diff options
608 files changed, 12346 insertions, 13862 deletions
diff --git a/Documentation/Changes b/Documentation/Changes index afebdbcd553a..dfec7569d450 100644 --- a/Documentation/Changes +++ b/Documentation/Changes | |||
@@ -57,7 +57,7 @@ o e2fsprogs 1.29 # tune2fs | |||
57 | o jfsutils 1.1.3 # fsck.jfs -V | 57 | o jfsutils 1.1.3 # fsck.jfs -V |
58 | o reiserfsprogs 3.6.3 # reiserfsck -V 2>&1|grep reiserfsprogs | 58 | o reiserfsprogs 3.6.3 # reiserfsck -V 2>&1|grep reiserfsprogs |
59 | o xfsprogs 2.6.0 # xfs_db -V | 59 | o xfsprogs 2.6.0 # xfs_db -V |
60 | o pcmciautils 001 | 60 | o pcmciautils 004 |
61 | o pcmcia-cs 3.1.21 # cardmgr -V | 61 | o pcmcia-cs 3.1.21 # cardmgr -V |
62 | o quota-tools 3.09 # quota -V | 62 | o quota-tools 3.09 # quota -V |
63 | o PPP 2.4.0 # pppd --version | 63 | o PPP 2.4.0 # pppd --version |
diff --git a/Documentation/DocBook/libata.tmpl b/Documentation/DocBook/libata.tmpl index 6df1dfd18b65..375ae760dc1e 100644 --- a/Documentation/DocBook/libata.tmpl +++ b/Documentation/DocBook/libata.tmpl | |||
@@ -84,6 +84,14 @@ void (*port_disable) (struct ata_port *); | |||
84 | Called from ata_bus_probe() and ata_bus_reset() error paths, | 84 | Called from ata_bus_probe() and ata_bus_reset() error paths, |
85 | as well as when unregistering from the SCSI module (rmmod, hot | 85 | as well as when unregistering from the SCSI module (rmmod, hot |
86 | unplug). | 86 | unplug). |
87 | This function should do whatever needs to be done to take the | ||
88 | port out of use. In most cases, ata_port_disable() can be used | ||
89 | as this hook. | ||
90 | </para> | ||
91 | <para> | ||
92 | Called from ata_bus_probe() on a failed probe. | ||
93 | Called from ata_bus_reset() on a failed bus reset. | ||
94 | Called from ata_scsi_release(). | ||
87 | </para> | 95 | </para> |
88 | 96 | ||
89 | </sect2> | 97 | </sect2> |
@@ -98,6 +106,13 @@ void (*dev_config) (struct ata_port *, struct ata_device *); | |||
98 | found. Typically used to apply device-specific fixups prior to | 106 | found. Typically used to apply device-specific fixups prior to |
99 | issue of SET FEATURES - XFER MODE, and prior to operation. | 107 | issue of SET FEATURES - XFER MODE, and prior to operation. |
100 | </para> | 108 | </para> |
109 | <para> | ||
110 | Called by ata_device_add() after ata_dev_identify() determines | ||
111 | a device is present. | ||
112 | </para> | ||
113 | <para> | ||
114 | This entry may be specified as NULL in ata_port_operations. | ||
115 | </para> | ||
101 | 116 | ||
102 | </sect2> | 117 | </sect2> |
103 | 118 | ||
@@ -135,6 +150,8 @@ void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); | |||
135 | registers / DMA buffers. ->tf_read() is called to read the | 150 | registers / DMA buffers. ->tf_read() is called to read the |
136 | hardware registers / DMA buffers, to obtain the current set of | 151 | hardware registers / DMA buffers, to obtain the current set of |
137 | taskfile register values. | 152 | taskfile register values. |
153 | Most drivers for taskfile-based hardware (PIO or MMIO) use | ||
154 | ata_tf_load() and ata_tf_read() for these hooks. | ||
138 | </para> | 155 | </para> |
139 | 156 | ||
140 | </sect2> | 157 | </sect2> |
@@ -147,6 +164,8 @@ void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf); | |||
147 | <para> | 164 | <para> |
148 | causes an ATA command, previously loaded with | 165 | causes an ATA command, previously loaded with |
149 | ->tf_load(), to be initiated in hardware. | 166 | ->tf_load(), to be initiated in hardware. |
167 | Most drivers for taskfile-based hardware use ata_exec_command() | ||
168 | for this hook. | ||
150 | </para> | 169 | </para> |
151 | 170 | ||
152 | </sect2> | 171 | </sect2> |
@@ -161,6 +180,10 @@ Allow low-level driver to filter ATA PACKET commands, returning a status | |||
161 | indicating whether or not it is OK to use DMA for the supplied PACKET | 180 | indicating whether or not it is OK to use DMA for the supplied PACKET |
162 | command. | 181 | command. |
163 | </para> | 182 | </para> |
183 | <para> | ||
184 | This hook may be specified as NULL, in which case libata will | ||
185 | assume that atapi dma can be supported. | ||
186 | </para> | ||
164 | 187 | ||
165 | </sect2> | 188 | </sect2> |
166 | 189 | ||
@@ -175,6 +198,14 @@ u8 (*check_err)(struct ata_port *ap); | |||
175 | Reads the Status/AltStatus/Error ATA shadow register from | 198 | Reads the Status/AltStatus/Error ATA shadow register from |
176 | hardware. On some hardware, reading the Status register has | 199 | hardware. On some hardware, reading the Status register has |
177 | the side effect of clearing the interrupt condition. | 200 | the side effect of clearing the interrupt condition. |
201 | Most drivers for taskfile-based hardware use | ||
202 | ata_check_status() for this hook. | ||
203 | </para> | ||
204 | <para> | ||
205 | Note that because this is called from ata_device_add(), at | ||
206 | least a dummy function that clears device interrupts must be | ||
207 | provided for all drivers, even if the controller doesn't | ||
208 | actually have a taskfile status register. | ||
178 | </para> | 209 | </para> |
179 | 210 | ||
180 | </sect2> | 211 | </sect2> |
@@ -188,7 +219,13 @@ void (*dev_select)(struct ata_port *ap, unsigned int device); | |||
188 | Issues the low-level hardware command(s) that causes one of N | 219 | Issues the low-level hardware command(s) that causes one of N |
189 | hardware devices to be considered 'selected' (active and | 220 | hardware devices to be considered 'selected' (active and |
190 | available for use) on the ATA bus. This generally has no | 221 | available for use) on the ATA bus. This generally has no |
191 | meaning on FIS-based devices. | 222 | meaning on FIS-based devices. |
223 | </para> | ||
224 | <para> | ||
225 | Most drivers for taskfile-based hardware use | ||
226 | ata_std_dev_select() for this hook. Controllers which do not | ||
227 | support second drives on a port (such as SATA contollers) will | ||
228 | use ata_noop_dev_select(). | ||
192 | </para> | 229 | </para> |
193 | 230 | ||
194 | </sect2> | 231 | </sect2> |
@@ -204,6 +241,8 @@ void (*phy_reset) (struct ata_port *ap); | |||
204 | for device presence (PATA and SATA), typically a soft reset | 241 | for device presence (PATA and SATA), typically a soft reset |
205 | (SRST) will be performed. Drivers typically use the helper | 242 | (SRST) will be performed. Drivers typically use the helper |
206 | functions ata_bus_reset() or sata_phy_reset() for this hook. | 243 | functions ata_bus_reset() or sata_phy_reset() for this hook. |
244 | Many SATA drivers use sata_phy_reset() or call it from within | ||
245 | their own phy_reset() functions. | ||
207 | </para> | 246 | </para> |
208 | 247 | ||
209 | </sect2> | 248 | </sect2> |
@@ -227,6 +266,25 @@ PCI IDE DMA Status register. | |||
227 | These hooks are typically either no-ops, or simply not implemented, in | 266 | These hooks are typically either no-ops, or simply not implemented, in |
228 | FIS-based drivers. | 267 | FIS-based drivers. |
229 | </para> | 268 | </para> |
269 | <para> | ||
270 | Most legacy IDE drivers use ata_bmdma_setup() for the bmdma_setup() | ||
271 | hook. ata_bmdma_setup() will write the pointer to the PRD table to | ||
272 | the IDE PRD Table Address register, enable DMA in the DMA Command | ||
273 | register, and call exec_command() to begin the transfer. | ||
274 | </para> | ||
275 | <para> | ||
276 | Most legacy IDE drivers use ata_bmdma_start() for the bmdma_start() | ||
277 | hook. ata_bmdma_start() will write the ATA_DMA_START flag to the DMA | ||
278 | Command register. | ||
279 | </para> | ||
280 | <para> | ||
281 | Many legacy IDE drivers use ata_bmdma_stop() for the bmdma_stop() | ||
282 | hook. ata_bmdma_stop() clears the ATA_DMA_START flag in the DMA | ||
283 | command register. | ||
284 | </para> | ||
285 | <para> | ||
286 | Many legacy IDE drivers use ata_bmdma_status() as the bmdma_status() hook. | ||
287 | </para> | ||
230 | 288 | ||
231 | </sect2> | 289 | </sect2> |
232 | 290 | ||
@@ -250,6 +308,10 @@ int (*qc_issue) (struct ata_queued_cmd *qc); | |||
250 | helper function ata_qc_issue_prot() for taskfile protocol-based | 308 | helper function ata_qc_issue_prot() for taskfile protocol-based |
251 | dispatch. More advanced drivers implement their own ->qc_issue. | 309 | dispatch. More advanced drivers implement their own ->qc_issue. |
252 | </para> | 310 | </para> |
311 | <para> | ||
312 | ata_qc_issue_prot() calls ->tf_load(), ->bmdma_setup(), and | ||
313 | ->bmdma_start() as necessary to initiate a transfer. | ||
314 | </para> | ||
253 | 315 | ||
254 | </sect2> | 316 | </sect2> |
255 | 317 | ||
@@ -279,6 +341,21 @@ void (*irq_clear) (struct ata_port *); | |||
279 | before the interrupt handler is registered, to be sure hardware | 341 | before the interrupt handler is registered, to be sure hardware |
280 | is quiet. | 342 | is quiet. |
281 | </para> | 343 | </para> |
344 | <para> | ||
345 | The second argument, dev_instance, should be cast to a pointer | ||
346 | to struct ata_host_set. | ||
347 | </para> | ||
348 | <para> | ||
349 | Most legacy IDE drivers use ata_interrupt() for the | ||
350 | irq_handler hook, which scans all ports in the host_set, | ||
351 | determines which queued command was active (if any), and calls | ||
352 | ata_host_intr(ap,qc). | ||
353 | </para> | ||
354 | <para> | ||
355 | Most legacy IDE drivers use ata_bmdma_irq_clear() for the | ||
356 | irq_clear() hook, which simply clears the interrupt and error | ||
357 | flags in the DMA status register. | ||
358 | </para> | ||
282 | 359 | ||
283 | </sect2> | 360 | </sect2> |
284 | 361 | ||
@@ -292,6 +369,7 @@ void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, | |||
292 | <para> | 369 | <para> |
293 | Read and write standard SATA phy registers. Currently only used | 370 | Read and write standard SATA phy registers. Currently only used |
294 | if ->phy_reset hook called the sata_phy_reset() helper function. | 371 | if ->phy_reset hook called the sata_phy_reset() helper function. |
372 | sc_reg is one of SCR_STATUS, SCR_CONTROL, SCR_ERROR, or SCR_ACTIVE. | ||
295 | </para> | 373 | </para> |
296 | 374 | ||
297 | </sect2> | 375 | </sect2> |
@@ -307,17 +385,29 @@ void (*host_stop) (struct ata_host_set *host_set); | |||
307 | ->port_start() is called just after the data structures for each | 385 | ->port_start() is called just after the data structures for each |
308 | port are initialized. Typically this is used to alloc per-port | 386 | port are initialized. Typically this is used to alloc per-port |
309 | DMA buffers / tables / rings, enable DMA engines, and similar | 387 | DMA buffers / tables / rings, enable DMA engines, and similar |
310 | tasks. | 388 | tasks. Some drivers also use this entry point as a chance to |
389 | allocate driver-private memory for ap->private_data. | ||
390 | </para> | ||
391 | <para> | ||
392 | Many drivers use ata_port_start() as this hook or call | ||
393 | it from their own port_start() hooks. ata_port_start() | ||
394 | allocates space for a legacy IDE PRD table and returns. | ||
311 | </para> | 395 | </para> |
312 | <para> | 396 | <para> |
313 | ->port_stop() is called after ->host_stop(). It's sole function | 397 | ->port_stop() is called after ->host_stop(). It's sole function |
314 | is to release DMA/memory resources, now that they are no longer | 398 | is to release DMA/memory resources, now that they are no longer |
315 | actively being used. | 399 | actively being used. Many drivers also free driver-private |
400 | data from port at this time. | ||
401 | </para> | ||
402 | <para> | ||
403 | Many drivers use ata_port_stop() as this hook, which frees the | ||
404 | PRD table. | ||
316 | </para> | 405 | </para> |
317 | <para> | 406 | <para> |
318 | ->host_stop() is called after all ->port_stop() calls | 407 | ->host_stop() is called after all ->port_stop() calls |
319 | have completed. The hook must finalize hardware shutdown, release DMA | 408 | have completed. The hook must finalize hardware shutdown, release DMA |
320 | and other resources, etc. | 409 | and other resources, etc. |
410 | This hook may be specified as NULL, in which case it is not called. | ||
321 | </para> | 411 | </para> |
322 | 412 | ||
323 | </sect2> | 413 | </sect2> |
diff --git a/Documentation/SubmittingDrivers b/Documentation/SubmittingDrivers index de3b252e717d..c3cca924e94b 100644 --- a/Documentation/SubmittingDrivers +++ b/Documentation/SubmittingDrivers | |||
@@ -13,13 +13,14 @@ Allocating Device Numbers | |||
13 | ------------------------- | 13 | ------------------------- |
14 | 14 | ||
15 | Major and minor numbers for block and character devices are allocated | 15 | Major and minor numbers for block and character devices are allocated |
16 | by the Linux assigned name and number authority (currently better | 16 | by the Linux assigned name and number authority (currently this is |
17 | known as H Peter Anvin). The site is http://www.lanana.org/. This | 17 | Torben Mathiasen). The site is http://www.lanana.org/. This |
18 | also deals with allocating numbers for devices that are not going to | 18 | also deals with allocating numbers for devices that are not going to |
19 | be submitted to the mainstream kernel. | 19 | be submitted to the mainstream kernel. |
20 | See Documentation/devices.txt for more information on this. | ||
20 | 21 | ||
21 | If you don't use assigned numbers then when you device is submitted it will | 22 | If you don't use assigned numbers then when your device is submitted it will |
22 | get given an assigned number even if that is different from values you may | 23 | be given an assigned number even if that is different from values you may |
23 | have shipped to customers before. | 24 | have shipped to customers before. |
24 | 25 | ||
25 | Who To Submit Drivers To | 26 | Who To Submit Drivers To |
@@ -32,7 +33,8 @@ Linux 2.2: | |||
32 | If the code area has a general maintainer then please submit it to | 33 | If the code area has a general maintainer then please submit it to |
33 | the maintainer listed in MAINTAINERS in the kernel file. If the | 34 | the maintainer listed in MAINTAINERS in the kernel file. If the |
34 | maintainer does not respond or you cannot find the appropriate | 35 | maintainer does not respond or you cannot find the appropriate |
35 | maintainer then please contact Alan Cox <alan@lxorguk.ukuu.org.uk> | 36 | maintainer then please contact the 2.2 kernel maintainer: |
37 | Marc-Christian Petersen <m.c.p@wolk-project.de>. | ||
36 | 38 | ||
37 | Linux 2.4: | 39 | Linux 2.4: |
38 | The same rules apply as 2.2. The final contact point for Linux 2.4 | 40 | The same rules apply as 2.2. The final contact point for Linux 2.4 |
@@ -48,7 +50,7 @@ What Criteria Determine Acceptance | |||
48 | 50 | ||
49 | Licensing: The code must be released to us under the | 51 | Licensing: The code must be released to us under the |
50 | GNU General Public License. We don't insist on any kind | 52 | GNU General Public License. We don't insist on any kind |
51 | of exclusively GPL licensing, and if you wish the driver | 53 | of exclusive GPL licensing, and if you wish the driver |
52 | to be useful to other communities such as BSD you may well | 54 | to be useful to other communities such as BSD you may well |
53 | wish to release under multiple licenses. | 55 | wish to release under multiple licenses. |
54 | 56 | ||
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index 4d1f41b84ebc..6761a7b241a5 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches | |||
@@ -35,7 +35,7 @@ not in any lower subdirectory. | |||
35 | 35 | ||
36 | To create a patch for a single file, it is often sufficient to do: | 36 | To create a patch for a single file, it is often sufficient to do: |
37 | 37 | ||
38 | SRCTREE= linux-2.4 | 38 | SRCTREE= linux-2.6 |
39 | MYFILE= drivers/net/mydriver.c | 39 | MYFILE= drivers/net/mydriver.c |
40 | 40 | ||
41 | cd $SRCTREE | 41 | cd $SRCTREE |
@@ -48,17 +48,18 @@ To create a patch for multiple files, you should unpack a "vanilla", | |||
48 | or unmodified kernel source tree, and generate a diff against your | 48 | or unmodified kernel source tree, and generate a diff against your |
49 | own source tree. For example: | 49 | own source tree. For example: |
50 | 50 | ||
51 | MYSRC= /devel/linux-2.4 | 51 | MYSRC= /devel/linux-2.6 |
52 | 52 | ||
53 | tar xvfz linux-2.4.0-test11.tar.gz | 53 | tar xvfz linux-2.6.12.tar.gz |
54 | mv linux linux-vanilla | 54 | mv linux-2.6.12 linux-2.6.12-vanilla |
55 | wget http://www.moses.uklinux.net/patches/dontdiff | 55 | diff -uprN -X linux-2.6.12-vanilla/Documentation/dontdiff \ |
56 | diff -uprN -X dontdiff linux-vanilla $MYSRC > /tmp/patch | 56 | linux-2.6.12-vanilla $MYSRC > /tmp/patch |
57 | rm -f dontdiff | ||
58 | 57 | ||
59 | "dontdiff" is a list of files which are generated by the kernel during | 58 | "dontdiff" is a list of files which are generated by the kernel during |
60 | the build process, and should be ignored in any diff(1)-generated | 59 | the build process, and should be ignored in any diff(1)-generated |
61 | patch. dontdiff is maintained by Tigran Aivazian <tigran@veritas.com> | 60 | patch. The "dontdiff" file is included in the kernel tree in |
61 | 2.6.12 and later. For earlier kernel versions, you can get it | ||
62 | from <http://www.xenotime.net/linux/doc/dontdiff>. | ||
62 | 63 | ||
63 | Make sure your patch does not include any extra files which do not | 64 | Make sure your patch does not include any extra files which do not |
64 | belong in a patch submission. Make sure to review your patch -after- | 65 | belong in a patch submission. Make sure to review your patch -after- |
@@ -66,18 +67,20 @@ generated it with diff(1), to ensure accuracy. | |||
66 | 67 | ||
67 | If your changes produce a lot of deltas, you may want to look into | 68 | If your changes produce a lot of deltas, you may want to look into |
68 | splitting them into individual patches which modify things in | 69 | splitting them into individual patches which modify things in |
69 | logical stages, this will facilitate easier reviewing by other | 70 | logical stages. This will facilitate easier reviewing by other |
70 | kernel developers, very important if you want your patch accepted. | 71 | kernel developers, very important if you want your patch accepted. |
71 | There are a number of scripts which can aid in this; | 72 | There are a number of scripts which can aid in this: |
72 | 73 | ||
73 | Quilt: | 74 | Quilt: |
74 | http://savannah.nongnu.org/projects/quilt | 75 | http://savannah.nongnu.org/projects/quilt |
75 | 76 | ||
76 | Randy Dunlap's patch scripts: | 77 | Randy Dunlap's patch scripts: |
77 | http://developer.osdl.org/rddunlap/scripts/patching-scripts.tgz | 78 | http://www.xenotime.net/linux/scripts/patching-scripts-002.tar.gz |
78 | 79 | ||
79 | Andrew Morton's patch scripts: | 80 | Andrew Morton's patch scripts: |
80 | http://www.zip.com.au/~akpm/linux/patches/patch-scripts-0.16 | 81 | http://www.zip.com.au/~akpm/linux/patches/patch-scripts-0.20 |
82 | |||
83 | |||
81 | 84 | ||
82 | 2) Describe your changes. | 85 | 2) Describe your changes. |
83 | 86 | ||
@@ -163,6 +166,8 @@ patches. Trivial patches must qualify for one of the following rules: | |||
163 | since people copy, as long as it's trivial) | 166 | since people copy, as long as it's trivial) |
164 | Any fix by the author/maintainer of the file. (ie. patch monkey | 167 | Any fix by the author/maintainer of the file. (ie. patch monkey |
165 | in re-transmission mode) | 168 | in re-transmission mode) |
169 | URL: <http://www.kernel.org/pub/linux/kernel/people/rusty/trivial/> | ||
170 | |||
166 | 171 | ||
167 | 172 | ||
168 | 173 | ||
@@ -291,6 +296,17 @@ now, but you can do this to mark internal company procedures or just | |||
291 | point out some special detail about the sign-off. | 296 | point out some special detail about the sign-off. |
292 | 297 | ||
293 | 298 | ||
299 | |||
300 | 12) More references for submitting patches | ||
301 | |||
302 | Andrew Morton, "The perfect patch" (tpp). | ||
303 | <http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt> | ||
304 | |||
305 | Jeff Garzik, "Linux kernel patch submission format." | ||
306 | <http://linux.yyz.us/patch-format.html> | ||
307 | |||
308 | |||
309 | |||
294 | ----------------------------------- | 310 | ----------------------------------- |
295 | SECTION 2 - HINTS, TIPS, AND TRICKS | 311 | SECTION 2 - HINTS, TIPS, AND TRICKS |
296 | ----------------------------------- | 312 | ----------------------------------- |
@@ -359,7 +375,5 @@ and 'extern __inline__'. | |||
359 | 4) Don't over-design. | 375 | 4) Don't over-design. |
360 | 376 | ||
361 | Don't try to anticipate nebulous future cases which may or may not | 377 | Don't try to anticipate nebulous future cases which may or may not |
362 | be useful: "Make it as simple as you can, and no simpler" | 378 | be useful: "Make it as simple as you can, and no simpler." |
363 | |||
364 | |||
365 | 379 | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 89cd417651e0..4ec75c06bca4 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -622,6 +622,17 @@ running once the system is up. | |||
622 | ips= [HW,SCSI] Adaptec / IBM ServeRAID controller | 622 | ips= [HW,SCSI] Adaptec / IBM ServeRAID controller |
623 | See header of drivers/scsi/ips.c. | 623 | See header of drivers/scsi/ips.c. |
624 | 624 | ||
625 | irqfixup [HW] | ||
626 | When an interrupt is not handled search all handlers | ||
627 | for it. Intended to get systems with badly broken | ||
628 | firmware running. | ||
629 | |||
630 | irqpoll [HW] | ||
631 | When an interrupt is not handled search all handlers | ||
632 | for it. Also check all handlers each timer | ||
633 | interrupt. Intended to get systems with badly broken | ||
634 | firmware running. | ||
635 | |||
625 | isapnp= [ISAPNP] | 636 | isapnp= [ISAPNP] |
626 | Format: <RDP>, <reset>, <pci_scan>, <verbosity> | 637 | Format: <RDP>, <reset>, <pci_scan>, <verbosity> |
627 | 638 | ||
@@ -1030,6 +1041,10 @@ running once the system is up. | |||
1030 | irqmask=0xMMMM [IA-32] Set a bit mask of IRQs allowed to be assigned | 1041 | irqmask=0xMMMM [IA-32] Set a bit mask of IRQs allowed to be assigned |
1031 | automatically to PCI devices. You can make the kernel | 1042 | automatically to PCI devices. You can make the kernel |
1032 | exclude IRQs of your ISA cards this way. | 1043 | exclude IRQs of your ISA cards this way. |
1044 | pirqaddr=0xAAAAA [IA-32] Specify the physical address | ||
1045 | of the PIRQ table (normally generated | ||
1046 | by the BIOS) if it is outside the | ||
1047 | F0000h-100000h range. | ||
1033 | lastbus=N [IA-32] Scan all buses till bus #N. Can be useful | 1048 | lastbus=N [IA-32] Scan all buses till bus #N. Can be useful |
1034 | if the kernel is unable to find your secondary buses | 1049 | if the kernel is unable to find your secondary buses |
1035 | and you want to tell it explicitly which ones they are. | 1050 | and you want to tell it explicitly which ones they are. |
diff --git a/Documentation/networking/fib_trie.txt b/Documentation/networking/fib_trie.txt new file mode 100644 index 000000000000..f50d0c673c57 --- /dev/null +++ b/Documentation/networking/fib_trie.txt | |||
@@ -0,0 +1,145 @@ | |||
1 | LC-trie implementation notes. | ||
2 | |||
3 | Node types | ||
4 | ---------- | ||
5 | leaf | ||
6 | An end node with data. This has a copy of the relevant key, along | ||
7 | with 'hlist' with routing table entries sorted by prefix length. | ||
8 | See struct leaf and struct leaf_info. | ||
9 | |||
10 | trie node or tnode | ||
11 | An internal node, holding an array of child (leaf or tnode) pointers, | ||
12 | indexed through a subset of the key. See Level Compression. | ||
13 | |||
14 | A few concepts explained | ||
15 | ------------------------ | ||
16 | Bits (tnode) | ||
17 | The number of bits in the key segment used for indexing into the | ||
18 | child array - the "child index". See Level Compression. | ||
19 | |||
20 | Pos (tnode) | ||
21 | The position (in the key) of the key segment used for indexing into | ||
22 | the child array. See Path Compression. | ||
23 | |||
24 | Path Compression / skipped bits | ||
25 | Any given tnode is linked to from the child array of its parent, using | ||
26 | a segment of the key specified by the parent's "pos" and "bits" | ||
27 | In certain cases, this tnode's own "pos" will not be immediately | ||
28 | adjacent to the parent (pos+bits), but there will be some bits | ||
29 | in the key skipped over because they represent a single path with no | ||
30 | deviations. These "skipped bits" constitute Path Compression. | ||
31 | Note that the search algorithm will simply skip over these bits when | ||
32 | searching, making it necessary to save the keys in the leaves to | ||
33 | verify that they actually do match the key we are searching for. | ||
34 | |||
35 | Level Compression / child arrays | ||
36 | the trie is kept level balanced moving, under certain conditions, the | ||
37 | children of a full child (see "full_children") up one level, so that | ||
38 | instead of a pure binary tree, each internal node ("tnode") may | ||
39 | contain an arbitrarily large array of links to several children. | ||
40 | Conversely, a tnode with a mostly empty child array (see empty_children) | ||
41 | may be "halved", having some of its children moved downwards one level, | ||
42 | in order to avoid ever-increasing child arrays. | ||
43 | |||
44 | empty_children | ||
45 | the number of positions in the child array of a given tnode that are | ||
46 | NULL. | ||
47 | |||
48 | full_children | ||
49 | the number of children of a given tnode that aren't path compressed. | ||
50 | (in other words, they aren't NULL or leaves and their "pos" is equal | ||
51 | to this tnode's "pos"+"bits"). | ||
52 | |||
53 | (The word "full" here is used more in the sense of "complete" than | ||
54 | as the opposite of "empty", which might be a tad confusing.) | ||
55 | |||
56 | Comments | ||
57 | --------- | ||
58 | |||
59 | We have tried to keep the structure of the code as close to fib_hash as | ||
60 | possible to allow verification and help up reviewing. | ||
61 | |||
62 | fib_find_node() | ||
63 | A good start for understanding this code. This function implements a | ||
64 | straightforward trie lookup. | ||
65 | |||
66 | fib_insert_node() | ||
67 | Inserts a new leaf node in the trie. This is bit more complicated than | ||
68 | fib_find_node(). Inserting a new node means we might have to run the | ||
69 | level compression algorithm on part of the trie. | ||
70 | |||
71 | trie_leaf_remove() | ||
72 | Looks up a key, deletes it and runs the level compression algorithm. | ||
73 | |||
74 | trie_rebalance() | ||
75 | The key function for the dynamic trie after any change in the trie | ||
76 | it is run to optimize and reorganize. Tt will walk the trie upwards | ||
77 | towards the root from a given tnode, doing a resize() at each step | ||
78 | to implement level compression. | ||
79 | |||
80 | resize() | ||
81 | Analyzes a tnode and optimizes the child array size by either inflating | ||
82 | or shrinking it repeatedly until it fullfills the criteria for optimal | ||
83 | level compression. This part follows the original paper pretty closely | ||
84 | and there may be some room for experimentation here. | ||
85 | |||
86 | inflate() | ||
87 | Doubles the size of the child array within a tnode. Used by resize(). | ||
88 | |||
89 | halve() | ||
90 | Halves the size of the child array within a tnode - the inverse of | ||
91 | inflate(). Used by resize(); | ||
92 | |||
93 | fn_trie_insert(), fn_trie_delete(), fn_trie_select_default() | ||
94 | The route manipulation functions. Should conform pretty closely to the | ||
95 | corresponding functions in fib_hash. | ||
96 | |||
97 | fn_trie_flush() | ||
98 | This walks the full trie (using nextleaf()) and searches for empty | ||
99 | leaves which have to be removed. | ||
100 | |||
101 | fn_trie_dump() | ||
102 | Dumps the routing table ordered by prefix length. This is somewhat | ||
103 | slower than the corresponding fib_hash function, as we have to walk the | ||
104 | entire trie for each prefix length. In comparison, fib_hash is organized | ||
105 | as one "zone"/hash per prefix length. | ||
106 | |||
107 | Locking | ||
108 | ------- | ||
109 | |||
110 | fib_lock is used for an RW-lock in the same way that this is done in fib_hash. | ||
111 | However, the functions are somewhat separated for other possible locking | ||
112 | scenarios. It might conceivably be possible to run trie_rebalance via RCU | ||
113 | to avoid read_lock in the fn_trie_lookup() function. | ||
114 | |||
115 | Main lookup mechanism | ||
116 | --------------------- | ||
117 | fn_trie_lookup() is the main lookup function. | ||
118 | |||
119 | The lookup is in its simplest form just like fib_find_node(). We descend the | ||
120 | trie, key segment by key segment, until we find a leaf. check_leaf() does | ||
121 | the fib_semantic_match in the leaf's sorted prefix hlist. | ||
122 | |||
123 | If we find a match, we are done. | ||
124 | |||
125 | If we don't find a match, we enter prefix matching mode. The prefix length, | ||
126 | starting out at the same as the key length, is reduced one step at a time, | ||
127 | and we backtrack upwards through the trie trying to find a longest matching | ||
128 | prefix. The goal is always to reach a leaf and get a positive result from the | ||
129 | fib_semantic_match mechanism. | ||
130 | |||
131 | Inside each tnode, the search for longest matching prefix consists of searching | ||
132 | through the child array, chopping off (zeroing) the least significant "1" of | ||
133 | the child index until we find a match or the child index consists of nothing but | ||
134 | zeros. | ||
135 | |||
136 | At this point we backtrack (t->stats.backtrack++) up the trie, continuing to | ||
137 | chop off part of the key in order to find the longest matching prefix. | ||
138 | |||
139 | At this point we will repeatedly descend subtries to look for a match, and there | ||
140 | are some optimizations available that can provide us with "shortcuts" to avoid | ||
141 | descending into dead ends. Look for "HL_OPTIMIZE" sections in the code. | ||
142 | |||
143 | To alleviate any doubts about the correctness of the route selection process, | ||
144 | a new netlink operation has been added. Look for NETLINK_FIB_LOOKUP, which | ||
145 | gives userland access to fib_lookup(). | ||
diff --git a/Documentation/pcmcia/devicetable.txt b/Documentation/pcmcia/devicetable.txt index 045511acafc9..3351c0355143 100644 --- a/Documentation/pcmcia/devicetable.txt +++ b/Documentation/pcmcia/devicetable.txt | |||
@@ -19,9 +19,8 @@ PCMCIA_DEVICE_PROD_ID1("some_string", 0x(hash_of_some_string)), | |||
19 | If the hash is incorrect, the kernel will inform you about this in "dmesg" | 19 | If the hash is incorrect, the kernel will inform you about this in "dmesg" |
20 | upon module initialization, and tell you of the correct hash. | 20 | upon module initialization, and tell you of the correct hash. |
21 | 21 | ||
22 | You can determine the hash of the product ID strings by running | 22 | You can determine the hash of the product ID strings by catting the file |
23 | "pcmcia-modalias %n.%m" [%n being replaced with the socket number and %m being | 23 | "modalias" in the sysfs directory of the PCMCIA device. It generates a string |
24 | replaced with the device function] from pcmciautils. It generates a string | ||
25 | in the following form: | 24 | in the following form: |
26 | pcmcia:m0149cC1ABf06pfn00fn00pa725B842DpbF1EFEE84pc0877B627pd00000000 | 25 | pcmcia:m0149cC1ABf06pfn00fn00pa725B842DpbF1EFEE84pc0877B627pd00000000 |
27 | 26 | ||
diff --git a/Documentation/serial/driver b/Documentation/serial/driver index e9c0178cd202..ac7eabbf662a 100644 --- a/Documentation/serial/driver +++ b/Documentation/serial/driver | |||
@@ -107,8 +107,8 @@ hardware. | |||
107 | indicate that the signal is permanently active. If RI is | 107 | indicate that the signal is permanently active. If RI is |
108 | not available, the signal should not be indicated as active. | 108 | not available, the signal should not be indicated as active. |
109 | 109 | ||
110 | Locking: none. | 110 | Locking: port->lock taken. |
111 | Interrupts: caller dependent. | 111 | Interrupts: locally disabled. |
112 | This call must not sleep | 112 | This call must not sleep |
113 | 113 | ||
114 | stop_tx(port,tty_stop) | 114 | stop_tx(port,tty_stop) |
diff --git a/Documentation/video4linux/API.html b/Documentation/video4linux/API.html index 4b3d8f640a4a..441407b12a9f 100644 --- a/Documentation/video4linux/API.html +++ b/Documentation/video4linux/API.html | |||
@@ -1,399 +1,16 @@ | |||
1 | <HTML><HEAD> | 1 | <TITLE>V4L API</TITLE> |
2 | <TITLE>Video4Linux Kernel API Reference v0.1:19990430</TITLE> | 2 | <H1>Video For Linux APIs</H1> |
3 | </HEAD> | 3 | <table border=0> |
4 | <! Revision History: > | 4 | <tr> |
5 | <! 4/30/1999 - Fred Gleason (fredg@wava.com)> | 5 | <td> |
6 | <! Documented extensions for the Radio Data System (RDS) extensions > | 6 | <A HREF=http://www.linuxtv.org/downloads/video4linux/API/V4L1_API.html> |
7 | <BODY bgcolor="#ffffff"> | 7 | V4L original API</a> |
8 | <H3>Devices</H3> | 8 | </td><td> |
9 | Video4Linux provides the following sets of device files. These live on the | 9 | Obsoleted by V4L2 API |
10 | character device formerly known as "/dev/bttv". /dev/bttv should be a | 10 | </td></tr><tr><td> |
11 | symlink to /dev/video0 for most people. | 11 | <A HREF=http://www.linuxtv.org/downloads/video4linux/API/V4L2_API.html> |
12 | <P> | 12 | V4L2 API</a> |
13 | <TABLE> | 13 | </td><td> |
14 | <TR><TH>Device Name</TH><TH>Minor Range</TH><TH>Function</TH> | 14 | Should be used for new projects |
15 | <TR><TD>/dev/video</TD><TD>0-63</TD><TD>Video Capture Interface</TD> | 15 | </td></tr> |
16 | <TR><TD>/dev/radio</TD><TD>64-127</TD><TD>AM/FM Radio Devices</TD> | 16 | </table> |
17 | <TR><TD>/dev/vtx</TD><TD>192-223</TD><TD>Teletext Interface Chips</TD> | ||
18 | <TR><TD>/dev/vbi</TD><TD>224-239</TD><TD>Raw VBI Data (Intercast/teletext)</TD> | ||
19 | </TABLE> | ||
20 | <P> | ||
21 | Video4Linux programs open and scan the devices to find what they are looking | ||
22 | for. Capability queries define what each interface supports. The | ||
23 | described API is only defined for video capture cards. The relevant subset | ||
24 | applies to radio cards. Teletext interfaces talk the existing VTX API. | ||
25 | <P> | ||
26 | <H3>Capability Query Ioctl</H3> | ||
27 | The <B>VIDIOCGCAP</B> ioctl call is used to obtain the capability | ||
28 | information for a video device. The <b>struct video_capability</b> object | ||
29 | passed to the ioctl is completed and returned. It contains the following | ||
30 | information | ||
31 | <P> | ||
32 | <TABLE> | ||
33 | <TR><TD><b>name[32]</b><TD>Canonical name for this interface</TD> | ||
34 | <TR><TD><b>type</b><TD>Type of interface</TD> | ||
35 | <TR><TD><b>channels</b><TD>Number of radio/tv channels if appropriate</TD> | ||
36 | <TR><TD><b>audios</b><TD>Number of audio devices if appropriate</TD> | ||
37 | <TR><TD><b>maxwidth</b><TD>Maximum capture width in pixels</TD> | ||
38 | <TR><TD><b>maxheight</b><TD>Maximum capture height in pixels</TD> | ||
39 | <TR><TD><b>minwidth</b><TD>Minimum capture width in pixels</TD> | ||
40 | <TR><TD><b>minheight</b><TD>Minimum capture height in pixels</TD> | ||
41 | </TABLE> | ||
42 | <P> | ||
43 | The type field lists the capability flags for the device. These are | ||
44 | as follows | ||
45 | <P> | ||
46 | <TABLE> | ||
47 | <TR><TH>Name</TH><TH>Description</TH> | ||
48 | <TR><TD><b>VID_TYPE_CAPTURE</b><TD>Can capture to memory</TD> | ||
49 | <TR><TD><b>VID_TYPE_TUNER</b><TD>Has a tuner of some form</TD> | ||
50 | <TR><TD><b>VID_TYPE_TELETEXT</b><TD>Has teletext capability</TD> | ||
51 | <TR><TD><b>VID_TYPE_OVERLAY</b><TD>Can overlay its image onto the frame buffer</TD> | ||
52 | <TR><TD><b>VID_TYPE_CHROMAKEY</b><TD>Overlay is Chromakeyed</TD> | ||
53 | <TR><TD><b>VID_TYPE_CLIPPING</b><TD>Overlay clipping is supported</TD> | ||
54 | <TR><TD><b>VID_TYPE_FRAMERAM</b><TD>Overlay overwrites frame buffer memory</TD> | ||
55 | <TR><TD><b>VID_TYPE_SCALES</b><TD>The hardware supports image scaling</TD> | ||
56 | <TR><TD><b>VID_TYPE_MONOCHROME</b><TD>Image capture is grey scale only</TD> | ||
57 | <TR><TD><b>VID_TYPE_SUBCAPTURE</b><TD>Capture can be of only part of the image</TD> | ||
58 | </TABLE> | ||
59 | <P> | ||
60 | The minimum and maximum sizes listed for a capture device do not imply all | ||
61 | that all height/width ratios or sizes within the range are possible. A | ||
62 | request to set a size will be honoured by the largest available capture | ||
63 | size whose capture is no large than the requested rectangle in either | ||
64 | direction. For example the quickcam has 3 fixed settings. | ||
65 | <P> | ||
66 | <H3>Frame Buffer</H3> | ||
67 | Capture cards that drop data directly onto the frame buffer must be told the | ||
68 | base address of the frame buffer, its size and organisation. This is a | ||
69 | privileged ioctl and one that eventually X itself should set. | ||
70 | <P> | ||
71 | The <b>VIDIOCSFBUF</b> ioctl sets the frame buffer parameters for a capture | ||
72 | card. If the card does not do direct writes to the frame buffer then this | ||
73 | ioctl will be unsupported. The <b>VIDIOCGFBUF</b> ioctl returns the | ||
74 | currently used parameters. The structure used in both cases is a | ||
75 | <b>struct video_buffer</b>. | ||
76 | <P> | ||
77 | <TABLE> | ||
78 | <TR><TD><b>void *base</b></TD><TD>Base physical address of the buffer</TD> | ||
79 | <TR><TD><b>int height</b></TD><TD>Height of the frame buffer</TD> | ||
80 | <TR><TD><b>int width</b></TD><TD>Width of the frame buffer</TD> | ||
81 | <TR><TD><b>int depth</b></TD><TD>Depth of the frame buffer</TD> | ||
82 | <TR><TD><b>int bytesperline</b></TD><TD>Number of bytes of memory between the start of two adjacent lines</TD> | ||
83 | </TABLE> | ||
84 | <P> | ||
85 | Note that these values reflect the physical layout of the frame buffer. | ||
86 | The visible area may be smaller. In fact under XFree86 this is commonly the | ||
87 | case. XFree86 DGA can provide the parameters required to set up this ioctl. | ||
88 | Setting the base address to NULL indicates there is no physical frame buffer | ||
89 | access. | ||
90 | <P> | ||
91 | <H3>Capture Windows</H3> | ||
92 | The capture area is described by a <b>struct video_window</b>. This defines | ||
93 | a capture area and the clipping information if relevant. The | ||
94 | <b>VIDIOCGWIN</b> ioctl recovers the current settings and the | ||
95 | <b>VIDIOCSWIN</b> sets new values. A successful call to <b>VIDIOCSWIN</b> | ||
96 | indicates that a suitable set of parameters have been chosen. They do not | ||
97 | indicate that exactly what was requested was granted. The program should | ||
98 | call <b>VIDIOCGWIN</b> to check if the nearest match was suitable. The | ||
99 | <b>struct video_window</b> contains the following fields. | ||
100 | <P> | ||
101 | <TABLE> | ||
102 | <TR><TD><b>x</b><TD>The X co-ordinate specified in X windows format.</TD> | ||
103 | <TR><TD><b>y</b><TD>The Y co-ordinate specified in X windows format.</TD> | ||
104 | <TR><TD><b>width</b><TD>The width of the image capture.</TD> | ||
105 | <TR><TD><b>height</b><TD>The height of the image capture.</TD> | ||
106 | <TR><TD><b>chromakey</b><TD>A host order RGB32 value for the chroma key.</TD> | ||
107 | <TR><TD><b>flags</b><TD>Additional capture flags.</TD> | ||
108 | <TR><TD><b>clips</b><TD>A list of clipping rectangles. <em>(Set only)</em></TD> | ||
109 | <TR><TD><b>clipcount</b><TD>The number of clipping rectangles. <em>(Set only)</em></TD> | ||
110 | </TABLE> | ||
111 | <P> | ||
112 | Clipping rectangles are passed as an array. Each clip consists of the following | ||
113 | fields available to the user. | ||
114 | <P> | ||
115 | <TABLE> | ||
116 | <TR><TD><b>x</b></TD><TD>X co-ordinate of rectangle to skip</TD> | ||
117 | <TR><TD><b>y</b></TD><TD>Y co-ordinate of rectangle to skip</TD> | ||
118 | <TR><TD><b>width</b></TD><TD>Width of rectangle to skip</TD> | ||
119 | <TR><TD><b>height</b></TD><TD>Height of rectangle to skip</TD> | ||
120 | </TABLE> | ||
121 | <P> | ||
122 | Merely setting the window does not enable capturing. Overlay capturing | ||
123 | (i.e. PCI-PCI transfer to the frame buffer of the video card) | ||
124 | is activated by passing the <b>VIDIOCCAPTURE</b> ioctl a value of 1, and | ||
125 | disabled by passing it a value of 0. | ||
126 | <P> | ||
127 | Some capture devices can capture a subfield of the image they actually see. | ||
128 | This is indicated when VIDEO_TYPE_SUBCAPTURE is defined. | ||
129 | The video_capture describes the time and special subfields to capture. | ||
130 | The video_capture structure contains the following fields. | ||
131 | <P> | ||
132 | <TABLE> | ||
133 | <TR><TD><b>x</b></TD><TD>X co-ordinate of source rectangle to grab</TD> | ||
134 | <TR><TD><b>y</b></TD><TD>Y co-ordinate of source rectangle to grab</TD> | ||
135 | <TR><TD><b>width</b></TD><TD>Width of source rectangle to grab</TD> | ||
136 | <TR><TD><b>height</b></TD><TD>Height of source rectangle to grab</TD> | ||
137 | <TR><TD><b>decimation</b></TD><TD>Decimation to apply</TD> | ||
138 | <TR><TD><b>flags</b></TD><TD>Flag settings for grabbing</TD> | ||
139 | </TABLE> | ||
140 | The available flags are | ||
141 | <P> | ||
142 | <TABLE> | ||
143 | <TR><TH>Name</TH><TH>Description</TH> | ||
144 | <TR><TD><b>VIDEO_CAPTURE_ODD</b><TD>Capture only odd frames</TD> | ||
145 | <TR><TD><b>VIDEO_CAPTURE_EVEN</b><TD>Capture only even frames</TD> | ||
146 | </TABLE> | ||
147 | <P> | ||
148 | <H3>Video Sources</H3> | ||
149 | Each video4linux video or audio device captures from one or more | ||
150 | source <b>channels</b>. Each channel can be queries with the | ||
151 | <b>VDIOCGCHAN</b> ioctl call. Before invoking this function the caller | ||
152 | must set the channel field to the channel that is being queried. On return | ||
153 | the <b>struct video_channel</b> is filled in with information about the | ||
154 | nature of the channel itself. | ||
155 | <P> | ||
156 | The <b>VIDIOCSCHAN</b> ioctl takes an integer argument and switches the | ||
157 | capture to this input. It is not defined whether parameters such as colour | ||
158 | settings or tuning are maintained across a channel switch. The caller should | ||
159 | maintain settings as desired for each channel. (This is reasonable as | ||
160 | different video inputs may have different properties). | ||
161 | <P> | ||
162 | The <b>struct video_channel</b> consists of the following | ||
163 | <P> | ||
164 | <TABLE> | ||
165 | <TR><TD><b>channel</b></TD><TD>The channel number</TD> | ||
166 | <TR><TD><b>name</b></TD><TD>The input name - preferably reflecting the label | ||
167 | on the card input itself</TD> | ||
168 | <TR><TD><b>tuners</b></TD><TD>Number of tuners for this input</TD> | ||
169 | <TR><TD><b>flags</b></TD><TD>Properties the tuner has</TD> | ||
170 | <TR><TD><b>type</b></TD><TD>Input type (if known)</TD> | ||
171 | <TR><TD><b>norm</b><TD>The norm for this channel</TD> | ||
172 | </TABLE> | ||
173 | <P> | ||
174 | The flags defined are | ||
175 | <P> | ||
176 | <TABLE> | ||
177 | <TR><TD><b>VIDEO_VC_TUNER</b><TD>Channel has tuners.</TD> | ||
178 | <TR><TD><b>VIDEO_VC_AUDIO</b><TD>Channel has audio.</TD> | ||
179 | <TR><TD><b>VIDEO_VC_NORM</b><TD>Channel has norm setting.</TD> | ||
180 | </TABLE> | ||
181 | <P> | ||
182 | The types defined are | ||
183 | <P> | ||
184 | <TABLE> | ||
185 | <TR><TD><b>VIDEO_TYPE_TV</b><TD>The input is a TV input.</TD> | ||
186 | <TR><TD><b>VIDEO_TYPE_CAMERA</b><TD>The input is a camera.</TD> | ||
187 | </TABLE> | ||
188 | <P> | ||
189 | <H3>Image Properties</H3> | ||
190 | The image properties of the picture can be queried with the <b>VIDIOCGPICT</b> | ||
191 | ioctl which fills in a <b>struct video_picture</b>. The <b>VIDIOCSPICT</b> | ||
192 | ioctl allows values to be changed. All values except for the palette type | ||
193 | are scaled between 0-65535. | ||
194 | <P> | ||
195 | The <b>struct video_picture</b> consists of the following fields | ||
196 | <P> | ||
197 | <TABLE> | ||
198 | <TR><TD><b>brightness</b><TD>Picture brightness</TD> | ||
199 | <TR><TD><b>hue</b><TD>Picture hue (colour only)</TD> | ||
200 | <TR><TD><b>colour</b><TD>Picture colour (colour only)</TD> | ||
201 | <TR><TD><b>contrast</b><TD>Picture contrast</TD> | ||
202 | <TR><TD><b>whiteness</b><TD>The whiteness (greyscale only)</TD> | ||
203 | <TR><TD><b>depth</b><TD>The capture depth (may need to match the frame buffer depth)</TD> | ||
204 | <TR><TD><b>palette</b><TD>Reports the palette that should be used for this image</TD> | ||
205 | </TABLE> | ||
206 | <P> | ||
207 | The following palettes are defined | ||
208 | <P> | ||
209 | <TABLE> | ||
210 | <TR><TD><b>VIDEO_PALETTE_GREY</b><TD>Linear intensity grey scale (255 is brightest).</TD> | ||
211 | <TR><TD><b>VIDEO_PALETTE_HI240</b><TD>The BT848 8bit colour cube.</TD> | ||
212 | <TR><TD><b>VIDEO_PALETTE_RGB565</b><TD>RGB565 packed into 16 bit words.</TD> | ||
213 | <TR><TD><b>VIDEO_PALETTE_RGB555</b><TD>RGV555 packed into 16 bit words, top bit undefined.</TD> | ||
214 | <TR><TD><b>VIDEO_PALETTE_RGB24</b><TD>RGB888 packed into 24bit words.</TD> | ||
215 | <TR><TD><b>VIDEO_PALETTE_RGB32</b><TD>RGB888 packed into the low 3 bytes of 32bit words. The top 8bits are undefined.</TD> | ||
216 | <TR><TD><b>VIDEO_PALETTE_YUV422</b><TD>Video style YUV422 - 8bits packed 4bits Y 2bits U 2bits V</TD> | ||
217 | <TR><TD><b>VIDEO_PALETTE_YUYV</b><TD>Describe me</TD> | ||
218 | <TR><TD><b>VIDEO_PALETTE_UYVY</b><TD>Describe me</TD> | ||
219 | <TR><TD><b>VIDEO_PALETTE_YUV420</b><TD>YUV420 capture</TD> | ||
220 | <TR><TD><b>VIDEO_PALETTE_YUV411</b><TD>YUV411 capture</TD> | ||
221 | <TR><TD><b>VIDEO_PALETTE_RAW</b><TD>RAW capture (BT848)</TD> | ||
222 | <TR><TD><b>VIDEO_PALETTE_YUV422P</b><TD>YUV 4:2:2 Planar</TD> | ||
223 | <TR><TD><b>VIDEO_PALETTE_YUV411P</b><TD>YUV 4:1:1 Planar</TD> | ||
224 | </TABLE> | ||
225 | <P> | ||
226 | <H3>Tuning</H3> | ||
227 | Each video input channel can have one or more tuners associated with it. Many | ||
228 | devices will not have tuners. TV cards and radio cards will have one or more | ||
229 | tuners attached. | ||
230 | <P> | ||
231 | Tuners are described by a <b>struct video_tuner</b> which can be obtained by | ||
232 | the <b>VIDIOCGTUNER</b> ioctl. Fill in the tuner number in the structure | ||
233 | then pass the structure to the ioctl to have the data filled in. The | ||
234 | tuner can be switched using <b>VIDIOCSTUNER</b> which takes an integer argument | ||
235 | giving the tuner to use. A struct tuner has the following fields | ||
236 | <P> | ||
237 | <TABLE> | ||
238 | <TR><TD><b>tuner</b><TD>Number of the tuner</TD> | ||
239 | <TR><TD><b>name</b><TD>Canonical name for this tuner (eg FM/AM/TV)</TD> | ||
240 | <TR><TD><b>rangelow</b><TD>Lowest tunable frequency</TD> | ||
241 | <TR><TD><b>rangehigh</b><TD>Highest tunable frequency</TD> | ||
242 | <TR><TD><b>flags</b><TD>Flags describing the tuner</TD> | ||
243 | <TR><TD><b>mode</b><TD>The video signal mode if relevant</TD> | ||
244 | <TR><TD><b>signal</b><TD>Signal strength if known - between 0-65535</TD> | ||
245 | </TABLE> | ||
246 | <P> | ||
247 | The following flags exist | ||
248 | <P> | ||
249 | <TABLE> | ||
250 | <TR><TD><b>VIDEO_TUNER_PAL</b><TD>PAL tuning is supported</TD> | ||
251 | <TR><TD><b>VIDEO_TUNER_NTSC</b><TD>NTSC tuning is supported</TD> | ||
252 | <TR><TD><b>VIDEO_TUNER_SECAM</b><TD>SECAM tuning is supported</TD> | ||
253 | <TR><TD><b>VIDEO_TUNER_LOW</b><TD>Frequency is in a lower range</TD> | ||
254 | <TR><TD><b>VIDEO_TUNER_NORM</b><TD>The norm for this tuner is settable</TD> | ||
255 | <TR><TD><b>VIDEO_TUNER_STEREO_ON</b><TD>The tuner is seeing stereo audio</TD> | ||
256 | <TR><TD><b>VIDEO_TUNER_RDS_ON</b><TD>The tuner is seeing a RDS datastream</TD> | ||
257 | <TR><TD><b>VIDEO_TUNER_MBS_ON</b><TD>The tuner is seeing a MBS datastream</TD> | ||
258 | </TABLE> | ||
259 | <P> | ||
260 | The following modes are defined | ||
261 | <P> | ||
262 | <TABLE> | ||
263 | <TR><TD><b>VIDEO_MODE_PAL</b><TD>The tuner is in PAL mode</TD> | ||
264 | <TR><TD><b>VIDEO_MODE_NTSC</b><TD>The tuner is in NTSC mode</TD> | ||
265 | <TR><TD><b>VIDEO_MODE_SECAM</b><TD>The tuner is in SECAM mode</TD> | ||
266 | <TR><TD><b>VIDEO_MODE_AUTO</b><TD>The tuner auto switches, or mode does not apply</TD> | ||
267 | </TABLE> | ||
268 | <P> | ||
269 | Tuning frequencies are an unsigned 32bit value in 1/16th MHz or if the | ||
270 | <b>VIDEO_TUNER_LOW</b> flag is set they are in 1/16th KHz. The current | ||
271 | frequency is obtained as an unsigned long via the <b>VIDIOCGFREQ</b> ioctl and | ||
272 | set by the <b>VIDIOCSFREQ</b> ioctl. | ||
273 | <P> | ||
274 | <H3>Audio</H3> | ||
275 | TV and Radio devices have one or more audio inputs that may be selected. | ||
276 | The audio properties are queried by passing a <b>struct video_audio</b> to <b>VIDIOCGAUDIO</b> ioctl. The | ||
277 | <b>VIDIOCSAUDIO</b> ioctl sets audio properties. | ||
278 | <P> | ||
279 | The structure contains the following fields | ||
280 | <P> | ||
281 | <TABLE> | ||
282 | <TR><TD><b>audio</b><TD>The channel number</TD> | ||
283 | <TR><TD><b>volume</b><TD>The volume level</TD> | ||
284 | <TR><TD><b>bass</b><TD>The bass level</TD> | ||
285 | <TR><TD><b>treble</b><TD>The treble level</TD> | ||
286 | <TR><TD><b>flags</b><TD>Flags describing the audio channel</TD> | ||
287 | <TR><TD><b>name</b><TD>Canonical name for the audio input</TD> | ||
288 | <TR><TD><b>mode</b><TD>The mode the audio input is in</TD> | ||
289 | <TR><TD><b>balance</b><TD>The left/right balance</TD> | ||
290 | <TR><TD><b>step</b><TD>Actual step used by the hardware</TD> | ||
291 | </TABLE> | ||
292 | <P> | ||
293 | The following flags are defined | ||
294 | <P> | ||
295 | <TABLE> | ||
296 | <TR><TD><b>VIDEO_AUDIO_MUTE</b><TD>The audio is muted</TD> | ||
297 | <TR><TD><b>VIDEO_AUDIO_MUTABLE</b><TD>Audio muting is supported</TD> | ||
298 | <TR><TD><b>VIDEO_AUDIO_VOLUME</b><TD>The volume is controllable</TD> | ||
299 | <TR><TD><b>VIDEO_AUDIO_BASS</b><TD>The bass is controllable</TD> | ||
300 | <TR><TD><b>VIDEO_AUDIO_TREBLE</b><TD>The treble is controllable</TD> | ||
301 | <TR><TD><b>VIDEO_AUDIO_BALANCE</b><TD>The balance is controllable</TD> | ||
302 | </TABLE> | ||
303 | <P> | ||
304 | The following decoding modes are defined | ||
305 | <P> | ||
306 | <TABLE> | ||
307 | <TR><TD><b>VIDEO_SOUND_MONO</b><TD>Mono signal</TD> | ||
308 | <TR><TD><b>VIDEO_SOUND_STEREO</b><TD>Stereo signal (NICAM for TV)</TD> | ||
309 | <TR><TD><b>VIDEO_SOUND_LANG1</b><TD>European TV alternate language 1</TD> | ||
310 | <TR><TD><b>VIDEO_SOUND_LANG2</b><TD>European TV alternate language 2</TD> | ||
311 | </TABLE> | ||
312 | <P> | ||
313 | <H3>Reading Images</H3> | ||
314 | Each call to the <b>read</b> syscall returns the next available image | ||
315 | from the device. It is up to the caller to set format and size (using | ||
316 | the VIDIOCSPICT and VIDIOCSWIN ioctls) and then to pass a suitable | ||
317 | size buffer and length to the function. Not all devices will support | ||
318 | read operations. | ||
319 | <P> | ||
320 | A second way to handle image capture is via the mmap interface if supported. | ||
321 | To use the mmap interface a user first sets the desired image size and depth | ||
322 | properties. Next the VIDIOCGMBUF ioctl is issued. This reports the size | ||
323 | of buffer to mmap and the offset within the buffer for each frame. The | ||
324 | number of frames supported is device dependent and may only be one. | ||
325 | <P> | ||
326 | The video_mbuf structure contains the following fields | ||
327 | <P> | ||
328 | <TABLE> | ||
329 | <TR><TD><b>size</b><TD>The number of bytes to map</TD> | ||
330 | <TR><TD><b>frames</b><TD>The number of frames</TD> | ||
331 | <TR><TD><b>offsets</b><TD>The offset of each frame</TD> | ||
332 | </TABLE> | ||
333 | <P> | ||
334 | Once the mmap has been made the VIDIOCMCAPTURE ioctl starts the | ||
335 | capture to a frame using the format and image size specified in the | ||
336 | video_mmap (which should match or be below the initial query size). | ||
337 | When the VIDIOCMCAPTURE ioctl returns the frame is <em>not</em> | ||
338 | captured yet, the driver just instructed the hardware to start the | ||
339 | capture. The application has to use the VIDIOCSYNC ioctl to wait | ||
340 | until the capture of a frame is finished. VIDIOCSYNC takes the frame | ||
341 | number you want to wait for as argument. | ||
342 | <p> | ||
343 | It is allowed to call VIDIOCMCAPTURE multiple times (with different | ||
344 | frame numbers in video_mmap->frame of course) and thus have multiple | ||
345 | outstanding capture requests. A simple way do to double-buffering | ||
346 | using this feature looks like this: | ||
347 | <pre> | ||
348 | /* setup everything */ | ||
349 | VIDIOCMCAPTURE(0) | ||
350 | while (whatever) { | ||
351 | VIDIOCMCAPTURE(1) | ||
352 | VIDIOCSYNC(0) | ||
353 | /* process frame 0 while the hardware captures frame 1 */ | ||
354 | VIDIOCMCAPTURE(0) | ||
355 | VIDIOCSYNC(1) | ||
356 | /* process frame 1 while the hardware captures frame 0 */ | ||
357 | } | ||
358 | </pre> | ||
359 | Note that you are <em>not</em> limited to only two frames. The API | ||
360 | allows up to 32 frames, the VIDIOCGMBUF ioctl returns the number of | ||
361 | frames the driver granted. Thus it is possible to build deeper queues | ||
362 | to avoid loosing frames on load peaks. | ||
363 | <p> | ||
364 | While capturing to memory the driver will make a "best effort" attempt | ||
365 | to capture to screen as well if requested. This normally means all | ||
366 | frames that "miss" memory mapped capture will go to the display. | ||
367 | <P> | ||
368 | A final ioctl exists to allow a device to obtain related devices if a | ||
369 | driver has multiple components (for example video0 may not be associated | ||
370 | with vbi0 which would cause an intercast display program to make a bad | ||
371 | mistake). The VIDIOCGUNIT ioctl reports the unit numbers of the associated | ||
372 | devices if any exist. The video_unit structure has the following fields. | ||
373 | <P> | ||
374 | <TABLE> | ||
375 | <TR><TD><b>video</b><TD>Video capture device</TD> | ||
376 | <TR><TD><b>vbi</b><TD>VBI capture device</TD> | ||
377 | <TR><TD><b>radio</b><TD>Radio device</TD> | ||
378 | <TR><TD><b>audio</b><TD>Audio mixer</TD> | ||
379 | <TR><TD><b>teletext</b><TD>Teletext device</TD> | ||
380 | </TABLE> | ||
381 | <P> | ||
382 | <H3>RDS Datastreams</H3> | ||
383 | For radio devices that support it, it is possible to receive Radio Data | ||
384 | System (RDS) data by means of a read() on the device. The data is packed in | ||
385 | groups of three, as follows: | ||
386 | <TABLE> | ||
387 | <TR><TD>First Octet</TD><TD>Least Significant Byte of RDS Block</TD></TR> | ||
388 | <TR><TD>Second Octet</TD><TD>Most Significant Byte of RDS Block | ||
389 | <TR><TD>Third Octet</TD><TD>Bit 7:</TD><TD>Error bit. Indicates that | ||
390 | an uncorrectable error occurred during reception of this block.</TD></TR> | ||
391 | <TR><TD> </TD><TD>Bit 6:</TD><TD>Corrected bit. Indicates that | ||
392 | an error was corrected for this data block.</TD></TR> | ||
393 | <TR><TD> </TD><TD>Bits 5-3:</TD><TD>Received Offset. Indicates the | ||
394 | offset received by the sync system.</TD></TR> | ||
395 | <TR><TD> </TD><TD>Bits 2-0:</TD><TD>Offset Name. Indicates the | ||
396 | offset applied to this data.</TD></TR> | ||
397 | </TABLE> | ||
398 | </BODY> | ||
399 | </HTML> | ||
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 216f705495cc..4377aa11f567 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 | |||
@@ -13,17 +13,17 @@ card=11 - Prolink PlayTV PVR | |||
13 | card=12 - ASUS PVR-416 | 13 | card=12 - ASUS PVR-416 |
14 | card=13 - MSI TV-@nywhere | 14 | card=13 - MSI TV-@nywhere |
15 | card=14 - KWorld/VStream XPert DVB-T | 15 | card=14 - KWorld/VStream XPert DVB-T |
16 | card=15 - DVICO FusionHDTV DVB-T1 | 16 | card=15 - DViCO FusionHDTV DVB-T1 |
17 | card=16 - KWorld LTV883RF | 17 | card=16 - KWorld LTV883RF |
18 | card=17 - DViCO - FusionHDTV 3 Gold | 18 | card=17 - DViCO FusionHDTV 3 Gold-Q |
19 | card=18 - Hauppauge Nova-T DVB-T | 19 | card=18 - Hauppauge Nova-T DVB-T |
20 | card=19 - Conexant DVB-T reference design | 20 | card=19 - Conexant DVB-T reference design |
21 | card=20 - Provideo PV259 | 21 | card=20 - Provideo PV259 |
22 | card=21 - DVICO FusionHDTV DVB-T Plus | 22 | card=21 - DViCO FusionHDTV DVB-T Plus |
23 | card=22 - digitalnow DNTV Live! DVB-T | 23 | card=22 - digitalnow DNTV Live! DVB-T |
24 | card=23 - pcHDTV HD3000 HDTV | 24 | card=23 - pcHDTV HD3000 HDTV |
25 | card=24 - Hauppauge WinTV 28xxx (Roslyn) models | 25 | card=24 - Hauppauge WinTV 28xxx (Roslyn) models |
26 | card=25 - Digital-Logic MICROSPACE Entertainment Center (MEC) | 26 | card=25 - Digital-Logic MICROSPACE Entertainment Center (MEC) |
27 | card=26 - IODATA GV/BCTV7E | 27 | card=26 - IODATA GV/BCTV7E |
28 | card=27 - PixelView PlayTV Ultra Pro (Stereo) | 28 | card=27 - PixelView PlayTV Ultra Pro (Stereo) |
29 | card=28 - DViCO - FusionHDTV 3 Gold-T | 29 | card=28 - DViCO FusionHDTV 3 Gold-T |
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index d5ed95d28500..735e8ba02d9f 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 | |||
@@ -54,3 +54,9 @@ | |||
54 | 55 -> LifeView FlyDVB-T DUO [5168:0306] | 54 | 55 -> LifeView FlyDVB-T DUO [5168:0306] |
55 | 56 -> Avermedia AVerTV 307 [1461:a70a] | 55 | 56 -> Avermedia AVerTV 307 [1461:a70a] |
56 | 57 -> Avermedia AVerTV GO 007 FM [1461:f31f] | 56 | 57 -> Avermedia AVerTV GO 007 FM [1461:f31f] |
57 | 58 -> ADS Tech Instant TV (saa7135) [1421:0350,1421:0370] | ||
58 | 59 -> Kworld/Tevion V-Stream Xpert TV PVR7134 | ||
59 | 60 -> Typhoon DVB-T Duo Digital/Analog Cardbus | ||
60 | 61 -> Philips TOUGH DVB-T reference design | ||
61 | 62 -> Compro VideoMate TV Gold+II | ||
62 | 63 -> Kworld Xpert TV PVR7134 | ||
diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner index aeb8df8ce890..e78020f68b2e 100644 --- a/Documentation/video4linux/CARDLIST.tuner +++ b/Documentation/video4linux/CARDLIST.tuner | |||
@@ -59,3 +59,6 @@ tuner=57 - Philips FQ1236A MK4 | |||
59 | tuner=58 - Ymec TVision TVF-8531MF | 59 | tuner=58 - Ymec TVision TVF-8531MF |
60 | tuner=59 - Ymec TVision TVF-5533MF | 60 | tuner=59 - Ymec TVision TVF-5533MF |
61 | tuner=60 - Thomson DDT 7611 (ATSC/NTSC) | 61 | tuner=60 - Thomson DDT 7611 (ATSC/NTSC) |
62 | tuner=61 - Tena TNF9533-D/IF | ||
63 | tuner=62 - Philips TEA5767HN FM Radio | ||
64 | tuner=63 - Philips FMD1216ME MK3 Hybrid Tuner | ||
diff --git a/Documentation/video4linux/README.saa7134 b/Documentation/video4linux/README.saa7134 index 1a446c65365e..1f788e498eff 100644 --- a/Documentation/video4linux/README.saa7134 +++ b/Documentation/video4linux/README.saa7134 | |||
@@ -57,6 +57,15 @@ Cards can use either of these two crystals (xtal): | |||
57 | - 24.576MHz -> .audio_clock=0x200000 | 57 | - 24.576MHz -> .audio_clock=0x200000 |
58 | (xtal * .audio_clock = 51539600) | 58 | (xtal * .audio_clock = 51539600) |
59 | 59 | ||
60 | Some details about 30/34/35: | ||
61 | |||
62 | - saa7130 - low-price chip, doesn't have mute, that is why all those | ||
63 | cards should have .mute field defined in their tuner structure. | ||
64 | |||
65 | - saa7134 - usual chip | ||
66 | |||
67 | - saa7133/35 - saa7135 is probably a marketing decision, since all those | ||
68 | chips identifies itself as 33 on pci. | ||
60 | 69 | ||
61 | Credits | 70 | Credits |
62 | ======= | 71 | ======= |
diff --git a/MAINTAINERS b/MAINTAINERS index 4db63de9652a..302b31960008 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -512,11 +512,11 @@ W: http://linuxppc64.org | |||
512 | S: Supported | 512 | S: Supported |
513 | 513 | ||
514 | BTTV VIDEO4LINUX DRIVER | 514 | BTTV VIDEO4LINUX DRIVER |
515 | P: Gerd Knorr | 515 | P: Mauro Carvalho Chehab |
516 | M: kraxel@bytesex.org | 516 | M: mchehab@brturbo.com.br |
517 | L: video4linux-list@redhat.com | 517 | L: video4linux-list@redhat.com |
518 | W: http://bytesex.org/bttv/ | 518 | W: http://linuxtv.org |
519 | S: Orphan | 519 | S: Maintained |
520 | 520 | ||
521 | BUSLOGIC SCSI DRIVER | 521 | BUSLOGIC SCSI DRIVER |
522 | P: Leonard N. Zubkoff | 522 | P: Leonard N. Zubkoff |
@@ -2161,7 +2161,7 @@ UltraSPARC (sparc64): | |||
2161 | P: David S. Miller | 2161 | P: David S. Miller |
2162 | M: davem@davemloft.net | 2162 | M: davem@davemloft.net |
2163 | P: Eddie C. Dost | 2163 | P: Eddie C. Dost |
2164 | M: ecd@skynet.be | 2164 | M: ecd@brainaid.de |
2165 | P: Jakub Jelinek | 2165 | P: Jakub Jelinek |
2166 | M: jj@sunsite.ms.mff.cuni.cz | 2166 | M: jj@sunsite.ms.mff.cuni.cz |
2167 | P: Anton Blanchard | 2167 | P: Anton Blanchard |
@@ -2625,10 +2625,11 @@ W: http://rio500.sourceforge.net | |||
2625 | S: Maintained | 2625 | S: Maintained |
2626 | 2626 | ||
2627 | VIDEO FOR LINUX | 2627 | VIDEO FOR LINUX |
2628 | P: Gerd Knorr | 2628 | P: Mauro Carvalho Chehab |
2629 | M: kraxel@bytesex.org | 2629 | M: mchehab@brturbo.com.br |
2630 | L: video4linux-list@redhat.com | 2630 | L: video4linux-list@redhat.com |
2631 | S: Orphan | 2631 | W: http://linuxtv.org |
2632 | S: Maintained | ||
2632 | 2633 | ||
2633 | W1 DALLAS'S 1-WIRE BUS | 2634 | W1 DALLAS'S 1-WIRE BUS |
2634 | P: Evgeniy Polyakov | 2635 | P: Evgeniy Polyakov |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 12 | 3 | SUBLEVEL = 13 |
4 | EXTRAVERSION = | 4 | EXTRAVERSION =-rc2 |
5 | NAME=Woozy Numbat | 5 | NAME=Woozy Numbat |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c index e6ded33c6e22..9d34ce26e5ef 100644 --- a/arch/alpha/kernel/irq_alpha.c +++ b/arch/alpha/kernel/irq_alpha.c | |||
@@ -55,6 +55,8 @@ do_entInt(unsigned long type, unsigned long vector, | |||
55 | #ifdef CONFIG_SMP | 55 | #ifdef CONFIG_SMP |
56 | { | 56 | { |
57 | long cpu; | 57 | long cpu; |
58 | |||
59 | local_irq_disable(); | ||
58 | smp_percpu_timer_interrupt(regs); | 60 | smp_percpu_timer_interrupt(regs); |
59 | cpu = smp_processor_id(); | 61 | cpu = smp_processor_id(); |
60 | if (cpu != boot_cpuid) { | 62 | if (cpu != boot_cpuid) { |
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c index fd7bd17cc960..6f509a644bdd 100644 --- a/arch/alpha/kernel/traps.c +++ b/arch/alpha/kernel/traps.c | |||
@@ -240,7 +240,7 @@ do_entIF(unsigned long type, struct pt_regs *regs) | |||
240 | siginfo_t info; | 240 | siginfo_t info; |
241 | int signo, code; | 241 | int signo, code; |
242 | 242 | ||
243 | if (regs->ps == 0) { | 243 | if ((regs->ps & ~IPL_MAX) == 0) { |
244 | if (type == 1) { | 244 | if (type == 1) { |
245 | const unsigned int *data | 245 | const unsigned int *data |
246 | = (const unsigned int *) regs->pc; | 246 | = (const unsigned int *) regs->pc; |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index c8d94dcd8ef7..620f2ca94ed2 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -361,6 +361,11 @@ config NO_IDLE_HZ | |||
361 | Alternatively, if you want dynamic tick automatically enabled | 361 | Alternatively, if you want dynamic tick automatically enabled |
362 | during boot, pass "dyntick=enable" via the kernel command string. | 362 | during boot, pass "dyntick=enable" via the kernel command string. |
363 | 363 | ||
364 | Please note that dynamic tick may affect the accuracy of | ||
365 | timekeeping on some platforms depending on the implementation. | ||
366 | Currently at least OMAP platform is known to have accurate | ||
367 | timekeeping with dynamic tick. | ||
368 | |||
364 | config ARCH_DISCONTIGMEM_ENABLE | 369 | config ARCH_DISCONTIGMEM_ENABLE |
365 | bool | 370 | bool |
366 | default (ARCH_LH7A40X && !LH7A40X_CONTIGMEM) | 371 | default (ARCH_LH7A40X && !LH7A40X_CONTIGMEM) |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 8330495e2448..eb933dcafba0 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -56,7 +56,7 @@ tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) | |||
56 | tune-$(CONFIG_CPU_V6) :=-mtune=strongarm | 56 | tune-$(CONFIG_CPU_V6) :=-mtune=strongarm |
57 | 57 | ||
58 | # Need -Uarm for gcc < 3.x | 58 | # Need -Uarm for gcc < 3.x |
59 | CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) | 59 | CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,) |
60 | CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm | 60 | CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm |
61 | AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float | 61 | AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float |
62 | 62 | ||
diff --git a/arch/arm/configs/omnimeter_defconfig b/arch/arm/configs/omnimeter_defconfig deleted file mode 100644 index 78fdb4a428b1..000000000000 --- a/arch/arm/configs/omnimeter_defconfig +++ /dev/null | |||
@@ -1,803 +0,0 @@ | |||
1 | # | ||
2 | # Automatically generated make config: don't edit | ||
3 | # Linux kernel version: 2.6.12-rc1-bk2 | ||
4 | # Sun Mar 27 21:31:45 2005 | ||
5 | # | ||
6 | CONFIG_ARM=y | ||
7 | CONFIG_MMU=y | ||
8 | CONFIG_UID16=y | ||
9 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | ||
10 | CONFIG_GENERIC_CALIBRATE_DELAY=y | ||
11 | CONFIG_GENERIC_IOMAP=y | ||
12 | |||
13 | # | ||
14 | # Code maturity level options | ||
15 | # | ||
16 | CONFIG_EXPERIMENTAL=y | ||
17 | CONFIG_CLEAN_COMPILE=y | ||
18 | CONFIG_BROKEN_ON_SMP=y | ||
19 | |||
20 | # | ||
21 | # General setup | ||
22 | # | ||
23 | CONFIG_LOCALVERSION="" | ||
24 | CONFIG_SWAP=y | ||
25 | CONFIG_SYSVIPC=y | ||
26 | # CONFIG_POSIX_MQUEUE is not set | ||
27 | # CONFIG_BSD_PROCESS_ACCT is not set | ||
28 | CONFIG_SYSCTL=y | ||
29 | # CONFIG_AUDIT is not set | ||
30 | CONFIG_HOTPLUG=y | ||
31 | CONFIG_KOBJECT_UEVENT=y | ||
32 | # CONFIG_IKCONFIG is not set | ||
33 | # CONFIG_EMBEDDED is not set | ||
34 | CONFIG_KALLSYMS=y | ||
35 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | ||
36 | CONFIG_BASE_FULL=y | ||
37 | CONFIG_FUTEX=y | ||
38 | CONFIG_EPOLL=y | ||
39 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | ||
40 | CONFIG_SHMEM=y | ||
41 | CONFIG_CC_ALIGN_FUNCTIONS=0 | ||
42 | CONFIG_CC_ALIGN_LABELS=0 | ||
43 | CONFIG_CC_ALIGN_LOOPS=0 | ||
44 | CONFIG_CC_ALIGN_JUMPS=0 | ||
45 | # CONFIG_TINY_SHMEM is not set | ||
46 | CONFIG_BASE_SMALL=0 | ||
47 | |||
48 | # | ||
49 | # Loadable module support | ||
50 | # | ||
51 | CONFIG_MODULES=y | ||
52 | # CONFIG_MODULE_UNLOAD is not set | ||
53 | CONFIG_OBSOLETE_MODPARM=y | ||
54 | # CONFIG_MODVERSIONS is not set | ||
55 | # CONFIG_MODULE_SRCVERSION_ALL is not set | ||
56 | CONFIG_KMOD=y | ||
57 | |||
58 | # | ||
59 | # System Type | ||
60 | # | ||
61 | # CONFIG_ARCH_CLPS7500 is not set | ||
62 | # CONFIG_ARCH_CLPS711X is not set | ||
63 | # CONFIG_ARCH_CO285 is not set | ||
64 | # CONFIG_ARCH_EBSA110 is not set | ||
65 | # CONFIG_ARCH_CAMELOT is not set | ||
66 | # CONFIG_ARCH_FOOTBRIDGE is not set | ||
67 | # CONFIG_ARCH_INTEGRATOR is not set | ||
68 | # CONFIG_ARCH_IOP3XX is not set | ||
69 | # CONFIG_ARCH_IXP4XX is not set | ||
70 | # CONFIG_ARCH_IXP2000 is not set | ||
71 | # CONFIG_ARCH_L7200 is not set | ||
72 | # CONFIG_ARCH_PXA is not set | ||
73 | # CONFIG_ARCH_RPC is not set | ||
74 | CONFIG_ARCH_SA1100=y | ||
75 | # CONFIG_ARCH_S3C2410 is not set | ||
76 | # CONFIG_ARCH_SHARK is not set | ||
77 | # CONFIG_ARCH_LH7A40X is not set | ||
78 | # CONFIG_ARCH_OMAP is not set | ||
79 | # CONFIG_ARCH_VERSATILE is not set | ||
80 | # CONFIG_ARCH_IMX is not set | ||
81 | # CONFIG_ARCH_H720X is not set | ||
82 | |||
83 | # | ||
84 | # SA11x0 Implementations | ||
85 | # | ||
86 | # CONFIG_SA1100_ASSABET is not set | ||
87 | # CONFIG_SA1100_CERF is not set | ||
88 | # CONFIG_SA1100_COLLIE is not set | ||
89 | # CONFIG_SA1100_H3100 is not set | ||
90 | # CONFIG_SA1100_H3600 is not set | ||
91 | # CONFIG_SA1100_H3800 is not set | ||
92 | # CONFIG_SA1100_BADGE4 is not set | ||
93 | # CONFIG_SA1100_JORNADA720 is not set | ||
94 | # CONFIG_SA1100_HACKKIT is not set | ||
95 | # CONFIG_SA1100_LART is not set | ||
96 | # CONFIG_SA1100_PLEB is not set | ||
97 | # CONFIG_SA1100_SHANNON is not set | ||
98 | # CONFIG_SA1100_SIMPAD is not set | ||
99 | # CONFIG_SA1100_SSP is not set | ||
100 | |||
101 | # | ||
102 | # Processor Type | ||
103 | # | ||
104 | CONFIG_CPU_32=y | ||
105 | CONFIG_CPU_SA1100=y | ||
106 | CONFIG_CPU_32v4=y | ||
107 | CONFIG_CPU_ABRT_EV4=y | ||
108 | CONFIG_CPU_CACHE_V4WB=y | ||
109 | CONFIG_CPU_CACHE_VIVT=y | ||
110 | CONFIG_CPU_TLB_V4WB=y | ||
111 | CONFIG_CPU_MINICACHE=y | ||
112 | |||
113 | # | ||
114 | # Processor Features | ||
115 | # | ||
116 | |||
117 | # | ||
118 | # Bus support | ||
119 | # | ||
120 | CONFIG_ISA=y | ||
121 | |||
122 | # | ||
123 | # PCCARD (PCMCIA/CardBus) support | ||
124 | # | ||
125 | CONFIG_PCCARD=y | ||
126 | # CONFIG_PCMCIA_DEBUG is not set | ||
127 | CONFIG_PCMCIA=y | ||
128 | |||
129 | # | ||
130 | # PC-card bridges | ||
131 | # | ||
132 | CONFIG_I82365=y | ||
133 | # CONFIG_TCIC is not set | ||
134 | CONFIG_PCMCIA_SA1100=y | ||
135 | CONFIG_PCCARD_NONSTATIC=y | ||
136 | |||
137 | # | ||
138 | # Kernel Features | ||
139 | # | ||
140 | # CONFIG_PREEMPT is not set | ||
141 | CONFIG_DISCONTIGMEM=y | ||
142 | # CONFIG_LEDS is not set | ||
143 | CONFIG_ALIGNMENT_TRAP=y | ||
144 | |||
145 | # | ||
146 | # Boot options | ||
147 | # | ||
148 | CONFIG_ZBOOT_ROM_TEXT=0x0 | ||
149 | CONFIG_ZBOOT_ROM_BSS=0x0 | ||
150 | CONFIG_CMDLINE="keepinitrd mem=16M root=/dev/ram ramdisk=8192 initrd=0xd0000000,4M" | ||
151 | # CONFIG_XIP_KERNEL is not set | ||
152 | |||
153 | # | ||
154 | # CPU Frequency scaling | ||
155 | # | ||
156 | # CONFIG_CPU_FREQ is not set | ||
157 | |||
158 | # | ||
159 | # Floating point emulation | ||
160 | # | ||
161 | |||
162 | # | ||
163 | # At least one emulation must be selected | ||
164 | # | ||
165 | # CONFIG_FPE_NWFPE is not set | ||
166 | # CONFIG_FPE_FASTFPE is not set | ||
167 | |||
168 | # | ||
169 | # Userspace binary formats | ||
170 | # | ||
171 | CONFIG_BINFMT_ELF=y | ||
172 | CONFIG_BINFMT_AOUT=y | ||
173 | # CONFIG_BINFMT_MISC is not set | ||
174 | # CONFIG_ARTHUR is not set | ||
175 | |||
176 | # | ||
177 | # Power management options | ||
178 | # | ||
179 | # CONFIG_PM is not set | ||
180 | |||
181 | # | ||
182 | # Device Drivers | ||
183 | # | ||
184 | |||
185 | # | ||
186 | # Generic Driver Options | ||
187 | # | ||
188 | CONFIG_STANDALONE=y | ||
189 | CONFIG_PREVENT_FIRMWARE_BUILD=y | ||
190 | # CONFIG_FW_LOADER is not set | ||
191 | |||
192 | # | ||
193 | # Memory Technology Devices (MTD) | ||
194 | # | ||
195 | # CONFIG_MTD is not set | ||
196 | |||
197 | # | ||
198 | # Parallel port support | ||
199 | # | ||
200 | # CONFIG_PARPORT is not set | ||
201 | |||
202 | # | ||
203 | # Plug and Play support | ||
204 | # | ||
205 | # CONFIG_PNP is not set | ||
206 | |||
207 | # | ||
208 | # Block devices | ||
209 | # | ||
210 | # CONFIG_BLK_DEV_FD is not set | ||
211 | # CONFIG_BLK_DEV_XD is not set | ||
212 | # CONFIG_BLK_DEV_COW_COMMON is not set | ||
213 | CONFIG_BLK_DEV_LOOP=m | ||
214 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set | ||
215 | CONFIG_BLK_DEV_NBD=m | ||
216 | # CONFIG_BLK_DEV_RAM is not set | ||
217 | CONFIG_BLK_DEV_RAM_COUNT=16 | ||
218 | CONFIG_INITRAMFS_SOURCE="" | ||
219 | # CONFIG_CDROM_PKTCDVD is not set | ||
220 | |||
221 | # | ||
222 | # IO Schedulers | ||
223 | # | ||
224 | CONFIG_IOSCHED_NOOP=y | ||
225 | CONFIG_IOSCHED_AS=y | ||
226 | CONFIG_IOSCHED_DEADLINE=y | ||
227 | CONFIG_IOSCHED_CFQ=y | ||
228 | # CONFIG_ATA_OVER_ETH is not set | ||
229 | |||
230 | # | ||
231 | # ATA/ATAPI/MFM/RLL support | ||
232 | # | ||
233 | CONFIG_IDE=y | ||
234 | CONFIG_BLK_DEV_IDE=y | ||
235 | |||
236 | # | ||
237 | # Please see Documentation/ide.txt for help/info on IDE drives | ||
238 | # | ||
239 | # CONFIG_BLK_DEV_IDE_SATA is not set | ||
240 | CONFIG_BLK_DEV_IDEDISK=y | ||
241 | # CONFIG_IDEDISK_MULTI_MODE is not set | ||
242 | # CONFIG_BLK_DEV_IDECS is not set | ||
243 | # CONFIG_BLK_DEV_IDECD is not set | ||
244 | # CONFIG_BLK_DEV_IDETAPE is not set | ||
245 | # CONFIG_BLK_DEV_IDEFLOPPY is not set | ||
246 | # CONFIG_IDE_TASK_IOCTL is not set | ||
247 | |||
248 | # | ||
249 | # IDE chipset support/bugfixes | ||
250 | # | ||
251 | CONFIG_IDE_GENERIC=y | ||
252 | # CONFIG_IDE_ARM is not set | ||
253 | # CONFIG_IDE_CHIPSETS is not set | ||
254 | # CONFIG_BLK_DEV_IDEDMA is not set | ||
255 | # CONFIG_IDEDMA_AUTO is not set | ||
256 | # CONFIG_BLK_DEV_HD is not set | ||
257 | |||
258 | # | ||
259 | # SCSI device support | ||
260 | # | ||
261 | # CONFIG_SCSI is not set | ||
262 | |||
263 | # | ||
264 | # Multi-device support (RAID and LVM) | ||
265 | # | ||
266 | # CONFIG_MD is not set | ||
267 | |||
268 | # | ||
269 | # Fusion MPT device support | ||
270 | # | ||
271 | |||
272 | # | ||
273 | # IEEE 1394 (FireWire) support | ||
274 | # | ||
275 | |||
276 | # | ||
277 | # I2O device support | ||
278 | # | ||
279 | |||
280 | # | ||
281 | # Networking support | ||
282 | # | ||
283 | CONFIG_NET=y | ||
284 | |||
285 | # | ||
286 | # Networking options | ||
287 | # | ||
288 | CONFIG_PACKET=y | ||
289 | CONFIG_PACKET_MMAP=y | ||
290 | # CONFIG_NETLINK_DEV is not set | ||
291 | CONFIG_UNIX=y | ||
292 | # CONFIG_NET_KEY is not set | ||
293 | CONFIG_INET=y | ||
294 | CONFIG_IP_MULTICAST=y | ||
295 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
296 | # CONFIG_IP_PNP is not set | ||
297 | # CONFIG_NET_IPIP is not set | ||
298 | # CONFIG_NET_IPGRE is not set | ||
299 | # CONFIG_IP_MROUTE is not set | ||
300 | # CONFIG_ARPD is not set | ||
301 | # CONFIG_SYN_COOKIES is not set | ||
302 | # CONFIG_INET_AH is not set | ||
303 | # CONFIG_INET_ESP is not set | ||
304 | # CONFIG_INET_IPCOMP is not set | ||
305 | # CONFIG_INET_TUNNEL is not set | ||
306 | CONFIG_IP_TCPDIAG=y | ||
307 | # CONFIG_IP_TCPDIAG_IPV6 is not set | ||
308 | |||
309 | # | ||
310 | # IP: Virtual Server Configuration | ||
311 | # | ||
312 | # CONFIG_IP_VS is not set | ||
313 | # CONFIG_IPV6 is not set | ||
314 | CONFIG_NETFILTER=y | ||
315 | # CONFIG_NETFILTER_DEBUG is not set | ||
316 | |||
317 | # | ||
318 | # IP: Netfilter Configuration | ||
319 | # | ||
320 | # CONFIG_IP_NF_CONNTRACK is not set | ||
321 | # CONFIG_IP_NF_CONNTRACK_MARK is not set | ||
322 | # CONFIG_IP_NF_QUEUE is not set | ||
323 | # CONFIG_IP_NF_IPTABLES is not set | ||
324 | # CONFIG_IP_NF_ARPTABLES is not set | ||
325 | |||
326 | # | ||
327 | # SCTP Configuration (EXPERIMENTAL) | ||
328 | # | ||
329 | # CONFIG_IP_SCTP is not set | ||
330 | # CONFIG_ATM is not set | ||
331 | # CONFIG_BRIDGE is not set | ||
332 | # CONFIG_VLAN_8021Q is not set | ||
333 | # CONFIG_DECNET is not set | ||
334 | # CONFIG_LLC2 is not set | ||
335 | # CONFIG_IPX is not set | ||
336 | # CONFIG_ATALK is not set | ||
337 | # CONFIG_X25 is not set | ||
338 | # CONFIG_LAPB is not set | ||
339 | # CONFIG_NET_DIVERT is not set | ||
340 | # CONFIG_ECONET is not set | ||
341 | # CONFIG_WAN_ROUTER is not set | ||
342 | |||
343 | # | ||
344 | # QoS and/or fair queueing | ||
345 | # | ||
346 | # CONFIG_NET_SCHED is not set | ||
347 | # CONFIG_NET_CLS_ROUTE is not set | ||
348 | |||
349 | # | ||
350 | # Network testing | ||
351 | # | ||
352 | # CONFIG_NET_PKTGEN is not set | ||
353 | # CONFIG_NETPOLL is not set | ||
354 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
355 | # CONFIG_HAMRADIO is not set | ||
356 | # CONFIG_IRDA is not set | ||
357 | # CONFIG_BT is not set | ||
358 | CONFIG_NETDEVICES=y | ||
359 | # CONFIG_DUMMY is not set | ||
360 | # CONFIG_BONDING is not set | ||
361 | # CONFIG_EQUALIZER is not set | ||
362 | # CONFIG_TUN is not set | ||
363 | |||
364 | # | ||
365 | # ARCnet devices | ||
366 | # | ||
367 | # CONFIG_ARCNET is not set | ||
368 | |||
369 | # | ||
370 | # Ethernet (10 or 100Mbit) | ||
371 | # | ||
372 | CONFIG_NET_ETHERNET=y | ||
373 | # CONFIG_MII is not set | ||
374 | # CONFIG_NET_VENDOR_3COM is not set | ||
375 | # CONFIG_LANCE is not set | ||
376 | # CONFIG_NET_VENDOR_SMC is not set | ||
377 | # CONFIG_SMC91X is not set | ||
378 | # CONFIG_NET_VENDOR_RACAL is not set | ||
379 | # CONFIG_AT1700 is not set | ||
380 | # CONFIG_DEPCA is not set | ||
381 | # CONFIG_HP100 is not set | ||
382 | # CONFIG_NET_ISA is not set | ||
383 | # CONFIG_NET_PCI is not set | ||
384 | # CONFIG_NET_POCKET is not set | ||
385 | |||
386 | # | ||
387 | # Ethernet (1000 Mbit) | ||
388 | # | ||
389 | |||
390 | # | ||
391 | # Ethernet (10000 Mbit) | ||
392 | # | ||
393 | |||
394 | # | ||
395 | # Token Ring devices | ||
396 | # | ||
397 | # CONFIG_TR is not set | ||
398 | |||
399 | # | ||
400 | # Wireless LAN (non-hamradio) | ||
401 | # | ||
402 | CONFIG_NET_RADIO=y | ||
403 | |||
404 | # | ||
405 | # Obsolete Wireless cards support (pre-802.11) | ||
406 | # | ||
407 | # CONFIG_STRIP is not set | ||
408 | # CONFIG_ARLAN is not set | ||
409 | # CONFIG_WAVELAN is not set | ||
410 | CONFIG_PCMCIA_WAVELAN=y | ||
411 | # CONFIG_PCMCIA_NETWAVE is not set | ||
412 | |||
413 | # | ||
414 | # Wireless 802.11 Frequency Hopping cards support | ||
415 | # | ||
416 | # CONFIG_PCMCIA_RAYCS is not set | ||
417 | |||
418 | # | ||
419 | # Wireless 802.11b ISA/PCI cards support | ||
420 | # | ||
421 | # CONFIG_HERMES is not set | ||
422 | # CONFIG_ATMEL is not set | ||
423 | |||
424 | # | ||
425 | # Wireless 802.11b Pcmcia/Cardbus cards support | ||
426 | # | ||
427 | CONFIG_AIRO_CS=y | ||
428 | CONFIG_PCMCIA_WL3501=y | ||
429 | CONFIG_NET_WIRELESS=y | ||
430 | |||
431 | # | ||
432 | # PCMCIA network device support | ||
433 | # | ||
434 | CONFIG_NET_PCMCIA=y | ||
435 | CONFIG_PCMCIA_3C589=y | ||
436 | # CONFIG_PCMCIA_3C574 is not set | ||
437 | # CONFIG_PCMCIA_FMVJ18X is not set | ||
438 | CONFIG_PCMCIA_PCNET=y | ||
439 | # CONFIG_PCMCIA_NMCLAN is not set | ||
440 | # CONFIG_PCMCIA_SMC91C92 is not set | ||
441 | # CONFIG_PCMCIA_XIRC2PS is not set | ||
442 | # CONFIG_PCMCIA_AXNET is not set | ||
443 | |||
444 | # | ||
445 | # Wan interfaces | ||
446 | # | ||
447 | # CONFIG_WAN is not set | ||
448 | # CONFIG_PPP is not set | ||
449 | # CONFIG_SLIP is not set | ||
450 | # CONFIG_SHAPER is not set | ||
451 | # CONFIG_NETCONSOLE is not set | ||
452 | |||
453 | # | ||
454 | # ISDN subsystem | ||
455 | # | ||
456 | # CONFIG_ISDN is not set | ||
457 | |||
458 | # | ||
459 | # Input device support | ||
460 | # | ||
461 | CONFIG_INPUT=y | ||
462 | |||
463 | # | ||
464 | # Userland interfaces | ||
465 | # | ||
466 | CONFIG_INPUT_MOUSEDEV=y | ||
467 | CONFIG_INPUT_MOUSEDEV_PSAUX=y | ||
468 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 | ||
469 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 | ||
470 | # CONFIG_INPUT_JOYDEV is not set | ||
471 | # CONFIG_INPUT_TSDEV is not set | ||
472 | # CONFIG_INPUT_EVDEV is not set | ||
473 | # CONFIG_INPUT_EVBUG is not set | ||
474 | |||
475 | # | ||
476 | # Input Device Drivers | ||
477 | # | ||
478 | CONFIG_INPUT_KEYBOARD=y | ||
479 | CONFIG_KEYBOARD_ATKBD=y | ||
480 | # CONFIG_KEYBOARD_SUNKBD is not set | ||
481 | # CONFIG_KEYBOARD_LKKBD is not set | ||
482 | # CONFIG_KEYBOARD_XTKBD is not set | ||
483 | # CONFIG_KEYBOARD_NEWTON is not set | ||
484 | CONFIG_INPUT_MOUSE=y | ||
485 | CONFIG_MOUSE_PS2=y | ||
486 | # CONFIG_MOUSE_SERIAL is not set | ||
487 | # CONFIG_MOUSE_INPORT is not set | ||
488 | # CONFIG_MOUSE_LOGIBM is not set | ||
489 | # CONFIG_MOUSE_PC110PAD is not set | ||
490 | # CONFIG_MOUSE_VSXXXAA is not set | ||
491 | # CONFIG_INPUT_JOYSTICK is not set | ||
492 | # CONFIG_INPUT_TOUCHSCREEN is not set | ||
493 | # CONFIG_INPUT_MISC is not set | ||
494 | |||
495 | # | ||
496 | # Hardware I/O ports | ||
497 | # | ||
498 | CONFIG_SERIO=y | ||
499 | CONFIG_SERIO_SERPORT=y | ||
500 | CONFIG_SERIO_LIBPS2=y | ||
501 | # CONFIG_SERIO_RAW is not set | ||
502 | # CONFIG_GAMEPORT is not set | ||
503 | CONFIG_SOUND_GAMEPORT=y | ||
504 | |||
505 | # | ||
506 | # Character devices | ||
507 | # | ||
508 | CONFIG_VT=y | ||
509 | CONFIG_VT_CONSOLE=y | ||
510 | CONFIG_HW_CONSOLE=y | ||
511 | # CONFIG_SERIAL_NONSTANDARD is not set | ||
512 | |||
513 | # | ||
514 | # Serial drivers | ||
515 | # | ||
516 | # CONFIG_SERIAL_8250 is not set | ||
517 | |||
518 | # | ||
519 | # Non-8250 serial port support | ||
520 | # | ||
521 | CONFIG_SERIAL_SA1100=y | ||
522 | CONFIG_SERIAL_SA1100_CONSOLE=y | ||
523 | CONFIG_SERIAL_CORE=y | ||
524 | CONFIG_SERIAL_CORE_CONSOLE=y | ||
525 | CONFIG_UNIX98_PTYS=y | ||
526 | CONFIG_LEGACY_PTYS=y | ||
527 | CONFIG_LEGACY_PTY_COUNT=256 | ||
528 | |||
529 | # | ||
530 | # IPMI | ||
531 | # | ||
532 | # CONFIG_IPMI_HANDLER is not set | ||
533 | |||
534 | # | ||
535 | # Watchdog Cards | ||
536 | # | ||
537 | # CONFIG_WATCHDOG is not set | ||
538 | # CONFIG_NVRAM is not set | ||
539 | # CONFIG_RTC is not set | ||
540 | # CONFIG_DTLK is not set | ||
541 | # CONFIG_R3964 is not set | ||
542 | |||
543 | # | ||
544 | # Ftape, the floppy tape device driver | ||
545 | # | ||
546 | # CONFIG_DRM is not set | ||
547 | |||
548 | # | ||
549 | # PCMCIA character devices | ||
550 | # | ||
551 | # CONFIG_SYNCLINK_CS is not set | ||
552 | # CONFIG_RAW_DRIVER is not set | ||
553 | |||
554 | # | ||
555 | # TPM devices | ||
556 | # | ||
557 | # CONFIG_TCG_TPM is not set | ||
558 | |||
559 | # | ||
560 | # I2C support | ||
561 | # | ||
562 | # CONFIG_I2C is not set | ||
563 | |||
564 | # | ||
565 | # Misc devices | ||
566 | # | ||
567 | |||
568 | # | ||
569 | # Multimedia devices | ||
570 | # | ||
571 | # CONFIG_VIDEO_DEV is not set | ||
572 | |||
573 | # | ||
574 | # Digital Video Broadcasting Devices | ||
575 | # | ||
576 | # CONFIG_DVB is not set | ||
577 | |||
578 | # | ||
579 | # Graphics support | ||
580 | # | ||
581 | CONFIG_FB=y | ||
582 | CONFIG_FB_CFB_FILLRECT=y | ||
583 | CONFIG_FB_CFB_COPYAREA=y | ||
584 | CONFIG_FB_CFB_IMAGEBLIT=y | ||
585 | CONFIG_FB_SOFT_CURSOR=y | ||
586 | # CONFIG_FB_MODE_HELPERS is not set | ||
587 | # CONFIG_FB_TILEBLITTING is not set | ||
588 | CONFIG_FB_SA1100=y | ||
589 | # CONFIG_FB_VIRTUAL is not set | ||
590 | |||
591 | # | ||
592 | # Console display driver support | ||
593 | # | ||
594 | # CONFIG_VGA_CONSOLE is not set | ||
595 | # CONFIG_MDA_CONSOLE is not set | ||
596 | CONFIG_DUMMY_CONSOLE=y | ||
597 | CONFIG_FRAMEBUFFER_CONSOLE=y | ||
598 | CONFIG_FONTS=y | ||
599 | CONFIG_FONT_8x8=y | ||
600 | # CONFIG_FONT_8x16 is not set | ||
601 | # CONFIG_FONT_6x11 is not set | ||
602 | # CONFIG_FONT_PEARL_8x8 is not set | ||
603 | # CONFIG_FONT_ACORN_8x8 is not set | ||
604 | # CONFIG_FONT_MINI_4x6 is not set | ||
605 | # CONFIG_FONT_SUN8x16 is not set | ||
606 | # CONFIG_FONT_SUN12x22 is not set | ||
607 | |||
608 | # | ||
609 | # Logo configuration | ||
610 | # | ||
611 | # CONFIG_LOGO is not set | ||
612 | # CONFIG_BACKLIGHT_LCD_SUPPORT is not set | ||
613 | |||
614 | # | ||
615 | # Sound | ||
616 | # | ||
617 | # CONFIG_SOUND is not set | ||
618 | |||
619 | # | ||
620 | # USB support | ||
621 | # | ||
622 | CONFIG_USB_ARCH_HAS_HCD=y | ||
623 | # CONFIG_USB_ARCH_HAS_OHCI is not set | ||
624 | # CONFIG_USB is not set | ||
625 | |||
626 | # | ||
627 | # USB Gadget Support | ||
628 | # | ||
629 | # CONFIG_USB_GADGET is not set | ||
630 | |||
631 | # | ||
632 | # MMC/SD Card support | ||
633 | # | ||
634 | # CONFIG_MMC is not set | ||
635 | |||
636 | # | ||
637 | # File systems | ||
638 | # | ||
639 | CONFIG_EXT2_FS=y | ||
640 | # CONFIG_EXT2_FS_XATTR is not set | ||
641 | # CONFIG_EXT3_FS is not set | ||
642 | # CONFIG_JBD is not set | ||
643 | # CONFIG_REISERFS_FS is not set | ||
644 | # CONFIG_JFS_FS is not set | ||
645 | |||
646 | # | ||
647 | # XFS support | ||
648 | # | ||
649 | # CONFIG_XFS_FS is not set | ||
650 | # CONFIG_MINIX_FS is not set | ||
651 | # CONFIG_ROMFS_FS is not set | ||
652 | # CONFIG_QUOTA is not set | ||
653 | CONFIG_DNOTIFY=y | ||
654 | # CONFIG_AUTOFS_FS is not set | ||
655 | # CONFIG_AUTOFS4_FS is not set | ||
656 | |||
657 | # | ||
658 | # CD-ROM/DVD Filesystems | ||
659 | # | ||
660 | # CONFIG_ISO9660_FS is not set | ||
661 | # CONFIG_UDF_FS is not set | ||
662 | |||
663 | # | ||
664 | # DOS/FAT/NT Filesystems | ||
665 | # | ||
666 | CONFIG_FAT_FS=y | ||
667 | CONFIG_MSDOS_FS=y | ||
668 | # CONFIG_VFAT_FS is not set | ||
669 | CONFIG_FAT_DEFAULT_CODEPAGE=437 | ||
670 | # CONFIG_NTFS_FS is not set | ||
671 | |||
672 | # | ||
673 | # Pseudo filesystems | ||
674 | # | ||
675 | CONFIG_PROC_FS=y | ||
676 | CONFIG_SYSFS=y | ||
677 | # CONFIG_DEVFS_FS is not set | ||
678 | # CONFIG_DEVPTS_FS_XATTR is not set | ||
679 | # CONFIG_TMPFS is not set | ||
680 | # CONFIG_HUGETLB_PAGE is not set | ||
681 | CONFIG_RAMFS=y | ||
682 | |||
683 | # | ||
684 | # Miscellaneous filesystems | ||
685 | # | ||
686 | # CONFIG_ADFS_FS is not set | ||
687 | # CONFIG_AFFS_FS is not set | ||
688 | # CONFIG_HFS_FS is not set | ||
689 | # CONFIG_HFSPLUS_FS is not set | ||
690 | # CONFIG_BEFS_FS is not set | ||
691 | # CONFIG_BFS_FS is not set | ||
692 | # CONFIG_EFS_FS is not set | ||
693 | # CONFIG_CRAMFS is not set | ||
694 | # CONFIG_VXFS_FS is not set | ||
695 | # CONFIG_HPFS_FS is not set | ||
696 | # CONFIG_QNX4FS_FS is not set | ||
697 | # CONFIG_SYSV_FS is not set | ||
698 | # CONFIG_UFS_FS is not set | ||
699 | |||
700 | # | ||
701 | # Network File Systems | ||
702 | # | ||
703 | CONFIG_NFS_FS=y | ||
704 | # CONFIG_NFS_V3 is not set | ||
705 | # CONFIG_NFS_V4 is not set | ||
706 | # CONFIG_NFS_DIRECTIO is not set | ||
707 | # CONFIG_NFSD is not set | ||
708 | CONFIG_LOCKD=y | ||
709 | CONFIG_SUNRPC=y | ||
710 | # CONFIG_RPCSEC_GSS_KRB5 is not set | ||
711 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | ||
712 | # CONFIG_SMB_FS is not set | ||
713 | # CONFIG_CIFS is not set | ||
714 | # CONFIG_NCP_FS is not set | ||
715 | # CONFIG_CODA_FS is not set | ||
716 | # CONFIG_AFS_FS is not set | ||
717 | |||
718 | # | ||
719 | # Partition Types | ||
720 | # | ||
721 | # CONFIG_PARTITION_ADVANCED is not set | ||
722 | CONFIG_MSDOS_PARTITION=y | ||
723 | |||
724 | # | ||
725 | # Native Language Support | ||
726 | # | ||
727 | CONFIG_NLS=y | ||
728 | CONFIG_NLS_DEFAULT="iso8859-1" | ||
729 | # CONFIG_NLS_CODEPAGE_437 is not set | ||
730 | # CONFIG_NLS_CODEPAGE_737 is not set | ||
731 | # CONFIG_NLS_CODEPAGE_775 is not set | ||
732 | # CONFIG_NLS_CODEPAGE_850 is not set | ||
733 | # CONFIG_NLS_CODEPAGE_852 is not set | ||
734 | # CONFIG_NLS_CODEPAGE_855 is not set | ||
735 | # CONFIG_NLS_CODEPAGE_857 is not set | ||
736 | # CONFIG_NLS_CODEPAGE_860 is not set | ||
737 | # CONFIG_NLS_CODEPAGE_861 is not set | ||
738 | # CONFIG_NLS_CODEPAGE_862 is not set | ||
739 | # CONFIG_NLS_CODEPAGE_863 is not set | ||
740 | # CONFIG_NLS_CODEPAGE_864 is not set | ||
741 | # CONFIG_NLS_CODEPAGE_865 is not set | ||
742 | # CONFIG_NLS_CODEPAGE_866 is not set | ||
743 | # CONFIG_NLS_CODEPAGE_869 is not set | ||
744 | # CONFIG_NLS_CODEPAGE_936 is not set | ||
745 | # CONFIG_NLS_CODEPAGE_950 is not set | ||
746 | # CONFIG_NLS_CODEPAGE_932 is not set | ||
747 | # CONFIG_NLS_CODEPAGE_949 is not set | ||
748 | # CONFIG_NLS_CODEPAGE_874 is not set | ||
749 | # CONFIG_NLS_ISO8859_8 is not set | ||
750 | # CONFIG_NLS_CODEPAGE_1250 is not set | ||
751 | # CONFIG_NLS_CODEPAGE_1251 is not set | ||
752 | # CONFIG_NLS_ASCII is not set | ||
753 | # CONFIG_NLS_ISO8859_1 is not set | ||
754 | # CONFIG_NLS_ISO8859_2 is not set | ||
755 | # CONFIG_NLS_ISO8859_3 is not set | ||
756 | # CONFIG_NLS_ISO8859_4 is not set | ||
757 | # CONFIG_NLS_ISO8859_5 is not set | ||
758 | # CONFIG_NLS_ISO8859_6 is not set | ||
759 | # CONFIG_NLS_ISO8859_7 is not set | ||
760 | # CONFIG_NLS_ISO8859_9 is not set | ||
761 | # CONFIG_NLS_ISO8859_13 is not set | ||
762 | # CONFIG_NLS_ISO8859_14 is not set | ||
763 | # CONFIG_NLS_ISO8859_15 is not set | ||
764 | # CONFIG_NLS_KOI8_R is not set | ||
765 | # CONFIG_NLS_KOI8_U is not set | ||
766 | # CONFIG_NLS_UTF8 is not set | ||
767 | |||
768 | # | ||
769 | # Profiling support | ||
770 | # | ||
771 | # CONFIG_PROFILING is not set | ||
772 | |||
773 | # | ||
774 | # Kernel hacking | ||
775 | # | ||
776 | # CONFIG_PRINTK_TIME is not set | ||
777 | # CONFIG_DEBUG_KERNEL is not set | ||
778 | CONFIG_LOG_BUF_SHIFT=14 | ||
779 | CONFIG_DEBUG_BUGVERBOSE=y | ||
780 | CONFIG_FRAME_POINTER=y | ||
781 | # CONFIG_DEBUG_USER is not set | ||
782 | |||
783 | # | ||
784 | # Security options | ||
785 | # | ||
786 | # CONFIG_KEYS is not set | ||
787 | # CONFIG_SECURITY is not set | ||
788 | |||
789 | # | ||
790 | # Cryptographic options | ||
791 | # | ||
792 | # CONFIG_CRYPTO is not set | ||
793 | |||
794 | # | ||
795 | # Hardware crypto devices | ||
796 | # | ||
797 | |||
798 | # | ||
799 | # Library routines | ||
800 | # | ||
801 | # CONFIG_CRC_CCITT is not set | ||
802 | CONFIG_CRC32=y | ||
803 | # CONFIG_LIBCRC32C is not set | ||
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c index 4c38bd8bc298..835d450797a1 100644 --- a/arch/arm/kernel/armksyms.c +++ b/arch/arm/kernel/armksyms.c | |||
@@ -30,9 +30,6 @@ extern void __lshrdi3(void); | |||
30 | extern void __modsi3(void); | 30 | extern void __modsi3(void); |
31 | extern void __muldi3(void); | 31 | extern void __muldi3(void); |
32 | extern void __ucmpdi2(void); | 32 | extern void __ucmpdi2(void); |
33 | extern void __udivdi3(void); | ||
34 | extern void __umoddi3(void); | ||
35 | extern void __udivmoddi4(void); | ||
36 | extern void __udivsi3(void); | 33 | extern void __udivsi3(void); |
37 | extern void __umodsi3(void); | 34 | extern void __umodsi3(void); |
38 | extern void __do_div64(void); | 35 | extern void __do_div64(void); |
@@ -44,7 +41,10 @@ extern void fp_enter(void); | |||
44 | * This has a special calling convention; it doesn't | 41 | * This has a special calling convention; it doesn't |
45 | * modify any of the usual registers, except for LR. | 42 | * modify any of the usual registers, except for LR. |
46 | */ | 43 | */ |
44 | #define EXPORT_CRC_ALIAS(sym) __CRC_SYMBOL(sym, "") | ||
45 | |||
47 | #define EXPORT_SYMBOL_ALIAS(sym,orig) \ | 46 | #define EXPORT_SYMBOL_ALIAS(sym,orig) \ |
47 | EXPORT_CRC_ALIAS(sym) \ | ||
48 | const struct kernel_symbol __ksymtab_##sym \ | 48 | const struct kernel_symbol __ksymtab_##sym \ |
49 | __attribute__((section("__ksymtab"))) = \ | 49 | __attribute__((section("__ksymtab"))) = \ |
50 | { (unsigned long)&orig, #sym }; | 50 | { (unsigned long)&orig, #sym }; |
@@ -134,9 +134,6 @@ EXPORT_SYMBOL(__lshrdi3); | |||
134 | EXPORT_SYMBOL(__modsi3); | 134 | EXPORT_SYMBOL(__modsi3); |
135 | EXPORT_SYMBOL(__muldi3); | 135 | EXPORT_SYMBOL(__muldi3); |
136 | EXPORT_SYMBOL(__ucmpdi2); | 136 | EXPORT_SYMBOL(__ucmpdi2); |
137 | EXPORT_SYMBOL(__udivdi3); | ||
138 | EXPORT_SYMBOL(__umoddi3); | ||
139 | EXPORT_SYMBOL(__udivmoddi4); | ||
140 | EXPORT_SYMBOL(__udivsi3); | 137 | EXPORT_SYMBOL(__udivsi3); |
141 | EXPORT_SYMBOL(__umodsi3); | 138 | EXPORT_SYMBOL(__umodsi3); |
142 | EXPORT_SYMBOL(__do_div64); | 139 | EXPORT_SYMBOL(__do_div64); |
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index bd4823c74645..1155cf07c871 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -344,9 +344,9 @@ __create_page_tables: | |||
344 | str r6, [r0] | 344 | str r6, [r0] |
345 | #endif | 345 | #endif |
346 | 346 | ||
347 | #ifdef CONFIG_DEBUG_LL | ||
347 | bic r7, r7, #0x0c @ turn off cacheable | 348 | bic r7, r7, #0x0c @ turn off cacheable |
348 | @ and bufferable bits | 349 | @ and bufferable bits |
349 | #ifdef CONFIG_DEBUG_LL | ||
350 | /* | 350 | /* |
351 | * Map in IO space for serial debugging. | 351 | * Map in IO space for serial debugging. |
352 | * This allows debug messages to be output | 352 | * This allows debug messages to be output |
@@ -372,28 +372,24 @@ __create_page_tables: | |||
372 | teq r1, #MACH_TYPE_NETWINDER | 372 | teq r1, #MACH_TYPE_NETWINDER |
373 | teqne r1, #MACH_TYPE_CATS | 373 | teqne r1, #MACH_TYPE_CATS |
374 | bne 1f | 374 | bne 1f |
375 | add r0, r4, #0x3fc0 @ ff000000 | 375 | add r0, r4, #0xff000000 >> 18 |
376 | mov r3, #0x7c000000 | 376 | orr r3, r7, #0x7c000000 |
377 | orr r3, r3, r7 | 377 | str r3, [r0] |
378 | str r3, [r0], #4 | ||
379 | add r3, r3, #1 << 20 | ||
380 | str r3, [r0], #4 | ||
381 | 1: | 378 | 1: |
382 | #endif | 379 | #endif |
383 | #endif | ||
384 | #ifdef CONFIG_ARCH_RPC | 380 | #ifdef CONFIG_ARCH_RPC |
385 | /* | 381 | /* |
386 | * Map in screen at 0x02000000 & SCREEN2_BASE | 382 | * Map in screen at 0x02000000 & SCREEN2_BASE |
387 | * Similar reasons here - for debug. This is | 383 | * Similar reasons here - for debug. This is |
388 | * only for Acorn RiscPC architectures. | 384 | * only for Acorn RiscPC architectures. |
389 | */ | 385 | */ |
390 | add r0, r4, #0x80 @ 02000000 | 386 | add r0, r4, #0x02000000 >> 18 |
391 | mov r3, #0x02000000 | 387 | orr r3, r7, #0x02000000 |
392 | orr r3, r3, r7 | ||
393 | str r3, [r0] | 388 | str r3, [r0] |
394 | add r0, r4, #0x3600 @ d8000000 | 389 | add r0, r4, #0xd8000000 >> 18 |
395 | str r3, [r0] | 390 | str r3, [r0] |
396 | #endif | 391 | #endif |
392 | #endif | ||
397 | mov pc, lr | 393 | mov pc, lr |
398 | .ltorg | 394 | .ltorg |
399 | 395 | ||
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 8cf733daa800..c9b69771f92e 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -359,7 +359,8 @@ void cpu_init(void) | |||
359 | "I" (offsetof(struct stack, abt[0])), | 359 | "I" (offsetof(struct stack, abt[0])), |
360 | "I" (PSR_F_BIT | PSR_I_BIT | UND_MODE), | 360 | "I" (PSR_F_BIT | PSR_I_BIT | UND_MODE), |
361 | "I" (offsetof(struct stack, und[0])), | 361 | "I" (offsetof(struct stack, und[0])), |
362 | "I" (PSR_F_BIT | PSR_I_BIT | SVC_MODE)); | 362 | "I" (PSR_F_BIT | PSR_I_BIT | SVC_MODE) |
363 | : "r14"); | ||
363 | } | 364 | } |
364 | 365 | ||
365 | static struct machine_desc * __init setup_machine(unsigned int nr) | 366 | static struct machine_desc * __init setup_machine(unsigned int nr) |
@@ -736,8 +737,8 @@ void __init setup_arch(char **cmdline_p) | |||
736 | if (mdesc->soft_reboot) | 737 | if (mdesc->soft_reboot) |
737 | reboot_setup("s"); | 738 | reboot_setup("s"); |
738 | 739 | ||
739 | if (mdesc->param_offset) | 740 | if (mdesc->boot_params) |
740 | tags = phys_to_virt(mdesc->param_offset); | 741 | tags = phys_to_virt(mdesc->boot_params); |
741 | 742 | ||
742 | /* | 743 | /* |
743 | * If we have the old style parameters, convert them to | 744 | * If we have the old style parameters, convert them to |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 34892758f098..a931409c8fe4 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -502,3 +502,126 @@ int __init setup_profiling_timer(unsigned int multiplier) | |||
502 | { | 502 | { |
503 | return -EINVAL; | 503 | return -EINVAL; |
504 | } | 504 | } |
505 | |||
506 | static int | ||
507 | on_each_cpu_mask(void (*func)(void *), void *info, int retry, int wait, | ||
508 | cpumask_t mask) | ||
509 | { | ||
510 | int ret = 0; | ||
511 | |||
512 | preempt_disable(); | ||
513 | |||
514 | ret = smp_call_function_on_cpu(func, info, retry, wait, mask); | ||
515 | if (cpu_isset(smp_processor_id(), mask)) | ||
516 | func(info); | ||
517 | |||
518 | preempt_enable(); | ||
519 | |||
520 | return ret; | ||
521 | } | ||
522 | |||
523 | /**********************************************************************/ | ||
524 | |||
525 | /* | ||
526 | * TLB operations | ||
527 | */ | ||
528 | struct tlb_args { | ||
529 | struct vm_area_struct *ta_vma; | ||
530 | unsigned long ta_start; | ||
531 | unsigned long ta_end; | ||
532 | }; | ||
533 | |||
534 | static inline void ipi_flush_tlb_all(void *ignored) | ||
535 | { | ||
536 | local_flush_tlb_all(); | ||
537 | } | ||
538 | |||
539 | static inline void ipi_flush_tlb_mm(void *arg) | ||
540 | { | ||
541 | struct mm_struct *mm = (struct mm_struct *)arg; | ||
542 | |||
543 | local_flush_tlb_mm(mm); | ||
544 | } | ||
545 | |||
546 | static inline void ipi_flush_tlb_page(void *arg) | ||
547 | { | ||
548 | struct tlb_args *ta = (struct tlb_args *)arg; | ||
549 | |||
550 | local_flush_tlb_page(ta->ta_vma, ta->ta_start); | ||
551 | } | ||
552 | |||
553 | static inline void ipi_flush_tlb_kernel_page(void *arg) | ||
554 | { | ||
555 | struct tlb_args *ta = (struct tlb_args *)arg; | ||
556 | |||
557 | local_flush_tlb_kernel_page(ta->ta_start); | ||
558 | } | ||
559 | |||
560 | static inline void ipi_flush_tlb_range(void *arg) | ||
561 | { | ||
562 | struct tlb_args *ta = (struct tlb_args *)arg; | ||
563 | |||
564 | local_flush_tlb_range(ta->ta_vma, ta->ta_start, ta->ta_end); | ||
565 | } | ||
566 | |||
567 | static inline void ipi_flush_tlb_kernel_range(void *arg) | ||
568 | { | ||
569 | struct tlb_args *ta = (struct tlb_args *)arg; | ||
570 | |||
571 | local_flush_tlb_kernel_range(ta->ta_start, ta->ta_end); | ||
572 | } | ||
573 | |||
574 | void flush_tlb_all(void) | ||
575 | { | ||
576 | on_each_cpu(ipi_flush_tlb_all, NULL, 1, 1); | ||
577 | } | ||
578 | |||
579 | void flush_tlb_mm(struct mm_struct *mm) | ||
580 | { | ||
581 | cpumask_t mask = mm->cpu_vm_mask; | ||
582 | |||
583 | on_each_cpu_mask(ipi_flush_tlb_mm, mm, 1, 1, mask); | ||
584 | } | ||
585 | |||
586 | void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) | ||
587 | { | ||
588 | cpumask_t mask = vma->vm_mm->cpu_vm_mask; | ||
589 | struct tlb_args ta; | ||
590 | |||
591 | ta.ta_vma = vma; | ||
592 | ta.ta_start = uaddr; | ||
593 | |||
594 | on_each_cpu_mask(ipi_flush_tlb_page, &ta, 1, 1, mask); | ||
595 | } | ||
596 | |||
597 | void flush_tlb_kernel_page(unsigned long kaddr) | ||
598 | { | ||
599 | struct tlb_args ta; | ||
600 | |||
601 | ta.ta_start = kaddr; | ||
602 | |||
603 | on_each_cpu(ipi_flush_tlb_kernel_page, &ta, 1, 1); | ||
604 | } | ||
605 | |||
606 | void flush_tlb_range(struct vm_area_struct *vma, | ||
607 | unsigned long start, unsigned long end) | ||
608 | { | ||
609 | cpumask_t mask = vma->vm_mm->cpu_vm_mask; | ||
610 | struct tlb_args ta; | ||
611 | |||
612 | ta.ta_vma = vma; | ||
613 | ta.ta_start = start; | ||
614 | ta.ta_end = end; | ||
615 | |||
616 | on_each_cpu_mask(ipi_flush_tlb_range, &ta, 1, 1, mask); | ||
617 | } | ||
618 | |||
619 | void flush_tlb_kernel_range(unsigned long start, unsigned long end) | ||
620 | { | ||
621 | struct tlb_args ta; | ||
622 | |||
623 | ta.ta_start = start; | ||
624 | ta.ta_end = end; | ||
625 | |||
626 | on_each_cpu(ipi_flush_tlb_kernel_range, &ta, 1, 1); | ||
627 | } | ||
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 2fb0a4cfb37a..df2cb06ce424 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -230,16 +230,8 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err) | |||
230 | do_exit(SIGSEGV); | 230 | do_exit(SIGSEGV); |
231 | } | 231 | } |
232 | 232 | ||
233 | void die_if_kernel(const char *str, struct pt_regs *regs, int err) | 233 | void notify_die(const char *str, struct pt_regs *regs, struct siginfo *info, |
234 | { | 234 | unsigned long err, unsigned long trap) |
235 | if (user_mode(regs)) | ||
236 | return; | ||
237 | |||
238 | die(str, regs, err); | ||
239 | } | ||
240 | |||
241 | static void notify_die(const char *str, struct pt_regs *regs, siginfo_t *info, | ||
242 | unsigned long err, unsigned long trap) | ||
243 | { | 235 | { |
244 | if (user_mode(regs)) { | 236 | if (user_mode(regs)) { |
245 | current->thread.error_code = err; | 237 | current->thread.error_code = err; |
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index c0e65833ffc4..8725d63e4219 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile | |||
@@ -11,7 +11,7 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ | |||
11 | strnlen_user.o strchr.o strrchr.o testchangebit.o \ | 11 | strnlen_user.o strchr.o strrchr.o testchangebit.o \ |
12 | testclearbit.o testsetbit.o uaccess.o getuser.o \ | 12 | testclearbit.o testsetbit.o uaccess.o getuser.o \ |
13 | putuser.o ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ | 13 | putuser.o ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ |
14 | ucmpdi2.o udivdi3.o lib1funcs.o div64.o \ | 14 | ucmpdi2.o lib1funcs.o div64.o \ |
15 | io-readsb.o io-writesb.o io-readsl.o io-writesl.o | 15 | io-readsb.o io-writesb.o io-readsl.o io-writesl.o |
16 | 16 | ||
17 | ifeq ($(CONFIG_CPU_32v3),y) | 17 | ifeq ($(CONFIG_CPU_32v3),y) |
diff --git a/arch/arm/lib/longlong.h b/arch/arm/lib/longlong.h deleted file mode 100644 index 90ae647e4d76..000000000000 --- a/arch/arm/lib/longlong.h +++ /dev/null | |||
@@ -1,183 +0,0 @@ | |||
1 | /* longlong.h -- based on code from gcc-2.95.3 | ||
2 | |||
3 | definitions for mixed size 32/64 bit arithmetic. | ||
4 | Copyright (C) 1991, 92, 94, 95, 96, 1997, 1998 Free Software Foundation, Inc. | ||
5 | |||
6 | This definition file is free software; you can redistribute it | ||
7 | and/or modify it under the terms of the GNU General Public | ||
8 | License as published by the Free Software Foundation; either | ||
9 | version 2, or (at your option) any later version. | ||
10 | |||
11 | This definition file is distributed in the hope that it will be | ||
12 | useful, but WITHOUT ANY WARRANTY; without even the implied | ||
13 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
14 | See the 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., 59 Temple Place - Suite 330, | ||
19 | Boston, MA 02111-1307, USA. */ | ||
20 | |||
21 | /* Borrowed from GCC 2.95.3, I Molton 29/07/01 */ | ||
22 | |||
23 | #ifndef SI_TYPE_SIZE | ||
24 | #define SI_TYPE_SIZE 32 | ||
25 | #endif | ||
26 | |||
27 | #define __BITS4 (SI_TYPE_SIZE / 4) | ||
28 | #define __ll_B (1L << (SI_TYPE_SIZE / 2)) | ||
29 | #define __ll_lowpart(t) ((u32) (t) % __ll_B) | ||
30 | #define __ll_highpart(t) ((u32) (t) / __ll_B) | ||
31 | |||
32 | /* Define auxiliary asm macros. | ||
33 | |||
34 | 1) umul_ppmm(high_prod, low_prod, multipler, multiplicand) | ||
35 | multiplies two u32 integers MULTIPLER and MULTIPLICAND, | ||
36 | and generates a two-part u32 product in HIGH_PROD and | ||
37 | LOW_PROD. | ||
38 | |||
39 | 2) __umulsidi3(a,b) multiplies two u32 integers A and B, | ||
40 | and returns a u64 product. This is just a variant of umul_ppmm. | ||
41 | |||
42 | 3) udiv_qrnnd(quotient, remainder, high_numerator, low_numerator, | ||
43 | denominator) divides a two-word unsigned integer, composed by the | ||
44 | integers HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and | ||
45 | places the quotient in QUOTIENT and the remainder in REMAINDER. | ||
46 | HIGH_NUMERATOR must be less than DENOMINATOR for correct operation. | ||
47 | If, in addition, the most significant bit of DENOMINATOR must be 1, | ||
48 | then the pre-processor symbol UDIV_NEEDS_NORMALIZATION is defined to 1. | ||
49 | |||
50 | 4) sdiv_qrnnd(quotient, remainder, high_numerator, low_numerator, | ||
51 | denominator). Like udiv_qrnnd but the numbers are signed. The | ||
52 | quotient is rounded towards 0. | ||
53 | |||
54 | 5) count_leading_zeros(count, x) counts the number of zero-bits from | ||
55 | the msb to the first non-zero bit. This is the number of steps X | ||
56 | needs to be shifted left to set the msb. Undefined for X == 0. | ||
57 | |||
58 | 6) add_ssaaaa(high_sum, low_sum, high_addend_1, low_addend_1, | ||
59 | high_addend_2, low_addend_2) adds two two-word unsigned integers, | ||
60 | composed by HIGH_ADDEND_1 and LOW_ADDEND_1, and HIGH_ADDEND_2 and | ||
61 | LOW_ADDEND_2 respectively. The result is placed in HIGH_SUM and | ||
62 | LOW_SUM. Overflow (i.e. carry out) is not stored anywhere, and is | ||
63 | lost. | ||
64 | |||
65 | 7) sub_ddmmss(high_difference, low_difference, high_minuend, | ||
66 | low_minuend, high_subtrahend, low_subtrahend) subtracts two | ||
67 | two-word unsigned integers, composed by HIGH_MINUEND_1 and | ||
68 | LOW_MINUEND_1, and HIGH_SUBTRAHEND_2 and LOW_SUBTRAHEND_2 | ||
69 | respectively. The result is placed in HIGH_DIFFERENCE and | ||
70 | LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere, | ||
71 | and is lost. | ||
72 | |||
73 | If any of these macros are left undefined for a particular CPU, | ||
74 | C macros are used. */ | ||
75 | |||
76 | #if defined (__arm__) | ||
77 | #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ | ||
78 | __asm__ ("adds %1, %4, %5 \n\ | ||
79 | adc %0, %2, %3" \ | ||
80 | : "=r" ((u32) (sh)), \ | ||
81 | "=&r" ((u32) (sl)) \ | ||
82 | : "%r" ((u32) (ah)), \ | ||
83 | "rI" ((u32) (bh)), \ | ||
84 | "%r" ((u32) (al)), \ | ||
85 | "rI" ((u32) (bl))) | ||
86 | #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ | ||
87 | __asm__ ("subs %1, %4, %5 \n\ | ||
88 | sbc %0, %2, %3" \ | ||
89 | : "=r" ((u32) (sh)), \ | ||
90 | "=&r" ((u32) (sl)) \ | ||
91 | : "r" ((u32) (ah)), \ | ||
92 | "rI" ((u32) (bh)), \ | ||
93 | "r" ((u32) (al)), \ | ||
94 | "rI" ((u32) (bl))) | ||
95 | #define umul_ppmm(xh, xl, a, b) \ | ||
96 | {register u32 __t0, __t1, __t2; \ | ||
97 | __asm__ ("%@ Inlined umul_ppmm \n\ | ||
98 | mov %2, %5, lsr #16 \n\ | ||
99 | mov %0, %6, lsr #16 \n\ | ||
100 | bic %3, %5, %2, lsl #16 \n\ | ||
101 | bic %4, %6, %0, lsl #16 \n\ | ||
102 | mul %1, %3, %4 \n\ | ||
103 | mul %4, %2, %4 \n\ | ||
104 | mul %3, %0, %3 \n\ | ||
105 | mul %0, %2, %0 \n\ | ||
106 | adds %3, %4, %3 \n\ | ||
107 | addcs %0, %0, #65536 \n\ | ||
108 | adds %1, %1, %3, lsl #16 \n\ | ||
109 | adc %0, %0, %3, lsr #16" \ | ||
110 | : "=&r" ((u32) (xh)), \ | ||
111 | "=r" ((u32) (xl)), \ | ||
112 | "=&r" (__t0), "=&r" (__t1), "=r" (__t2) \ | ||
113 | : "r" ((u32) (a)), \ | ||
114 | "r" ((u32) (b)));} | ||
115 | #define UMUL_TIME 20 | ||
116 | #define UDIV_TIME 100 | ||
117 | #endif /* __arm__ */ | ||
118 | |||
119 | #define __umulsidi3(u, v) \ | ||
120 | ({DIunion __w; \ | ||
121 | umul_ppmm (__w.s.high, __w.s.low, u, v); \ | ||
122 | __w.ll; }) | ||
123 | |||
124 | #define __udiv_qrnnd_c(q, r, n1, n0, d) \ | ||
125 | do { \ | ||
126 | u32 __d1, __d0, __q1, __q0; \ | ||
127 | u32 __r1, __r0, __m; \ | ||
128 | __d1 = __ll_highpart (d); \ | ||
129 | __d0 = __ll_lowpart (d); \ | ||
130 | \ | ||
131 | __r1 = (n1) % __d1; \ | ||
132 | __q1 = (n1) / __d1; \ | ||
133 | __m = (u32) __q1 * __d0; \ | ||
134 | __r1 = __r1 * __ll_B | __ll_highpart (n0); \ | ||
135 | if (__r1 < __m) \ | ||
136 | { \ | ||
137 | __q1--, __r1 += (d); \ | ||
138 | if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\ | ||
139 | if (__r1 < __m) \ | ||
140 | __q1--, __r1 += (d); \ | ||
141 | } \ | ||
142 | __r1 -= __m; \ | ||
143 | \ | ||
144 | __r0 = __r1 % __d1; \ | ||
145 | __q0 = __r1 / __d1; \ | ||
146 | __m = (u32) __q0 * __d0; \ | ||
147 | __r0 = __r0 * __ll_B | __ll_lowpart (n0); \ | ||
148 | if (__r0 < __m) \ | ||
149 | { \ | ||
150 | __q0--, __r0 += (d); \ | ||
151 | if (__r0 >= (d)) \ | ||
152 | if (__r0 < __m) \ | ||
153 | __q0--, __r0 += (d); \ | ||
154 | } \ | ||
155 | __r0 -= __m; \ | ||
156 | \ | ||
157 | (q) = (u32) __q1 * __ll_B | __q0; \ | ||
158 | (r) = __r0; \ | ||
159 | } while (0) | ||
160 | |||
161 | #define UDIV_NEEDS_NORMALIZATION 1 | ||
162 | #define udiv_qrnnd __udiv_qrnnd_c | ||
163 | |||
164 | #define count_leading_zeros(count, x) \ | ||
165 | do { \ | ||
166 | u32 __xr = (x); \ | ||
167 | u32 __a; \ | ||
168 | \ | ||
169 | if (SI_TYPE_SIZE <= 32) \ | ||
170 | { \ | ||
171 | __a = __xr < ((u32)1<<2*__BITS4) \ | ||
172 | ? (__xr < ((u32)1<<__BITS4) ? 0 : __BITS4) \ | ||
173 | : (__xr < ((u32)1<<3*__BITS4) ? 2*__BITS4 : 3*__BITS4); \ | ||
174 | } \ | ||
175 | else \ | ||
176 | { \ | ||
177 | for (__a = SI_TYPE_SIZE - 8; __a > 0; __a -= 8) \ | ||
178 | if (((__xr >> __a) & 0xff) != 0) \ | ||
179 | break; \ | ||
180 | } \ | ||
181 | \ | ||
182 | (count) = SI_TYPE_SIZE - (__clz_tab[__xr >> __a] + __a); \ | ||
183 | } while (0) | ||
diff --git a/arch/arm/lib/udivdi3.c b/arch/arm/lib/udivdi3.c deleted file mode 100644 index e343be4c6642..000000000000 --- a/arch/arm/lib/udivdi3.c +++ /dev/null | |||
@@ -1,222 +0,0 @@ | |||
1 | /* More subroutines needed by GCC output code on some machines. */ | ||
2 | /* Compile this one with gcc. */ | ||
3 | /* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc. | ||
4 | |||
5 | This file is part of GNU CC. | ||
6 | |||
7 | GNU CC is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2, or (at your option) | ||
10 | any later version. | ||
11 | |||
12 | GNU CC is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with GNU CC; see the file COPYING. If not, write to | ||
19 | the Free Software Foundation, 59 Temple Place - Suite 330, | ||
20 | Boston, MA 02111-1307, USA. */ | ||
21 | |||
22 | /* As a special exception, if you link this library with other files, | ||
23 | some of which are compiled with GCC, to produce an executable, | ||
24 | this library does not by itself cause the resulting executable | ||
25 | to be covered by the GNU General Public License. | ||
26 | This exception does not however invalidate any other reasons why | ||
27 | the executable file might be covered by the GNU General Public License. | ||
28 | */ | ||
29 | /* support functions required by the kernel. based on code from gcc-2.95.3 */ | ||
30 | /* I Molton 29/07/01 */ | ||
31 | |||
32 | #include "gcclib.h" | ||
33 | #include "longlong.h" | ||
34 | |||
35 | static const u8 __clz_tab[] = { | ||
36 | 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, | ||
37 | 5, 5, 5, 5, 5, 5, 5, 5, | ||
38 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
39 | 6, 6, 6, 6, 6, 6, 6, 6, | ||
40 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
41 | 7, 7, 7, 7, 7, 7, 7, 7, | ||
42 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
43 | 7, 7, 7, 7, 7, 7, 7, 7, | ||
44 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
45 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
46 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
47 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
48 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
49 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
50 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
51 | 8, 8, 8, 8, 8, 8, 8, 8, | ||
52 | }; | ||
53 | |||
54 | u64 __udivmoddi4(u64 n, u64 d, u64 * rp) | ||
55 | { | ||
56 | DIunion ww; | ||
57 | DIunion nn, dd; | ||
58 | DIunion rr; | ||
59 | u32 d0, d1, n0, n1, n2; | ||
60 | u32 q0, q1; | ||
61 | u32 b, bm; | ||
62 | |||
63 | nn.ll = n; | ||
64 | dd.ll = d; | ||
65 | |||
66 | d0 = dd.s.low; | ||
67 | d1 = dd.s.high; | ||
68 | n0 = nn.s.low; | ||
69 | n1 = nn.s.high; | ||
70 | |||
71 | if (d1 == 0) { | ||
72 | if (d0 > n1) { | ||
73 | /* 0q = nn / 0D */ | ||
74 | |||
75 | count_leading_zeros(bm, d0); | ||
76 | |||
77 | if (bm != 0) { | ||
78 | /* Normalize, i.e. make the most significant bit of the | ||
79 | denominator set. */ | ||
80 | |||
81 | d0 = d0 << bm; | ||
82 | n1 = (n1 << bm) | (n0 >> (SI_TYPE_SIZE - bm)); | ||
83 | n0 = n0 << bm; | ||
84 | } | ||
85 | |||
86 | udiv_qrnnd(q0, n0, n1, n0, d0); | ||
87 | q1 = 0; | ||
88 | |||
89 | /* Remainder in n0 >> bm. */ | ||
90 | } else { | ||
91 | /* qq = NN / 0d */ | ||
92 | |||
93 | if (d0 == 0) | ||
94 | d0 = 1 / d0; /* Divide intentionally by zero. */ | ||
95 | |||
96 | count_leading_zeros(bm, d0); | ||
97 | |||
98 | if (bm == 0) { | ||
99 | /* From (n1 >= d0) /\ (the most significant bit of d0 is set), | ||
100 | conclude (the most significant bit of n1 is set) /\ (the | ||
101 | leading quotient digit q1 = 1). | ||
102 | |||
103 | This special case is necessary, not an optimization. | ||
104 | (Shifts counts of SI_TYPE_SIZE are undefined.) */ | ||
105 | |||
106 | n1 -= d0; | ||
107 | q1 = 1; | ||
108 | } else { | ||
109 | /* Normalize. */ | ||
110 | |||
111 | b = SI_TYPE_SIZE - bm; | ||
112 | |||
113 | d0 = d0 << bm; | ||
114 | n2 = n1 >> b; | ||
115 | n1 = (n1 << bm) | (n0 >> b); | ||
116 | n0 = n0 << bm; | ||
117 | |||
118 | udiv_qrnnd(q1, n1, n2, n1, d0); | ||
119 | } | ||
120 | |||
121 | /* n1 != d0... */ | ||
122 | |||
123 | udiv_qrnnd(q0, n0, n1, n0, d0); | ||
124 | |||
125 | /* Remainder in n0 >> bm. */ | ||
126 | } | ||
127 | |||
128 | if (rp != 0) { | ||
129 | rr.s.low = n0 >> bm; | ||
130 | rr.s.high = 0; | ||
131 | *rp = rr.ll; | ||
132 | } | ||
133 | } else { | ||
134 | if (d1 > n1) { | ||
135 | /* 00 = nn / DD */ | ||
136 | |||
137 | q0 = 0; | ||
138 | q1 = 0; | ||
139 | |||
140 | /* Remainder in n1n0. */ | ||
141 | if (rp != 0) { | ||
142 | rr.s.low = n0; | ||
143 | rr.s.high = n1; | ||
144 | *rp = rr.ll; | ||
145 | } | ||
146 | } else { | ||
147 | /* 0q = NN / dd */ | ||
148 | |||
149 | count_leading_zeros(bm, d1); | ||
150 | if (bm == 0) { | ||
151 | /* From (n1 >= d1) /\ (the most significant bit of d1 is set), | ||
152 | conclude (the most significant bit of n1 is set) /\ (the | ||
153 | quotient digit q0 = 0 or 1). | ||
154 | |||
155 | This special case is necessary, not an optimization. */ | ||
156 | |||
157 | /* The condition on the next line takes advantage of that | ||
158 | n1 >= d1 (true due to program flow). */ | ||
159 | if (n1 > d1 || n0 >= d0) { | ||
160 | q0 = 1; | ||
161 | sub_ddmmss(n1, n0, n1, n0, d1, d0); | ||
162 | } else | ||
163 | q0 = 0; | ||
164 | |||
165 | q1 = 0; | ||
166 | |||
167 | if (rp != 0) { | ||
168 | rr.s.low = n0; | ||
169 | rr.s.high = n1; | ||
170 | *rp = rr.ll; | ||
171 | } | ||
172 | } else { | ||
173 | u32 m1, m0; | ||
174 | /* Normalize. */ | ||
175 | |||
176 | b = SI_TYPE_SIZE - bm; | ||
177 | |||
178 | d1 = (d1 << bm) | (d0 >> b); | ||
179 | d0 = d0 << bm; | ||
180 | n2 = n1 >> b; | ||
181 | n1 = (n1 << bm) | (n0 >> b); | ||
182 | n0 = n0 << bm; | ||
183 | |||
184 | udiv_qrnnd(q0, n1, n2, n1, d1); | ||
185 | umul_ppmm(m1, m0, q0, d0); | ||
186 | |||
187 | if (m1 > n1 || (m1 == n1 && m0 > n0)) { | ||
188 | q0--; | ||
189 | sub_ddmmss(m1, m0, m1, m0, d1, d0); | ||
190 | } | ||
191 | |||
192 | q1 = 0; | ||
193 | |||
194 | /* Remainder in (n1n0 - m1m0) >> bm. */ | ||
195 | if (rp != 0) { | ||
196 | sub_ddmmss(n1, n0, n1, n0, m1, m0); | ||
197 | rr.s.low = (n1 << b) | (n0 >> bm); | ||
198 | rr.s.high = n1 >> bm; | ||
199 | *rp = rr.ll; | ||
200 | } | ||
201 | } | ||
202 | } | ||
203 | } | ||
204 | |||
205 | ww.s.low = q0; | ||
206 | ww.s.high = q1; | ||
207 | return ww.ll; | ||
208 | } | ||
209 | |||
210 | u64 __udivdi3(u64 n, u64 d) | ||
211 | { | ||
212 | return __udivmoddi4(n, d, (u64 *) 0); | ||
213 | } | ||
214 | |||
215 | u64 __umoddi3(u64 u, u64 v) | ||
216 | { | ||
217 | u64 w; | ||
218 | |||
219 | (void)__udivmoddi4(u, v, &w); | ||
220 | |||
221 | return w; | ||
222 | } | ||
diff --git a/arch/arm/mach-aaec2000/aaed2000.c b/arch/arm/mach-aaec2000/aaed2000.c index 5417ca3f4621..c9d899886648 100644 --- a/arch/arm/mach-aaec2000/aaed2000.c +++ b/arch/arm/mach-aaec2000/aaed2000.c | |||
@@ -40,9 +40,11 @@ static void __init aaed2000_map_io(void) | |||
40 | } | 40 | } |
41 | 41 | ||
42 | MACHINE_START(AAED2000, "Agilent AAED-2000 Development Platform") | 42 | MACHINE_START(AAED2000, "Agilent AAED-2000 Development Platform") |
43 | MAINTAINER("Nicolas Bellido Y Ortega") | 43 | /* Maintainer: Nicolas Bellido Y Ortega */ |
44 | BOOT_MEM(0xf0000000, PIO_BASE, VIO_BASE) | 44 | .phys_ram = 0xf0000000, |
45 | MAPIO(aaed2000_map_io) | 45 | .phys_io = PIO_BASE, |
46 | INITIRQ(aaed2000_init_irq) | 46 | .io_pg_offst = ((VIO_BASE) >> 18) & 0xfffc, |
47 | .map_io = aaed2000_map_io, | ||
48 | .init_irq = aaed2000_init_irq, | ||
47 | .timer = &aaec2000_timer, | 49 | .timer = &aaec2000_timer, |
48 | MACHINE_END | 50 | MACHINE_END |
diff --git a/arch/arm/mach-clps711x/autcpu12.c b/arch/arm/mach-clps711x/autcpu12.c index c106704a2c34..dc73feb1ffb0 100644 --- a/arch/arm/mach-clps711x/autcpu12.c +++ b/arch/arm/mach-clps711x/autcpu12.c | |||
@@ -59,11 +59,13 @@ void __init autcpu12_map_io(void) | |||
59 | } | 59 | } |
60 | 60 | ||
61 | MACHINE_START(AUTCPU12, "autronix autcpu12") | 61 | MACHINE_START(AUTCPU12, "autronix autcpu12") |
62 | MAINTAINER("Thomas Gleixner") | 62 | /* Maintainer: Thomas Gleixner */ |
63 | BOOT_MEM(0xc0000000, 0x80000000, 0xff000000) | 63 | .phys_ram = 0xc0000000, |
64 | BOOT_PARAMS(0xc0020000) | 64 | .phys_io = 0x80000000, |
65 | MAPIO(autcpu12_map_io) | 65 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, |
66 | INITIRQ(clps711x_init_irq) | 66 | .boot_params = 0xc0020000, |
67 | .map_io = autcpu12_map_io, | ||
68 | .init_irq = clps711x_init_irq, | ||
67 | .timer = &clps711x_timer, | 69 | .timer = &clps711x_timer, |
68 | MACHINE_END | 70 | MACHINE_END |
69 | 71 | ||
diff --git a/arch/arm/mach-clps711x/cdb89712.c b/arch/arm/mach-clps711x/cdb89712.c index 7664f9cf83b8..a46c82cd2711 100644 --- a/arch/arm/mach-clps711x/cdb89712.c +++ b/arch/arm/mach-clps711x/cdb89712.c | |||
@@ -49,10 +49,12 @@ static void __init cdb89712_map_io(void) | |||
49 | } | 49 | } |
50 | 50 | ||
51 | MACHINE_START(CDB89712, "Cirrus-CDB89712") | 51 | MACHINE_START(CDB89712, "Cirrus-CDB89712") |
52 | MAINTAINER("Ray Lehtiniemi") | 52 | /* Maintainer: Ray Lehtiniemi */ |
53 | BOOT_MEM(0xc0000000, 0x80000000, 0xff000000) | 53 | .phys_ram = 0xc0000000, |
54 | BOOT_PARAMS(0xc0000100) | 54 | .phys_io = 0x80000000, |
55 | MAPIO(cdb89712_map_io) | 55 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, |
56 | INITIRQ(clps711x_init_irq) | 56 | .boot_params = 0xc0000100, |
57 | .map_io = cdb89712_map_io, | ||
58 | .init_irq = clps711x_init_irq, | ||
57 | .timer = &clps711x_timer, | 59 | .timer = &clps711x_timer, |
58 | MACHINE_END | 60 | MACHINE_END |
diff --git a/arch/arm/mach-clps711x/ceiva.c b/arch/arm/mach-clps711x/ceiva.c index e4093be3c4cb..780d91805984 100644 --- a/arch/arm/mach-clps711x/ceiva.c +++ b/arch/arm/mach-clps711x/ceiva.c | |||
@@ -53,10 +53,12 @@ static void __init ceiva_map_io(void) | |||
53 | 53 | ||
54 | 54 | ||
55 | MACHINE_START(CEIVA, "CEIVA/Polaroid Photo MAX Digital Picture Frame") | 55 | MACHINE_START(CEIVA, "CEIVA/Polaroid Photo MAX Digital Picture Frame") |
56 | MAINTAINER("Rob Scott") | 56 | /* Maintainer: Rob Scott */ |
57 | BOOT_MEM(0xc0000000, 0x80000000, 0xff000000) | 57 | .phys_ram = 0xc0000000, |
58 | BOOT_PARAMS(0xc0000100) | 58 | .phys_io = 0x80000000, |
59 | MAPIO(ceiva_map_io) | 59 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, |
60 | INITIRQ(clps711x_init_irq) | 60 | .boot_params = 0xc0000100, |
61 | .map_io = ceiva_map_io, | ||
62 | .init_irq = clps711x_init_irq, | ||
61 | .timer = &clps711x_timer, | 63 | .timer = &clps711x_timer, |
62 | MACHINE_END | 64 | MACHINE_END |
diff --git a/arch/arm/mach-clps711x/clep7312.c b/arch/arm/mach-clps711x/clep7312.c index 9ca21cb481ba..c83f3fd68fcd 100644 --- a/arch/arm/mach-clps711x/clep7312.c +++ b/arch/arm/mach-clps711x/clep7312.c | |||
@@ -37,12 +37,14 @@ fixup_clep7312(struct machine_desc *desc, struct tag *tags, | |||
37 | 37 | ||
38 | 38 | ||
39 | MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312") | 39 | MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312") |
40 | MAINTAINER("Nobody") | 40 | /* Maintainer: Nobody */ |
41 | BOOT_MEM(0xc0000000, 0x80000000, 0xff000000) | 41 | .phys_ram = 0xc0000000, |
42 | BOOT_PARAMS(0xc0000100) | 42 | .phys_io = 0x80000000, |
43 | FIXUP(fixup_clep7312) | 43 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, |
44 | MAPIO(clps711x_map_io) | 44 | .boot_params = 0xc0000100, |
45 | INITIRQ(clps711x_init_irq) | 45 | .fixup = fixup_clep7312, |
46 | .map_io = clps711x_map_io, | ||
47 | .init_irq = clps711x_init_irq, | ||
46 | .timer = &clps711x_timer, | 48 | .timer = &clps711x_timer, |
47 | MACHINE_END | 49 | MACHINE_END |
48 | 50 | ||
diff --git a/arch/arm/mach-clps711x/edb7211-arch.c b/arch/arm/mach-clps711x/edb7211-arch.c index c6c46324a2e3..255c98b63e15 100644 --- a/arch/arm/mach-clps711x/edb7211-arch.c +++ b/arch/arm/mach-clps711x/edb7211-arch.c | |||
@@ -51,11 +51,13 @@ fixup_edb7211(struct machine_desc *desc, struct tag *tags, | |||
51 | } | 51 | } |
52 | 52 | ||
53 | MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)") | 53 | MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)") |
54 | MAINTAINER("Jon McClintock") | 54 | /* Maintainer: Jon McClintock */ |
55 | BOOT_MEM(0xc0000000, 0x80000000, 0xff000000) | 55 | .phys_ram = 0xc0000000, |
56 | BOOT_PARAMS(0xc0020100) /* 0xc0000000 - 0xc001ffff can be video RAM */ | 56 | .phys_io = 0x80000000, |
57 | FIXUP(fixup_edb7211) | 57 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, |
58 | MAPIO(edb7211_map_io) | 58 | .boot_params = 0xc0020100, /* 0xc0000000 - 0xc001ffff can be video RAM */ |
59 | INITIRQ(clps711x_init_irq) | 59 | .fixup = fixup_edb7211, |
60 | .map_io = edb7211_map_io, | ||
61 | .init_irq = clps711x_init_irq, | ||
60 | .timer = &clps711x_timer, | 62 | .timer = &clps711x_timer, |
61 | MACHINE_END | 63 | MACHINE_END |
diff --git a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c index c1c5b8e01549..f83a59761e02 100644 --- a/arch/arm/mach-clps711x/fortunet.c +++ b/arch/arm/mach-clps711x/fortunet.c | |||
@@ -75,11 +75,13 @@ fortunet_fixup(struct machine_desc *desc, struct tag *tags, | |||
75 | } | 75 | } |
76 | 76 | ||
77 | MACHINE_START(FORTUNET, "ARM-FortuNet") | 77 | MACHINE_START(FORTUNET, "ARM-FortuNet") |
78 | MAINTAINER("FortuNet Inc.") | 78 | /* Maintainer: FortuNet Inc. */ |
79 | BOOT_MEM(0xc0000000, 0x80000000, 0xf0000000) | 79 | .phys_ram = 0xc0000000, |
80 | BOOT_PARAMS(0x00000000) | 80 | .phys_io = 0x80000000, |
81 | FIXUP(fortunet_fixup) | 81 | .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc, |
82 | MAPIO(clps711x_map_io) | 82 | .boot_params = 0x00000000, |
83 | INITIRQ(clps711x_init_irq) | 83 | .fixup = fortunet_fixup, |
84 | .map_io = clps711x_map_io, | ||
85 | .init_irq = clps711x_init_irq, | ||
84 | .timer = &clps711x_timer, | 86 | .timer = &clps711x_timer, |
85 | MACHINE_END | 87 | MACHINE_END |
diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c index 29269df054f5..5bdb90edf992 100644 --- a/arch/arm/mach-clps711x/p720t.c +++ b/arch/arm/mach-clps711x/p720t.c | |||
@@ -79,12 +79,14 @@ static void __init p720t_map_io(void) | |||
79 | } | 79 | } |
80 | 80 | ||
81 | MACHINE_START(P720T, "ARM-Prospector720T") | 81 | MACHINE_START(P720T, "ARM-Prospector720T") |
82 | MAINTAINER("ARM Ltd/Deep Blue Solutions Ltd") | 82 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
83 | BOOT_MEM(0xc0000000, 0x80000000, 0xff000000) | 83 | .phys_ram = 0xc0000000, |
84 | BOOT_PARAMS(0xc0000100) | 84 | .phys_io = 0x80000000, |
85 | FIXUP(fixup_p720t) | 85 | .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, |
86 | MAPIO(p720t_map_io) | 86 | .boot_params = 0xc0000100, |
87 | INITIRQ(clps711x_init_irq) | 87 | .fixup = fixup_p720t, |
88 | .map_io = p720t_map_io, | ||
89 | .init_irq = clps711x_init_irq, | ||
88 | .timer = &clps711x_timer, | 90 | .timer = &clps711x_timer, |
89 | MACHINE_END | 91 | MACHINE_END |
90 | 92 | ||
diff --git a/arch/arm/mach-clps7500/core.c b/arch/arm/mach-clps7500/core.c index 90e85f434f6f..112f1d68fb2b 100644 --- a/arch/arm/mach-clps7500/core.c +++ b/arch/arm/mach-clps7500/core.c | |||
@@ -366,11 +366,13 @@ static void __init clps7500_init(void) | |||
366 | } | 366 | } |
367 | 367 | ||
368 | MACHINE_START(CLPS7500, "CL-PS7500") | 368 | MACHINE_START(CLPS7500, "CL-PS7500") |
369 | MAINTAINER("Philip Blundell") | 369 | /* Maintainer: Philip Blundell */ |
370 | BOOT_MEM(0x10000000, 0x03000000, 0xe0000000) | 370 | .phys_ram = 0x10000000, |
371 | MAPIO(clps7500_map_io) | 371 | .phys_io = 0x03000000, |
372 | INITIRQ(clps7500_init_irq) | 372 | .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, |
373 | .init_machine = clps7500_init, | 373 | .map_io = clps7500_map_io, |
374 | .timer = &clps7500_timer, | 374 | .init_irq = clps7500_init_irq, |
375 | .init_machine = clps7500_init, | ||
376 | .timer = &clps7500_timer, | ||
375 | MACHINE_END | 377 | MACHINE_END |
376 | 378 | ||
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c index 86ffdbb5626e..23c4da10101b 100644 --- a/arch/arm/mach-ebsa110/core.c +++ b/arch/arm/mach-ebsa110/core.c | |||
@@ -233,13 +233,15 @@ static int __init ebsa110_init(void) | |||
233 | arch_initcall(ebsa110_init); | 233 | arch_initcall(ebsa110_init); |
234 | 234 | ||
235 | MACHINE_START(EBSA110, "EBSA110") | 235 | MACHINE_START(EBSA110, "EBSA110") |
236 | MAINTAINER("Russell King") | 236 | /* Maintainer: Russell King */ |
237 | BOOT_MEM(0x00000000, 0xe0000000, 0xe0000000) | 237 | .phys_ram = 0x00000000, |
238 | BOOT_PARAMS(0x00000400) | 238 | .phys_io = 0xe0000000, |
239 | DISABLE_PARPORT(0) | 239 | .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, |
240 | DISABLE_PARPORT(2) | 240 | .boot_params = 0x00000400, |
241 | SOFT_REBOOT | 241 | .reserve_lp0 = 1, |
242 | MAPIO(ebsa110_map_io) | 242 | .reserve_lp2 = 1, |
243 | INITIRQ(ebsa110_init_irq) | 243 | .soft_reboot = 1, |
244 | .map_io = ebsa110_map_io, | ||
245 | .init_irq = ebsa110_init_irq, | ||
244 | .timer = &ebsa110_timer, | 246 | .timer = &ebsa110_timer, |
245 | MACHINE_END | 247 | MACHINE_END |
diff --git a/arch/arm/mach-epxa10db/arch.c b/arch/arm/mach-epxa10db/arch.c index 1b40340e8a21..7daa021676d0 100644 --- a/arch/arm/mach-epxa10db/arch.c +++ b/arch/arm/mach-epxa10db/arch.c | |||
@@ -63,10 +63,12 @@ extern void epxa10db_init_irq(void); | |||
63 | extern struct sys_timer epxa10db_timer; | 63 | extern struct sys_timer epxa10db_timer; |
64 | 64 | ||
65 | MACHINE_START(CAMELOT, "Altera Epxa10db") | 65 | MACHINE_START(CAMELOT, "Altera Epxa10db") |
66 | MAINTAINER("Altera Corporation") | 66 | /* Maintainer: Altera Corporation */ |
67 | BOOT_MEM(0x00000000, 0x7fffc000, 0xffffc000) | 67 | .phys_ram = 0x00000000, |
68 | MAPIO(epxa10db_map_io) | 68 | .phys_io = 0x7fffc000, |
69 | INITIRQ(epxa10db_init_irq) | 69 | .io_pg_offst = ((0xffffc000) >> 18) & 0xfffc, |
70 | .map_io = epxa10db_map_io, | ||
71 | .init_irq = epxa10db_init_irq, | ||
70 | .timer = &epxa10db_timer, | 72 | .timer = &epxa10db_timer, |
71 | MACHINE_END | 73 | MACHINE_END |
72 | 74 | ||
diff --git a/arch/arm/mach-footbridge/cats-hw.c b/arch/arm/mach-footbridge/cats-hw.c index d1ced86c379c..49b898af0032 100644 --- a/arch/arm/mach-footbridge/cats-hw.c +++ b/arch/arm/mach-footbridge/cats-hw.c | |||
@@ -84,12 +84,14 @@ fixup_cats(struct machine_desc *desc, struct tag *tags, | |||
84 | } | 84 | } |
85 | 85 | ||
86 | MACHINE_START(CATS, "Chalice-CATS") | 86 | MACHINE_START(CATS, "Chalice-CATS") |
87 | MAINTAINER("Philip Blundell") | 87 | /* Maintainer: Philip Blundell */ |
88 | BOOT_MEM(0x00000000, DC21285_ARMCSR_BASE, 0xfe000000) | 88 | .phys_ram = 0x00000000, |
89 | BOOT_PARAMS(0x00000100) | 89 | .phys_io = DC21285_ARMCSR_BASE, |
90 | SOFT_REBOOT | 90 | .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, |
91 | FIXUP(fixup_cats) | 91 | .boot_params = 0x00000100, |
92 | MAPIO(footbridge_map_io) | 92 | .soft_reboot = 1, |
93 | INITIRQ(footbridge_init_irq) | 93 | .fixup = fixup_cats, |
94 | .map_io = footbridge_map_io, | ||
95 | .init_irq = footbridge_init_irq, | ||
94 | .timer = &isa_timer, | 96 | .timer = &isa_timer, |
95 | MACHINE_END | 97 | MACHINE_END |
diff --git a/arch/arm/mach-footbridge/co285.c b/arch/arm/mach-footbridge/co285.c index e1541914fdcd..548a79081688 100644 --- a/arch/arm/mach-footbridge/co285.c +++ b/arch/arm/mach-footbridge/co285.c | |||
@@ -28,11 +28,13 @@ fixup_coebsa285(struct machine_desc *desc, struct tag *tags, | |||
28 | } | 28 | } |
29 | 29 | ||
30 | MACHINE_START(CO285, "co-EBSA285") | 30 | MACHINE_START(CO285, "co-EBSA285") |
31 | MAINTAINER("Mark van Doesburg") | 31 | /* Maintainer: Mark van Doesburg */ |
32 | BOOT_MEM(0x00000000, DC21285_ARMCSR_BASE, 0x7cf00000) | 32 | .phys_ram = 0x00000000, |
33 | FIXUP(fixup_coebsa285) | 33 | .phys_io = DC21285_ARMCSR_BASE, |
34 | MAPIO(footbridge_map_io) | 34 | .io_pg_offst = ((0x7cf00000) >> 18) & 0xfffc, |
35 | INITIRQ(footbridge_init_irq) | 35 | .fixup = fixup_coebsa285, |
36 | .map_io = footbridge_map_io, | ||
37 | .init_irq = footbridge_init_irq, | ||
36 | .timer = &footbridge_timer, | 38 | .timer = &footbridge_timer, |
37 | MACHINE_END | 39 | MACHINE_END |
38 | 40 | ||
diff --git a/arch/arm/mach-footbridge/ebsa285.c b/arch/arm/mach-footbridge/ebsa285.c index d0931f5a63c8..1c37605268d5 100644 --- a/arch/arm/mach-footbridge/ebsa285.c +++ b/arch/arm/mach-footbridge/ebsa285.c | |||
@@ -13,12 +13,15 @@ | |||
13 | #include "common.h" | 13 | #include "common.h" |
14 | 14 | ||
15 | MACHINE_START(EBSA285, "EBSA285") | 15 | MACHINE_START(EBSA285, "EBSA285") |
16 | MAINTAINER("Russell King") | 16 | /* Maintainer: Russell King */ |
17 | BOOT_MEM(0x00000000, DC21285_ARMCSR_BASE, 0xfe000000) | 17 | .phys_ram = 0x00000000, |
18 | BOOT_PARAMS(0x00000100) | 18 | .phys_io = DC21285_ARMCSR_BASE, |
19 | VIDEO(0x000a0000, 0x000bffff) | 19 | .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, |
20 | MAPIO(footbridge_map_io) | 20 | .boot_params = 0x00000100, |
21 | INITIRQ(footbridge_init_irq) | 21 | .video_start = 0x000a0000, |
22 | .video_end = 0x000bffff, | ||
23 | .map_io = footbridge_map_io, | ||
24 | .init_irq = footbridge_init_irq, | ||
22 | .timer = &footbridge_timer, | 25 | .timer = &footbridge_timer, |
23 | MACHINE_END | 26 | MACHINE_END |
24 | 27 | ||
diff --git a/arch/arm/mach-footbridge/netwinder-hw.c b/arch/arm/mach-footbridge/netwinder-hw.c index 1e1dfd79f4fe..775f85fc8513 100644 --- a/arch/arm/mach-footbridge/netwinder-hw.c +++ b/arch/arm/mach-footbridge/netwinder-hw.c | |||
@@ -647,14 +647,17 @@ fixup_netwinder(struct machine_desc *desc, struct tag *tags, | |||
647 | } | 647 | } |
648 | 648 | ||
649 | MACHINE_START(NETWINDER, "Rebel-NetWinder") | 649 | MACHINE_START(NETWINDER, "Rebel-NetWinder") |
650 | MAINTAINER("Russell King/Rebel.com") | 650 | /* Maintainer: Russell King/Rebel.com */ |
651 | BOOT_MEM(0x00000000, DC21285_ARMCSR_BASE, 0xfe000000) | 651 | .phys_ram = 0x00000000, |
652 | BOOT_PARAMS(0x00000100) | 652 | .phys_io = DC21285_ARMCSR_BASE, |
653 | VIDEO(0x000a0000, 0x000bffff) | 653 | .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, |
654 | DISABLE_PARPORT(0) | 654 | .boot_params = 0x00000100, |
655 | DISABLE_PARPORT(2) | 655 | .video_start = 0x000a0000, |
656 | FIXUP(fixup_netwinder) | 656 | .video_end = 0x000bffff, |
657 | MAPIO(footbridge_map_io) | 657 | .reserve_lp0 = 1, |
658 | INITIRQ(footbridge_init_irq) | 658 | .reserve_lp2 = 1, |
659 | .fixup = fixup_netwinder, | ||
660 | .map_io = footbridge_map_io, | ||
661 | .init_irq = footbridge_init_irq, | ||
659 | .timer = &isa_timer, | 662 | .timer = &isa_timer, |
660 | MACHINE_END | 663 | MACHINE_END |
diff --git a/arch/arm/mach-footbridge/personal.c b/arch/arm/mach-footbridge/personal.c index 415086d7bbee..0146b8bb59da 100644 --- a/arch/arm/mach-footbridge/personal.c +++ b/arch/arm/mach-footbridge/personal.c | |||
@@ -13,11 +13,13 @@ | |||
13 | #include "common.h" | 13 | #include "common.h" |
14 | 14 | ||
15 | MACHINE_START(PERSONAL_SERVER, "Compaq-PersonalServer") | 15 | MACHINE_START(PERSONAL_SERVER, "Compaq-PersonalServer") |
16 | MAINTAINER("Jamey Hicks / George France") | 16 | /* Maintainer: Jamey Hicks / George France */ |
17 | BOOT_MEM(0x00000000, DC21285_ARMCSR_BASE, 0xfe000000) | 17 | .phys_ram = 0x00000000, |
18 | BOOT_PARAMS(0x00000100) | 18 | .phys_io = DC21285_ARMCSR_BASE, |
19 | MAPIO(footbridge_map_io) | 19 | .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, |
20 | INITIRQ(footbridge_init_irq) | 20 | .boot_params = 0x00000100, |
21 | .map_io = footbridge_map_io, | ||
22 | .init_irq = footbridge_init_irq, | ||
21 | .timer = &footbridge_timer, | 23 | .timer = &footbridge_timer, |
22 | MACHINE_END | 24 | MACHINE_END |
23 | 25 | ||
diff --git a/arch/arm/mach-h720x/h7201-eval.c b/arch/arm/mach-h720x/h7201-eval.c index 9b24b9b0db15..fa59e9e2a5c8 100644 --- a/arch/arm/mach-h720x/h7201-eval.c +++ b/arch/arm/mach-h720x/h7201-eval.c | |||
@@ -30,10 +30,12 @@ | |||
30 | #include "common.h" | 30 | #include "common.h" |
31 | 31 | ||
32 | MACHINE_START(H7201, "Hynix GMS30C7201") | 32 | MACHINE_START(H7201, "Hynix GMS30C7201") |
33 | MAINTAINER("Robert Schwebel, Pengutronix") | 33 | /* Maintainer: Robert Schwebel, Pengutronix */ |
34 | BOOT_MEM(0x40000000, 0x80000000, 0xf0000000) | 34 | .phys_ram = 0x40000000, |
35 | BOOT_PARAMS(0xc0001000) | 35 | .phys_io = 0x80000000, |
36 | MAPIO(h720x_map_io) | 36 | .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc, |
37 | INITIRQ(h720x_init_irq) | 37 | .boot_params = 0xc0001000, |
38 | .timer = &h7201_timer, | 38 | .map_io = h720x_map_io, |
39 | .init_irq = h720x_init_irq, | ||
40 | .timer = &h7201_timer, | ||
39 | MACHINE_END | 41 | MACHINE_END |
diff --git a/arch/arm/mach-h720x/h7202-eval.c b/arch/arm/mach-h720x/h7202-eval.c index 3456a00d5f5c..db9078ad008c 100644 --- a/arch/arm/mach-h720x/h7202-eval.c +++ b/arch/arm/mach-h720x/h7202-eval.c | |||
@@ -71,11 +71,13 @@ static void __init init_eval_h7202(void) | |||
71 | } | 71 | } |
72 | 72 | ||
73 | MACHINE_START(H7202, "Hynix HMS30C7202") | 73 | MACHINE_START(H7202, "Hynix HMS30C7202") |
74 | MAINTAINER("Robert Schwebel, Pengutronix") | 74 | /* Maintainer: Robert Schwebel, Pengutronix */ |
75 | BOOT_MEM(0x40000000, 0x80000000, 0xf0000000) | 75 | .phys_ram = 0x40000000, |
76 | BOOT_PARAMS(0x40000100) | 76 | .phys_io = 0x80000000, |
77 | MAPIO(h720x_map_io) | 77 | .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc, |
78 | INITIRQ(h7202_init_irq) | 78 | .boot_params = 0x40000100, |
79 | .timer = &h7202_timer, | 79 | .map_io = h720x_map_io, |
80 | INIT_MACHINE(init_eval_h7202) | 80 | .init_irq = h7202_init_irq, |
81 | .timer = &h7202_timer, | ||
82 | .init_machine = init_eval_h7202, | ||
81 | MACHINE_END | 83 | MACHINE_END |
diff --git a/arch/arm/mach-imx/mx1ads.c b/arch/arm/mach-imx/mx1ads.c index 625dd01c2578..5d25434d332c 100644 --- a/arch/arm/mach-imx/mx1ads.c +++ b/arch/arm/mach-imx/mx1ads.c | |||
@@ -78,11 +78,13 @@ mx1ads_map_io(void) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | MACHINE_START(MX1ADS, "Motorola MX1ADS") | 80 | MACHINE_START(MX1ADS, "Motorola MX1ADS") |
81 | MAINTAINER("Sascha Hauer, Pengutronix") | 81 | /* Maintainer: Sascha Hauer, Pengutronix */ |
82 | BOOT_MEM(0x08000000, 0x00200000, 0xe0200000) | 82 | .phys_ram = 0x08000000, |
83 | BOOT_PARAMS(0x08000100) | 83 | .phys_io = 0x00200000, |
84 | MAPIO(mx1ads_map_io) | 84 | .io_pg_offst = ((0xe0200000) >> 18) & 0xfffc, |
85 | INITIRQ(imx_init_irq) | 85 | .boot_params = 0x08000100, |
86 | .map_io = mx1ads_map_io, | ||
87 | .init_irq = imx_init_irq, | ||
86 | .timer = &imx_timer, | 88 | .timer = &imx_timer, |
87 | INIT_MACHINE(mx1ads_init) | 89 | .init_machine = mx1ads_init, |
88 | MACHINE_END | 90 | MACHINE_END |
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c index 9222e57bd872..dacbf504dae2 100644 --- a/arch/arm/mach-integrator/core.c +++ b/arch/arm/mach-integrator/core.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <asm/irq.h> | 20 | #include <asm/irq.h> |
21 | #include <asm/io.h> | 21 | #include <asm/io.h> |
22 | #include <asm/hardware/amba.h> | 22 | #include <asm/hardware/amba.h> |
23 | #include <asm/hardware/arm_timer.h> | ||
23 | #include <asm/arch/cm.h> | 24 | #include <asm/arch/cm.h> |
24 | #include <asm/system.h> | 25 | #include <asm/system.h> |
25 | #include <asm/leds.h> | 26 | #include <asm/leds.h> |
@@ -156,16 +157,6 @@ EXPORT_SYMBOL(cm_control); | |||
156 | #define TICKS2USECS(x) ((x) / TICKS_PER_uSEC) | 157 | #define TICKS2USECS(x) ((x) / TICKS_PER_uSEC) |
157 | #endif | 158 | #endif |
158 | 159 | ||
159 | /* | ||
160 | * What does it look like? | ||
161 | */ | ||
162 | typedef struct TimerStruct { | ||
163 | unsigned long TimerLoad; | ||
164 | unsigned long TimerValue; | ||
165 | unsigned long TimerControl; | ||
166 | unsigned long TimerClear; | ||
167 | } TimerStruct_t; | ||
168 | |||
169 | static unsigned long timer_reload; | 160 | static unsigned long timer_reload; |
170 | 161 | ||
171 | /* | 162 | /* |
@@ -174,7 +165,6 @@ static unsigned long timer_reload; | |||
174 | */ | 165 | */ |
175 | unsigned long integrator_gettimeoffset(void) | 166 | unsigned long integrator_gettimeoffset(void) |
176 | { | 167 | { |
177 | volatile TimerStruct_t *timer1 = (TimerStruct_t *)TIMER1_VA_BASE; | ||
178 | unsigned long ticks1, ticks2, status; | 168 | unsigned long ticks1, ticks2, status; |
179 | 169 | ||
180 | /* | 170 | /* |
@@ -183,11 +173,11 @@ unsigned long integrator_gettimeoffset(void) | |||
183 | * an interrupt. We get around this by ensuring that the | 173 | * an interrupt. We get around this by ensuring that the |
184 | * counter has not reloaded between our two reads. | 174 | * counter has not reloaded between our two reads. |
185 | */ | 175 | */ |
186 | ticks2 = timer1->TimerValue & 0xffff; | 176 | ticks2 = readl(TIMER1_VA_BASE + TIMER_VALUE) & 0xffff; |
187 | do { | 177 | do { |
188 | ticks1 = ticks2; | 178 | ticks1 = ticks2; |
189 | status = __raw_readl(VA_IC_BASE + IRQ_RAW_STATUS); | 179 | status = __raw_readl(VA_IC_BASE + IRQ_RAW_STATUS); |
190 | ticks2 = timer1->TimerValue & 0xffff; | 180 | ticks2 = readl(TIMER1_VA_BASE + TIMER_VALUE) & 0xffff; |
191 | } while (ticks2 > ticks1); | 181 | } while (ticks2 > ticks1); |
192 | 182 | ||
193 | /* | 183 | /* |
@@ -213,14 +203,12 @@ unsigned long integrator_gettimeoffset(void) | |||
213 | static irqreturn_t | 203 | static irqreturn_t |
214 | integrator_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 204 | integrator_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
215 | { | 205 | { |
216 | volatile TimerStruct_t *timer1 = (volatile TimerStruct_t *)TIMER1_VA_BASE; | ||
217 | |||
218 | write_seqlock(&xtime_lock); | 206 | write_seqlock(&xtime_lock); |
219 | 207 | ||
220 | /* | 208 | /* |
221 | * clear the interrupt | 209 | * clear the interrupt |
222 | */ | 210 | */ |
223 | timer1->TimerClear = 1; | 211 | writel(1, TIMER1_VA_BASE + TIMER_INTCLR); |
224 | 212 | ||
225 | /* | 213 | /* |
226 | * the clock tick routines are only processed on the | 214 | * the clock tick routines are only processed on the |
@@ -256,32 +244,29 @@ static struct irqaction integrator_timer_irq = { | |||
256 | */ | 244 | */ |
257 | void __init integrator_time_init(unsigned long reload, unsigned int ctrl) | 245 | void __init integrator_time_init(unsigned long reload, unsigned int ctrl) |
258 | { | 246 | { |
259 | volatile TimerStruct_t *timer0 = (volatile TimerStruct_t *)TIMER0_VA_BASE; | 247 | unsigned int timer_ctrl = TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC; |
260 | volatile TimerStruct_t *timer1 = (volatile TimerStruct_t *)TIMER1_VA_BASE; | ||
261 | volatile TimerStruct_t *timer2 = (volatile TimerStruct_t *)TIMER2_VA_BASE; | ||
262 | unsigned int timer_ctrl = 0x80 | 0x40; /* periodic */ | ||
263 | 248 | ||
264 | timer_reload = reload; | 249 | timer_reload = reload; |
265 | timer_ctrl |= ctrl; | 250 | timer_ctrl |= ctrl; |
266 | 251 | ||
267 | if (timer_reload > 0x100000) { | 252 | if (timer_reload > 0x100000) { |
268 | timer_reload >>= 8; | 253 | timer_reload >>= 8; |
269 | timer_ctrl |= 0x08; /* /256 */ | 254 | timer_ctrl |= TIMER_CTRL_DIV256; |
270 | } else if (timer_reload > 0x010000) { | 255 | } else if (timer_reload > 0x010000) { |
271 | timer_reload >>= 4; | 256 | timer_reload >>= 4; |
272 | timer_ctrl |= 0x04; /* /16 */ | 257 | timer_ctrl |= TIMER_CTRL_DIV16; |
273 | } | 258 | } |
274 | 259 | ||
275 | /* | 260 | /* |
276 | * Initialise to a known state (all timers off) | 261 | * Initialise to a known state (all timers off) |
277 | */ | 262 | */ |
278 | timer0->TimerControl = 0; | 263 | writel(0, TIMER0_VA_BASE + TIMER_CTRL); |
279 | timer1->TimerControl = 0; | 264 | writel(0, TIMER1_VA_BASE + TIMER_CTRL); |
280 | timer2->TimerControl = 0; | 265 | writel(0, TIMER2_VA_BASE + TIMER_CTRL); |
281 | 266 | ||
282 | timer1->TimerLoad = timer_reload; | 267 | writel(timer_reload, TIMER1_VA_BASE + TIMER_LOAD); |
283 | timer1->TimerValue = timer_reload; | 268 | writel(timer_reload, TIMER1_VA_BASE + TIMER_VALUE); |
284 | timer1->TimerControl = timer_ctrl; | 269 | writel(timer_ctrl, TIMER1_VA_BASE + TIMER_CTRL); |
285 | 270 | ||
286 | /* | 271 | /* |
287 | * Make irqs happen for the system timer | 272 | * Make irqs happen for the system timer |
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index 91ba9fd79c87..36e2b6eb67b7 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c | |||
@@ -292,11 +292,13 @@ static struct sys_timer ap_timer = { | |||
292 | }; | 292 | }; |
293 | 293 | ||
294 | MACHINE_START(INTEGRATOR, "ARM-Integrator") | 294 | MACHINE_START(INTEGRATOR, "ARM-Integrator") |
295 | MAINTAINER("ARM Ltd/Deep Blue Solutions Ltd") | 295 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
296 | BOOT_MEM(0x00000000, 0x16000000, 0xf1600000) | 296 | .phys_ram = 0x00000000, |
297 | BOOT_PARAMS(0x00000100) | 297 | .phys_io = 0x16000000, |
298 | MAPIO(ap_map_io) | 298 | .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc, |
299 | INITIRQ(ap_init_irq) | 299 | .boot_params = 0x00000100, |
300 | .map_io = ap_map_io, | ||
301 | .init_irq = ap_init_irq, | ||
300 | .timer = &ap_timer, | 302 | .timer = &ap_timer, |
301 | INIT_MACHINE(ap_init) | 303 | .init_machine = ap_init, |
302 | MACHINE_END | 304 | MACHINE_END |
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index e0a01eef0993..569f328c479d 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c | |||
@@ -532,11 +532,13 @@ static struct sys_timer cp_timer = { | |||
532 | }; | 532 | }; |
533 | 533 | ||
534 | MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP") | 534 | MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP") |
535 | MAINTAINER("ARM Ltd/Deep Blue Solutions Ltd") | 535 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
536 | BOOT_MEM(0x00000000, 0x16000000, 0xf1600000) | 536 | .phys_ram = 0x00000000, |
537 | BOOT_PARAMS(0x00000100) | 537 | .phys_io = 0x16000000, |
538 | MAPIO(intcp_map_io) | 538 | .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc, |
539 | INITIRQ(intcp_init_irq) | 539 | .boot_params = 0x00000100, |
540 | .map_io = intcp_map_io, | ||
541 | .init_irq = intcp_init_irq, | ||
540 | .timer = &cp_timer, | 542 | .timer = &cp_timer, |
541 | INIT_MACHINE(intcp_init) | 543 | .init_machine = intcp_init, |
542 | MACHINE_END | 544 | MACHINE_END |
diff --git a/arch/arm/mach-iop3xx/iop321-setup.c b/arch/arm/mach-iop3xx/iop321-setup.c index bf23e0fd2843..0f921ba2750c 100644 --- a/arch/arm/mach-iop3xx/iop321-setup.c +++ b/arch/arm/mach-iop3xx/iop321-setup.c | |||
@@ -146,23 +146,27 @@ extern void iop321_init_time(void); | |||
146 | 146 | ||
147 | #if defined(CONFIG_ARCH_IQ80321) | 147 | #if defined(CONFIG_ARCH_IQ80321) |
148 | MACHINE_START(IQ80321, "Intel IQ80321") | 148 | MACHINE_START(IQ80321, "Intel IQ80321") |
149 | MAINTAINER("Intel Corporation") | 149 | /* Maintainer: Intel Corporation */ |
150 | BOOT_MEM(PHYS_OFFSET, IQ80321_UART, IQ80321_UART) | 150 | .phys_ram = PHYS_OFFSET, |
151 | MAPIO(iq80321_map_io) | 151 | .phys_io = IQ80321_UART, |
152 | INITIRQ(iop321_init_irq) | 152 | .io_pg_offst = ((IQ80321_UART) >> 18) & 0xfffc, |
153 | .map_io = iq80321_map_io, | ||
154 | .init_irq = iop321_init_irq, | ||
153 | .timer = &iop321_timer, | 155 | .timer = &iop321_timer, |
154 | BOOT_PARAMS(0xa0000100) | 156 | .boot_params = 0xa0000100, |
155 | INIT_MACHINE(iop32x_init) | 157 | .init_machine = iop32x_init, |
156 | MACHINE_END | 158 | MACHINE_END |
157 | #elif defined(CONFIG_ARCH_IQ31244) | 159 | #elif defined(CONFIG_ARCH_IQ31244) |
158 | MACHINE_START(IQ31244, "Intel IQ31244") | 160 | MACHINE_START(IQ31244, "Intel IQ31244") |
159 | MAINTAINER("Intel Corp.") | 161 | /* Maintainer: Intel Corp. */ |
160 | BOOT_MEM(PHYS_OFFSET, IQ31244_UART, IQ31244_UART) | 162 | .phys_ram = PHYS_OFFSET, |
161 | MAPIO(iq31244_map_io) | 163 | .phys_io = IQ31244_UART, |
162 | INITIRQ(iop321_init_irq) | 164 | .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc, |
165 | .map_io = iq31244_map_io, | ||
166 | .init_irq = iop321_init_irq, | ||
163 | .timer = &iop321_timer, | 167 | .timer = &iop321_timer, |
164 | BOOT_PARAMS(0xa0000100) | 168 | .boot_params = 0xa0000100, |
165 | INIT_MACHINE(iop32x_init) | 169 | .init_machine = iop32x_init, |
166 | MACHINE_END | 170 | MACHINE_END |
167 | #else | 171 | #else |
168 | #error No machine descriptor defined for this IOP3XX implementation | 172 | #error No machine descriptor defined for this IOP3XX implementation |
diff --git a/arch/arm/mach-iop3xx/iop331-setup.c b/arch/arm/mach-iop3xx/iop331-setup.c index 622e7914819a..fc74b722f72f 100644 --- a/arch/arm/mach-iop3xx/iop331-setup.c +++ b/arch/arm/mach-iop3xx/iop331-setup.c | |||
@@ -148,26 +148,28 @@ extern void iq80332_map_io(void); | |||
148 | 148 | ||
149 | #if defined(CONFIG_ARCH_IQ80331) | 149 | #if defined(CONFIG_ARCH_IQ80331) |
150 | MACHINE_START(IQ80331, "Intel IQ80331") | 150 | MACHINE_START(IQ80331, "Intel IQ80331") |
151 | MAINTAINER("Intel Corp.") | 151 | /* Maintainer: Intel Corp. */ |
152 | BOOT_MEM(PHYS_OFFSET, 0xfefff000, 0xfffff000) // virtual, physical | 152 | .phys_ram = PHYS_OFFSET, |
153 | //BOOT_MEM(PHYS_OFFSET, IOP331_UART0_VIRT, IOP331_UART0_PHYS) | 153 | .phys_io = 0xfefff000, |
154 | MAPIO(iq80331_map_io) | 154 | .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical |
155 | INITIRQ(iop331_init_irq) | 155 | .map_io = iq80331_map_io, |
156 | .init_irq = iop331_init_irq, | ||
156 | .timer = &iop331_timer, | 157 | .timer = &iop331_timer, |
157 | BOOT_PARAMS(0x0100) | 158 | .boot_params = 0x0100, |
158 | INIT_MACHINE(iop33x_init) | 159 | .init_machine = iop33x_init, |
159 | MACHINE_END | 160 | MACHINE_END |
160 | 161 | ||
161 | #elif defined(CONFIG_MACH_IQ80332) | 162 | #elif defined(CONFIG_MACH_IQ80332) |
162 | MACHINE_START(IQ80332, "Intel IQ80332") | 163 | MACHINE_START(IQ80332, "Intel IQ80332") |
163 | MAINTAINER("Intel Corp.") | 164 | /* Maintainer: Intel Corp. */ |
164 | BOOT_MEM(PHYS_OFFSET, 0xfefff000, 0xfffff000) // virtual, physical | 165 | .phys_ram = PHYS_OFFSET, |
165 | //BOOT_MEM(PHYS_OFFSET, IOP331_UART0_VIRT, IOP331_UART0_PHYS) | 166 | .phys_io = 0xfefff000, |
166 | MAPIO(iq80332_map_io) | 167 | .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical |
167 | INITIRQ(iop331_init_irq) | 168 | .map_io = iq80332_map_io, |
169 | .init_irq = iop331_init_irq, | ||
168 | .timer = &iop331_timer, | 170 | .timer = &iop331_timer, |
169 | BOOT_PARAMS(0x0100) | 171 | .boot_params = 0x0100, |
170 | INIT_MACHINE(iop33x_init) | 172 | .init_machine = iop33x_init, |
171 | MACHINE_END | 173 | MACHINE_END |
172 | 174 | ||
173 | #else | 175 | #else |
diff --git a/arch/arm/mach-ixp2000/enp2611.c b/arch/arm/mach-ixp2000/enp2611.c index f3a291b6a9fb..b7ebf3898fc5 100644 --- a/arch/arm/mach-ixp2000/enp2611.c +++ b/arch/arm/mach-ixp2000/enp2611.c | |||
@@ -223,13 +223,15 @@ static void __init enp2611_init_machine(void) | |||
223 | 223 | ||
224 | 224 | ||
225 | MACHINE_START(ENP2611, "Radisys ENP-2611 PCI network processor board") | 225 | MACHINE_START(ENP2611, "Radisys ENP-2611 PCI network processor board") |
226 | MAINTAINER("Lennert Buytenhek <buytenh@wantstofly.org>") | 226 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ |
227 | BOOT_MEM(0x00000000, IXP2000_UART_PHYS_BASE, IXP2000_UART_VIRT_BASE) | 227 | .phys_ram = 0x00000000, |
228 | BOOT_PARAMS(0x00000100) | 228 | .phys_io = IXP2000_UART_PHYS_BASE, |
229 | MAPIO(ixp2000_map_io) | 229 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, |
230 | INITIRQ(ixp2000_init_irq) | 230 | .boot_params = 0x00000100, |
231 | .map_io = ixp2000_map_io, | ||
232 | .init_irq = ixp2000_init_irq, | ||
231 | .timer = &enp2611_timer, | 233 | .timer = &enp2611_timer, |
232 | INIT_MACHINE(enp2611_init_machine) | 234 | .init_machine = enp2611_init_machine, |
233 | MACHINE_END | 235 | MACHINE_END |
234 | 236 | ||
235 | 237 | ||
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c index df3ff26c8cdd..fd280a93637e 100644 --- a/arch/arm/mach-ixp2000/ixdp2400.c +++ b/arch/arm/mach-ixp2000/ixdp2400.c | |||
@@ -168,12 +168,14 @@ void ixdp2400_init_irq(void) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | MACHINE_START(IXDP2400, "Intel IXDP2400 Development Platform") | 170 | MACHINE_START(IXDP2400, "Intel IXDP2400 Development Platform") |
171 | MAINTAINER("MontaVista Software, Inc.") | 171 | /* Maintainer: MontaVista Software, Inc. */ |
172 | BOOT_MEM(0x00000000, IXP2000_UART_PHYS_BASE, IXP2000_UART_VIRT_BASE) | 172 | .phys_ram = 0x00000000, |
173 | BOOT_PARAMS(0x00000100) | 173 | .phys_io = IXP2000_UART_PHYS_BASE, |
174 | MAPIO(ixdp2x00_map_io) | 174 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, |
175 | INITIRQ(ixdp2400_init_irq) | 175 | .boot_params = 0x00000100, |
176 | .map_io = ixdp2x00_map_io, | ||
177 | .init_irq = ixdp2400_init_irq, | ||
176 | .timer = &ixdp2400_timer, | 178 | .timer = &ixdp2400_timer, |
177 | INIT_MACHINE(ixdp2x00_init_machine) | 179 | .init_machine = ixdp2x00_init_machine, |
178 | MACHINE_END | 180 | MACHINE_END |
179 | 181 | ||
diff --git a/arch/arm/mach-ixp2000/ixdp2800.c b/arch/arm/mach-ixp2000/ixdp2800.c index 468a4bbfb724..f9073aa28615 100644 --- a/arch/arm/mach-ixp2000/ixdp2800.c +++ b/arch/arm/mach-ixp2000/ixdp2800.c | |||
@@ -284,12 +284,14 @@ void ixdp2800_init_irq(void) | |||
284 | } | 284 | } |
285 | 285 | ||
286 | MACHINE_START(IXDP2800, "Intel IXDP2800 Development Platform") | 286 | MACHINE_START(IXDP2800, "Intel IXDP2800 Development Platform") |
287 | MAINTAINER("MontaVista Software, Inc.") | 287 | /* Maintainer: MontaVista Software, Inc. */ |
288 | BOOT_MEM(0x00000000, IXP2000_UART_PHYS_BASE, IXP2000_UART_VIRT_BASE) | 288 | .phys_ram = 0x00000000, |
289 | BOOT_PARAMS(0x00000100) | 289 | .phys_io = IXP2000_UART_PHYS_BASE, |
290 | MAPIO(ixdp2x00_map_io) | 290 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, |
291 | INITIRQ(ixdp2800_init_irq) | 291 | .boot_params = 0x00000100, |
292 | .map_io = ixdp2x00_map_io, | ||
293 | .init_irq = ixdp2800_init_irq, | ||
292 | .timer = &ixdp2800_timer, | 294 | .timer = &ixdp2800_timer, |
293 | INIT_MACHINE(ixdp2x00_init_machine) | 295 | .init_machine = ixdp2x00_init_machine, |
294 | MACHINE_END | 296 | MACHINE_END |
295 | 297 | ||
diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c index e94dace3d412..c73588743ee1 100644 --- a/arch/arm/mach-ixp2000/ixdp2x01.c +++ b/arch/arm/mach-ixp2000/ixdp2x01.c | |||
@@ -375,25 +375,29 @@ static void __init ixdp2x01_init_machine(void) | |||
375 | 375 | ||
376 | #ifdef CONFIG_ARCH_IXDP2401 | 376 | #ifdef CONFIG_ARCH_IXDP2401 |
377 | MACHINE_START(IXDP2401, "Intel IXDP2401 Development Platform") | 377 | MACHINE_START(IXDP2401, "Intel IXDP2401 Development Platform") |
378 | MAINTAINER("MontaVista Software, Inc.") | 378 | /* Maintainer: MontaVista Software, Inc. */ |
379 | BOOT_MEM(0x00000000, IXP2000_UART_PHYS_BASE, IXP2000_UART_VIRT_BASE) | 379 | .phys_ram = 0x00000000, |
380 | BOOT_PARAMS(0x00000100) | 380 | .phys_io = IXP2000_UART_PHYS_BASE, |
381 | MAPIO(ixdp2x01_map_io) | 381 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, |
382 | INITIRQ(ixdp2x01_init_irq) | 382 | .boot_params = 0x00000100, |
383 | .map_io = ixdp2x01_map_io, | ||
384 | .init_irq = ixdp2x01_init_irq, | ||
383 | .timer = &ixdp2x01_timer, | 385 | .timer = &ixdp2x01_timer, |
384 | INIT_MACHINE(ixdp2x01_init_machine) | 386 | .init_machine = ixdp2x01_init_machine, |
385 | MACHINE_END | 387 | MACHINE_END |
386 | #endif | 388 | #endif |
387 | 389 | ||
388 | #ifdef CONFIG_ARCH_IXDP2801 | 390 | #ifdef CONFIG_ARCH_IXDP2801 |
389 | MACHINE_START(IXDP2801, "Intel IXDP2801 Development Platform") | 391 | MACHINE_START(IXDP2801, "Intel IXDP2801 Development Platform") |
390 | MAINTAINER("MontaVista Software, Inc.") | 392 | /* Maintainer: MontaVista Software, Inc. */ |
391 | BOOT_MEM(0x00000000, IXP2000_UART_PHYS_BASE, IXP2000_UART_VIRT_BASE) | 393 | .phys_ram = 0x00000000, |
392 | BOOT_PARAMS(0x00000100) | 394 | .phys_io = IXP2000_UART_PHYS_BASE, |
393 | MAPIO(ixdp2x01_map_io) | 395 | .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, |
394 | INITIRQ(ixdp2x01_init_irq) | 396 | .boot_params = 0x00000100, |
397 | .map_io = ixdp2x01_map_io, | ||
398 | .init_irq = ixdp2x01_init_irq, | ||
395 | .timer = &ixdp2x01_timer, | 399 | .timer = &ixdp2x01_timer, |
396 | INIT_MACHINE(ixdp2x01_init_machine) | 400 | .init_machine = ixdp2x01_init_machine, |
397 | MACHINE_END | 401 | MACHINE_END |
398 | #endif | 402 | #endif |
399 | 403 | ||
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c index aa92e3708838..2b544363c078 100644 --- a/arch/arm/mach-ixp4xx/common-pci.c +++ b/arch/arm/mach-ixp4xx/common-pci.c | |||
@@ -453,8 +453,8 @@ int ixp4xx_setup(int nr, struct pci_sys_data *sys) | |||
453 | local_write_config(PCI_COMMAND, 2, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); | 453 | local_write_config(PCI_COMMAND, 2, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); |
454 | 454 | ||
455 | res[0].name = "PCI I/O Space"; | 455 | res[0].name = "PCI I/O Space"; |
456 | res[0].start = 0x00001000; | 456 | res[0].start = 0x00000000; |
457 | res[0].end = 0xffff0000; | 457 | res[0].end = 0x0000ffff; |
458 | res[0].flags = IORESOURCE_IO; | 458 | res[0].flags = IORESOURCE_IO; |
459 | 459 | ||
460 | res[1].name = "PCI Memory Space"; | 460 | res[1].name = "PCI Memory Space"; |
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c index 8a05a1227e5f..4ff4393ef0ea 100644 --- a/arch/arm/mach-ixp4xx/coyote-setup.c +++ b/arch/arm/mach-ixp4xx/coyote-setup.c | |||
@@ -56,21 +56,24 @@ static struct resource coyote_uart_resource = { | |||
56 | .flags = IORESOURCE_MEM, | 56 | .flags = IORESOURCE_MEM, |
57 | }; | 57 | }; |
58 | 58 | ||
59 | static struct plat_serial8250_port coyote_uart_data = { | 59 | static struct plat_serial8250_port coyote_uart_data[] = { |
60 | .mapbase = IXP4XX_UART2_BASE_PHYS, | 60 | { |
61 | .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, | 61 | .mapbase = IXP4XX_UART2_BASE_PHYS, |
62 | .irq = IRQ_IXP4XX_UART2, | 62 | .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, |
63 | .flags = UPF_BOOT_AUTOCONF, | 63 | .irq = IRQ_IXP4XX_UART2, |
64 | .iotype = UPIO_MEM, | 64 | .flags = UPF_BOOT_AUTOCONF, |
65 | .regshift = 2, | 65 | .iotype = UPIO_MEM, |
66 | .uartclk = IXP4XX_UART_XTAL, | 66 | .regshift = 2, |
67 | .uartclk = IXP4XX_UART_XTAL, | ||
68 | }, | ||
69 | { }, | ||
67 | }; | 70 | }; |
68 | 71 | ||
69 | static struct platform_device coyote_uart = { | 72 | static struct platform_device coyote_uart = { |
70 | .name = "serial8250", | 73 | .name = "serial8250", |
71 | .id = 0, | 74 | .id = 0, |
72 | .dev = { | 75 | .dev = { |
73 | .platform_data = &coyote_uart_data, | 76 | .platform_data = coyote_uart_data, |
74 | }, | 77 | }, |
75 | .num_resources = 1, | 78 | .num_resources = 1, |
76 | .resource = &coyote_uart_resource, | 79 | .resource = &coyote_uart_resource, |
@@ -87,10 +90,10 @@ static void __init coyote_init(void) | |||
87 | *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; | 90 | *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; |
88 | 91 | ||
89 | if (machine_is_ixdpg425()) { | 92 | if (machine_is_ixdpg425()) { |
90 | coyote_uart_data.membase = | 93 | coyote_uart_data[0].membase = |
91 | (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET); | 94 | (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET); |
92 | coyote_uart_data.mapbase = IXP4XX_UART1_BASE_PHYS; | 95 | coyote_uart_data[0].mapbase = IXP4XX_UART1_BASE_PHYS; |
93 | coyote_uart_data.irq = IRQ_IXP4XX_UART1; | 96 | coyote_uart_data[0].irq = IRQ_IXP4XX_UART1; |
94 | } | 97 | } |
95 | 98 | ||
96 | 99 | ||
@@ -100,14 +103,15 @@ static void __init coyote_init(void) | |||
100 | 103 | ||
101 | #ifdef CONFIG_ARCH_ADI_COYOTE | 104 | #ifdef CONFIG_ARCH_ADI_COYOTE |
102 | MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote") | 105 | MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote") |
103 | MAINTAINER("MontaVista Software, Inc.") | 106 | /* Maintainer: MontaVista Software, Inc. */ |
104 | BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS, | 107 | .phys_ram = PHYS_OFFSET, |
105 | IXP4XX_PERIPHERAL_BASE_VIRT) | 108 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
106 | MAPIO(coyote_map_io) | 109 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
107 | INITIRQ(ixp4xx_init_irq) | 110 | .map_io = coyote_map_io, |
111 | .init_irq = ixp4xx_init_irq, | ||
108 | .timer = &ixp4xx_timer, | 112 | .timer = &ixp4xx_timer, |
109 | BOOT_PARAMS(0x0100) | 113 | .boot_params = 0x0100, |
110 | INIT_MACHINE(coyote_init) | 114 | .init_machine = coyote_init, |
111 | MACHINE_END | 115 | MACHINE_END |
112 | #endif | 116 | #endif |
113 | 117 | ||
@@ -117,14 +121,15 @@ MACHINE_END | |||
117 | */ | 121 | */ |
118 | #ifdef CONFIG_MACH_IXDPG425 | 122 | #ifdef CONFIG_MACH_IXDPG425 |
119 | MACHINE_START(IXDPG425, "Intel IXDPG425") | 123 | MACHINE_START(IXDPG425, "Intel IXDPG425") |
120 | MAINTAINER("MontaVista Software, Inc.") | 124 | /* Maintainer: MontaVista Software, Inc. */ |
121 | BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS, | 125 | .phys_ram = PHYS_OFFSET, |
122 | IXP4XX_PERIPHERAL_BASE_VIRT) | 126 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
123 | MAPIO(coyote_map_io) | 127 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
124 | INITIRQ(ixp4xx_init_irq) | 128 | .map_io = coyote_map_io, |
129 | .init_irq = ixp4xx_init_irq, | ||
125 | .timer = &ixp4xx_timer, | 130 | .timer = &ixp4xx_timer, |
126 | BOOT_PARAMS(0x0100) | 131 | .boot_params = 0x0100, |
127 | INIT_MACHINE(coyote_init) | 132 | .init_machine = coyote_init, |
128 | MACHINE_END | 133 | MACHINE_END |
129 | #endif | 134 | #endif |
130 | 135 | ||
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c index e77c86efd21d..8ba1cd9406e7 100644 --- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c +++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c | |||
@@ -140,14 +140,15 @@ static void __init gtwx5715_init(void) | |||
140 | 140 | ||
141 | 141 | ||
142 | MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)") | 142 | MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)") |
143 | MAINTAINER("George Joseph") | 143 | /* Maintainer: George Joseph */ |
144 | BOOT_MEM(PHYS_OFFSET, IXP4XX_UART2_BASE_PHYS, | 144 | .phys_ram = PHYS_OFFSET, |
145 | IXP4XX_UART2_BASE_VIRT) | 145 | .phys_io = IXP4XX_UART2_BASE_PHYS, |
146 | MAPIO(gtwx5715_map_io) | 146 | .io_pg_offst = ((IXP4XX_UART2_BASE_VIRT) >> 18) & 0xfffc, |
147 | INITIRQ(ixp4xx_init_irq) | 147 | .map_io = gtwx5715_map_io, |
148 | .timer = &ixp4xx_timer, | 148 | .init_irq = ixp4xx_init_irq, |
149 | BOOT_PARAMS(0x0100) | 149 | .timer = &ixp4xx_timer, |
150 | INIT_MACHINE(gtwx5715_init) | 150 | .boot_params = 0x0100, |
151 | .init_machine = gtwx5715_init, | ||
151 | MACHINE_END | 152 | MACHINE_END |
152 | 153 | ||
153 | 154 | ||
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c index 77346c1f676b..c2ba759e9946 100644 --- a/arch/arm/mach-ixp4xx/ixdp425-setup.c +++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c | |||
@@ -95,7 +95,8 @@ static struct plat_serial8250_port ixdp425_uart_data[] = { | |||
95 | .iotype = UPIO_MEM, | 95 | .iotype = UPIO_MEM, |
96 | .regshift = 2, | 96 | .regshift = 2, |
97 | .uartclk = IXP4XX_UART_XTAL, | 97 | .uartclk = IXP4XX_UART_XTAL, |
98 | } | 98 | }, |
99 | { }, | ||
99 | }; | 100 | }; |
100 | 101 | ||
101 | static struct platform_device ixdp425_uart = { | 102 | static struct platform_device ixdp425_uart = { |
@@ -128,36 +129,39 @@ static void __init ixdp425_init(void) | |||
128 | } | 129 | } |
129 | 130 | ||
130 | MACHINE_START(IXDP425, "Intel IXDP425 Development Platform") | 131 | MACHINE_START(IXDP425, "Intel IXDP425 Development Platform") |
131 | MAINTAINER("MontaVista Software, Inc.") | 132 | /* Maintainer: MontaVista Software, Inc. */ |
132 | BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS, | 133 | .phys_ram = PHYS_OFFSET, |
133 | IXP4XX_PERIPHERAL_BASE_VIRT) | 134 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
134 | MAPIO(ixdp425_map_io) | 135 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
135 | INITIRQ(ixp4xx_init_irq) | 136 | .map_io = ixdp425_map_io, |
137 | .init_irq = ixp4xx_init_irq, | ||
136 | .timer = &ixp4xx_timer, | 138 | .timer = &ixp4xx_timer, |
137 | BOOT_PARAMS(0x0100) | 139 | .boot_params = 0x0100, |
138 | INIT_MACHINE(ixdp425_init) | 140 | .init_machine = ixdp425_init, |
139 | MACHINE_END | 141 | MACHINE_END |
140 | 142 | ||
141 | MACHINE_START(IXDP465, "Intel IXDP465 Development Platform") | 143 | MACHINE_START(IXDP465, "Intel IXDP465 Development Platform") |
142 | MAINTAINER("MontaVista Software, Inc.") | 144 | /* Maintainer: MontaVista Software, Inc. */ |
143 | BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS, | 145 | .phys_ram = PHYS_OFFSET, |
144 | IXP4XX_PERIPHERAL_BASE_VIRT) | 146 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
145 | MAPIO(ixdp425_map_io) | 147 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
146 | INITIRQ(ixp4xx_init_irq) | 148 | .map_io = ixdp425_map_io, |
149 | .init_irq = ixp4xx_init_irq, | ||
147 | .timer = &ixp4xx_timer, | 150 | .timer = &ixp4xx_timer, |
148 | BOOT_PARAMS(0x0100) | 151 | .boot_params = 0x0100, |
149 | INIT_MACHINE(ixdp425_init) | 152 | .init_machine = ixdp425_init, |
150 | MACHINE_END | 153 | MACHINE_END |
151 | 154 | ||
152 | MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform") | 155 | MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform") |
153 | MAINTAINER("MontaVista Software, Inc.") | 156 | /* Maintainer: MontaVista Software, Inc. */ |
154 | BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS, | 157 | .phys_ram = PHYS_OFFSET, |
155 | IXP4XX_PERIPHERAL_BASE_VIRT) | 158 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
156 | MAPIO(ixdp425_map_io) | 159 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
157 | INITIRQ(ixp4xx_init_irq) | 160 | .map_io = ixdp425_map_io, |
161 | .init_irq = ixp4xx_init_irq, | ||
158 | .timer = &ixp4xx_timer, | 162 | .timer = &ixp4xx_timer, |
159 | BOOT_PARAMS(0x0100) | 163 | .boot_params = 0x0100, |
160 | INIT_MACHINE(ixdp425_init) | 164 | .init_machine = ixdp425_init, |
161 | MACHINE_END | 165 | MACHINE_END |
162 | 166 | ||
163 | /* | 167 | /* |
@@ -168,14 +172,15 @@ MACHINE_END | |||
168 | */ | 172 | */ |
169 | #ifdef CONFIG_ARCH_AVILA | 173 | #ifdef CONFIG_ARCH_AVILA |
170 | MACHINE_START(AVILA, "Gateworks Avila Network Platform") | 174 | MACHINE_START(AVILA, "Gateworks Avila Network Platform") |
171 | MAINTAINER("Deepak Saxena <dsaxena@plexity.net>") | 175 | /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ |
172 | BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS, | 176 | .phys_ram = PHYS_OFFSET, |
173 | IXP4XX_PERIPHERAL_BASE_VIRT) | 177 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
174 | MAPIO(ixdp425_map_io) | 178 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
175 | INITIRQ(ixp4xx_init_irq) | 179 | .map_io = ixdp425_map_io, |
180 | .init_irq = ixp4xx_init_irq, | ||
176 | .timer = &ixp4xx_timer, | 181 | .timer = &ixp4xx_timer, |
177 | BOOT_PARAMS(0x0100) | 182 | .boot_params = 0x0100, |
178 | INIT_MACHINE(ixdp425_init) | 183 | .init_machine = ixdp425_init, |
179 | MACHINE_END | 184 | MACHINE_END |
180 | #endif | 185 | #endif |
181 | 186 | ||
diff --git a/arch/arm/mach-l7200/core.c b/arch/arm/mach-l7200/core.c index 606ca95f8217..2a7fee2a7635 100644 --- a/arch/arm/mach-l7200/core.c +++ b/arch/arm/mach-l7200/core.c | |||
@@ -81,9 +81,11 @@ static void __init l7200_map_io(void) | |||
81 | } | 81 | } |
82 | 82 | ||
83 | MACHINE_START(L7200, "LinkUp Systems L7200") | 83 | MACHINE_START(L7200, "LinkUp Systems L7200") |
84 | MAINTAINER("Steve Hill / Scott McConnell") | 84 | /* Maintainer: Steve Hill / Scott McConnell */ |
85 | BOOT_MEM(0xf0000000, 0x80040000, 0xd0000000) | 85 | .phys_ram = 0xf0000000, |
86 | MAPIO(l7200_map_io) | 86 | .phys_io = 0x80040000, |
87 | INITIRQ(l7200_init_irq) | 87 | .io_pg_offst = ((0xd0000000) >> 18) & 0xfffc, |
88 | .map_io = l7200_map_io, | ||
89 | .init_irq = l7200_init_irq, | ||
88 | MACHINE_END | 90 | MACHINE_END |
89 | 91 | ||
diff --git a/arch/arm/mach-lh7a40x/arch-kev7a400.c b/arch/arm/mach-lh7a40x/arch-kev7a400.c index be5d17fe9dcb..cb3dcd3bd00a 100644 --- a/arch/arm/mach-lh7a40x/arch-kev7a400.c +++ b/arch/arm/mach-lh7a40x/arch-kev7a400.c | |||
@@ -102,10 +102,12 @@ void __init lh7a40x_init_board_irq (void) | |||
102 | } | 102 | } |
103 | 103 | ||
104 | MACHINE_START (KEV7A400, "Sharp KEV7a400") | 104 | MACHINE_START (KEV7A400, "Sharp KEV7a400") |
105 | MAINTAINER ("Marc Singer") | 105 | /* Maintainer: Marc Singer */ |
106 | BOOT_MEM (0xc0000000, 0x80000000, io_p2v (0x80000000)) | 106 | .phys_ram = 0xc0000000, |
107 | BOOT_PARAMS (0xc0000100) | 107 | .phys_io = 0x80000000, |
108 | MAPIO (kev7a400_map_io) | 108 | .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc, |
109 | INITIRQ (lh7a400_init_irq) | 109 | .boot_params = 0xc0000100, |
110 | .map_io = kev7a400_map_io, | ||
111 | .init_irq = lh7a400_init_irq, | ||
110 | .timer = &lh7a40x_timer, | 112 | .timer = &lh7a40x_timer, |
111 | MACHINE_END | 113 | MACHINE_END |
diff --git a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c index c823447a150f..6eb61a17c63b 100644 --- a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c +++ b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c | |||
@@ -260,13 +260,15 @@ lpd7a400_map_io(void) | |||
260 | #ifdef CONFIG_MACH_LPD7A400 | 260 | #ifdef CONFIG_MACH_LPD7A400 |
261 | 261 | ||
262 | MACHINE_START (LPD7A400, "Logic Product Development LPD7A400-10") | 262 | MACHINE_START (LPD7A400, "Logic Product Development LPD7A400-10") |
263 | MAINTAINER ("Marc Singer") | 263 | /* Maintainer: Marc Singer */ |
264 | BOOT_MEM (0xc0000000, 0x80000000, io_p2v (0x80000000)) | 264 | .phys_ram = 0xc0000000, |
265 | BOOT_PARAMS (0xc0000100) | 265 | .phys_io = 0x80000000, |
266 | MAPIO (lpd7a400_map_io) | 266 | .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc, |
267 | INITIRQ (lh7a400_init_irq) | 267 | .boot_params = 0xc0000100, |
268 | .map_io = lpd7a400_map_io, | ||
269 | .init_irq = lh7a400_init_irq, | ||
268 | .timer = &lh7a40x_timer, | 270 | .timer = &lh7a40x_timer, |
269 | INIT_MACHINE (lpd7a40x_init) | 271 | .init_machine = lpd7a40x_init, |
270 | MACHINE_END | 272 | MACHINE_END |
271 | 273 | ||
272 | #endif | 274 | #endif |
@@ -274,13 +276,15 @@ MACHINE_END | |||
274 | #ifdef CONFIG_MACH_LPD7A404 | 276 | #ifdef CONFIG_MACH_LPD7A404 |
275 | 277 | ||
276 | MACHINE_START (LPD7A404, "Logic Product Development LPD7A404-10") | 278 | MACHINE_START (LPD7A404, "Logic Product Development LPD7A404-10") |
277 | MAINTAINER ("Marc Singer") | 279 | /* Maintainer: Marc Singer */ |
278 | BOOT_MEM (0xc0000000, 0x80000000, io_p2v (0x80000000)) | 280 | .phys_ram = 0xc0000000, |
279 | BOOT_PARAMS (0xc0000100) | 281 | .phys_io = 0x80000000, |
280 | MAPIO (lpd7a400_map_io) | 282 | .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc, |
281 | INITIRQ (lh7a404_init_irq) | 283 | .boot_params = 0xc0000100, |
284 | .map_io = lpd7a400_map_io, | ||
285 | .init_irq = lh7a404_init_irq, | ||
282 | .timer = &lh7a40x_timer, | 286 | .timer = &lh7a40x_timer, |
283 | INIT_MACHINE (lpd7a40x_init) | 287 | .init_machine = lpd7a40x_init, |
284 | MACHINE_END | 288 | MACHINE_END |
285 | 289 | ||
286 | #endif | 290 | #endif |
diff --git a/arch/arm/mach-omap/board-generic.c b/arch/arm/mach-omap/board-generic.c index 2102a2cd1013..384bc7cec1db 100644 --- a/arch/arm/mach-omap/board-generic.c +++ b/arch/arm/mach-omap/board-generic.c | |||
@@ -88,11 +88,13 @@ static void __init omap_generic_map_io(void) | |||
88 | } | 88 | } |
89 | 89 | ||
90 | MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710") | 90 | MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710") |
91 | MAINTAINER("Tony Lindgren <tony@atomide.com>") | 91 | /* Maintainer: Tony Lindgren <tony@atomide.com> */ |
92 | BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000) | 92 | .phys_ram = 0x10000000, |
93 | BOOT_PARAMS(0x10000100) | 93 | .phys_io = 0xfff00000, |
94 | MAPIO(omap_generic_map_io) | 94 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
95 | INITIRQ(omap_generic_init_irq) | 95 | .boot_params = 0x10000100, |
96 | INIT_MACHINE(omap_generic_init) | 96 | .map_io = omap_generic_map_io, |
97 | .init_irq = omap_generic_init_irq, | ||
98 | .init_machine = omap_generic_init, | ||
97 | .timer = &omap_timer, | 99 | .timer = &omap_timer, |
98 | MACHINE_END | 100 | MACHINE_END |
diff --git a/arch/arm/mach-omap/board-h2.c b/arch/arm/mach-omap/board-h2.c index 1f067830d1fc..f37c76a9b163 100644 --- a/arch/arm/mach-omap/board-h2.c +++ b/arch/arm/mach-omap/board-h2.c | |||
@@ -177,11 +177,13 @@ static void __init h2_map_io(void) | |||
177 | } | 177 | } |
178 | 178 | ||
179 | MACHINE_START(OMAP_H2, "TI-H2") | 179 | MACHINE_START(OMAP_H2, "TI-H2") |
180 | MAINTAINER("Imre Deak <imre.deak@nokia.com>") | 180 | /* Maintainer: Imre Deak <imre.deak@nokia.com> */ |
181 | BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000) | 181 | .phys_ram = 0x10000000, |
182 | BOOT_PARAMS(0x10000100) | 182 | .phys_io = 0xfff00000, |
183 | MAPIO(h2_map_io) | 183 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
184 | INITIRQ(h2_init_irq) | 184 | .boot_params = 0x10000100, |
185 | INIT_MACHINE(h2_init) | 185 | .map_io = h2_map_io, |
186 | .init_irq = h2_init_irq, | ||
187 | .init_machine = h2_init, | ||
186 | .timer = &omap_timer, | 188 | .timer = &omap_timer, |
187 | MACHINE_END | 189 | MACHINE_END |
diff --git a/arch/arm/mach-omap/board-h3.c b/arch/arm/mach-omap/board-h3.c index 486a5a006c9a..705e48594e9a 100644 --- a/arch/arm/mach-omap/board-h3.c +++ b/arch/arm/mach-omap/board-h3.c | |||
@@ -195,11 +195,13 @@ static void __init h3_map_io(void) | |||
195 | } | 195 | } |
196 | 196 | ||
197 | MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") | 197 | MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") |
198 | MAINTAINER("Texas Instruments, Inc.") | 198 | /* Maintainer: Texas Instruments, Inc. */ |
199 | BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000) | 199 | .phys_ram = 0x10000000, |
200 | BOOT_PARAMS(0x10000100) | 200 | .phys_io = 0xfff00000, |
201 | MAPIO(h3_map_io) | 201 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
202 | INITIRQ(h3_init_irq) | 202 | .boot_params = 0x10000100, |
203 | INIT_MACHINE(h3_init) | 203 | .map_io = h3_map_io, |
204 | .init_irq = h3_init_irq, | ||
205 | .init_machine = h3_init, | ||
204 | .timer = &omap_timer, | 206 | .timer = &omap_timer, |
205 | MACHINE_END | 207 | MACHINE_END |
diff --git a/arch/arm/mach-omap/board-innovator.c b/arch/arm/mach-omap/board-innovator.c index 57cf4da88d55..523363f18cc0 100644 --- a/arch/arm/mach-omap/board-innovator.c +++ b/arch/arm/mach-omap/board-innovator.c | |||
@@ -270,11 +270,13 @@ static void __init innovator_map_io(void) | |||
270 | } | 270 | } |
271 | 271 | ||
272 | MACHINE_START(OMAP_INNOVATOR, "TI-Innovator") | 272 | MACHINE_START(OMAP_INNOVATOR, "TI-Innovator") |
273 | MAINTAINER("MontaVista Software, Inc.") | 273 | /* Maintainer: MontaVista Software, Inc. */ |
274 | BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000) | 274 | .phys_ram = 0x10000000, |
275 | BOOT_PARAMS(0x10000100) | 275 | .phys_io = 0xfff00000, |
276 | MAPIO(innovator_map_io) | 276 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
277 | INITIRQ(innovator_init_irq) | 277 | .boot_params = 0x10000100, |
278 | INIT_MACHINE(innovator_init) | 278 | .map_io = innovator_map_io, |
279 | .init_irq = innovator_init_irq, | ||
280 | .init_machine = innovator_init, | ||
279 | .timer = &omap_timer, | 281 | .timer = &omap_timer, |
280 | MACHINE_END | 282 | MACHINE_END |
diff --git a/arch/arm/mach-omap/board-netstar.c b/arch/arm/mach-omap/board-netstar.c index 54acbd215c4b..8c653734d5a3 100644 --- a/arch/arm/mach-omap/board-netstar.c +++ b/arch/arm/mach-omap/board-netstar.c | |||
@@ -141,11 +141,13 @@ static int __init netstar_late_init(void) | |||
141 | postcore_initcall(netstar_late_init); | 141 | postcore_initcall(netstar_late_init); |
142 | 142 | ||
143 | MACHINE_START(NETSTAR, "NetStar OMAP5910") | 143 | MACHINE_START(NETSTAR, "NetStar OMAP5910") |
144 | MAINTAINER("Ladislav Michl <michl@2n.cz>") | 144 | /* Maintainer: Ladislav Michl <michl@2n.cz> */ |
145 | BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000) | 145 | .phys_ram = 0x10000000, |
146 | BOOT_PARAMS(0x10000100) | 146 | .phys_io = 0xfff00000, |
147 | MAPIO(netstar_map_io) | 147 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
148 | INITIRQ(netstar_init_irq) | 148 | .boot_params = 0x10000100, |
149 | INIT_MACHINE(netstar_init) | 149 | .map_io = netstar_map_io, |
150 | .timer = &omap_timer, | 150 | .init_irq = netstar_init_irq, |
151 | .init_machine = netstar_init, | ||
152 | .timer = &omap_timer, | ||
151 | MACHINE_END | 153 | MACHINE_END |
diff --git a/arch/arm/mach-omap/board-osk.c b/arch/arm/mach-omap/board-osk.c index a951fc82459b..cb433436aa08 100644 --- a/arch/arm/mach-omap/board-osk.c +++ b/arch/arm/mach-omap/board-osk.c | |||
@@ -159,11 +159,13 @@ static void __init osk_map_io(void) | |||
159 | } | 159 | } |
160 | 160 | ||
161 | MACHINE_START(OMAP_OSK, "TI-OSK") | 161 | MACHINE_START(OMAP_OSK, "TI-OSK") |
162 | MAINTAINER("Dirk Behme <dirk.behme@de.bosch.com>") | 162 | /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */ |
163 | BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000) | 163 | .phys_ram = 0x10000000, |
164 | BOOT_PARAMS(0x10000100) | 164 | .phys_io = 0xfff00000, |
165 | MAPIO(osk_map_io) | 165 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
166 | INITIRQ(osk_init_irq) | 166 | .boot_params = 0x10000100, |
167 | INIT_MACHINE(osk_init) | 167 | .map_io = osk_map_io, |
168 | .init_irq = osk_init_irq, | ||
169 | .init_machine = osk_init, | ||
168 | .timer = &omap_timer, | 170 | .timer = &omap_timer, |
169 | MACHINE_END | 171 | MACHINE_END |
diff --git a/arch/arm/mach-omap/board-perseus2.c b/arch/arm/mach-omap/board-perseus2.c index 64515aeb49cf..d5342043d48f 100644 --- a/arch/arm/mach-omap/board-perseus2.c +++ b/arch/arm/mach-omap/board-perseus2.c | |||
@@ -179,11 +179,13 @@ static void __init omap_perseus2_map_io(void) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2") | 181 | MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2") |
182 | MAINTAINER("Kevin Hilman <kjh@hilman.org>") | 182 | /* Maintainer: Kevin Hilman <kjh@hilman.org> */ |
183 | BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000) | 183 | .phys_ram = 0x10000000, |
184 | BOOT_PARAMS(0x10000100) | 184 | .phys_io = 0xfff00000, |
185 | MAPIO(omap_perseus2_map_io) | 185 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
186 | INITIRQ(omap_perseus2_init_irq) | 186 | .boot_params = 0x10000100, |
187 | INIT_MACHINE(omap_perseus2_init) | 187 | .map_io = omap_perseus2_map_io, |
188 | .init_irq = omap_perseus2_init_irq, | ||
189 | .init_machine = omap_perseus2_init, | ||
188 | .timer = &omap_timer, | 190 | .timer = &omap_timer, |
189 | MACHINE_END | 191 | MACHINE_END |
diff --git a/arch/arm/mach-omap/board-voiceblue.c b/arch/arm/mach-omap/board-voiceblue.c index f1a5bffac666..6b0c5003d719 100644 --- a/arch/arm/mach-omap/board-voiceblue.c +++ b/arch/arm/mach-omap/board-voiceblue.c | |||
@@ -246,11 +246,13 @@ EXPORT_SYMBOL(voiceblue_wdt_disable); | |||
246 | EXPORT_SYMBOL(voiceblue_wdt_ping); | 246 | EXPORT_SYMBOL(voiceblue_wdt_ping); |
247 | 247 | ||
248 | MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910") | 248 | MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910") |
249 | MAINTAINER("Ladislav Michl <michl@2n.cz>") | 249 | /* Maintainer: Ladislav Michl <michl@2n.cz> */ |
250 | BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000) | 250 | .phys_ram = 0x10000000, |
251 | BOOT_PARAMS(0x10000100) | 251 | .phys_io = 0xfff00000, |
252 | MAPIO(voiceblue_map_io) | 252 | .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, |
253 | INITIRQ(voiceblue_init_irq) | 253 | .boot_params = 0x10000100, |
254 | INIT_MACHINE(voiceblue_init) | 254 | .map_io = voiceblue_map_io, |
255 | .timer = &omap_timer, | 255 | .init_irq = voiceblue_init_irq, |
256 | .init_machine = voiceblue_init, | ||
257 | .timer = &omap_timer, | ||
256 | MACHINE_END | 258 | MACHINE_END |
diff --git a/arch/arm/mach-omap/pm.c b/arch/arm/mach-omap/pm.c index 00fac155df2a..6b03ccdc1e92 100644 --- a/arch/arm/mach-omap/pm.c +++ b/arch/arm/mach-omap/pm.c | |||
@@ -41,7 +41,9 @@ | |||
41 | #include <linux/pm.h> | 41 | #include <linux/pm.h> |
42 | 42 | ||
43 | #include <asm/io.h> | 43 | #include <asm/io.h> |
44 | #include <asm/mach/time.h> | ||
44 | #include <asm/mach-types.h> | 45 | #include <asm/mach-types.h> |
46 | |||
45 | #include <asm/arch/omap16xx.h> | 47 | #include <asm/arch/omap16xx.h> |
46 | #include <asm/arch/pm.h> | 48 | #include <asm/arch/pm.h> |
47 | #include <asm/arch/mux.h> | 49 | #include <asm/arch/mux.h> |
@@ -80,13 +82,13 @@ void omap_pm_idle(void) | |||
80 | return; | 82 | return; |
81 | } | 83 | } |
82 | mask32 = omap_readl(ARM_SYSST); | 84 | mask32 = omap_readl(ARM_SYSST); |
83 | local_fiq_enable(); | ||
84 | local_irq_enable(); | ||
85 | 85 | ||
86 | #if defined(CONFIG_OMAP_32K_TIMER) && defined(CONFIG_NO_IDLE_HZ) | 86 | /* |
87 | /* Override timer to use VST for the next cycle */ | 87 | * Since an interrupt may set up a timer, we don't want to |
88 | omap_32k_timer_next_vst_interrupt(); | 88 | * reprogram the hardware timer with interrupts enabled. |
89 | #endif | 89 | * Re-enable interrupts only after returning from idle. |
90 | */ | ||
91 | timer_dyn_reprogram(); | ||
90 | 92 | ||
91 | if ((mask32 & DSP_IDLE) == 0) { | 93 | if ((mask32 & DSP_IDLE) == 0) { |
92 | __asm__ volatile ("mcr p15, 0, r0, c7, c0, 4"); | 94 | __asm__ volatile ("mcr p15, 0, r0, c7, c0, 4"); |
@@ -102,6 +104,8 @@ void omap_pm_idle(void) | |||
102 | 104 | ||
103 | func_ptr(); | 105 | func_ptr(); |
104 | } | 106 | } |
107 | local_fiq_enable(); | ||
108 | local_irq_enable(); | ||
105 | } | 109 | } |
106 | 110 | ||
107 | /* | 111 | /* |
diff --git a/arch/arm/mach-omap/time.c b/arch/arm/mach-omap/time.c index 589e8b2740dd..dd34e9f4c413 100644 --- a/arch/arm/mach-omap/time.c +++ b/arch/arm/mach-omap/time.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * OMAP Timers | 4 | * OMAP Timers |
5 | * | 5 | * |
6 | * Copyright (C) 2004 Nokia Corporation | 6 | * Copyright (C) 2004 Nokia Corporation |
7 | * Partial timer rewrite and additional VST timer support by | 7 | * Partial timer rewrite and additional dynamic tick timer support by |
8 | * Tony Lindgen <tony@atomide.com> and | 8 | * Tony Lindgen <tony@atomide.com> and |
9 | * Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> | 9 | * Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> |
10 | * | 10 | * |
@@ -261,7 +261,6 @@ unsigned long long sched_clock(void) | |||
261 | * so with HZ = 100, TVR = 327.68. | 261 | * so with HZ = 100, TVR = 327.68. |
262 | */ | 262 | */ |
263 | #define OMAP_32K_TIMER_TICK_PERIOD ((32768 / HZ) - 1) | 263 | #define OMAP_32K_TIMER_TICK_PERIOD ((32768 / HZ) - 1) |
264 | #define MAX_SKIP_JIFFIES 25 | ||
265 | #define TIMER_32K_SYNCHRONIZED 0xfffbc410 | 264 | #define TIMER_32K_SYNCHRONIZED 0xfffbc410 |
266 | 265 | ||
267 | #define JIFFIES_TO_HW_TICKS(nr_jiffies, clock_rate) \ | 266 | #define JIFFIES_TO_HW_TICKS(nr_jiffies, clock_rate) \ |
@@ -347,6 +346,42 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id, | |||
347 | return IRQ_HANDLED; | 346 | return IRQ_HANDLED; |
348 | } | 347 | } |
349 | 348 | ||
349 | #ifdef CONFIG_NO_IDLE_HZ | ||
350 | /* | ||
351 | * Programs the next timer interrupt needed. Called when dynamic tick is | ||
352 | * enabled, and to reprogram the ticks to skip from pm_idle. Note that | ||
353 | * we can keep the timer continuous, and don't need to set it to run in | ||
354 | * one-shot mode. This is because the timer will get reprogrammed again | ||
355 | * after next interrupt. | ||
356 | */ | ||
357 | void omap_32k_timer_reprogram(unsigned long next_tick) | ||
358 | { | ||
359 | omap_32k_timer_start(JIFFIES_TO_HW_TICKS(next_tick, 32768) + 1); | ||
360 | } | ||
361 | |||
362 | static struct irqaction omap_32k_timer_irq; | ||
363 | extern struct timer_update_handler timer_update; | ||
364 | |||
365 | static int omap_32k_timer_enable_dyn_tick(void) | ||
366 | { | ||
367 | /* No need to reprogram timer, just use the next interrupt */ | ||
368 | return 0; | ||
369 | } | ||
370 | |||
371 | static int omap_32k_timer_disable_dyn_tick(void) | ||
372 | { | ||
373 | omap_32k_timer_start(OMAP_32K_TIMER_TICK_PERIOD); | ||
374 | return 0; | ||
375 | } | ||
376 | |||
377 | static struct dyn_tick_timer omap_dyn_tick_timer = { | ||
378 | .enable = omap_32k_timer_enable_dyn_tick, | ||
379 | .disable = omap_32k_timer_disable_dyn_tick, | ||
380 | .reprogram = omap_32k_timer_reprogram, | ||
381 | .handler = omap_32k_timer_interrupt, | ||
382 | }; | ||
383 | #endif /* CONFIG_NO_IDLE_HZ */ | ||
384 | |||
350 | static struct irqaction omap_32k_timer_irq = { | 385 | static struct irqaction omap_32k_timer_irq = { |
351 | .name = "32KHz timer", | 386 | .name = "32KHz timer", |
352 | .flags = SA_INTERRUPT | SA_TIMER, | 387 | .flags = SA_INTERRUPT | SA_TIMER, |
@@ -355,6 +390,11 @@ static struct irqaction omap_32k_timer_irq = { | |||
355 | 390 | ||
356 | static __init void omap_init_32k_timer(void) | 391 | static __init void omap_init_32k_timer(void) |
357 | { | 392 | { |
393 | |||
394 | #ifdef CONFIG_NO_IDLE_HZ | ||
395 | omap_timer.dyn_tick = &omap_dyn_tick_timer; | ||
396 | #endif | ||
397 | |||
358 | setup_irq(INT_OS_TIMER, &omap_32k_timer_irq); | 398 | setup_irq(INT_OS_TIMER, &omap_32k_timer_irq); |
359 | omap_timer.offset = omap_32k_timer_gettimeoffset; | 399 | omap_timer.offset = omap_32k_timer_gettimeoffset; |
360 | omap_32k_last_tick = omap_32k_sync_timer_read(); | 400 | omap_32k_last_tick = omap_32k_sync_timer_read(); |
diff --git a/arch/arm/mach-omap/usb.c b/arch/arm/mach-omap/usb.c index 7f37857b1a28..fd483ff9f8fe 100644 --- a/arch/arm/mach-omap/usb.c +++ b/arch/arm/mach-omap/usb.c | |||
@@ -41,7 +41,6 @@ | |||
41 | 41 | ||
42 | /* These routines should handle the standard chip-specific modes | 42 | /* These routines should handle the standard chip-specific modes |
43 | * for usb0/1/2 ports, covering basic mux and transceiver setup. | 43 | * for usb0/1/2 ports, covering basic mux and transceiver setup. |
44 | * Call omap_usb_init() once, from INIT_MACHINE(). | ||
45 | * | 44 | * |
46 | * Some board-*.c files will need to set up additional mux options, | 45 | * Some board-*.c files will need to set up additional mux options, |
47 | * like for suspend handling, vbus sensing, GPIOs, and the D+ pullup. | 46 | * like for suspend handling, vbus sensing, GPIOs, and the D+ pullup. |
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index c4e6d2523585..efc2f657184e 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -24,3 +24,7 @@ obj-$(CONFIG_LEDS) += $(led-y) | |||
24 | 24 | ||
25 | # Misc features | 25 | # Misc features |
26 | obj-$(CONFIG_PM) += pm.o sleep.o | 26 | obj-$(CONFIG_PM) += pm.o sleep.o |
27 | |||
28 | ifeq ($(CONFIG_PXA27x),y) | ||
29 | obj-$(CONFIG_PM) += standby.o | ||
30 | endif | ||
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index f691cf77d390..86b862f56e7e 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -287,34 +287,40 @@ static void __init corgi_map_io(void) | |||
287 | 287 | ||
288 | #ifdef CONFIG_MACH_CORGI | 288 | #ifdef CONFIG_MACH_CORGI |
289 | MACHINE_START(CORGI, "SHARP Corgi") | 289 | MACHINE_START(CORGI, "SHARP Corgi") |
290 | BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000)) | 290 | .phys_ram = 0xa0000000, |
291 | FIXUP(fixup_corgi) | 291 | .phys_io = 0x40000000, |
292 | MAPIO(corgi_map_io) | 292 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
293 | INITIRQ(corgi_init_irq) | 293 | .fixup = fixup_corgi, |
294 | .init_machine = corgi_init, | 294 | .map_io = corgi_map_io, |
295 | .timer = &pxa_timer, | 295 | .init_irq = corgi_init_irq, |
296 | .init_machine = corgi_init, | ||
297 | .timer = &pxa_timer, | ||
296 | MACHINE_END | 298 | MACHINE_END |
297 | #endif | 299 | #endif |
298 | 300 | ||
299 | #ifdef CONFIG_MACH_SHEPHERD | 301 | #ifdef CONFIG_MACH_SHEPHERD |
300 | MACHINE_START(SHEPHERD, "SHARP Shepherd") | 302 | MACHINE_START(SHEPHERD, "SHARP Shepherd") |
301 | BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000)) | 303 | .phys_ram = 0xa0000000, |
302 | FIXUP(fixup_corgi) | 304 | .phys_io = 0x40000000, |
303 | MAPIO(corgi_map_io) | 305 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
304 | INITIRQ(corgi_init_irq) | 306 | .fixup = fixup_corgi, |
305 | .init_machine = corgi_init, | 307 | .map_io = corgi_map_io, |
306 | .timer = &pxa_timer, | 308 | .init_irq = corgi_init_irq, |
309 | .init_machine = corgi_init, | ||
310 | .timer = &pxa_timer, | ||
307 | MACHINE_END | 311 | MACHINE_END |
308 | #endif | 312 | #endif |
309 | 313 | ||
310 | #ifdef CONFIG_MACH_HUSKY | 314 | #ifdef CONFIG_MACH_HUSKY |
311 | MACHINE_START(HUSKY, "SHARP Husky") | 315 | MACHINE_START(HUSKY, "SHARP Husky") |
312 | BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000)) | 316 | .phys_ram = 0xa0000000, |
313 | FIXUP(fixup_corgi) | 317 | .phys_io = 0x40000000, |
314 | MAPIO(corgi_map_io) | 318 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
315 | INITIRQ(corgi_init_irq) | 319 | .fixup = fixup_corgi, |
316 | .init_machine = corgi_init, | 320 | .map_io = corgi_map_io, |
317 | .timer = &pxa_timer, | 321 | .init_irq = corgi_init_irq, |
322 | .init_machine = corgi_init, | ||
323 | .timer = &pxa_timer, | ||
318 | MACHINE_END | 324 | MACHINE_END |
319 | #endif | 325 | #endif |
320 | 326 | ||
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c index c5a66bf4d3d5..386e107b53cc 100644 --- a/arch/arm/mach-pxa/idp.c +++ b/arch/arm/mach-pxa/idp.c | |||
@@ -181,10 +181,12 @@ static void __init idp_map_io(void) | |||
181 | 181 | ||
182 | 182 | ||
183 | MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") | 183 | MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") |
184 | MAINTAINER("Vibren Technologies") | 184 | /* Maintainer: Vibren Technologies */ |
185 | BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000)) | 185 | .phys_ram = 0xa0000000, |
186 | MAPIO(idp_map_io) | 186 | .phys_io = 0x40000000, |
187 | INITIRQ(idp_init_irq) | 187 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
188 | .map_io = idp_map_io, | ||
189 | .init_irq = idp_init_irq, | ||
188 | .timer = &pxa_timer, | 190 | .timer = &pxa_timer, |
189 | INIT_MACHINE(idp_init) | 191 | .init_machine = idp_init, |
190 | MACHINE_END | 192 | MACHINE_END |
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index f2c9e0d2b24b..6309853b59be 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c | |||
@@ -268,10 +268,12 @@ static void __init lubbock_map_io(void) | |||
268 | } | 268 | } |
269 | 269 | ||
270 | MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)") | 270 | MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)") |
271 | MAINTAINER("MontaVista Software Inc.") | 271 | /* Maintainer: MontaVista Software Inc. */ |
272 | BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000)) | 272 | .phys_ram = 0xa0000000, |
273 | MAPIO(lubbock_map_io) | 273 | .phys_io = 0x40000000, |
274 | INITIRQ(lubbock_init_irq) | 274 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
275 | .map_io = lubbock_map_io, | ||
276 | .init_irq = lubbock_init_irq, | ||
275 | .timer = &pxa_timer, | 277 | .timer = &pxa_timer, |
276 | INIT_MACHINE(lubbock_init) | 278 | .init_machine = lubbock_init, |
277 | MACHINE_END | 279 | MACHINE_END |
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 9896afca751f..827b7b5a5be8 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -345,10 +345,12 @@ static void __init mainstone_map_io(void) | |||
345 | } | 345 | } |
346 | 346 | ||
347 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") | 347 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") |
348 | MAINTAINER("MontaVista Software Inc.") | 348 | /* Maintainer: MontaVista Software Inc. */ |
349 | BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000)) | 349 | .phys_ram = 0xa0000000, |
350 | MAPIO(mainstone_map_io) | 350 | .phys_io = 0x40000000, |
351 | INITIRQ(mainstone_init_irq) | 351 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
352 | .map_io = mainstone_map_io, | ||
353 | .init_irq = mainstone_init_irq, | ||
352 | .timer = &pxa_timer, | 354 | .timer = &pxa_timer, |
353 | INIT_MACHINE(mainstone_init) | 355 | .init_machine = mainstone_init, |
354 | MACHINE_END | 356 | MACHINE_END |
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index b6c746ea3830..0e4f6fab100a 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -180,10 +180,12 @@ static void __init poodle_map_io(void) | |||
180 | } | 180 | } |
181 | 181 | ||
182 | MACHINE_START(POODLE, "SHARP Poodle") | 182 | MACHINE_START(POODLE, "SHARP Poodle") |
183 | BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000)) | 183 | .phys_ram = 0xa0000000, |
184 | FIXUP(fixup_poodle) | 184 | .phys_io = 0x40000000, |
185 | MAPIO(poodle_map_io) | 185 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
186 | INITIRQ(pxa_init_irq) | 186 | .fixup = fixup_poodle, |
187 | .timer = &pxa_timer, | 187 | .map_io = poodle_map_io, |
188 | .init_machine = poodle_init, | 188 | .init_irq = pxa_init_irq, |
189 | .timer = &pxa_timer, | ||
190 | .init_machine = poodle_init, | ||
189 | MACHINE_END | 191 | MACHINE_END |
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index 893964fb9659..9a791b07118d 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c | |||
@@ -126,6 +126,7 @@ int pxa_cpu_pm_prepare(suspend_state_t state) | |||
126 | { | 126 | { |
127 | switch (state) { | 127 | switch (state) { |
128 | case PM_SUSPEND_MEM: | 128 | case PM_SUSPEND_MEM: |
129 | case PM_SUSPEND_STANDBY: | ||
129 | return 0; | 130 | return 0; |
130 | default: | 131 | default: |
131 | return -EINVAL; | 132 | return -EINVAL; |
@@ -138,7 +139,10 @@ void pxa_cpu_pm_enter(suspend_state_t state) | |||
138 | extern void pxa_cpu_suspend(unsigned int); | 139 | extern void pxa_cpu_suspend(unsigned int); |
139 | extern void pxa_cpu_resume(void); | 140 | extern void pxa_cpu_resume(void); |
140 | 141 | ||
141 | CKEN = CKEN22_MEMC | CKEN9_OSTIMER; | 142 | if (state == PM_SUSPEND_STANDBY) |
143 | CKEN = CKEN22_MEMC | CKEN9_OSTIMER | CKEN16_LCD |CKEN0_PWM0; | ||
144 | else | ||
145 | CKEN = CKEN22_MEMC | CKEN9_OSTIMER; | ||
142 | 146 | ||
143 | /* ensure voltage-change sequencer not initiated, which hangs */ | 147 | /* ensure voltage-change sequencer not initiated, which hangs */ |
144 | PCFR &= ~PCFR_FVC; | 148 | PCFR &= ~PCFR_FVC; |
@@ -147,6 +151,9 @@ void pxa_cpu_pm_enter(suspend_state_t state) | |||
147 | PEDR = 0xDF12FE1B; | 151 | PEDR = 0xDF12FE1B; |
148 | 152 | ||
149 | switch (state) { | 153 | switch (state) { |
154 | case PM_SUSPEND_STANDBY: | ||
155 | pxa_cpu_standby(); | ||
156 | break; | ||
150 | case PM_SUSPEND_MEM: | 157 | case PM_SUSPEND_MEM: |
151 | /* set resume return address */ | 158 | /* set resume return address */ |
152 | PSPR = virt_to_phys(pxa_cpu_resume); | 159 | PSPR = virt_to_phys(pxa_cpu_resume); |
diff --git a/arch/arm/mach-pxa/standby.S b/arch/arm/mach-pxa/standby.S new file mode 100644 index 000000000000..8a3f27b76784 --- /dev/null +++ b/arch/arm/mach-pxa/standby.S | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * PXA27x standby mode | ||
3 | * | ||
4 | * Author: David Burrage | ||
5 | * | ||
6 | * 2005 (c) MontaVista Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <linux/linkage.h> | ||
14 | #include <asm/assembler.h> | ||
15 | #include <asm/hardware.h> | ||
16 | |||
17 | #include <asm/arch/pxa-regs.h> | ||
18 | |||
19 | .text | ||
20 | |||
21 | ENTRY(pxa_cpu_standby) | ||
22 | ldr r0, =PSSR | ||
23 | mov r1, #(PSSR_PH | PSSR_STS) | ||
24 | mov r2, #2 | ||
25 | mov r3, #UNCACHED_PHYS_0 @ Read mem context in. | ||
26 | ldr ip, [r3] | ||
27 | b 1f | ||
28 | |||
29 | .align 5 | ||
30 | 1: mcr p14, 0, r2, c7, c0, 0 @ put the system into Standby | ||
31 | str r1, [r0] @ make sure PSSR_PH/STS are clear | ||
32 | mov pc, lr | ||
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c index 437106881436..a10268618f74 100644 --- a/arch/arm/mach-rpc/riscpc.c +++ b/arch/arm/mach-rpc/riscpc.c | |||
@@ -163,12 +163,14 @@ arch_initcall(rpc_init); | |||
163 | extern struct sys_timer ioc_timer; | 163 | extern struct sys_timer ioc_timer; |
164 | 164 | ||
165 | MACHINE_START(RISCPC, "Acorn-RiscPC") | 165 | MACHINE_START(RISCPC, "Acorn-RiscPC") |
166 | MAINTAINER("Russell King") | 166 | /* Maintainer: Russell King */ |
167 | BOOT_MEM(0x10000000, 0x03000000, 0xe0000000) | 167 | .phys_ram = 0x10000000, |
168 | BOOT_PARAMS(0x10000100) | 168 | .phys_io = 0x03000000, |
169 | DISABLE_PARPORT(0) | 169 | .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, |
170 | DISABLE_PARPORT(1) | 170 | .boot_params = 0x10000100, |
171 | MAPIO(rpc_map_io) | 171 | .reserve_lp0 = 1, |
172 | INITIRQ(rpc_init_irq) | 172 | .reserve_lp1 = 1, |
173 | .map_io = rpc_map_io, | ||
174 | .init_irq = rpc_init_irq, | ||
173 | .timer = &ioc_timer, | 175 | .timer = &ioc_timer, |
174 | MACHINE_END | 176 | MACHINE_END |
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig index 534df0c6c770..d4d03d0daaec 100644 --- a/arch/arm/mach-s3c2410/Kconfig +++ b/arch/arm/mach-s3c2410/Kconfig | |||
@@ -154,6 +154,11 @@ config S3C2410_PM_CHECK_CHUNKSIZE | |||
154 | the CRC data block will take more memory, but wil identify any | 154 | the CRC data block will take more memory, but wil identify any |
155 | faults with better precision. | 155 | faults with better precision. |
156 | 156 | ||
157 | config PM_SIMTEC | ||
158 | bool | ||
159 | depends on PM && (ARCH_BAST || MACH_VR1000) | ||
160 | default y | ||
161 | |||
157 | config S3C2410_LOWLEVEL_UART_PORT | 162 | config S3C2410_LOWLEVEL_UART_PORT |
158 | int "S3C2410 UART to use for low-level messages" | 163 | int "S3C2410 UART to use for low-level messages" |
159 | default 0 | 164 | default 0 |
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile index 7c379aad5d62..f99b689e4392 100644 --- a/arch/arm/mach-s3c2410/Makefile +++ b/arch/arm/mach-s3c2410/Makefile | |||
@@ -18,6 +18,7 @@ obj-$(CONFIG_S3C2410_DMA) += dma.o | |||
18 | # Power Management support | 18 | # Power Management support |
19 | 19 | ||
20 | obj-$(CONFIG_PM) += pm.o sleep.o | 20 | obj-$(CONFIG_PM) += pm.o sleep.o |
21 | obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o | ||
21 | 22 | ||
22 | # S3C2440 support | 23 | # S3C2440 support |
23 | 24 | ||
diff --git a/arch/arm/mach-s3c2410/devs.c b/arch/arm/mach-s3c2410/devs.c index 64792f678668..4664bd11adc1 100644 --- a/arch/arm/mach-s3c2410/devs.c +++ b/arch/arm/mach-s3c2410/devs.c | |||
@@ -96,8 +96,8 @@ struct platform_device s3c_device_lcd = { | |||
96 | .num_resources = ARRAY_SIZE(s3c_lcd_resource), | 96 | .num_resources = ARRAY_SIZE(s3c_lcd_resource), |
97 | .resource = s3c_lcd_resource, | 97 | .resource = s3c_lcd_resource, |
98 | .dev = { | 98 | .dev = { |
99 | .dma_mask = &s3c_device_lcd_dmamask, | 99 | .dma_mask = &s3c_device_lcd_dmamask, |
100 | .coherent_dma_mask = 0xffffffffUL | 100 | .coherent_dma_mask = 0xffffffffUL |
101 | } | 101 | } |
102 | }; | 102 | }; |
103 | 103 | ||
diff --git a/arch/arm/mach-s3c2410/irq.c b/arch/arm/mach-s3c2410/irq.c index b668c48f4399..cf9f46d88061 100644 --- a/arch/arm/mach-s3c2410/irq.c +++ b/arch/arm/mach-s3c2410/irq.c | |||
@@ -40,8 +40,11 @@ | |||
40 | * 04-Nov-2004 Ben Dooks | 40 | * 04-Nov-2004 Ben Dooks |
41 | * Fix standard IRQ wake for EINT0..4 and RTC | 41 | * Fix standard IRQ wake for EINT0..4 and RTC |
42 | * | 42 | * |
43 | * 22-Feb-2004 Ben Dooks | 43 | * 22-Feb-2005 Ben Dooks |
44 | * Fixed edge-triggering on ADC IRQ | 44 | * Fixed edge-triggering on ADC IRQ |
45 | * | ||
46 | * 28-Jun-2005 Ben Dooks | ||
47 | * Mark IRQ_LCD valid | ||
45 | */ | 48 | */ |
46 | 49 | ||
47 | #include <linux/init.h> | 50 | #include <linux/init.h> |
@@ -366,7 +369,6 @@ static struct irqchip s3c_irq_eint0t4 = { | |||
366 | #define INTMSK_UART1 (1UL << (IRQ_UART1 - IRQ_EINT0)) | 369 | #define INTMSK_UART1 (1UL << (IRQ_UART1 - IRQ_EINT0)) |
367 | #define INTMSK_UART2 (1UL << (IRQ_UART2 - IRQ_EINT0)) | 370 | #define INTMSK_UART2 (1UL << (IRQ_UART2 - IRQ_EINT0)) |
368 | #define INTMSK_ADCPARENT (1UL << (IRQ_ADCPARENT - IRQ_EINT0)) | 371 | #define INTMSK_ADCPARENT (1UL << (IRQ_ADCPARENT - IRQ_EINT0)) |
369 | #define INTMSK_LCD (1UL << (IRQ_LCD - IRQ_EINT0)) | ||
370 | 372 | ||
371 | static inline void | 373 | static inline void |
372 | s3c_irqsub_mask(unsigned int irqno, unsigned int parentbit, | 374 | s3c_irqsub_mask(unsigned int irqno, unsigned int parentbit, |
@@ -716,7 +718,6 @@ void __init s3c24xx_init_irq(void) | |||
716 | case IRQ_UART0: | 718 | case IRQ_UART0: |
717 | case IRQ_UART1: | 719 | case IRQ_UART1: |
718 | case IRQ_UART2: | 720 | case IRQ_UART2: |
719 | case IRQ_LCD: | ||
720 | case IRQ_ADCPARENT: | 721 | case IRQ_ADCPARENT: |
721 | set_irq_chip(irqno, &s3c_irq_level_chip); | 722 | set_irq_chip(irqno, &s3c_irq_level_chip); |
722 | set_irq_handler(irqno, do_level_IRQ); | 723 | set_irq_handler(irqno, do_level_IRQ); |
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c index f3e970039b65..ccb6bcefa46c 100644 --- a/arch/arm/mach-s3c2410/mach-bast.c +++ b/arch/arm/mach-s3c2410/mach-bast.c | |||
@@ -27,6 +27,7 @@ | |||
27 | * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA | 27 | * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA |
28 | * 14-Mar-2006 BJD Updated for __iomem changes | 28 | * 14-Mar-2006 BJD Updated for __iomem changes |
29 | * 22-Jun-2006 BJD Added DM9000 platform information | 29 | * 22-Jun-2006 BJD Added DM9000 platform information |
30 | * 28-Jun-2006 BJD Moved pm functionality out to common code | ||
30 | */ | 31 | */ |
31 | 32 | ||
32 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
@@ -67,7 +68,6 @@ | |||
67 | #include "devs.h" | 68 | #include "devs.h" |
68 | #include "cpu.h" | 69 | #include "cpu.h" |
69 | #include "usb-simtec.h" | 70 | #include "usb-simtec.h" |
70 | #include "pm.h" | ||
71 | 71 | ||
72 | #define COPYRIGHT ", (c) 2004-2005 Simtec Electronics" | 72 | #define COPYRIGHT ", (c) 2004-2005 Simtec Electronics" |
73 | 73 | ||
@@ -405,44 +405,14 @@ void __init bast_map_io(void) | |||
405 | usb_simtec_init(); | 405 | usb_simtec_init(); |
406 | } | 406 | } |
407 | 407 | ||
408 | void __init bast_init_irq(void) | ||
409 | { | ||
410 | s3c24xx_init_irq(); | ||
411 | } | ||
412 | |||
413 | #ifdef CONFIG_PM | ||
414 | |||
415 | /* bast_init_machine | ||
416 | * | ||
417 | * enable the power management functions for the EB2410ITX | ||
418 | */ | ||
419 | |||
420 | static __init void bast_init_machine(void) | ||
421 | { | ||
422 | unsigned long gstatus4; | ||
423 | |||
424 | printk(KERN_INFO "BAST Power Manangement" COPYRIGHT "\n"); | ||
425 | |||
426 | gstatus4 = (__raw_readl(S3C2410_BANKCON7) & 0x3) << 30; | ||
427 | gstatus4 |= (__raw_readl(S3C2410_BANKCON6) & 0x3) << 28; | ||
428 | gstatus4 |= (__raw_readl(S3C2410_BANKSIZE) & S3C2410_BANKSIZE_MASK); | ||
429 | |||
430 | __raw_writel(gstatus4, S3C2410_GSTATUS4); | ||
431 | |||
432 | s3c2410_pm_init(); | ||
433 | } | ||
434 | |||
435 | #else | ||
436 | #define bast_init_machine NULL | ||
437 | #endif | ||
438 | |||
439 | 408 | ||
440 | MACHINE_START(BAST, "Simtec-BAST") | 409 | MACHINE_START(BAST, "Simtec-BAST") |
441 | MAINTAINER("Ben Dooks <ben@simtec.co.uk>") | 410 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ |
442 | BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART) | 411 | .phys_ram = S3C2410_SDRAM_PA, |
443 | BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100) | 412 | .phys_io = S3C2410_PA_UART, |
444 | MAPIO(bast_map_io) | 413 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
445 | INITIRQ(bast_init_irq) | 414 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
446 | .init_machine = bast_init_machine, | 415 | .map_io = bast_map_io, |
416 | .init_irq = s3c24xx_init_irq, | ||
447 | .timer = &s3c24xx_timer, | 417 | .timer = &s3c24xx_timer, |
448 | MACHINE_END | 418 | MACHINE_END |
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c index 2924afc068a4..ea4fb1a97a50 100644 --- a/arch/arm/mach-s3c2410/mach-h1940.c +++ b/arch/arm/mach-s3c2410/mach-h1940.c | |||
@@ -117,10 +117,12 @@ void __init h1940_init_irq(void) | |||
117 | } | 117 | } |
118 | 118 | ||
119 | MACHINE_START(H1940, "IPAQ-H1940") | 119 | MACHINE_START(H1940, "IPAQ-H1940") |
120 | MAINTAINER("Ben Dooks <ben@fluff.org>") | 120 | /* Maintainer: Ben Dooks <ben@fluff.org> */ |
121 | BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART) | 121 | .phys_ram = S3C2410_SDRAM_PA, |
122 | BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100) | 122 | .phys_io = S3C2410_PA_UART, |
123 | MAPIO(h1940_map_io) | 123 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
124 | INITIRQ(h1940_init_irq) | 124 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
125 | .map_io = h1940_map_io, | ||
126 | .init_irq = h1940_init_irq, | ||
125 | .timer = &s3c24xx_timer, | 127 | .timer = &s3c24xx_timer, |
126 | MACHINE_END | 128 | MACHINE_END |
diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c index bd15998c129b..79044d9bce38 100644 --- a/arch/arm/mach-s3c2410/mach-n30.c +++ b/arch/arm/mach-s3c2410/mach-n30.c | |||
@@ -137,10 +137,11 @@ void __init n30_init(void) | |||
137 | } | 137 | } |
138 | 138 | ||
139 | MACHINE_START(N30, "Acer-N30") | 139 | MACHINE_START(N30, "Acer-N30") |
140 | MAINTAINER("Christer Weinigel <christer@weinigel.se>, Ben Dooks <ben-linux@fluff.org>") | 140 | /* Maintainer: Christer Weinigel <christer@weinigel.se>, Ben Dooks <ben-linux@fluff.org> */ |
141 | BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART) | 141 | .phys_ram = S3C2410_SDRAM_PA, |
142 | BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100) | 142 | .phys_io = S3C2410_PA_UART, |
143 | 143 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | |
144 | .boot_params = S3C2410_SDRAM_PA + 0x100, | ||
144 | .timer = &s3c24xx_timer, | 145 | .timer = &s3c24xx_timer, |
145 | .init_machine = n30_init, | 146 | .init_machine = n30_init, |
146 | .init_irq = n30_init_irq, | 147 | .init_irq = n30_init_irq, |
diff --git a/arch/arm/mach-s3c2410/mach-nexcoder.c b/arch/arm/mach-s3c2410/mach-nexcoder.c index 70487bf4b71e..d24c242414ca 100644 --- a/arch/arm/mach-s3c2410/mach-nexcoder.c +++ b/arch/arm/mach-s3c2410/mach-nexcoder.c | |||
@@ -147,9 +147,11 @@ void __init nexcoder_map_io(void) | |||
147 | 147 | ||
148 | 148 | ||
149 | MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440") | 149 | MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440") |
150 | MAINTAINER("Guillaume GOURAT <guillaume.gourat@nexvision.tv>") | 150 | /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */ |
151 | BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART) | 151 | .phys_ram = S3C2410_SDRAM_PA, |
152 | BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100) | 152 | .phys_io = S3C2410_PA_UART, |
153 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | ||
154 | .boot_params = S3C2410_SDRAM_PA + 0x100, | ||
153 | .map_io = nexcoder_map_io, | 155 | .map_io = nexcoder_map_io, |
154 | .init_irq = s3c24xx_init_irq, | 156 | .init_irq = s3c24xx_init_irq, |
155 | .timer = &s3c24xx_timer, | 157 | .timer = &s3c24xx_timer, |
diff --git a/arch/arm/mach-s3c2410/mach-otom.c b/arch/arm/mach-s3c2410/mach-otom.c index 67d8ce8fb00f..d901ed492ff5 100644 --- a/arch/arm/mach-s3c2410/mach-otom.c +++ b/arch/arm/mach-s3c2410/mach-otom.c | |||
@@ -115,9 +115,11 @@ void __init otom11_map_io(void) | |||
115 | 115 | ||
116 | 116 | ||
117 | MACHINE_START(OTOM, "Nex Vision - Otom 1.1") | 117 | MACHINE_START(OTOM, "Nex Vision - Otom 1.1") |
118 | MAINTAINER("Guillaume GOURAT <guillaume.gourat@nexvision.tv>") | 118 | /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */ |
119 | BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART) | 119 | .phys_ram = S3C2410_SDRAM_PA, |
120 | BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100) | 120 | .phys_io = S3C2410_PA_UART, |
121 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | ||
122 | .boot_params = S3C2410_SDRAM_PA + 0x100, | ||
121 | .map_io = otom11_map_io, | 123 | .map_io = otom11_map_io, |
122 | .init_irq = s3c24xx_init_irq, | 124 | .init_irq = s3c24xx_init_irq, |
123 | .timer = &s3c24xx_timer, | 125 | .timer = &s3c24xx_timer, |
diff --git a/arch/arm/mach-s3c2410/mach-rx3715.c b/arch/arm/mach-s3c2410/mach-rx3715.c index f8d3a9784e71..a73d61c1de46 100644 --- a/arch/arm/mach-s3c2410/mach-rx3715.c +++ b/arch/arm/mach-s3c2410/mach-rx3715.c | |||
@@ -131,11 +131,13 @@ static void __init rx3715_init_machine(void) | |||
131 | #endif | 131 | #endif |
132 | 132 | ||
133 | MACHINE_START(RX3715, "IPAQ-RX3715") | 133 | MACHINE_START(RX3715, "IPAQ-RX3715") |
134 | MAINTAINER("Ben Dooks <ben@fluff.org>") | 134 | /* Maintainer: Ben Dooks <ben@fluff.org> */ |
135 | BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART) | 135 | .phys_ram = S3C2410_SDRAM_PA, |
136 | BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100) | 136 | .phys_io = S3C2410_PA_UART, |
137 | MAPIO(rx3715_map_io) | 137 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
138 | INITIRQ(rx3715_init_irq) | 138 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
139 | INIT_MACHINE(rx3715_init_machine) | 139 | .map_io = rx3715_map_io, |
140 | .init_irq = rx3715_init_irq, | ||
141 | .init_machine = rx3715_init_machine, | ||
140 | .timer = &s3c24xx_timer, | 142 | .timer = &s3c24xx_timer, |
141 | MACHINE_END | 143 | MACHINE_END |
diff --git a/arch/arm/mach-s3c2410/mach-smdk2410.c b/arch/arm/mach-s3c2410/mach-smdk2410.c index c1a4a1420ea0..67e903a700d3 100644 --- a/arch/arm/mach-s3c2410/mach-smdk2410.c +++ b/arch/arm/mach-s3c2410/mach-smdk2410.c | |||
@@ -112,11 +112,13 @@ void __init smdk2410_init_irq(void) | |||
112 | 112 | ||
113 | MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch | 113 | MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch |
114 | * to SMDK2410 */ | 114 | * to SMDK2410 */ |
115 | MAINTAINER("Jonas Dietsche") | 115 | /* Maintainer: Jonas Dietsche */ |
116 | BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART) | 116 | .phys_ram = S3C2410_SDRAM_PA, |
117 | BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100) | 117 | .phys_io = S3C2410_PA_UART, |
118 | MAPIO(smdk2410_map_io) | 118 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
119 | INITIRQ(smdk2410_init_irq) | 119 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
120 | .map_io = smdk2410_map_io, | ||
121 | .init_irq = smdk2410_init_irq, | ||
120 | .timer = &s3c24xx_timer, | 122 | .timer = &s3c24xx_timer, |
121 | MACHINE_END | 123 | MACHINE_END |
122 | 124 | ||
diff --git a/arch/arm/mach-s3c2410/mach-smdk2440.c b/arch/arm/mach-s3c2410/mach-smdk2440.c index 7857176d9bcb..357522106f68 100644 --- a/arch/arm/mach-s3c2410/mach-smdk2440.c +++ b/arch/arm/mach-s3c2410/mach-smdk2440.c | |||
@@ -124,9 +124,11 @@ void __init smdk2440_machine_init(void) | |||
124 | } | 124 | } |
125 | 125 | ||
126 | MACHINE_START(S3C2440, "SMDK2440") | 126 | MACHINE_START(S3C2440, "SMDK2440") |
127 | MAINTAINER("Ben Dooks <ben@fluff.org>") | 127 | /* Maintainer: Ben Dooks <ben@fluff.org> */ |
128 | BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART) | 128 | .phys_ram = S3C2410_SDRAM_PA, |
129 | BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100) | 129 | .phys_io = S3C2410_PA_UART, |
130 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | ||
131 | .boot_params = S3C2410_SDRAM_PA + 0x100, | ||
130 | 132 | ||
131 | .init_irq = s3c24xx_init_irq, | 133 | .init_irq = s3c24xx_init_irq, |
132 | .map_io = smdk2440_map_io, | 134 | .map_io = smdk2440_map_io, |
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c index 76be074944a0..924e8464c212 100644 --- a/arch/arm/mach-s3c2410/mach-vr1000.c +++ b/arch/arm/mach-s3c2410/mach-vr1000.c | |||
@@ -371,16 +371,14 @@ void __init vr1000_map_io(void) | |||
371 | usb_simtec_init(); | 371 | usb_simtec_init(); |
372 | } | 372 | } |
373 | 373 | ||
374 | void __init vr1000_init_irq(void) | ||
375 | { | ||
376 | s3c24xx_init_irq(); | ||
377 | } | ||
378 | 374 | ||
379 | MACHINE_START(VR1000, "Thorcom-VR1000") | 375 | MACHINE_START(VR1000, "Thorcom-VR1000") |
380 | MAINTAINER("Ben Dooks <ben@simtec.co.uk>") | 376 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ |
381 | BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART) | 377 | .phys_ram = S3C2410_SDRAM_PA, |
382 | BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100) | 378 | .phys_io = S3C2410_PA_UART, |
383 | MAPIO(vr1000_map_io) | 379 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
384 | INITIRQ(vr1000_init_irq) | 380 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
381 | .map_io = vr1000_map_io, | ||
382 | .init_irq = s3c24xx_init_irq, | ||
385 | .timer = &s3c24xx_timer, | 383 | .timer = &s3c24xx_timer, |
386 | MACHINE_END | 384 | MACHINE_END |
diff --git a/arch/arm/mach-s3c2410/pm-simtec.c b/arch/arm/mach-s3c2410/pm-simtec.c new file mode 100644 index 000000000000..2cb798832223 --- /dev/null +++ b/arch/arm/mach-s3c2410/pm-simtec.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/pm-simtec.c | ||
2 | * | ||
3 | * Copyright (c) 2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://armlinux.simtec.co.uk/ | ||
7 | * | ||
8 | * Power Management helpers for Simtec S3C24XX implementations | ||
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 version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/list.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/device.h> | ||
22 | |||
23 | #include <asm/mach/arch.h> | ||
24 | #include <asm/mach/map.h> | ||
25 | |||
26 | #include <asm/hardware.h> | ||
27 | #include <asm/io.h> | ||
28 | |||
29 | #include <asm/arch/map.h> | ||
30 | #include <asm/arch/regs-serial.h> | ||
31 | #include <asm/arch/regs-gpio.h> | ||
32 | #include <asm/arch/regs-mem.h> | ||
33 | |||
34 | #include <asm/mach-types.h> | ||
35 | |||
36 | #include "pm.h" | ||
37 | |||
38 | #define COPYRIGHT ", (c) 2005 Simtec Electronics" | ||
39 | |||
40 | /* pm_simtec_init | ||
41 | * | ||
42 | * enable the power management functions | ||
43 | */ | ||
44 | |||
45 | static __init int pm_simtec_init(void) | ||
46 | { | ||
47 | unsigned long gstatus4; | ||
48 | |||
49 | /* check which machine we are running on */ | ||
50 | |||
51 | if (!machine_is_bast() && !machine_is_vr1000()) | ||
52 | return 0; | ||
53 | |||
54 | printk(KERN_INFO "Simtec Board Power Manangement" COPYRIGHT "\n"); | ||
55 | |||
56 | gstatus4 = (__raw_readl(S3C2410_BANKCON7) & 0x3) << 30; | ||
57 | gstatus4 |= (__raw_readl(S3C2410_BANKCON6) & 0x3) << 28; | ||
58 | gstatus4 |= (__raw_readl(S3C2410_BANKSIZE) & S3C2410_BANKSIZE_MASK); | ||
59 | |||
60 | __raw_writel(gstatus4, S3C2410_GSTATUS4); | ||
61 | |||
62 | return s3c2410_pm_init(); | ||
63 | } | ||
64 | |||
65 | arch_initcall(pm_simtec_init); | ||
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c index bedf88fafe08..4d4d303ee3a8 100644 --- a/arch/arm/mach-sa1100/assabet.c +++ b/arch/arm/mach-sa1100/assabet.c | |||
@@ -431,11 +431,13 @@ static void __init assabet_map_io(void) | |||
431 | 431 | ||
432 | 432 | ||
433 | MACHINE_START(ASSABET, "Intel-Assabet") | 433 | MACHINE_START(ASSABET, "Intel-Assabet") |
434 | BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) | 434 | .phys_ram = 0xc0000000, |
435 | BOOT_PARAMS(0xc0000100) | 435 | .phys_io = 0x80000000, |
436 | FIXUP(fixup_assabet) | 436 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
437 | MAPIO(assabet_map_io) | 437 | .boot_params = 0xc0000100, |
438 | INITIRQ(sa1100_init_irq) | 438 | .fixup = fixup_assabet, |
439 | .map_io = assabet_map_io, | ||
440 | .init_irq = sa1100_init_irq, | ||
439 | .timer = &sa1100_timer, | 441 | .timer = &sa1100_timer, |
440 | .init_machine = assabet_init, | 442 | .init_machine = assabet_init, |
441 | MACHINE_END | 443 | MACHINE_END |
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c index 6a60b497ab42..b6169cb09196 100644 --- a/arch/arm/mach-sa1100/badge4.c +++ b/arch/arm/mach-sa1100/badge4.c | |||
@@ -285,9 +285,11 @@ static void __init badge4_map_io(void) | |||
285 | } | 285 | } |
286 | 286 | ||
287 | MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4") | 287 | MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4") |
288 | BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) | 288 | .phys_ram = 0xc0000000, |
289 | BOOT_PARAMS(0xc0000100) | 289 | .phys_io = 0x80000000, |
290 | MAPIO(badge4_map_io) | 290 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
291 | INITIRQ(sa1100_init_irq) | 291 | .boot_params = 0xc0000100, |
292 | .map_io = badge4_map_io, | ||
293 | .init_irq = sa1100_init_irq, | ||
292 | .timer = &sa1100_timer, | 294 | .timer = &sa1100_timer, |
293 | MACHINE_END | 295 | MACHINE_END |
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c index f8edde5e7cbf..0aa918e24c31 100644 --- a/arch/arm/mach-sa1100/cerf.c +++ b/arch/arm/mach-sa1100/cerf.c | |||
@@ -123,10 +123,12 @@ static void __init cerf_init(void) | |||
123 | } | 123 | } |
124 | 124 | ||
125 | MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube") | 125 | MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube") |
126 | MAINTAINER("support@intrinsyc.com") | 126 | /* Maintainer: support@intrinsyc.com */ |
127 | BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) | 127 | .phys_ram = 0xc0000000, |
128 | MAPIO(cerf_map_io) | 128 | .phys_io = 0x80000000, |
129 | INITIRQ(cerf_init_irq) | 129 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
130 | .map_io = cerf_map_io, | ||
131 | .init_irq = cerf_init_irq, | ||
130 | .timer = &sa1100_timer, | 132 | .timer = &sa1100_timer, |
131 | .init_machine = cerf_init, | 133 | .init_machine = cerf_init, |
132 | MACHINE_END | 134 | MACHINE_END |
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index 99287890d396..8cb69113a57c 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c | |||
@@ -184,9 +184,11 @@ static void __init collie_map_io(void) | |||
184 | } | 184 | } |
185 | 185 | ||
186 | MACHINE_START(COLLIE, "Sharp-Collie") | 186 | MACHINE_START(COLLIE, "Sharp-Collie") |
187 | BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) | 187 | .phys_ram = 0xc0000000, |
188 | MAPIO(collie_map_io) | 188 | .phys_io = 0x80000000, |
189 | INITIRQ(sa1100_init_irq) | 189 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
190 | .map_io = collie_map_io, | ||
191 | .init_irq = sa1100_init_irq, | ||
190 | .timer = &sa1100_timer, | 192 | .timer = &sa1100_timer, |
191 | .init_machine = collie_init, | 193 | .init_machine = collie_init, |
192 | MACHINE_END | 194 | MACHINE_END |
diff --git a/arch/arm/mach-sa1100/cpu-sa1110.c b/arch/arm/mach-sa1100/cpu-sa1110.c index 8d2a89a2ea01..04c94ab6c18b 100644 --- a/arch/arm/mach-sa1100/cpu-sa1110.c +++ b/arch/arm/mach-sa1100/cpu-sa1110.c | |||
@@ -271,8 +271,7 @@ static int sa1110_target(struct cpufreq_policy *policy, | |||
271 | */ | 271 | */ |
272 | sdram_set_refresh(2); | 272 | sdram_set_refresh(2); |
273 | if (!irqs_disabled()) { | 273 | if (!irqs_disabled()) { |
274 | set_current_state(TASK_UNINTERRUPTIBLE); | 274 | msleep(20); |
275 | schedule_timeout(20 * HZ / 1000); | ||
276 | } else { | 275 | } else { |
277 | mdelay(20); | 276 | mdelay(20); |
278 | } | 277 | } |
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c index 65dbe991426d..e7aa2681ca64 100644 --- a/arch/arm/mach-sa1100/h3600.c +++ b/arch/arm/mach-sa1100/h3600.c | |||
@@ -380,10 +380,12 @@ static void __init h3100_map_io(void) | |||
380 | } | 380 | } |
381 | 381 | ||
382 | MACHINE_START(H3100, "Compaq iPAQ H3100") | 382 | MACHINE_START(H3100, "Compaq iPAQ H3100") |
383 | BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) | 383 | .phys_ram = 0xc0000000, |
384 | BOOT_PARAMS(0xc0000100) | 384 | .phys_io = 0x80000000, |
385 | MAPIO(h3100_map_io) | 385 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
386 | INITIRQ(sa1100_init_irq) | 386 | .boot_params = 0xc0000100, |
387 | .map_io = h3100_map_io, | ||
388 | .init_irq = sa1100_init_irq, | ||
387 | .timer = &sa1100_timer, | 389 | .timer = &sa1100_timer, |
388 | .init_machine = h3xxx_mach_init, | 390 | .init_machine = h3xxx_mach_init, |
389 | MACHINE_END | 391 | MACHINE_END |
@@ -496,10 +498,12 @@ static void __init h3600_map_io(void) | |||
496 | } | 498 | } |
497 | 499 | ||
498 | MACHINE_START(H3600, "Compaq iPAQ H3600") | 500 | MACHINE_START(H3600, "Compaq iPAQ H3600") |
499 | BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) | 501 | .phys_ram = 0xc0000000, |
500 | BOOT_PARAMS(0xc0000100) | 502 | .phys_io = 0x80000000, |
501 | MAPIO(h3600_map_io) | 503 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
502 | INITIRQ(sa1100_init_irq) | 504 | .boot_params = 0xc0000100, |
505 | .map_io = h3600_map_io, | ||
506 | .init_irq = sa1100_init_irq, | ||
503 | .timer = &sa1100_timer, | 507 | .timer = &sa1100_timer, |
504 | .init_machine = h3xxx_mach_init, | 508 | .init_machine = h3xxx_mach_init, |
505 | MACHINE_END | 509 | MACHINE_END |
@@ -881,10 +885,12 @@ static void __init h3800_map_io(void) | |||
881 | } | 885 | } |
882 | 886 | ||
883 | MACHINE_START(H3800, "Compaq iPAQ H3800") | 887 | MACHINE_START(H3800, "Compaq iPAQ H3800") |
884 | BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) | 888 | .phys_ram = 0xc0000000, |
885 | BOOT_PARAMS(0xc0000100) | 889 | .phys_io = 0x80000000, |
886 | MAPIO(h3800_map_io) | 890 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
887 | INITIRQ(h3800_init_irq) | 891 | .boot_params = 0xc0000100, |
892 | .map_io = h3800_map_io, | ||
893 | .init_irq = h3800_init_irq, | ||
888 | .timer = &sa1100_timer, | 894 | .timer = &sa1100_timer, |
889 | .init_machine = h3xxx_mach_init, | 895 | .init_machine = h3xxx_mach_init, |
890 | MACHINE_END | 896 | MACHINE_END |
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c index 570841779714..502d65cfe654 100644 --- a/arch/arm/mach-sa1100/hackkit.c +++ b/arch/arm/mach-sa1100/hackkit.c | |||
@@ -191,10 +191,12 @@ static void __init hackkit_init(void) | |||
191 | */ | 191 | */ |
192 | 192 | ||
193 | MACHINE_START(HACKKIT, "HackKit Cpu Board") | 193 | MACHINE_START(HACKKIT, "HackKit Cpu Board") |
194 | BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) | 194 | .phys_ram = 0xc0000000, |
195 | BOOT_PARAMS(0xc0000100) | 195 | .phys_io = 0x80000000, |
196 | MAPIO(hackkit_map_io) | 196 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
197 | INITIRQ(sa1100_init_irq) | 197 | .boot_params = 0xc0000100, |
198 | .map_io = hackkit_map_io, | ||
199 | .init_irq = sa1100_init_irq, | ||
198 | .timer = &sa1100_timer, | 200 | .timer = &sa1100_timer, |
199 | .init_machine = hackkit_init, | 201 | .init_machine = hackkit_init, |
200 | MACHINE_END | 202 | MACHINE_END |
diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c index 6be78291a878..eee3cbc5ec4f 100644 --- a/arch/arm/mach-sa1100/jornada720.c +++ b/arch/arm/mach-sa1100/jornada720.c | |||
@@ -97,9 +97,11 @@ static void __init jornada720_map_io(void) | |||
97 | } | 97 | } |
98 | 98 | ||
99 | MACHINE_START(JORNADA720, "HP Jornada 720") | 99 | MACHINE_START(JORNADA720, "HP Jornada 720") |
100 | BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) | 100 | .phys_ram = 0xc0000000, |
101 | BOOT_PARAMS(0xc0000100) | 101 | .phys_io = 0x80000000, |
102 | MAPIO(jornada720_map_io) | 102 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
103 | INITIRQ(sa1100_init_irq) | 103 | .boot_params = 0xc0000100, |
104 | .map_io = jornada720_map_io, | ||
105 | .init_irq = sa1100_init_irq, | ||
104 | .timer = &sa1100_timer, | 106 | .timer = &sa1100_timer, |
105 | MACHINE_END | 107 | MACHINE_END |
diff --git a/arch/arm/mach-sa1100/lart.c b/arch/arm/mach-sa1100/lart.c index 51c08ccfb8db..870b488aeda4 100644 --- a/arch/arm/mach-sa1100/lart.c +++ b/arch/arm/mach-sa1100/lart.c | |||
@@ -41,9 +41,11 @@ static void __init lart_map_io(void) | |||
41 | } | 41 | } |
42 | 42 | ||
43 | MACHINE_START(LART, "LART") | 43 | MACHINE_START(LART, "LART") |
44 | BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) | 44 | .phys_ram = 0xc0000000, |
45 | BOOT_PARAMS(0xc0000100) | 45 | .phys_io = 0x80000000, |
46 | MAPIO(lart_map_io) | 46 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
47 | INITIRQ(sa1100_init_irq) | 47 | .boot_params = 0xc0000100, |
48 | .map_io = lart_map_io, | ||
49 | .init_irq = sa1100_init_irq, | ||
48 | .timer = &sa1100_timer, | 50 | .timer = &sa1100_timer, |
49 | MACHINE_END | 51 | MACHINE_END |
diff --git a/arch/arm/mach-sa1100/pleb.c b/arch/arm/mach-sa1100/pleb.c index 5606bd71b024..e17b58fb9c9c 100644 --- a/arch/arm/mach-sa1100/pleb.c +++ b/arch/arm/mach-sa1100/pleb.c | |||
@@ -146,9 +146,11 @@ static void __init pleb_map_io(void) | |||
146 | } | 146 | } |
147 | 147 | ||
148 | MACHINE_START(PLEB, "PLEB") | 148 | MACHINE_START(PLEB, "PLEB") |
149 | BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) | 149 | .phys_ram = 0xc0000000, |
150 | MAPIO(pleb_map_io) | 150 | .phys_io = 0x80000000, |
151 | INITIRQ(sa1100_init_irq) | 151 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
152 | .map_io = pleb_map_io, | ||
153 | .init_irq = sa1100_init_irq, | ||
152 | .timer = &sa1100_timer, | 154 | .timer = &sa1100_timer, |
153 | .init_machine = pleb_init, | 155 | .init_machine = pleb_init, |
154 | MACHINE_END | 156 | MACHINE_END |
diff --git a/arch/arm/mach-sa1100/shannon.c b/arch/arm/mach-sa1100/shannon.c index edddd559be02..43a00359fcdd 100644 --- a/arch/arm/mach-sa1100/shannon.c +++ b/arch/arm/mach-sa1100/shannon.c | |||
@@ -76,10 +76,12 @@ static void __init shannon_map_io(void) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)") | 78 | MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)") |
79 | BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) | 79 | .phys_ram = 0xc0000000, |
80 | BOOT_PARAMS(0xc0000100) | 80 | .phys_io = 0x80000000, |
81 | MAPIO(shannon_map_io) | 81 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
82 | INITIRQ(sa1100_init_irq) | 82 | .boot_params = 0xc0000100, |
83 | .map_io = shannon_map_io, | ||
84 | .init_irq = sa1100_init_irq, | ||
83 | .timer = &sa1100_timer, | 85 | .timer = &sa1100_timer, |
84 | .init_machine = shannon_init, | 86 | .init_machine = shannon_init, |
85 | MACHINE_END | 87 | MACHINE_END |
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c index 8d113d629867..77978586b126 100644 --- a/arch/arm/mach-sa1100/simpad.c +++ b/arch/arm/mach-sa1100/simpad.c | |||
@@ -215,10 +215,12 @@ arch_initcall(simpad_init); | |||
215 | 215 | ||
216 | 216 | ||
217 | MACHINE_START(SIMPAD, "Simpad") | 217 | MACHINE_START(SIMPAD, "Simpad") |
218 | MAINTAINER("Holger Freyther") | 218 | /* Maintainer: Holger Freyther */ |
219 | BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) | 219 | .phys_ram = 0xc0000000, |
220 | BOOT_PARAMS(0xc0000100) | 220 | .phys_io = 0x80000000, |
221 | MAPIO(simpad_map_io) | 221 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
222 | INITIRQ(sa1100_init_irq) | 222 | .boot_params = 0xc0000100, |
223 | .map_io = simpad_map_io, | ||
224 | .init_irq = sa1100_init_irq, | ||
223 | .timer = &sa1100_timer, | 225 | .timer = &sa1100_timer, |
224 | MACHINE_END | 226 | MACHINE_END |
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c index aa0e2f6e02f6..726445895b5c 100644 --- a/arch/arm/mach-shark/core.c +++ b/arch/arm/mach-shark/core.c | |||
@@ -105,10 +105,12 @@ static struct sys_timer shark_timer = { | |||
105 | }; | 105 | }; |
106 | 106 | ||
107 | MACHINE_START(SHARK, "Shark") | 107 | MACHINE_START(SHARK, "Shark") |
108 | MAINTAINER("Alexander Schulz") | 108 | /* Maintainer: Alexander Schulz */ |
109 | BOOT_MEM(0x08000000, 0x40000000, 0xe0000000) | 109 | .phys_ram = 0x08000000, |
110 | BOOT_PARAMS(0x08003000) | 110 | .phys_io = 0x40000000, |
111 | MAPIO(shark_map_io) | 111 | .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, |
112 | INITIRQ(shark_init_irq) | 112 | .boot_params = 0x08003000, |
113 | .map_io = shark_map_io, | ||
114 | .init_irq = shark_init_irq, | ||
113 | .timer = &shark_timer, | 115 | .timer = &shark_timer, |
114 | MACHINE_END | 116 | MACHINE_END |
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index 9d1f2253e987..f01c0f8a2bb3 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
34 | #include <asm/hardware/amba.h> | 34 | #include <asm/hardware/amba.h> |
35 | #include <asm/hardware/amba_clcd.h> | 35 | #include <asm/hardware/amba_clcd.h> |
36 | #include <asm/hardware/arm_timer.h> | ||
36 | #include <asm/hardware/icst307.h> | 37 | #include <asm/hardware/icst307.h> |
37 | 38 | ||
38 | #include <asm/mach/arch.h> | 39 | #include <asm/mach/arch.h> |
@@ -788,38 +789,25 @@ void __init versatile_init(void) | |||
788 | */ | 789 | */ |
789 | #define TIMER_INTERVAL (TICKS_PER_uSEC * mSEC_10) | 790 | #define TIMER_INTERVAL (TICKS_PER_uSEC * mSEC_10) |
790 | #if TIMER_INTERVAL >= 0x100000 | 791 | #if TIMER_INTERVAL >= 0x100000 |
791 | #define TIMER_RELOAD (TIMER_INTERVAL >> 8) /* Divide by 256 */ | 792 | #define TIMER_RELOAD (TIMER_INTERVAL >> 8) |
792 | #define TIMER_CTRL 0x88 /* Enable, Clock / 256 */ | 793 | #define TIMER_DIVISOR (TIMER_CTRL_DIV256) |
793 | #define TICKS2USECS(x) (256 * (x) / TICKS_PER_uSEC) | 794 | #define TICKS2USECS(x) (256 * (x) / TICKS_PER_uSEC) |
794 | #elif TIMER_INTERVAL >= 0x10000 | 795 | #elif TIMER_INTERVAL >= 0x10000 |
795 | #define TIMER_RELOAD (TIMER_INTERVAL >> 4) /* Divide by 16 */ | 796 | #define TIMER_RELOAD (TIMER_INTERVAL >> 4) /* Divide by 16 */ |
796 | #define TIMER_CTRL 0x84 /* Enable, Clock / 16 */ | 797 | #define TIMER_DIVISOR (TIMER_CTRL_DIV16) |
797 | #define TICKS2USECS(x) (16 * (x) / TICKS_PER_uSEC) | 798 | #define TICKS2USECS(x) (16 * (x) / TICKS_PER_uSEC) |
798 | #else | 799 | #else |
799 | #define TIMER_RELOAD (TIMER_INTERVAL) | 800 | #define TIMER_RELOAD (TIMER_INTERVAL) |
800 | #define TIMER_CTRL 0x80 /* Enable */ | 801 | #define TIMER_DIVISOR (TIMER_CTRL_DIV1) |
801 | #define TICKS2USECS(x) ((x) / TICKS_PER_uSEC) | 802 | #define TICKS2USECS(x) ((x) / TICKS_PER_uSEC) |
802 | #endif | 803 | #endif |
803 | 804 | ||
804 | #define TIMER_CTRL_IE (1 << 5) /* Interrupt Enable */ | ||
805 | |||
806 | /* | ||
807 | * What does it look like? | ||
808 | */ | ||
809 | typedef struct TimerStruct { | ||
810 | unsigned long TimerLoad; | ||
811 | unsigned long TimerValue; | ||
812 | unsigned long TimerControl; | ||
813 | unsigned long TimerClear; | ||
814 | } TimerStruct_t; | ||
815 | |||
816 | /* | 805 | /* |
817 | * Returns number of ms since last clock interrupt. Note that interrupts | 806 | * Returns number of ms since last clock interrupt. Note that interrupts |
818 | * will have been disabled by do_gettimeoffset() | 807 | * will have been disabled by do_gettimeoffset() |
819 | */ | 808 | */ |
820 | static unsigned long versatile_gettimeoffset(void) | 809 | static unsigned long versatile_gettimeoffset(void) |
821 | { | 810 | { |
822 | volatile TimerStruct_t *timer0 = (TimerStruct_t *)TIMER0_VA_BASE; | ||
823 | unsigned long ticks1, ticks2, status; | 811 | unsigned long ticks1, ticks2, status; |
824 | 812 | ||
825 | /* | 813 | /* |
@@ -828,11 +816,11 @@ static unsigned long versatile_gettimeoffset(void) | |||
828 | * an interrupt. We get around this by ensuring that the | 816 | * an interrupt. We get around this by ensuring that the |
829 | * counter has not reloaded between our two reads. | 817 | * counter has not reloaded between our two reads. |
830 | */ | 818 | */ |
831 | ticks2 = timer0->TimerValue & 0xffff; | 819 | ticks2 = readl(TIMER0_VA_BASE + TIMER_VALUE) & 0xffff; |
832 | do { | 820 | do { |
833 | ticks1 = ticks2; | 821 | ticks1 = ticks2; |
834 | status = __raw_readl(VA_IC_BASE + VIC_IRQ_RAW_STATUS); | 822 | status = __raw_readl(VA_IC_BASE + VIC_IRQ_RAW_STATUS); |
835 | ticks2 = timer0->TimerValue & 0xffff; | 823 | ticks2 = readl(TIMER0_VA_BASE + TIMER_VALUE) & 0xffff; |
836 | } while (ticks2 > ticks1); | 824 | } while (ticks2 > ticks1); |
837 | 825 | ||
838 | /* | 826 | /* |
@@ -859,12 +847,10 @@ static unsigned long versatile_gettimeoffset(void) | |||
859 | */ | 847 | */ |
860 | static irqreturn_t versatile_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 848 | static irqreturn_t versatile_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
861 | { | 849 | { |
862 | volatile TimerStruct_t *timer0 = (volatile TimerStruct_t *)TIMER0_VA_BASE; | ||
863 | |||
864 | write_seqlock(&xtime_lock); | 850 | write_seqlock(&xtime_lock); |
865 | 851 | ||
866 | // ...clear the interrupt | 852 | // ...clear the interrupt |
867 | timer0->TimerClear = 1; | 853 | writel(1, TIMER0_VA_BASE + TIMER_INTCLR); |
868 | 854 | ||
869 | timer_tick(regs); | 855 | timer_tick(regs); |
870 | 856 | ||
@@ -884,31 +870,32 @@ static struct irqaction versatile_timer_irq = { | |||
884 | */ | 870 | */ |
885 | static void __init versatile_timer_init(void) | 871 | static void __init versatile_timer_init(void) |
886 | { | 872 | { |
887 | volatile TimerStruct_t *timer0 = (volatile TimerStruct_t *)TIMER0_VA_BASE; | 873 | u32 val; |
888 | volatile TimerStruct_t *timer1 = (volatile TimerStruct_t *)TIMER1_VA_BASE; | ||
889 | volatile TimerStruct_t *timer2 = (volatile TimerStruct_t *)TIMER2_VA_BASE; | ||
890 | volatile TimerStruct_t *timer3 = (volatile TimerStruct_t *)TIMER3_VA_BASE; | ||
891 | 874 | ||
892 | /* | 875 | /* |
893 | * set clock frequency: | 876 | * set clock frequency: |
894 | * VERSATILE_REFCLK is 32KHz | 877 | * VERSATILE_REFCLK is 32KHz |
895 | * VERSATILE_TIMCLK is 1MHz | 878 | * VERSATILE_TIMCLK is 1MHz |
896 | */ | 879 | */ |
897 | *(volatile unsigned int *)IO_ADDRESS(VERSATILE_SCTL_BASE) |= | 880 | val = readl(IO_ADDRESS(VERSATILE_SCTL_BASE)); |
898 | ((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) | (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) | | 881 | writel((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) | |
899 | (VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) | (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel)); | 882 | (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) | |
883 | (VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) | | ||
884 | (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel) | val, | ||
885 | IO_ADDRESS(VERSATILE_SCTL_BASE)); | ||
900 | 886 | ||
901 | /* | 887 | /* |
902 | * Initialise to a known state (all timers off) | 888 | * Initialise to a known state (all timers off) |
903 | */ | 889 | */ |
904 | timer0->TimerControl = 0; | 890 | writel(0, TIMER0_VA_BASE + TIMER_CTRL); |
905 | timer1->TimerControl = 0; | 891 | writel(0, TIMER1_VA_BASE + TIMER_CTRL); |
906 | timer2->TimerControl = 0; | 892 | writel(0, TIMER2_VA_BASE + TIMER_CTRL); |
907 | timer3->TimerControl = 0; | 893 | writel(0, TIMER3_VA_BASE + TIMER_CTRL); |
908 | 894 | ||
909 | timer0->TimerLoad = TIMER_RELOAD; | 895 | writel(TIMER_RELOAD, TIMER0_VA_BASE + TIMER_LOAD); |
910 | timer0->TimerValue = TIMER_RELOAD; | 896 | writel(TIMER_RELOAD, TIMER0_VA_BASE + TIMER_VALUE); |
911 | timer0->TimerControl = TIMER_CTRL | 0x40 | TIMER_CTRL_IE; /* periodic + IE */ | 897 | writel(TIMER_DIVISOR | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC | |
898 | TIMER_CTRL_IE, TIMER0_VA_BASE + TIMER_CTRL); | ||
912 | 899 | ||
913 | /* | 900 | /* |
914 | * Make irqs happen for the system timer | 901 | * Make irqs happen for the system timer |
diff --git a/arch/arm/mach-versatile/versatile_ab.c b/arch/arm/mach-versatile/versatile_ab.c index d332084586cf..8b0b3bef24ae 100644 --- a/arch/arm/mach-versatile/versatile_ab.c +++ b/arch/arm/mach-versatile/versatile_ab.c | |||
@@ -35,11 +35,13 @@ | |||
35 | #include "core.h" | 35 | #include "core.h" |
36 | 36 | ||
37 | MACHINE_START(VERSATILE_AB, "ARM-Versatile AB") | 37 | MACHINE_START(VERSATILE_AB, "ARM-Versatile AB") |
38 | MAINTAINER("ARM Ltd/Deep Blue Solutions Ltd") | 38 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
39 | BOOT_MEM(0x00000000, 0x101f1000, 0xf11f1000) | 39 | .phys_ram = 0x00000000, |
40 | BOOT_PARAMS(0x00000100) | 40 | .phys_io = 0x101f1000, |
41 | MAPIO(versatile_map_io) | 41 | .io_pg_offst = ((0xf11f1000) >> 18) & 0xfffc, |
42 | INITIRQ(versatile_init_irq) | 42 | .boot_params = 0x00000100, |
43 | .map_io = versatile_map_io, | ||
44 | .init_irq = versatile_init_irq, | ||
43 | .timer = &versatile_timer, | 45 | .timer = &versatile_timer, |
44 | INIT_MACHINE(versatile_init) | 46 | .init_machine = versatile_init, |
45 | MACHINE_END | 47 | MACHINE_END |
diff --git a/arch/arm/mach-versatile/versatile_pb.c b/arch/arm/mach-versatile/versatile_pb.c index 2702099a68f3..7c3078c38916 100644 --- a/arch/arm/mach-versatile/versatile_pb.c +++ b/arch/arm/mach-versatile/versatile_pb.c | |||
@@ -99,11 +99,13 @@ static int __init versatile_pb_init(void) | |||
99 | arch_initcall(versatile_pb_init); | 99 | arch_initcall(versatile_pb_init); |
100 | 100 | ||
101 | MACHINE_START(VERSATILE_PB, "ARM-Versatile PB") | 101 | MACHINE_START(VERSATILE_PB, "ARM-Versatile PB") |
102 | MAINTAINER("ARM Ltd/Deep Blue Solutions Ltd") | 102 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
103 | BOOT_MEM(0x00000000, 0x101f1000, 0xf11f1000) | 103 | .phys_ram = 0x00000000, |
104 | BOOT_PARAMS(0x00000100) | 104 | .phys_io = 0x101f1000, |
105 | MAPIO(versatile_map_io) | 105 | .io_pg_offst = ((0xf11f1000) >> 18) & 0xfffc, |
106 | INITIRQ(versatile_init_irq) | 106 | .boot_params = 0x00000100, |
107 | .map_io = versatile_map_io, | ||
108 | .init_irq = versatile_init_irq, | ||
107 | .timer = &versatile_timer, | 109 | .timer = &versatile_timer, |
108 | INIT_MACHINE(versatile_init) | 110 | .init_machine = versatile_init, |
109 | MACHINE_END | 111 | MACHINE_END |
diff --git a/arch/arm/mm/blockops.c b/arch/arm/mm/blockops.c index 806c6eeb1b0c..4f5ee2d08996 100644 --- a/arch/arm/mm/blockops.c +++ b/arch/arm/mm/blockops.c | |||
@@ -25,13 +25,14 @@ blk_flush_kern_dcache_page(void *kaddr) | |||
25 | { | 25 | { |
26 | asm( | 26 | asm( |
27 | "add r1, r0, %0 \n\ | 27 | "add r1, r0, %0 \n\ |
28 | sub r1, r1, %1 \n\ | ||
28 | 1: .word 0xec401f0e @ mcrr p15, 0, r0, r1, c14, 0 @ blocking \n\ | 29 | 1: .word 0xec401f0e @ mcrr p15, 0, r0, r1, c14, 0 @ blocking \n\ |
29 | mov r0, #0 \n\ | 30 | mov r0, #0 \n\ |
30 | mcr p15, 0, r0, c7, c5, 0 \n\ | 31 | mcr p15, 0, r0, c7, c5, 0 \n\ |
31 | mcr p15, 0, r0, c7, c10, 4 \n\ | 32 | mcr p15, 0, r0, c7, c10, 4 \n\ |
32 | mov pc, lr" | 33 | mov pc, lr" |
33 | : | 34 | : |
34 | : "I" (PAGE_SIZE)); | 35 | : "I" (PAGE_SIZE), "I" (L1_CACHE_BYTES)); |
35 | } | 36 | } |
36 | 37 | ||
37 | /* | 38 | /* |
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index e25b4fd8412c..65bfe84b6d67 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
@@ -372,49 +372,50 @@ do_bad(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | |||
372 | static struct fsr_info { | 372 | static struct fsr_info { |
373 | int (*fn)(unsigned long addr, unsigned int fsr, struct pt_regs *regs); | 373 | int (*fn)(unsigned long addr, unsigned int fsr, struct pt_regs *regs); |
374 | int sig; | 374 | int sig; |
375 | int code; | ||
375 | const char *name; | 376 | const char *name; |
376 | } fsr_info[] = { | 377 | } fsr_info[] = { |
377 | /* | 378 | /* |
378 | * The following are the standard ARMv3 and ARMv4 aborts. ARMv5 | 379 | * The following are the standard ARMv3 and ARMv4 aborts. ARMv5 |
379 | * defines these to be "precise" aborts. | 380 | * defines these to be "precise" aborts. |
380 | */ | 381 | */ |
381 | { do_bad, SIGSEGV, "vector exception" }, | 382 | { do_bad, SIGSEGV, 0, "vector exception" }, |
382 | { do_bad, SIGILL, "alignment exception" }, | 383 | { do_bad, SIGILL, BUS_ADRALN, "alignment exception" }, |
383 | { do_bad, SIGKILL, "terminal exception" }, | 384 | { do_bad, SIGKILL, 0, "terminal exception" }, |
384 | { do_bad, SIGILL, "alignment exception" }, | 385 | { do_bad, SIGILL, BUS_ADRALN, "alignment exception" }, |
385 | { do_bad, SIGBUS, "external abort on linefetch" }, | 386 | { do_bad, SIGBUS, 0, "external abort on linefetch" }, |
386 | { do_translation_fault, SIGSEGV, "section translation fault" }, | 387 | { do_translation_fault, SIGSEGV, SEGV_MAPERR, "section translation fault" }, |
387 | { do_bad, SIGBUS, "external abort on linefetch" }, | 388 | { do_bad, SIGBUS, 0, "external abort on linefetch" }, |
388 | { do_page_fault, SIGSEGV, "page translation fault" }, | 389 | { do_page_fault, SIGSEGV, SEGV_MAPERR, "page translation fault" }, |
389 | { do_bad, SIGBUS, "external abort on non-linefetch" }, | 390 | { do_bad, SIGBUS, 0, "external abort on non-linefetch" }, |
390 | { do_bad, SIGSEGV, "section domain fault" }, | 391 | { do_bad, SIGSEGV, SEGV_ACCERR, "section domain fault" }, |
391 | { do_bad, SIGBUS, "external abort on non-linefetch" }, | 392 | { do_bad, SIGBUS, 0, "external abort on non-linefetch" }, |
392 | { do_bad, SIGSEGV, "page domain fault" }, | 393 | { do_bad, SIGSEGV, SEGV_ACCERR, "page domain fault" }, |
393 | { do_bad, SIGBUS, "external abort on translation" }, | 394 | { do_bad, SIGBUS, 0, "external abort on translation" }, |
394 | { do_sect_fault, SIGSEGV, "section permission fault" }, | 395 | { do_sect_fault, SIGSEGV, SEGV_ACCERR, "section permission fault" }, |
395 | { do_bad, SIGBUS, "external abort on translation" }, | 396 | { do_bad, SIGBUS, 0, "external abort on translation" }, |
396 | { do_page_fault, SIGSEGV, "page permission fault" }, | 397 | { do_page_fault, SIGSEGV, SEGV_ACCERR, "page permission fault" }, |
397 | /* | 398 | /* |
398 | * The following are "imprecise" aborts, which are signalled by bit | 399 | * The following are "imprecise" aborts, which are signalled by bit |
399 | * 10 of the FSR, and may not be recoverable. These are only | 400 | * 10 of the FSR, and may not be recoverable. These are only |
400 | * supported if the CPU abort handler supports bit 10. | 401 | * supported if the CPU abort handler supports bit 10. |
401 | */ | 402 | */ |
402 | { do_bad, SIGBUS, "unknown 16" }, | 403 | { do_bad, SIGBUS, 0, "unknown 16" }, |
403 | { do_bad, SIGBUS, "unknown 17" }, | 404 | { do_bad, SIGBUS, 0, "unknown 17" }, |
404 | { do_bad, SIGBUS, "unknown 18" }, | 405 | { do_bad, SIGBUS, 0, "unknown 18" }, |
405 | { do_bad, SIGBUS, "unknown 19" }, | 406 | { do_bad, SIGBUS, 0, "unknown 19" }, |
406 | { do_bad, SIGBUS, "lock abort" }, /* xscale */ | 407 | { do_bad, SIGBUS, 0, "lock abort" }, /* xscale */ |
407 | { do_bad, SIGBUS, "unknown 21" }, | 408 | { do_bad, SIGBUS, 0, "unknown 21" }, |
408 | { do_bad, SIGBUS, "imprecise external abort" }, /* xscale */ | 409 | { do_bad, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */ |
409 | { do_bad, SIGBUS, "unknown 23" }, | 410 | { do_bad, SIGBUS, 0, "unknown 23" }, |
410 | { do_bad, SIGBUS, "dcache parity error" }, /* xscale */ | 411 | { do_bad, SIGBUS, 0, "dcache parity error" }, /* xscale */ |
411 | { do_bad, SIGBUS, "unknown 25" }, | 412 | { do_bad, SIGBUS, 0, "unknown 25" }, |
412 | { do_bad, SIGBUS, "unknown 26" }, | 413 | { do_bad, SIGBUS, 0, "unknown 26" }, |
413 | { do_bad, SIGBUS, "unknown 27" }, | 414 | { do_bad, SIGBUS, 0, "unknown 27" }, |
414 | { do_bad, SIGBUS, "unknown 28" }, | 415 | { do_bad, SIGBUS, 0, "unknown 28" }, |
415 | { do_bad, SIGBUS, "unknown 29" }, | 416 | { do_bad, SIGBUS, 0, "unknown 29" }, |
416 | { do_bad, SIGBUS, "unknown 30" }, | 417 | { do_bad, SIGBUS, 0, "unknown 30" }, |
417 | { do_bad, SIGBUS, "unknown 31" } | 418 | { do_bad, SIGBUS, 0, "unknown 31" } |
418 | }; | 419 | }; |
419 | 420 | ||
420 | void __init | 421 | void __init |
@@ -435,15 +436,19 @@ asmlinkage void | |||
435 | do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | 436 | do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs) |
436 | { | 437 | { |
437 | const struct fsr_info *inf = fsr_info + (fsr & 15) + ((fsr & (1 << 10)) >> 6); | 438 | const struct fsr_info *inf = fsr_info + (fsr & 15) + ((fsr & (1 << 10)) >> 6); |
439 | struct siginfo info; | ||
438 | 440 | ||
439 | if (!inf->fn(addr, fsr, regs)) | 441 | if (!inf->fn(addr, fsr, regs)) |
440 | return; | 442 | return; |
441 | 443 | ||
442 | printk(KERN_ALERT "Unhandled fault: %s (0x%03x) at 0x%08lx\n", | 444 | printk(KERN_ALERT "Unhandled fault: %s (0x%03x) at 0x%08lx\n", |
443 | inf->name, fsr, addr); | 445 | inf->name, fsr, addr); |
444 | force_sig(inf->sig, current); | 446 | |
445 | show_pte(current->mm, addr); | 447 | info.si_signo = inf->sig; |
446 | die_if_kernel("Oops", regs, 0); | 448 | info.si_errno = 0; |
449 | info.si_code = inf->code; | ||
450 | info.si_addr = (void __user *)addr; | ||
451 | notify_die("", regs, &info, fsr, 0); | ||
447 | } | 452 | } |
448 | 453 | ||
449 | asmlinkage void | 454 | asmlinkage void |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 6dcb23d64bf5..edffa47a4b2a 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -437,7 +437,7 @@ void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc) | |||
437 | memtable_init(mi); | 437 | memtable_init(mi); |
438 | if (mdesc->map_io) | 438 | if (mdesc->map_io) |
439 | mdesc->map_io(); | 439 | mdesc->map_io(); |
440 | flush_tlb_all(); | 440 | local_flush_tlb_all(); |
441 | 441 | ||
442 | /* | 442 | /* |
443 | * initialise the zones within each node | 443 | * initialise the zones within each node |
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c index 052ab443ec4e..c3bd503b43a2 100644 --- a/arch/arm/mm/mm-armv.c +++ b/arch/arm/mm/mm-armv.c | |||
@@ -682,7 +682,7 @@ void __init memtable_init(struct meminfo *mi) | |||
682 | } | 682 | } |
683 | 683 | ||
684 | flush_cache_all(); | 684 | flush_cache_all(); |
685 | flush_tlb_all(); | 685 | local_flush_tlb_all(); |
686 | 686 | ||
687 | top_pmd = pmd_off_k(0xffff0000); | 687 | top_pmd = pmd_off_k(0xffff0000); |
688 | } | 688 | } |
diff --git a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S index 1f325231b9e4..5c0ae5260d1c 100644 --- a/arch/arm/mm/proc-arm1020.S +++ b/arch/arm/mm/proc-arm1020.S | |||
@@ -445,14 +445,14 @@ __arm1020_setup: | |||
445 | /* | 445 | /* |
446 | * R | 446 | * R |
447 | * .RVI ZFRS BLDP WCAM | 447 | * .RVI ZFRS BLDP WCAM |
448 | * .0.1 1001 ..11 0101 /* FIXME: why no V bit? */ | 448 | * .011 1001 ..11 0101 |
449 | */ | 449 | */ |
450 | .type arm1020_cr1_clear, #object | 450 | .type arm1020_cr1_clear, #object |
451 | .type arm1020_cr1_set, #object | 451 | .type arm1020_cr1_set, #object |
452 | arm1020_cr1_clear: | 452 | arm1020_cr1_clear: |
453 | .word 0x593f | 453 | .word 0x593f |
454 | arm1020_cr1_set: | 454 | arm1020_cr1_set: |
455 | .word 0x1935 | 455 | .word 0x3935 |
456 | 456 | ||
457 | __INITDATA | 457 | __INITDATA |
458 | 458 | ||
diff --git a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S index 142a2c2d6f0b..d69389c4d4ba 100644 --- a/arch/arm/mm/proc-arm1020e.S +++ b/arch/arm/mm/proc-arm1020e.S | |||
@@ -427,14 +427,14 @@ __arm1020e_setup: | |||
427 | /* | 427 | /* |
428 | * R | 428 | * R |
429 | * .RVI ZFRS BLDP WCAM | 429 | * .RVI ZFRS BLDP WCAM |
430 | * .0.1 1001 ..11 0101 /* FIXME: why no V bit? */ | 430 | * .011 1001 ..11 0101 |
431 | */ | 431 | */ |
432 | .type arm1020e_cr1_clear, #object | 432 | .type arm1020e_cr1_clear, #object |
433 | .type arm1020e_cr1_set, #object | 433 | .type arm1020e_cr1_set, #object |
434 | arm1020e_cr1_clear: | 434 | arm1020e_cr1_clear: |
435 | .word 0x5f3f | 435 | .word 0x5f3f |
436 | arm1020e_cr1_set: | 436 | arm1020e_cr1_set: |
437 | .word 0x1935 | 437 | .word 0x3935 |
438 | 438 | ||
439 | __INITDATA | 439 | __INITDATA |
440 | 440 | ||
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S index e3d8510f4340..352db98ee269 100644 --- a/arch/arm/mm/proc-v6.S +++ b/arch/arm/mm/proc-v6.S | |||
@@ -200,7 +200,7 @@ __v6_setup: | |||
200 | mcr p15, 0, r4, c2, c0, 1 @ load TTB1 | 200 | mcr p15, 0, r4, c2, c0, 1 @ load TTB1 |
201 | #ifdef CONFIG_VFP | 201 | #ifdef CONFIG_VFP |
202 | mrc p15, 0, r0, c1, c0, 2 | 202 | mrc p15, 0, r0, c1, c0, 2 |
203 | orr r0, r0, #(3 << 20) | 203 | orr r0, r0, #(0xf << 20) |
204 | mcr p15, 0, r0, c1, c0, 2 @ Enable full access to VFP | 204 | mcr p15, 0, r0, c1, c0, 2 @ Enable full access to VFP |
205 | #endif | 205 | #endif |
206 | mrc p15, 0, r0, c1, c0, 0 @ read control register | 206 | mrc p15, 0, r0, c1, c0, 0 @ read control register |
diff --git a/arch/arm/oprofile/Makefile b/arch/arm/oprofile/Makefile index ba1a6e9f2b28..8ffb523e6c77 100644 --- a/arch/arm/oprofile/Makefile +++ b/arch/arm/oprofile/Makefile | |||
@@ -6,6 +6,6 @@ DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \ | |||
6 | oprofilefs.o oprofile_stats.o \ | 6 | oprofilefs.o oprofile_stats.o \ |
7 | timer_int.o ) | 7 | timer_int.o ) |
8 | 8 | ||
9 | oprofile-y := $(DRIVER_OBJS) init.o | 9 | oprofile-y := $(DRIVER_OBJS) init.o backtrace.o |
10 | oprofile-$(CONFIG_CPU_XSCALE) += common.o op_model_xscale.o | 10 | oprofile-$(CONFIG_CPU_XSCALE) += common.o op_model_xscale.o |
11 | 11 | ||
diff --git a/arch/arm/oprofile/backtrace.c b/arch/arm/oprofile/backtrace.c new file mode 100644 index 000000000000..ec58d3e2eb8b --- /dev/null +++ b/arch/arm/oprofile/backtrace.c | |||
@@ -0,0 +1,144 @@ | |||
1 | /* | ||
2 | * Arm specific backtracing code for oprofile | ||
3 | * | ||
4 | * Copyright 2005 Openedhand Ltd. | ||
5 | * | ||
6 | * Author: Richard Purdie <rpurdie@openedhand.com> | ||
7 | * | ||
8 | * Based on i386 oprofile backtrace code by John Levon, David Smith | ||
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 version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #include <linux/oprofile.h> | ||
17 | #include <linux/sched.h> | ||
18 | #include <linux/mm.h> | ||
19 | #include <asm/ptrace.h> | ||
20 | #include <asm/uaccess.h> | ||
21 | |||
22 | |||
23 | /* | ||
24 | * The registers we're interested in are at the end of the variable | ||
25 | * length saved register structure. The fp points at the end of this | ||
26 | * structure so the address of this struct is: | ||
27 | * (struct frame_tail *)(xxx->fp)-1 | ||
28 | */ | ||
29 | struct frame_tail { | ||
30 | struct frame_tail *fp; | ||
31 | unsigned long sp; | ||
32 | unsigned long lr; | ||
33 | } __attribute__((packed)); | ||
34 | |||
35 | |||
36 | #ifdef CONFIG_FRAME_POINTER | ||
37 | static struct frame_tail* kernel_backtrace(struct frame_tail *tail) | ||
38 | { | ||
39 | oprofile_add_trace(tail->lr); | ||
40 | |||
41 | /* frame pointers should strictly progress back up the stack | ||
42 | * (towards higher addresses) */ | ||
43 | if (tail >= tail->fp) | ||
44 | return NULL; | ||
45 | |||
46 | return tail->fp-1; | ||
47 | } | ||
48 | #endif | ||
49 | |||
50 | static struct frame_tail* user_backtrace(struct frame_tail *tail) | ||
51 | { | ||
52 | struct frame_tail buftail; | ||
53 | |||
54 | /* hardware pte might not be valid due to dirty/accessed bit emulation | ||
55 | * so we use copy_from_user and benefit from exception fixups */ | ||
56 | if (copy_from_user(&buftail, tail, sizeof(struct frame_tail))) | ||
57 | return NULL; | ||
58 | |||
59 | oprofile_add_trace(buftail.lr); | ||
60 | |||
61 | /* frame pointers should strictly progress back up the stack | ||
62 | * (towards higher addresses) */ | ||
63 | if (tail >= buftail.fp) | ||
64 | return NULL; | ||
65 | |||
66 | return buftail.fp-1; | ||
67 | } | ||
68 | |||
69 | /* Compare two addresses and see if they're on the same page */ | ||
70 | #define CMP_ADDR_EQUAL(x,y,offset) ((((unsigned long) x) >> PAGE_SHIFT) \ | ||
71 | == ((((unsigned long) y) + offset) >> PAGE_SHIFT)) | ||
72 | |||
73 | /* check that the page(s) containing the frame tail are present */ | ||
74 | static int pages_present(struct frame_tail *tail) | ||
75 | { | ||
76 | struct mm_struct * mm = current->mm; | ||
77 | |||
78 | if (!check_user_page_readable(mm, (unsigned long)tail)) | ||
79 | return 0; | ||
80 | |||
81 | if (CMP_ADDR_EQUAL(tail, tail, 8)) | ||
82 | return 1; | ||
83 | |||
84 | if (!check_user_page_readable(mm, ((unsigned long)tail) + 8)) | ||
85 | return 0; | ||
86 | |||
87 | return 1; | ||
88 | } | ||
89 | |||
90 | /* | ||
91 | * | | /\ Higher addresses | ||
92 | * | | | ||
93 | * --------------- stack base (address of current_thread_info) | ||
94 | * | thread info | | ||
95 | * . . | ||
96 | * | stack | | ||
97 | * --------------- saved regs->ARM_fp value if valid (frame_tail address) | ||
98 | * . . | ||
99 | * --------------- struct pt_regs stored on stack (struct pt_regs *) | ||
100 | * | | | ||
101 | * . . | ||
102 | * | | | ||
103 | * --------------- %esp | ||
104 | * | | | ||
105 | * | | \/ Lower addresses | ||
106 | * | ||
107 | * Thus, &pt_regs <-> stack base restricts the valid(ish) fp values | ||
108 | */ | ||
109 | static int valid_kernel_stack(struct frame_tail *tail, struct pt_regs *regs) | ||
110 | { | ||
111 | unsigned long tailaddr = (unsigned long)tail; | ||
112 | unsigned long stack = (unsigned long)regs; | ||
113 | unsigned long stack_base = (stack & ~(THREAD_SIZE - 1)) + THREAD_SIZE; | ||
114 | |||
115 | return (tailaddr > stack) && (tailaddr < stack_base); | ||
116 | } | ||
117 | |||
118 | void arm_backtrace(struct pt_regs const *regs, unsigned int depth) | ||
119 | { | ||
120 | struct frame_tail *tail; | ||
121 | unsigned long last_address = 0; | ||
122 | |||
123 | tail = ((struct frame_tail *) regs->ARM_fp) - 1; | ||
124 | |||
125 | if (!user_mode(regs)) { | ||
126 | |||
127 | #ifdef CONFIG_FRAME_POINTER | ||
128 | while (depth-- && tail && valid_kernel_stack(tail, regs)) { | ||
129 | tail = kernel_backtrace(tail); | ||
130 | } | ||
131 | #endif | ||
132 | return; | ||
133 | } | ||
134 | |||
135 | while (depth-- && tail && !((unsigned long) tail & 3)) { | ||
136 | if ((!CMP_ADDR_EQUAL(last_address, tail, 0) | ||
137 | || !CMP_ADDR_EQUAL(last_address, tail, 8)) | ||
138 | && !pages_present(tail)) | ||
139 | return; | ||
140 | last_address = (unsigned long) tail; | ||
141 | tail = user_backtrace(tail); | ||
142 | } | ||
143 | } | ||
144 | |||
diff --git a/arch/arm/oprofile/init.c b/arch/arm/oprofile/init.c index cce3d3015eb7..d315a3a86c86 100644 --- a/arch/arm/oprofile/init.c +++ b/arch/arm/oprofile/init.c | |||
@@ -20,6 +20,8 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
20 | ret = pmu_init(ops, &op_xscale_spec); | 20 | ret = pmu_init(ops, &op_xscale_spec); |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | ops->backtrace = arm_backtrace; | ||
24 | |||
23 | return ret; | 25 | return ret; |
24 | } | 26 | } |
25 | 27 | ||
diff --git a/arch/arm/oprofile/op_arm_model.h b/arch/arm/oprofile/op_arm_model.h index 2d4caf4781ad..2148d07484b7 100644 --- a/arch/arm/oprofile/op_arm_model.h +++ b/arch/arm/oprofile/op_arm_model.h | |||
@@ -24,6 +24,8 @@ struct op_arm_model_spec { | |||
24 | extern struct op_arm_model_spec op_xscale_spec; | 24 | extern struct op_arm_model_spec op_xscale_spec; |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | extern void arm_backtrace(struct pt_regs * const regs, unsigned int depth); | ||
28 | |||
27 | extern int __init pmu_init(struct oprofile_operations *ops, struct op_arm_model_spec *spec); | 29 | extern int __init pmu_init(struct oprofile_operations *ops, struct op_arm_model_spec *spec); |
28 | extern void pmu_exit(void); | 30 | extern void pmu_exit(void); |
29 | #endif /* OP_ARM_MODEL_H */ | 31 | #endif /* OP_ARM_MODEL_H */ |
diff --git a/arch/arm/vfp/vfp.h b/arch/arm/vfp/vfp.h index 55a02bc994a3..4b97950984e9 100644 --- a/arch/arm/vfp/vfp.h +++ b/arch/arm/vfp/vfp.h | |||
@@ -117,7 +117,13 @@ static inline u64 vfp_estimate_div128to64(u64 nh, u64 nl, u64 m) | |||
117 | if (nh >= m) | 117 | if (nh >= m) |
118 | return ~0ULL; | 118 | return ~0ULL; |
119 | mh = m >> 32; | 119 | mh = m >> 32; |
120 | z = (mh << 32 <= nh) ? 0xffffffff00000000ULL : (nh / mh) << 32; | 120 | if (mh << 32 <= nh) { |
121 | z = 0xffffffff00000000ULL; | ||
122 | } else { | ||
123 | z = nh; | ||
124 | do_div(z, mh); | ||
125 | z <<= 32; | ||
126 | } | ||
121 | mul64to128(&termh, &terml, m, z); | 127 | mul64to128(&termh, &terml, m, z); |
122 | sub128(&remh, &reml, nh, nl, termh, terml); | 128 | sub128(&remh, &reml, nh, nl, termh, terml); |
123 | ml = m << 32; | 129 | ml = m << 32; |
@@ -126,7 +132,12 @@ static inline u64 vfp_estimate_div128to64(u64 nh, u64 nl, u64 m) | |||
126 | add128(&remh, &reml, remh, reml, mh, ml); | 132 | add128(&remh, &reml, remh, reml, mh, ml); |
127 | } | 133 | } |
128 | remh = (remh << 32) | (reml >> 32); | 134 | remh = (remh << 32) | (reml >> 32); |
129 | z |= (mh << 32 <= remh) ? 0xffffffff : remh / mh; | 135 | if (mh << 32 <= remh) { |
136 | z |= 0xffffffff; | ||
137 | } else { | ||
138 | do_div(remh, mh); | ||
139 | z |= remh; | ||
140 | } | ||
130 | return z; | 141 | return z; |
131 | } | 142 | } |
132 | 143 | ||
diff --git a/arch/arm/vfp/vfpdouble.c b/arch/arm/vfp/vfpdouble.c index fa3053e84db5..b801cd66b6ea 100644 --- a/arch/arm/vfp/vfpdouble.c +++ b/arch/arm/vfp/vfpdouble.c | |||
@@ -32,6 +32,8 @@ | |||
32 | */ | 32 | */ |
33 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
34 | #include <linux/bitops.h> | 34 | #include <linux/bitops.h> |
35 | |||
36 | #include <asm/div64.h> | ||
35 | #include <asm/ptrace.h> | 37 | #include <asm/ptrace.h> |
36 | #include <asm/vfp.h> | 38 | #include <asm/vfp.h> |
37 | 39 | ||
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index 3aeedd2afc70..22f3da4e0829 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c | |||
@@ -89,7 +89,7 @@ void vfp_raise_sigfpe(unsigned int sicode, struct pt_regs *regs) | |||
89 | current->thread.error_code = 0; | 89 | current->thread.error_code = 0; |
90 | current->thread.trap_no = 6; | 90 | current->thread.trap_no = 6; |
91 | 91 | ||
92 | force_sig_info(SIGFPE, &info, current); | 92 | send_sig_info(SIGFPE, &info, current); |
93 | } | 93 | } |
94 | 94 | ||
95 | static void vfp_panic(char *reason) | 95 | static void vfp_panic(char *reason) |
diff --git a/arch/arm/vfp/vfpsingle.c b/arch/arm/vfp/vfpsingle.c index 6849fe35cb2e..14dd696ddeb1 100644 --- a/arch/arm/vfp/vfpsingle.c +++ b/arch/arm/vfp/vfpsingle.c | |||
@@ -32,6 +32,8 @@ | |||
32 | */ | 32 | */ |
33 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
34 | #include <linux/bitops.h> | 34 | #include <linux/bitops.h> |
35 | |||
36 | #include <asm/div64.h> | ||
35 | #include <asm/ptrace.h> | 37 | #include <asm/ptrace.h> |
36 | #include <asm/vfp.h> | 38 | #include <asm/vfp.h> |
37 | 39 | ||
@@ -303,7 +305,11 @@ u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand) | |||
303 | if (z <= a) | 305 | if (z <= a) |
304 | return (s32)a >> 1; | 306 | return (s32)a >> 1; |
305 | } | 307 | } |
306 | return (u32)(((u64)a << 31) / z) + (z >> 1); | 308 | { |
309 | u64 v = (u64)a << 31; | ||
310 | do_div(v, z); | ||
311 | return v + (z >> 1); | ||
312 | } | ||
307 | } | 313 | } |
308 | 314 | ||
309 | static u32 vfp_single_fsqrt(int sd, int unused, s32 m, u32 fpscr) | 315 | static u32 vfp_single_fsqrt(int sd, int unused, s32 m, u32 fpscr) |
@@ -1107,7 +1113,11 @@ static u32 vfp_single_fdiv(int sd, int sn, s32 m, u32 fpscr) | |||
1107 | vsn.significand >>= 1; | 1113 | vsn.significand >>= 1; |
1108 | vsd.exponent++; | 1114 | vsd.exponent++; |
1109 | } | 1115 | } |
1110 | vsd.significand = ((u64)vsn.significand << 32) / vsm.significand; | 1116 | { |
1117 | u64 significand = (u64)vsn.significand << 32; | ||
1118 | do_div(significand, vsm.significand); | ||
1119 | vsd.significand = significand; | ||
1120 | } | ||
1111 | if ((vsd.significand & 0x3f) == 0) | 1121 | if ((vsd.significand & 0x3f) == 0) |
1112 | vsd.significand |= ((u64)vsm.significand * vsd.significand != (u64)vsn.significand << 32); | 1122 | vsd.significand |= ((u64)vsm.significand * vsd.significand != (u64)vsn.significand << 32); |
1113 | 1123 | ||
diff --git a/arch/i386/boot/tools/build.c b/arch/i386/boot/tools/build.c index 4a17956512e1..6835f6d47c31 100644 --- a/arch/i386/boot/tools/build.c +++ b/arch/i386/boot/tools/build.c | |||
@@ -70,7 +70,8 @@ void usage(void) | |||
70 | 70 | ||
71 | int main(int argc, char ** argv) | 71 | int main(int argc, char ** argv) |
72 | { | 72 | { |
73 | unsigned int i, c, sz, setup_sectors; | 73 | unsigned int i, sz, setup_sectors; |
74 | int c; | ||
74 | u32 sys_size; | 75 | u32 sys_size; |
75 | byte major_root, minor_root; | 76 | byte major_root, minor_root; |
76 | struct stat sb; | 77 | struct stat sb; |
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index 9f63ae0f404b..b7808a89d945 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c | |||
@@ -159,9 +159,15 @@ char *__acpi_map_table(unsigned long phys, unsigned long size) | |||
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | #ifdef CONFIG_PCI_MMCONFIG | 161 | #ifdef CONFIG_PCI_MMCONFIG |
162 | static int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size) | 162 | /* The physical address of the MMCONFIG aperture. Set from ACPI tables. */ |
163 | struct acpi_table_mcfg_config *pci_mmcfg_config; | ||
164 | int pci_mmcfg_config_num; | ||
165 | |||
166 | int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size) | ||
163 | { | 167 | { |
164 | struct acpi_table_mcfg *mcfg; | 168 | struct acpi_table_mcfg *mcfg; |
169 | unsigned long i; | ||
170 | int config_size; | ||
165 | 171 | ||
166 | if (!phys_addr || !size) | 172 | if (!phys_addr || !size) |
167 | return -EINVAL; | 173 | return -EINVAL; |
@@ -172,18 +178,38 @@ static int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size) | |||
172 | return -ENODEV; | 178 | return -ENODEV; |
173 | } | 179 | } |
174 | 180 | ||
175 | if (mcfg->base_reserved) { | 181 | /* how many config structures do we have */ |
176 | printk(KERN_ERR PREFIX "MMCONFIG not in low 4GB of memory\n"); | 182 | pci_mmcfg_config_num = 0; |
183 | i = size - sizeof(struct acpi_table_mcfg); | ||
184 | while (i >= sizeof(struct acpi_table_mcfg_config)) { | ||
185 | ++pci_mmcfg_config_num; | ||
186 | i -= sizeof(struct acpi_table_mcfg_config); | ||
187 | }; | ||
188 | if (pci_mmcfg_config_num == 0) { | ||
189 | printk(KERN_ERR PREFIX "MMCONFIG has no entries\n"); | ||
177 | return -ENODEV; | 190 | return -ENODEV; |
178 | } | 191 | } |
179 | 192 | ||
180 | pci_mmcfg_base_addr = mcfg->base_address; | 193 | config_size = pci_mmcfg_config_num * sizeof(*pci_mmcfg_config); |
194 | pci_mmcfg_config = kmalloc(config_size, GFP_KERNEL); | ||
195 | if (!pci_mmcfg_config) { | ||
196 | printk(KERN_WARNING PREFIX | ||
197 | "No memory for MCFG config tables\n"); | ||
198 | return -ENOMEM; | ||
199 | } | ||
200 | |||
201 | memcpy(pci_mmcfg_config, &mcfg->config, config_size); | ||
202 | for (i = 0; i < pci_mmcfg_config_num; ++i) { | ||
203 | if (mcfg->config[i].base_reserved) { | ||
204 | printk(KERN_ERR PREFIX | ||
205 | "MMCONFIG not in low 4GB of memory\n"); | ||
206 | return -ENODEV; | ||
207 | } | ||
208 | } | ||
181 | 209 | ||
182 | return 0; | 210 | return 0; |
183 | } | 211 | } |
184 | #else | 212 | #endif /* CONFIG_PCI_MMCONFIG */ |
185 | #define acpi_parse_mcfg NULL | ||
186 | #endif /* !CONFIG_PCI_MMCONFIG */ | ||
187 | 213 | ||
188 | #ifdef CONFIG_X86_LOCAL_APIC | 214 | #ifdef CONFIG_X86_LOCAL_APIC |
189 | static int __init | 215 | static int __init |
@@ -507,6 +533,22 @@ acpi_unmap_lsapic(int cpu) | |||
507 | EXPORT_SYMBOL(acpi_unmap_lsapic); | 533 | EXPORT_SYMBOL(acpi_unmap_lsapic); |
508 | #endif /* CONFIG_ACPI_HOTPLUG_CPU */ | 534 | #endif /* CONFIG_ACPI_HOTPLUG_CPU */ |
509 | 535 | ||
536 | int | ||
537 | acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base) | ||
538 | { | ||
539 | /* TBD */ | ||
540 | return -EINVAL; | ||
541 | } | ||
542 | EXPORT_SYMBOL(acpi_register_ioapic); | ||
543 | |||
544 | int | ||
545 | acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base) | ||
546 | { | ||
547 | /* TBD */ | ||
548 | return -EINVAL; | ||
549 | } | ||
550 | EXPORT_SYMBOL(acpi_unregister_ioapic); | ||
551 | |||
510 | static unsigned long __init | 552 | static unsigned long __init |
511 | acpi_scan_rsdp ( | 553 | acpi_scan_rsdp ( |
512 | unsigned long start, | 554 | unsigned long start, |
@@ -1123,7 +1165,6 @@ int __init acpi_boot_init(void) | |||
1123 | acpi_process_madt(); | 1165 | acpi_process_madt(); |
1124 | 1166 | ||
1125 | acpi_table_parse(ACPI_HPET, acpi_parse_hpet); | 1167 | acpi_table_parse(ACPI_HPET, acpi_parse_hpet); |
1126 | acpi_table_parse(ACPI_MCFG, acpi_parse_mcfg); | ||
1127 | 1168 | ||
1128 | return 0; | 1169 | return 0; |
1129 | } | 1170 | } |
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c index 93df90bbb87e..bd1dbf3bd223 100644 --- a/arch/i386/kernel/apic.c +++ b/arch/i386/kernel/apic.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <asm/desc.h> | 35 | #include <asm/desc.h> |
36 | #include <asm/arch_hooks.h> | 36 | #include <asm/arch_hooks.h> |
37 | #include <asm/hpet.h> | 37 | #include <asm/hpet.h> |
38 | #include <asm/i8253.h> | ||
38 | 39 | ||
39 | #include <mach_apic.h> | 40 | #include <mach_apic.h> |
40 | 41 | ||
@@ -879,7 +880,6 @@ fake_ioapic_page: | |||
879 | */ | 880 | */ |
880 | static unsigned int __devinit get_8254_timer_count(void) | 881 | static unsigned int __devinit get_8254_timer_count(void) |
881 | { | 882 | { |
882 | extern spinlock_t i8253_lock; | ||
883 | unsigned long flags; | 883 | unsigned long flags; |
884 | 884 | ||
885 | unsigned int count; | 885 | unsigned int count; |
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index d48ce9290963..064211d5f41b 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c | |||
@@ -228,10 +228,10 @@ | |||
228 | #include <asm/system.h> | 228 | #include <asm/system.h> |
229 | #include <asm/uaccess.h> | 229 | #include <asm/uaccess.h> |
230 | #include <asm/desc.h> | 230 | #include <asm/desc.h> |
231 | #include <asm/i8253.h> | ||
231 | 232 | ||
232 | #include "io_ports.h" | 233 | #include "io_ports.h" |
233 | 234 | ||
234 | extern spinlock_t i8253_lock; | ||
235 | extern unsigned long get_cmos_time(void); | 235 | extern unsigned long get_cmos_time(void); |
236 | extern void machine_real_restart(unsigned char *, int); | 236 | extern void machine_real_restart(unsigned char *, int); |
237 | 237 | ||
@@ -1168,8 +1168,7 @@ static void get_time_diff(void) | |||
1168 | static void reinit_timer(void) | 1168 | static void reinit_timer(void) |
1169 | { | 1169 | { |
1170 | #ifdef INIT_TIMER_AFTER_SUSPEND | 1170 | #ifdef INIT_TIMER_AFTER_SUSPEND |
1171 | unsigned long flags; | 1171 | unsigned long flags; |
1172 | extern spinlock_t i8253_lock; | ||
1173 | 1172 | ||
1174 | spin_lock_irqsave(&i8253_lock, flags); | 1173 | spin_lock_irqsave(&i8253_lock, flags); |
1175 | /* set the clock to 100 Hz */ | 1174 | /* set the clock to 100 Hz */ |
diff --git a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c index 1a49adb1f4a6..e86ea486c311 100644 --- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c +++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c | |||
@@ -190,7 +190,7 @@ static __init struct pci_dev *gx_detect_chipset(void) | |||
190 | 190 | ||
191 | /* detect which companion chip is used */ | 191 | /* detect which companion chip is used */ |
192 | while ((gx_pci = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, gx_pci)) != NULL) { | 192 | while ((gx_pci = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, gx_pci)) != NULL) { |
193 | if ((pci_match_device (gx_chipset_tbl, gx_pci)) != NULL) { | 193 | if ((pci_match_id(gx_chipset_tbl, gx_pci)) != NULL) { |
194 | return gx_pci; | 194 | return gx_pci; |
195 | } | 195 | } |
196 | } | 196 | } |
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index 35eb8e29c485..6578f40bd501 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <asm/smp.h> | 37 | #include <asm/smp.h> |
38 | #include <asm/desc.h> | 38 | #include <asm/desc.h> |
39 | #include <asm/timer.h> | 39 | #include <asm/timer.h> |
40 | #include <asm/i8259.h> | ||
40 | 41 | ||
41 | #include <mach_apic.h> | 42 | #include <mach_apic.h> |
42 | 43 | ||
@@ -1566,7 +1567,6 @@ void print_all_local_APICs (void) | |||
1566 | 1567 | ||
1567 | void /*__init*/ print_PIC(void) | 1568 | void /*__init*/ print_PIC(void) |
1568 | { | 1569 | { |
1569 | extern spinlock_t i8259A_lock; | ||
1570 | unsigned int v; | 1570 | unsigned int v; |
1571 | unsigned long flags; | 1571 | unsigned long flags; |
1572 | 1572 | ||
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index fc8b17521761..a6d8c45961d3 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c | |||
@@ -537,7 +537,7 @@ static struct kprobe trampoline_p = { | |||
537 | .pre_handler = trampoline_probe_handler | 537 | .pre_handler = trampoline_probe_handler |
538 | }; | 538 | }; |
539 | 539 | ||
540 | int __init arch_init(void) | 540 | int __init arch_init_kprobes(void) |
541 | { | 541 | { |
542 | return register_kprobe(&trampoline_p); | 542 | return register_kprobe(&trampoline_p); |
543 | } | 543 | } |
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c index e68d9fdb0759..2854c357377f 100644 --- a/arch/i386/kernel/time.c +++ b/arch/i386/kernel/time.c | |||
@@ -68,7 +68,8 @@ | |||
68 | 68 | ||
69 | #include "io_ports.h" | 69 | #include "io_ports.h" |
70 | 70 | ||
71 | extern spinlock_t i8259A_lock; | 71 | #include <asm/i8259.h> |
72 | |||
72 | int pit_latch_buggy; /* extern */ | 73 | int pit_latch_buggy; /* extern */ |
73 | 74 | ||
74 | #include "do_timer.h" | 75 | #include "do_timer.h" |
@@ -85,6 +86,8 @@ extern unsigned long wall_jiffies; | |||
85 | DEFINE_SPINLOCK(rtc_lock); | 86 | DEFINE_SPINLOCK(rtc_lock); |
86 | EXPORT_SYMBOL(rtc_lock); | 87 | EXPORT_SYMBOL(rtc_lock); |
87 | 88 | ||
89 | #include <asm/i8253.h> | ||
90 | |||
88 | DEFINE_SPINLOCK(i8253_lock); | 91 | DEFINE_SPINLOCK(i8253_lock); |
89 | EXPORT_SYMBOL(i8253_lock); | 92 | EXPORT_SYMBOL(i8253_lock); |
90 | 93 | ||
diff --git a/arch/i386/kernel/timers/timer_cyclone.c b/arch/i386/kernel/timers/timer_cyclone.c index f6f1206a11bb..13892a65c941 100644 --- a/arch/i386/kernel/timers/timer_cyclone.c +++ b/arch/i386/kernel/timers/timer_cyclone.c | |||
@@ -17,9 +17,9 @@ | |||
17 | #include <asm/io.h> | 17 | #include <asm/io.h> |
18 | #include <asm/pgtable.h> | 18 | #include <asm/pgtable.h> |
19 | #include <asm/fixmap.h> | 19 | #include <asm/fixmap.h> |
20 | #include "io_ports.h" | 20 | #include <asm/i8253.h> |
21 | 21 | ||
22 | extern spinlock_t i8253_lock; | 22 | #include "io_ports.h" |
23 | 23 | ||
24 | /* Number of usecs that the last interrupt was delayed */ | 24 | /* Number of usecs that the last interrupt was delayed */ |
25 | static int delay_at_last_interrupt; | 25 | static int delay_at_last_interrupt; |
diff --git a/arch/i386/kernel/timers/timer_pit.c b/arch/i386/kernel/timers/timer_pit.c index 967d5453cd0e..06de036a820c 100644 --- a/arch/i386/kernel/timers/timer_pit.c +++ b/arch/i386/kernel/timers/timer_pit.c | |||
@@ -15,9 +15,8 @@ | |||
15 | #include <asm/smp.h> | 15 | #include <asm/smp.h> |
16 | #include <asm/io.h> | 16 | #include <asm/io.h> |
17 | #include <asm/arch_hooks.h> | 17 | #include <asm/arch_hooks.h> |
18 | #include <asm/i8253.h> | ||
18 | 19 | ||
19 | extern spinlock_t i8259A_lock; | ||
20 | extern spinlock_t i8253_lock; | ||
21 | #include "do_timer.h" | 20 | #include "do_timer.h" |
22 | #include "io_ports.h" | 21 | #include "io_ports.h" |
23 | 22 | ||
@@ -166,7 +165,6 @@ struct init_timer_opts __initdata timer_pit_init = { | |||
166 | 165 | ||
167 | void setup_pit_timer(void) | 166 | void setup_pit_timer(void) |
168 | { | 167 | { |
169 | extern spinlock_t i8253_lock; | ||
170 | unsigned long flags; | 168 | unsigned long flags; |
171 | 169 | ||
172 | spin_lock_irqsave(&i8253_lock, flags); | 170 | spin_lock_irqsave(&i8253_lock, flags); |
diff --git a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c index f46e625bab67..8f4e4d5bc560 100644 --- a/arch/i386/kernel/timers/timer_tsc.c +++ b/arch/i386/kernel/timers/timer_tsc.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "mach_timer.h" | 24 | #include "mach_timer.h" |
25 | 25 | ||
26 | #include <asm/hpet.h> | 26 | #include <asm/hpet.h> |
27 | #include <asm/i8253.h> | ||
27 | 28 | ||
28 | #ifdef CONFIG_HPET_TIMER | 29 | #ifdef CONFIG_HPET_TIMER |
29 | static unsigned long hpet_usec_quotient; | 30 | static unsigned long hpet_usec_quotient; |
@@ -35,8 +36,6 @@ static inline void cpufreq_delayed_get(void); | |||
35 | 36 | ||
36 | int tsc_disable __devinitdata = 0; | 37 | int tsc_disable __devinitdata = 0; |
37 | 38 | ||
38 | extern spinlock_t i8253_lock; | ||
39 | |||
40 | static int use_tsc; | 39 | static int use_tsc; |
41 | /* Number of usecs that the last interrupt was delayed */ | 40 | /* Number of usecs that the last interrupt was delayed */ |
42 | static int delay_at_last_interrupt; | 41 | static int delay_at_last_interrupt; |
diff --git a/arch/i386/mach-voyager/voyager_basic.c b/arch/i386/mach-voyager/voyager_basic.c index 602aea240e9b..3e439ce5e1b2 100644 --- a/arch/i386/mach-voyager/voyager_basic.c +++ b/arch/i386/mach-voyager/voyager_basic.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/irq.h> | 30 | #include <linux/irq.h> |
31 | #include <asm/tlbflush.h> | 31 | #include <asm/tlbflush.h> |
32 | #include <asm/arch_hooks.h> | 32 | #include <asm/arch_hooks.h> |
33 | #include <asm/i8253.h> | ||
33 | 34 | ||
34 | /* | 35 | /* |
35 | * Power off function, if any | 36 | * Power off function, if any |
@@ -182,7 +183,6 @@ voyager_timer_interrupt(struct pt_regs *regs) | |||
182 | * and swiftly introduce it to something sharp and | 183 | * and swiftly introduce it to something sharp and |
183 | * pointy. */ | 184 | * pointy. */ |
184 | __u16 val; | 185 | __u16 val; |
185 | extern spinlock_t i8253_lock; | ||
186 | 186 | ||
187 | spin_lock(&i8253_lock); | 187 | spin_lock(&i8253_lock); |
188 | 188 | ||
diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c index 720975e1af50..70bcd53451f6 100644 --- a/arch/i386/pci/common.c +++ b/arch/i386/pci/common.c | |||
@@ -25,7 +25,8 @@ unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 | | |||
25 | 25 | ||
26 | int pci_routeirq; | 26 | int pci_routeirq; |
27 | int pcibios_last_bus = -1; | 27 | int pcibios_last_bus = -1; |
28 | struct pci_bus *pci_root_bus = NULL; | 28 | unsigned long pirq_table_addr; |
29 | struct pci_bus *pci_root_bus; | ||
29 | struct pci_raw_ops *raw_pci_ops; | 30 | struct pci_raw_ops *raw_pci_ops; |
30 | 31 | ||
31 | static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) | 32 | static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) |
@@ -133,7 +134,7 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum) | |||
133 | 134 | ||
134 | printk("PCI: Probing PCI hardware (bus %02x)\n", busnum); | 135 | printk("PCI: Probing PCI hardware (bus %02x)\n", busnum); |
135 | 136 | ||
136 | return pci_scan_bus(busnum, &pci_root_ops, NULL); | 137 | return pci_scan_bus_parented(NULL, busnum, &pci_root_ops, NULL); |
137 | } | 138 | } |
138 | 139 | ||
139 | extern u8 pci_cache_line_size; | 140 | extern u8 pci_cache_line_size; |
@@ -164,6 +165,7 @@ static int __init pcibios_init(void) | |||
164 | if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT)) | 165 | if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT)) |
165 | pcibios_sort(); | 166 | pcibios_sort(); |
166 | #endif | 167 | #endif |
168 | pci_assign_unassigned_resources(); | ||
167 | return 0; | 169 | return 0; |
168 | } | 170 | } |
169 | 171 | ||
@@ -188,6 +190,9 @@ char * __devinit pcibios_setup(char *str) | |||
188 | } else if (!strcmp(str, "biosirq")) { | 190 | } else if (!strcmp(str, "biosirq")) { |
189 | pci_probe |= PCI_BIOS_IRQ_SCAN; | 191 | pci_probe |= PCI_BIOS_IRQ_SCAN; |
190 | return NULL; | 192 | return NULL; |
193 | } else if (!strncmp(str, "pirqaddr=", 9)) { | ||
194 | pirq_table_addr = simple_strtoul(str+9, NULL, 0); | ||
195 | return NULL; | ||
191 | } | 196 | } |
192 | #endif | 197 | #endif |
193 | #ifdef CONFIG_PCI_DIRECT | 198 | #ifdef CONFIG_PCI_DIRECT |
diff --git a/arch/i386/pci/i386.c b/arch/i386/pci/i386.c index c205ea7e233b..93a364c82150 100644 --- a/arch/i386/pci/i386.c +++ b/arch/i386/pci/i386.c | |||
@@ -106,11 +106,16 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) | |||
106 | if ((dev = bus->self)) { | 106 | if ((dev = bus->self)) { |
107 | for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) { | 107 | for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) { |
108 | r = &dev->resource[idx]; | 108 | r = &dev->resource[idx]; |
109 | if (!r->start) | 109 | if (!r->flags) |
110 | continue; | 110 | continue; |
111 | pr = pci_find_parent_resource(dev, r); | 111 | pr = pci_find_parent_resource(dev, r); |
112 | if (!pr || request_resource(pr, r) < 0) | 112 | if (!r->start || !pr || request_resource(pr, r) < 0) { |
113 | printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, pci_name(dev)); | 113 | printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, pci_name(dev)); |
114 | /* Something is wrong with the region. | ||
115 | Invalidate the resource to prevent child | ||
116 | resource allocations in this range. */ | ||
117 | r->flags = 0; | ||
118 | } | ||
114 | } | 119 | } |
115 | } | 120 | } |
116 | pcibios_allocate_bus_resources(&bus->children); | 121 | pcibios_allocate_bus_resources(&bus->children); |
@@ -227,7 +232,7 @@ int pcibios_enable_resources(struct pci_dev *dev, int mask) | |||
227 | 232 | ||
228 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | 233 | pci_read_config_word(dev, PCI_COMMAND, &cmd); |
229 | old_cmd = cmd; | 234 | old_cmd = cmd; |
230 | for(idx=0; idx<6; idx++) { | 235 | for(idx = 0; idx < PCI_NUM_RESOURCES; idx++) { |
231 | /* Only set up the requested stuff */ | 236 | /* Only set up the requested stuff */ |
232 | if (!(mask & (1<<idx))) | 237 | if (!(mask & (1<<idx))) |
233 | continue; | 238 | continue; |
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c index 83458f81e661..78ca1ecbb907 100644 --- a/arch/i386/pci/irq.c +++ b/arch/i386/pci/irq.c | |||
@@ -58,6 +58,35 @@ struct irq_router_handler { | |||
58 | int (*pcibios_enable_irq)(struct pci_dev *dev) = NULL; | 58 | int (*pcibios_enable_irq)(struct pci_dev *dev) = NULL; |
59 | 59 | ||
60 | /* | 60 | /* |
61 | * Check passed address for the PCI IRQ Routing Table signature | ||
62 | * and perform checksum verification. | ||
63 | */ | ||
64 | |||
65 | static inline struct irq_routing_table * pirq_check_routing_table(u8 *addr) | ||
66 | { | ||
67 | struct irq_routing_table *rt; | ||
68 | int i; | ||
69 | u8 sum; | ||
70 | |||
71 | rt = (struct irq_routing_table *) addr; | ||
72 | if (rt->signature != PIRQ_SIGNATURE || | ||
73 | rt->version != PIRQ_VERSION || | ||
74 | rt->size % 16 || | ||
75 | rt->size < sizeof(struct irq_routing_table)) | ||
76 | return NULL; | ||
77 | sum = 0; | ||
78 | for (i=0; i < rt->size; i++) | ||
79 | sum += addr[i]; | ||
80 | if (!sum) { | ||
81 | DBG("PCI: Interrupt Routing Table found at 0x%p\n", rt); | ||
82 | return rt; | ||
83 | } | ||
84 | return NULL; | ||
85 | } | ||
86 | |||
87 | |||
88 | |||
89 | /* | ||
61 | * Search 0xf0000 -- 0xfffff for the PCI IRQ Routing Table. | 90 | * Search 0xf0000 -- 0xfffff for the PCI IRQ Routing Table. |
62 | */ | 91 | */ |
63 | 92 | ||
@@ -65,23 +94,17 @@ static struct irq_routing_table * __init pirq_find_routing_table(void) | |||
65 | { | 94 | { |
66 | u8 *addr; | 95 | u8 *addr; |
67 | struct irq_routing_table *rt; | 96 | struct irq_routing_table *rt; |
68 | int i; | ||
69 | u8 sum; | ||
70 | 97 | ||
98 | if (pirq_table_addr) { | ||
99 | rt = pirq_check_routing_table((u8 *) __va(pirq_table_addr)); | ||
100 | if (rt) | ||
101 | return rt; | ||
102 | printk(KERN_WARNING "PCI: PIRQ table NOT found at pirqaddr\n"); | ||
103 | } | ||
71 | for(addr = (u8 *) __va(0xf0000); addr < (u8 *) __va(0x100000); addr += 16) { | 104 | for(addr = (u8 *) __va(0xf0000); addr < (u8 *) __va(0x100000); addr += 16) { |
72 | rt = (struct irq_routing_table *) addr; | 105 | rt = pirq_check_routing_table(addr); |
73 | if (rt->signature != PIRQ_SIGNATURE || | 106 | if (rt) |
74 | rt->version != PIRQ_VERSION || | ||
75 | rt->size % 16 || | ||
76 | rt->size < sizeof(struct irq_routing_table)) | ||
77 | continue; | ||
78 | sum = 0; | ||
79 | for(i=0; i<rt->size; i++) | ||
80 | sum += addr[i]; | ||
81 | if (!sum) { | ||
82 | DBG("PCI: Interrupt Routing Table found at 0x%p\n", rt); | ||
83 | return rt; | 107 | return rt; |
84 | } | ||
85 | } | 108 | } |
86 | return NULL; | 109 | return NULL; |
87 | } | 110 | } |
diff --git a/arch/i386/pci/legacy.c b/arch/i386/pci/legacy.c index 1492e3753869..149a9588c256 100644 --- a/arch/i386/pci/legacy.c +++ b/arch/i386/pci/legacy.c | |||
@@ -45,6 +45,8 @@ static int __init pci_legacy_init(void) | |||
45 | 45 | ||
46 | printk("PCI: Probing PCI hardware\n"); | 46 | printk("PCI: Probing PCI hardware\n"); |
47 | pci_root_bus = pcibios_scan_root(0); | 47 | pci_root_bus = pcibios_scan_root(0); |
48 | if (pci_root_bus) | ||
49 | pci_bus_add_devices(pci_root_bus); | ||
48 | 50 | ||
49 | pcibios_fixup_peer_bridges(); | 51 | pcibios_fixup_peer_bridges(); |
50 | 52 | ||
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c index 021a50aa51f4..60f0e7a1162a 100644 --- a/arch/i386/pci/mmconfig.c +++ b/arch/i386/pci/mmconfig.c | |||
@@ -11,11 +11,9 @@ | |||
11 | 11 | ||
12 | #include <linux/pci.h> | 12 | #include <linux/pci.h> |
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/acpi.h> | ||
14 | #include "pci.h" | 15 | #include "pci.h" |
15 | 16 | ||
16 | /* The physical address of the MMCONFIG aperture. Set from ACPI tables. */ | ||
17 | u32 pci_mmcfg_base_addr; | ||
18 | |||
19 | #define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG)) | 17 | #define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG)) |
20 | 18 | ||
21 | /* The base address of the last MMCONFIG device accessed */ | 19 | /* The base address of the last MMCONFIG device accessed */ |
@@ -24,10 +22,31 @@ static u32 mmcfg_last_accessed_device; | |||
24 | /* | 22 | /* |
25 | * Functions for accessing PCI configuration space with MMCONFIG accesses | 23 | * Functions for accessing PCI configuration space with MMCONFIG accesses |
26 | */ | 24 | */ |
25 | static u32 get_base_addr(unsigned int seg, int bus) | ||
26 | { | ||
27 | int cfg_num = -1; | ||
28 | struct acpi_table_mcfg_config *cfg; | ||
29 | |||
30 | while (1) { | ||
31 | ++cfg_num; | ||
32 | if (cfg_num >= pci_mmcfg_config_num) { | ||
33 | /* something bad is going on, no cfg table is found. */ | ||
34 | /* so we fall back to the old way we used to do this */ | ||
35 | /* and just rely on the first entry to be correct. */ | ||
36 | return pci_mmcfg_config[0].base_address; | ||
37 | } | ||
38 | cfg = &pci_mmcfg_config[cfg_num]; | ||
39 | if (cfg->pci_segment_group_number != seg) | ||
40 | continue; | ||
41 | if ((cfg->start_bus_number <= bus) && | ||
42 | (cfg->end_bus_number >= bus)) | ||
43 | return cfg->base_address; | ||
44 | } | ||
45 | } | ||
27 | 46 | ||
28 | static inline void pci_exp_set_dev_base(int bus, int devfn) | 47 | static inline void pci_exp_set_dev_base(unsigned int seg, int bus, int devfn) |
29 | { | 48 | { |
30 | u32 dev_base = pci_mmcfg_base_addr | (bus << 20) | (devfn << 12); | 49 | u32 dev_base = get_base_addr(seg, bus) | (bus << 20) | (devfn << 12); |
31 | if (dev_base != mmcfg_last_accessed_device) { | 50 | if (dev_base != mmcfg_last_accessed_device) { |
32 | mmcfg_last_accessed_device = dev_base; | 51 | mmcfg_last_accessed_device = dev_base; |
33 | set_fixmap_nocache(FIX_PCIE_MCFG, dev_base); | 52 | set_fixmap_nocache(FIX_PCIE_MCFG, dev_base); |
@@ -44,7 +63,7 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus, | |||
44 | 63 | ||
45 | spin_lock_irqsave(&pci_config_lock, flags); | 64 | spin_lock_irqsave(&pci_config_lock, flags); |
46 | 65 | ||
47 | pci_exp_set_dev_base(bus, devfn); | 66 | pci_exp_set_dev_base(seg, bus, devfn); |
48 | 67 | ||
49 | switch (len) { | 68 | switch (len) { |
50 | case 1: | 69 | case 1: |
@@ -73,7 +92,7 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus, | |||
73 | 92 | ||
74 | spin_lock_irqsave(&pci_config_lock, flags); | 93 | spin_lock_irqsave(&pci_config_lock, flags); |
75 | 94 | ||
76 | pci_exp_set_dev_base(bus, devfn); | 95 | pci_exp_set_dev_base(seg, bus, devfn); |
77 | 96 | ||
78 | switch (len) { | 97 | switch (len) { |
79 | case 1: | 98 | case 1: |
@@ -101,7 +120,11 @@ static int __init pci_mmcfg_init(void) | |||
101 | { | 120 | { |
102 | if ((pci_probe & PCI_PROBE_MMCONF) == 0) | 121 | if ((pci_probe & PCI_PROBE_MMCONF) == 0) |
103 | goto out; | 122 | goto out; |
104 | if (!pci_mmcfg_base_addr) | 123 | |
124 | acpi_table_parse(ACPI_MCFG, acpi_parse_mcfg); | ||
125 | if ((pci_mmcfg_config_num == 0) || | ||
126 | (pci_mmcfg_config == NULL) || | ||
127 | (pci_mmcfg_config[0].base_address == 0)) | ||
105 | goto out; | 128 | goto out; |
106 | 129 | ||
107 | /* Kludge for now. Don't use mmconfig on AMD systems because | 130 | /* Kludge for now. Don't use mmconfig on AMD systems because |
diff --git a/arch/i386/pci/numa.c b/arch/i386/pci/numa.c index 9e3695461899..adbe17a38f6f 100644 --- a/arch/i386/pci/numa.c +++ b/arch/i386/pci/numa.c | |||
@@ -115,6 +115,8 @@ static int __init pci_numa_init(void) | |||
115 | return 0; | 115 | return 0; |
116 | 116 | ||
117 | pci_root_bus = pcibios_scan_root(0); | 117 | pci_root_bus = pcibios_scan_root(0); |
118 | if (pci_root_bus) | ||
119 | pci_bus_add_devices(pci_root_bus); | ||
118 | if (num_online_nodes() > 1) | 120 | if (num_online_nodes() > 1) |
119 | for_each_online_node(quad) { | 121 | for_each_online_node(quad) { |
120 | if (quad == 0) | 122 | if (quad == 0) |
diff --git a/arch/i386/pci/pci.h b/arch/i386/pci/pci.h index a8fc80ca69f3..a80f0f55ff51 100644 --- a/arch/i386/pci/pci.h +++ b/arch/i386/pci/pci.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define PCI_ASSIGN_ALL_BUSSES 0x4000 | 27 | #define PCI_ASSIGN_ALL_BUSSES 0x4000 |
28 | 28 | ||
29 | extern unsigned int pci_probe; | 29 | extern unsigned int pci_probe; |
30 | extern unsigned long pirq_table_addr; | ||
30 | 31 | ||
31 | /* pci-i386.c */ | 32 | /* pci-i386.c */ |
32 | 33 | ||
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig index 487d2e36b0a6..c05613980300 100644 --- a/arch/ia64/configs/sn2_defconfig +++ b/arch/ia64/configs/sn2_defconfig | |||
@@ -99,7 +99,7 @@ CONFIG_ACPI_DEALLOCATE_IRQ=y | |||
99 | # Firmware Drivers | 99 | # Firmware Drivers |
100 | # | 100 | # |
101 | CONFIG_EFI_VARS=y | 101 | CONFIG_EFI_VARS=y |
102 | # CONFIG_EFI_PCDP is not set | 102 | CONFIG_EFI_PCDP=y |
103 | CONFIG_BINFMT_ELF=y | 103 | CONFIG_BINFMT_ELF=y |
104 | # CONFIG_BINFMT_MISC is not set | 104 | # CONFIG_BINFMT_MISC is not set |
105 | 105 | ||
@@ -650,7 +650,7 @@ CONFIG_MMTIMER=y | |||
650 | # | 650 | # |
651 | # Console display driver support | 651 | # Console display driver support |
652 | # | 652 | # |
653 | # CONFIG_VGA_CONSOLE is not set | 653 | CONFIG_VGA_CONSOLE=y |
654 | CONFIG_DUMMY_CONSOLE=y | 654 | CONFIG_DUMMY_CONSOLE=y |
655 | 655 | ||
656 | # | 656 | # |
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig index 47f45341ac62..73454eee26f1 100644 --- a/arch/ia64/configs/tiger_defconfig +++ b/arch/ia64/configs/tiger_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.12-20050621 | 3 | # Linux kernel version: 2.6.13-rc1-20050629 |
4 | # Tue Jun 21 14:03:24 2005 | 4 | # Wed Jun 29 15:28:12 2005 |
5 | # | 5 | # |
6 | 6 | ||
7 | # | 7 | # |
@@ -80,18 +80,29 @@ CONFIG_MCKINLEY=y | |||
80 | # CONFIG_IA64_PAGE_SIZE_8KB is not set | 80 | # CONFIG_IA64_PAGE_SIZE_8KB is not set |
81 | CONFIG_IA64_PAGE_SIZE_16KB=y | 81 | CONFIG_IA64_PAGE_SIZE_16KB=y |
82 | # CONFIG_IA64_PAGE_SIZE_64KB is not set | 82 | # CONFIG_IA64_PAGE_SIZE_64KB is not set |
83 | # CONFIG_HZ_100 is not set | ||
84 | CONFIG_HZ_250=y | ||
85 | # CONFIG_HZ_1000 is not set | ||
86 | CONFIG_HZ=250 | ||
83 | CONFIG_IA64_L1_CACHE_SHIFT=7 | 87 | CONFIG_IA64_L1_CACHE_SHIFT=7 |
84 | # CONFIG_NUMA is not set | 88 | # CONFIG_NUMA is not set |
85 | CONFIG_VIRTUAL_MEM_MAP=y | 89 | CONFIG_VIRTUAL_MEM_MAP=y |
86 | CONFIG_HOLES_IN_ZONE=y | 90 | CONFIG_HOLES_IN_ZONE=y |
87 | CONFIG_IA64_CYCLONE=y | 91 | CONFIG_IA64_CYCLONE=y |
88 | CONFIG_IOSAPIC=y | 92 | CONFIG_IOSAPIC=y |
93 | # CONFIG_IA64_SGI_SN_XP is not set | ||
89 | CONFIG_FORCE_MAX_ZONEORDER=18 | 94 | CONFIG_FORCE_MAX_ZONEORDER=18 |
90 | CONFIG_SMP=y | 95 | CONFIG_SMP=y |
91 | CONFIG_NR_CPUS=4 | 96 | CONFIG_NR_CPUS=4 |
92 | CONFIG_HOTPLUG_CPU=y | 97 | CONFIG_HOTPLUG_CPU=y |
93 | # CONFIG_SCHED_SMT is not set | 98 | # CONFIG_SCHED_SMT is not set |
94 | # CONFIG_PREEMPT is not set | 99 | # CONFIG_PREEMPT is not set |
100 | CONFIG_SELECT_MEMORY_MODEL=y | ||
101 | CONFIG_FLATMEM_MANUAL=y | ||
102 | # CONFIG_DISCONTIGMEM_MANUAL is not set | ||
103 | # CONFIG_SPARSEMEM_MANUAL is not set | ||
104 | CONFIG_FLATMEM=y | ||
105 | CONFIG_FLAT_NODE_MEM_MAP=y | ||
95 | CONFIG_HAVE_DEC_LOCK=y | 106 | CONFIG_HAVE_DEC_LOCK=y |
96 | CONFIG_IA32_SUPPORT=y | 107 | CONFIG_IA32_SUPPORT=y |
97 | CONFIG_COMPAT=y | 108 | CONFIG_COMPAT=y |
@@ -257,6 +268,7 @@ CONFIG_BLK_DEV_CMD64X=y | |||
257 | # CONFIG_BLK_DEV_HPT366 is not set | 268 | # CONFIG_BLK_DEV_HPT366 is not set |
258 | # CONFIG_BLK_DEV_SC1200 is not set | 269 | # CONFIG_BLK_DEV_SC1200 is not set |
259 | CONFIG_BLK_DEV_PIIX=y | 270 | CONFIG_BLK_DEV_PIIX=y |
271 | # CONFIG_BLK_DEV_IT821X is not set | ||
260 | # CONFIG_BLK_DEV_NS87415 is not set | 272 | # CONFIG_BLK_DEV_NS87415 is not set |
261 | # CONFIG_BLK_DEV_PDC202XX_OLD is not set | 273 | # CONFIG_BLK_DEV_PDC202XX_OLD is not set |
262 | # CONFIG_BLK_DEV_PDC202XX_NEW is not set | 274 | # CONFIG_BLK_DEV_PDC202XX_NEW is not set |
@@ -395,6 +407,7 @@ CONFIG_UNIX=y | |||
395 | CONFIG_INET=y | 407 | CONFIG_INET=y |
396 | CONFIG_IP_MULTICAST=y | 408 | CONFIG_IP_MULTICAST=y |
397 | # CONFIG_IP_ADVANCED_ROUTER is not set | 409 | # CONFIG_IP_ADVANCED_ROUTER is not set |
410 | CONFIG_IP_FIB_HASH=y | ||
398 | # CONFIG_IP_PNP is not set | 411 | # CONFIG_IP_PNP is not set |
399 | # CONFIG_NET_IPIP is not set | 412 | # CONFIG_NET_IPIP is not set |
400 | # CONFIG_NET_IPGRE is not set | 413 | # CONFIG_NET_IPGRE is not set |
@@ -407,6 +420,8 @@ CONFIG_SYN_COOKIES=y | |||
407 | # CONFIG_INET_TUNNEL is not set | 420 | # CONFIG_INET_TUNNEL is not set |
408 | CONFIG_IP_TCPDIAG=y | 421 | CONFIG_IP_TCPDIAG=y |
409 | # CONFIG_IP_TCPDIAG_IPV6 is not set | 422 | # CONFIG_IP_TCPDIAG_IPV6 is not set |
423 | # CONFIG_TCP_CONG_ADVANCED is not set | ||
424 | CONFIG_TCP_CONG_BIC=y | ||
410 | # CONFIG_IPV6 is not set | 425 | # CONFIG_IPV6 is not set |
411 | # CONFIG_NETFILTER is not set | 426 | # CONFIG_NETFILTER is not set |
412 | 427 | ||
@@ -598,9 +613,7 @@ CONFIG_GAMEPORT=m | |||
598 | # CONFIG_GAMEPORT_NS558 is not set | 613 | # CONFIG_GAMEPORT_NS558 is not set |
599 | # CONFIG_GAMEPORT_L4 is not set | 614 | # CONFIG_GAMEPORT_L4 is not set |
600 | # CONFIG_GAMEPORT_EMU10K1 is not set | 615 | # CONFIG_GAMEPORT_EMU10K1 is not set |
601 | # CONFIG_GAMEPORT_VORTEX is not set | ||
602 | # CONFIG_GAMEPORT_FM801 is not set | 616 | # CONFIG_GAMEPORT_FM801 is not set |
603 | # CONFIG_GAMEPORT_CS461X is not set | ||
604 | 617 | ||
605 | # | 618 | # |
606 | # Character devices | 619 | # Character devices |
@@ -629,7 +642,6 @@ CONFIG_SERIAL_8250_NR_UARTS=6 | |||
629 | CONFIG_SERIAL_8250_EXTENDED=y | 642 | CONFIG_SERIAL_8250_EXTENDED=y |
630 | CONFIG_SERIAL_8250_SHARE_IRQ=y | 643 | CONFIG_SERIAL_8250_SHARE_IRQ=y |
631 | # CONFIG_SERIAL_8250_DETECT_IRQ is not set | 644 | # CONFIG_SERIAL_8250_DETECT_IRQ is not set |
632 | # CONFIG_SERIAL_8250_MULTIPORT is not set | ||
633 | # CONFIG_SERIAL_8250_RSA is not set | 645 | # CONFIG_SERIAL_8250_RSA is not set |
634 | 646 | ||
635 | # | 647 | # |
@@ -743,6 +755,7 @@ CONFIG_USB_DEVICEFS=y | |||
743 | CONFIG_USB_EHCI_HCD=m | 755 | CONFIG_USB_EHCI_HCD=m |
744 | # CONFIG_USB_EHCI_SPLIT_ISO is not set | 756 | # CONFIG_USB_EHCI_SPLIT_ISO is not set |
745 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set | 757 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set |
758 | # CONFIG_USB_ISP116X_HCD is not set | ||
746 | CONFIG_USB_OHCI_HCD=m | 759 | CONFIG_USB_OHCI_HCD=m |
747 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set | 760 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set |
748 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y | 761 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y |
@@ -779,9 +792,11 @@ CONFIG_USB_HIDINPUT=y | |||
779 | # CONFIG_USB_HIDDEV is not set | 792 | # CONFIG_USB_HIDDEV is not set |
780 | # CONFIG_USB_AIPTEK is not set | 793 | # CONFIG_USB_AIPTEK is not set |
781 | # CONFIG_USB_WACOM is not set | 794 | # CONFIG_USB_WACOM is not set |
795 | # CONFIG_USB_ACECAD is not set | ||
782 | # CONFIG_USB_KBTAB is not set | 796 | # CONFIG_USB_KBTAB is not set |
783 | # CONFIG_USB_POWERMATE is not set | 797 | # CONFIG_USB_POWERMATE is not set |
784 | # CONFIG_USB_MTOUCH is not set | 798 | # CONFIG_USB_MTOUCH is not set |
799 | # CONFIG_USB_ITMTOUCH is not set | ||
785 | # CONFIG_USB_EGALAX is not set | 800 | # CONFIG_USB_EGALAX is not set |
786 | # CONFIG_USB_XPAD is not set | 801 | # CONFIG_USB_XPAD is not set |
787 | # CONFIG_USB_ATI_REMOTE is not set | 802 | # CONFIG_USB_ATI_REMOTE is not set |
@@ -838,7 +853,7 @@ CONFIG_USB_HIDINPUT=y | |||
838 | # CONFIG_USB_TEST is not set | 853 | # CONFIG_USB_TEST is not set |
839 | 854 | ||
840 | # | 855 | # |
841 | # USB ATM/DSL drivers | 856 | # USB DSL modem support |
842 | # | 857 | # |
843 | 858 | ||
844 | # | 859 | # |
@@ -857,12 +872,17 @@ CONFIG_USB_HIDINPUT=y | |||
857 | # CONFIG_INFINIBAND is not set | 872 | # CONFIG_INFINIBAND is not set |
858 | 873 | ||
859 | # | 874 | # |
875 | # SN Devices | ||
876 | # | ||
877 | |||
878 | # | ||
860 | # File systems | 879 | # File systems |
861 | # | 880 | # |
862 | CONFIG_EXT2_FS=y | 881 | CONFIG_EXT2_FS=y |
863 | CONFIG_EXT2_FS_XATTR=y | 882 | CONFIG_EXT2_FS_XATTR=y |
864 | CONFIG_EXT2_FS_POSIX_ACL=y | 883 | CONFIG_EXT2_FS_POSIX_ACL=y |
865 | CONFIG_EXT2_FS_SECURITY=y | 884 | CONFIG_EXT2_FS_SECURITY=y |
885 | # CONFIG_EXT2_FS_XIP is not set | ||
866 | CONFIG_EXT3_FS=y | 886 | CONFIG_EXT3_FS=y |
867 | CONFIG_EXT3_FS_XATTR=y | 887 | CONFIG_EXT3_FS_XATTR=y |
868 | CONFIG_EXT3_FS_POSIX_ACL=y | 888 | CONFIG_EXT3_FS_POSIX_ACL=y |
@@ -922,7 +942,6 @@ CONFIG_NTFS_FS=m | |||
922 | CONFIG_PROC_FS=y | 942 | CONFIG_PROC_FS=y |
923 | CONFIG_PROC_KCORE=y | 943 | CONFIG_PROC_KCORE=y |
924 | CONFIG_SYSFS=y | 944 | CONFIG_SYSFS=y |
925 | # CONFIG_DEVFS_FS is not set | ||
926 | # CONFIG_DEVPTS_FS_XATTR is not set | 945 | # CONFIG_DEVPTS_FS_XATTR is not set |
927 | CONFIG_TMPFS=y | 946 | CONFIG_TMPFS=y |
928 | CONFIG_TMPFS_XATTR=y | 947 | CONFIG_TMPFS_XATTR=y |
@@ -953,15 +972,18 @@ CONFIG_RAMFS=y | |||
953 | # | 972 | # |
954 | CONFIG_NFS_FS=m | 973 | CONFIG_NFS_FS=m |
955 | CONFIG_NFS_V3=y | 974 | CONFIG_NFS_V3=y |
975 | # CONFIG_NFS_V3_ACL is not set | ||
956 | CONFIG_NFS_V4=y | 976 | CONFIG_NFS_V4=y |
957 | CONFIG_NFS_DIRECTIO=y | 977 | CONFIG_NFS_DIRECTIO=y |
958 | CONFIG_NFSD=m | 978 | CONFIG_NFSD=m |
959 | CONFIG_NFSD_V3=y | 979 | CONFIG_NFSD_V3=y |
980 | # CONFIG_NFSD_V3_ACL is not set | ||
960 | CONFIG_NFSD_V4=y | 981 | CONFIG_NFSD_V4=y |
961 | CONFIG_NFSD_TCP=y | 982 | CONFIG_NFSD_TCP=y |
962 | CONFIG_LOCKD=m | 983 | CONFIG_LOCKD=m |
963 | CONFIG_LOCKD_V4=y | 984 | CONFIG_LOCKD_V4=y |
964 | CONFIG_EXPORTFS=y | 985 | CONFIG_EXPORTFS=y |
986 | CONFIG_NFS_COMMON=y | ||
965 | CONFIG_SUNRPC=m | 987 | CONFIG_SUNRPC=m |
966 | CONFIG_SUNRPC_GSS=m | 988 | CONFIG_SUNRPC_GSS=m |
967 | CONFIG_RPCSEC_GSS_KRB5=m | 989 | CONFIG_RPCSEC_GSS_KRB5=m |
@@ -1069,6 +1091,7 @@ CONFIG_LOG_BUF_SHIFT=20 | |||
1069 | # CONFIG_DEBUG_KOBJECT is not set | 1091 | # CONFIG_DEBUG_KOBJECT is not set |
1070 | # CONFIG_DEBUG_INFO is not set | 1092 | # CONFIG_DEBUG_INFO is not set |
1071 | # CONFIG_DEBUG_FS is not set | 1093 | # CONFIG_DEBUG_FS is not set |
1094 | # CONFIG_KPROBES is not set | ||
1072 | CONFIG_IA64_GRANULE_16MB=y | 1095 | CONFIG_IA64_GRANULE_16MB=y |
1073 | # CONFIG_IA64_GRANULE_64MB is not set | 1096 | # CONFIG_IA64_GRANULE_64MB is not set |
1074 | # CONFIG_IA64_PRINT_HAZARDS is not set | 1097 | # CONFIG_IA64_PRINT_HAZARDS is not set |
@@ -1090,7 +1113,7 @@ CONFIG_CRYPTO=y | |||
1090 | # CONFIG_CRYPTO_HMAC is not set | 1113 | # CONFIG_CRYPTO_HMAC is not set |
1091 | # CONFIG_CRYPTO_NULL is not set | 1114 | # CONFIG_CRYPTO_NULL is not set |
1092 | # CONFIG_CRYPTO_MD4 is not set | 1115 | # CONFIG_CRYPTO_MD4 is not set |
1093 | CONFIG_CRYPTO_MD5=m | 1116 | CONFIG_CRYPTO_MD5=y |
1094 | # CONFIG_CRYPTO_SHA1 is not set | 1117 | # CONFIG_CRYPTO_SHA1 is not set |
1095 | # CONFIG_CRYPTO_SHA256 is not set | 1118 | # CONFIG_CRYPTO_SHA256 is not set |
1096 | # CONFIG_CRYPTO_SHA512 is not set | 1119 | # CONFIG_CRYPTO_SHA512 is not set |
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig index 21d6f9bab5e9..b7755e4436d2 100644 --- a/arch/ia64/configs/zx1_defconfig +++ b/arch/ia64/configs/zx1_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.10 | 3 | # Linux kernel version: 2.6.13-rc1-20050629 |
4 | # Wed Dec 29 09:05:48 2004 | 4 | # Wed Jun 29 15:31:11 2005 |
5 | # | 5 | # |
6 | 6 | ||
7 | # | 7 | # |
@@ -12,6 +12,7 @@ CONFIG_EXPERIMENTAL=y | |||
12 | CONFIG_BROKEN=y | 12 | CONFIG_BROKEN=y |
13 | CONFIG_BROKEN_ON_SMP=y | 13 | CONFIG_BROKEN_ON_SMP=y |
14 | CONFIG_LOCK_KERNEL=y | 14 | CONFIG_LOCK_KERNEL=y |
15 | CONFIG_INIT_ENV_ARG_LIMIT=32 | ||
15 | 16 | ||
16 | # | 17 | # |
17 | # General setup | 18 | # General setup |
@@ -24,23 +25,26 @@ CONFIG_BSD_PROCESS_ACCT=y | |||
24 | # CONFIG_BSD_PROCESS_ACCT_V3 is not set | 25 | # CONFIG_BSD_PROCESS_ACCT_V3 is not set |
25 | CONFIG_SYSCTL=y | 26 | CONFIG_SYSCTL=y |
26 | # CONFIG_AUDIT is not set | 27 | # CONFIG_AUDIT is not set |
27 | CONFIG_LOG_BUF_SHIFT=17 | ||
28 | CONFIG_HOTPLUG=y | 28 | CONFIG_HOTPLUG=y |
29 | CONFIG_KOBJECT_UEVENT=y | 29 | CONFIG_KOBJECT_UEVENT=y |
30 | # CONFIG_IKCONFIG is not set | 30 | # CONFIG_IKCONFIG is not set |
31 | # CONFIG_CPUSETS is not set | ||
31 | # CONFIG_EMBEDDED is not set | 32 | # CONFIG_EMBEDDED is not set |
32 | CONFIG_KALLSYMS=y | 33 | CONFIG_KALLSYMS=y |
33 | # CONFIG_KALLSYMS_ALL is not set | 34 | # CONFIG_KALLSYMS_ALL is not set |
34 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | 35 | # CONFIG_KALLSYMS_EXTRA_PASS is not set |
36 | CONFIG_PRINTK=y | ||
37 | CONFIG_BUG=y | ||
38 | CONFIG_BASE_FULL=y | ||
35 | CONFIG_FUTEX=y | 39 | CONFIG_FUTEX=y |
36 | CONFIG_EPOLL=y | 40 | CONFIG_EPOLL=y |
37 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | ||
38 | CONFIG_SHMEM=y | 41 | CONFIG_SHMEM=y |
39 | CONFIG_CC_ALIGN_FUNCTIONS=0 | 42 | CONFIG_CC_ALIGN_FUNCTIONS=0 |
40 | CONFIG_CC_ALIGN_LABELS=0 | 43 | CONFIG_CC_ALIGN_LABELS=0 |
41 | CONFIG_CC_ALIGN_LOOPS=0 | 44 | CONFIG_CC_ALIGN_LOOPS=0 |
42 | CONFIG_CC_ALIGN_JUMPS=0 | 45 | CONFIG_CC_ALIGN_JUMPS=0 |
43 | # CONFIG_TINY_SHMEM is not set | 46 | # CONFIG_TINY_SHMEM is not set |
47 | CONFIG_BASE_SMALL=0 | ||
44 | 48 | ||
45 | # | 49 | # |
46 | # Loadable module support | 50 | # Loadable module support |
@@ -59,12 +63,15 @@ CONFIG_IA64=y | |||
59 | CONFIG_64BIT=y | 63 | CONFIG_64BIT=y |
60 | CONFIG_MMU=y | 64 | CONFIG_MMU=y |
61 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | 65 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y |
66 | CONFIG_GENERIC_CALIBRATE_DELAY=y | ||
62 | CONFIG_TIME_INTERPOLATION=y | 67 | CONFIG_TIME_INTERPOLATION=y |
63 | CONFIG_EFI=y | 68 | CONFIG_EFI=y |
64 | CONFIG_GENERIC_IOMAP=y | 69 | CONFIG_GENERIC_IOMAP=y |
70 | CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y | ||
65 | # CONFIG_IA64_GENERIC is not set | 71 | # CONFIG_IA64_GENERIC is not set |
66 | # CONFIG_IA64_DIG is not set | 72 | # CONFIG_IA64_DIG is not set |
67 | CONFIG_IA64_HP_ZX1=y | 73 | CONFIG_IA64_HP_ZX1=y |
74 | # CONFIG_IA64_HP_ZX1_SWIOTLB is not set | ||
68 | # CONFIG_IA64_SGI_SN2 is not set | 75 | # CONFIG_IA64_SGI_SN2 is not set |
69 | # CONFIG_IA64_HP_SIM is not set | 76 | # CONFIG_IA64_HP_SIM is not set |
70 | # CONFIG_ITANIUM is not set | 77 | # CONFIG_ITANIUM is not set |
@@ -73,22 +80,36 @@ CONFIG_MCKINLEY=y | |||
73 | # CONFIG_IA64_PAGE_SIZE_8KB is not set | 80 | # CONFIG_IA64_PAGE_SIZE_8KB is not set |
74 | CONFIG_IA64_PAGE_SIZE_16KB=y | 81 | CONFIG_IA64_PAGE_SIZE_16KB=y |
75 | # CONFIG_IA64_PAGE_SIZE_64KB is not set | 82 | # CONFIG_IA64_PAGE_SIZE_64KB is not set |
83 | # CONFIG_HZ_100 is not set | ||
84 | CONFIG_HZ_250=y | ||
85 | # CONFIG_HZ_1000 is not set | ||
86 | CONFIG_HZ=250 | ||
76 | CONFIG_IA64_L1_CACHE_SHIFT=7 | 87 | CONFIG_IA64_L1_CACHE_SHIFT=7 |
77 | # CONFIG_NUMA is not set | 88 | # CONFIG_NUMA is not set |
78 | CONFIG_VIRTUAL_MEM_MAP=y | 89 | CONFIG_VIRTUAL_MEM_MAP=y |
90 | CONFIG_HOLES_IN_ZONE=y | ||
79 | # CONFIG_IA64_CYCLONE is not set | 91 | # CONFIG_IA64_CYCLONE is not set |
80 | CONFIG_IOSAPIC=y | 92 | CONFIG_IOSAPIC=y |
93 | # CONFIG_IA64_SGI_SN_XP is not set | ||
81 | CONFIG_FORCE_MAX_ZONEORDER=18 | 94 | CONFIG_FORCE_MAX_ZONEORDER=18 |
82 | CONFIG_SMP=y | 95 | CONFIG_SMP=y |
83 | CONFIG_NR_CPUS=16 | 96 | CONFIG_NR_CPUS=16 |
84 | # CONFIG_HOTPLUG_CPU is not set | 97 | # CONFIG_HOTPLUG_CPU is not set |
98 | # CONFIG_SCHED_SMT is not set | ||
85 | # CONFIG_PREEMPT is not set | 99 | # CONFIG_PREEMPT is not set |
100 | CONFIG_SELECT_MEMORY_MODEL=y | ||
101 | CONFIG_FLATMEM_MANUAL=y | ||
102 | # CONFIG_DISCONTIGMEM_MANUAL is not set | ||
103 | # CONFIG_SPARSEMEM_MANUAL is not set | ||
104 | CONFIG_FLATMEM=y | ||
105 | CONFIG_FLAT_NODE_MEM_MAP=y | ||
86 | CONFIG_HAVE_DEC_LOCK=y | 106 | CONFIG_HAVE_DEC_LOCK=y |
87 | CONFIG_IA32_SUPPORT=y | 107 | CONFIG_IA32_SUPPORT=y |
88 | CONFIG_COMPAT=y | 108 | CONFIG_COMPAT=y |
89 | CONFIG_IA64_MCA_RECOVERY=y | 109 | CONFIG_IA64_MCA_RECOVERY=y |
90 | CONFIG_PERFMON=y | 110 | CONFIG_PERFMON=y |
91 | CONFIG_IA64_PALINFO=y | 111 | CONFIG_IA64_PALINFO=y |
112 | CONFIG_ACPI_DEALLOCATE_IRQ=y | ||
92 | 113 | ||
93 | # | 114 | # |
94 | # Firmware Drivers | 115 | # Firmware Drivers |
@@ -120,6 +141,7 @@ CONFIG_ACPI_BUS=y | |||
120 | CONFIG_ACPI_POWER=y | 141 | CONFIG_ACPI_POWER=y |
121 | CONFIG_ACPI_PCI=y | 142 | CONFIG_ACPI_PCI=y |
122 | CONFIG_ACPI_SYSTEM=y | 143 | CONFIG_ACPI_SYSTEM=y |
144 | # CONFIG_ACPI_CONTAINER is not set | ||
123 | 145 | ||
124 | # | 146 | # |
125 | # Bus options (PCI, PCMCIA) | 147 | # Bus options (PCI, PCMCIA) |
@@ -129,6 +151,7 @@ CONFIG_PCI_DOMAINS=y | |||
129 | # CONFIG_PCI_MSI is not set | 151 | # CONFIG_PCI_MSI is not set |
130 | CONFIG_PCI_LEGACY_PROC=y | 152 | CONFIG_PCI_LEGACY_PROC=y |
131 | CONFIG_PCI_NAMES=y | 153 | CONFIG_PCI_NAMES=y |
154 | # CONFIG_PCI_DEBUG is not set | ||
132 | 155 | ||
133 | # | 156 | # |
134 | # PCI Hotplug Support | 157 | # PCI Hotplug Support |
@@ -138,7 +161,6 @@ CONFIG_HOTPLUG_PCI=y | |||
138 | CONFIG_HOTPLUG_PCI_ACPI=y | 161 | CONFIG_HOTPLUG_PCI_ACPI=y |
139 | # CONFIG_HOTPLUG_PCI_ACPI_IBM is not set | 162 | # CONFIG_HOTPLUG_PCI_ACPI_IBM is not set |
140 | # CONFIG_HOTPLUG_PCI_CPCI is not set | 163 | # CONFIG_HOTPLUG_PCI_CPCI is not set |
141 | # CONFIG_HOTPLUG_PCI_PCIE is not set | ||
142 | # CONFIG_HOTPLUG_PCI_SHPC is not set | 164 | # CONFIG_HOTPLUG_PCI_SHPC is not set |
143 | 165 | ||
144 | # | 166 | # |
@@ -147,10 +169,6 @@ CONFIG_HOTPLUG_PCI_ACPI=y | |||
147 | # CONFIG_PCCARD is not set | 169 | # CONFIG_PCCARD is not set |
148 | 170 | ||
149 | # | 171 | # |
150 | # PC-card bridges | ||
151 | # | ||
152 | |||
153 | # | ||
154 | # Device Drivers | 172 | # Device Drivers |
155 | # | 173 | # |
156 | 174 | ||
@@ -184,6 +202,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y | |||
184 | # CONFIG_BLK_CPQ_CISS_DA is not set | 202 | # CONFIG_BLK_CPQ_CISS_DA is not set |
185 | # CONFIG_BLK_DEV_DAC960 is not set | 203 | # CONFIG_BLK_DEV_DAC960 is not set |
186 | # CONFIG_BLK_DEV_UMEM is not set | 204 | # CONFIG_BLK_DEV_UMEM is not set |
205 | # CONFIG_BLK_DEV_COW_COMMON is not set | ||
187 | CONFIG_BLK_DEV_LOOP=y | 206 | CONFIG_BLK_DEV_LOOP=y |
188 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set | 207 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set |
189 | # CONFIG_BLK_DEV_NBD is not set | 208 | # CONFIG_BLK_DEV_NBD is not set |
@@ -203,6 +222,7 @@ CONFIG_IOSCHED_NOOP=y | |||
203 | CONFIG_IOSCHED_AS=y | 222 | CONFIG_IOSCHED_AS=y |
204 | CONFIG_IOSCHED_DEADLINE=y | 223 | CONFIG_IOSCHED_DEADLINE=y |
205 | CONFIG_IOSCHED_CFQ=y | 224 | CONFIG_IOSCHED_CFQ=y |
225 | # CONFIG_ATA_OVER_ETH is not set | ||
206 | 226 | ||
207 | # | 227 | # |
208 | # ATA/ATAPI/MFM/RLL support | 228 | # ATA/ATAPI/MFM/RLL support |
@@ -246,6 +266,7 @@ CONFIG_BLK_DEV_CMD64X=y | |||
246 | # CONFIG_BLK_DEV_HPT366 is not set | 266 | # CONFIG_BLK_DEV_HPT366 is not set |
247 | # CONFIG_BLK_DEV_SC1200 is not set | 267 | # CONFIG_BLK_DEV_SC1200 is not set |
248 | # CONFIG_BLK_DEV_PIIX is not set | 268 | # CONFIG_BLK_DEV_PIIX is not set |
269 | # CONFIG_BLK_DEV_IT821X is not set | ||
249 | # CONFIG_BLK_DEV_NS87415 is not set | 270 | # CONFIG_BLK_DEV_NS87415 is not set |
250 | # CONFIG_BLK_DEV_PDC202XX_OLD is not set | 271 | # CONFIG_BLK_DEV_PDC202XX_OLD is not set |
251 | # CONFIG_BLK_DEV_PDC202XX_NEW is not set | 272 | # CONFIG_BLK_DEV_PDC202XX_NEW is not set |
@@ -275,6 +296,7 @@ CONFIG_CHR_DEV_OSST=y | |||
275 | CONFIG_BLK_DEV_SR=y | 296 | CONFIG_BLK_DEV_SR=y |
276 | CONFIG_BLK_DEV_SR_VENDOR=y | 297 | CONFIG_BLK_DEV_SR_VENDOR=y |
277 | CONFIG_CHR_DEV_SG=y | 298 | CONFIG_CHR_DEV_SG=y |
299 | # CONFIG_CHR_DEV_SCH is not set | ||
278 | 300 | ||
279 | # | 301 | # |
280 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs | 302 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs |
@@ -288,6 +310,7 @@ CONFIG_SCSI_LOGGING=y | |||
288 | # | 310 | # |
289 | CONFIG_SCSI_SPI_ATTRS=y | 311 | CONFIG_SCSI_SPI_ATTRS=y |
290 | # CONFIG_SCSI_FC_ATTRS is not set | 312 | # CONFIG_SCSI_FC_ATTRS is not set |
313 | # CONFIG_SCSI_ISCSI_ATTRS is not set | ||
291 | 314 | ||
292 | # | 315 | # |
293 | # SCSI low-level drivers | 316 | # SCSI low-level drivers |
@@ -303,13 +326,10 @@ CONFIG_SCSI_SPI_ATTRS=y | |||
303 | # CONFIG_MEGARAID_NEWGEN is not set | 326 | # CONFIG_MEGARAID_NEWGEN is not set |
304 | # CONFIG_MEGARAID_LEGACY is not set | 327 | # CONFIG_MEGARAID_LEGACY is not set |
305 | # CONFIG_SCSI_SATA is not set | 328 | # CONFIG_SCSI_SATA is not set |
306 | # CONFIG_SCSI_BUSLOGIC is not set | ||
307 | # CONFIG_SCSI_CPQFCTS is not set | 329 | # CONFIG_SCSI_CPQFCTS is not set |
308 | # CONFIG_SCSI_DMX3191D is not set | 330 | # CONFIG_SCSI_DMX3191D is not set |
309 | # CONFIG_SCSI_EATA is not set | ||
310 | # CONFIG_SCSI_EATA_PIO is not set | 331 | # CONFIG_SCSI_EATA_PIO is not set |
311 | # CONFIG_SCSI_FUTURE_DOMAIN is not set | 332 | # CONFIG_SCSI_FUTURE_DOMAIN is not set |
312 | # CONFIG_SCSI_GDTH is not set | ||
313 | # CONFIG_SCSI_IPS is not set | 333 | # CONFIG_SCSI_IPS is not set |
314 | # CONFIG_SCSI_INITIO is not set | 334 | # CONFIG_SCSI_INITIO is not set |
315 | # CONFIG_SCSI_INIA100 is not set | 335 | # CONFIG_SCSI_INIA100 is not set |
@@ -319,8 +339,6 @@ CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 | |||
319 | CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 | 339 | CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 |
320 | # CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set | 340 | # CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set |
321 | # CONFIG_SCSI_IPR is not set | 341 | # CONFIG_SCSI_IPR is not set |
322 | # CONFIG_SCSI_PCI2000 is not set | ||
323 | # CONFIG_SCSI_PCI2220I is not set | ||
324 | # CONFIG_SCSI_QLOGIC_ISP is not set | 342 | # CONFIG_SCSI_QLOGIC_ISP is not set |
325 | # CONFIG_SCSI_QLOGIC_FC is not set | 343 | # CONFIG_SCSI_QLOGIC_FC is not set |
326 | CONFIG_SCSI_QLOGIC_1280=y | 344 | CONFIG_SCSI_QLOGIC_1280=y |
@@ -331,7 +349,7 @@ CONFIG_SCSI_QLA2XXX=y | |||
331 | # CONFIG_SCSI_QLA2300 is not set | 349 | # CONFIG_SCSI_QLA2300 is not set |
332 | # CONFIG_SCSI_QLA2322 is not set | 350 | # CONFIG_SCSI_QLA2322 is not set |
333 | # CONFIG_SCSI_QLA6312 is not set | 351 | # CONFIG_SCSI_QLA6312 is not set |
334 | # CONFIG_SCSI_QLA6322 is not set | 352 | # CONFIG_SCSI_LPFC is not set |
335 | # CONFIG_SCSI_DC395x is not set | 353 | # CONFIG_SCSI_DC395x is not set |
336 | # CONFIG_SCSI_DC390T is not set | 354 | # CONFIG_SCSI_DC390T is not set |
337 | # CONFIG_SCSI_DEBUG is not set | 355 | # CONFIG_SCSI_DEBUG is not set |
@@ -344,9 +362,9 @@ CONFIG_SCSI_QLA2XXX=y | |||
344 | # | 362 | # |
345 | # Fusion MPT device support | 363 | # Fusion MPT device support |
346 | # | 364 | # |
347 | CONFIG_FUSION=y | 365 | # CONFIG_FUSION is not set |
348 | CONFIG_FUSION_MAX_SGE=40 | 366 | # CONFIG_FUSION_SPI is not set |
349 | # CONFIG_FUSION_CTL is not set | 367 | # CONFIG_FUSION_FC is not set |
350 | 368 | ||
351 | # | 369 | # |
352 | # IEEE 1394 (FireWire) support | 370 | # IEEE 1394 (FireWire) support |
@@ -368,12 +386,12 @@ CONFIG_NET=y | |||
368 | # | 386 | # |
369 | CONFIG_PACKET=y | 387 | CONFIG_PACKET=y |
370 | # CONFIG_PACKET_MMAP is not set | 388 | # CONFIG_PACKET_MMAP is not set |
371 | # CONFIG_NETLINK_DEV is not set | ||
372 | CONFIG_UNIX=y | 389 | CONFIG_UNIX=y |
373 | # CONFIG_NET_KEY is not set | 390 | # CONFIG_NET_KEY is not set |
374 | CONFIG_INET=y | 391 | CONFIG_INET=y |
375 | CONFIG_IP_MULTICAST=y | 392 | CONFIG_IP_MULTICAST=y |
376 | # CONFIG_IP_ADVANCED_ROUTER is not set | 393 | # CONFIG_IP_ADVANCED_ROUTER is not set |
394 | CONFIG_IP_FIB_HASH=y | ||
377 | # CONFIG_IP_PNP is not set | 395 | # CONFIG_IP_PNP is not set |
378 | # CONFIG_NET_IPIP is not set | 396 | # CONFIG_NET_IPIP is not set |
379 | # CONFIG_NET_IPGRE is not set | 397 | # CONFIG_NET_IPGRE is not set |
@@ -386,6 +404,8 @@ CONFIG_IP_MULTICAST=y | |||
386 | # CONFIG_INET_TUNNEL is not set | 404 | # CONFIG_INET_TUNNEL is not set |
387 | # CONFIG_IP_TCPDIAG is not set | 405 | # CONFIG_IP_TCPDIAG is not set |
388 | # CONFIG_IP_TCPDIAG_IPV6 is not set | 406 | # CONFIG_IP_TCPDIAG_IPV6 is not set |
407 | # CONFIG_TCP_CONG_ADVANCED is not set | ||
408 | CONFIG_TCP_CONG_BIC=y | ||
389 | 409 | ||
390 | # | 410 | # |
391 | # IP: Virtual Server Configuration | 411 | # IP: Virtual Server Configuration |
@@ -405,8 +425,6 @@ CONFIG_NETFILTER=y | |||
405 | CONFIG_IP_NF_ARPTABLES=y | 425 | CONFIG_IP_NF_ARPTABLES=y |
406 | # CONFIG_IP_NF_ARPFILTER is not set | 426 | # CONFIG_IP_NF_ARPFILTER is not set |
407 | # CONFIG_IP_NF_ARP_MANGLE is not set | 427 | # CONFIG_IP_NF_ARP_MANGLE is not set |
408 | # CONFIG_IP_NF_COMPAT_IPCHAINS is not set | ||
409 | # CONFIG_IP_NF_COMPAT_IPFWADM is not set | ||
410 | 428 | ||
411 | # | 429 | # |
412 | # SCTP Configuration (EXPERIMENTAL) | 430 | # SCTP Configuration (EXPERIMENTAL) |
@@ -483,7 +501,6 @@ CONFIG_NET_PCI=y | |||
483 | # CONFIG_DGRS is not set | 501 | # CONFIG_DGRS is not set |
484 | # CONFIG_EEPRO100 is not set | 502 | # CONFIG_EEPRO100 is not set |
485 | CONFIG_E100=y | 503 | CONFIG_E100=y |
486 | # CONFIG_E100_NAPI is not set | ||
487 | # CONFIG_FEALNX is not set | 504 | # CONFIG_FEALNX is not set |
488 | # CONFIG_NATSEMI is not set | 505 | # CONFIG_NATSEMI is not set |
489 | # CONFIG_NE2K_PCI is not set | 506 | # CONFIG_NE2K_PCI is not set |
@@ -505,9 +522,11 @@ CONFIG_E1000=y | |||
505 | # CONFIG_HAMACHI is not set | 522 | # CONFIG_HAMACHI is not set |
506 | # CONFIG_YELLOWFIN is not set | 523 | # CONFIG_YELLOWFIN is not set |
507 | # CONFIG_R8169 is not set | 524 | # CONFIG_R8169 is not set |
525 | # CONFIG_SKGE is not set | ||
508 | # CONFIG_SK98LIN is not set | 526 | # CONFIG_SK98LIN is not set |
509 | # CONFIG_VIA_VELOCITY is not set | 527 | # CONFIG_VIA_VELOCITY is not set |
510 | CONFIG_TIGON3=y | 528 | CONFIG_TIGON3=y |
529 | # CONFIG_BNX2 is not set | ||
511 | 530 | ||
512 | # | 531 | # |
513 | # Ethernet (10000 Mbit) | 532 | # Ethernet (10000 Mbit) |
@@ -565,18 +584,6 @@ CONFIG_INPUT_EVDEV=y | |||
565 | # CONFIG_INPUT_EVBUG is not set | 584 | # CONFIG_INPUT_EVBUG is not set |
566 | 585 | ||
567 | # | 586 | # |
568 | # Input I/O drivers | ||
569 | # | ||
570 | # CONFIG_GAMEPORT is not set | ||
571 | CONFIG_SOUND_GAMEPORT=y | ||
572 | CONFIG_SERIO=y | ||
573 | # CONFIG_SERIO_I8042 is not set | ||
574 | # CONFIG_SERIO_SERPORT is not set | ||
575 | # CONFIG_SERIO_CT82C710 is not set | ||
576 | # CONFIG_SERIO_PCIPS2 is not set | ||
577 | # CONFIG_SERIO_RAW is not set | ||
578 | |||
579 | # | ||
580 | # Input Device Drivers | 587 | # Input Device Drivers |
581 | # | 588 | # |
582 | # CONFIG_INPUT_KEYBOARD is not set | 589 | # CONFIG_INPUT_KEYBOARD is not set |
@@ -586,6 +593,16 @@ CONFIG_SERIO=y | |||
586 | # CONFIG_INPUT_MISC is not set | 593 | # CONFIG_INPUT_MISC is not set |
587 | 594 | ||
588 | # | 595 | # |
596 | # Hardware I/O ports | ||
597 | # | ||
598 | CONFIG_SERIO=y | ||
599 | # CONFIG_SERIO_I8042 is not set | ||
600 | # CONFIG_SERIO_SERPORT is not set | ||
601 | # CONFIG_SERIO_PCIPS2 is not set | ||
602 | # CONFIG_SERIO_RAW is not set | ||
603 | # CONFIG_GAMEPORT is not set | ||
604 | |||
605 | # | ||
589 | # Character devices | 606 | # Character devices |
590 | # | 607 | # |
591 | CONFIG_VT=y | 608 | CONFIG_VT=y |
@@ -603,7 +620,6 @@ CONFIG_SERIAL_8250_NR_UARTS=8 | |||
603 | CONFIG_SERIAL_8250_EXTENDED=y | 620 | CONFIG_SERIAL_8250_EXTENDED=y |
604 | CONFIG_SERIAL_8250_SHARE_IRQ=y | 621 | CONFIG_SERIAL_8250_SHARE_IRQ=y |
605 | # CONFIG_SERIAL_8250_DETECT_IRQ is not set | 622 | # CONFIG_SERIAL_8250_DETECT_IRQ is not set |
606 | # CONFIG_SERIAL_8250_MULTIPORT is not set | ||
607 | # CONFIG_SERIAL_8250_RSA is not set | 623 | # CONFIG_SERIAL_8250_RSA is not set |
608 | 624 | ||
609 | # | 625 | # |
@@ -611,6 +627,7 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y | |||
611 | # | 627 | # |
612 | CONFIG_SERIAL_CORE=y | 628 | CONFIG_SERIAL_CORE=y |
613 | CONFIG_SERIAL_CORE_CONSOLE=y | 629 | CONFIG_SERIAL_CORE_CONSOLE=y |
630 | # CONFIG_SERIAL_JSM is not set | ||
614 | CONFIG_UNIX98_PTYS=y | 631 | CONFIG_UNIX98_PTYS=y |
615 | CONFIG_LEGACY_PTYS=y | 632 | CONFIG_LEGACY_PTYS=y |
616 | CONFIG_LEGACY_PTY_COUNT=256 | 633 | CONFIG_LEGACY_PTY_COUNT=256 |
@@ -644,6 +661,12 @@ CONFIG_DRM_RADEON=y | |||
644 | # CONFIG_DRM_SIS is not set | 661 | # CONFIG_DRM_SIS is not set |
645 | # CONFIG_RAW_DRIVER is not set | 662 | # CONFIG_RAW_DRIVER is not set |
646 | # CONFIG_HPET is not set | 663 | # CONFIG_HPET is not set |
664 | # CONFIG_HANGCHECK_TIMER is not set | ||
665 | |||
666 | # | ||
667 | # TPM devices | ||
668 | # | ||
669 | # CONFIG_TCG_TPM is not set | ||
647 | 670 | ||
648 | # | 671 | # |
649 | # I2C support | 672 | # I2C support |
@@ -668,6 +691,7 @@ CONFIG_I2C_ALGOPCF=y | |||
668 | # CONFIG_I2C_AMD8111 is not set | 691 | # CONFIG_I2C_AMD8111 is not set |
669 | # CONFIG_I2C_I801 is not set | 692 | # CONFIG_I2C_I801 is not set |
670 | # CONFIG_I2C_I810 is not set | 693 | # CONFIG_I2C_I810 is not set |
694 | # CONFIG_I2C_PIIX4 is not set | ||
671 | # CONFIG_I2C_ISA is not set | 695 | # CONFIG_I2C_ISA is not set |
672 | # CONFIG_I2C_NFORCE2 is not set | 696 | # CONFIG_I2C_NFORCE2 is not set |
673 | # CONFIG_I2C_PARPORT_LIGHT is not set | 697 | # CONFIG_I2C_PARPORT_LIGHT is not set |
@@ -691,10 +715,14 @@ CONFIG_I2C_ALGOPCF=y | |||
691 | # CONFIG_SENSORS_ADM1025 is not set | 715 | # CONFIG_SENSORS_ADM1025 is not set |
692 | # CONFIG_SENSORS_ADM1026 is not set | 716 | # CONFIG_SENSORS_ADM1026 is not set |
693 | # CONFIG_SENSORS_ADM1031 is not set | 717 | # CONFIG_SENSORS_ADM1031 is not set |
718 | # CONFIG_SENSORS_ADM9240 is not set | ||
694 | # CONFIG_SENSORS_ASB100 is not set | 719 | # CONFIG_SENSORS_ASB100 is not set |
720 | # CONFIG_SENSORS_ATXP1 is not set | ||
695 | # CONFIG_SENSORS_DS1621 is not set | 721 | # CONFIG_SENSORS_DS1621 is not set |
696 | # CONFIG_SENSORS_FSCHER is not set | 722 | # CONFIG_SENSORS_FSCHER is not set |
723 | # CONFIG_SENSORS_FSCPOS is not set | ||
697 | # CONFIG_SENSORS_GL518SM is not set | 724 | # CONFIG_SENSORS_GL518SM is not set |
725 | # CONFIG_SENSORS_GL520SM is not set | ||
698 | # CONFIG_SENSORS_IT87 is not set | 726 | # CONFIG_SENSORS_IT87 is not set |
699 | # CONFIG_SENSORS_LM63 is not set | 727 | # CONFIG_SENSORS_LM63 is not set |
700 | # CONFIG_SENSORS_LM75 is not set | 728 | # CONFIG_SENSORS_LM75 is not set |
@@ -705,21 +733,29 @@ CONFIG_I2C_ALGOPCF=y | |||
705 | # CONFIG_SENSORS_LM85 is not set | 733 | # CONFIG_SENSORS_LM85 is not set |
706 | # CONFIG_SENSORS_LM87 is not set | 734 | # CONFIG_SENSORS_LM87 is not set |
707 | # CONFIG_SENSORS_LM90 is not set | 735 | # CONFIG_SENSORS_LM90 is not set |
736 | # CONFIG_SENSORS_LM92 is not set | ||
708 | # CONFIG_SENSORS_MAX1619 is not set | 737 | # CONFIG_SENSORS_MAX1619 is not set |
709 | # CONFIG_SENSORS_PC87360 is not set | 738 | # CONFIG_SENSORS_PC87360 is not set |
739 | # CONFIG_SENSORS_SMSC47B397 is not set | ||
740 | # CONFIG_SENSORS_SIS5595 is not set | ||
710 | # CONFIG_SENSORS_SMSC47M1 is not set | 741 | # CONFIG_SENSORS_SMSC47M1 is not set |
711 | # CONFIG_SENSORS_VIA686A is not set | 742 | # CONFIG_SENSORS_VIA686A is not set |
712 | # CONFIG_SENSORS_W83781D is not set | 743 | # CONFIG_SENSORS_W83781D is not set |
713 | # CONFIG_SENSORS_W83L785TS is not set | 744 | # CONFIG_SENSORS_W83L785TS is not set |
714 | # CONFIG_SENSORS_W83627HF is not set | 745 | # CONFIG_SENSORS_W83627HF is not set |
746 | # CONFIG_SENSORS_W83627EHF is not set | ||
715 | 747 | ||
716 | # | 748 | # |
717 | # Other I2C Chip support | 749 | # Other I2C Chip support |
718 | # | 750 | # |
751 | # CONFIG_SENSORS_DS1337 is not set | ||
752 | # CONFIG_SENSORS_DS1374 is not set | ||
719 | # CONFIG_SENSORS_EEPROM is not set | 753 | # CONFIG_SENSORS_EEPROM is not set |
720 | # CONFIG_SENSORS_PCF8574 is not set | 754 | # CONFIG_SENSORS_PCF8574 is not set |
755 | # CONFIG_SENSORS_PCA9539 is not set | ||
721 | # CONFIG_SENSORS_PCF8591 is not set | 756 | # CONFIG_SENSORS_PCF8591 is not set |
722 | # CONFIG_SENSORS_RTC8564 is not set | 757 | # CONFIG_SENSORS_RTC8564 is not set |
758 | # CONFIG_SENSORS_MAX6875 is not set | ||
723 | # CONFIG_I2C_DEBUG_CORE is not set | 759 | # CONFIG_I2C_DEBUG_CORE is not set |
724 | # CONFIG_I2C_DEBUG_ALGO is not set | 760 | # CONFIG_I2C_DEBUG_ALGO is not set |
725 | # CONFIG_I2C_DEBUG_BUS is not set | 761 | # CONFIG_I2C_DEBUG_BUS is not set |
@@ -746,6 +782,7 @@ CONFIG_VIDEO_DEV=y | |||
746 | # | 782 | # |
747 | # Video Adapters | 783 | # Video Adapters |
748 | # | 784 | # |
785 | # CONFIG_TUNER_MULTI_I2C is not set | ||
749 | # CONFIG_VIDEO_BT848 is not set | 786 | # CONFIG_VIDEO_BT848 is not set |
750 | # CONFIG_VIDEO_CPIA is not set | 787 | # CONFIG_VIDEO_CPIA is not set |
751 | # CONFIG_VIDEO_SAA5246A is not set | 788 | # CONFIG_VIDEO_SAA5246A is not set |
@@ -778,6 +815,11 @@ CONFIG_VIDEO_DEV=y | |||
778 | # Graphics support | 815 | # Graphics support |
779 | # | 816 | # |
780 | CONFIG_FB=y | 817 | CONFIG_FB=y |
818 | CONFIG_FB_CFB_FILLRECT=y | ||
819 | CONFIG_FB_CFB_COPYAREA=y | ||
820 | CONFIG_FB_CFB_IMAGEBLIT=y | ||
821 | CONFIG_FB_SOFT_CURSOR=y | ||
822 | # CONFIG_FB_MACMODES is not set | ||
781 | CONFIG_FB_MODE_HELPERS=y | 823 | CONFIG_FB_MODE_HELPERS=y |
782 | # CONFIG_FB_TILEBLITTING is not set | 824 | # CONFIG_FB_TILEBLITTING is not set |
783 | # CONFIG_FB_CIRRUS is not set | 825 | # CONFIG_FB_CIRRUS is not set |
@@ -785,6 +827,7 @@ CONFIG_FB_MODE_HELPERS=y | |||
785 | # CONFIG_FB_CYBER2000 is not set | 827 | # CONFIG_FB_CYBER2000 is not set |
786 | # CONFIG_FB_ASILIANT is not set | 828 | # CONFIG_FB_ASILIANT is not set |
787 | # CONFIG_FB_IMSTT is not set | 829 | # CONFIG_FB_IMSTT is not set |
830 | # CONFIG_FB_NVIDIA is not set | ||
788 | # CONFIG_FB_RIVA is not set | 831 | # CONFIG_FB_RIVA is not set |
789 | # CONFIG_FB_MATROX is not set | 832 | # CONFIG_FB_MATROX is not set |
790 | # CONFIG_FB_RADEON_OLD is not set | 833 | # CONFIG_FB_RADEON_OLD is not set |
@@ -801,6 +844,7 @@ CONFIG_FB_RADEON_DEBUG=y | |||
801 | # CONFIG_FB_VOODOO1 is not set | 844 | # CONFIG_FB_VOODOO1 is not set |
802 | # CONFIG_FB_TRIDENT is not set | 845 | # CONFIG_FB_TRIDENT is not set |
803 | # CONFIG_FB_PM3 is not set | 846 | # CONFIG_FB_PM3 is not set |
847 | # CONFIG_FB_S1D13XXX is not set | ||
804 | # CONFIG_FB_VIRTUAL is not set | 848 | # CONFIG_FB_VIRTUAL is not set |
805 | 849 | ||
806 | # | 850 | # |
@@ -820,6 +864,7 @@ CONFIG_LOGO=y | |||
820 | # CONFIG_LOGO_LINUX_MONO is not set | 864 | # CONFIG_LOGO_LINUX_MONO is not set |
821 | # CONFIG_LOGO_LINUX_VGA16 is not set | 865 | # CONFIG_LOGO_LINUX_VGA16 is not set |
822 | CONFIG_LOGO_LINUX_CLUT224=y | 866 | CONFIG_LOGO_LINUX_CLUT224=y |
867 | # CONFIG_BACKLIGHT_LCD_SUPPORT is not set | ||
823 | 868 | ||
824 | # | 869 | # |
825 | # Sound | 870 | # Sound |
@@ -869,6 +914,8 @@ CONFIG_SND_AC97_CODEC=y | |||
869 | # CONFIG_SND_CS46XX is not set | 914 | # CONFIG_SND_CS46XX is not set |
870 | # CONFIG_SND_CS4281 is not set | 915 | # CONFIG_SND_CS4281 is not set |
871 | # CONFIG_SND_EMU10K1 is not set | 916 | # CONFIG_SND_EMU10K1 is not set |
917 | # CONFIG_SND_EMU10K1X is not set | ||
918 | # CONFIG_SND_CA0106 is not set | ||
872 | # CONFIG_SND_KORG1212 is not set | 919 | # CONFIG_SND_KORG1212 is not set |
873 | # CONFIG_SND_MIXART is not set | 920 | # CONFIG_SND_MIXART is not set |
874 | # CONFIG_SND_NM256 is not set | 921 | # CONFIG_SND_NM256 is not set |
@@ -876,6 +923,7 @@ CONFIG_SND_AC97_CODEC=y | |||
876 | # CONFIG_SND_RME96 is not set | 923 | # CONFIG_SND_RME96 is not set |
877 | # CONFIG_SND_RME9652 is not set | 924 | # CONFIG_SND_RME9652 is not set |
878 | # CONFIG_SND_HDSP is not set | 925 | # CONFIG_SND_HDSP is not set |
926 | # CONFIG_SND_HDSPM is not set | ||
879 | # CONFIG_SND_TRIDENT is not set | 927 | # CONFIG_SND_TRIDENT is not set |
880 | # CONFIG_SND_YMFPCI is not set | 928 | # CONFIG_SND_YMFPCI is not set |
881 | # CONFIG_SND_ALS4000 is not set | 929 | # CONFIG_SND_ALS4000 is not set |
@@ -893,13 +941,14 @@ CONFIG_SND_FM801_TEA575X=y | |||
893 | # CONFIG_SND_INTEL8X0M is not set | 941 | # CONFIG_SND_INTEL8X0M is not set |
894 | # CONFIG_SND_SONICVIBES is not set | 942 | # CONFIG_SND_SONICVIBES is not set |
895 | # CONFIG_SND_VIA82XX is not set | 943 | # CONFIG_SND_VIA82XX is not set |
944 | # CONFIG_SND_VIA82XX_MODEM is not set | ||
896 | # CONFIG_SND_VX222 is not set | 945 | # CONFIG_SND_VX222 is not set |
946 | # CONFIG_SND_HDA_INTEL is not set | ||
897 | 947 | ||
898 | # | 948 | # |
899 | # USB devices | 949 | # USB devices |
900 | # | 950 | # |
901 | # CONFIG_SND_USB_AUDIO is not set | 951 | # CONFIG_SND_USB_AUDIO is not set |
902 | # CONFIG_SND_USB_USX2Y is not set | ||
903 | 952 | ||
904 | # | 953 | # |
905 | # Open Sound System | 954 | # Open Sound System |
@@ -909,6 +958,8 @@ CONFIG_SND_FM801_TEA575X=y | |||
909 | # | 958 | # |
910 | # USB support | 959 | # USB support |
911 | # | 960 | # |
961 | CONFIG_USB_ARCH_HAS_HCD=y | ||
962 | CONFIG_USB_ARCH_HAS_OHCI=y | ||
912 | CONFIG_USB=y | 963 | CONFIG_USB=y |
913 | # CONFIG_USB_DEBUG is not set | 964 | # CONFIG_USB_DEBUG is not set |
914 | 965 | ||
@@ -920,8 +971,6 @@ CONFIG_USB_BANDWIDTH=y | |||
920 | # CONFIG_USB_DYNAMIC_MINORS is not set | 971 | # CONFIG_USB_DYNAMIC_MINORS is not set |
921 | # CONFIG_USB_SUSPEND is not set | 972 | # CONFIG_USB_SUSPEND is not set |
922 | # CONFIG_USB_OTG is not set | 973 | # CONFIG_USB_OTG is not set |
923 | CONFIG_USB_ARCH_HAS_HCD=y | ||
924 | CONFIG_USB_ARCH_HAS_OHCI=y | ||
925 | 974 | ||
926 | # | 975 | # |
927 | # USB Host Controller Drivers | 976 | # USB Host Controller Drivers |
@@ -929,7 +978,10 @@ CONFIG_USB_ARCH_HAS_OHCI=y | |||
929 | CONFIG_USB_EHCI_HCD=y | 978 | CONFIG_USB_EHCI_HCD=y |
930 | # CONFIG_USB_EHCI_SPLIT_ISO is not set | 979 | # CONFIG_USB_EHCI_SPLIT_ISO is not set |
931 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set | 980 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set |
981 | # CONFIG_USB_ISP116X_HCD is not set | ||
932 | CONFIG_USB_OHCI_HCD=y | 982 | CONFIG_USB_OHCI_HCD=y |
983 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set | ||
984 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y | ||
933 | CONFIG_USB_UHCI_HCD=y | 985 | CONFIG_USB_UHCI_HCD=y |
934 | # CONFIG_USB_SL811_HCD is not set | 986 | # CONFIG_USB_SL811_HCD is not set |
935 | 987 | ||
@@ -947,12 +999,11 @@ CONFIG_USB_UHCI_HCD=y | |||
947 | # | 999 | # |
948 | CONFIG_USB_STORAGE=y | 1000 | CONFIG_USB_STORAGE=y |
949 | # CONFIG_USB_STORAGE_DEBUG is not set | 1001 | # CONFIG_USB_STORAGE_DEBUG is not set |
950 | # CONFIG_USB_STORAGE_RW_DETECT is not set | ||
951 | # CONFIG_USB_STORAGE_DATAFAB is not set | 1002 | # CONFIG_USB_STORAGE_DATAFAB is not set |
952 | # CONFIG_USB_STORAGE_FREECOM is not set | 1003 | # CONFIG_USB_STORAGE_FREECOM is not set |
953 | # CONFIG_USB_STORAGE_ISD200 is not set | 1004 | # CONFIG_USB_STORAGE_ISD200 is not set |
954 | # CONFIG_USB_STORAGE_DPCM is not set | 1005 | # CONFIG_USB_STORAGE_DPCM is not set |
955 | # CONFIG_USB_STORAGE_HP8200e is not set | 1006 | # CONFIG_USB_STORAGE_USBAT is not set |
956 | # CONFIG_USB_STORAGE_SDDR09 is not set | 1007 | # CONFIG_USB_STORAGE_SDDR09 is not set |
957 | # CONFIG_USB_STORAGE_SDDR55 is not set | 1008 | # CONFIG_USB_STORAGE_SDDR55 is not set |
958 | # CONFIG_USB_STORAGE_JUMPSHOT is not set | 1009 | # CONFIG_USB_STORAGE_JUMPSHOT is not set |
@@ -966,9 +1017,11 @@ CONFIG_USB_HIDINPUT=y | |||
966 | CONFIG_USB_HIDDEV=y | 1017 | CONFIG_USB_HIDDEV=y |
967 | # CONFIG_USB_AIPTEK is not set | 1018 | # CONFIG_USB_AIPTEK is not set |
968 | # CONFIG_USB_WACOM is not set | 1019 | # CONFIG_USB_WACOM is not set |
1020 | # CONFIG_USB_ACECAD is not set | ||
969 | # CONFIG_USB_KBTAB is not set | 1021 | # CONFIG_USB_KBTAB is not set |
970 | # CONFIG_USB_POWERMATE is not set | 1022 | # CONFIG_USB_POWERMATE is not set |
971 | # CONFIG_USB_MTOUCH is not set | 1023 | # CONFIG_USB_MTOUCH is not set |
1024 | # CONFIG_USB_ITMTOUCH is not set | ||
972 | # CONFIG_USB_EGALAX is not set | 1025 | # CONFIG_USB_EGALAX is not set |
973 | # CONFIG_USB_XPAD is not set | 1026 | # CONFIG_USB_XPAD is not set |
974 | # CONFIG_USB_ATI_REMOTE is not set | 1027 | # CONFIG_USB_ATI_REMOTE is not set |
@@ -978,7 +1031,6 @@ CONFIG_USB_HIDDEV=y | |||
978 | # | 1031 | # |
979 | # CONFIG_USB_MDC800 is not set | 1032 | # CONFIG_USB_MDC800 is not set |
980 | # CONFIG_USB_MICROTEK is not set | 1033 | # CONFIG_USB_MICROTEK is not set |
981 | # CONFIG_USB_HPUSBSCSI is not set | ||
982 | 1034 | ||
983 | # | 1035 | # |
984 | # USB Multimedia devices | 1036 | # USB Multimedia devices |
@@ -992,6 +1044,7 @@ CONFIG_USB_HIDDEV=y | |||
992 | # CONFIG_USB_SE401 is not set | 1044 | # CONFIG_USB_SE401 is not set |
993 | # CONFIG_USB_SN9C102 is not set | 1045 | # CONFIG_USB_SN9C102 is not set |
994 | # CONFIG_USB_STV680 is not set | 1046 | # CONFIG_USB_STV680 is not set |
1047 | # CONFIG_USB_PWC is not set | ||
995 | 1048 | ||
996 | # | 1049 | # |
997 | # USB Network Adapters | 1050 | # USB Network Adapters |
@@ -1001,6 +1054,7 @@ CONFIG_USB_HIDDEV=y | |||
1001 | # CONFIG_USB_PEGASUS is not set | 1054 | # CONFIG_USB_PEGASUS is not set |
1002 | # CONFIG_USB_RTL8150 is not set | 1055 | # CONFIG_USB_RTL8150 is not set |
1003 | # CONFIG_USB_USBNET is not set | 1056 | # CONFIG_USB_USBNET is not set |
1057 | CONFIG_USB_MON=y | ||
1004 | 1058 | ||
1005 | # | 1059 | # |
1006 | # USB port drivers | 1060 | # USB port drivers |
@@ -1016,7 +1070,6 @@ CONFIG_USB_HIDDEV=y | |||
1016 | # | 1070 | # |
1017 | # CONFIG_USB_EMI62 is not set | 1071 | # CONFIG_USB_EMI62 is not set |
1018 | # CONFIG_USB_EMI26 is not set | 1072 | # CONFIG_USB_EMI26 is not set |
1019 | # CONFIG_USB_TIGL is not set | ||
1020 | # CONFIG_USB_AUERSWALD is not set | 1073 | # CONFIG_USB_AUERSWALD is not set |
1021 | # CONFIG_USB_RIO500 is not set | 1074 | # CONFIG_USB_RIO500 is not set |
1022 | # CONFIG_USB_LEGOTOWER is not set | 1075 | # CONFIG_USB_LEGOTOWER is not set |
@@ -1025,9 +1078,11 @@ CONFIG_USB_HIDDEV=y | |||
1025 | # CONFIG_USB_CYTHERM is not set | 1078 | # CONFIG_USB_CYTHERM is not set |
1026 | # CONFIG_USB_PHIDGETKIT is not set | 1079 | # CONFIG_USB_PHIDGETKIT is not set |
1027 | # CONFIG_USB_PHIDGETSERVO is not set | 1080 | # CONFIG_USB_PHIDGETSERVO is not set |
1081 | # CONFIG_USB_IDMOUSE is not set | ||
1082 | # CONFIG_USB_SISUSBVGA is not set | ||
1028 | 1083 | ||
1029 | # | 1084 | # |
1030 | # USB ATM/DSL drivers | 1085 | # USB DSL modem support |
1031 | # | 1086 | # |
1032 | 1087 | ||
1033 | # | 1088 | # |
@@ -1041,12 +1096,22 @@ CONFIG_USB_HIDDEV=y | |||
1041 | # CONFIG_MMC is not set | 1096 | # CONFIG_MMC is not set |
1042 | 1097 | ||
1043 | # | 1098 | # |
1099 | # InfiniBand support | ||
1100 | # | ||
1101 | # CONFIG_INFINIBAND is not set | ||
1102 | |||
1103 | # | ||
1104 | # SN Devices | ||
1105 | # | ||
1106 | |||
1107 | # | ||
1044 | # File systems | 1108 | # File systems |
1045 | # | 1109 | # |
1046 | CONFIG_EXT2_FS=y | 1110 | CONFIG_EXT2_FS=y |
1047 | CONFIG_EXT2_FS_XATTR=y | 1111 | CONFIG_EXT2_FS_XATTR=y |
1048 | # CONFIG_EXT2_FS_POSIX_ACL is not set | 1112 | # CONFIG_EXT2_FS_POSIX_ACL is not set |
1049 | # CONFIG_EXT2_FS_SECURITY is not set | 1113 | # CONFIG_EXT2_FS_SECURITY is not set |
1114 | # CONFIG_EXT2_FS_XIP is not set | ||
1050 | CONFIG_EXT3_FS=y | 1115 | CONFIG_EXT3_FS=y |
1051 | CONFIG_EXT3_FS_XATTR=y | 1116 | CONFIG_EXT3_FS_XATTR=y |
1052 | # CONFIG_EXT3_FS_POSIX_ACL is not set | 1117 | # CONFIG_EXT3_FS_POSIX_ACL is not set |
@@ -1056,6 +1121,10 @@ CONFIG_JBD=y | |||
1056 | CONFIG_FS_MBCACHE=y | 1121 | CONFIG_FS_MBCACHE=y |
1057 | # CONFIG_REISERFS_FS is not set | 1122 | # CONFIG_REISERFS_FS is not set |
1058 | # CONFIG_JFS_FS is not set | 1123 | # CONFIG_JFS_FS is not set |
1124 | |||
1125 | # | ||
1126 | # XFS support | ||
1127 | # | ||
1059 | # CONFIG_XFS_FS is not set | 1128 | # CONFIG_XFS_FS is not set |
1060 | # CONFIG_MINIX_FS is not set | 1129 | # CONFIG_MINIX_FS is not set |
1061 | # CONFIG_ROMFS_FS is not set | 1130 | # CONFIG_ROMFS_FS is not set |
@@ -1089,7 +1158,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" | |||
1089 | CONFIG_PROC_FS=y | 1158 | CONFIG_PROC_FS=y |
1090 | CONFIG_PROC_KCORE=y | 1159 | CONFIG_PROC_KCORE=y |
1091 | CONFIG_SYSFS=y | 1160 | CONFIG_SYSFS=y |
1092 | # CONFIG_DEVFS_FS is not set | ||
1093 | # CONFIG_DEVPTS_FS_XATTR is not set | 1161 | # CONFIG_DEVPTS_FS_XATTR is not set |
1094 | CONFIG_TMPFS=y | 1162 | CONFIG_TMPFS=y |
1095 | CONFIG_TMPFS_XATTR=y | 1163 | CONFIG_TMPFS_XATTR=y |
@@ -1120,15 +1188,18 @@ CONFIG_RAMFS=y | |||
1120 | # | 1188 | # |
1121 | CONFIG_NFS_FS=y | 1189 | CONFIG_NFS_FS=y |
1122 | CONFIG_NFS_V3=y | 1190 | CONFIG_NFS_V3=y |
1191 | # CONFIG_NFS_V3_ACL is not set | ||
1123 | CONFIG_NFS_V4=y | 1192 | CONFIG_NFS_V4=y |
1124 | # CONFIG_NFS_DIRECTIO is not set | 1193 | # CONFIG_NFS_DIRECTIO is not set |
1125 | CONFIG_NFSD=y | 1194 | CONFIG_NFSD=y |
1126 | CONFIG_NFSD_V3=y | 1195 | CONFIG_NFSD_V3=y |
1196 | # CONFIG_NFSD_V3_ACL is not set | ||
1127 | # CONFIG_NFSD_V4 is not set | 1197 | # CONFIG_NFSD_V4 is not set |
1128 | # CONFIG_NFSD_TCP is not set | 1198 | # CONFIG_NFSD_TCP is not set |
1129 | CONFIG_LOCKD=y | 1199 | CONFIG_LOCKD=y |
1130 | CONFIG_LOCKD_V4=y | 1200 | CONFIG_LOCKD_V4=y |
1131 | CONFIG_EXPORTFS=y | 1201 | CONFIG_EXPORTFS=y |
1202 | CONFIG_NFS_COMMON=y | ||
1132 | CONFIG_SUNRPC=y | 1203 | CONFIG_SUNRPC=y |
1133 | CONFIG_SUNRPC_GSS=y | 1204 | CONFIG_SUNRPC_GSS=y |
1134 | CONFIG_RPCSEC_GSS_KRB5=y | 1205 | CONFIG_RPCSEC_GSS_KRB5=y |
@@ -1209,6 +1280,8 @@ CONFIG_NLS_UTF8=y | |||
1209 | # CONFIG_CRC_CCITT is not set | 1280 | # CONFIG_CRC_CCITT is not set |
1210 | CONFIG_CRC32=y | 1281 | CONFIG_CRC32=y |
1211 | # CONFIG_LIBCRC32C is not set | 1282 | # CONFIG_LIBCRC32C is not set |
1283 | CONFIG_GENERIC_HARDIRQS=y | ||
1284 | CONFIG_GENERIC_IRQ_PROBE=y | ||
1212 | 1285 | ||
1213 | # | 1286 | # |
1214 | # Profiling support | 1287 | # Profiling support |
@@ -1218,14 +1291,18 @@ CONFIG_CRC32=y | |||
1218 | # | 1291 | # |
1219 | # Kernel hacking | 1292 | # Kernel hacking |
1220 | # | 1293 | # |
1294 | # CONFIG_PRINTK_TIME is not set | ||
1221 | CONFIG_DEBUG_KERNEL=y | 1295 | CONFIG_DEBUG_KERNEL=y |
1222 | CONFIG_MAGIC_SYSRQ=y | 1296 | CONFIG_MAGIC_SYSRQ=y |
1297 | CONFIG_LOG_BUF_SHIFT=17 | ||
1223 | # CONFIG_SCHEDSTATS is not set | 1298 | # CONFIG_SCHEDSTATS is not set |
1224 | # CONFIG_DEBUG_SLAB is not set | 1299 | # CONFIG_DEBUG_SLAB is not set |
1225 | # CONFIG_DEBUG_SPINLOCK is not set | 1300 | # CONFIG_DEBUG_SPINLOCK is not set |
1226 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | 1301 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set |
1227 | # CONFIG_DEBUG_KOBJECT is not set | 1302 | # CONFIG_DEBUG_KOBJECT is not set |
1228 | # CONFIG_DEBUG_INFO is not set | 1303 | # CONFIG_DEBUG_INFO is not set |
1304 | # CONFIG_DEBUG_FS is not set | ||
1305 | CONFIG_KPROBES=y | ||
1229 | CONFIG_IA64_GRANULE_16MB=y | 1306 | CONFIG_IA64_GRANULE_16MB=y |
1230 | # CONFIG_IA64_GRANULE_64MB is not set | 1307 | # CONFIG_IA64_GRANULE_64MB is not set |
1231 | CONFIG_IA64_PRINT_HAZARDS=y | 1308 | CONFIG_IA64_PRINT_HAZARDS=y |
@@ -1252,6 +1329,7 @@ CONFIG_CRYPTO_MD5=y | |||
1252 | # CONFIG_CRYPTO_SHA256 is not set | 1329 | # CONFIG_CRYPTO_SHA256 is not set |
1253 | # CONFIG_CRYPTO_SHA512 is not set | 1330 | # CONFIG_CRYPTO_SHA512 is not set |
1254 | # CONFIG_CRYPTO_WP512 is not set | 1331 | # CONFIG_CRYPTO_WP512 is not set |
1332 | # CONFIG_CRYPTO_TGR192 is not set | ||
1255 | CONFIG_CRYPTO_DES=y | 1333 | CONFIG_CRYPTO_DES=y |
1256 | # CONFIG_CRYPTO_BLOWFISH is not set | 1334 | # CONFIG_CRYPTO_BLOWFISH is not set |
1257 | # CONFIG_CRYPTO_TWOFISH is not set | 1335 | # CONFIG_CRYPTO_TWOFISH is not set |
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index b8db6e3e5e81..11957598a8b9 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
@@ -156,10 +156,13 @@ | |||
156 | */ | 156 | */ |
157 | #define DELAYED_RESOURCE_CNT 64 | 157 | #define DELAYED_RESOURCE_CNT 64 |
158 | 158 | ||
159 | #define PCI_DEVICE_ID_HP_SX2000_IOC 0x12ec | ||
160 | |||
159 | #define ZX1_IOC_ID ((PCI_DEVICE_ID_HP_ZX1_IOC << 16) | PCI_VENDOR_ID_HP) | 161 | #define ZX1_IOC_ID ((PCI_DEVICE_ID_HP_ZX1_IOC << 16) | PCI_VENDOR_ID_HP) |
160 | #define ZX2_IOC_ID ((PCI_DEVICE_ID_HP_ZX2_IOC << 16) | PCI_VENDOR_ID_HP) | 162 | #define ZX2_IOC_ID ((PCI_DEVICE_ID_HP_ZX2_IOC << 16) | PCI_VENDOR_ID_HP) |
161 | #define REO_IOC_ID ((PCI_DEVICE_ID_HP_REO_IOC << 16) | PCI_VENDOR_ID_HP) | 163 | #define REO_IOC_ID ((PCI_DEVICE_ID_HP_REO_IOC << 16) | PCI_VENDOR_ID_HP) |
162 | #define SX1000_IOC_ID ((PCI_DEVICE_ID_HP_SX1000_IOC << 16) | PCI_VENDOR_ID_HP) | 164 | #define SX1000_IOC_ID ((PCI_DEVICE_ID_HP_SX1000_IOC << 16) | PCI_VENDOR_ID_HP) |
165 | #define SX2000_IOC_ID ((PCI_DEVICE_ID_HP_SX2000_IOC << 16) | PCI_VENDOR_ID_HP) | ||
163 | 166 | ||
164 | #define ZX1_IOC_OFFSET 0x1000 /* ACPI reports SBA, we want IOC */ | 167 | #define ZX1_IOC_OFFSET 0x1000 /* ACPI reports SBA, we want IOC */ |
165 | 168 | ||
@@ -1726,6 +1729,7 @@ static struct ioc_iommu ioc_iommu_info[] __initdata = { | |||
1726 | { ZX1_IOC_ID, "zx1", ioc_zx1_init }, | 1729 | { ZX1_IOC_ID, "zx1", ioc_zx1_init }, |
1727 | { ZX2_IOC_ID, "zx2", NULL }, | 1730 | { ZX2_IOC_ID, "zx2", NULL }, |
1728 | { SX1000_IOC_ID, "sx1000", NULL }, | 1731 | { SX1000_IOC_ID, "sx1000", NULL }, |
1732 | { SX2000_IOC_ID, "sx2000", NULL }, | ||
1729 | }; | 1733 | }; |
1730 | 1734 | ||
1731 | static struct ioc * __init | 1735 | static struct ioc * __init |
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index 786e70718ce4..7a8ae0f4b387 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/serial.h> | 31 | #include <linux/serial.h> |
32 | #include <linux/serialP.h> | 32 | #include <linux/serialP.h> |
33 | #include <linux/sysrq.h> | ||
33 | 34 | ||
34 | #include <asm/irq.h> | 35 | #include <asm/irq.h> |
35 | #include <asm/hw_irq.h> | 36 | #include <asm/hw_irq.h> |
@@ -149,12 +150,17 @@ static void receive_chars(struct tty_struct *tty, struct pt_regs *regs) | |||
149 | seen_esc = 2; | 150 | seen_esc = 2; |
150 | continue; | 151 | continue; |
151 | } else if ( seen_esc == 2 ) { | 152 | } else if ( seen_esc == 2 ) { |
152 | if ( ch == 'P' ) show_state(); /* F1 key */ | 153 | if ( ch == 'P' ) /* F1 */ |
153 | #ifdef CONFIG_KDB | 154 | show_state(); |
154 | if ( ch == 'S' ) | 155 | #ifdef CONFIG_MAGIC_SYSRQ |
155 | kdb(KDB_REASON_KEYBOARD, 0, (kdb_eframe_t) regs); | 156 | if ( ch == 'S' ) { /* F4 */ |
157 | do | ||
158 | ch = ia64_ssc(0, 0, 0, 0, | ||
159 | SSC_GETCHAR); | ||
160 | while (!ch); | ||
161 | handle_sysrq(ch, regs, NULL); | ||
162 | } | ||
156 | #endif | 163 | #endif |
157 | |||
158 | seen_esc = 0; | 164 | seen_esc = 0; |
159 | continue; | 165 | continue; |
160 | } | 166 | } |
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index 72dfd9e7de0f..cda06f88c66e 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c | |||
@@ -236,9 +236,7 @@ acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end) | |||
236 | if (BAD_MADT_ENTRY(iosapic, end)) | 236 | if (BAD_MADT_ENTRY(iosapic, end)) |
237 | return -EINVAL; | 237 | return -EINVAL; |
238 | 238 | ||
239 | iosapic_init(iosapic->address, iosapic->global_irq_base); | 239 | return iosapic_init(iosapic->address, iosapic->global_irq_base); |
240 | |||
241 | return 0; | ||
242 | } | 240 | } |
243 | 241 | ||
244 | 242 | ||
@@ -772,7 +770,7 @@ EXPORT_SYMBOL(acpi_unmap_lsapic); | |||
772 | 770 | ||
773 | 771 | ||
774 | #ifdef CONFIG_ACPI_NUMA | 772 | #ifdef CONFIG_ACPI_NUMA |
775 | acpi_status __init | 773 | acpi_status __devinit |
776 | acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret) | 774 | acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret) |
777 | { | 775 | { |
778 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 776 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; |
@@ -825,4 +823,28 @@ acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret) | |||
825 | return AE_OK; | 823 | return AE_OK; |
826 | } | 824 | } |
827 | #endif /* CONFIG_NUMA */ | 825 | #endif /* CONFIG_NUMA */ |
826 | |||
827 | int | ||
828 | acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base) | ||
829 | { | ||
830 | int err; | ||
831 | |||
832 | if ((err = iosapic_init(phys_addr, gsi_base))) | ||
833 | return err; | ||
834 | |||
835 | #if CONFIG_ACPI_NUMA | ||
836 | acpi_map_iosapic(handle, 0, NULL, NULL); | ||
837 | #endif /* CONFIG_ACPI_NUMA */ | ||
838 | |||
839 | return 0; | ||
840 | } | ||
841 | EXPORT_SYMBOL(acpi_register_ioapic); | ||
842 | |||
843 | int | ||
844 | acpi_unregister_ioapic (acpi_handle handle, u32 gsi_base) | ||
845 | { | ||
846 | return iosapic_remove(gsi_base); | ||
847 | } | ||
848 | EXPORT_SYMBOL(acpi_unregister_ioapic); | ||
849 | |||
828 | #endif /* CONFIG_ACPI_BOOT */ | 850 | #endif /* CONFIG_ACPI_BOOT */ |
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index 785a51b0ad8e..69f88d561d62 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S | |||
@@ -470,18 +470,6 @@ ENTRY(load_switch_stack) | |||
470 | br.cond.sptk.many b7 | 470 | br.cond.sptk.many b7 |
471 | END(load_switch_stack) | 471 | END(load_switch_stack) |
472 | 472 | ||
473 | GLOBAL_ENTRY(__ia64_syscall) | ||
474 | .regstk 6,0,0,0 | ||
475 | mov r15=in5 // put syscall number in place | ||
476 | break __BREAK_SYSCALL | ||
477 | movl r2=errno | ||
478 | cmp.eq p6,p7=-1,r10 | ||
479 | ;; | ||
480 | (p6) st4 [r2]=r8 | ||
481 | (p6) mov r8=-1 | ||
482 | br.ret.sptk.many rp | ||
483 | END(__ia64_syscall) | ||
484 | |||
485 | GLOBAL_ENTRY(execve) | 473 | GLOBAL_ENTRY(execve) |
486 | mov r15=__NR_execve // put syscall number in place | 474 | mov r15=__NR_execve // put syscall number in place |
487 | break __BREAK_SYSCALL | 475 | break __BREAK_SYSCALL |
@@ -637,7 +625,7 @@ END(ia64_ret_from_syscall) | |||
637 | * r8-r11: restored (syscall return value(s)) | 625 | * r8-r11: restored (syscall return value(s)) |
638 | * r12: restored (user-level stack pointer) | 626 | * r12: restored (user-level stack pointer) |
639 | * r13: restored (user-level thread pointer) | 627 | * r13: restored (user-level thread pointer) |
640 | * r14: cleared | 628 | * r14: set to __kernel_syscall_via_epc |
641 | * r15: restored (syscall #) | 629 | * r15: restored (syscall #) |
642 | * r16-r17: cleared | 630 | * r16-r17: cleared |
643 | * r18: user-level b6 | 631 | * r18: user-level b6 |
@@ -658,7 +646,7 @@ END(ia64_ret_from_syscall) | |||
658 | * pr: restored (user-level pr) | 646 | * pr: restored (user-level pr) |
659 | * b0: restored (user-level rp) | 647 | * b0: restored (user-level rp) |
660 | * b6: restored | 648 | * b6: restored |
661 | * b7: cleared | 649 | * b7: set to __kernel_syscall_via_epc |
662 | * ar.unat: restored (user-level ar.unat) | 650 | * ar.unat: restored (user-level ar.unat) |
663 | * ar.pfs: restored (user-level ar.pfs) | 651 | * ar.pfs: restored (user-level ar.pfs) |
664 | * ar.rsc: restored (user-level ar.rsc) | 652 | * ar.rsc: restored (user-level ar.rsc) |
@@ -704,72 +692,79 @@ ENTRY(ia64_leave_syscall) | |||
704 | ;; | 692 | ;; |
705 | (p6) ld4 r31=[r18] // load current_thread_info()->flags | 693 | (p6) ld4 r31=[r18] // load current_thread_info()->flags |
706 | ld8 r19=[r2],PT(B6)-PT(LOADRS) // load ar.rsc value for "loadrs" | 694 | ld8 r19=[r2],PT(B6)-PT(LOADRS) // load ar.rsc value for "loadrs" |
707 | mov b7=r0 // clear b7 | 695 | nop.i 0 |
708 | ;; | 696 | ;; |
709 | ld8 r23=[r3],PT(R11)-PT(AR_BSPSTORE) // load ar.bspstore (may be garbage) | 697 | mov r16=ar.bsp // M2 get existing backing store pointer |
710 | ld8 r18=[r2],PT(R9)-PT(B6) // load b6 | 698 | ld8 r18=[r2],PT(R9)-PT(B6) // load b6 |
711 | (p6) and r15=TIF_WORK_MASK,r31 // any work other than TIF_SYSCALL_TRACE? | 699 | (p6) and r15=TIF_WORK_MASK,r31 // any work other than TIF_SYSCALL_TRACE? |
712 | ;; | 700 | ;; |
713 | mov r16=ar.bsp // M2 get existing backing store pointer | 701 | ld8 r23=[r3],PT(R11)-PT(AR_BSPSTORE) // load ar.bspstore (may be garbage) |
714 | (p6) cmp4.ne.unc p6,p0=r15, r0 // any special work pending? | 702 | (p6) cmp4.ne.unc p6,p0=r15, r0 // any special work pending? |
715 | (p6) br.cond.spnt .work_pending_syscall | 703 | (p6) br.cond.spnt .work_pending_syscall |
716 | ;; | 704 | ;; |
717 | // start restoring the state saved on the kernel stack (struct pt_regs): | 705 | // start restoring the state saved on the kernel stack (struct pt_regs): |
718 | ld8 r9=[r2],PT(CR_IPSR)-PT(R9) | 706 | ld8 r9=[r2],PT(CR_IPSR)-PT(R9) |
719 | ld8 r11=[r3],PT(CR_IIP)-PT(R11) | 707 | ld8 r11=[r3],PT(CR_IIP)-PT(R11) |
720 | mov f6=f0 // clear f6 | 708 | (pNonSys) break 0 // bug check: we shouldn't be here if pNonSys is TRUE! |
721 | ;; | 709 | ;; |
722 | invala // M0|1 invalidate ALAT | 710 | invala // M0|1 invalidate ALAT |
723 | rsm psr.i | psr.ic // M2 initiate turning off of interrupt and interruption collection | 711 | rsm psr.i | psr.ic // M2 turn off interrupts and interruption collection |
724 | mov f9=f0 // clear f9 | 712 | cmp.eq p9,p0=r0,r0 // A set p9 to indicate that we should restore cr.ifs |
725 | 713 | ||
726 | ld8 r29=[r2],16 // load cr.ipsr | 714 | ld8 r29=[r2],16 // M0|1 load cr.ipsr |
727 | ld8 r28=[r3],16 // load cr.iip | 715 | ld8 r28=[r3],16 // M0|1 load cr.iip |
728 | mov f8=f0 // clear f8 | 716 | mov r22=r0 // A clear r22 |
729 | ;; | 717 | ;; |
730 | ld8 r30=[r2],16 // M0|1 load cr.ifs | 718 | ld8 r30=[r2],16 // M0|1 load cr.ifs |
731 | ld8 r25=[r3],16 // M0|1 load ar.unat | 719 | ld8 r25=[r3],16 // M0|1 load ar.unat |
732 | cmp.eq p9,p0=r0,r0 // set p9 to indicate that we should restore cr.ifs | 720 | (pUStk) add r14=IA64_TASK_THREAD_ON_USTACK_OFFSET,r13 |
733 | ;; | 721 | ;; |
734 | ld8 r26=[r2],PT(B0)-PT(AR_PFS) // M0|1 load ar.pfs | 722 | ld8 r26=[r2],PT(B0)-PT(AR_PFS) // M0|1 load ar.pfs |
735 | (pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled | 723 | (pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled |
736 | mov f10=f0 // clear f10 | 724 | nop 0 |
737 | ;; | 725 | ;; |
738 | ld8 r21=[r2],PT(AR_RNAT)-PT(B0) // load b0 | 726 | ld8 r21=[r2],PT(AR_RNAT)-PT(B0) // M0|1 load b0 |
739 | ld8 r27=[r3],PT(PR)-PT(AR_RSC) // load ar.rsc | 727 | ld8 r27=[r3],PT(PR)-PT(AR_RSC) // M0|1 load ar.rsc |
740 | mov f11=f0 // clear f11 | 728 | mov f6=f0 // F clear f6 |
741 | ;; | 729 | ;; |
742 | ld8 r24=[r2],PT(AR_FPSR)-PT(AR_RNAT) // load ar.rnat (may be garbage) | 730 | ld8 r24=[r2],PT(AR_FPSR)-PT(AR_RNAT) // M0|1 load ar.rnat (may be garbage) |
743 | ld8 r31=[r3],PT(R1)-PT(PR) // load predicates | 731 | ld8 r31=[r3],PT(R1)-PT(PR) // M0|1 load predicates |
744 | (pUStk) add r14=IA64_TASK_THREAD_ON_USTACK_OFFSET,r13 | 732 | mov f7=f0 // F clear f7 |
745 | ;; | 733 | ;; |
746 | ld8 r20=[r2],PT(R12)-PT(AR_FPSR) // load ar.fpsr | 734 | ld8 r20=[r2],PT(R12)-PT(AR_FPSR) // M0|1 load ar.fpsr |
747 | ld8.fill r1=[r3],16 // load r1 | 735 | ld8.fill r1=[r3],16 // M0|1 load r1 |
748 | (pUStk) mov r17=1 | 736 | (pUStk) mov r17=1 // A |
749 | ;; | 737 | ;; |
750 | srlz.d // M0 ensure interruption collection is off | 738 | (pUStk) st1 [r14]=r17 // M2|3 |
751 | ld8.fill r13=[r3],16 | 739 | ld8.fill r13=[r3],16 // M0|1 |
752 | mov f7=f0 // clear f7 | 740 | mov f8=f0 // F clear f8 |
753 | ;; | 741 | ;; |
754 | ld8.fill r12=[r2] // restore r12 (sp) | 742 | ld8.fill r12=[r2] // M0|1 restore r12 (sp) |
755 | mov.m ar.ssd=r0 // M2 clear ar.ssd | 743 | ld8.fill r15=[r3] // M0|1 restore r15 |
756 | mov r22=r0 // clear r22 | 744 | mov b6=r18 // I0 restore b6 |
757 | 745 | ||
758 | ld8.fill r15=[r3] // restore r15 | 746 | addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0 // A |
759 | (pUStk) st1 [r14]=r17 | 747 | mov f9=f0 // F clear f9 |
760 | addl r3=THIS_CPU(ia64_phys_stacked_size_p8),r0 | 748 | (pKStk) br.cond.dpnt.many skip_rbs_switch // B |
749 | |||
750 | srlz.d // M0 ensure interruption collection is off (for cover) | ||
751 | shr.u r18=r19,16 // I0|1 get byte size of existing "dirty" partition | ||
752 | cover // B add current frame into dirty partition & set cr.ifs | ||
761 | ;; | 753 | ;; |
762 | (pUStk) ld4 r17=[r3] // r17 = cpu_data->phys_stacked_size_p8 | 754 | (pUStk) ld4 r17=[r17] // M0|1 r17 = cpu_data->phys_stacked_size_p8 |
763 | mov.m ar.csd=r0 // M2 clear ar.csd | 755 | mov r19=ar.bsp // M2 get new backing store pointer |
764 | mov b6=r18 // I0 restore b6 | 756 | mov f10=f0 // F clear f10 |
757 | |||
758 | nop.m 0 | ||
759 | movl r14=__kernel_syscall_via_epc // X | ||
765 | ;; | 760 | ;; |
766 | mov r14=r0 // clear r14 | 761 | mov.m ar.csd=r0 // M2 clear ar.csd |
767 | shr.u r18=r19,16 // I0|1 get byte size of existing "dirty" partition | 762 | mov.m ar.ccv=r0 // M2 clear ar.ccv |
768 | (pKStk) br.cond.dpnt.many skip_rbs_switch | 763 | mov b7=r14 // I0 clear b7 (hint with __kernel_syscall_via_epc) |
769 | 764 | ||
770 | mov.m ar.ccv=r0 // clear ar.ccv | 765 | mov.m ar.ssd=r0 // M2 clear ar.ssd |
771 | (pNonSys) br.cond.dpnt.many dont_preserve_current_frame | 766 | mov f11=f0 // F clear f11 |
772 | br.cond.sptk.many rbs_switch | 767 | br.cond.sptk.many rbs_switch // B |
773 | END(ia64_leave_syscall) | 768 | END(ia64_leave_syscall) |
774 | 769 | ||
775 | #ifdef CONFIG_IA32_SUPPORT | 770 | #ifdef CONFIG_IA32_SUPPORT |
@@ -885,7 +880,7 @@ GLOBAL_ENTRY(ia64_leave_kernel) | |||
885 | ldf.fill f7=[r2],PT(F11)-PT(F7) | 880 | ldf.fill f7=[r2],PT(F11)-PT(F7) |
886 | ldf.fill f8=[r3],32 | 881 | ldf.fill f8=[r3],32 |
887 | ;; | 882 | ;; |
888 | srlz.i // ensure interruption collection is off | 883 | srlz.d // ensure that inter. collection is off (VHPT is don't care, since text is pinned) |
889 | mov ar.ccv=r15 | 884 | mov ar.ccv=r15 |
890 | ;; | 885 | ;; |
891 | ldf.fill f11=[r2] | 886 | ldf.fill f11=[r2] |
@@ -945,11 +940,10 @@ GLOBAL_ENTRY(ia64_leave_kernel) | |||
945 | * NOTE: alloc, loadrs, and cover can't be predicated. | 940 | * NOTE: alloc, loadrs, and cover can't be predicated. |
946 | */ | 941 | */ |
947 | (pNonSys) br.cond.dpnt dont_preserve_current_frame | 942 | (pNonSys) br.cond.dpnt dont_preserve_current_frame |
948 | |||
949 | rbs_switch: | ||
950 | cover // add current frame into dirty partition and set cr.ifs | 943 | cover // add current frame into dirty partition and set cr.ifs |
951 | ;; | 944 | ;; |
952 | mov r19=ar.bsp // get new backing store pointer | 945 | mov r19=ar.bsp // get new backing store pointer |
946 | rbs_switch: | ||
953 | sub r16=r16,r18 // krbs = old bsp - size of dirty partition | 947 | sub r16=r16,r18 // krbs = old bsp - size of dirty partition |
954 | cmp.ne p9,p0=r0,r0 // clear p9 to skip restore of cr.ifs | 948 | cmp.ne p9,p0=r0,r0 // clear p9 to skip restore of cr.ifs |
955 | ;; | 949 | ;; |
@@ -1024,14 +1018,14 @@ rse_clear_invalid: | |||
1024 | mov loc5=0 | 1018 | mov loc5=0 |
1025 | mov loc6=0 | 1019 | mov loc6=0 |
1026 | mov loc7=0 | 1020 | mov loc7=0 |
1027 | (pRecurse) br.call.sptk.few b0=rse_clear_invalid | 1021 | (pRecurse) br.call.dptk.few b0=rse_clear_invalid |
1028 | ;; | 1022 | ;; |
1029 | mov loc8=0 | 1023 | mov loc8=0 |
1030 | mov loc9=0 | 1024 | mov loc9=0 |
1031 | cmp.ne pReturn,p0=r0,in1 // if recursion count != 0, we need to do a br.ret | 1025 | cmp.ne pReturn,p0=r0,in1 // if recursion count != 0, we need to do a br.ret |
1032 | mov loc10=0 | 1026 | mov loc10=0 |
1033 | mov loc11=0 | 1027 | mov loc11=0 |
1034 | (pReturn) br.ret.sptk.many b0 | 1028 | (pReturn) br.ret.dptk.many b0 |
1035 | #endif /* !CONFIG_ITANIUM */ | 1029 | #endif /* !CONFIG_ITANIUM */ |
1036 | # undef pRecurse | 1030 | # undef pRecurse |
1037 | # undef pReturn | 1031 | # undef pReturn |
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S index 962b6c4e32b5..7d7684a369d3 100644 --- a/arch/ia64/kernel/fsys.S +++ b/arch/ia64/kernel/fsys.S | |||
@@ -531,93 +531,114 @@ GLOBAL_ENTRY(fsys_bubble_down) | |||
531 | .altrp b6 | 531 | .altrp b6 |
532 | .body | 532 | .body |
533 | /* | 533 | /* |
534 | * We get here for syscalls that don't have a lightweight handler. For those, we | 534 | * We get here for syscalls that don't have a lightweight |
535 | * need to bubble down into the kernel and that requires setting up a minimal | 535 | * handler. For those, we need to bubble down into the kernel |
536 | * pt_regs structure, and initializing the CPU state more or less as if an | 536 | * and that requires setting up a minimal pt_regs structure, |
537 | * interruption had occurred. To make syscall-restarts work, we setup pt_regs | 537 | * and initializing the CPU state more or less as if an |
538 | * such that cr_iip points to the second instruction in syscall_via_break. | 538 | * interruption had occurred. To make syscall-restarts work, |
539 | * Decrementing the IP hence will restart the syscall via break and not | 539 | * we setup pt_regs such that cr_iip points to the second |
540 | * decrementing IP will return us to the caller, as usual. Note that we preserve | 540 | * instruction in syscall_via_break. Decrementing the IP |
541 | * the value of psr.pp rather than initializing it from dcr.pp. This makes it | 541 | * hence will restart the syscall via break and not |
542 | * possible to distinguish fsyscall execution from other privileged execution. | 542 | * decrementing IP will return us to the caller, as usual. |
543 | * Note that we preserve the value of psr.pp rather than | ||
544 | * initializing it from dcr.pp. This makes it possible to | ||
545 | * distinguish fsyscall execution from other privileged | ||
546 | * execution. | ||
543 | * | 547 | * |
544 | * On entry: | 548 | * On entry: |
545 | * - normal fsyscall handler register usage, except that we also have: | 549 | * - normal fsyscall handler register usage, except |
550 | * that we also have: | ||
546 | * - r18: address of syscall entry point | 551 | * - r18: address of syscall entry point |
547 | * - r21: ar.fpsr | 552 | * - r21: ar.fpsr |
548 | * - r26: ar.pfs | 553 | * - r26: ar.pfs |
549 | * - r27: ar.rsc | 554 | * - r27: ar.rsc |
550 | * - r29: psr | 555 | * - r29: psr |
556 | * | ||
557 | * We used to clear some PSR bits here but that requires slow | ||
558 | * serialization. Fortuntely, that isn't really necessary. | ||
559 | * The rationale is as follows: we used to clear bits | ||
560 | * ~PSR_PRESERVED_BITS in PSR.L. Since | ||
561 | * PSR_PRESERVED_BITS==PSR.{UP,MFL,MFH,PK,DT,PP,SP,RT,IC}, we | ||
562 | * ended up clearing PSR.{BE,AC,I,DFL,DFH,DI,DB,SI,TB}. | ||
563 | * However, | ||
564 | * | ||
565 | * PSR.BE : already is turned off in __kernel_syscall_via_epc() | ||
566 | * PSR.AC : don't care (kernel normally turns PSR.AC on) | ||
567 | * PSR.I : already turned off by the time fsys_bubble_down gets | ||
568 | * invoked | ||
569 | * PSR.DFL: always 0 (kernel never turns it on) | ||
570 | * PSR.DFH: don't care --- kernel never touches f32-f127 on its own | ||
571 | * initiative | ||
572 | * PSR.DI : always 0 (kernel never turns it on) | ||
573 | * PSR.SI : always 0 (kernel never turns it on) | ||
574 | * PSR.DB : don't care --- kernel never enables kernel-level | ||
575 | * breakpoints | ||
576 | * PSR.TB : must be 0 already; if it wasn't zero on entry to | ||
577 | * __kernel_syscall_via_epc, the branch to fsys_bubble_down | ||
578 | * will trigger a taken branch; the taken-trap-handler then | ||
579 | * converts the syscall into a break-based system-call. | ||
551 | */ | 580 | */ |
552 | # define PSR_PRESERVED_BITS (IA64_PSR_UP | IA64_PSR_MFL | IA64_PSR_MFH | IA64_PSR_PK \ | ||
553 | | IA64_PSR_DT | IA64_PSR_PP | IA64_PSR_SP | IA64_PSR_RT \ | ||
554 | | IA64_PSR_IC) | ||
555 | /* | 581 | /* |
556 | * Reading psr.l gives us only bits 0-31, psr.it, and psr.mc. The rest we have | 582 | * Reading psr.l gives us only bits 0-31, psr.it, and psr.mc. |
557 | * to synthesize. | 583 | * The rest we have to synthesize. |
558 | */ | 584 | */ |
559 | # define PSR_ONE_BITS ((3 << IA64_PSR_CPL0_BIT) | (0x1 << IA64_PSR_RI_BIT) \ | 585 | # define PSR_ONE_BITS ((3 << IA64_PSR_CPL0_BIT) \ |
586 | | (0x1 << IA64_PSR_RI_BIT) \ | ||
560 | | IA64_PSR_BN | IA64_PSR_I) | 587 | | IA64_PSR_BN | IA64_PSR_I) |
561 | 588 | ||
562 | invala | 589 | invala // M0|1 |
563 | movl r8=PSR_ONE_BITS | 590 | movl r14=ia64_ret_from_syscall // X |
564 | 591 | ||
565 | mov r25=ar.unat // save ar.unat (5 cyc) | 592 | nop.m 0 |
566 | movl r9=PSR_PRESERVED_BITS | 593 | movl r28=__kernel_syscall_via_break // X create cr.iip |
594 | ;; | ||
567 | 595 | ||
568 | mov ar.rsc=0 // set enforced lazy mode, pl 0, little-endian, loadrs=0 | 596 | mov r2=r16 // A get task addr to addl-addressable register |
569 | movl r28=__kernel_syscall_via_break | 597 | adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16 // A |
598 | mov r31=pr // I0 save pr (2 cyc) | ||
570 | ;; | 599 | ;; |
571 | mov r23=ar.bspstore // save ar.bspstore (12 cyc) | 600 | st1 [r16]=r0 // M2|3 clear current->thread.on_ustack flag |
572 | mov r31=pr // save pr (2 cyc) | 601 | addl r22=IA64_RBS_OFFSET,r2 // A compute base of RBS |
573 | mov r20=r1 // save caller's gp in r20 | 602 | add r3=TI_FLAGS+IA64_TASK_SIZE,r2 // A |
574 | ;; | 603 | ;; |
575 | mov r2=r16 // copy current task addr to addl-addressable register | 604 | ld4 r3=[r3] // M0|1 r3 = current_thread_info()->flags |
576 | and r9=r9,r29 | 605 | lfetch.fault.excl.nt1 [r22] // M0|1 prefetch register backing-store |
577 | mov r19=b6 // save b6 (2 cyc) | 606 | nop.i 0 |
578 | ;; | 607 | ;; |
579 | mov psr.l=r9 // slam the door (17 cyc to srlz.i) | 608 | mov ar.rsc=0 // M2 set enforced lazy mode, pl 0, LE, loadrs=0 |
580 | or r29=r8,r29 // construct cr.ipsr value to save | 609 | nop.m 0 |
581 | addl r22=IA64_RBS_OFFSET,r2 // compute base of RBS | 610 | nop.i 0 |
582 | ;; | 611 | ;; |
583 | // GAS reports a spurious RAW hazard on the read of ar.rnat because it thinks | 612 | mov r23=ar.bspstore // M2 (12 cyc) save ar.bspstore |
584 | // we may be reading ar.itc after writing to psr.l. Avoid that message with | 613 | mov.m r24=ar.rnat // M2 (5 cyc) read ar.rnat (dual-issues!) |
585 | // this directive: | 614 | nop.i 0 |
586 | dv_serialize_data | ||
587 | mov.m r24=ar.rnat // read ar.rnat (5 cyc lat) | ||
588 | lfetch.fault.excl.nt1 [r22] | ||
589 | adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r2 | ||
590 | |||
591 | // ensure previous insn group is issued before we stall for srlz.i: | ||
592 | ;; | 615 | ;; |
593 | srlz.i // ensure new psr.l has been established | 616 | mov ar.bspstore=r22 // M2 (6 cyc) switch to kernel RBS |
594 | ///////////////////////////////////////////////////////////////////////////// | 617 | movl r8=PSR_ONE_BITS // X |
595 | ////////// from this point on, execution is not interruptible anymore | ||
596 | ///////////////////////////////////////////////////////////////////////////// | ||
597 | addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r2 // compute base of memory stack | ||
598 | cmp.ne pKStk,pUStk=r0,r0 // set pKStk <- 0, pUStk <- 1 | ||
599 | ;; | 618 | ;; |
600 | st1 [r16]=r0 // clear current->thread.on_ustack flag | 619 | mov r25=ar.unat // M2 (5 cyc) save ar.unat |
601 | mov ar.bspstore=r22 // switch to kernel RBS | 620 | mov r19=b6 // I0 save b6 (2 cyc) |
602 | mov b6=r18 // copy syscall entry-point to b6 (7 cyc) | 621 | mov r20=r1 // A save caller's gp in r20 |
603 | add r3=TI_FLAGS+IA64_TASK_SIZE,r2 | ||
604 | ;; | 622 | ;; |
605 | ld4 r3=[r3] // r2 = current_thread_info()->flags | 623 | or r29=r8,r29 // A construct cr.ipsr value to save |
606 | mov r18=ar.bsp // save (kernel) ar.bsp (12 cyc) | 624 | mov b6=r18 // I0 copy syscall entry-point to b6 (7 cyc) |
607 | mov ar.rsc=0x3 // set eager mode, pl 0, little-endian, loadrs=0 | 625 | addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r2 // A compute base of memory stack |
608 | br.call.sptk.many b7=ia64_syscall_setup | 626 | |
609 | ;; | 627 | mov r18=ar.bsp // M2 save (kernel) ar.bsp (12 cyc) |
610 | ssm psr.i | 628 | cmp.ne pKStk,pUStk=r0,r0 // A set pKStk <- 0, pUStk <- 1 |
611 | movl r2=ia64_ret_from_syscall | 629 | br.call.sptk.many b7=ia64_syscall_setup // B |
612 | ;; | 630 | ;; |
613 | mov rp=r2 // set the real return addr | 631 | mov ar.rsc=0x3 // M2 set eager mode, pl 0, LE, loadrs=0 |
614 | and r3=_TIF_SYSCALL_TRACEAUDIT,r3 | 632 | mov rp=r14 // I0 set the real return addr |
633 | and r3=_TIF_SYSCALL_TRACEAUDIT,r3 // A | ||
615 | ;; | 634 | ;; |
616 | cmp.eq p8,p0=r3,r0 | 635 | ssm psr.i // M2 we're on kernel stacks now, reenable irqs |
636 | cmp.eq p8,p0=r3,r0 // A | ||
637 | (p10) br.cond.spnt.many ia64_ret_from_syscall // B return if bad call-frame or r15 is a NaT | ||
617 | 638 | ||
618 | (p10) br.cond.spnt.many ia64_ret_from_syscall // p10==true means out registers are more than 8 | 639 | nop.m 0 |
619 | (p8) br.call.sptk.many b6=b6 // ignore this return addr | 640 | (p8) br.call.sptk.many b6=b6 // B (ignore return address) |
620 | br.cond.sptk ia64_trace_syscall | 641 | br.cond.spnt ia64_trace_syscall // B |
621 | END(fsys_bubble_down) | 642 | END(fsys_bubble_down) |
622 | 643 | ||
623 | .rodata | 644 | .rodata |
diff --git a/arch/ia64/kernel/gate.S b/arch/ia64/kernel/gate.S index facf75acdc85..86948ce63e43 100644 --- a/arch/ia64/kernel/gate.S +++ b/arch/ia64/kernel/gate.S | |||
@@ -72,38 +72,40 @@ GLOBAL_ENTRY(__kernel_syscall_via_epc) | |||
72 | * bundle get executed. The remaining code must be safe even if | 72 | * bundle get executed. The remaining code must be safe even if |
73 | * they do not get executed. | 73 | * they do not get executed. |
74 | */ | 74 | */ |
75 | adds r17=-1024,r15 | 75 | adds r17=-1024,r15 // A |
76 | mov r10=0 // default to successful syscall execution | 76 | mov r10=0 // A default to successful syscall execution |
77 | epc | 77 | epc // B causes split-issue |
78 | } | 78 | } |
79 | ;; | 79 | ;; |
80 | rsm psr.be // note: on McKinley "rsm psr.be/srlz.d" is slightly faster than "rum psr.be" | 80 | rsm psr.be | psr.i // M2 (5 cyc to srlz.d) |
81 | LOAD_FSYSCALL_TABLE(r14) | 81 | LOAD_FSYSCALL_TABLE(r14) // X |
82 | |||
83 | mov r16=IA64_KR(CURRENT) // 12 cycle read latency | ||
84 | tnat.nz p10,p9=r15 | ||
85 | mov r19=NR_syscalls-1 | ||
86 | ;; | 82 | ;; |
87 | shladd r18=r17,3,r14 | 83 | mov r16=IA64_KR(CURRENT) // M2 (12 cyc) |
88 | 84 | shladd r18=r17,3,r14 // A | |
89 | srlz.d | 85 | mov r19=NR_syscalls-1 // A |
90 | cmp.ne p8,p0=r0,r0 // p8 <- FALSE | 86 | ;; |
91 | /* Note: if r17 is a NaT, p6 will be set to zero. */ | 87 | lfetch [r18] // M0|1 |
92 | cmp.geu p6,p7=r19,r17 // (syscall > 0 && syscall < 1024+NR_syscalls)? | 88 | mov r29=psr // M2 (12 cyc) |
93 | ;; | 89 | // If r17 is a NaT, p6 will be zero |
94 | (p6) ld8 r18=[r18] | 90 | cmp.geu p6,p7=r19,r17 // A (sysnr > 0 && sysnr < 1024+NR_syscalls)? |
95 | mov r21=ar.fpsr | 91 | ;; |
96 | add r14=-8,r14 // r14 <- addr of fsys_bubble_down entry | 92 | mov r21=ar.fpsr // M2 (12 cyc) |
97 | ;; | 93 | tnat.nz p10,p9=r15 // I0 |
98 | (p6) mov b7=r18 | 94 | mov.i r26=ar.pfs // I0 (would stall anyhow due to srlz.d...) |
99 | (p6) tbit.z p8,p0=r18,0 | 95 | ;; |
100 | (p8) br.dptk.many b7 | 96 | srlz.d // M0 (forces split-issue) ensure PSR.BE==0 |
101 | 97 | (p6) ld8 r18=[r18] // M0|1 | |
102 | (p6) rsm psr.i | 98 | nop.i 0 |
103 | mov r27=ar.rsc | 99 | ;; |
104 | mov r26=ar.pfs | 100 | nop.m 0 |
101 | (p6) tbit.z.unc p8,p0=r18,0 // I0 (dual-issues with "mov b7=r18"!) | ||
102 | nop.i 0 | ||
105 | ;; | 103 | ;; |
106 | mov r29=psr // read psr (12 cyc load latency) | 104 | (p8) ssm psr.i |
105 | (p6) mov b7=r18 // I0 | ||
106 | (p8) br.dptk.many b7 // B | ||
107 | |||
108 | mov r27=ar.rsc // M2 (12 cyc) | ||
107 | /* | 109 | /* |
108 | * brl.cond doesn't work as intended because the linker would convert this branch | 110 | * brl.cond doesn't work as intended because the linker would convert this branch |
109 | * into a branch to a PLT. Perhaps there will be a way to avoid this with some | 111 | * into a branch to a PLT. Perhaps there will be a way to avoid this with some |
@@ -111,6 +113,8 @@ GLOBAL_ENTRY(__kernel_syscall_via_epc) | |||
111 | * instead. | 113 | * instead. |
112 | */ | 114 | */ |
113 | #ifdef CONFIG_ITANIUM | 115 | #ifdef CONFIG_ITANIUM |
116 | (p6) add r14=-8,r14 // r14 <- addr of fsys_bubble_down entry | ||
117 | ;; | ||
114 | (p6) ld8 r14=[r14] // r14 <- fsys_bubble_down | 118 | (p6) ld8 r14=[r14] // r14 <- fsys_bubble_down |
115 | ;; | 119 | ;; |
116 | (p6) mov b7=r14 | 120 | (p6) mov b7=r14 |
@@ -118,7 +122,7 @@ GLOBAL_ENTRY(__kernel_syscall_via_epc) | |||
118 | #else | 122 | #else |
119 | BRL_COND_FSYS_BUBBLE_DOWN(p6) | 123 | BRL_COND_FSYS_BUBBLE_DOWN(p6) |
120 | #endif | 124 | #endif |
121 | 125 | ssm psr.i | |
122 | mov r10=-1 | 126 | mov r10=-1 |
123 | (p10) mov r8=EINVAL | 127 | (p10) mov r8=EINVAL |
124 | (p9) mov r8=ENOSYS | 128 | (p9) mov r8=ENOSYS |
diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c index 7bbf019c9867..01572814abe4 100644 --- a/arch/ia64/kernel/ia64_ksyms.c +++ b/arch/ia64/kernel/ia64_ksyms.c | |||
@@ -58,9 +58,6 @@ EXPORT_SYMBOL(__strlen_user); | |||
58 | EXPORT_SYMBOL(__strncpy_from_user); | 58 | EXPORT_SYMBOL(__strncpy_from_user); |
59 | EXPORT_SYMBOL(__strnlen_user); | 59 | EXPORT_SYMBOL(__strnlen_user); |
60 | 60 | ||
61 | #include <asm/unistd.h> | ||
62 | EXPORT_SYMBOL(__ia64_syscall); | ||
63 | |||
64 | /* from arch/ia64/lib */ | 61 | /* from arch/ia64/lib */ |
65 | extern void __divsi3(void); | 62 | extern void __divsi3(void); |
66 | extern void __udivsi3(void); | 63 | extern void __udivsi3(void); |
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c index 88b014381df5..c170be095ccd 100644 --- a/arch/ia64/kernel/iosapic.c +++ b/arch/ia64/kernel/iosapic.c | |||
@@ -129,14 +129,13 @@ static struct iosapic { | |||
129 | char __iomem *addr; /* base address of IOSAPIC */ | 129 | char __iomem *addr; /* base address of IOSAPIC */ |
130 | unsigned int gsi_base; /* first GSI assigned to this IOSAPIC */ | 130 | unsigned int gsi_base; /* first GSI assigned to this IOSAPIC */ |
131 | unsigned short num_rte; /* number of RTE in this IOSAPIC */ | 131 | unsigned short num_rte; /* number of RTE in this IOSAPIC */ |
132 | int rtes_inuse; /* # of RTEs in use on this IOSAPIC */ | ||
132 | #ifdef CONFIG_NUMA | 133 | #ifdef CONFIG_NUMA |
133 | unsigned short node; /* numa node association via pxm */ | 134 | unsigned short node; /* numa node association via pxm */ |
134 | #endif | 135 | #endif |
135 | } iosapic_lists[NR_IOSAPICS]; | 136 | } iosapic_lists[NR_IOSAPICS]; |
136 | 137 | ||
137 | static int num_iosapic; | 138 | static unsigned char pcat_compat __devinitdata; /* 8259 compatibility flag */ |
138 | |||
139 | static unsigned char pcat_compat __initdata; /* 8259 compatibility flag */ | ||
140 | 139 | ||
141 | static int iosapic_kmalloc_ok; | 140 | static int iosapic_kmalloc_ok; |
142 | static LIST_HEAD(free_rte_list); | 141 | static LIST_HEAD(free_rte_list); |
@@ -149,7 +148,7 @@ find_iosapic (unsigned int gsi) | |||
149 | { | 148 | { |
150 | int i; | 149 | int i; |
151 | 150 | ||
152 | for (i = 0; i < num_iosapic; i++) { | 151 | for (i = 0; i < NR_IOSAPICS; i++) { |
153 | if ((unsigned) (gsi - iosapic_lists[i].gsi_base) < iosapic_lists[i].num_rte) | 152 | if ((unsigned) (gsi - iosapic_lists[i].gsi_base) < iosapic_lists[i].num_rte) |
154 | return i; | 153 | return i; |
155 | } | 154 | } |
@@ -598,6 +597,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery, | |||
598 | rte->refcnt++; | 597 | rte->refcnt++; |
599 | list_add_tail(&rte->rte_list, &iosapic_intr_info[vector].rtes); | 598 | list_add_tail(&rte->rte_list, &iosapic_intr_info[vector].rtes); |
600 | iosapic_intr_info[vector].count++; | 599 | iosapic_intr_info[vector].count++; |
600 | iosapic_lists[index].rtes_inuse++; | ||
601 | } | 601 | } |
602 | else if (vector_is_shared(vector)) { | 602 | else if (vector_is_shared(vector)) { |
603 | struct iosapic_intr_info *info = &iosapic_intr_info[vector]; | 603 | struct iosapic_intr_info *info = &iosapic_intr_info[vector]; |
@@ -778,7 +778,7 @@ void | |||
778 | iosapic_unregister_intr (unsigned int gsi) | 778 | iosapic_unregister_intr (unsigned int gsi) |
779 | { | 779 | { |
780 | unsigned long flags; | 780 | unsigned long flags; |
781 | int irq, vector; | 781 | int irq, vector, index; |
782 | irq_desc_t *idesc; | 782 | irq_desc_t *idesc; |
783 | u32 low32; | 783 | u32 low32; |
784 | unsigned long trigger, polarity; | 784 | unsigned long trigger, polarity; |
@@ -819,6 +819,9 @@ iosapic_unregister_intr (unsigned int gsi) | |||
819 | list_del(&rte->rte_list); | 819 | list_del(&rte->rte_list); |
820 | iosapic_intr_info[vector].count--; | 820 | iosapic_intr_info[vector].count--; |
821 | iosapic_free_rte(rte); | 821 | iosapic_free_rte(rte); |
822 | index = find_iosapic(gsi); | ||
823 | iosapic_lists[index].rtes_inuse--; | ||
824 | WARN_ON(iosapic_lists[index].rtes_inuse < 0); | ||
822 | 825 | ||
823 | trigger = iosapic_intr_info[vector].trigger; | 826 | trigger = iosapic_intr_info[vector].trigger; |
824 | polarity = iosapic_intr_info[vector].polarity; | 827 | polarity = iosapic_intr_info[vector].polarity; |
@@ -952,30 +955,86 @@ iosapic_system_init (int system_pcat_compat) | |||
952 | } | 955 | } |
953 | } | 956 | } |
954 | 957 | ||
955 | void __init | 958 | static inline int |
959 | iosapic_alloc (void) | ||
960 | { | ||
961 | int index; | ||
962 | |||
963 | for (index = 0; index < NR_IOSAPICS; index++) | ||
964 | if (!iosapic_lists[index].addr) | ||
965 | return index; | ||
966 | |||
967 | printk(KERN_WARNING "%s: failed to allocate iosapic\n", __FUNCTION__); | ||
968 | return -1; | ||
969 | } | ||
970 | |||
971 | static inline void | ||
972 | iosapic_free (int index) | ||
973 | { | ||
974 | memset(&iosapic_lists[index], 0, sizeof(iosapic_lists[0])); | ||
975 | } | ||
976 | |||
977 | static inline int | ||
978 | iosapic_check_gsi_range (unsigned int gsi_base, unsigned int ver) | ||
979 | { | ||
980 | int index; | ||
981 | unsigned int gsi_end, base, end; | ||
982 | |||
983 | /* check gsi range */ | ||
984 | gsi_end = gsi_base + ((ver >> 16) & 0xff); | ||
985 | for (index = 0; index < NR_IOSAPICS; index++) { | ||
986 | if (!iosapic_lists[index].addr) | ||
987 | continue; | ||
988 | |||
989 | base = iosapic_lists[index].gsi_base; | ||
990 | end = base + iosapic_lists[index].num_rte - 1; | ||
991 | |||
992 | if (gsi_base < base && gsi_end < base) | ||
993 | continue;/* OK */ | ||
994 | |||
995 | if (gsi_base > end && gsi_end > end) | ||
996 | continue; /* OK */ | ||
997 | |||
998 | return -EBUSY; | ||
999 | } | ||
1000 | return 0; | ||
1001 | } | ||
1002 | |||
1003 | int __devinit | ||
956 | iosapic_init (unsigned long phys_addr, unsigned int gsi_base) | 1004 | iosapic_init (unsigned long phys_addr, unsigned int gsi_base) |
957 | { | 1005 | { |
958 | int num_rte; | 1006 | int num_rte, err, index; |
959 | unsigned int isa_irq, ver; | 1007 | unsigned int isa_irq, ver; |
960 | char __iomem *addr; | 1008 | char __iomem *addr; |
1009 | unsigned long flags; | ||
1010 | |||
1011 | spin_lock_irqsave(&iosapic_lock, flags); | ||
1012 | { | ||
1013 | addr = ioremap(phys_addr, 0); | ||
1014 | ver = iosapic_version(addr); | ||
961 | 1015 | ||
962 | addr = ioremap(phys_addr, 0); | 1016 | if ((err = iosapic_check_gsi_range(gsi_base, ver))) { |
963 | ver = iosapic_version(addr); | 1017 | iounmap(addr); |
1018 | spin_unlock_irqrestore(&iosapic_lock, flags); | ||
1019 | return err; | ||
1020 | } | ||
964 | 1021 | ||
965 | /* | 1022 | /* |
966 | * The MAX_REDIR register holds the highest input pin | 1023 | * The MAX_REDIR register holds the highest input pin |
967 | * number (starting from 0). | 1024 | * number (starting from 0). |
968 | * We add 1 so that we can use it for number of pins (= RTEs) | 1025 | * We add 1 so that we can use it for number of pins (= RTEs) |
969 | */ | 1026 | */ |
970 | num_rte = ((ver >> 16) & 0xff) + 1; | 1027 | num_rte = ((ver >> 16) & 0xff) + 1; |
971 | 1028 | ||
972 | iosapic_lists[num_iosapic].addr = addr; | 1029 | index = iosapic_alloc(); |
973 | iosapic_lists[num_iosapic].gsi_base = gsi_base; | 1030 | iosapic_lists[index].addr = addr; |
974 | iosapic_lists[num_iosapic].num_rte = num_rte; | 1031 | iosapic_lists[index].gsi_base = gsi_base; |
1032 | iosapic_lists[index].num_rte = num_rte; | ||
975 | #ifdef CONFIG_NUMA | 1033 | #ifdef CONFIG_NUMA |
976 | iosapic_lists[num_iosapic].node = MAX_NUMNODES; | 1034 | iosapic_lists[index].node = MAX_NUMNODES; |
977 | #endif | 1035 | #endif |
978 | num_iosapic++; | 1036 | } |
1037 | spin_unlock_irqrestore(&iosapic_lock, flags); | ||
979 | 1038 | ||
980 | if ((gsi_base == 0) && pcat_compat) { | 1039 | if ((gsi_base == 0) && pcat_compat) { |
981 | /* | 1040 | /* |
@@ -986,10 +1045,43 @@ iosapic_init (unsigned long phys_addr, unsigned int gsi_base) | |||
986 | for (isa_irq = 0; isa_irq < 16; ++isa_irq) | 1045 | for (isa_irq = 0; isa_irq < 16; ++isa_irq) |
987 | iosapic_override_isa_irq(isa_irq, isa_irq, IOSAPIC_POL_HIGH, IOSAPIC_EDGE); | 1046 | iosapic_override_isa_irq(isa_irq, isa_irq, IOSAPIC_POL_HIGH, IOSAPIC_EDGE); |
988 | } | 1047 | } |
1048 | return 0; | ||
1049 | } | ||
1050 | |||
1051 | #ifdef CONFIG_HOTPLUG | ||
1052 | int | ||
1053 | iosapic_remove (unsigned int gsi_base) | ||
1054 | { | ||
1055 | int index, err = 0; | ||
1056 | unsigned long flags; | ||
1057 | |||
1058 | spin_lock_irqsave(&iosapic_lock, flags); | ||
1059 | { | ||
1060 | index = find_iosapic(gsi_base); | ||
1061 | if (index < 0) { | ||
1062 | printk(KERN_WARNING "%s: No IOSAPIC for GSI base %u\n", | ||
1063 | __FUNCTION__, gsi_base); | ||
1064 | goto out; | ||
1065 | } | ||
1066 | |||
1067 | if (iosapic_lists[index].rtes_inuse) { | ||
1068 | err = -EBUSY; | ||
1069 | printk(KERN_WARNING "%s: IOSAPIC for GSI base %u is busy\n", | ||
1070 | __FUNCTION__, gsi_base); | ||
1071 | goto out; | ||
1072 | } | ||
1073 | |||
1074 | iounmap(iosapic_lists[index].addr); | ||
1075 | iosapic_free(index); | ||
1076 | } | ||
1077 | out: | ||
1078 | spin_unlock_irqrestore(&iosapic_lock, flags); | ||
1079 | return err; | ||
989 | } | 1080 | } |
1081 | #endif /* CONFIG_HOTPLUG */ | ||
990 | 1082 | ||
991 | #ifdef CONFIG_NUMA | 1083 | #ifdef CONFIG_NUMA |
992 | void __init | 1084 | void __devinit |
993 | map_iosapic_to_node(unsigned int gsi_base, int node) | 1085 | map_iosapic_to_node(unsigned int gsi_base, int node) |
994 | { | 1086 | { |
995 | int index; | 1087 | int index; |
diff --git a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S index 2bc085a73e30..3bb3a13c4047 100644 --- a/arch/ia64/kernel/ivt.S +++ b/arch/ia64/kernel/ivt.S | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/ia64/kernel/ivt.S | 2 | * arch/ia64/kernel/ivt.S |
3 | * | 3 | * |
4 | * Copyright (C) 1998-2001, 2003 Hewlett-Packard Co | 4 | * Copyright (C) 1998-2001, 2003, 2005 Hewlett-Packard Co |
5 | * Stephane Eranian <eranian@hpl.hp.com> | 5 | * Stephane Eranian <eranian@hpl.hp.com> |
6 | * David Mosberger <davidm@hpl.hp.com> | 6 | * David Mosberger <davidm@hpl.hp.com> |
7 | * Copyright (C) 2000, 2002-2003 Intel Co | 7 | * Copyright (C) 2000, 2002-2003 Intel Co |
@@ -692,82 +692,118 @@ ENTRY(break_fault) | |||
692 | * to prevent leaking bits from kernel to user level. | 692 | * to prevent leaking bits from kernel to user level. |
693 | */ | 693 | */ |
694 | DBG_FAULT(11) | 694 | DBG_FAULT(11) |
695 | mov r16=IA64_KR(CURRENT) // r16 = current task; 12 cycle read lat. | 695 | mov.m r16=IA64_KR(CURRENT) // M2 r16 <- current task (12 cyc) |
696 | mov r17=cr.iim | 696 | mov r29=cr.ipsr // M2 (12 cyc) |
697 | mov r18=__IA64_BREAK_SYSCALL | 697 | mov r31=pr // I0 (2 cyc) |
698 | mov r21=ar.fpsr | 698 | |
699 | mov r29=cr.ipsr | 699 | mov r17=cr.iim // M2 (2 cyc) |
700 | mov r19=b6 | 700 | mov.m r27=ar.rsc // M2 (12 cyc) |
701 | mov r25=ar.unat | 701 | mov r18=__IA64_BREAK_SYSCALL // A |
702 | mov r27=ar.rsc | 702 | |
703 | mov r26=ar.pfs | 703 | mov.m ar.rsc=0 // M2 |
704 | mov r28=cr.iip | 704 | mov.m r21=ar.fpsr // M2 (12 cyc) |
705 | mov r31=pr // prepare to save predicates | 705 | mov r19=b6 // I0 (2 cyc) |
706 | mov r20=r1 | 706 | ;; |
707 | ;; | 707 | mov.m r23=ar.bspstore // M2 (12 cyc) |
708 | mov.m r24=ar.rnat // M2 (5 cyc) | ||
709 | mov.i r26=ar.pfs // I0 (2 cyc) | ||
710 | |||
711 | invala // M0|1 | ||
712 | nop.m 0 // M | ||
713 | mov r20=r1 // A save r1 | ||
714 | |||
715 | nop.m 0 | ||
716 | movl r30=sys_call_table // X | ||
717 | |||
718 | mov r28=cr.iip // M2 (2 cyc) | ||
719 | cmp.eq p0,p7=r18,r17 // I0 is this a system call? | ||
720 | (p7) br.cond.spnt non_syscall // B no -> | ||
721 | // | ||
722 | // From this point on, we are definitely on the syscall-path | ||
723 | // and we can use (non-banked) scratch registers. | ||
724 | // | ||
725 | /////////////////////////////////////////////////////////////////////// | ||
726 | mov r1=r16 // A move task-pointer to "addl"-addressable reg | ||
727 | mov r2=r16 // A setup r2 for ia64_syscall_setup | ||
728 | add r9=TI_FLAGS+IA64_TASK_SIZE,r16 // A r9 = ¤t_thread_info()->flags | ||
729 | |||
708 | adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16 | 730 | adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16 |
709 | cmp.eq p0,p7=r18,r17 // is this a system call? (p7 <- false, if so) | 731 | adds r15=-1024,r15 // A subtract 1024 from syscall number |
710 | (p7) br.cond.spnt non_syscall | 732 | mov r3=NR_syscalls - 1 |
711 | ;; | 733 | ;; |
712 | ld1 r17=[r16] // load current->thread.on_ustack flag | 734 | ld1.bias r17=[r16] // M0|1 r17 = current->thread.on_ustack flag |
713 | st1 [r16]=r0 // clear current->thread.on_ustack flag | 735 | ld4 r9=[r9] // M0|1 r9 = current_thread_info()->flags |
714 | add r1=-IA64_TASK_THREAD_ON_USTACK_OFFSET,r16 // set r1 for MINSTATE_START_SAVE_MIN_VIRT | 736 | extr.u r8=r29,41,2 // I0 extract ei field from cr.ipsr |
737 | |||
738 | shladd r30=r15,3,r30 // A r30 = sys_call_table + 8*(syscall-1024) | ||
739 | addl r22=IA64_RBS_OFFSET,r1 // A compute base of RBS | ||
740 | cmp.leu p6,p7=r15,r3 // A syscall number in range? | ||
715 | ;; | 741 | ;; |
716 | invala | ||
717 | 742 | ||
718 | /* adjust return address so we skip over the break instruction: */ | 743 | lfetch.fault.excl.nt1 [r22] // M0|1 prefetch RBS |
744 | (p6) ld8 r30=[r30] // M0|1 load address of syscall entry point | ||
745 | tnat.nz.or p7,p0=r15 // I0 is syscall nr a NaT? | ||
719 | 746 | ||
720 | extr.u r8=r29,41,2 // extract ei field from cr.ipsr | 747 | mov.m ar.bspstore=r22 // M2 switch to kernel RBS |
721 | ;; | 748 | cmp.eq p8,p9=2,r8 // A isr.ei==2? |
722 | cmp.eq p6,p7=2,r8 // isr.ei==2? | ||
723 | mov r2=r1 // setup r2 for ia64_syscall_setup | ||
724 | ;; | ||
725 | (p6) mov r8=0 // clear ei to 0 | ||
726 | (p6) adds r28=16,r28 // switch cr.iip to next bundle cr.ipsr.ei wrapped | ||
727 | (p7) adds r8=1,r8 // increment ei to next slot | ||
728 | ;; | ||
729 | cmp.eq pKStk,pUStk=r0,r17 // are we in kernel mode already? | ||
730 | dep r29=r8,r29,41,2 // insert new ei into cr.ipsr | ||
731 | ;; | 749 | ;; |
732 | 750 | ||
733 | // switch from user to kernel RBS: | 751 | (p8) mov r8=0 // A clear ei to 0 |
734 | MINSTATE_START_SAVE_MIN_VIRT | 752 | (p7) movl r30=sys_ni_syscall // X |
735 | br.call.sptk.many b7=ia64_syscall_setup | ||
736 | ;; | ||
737 | MINSTATE_END_SAVE_MIN_VIRT // switch to bank 1 | ||
738 | ssm psr.ic | PSR_DEFAULT_BITS | ||
739 | ;; | ||
740 | srlz.i // guarantee that interruption collection is on | ||
741 | mov r3=NR_syscalls - 1 | ||
742 | ;; | ||
743 | (p15) ssm psr.i // restore psr.i | ||
744 | // p10==true means out registers are more than 8 or r15's Nat is true | ||
745 | (p10) br.cond.spnt.many ia64_ret_from_syscall | ||
746 | ;; | ||
747 | movl r16=sys_call_table | ||
748 | 753 | ||
749 | adds r15=-1024,r15 // r15 contains the syscall number---subtract 1024 | 754 | (p8) adds r28=16,r28 // A switch cr.iip to next bundle |
750 | movl r2=ia64_ret_from_syscall | 755 | (p9) adds r8=1,r8 // A increment ei to next slot |
751 | ;; | 756 | nop.i 0 |
752 | shladd r20=r15,3,r16 // r20 = sys_call_table + 8*(syscall-1024) | ||
753 | cmp.leu p6,p7=r15,r3 // (syscall > 0 && syscall < 1024 + NR_syscalls) ? | ||
754 | mov rp=r2 // set the real return addr | ||
755 | ;; | 757 | ;; |
756 | (p6) ld8 r20=[r20] // load address of syscall entry point | ||
757 | (p7) movl r20=sys_ni_syscall | ||
758 | 758 | ||
759 | add r2=TI_FLAGS+IA64_TASK_SIZE,r13 | 759 | mov.m r25=ar.unat // M2 (5 cyc) |
760 | ;; | 760 | dep r29=r8,r29,41,2 // I0 insert new ei into cr.ipsr |
761 | ld4 r2=[r2] // r2 = current_thread_info()->flags | 761 | adds r15=1024,r15 // A restore original syscall number |
762 | ;; | 762 | // |
763 | and r2=_TIF_SYSCALL_TRACEAUDIT,r2 // mask trace or audit | 763 | // If any of the above loads miss in L1D, we'll stall here until |
764 | // the data arrives. | ||
765 | // | ||
766 | /////////////////////////////////////////////////////////////////////// | ||
767 | st1 [r16]=r0 // M2|3 clear current->thread.on_ustack flag | ||
768 | mov b6=r30 // I0 setup syscall handler branch reg early | ||
769 | cmp.eq pKStk,pUStk=r0,r17 // A were we on kernel stacks already? | ||
770 | |||
771 | and r9=_TIF_SYSCALL_TRACEAUDIT,r9 // A mask trace or audit | ||
772 | mov r18=ar.bsp // M2 (12 cyc) | ||
773 | (pKStk) br.cond.spnt .break_fixup // B we're already in kernel-mode -- fix up RBS | ||
774 | ;; | ||
775 | .back_from_break_fixup: | ||
776 | (pUStk) addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1 // A compute base of memory stack | ||
777 | cmp.eq p14,p0=r9,r0 // A are syscalls being traced/audited? | ||
778 | br.call.sptk.many b7=ia64_syscall_setup // B | ||
779 | 1: | ||
780 | mov ar.rsc=0x3 // M2 set eager mode, pl 0, LE, loadrs=0 | ||
781 | nop 0 | ||
782 | bsw.1 // B (6 cyc) regs are saved, switch to bank 1 | ||
764 | ;; | 783 | ;; |
765 | cmp.eq p8,p0=r2,r0 | 784 | |
766 | mov b6=r20 | 785 | ssm psr.ic | PSR_DEFAULT_BITS // M2 now it's safe to re-enable intr.-collection |
786 | movl r3=ia64_ret_from_syscall // X | ||
767 | ;; | 787 | ;; |
768 | (p8) br.call.sptk.many b6=b6 // ignore this return addr | 788 | |
769 | br.cond.sptk ia64_trace_syscall | 789 | srlz.i // M0 ensure interruption collection is on |
790 | mov rp=r3 // I0 set the real return addr | ||
791 | (p10) br.cond.spnt.many ia64_ret_from_syscall // B return if bad call-frame or r15 is a NaT | ||
792 | |||
793 | (p15) ssm psr.i // M2 restore psr.i | ||
794 | (p14) br.call.sptk.many b6=b6 // B invoke syscall-handker (ignore return addr) | ||
795 | br.cond.spnt.many ia64_trace_syscall // B do syscall-tracing thingamagic | ||
770 | // NOT REACHED | 796 | // NOT REACHED |
797 | /////////////////////////////////////////////////////////////////////// | ||
798 | // On entry, we optimistically assumed that we're coming from user-space. | ||
799 | // For the rare cases where a system-call is done from within the kernel, | ||
800 | // we fix things up at this point: | ||
801 | .break_fixup: | ||
802 | add r1=-IA64_PT_REGS_SIZE,sp // A allocate space for pt_regs structure | ||
803 | mov ar.rnat=r24 // M2 restore kernel's AR.RNAT | ||
804 | ;; | ||
805 | mov ar.bspstore=r23 // M2 restore kernel's AR.BSPSTORE | ||
806 | br.cond.sptk .back_from_break_fixup | ||
771 | END(break_fault) | 807 | END(break_fault) |
772 | 808 | ||
773 | .org ia64_ivt+0x3000 | 809 | .org ia64_ivt+0x3000 |
@@ -842,8 +878,6 @@ END(interrupt) | |||
842 | * - r31: saved pr | 878 | * - r31: saved pr |
843 | * - b0: original contents (to be saved) | 879 | * - b0: original contents (to be saved) |
844 | * On exit: | 880 | * On exit: |
845 | * - executing on bank 1 registers | ||
846 | * - psr.ic enabled, interrupts restored | ||
847 | * - p10: TRUE if syscall is invoked with more than 8 out | 881 | * - p10: TRUE if syscall is invoked with more than 8 out |
848 | * registers or r15's Nat is true | 882 | * registers or r15's Nat is true |
849 | * - r1: kernel's gp | 883 | * - r1: kernel's gp |
@@ -851,8 +885,11 @@ END(interrupt) | |||
851 | * - r8: -EINVAL if p10 is true | 885 | * - r8: -EINVAL if p10 is true |
852 | * - r12: points to kernel stack | 886 | * - r12: points to kernel stack |
853 | * - r13: points to current task | 887 | * - r13: points to current task |
888 | * - r14: preserved (same as on entry) | ||
889 | * - p13: preserved | ||
854 | * - p15: TRUE if interrupts need to be re-enabled | 890 | * - p15: TRUE if interrupts need to be re-enabled |
855 | * - ar.fpsr: set to kernel settings | 891 | * - ar.fpsr: set to kernel settings |
892 | * - b6: preserved (same as on entry) | ||
856 | */ | 893 | */ |
857 | GLOBAL_ENTRY(ia64_syscall_setup) | 894 | GLOBAL_ENTRY(ia64_syscall_setup) |
858 | #if PT(B6) != 0 | 895 | #if PT(B6) != 0 |
@@ -920,10 +957,10 @@ GLOBAL_ENTRY(ia64_syscall_setup) | |||
920 | (p13) mov in5=-1 | 957 | (p13) mov in5=-1 |
921 | ;; | 958 | ;; |
922 | st8 [r16]=r21,PT(R8)-PT(AR_FPSR) // save ar.fpsr | 959 | st8 [r16]=r21,PT(R8)-PT(AR_FPSR) // save ar.fpsr |
923 | tnat.nz p14,p0=in6 | 960 | tnat.nz p13,p0=in6 |
924 | cmp.lt p10,p9=r11,r8 // frame size can't be more than local+8 | 961 | cmp.lt p10,p9=r11,r8 // frame size can't be more than local+8 |
925 | ;; | 962 | ;; |
926 | stf8 [r16]=f1 // ensure pt_regs.r8 != 0 (see handle_syscall_error) | 963 | mov r8=1 |
927 | (p9) tnat.nz p10,p0=r15 | 964 | (p9) tnat.nz p10,p0=r15 |
928 | adds r12=-16,r1 // switch to kernel memory stack (with 16 bytes of scratch) | 965 | adds r12=-16,r1 // switch to kernel memory stack (with 16 bytes of scratch) |
929 | 966 | ||
@@ -934,9 +971,9 @@ GLOBAL_ENTRY(ia64_syscall_setup) | |||
934 | mov r13=r2 // establish `current' | 971 | mov r13=r2 // establish `current' |
935 | movl r1=__gp // establish kernel global pointer | 972 | movl r1=__gp // establish kernel global pointer |
936 | ;; | 973 | ;; |
937 | (p14) mov in6=-1 | 974 | st8 [r16]=r8 // ensure pt_regs.r8 != 0 (see handle_syscall_error) |
975 | (p13) mov in6=-1 | ||
938 | (p8) mov in7=-1 | 976 | (p8) mov in7=-1 |
939 | nop.i 0 | ||
940 | 977 | ||
941 | cmp.eq pSys,pNonSys=r0,r0 // set pSys=1, pNonSys=0 | 978 | cmp.eq pSys,pNonSys=r0,r0 // set pSys=1, pNonSys=0 |
942 | movl r17=FPSR_DEFAULT | 979 | movl r17=FPSR_DEFAULT |
@@ -1007,6 +1044,8 @@ END(dispatch_illegal_op_fault) | |||
1007 | FAULT(17) | 1044 | FAULT(17) |
1008 | 1045 | ||
1009 | ENTRY(non_syscall) | 1046 | ENTRY(non_syscall) |
1047 | mov ar.rsc=r27 // restore ar.rsc before SAVE_MIN_WITH_COVER | ||
1048 | ;; | ||
1010 | SAVE_MIN_WITH_COVER | 1049 | SAVE_MIN_WITH_COVER |
1011 | 1050 | ||
1012 | // There is no particular reason for this code to be here, other than that | 1051 | // There is no particular reason for this code to be here, other than that |
@@ -1204,6 +1243,25 @@ END(disabled_fp_reg) | |||
1204 | // 0x5600 Entry 26 (size 16 bundles) Nat Consumption (11,23,37,50) | 1243 | // 0x5600 Entry 26 (size 16 bundles) Nat Consumption (11,23,37,50) |
1205 | ENTRY(nat_consumption) | 1244 | ENTRY(nat_consumption) |
1206 | DBG_FAULT(26) | 1245 | DBG_FAULT(26) |
1246 | |||
1247 | mov r16=cr.ipsr | ||
1248 | mov r17=cr.isr | ||
1249 | mov r31=pr // save PR | ||
1250 | ;; | ||
1251 | and r18=0xf,r17 // r18 = cr.ipsr.code{3:0} | ||
1252 | tbit.z p6,p0=r17,IA64_ISR_NA_BIT | ||
1253 | ;; | ||
1254 | cmp.ne.or p6,p0=IA64_ISR_CODE_LFETCH,r18 | ||
1255 | dep r16=-1,r16,IA64_PSR_ED_BIT,1 | ||
1256 | (p6) br.cond.spnt 1f // branch if (cr.ispr.na == 0 || cr.ipsr.code{3:0} != LFETCH) | ||
1257 | ;; | ||
1258 | mov cr.ipsr=r16 // set cr.ipsr.na | ||
1259 | mov pr=r31,-1 | ||
1260 | ;; | ||
1261 | rfi | ||
1262 | |||
1263 | 1: mov pr=r31,-1 | ||
1264 | ;; | ||
1207 | FAULT(26) | 1265 | FAULT(26) |
1208 | END(nat_consumption) | 1266 | END(nat_consumption) |
1209 | 1267 | ||
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 3aa3167edbec..884f5cd27d8a 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c | |||
@@ -713,7 +713,7 @@ static struct kprobe trampoline_p = { | |||
713 | .pre_handler = trampoline_probe_handler | 713 | .pre_handler = trampoline_probe_handler |
714 | }; | 714 | }; |
715 | 715 | ||
716 | int __init arch_init(void) | 716 | int __init arch_init_kprobes(void) |
717 | { | 717 | { |
718 | trampoline_p.addr = | 718 | trampoline_p.addr = |
719 | (kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip; | 719 | (kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip; |
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c index 6d57aebad485..bbb8bc7c0552 100644 --- a/arch/ia64/kernel/ptrace.c +++ b/arch/ia64/kernel/ptrace.c | |||
@@ -725,12 +725,32 @@ convert_to_non_syscall (struct task_struct *child, struct pt_regs *pt, | |||
725 | break; | 725 | break; |
726 | } | 726 | } |
727 | 727 | ||
728 | /* | ||
729 | * Note: at the time of this call, the target task is blocked | ||
730 | * in notify_resume_user() and by clearling PRED_LEAVE_SYSCALL | ||
731 | * (aka, "pLvSys") we redirect execution from | ||
732 | * .work_pending_syscall_end to .work_processed_kernel. | ||
733 | */ | ||
728 | unw_get_pr(&prev_info, &pr); | 734 | unw_get_pr(&prev_info, &pr); |
729 | pr &= ~(1UL << PRED_SYSCALL); | 735 | pr &= ~((1UL << PRED_SYSCALL) | (1UL << PRED_LEAVE_SYSCALL)); |
730 | pr |= (1UL << PRED_NON_SYSCALL); | 736 | pr |= (1UL << PRED_NON_SYSCALL); |
731 | unw_set_pr(&prev_info, pr); | 737 | unw_set_pr(&prev_info, pr); |
732 | 738 | ||
733 | pt->cr_ifs = (1UL << 63) | cfm; | 739 | pt->cr_ifs = (1UL << 63) | cfm; |
740 | /* | ||
741 | * Clear the memory that is NOT written on syscall-entry to | ||
742 | * ensure we do not leak kernel-state to user when execution | ||
743 | * resumes. | ||
744 | */ | ||
745 | pt->r2 = 0; | ||
746 | pt->r3 = 0; | ||
747 | pt->r14 = 0; | ||
748 | memset(&pt->r16, 0, 16*8); /* clear r16-r31 */ | ||
749 | memset(&pt->f6, 0, 6*16); /* clear f6-f11 */ | ||
750 | pt->b7 = 0; | ||
751 | pt->ar_ccv = 0; | ||
752 | pt->ar_csd = 0; | ||
753 | pt->ar_ssd = 0; | ||
734 | } | 754 | } |
735 | 755 | ||
736 | static int | 756 | static int |
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index d14692e0920a..2693e1522d7c 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c | |||
@@ -72,6 +72,8 @@ DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8); | |||
72 | unsigned long ia64_cycles_per_usec; | 72 | unsigned long ia64_cycles_per_usec; |
73 | struct ia64_boot_param *ia64_boot_param; | 73 | struct ia64_boot_param *ia64_boot_param; |
74 | struct screen_info screen_info; | 74 | struct screen_info screen_info; |
75 | unsigned long vga_console_iobase; | ||
76 | unsigned long vga_console_membase; | ||
75 | 77 | ||
76 | unsigned long ia64_max_cacheline_size; | 78 | unsigned long ia64_max_cacheline_size; |
77 | unsigned long ia64_iobase; /* virtual address for I/O accesses */ | 79 | unsigned long ia64_iobase; /* virtual address for I/O accesses */ |
@@ -273,23 +275,25 @@ io_port_init (void) | |||
273 | static inline int __init | 275 | static inline int __init |
274 | early_console_setup (char *cmdline) | 276 | early_console_setup (char *cmdline) |
275 | { | 277 | { |
278 | int earlycons = 0; | ||
279 | |||
276 | #ifdef CONFIG_SERIAL_SGI_L1_CONSOLE | 280 | #ifdef CONFIG_SERIAL_SGI_L1_CONSOLE |
277 | { | 281 | { |
278 | extern int sn_serial_console_early_setup(void); | 282 | extern int sn_serial_console_early_setup(void); |
279 | if (!sn_serial_console_early_setup()) | 283 | if (!sn_serial_console_early_setup()) |
280 | return 0; | 284 | earlycons++; |
281 | } | 285 | } |
282 | #endif | 286 | #endif |
283 | #ifdef CONFIG_EFI_PCDP | 287 | #ifdef CONFIG_EFI_PCDP |
284 | if (!efi_setup_pcdp_console(cmdline)) | 288 | if (!efi_setup_pcdp_console(cmdline)) |
285 | return 0; | 289 | earlycons++; |
286 | #endif | 290 | #endif |
287 | #ifdef CONFIG_SERIAL_8250_CONSOLE | 291 | #ifdef CONFIG_SERIAL_8250_CONSOLE |
288 | if (!early_serial_console_init(cmdline)) | 292 | if (!early_serial_console_init(cmdline)) |
289 | return 0; | 293 | earlycons++; |
290 | #endif | 294 | #endif |
291 | 295 | ||
292 | return -1; | 296 | return (earlycons) ? 0 : -1; |
293 | } | 297 | } |
294 | 298 | ||
295 | static inline void | 299 | static inline void |
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c index b49d4ddaab93..0166a9847095 100644 --- a/arch/ia64/kernel/smp.c +++ b/arch/ia64/kernel/smp.c | |||
@@ -231,13 +231,16 @@ smp_flush_tlb_all (void) | |||
231 | void | 231 | void |
232 | smp_flush_tlb_mm (struct mm_struct *mm) | 232 | smp_flush_tlb_mm (struct mm_struct *mm) |
233 | { | 233 | { |
234 | preempt_disable(); | ||
234 | /* this happens for the common case of a single-threaded fork(): */ | 235 | /* this happens for the common case of a single-threaded fork(): */ |
235 | if (likely(mm == current->active_mm && atomic_read(&mm->mm_users) == 1)) | 236 | if (likely(mm == current->active_mm && atomic_read(&mm->mm_users) == 1)) |
236 | { | 237 | { |
237 | local_finish_flush_tlb_mm(mm); | 238 | local_finish_flush_tlb_mm(mm); |
239 | preempt_enable(); | ||
238 | return; | 240 | return; |
239 | } | 241 | } |
240 | 242 | ||
243 | preempt_enable(); | ||
241 | /* | 244 | /* |
242 | * We could optimize this further by using mm->cpu_vm_mask to track which CPUs | 245 | * We could optimize this further by using mm->cpu_vm_mask to track which CPUs |
243 | * have been running in the address space. It's not clear that this is worth the | 246 | * have been running in the address space. It's not clear that this is worth the |
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index e3fc4edea113..720a861f88be 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
@@ -312,7 +312,7 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus) | |||
312 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, add_window, | 312 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, add_window, |
313 | &info); | 313 | &info); |
314 | 314 | ||
315 | pbus = pci_scan_bus(bus, &pci_root_ops, controller); | 315 | pbus = pci_scan_bus_parented(NULL, bus, &pci_root_ops, controller); |
316 | if (pbus) | 316 | if (pbus) |
317 | pcibios_setup_root_windows(pbus, controller); | 317 | pcibios_setup_root_windows(pbus, controller); |
318 | 318 | ||
@@ -373,6 +373,25 @@ void pcibios_bus_to_resource(struct pci_dev *dev, | |||
373 | res->end = region->end + offset; | 373 | res->end = region->end + offset; |
374 | } | 374 | } |
375 | 375 | ||
376 | static int __devinit is_valid_resource(struct pci_dev *dev, int idx) | ||
377 | { | ||
378 | unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; | ||
379 | struct resource *devr = &dev->resource[idx]; | ||
380 | |||
381 | if (!dev->bus) | ||
382 | return 0; | ||
383 | for (i=0; i<PCI_BUS_NUM_RESOURCES; i++) { | ||
384 | struct resource *busr = dev->bus->resource[i]; | ||
385 | |||
386 | if (!busr || ((busr->flags ^ devr->flags) & type_mask)) | ||
387 | continue; | ||
388 | if ((devr->start) && (devr->start >= busr->start) && | ||
389 | (devr->end <= busr->end)) | ||
390 | return 1; | ||
391 | } | ||
392 | return 0; | ||
393 | } | ||
394 | |||
376 | static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) | 395 | static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) |
377 | { | 396 | { |
378 | struct pci_bus_region region; | 397 | struct pci_bus_region region; |
@@ -386,7 +405,8 @@ static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) | |||
386 | region.start = dev->resource[i].start; | 405 | region.start = dev->resource[i].start; |
387 | region.end = dev->resource[i].end; | 406 | region.end = dev->resource[i].end; |
388 | pcibios_bus_to_resource(dev, &dev->resource[i], ®ion); | 407 | pcibios_bus_to_resource(dev, &dev->resource[i], ®ion); |
389 | pci_claim_resource(dev, i); | 408 | if ((is_valid_resource(dev, i))) |
409 | pci_claim_resource(dev, i); | ||
390 | } | 410 | } |
391 | } | 411 | } |
392 | 412 | ||
@@ -398,6 +418,10 @@ pcibios_fixup_bus (struct pci_bus *b) | |||
398 | { | 418 | { |
399 | struct pci_dev *dev; | 419 | struct pci_dev *dev; |
400 | 420 | ||
421 | if (b->self) { | ||
422 | pci_read_bridge_bases(b); | ||
423 | pcibios_fixup_device_resources(b->self); | ||
424 | } | ||
401 | list_for_each_entry(dev, &b->devices, bus_list) | 425 | list_for_each_entry(dev, &b->devices, bus_list) |
402 | pcibios_fixup_device_resources(dev); | 426 | pcibios_fixup_device_resources(dev); |
403 | 427 | ||
@@ -418,18 +442,24 @@ pcibios_enable_resources (struct pci_dev *dev, int mask) | |||
418 | u16 cmd, old_cmd; | 442 | u16 cmd, old_cmd; |
419 | int idx; | 443 | int idx; |
420 | struct resource *r; | 444 | struct resource *r; |
445 | unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM; | ||
421 | 446 | ||
422 | if (!dev) | 447 | if (!dev) |
423 | return -EINVAL; | 448 | return -EINVAL; |
424 | 449 | ||
425 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | 450 | pci_read_config_word(dev, PCI_COMMAND, &cmd); |
426 | old_cmd = cmd; | 451 | old_cmd = cmd; |
427 | for (idx=0; idx<6; idx++) { | 452 | for (idx=0; idx<PCI_NUM_RESOURCES; idx++) { |
428 | /* Only set up the desired resources. */ | 453 | /* Only set up the desired resources. */ |
429 | if (!(mask & (1 << idx))) | 454 | if (!(mask & (1 << idx))) |
430 | continue; | 455 | continue; |
431 | 456 | ||
432 | r = &dev->resource[idx]; | 457 | r = &dev->resource[idx]; |
458 | if (!(r->flags & type_mask)) | ||
459 | continue; | ||
460 | if ((idx == PCI_ROM_RESOURCE) && | ||
461 | (!(r->flags & IORESOURCE_ROM_ENABLE))) | ||
462 | continue; | ||
433 | if (!r->start && r->end) { | 463 | if (!r->start && r->end) { |
434 | printk(KERN_ERR | 464 | printk(KERN_ERR |
435 | "PCI: Device %s not available because of resource collisions\n", | 465 | "PCI: Device %s not available because of resource collisions\n", |
@@ -441,8 +471,6 @@ pcibios_enable_resources (struct pci_dev *dev, int mask) | |||
441 | if (r->flags & IORESOURCE_MEM) | 471 | if (r->flags & IORESOURCE_MEM) |
442 | cmd |= PCI_COMMAND_MEMORY; | 472 | cmd |= PCI_COMMAND_MEMORY; |
443 | } | 473 | } |
444 | if (dev->resource[PCI_ROM_RESOURCE].start) | ||
445 | cmd |= PCI_COMMAND_MEMORY; | ||
446 | if (cmd != old_cmd) { | 474 | if (cmd != old_cmd) { |
447 | printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd); | 475 | printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd); |
448 | pci_write_config_word(dev, PCI_COMMAND, cmd); | 476 | pci_write_config_word(dev, PCI_COMMAND, cmd); |
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c index 9e07f5463f21..783eb4323847 100644 --- a/arch/ia64/sn/kernel/io_init.c +++ b/arch/ia64/sn/kernel/io_init.c | |||
@@ -384,7 +384,7 @@ static int __init sn_pci_init(void) | |||
384 | extern void register_sn_procfs(void); | 384 | extern void register_sn_procfs(void); |
385 | #endif | 385 | #endif |
386 | 386 | ||
387 | if (!ia64_platform_is("sn2") || IS_RUNNING_ON_SIMULATOR()) | 387 | if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM()) |
388 | return 0; | 388 | return 0; |
389 | 389 | ||
390 | /* | 390 | /* |
diff --git a/arch/ia64/sn/kernel/iomv.c b/arch/ia64/sn/kernel/iomv.c index fec6d8b8237b..7ce3cdad627b 100644 --- a/arch/ia64/sn/kernel/iomv.c +++ b/arch/ia64/sn/kernel/iomv.c | |||
@@ -9,12 +9,16 @@ | |||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <asm/io.h> | 10 | #include <asm/io.h> |
11 | #include <asm/delay.h> | 11 | #include <asm/delay.h> |
12 | #include <asm/vga.h> | ||
12 | #include <asm/sn/nodepda.h> | 13 | #include <asm/sn/nodepda.h> |
13 | #include <asm/sn/simulator.h> | 14 | #include <asm/sn/simulator.h> |
14 | #include <asm/sn/pda.h> | 15 | #include <asm/sn/pda.h> |
15 | #include <asm/sn/sn_cpuid.h> | 16 | #include <asm/sn/sn_cpuid.h> |
16 | #include <asm/sn/shub_mmr.h> | 17 | #include <asm/sn/shub_mmr.h> |
17 | 18 | ||
19 | #define IS_LEGACY_VGA_IOPORT(p) \ | ||
20 | (((p) >= 0x3b0 && (p) <= 0x3bb) || ((p) >= 0x3c0 && (p) <= 0x3df)) | ||
21 | |||
18 | /** | 22 | /** |
19 | * sn_io_addr - convert an in/out port to an i/o address | 23 | * sn_io_addr - convert an in/out port to an i/o address |
20 | * @port: port to convert | 24 | * @port: port to convert |
@@ -26,6 +30,8 @@ | |||
26 | void *sn_io_addr(unsigned long port) | 30 | void *sn_io_addr(unsigned long port) |
27 | { | 31 | { |
28 | if (!IS_RUNNING_ON_SIMULATOR()) { | 32 | if (!IS_RUNNING_ON_SIMULATOR()) { |
33 | if (IS_LEGACY_VGA_IOPORT(port)) | ||
34 | port += vga_console_iobase; | ||
29 | /* On sn2, legacy I/O ports don't point at anything */ | 35 | /* On sn2, legacy I/O ports don't point at anything */ |
30 | if (port < (64 * 1024)) | 36 | if (port < (64 * 1024)) |
31 | return NULL; | 37 | return NULL; |
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c index 44bfc7f318cb..22e10d282c7f 100644 --- a/arch/ia64/sn/kernel/setup.c +++ b/arch/ia64/sn/kernel/setup.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <asm/machvec.h> | 36 | #include <asm/machvec.h> |
37 | #include <asm/system.h> | 37 | #include <asm/system.h> |
38 | #include <asm/processor.h> | 38 | #include <asm/processor.h> |
39 | #include <asm/vga.h> | ||
39 | #include <asm/sn/arch.h> | 40 | #include <asm/sn/arch.h> |
40 | #include <asm/sn/addrs.h> | 41 | #include <asm/sn/addrs.h> |
41 | #include <asm/sn/pda.h> | 42 | #include <asm/sn/pda.h> |
@@ -95,6 +96,7 @@ u8 sn_coherency_id; | |||
95 | EXPORT_SYMBOL(sn_coherency_id); | 96 | EXPORT_SYMBOL(sn_coherency_id); |
96 | u8 sn_region_size; | 97 | u8 sn_region_size; |
97 | EXPORT_SYMBOL(sn_region_size); | 98 | EXPORT_SYMBOL(sn_region_size); |
99 | int sn_prom_type; /* 0=hardware, 1=medusa/realprom, 2=medusa/fakeprom */ | ||
98 | 100 | ||
99 | short physical_node_map[MAX_PHYSNODE_ID]; | 101 | short physical_node_map[MAX_PHYSNODE_ID]; |
100 | 102 | ||
@@ -273,14 +275,17 @@ void __init sn_setup(char **cmdline_p) | |||
273 | 275 | ||
274 | ia64_sn_plat_set_error_handling_features(); | 276 | ia64_sn_plat_set_error_handling_features(); |
275 | 277 | ||
278 | #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) | ||
276 | /* | 279 | /* |
277 | * If the generic code has enabled vga console support - lets | 280 | * If there was a primary vga adapter identified through the |
278 | * get rid of it again. This is a kludge for the fact that ACPI | 281 | * EFI PCDP table, make it the preferred console. Otherwise |
279 | * currtently has no way of informing us if legacy VGA is available | 282 | * zero out conswitchp. |
280 | * or not. | ||
281 | */ | 283 | */ |
282 | #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) | 284 | |
283 | if (conswitchp == &vga_con) { | 285 | if (vga_console_membase) { |
286 | /* usable vga ... make tty0 the preferred default console */ | ||
287 | add_preferred_console("tty", 0, NULL); | ||
288 | } else { | ||
284 | printk(KERN_DEBUG "SGI: Disabling VGA console\n"); | 289 | printk(KERN_DEBUG "SGI: Disabling VGA console\n"); |
285 | #ifdef CONFIG_DUMMY_CONSOLE | 290 | #ifdef CONFIG_DUMMY_CONSOLE |
286 | conswitchp = &dummy_con; | 291 | conswitchp = &dummy_con; |
@@ -350,7 +355,7 @@ void __init sn_setup(char **cmdline_p) | |||
350 | 355 | ||
351 | ia64_mark_idle = &snidle; | 356 | ia64_mark_idle = &snidle; |
352 | 357 | ||
353 | /* | 358 | /* |
354 | * For the bootcpu, we do this here. All other cpus will make the | 359 | * For the bootcpu, we do this here. All other cpus will make the |
355 | * call as part of cpu_init in slave cpu initialization. | 360 | * call as part of cpu_init in slave cpu initialization. |
356 | */ | 361 | */ |
@@ -397,7 +402,7 @@ static void __init sn_init_pdas(char **cmdline_p) | |||
397 | nodepdaindr[cnode] = | 402 | nodepdaindr[cnode] = |
398 | alloc_bootmem_node(NODE_DATA(cnode), sizeof(nodepda_t)); | 403 | alloc_bootmem_node(NODE_DATA(cnode), sizeof(nodepda_t)); |
399 | memset(nodepdaindr[cnode], 0, sizeof(nodepda_t)); | 404 | memset(nodepdaindr[cnode], 0, sizeof(nodepda_t)); |
400 | memset(nodepdaindr[cnode]->phys_cpuid, -1, | 405 | memset(nodepdaindr[cnode]->phys_cpuid, -1, |
401 | sizeof(nodepdaindr[cnode]->phys_cpuid)); | 406 | sizeof(nodepdaindr[cnode]->phys_cpuid)); |
402 | } | 407 | } |
403 | 408 | ||
@@ -427,7 +432,7 @@ static void __init sn_init_pdas(char **cmdline_p) | |||
427 | } | 432 | } |
428 | 433 | ||
429 | /* | 434 | /* |
430 | * Initialize the per node hubdev. This includes IO Nodes and | 435 | * Initialize the per node hubdev. This includes IO Nodes and |
431 | * headless/memless nodes. | 436 | * headless/memless nodes. |
432 | */ | 437 | */ |
433 | for (cnode = 0; cnode < numionodes; cnode++) { | 438 | for (cnode = 0; cnode < numionodes; cnode++) { |
@@ -455,6 +460,14 @@ void __init sn_cpu_init(void) | |||
455 | int i; | 460 | int i; |
456 | static int wars_have_been_checked; | 461 | static int wars_have_been_checked; |
457 | 462 | ||
463 | if (smp_processor_id() == 0 && IS_MEDUSA()) { | ||
464 | if (ia64_sn_is_fake_prom()) | ||
465 | sn_prom_type = 2; | ||
466 | else | ||
467 | sn_prom_type = 1; | ||
468 | printk("Running on medusa with %s PROM\n", (sn_prom_type == 1) ? "real" : "fake"); | ||
469 | } | ||
470 | |||
458 | memset(pda, 0, sizeof(pda)); | 471 | memset(pda, 0, sizeof(pda)); |
459 | if (ia64_sn_get_sn_info(0, &sn_hub_info->shub2, &sn_hub_info->nasid_bitmask, &sn_hub_info->nasid_shift, | 472 | if (ia64_sn_get_sn_info(0, &sn_hub_info->shub2, &sn_hub_info->nasid_bitmask, &sn_hub_info->nasid_shift, |
460 | &sn_system_size, &sn_sharing_domain_size, &sn_partition_id, | 473 | &sn_system_size, &sn_sharing_domain_size, &sn_partition_id, |
@@ -520,7 +533,7 @@ void __init sn_cpu_init(void) | |||
520 | */ | 533 | */ |
521 | { | 534 | { |
522 | u64 pio1[] = {SH1_PIO_WRITE_STATUS_0, 0, SH1_PIO_WRITE_STATUS_1, 0}; | 535 | u64 pio1[] = {SH1_PIO_WRITE_STATUS_0, 0, SH1_PIO_WRITE_STATUS_1, 0}; |
523 | u64 pio2[] = {SH2_PIO_WRITE_STATUS_0, SH2_PIO_WRITE_STATUS_1, | 536 | u64 pio2[] = {SH2_PIO_WRITE_STATUS_0, SH2_PIO_WRITE_STATUS_1, |
524 | SH2_PIO_WRITE_STATUS_2, SH2_PIO_WRITE_STATUS_3}; | 537 | SH2_PIO_WRITE_STATUS_2, SH2_PIO_WRITE_STATUS_3}; |
525 | u64 *pio; | 538 | u64 *pio; |
526 | pio = is_shub1() ? pio1 : pio2; | 539 | pio = is_shub1() ? pio1 : pio2; |
@@ -552,6 +565,10 @@ static void __init scan_for_ionodes(void) | |||
552 | int nasid = 0; | 565 | int nasid = 0; |
553 | lboard_t *brd; | 566 | lboard_t *brd; |
554 | 567 | ||
568 | /* fakeprom does not support klgraph */ | ||
569 | if (IS_RUNNING_ON_FAKE_PROM()) | ||
570 | return; | ||
571 | |||
555 | /* Setup ionodes with memory */ | 572 | /* Setup ionodes with memory */ |
556 | for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) { | 573 | for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) { |
557 | char *klgraph_header; | 574 | char *klgraph_header; |
@@ -563,8 +580,6 @@ static void __init scan_for_ionodes(void) | |||
563 | cnodeid = -1; | 580 | cnodeid = -1; |
564 | klgraph_header = __va(ia64_sn_get_klconfig_addr(nasid)); | 581 | klgraph_header = __va(ia64_sn_get_klconfig_addr(nasid)); |
565 | if (!klgraph_header) { | 582 | if (!klgraph_header) { |
566 | if (IS_RUNNING_ON_SIMULATOR()) | ||
567 | continue; | ||
568 | BUG(); /* All nodes must have klconfig tables! */ | 583 | BUG(); /* All nodes must have klconfig tables! */ |
569 | } | 584 | } |
570 | cnodeid = nasid_to_cnodeid(nasid); | 585 | cnodeid = nasid_to_cnodeid(nasid); |
@@ -630,8 +645,8 @@ int | |||
630 | nasid_slice_to_cpuid(int nasid, int slice) | 645 | nasid_slice_to_cpuid(int nasid, int slice) |
631 | { | 646 | { |
632 | long cpu; | 647 | long cpu; |
633 | 648 | ||
634 | for (cpu=0; cpu < NR_CPUS; cpu++) | 649 | for (cpu=0; cpu < NR_CPUS; cpu++) |
635 | if (cpuid_to_nasid(cpu) == nasid && | 650 | if (cpuid_to_nasid(cpu) == nasid && |
636 | cpuid_to_slice(cpu) == slice) | 651 | cpuid_to_slice(cpu) == slice) |
637 | return cpu; | 652 | return cpu; |
diff --git a/arch/ia64/sn/kernel/sn2/ptc_deadlock.S b/arch/ia64/sn/kernel/sn2/ptc_deadlock.S index 7947312801ec..96cb71d15682 100644 --- a/arch/ia64/sn/kernel/sn2/ptc_deadlock.S +++ b/arch/ia64/sn/kernel/sn2/ptc_deadlock.S | |||
@@ -6,6 +6,7 @@ | |||
6 | * Copyright (C) 2000-2004 Silicon Graphics, Inc. All rights reserved. | 6 | * Copyright (C) 2000-2004 Silicon Graphics, Inc. All rights reserved. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <asm/types.h> | ||
9 | #include <asm/sn/shub_mmr.h> | 10 | #include <asm/sn/shub_mmr.h> |
10 | 11 | ||
11 | #define DEADLOCKBIT SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_SHFT | 12 | #define DEADLOCKBIT SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_SHFT |
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c index a087b274847e..8716f4d5314b 100644 --- a/arch/ia64/sn/kernel/tiocx.c +++ b/arch/ia64/sn/kernel/tiocx.c | |||
@@ -204,8 +204,8 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num, | |||
204 | cx_dev->dev.parent = NULL; | 204 | cx_dev->dev.parent = NULL; |
205 | cx_dev->dev.bus = &tiocx_bus_type; | 205 | cx_dev->dev.bus = &tiocx_bus_type; |
206 | cx_dev->dev.release = tiocx_bus_release; | 206 | cx_dev->dev.release = tiocx_bus_release; |
207 | snprintf(cx_dev->dev.bus_id, BUS_ID_SIZE, "%d.0x%x", | 207 | snprintf(cx_dev->dev.bus_id, BUS_ID_SIZE, "%d", |
208 | cx_dev->cx_id.nasid, cx_dev->cx_id.part_num); | 208 | cx_dev->cx_id.nasid); |
209 | device_register(&cx_dev->dev); | 209 | device_register(&cx_dev->dev); |
210 | get_device(&cx_dev->dev); | 210 | get_device(&cx_dev->dev); |
211 | 211 | ||
@@ -236,7 +236,6 @@ int cx_device_unregister(struct cx_dev *cx_dev) | |||
236 | */ | 236 | */ |
237 | static int cx_device_reload(struct cx_dev *cx_dev) | 237 | static int cx_device_reload(struct cx_dev *cx_dev) |
238 | { | 238 | { |
239 | device_remove_file(&cx_dev->dev, &dev_attr_cxdev_control); | ||
240 | cx_device_unregister(cx_dev); | 239 | cx_device_unregister(cx_dev); |
241 | return cx_device_register(cx_dev->cx_id.nasid, cx_dev->cx_id.part_num, | 240 | return cx_device_register(cx_dev->cx_id.nasid, cx_dev->cx_id.part_num, |
242 | cx_dev->cx_id.mfg_num, cx_dev->hubdev); | 241 | cx_dev->cx_id.mfg_num, cx_dev->hubdev); |
@@ -383,6 +382,7 @@ static int is_fpga_brick(int nasid) | |||
383 | switch (tiocx_btchar_get(nasid)) { | 382 | switch (tiocx_btchar_get(nasid)) { |
384 | case L1_BRICKTYPE_SA: | 383 | case L1_BRICKTYPE_SA: |
385 | case L1_BRICKTYPE_ATHENA: | 384 | case L1_BRICKTYPE_ATHENA: |
385 | case L1_BRICKTYPE_DAYTONA: | ||
386 | return 1; | 386 | return 1; |
387 | } | 387 | } |
388 | return 0; | 388 | return 0; |
@@ -409,7 +409,7 @@ static int tiocx_reload(struct cx_dev *cx_dev) | |||
409 | uint64_t cx_id; | 409 | uint64_t cx_id; |
410 | 410 | ||
411 | cx_id = | 411 | cx_id = |
412 | *(volatile int32_t *)(TIO_SWIN_BASE(nasid, TIOCX_CORELET) + | 412 | *(volatile uint64_t *)(TIO_SWIN_BASE(nasid, TIOCX_CORELET) + |
413 | WIDGET_ID); | 413 | WIDGET_ID); |
414 | part_num = XWIDGET_PART_NUM(cx_id); | 414 | part_num = XWIDGET_PART_NUM(cx_id); |
415 | mfg_num = XWIDGET_MFG_NUM(cx_id); | 415 | mfg_num = XWIDGET_MFG_NUM(cx_id); |
@@ -458,6 +458,10 @@ static ssize_t store_cxdev_control(struct device *dev, struct device_attribute * | |||
458 | 458 | ||
459 | switch (n) { | 459 | switch (n) { |
460 | case 1: | 460 | case 1: |
461 | tio_corelet_reset(cx_dev->cx_id.nasid, TIOCX_CORELET); | ||
462 | tiocx_reload(cx_dev); | ||
463 | break; | ||
464 | case 2: | ||
461 | tiocx_reload(cx_dev); | 465 | tiocx_reload(cx_dev); |
462 | break; | 466 | break; |
463 | case 3: | 467 | case 3: |
@@ -537,7 +541,7 @@ static void __exit tiocx_exit(void) | |||
537 | bus_unregister(&tiocx_bus_type); | 541 | bus_unregister(&tiocx_bus_type); |
538 | } | 542 | } |
539 | 543 | ||
540 | module_init(tiocx_init); | 544 | subsys_initcall(tiocx_init); |
541 | module_exit(tiocx_exit); | 545 | module_exit(tiocx_exit); |
542 | 546 | ||
543 | /************************************************************************ | 547 | /************************************************************************ |
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c index 8dae9eb45456..05aa8c2fe9bb 100644 --- a/arch/ia64/sn/pci/tioca_provider.c +++ b/arch/ia64/sn/pci/tioca_provider.c | |||
@@ -336,7 +336,7 @@ tioca_dma_d48(struct pci_dev *pdev, uint64_t paddr) | |||
336 | if (!ct_addr) | 336 | if (!ct_addr) |
337 | return 0; | 337 | return 0; |
338 | 338 | ||
339 | bus_addr = (dma_addr_t) (ct_addr & 0xffffffffffff); | 339 | bus_addr = (dma_addr_t) (ct_addr & 0xffffffffffffUL); |
340 | node_upper = ct_addr >> 48; | 340 | node_upper = ct_addr >> 48; |
341 | 341 | ||
342 | if (node_upper > 64) { | 342 | if (node_upper > 64) { |
@@ -464,7 +464,7 @@ map_return: | |||
464 | * For mappings created using the direct modes (64 or 48) there are no | 464 | * For mappings created using the direct modes (64 or 48) there are no |
465 | * resources to release. | 465 | * resources to release. |
466 | */ | 466 | */ |
467 | void | 467 | static void |
468 | tioca_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir) | 468 | tioca_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir) |
469 | { | 469 | { |
470 | int i, entry; | 470 | int i, entry; |
@@ -514,7 +514,7 @@ tioca_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir) | |||
514 | * The mapping mode used is based on the devices dma_mask. As a last resort | 514 | * The mapping mode used is based on the devices dma_mask. As a last resort |
515 | * use the GART mapped mode. | 515 | * use the GART mapped mode. |
516 | */ | 516 | */ |
517 | uint64_t | 517 | static uint64_t |
518 | tioca_dma_map(struct pci_dev *pdev, uint64_t paddr, size_t byte_count) | 518 | tioca_dma_map(struct pci_dev *pdev, uint64_t paddr, size_t byte_count) |
519 | { | 519 | { |
520 | uint64_t mapaddr; | 520 | uint64_t mapaddr; |
@@ -580,7 +580,7 @@ tioca_error_intr_handler(int irq, void *arg, struct pt_regs *pt) | |||
580 | * On successful setup, returns the kernel version of tioca_common back to | 580 | * On successful setup, returns the kernel version of tioca_common back to |
581 | * the caller. | 581 | * the caller. |
582 | */ | 582 | */ |
583 | void * | 583 | static void * |
584 | tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft) | 584 | tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft) |
585 | { | 585 | { |
586 | struct tioca_common *tioca_common; | 586 | struct tioca_common *tioca_common; |
diff --git a/arch/parisc/configs/712_defconfig b/arch/parisc/configs/712_defconfig index 872085dea8a8..6efaa9293eef 100644 --- a/arch/parisc/configs/712_defconfig +++ b/arch/parisc/configs/712_defconfig | |||
@@ -506,7 +506,7 @@ CONFIG_HW_CONSOLE=y | |||
506 | # | 506 | # |
507 | CONFIG_SERIAL_8250=y | 507 | CONFIG_SERIAL_8250=y |
508 | CONFIG_SERIAL_8250_CONSOLE=y | 508 | CONFIG_SERIAL_8250_CONSOLE=y |
509 | CONFIG_SERIAL_8250_NR_UARTS=8 | 509 | CONFIG_SERIAL_8250_NR_UARTS=17 |
510 | CONFIG_SERIAL_8250_EXTENDED=y | 510 | CONFIG_SERIAL_8250_EXTENDED=y |
511 | CONFIG_SERIAL_8250_MANY_PORTS=y | 511 | CONFIG_SERIAL_8250_MANY_PORTS=y |
512 | CONFIG_SERIAL_8250_SHARE_IRQ=y | 512 | CONFIG_SERIAL_8250_SHARE_IRQ=y |
diff --git a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig index d28ebfa1070d..30fc03ed0cfb 100644 --- a/arch/parisc/configs/a500_defconfig +++ b/arch/parisc/configs/a500_defconfig | |||
@@ -662,7 +662,7 @@ CONFIG_HW_CONSOLE=y | |||
662 | CONFIG_SERIAL_8250=y | 662 | CONFIG_SERIAL_8250=y |
663 | CONFIG_SERIAL_8250_CONSOLE=y | 663 | CONFIG_SERIAL_8250_CONSOLE=y |
664 | CONFIG_SERIAL_8250_CS=m | 664 | CONFIG_SERIAL_8250_CS=m |
665 | CONFIG_SERIAL_8250_NR_UARTS=8 | 665 | CONFIG_SERIAL_8250_NR_UARTS=17 |
666 | CONFIG_SERIAL_8250_EXTENDED=y | 666 | CONFIG_SERIAL_8250_EXTENDED=y |
667 | CONFIG_SERIAL_8250_MANY_PORTS=y | 667 | CONFIG_SERIAL_8250_MANY_PORTS=y |
668 | CONFIG_SERIAL_8250_SHARE_IRQ=y | 668 | CONFIG_SERIAL_8250_SHARE_IRQ=y |
diff --git a/arch/parisc/configs/b180_defconfig b/arch/parisc/configs/b180_defconfig index 1700d7aec686..46c9511f3229 100644 --- a/arch/parisc/configs/b180_defconfig +++ b/arch/parisc/configs/b180_defconfig | |||
@@ -514,7 +514,7 @@ CONFIG_HW_CONSOLE=y | |||
514 | # | 514 | # |
515 | CONFIG_SERIAL_8250=y | 515 | CONFIG_SERIAL_8250=y |
516 | CONFIG_SERIAL_8250_CONSOLE=y | 516 | CONFIG_SERIAL_8250_CONSOLE=y |
517 | CONFIG_SERIAL_8250_NR_UARTS=4 | 517 | CONFIG_SERIAL_8250_NR_UARTS=13 |
518 | CONFIG_SERIAL_8250_EXTENDED=y | 518 | CONFIG_SERIAL_8250_EXTENDED=y |
519 | CONFIG_SERIAL_8250_MANY_PORTS=y | 519 | CONFIG_SERIAL_8250_MANY_PORTS=y |
520 | CONFIG_SERIAL_8250_SHARE_IRQ=y | 520 | CONFIG_SERIAL_8250_SHARE_IRQ=y |
diff --git a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig index b27980161c31..67aca6ccc9b0 100644 --- a/arch/parisc/configs/c3000_defconfig +++ b/arch/parisc/configs/c3000_defconfig | |||
@@ -661,7 +661,7 @@ CONFIG_HW_CONSOLE=y | |||
661 | # | 661 | # |
662 | CONFIG_SERIAL_8250=y | 662 | CONFIG_SERIAL_8250=y |
663 | CONFIG_SERIAL_8250_CONSOLE=y | 663 | CONFIG_SERIAL_8250_CONSOLE=y |
664 | CONFIG_SERIAL_8250_NR_UARTS=4 | 664 | CONFIG_SERIAL_8250_NR_UARTS=13 |
665 | CONFIG_SERIAL_8250_EXTENDED=y | 665 | CONFIG_SERIAL_8250_EXTENDED=y |
666 | CONFIG_SERIAL_8250_MANY_PORTS=y | 666 | CONFIG_SERIAL_8250_MANY_PORTS=y |
667 | CONFIG_SERIAL_8250_SHARE_IRQ=y | 667 | CONFIG_SERIAL_8250_SHARE_IRQ=y |
diff --git a/arch/parisc/defconfig b/arch/parisc/defconfig index ebd6301aa599..fdae21c503d7 100644 --- a/arch/parisc/defconfig +++ b/arch/parisc/defconfig | |||
@@ -517,7 +517,7 @@ CONFIG_HW_CONSOLE=y | |||
517 | # | 517 | # |
518 | CONFIG_SERIAL_8250=y | 518 | CONFIG_SERIAL_8250=y |
519 | CONFIG_SERIAL_8250_CONSOLE=y | 519 | CONFIG_SERIAL_8250_CONSOLE=y |
520 | CONFIG_SERIAL_8250_NR_UARTS=4 | 520 | CONFIG_SERIAL_8250_NR_UARTS=13 |
521 | CONFIG_SERIAL_8250_EXTENDED=y | 521 | CONFIG_SERIAL_8250_EXTENDED=y |
522 | CONFIG_SERIAL_8250_MANY_PORTS=y | 522 | CONFIG_SERIAL_8250_MANY_PORTS=y |
523 | CONFIG_SERIAL_8250_SHARE_IRQ=y | 523 | CONFIG_SERIAL_8250_SHARE_IRQ=y |
diff --git a/arch/ppc/8xx_io/enet.c b/arch/ppc/8xx_io/enet.c index 4ea7158e5062..ece6a9fbe09b 100644 --- a/arch/ppc/8xx_io/enet.c +++ b/arch/ppc/8xx_io/enet.c | |||
@@ -714,16 +714,24 @@ static int __init scc_enet_init(void) | |||
714 | immap->im_ioport.iop_pcdat &= ~PC_ENET_LBK; /* Disable Loopback */ | 714 | immap->im_ioport.iop_pcdat &= ~PC_ENET_LBK; /* Disable Loopback */ |
715 | #endif /* PC_ENET_LBK */ | 715 | #endif /* PC_ENET_LBK */ |
716 | 716 | ||
717 | /* Configure port C pins to enable CLSN and RENA. | 717 | #ifdef PE_ENET_TCLK |
718 | /* Configure port E for TCLK and RCLK. | ||
718 | */ | 719 | */ |
719 | immap->im_ioport.iop_pcpar &= ~(PC_ENET_CLSN | PC_ENET_RENA); | 720 | cp->cp_pepar |= (PE_ENET_TCLK | PE_ENET_RCLK); |
720 | immap->im_ioport.iop_pcdir &= ~(PC_ENET_CLSN | PC_ENET_RENA); | 721 | cp->cp_pedir &= ~(PE_ENET_TCLK | PE_ENET_RCLK); |
721 | immap->im_ioport.iop_pcso |= (PC_ENET_CLSN | PC_ENET_RENA); | 722 | cp->cp_peso &= ~(PE_ENET_TCLK | PE_ENET_RCLK); |
722 | 723 | #else | |
723 | /* Configure port A for TCLK and RCLK. | 724 | /* Configure port A for TCLK and RCLK. |
724 | */ | 725 | */ |
725 | immap->im_ioport.iop_papar |= (PA_ENET_TCLK | PA_ENET_RCLK); | 726 | immap->im_ioport.iop_papar |= (PA_ENET_TCLK | PA_ENET_RCLK); |
726 | immap->im_ioport.iop_padir &= ~(PA_ENET_TCLK | PA_ENET_RCLK); | 727 | immap->im_ioport.iop_padir &= ~(PA_ENET_TCLK | PA_ENET_RCLK); |
728 | #endif | ||
729 | |||
730 | /* Configure port C pins to enable CLSN and RENA. | ||
731 | */ | ||
732 | immap->im_ioport.iop_pcpar &= ~(PC_ENET_CLSN | PC_ENET_RENA); | ||
733 | immap->im_ioport.iop_pcdir &= ~(PC_ENET_CLSN | PC_ENET_RENA); | ||
734 | immap->im_ioport.iop_pcso |= (PC_ENET_CLSN | PC_ENET_RENA); | ||
727 | 735 | ||
728 | /* Configure Serial Interface clock routing. | 736 | /* Configure Serial Interface clock routing. |
729 | * First, clear all SCC bits to zero, then set the ones we want. | 737 | * First, clear all SCC bits to zero, then set the ones we want. |
@@ -896,14 +904,18 @@ static int __init scc_enet_init(void) | |||
896 | /* It is now OK to enable the Ethernet transmitter. | 904 | /* It is now OK to enable the Ethernet transmitter. |
897 | * Unfortunately, there are board implementation differences here. | 905 | * Unfortunately, there are board implementation differences here. |
898 | */ | 906 | */ |
899 | #if (!defined (PB_ENET_TENA) && defined (PC_ENET_TENA)) | 907 | #if (!defined (PB_ENET_TENA) && defined (PC_ENET_TENA) && !defined (PE_ENET_TENA)) |
900 | immap->im_ioport.iop_pcpar |= PC_ENET_TENA; | 908 | immap->im_ioport.iop_pcpar |= PC_ENET_TENA; |
901 | immap->im_ioport.iop_pcdir &= ~PC_ENET_TENA; | 909 | immap->im_ioport.iop_pcdir &= ~PC_ENET_TENA; |
902 | #elif ( defined (PB_ENET_TENA) && !defined (PC_ENET_TENA)) | 910 | #elif ( defined (PB_ENET_TENA) && !defined (PC_ENET_TENA) && !defined (PE_ENET_TENA)) |
903 | cp->cp_pbpar |= PB_ENET_TENA; | 911 | cp->cp_pbpar |= PB_ENET_TENA; |
904 | cp->cp_pbdir |= PB_ENET_TENA; | 912 | cp->cp_pbdir |= PB_ENET_TENA; |
913 | #elif ( !defined (PB_ENET_TENA) && !defined (PC_ENET_TENA) && defined (PE_ENET_TENA)) | ||
914 | cp->cp_pepar |= PE_ENET_TENA; | ||
915 | cp->cp_pedir &= ~PE_ENET_TENA; | ||
916 | cp->cp_peso |= PE_ENET_TENA; | ||
905 | #else | 917 | #else |
906 | #error Configuration Error: define exactly ONE of PB_ENET_TENA, PC_ENET_TENA | 918 | #error Configuration Error: define exactly ONE of PB_ENET_TENA, PC_ENET_TENA, PE_ENET_TENA |
907 | #endif | 919 | #endif |
908 | 920 | ||
909 | #if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC) | 921 | #if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC) |
@@ -936,6 +948,29 @@ static int __init scc_enet_init(void) | |||
936 | *((volatile uint *)BCSR1) &= ~BCSR1_ETHEN; | 948 | *((volatile uint *)BCSR1) &= ~BCSR1_ETHEN; |
937 | #endif | 949 | #endif |
938 | 950 | ||
951 | #ifdef CONFIG_MPC885ADS | ||
952 | |||
953 | /* Deassert PHY reset and enable the PHY. | ||
954 | */ | ||
955 | { | ||
956 | volatile uint __iomem *bcsr = ioremap(BCSR_ADDR, BCSR_SIZE); | ||
957 | uint tmp; | ||
958 | |||
959 | tmp = in_be32(bcsr + 1 /* BCSR1 */); | ||
960 | tmp |= BCSR1_ETHEN; | ||
961 | out_be32(bcsr + 1, tmp); | ||
962 | tmp = in_be32(bcsr + 4 /* BCSR4 */); | ||
963 | tmp |= BCSR4_ETH10_RST; | ||
964 | out_be32(bcsr + 4, tmp); | ||
965 | iounmap(bcsr); | ||
966 | } | ||
967 | |||
968 | /* On MPC885ADS SCC ethernet PHY defaults to the full duplex mode | ||
969 | * upon reset. SCC is set to half duplex by default. So this | ||
970 | * inconsistency should be better fixed by the software. | ||
971 | */ | ||
972 | #endif | ||
973 | |||
939 | dev->base_addr = (unsigned long)ep; | 974 | dev->base_addr = (unsigned long)ep; |
940 | #if 0 | 975 | #if 0 |
941 | dev->name = "CPM_ENET"; | 976 | dev->name = "CPM_ENET"; |
@@ -969,3 +1004,4 @@ static int __init scc_enet_init(void) | |||
969 | } | 1004 | } |
970 | 1005 | ||
971 | module_init(scc_enet_init); | 1006 | module_init(scc_enet_init); |
1007 | |||
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig index a7835cd3f51f..23b0d2f662c5 100644 --- a/arch/ppc/Kconfig +++ b/arch/ppc/Kconfig | |||
@@ -284,6 +284,9 @@ endmenu | |||
284 | 284 | ||
285 | menu "Platform options" | 285 | menu "Platform options" |
286 | 286 | ||
287 | config FADS | ||
288 | bool | ||
289 | |||
287 | choice | 290 | choice |
288 | prompt "8xx Machine Type" | 291 | prompt "8xx Machine Type" |
289 | depends on 8xx | 292 | depends on 8xx |
@@ -399,8 +402,25 @@ config BSEIP | |||
399 | 26MB DRAM, 4MB flash, Ethernet, a 16K-gate FPGA, USB, an LCD/video | 402 | 26MB DRAM, 4MB flash, Ethernet, a 16K-gate FPGA, USB, an LCD/video |
400 | controller, and two RS232 ports. | 403 | controller, and two RS232 ports. |
401 | 404 | ||
402 | config FADS | 405 | config MPC8XXFADS |
403 | bool "FADS" | 406 | bool "FADS" |
407 | select FADS | ||
408 | |||
409 | config MPC86XADS | ||
410 | bool "MPC86XADS" | ||
411 | help | ||
412 | MPC86x Application Development System by Freescale Semiconductor. | ||
413 | The MPC86xADS is meant to serve as a platform for s/w and h/w | ||
414 | development around the MPC86X processor families. | ||
415 | select FADS | ||
416 | |||
417 | config MPC885ADS | ||
418 | bool "MPC885ADS" | ||
419 | help | ||
420 | Freescale Semiconductor MPC885 Application Development System (ADS). | ||
421 | Also known as DUET. | ||
422 | The MPC885ADS is meant to serve as a platform for s/w and h/w | ||
423 | development around the MPC885 processor family. | ||
404 | 424 | ||
405 | config TQM823L | 425 | config TQM823L |
406 | bool "TQM823L" | 426 | bool "TQM823L" |
diff --git a/arch/ppc/configs/mpc86x_ads_defconfig b/arch/ppc/configs/mpc86x_ads_defconfig new file mode 100644 index 000000000000..f63c6f59d68a --- /dev/null +++ b/arch/ppc/configs/mpc86x_ads_defconfig | |||
@@ -0,0 +1,633 @@ | |||
1 | # | ||
2 | # Automatically generated make config: don't edit | ||
3 | # Linux kernel version: 2.6.12-rc4 | ||
4 | # Tue Jun 14 13:36:35 2005 | ||
5 | # | ||
6 | CONFIG_MMU=y | ||
7 | CONFIG_GENERIC_HARDIRQS=y | ||
8 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | ||
9 | CONFIG_GENERIC_CALIBRATE_DELAY=y | ||
10 | CONFIG_HAVE_DEC_LOCK=y | ||
11 | CONFIG_PPC=y | ||
12 | CONFIG_PPC32=y | ||
13 | CONFIG_GENERIC_NVRAM=y | ||
14 | CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y | ||
15 | |||
16 | # | ||
17 | # Code maturity level options | ||
18 | # | ||
19 | CONFIG_EXPERIMENTAL=y | ||
20 | # CONFIG_CLEAN_COMPILE is not set | ||
21 | CONFIG_BROKEN=y | ||
22 | CONFIG_BROKEN_ON_SMP=y | ||
23 | CONFIG_INIT_ENV_ARG_LIMIT=32 | ||
24 | |||
25 | # | ||
26 | # General setup | ||
27 | # | ||
28 | CONFIG_LOCALVERSION="" | ||
29 | # CONFIG_SWAP is not set | ||
30 | CONFIG_SYSVIPC=y | ||
31 | # CONFIG_POSIX_MQUEUE is not set | ||
32 | # CONFIG_BSD_PROCESS_ACCT is not set | ||
33 | CONFIG_SYSCTL=y | ||
34 | # CONFIG_AUDIT is not set | ||
35 | # CONFIG_HOTPLUG is not set | ||
36 | CONFIG_KOBJECT_UEVENT=y | ||
37 | # CONFIG_IKCONFIG is not set | ||
38 | CONFIG_EMBEDDED=y | ||
39 | # CONFIG_KALLSYMS is not set | ||
40 | CONFIG_PRINTK=y | ||
41 | CONFIG_BUG=y | ||
42 | # CONFIG_BASE_FULL is not set | ||
43 | CONFIG_FUTEX=y | ||
44 | # CONFIG_EPOLL is not set | ||
45 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | ||
46 | # CONFIG_SHMEM is not set | ||
47 | CONFIG_CC_ALIGN_FUNCTIONS=0 | ||
48 | CONFIG_CC_ALIGN_LABELS=0 | ||
49 | CONFIG_CC_ALIGN_LOOPS=0 | ||
50 | CONFIG_CC_ALIGN_JUMPS=0 | ||
51 | CONFIG_TINY_SHMEM=y | ||
52 | CONFIG_BASE_SMALL=1 | ||
53 | |||
54 | # | ||
55 | # Loadable module support | ||
56 | # | ||
57 | CONFIG_MODULES=y | ||
58 | # CONFIG_MODULE_UNLOAD is not set | ||
59 | CONFIG_OBSOLETE_MODPARM=y | ||
60 | # CONFIG_MODVERSIONS is not set | ||
61 | # CONFIG_MODULE_SRCVERSION_ALL is not set | ||
62 | # CONFIG_KMOD is not set | ||
63 | |||
64 | # | ||
65 | # Processor | ||
66 | # | ||
67 | # CONFIG_6xx is not set | ||
68 | # CONFIG_40x is not set | ||
69 | # CONFIG_44x is not set | ||
70 | # CONFIG_POWER3 is not set | ||
71 | # CONFIG_POWER4 is not set | ||
72 | CONFIG_8xx=y | ||
73 | # CONFIG_E500 is not set | ||
74 | # CONFIG_MATH_EMULATION is not set | ||
75 | # CONFIG_CPU_FREQ is not set | ||
76 | CONFIG_EMBEDDEDBOOT=y | ||
77 | # CONFIG_PM is not set | ||
78 | CONFIG_NOT_COHERENT_CACHE=y | ||
79 | |||
80 | # | ||
81 | # Platform options | ||
82 | # | ||
83 | CONFIG_FADS=y | ||
84 | # CONFIG_RPXLITE is not set | ||
85 | # CONFIG_RPXCLASSIC is not set | ||
86 | # CONFIG_BSEIP is not set | ||
87 | # CONFIG_MPC8XXFADS is not set | ||
88 | CONFIG_MPC86XADS=y | ||
89 | # CONFIG_TQM823L is not set | ||
90 | # CONFIG_TQM850L is not set | ||
91 | # CONFIG_TQM855L is not set | ||
92 | # CONFIG_TQM860L is not set | ||
93 | # CONFIG_FPS850L is not set | ||
94 | # CONFIG_SPD823TS is not set | ||
95 | # CONFIG_IVMS8 is not set | ||
96 | # CONFIG_IVML24 is not set | ||
97 | # CONFIG_SM850 is not set | ||
98 | # CONFIG_HERMES_PRO is not set | ||
99 | # CONFIG_IP860 is not set | ||
100 | # CONFIG_LWMON is not set | ||
101 | # CONFIG_PCU_E is not set | ||
102 | # CONFIG_CCM is not set | ||
103 | # CONFIG_LANTEC is not set | ||
104 | # CONFIG_MBX is not set | ||
105 | # CONFIG_WINCEPT is not set | ||
106 | # CONFIG_SMP is not set | ||
107 | # CONFIG_PREEMPT is not set | ||
108 | # CONFIG_HIGHMEM is not set | ||
109 | CONFIG_BINFMT_ELF=y | ||
110 | # CONFIG_BINFMT_MISC is not set | ||
111 | # CONFIG_CMDLINE_BOOL is not set | ||
112 | CONFIG_ISA_DMA_API=y | ||
113 | |||
114 | # | ||
115 | # Bus options | ||
116 | # | ||
117 | # CONFIG_PCI is not set | ||
118 | # CONFIG_PCI_DOMAINS is not set | ||
119 | # CONFIG_PCI_QSPAN is not set | ||
120 | |||
121 | # | ||
122 | # PCCARD (PCMCIA/CardBus) support | ||
123 | # | ||
124 | # CONFIG_PCCARD is not set | ||
125 | |||
126 | # | ||
127 | # Advanced setup | ||
128 | # | ||
129 | # CONFIG_ADVANCED_OPTIONS is not set | ||
130 | |||
131 | # | ||
132 | # Default settings for advanced configuration options are used | ||
133 | # | ||
134 | CONFIG_HIGHMEM_START=0xfe000000 | ||
135 | CONFIG_LOWMEM_SIZE=0x30000000 | ||
136 | CONFIG_KERNEL_START=0xc0000000 | ||
137 | CONFIG_TASK_SIZE=0x80000000 | ||
138 | CONFIG_CONSISTENT_START=0xff100000 | ||
139 | CONFIG_CONSISTENT_SIZE=0x00200000 | ||
140 | CONFIG_BOOT_LOAD=0x00400000 | ||
141 | |||
142 | # | ||
143 | # Device Drivers | ||
144 | # | ||
145 | |||
146 | # | ||
147 | # Generic Driver Options | ||
148 | # | ||
149 | # CONFIG_STANDALONE is not set | ||
150 | CONFIG_PREVENT_FIRMWARE_BUILD=y | ||
151 | # CONFIG_FW_LOADER is not set | ||
152 | |||
153 | # | ||
154 | # Memory Technology Devices (MTD) | ||
155 | # | ||
156 | # CONFIG_MTD is not set | ||
157 | |||
158 | # | ||
159 | # Parallel port support | ||
160 | # | ||
161 | # CONFIG_PARPORT is not set | ||
162 | |||
163 | # | ||
164 | # Plug and Play support | ||
165 | # | ||
166 | |||
167 | # | ||
168 | # Block devices | ||
169 | # | ||
170 | # CONFIG_BLK_DEV_FD is not set | ||
171 | # CONFIG_BLK_DEV_COW_COMMON is not set | ||
172 | CONFIG_BLK_DEV_LOOP=y | ||
173 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set | ||
174 | # CONFIG_BLK_DEV_NBD is not set | ||
175 | # CONFIG_BLK_DEV_RAM is not set | ||
176 | CONFIG_BLK_DEV_RAM_COUNT=16 | ||
177 | CONFIG_INITRAMFS_SOURCE="" | ||
178 | # CONFIG_LBD is not set | ||
179 | # CONFIG_CDROM_PKTCDVD is not set | ||
180 | |||
181 | # | ||
182 | # IO Schedulers | ||
183 | # | ||
184 | CONFIG_IOSCHED_NOOP=y | ||
185 | CONFIG_IOSCHED_AS=y | ||
186 | CONFIG_IOSCHED_DEADLINE=y | ||
187 | CONFIG_IOSCHED_CFQ=y | ||
188 | # CONFIG_ATA_OVER_ETH is not set | ||
189 | |||
190 | # | ||
191 | # ATA/ATAPI/MFM/RLL support | ||
192 | # | ||
193 | # CONFIG_IDE is not set | ||
194 | |||
195 | # | ||
196 | # SCSI device support | ||
197 | # | ||
198 | # CONFIG_SCSI is not set | ||
199 | |||
200 | # | ||
201 | # Multi-device support (RAID and LVM) | ||
202 | # | ||
203 | # CONFIG_MD is not set | ||
204 | |||
205 | # | ||
206 | # Fusion MPT device support | ||
207 | # | ||
208 | |||
209 | # | ||
210 | # IEEE 1394 (FireWire) support | ||
211 | # | ||
212 | # CONFIG_IEEE1394 is not set | ||
213 | |||
214 | # | ||
215 | # I2O device support | ||
216 | # | ||
217 | |||
218 | # | ||
219 | # Macintosh device drivers | ||
220 | # | ||
221 | |||
222 | # | ||
223 | # Networking support | ||
224 | # | ||
225 | CONFIG_NET=y | ||
226 | |||
227 | # | ||
228 | # Networking options | ||
229 | # | ||
230 | CONFIG_PACKET=y | ||
231 | # CONFIG_PACKET_MMAP is not set | ||
232 | CONFIG_UNIX=y | ||
233 | # CONFIG_NET_KEY is not set | ||
234 | CONFIG_INET=y | ||
235 | # CONFIG_IP_MULTICAST is not set | ||
236 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
237 | CONFIG_IP_PNP=y | ||
238 | CONFIG_IP_PNP_DHCP=y | ||
239 | # CONFIG_IP_PNP_BOOTP is not set | ||
240 | # CONFIG_IP_PNP_RARP is not set | ||
241 | # CONFIG_NET_IPIP is not set | ||
242 | # CONFIG_NET_IPGRE is not set | ||
243 | # CONFIG_ARPD is not set | ||
244 | # CONFIG_SYN_COOKIES is not set | ||
245 | # CONFIG_INET_AH is not set | ||
246 | # CONFIG_INET_ESP is not set | ||
247 | # CONFIG_INET_IPCOMP is not set | ||
248 | # CONFIG_INET_TUNNEL is not set | ||
249 | CONFIG_IP_TCPDIAG=y | ||
250 | # CONFIG_IP_TCPDIAG_IPV6 is not set | ||
251 | CONFIG_IPV6=m | ||
252 | # CONFIG_IPV6_PRIVACY is not set | ||
253 | # CONFIG_INET6_AH is not set | ||
254 | # CONFIG_INET6_ESP is not set | ||
255 | # CONFIG_INET6_IPCOMP is not set | ||
256 | # CONFIG_INET6_TUNNEL is not set | ||
257 | # CONFIG_IPV6_TUNNEL is not set | ||
258 | # CONFIG_NETFILTER is not set | ||
259 | |||
260 | # | ||
261 | # SCTP Configuration (EXPERIMENTAL) | ||
262 | # | ||
263 | # CONFIG_IP_SCTP is not set | ||
264 | # CONFIG_ATM is not set | ||
265 | # CONFIG_BRIDGE is not set | ||
266 | # CONFIG_VLAN_8021Q is not set | ||
267 | # CONFIG_DECNET is not set | ||
268 | # CONFIG_LLC2 is not set | ||
269 | # CONFIG_IPX is not set | ||
270 | # CONFIG_ATALK is not set | ||
271 | # CONFIG_X25 is not set | ||
272 | # CONFIG_LAPB is not set | ||
273 | # CONFIG_NET_DIVERT is not set | ||
274 | # CONFIG_ECONET is not set | ||
275 | # CONFIG_WAN_ROUTER is not set | ||
276 | |||
277 | # | ||
278 | # QoS and/or fair queueing | ||
279 | # | ||
280 | # CONFIG_NET_SCHED is not set | ||
281 | # CONFIG_NET_CLS_ROUTE is not set | ||
282 | |||
283 | # | ||
284 | # Network testing | ||
285 | # | ||
286 | # CONFIG_NET_PKTGEN is not set | ||
287 | # CONFIG_NETPOLL is not set | ||
288 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
289 | # CONFIG_HAMRADIO is not set | ||
290 | # CONFIG_IRDA is not set | ||
291 | # CONFIG_BT is not set | ||
292 | CONFIG_NETDEVICES=y | ||
293 | # CONFIG_DUMMY is not set | ||
294 | # CONFIG_BONDING is not set | ||
295 | # CONFIG_EQUALIZER is not set | ||
296 | # CONFIG_TUN is not set | ||
297 | |||
298 | # | ||
299 | # Ethernet (10 or 100Mbit) | ||
300 | # | ||
301 | CONFIG_NET_ETHERNET=y | ||
302 | # CONFIG_MII is not set | ||
303 | # CONFIG_OAKNET is not set | ||
304 | |||
305 | # | ||
306 | # Ethernet (1000 Mbit) | ||
307 | # | ||
308 | |||
309 | # | ||
310 | # Ethernet (10000 Mbit) | ||
311 | # | ||
312 | |||
313 | # | ||
314 | # Token Ring devices | ||
315 | # | ||
316 | |||
317 | # | ||
318 | # Wireless LAN (non-hamradio) | ||
319 | # | ||
320 | # CONFIG_NET_RADIO is not set | ||
321 | |||
322 | # | ||
323 | # Wan interfaces | ||
324 | # | ||
325 | # CONFIG_WAN is not set | ||
326 | # CONFIG_PPP is not set | ||
327 | # CONFIG_SLIP is not set | ||
328 | # CONFIG_SHAPER is not set | ||
329 | # CONFIG_NETCONSOLE is not set | ||
330 | |||
331 | # | ||
332 | # ISDN subsystem | ||
333 | # | ||
334 | # CONFIG_ISDN is not set | ||
335 | |||
336 | # | ||
337 | # Telephony Support | ||
338 | # | ||
339 | # CONFIG_PHONE is not set | ||
340 | |||
341 | # | ||
342 | # Input device support | ||
343 | # | ||
344 | # CONFIG_INPUT is not set | ||
345 | |||
346 | # | ||
347 | # Hardware I/O ports | ||
348 | # | ||
349 | # CONFIG_SERIO is not set | ||
350 | # CONFIG_GAMEPORT is not set | ||
351 | CONFIG_SOUND_GAMEPORT=y | ||
352 | |||
353 | # | ||
354 | # Character devices | ||
355 | # | ||
356 | # CONFIG_VT is not set | ||
357 | # CONFIG_SERIAL_NONSTANDARD is not set | ||
358 | |||
359 | # | ||
360 | # Serial drivers | ||
361 | # | ||
362 | # CONFIG_SERIAL_8250 is not set | ||
363 | |||
364 | # | ||
365 | # Non-8250 serial port support | ||
366 | # | ||
367 | CONFIG_SERIAL_CORE=y | ||
368 | CONFIG_SERIAL_CORE_CONSOLE=y | ||
369 | CONFIG_SERIAL_CPM=y | ||
370 | CONFIG_SERIAL_CPM_CONSOLE=y | ||
371 | # CONFIG_SERIAL_CPM_SCC1 is not set | ||
372 | # CONFIG_SERIAL_CPM_SCC2 is not set | ||
373 | # CONFIG_SERIAL_CPM_SCC3 is not set | ||
374 | # CONFIG_SERIAL_CPM_SCC4 is not set | ||
375 | CONFIG_SERIAL_CPM_SMC1=y | ||
376 | # CONFIG_SERIAL_CPM_SMC2 is not set | ||
377 | CONFIG_UNIX98_PTYS=y | ||
378 | # CONFIG_LEGACY_PTYS is not set | ||
379 | |||
380 | # | ||
381 | # IPMI | ||
382 | # | ||
383 | # CONFIG_IPMI_HANDLER is not set | ||
384 | |||
385 | # | ||
386 | # Watchdog Cards | ||
387 | # | ||
388 | # CONFIG_WATCHDOG is not set | ||
389 | # CONFIG_NVRAM is not set | ||
390 | # CONFIG_GEN_RTC is not set | ||
391 | # CONFIG_DTLK is not set | ||
392 | # CONFIG_R3964 is not set | ||
393 | |||
394 | # | ||
395 | # Ftape, the floppy tape device driver | ||
396 | # | ||
397 | # CONFIG_AGP is not set | ||
398 | # CONFIG_DRM is not set | ||
399 | # CONFIG_RAW_DRIVER is not set | ||
400 | |||
401 | # | ||
402 | # TPM devices | ||
403 | # | ||
404 | |||
405 | # | ||
406 | # I2C support | ||
407 | # | ||
408 | # CONFIG_I2C is not set | ||
409 | |||
410 | # | ||
411 | # Dallas's 1-wire bus | ||
412 | # | ||
413 | # CONFIG_W1 is not set | ||
414 | |||
415 | # | ||
416 | # Misc devices | ||
417 | # | ||
418 | |||
419 | # | ||
420 | # Multimedia devices | ||
421 | # | ||
422 | # CONFIG_VIDEO_DEV is not set | ||
423 | |||
424 | # | ||
425 | # Digital Video Broadcasting Devices | ||
426 | # | ||
427 | # CONFIG_DVB is not set | ||
428 | |||
429 | # | ||
430 | # Graphics support | ||
431 | # | ||
432 | # CONFIG_FB is not set | ||
433 | |||
434 | # | ||
435 | # Sound | ||
436 | # | ||
437 | # CONFIG_SOUND is not set | ||
438 | |||
439 | # | ||
440 | # USB support | ||
441 | # | ||
442 | # CONFIG_USB_ARCH_HAS_HCD is not set | ||
443 | # CONFIG_USB_ARCH_HAS_OHCI is not set | ||
444 | |||
445 | # | ||
446 | # USB Gadget Support | ||
447 | # | ||
448 | # CONFIG_USB_GADGET is not set | ||
449 | |||
450 | # | ||
451 | # MMC/SD Card support | ||
452 | # | ||
453 | # CONFIG_MMC is not set | ||
454 | |||
455 | # | ||
456 | # InfiniBand support | ||
457 | # | ||
458 | # CONFIG_INFINIBAND is not set | ||
459 | |||
460 | # | ||
461 | # File systems | ||
462 | # | ||
463 | # CONFIG_EXT2_FS is not set | ||
464 | CONFIG_EXT3_FS=y | ||
465 | # CONFIG_EXT3_FS_XATTR is not set | ||
466 | CONFIG_JBD=y | ||
467 | # CONFIG_JBD_DEBUG is not set | ||
468 | # CONFIG_REISERFS_FS is not set | ||
469 | # CONFIG_JFS_FS is not set | ||
470 | |||
471 | # | ||
472 | # XFS support | ||
473 | # | ||
474 | # CONFIG_XFS_FS is not set | ||
475 | # CONFIG_MINIX_FS is not set | ||
476 | # CONFIG_ROMFS_FS is not set | ||
477 | # CONFIG_QUOTA is not set | ||
478 | # CONFIG_DNOTIFY is not set | ||
479 | # CONFIG_AUTOFS_FS is not set | ||
480 | # CONFIG_AUTOFS4_FS is not set | ||
481 | |||
482 | # | ||
483 | # CD-ROM/DVD Filesystems | ||
484 | # | ||
485 | # CONFIG_ISO9660_FS is not set | ||
486 | # CONFIG_UDF_FS is not set | ||
487 | |||
488 | # | ||
489 | # DOS/FAT/NT Filesystems | ||
490 | # | ||
491 | # CONFIG_MSDOS_FS is not set | ||
492 | # CONFIG_VFAT_FS is not set | ||
493 | # CONFIG_NTFS_FS is not set | ||
494 | |||
495 | # | ||
496 | # Pseudo filesystems | ||
497 | # | ||
498 | CONFIG_PROC_FS=y | ||
499 | CONFIG_PROC_KCORE=y | ||
500 | CONFIG_SYSFS=y | ||
501 | # CONFIG_DEVFS_FS is not set | ||
502 | # CONFIG_DEVPTS_FS_XATTR is not set | ||
503 | # CONFIG_TMPFS is not set | ||
504 | # CONFIG_HUGETLBFS is not set | ||
505 | # CONFIG_HUGETLB_PAGE is not set | ||
506 | CONFIG_RAMFS=y | ||
507 | |||
508 | # | ||
509 | # Miscellaneous filesystems | ||
510 | # | ||
511 | # CONFIG_ADFS_FS is not set | ||
512 | # CONFIG_AFFS_FS is not set | ||
513 | # CONFIG_HFS_FS is not set | ||
514 | # CONFIG_HFSPLUS_FS is not set | ||
515 | # CONFIG_BEFS_FS is not set | ||
516 | # CONFIG_BFS_FS is not set | ||
517 | # CONFIG_EFS_FS is not set | ||
518 | # CONFIG_CRAMFS is not set | ||
519 | # CONFIG_VXFS_FS is not set | ||
520 | # CONFIG_HPFS_FS is not set | ||
521 | # CONFIG_QNX4FS_FS is not set | ||
522 | # CONFIG_SYSV_FS is not set | ||
523 | # CONFIG_UFS_FS is not set | ||
524 | |||
525 | # | ||
526 | # Network File Systems | ||
527 | # | ||
528 | CONFIG_NFS_FS=y | ||
529 | CONFIG_NFS_V3=y | ||
530 | CONFIG_NFS_V4=y | ||
531 | # CONFIG_NFS_DIRECTIO is not set | ||
532 | # CONFIG_NFSD is not set | ||
533 | CONFIG_ROOT_NFS=y | ||
534 | CONFIG_LOCKD=y | ||
535 | CONFIG_LOCKD_V4=y | ||
536 | CONFIG_SUNRPC=y | ||
537 | CONFIG_SUNRPC_GSS=y | ||
538 | CONFIG_RPCSEC_GSS_KRB5=y | ||
539 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | ||
540 | # CONFIG_SMB_FS is not set | ||
541 | # CONFIG_CIFS is not set | ||
542 | # CONFIG_NCP_FS is not set | ||
543 | # CONFIG_CODA_FS is not set | ||
544 | # CONFIG_AFS_FS is not set | ||
545 | |||
546 | # | ||
547 | # Partition Types | ||
548 | # | ||
549 | # CONFIG_PARTITION_ADVANCED is not set | ||
550 | CONFIG_MSDOS_PARTITION=y | ||
551 | |||
552 | # | ||
553 | # Native Language Support | ||
554 | # | ||
555 | # CONFIG_NLS is not set | ||
556 | |||
557 | # | ||
558 | # MPC8xx CPM Options | ||
559 | # | ||
560 | CONFIG_SCC_ENET=y | ||
561 | CONFIG_SCC1_ENET=y | ||
562 | # CONFIG_SCC2_ENET is not set | ||
563 | # CONFIG_SCC3_ENET is not set | ||
564 | # CONFIG_FEC_ENET is not set | ||
565 | # CONFIG_ENET_BIG_BUFFERS is not set | ||
566 | |||
567 | # | ||
568 | # Generic MPC8xx Options | ||
569 | # | ||
570 | # CONFIG_8xx_COPYBACK is not set | ||
571 | # CONFIG_8xx_CPU6 is not set | ||
572 | CONFIG_NO_UCODE_PATCH=y | ||
573 | # CONFIG_USB_SOF_UCODE_PATCH is not set | ||
574 | # CONFIG_I2C_SPI_UCODE_PATCH is not set | ||
575 | # CONFIG_I2C_SPI_SMC1_UCODE_PATCH is not set | ||
576 | |||
577 | # | ||
578 | # Library routines | ||
579 | # | ||
580 | # CONFIG_CRC_CCITT is not set | ||
581 | # CONFIG_CRC32 is not set | ||
582 | # CONFIG_LIBCRC32C is not set | ||
583 | |||
584 | # | ||
585 | # Profiling support | ||
586 | # | ||
587 | # CONFIG_PROFILING is not set | ||
588 | |||
589 | # | ||
590 | # Kernel hacking | ||
591 | # | ||
592 | # CONFIG_PRINTK_TIME is not set | ||
593 | # CONFIG_DEBUG_KERNEL is not set | ||
594 | CONFIG_LOG_BUF_SHIFT=14 | ||
595 | |||
596 | # | ||
597 | # Security options | ||
598 | # | ||
599 | # CONFIG_KEYS is not set | ||
600 | # CONFIG_SECURITY is not set | ||
601 | |||
602 | # | ||
603 | # Cryptographic options | ||
604 | # | ||
605 | CONFIG_CRYPTO=y | ||
606 | # CONFIG_CRYPTO_HMAC is not set | ||
607 | # CONFIG_CRYPTO_NULL is not set | ||
608 | # CONFIG_CRYPTO_MD4 is not set | ||
609 | CONFIG_CRYPTO_MD5=y | ||
610 | # CONFIG_CRYPTO_SHA1 is not set | ||
611 | # CONFIG_CRYPTO_SHA256 is not set | ||
612 | # CONFIG_CRYPTO_SHA512 is not set | ||
613 | # CONFIG_CRYPTO_WP512 is not set | ||
614 | # CONFIG_CRYPTO_TGR192 is not set | ||
615 | CONFIG_CRYPTO_DES=y | ||
616 | # CONFIG_CRYPTO_BLOWFISH is not set | ||
617 | # CONFIG_CRYPTO_TWOFISH is not set | ||
618 | # CONFIG_CRYPTO_SERPENT is not set | ||
619 | # CONFIG_CRYPTO_AES is not set | ||
620 | # CONFIG_CRYPTO_CAST5 is not set | ||
621 | # CONFIG_CRYPTO_CAST6 is not set | ||
622 | # CONFIG_CRYPTO_TEA is not set | ||
623 | # CONFIG_CRYPTO_ARC4 is not set | ||
624 | # CONFIG_CRYPTO_KHAZAD is not set | ||
625 | # CONFIG_CRYPTO_ANUBIS is not set | ||
626 | # CONFIG_CRYPTO_DEFLATE is not set | ||
627 | # CONFIG_CRYPTO_MICHAEL_MIC is not set | ||
628 | # CONFIG_CRYPTO_CRC32C is not set | ||
629 | # CONFIG_CRYPTO_TEST is not set | ||
630 | |||
631 | # | ||
632 | # Hardware crypto devices | ||
633 | # | ||
diff --git a/arch/ppc/configs/mpc885ads_defconfig b/arch/ppc/configs/mpc885ads_defconfig new file mode 100644 index 000000000000..016f94d9325f --- /dev/null +++ b/arch/ppc/configs/mpc885ads_defconfig | |||
@@ -0,0 +1,622 @@ | |||
1 | # | ||
2 | # Automatically generated make config: don't edit | ||
3 | # Linux kernel version: 2.6.12-rc6 | ||
4 | # Thu Jun 9 21:17:29 2005 | ||
5 | # | ||
6 | CONFIG_MMU=y | ||
7 | CONFIG_GENERIC_HARDIRQS=y | ||
8 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | ||
9 | CONFIG_GENERIC_CALIBRATE_DELAY=y | ||
10 | CONFIG_HAVE_DEC_LOCK=y | ||
11 | CONFIG_PPC=y | ||
12 | CONFIG_PPC32=y | ||
13 | CONFIG_GENERIC_NVRAM=y | ||
14 | CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y | ||
15 | |||
16 | # | ||
17 | # Code maturity level options | ||
18 | # | ||
19 | CONFIG_EXPERIMENTAL=y | ||
20 | # CONFIG_CLEAN_COMPILE is not set | ||
21 | CONFIG_BROKEN=y | ||
22 | CONFIG_BROKEN_ON_SMP=y | ||
23 | CONFIG_INIT_ENV_ARG_LIMIT=32 | ||
24 | |||
25 | # | ||
26 | # General setup | ||
27 | # | ||
28 | CONFIG_LOCALVERSION="" | ||
29 | # CONFIG_SWAP is not set | ||
30 | CONFIG_SYSVIPC=y | ||
31 | # CONFIG_POSIX_MQUEUE is not set | ||
32 | # CONFIG_BSD_PROCESS_ACCT is not set | ||
33 | CONFIG_SYSCTL=y | ||
34 | # CONFIG_AUDIT is not set | ||
35 | CONFIG_HOTPLUG=y | ||
36 | CONFIG_KOBJECT_UEVENT=y | ||
37 | # CONFIG_IKCONFIG is not set | ||
38 | CONFIG_EMBEDDED=y | ||
39 | # CONFIG_KALLSYMS is not set | ||
40 | CONFIG_PRINTK=y | ||
41 | CONFIG_BUG=y | ||
42 | CONFIG_BASE_FULL=y | ||
43 | CONFIG_FUTEX=y | ||
44 | # CONFIG_EPOLL is not set | ||
45 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | ||
46 | CONFIG_SHMEM=y | ||
47 | CONFIG_CC_ALIGN_FUNCTIONS=0 | ||
48 | CONFIG_CC_ALIGN_LABELS=0 | ||
49 | CONFIG_CC_ALIGN_LOOPS=0 | ||
50 | CONFIG_CC_ALIGN_JUMPS=0 | ||
51 | # CONFIG_TINY_SHMEM is not set | ||
52 | CONFIG_BASE_SMALL=0 | ||
53 | |||
54 | # | ||
55 | # Loadable module support | ||
56 | # | ||
57 | # CONFIG_MODULES is not set | ||
58 | |||
59 | # | ||
60 | # Processor | ||
61 | # | ||
62 | # CONFIG_6xx is not set | ||
63 | # CONFIG_40x is not set | ||
64 | # CONFIG_44x is not set | ||
65 | # CONFIG_POWER3 is not set | ||
66 | # CONFIG_POWER4 is not set | ||
67 | CONFIG_8xx=y | ||
68 | # CONFIG_E500 is not set | ||
69 | # CONFIG_MATH_EMULATION is not set | ||
70 | # CONFIG_CPU_FREQ is not set | ||
71 | CONFIG_EMBEDDEDBOOT=y | ||
72 | # CONFIG_PM is not set | ||
73 | CONFIG_NOT_COHERENT_CACHE=y | ||
74 | |||
75 | # | ||
76 | # Platform options | ||
77 | # | ||
78 | # CONFIG_RPXLITE is not set | ||
79 | # CONFIG_RPXCLASSIC is not set | ||
80 | # CONFIG_BSEIP is not set | ||
81 | # CONFIG_FADS is not set | ||
82 | CONFIG_MPC885ADS=y | ||
83 | # CONFIG_TQM823L is not set | ||
84 | # CONFIG_TQM850L is not set | ||
85 | # CONFIG_TQM855L is not set | ||
86 | # CONFIG_TQM860L is not set | ||
87 | # CONFIG_FPS850L is not set | ||
88 | # CONFIG_SPD823TS is not set | ||
89 | # CONFIG_IVMS8 is not set | ||
90 | # CONFIG_IVML24 is not set | ||
91 | # CONFIG_SM850 is not set | ||
92 | # CONFIG_HERMES_PRO is not set | ||
93 | # CONFIG_IP860 is not set | ||
94 | # CONFIG_LWMON is not set | ||
95 | # CONFIG_PCU_E is not set | ||
96 | # CONFIG_CCM is not set | ||
97 | # CONFIG_LANTEC is not set | ||
98 | # CONFIG_MBX is not set | ||
99 | # CONFIG_WINCEPT is not set | ||
100 | # CONFIG_SMP is not set | ||
101 | # CONFIG_PREEMPT is not set | ||
102 | # CONFIG_HIGHMEM is not set | ||
103 | CONFIG_BINFMT_ELF=y | ||
104 | # CONFIG_BINFMT_MISC is not set | ||
105 | # CONFIG_CMDLINE_BOOL is not set | ||
106 | CONFIG_ISA_DMA_API=y | ||
107 | |||
108 | # | ||
109 | # Bus options | ||
110 | # | ||
111 | # CONFIG_PCI is not set | ||
112 | # CONFIG_PCI_DOMAINS is not set | ||
113 | # CONFIG_PCI_QSPAN is not set | ||
114 | |||
115 | # | ||
116 | # PCCARD (PCMCIA/CardBus) support | ||
117 | # | ||
118 | # CONFIG_PCCARD is not set | ||
119 | |||
120 | # | ||
121 | # Advanced setup | ||
122 | # | ||
123 | # CONFIG_ADVANCED_OPTIONS is not set | ||
124 | |||
125 | # | ||
126 | # Default settings for advanced configuration options are used | ||
127 | # | ||
128 | CONFIG_HIGHMEM_START=0xfe000000 | ||
129 | CONFIG_LOWMEM_SIZE=0x30000000 | ||
130 | CONFIG_KERNEL_START=0xc0000000 | ||
131 | CONFIG_TASK_SIZE=0x80000000 | ||
132 | CONFIG_CONSISTENT_START=0xff100000 | ||
133 | CONFIG_CONSISTENT_SIZE=0x00200000 | ||
134 | CONFIG_BOOT_LOAD=0x00400000 | ||
135 | |||
136 | # | ||
137 | # Device Drivers | ||
138 | # | ||
139 | |||
140 | # | ||
141 | # Generic Driver Options | ||
142 | # | ||
143 | CONFIG_STANDALONE=y | ||
144 | CONFIG_PREVENT_FIRMWARE_BUILD=y | ||
145 | # CONFIG_FW_LOADER is not set | ||
146 | |||
147 | # | ||
148 | # Memory Technology Devices (MTD) | ||
149 | # | ||
150 | # CONFIG_MTD is not set | ||
151 | |||
152 | # | ||
153 | # Parallel port support | ||
154 | # | ||
155 | # CONFIG_PARPORT is not set | ||
156 | |||
157 | # | ||
158 | # Plug and Play support | ||
159 | # | ||
160 | |||
161 | # | ||
162 | # Block devices | ||
163 | # | ||
164 | # CONFIG_BLK_DEV_FD is not set | ||
165 | # CONFIG_BLK_DEV_COW_COMMON is not set | ||
166 | # CONFIG_BLK_DEV_LOOP is not set | ||
167 | # CONFIG_BLK_DEV_NBD is not set | ||
168 | # CONFIG_BLK_DEV_RAM is not set | ||
169 | CONFIG_BLK_DEV_RAM_COUNT=16 | ||
170 | CONFIG_INITRAMFS_SOURCE="" | ||
171 | # CONFIG_LBD is not set | ||
172 | # CONFIG_CDROM_PKTCDVD is not set | ||
173 | |||
174 | # | ||
175 | # IO Schedulers | ||
176 | # | ||
177 | CONFIG_IOSCHED_NOOP=y | ||
178 | # CONFIG_IOSCHED_AS is not set | ||
179 | # CONFIG_IOSCHED_DEADLINE is not set | ||
180 | # CONFIG_IOSCHED_CFQ is not set | ||
181 | # CONFIG_ATA_OVER_ETH is not set | ||
182 | |||
183 | # | ||
184 | # ATA/ATAPI/MFM/RLL support | ||
185 | # | ||
186 | # CONFIG_IDE is not set | ||
187 | |||
188 | # | ||
189 | # SCSI device support | ||
190 | # | ||
191 | # CONFIG_SCSI is not set | ||
192 | |||
193 | # | ||
194 | # Multi-device support (RAID and LVM) | ||
195 | # | ||
196 | # CONFIG_MD is not set | ||
197 | |||
198 | # | ||
199 | # Fusion MPT device support | ||
200 | # | ||
201 | |||
202 | # | ||
203 | # IEEE 1394 (FireWire) support | ||
204 | # | ||
205 | # CONFIG_IEEE1394 is not set | ||
206 | |||
207 | # | ||
208 | # I2O device support | ||
209 | # | ||
210 | |||
211 | # | ||
212 | # Macintosh device drivers | ||
213 | # | ||
214 | |||
215 | # | ||
216 | # Networking support | ||
217 | # | ||
218 | CONFIG_NET=y | ||
219 | |||
220 | # | ||
221 | # Networking options | ||
222 | # | ||
223 | CONFIG_PACKET=y | ||
224 | # CONFIG_PACKET_MMAP is not set | ||
225 | CONFIG_UNIX=y | ||
226 | # CONFIG_NET_KEY is not set | ||
227 | CONFIG_INET=y | ||
228 | # CONFIG_IP_MULTICAST is not set | ||
229 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
230 | CONFIG_IP_PNP=y | ||
231 | CONFIG_IP_PNP_DHCP=y | ||
232 | CONFIG_IP_PNP_BOOTP=y | ||
233 | # CONFIG_IP_PNP_RARP is not set | ||
234 | # CONFIG_NET_IPIP is not set | ||
235 | # CONFIG_NET_IPGRE is not set | ||
236 | # CONFIG_ARPD is not set | ||
237 | # CONFIG_SYN_COOKIES is not set | ||
238 | # CONFIG_INET_AH is not set | ||
239 | # CONFIG_INET_ESP is not set | ||
240 | # CONFIG_INET_IPCOMP is not set | ||
241 | # CONFIG_INET_TUNNEL is not set | ||
242 | CONFIG_IP_TCPDIAG=y | ||
243 | # CONFIG_IP_TCPDIAG_IPV6 is not set | ||
244 | # CONFIG_IPV6 is not set | ||
245 | # CONFIG_NETFILTER is not set | ||
246 | |||
247 | # | ||
248 | # SCTP Configuration (EXPERIMENTAL) | ||
249 | # | ||
250 | # CONFIG_IP_SCTP is not set | ||
251 | # CONFIG_ATM is not set | ||
252 | # CONFIG_BRIDGE is not set | ||
253 | # CONFIG_VLAN_8021Q is not set | ||
254 | # CONFIG_DECNET is not set | ||
255 | # CONFIG_LLC2 is not set | ||
256 | # CONFIG_IPX is not set | ||
257 | # CONFIG_ATALK is not set | ||
258 | # CONFIG_X25 is not set | ||
259 | # CONFIG_LAPB is not set | ||
260 | # CONFIG_NET_DIVERT is not set | ||
261 | # CONFIG_ECONET is not set | ||
262 | # CONFIG_WAN_ROUTER is not set | ||
263 | |||
264 | # | ||
265 | # QoS and/or fair queueing | ||
266 | # | ||
267 | # CONFIG_NET_SCHED is not set | ||
268 | # CONFIG_NET_CLS_ROUTE is not set | ||
269 | |||
270 | # | ||
271 | # Network testing | ||
272 | # | ||
273 | # CONFIG_NET_PKTGEN is not set | ||
274 | # CONFIG_NETPOLL is not set | ||
275 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
276 | # CONFIG_HAMRADIO is not set | ||
277 | # CONFIG_IRDA is not set | ||
278 | # CONFIG_BT is not set | ||
279 | CONFIG_NETDEVICES=y | ||
280 | # CONFIG_DUMMY is not set | ||
281 | # CONFIG_BONDING is not set | ||
282 | # CONFIG_EQUALIZER is not set | ||
283 | # CONFIG_TUN is not set | ||
284 | |||
285 | # | ||
286 | # Ethernet (10 or 100Mbit) | ||
287 | # | ||
288 | CONFIG_NET_ETHERNET=y | ||
289 | CONFIG_MII=y | ||
290 | # CONFIG_OAKNET is not set | ||
291 | |||
292 | # | ||
293 | # Ethernet (1000 Mbit) | ||
294 | # | ||
295 | |||
296 | # | ||
297 | # Ethernet (10000 Mbit) | ||
298 | # | ||
299 | |||
300 | # | ||
301 | # Token Ring devices | ||
302 | # | ||
303 | |||
304 | # | ||
305 | # Wireless LAN (non-hamradio) | ||
306 | # | ||
307 | # CONFIG_NET_RADIO is not set | ||
308 | |||
309 | # | ||
310 | # Wan interfaces | ||
311 | # | ||
312 | # CONFIG_WAN is not set | ||
313 | CONFIG_PPP=y | ||
314 | # CONFIG_PPP_MULTILINK is not set | ||
315 | # CONFIG_PPP_FILTER is not set | ||
316 | CONFIG_PPP_ASYNC=y | ||
317 | CONFIG_PPP_SYNC_TTY=y | ||
318 | CONFIG_PPP_DEFLATE=y | ||
319 | # CONFIG_PPP_BSDCOMP is not set | ||
320 | # CONFIG_PPPOE is not set | ||
321 | # CONFIG_SLIP is not set | ||
322 | # CONFIG_SHAPER is not set | ||
323 | # CONFIG_NETCONSOLE is not set | ||
324 | |||
325 | # | ||
326 | # ISDN subsystem | ||
327 | # | ||
328 | # CONFIG_ISDN is not set | ||
329 | |||
330 | # | ||
331 | # Telephony Support | ||
332 | # | ||
333 | # CONFIG_PHONE is not set | ||
334 | |||
335 | # | ||
336 | # Input device support | ||
337 | # | ||
338 | # CONFIG_INPUT is not set | ||
339 | |||
340 | # | ||
341 | # Hardware I/O ports | ||
342 | # | ||
343 | # CONFIG_SERIO is not set | ||
344 | # CONFIG_GAMEPORT is not set | ||
345 | |||
346 | # | ||
347 | # Character devices | ||
348 | # | ||
349 | # CONFIG_VT is not set | ||
350 | # CONFIG_SERIAL_NONSTANDARD is not set | ||
351 | |||
352 | # | ||
353 | # Serial drivers | ||
354 | # | ||
355 | # CONFIG_SERIAL_8250 is not set | ||
356 | |||
357 | # | ||
358 | # Non-8250 serial port support | ||
359 | # | ||
360 | CONFIG_SERIAL_CORE=y | ||
361 | CONFIG_SERIAL_CORE_CONSOLE=y | ||
362 | CONFIG_SERIAL_CPM=y | ||
363 | CONFIG_SERIAL_CPM_CONSOLE=y | ||
364 | # CONFIG_SERIAL_CPM_SCC1 is not set | ||
365 | # CONFIG_SERIAL_CPM_SCC2 is not set | ||
366 | # CONFIG_SERIAL_CPM_SCC3 is not set | ||
367 | # CONFIG_SERIAL_CPM_SCC4 is not set | ||
368 | CONFIG_SERIAL_CPM_SMC1=y | ||
369 | CONFIG_SERIAL_CPM_SMC2=y | ||
370 | CONFIG_UNIX98_PTYS=y | ||
371 | # CONFIG_LEGACY_PTYS is not set | ||
372 | |||
373 | # | ||
374 | # IPMI | ||
375 | # | ||
376 | # CONFIG_IPMI_HANDLER is not set | ||
377 | |||
378 | # | ||
379 | # Watchdog Cards | ||
380 | # | ||
381 | # CONFIG_WATCHDOG is not set | ||
382 | # CONFIG_NVRAM is not set | ||
383 | # CONFIG_GEN_RTC is not set | ||
384 | # CONFIG_DTLK is not set | ||
385 | # CONFIG_R3964 is not set | ||
386 | |||
387 | # | ||
388 | # Ftape, the floppy tape device driver | ||
389 | # | ||
390 | # CONFIG_AGP is not set | ||
391 | # CONFIG_DRM is not set | ||
392 | # CONFIG_RAW_DRIVER is not set | ||
393 | |||
394 | # | ||
395 | # TPM devices | ||
396 | # | ||
397 | |||
398 | # | ||
399 | # I2C support | ||
400 | # | ||
401 | # CONFIG_I2C is not set | ||
402 | |||
403 | # | ||
404 | # Dallas's 1-wire bus | ||
405 | # | ||
406 | # CONFIG_W1 is not set | ||
407 | |||
408 | # | ||
409 | # Misc devices | ||
410 | # | ||
411 | |||
412 | # | ||
413 | # Multimedia devices | ||
414 | # | ||
415 | # CONFIG_VIDEO_DEV is not set | ||
416 | |||
417 | # | ||
418 | # Digital Video Broadcasting Devices | ||
419 | # | ||
420 | # CONFIG_DVB is not set | ||
421 | |||
422 | # | ||
423 | # Graphics support | ||
424 | # | ||
425 | # CONFIG_FB is not set | ||
426 | |||
427 | # | ||
428 | # Sound | ||
429 | # | ||
430 | # CONFIG_SOUND is not set | ||
431 | |||
432 | # | ||
433 | # USB support | ||
434 | # | ||
435 | # CONFIG_USB_ARCH_HAS_HCD is not set | ||
436 | # CONFIG_USB_ARCH_HAS_OHCI is not set | ||
437 | |||
438 | # | ||
439 | # USB Gadget Support | ||
440 | # | ||
441 | # CONFIG_USB_GADGET is not set | ||
442 | |||
443 | # | ||
444 | # MMC/SD Card support | ||
445 | # | ||
446 | # CONFIG_MMC is not set | ||
447 | |||
448 | # | ||
449 | # InfiniBand support | ||
450 | # | ||
451 | # CONFIG_INFINIBAND is not set | ||
452 | |||
453 | # | ||
454 | # File systems | ||
455 | # | ||
456 | CONFIG_EXT2_FS=y | ||
457 | CONFIG_EXT2_FS_XATTR=y | ||
458 | # CONFIG_EXT2_FS_POSIX_ACL is not set | ||
459 | # CONFIG_EXT2_FS_SECURITY is not set | ||
460 | CONFIG_EXT3_FS=y | ||
461 | CONFIG_EXT3_FS_XATTR=y | ||
462 | # CONFIG_EXT3_FS_POSIX_ACL is not set | ||
463 | # CONFIG_EXT3_FS_SECURITY is not set | ||
464 | CONFIG_JBD=y | ||
465 | # CONFIG_JBD_DEBUG is not set | ||
466 | CONFIG_FS_MBCACHE=y | ||
467 | # CONFIG_REISERFS_FS is not set | ||
468 | # CONFIG_JFS_FS is not set | ||
469 | |||
470 | # | ||
471 | # XFS support | ||
472 | # | ||
473 | # CONFIG_XFS_FS is not set | ||
474 | # CONFIG_MINIX_FS is not set | ||
475 | # CONFIG_ROMFS_FS is not set | ||
476 | # CONFIG_QUOTA is not set | ||
477 | # CONFIG_DNOTIFY is not set | ||
478 | # CONFIG_AUTOFS_FS is not set | ||
479 | # CONFIG_AUTOFS4_FS is not set | ||
480 | |||
481 | # | ||
482 | # CD-ROM/DVD Filesystems | ||
483 | # | ||
484 | # CONFIG_ISO9660_FS is not set | ||
485 | # CONFIG_UDF_FS is not set | ||
486 | |||
487 | # | ||
488 | # DOS/FAT/NT Filesystems | ||
489 | # | ||
490 | # CONFIG_MSDOS_FS is not set | ||
491 | # CONFIG_VFAT_FS is not set | ||
492 | # CONFIG_NTFS_FS is not set | ||
493 | |||
494 | # | ||
495 | # Pseudo filesystems | ||
496 | # | ||
497 | CONFIG_PROC_FS=y | ||
498 | # CONFIG_PROC_KCORE is not set | ||
499 | CONFIG_SYSFS=y | ||
500 | # CONFIG_DEVFS_FS is not set | ||
501 | # CONFIG_DEVPTS_FS_XATTR is not set | ||
502 | # CONFIG_TMPFS is not set | ||
503 | # CONFIG_HUGETLBFS is not set | ||
504 | # CONFIG_HUGETLB_PAGE is not set | ||
505 | CONFIG_RAMFS=y | ||
506 | |||
507 | # | ||
508 | # Miscellaneous filesystems | ||
509 | # | ||
510 | # CONFIG_ADFS_FS is not set | ||
511 | # CONFIG_AFFS_FS is not set | ||
512 | # CONFIG_HFS_FS is not set | ||
513 | # CONFIG_HFSPLUS_FS is not set | ||
514 | # CONFIG_BEFS_FS is not set | ||
515 | # CONFIG_BFS_FS is not set | ||
516 | # CONFIG_EFS_FS is not set | ||
517 | # CONFIG_CRAMFS is not set | ||
518 | # CONFIG_VXFS_FS is not set | ||
519 | # CONFIG_HPFS_FS is not set | ||
520 | # CONFIG_QNX4FS_FS is not set | ||
521 | # CONFIG_SYSV_FS is not set | ||
522 | # CONFIG_UFS_FS is not set | ||
523 | |||
524 | # | ||
525 | # Network File Systems | ||
526 | # | ||
527 | CONFIG_NFS_FS=y | ||
528 | # CONFIG_NFS_V3 is not set | ||
529 | # CONFIG_NFS_V4 is not set | ||
530 | # CONFIG_NFS_DIRECTIO is not set | ||
531 | # CONFIG_NFSD is not set | ||
532 | CONFIG_ROOT_NFS=y | ||
533 | CONFIG_LOCKD=y | ||
534 | CONFIG_SUNRPC=y | ||
535 | # CONFIG_RPCSEC_GSS_KRB5 is not set | ||
536 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | ||
537 | # CONFIG_SMB_FS is not set | ||
538 | # CONFIG_CIFS is not set | ||
539 | # CONFIG_NCP_FS is not set | ||
540 | # CONFIG_CODA_FS is not set | ||
541 | # CONFIG_AFS_FS is not set | ||
542 | |||
543 | # | ||
544 | # Partition Types | ||
545 | # | ||
546 | CONFIG_PARTITION_ADVANCED=y | ||
547 | # CONFIG_ACORN_PARTITION is not set | ||
548 | # CONFIG_OSF_PARTITION is not set | ||
549 | # CONFIG_AMIGA_PARTITION is not set | ||
550 | # CONFIG_ATARI_PARTITION is not set | ||
551 | # CONFIG_MAC_PARTITION is not set | ||
552 | CONFIG_MSDOS_PARTITION=y | ||
553 | # CONFIG_BSD_DISKLABEL is not set | ||
554 | # CONFIG_MINIX_SUBPARTITION is not set | ||
555 | # CONFIG_SOLARIS_X86_PARTITION is not set | ||
556 | # CONFIG_UNIXWARE_DISKLABEL is not set | ||
557 | # CONFIG_LDM_PARTITION is not set | ||
558 | # CONFIG_SGI_PARTITION is not set | ||
559 | # CONFIG_ULTRIX_PARTITION is not set | ||
560 | # CONFIG_SUN_PARTITION is not set | ||
561 | # CONFIG_EFI_PARTITION is not set | ||
562 | |||
563 | # | ||
564 | # Native Language Support | ||
565 | # | ||
566 | # CONFIG_NLS is not set | ||
567 | |||
568 | # | ||
569 | # MPC8xx CPM Options | ||
570 | # | ||
571 | CONFIG_SCC_ENET=y | ||
572 | # CONFIG_SCC1_ENET is not set | ||
573 | # CONFIG_SCC2_ENET is not set | ||
574 | CONFIG_SCC3_ENET=y | ||
575 | # CONFIG_FEC_ENET is not set | ||
576 | # CONFIG_ENET_BIG_BUFFERS is not set | ||
577 | |||
578 | # | ||
579 | # Generic MPC8xx Options | ||
580 | # | ||
581 | CONFIG_8xx_COPYBACK=y | ||
582 | CONFIG_8xx_CPU6=y | ||
583 | CONFIG_NO_UCODE_PATCH=y | ||
584 | # CONFIG_USB_SOF_UCODE_PATCH is not set | ||
585 | # CONFIG_I2C_SPI_UCODE_PATCH is not set | ||
586 | # CONFIG_I2C_SPI_SMC1_UCODE_PATCH is not set | ||
587 | |||
588 | # | ||
589 | # Library routines | ||
590 | # | ||
591 | CONFIG_CRC_CCITT=y | ||
592 | # CONFIG_CRC32 is not set | ||
593 | # CONFIG_LIBCRC32C is not set | ||
594 | CONFIG_ZLIB_INFLATE=y | ||
595 | CONFIG_ZLIB_DEFLATE=y | ||
596 | |||
597 | # | ||
598 | # Profiling support | ||
599 | # | ||
600 | # CONFIG_PROFILING is not set | ||
601 | |||
602 | # | ||
603 | # Kernel hacking | ||
604 | # | ||
605 | # CONFIG_PRINTK_TIME is not set | ||
606 | # CONFIG_DEBUG_KERNEL is not set | ||
607 | CONFIG_LOG_BUF_SHIFT=14 | ||
608 | |||
609 | # | ||
610 | # Security options | ||
611 | # | ||
612 | # CONFIG_KEYS is not set | ||
613 | # CONFIG_SECURITY is not set | ||
614 | |||
615 | # | ||
616 | # Cryptographic options | ||
617 | # | ||
618 | # CONFIG_CRYPTO is not set | ||
619 | |||
620 | # | ||
621 | # Hardware crypto devices | ||
622 | # | ||
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c index 6d7b92d72458..70cfb6ffd877 100644 --- a/arch/ppc/kernel/pci.c +++ b/arch/ppc/kernel/pci.c | |||
@@ -1495,7 +1495,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | |||
1495 | *offset += hose->pci_mem_offset; | 1495 | *offset += hose->pci_mem_offset; |
1496 | res_bit = IORESOURCE_MEM; | 1496 | res_bit = IORESOURCE_MEM; |
1497 | } else { | 1497 | } else { |
1498 | io_offset = (unsigned long)hose->io_base_virt; | 1498 | io_offset = hose->io_base_virt - ___IO_BASE; |
1499 | *offset += io_offset; | 1499 | *offset += io_offset; |
1500 | res_bit = IORESOURCE_IO; | 1500 | res_bit = IORESOURCE_IO; |
1501 | } | 1501 | } |
@@ -1522,7 +1522,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | |||
1522 | 1522 | ||
1523 | /* found it! construct the final physical address */ | 1523 | /* found it! construct the final physical address */ |
1524 | if (mmap_state == pci_mmap_io) | 1524 | if (mmap_state == pci_mmap_io) |
1525 | *offset += hose->io_base_phys - _IO_BASE; | 1525 | *offset += hose->io_base_phys - io_offset; |
1526 | return rp; | 1526 | return rp; |
1527 | } | 1527 | } |
1528 | 1528 | ||
@@ -1739,6 +1739,23 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn) | |||
1739 | return result; | 1739 | return result; |
1740 | } | 1740 | } |
1741 | 1741 | ||
1742 | void pci_resource_to_user(const struct pci_dev *dev, int bar, | ||
1743 | const struct resource *rsrc, | ||
1744 | u64 *start, u64 *end) | ||
1745 | { | ||
1746 | struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); | ||
1747 | unsigned long offset = 0; | ||
1748 | |||
1749 | if (hose == NULL) | ||
1750 | return; | ||
1751 | |||
1752 | if (rsrc->flags & IORESOURCE_IO) | ||
1753 | offset = ___IO_BASE - hose->io_base_virt + hose->io_base_phys; | ||
1754 | |||
1755 | *start = rsrc->start + offset; | ||
1756 | *end = rsrc->end + offset; | ||
1757 | } | ||
1758 | |||
1742 | void __init | 1759 | void __init |
1743 | pci_init_resource(struct resource *res, unsigned long start, unsigned long end, | 1760 | pci_init_resource(struct resource *res, unsigned long start, unsigned long end, |
1744 | int flags, char *name) | 1761 | int flags, char *name) |
diff --git a/arch/ppc/kernel/relocate_kernel.S b/arch/ppc/kernel/relocate_kernel.S index 7ff69c4af920..9b2ad48e988c 100644 --- a/arch/ppc/kernel/relocate_kernel.S +++ b/arch/ppc/kernel/relocate_kernel.S | |||
@@ -34,9 +34,9 @@ relocate_new_kernel: | |||
34 | 34 | ||
35 | mr r8, r0 | 35 | mr r8, r0 |
36 | ori r8, r8, MSR_RI|MSR_ME | 36 | ori r8, r8, MSR_RI|MSR_ME |
37 | mtspr SRR1, r8 | 37 | mtspr SPRN_SRR1, r8 |
38 | addi r8, r4, 1f - relocate_new_kernel | 38 | addi r8, r4, 1f - relocate_new_kernel |
39 | mtspr SRR0, r8 | 39 | mtspr SPRN_SRR0, r8 |
40 | sync | 40 | sync |
41 | rfi | 41 | rfi |
42 | 42 | ||
diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c index 735866559199..bf4ddca5e853 100644 --- a/arch/ppc/kernel/time.c +++ b/arch/ppc/kernel/time.c | |||
@@ -89,6 +89,9 @@ unsigned long tb_to_ns_scale; | |||
89 | 89 | ||
90 | extern unsigned long wall_jiffies; | 90 | extern unsigned long wall_jiffies; |
91 | 91 | ||
92 | /* used for timezone offset */ | ||
93 | static long timezone_offset; | ||
94 | |||
92 | DEFINE_SPINLOCK(rtc_lock); | 95 | DEFINE_SPINLOCK(rtc_lock); |
93 | 96 | ||
94 | EXPORT_SYMBOL(rtc_lock); | 97 | EXPORT_SYMBOL(rtc_lock); |
@@ -170,7 +173,7 @@ void timer_interrupt(struct pt_regs * regs) | |||
170 | xtime.tv_sec - last_rtc_update >= 659 && | 173 | xtime.tv_sec - last_rtc_update >= 659 && |
171 | abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ && | 174 | abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ && |
172 | jiffies - wall_jiffies == 1) { | 175 | jiffies - wall_jiffies == 1) { |
173 | if (ppc_md.set_rtc_time(xtime.tv_sec+1 + time_offset) == 0) | 176 | if (ppc_md.set_rtc_time(xtime.tv_sec+1 + timezone_offset) == 0) |
174 | last_rtc_update = xtime.tv_sec+1; | 177 | last_rtc_update = xtime.tv_sec+1; |
175 | else | 178 | else |
176 | /* Try again one minute later */ | 179 | /* Try again one minute later */ |
@@ -286,7 +289,7 @@ void __init time_init(void) | |||
286 | unsigned old_stamp, stamp, elapsed; | 289 | unsigned old_stamp, stamp, elapsed; |
287 | 290 | ||
288 | if (ppc_md.time_init != NULL) | 291 | if (ppc_md.time_init != NULL) |
289 | time_offset = ppc_md.time_init(); | 292 | timezone_offset = ppc_md.time_init(); |
290 | 293 | ||
291 | if (__USE_RTC()) { | 294 | if (__USE_RTC()) { |
292 | /* 601 processor: dec counts down by 128 every 128ns */ | 295 | /* 601 processor: dec counts down by 128 every 128ns */ |
@@ -331,10 +334,10 @@ void __init time_init(void) | |||
331 | set_dec(tb_ticks_per_jiffy); | 334 | set_dec(tb_ticks_per_jiffy); |
332 | 335 | ||
333 | /* If platform provided a timezone (pmac), we correct the time */ | 336 | /* If platform provided a timezone (pmac), we correct the time */ |
334 | if (time_offset) { | 337 | if (timezone_offset) { |
335 | sys_tz.tz_minuteswest = -time_offset / 60; | 338 | sys_tz.tz_minuteswest = -timezone_offset / 60; |
336 | sys_tz.tz_dsttime = 0; | 339 | sys_tz.tz_dsttime = 0; |
337 | xtime.tv_sec -= time_offset; | 340 | xtime.tv_sec -= timezone_offset; |
338 | } | 341 | } |
339 | set_normalized_timespec(&wall_to_monotonic, | 342 | set_normalized_timespec(&wall_to_monotonic, |
340 | -xtime.tv_sec, -xtime.tv_nsec); | 343 | -xtime.tv_sec, -xtime.tv_nsec); |
diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.c b/arch/ppc/platforms/85xx/mpc8540_ads.c index ddd2e9a5bb12..f761fdf160db 100644 --- a/arch/ppc/platforms/85xx/mpc8540_ads.c +++ b/arch/ppc/platforms/85xx/mpc8540_ads.c | |||
@@ -111,8 +111,8 @@ mpc8540ads_setup_arch(void) | |||
111 | memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); | 111 | memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); |
112 | } | 112 | } |
113 | 113 | ||
114 | pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_FEC); | ||
114 | if (pdata) { | 115 | if (pdata) { |
115 | pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_FEC); | ||
116 | pdata->board_flags = 0; | 116 | pdata->board_flags = 0; |
117 | pdata->interruptPHY = MPC85xx_IRQ_EXT5; | 117 | pdata->interruptPHY = MPC85xx_IRQ_EXT5; |
118 | pdata->phyid = 3; | 118 | pdata->phyid = 3; |
diff --git a/arch/ppc/platforms/fads.h b/arch/ppc/platforms/fads.h index 632b8178ce66..b60c56450b67 100644 --- a/arch/ppc/platforms/fads.h +++ b/arch/ppc/platforms/fads.h | |||
@@ -3,7 +3,18 @@ | |||
3 | * the Motorola 860T FADS board. Copied from the MBX stuff. | 3 | * the Motorola 860T FADS board. Copied from the MBX stuff. |
4 | * | 4 | * |
5 | * Copyright (c) 1998 Dan Malek (dmalek@jlc.net) | 5 | * Copyright (c) 1998 Dan Malek (dmalek@jlc.net) |
6 | * | ||
7 | * Added MPC86XADS support. | ||
8 | * The MPC86xADS manual says the board "is compatible with the MPC8xxFADS | ||
9 | * for SW point of view". This is 99% correct. | ||
10 | * | ||
11 | * Author: MontaVista Software, Inc. | ||
12 | * source@mvista.com | ||
13 | * 2005 (c) MontaVista Software, Inc. This file is licensed under the | ||
14 | * terms of the GNU General Public License version 2. This program is licensed | ||
15 | * "as is" without any warranty of any kind, whether express or implied. | ||
6 | */ | 16 | */ |
17 | |||
7 | #ifdef __KERNEL__ | 18 | #ifdef __KERNEL__ |
8 | #ifndef __ASM_FADS_H__ | 19 | #ifndef __ASM_FADS_H__ |
9 | #define __ASM_FADS_H__ | 20 | #define __ASM_FADS_H__ |
@@ -12,18 +23,45 @@ | |||
12 | 23 | ||
13 | #include <asm/ppcboot.h> | 24 | #include <asm/ppcboot.h> |
14 | 25 | ||
26 | #if defined(CONFIG_MPC86XADS) | ||
27 | |||
28 | /* U-Boot maps BCSR to 0xff080000 */ | ||
29 | #define BCSR_ADDR ((uint)0xff080000) | ||
30 | |||
31 | /* MPC86XADS has one more CPLD and an additional BCSR. | ||
32 | */ | ||
33 | #define CFG_PHYDEV_ADDR ((uint)0xff0a0000) | ||
34 | #define BCSR5 ((uint)(CFG_PHYDEV_ADDR + 0x300)) | ||
35 | |||
36 | #define BCSR5_T1_RST 0x10 | ||
37 | #define BCSR5_ATM155_RST 0x08 | ||
38 | #define BCSR5_ATM25_RST 0x04 | ||
39 | #define BCSR5_MII1_EN 0x02 | ||
40 | #define BCSR5_MII1_RST 0x01 | ||
41 | |||
42 | /* There is no PHY link change interrupt */ | ||
43 | #define PHY_INTERRUPT (-1) | ||
44 | |||
45 | #else /* FADS */ | ||
46 | |||
15 | /* Memory map is configured by the PROM startup. | 47 | /* Memory map is configured by the PROM startup. |
16 | * I tried to follow the FADS manual, although the startup PROM | 48 | * I tried to follow the FADS manual, although the startup PROM |
17 | * dictates this and we simply have to move some of the physical | 49 | * dictates this and we simply have to move some of the physical |
18 | * addresses for Linux. | 50 | * addresses for Linux. |
19 | */ | 51 | */ |
20 | #define BCSR_ADDR ((uint)0xff010000) | 52 | #define BCSR_ADDR ((uint)0xff010000) |
53 | |||
54 | /* PHY link change interrupt */ | ||
55 | #define PHY_INTERRUPT SIU_IRQ2 | ||
56 | |||
57 | #endif /* CONFIG_MPC86XADS */ | ||
58 | |||
21 | #define BCSR_SIZE ((uint)(64 * 1024)) | 59 | #define BCSR_SIZE ((uint)(64 * 1024)) |
22 | #define BCSR0 ((uint)0xff010000) | 60 | #define BCSR0 ((uint)(BCSR_ADDR + 0x00)) |
23 | #define BCSR1 ((uint)0xff010004) | 61 | #define BCSR1 ((uint)(BCSR_ADDR + 0x04)) |
24 | #define BCSR2 ((uint)0xff010008) | 62 | #define BCSR2 ((uint)(BCSR_ADDR + 0x08)) |
25 | #define BCSR3 ((uint)0xff01000c) | 63 | #define BCSR3 ((uint)(BCSR_ADDR + 0x0c)) |
26 | #define BCSR4 ((uint)0xff010010) | 64 | #define BCSR4 ((uint)(BCSR_ADDR + 0x10)) |
27 | 65 | ||
28 | #define IMAP_ADDR ((uint)0xff000000) | 66 | #define IMAP_ADDR ((uint)0xff000000) |
29 | #define IMAP_SIZE ((uint)(64 * 1024)) | 67 | #define IMAP_SIZE ((uint)(64 * 1024)) |
@@ -34,8 +72,17 @@ | |||
34 | /* Bits of interest in the BCSRs. | 72 | /* Bits of interest in the BCSRs. |
35 | */ | 73 | */ |
36 | #define BCSR1_ETHEN ((uint)0x20000000) | 74 | #define BCSR1_ETHEN ((uint)0x20000000) |
75 | #define BCSR1_IRDAEN ((uint)0x10000000) | ||
37 | #define BCSR1_RS232EN_1 ((uint)0x01000000) | 76 | #define BCSR1_RS232EN_1 ((uint)0x01000000) |
77 | #define BCSR1_PCCEN ((uint)0x00800000) | ||
78 | #define BCSR1_PCCVCC0 ((uint)0x00400000) | ||
79 | #define BCSR1_PCCVPP0 ((uint)0x00200000) | ||
80 | #define BCSR1_PCCVPP1 ((uint)0x00100000) | ||
81 | #define BCSR1_PCCVPP_MASK (BCSR1_PCCVPP0 | BCSR1_PCCVPP1) | ||
38 | #define BCSR1_RS232EN_2 ((uint)0x00040000) | 82 | #define BCSR1_RS232EN_2 ((uint)0x00040000) |
83 | #define BCSR1_PCCVCC1 ((uint)0x00010000) | ||
84 | #define BCSR1_PCCVCC_MASK (BCSR1_PCCVCC0 | BCSR1_PCCVCC1) | ||
85 | |||
39 | #define BCSR4_ETHLOOP ((uint)0x80000000) /* EEST Loopback */ | 86 | #define BCSR4_ETHLOOP ((uint)0x80000000) /* EEST Loopback */ |
40 | #define BCSR4_EEFDX ((uint)0x40000000) /* EEST FDX enable */ | 87 | #define BCSR4_EEFDX ((uint)0x40000000) /* EEST FDX enable */ |
41 | #define BCSR4_FETH_EN ((uint)0x08000000) /* PHY enable */ | 88 | #define BCSR4_FETH_EN ((uint)0x08000000) /* PHY enable */ |
@@ -44,14 +91,64 @@ | |||
44 | #define BCSR4_FETHFDE ((uint)0x02000000) /* PHY FDX advertise */ | 91 | #define BCSR4_FETHFDE ((uint)0x02000000) /* PHY FDX advertise */ |
45 | #define BCSR4_FETHRST ((uint)0x00200000) /* PHY Reset */ | 92 | #define BCSR4_FETHRST ((uint)0x00200000) /* PHY Reset */ |
46 | 93 | ||
94 | /* IO_BASE definition for pcmcia. | ||
95 | */ | ||
96 | #define _IO_BASE 0x80000000 | ||
97 | #define _IO_BASE_SIZE 0x1000 | ||
98 | |||
99 | #ifdef CONFIG_IDE | ||
100 | #define MAX_HWIFS 1 | ||
101 | #endif | ||
102 | |||
47 | /* Interrupt level assignments. | 103 | /* Interrupt level assignments. |
48 | */ | 104 | */ |
49 | #define FEC_INTERRUPT SIU_LEVEL1 /* FEC interrupt */ | 105 | #define FEC_INTERRUPT SIU_LEVEL1 /* FEC interrupt */ |
50 | #define PHY_INTERRUPT SIU_IRQ2 /* PHY link change interrupt */ | ||
51 | 106 | ||
52 | /* We don't use the 8259. | 107 | /* We don't use the 8259. |
53 | */ | 108 | */ |
54 | #define NR_8259_INTS 0 | 109 | #define NR_8259_INTS 0 |
55 | 110 | ||
111 | /* CPM Ethernet through SCC1 or SCC2 */ | ||
112 | |||
113 | #ifdef CONFIG_SCC1_ENET /* Probably 860 variant */ | ||
114 | /* Bits in parallel I/O port registers that have to be set/cleared | ||
115 | * to configure the pins for SCC1 use. | ||
116 | * TCLK - CLK1, RCLK - CLK2. | ||
117 | */ | ||
118 | #define PA_ENET_RXD ((ushort)0x0001) | ||
119 | #define PA_ENET_TXD ((ushort)0x0002) | ||
120 | #define PA_ENET_TCLK ((ushort)0x0100) | ||
121 | #define PA_ENET_RCLK ((ushort)0x0200) | ||
122 | #define PB_ENET_TENA ((uint)0x00001000) | ||
123 | #define PC_ENET_CLSN ((ushort)0x0010) | ||
124 | #define PC_ENET_RENA ((ushort)0x0020) | ||
125 | |||
126 | /* Control bits in the SICR to route TCLK (CLK1) and RCLK (CLK2) to | ||
127 | * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero. | ||
128 | */ | ||
129 | #define SICR_ENET_MASK ((uint)0x000000ff) | ||
130 | #define SICR_ENET_CLKRT ((uint)0x0000002c) | ||
131 | #endif /* CONFIG_SCC1_ENET */ | ||
132 | |||
133 | #ifdef CONFIG_SCC2_ENET /* Probably 823/850 variant */ | ||
134 | /* Bits in parallel I/O port registers that have to be set/cleared | ||
135 | * to configure the pins for SCC1 use. | ||
136 | * TCLK - CLK1, RCLK - CLK2. | ||
137 | */ | ||
138 | #define PA_ENET_RXD ((ushort)0x0004) | ||
139 | #define PA_ENET_TXD ((ushort)0x0008) | ||
140 | #define PA_ENET_TCLK ((ushort)0x0400) | ||
141 | #define PA_ENET_RCLK ((ushort)0x0200) | ||
142 | #define PB_ENET_TENA ((uint)0x00002000) | ||
143 | #define PC_ENET_CLSN ((ushort)0x0040) | ||
144 | #define PC_ENET_RENA ((ushort)0x0080) | ||
145 | |||
146 | /* Control bits in the SICR to route TCLK and RCLK to | ||
147 | * SCC2. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero. | ||
148 | */ | ||
149 | #define SICR_ENET_MASK ((uint)0x0000ff00) | ||
150 | #define SICR_ENET_CLKRT ((uint)0x00002e00) | ||
151 | #endif /* CONFIG_SCC2_ENET */ | ||
152 | |||
56 | #endif /* __ASM_FADS_H__ */ | 153 | #endif /* __ASM_FADS_H__ */ |
57 | #endif /* __KERNEL__ */ | 154 | #endif /* __KERNEL__ */ |
diff --git a/arch/ppc/platforms/mpc885ads.h b/arch/ppc/platforms/mpc885ads.h new file mode 100644 index 000000000000..eb386635b0fd --- /dev/null +++ b/arch/ppc/platforms/mpc885ads.h | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * A collection of structures, addresses, and values associated with | ||
3 | * the Freescale MPC885ADS board. | ||
4 | * Copied from the FADS stuff. | ||
5 | * | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * source@mvista.com | ||
8 | * | ||
9 | * 2005 (c) MontaVista Software, Inc. This file is licensed under the | ||
10 | * terms of the GNU General Public License version 2. This program is licensed | ||
11 | * "as is" without any warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | #ifndef __ASM_MPC885ADS_H__ | ||
16 | #define __ASM_MPC885ADS_H__ | ||
17 | |||
18 | #include <linux/config.h> | ||
19 | |||
20 | #include <asm/ppcboot.h> | ||
21 | |||
22 | /* U-Boot maps BCSR to 0xff080000 */ | ||
23 | #define BCSR_ADDR ((uint)0xff080000) | ||
24 | #define BCSR_SIZE ((uint)32) | ||
25 | #define BCSR0 ((uint)(BCSR_ADDR + 0x00)) | ||
26 | #define BCSR1 ((uint)(BCSR_ADDR + 0x04)) | ||
27 | #define BCSR2 ((uint)(BCSR_ADDR + 0x08)) | ||
28 | #define BCSR3 ((uint)(BCSR_ADDR + 0x0c)) | ||
29 | #define BCSR4 ((uint)(BCSR_ADDR + 0x10)) | ||
30 | |||
31 | #define CFG_PHYDEV_ADDR ((uint)0xff0a0000) | ||
32 | #define BCSR5 ((uint)(CFG_PHYDEV_ADDR + 0x300)) | ||
33 | |||
34 | #define IMAP_ADDR ((uint)0xff000000) | ||
35 | #define IMAP_SIZE ((uint)(64 * 1024)) | ||
36 | |||
37 | #define PCMCIA_MEM_ADDR ((uint)0xff020000) | ||
38 | #define PCMCIA_MEM_SIZE ((uint)(64 * 1024)) | ||
39 | |||
40 | /* Bits of interest in the BCSRs. | ||
41 | */ | ||
42 | #define BCSR1_ETHEN ((uint)0x20000000) | ||
43 | #define BCSR1_IRDAEN ((uint)0x10000000) | ||
44 | #define BCSR1_RS232EN_1 ((uint)0x01000000) | ||
45 | #define BCSR1_PCCEN ((uint)0x00800000) | ||
46 | #define BCSR1_PCCVCC0 ((uint)0x00400000) | ||
47 | #define BCSR1_PCCVPP0 ((uint)0x00200000) | ||
48 | #define BCSR1_PCCVPP1 ((uint)0x00100000) | ||
49 | #define BCSR1_PCCVPP_MASK (BCSR1_PCCVPP0 | BCSR1_PCCVPP1) | ||
50 | #define BCSR1_RS232EN_2 ((uint)0x00040000) | ||
51 | #define BCSR1_PCCVCC1 ((uint)0x00010000) | ||
52 | #define BCSR1_PCCVCC_MASK (BCSR1_PCCVCC0 | BCSR1_PCCVCC1) | ||
53 | |||
54 | #define BCSR4_ETH10_RST ((uint)0x80000000) /* 10Base-T PHY reset*/ | ||
55 | #define BCSR4_USB_LO_SPD ((uint)0x04000000) | ||
56 | #define BCSR4_USB_VCC ((uint)0x02000000) | ||
57 | #define BCSR4_USB_FULL_SPD ((uint)0x00040000) | ||
58 | #define BCSR4_USB_EN ((uint)0x00020000) | ||
59 | |||
60 | #define BCSR5_MII2_EN 0x40 | ||
61 | #define BCSR5_MII2_RST 0x20 | ||
62 | #define BCSR5_T1_RST 0x10 | ||
63 | #define BCSR5_ATM155_RST 0x08 | ||
64 | #define BCSR5_ATM25_RST 0x04 | ||
65 | #define BCSR5_MII1_EN 0x02 | ||
66 | #define BCSR5_MII1_RST 0x01 | ||
67 | |||
68 | /* Interrupt level assignments */ | ||
69 | #define PHY_INTERRUPT SIU_IRQ7 /* PHY link change interrupt */ | ||
70 | #define SIU_INT_FEC1 SIU_LEVEL1 /* FEC1 interrupt */ | ||
71 | #define SIU_INT_FEC2 SIU_LEVEL3 /* FEC2 interrupt */ | ||
72 | #define FEC_INTERRUPT SIU_INT_FEC1 /* FEC interrupt */ | ||
73 | |||
74 | /* We don't use the 8259 */ | ||
75 | #define NR_8259_INTS 0 | ||
76 | |||
77 | /* CPM Ethernet through SCC3 */ | ||
78 | #define PA_ENET_RXD ((ushort)0x0040) | ||
79 | #define PA_ENET_TXD ((ushort)0x0080) | ||
80 | #define PE_ENET_TCLK ((uint)0x00004000) | ||
81 | #define PE_ENET_RCLK ((uint)0x00008000) | ||
82 | #define PE_ENET_TENA ((uint)0x00000010) | ||
83 | #define PC_ENET_CLSN ((ushort)0x0400) | ||
84 | #define PC_ENET_RENA ((ushort)0x0800) | ||
85 | |||
86 | /* Control bits in the SICR to route TCLK (CLK5) and RCLK (CLK6) to | ||
87 | * SCC3. Also, make sure GR3 (bit 8) and SC3 (bit 9) are zero */ | ||
88 | #define SICR_ENET_MASK ((uint)0x00ff0000) | ||
89 | #define SICR_ENET_CLKRT ((uint)0x002c0000) | ||
90 | |||
91 | #endif /* __ASM_MPC885ADS_H__ */ | ||
92 | #endif /* __KERNEL__ */ | ||
diff --git a/arch/ppc/syslib/of_device.c b/arch/ppc/syslib/of_device.c index 49c0e34e2d6b..1eb4f726ca9f 100644 --- a/arch/ppc/syslib/of_device.c +++ b/arch/ppc/syslib/of_device.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/kernel.h> | 3 | #include <linux/kernel.h> |
4 | #include <linux/init.h> | 4 | #include <linux/init.h> |
5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
6 | #include <linux/mod_devicetable.h> | ||
6 | #include <asm/errno.h> | 7 | #include <asm/errno.h> |
7 | #include <asm/of_device.h> | 8 | #include <asm/of_device.h> |
8 | 9 | ||
@@ -15,20 +16,20 @@ | |||
15 | * Used by a driver to check whether an of_device present in the | 16 | * Used by a driver to check whether an of_device present in the |
16 | * system is in its list of supported devices. | 17 | * system is in its list of supported devices. |
17 | */ | 18 | */ |
18 | const struct of_match * of_match_device(const struct of_match *matches, | 19 | const struct of_device_id * of_match_device(const struct of_device_id *matches, |
19 | const struct of_device *dev) | 20 | const struct of_device *dev) |
20 | { | 21 | { |
21 | if (!dev->node) | 22 | if (!dev->node) |
22 | return NULL; | 23 | return NULL; |
23 | while (matches->name || matches->type || matches->compatible) { | 24 | while (matches->name[0] || matches->type[0] || matches->compatible[0]) { |
24 | int match = 1; | 25 | int match = 1; |
25 | if (matches->name && matches->name != OF_ANY_MATCH) | 26 | if (matches->name[0]) |
26 | match &= dev->node->name | 27 | match &= dev->node->name |
27 | && !strcmp(matches->name, dev->node->name); | 28 | && !strcmp(matches->name, dev->node->name); |
28 | if (matches->type && matches->type != OF_ANY_MATCH) | 29 | if (matches->type[0]) |
29 | match &= dev->node->type | 30 | match &= dev->node->type |
30 | && !strcmp(matches->type, dev->node->type); | 31 | && !strcmp(matches->type, dev->node->type); |
31 | if (matches->compatible && matches->compatible != OF_ANY_MATCH) | 32 | if (matches->compatible[0]) |
32 | match &= device_is_compatible(dev->node, | 33 | match &= device_is_compatible(dev->node, |
33 | matches->compatible); | 34 | matches->compatible); |
34 | if (match) | 35 | if (match) |
@@ -42,7 +43,7 @@ static int of_platform_bus_match(struct device *dev, struct device_driver *drv) | |||
42 | { | 43 | { |
43 | struct of_device * of_dev = to_of_device(dev); | 44 | struct of_device * of_dev = to_of_device(dev); |
44 | struct of_platform_driver * of_drv = to_of_platform_driver(drv); | 45 | struct of_platform_driver * of_drv = to_of_platform_driver(drv); |
45 | const struct of_match * matches = of_drv->match_table; | 46 | const struct of_device_id * matches = of_drv->match_table; |
46 | 47 | ||
47 | if (!matches) | 48 | if (!matches) |
48 | return 0; | 49 | return 0; |
@@ -75,7 +76,7 @@ static int of_device_probe(struct device *dev) | |||
75 | int error = -ENODEV; | 76 | int error = -ENODEV; |
76 | struct of_platform_driver *drv; | 77 | struct of_platform_driver *drv; |
77 | struct of_device *of_dev; | 78 | struct of_device *of_dev; |
78 | const struct of_match *match; | 79 | const struct of_device_id *match; |
79 | 80 | ||
80 | drv = to_of_platform_driver(dev->driver); | 81 | drv = to_of_platform_driver(dev->driver); |
81 | of_dev = to_of_device(dev); | 82 | of_dev = to_of_device(dev); |
diff --git a/arch/ppc/syslib/ppc4xx_pic.c b/arch/ppc/syslib/ppc4xx_pic.c index 05686fa73545..40086212b9c3 100644 --- a/arch/ppc/syslib/ppc4xx_pic.c +++ b/arch/ppc/syslib/ppc4xx_pic.c | |||
@@ -110,6 +110,10 @@ static int ppc4xx_pic_get_irq(struct pt_regs *regs) | |||
110 | 110 | ||
111 | static void __init ppc4xx_pic_impl_init(void) | 111 | static void __init ppc4xx_pic_impl_init(void) |
112 | { | 112 | { |
113 | #if defined(CONFIG_440GX) | ||
114 | /* Disable 440GP compatibility mode if it was enabled in firmware */ | ||
115 | SDR_WRITE(DCRN_SDR_MFR, SDR_READ(DCRN_SDR_MFR) & ~DCRN_SDR_MFR_PCM); | ||
116 | #endif | ||
113 | /* Configure Base UIC */ | 117 | /* Configure Base UIC */ |
114 | mtdcr(DCRN_UIC_CR(UICB), 0); | 118 | mtdcr(DCRN_UIC_CR(UICB), 0); |
115 | mtdcr(DCRN_UIC_TR(UICB), 0); | 119 | mtdcr(DCRN_UIC_TR(UICB), 0); |
diff --git a/arch/ppc64/boot/Makefile b/arch/ppc64/boot/Makefile index d3e1d6af9203..683b2d43c15f 100644 --- a/arch/ppc64/boot/Makefile +++ b/arch/ppc64/boot/Makefile | |||
@@ -52,7 +52,7 @@ obj-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.o, $(section))) | |||
52 | src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section))) | 52 | src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section))) |
53 | gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) | 53 | gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) |
54 | 54 | ||
55 | hostprogs-y := piggy addnote addRamDisk | 55 | hostprogs-y := addnote addRamDisk |
56 | targets += zImage zImage.initrd imagesize.c \ | 56 | targets += zImage zImage.initrd imagesize.c \ |
57 | $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ | 57 | $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ |
58 | $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ | 58 | $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ |
@@ -78,9 +78,6 @@ addsection = $(CROSS32OBJCOPY) $(1) \ | |||
78 | quiet_cmd_addnote = ADDNOTE $@ | 78 | quiet_cmd_addnote = ADDNOTE $@ |
79 | cmd_addnote = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(obj-boot) && $(obj)/addnote $@ | 79 | cmd_addnote = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(obj-boot) && $(obj)/addnote $@ |
80 | 80 | ||
81 | quiet_cmd_piggy = PIGGY $@ | ||
82 | cmd_piggy = $(obj)/piggyback $(@:.o=) < $< | $(CROSS32AS) -o $@ | ||
83 | |||
84 | $(call gz-sec, $(required)): $(obj)/kernel-%.gz: % FORCE | 81 | $(call gz-sec, $(required)): $(obj)/kernel-%.gz: % FORCE |
85 | $(call if_changed,gzip) | 82 | $(call if_changed,gzip) |
86 | 83 | ||
diff --git a/arch/ppc64/boot/main.c b/arch/ppc64/boot/main.c index da12ea2ca464..199d9804f61c 100644 --- a/arch/ppc64/boot/main.c +++ b/arch/ppc64/boot/main.c | |||
@@ -17,7 +17,6 @@ | |||
17 | 17 | ||
18 | extern void *finddevice(const char *); | 18 | extern void *finddevice(const char *); |
19 | extern int getprop(void *, const char *, void *, int); | 19 | extern int getprop(void *, const char *, void *, int); |
20 | extern void printk(char *fmt, ...); | ||
21 | extern void printf(const char *fmt, ...); | 20 | extern void printf(const char *fmt, ...); |
22 | extern int sprintf(char *buf, const char *fmt, ...); | 21 | extern int sprintf(char *buf, const char *fmt, ...); |
23 | void gunzip(void *, int, unsigned char *, int *); | 22 | void gunzip(void *, int, unsigned char *, int *); |
@@ -147,10 +146,10 @@ void start(unsigned long a1, unsigned long a2, void *promptr) | |||
147 | } | 146 | } |
148 | a1 = initrd.addr; | 147 | a1 = initrd.addr; |
149 | a2 = initrd.size; | 148 | a2 = initrd.size; |
150 | printf("initial ramdisk moving 0x%lx <- 0x%lx (%lx bytes)\n\r", | 149 | printf("initial ramdisk moving 0x%lx <- 0x%lx (0x%lx bytes)\n\r", |
151 | initrd.addr, (unsigned long)_initrd_start, initrd.size); | 150 | initrd.addr, (unsigned long)_initrd_start, initrd.size); |
152 | memmove((void *)initrd.addr, (void *)_initrd_start, initrd.size); | 151 | memmove((void *)initrd.addr, (void *)_initrd_start, initrd.size); |
153 | printf("initrd head: 0x%lx\n\r", *((u32 *)initrd.addr)); | 152 | printf("initrd head: 0x%lx\n\r", *((unsigned long *)initrd.addr)); |
154 | } | 153 | } |
155 | 154 | ||
156 | /* Eventually gunzip the kernel */ | 155 | /* Eventually gunzip the kernel */ |
@@ -201,9 +200,6 @@ void start(unsigned long a1, unsigned long a2, void *promptr) | |||
201 | 200 | ||
202 | flush_cache((void *)vmlinux.addr, vmlinux.size); | 201 | flush_cache((void *)vmlinux.addr, vmlinux.size); |
203 | 202 | ||
204 | if (a1) | ||
205 | printf("initrd head: 0x%lx\n\r", *((u32 *)initrd.addr)); | ||
206 | |||
207 | kernel_entry = (kernel_entry_t)vmlinux.addr; | 203 | kernel_entry = (kernel_entry_t)vmlinux.addr; |
208 | #ifdef DEBUG | 204 | #ifdef DEBUG |
209 | printf( "kernel:\n\r" | 205 | printf( "kernel:\n\r" |
diff --git a/arch/ppc64/boot/mknote.c b/arch/ppc64/boot/mknote.c deleted file mode 100644 index 120cc1d89739..000000000000 --- a/arch/ppc64/boot/mknote.c +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Cort Dougan 1999. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * Generate a note section as per the CHRP specification. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #include <stdio.h> | ||
14 | |||
15 | #define PL(x) printf("%c%c%c%c", ((x)>>24)&0xff, ((x)>>16)&0xff, ((x)>>8)&0xff, (x)&0xff ); | ||
16 | |||
17 | int main(void) | ||
18 | { | ||
19 | /* header */ | ||
20 | /* namesz */ | ||
21 | PL(strlen("PowerPC")+1); | ||
22 | /* descrsz */ | ||
23 | PL(6*4); | ||
24 | /* type */ | ||
25 | PL(0x1275); | ||
26 | /* name */ | ||
27 | printf("PowerPC"); printf("%c", 0); | ||
28 | |||
29 | /* descriptor */ | ||
30 | /* real-mode */ | ||
31 | PL(0xffffffff); | ||
32 | /* real-base */ | ||
33 | PL(0x00c00000); | ||
34 | /* real-size */ | ||
35 | PL(0xffffffff); | ||
36 | /* virt-base */ | ||
37 | PL(0xffffffff); | ||
38 | /* virt-size */ | ||
39 | PL(0xffffffff); | ||
40 | /* load-base */ | ||
41 | PL(0x4000); | ||
42 | return 0; | ||
43 | } | ||
diff --git a/arch/ppc64/boot/piggyback.c b/arch/ppc64/boot/piggyback.c deleted file mode 100644 index 235c7a87269c..000000000000 --- a/arch/ppc64/boot/piggyback.c +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2001 IBM Corp | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | #include <stdio.h> | ||
10 | #include <unistd.h> | ||
11 | #include <string.h> | ||
12 | |||
13 | extern long ce_exec_config[]; | ||
14 | |||
15 | int main(int argc, char *argv[]) | ||
16 | { | ||
17 | int i, cnt, pos, len; | ||
18 | unsigned int cksum, val; | ||
19 | unsigned char *lp; | ||
20 | unsigned char buf[8192]; | ||
21 | char *varname; | ||
22 | if (argc != 2) | ||
23 | { | ||
24 | fprintf(stderr, "usage: %s name <in-file >out-file\n", | ||
25 | argv[0]); | ||
26 | exit(1); | ||
27 | } | ||
28 | |||
29 | varname = strrchr(argv[1], '/'); | ||
30 | if (varname) | ||
31 | varname++; | ||
32 | else | ||
33 | varname = argv[1]; | ||
34 | |||
35 | fprintf(stdout, "#\n"); | ||
36 | fprintf(stdout, "# Miscellaneous data structures:\n"); | ||
37 | fprintf(stdout, "# WARNING - this file is automatically generated!\n"); | ||
38 | fprintf(stdout, "#\n"); | ||
39 | fprintf(stdout, "\n"); | ||
40 | fprintf(stdout, "\t.data\n"); | ||
41 | fprintf(stdout, "\t.globl %s_data\n", varname); | ||
42 | fprintf(stdout, "%s_data:\n", varname); | ||
43 | pos = 0; | ||
44 | cksum = 0; | ||
45 | while ((len = read(0, buf, sizeof(buf))) > 0) | ||
46 | { | ||
47 | cnt = 0; | ||
48 | lp = (unsigned char *)buf; | ||
49 | len = (len + 3) & ~3; /* Round up to longwords */ | ||
50 | for (i = 0; i < len; i += 4) | ||
51 | { | ||
52 | if (cnt == 0) | ||
53 | { | ||
54 | fprintf(stdout, "\t.long\t"); | ||
55 | } | ||
56 | fprintf(stdout, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]); | ||
57 | val = *(unsigned long *)lp; | ||
58 | cksum ^= val; | ||
59 | lp += 4; | ||
60 | if (++cnt == 4) | ||
61 | { | ||
62 | cnt = 0; | ||
63 | fprintf(stdout, " # %x \n", pos+i-12); | ||
64 | fflush(stdout); | ||
65 | } else | ||
66 | { | ||
67 | fprintf(stdout, ","); | ||
68 | } | ||
69 | } | ||
70 | if (cnt) | ||
71 | { | ||
72 | fprintf(stdout, "0\n"); | ||
73 | } | ||
74 | pos += len; | ||
75 | } | ||
76 | fprintf(stdout, "\t.globl %s_len\n", varname); | ||
77 | fprintf(stdout, "%s_len:\t.long\t0x%x\n", varname, pos); | ||
78 | fflush(stdout); | ||
79 | fclose(stdout); | ||
80 | fprintf(stderr, "cksum = %x\n", cksum); | ||
81 | exit(0); | ||
82 | } | ||
83 | |||
diff --git a/arch/ppc64/boot/prom.c b/arch/ppc64/boot/prom.c index d5218b15824e..5e48b80ff5a0 100644 --- a/arch/ppc64/boot/prom.c +++ b/arch/ppc64/boot/prom.c | |||
@@ -40,7 +40,7 @@ void *finddevice(const char *name); | |||
40 | int getprop(void *phandle, const char *name, void *buf, int buflen); | 40 | int getprop(void *phandle, const char *name, void *buf, int buflen); |
41 | void chrpboot(int a1, int a2, void *prom); /* in main.c */ | 41 | void chrpboot(int a1, int a2, void *prom); /* in main.c */ |
42 | 42 | ||
43 | void printk(char *fmt, ...); | 43 | int printf(char *fmt, ...); |
44 | 44 | ||
45 | /* there is no convenient header to get this from... -- paulus */ | 45 | /* there is no convenient header to get this from... -- paulus */ |
46 | extern unsigned long strlen(const char *); | 46 | extern unsigned long strlen(const char *); |
@@ -220,7 +220,7 @@ readchar(void) | |||
220 | case 1: | 220 | case 1: |
221 | return ch; | 221 | return ch; |
222 | case -1: | 222 | case -1: |
223 | printk("read(stdin) returned -1\r\n"); | 223 | printf("read(stdin) returned -1\r\n"); |
224 | return -1; | 224 | return -1; |
225 | } | 225 | } |
226 | } | 226 | } |
@@ -627,18 +627,6 @@ int sprintf(char * buf, const char *fmt, ...) | |||
627 | 627 | ||
628 | static char sprint_buf[1024]; | 628 | static char sprint_buf[1024]; |
629 | 629 | ||
630 | void | ||
631 | printk(char *fmt, ...) | ||
632 | { | ||
633 | va_list args; | ||
634 | int n; | ||
635 | |||
636 | va_start(args, fmt); | ||
637 | n = vsprintf(sprint_buf, fmt, args); | ||
638 | va_end(args); | ||
639 | write(stdout, sprint_buf, n); | ||
640 | } | ||
641 | |||
642 | int | 630 | int |
643 | printf(char *fmt, ...) | 631 | printf(char *fmt, ...) |
644 | { | 632 | { |
diff --git a/arch/ppc64/kernel/ItLpQueue.c b/arch/ppc64/kernel/ItLpQueue.c index cdea00d7707f..4231861288a3 100644 --- a/arch/ppc64/kernel/ItLpQueue.c +++ b/arch/ppc64/kernel/ItLpQueue.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * ItLpQueue.c | 2 | * ItLpQueue.c |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | 3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
@@ -11,156 +11,252 @@ | |||
11 | #include <linux/stddef.h> | 11 | #include <linux/stddef.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/bootmem.h> | ||
15 | #include <linux/seq_file.h> | ||
16 | #include <linux/proc_fs.h> | ||
14 | #include <asm/system.h> | 17 | #include <asm/system.h> |
15 | #include <asm/paca.h> | 18 | #include <asm/paca.h> |
16 | #include <asm/iSeries/ItLpQueue.h> | 19 | #include <asm/iSeries/ItLpQueue.h> |
17 | #include <asm/iSeries/HvLpEvent.h> | 20 | #include <asm/iSeries/HvLpEvent.h> |
18 | #include <asm/iSeries/HvCallEvent.h> | 21 | #include <asm/iSeries/HvCallEvent.h> |
19 | 22 | ||
20 | static __inline__ int set_inUse( struct ItLpQueue * lpQueue ) | 23 | /* |
21 | { | 24 | * The LpQueue is used to pass event data from the hypervisor to |
22 | int t; | 25 | * the partition. This is where I/O interrupt events are communicated. |
23 | u32 * inUseP = &(lpQueue->xInUseWord); | 26 | * |
24 | 27 | * It is written to by the hypervisor so cannot end up in the BSS. | |
25 | __asm__ __volatile__("\n\ | 28 | */ |
26 | 1: lwarx %0,0,%2 \n\ | 29 | struct hvlpevent_queue hvlpevent_queue __attribute__((__section__(".data"))); |
27 | cmpwi 0,%0,0 \n\ | ||
28 | li %0,0 \n\ | ||
29 | bne- 2f \n\ | ||
30 | addi %0,%0,1 \n\ | ||
31 | stwcx. %0,0,%2 \n\ | ||
32 | bne- 1b \n\ | ||
33 | 2: eieio" | ||
34 | : "=&r" (t), "=m" (lpQueue->xInUseWord) | ||
35 | : "r" (inUseP), "m" (lpQueue->xInUseWord) | ||
36 | : "cc"); | ||
37 | |||
38 | return t; | ||
39 | } | ||
40 | 30 | ||
41 | static __inline__ void clear_inUse( struct ItLpQueue * lpQueue ) | 31 | DEFINE_PER_CPU(unsigned long[HvLpEvent_Type_NumTypes], hvlpevent_counts); |
42 | { | 32 | |
43 | lpQueue->xInUseWord = 0; | 33 | static char *event_types[HvLpEvent_Type_NumTypes] = { |
44 | } | 34 | "Hypervisor", |
35 | "Machine Facilities", | ||
36 | "Session Manager", | ||
37 | "SPD I/O", | ||
38 | "Virtual Bus", | ||
39 | "PCI I/O", | ||
40 | "RIO I/O", | ||
41 | "Virtual Lan", | ||
42 | "Virtual I/O" | ||
43 | }; | ||
45 | 44 | ||
46 | /* Array of LpEvent handler functions */ | 45 | /* Array of LpEvent handler functions */ |
47 | extern LpEventHandler lpEventHandler[HvLpEvent_Type_NumTypes]; | 46 | extern LpEventHandler lpEventHandler[HvLpEvent_Type_NumTypes]; |
48 | unsigned long ItLpQueueInProcess = 0; | ||
49 | 47 | ||
50 | struct HvLpEvent * ItLpQueue_getNextLpEvent( struct ItLpQueue * lpQueue ) | 48 | static struct HvLpEvent * get_next_hvlpevent(void) |
51 | { | 49 | { |
52 | struct HvLpEvent * nextLpEvent = | 50 | struct HvLpEvent * event; |
53 | (struct HvLpEvent *)lpQueue->xSlicCurEventPtr; | 51 | event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr; |
54 | if ( nextLpEvent->xFlags.xValid ) { | 52 | |
53 | if (event->xFlags.xValid) { | ||
55 | /* rmb() needed only for weakly consistent machines (regatta) */ | 54 | /* rmb() needed only for weakly consistent machines (regatta) */ |
56 | rmb(); | 55 | rmb(); |
57 | /* Set pointer to next potential event */ | 56 | /* Set pointer to next potential event */ |
58 | lpQueue->xSlicCurEventPtr += ((nextLpEvent->xSizeMinus1 + | 57 | hvlpevent_queue.xSlicCurEventPtr += ((event->xSizeMinus1 + |
59 | LpEventAlign ) / | 58 | LpEventAlign) / LpEventAlign) * LpEventAlign; |
60 | LpEventAlign ) * | 59 | |
61 | LpEventAlign; | ||
62 | /* Wrap to beginning if no room at end */ | 60 | /* Wrap to beginning if no room at end */ |
63 | if (lpQueue->xSlicCurEventPtr > lpQueue->xSlicLastValidEventPtr) | 61 | if (hvlpevent_queue.xSlicCurEventPtr > |
64 | lpQueue->xSlicCurEventPtr = lpQueue->xSlicEventStackPtr; | 62 | hvlpevent_queue.xSlicLastValidEventPtr) { |
63 | hvlpevent_queue.xSlicCurEventPtr = | ||
64 | hvlpevent_queue.xSlicEventStackPtr; | ||
65 | } | ||
66 | } else { | ||
67 | event = NULL; | ||
65 | } | 68 | } |
66 | else | ||
67 | nextLpEvent = NULL; | ||
68 | 69 | ||
69 | return nextLpEvent; | 70 | return event; |
70 | } | 71 | } |
71 | 72 | ||
72 | int ItLpQueue_isLpIntPending( struct ItLpQueue * lpQueue ) | 73 | static unsigned long spread_lpevents = NR_CPUS; |
74 | |||
75 | int hvlpevent_is_pending(void) | ||
73 | { | 76 | { |
74 | int retval = 0; | 77 | struct HvLpEvent *next_event; |
75 | struct HvLpEvent * nextLpEvent; | 78 | |
76 | if ( lpQueue ) { | 79 | if (smp_processor_id() >= spread_lpevents) |
77 | nextLpEvent = (struct HvLpEvent *)lpQueue->xSlicCurEventPtr; | 80 | return 0; |
78 | retval = nextLpEvent->xFlags.xValid | lpQueue->xPlicOverflowIntPending; | 81 | |
79 | } | 82 | next_event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr; |
80 | return retval; | 83 | |
84 | return next_event->xFlags.xValid | | ||
85 | hvlpevent_queue.xPlicOverflowIntPending; | ||
81 | } | 86 | } |
82 | 87 | ||
83 | void ItLpQueue_clearValid( struct HvLpEvent * event ) | 88 | static void hvlpevent_clear_valid(struct HvLpEvent * event) |
84 | { | 89 | { |
85 | /* Clear the valid bit of the event | 90 | /* Tell the Hypervisor that we're done with this event. |
86 | * Also clear bits within this event that might | 91 | * Also clear bits within this event that might look like valid bits. |
87 | * look like valid bits (on 64-byte boundaries) | 92 | * ie. on 64-byte boundaries. |
88 | */ | 93 | */ |
89 | unsigned extra = (( event->xSizeMinus1 + LpEventAlign ) / | 94 | struct HvLpEvent *tmp; |
90 | LpEventAlign ) - 1; | 95 | unsigned extra = ((event->xSizeMinus1 + LpEventAlign) / |
91 | switch ( extra ) { | 96 | LpEventAlign) - 1; |
92 | case 3: | 97 | |
93 | ((struct HvLpEvent*)((char*)event+3*LpEventAlign))->xFlags.xValid=0; | 98 | switch (extra) { |
94 | case 2: | 99 | case 3: |
95 | ((struct HvLpEvent*)((char*)event+2*LpEventAlign))->xFlags.xValid=0; | 100 | tmp = (struct HvLpEvent*)((char*)event + 3 * LpEventAlign); |
96 | case 1: | 101 | tmp->xFlags.xValid = 0; |
97 | ((struct HvLpEvent*)((char*)event+1*LpEventAlign))->xFlags.xValid=0; | 102 | case 2: |
98 | case 0: | 103 | tmp = (struct HvLpEvent*)((char*)event + 2 * LpEventAlign); |
99 | ; | 104 | tmp->xFlags.xValid = 0; |
105 | case 1: | ||
106 | tmp = (struct HvLpEvent*)((char*)event + 1 * LpEventAlign); | ||
107 | tmp->xFlags.xValid = 0; | ||
100 | } | 108 | } |
109 | |||
101 | mb(); | 110 | mb(); |
111 | |||
102 | event->xFlags.xValid = 0; | 112 | event->xFlags.xValid = 0; |
103 | } | 113 | } |
104 | 114 | ||
105 | unsigned ItLpQueue_process( struct ItLpQueue * lpQueue, struct pt_regs *regs ) | 115 | void process_hvlpevents(struct pt_regs *regs) |
106 | { | 116 | { |
107 | unsigned numIntsProcessed = 0; | 117 | struct HvLpEvent * event; |
108 | struct HvLpEvent * nextLpEvent; | ||
109 | 118 | ||
110 | /* If we have recursed, just return */ | 119 | /* If we have recursed, just return */ |
111 | if ( !set_inUse( lpQueue ) ) | 120 | if (!spin_trylock(&hvlpevent_queue.lock)) |
112 | return 0; | 121 | return; |
113 | |||
114 | if (ItLpQueueInProcess == 0) | ||
115 | ItLpQueueInProcess = 1; | ||
116 | else | ||
117 | BUG(); | ||
118 | 122 | ||
119 | for (;;) { | 123 | for (;;) { |
120 | nextLpEvent = ItLpQueue_getNextLpEvent( lpQueue ); | 124 | event = get_next_hvlpevent(); |
121 | if ( nextLpEvent ) { | 125 | if (event) { |
122 | /* Count events to return to caller | 126 | /* Call appropriate handler here, passing |
123 | * and count processed events in lpQueue | ||
124 | */ | ||
125 | ++numIntsProcessed; | ||
126 | lpQueue->xLpIntCount++; | ||
127 | /* Call appropriate handler here, passing | ||
128 | * a pointer to the LpEvent. The handler | 127 | * a pointer to the LpEvent. The handler |
129 | * must make a copy of the LpEvent if it | 128 | * must make a copy of the LpEvent if it |
130 | * needs it in a bottom half. (perhaps for | 129 | * needs it in a bottom half. (perhaps for |
131 | * an ACK) | 130 | * an ACK) |
132 | * | 131 | * |
133 | * Handlers are responsible for ACK processing | 132 | * Handlers are responsible for ACK processing |
134 | * | 133 | * |
135 | * The Hypervisor guarantees that LpEvents will | 134 | * The Hypervisor guarantees that LpEvents will |
136 | * only be delivered with types that we have | 135 | * only be delivered with types that we have |
137 | * registered for, so no type check is necessary | 136 | * registered for, so no type check is necessary |
138 | * here! | 137 | * here! |
139 | */ | 138 | */ |
140 | if ( nextLpEvent->xType < HvLpEvent_Type_NumTypes ) | 139 | if (event->xType < HvLpEvent_Type_NumTypes) |
141 | lpQueue->xLpIntCountByType[nextLpEvent->xType]++; | 140 | __get_cpu_var(hvlpevent_counts)[event->xType]++; |
142 | if ( nextLpEvent->xType < HvLpEvent_Type_NumTypes && | 141 | if (event->xType < HvLpEvent_Type_NumTypes && |
143 | lpEventHandler[nextLpEvent->xType] ) | 142 | lpEventHandler[event->xType]) |
144 | lpEventHandler[nextLpEvent->xType](nextLpEvent, regs); | 143 | lpEventHandler[event->xType](event, regs); |
145 | else | 144 | else |
146 | printk(KERN_INFO "Unexpected Lp Event type=%d\n", nextLpEvent->xType ); | 145 | printk(KERN_INFO "Unexpected Lp Event type=%d\n", event->xType ); |
147 | 146 | ||
148 | ItLpQueue_clearValid( nextLpEvent ); | 147 | hvlpevent_clear_valid(event); |
149 | } else if ( lpQueue->xPlicOverflowIntPending ) | 148 | } else if (hvlpevent_queue.xPlicOverflowIntPending) |
150 | /* | 149 | /* |
151 | * No more valid events. If overflow events are | 150 | * No more valid events. If overflow events are |
152 | * pending process them | 151 | * pending process them |
153 | */ | 152 | */ |
154 | HvCallEvent_getOverflowLpEvents( lpQueue->xIndex); | 153 | HvCallEvent_getOverflowLpEvents(hvlpevent_queue.xIndex); |
155 | else | 154 | else |
156 | break; | 155 | break; |
157 | } | 156 | } |
158 | 157 | ||
159 | ItLpQueueInProcess = 0; | 158 | spin_unlock(&hvlpevent_queue.lock); |
160 | mb(); | 159 | } |
161 | clear_inUse( lpQueue ); | 160 | |
161 | static int set_spread_lpevents(char *str) | ||
162 | { | ||
163 | unsigned long val = simple_strtoul(str, NULL, 0); | ||
164 | |||
165 | /* | ||
166 | * The parameter is the number of processors to share in processing | ||
167 | * lp events. | ||
168 | */ | ||
169 | if (( val > 0) && (val <= NR_CPUS)) { | ||
170 | spread_lpevents = val; | ||
171 | printk("lpevent processing spread over %ld processors\n", val); | ||
172 | } else { | ||
173 | printk("invalid spread_lpevents %ld\n", val); | ||
174 | } | ||
162 | 175 | ||
163 | get_paca()->lpevent_count += numIntsProcessed; | 176 | return 1; |
177 | } | ||
178 | __setup("spread_lpevents=", set_spread_lpevents); | ||
179 | |||
180 | void setup_hvlpevent_queue(void) | ||
181 | { | ||
182 | void *eventStack; | ||
183 | |||
184 | /* | ||
185 | * Allocate a page for the Event Stack. The Hypervisor needs the | ||
186 | * absolute real address, so we subtract out the KERNELBASE and add | ||
187 | * in the absolute real address of the kernel load area. | ||
188 | */ | ||
189 | eventStack = alloc_bootmem_pages(LpEventStackSize); | ||
190 | memset(eventStack, 0, LpEventStackSize); | ||
191 | |||
192 | /* Invoke the hypervisor to initialize the event stack */ | ||
193 | HvCallEvent_setLpEventStack(0, eventStack, LpEventStackSize); | ||
194 | |||
195 | hvlpevent_queue.xSlicEventStackPtr = (char *)eventStack; | ||
196 | hvlpevent_queue.xSlicCurEventPtr = (char *)eventStack; | ||
197 | hvlpevent_queue.xSlicLastValidEventPtr = (char *)eventStack + | ||
198 | (LpEventStackSize - LpEventMaxSize); | ||
199 | hvlpevent_queue.xIndex = 0; | ||
200 | } | ||
201 | |||
202 | static int proc_lpevents_show(struct seq_file *m, void *v) | ||
203 | { | ||
204 | int cpu, i; | ||
205 | unsigned long sum; | ||
206 | static unsigned long cpu_totals[NR_CPUS]; | ||
207 | |||
208 | /* FIXME: do we care that there's no locking here? */ | ||
209 | sum = 0; | ||
210 | for_each_online_cpu(cpu) { | ||
211 | cpu_totals[cpu] = 0; | ||
212 | for (i = 0; i < HvLpEvent_Type_NumTypes; i++) { | ||
213 | cpu_totals[cpu] += per_cpu(hvlpevent_counts, cpu)[i]; | ||
214 | } | ||
215 | sum += cpu_totals[cpu]; | ||
216 | } | ||
217 | |||
218 | seq_printf(m, "LpEventQueue 0\n"); | ||
219 | seq_printf(m, " events processed:\t%lu\n", sum); | ||
220 | |||
221 | for (i = 0; i < HvLpEvent_Type_NumTypes; ++i) { | ||
222 | sum = 0; | ||
223 | for_each_online_cpu(cpu) { | ||
224 | sum += per_cpu(hvlpevent_counts, cpu)[i]; | ||
225 | } | ||
226 | |||
227 | seq_printf(m, " %-20s %10lu\n", event_types[i], sum); | ||
228 | } | ||
229 | |||
230 | seq_printf(m, "\n events processed by processor:\n"); | ||
231 | |||
232 | for_each_online_cpu(cpu) { | ||
233 | seq_printf(m, " CPU%02d %10lu\n", cpu, cpu_totals[cpu]); | ||
234 | } | ||
235 | |||
236 | return 0; | ||
237 | } | ||
238 | |||
239 | static int proc_lpevents_open(struct inode *inode, struct file *file) | ||
240 | { | ||
241 | return single_open(file, proc_lpevents_show, NULL); | ||
242 | } | ||
164 | 243 | ||
165 | return numIntsProcessed; | 244 | static struct file_operations proc_lpevents_operations = { |
245 | .open = proc_lpevents_open, | ||
246 | .read = seq_read, | ||
247 | .llseek = seq_lseek, | ||
248 | .release = single_release, | ||
249 | }; | ||
250 | |||
251 | static int __init proc_lpevents_init(void) | ||
252 | { | ||
253 | struct proc_dir_entry *e; | ||
254 | |||
255 | e = create_proc_entry("iSeries/lpevents", S_IFREG|S_IRUGO, NULL); | ||
256 | if (e) | ||
257 | e->proc_fops = &proc_lpevents_operations; | ||
258 | |||
259 | return 0; | ||
166 | } | 260 | } |
261 | __initcall(proc_lpevents_init); | ||
262 | |||
diff --git a/arch/ppc64/kernel/LparData.c b/arch/ppc64/kernel/LparData.c index badc5a443614..6ffcf67dd507 100644 --- a/arch/ppc64/kernel/LparData.c +++ b/arch/ppc64/kernel/LparData.c | |||
@@ -28,13 +28,6 @@ | |||
28 | #include <asm/iSeries/IoHriProcessorVpd.h> | 28 | #include <asm/iSeries/IoHriProcessorVpd.h> |
29 | #include <asm/iSeries/ItSpCommArea.h> | 29 | #include <asm/iSeries/ItSpCommArea.h> |
30 | 30 | ||
31 | /* The LpQueue is used to pass event data from the hypervisor to | ||
32 | * the partition. This is where I/O interrupt events are communicated. | ||
33 | */ | ||
34 | |||
35 | /* May be filled in by the hypervisor so cannot end up in the BSS */ | ||
36 | struct ItLpQueue xItLpQueue __attribute__((__section__(".data"))); | ||
37 | |||
38 | 31 | ||
39 | /* The HvReleaseData is the root of the information shared between | 32 | /* The HvReleaseData is the root of the information shared between |
40 | * the hypervisor and Linux. | 33 | * the hypervisor and Linux. |
@@ -200,7 +193,7 @@ struct ItVpdAreas itVpdAreas = { | |||
200 | 0,0,0, /* 13 - 15 */ | 193 | 0,0,0, /* 13 - 15 */ |
201 | sizeof(struct IoHriProcessorVpd),/* 16 length of Proc Vpd */ | 194 | sizeof(struct IoHriProcessorVpd),/* 16 length of Proc Vpd */ |
202 | 0,0,0,0,0,0, /* 17 - 22 */ | 195 | 0,0,0,0,0,0, /* 17 - 22 */ |
203 | sizeof(struct ItLpQueue),/* 23 length of Lp Queue */ | 196 | sizeof(struct hvlpevent_queue), /* 23 length of Lp Queue */ |
204 | 0,0 /* 24 - 25 */ | 197 | 0,0 /* 24 - 25 */ |
205 | }, | 198 | }, |
206 | .xSlicVpdAdrs = { /* VPD addresses */ | 199 | .xSlicVpdAdrs = { /* VPD addresses */ |
@@ -218,7 +211,7 @@ struct ItVpdAreas itVpdAreas = { | |||
218 | 0,0,0, /* 13 - 15 */ | 211 | 0,0,0, /* 13 - 15 */ |
219 | &xIoHriProcessorVpd, /* 16 Proc Vpd */ | 212 | &xIoHriProcessorVpd, /* 16 Proc Vpd */ |
220 | 0,0,0,0,0,0, /* 17 - 22 */ | 213 | 0,0,0,0,0,0, /* 17 - 22 */ |
221 | &xItLpQueue, /* 23 Lp Queue */ | 214 | &hvlpevent_queue, /* 23 Lp Queue */ |
222 | 0,0 | 215 | 0,0 |
223 | } | 216 | } |
224 | }; | 217 | }; |
diff --git a/arch/ppc64/kernel/iSeries_proc.c b/arch/ppc64/kernel/iSeries_proc.c index 356bd9931fcc..0fe3116eba29 100644 --- a/arch/ppc64/kernel/iSeries_proc.c +++ b/arch/ppc64/kernel/iSeries_proc.c | |||
@@ -40,50 +40,6 @@ static int __init iseries_proc_create(void) | |||
40 | } | 40 | } |
41 | core_initcall(iseries_proc_create); | 41 | core_initcall(iseries_proc_create); |
42 | 42 | ||
43 | static char *event_types[9] = { | ||
44 | "Hypervisor\t\t", | ||
45 | "Machine Facilities\t", | ||
46 | "Session Manager\t", | ||
47 | "SPD I/O\t\t", | ||
48 | "Virtual Bus\t\t", | ||
49 | "PCI I/O\t\t", | ||
50 | "RIO I/O\t\t", | ||
51 | "Virtual Lan\t\t", | ||
52 | "Virtual I/O\t\t" | ||
53 | }; | ||
54 | |||
55 | static int proc_lpevents_show(struct seq_file *m, void *v) | ||
56 | { | ||
57 | unsigned int i; | ||
58 | |||
59 | seq_printf(m, "LpEventQueue 0\n"); | ||
60 | seq_printf(m, " events processed:\t%lu\n", | ||
61 | (unsigned long)xItLpQueue.xLpIntCount); | ||
62 | |||
63 | for (i = 0; i < 9; ++i) | ||
64 | seq_printf(m, " %s %10lu\n", event_types[i], | ||
65 | (unsigned long)xItLpQueue.xLpIntCountByType[i]); | ||
66 | |||
67 | seq_printf(m, "\n events processed by processor:\n"); | ||
68 | |||
69 | for_each_online_cpu(i) | ||
70 | seq_printf(m, " CPU%02d %10u\n", i, paca[i].lpevent_count); | ||
71 | |||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | static int proc_lpevents_open(struct inode *inode, struct file *file) | ||
76 | { | ||
77 | return single_open(file, proc_lpevents_show, NULL); | ||
78 | } | ||
79 | |||
80 | static struct file_operations proc_lpevents_operations = { | ||
81 | .open = proc_lpevents_open, | ||
82 | .read = seq_read, | ||
83 | .llseek = seq_lseek, | ||
84 | .release = single_release, | ||
85 | }; | ||
86 | |||
87 | static unsigned long startTitan = 0; | 43 | static unsigned long startTitan = 0; |
88 | static unsigned long startTb = 0; | 44 | static unsigned long startTb = 0; |
89 | 45 | ||
@@ -148,10 +104,6 @@ static int __init iseries_proc_init(void) | |||
148 | { | 104 | { |
149 | struct proc_dir_entry *e; | 105 | struct proc_dir_entry *e; |
150 | 106 | ||
151 | e = create_proc_entry("iSeries/lpevents", S_IFREG|S_IRUGO, NULL); | ||
152 | if (e) | ||
153 | e->proc_fops = &proc_lpevents_operations; | ||
154 | |||
155 | e = create_proc_entry("iSeries/titanTod", S_IFREG|S_IRUGO, NULL); | 107 | e = create_proc_entry("iSeries/titanTod", S_IFREG|S_IRUGO, NULL); |
156 | if (e) | 108 | if (e) |
157 | e->proc_fops = &proc_titantod_operations; | 109 | e->proc_fops = &proc_titantod_operations; |
diff --git a/arch/ppc64/kernel/iSeries_setup.c b/arch/ppc64/kernel/iSeries_setup.c index 86966ce76b58..b3f770f6d402 100644 --- a/arch/ppc64/kernel/iSeries_setup.c +++ b/arch/ppc64/kernel/iSeries_setup.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/smp.h> | 24 | #include <linux/smp.h> |
25 | #include <linux/param.h> | 25 | #include <linux/param.h> |
26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
27 | #include <linux/bootmem.h> | ||
28 | #include <linux/initrd.h> | 27 | #include <linux/initrd.h> |
29 | #include <linux/seq_file.h> | 28 | #include <linux/seq_file.h> |
30 | #include <linux/kdev_t.h> | 29 | #include <linux/kdev_t.h> |
@@ -676,7 +675,6 @@ static void __init iSeries_bolt_kernel(unsigned long saddr, unsigned long eaddr) | |||
676 | */ | 675 | */ |
677 | static void __init iSeries_setup_arch(void) | 676 | static void __init iSeries_setup_arch(void) |
678 | { | 677 | { |
679 | void *eventStack; | ||
680 | unsigned procIx = get_paca()->lppaca.dyn_hv_phys_proc_index; | 678 | unsigned procIx = get_paca()->lppaca.dyn_hv_phys_proc_index; |
681 | 679 | ||
682 | /* Add an eye catcher and the systemcfg layout version number */ | 680 | /* Add an eye catcher and the systemcfg layout version number */ |
@@ -685,24 +683,7 @@ static void __init iSeries_setup_arch(void) | |||
685 | systemcfg->version.minor = SYSTEMCFG_MINOR; | 683 | systemcfg->version.minor = SYSTEMCFG_MINOR; |
686 | 684 | ||
687 | /* Setup the Lp Event Queue */ | 685 | /* Setup the Lp Event Queue */ |
688 | 686 | setup_hvlpevent_queue(); | |
689 | /* Allocate a page for the Event Stack | ||
690 | * The hypervisor wants the absolute real address, so | ||
691 | * we subtract out the KERNELBASE and add in the | ||
692 | * absolute real address of the kernel load area | ||
693 | */ | ||
694 | eventStack = alloc_bootmem_pages(LpEventStackSize); | ||
695 | memset(eventStack, 0, LpEventStackSize); | ||
696 | |||
697 | /* Invoke the hypervisor to initialize the event stack */ | ||
698 | HvCallEvent_setLpEventStack(0, eventStack, LpEventStackSize); | ||
699 | |||
700 | /* Initialize fields in our Lp Event Queue */ | ||
701 | xItLpQueue.xSlicEventStackPtr = (char *)eventStack; | ||
702 | xItLpQueue.xSlicCurEventPtr = (char *)eventStack; | ||
703 | xItLpQueue.xSlicLastValidEventPtr = (char *)eventStack + | ||
704 | (LpEventStackSize - LpEventMaxSize); | ||
705 | xItLpQueue.xIndex = 0; | ||
706 | 687 | ||
707 | /* Compute processor frequency */ | 688 | /* Compute processor frequency */ |
708 | procFreqHz = ((1UL << 34) * 1000000) / | 689 | procFreqHz = ((1UL << 34) * 1000000) / |
@@ -853,28 +834,6 @@ static int __init iSeries_src_init(void) | |||
853 | 834 | ||
854 | late_initcall(iSeries_src_init); | 835 | late_initcall(iSeries_src_init); |
855 | 836 | ||
856 | static int set_spread_lpevents(char *str) | ||
857 | { | ||
858 | unsigned long i; | ||
859 | unsigned long val = simple_strtoul(str, NULL, 0); | ||
860 | |||
861 | /* | ||
862 | * The parameter is the number of processors to share in processing | ||
863 | * lp events. | ||
864 | */ | ||
865 | if (( val > 0) && (val <= NR_CPUS)) { | ||
866 | for (i = 1; i < val; ++i) | ||
867 | paca[i].lpqueue_ptr = paca[0].lpqueue_ptr; | ||
868 | |||
869 | printk("lpevent processing spread over %ld processors\n", val); | ||
870 | } else { | ||
871 | printk("invalid spread_lpevents %ld\n", val); | ||
872 | } | ||
873 | |||
874 | return 1; | ||
875 | } | ||
876 | __setup("spread_lpevents=", set_spread_lpevents); | ||
877 | |||
878 | #ifndef CONFIG_PCI | 837 | #ifndef CONFIG_PCI |
879 | void __init iSeries_init_IRQ(void) { } | 838 | void __init iSeries_init_IRQ(void) { } |
880 | #endif | 839 | #endif |
diff --git a/arch/ppc64/kernel/idle.c b/arch/ppc64/kernel/idle.c index bdf13b4dc1c8..08952c7e6216 100644 --- a/arch/ppc64/kernel/idle.c +++ b/arch/ppc64/kernel/idle.c | |||
@@ -88,7 +88,7 @@ static int iSeries_idle(void) | |||
88 | 88 | ||
89 | while (1) { | 89 | while (1) { |
90 | if (lpaca->lppaca.shared_proc) { | 90 | if (lpaca->lppaca.shared_proc) { |
91 | if (ItLpQueue_isLpIntPending(lpaca->lpqueue_ptr)) | 91 | if (hvlpevent_is_pending()) |
92 | process_iSeries_events(); | 92 | process_iSeries_events(); |
93 | if (!need_resched()) | 93 | if (!need_resched()) |
94 | yield_shared_processor(); | 94 | yield_shared_processor(); |
@@ -100,7 +100,7 @@ static int iSeries_idle(void) | |||
100 | 100 | ||
101 | while (!need_resched()) { | 101 | while (!need_resched()) { |
102 | HMT_medium(); | 102 | HMT_medium(); |
103 | if (ItLpQueue_isLpIntPending(lpaca->lpqueue_ptr)) | 103 | if (hvlpevent_is_pending()) |
104 | process_iSeries_events(); | 104 | process_iSeries_events(); |
105 | HMT_low(); | 105 | HMT_low(); |
106 | } | 106 | } |
diff --git a/arch/ppc64/kernel/irq.c b/arch/ppc64/kernel/irq.c index 3defc8c33adf..f41afe545045 100644 --- a/arch/ppc64/kernel/irq.c +++ b/arch/ppc64/kernel/irq.c | |||
@@ -66,7 +66,6 @@ EXPORT_SYMBOL(irq_desc); | |||
66 | int distribute_irqs = 1; | 66 | int distribute_irqs = 1; |
67 | int __irq_offset_value; | 67 | int __irq_offset_value; |
68 | int ppc_spurious_interrupts; | 68 | int ppc_spurious_interrupts; |
69 | unsigned long lpevent_count; | ||
70 | u64 ppc64_interrupt_controller; | 69 | u64 ppc64_interrupt_controller; |
71 | 70 | ||
72 | int show_interrupts(struct seq_file *p, void *v) | 71 | int show_interrupts(struct seq_file *p, void *v) |
@@ -245,7 +244,7 @@ void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq) | |||
245 | 244 | ||
246 | spin_lock(&desc->lock); | 245 | spin_lock(&desc->lock); |
247 | if (!noirqdebug) | 246 | if (!noirqdebug) |
248 | note_interrupt(irq, desc, action_ret); | 247 | note_interrupt(irq, desc, action_ret, regs); |
249 | if (likely(!(desc->status & IRQ_PENDING))) | 248 | if (likely(!(desc->status & IRQ_PENDING))) |
250 | break; | 249 | break; |
251 | desc->status &= ~IRQ_PENDING; | 250 | desc->status &= ~IRQ_PENDING; |
@@ -269,7 +268,6 @@ out: | |||
269 | void do_IRQ(struct pt_regs *regs) | 268 | void do_IRQ(struct pt_regs *regs) |
270 | { | 269 | { |
271 | struct paca_struct *lpaca; | 270 | struct paca_struct *lpaca; |
272 | struct ItLpQueue *lpq; | ||
273 | 271 | ||
274 | irq_enter(); | 272 | irq_enter(); |
275 | 273 | ||
@@ -295,9 +293,8 @@ void do_IRQ(struct pt_regs *regs) | |||
295 | iSeries_smp_message_recv(regs); | 293 | iSeries_smp_message_recv(regs); |
296 | } | 294 | } |
297 | #endif /* CONFIG_SMP */ | 295 | #endif /* CONFIG_SMP */ |
298 | lpq = lpaca->lpqueue_ptr; | 296 | if (hvlpevent_is_pending()) |
299 | if (lpq && ItLpQueue_isLpIntPending(lpq)) | 297 | process_hvlpevents(regs); |
300 | lpevent_count += ItLpQueue_process(lpq, regs); | ||
301 | 298 | ||
302 | irq_exit(); | 299 | irq_exit(); |
303 | 300 | ||
diff --git a/arch/ppc64/kernel/kprobes.c b/arch/ppc64/kernel/kprobes.c index 1d2ff6d6b0b3..a3d519518fb8 100644 --- a/arch/ppc64/kernel/kprobes.c +++ b/arch/ppc64/kernel/kprobes.c | |||
@@ -444,7 +444,7 @@ static struct kprobe trampoline_p = { | |||
444 | .pre_handler = trampoline_probe_handler | 444 | .pre_handler = trampoline_probe_handler |
445 | }; | 445 | }; |
446 | 446 | ||
447 | int __init arch_init(void) | 447 | int __init arch_init_kprobes(void) |
448 | { | 448 | { |
449 | return register_kprobe(&trampoline_p); | 449 | return register_kprobe(&trampoline_p); |
450 | } | 450 | } |
diff --git a/arch/ppc64/kernel/mf.c b/arch/ppc64/kernel/mf.c index d98bebf7042f..ef4a338ebd01 100644 --- a/arch/ppc64/kernel/mf.c +++ b/arch/ppc64/kernel/mf.c | |||
@@ -801,10 +801,8 @@ int mf_get_boot_rtc(struct rtc_time *tm) | |||
801 | return rc; | 801 | return rc; |
802 | /* We need to poll here as we are not yet taking interrupts */ | 802 | /* We need to poll here as we are not yet taking interrupts */ |
803 | while (rtc_data.busy) { | 803 | while (rtc_data.busy) { |
804 | extern unsigned long lpevent_count; | 804 | if (hvlpevent_is_pending()) |
805 | struct ItLpQueue *lpq = get_paca()->lpqueue_ptr; | 805 | process_hvlpevents(NULL); |
806 | if (lpq && ItLpQueue_isLpIntPending(lpq)) | ||
807 | lpevent_count += ItLpQueue_process(lpq, NULL); | ||
808 | } | 806 | } |
809 | return rtc_set_tm(rtc_data.rc, rtc_data.ce_msg.ce_msg, tm); | 807 | return rtc_set_tm(rtc_data.rc, rtc_data.ce_msg.ce_msg, tm); |
810 | } | 808 | } |
diff --git a/arch/ppc64/kernel/nvram.c b/arch/ppc64/kernel/nvram.c index 4e71781a4414..4fb1a9f5060d 100644 --- a/arch/ppc64/kernel/nvram.c +++ b/arch/ppc64/kernel/nvram.c | |||
@@ -338,9 +338,8 @@ static int nvram_remove_os_partition(void) | |||
338 | */ | 338 | */ |
339 | static int nvram_create_os_partition(void) | 339 | static int nvram_create_os_partition(void) |
340 | { | 340 | { |
341 | struct list_head * p; | 341 | struct nvram_partition *part; |
342 | struct nvram_partition *part = NULL; | 342 | struct nvram_partition *new_part; |
343 | struct nvram_partition *new_part = NULL; | ||
344 | struct nvram_partition *free_part = NULL; | 343 | struct nvram_partition *free_part = NULL; |
345 | int seq_init[2] = { 0, 0 }; | 344 | int seq_init[2] = { 0, 0 }; |
346 | loff_t tmp_index; | 345 | loff_t tmp_index; |
@@ -349,8 +348,7 @@ static int nvram_create_os_partition(void) | |||
349 | 348 | ||
350 | /* Find a free partition that will give us the maximum needed size | 349 | /* Find a free partition that will give us the maximum needed size |
351 | If can't find one that will give us the minimum size needed */ | 350 | If can't find one that will give us the minimum size needed */ |
352 | list_for_each(p, &nvram_part->partition) { | 351 | list_for_each_entry(part, &nvram_part->partition, partition) { |
353 | part = list_entry(p, struct nvram_partition, partition); | ||
354 | if (part->header.signature != NVRAM_SIG_FREE) | 352 | if (part->header.signature != NVRAM_SIG_FREE) |
355 | continue; | 353 | continue; |
356 | 354 | ||
diff --git a/arch/ppc64/kernel/of_device.c b/arch/ppc64/kernel/of_device.c index 66bd5ab7c25a..b80e81984ba8 100644 --- a/arch/ppc64/kernel/of_device.c +++ b/arch/ppc64/kernel/of_device.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/kernel.h> | 3 | #include <linux/kernel.h> |
4 | #include <linux/init.h> | 4 | #include <linux/init.h> |
5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
6 | #include <linux/mod_devicetable.h> | ||
6 | #include <asm/errno.h> | 7 | #include <asm/errno.h> |
7 | #include <asm/of_device.h> | 8 | #include <asm/of_device.h> |
8 | 9 | ||
@@ -15,20 +16,20 @@ | |||
15 | * Used by a driver to check whether an of_device present in the | 16 | * Used by a driver to check whether an of_device present in the |
16 | * system is in its list of supported devices. | 17 | * system is in its list of supported devices. |
17 | */ | 18 | */ |
18 | const struct of_match * of_match_device(const struct of_match *matches, | 19 | const struct of_device_id *of_match_device(const struct of_device_id *matches, |
19 | const struct of_device *dev) | 20 | const struct of_device *dev) |
20 | { | 21 | { |
21 | if (!dev->node) | 22 | if (!dev->node) |
22 | return NULL; | 23 | return NULL; |
23 | while (matches->name || matches->type || matches->compatible) { | 24 | while (matches->name[0] || matches->type[0] || matches->compatible[0]) { |
24 | int match = 1; | 25 | int match = 1; |
25 | if (matches->name && matches->name != OF_ANY_MATCH) | 26 | if (matches->name[0]) |
26 | match &= dev->node->name | 27 | match &= dev->node->name |
27 | && !strcmp(matches->name, dev->node->name); | 28 | && !strcmp(matches->name, dev->node->name); |
28 | if (matches->type && matches->type != OF_ANY_MATCH) | 29 | if (matches->type[0]) |
29 | match &= dev->node->type | 30 | match &= dev->node->type |
30 | && !strcmp(matches->type, dev->node->type); | 31 | && !strcmp(matches->type, dev->node->type); |
31 | if (matches->compatible && matches->compatible != OF_ANY_MATCH) | 32 | if (matches->compatible[0]) |
32 | match &= device_is_compatible(dev->node, | 33 | match &= device_is_compatible(dev->node, |
33 | matches->compatible); | 34 | matches->compatible); |
34 | if (match) | 35 | if (match) |
@@ -42,7 +43,7 @@ static int of_platform_bus_match(struct device *dev, struct device_driver *drv) | |||
42 | { | 43 | { |
43 | struct of_device * of_dev = to_of_device(dev); | 44 | struct of_device * of_dev = to_of_device(dev); |
44 | struct of_platform_driver * of_drv = to_of_platform_driver(drv); | 45 | struct of_platform_driver * of_drv = to_of_platform_driver(drv); |
45 | const struct of_match * matches = of_drv->match_table; | 46 | const struct of_device_id * matches = of_drv->match_table; |
46 | 47 | ||
47 | if (!matches) | 48 | if (!matches) |
48 | return 0; | 49 | return 0; |
@@ -75,7 +76,7 @@ static int of_device_probe(struct device *dev) | |||
75 | int error = -ENODEV; | 76 | int error = -ENODEV; |
76 | struct of_platform_driver *drv; | 77 | struct of_platform_driver *drv; |
77 | struct of_device *of_dev; | 78 | struct of_device *of_dev; |
78 | const struct of_match *match; | 79 | const struct of_device_id *match; |
79 | 80 | ||
80 | drv = to_of_platform_driver(dev->driver); | 81 | drv = to_of_platform_driver(dev->driver); |
81 | of_dev = to_of_device(dev); | 82 | of_dev = to_of_device(dev); |
diff --git a/arch/ppc64/kernel/pacaData.c b/arch/ppc64/kernel/pacaData.c index a3e0975c26c1..6316188737b6 100644 --- a/arch/ppc64/kernel/pacaData.c +++ b/arch/ppc64/kernel/pacaData.c | |||
@@ -42,21 +42,7 @@ extern unsigned long __toc_start; | |||
42 | * processors. The processor VPD array needs one entry per physical | 42 | * processors. The processor VPD array needs one entry per physical |
43 | * processor (not thread). | 43 | * processor (not thread). |
44 | */ | 44 | */ |
45 | #ifdef CONFIG_PPC_ISERIES | 45 | #define PACA_INIT_COMMON(number, start, asrr, asrv) \ |
46 | #define EXTRA_INITS(number, lpq) \ | ||
47 | .lppaca_ptr = &paca[number].lppaca, \ | ||
48 | .lpqueue_ptr = (lpq), /* &xItLpQueue, */ \ | ||
49 | .reg_save_ptr = &paca[number].reg_save, \ | ||
50 | .reg_save = { \ | ||
51 | .xDesc = 0xd397d9e2, /* "LpRS" */ \ | ||
52 | .xSize = sizeof(struct ItLpRegSave) \ | ||
53 | }, | ||
54 | #else | ||
55 | #define EXTRA_INITS(number, lpq) | ||
56 | #endif | ||
57 | |||
58 | #define PACAINITDATA(number,start,lpq,asrr,asrv) \ | ||
59 | { \ | ||
60 | .lock_token = 0x8000, \ | 46 | .lock_token = 0x8000, \ |
61 | .paca_index = (number), /* Paca Index */ \ | 47 | .paca_index = (number), /* Paca Index */ \ |
62 | .default_decr = 0x00ff0000, /* Initial Decr */ \ | 48 | .default_decr = 0x00ff0000, /* Initial Decr */ \ |
@@ -74,147 +60,79 @@ extern unsigned long __toc_start; | |||
74 | .end_of_quantum = 0xfffffffffffffffful, \ | 60 | .end_of_quantum = 0xfffffffffffffffful, \ |
75 | .slb_count = 64, \ | 61 | .slb_count = 64, \ |
76 | }, \ | 62 | }, \ |
77 | EXTRA_INITS((number), (lpq)) \ | ||
78 | } | ||
79 | 63 | ||
80 | struct paca_struct paca[] = { | ||
81 | #ifdef CONFIG_PPC_ISERIES | 64 | #ifdef CONFIG_PPC_ISERIES |
82 | PACAINITDATA( 0, 1, &xItLpQueue, 0, STAB0_VIRT_ADDR), | 65 | #define PACA_INIT_ISERIES(number) \ |
66 | .lppaca_ptr = &paca[number].lppaca, \ | ||
67 | .reg_save_ptr = &paca[number].reg_save, \ | ||
68 | .reg_save = { \ | ||
69 | .xDesc = 0xd397d9e2, /* "LpRS" */ \ | ||
70 | .xSize = sizeof(struct ItLpRegSave) \ | ||
71 | } | ||
72 | |||
73 | #define PACA_INIT(number) \ | ||
74 | { \ | ||
75 | PACA_INIT_COMMON(number, 0, 0, 0) \ | ||
76 | PACA_INIT_ISERIES(number) \ | ||
77 | } | ||
78 | |||
79 | #define BOOTCPU_PACA_INIT(number) \ | ||
80 | { \ | ||
81 | PACA_INIT_COMMON(number, 1, 0, STAB0_VIRT_ADDR) \ | ||
82 | PACA_INIT_ISERIES(number) \ | ||
83 | } | ||
84 | |||
83 | #else | 85 | #else |
84 | PACAINITDATA( 0, 1, NULL, STAB0_PHYS_ADDR, STAB0_VIRT_ADDR), | 86 | #define PACA_INIT(number) \ |
87 | { \ | ||
88 | PACA_INIT_COMMON(number, 0, 0, 0) \ | ||
89 | } | ||
90 | |||
91 | #define BOOTCPU_PACA_INIT(number) \ | ||
92 | { \ | ||
93 | PACA_INIT_COMMON(number, 1, STAB0_PHYS_ADDR, STAB0_VIRT_ADDR) \ | ||
94 | } | ||
85 | #endif | 95 | #endif |
96 | |||
97 | struct paca_struct paca[] = { | ||
98 | BOOTCPU_PACA_INIT(0), | ||
86 | #if NR_CPUS > 1 | 99 | #if NR_CPUS > 1 |
87 | PACAINITDATA( 1, 0, NULL, 0, 0), | 100 | PACA_INIT( 1), PACA_INIT( 2), PACA_INIT( 3), |
88 | PACAINITDATA( 2, 0, NULL, 0, 0), | ||
89 | PACAINITDATA( 3, 0, NULL, 0, 0), | ||
90 | #if NR_CPUS > 4 | 101 | #if NR_CPUS > 4 |
91 | PACAINITDATA( 4, 0, NULL, 0, 0), | 102 | PACA_INIT( 4), PACA_INIT( 5), PACA_INIT( 6), PACA_INIT( 7), |
92 | PACAINITDATA( 5, 0, NULL, 0, 0), | ||
93 | PACAINITDATA( 6, 0, NULL, 0, 0), | ||
94 | PACAINITDATA( 7, 0, NULL, 0, 0), | ||
95 | #if NR_CPUS > 8 | 103 | #if NR_CPUS > 8 |
96 | PACAINITDATA( 8, 0, NULL, 0, 0), | 104 | PACA_INIT( 8), PACA_INIT( 9), PACA_INIT( 10), PACA_INIT( 11), |
97 | PACAINITDATA( 9, 0, NULL, 0, 0), | 105 | PACA_INIT( 12), PACA_INIT( 13), PACA_INIT( 14), PACA_INIT( 15), |
98 | PACAINITDATA(10, 0, NULL, 0, 0), | 106 | PACA_INIT( 16), PACA_INIT( 17), PACA_INIT( 18), PACA_INIT( 19), |
99 | PACAINITDATA(11, 0, NULL, 0, 0), | 107 | PACA_INIT( 20), PACA_INIT( 21), PACA_INIT( 22), PACA_INIT( 23), |
100 | PACAINITDATA(12, 0, NULL, 0, 0), | 108 | PACA_INIT( 24), PACA_INIT( 25), PACA_INIT( 26), PACA_INIT( 27), |
101 | PACAINITDATA(13, 0, NULL, 0, 0), | 109 | PACA_INIT( 28), PACA_INIT( 29), PACA_INIT( 30), PACA_INIT( 31), |
102 | PACAINITDATA(14, 0, NULL, 0, 0), | ||
103 | PACAINITDATA(15, 0, NULL, 0, 0), | ||
104 | PACAINITDATA(16, 0, NULL, 0, 0), | ||
105 | PACAINITDATA(17, 0, NULL, 0, 0), | ||
106 | PACAINITDATA(18, 0, NULL, 0, 0), | ||
107 | PACAINITDATA(19, 0, NULL, 0, 0), | ||
108 | PACAINITDATA(20, 0, NULL, 0, 0), | ||
109 | PACAINITDATA(21, 0, NULL, 0, 0), | ||
110 | PACAINITDATA(22, 0, NULL, 0, 0), | ||
111 | PACAINITDATA(23, 0, NULL, 0, 0), | ||
112 | PACAINITDATA(24, 0, NULL, 0, 0), | ||
113 | PACAINITDATA(25, 0, NULL, 0, 0), | ||
114 | PACAINITDATA(26, 0, NULL, 0, 0), | ||
115 | PACAINITDATA(27, 0, NULL, 0, 0), | ||
116 | PACAINITDATA(28, 0, NULL, 0, 0), | ||
117 | PACAINITDATA(29, 0, NULL, 0, 0), | ||
118 | PACAINITDATA(30, 0, NULL, 0, 0), | ||
119 | PACAINITDATA(31, 0, NULL, 0, 0), | ||
120 | #if NR_CPUS > 32 | 110 | #if NR_CPUS > 32 |
121 | PACAINITDATA(32, 0, NULL, 0, 0), | 111 | PACA_INIT( 32), PACA_INIT( 33), PACA_INIT( 34), PACA_INIT( 35), |
122 | PACAINITDATA(33, 0, NULL, 0, 0), | 112 | PACA_INIT( 36), PACA_INIT( 37), PACA_INIT( 38), PACA_INIT( 39), |
123 | PACAINITDATA(34, 0, NULL, 0, 0), | 113 | PACA_INIT( 40), PACA_INIT( 41), PACA_INIT( 42), PACA_INIT( 43), |
124 | PACAINITDATA(35, 0, NULL, 0, 0), | 114 | PACA_INIT( 44), PACA_INIT( 45), PACA_INIT( 46), PACA_INIT( 47), |
125 | PACAINITDATA(36, 0, NULL, 0, 0), | 115 | PACA_INIT( 48), PACA_INIT( 49), PACA_INIT( 50), PACA_INIT( 51), |
126 | PACAINITDATA(37, 0, NULL, 0, 0), | 116 | PACA_INIT( 52), PACA_INIT( 53), PACA_INIT( 54), PACA_INIT( 55), |
127 | PACAINITDATA(38, 0, NULL, 0, 0), | 117 | PACA_INIT( 56), PACA_INIT( 57), PACA_INIT( 58), PACA_INIT( 59), |
128 | PACAINITDATA(39, 0, NULL, 0, 0), | 118 | PACA_INIT( 60), PACA_INIT( 61), PACA_INIT( 62), PACA_INIT( 63), |
129 | PACAINITDATA(40, 0, NULL, 0, 0), | ||
130 | PACAINITDATA(41, 0, NULL, 0, 0), | ||
131 | PACAINITDATA(42, 0, NULL, 0, 0), | ||
132 | PACAINITDATA(43, 0, NULL, 0, 0), | ||
133 | PACAINITDATA(44, 0, NULL, 0, 0), | ||
134 | PACAINITDATA(45, 0, NULL, 0, 0), | ||
135 | PACAINITDATA(46, 0, NULL, 0, 0), | ||
136 | PACAINITDATA(47, 0, NULL, 0, 0), | ||
137 | PACAINITDATA(48, 0, NULL, 0, 0), | ||
138 | PACAINITDATA(49, 0, NULL, 0, 0), | ||
139 | PACAINITDATA(50, 0, NULL, 0, 0), | ||
140 | PACAINITDATA(51, 0, NULL, 0, 0), | ||
141 | PACAINITDATA(52, 0, NULL, 0, 0), | ||
142 | PACAINITDATA(53, 0, NULL, 0, 0), | ||
143 | PACAINITDATA(54, 0, NULL, 0, 0), | ||
144 | PACAINITDATA(55, 0, NULL, 0, 0), | ||
145 | PACAINITDATA(56, 0, NULL, 0, 0), | ||
146 | PACAINITDATA(57, 0, NULL, 0, 0), | ||
147 | PACAINITDATA(58, 0, NULL, 0, 0), | ||
148 | PACAINITDATA(59, 0, NULL, 0, 0), | ||
149 | PACAINITDATA(60, 0, NULL, 0, 0), | ||
150 | PACAINITDATA(61, 0, NULL, 0, 0), | ||
151 | PACAINITDATA(62, 0, NULL, 0, 0), | ||
152 | PACAINITDATA(63, 0, NULL, 0, 0), | ||
153 | #if NR_CPUS > 64 | 119 | #if NR_CPUS > 64 |
154 | PACAINITDATA(64, 0, NULL, 0, 0), | 120 | PACA_INIT( 64), PACA_INIT( 65), PACA_INIT( 66), PACA_INIT( 67), |
155 | PACAINITDATA(65, 0, NULL, 0, 0), | 121 | PACA_INIT( 68), PACA_INIT( 69), PACA_INIT( 70), PACA_INIT( 71), |
156 | PACAINITDATA(66, 0, NULL, 0, 0), | 122 | PACA_INIT( 72), PACA_INIT( 73), PACA_INIT( 74), PACA_INIT( 75), |
157 | PACAINITDATA(67, 0, NULL, 0, 0), | 123 | PACA_INIT( 76), PACA_INIT( 77), PACA_INIT( 78), PACA_INIT( 79), |
158 | PACAINITDATA(68, 0, NULL, 0, 0), | 124 | PACA_INIT( 80), PACA_INIT( 81), PACA_INIT( 82), PACA_INIT( 83), |
159 | PACAINITDATA(69, 0, NULL, 0, 0), | 125 | PACA_INIT( 84), PACA_INIT( 85), PACA_INIT( 86), PACA_INIT( 87), |
160 | PACAINITDATA(70, 0, NULL, 0, 0), | 126 | PACA_INIT( 88), PACA_INIT( 89), PACA_INIT( 90), PACA_INIT( 91), |
161 | PACAINITDATA(71, 0, NULL, 0, 0), | 127 | PACA_INIT( 92), PACA_INIT( 93), PACA_INIT( 94), PACA_INIT( 95), |
162 | PACAINITDATA(72, 0, NULL, 0, 0), | 128 | PACA_INIT( 96), PACA_INIT( 97), PACA_INIT( 98), PACA_INIT( 99), |
163 | PACAINITDATA(73, 0, NULL, 0, 0), | 129 | PACA_INIT(100), PACA_INIT(101), PACA_INIT(102), PACA_INIT(103), |
164 | PACAINITDATA(74, 0, NULL, 0, 0), | 130 | PACA_INIT(104), PACA_INIT(105), PACA_INIT(106), PACA_INIT(107), |
165 | PACAINITDATA(75, 0, NULL, 0, 0), | 131 | PACA_INIT(108), PACA_INIT(109), PACA_INIT(110), PACA_INIT(111), |
166 | PACAINITDATA(76, 0, NULL, 0, 0), | 132 | PACA_INIT(112), PACA_INIT(113), PACA_INIT(114), PACA_INIT(115), |
167 | PACAINITDATA(77, 0, NULL, 0, 0), | 133 | PACA_INIT(116), PACA_INIT(117), PACA_INIT(118), PACA_INIT(119), |
168 | PACAINITDATA(78, 0, NULL, 0, 0), | 134 | PACA_INIT(120), PACA_INIT(121), PACA_INIT(122), PACA_INIT(123), |
169 | PACAINITDATA(79, 0, NULL, 0, 0), | 135 | PACA_INIT(124), PACA_INIT(125), PACA_INIT(126), PACA_INIT(127), |
170 | PACAINITDATA(80, 0, NULL, 0, 0), | ||
171 | PACAINITDATA(81, 0, NULL, 0, 0), | ||
172 | PACAINITDATA(82, 0, NULL, 0, 0), | ||
173 | PACAINITDATA(83, 0, NULL, 0, 0), | ||
174 | PACAINITDATA(84, 0, NULL, 0, 0), | ||
175 | PACAINITDATA(85, 0, NULL, 0, 0), | ||
176 | PACAINITDATA(86, 0, NULL, 0, 0), | ||
177 | PACAINITDATA(87, 0, NULL, 0, 0), | ||
178 | PACAINITDATA(88, 0, NULL, 0, 0), | ||
179 | PACAINITDATA(89, 0, NULL, 0, 0), | ||
180 | PACAINITDATA(90, 0, NULL, 0, 0), | ||
181 | PACAINITDATA(91, 0, NULL, 0, 0), | ||
182 | PACAINITDATA(92, 0, NULL, 0, 0), | ||
183 | PACAINITDATA(93, 0, NULL, 0, 0), | ||
184 | PACAINITDATA(94, 0, NULL, 0, 0), | ||
185 | PACAINITDATA(95, 0, NULL, 0, 0), | ||
186 | PACAINITDATA(96, 0, NULL, 0, 0), | ||
187 | PACAINITDATA(97, 0, NULL, 0, 0), | ||
188 | PACAINITDATA(98, 0, NULL, 0, 0), | ||
189 | PACAINITDATA(99, 0, NULL, 0, 0), | ||
190 | PACAINITDATA(100, 0, NULL, 0, 0), | ||
191 | PACAINITDATA(101, 0, NULL, 0, 0), | ||
192 | PACAINITDATA(102, 0, NULL, 0, 0), | ||
193 | PACAINITDATA(103, 0, NULL, 0, 0), | ||
194 | PACAINITDATA(104, 0, NULL, 0, 0), | ||
195 | PACAINITDATA(105, 0, NULL, 0, 0), | ||
196 | PACAINITDATA(106, 0, NULL, 0, 0), | ||
197 | PACAINITDATA(107, 0, NULL, 0, 0), | ||
198 | PACAINITDATA(108, 0, NULL, 0, 0), | ||
199 | PACAINITDATA(109, 0, NULL, 0, 0), | ||
200 | PACAINITDATA(110, 0, NULL, 0, 0), | ||
201 | PACAINITDATA(111, 0, NULL, 0, 0), | ||
202 | PACAINITDATA(112, 0, NULL, 0, 0), | ||
203 | PACAINITDATA(113, 0, NULL, 0, 0), | ||
204 | PACAINITDATA(114, 0, NULL, 0, 0), | ||
205 | PACAINITDATA(115, 0, NULL, 0, 0), | ||
206 | PACAINITDATA(116, 0, NULL, 0, 0), | ||
207 | PACAINITDATA(117, 0, NULL, 0, 0), | ||
208 | PACAINITDATA(118, 0, NULL, 0, 0), | ||
209 | PACAINITDATA(119, 0, NULL, 0, 0), | ||
210 | PACAINITDATA(120, 0, NULL, 0, 0), | ||
211 | PACAINITDATA(121, 0, NULL, 0, 0), | ||
212 | PACAINITDATA(122, 0, NULL, 0, 0), | ||
213 | PACAINITDATA(123, 0, NULL, 0, 0), | ||
214 | PACAINITDATA(124, 0, NULL, 0, 0), | ||
215 | PACAINITDATA(125, 0, NULL, 0, 0), | ||
216 | PACAINITDATA(126, 0, NULL, 0, 0), | ||
217 | PACAINITDATA(127, 0, NULL, 0, 0), | ||
218 | #endif | 136 | #endif |
219 | #endif | 137 | #endif |
220 | #endif | 138 | #endif |
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c index 580676f87d23..ae6f579d3fa0 100644 --- a/arch/ppc64/kernel/pci.c +++ b/arch/ppc64/kernel/pci.c | |||
@@ -351,7 +351,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | |||
351 | *offset += hose->pci_mem_offset; | 351 | *offset += hose->pci_mem_offset; |
352 | res_bit = IORESOURCE_MEM; | 352 | res_bit = IORESOURCE_MEM; |
353 | } else { | 353 | } else { |
354 | io_offset = (unsigned long)hose->io_base_virt; | 354 | io_offset = (unsigned long)hose->io_base_virt - pci_io_base; |
355 | *offset += io_offset; | 355 | *offset += io_offset; |
356 | res_bit = IORESOURCE_IO; | 356 | res_bit = IORESOURCE_IO; |
357 | } | 357 | } |
@@ -378,7 +378,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | |||
378 | 378 | ||
379 | /* found it! construct the final physical address */ | 379 | /* found it! construct the final physical address */ |
380 | if (mmap_state == pci_mmap_io) | 380 | if (mmap_state == pci_mmap_io) |
381 | *offset += hose->io_base_phys - io_offset; | 381 | *offset += hose->io_base_phys - io_offset; |
382 | return rp; | 382 | return rp; |
383 | } | 383 | } |
384 | 384 | ||
@@ -944,4 +944,22 @@ int pci_read_irq_line(struct pci_dev *pci_dev) | |||
944 | } | 944 | } |
945 | EXPORT_SYMBOL(pci_read_irq_line); | 945 | EXPORT_SYMBOL(pci_read_irq_line); |
946 | 946 | ||
947 | void pci_resource_to_user(const struct pci_dev *dev, int bar, | ||
948 | const struct resource *rsrc, | ||
949 | u64 *start, u64 *end) | ||
950 | { | ||
951 | struct pci_controller *hose = pci_bus_to_host(dev->bus); | ||
952 | unsigned long offset = 0; | ||
953 | |||
954 | if (hose == NULL) | ||
955 | return; | ||
956 | |||
957 | if (rsrc->flags & IORESOURCE_IO) | ||
958 | offset = pci_io_base - (unsigned long)hose->io_base_virt + | ||
959 | hose->io_base_phys; | ||
960 | |||
961 | *start = rsrc->start + offset; | ||
962 | *end = rsrc->end + offset; | ||
963 | } | ||
964 | |||
947 | #endif /* CONFIG_PPC_MULTIPLATFORM */ | 965 | #endif /* CONFIG_PPC_MULTIPLATFORM */ |
diff --git a/arch/ppc64/kernel/sysfs.c b/arch/ppc64/kernel/sysfs.c index c8fa6569b2fd..2f704a2cafb1 100644 --- a/arch/ppc64/kernel/sysfs.c +++ b/arch/ppc64/kernel/sysfs.c | |||
@@ -400,7 +400,12 @@ static int __init topology_init(void) | |||
400 | struct cpu *c = &per_cpu(cpu_devices, cpu); | 400 | struct cpu *c = &per_cpu(cpu_devices, cpu); |
401 | 401 | ||
402 | #ifdef CONFIG_NUMA | 402 | #ifdef CONFIG_NUMA |
403 | parent = &node_devices[cpu_to_node(cpu)]; | 403 | /* The node to which a cpu belongs can't be known |
404 | * until the cpu is made present. | ||
405 | */ | ||
406 | parent = NULL; | ||
407 | if (cpu_present(cpu)) | ||
408 | parent = &node_devices[cpu_to_node(cpu)]; | ||
404 | #endif | 409 | #endif |
405 | /* | 410 | /* |
406 | * For now, we just see if the system supports making | 411 | * For now, we just see if the system supports making |
diff --git a/arch/ppc64/kernel/time.c b/arch/ppc64/kernel/time.c index 2a532db9138a..909462e1adea 100644 --- a/arch/ppc64/kernel/time.c +++ b/arch/ppc64/kernel/time.c | |||
@@ -99,7 +99,6 @@ unsigned long tb_to_ns_shift; | |||
99 | struct gettimeofday_struct do_gtod; | 99 | struct gettimeofday_struct do_gtod; |
100 | 100 | ||
101 | extern unsigned long wall_jiffies; | 101 | extern unsigned long wall_jiffies; |
102 | extern unsigned long lpevent_count; | ||
103 | extern int smp_tb_synchronized; | 102 | extern int smp_tb_synchronized; |
104 | 103 | ||
105 | extern struct timezone sys_tz; | 104 | extern struct timezone sys_tz; |
@@ -367,11 +366,8 @@ int timer_interrupt(struct pt_regs * regs) | |||
367 | set_dec(next_dec); | 366 | set_dec(next_dec); |
368 | 367 | ||
369 | #ifdef CONFIG_PPC_ISERIES | 368 | #ifdef CONFIG_PPC_ISERIES |
370 | { | 369 | if (hvlpevent_is_pending()) |
371 | struct ItLpQueue *lpq = lpaca->lpqueue_ptr; | 370 | process_hvlpevents(regs); |
372 | if (lpq && ItLpQueue_isLpIntPending(lpq)) | ||
373 | lpevent_count += ItLpQueue_process(lpq, regs); | ||
374 | } | ||
375 | #endif | 371 | #endif |
376 | 372 | ||
377 | /* collect purr register values often, for accurate calculations */ | 373 | /* collect purr register values often, for accurate calculations */ |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 262e13d086fe..7a117ef473c5 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -270,66 +270,10 @@ endmenu | |||
270 | 270 | ||
271 | source "drivers/Kconfig" | 271 | source "drivers/Kconfig" |
272 | 272 | ||
273 | config PRINTER | ||
274 | tristate "Parallel printer support" | ||
275 | depends on PARPORT | ||
276 | ---help--- | ||
277 | If you intend to attach a printer to the parallel port of your Linux | ||
278 | box (as opposed to using a serial printer; if the connector at the | ||
279 | printer has 9 or 25 holes ["female"], then it's serial), say Y. | ||
280 | Also read the Printing-HOWTO, available from | ||
281 | <http://www.tldp.org/docs.html#howto>. | ||
282 | |||
283 | It is possible to share one parallel port among several devices | ||
284 | (e.g. printer and ZIP drive) and it is safe to compile the | ||
285 | corresponding drivers into the kernel. If you want to compile this | ||
286 | driver as a module however, choose M here and read | ||
287 | <file:Documentation/parport.txt>. The module will be called lp. | ||
288 | |||
289 | If you have several parallel ports, you can specify which ports to | ||
290 | use with the "lp" kernel command line option. (Try "man bootparam" | ||
291 | or see the documentation of your boot loader (silo) about how to pass | ||
292 | options to the kernel at boot time.) The syntax of the "lp" command | ||
293 | line option can be found in <file:drivers/char/lp.c>. | ||
294 | |||
295 | If you have more than 8 printers, you need to increase the LP_NO | ||
296 | macro in lp.c and the PARPORT_MAX macro in parport.h. | ||
297 | |||
298 | source "mm/Kconfig" | ||
299 | |||
300 | endmenu | ||
301 | |||
302 | source "drivers/base/Kconfig" | ||
303 | |||
304 | source "drivers/video/Kconfig" | ||
305 | |||
306 | source "drivers/mtd/Kconfig" | ||
307 | |||
308 | source "drivers/serial/Kconfig" | ||
309 | |||
310 | if !SUN4 | 273 | if !SUN4 |
311 | source "drivers/sbus/char/Kconfig" | 274 | source "drivers/sbus/char/Kconfig" |
312 | endif | 275 | endif |
313 | 276 | ||
314 | source "drivers/block/Kconfig" | ||
315 | |||
316 | # Don't frighten a common SBus user | ||
317 | if PCI | ||
318 | |||
319 | source "drivers/ide/Kconfig" | ||
320 | |||
321 | endif | ||
322 | |||
323 | source "drivers/isdn/Kconfig" | ||
324 | |||
325 | source "drivers/scsi/Kconfig" | ||
326 | |||
327 | source "drivers/fc4/Kconfig" | ||
328 | |||
329 | source "drivers/md/Kconfig" | ||
330 | |||
331 | source "net/Kconfig" | ||
332 | |||
333 | # This one must be before the filesystem configs. -DaveM | 277 | # This one must be before the filesystem configs. -DaveM |
334 | 278 | ||
335 | menu "Unix98 PTY support" | 279 | menu "Unix98 PTY support" |
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index e2b050eb3b96..d78bc13ebbb9 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig | |||
@@ -444,6 +444,24 @@ config PRINTER | |||
444 | If you have more than 8 printers, you need to increase the LP_NO | 444 | If you have more than 8 printers, you need to increase the LP_NO |
445 | macro in lp.c and the PARPORT_MAX macro in parport.h. | 445 | macro in lp.c and the PARPORT_MAX macro in parport.h. |
446 | 446 | ||
447 | config PPDEV | ||
448 | tristate "Support for user-space parallel port device drivers" | ||
449 | depends on PARPORT | ||
450 | ---help--- | ||
451 | Saying Y to this adds support for /dev/parport device nodes. This | ||
452 | is needed for programs that want portable access to the parallel | ||
453 | port, for instance deviceid (which displays Plug-and-Play device | ||
454 | IDs). | ||
455 | |||
456 | This is the parallel port equivalent of SCSI generic support (sg). | ||
457 | It is safe to say N to this -- it is not needed for normal printing | ||
458 | or parallel port CD-ROM/disk support. | ||
459 | |||
460 | To compile this driver as a module, choose M here: the | ||
461 | module will be called ppdev. | ||
462 | |||
463 | If unsure, say N. | ||
464 | |||
447 | config ENVCTRL | 465 | config ENVCTRL |
448 | tristate "SUNW, envctrl support" | 466 | tristate "SUNW, envctrl support" |
449 | depends on PCI | 467 | depends on PCI |
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S index eee516a71c14..d3973d8a7195 100644 --- a/arch/sparc64/kernel/entry.S +++ b/arch/sparc64/kernel/entry.S | |||
@@ -553,13 +553,11 @@ do_ivec: | |||
553 | sllx %g3, 5, %g3 | 553 | sllx %g3, 5, %g3 |
554 | or %g2, %lo(ivector_table), %g2 | 554 | or %g2, %lo(ivector_table), %g2 |
555 | add %g2, %g3, %g3 | 555 | add %g2, %g3, %g3 |
556 | ldx [%g3 + 0x08], %g2 /* irq_info */ | ||
557 | ldub [%g3 + 0x04], %g4 /* pil */ | 556 | ldub [%g3 + 0x04], %g4 /* pil */ |
558 | brz,pn %g2, do_ivec_spurious | 557 | mov 1, %g2 |
559 | mov 1, %g2 | ||
560 | |||
561 | sllx %g2, %g4, %g2 | 558 | sllx %g2, %g4, %g2 |
562 | sllx %g4, 2, %g4 | 559 | sllx %g4, 2, %g4 |
560 | |||
563 | lduw [%g6 + %g4], %g5 /* g5 = irq_work(cpu, pil) */ | 561 | lduw [%g6 + %g4], %g5 /* g5 = irq_work(cpu, pil) */ |
564 | stw %g5, [%g3 + 0x00] /* bucket->irq_chain = g5 */ | 562 | stw %g5, [%g3 + 0x00] /* bucket->irq_chain = g5 */ |
565 | stw %g3, [%g6 + %g4] /* irq_work(cpu, pil) = bucket */ | 563 | stw %g3, [%g6 + %g4] /* irq_work(cpu, pil) = bucket */ |
@@ -567,9 +565,9 @@ do_ivec: | |||
567 | retry | 565 | retry |
568 | do_ivec_xcall: | 566 | do_ivec_xcall: |
569 | mov 0x50, %g1 | 567 | mov 0x50, %g1 |
570 | |||
571 | ldxa [%g1 + %g0] ASI_INTR_R, %g1 | 568 | ldxa [%g1 + %g0] ASI_INTR_R, %g1 |
572 | srl %g3, 0, %g3 | 569 | srl %g3, 0, %g3 |
570 | |||
573 | mov 0x60, %g7 | 571 | mov 0x60, %g7 |
574 | ldxa [%g7 + %g0] ASI_INTR_R, %g7 | 572 | ldxa [%g7 + %g0] ASI_INTR_R, %g7 |
575 | stxa %g0, [%g0] ASI_INTR_RECEIVE | 573 | stxa %g0, [%g0] ASI_INTR_RECEIVE |
@@ -581,19 +579,6 @@ do_ivec_xcall: | |||
581 | 1: jmpl %g3, %g0 | 579 | 1: jmpl %g3, %g0 |
582 | nop | 580 | nop |
583 | 581 | ||
584 | do_ivec_spurious: | ||
585 | stw %g3, [%g6 + 0x00] /* irq_work(cpu, 0) = bucket */ | ||
586 | rdpr %pstate, %g5 | ||
587 | |||
588 | wrpr %g5, PSTATE_IG | PSTATE_AG, %pstate | ||
589 | sethi %hi(109f), %g7 | ||
590 | ba,pt %xcc, etrap | ||
591 | 109: or %g7, %lo(109b), %g7 | ||
592 | call catch_disabled_ivec | ||
593 | add %sp, PTREGS_OFF, %o0 | ||
594 | ba,pt %xcc, rtrap | ||
595 | clr %l6 | ||
596 | |||
597 | .globl save_alternate_globals | 582 | .globl save_alternate_globals |
598 | save_alternate_globals: /* %o0 = save_area */ | 583 | save_alternate_globals: /* %o0 = save_area */ |
599 | rdpr %pstate, %o5 | 584 | rdpr %pstate, %o5 |
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c index 424712577307..daa2fb93052c 100644 --- a/arch/sparc64/kernel/irq.c +++ b/arch/sparc64/kernel/irq.c | |||
@@ -71,31 +71,7 @@ struct irq_work_struct { | |||
71 | struct irq_work_struct __irq_work[NR_CPUS]; | 71 | struct irq_work_struct __irq_work[NR_CPUS]; |
72 | #define irq_work(__cpu, __pil) &(__irq_work[(__cpu)].irq_worklists[(__pil)]) | 72 | #define irq_work(__cpu, __pil) &(__irq_work[(__cpu)].irq_worklists[(__pil)]) |
73 | 73 | ||
74 | #ifdef CONFIG_PCI | 74 | static struct irqaction *irq_action[NR_IRQS+1]; |
75 | /* This is a table of physical addresses used to deal with IBF_DMA_SYNC. | ||
76 | * It is used for PCI only to synchronize DMA transfers with IRQ delivery | ||
77 | * for devices behind busses other than APB on Sabre systems. | ||
78 | * | ||
79 | * Currently these physical addresses are just config space accesses | ||
80 | * to the command register for that device. | ||
81 | */ | ||
82 | unsigned long pci_dma_wsync; | ||
83 | unsigned long dma_sync_reg_table[256]; | ||
84 | unsigned char dma_sync_reg_table_entry = 0; | ||
85 | #endif | ||
86 | |||
87 | /* This is based upon code in the 32-bit Sparc kernel written mostly by | ||
88 | * David Redman (djhr@tadpole.co.uk). | ||
89 | */ | ||
90 | #define MAX_STATIC_ALLOC 4 | ||
91 | static struct irqaction static_irqaction[MAX_STATIC_ALLOC]; | ||
92 | static int static_irq_count; | ||
93 | |||
94 | /* This is exported so that fast IRQ handlers can get at it... -DaveM */ | ||
95 | struct irqaction *irq_action[NR_IRQS+1] = { | ||
96 | NULL, NULL, NULL, NULL, NULL, NULL , NULL, NULL, | ||
97 | NULL, NULL, NULL, NULL, NULL, NULL , NULL, NULL | ||
98 | }; | ||
99 | 75 | ||
100 | /* This only synchronizes entities which modify IRQ handler | 76 | /* This only synchronizes entities which modify IRQ handler |
101 | * state and some selected user-level spots that want to | 77 | * state and some selected user-level spots that want to |
@@ -241,17 +217,22 @@ void disable_irq(unsigned int irq) | |||
241 | * the CPU %tick register and not by some normal vectored interrupt | 217 | * the CPU %tick register and not by some normal vectored interrupt |
242 | * source. To handle this special case, we use this dummy INO bucket. | 218 | * source. To handle this special case, we use this dummy INO bucket. |
243 | */ | 219 | */ |
220 | static struct irq_desc pil0_dummy_desc; | ||
244 | static struct ino_bucket pil0_dummy_bucket = { | 221 | static struct ino_bucket pil0_dummy_bucket = { |
245 | 0, /* irq_chain */ | 222 | .irq_info = &pil0_dummy_desc, |
246 | 0, /* pil */ | ||
247 | 0, /* pending */ | ||
248 | 0, /* flags */ | ||
249 | 0, /* __unused */ | ||
250 | NULL, /* irq_info */ | ||
251 | 0UL, /* iclr */ | ||
252 | 0UL, /* imap */ | ||
253 | }; | 223 | }; |
254 | 224 | ||
225 | static void build_irq_error(const char *msg, unsigned int ino, int pil, int inofixup, | ||
226 | unsigned long iclr, unsigned long imap, | ||
227 | struct ino_bucket *bucket) | ||
228 | { | ||
229 | prom_printf("IRQ: INO %04x (%d:%016lx:%016lx) --> " | ||
230 | "(%d:%d:%016lx:%016lx), halting...\n", | ||
231 | ino, bucket->pil, bucket->iclr, bucket->imap, | ||
232 | pil, inofixup, iclr, imap); | ||
233 | prom_halt(); | ||
234 | } | ||
235 | |||
255 | unsigned int build_irq(int pil, int inofixup, unsigned long iclr, unsigned long imap) | 236 | unsigned int build_irq(int pil, int inofixup, unsigned long iclr, unsigned long imap) |
256 | { | 237 | { |
257 | struct ino_bucket *bucket; | 238 | struct ino_bucket *bucket; |
@@ -280,28 +261,35 @@ unsigned int build_irq(int pil, int inofixup, unsigned long iclr, unsigned long | |||
280 | prom_halt(); | 261 | prom_halt(); |
281 | } | 262 | } |
282 | 263 | ||
283 | /* Ok, looks good, set it up. Don't touch the irq_chain or | ||
284 | * the pending flag. | ||
285 | */ | ||
286 | bucket = &ivector_table[ino]; | 264 | bucket = &ivector_table[ino]; |
287 | if ((bucket->flags & IBF_ACTIVE) || | 265 | if (bucket->flags & IBF_ACTIVE) |
288 | (bucket->irq_info != NULL)) { | 266 | build_irq_error("IRQ: Trying to build active INO bucket.\n", |
289 | /* This is a gross fatal error if it happens here. */ | 267 | ino, pil, inofixup, iclr, imap, bucket); |
290 | prom_printf("IRQ: Trying to reinit INO bucket, fatal error.\n"); | 268 | |
291 | prom_printf("IRQ: Request INO %04x (%d:%d:%016lx:%016lx)\n", | 269 | if (bucket->irq_info) { |
292 | ino, pil, inofixup, iclr, imap); | 270 | if (bucket->imap != imap || bucket->iclr != iclr) |
293 | prom_printf("IRQ: Existing (%d:%016lx:%016lx)\n", | 271 | build_irq_error("IRQ: Trying to reinit INO bucket.\n", |
294 | bucket->pil, bucket->iclr, bucket->imap); | 272 | ino, pil, inofixup, iclr, imap, bucket); |
295 | prom_printf("IRQ: Cannot continue, halting...\n"); | 273 | |
274 | goto out; | ||
275 | } | ||
276 | |||
277 | bucket->irq_info = kmalloc(sizeof(struct irq_desc), GFP_ATOMIC); | ||
278 | if (!bucket->irq_info) { | ||
279 | prom_printf("IRQ: Error, kmalloc(irq_desc) failed.\n"); | ||
296 | prom_halt(); | 280 | prom_halt(); |
297 | } | 281 | } |
282 | memset(bucket->irq_info, 0, sizeof(struct irq_desc)); | ||
283 | |||
284 | /* Ok, looks good, set it up. Don't touch the irq_chain or | ||
285 | * the pending flag. | ||
286 | */ | ||
298 | bucket->imap = imap; | 287 | bucket->imap = imap; |
299 | bucket->iclr = iclr; | 288 | bucket->iclr = iclr; |
300 | bucket->pil = pil; | 289 | bucket->pil = pil; |
301 | bucket->flags = 0; | 290 | bucket->flags = 0; |
302 | 291 | ||
303 | bucket->irq_info = NULL; | 292 | out: |
304 | |||
305 | return __irq(bucket); | 293 | return __irq(bucket); |
306 | } | 294 | } |
307 | 295 | ||
@@ -319,26 +307,65 @@ static void atomic_bucket_insert(struct ino_bucket *bucket) | |||
319 | __asm__ __volatile__("wrpr %0, 0x0, %%pstate" : : "r" (pstate)); | 307 | __asm__ __volatile__("wrpr %0, 0x0, %%pstate" : : "r" (pstate)); |
320 | } | 308 | } |
321 | 309 | ||
310 | static int check_irq_sharing(int pil, unsigned long irqflags) | ||
311 | { | ||
312 | struct irqaction *action, *tmp; | ||
313 | |||
314 | action = *(irq_action + pil); | ||
315 | if (action) { | ||
316 | if ((action->flags & SA_SHIRQ) && (irqflags & SA_SHIRQ)) { | ||
317 | for (tmp = action; tmp->next; tmp = tmp->next) | ||
318 | ; | ||
319 | } else { | ||
320 | return -EBUSY; | ||
321 | } | ||
322 | } | ||
323 | return 0; | ||
324 | } | ||
325 | |||
326 | static void append_irq_action(int pil, struct irqaction *action) | ||
327 | { | ||
328 | struct irqaction **pp = irq_action + pil; | ||
329 | |||
330 | while (*pp) | ||
331 | pp = &((*pp)->next); | ||
332 | *pp = action; | ||
333 | } | ||
334 | |||
335 | static struct irqaction *get_action_slot(struct ino_bucket *bucket) | ||
336 | { | ||
337 | struct irq_desc *desc = bucket->irq_info; | ||
338 | int max_irq, i; | ||
339 | |||
340 | max_irq = 1; | ||
341 | if (bucket->flags & IBF_PCI) | ||
342 | max_irq = MAX_IRQ_DESC_ACTION; | ||
343 | for (i = 0; i < max_irq; i++) { | ||
344 | struct irqaction *p = &desc->action[i]; | ||
345 | u32 mask = (1 << i); | ||
346 | |||
347 | if (desc->action_active_mask & mask) | ||
348 | continue; | ||
349 | |||
350 | desc->action_active_mask |= mask; | ||
351 | return p; | ||
352 | } | ||
353 | return NULL; | ||
354 | } | ||
355 | |||
322 | int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), | 356 | int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), |
323 | unsigned long irqflags, const char *name, void *dev_id) | 357 | unsigned long irqflags, const char *name, void *dev_id) |
324 | { | 358 | { |
325 | struct irqaction *action, *tmp = NULL; | 359 | struct irqaction *action; |
326 | struct ino_bucket *bucket = __bucket(irq); | 360 | struct ino_bucket *bucket = __bucket(irq); |
327 | unsigned long flags; | 361 | unsigned long flags; |
328 | int pending = 0; | 362 | int pending = 0; |
329 | 363 | ||
330 | if ((bucket != &pil0_dummy_bucket) && | 364 | if (unlikely(!handler)) |
331 | (bucket < &ivector_table[0] || | ||
332 | bucket >= &ivector_table[NUM_IVECS])) { | ||
333 | unsigned int *caller; | ||
334 | |||
335 | __asm__ __volatile__("mov %%i7, %0" : "=r" (caller)); | ||
336 | printk(KERN_CRIT "request_irq: Old style IRQ registry attempt " | ||
337 | "from %p, irq %08x.\n", caller, irq); | ||
338 | return -EINVAL; | 365 | return -EINVAL; |
339 | } | 366 | |
340 | if (!handler) | 367 | if (unlikely(!bucket->irq_info)) |
341 | return -EINVAL; | 368 | return -ENODEV; |
342 | 369 | ||
343 | if ((bucket != &pil0_dummy_bucket) && (irqflags & SA_SAMPLE_RANDOM)) { | 370 | if ((bucket != &pil0_dummy_bucket) && (irqflags & SA_SAMPLE_RANDOM)) { |
344 | /* | 371 | /* |
@@ -356,93 +383,20 @@ int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_ | |||
356 | 383 | ||
357 | spin_lock_irqsave(&irq_action_lock, flags); | 384 | spin_lock_irqsave(&irq_action_lock, flags); |
358 | 385 | ||
359 | action = *(bucket->pil + irq_action); | 386 | if (check_irq_sharing(bucket->pil, irqflags)) { |
360 | if (action) { | 387 | spin_unlock_irqrestore(&irq_action_lock, flags); |
361 | if ((action->flags & SA_SHIRQ) && (irqflags & SA_SHIRQ)) | 388 | return -EBUSY; |
362 | for (tmp = action; tmp->next; tmp = tmp->next) | ||
363 | ; | ||
364 | else { | ||
365 | spin_unlock_irqrestore(&irq_action_lock, flags); | ||
366 | return -EBUSY; | ||
367 | } | ||
368 | action = NULL; /* Or else! */ | ||
369 | } | 389 | } |
370 | 390 | ||
371 | /* If this is flagged as statically allocated then we use our | 391 | action = get_action_slot(bucket); |
372 | * private struct which is never freed. | ||
373 | */ | ||
374 | if (irqflags & SA_STATIC_ALLOC) { | ||
375 | if (static_irq_count < MAX_STATIC_ALLOC) | ||
376 | action = &static_irqaction[static_irq_count++]; | ||
377 | else | ||
378 | printk("Request for IRQ%d (%s) SA_STATIC_ALLOC failed " | ||
379 | "using kmalloc\n", irq, name); | ||
380 | } | ||
381 | if (action == NULL) | ||
382 | action = (struct irqaction *)kmalloc(sizeof(struct irqaction), | ||
383 | GFP_ATOMIC); | ||
384 | |||
385 | if (!action) { | 392 | if (!action) { |
386 | spin_unlock_irqrestore(&irq_action_lock, flags); | 393 | spin_unlock_irqrestore(&irq_action_lock, flags); |
387 | return -ENOMEM; | 394 | return -ENOMEM; |
388 | } | 395 | } |
389 | 396 | ||
390 | if (bucket == &pil0_dummy_bucket) { | 397 | bucket->flags |= IBF_ACTIVE; |
391 | bucket->irq_info = action; | 398 | pending = 0; |
392 | bucket->flags |= IBF_ACTIVE; | 399 | if (bucket != &pil0_dummy_bucket) { |
393 | } else { | ||
394 | if ((bucket->flags & IBF_ACTIVE) != 0) { | ||
395 | void *orig = bucket->irq_info; | ||
396 | void **vector = NULL; | ||
397 | |||
398 | if ((bucket->flags & IBF_PCI) == 0) { | ||
399 | printk("IRQ: Trying to share non-PCI bucket.\n"); | ||
400 | goto free_and_ebusy; | ||
401 | } | ||
402 | if ((bucket->flags & IBF_MULTI) == 0) { | ||
403 | vector = kmalloc(sizeof(void *) * 4, GFP_ATOMIC); | ||
404 | if (vector == NULL) | ||
405 | goto free_and_enomem; | ||
406 | |||
407 | /* We might have slept. */ | ||
408 | if ((bucket->flags & IBF_MULTI) != 0) { | ||
409 | int ent; | ||
410 | |||
411 | kfree(vector); | ||
412 | vector = (void **)bucket->irq_info; | ||
413 | for(ent = 0; ent < 4; ent++) { | ||
414 | if (vector[ent] == NULL) { | ||
415 | vector[ent] = action; | ||
416 | break; | ||
417 | } | ||
418 | } | ||
419 | if (ent == 4) | ||
420 | goto free_and_ebusy; | ||
421 | } else { | ||
422 | vector[0] = orig; | ||
423 | vector[1] = action; | ||
424 | vector[2] = NULL; | ||
425 | vector[3] = NULL; | ||
426 | bucket->irq_info = vector; | ||
427 | bucket->flags |= IBF_MULTI; | ||
428 | } | ||
429 | } else { | ||
430 | int ent; | ||
431 | |||
432 | vector = (void **)orig; | ||
433 | for (ent = 0; ent < 4; ent++) { | ||
434 | if (vector[ent] == NULL) { | ||
435 | vector[ent] = action; | ||
436 | break; | ||
437 | } | ||
438 | } | ||
439 | if (ent == 4) | ||
440 | goto free_and_ebusy; | ||
441 | } | ||
442 | } else { | ||
443 | bucket->irq_info = action; | ||
444 | bucket->flags |= IBF_ACTIVE; | ||
445 | } | ||
446 | pending = bucket->pending; | 400 | pending = bucket->pending; |
447 | if (pending) | 401 | if (pending) |
448 | bucket->pending = 0; | 402 | bucket->pending = 0; |
@@ -456,10 +410,7 @@ int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_ | |||
456 | put_ino_in_irqaction(action, irq); | 410 | put_ino_in_irqaction(action, irq); |
457 | put_smpaff_in_irqaction(action, CPU_MASK_NONE); | 411 | put_smpaff_in_irqaction(action, CPU_MASK_NONE); |
458 | 412 | ||
459 | if (tmp) | 413 | append_irq_action(bucket->pil, action); |
460 | tmp->next = action; | ||
461 | else | ||
462 | *(bucket->pil + irq_action) = action; | ||
463 | 414 | ||
464 | enable_irq(irq); | 415 | enable_irq(irq); |
465 | 416 | ||
@@ -468,147 +419,103 @@ int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_ | |||
468 | atomic_bucket_insert(bucket); | 419 | atomic_bucket_insert(bucket); |
469 | set_softint(1 << bucket->pil); | 420 | set_softint(1 << bucket->pil); |
470 | } | 421 | } |
422 | |||
471 | spin_unlock_irqrestore(&irq_action_lock, flags); | 423 | spin_unlock_irqrestore(&irq_action_lock, flags); |
472 | if ((bucket != &pil0_dummy_bucket) && (!(irqflags & SA_STATIC_ALLOC))) | 424 | |
425 | if (bucket != &pil0_dummy_bucket) | ||
473 | register_irq_proc(__irq_ino(irq)); | 426 | register_irq_proc(__irq_ino(irq)); |
474 | 427 | ||
475 | #ifdef CONFIG_SMP | 428 | #ifdef CONFIG_SMP |
476 | distribute_irqs(); | 429 | distribute_irqs(); |
477 | #endif | 430 | #endif |
478 | return 0; | 431 | return 0; |
479 | |||
480 | free_and_ebusy: | ||
481 | kfree(action); | ||
482 | spin_unlock_irqrestore(&irq_action_lock, flags); | ||
483 | return -EBUSY; | ||
484 | |||
485 | free_and_enomem: | ||
486 | kfree(action); | ||
487 | spin_unlock_irqrestore(&irq_action_lock, flags); | ||
488 | return -ENOMEM; | ||
489 | } | 432 | } |
490 | 433 | ||
491 | EXPORT_SYMBOL(request_irq); | 434 | EXPORT_SYMBOL(request_irq); |
492 | 435 | ||
493 | void free_irq(unsigned int irq, void *dev_id) | 436 | static struct irqaction *unlink_irq_action(unsigned int irq, void *dev_id) |
494 | { | 437 | { |
495 | struct irqaction *action; | 438 | struct ino_bucket *bucket = __bucket(irq); |
496 | struct irqaction *tmp = NULL; | 439 | struct irqaction *action, **pp; |
497 | unsigned long flags; | ||
498 | struct ino_bucket *bucket = __bucket(irq), *bp; | ||
499 | 440 | ||
500 | if ((bucket != &pil0_dummy_bucket) && | 441 | pp = irq_action + bucket->pil; |
501 | (bucket < &ivector_table[0] || | 442 | action = *pp; |
502 | bucket >= &ivector_table[NUM_IVECS])) { | 443 | if (unlikely(!action)) |
503 | unsigned int *caller; | 444 | return NULL; |
504 | 445 | ||
505 | __asm__ __volatile__("mov %%i7, %0" : "=r" (caller)); | 446 | if (unlikely(!action->handler)) { |
506 | printk(KERN_CRIT "free_irq: Old style IRQ removal attempt " | ||
507 | "from %p, irq %08x.\n", caller, irq); | ||
508 | return; | ||
509 | } | ||
510 | |||
511 | spin_lock_irqsave(&irq_action_lock, flags); | ||
512 | |||
513 | action = *(bucket->pil + irq_action); | ||
514 | if (!action->handler) { | ||
515 | printk("Freeing free IRQ %d\n", bucket->pil); | 447 | printk("Freeing free IRQ %d\n", bucket->pil); |
516 | return; | 448 | return NULL; |
517 | } | ||
518 | if (dev_id) { | ||
519 | for ( ; action; action = action->next) { | ||
520 | if (action->dev_id == dev_id) | ||
521 | break; | ||
522 | tmp = action; | ||
523 | } | ||
524 | if (!action) { | ||
525 | printk("Trying to free free shared IRQ %d\n", bucket->pil); | ||
526 | spin_unlock_irqrestore(&irq_action_lock, flags); | ||
527 | return; | ||
528 | } | ||
529 | } else if (action->flags & SA_SHIRQ) { | ||
530 | printk("Trying to free shared IRQ %d with NULL device ID\n", bucket->pil); | ||
531 | spin_unlock_irqrestore(&irq_action_lock, flags); | ||
532 | return; | ||
533 | } | 449 | } |
534 | 450 | ||
535 | if (action->flags & SA_STATIC_ALLOC) { | 451 | while (action && action->dev_id != dev_id) { |
536 | printk("Attempt to free statically allocated IRQ %d (%s)\n", | 452 | pp = &action->next; |
537 | bucket->pil, action->name); | 453 | action = *pp; |
538 | spin_unlock_irqrestore(&irq_action_lock, flags); | ||
539 | return; | ||
540 | } | 454 | } |
541 | 455 | ||
542 | if (action && tmp) | 456 | if (likely(action)) |
543 | tmp->next = action->next; | 457 | *pp = action->next; |
544 | else | 458 | |
545 | *(bucket->pil + irq_action) = action->next; | 459 | return action; |
460 | } | ||
461 | |||
462 | void free_irq(unsigned int irq, void *dev_id) | ||
463 | { | ||
464 | struct irqaction *action; | ||
465 | struct ino_bucket *bucket; | ||
466 | unsigned long flags; | ||
467 | |||
468 | spin_lock_irqsave(&irq_action_lock, flags); | ||
469 | |||
470 | action = unlink_irq_action(irq, dev_id); | ||
546 | 471 | ||
547 | spin_unlock_irqrestore(&irq_action_lock, flags); | 472 | spin_unlock_irqrestore(&irq_action_lock, flags); |
548 | 473 | ||
474 | if (unlikely(!action)) | ||
475 | return; | ||
476 | |||
549 | synchronize_irq(irq); | 477 | synchronize_irq(irq); |
550 | 478 | ||
551 | spin_lock_irqsave(&irq_action_lock, flags); | 479 | spin_lock_irqsave(&irq_action_lock, flags); |
552 | 480 | ||
481 | bucket = __bucket(irq); | ||
553 | if (bucket != &pil0_dummy_bucket) { | 482 | if (bucket != &pil0_dummy_bucket) { |
483 | struct irq_desc *desc = bucket->irq_info; | ||
554 | unsigned long imap = bucket->imap; | 484 | unsigned long imap = bucket->imap; |
555 | void **vector, *orig; | 485 | int ent, i; |
556 | int ent; | ||
557 | |||
558 | orig = bucket->irq_info; | ||
559 | vector = (void **)orig; | ||
560 | |||
561 | if ((bucket->flags & IBF_MULTI) != 0) { | ||
562 | int other = 0; | ||
563 | void *orphan = NULL; | ||
564 | for (ent = 0; ent < 4; ent++) { | ||
565 | if (vector[ent] == action) | ||
566 | vector[ent] = NULL; | ||
567 | else if (vector[ent] != NULL) { | ||
568 | orphan = vector[ent]; | ||
569 | other++; | ||
570 | } | ||
571 | } | ||
572 | 486 | ||
573 | /* Only free when no other shared irq | 487 | for (i = 0; i < MAX_IRQ_DESC_ACTION; i++) { |
574 | * uses this bucket. | 488 | struct irqaction *p = &desc->action[i]; |
575 | */ | 489 | |
576 | if (other) { | 490 | if (p == action) { |
577 | if (other == 1) { | 491 | desc->action_active_mask &= ~(1 << i); |
578 | /* Convert back to non-shared bucket. */ | 492 | break; |
579 | bucket->irq_info = orphan; | ||
580 | bucket->flags &= ~(IBF_MULTI); | ||
581 | kfree(vector); | ||
582 | } | ||
583 | goto out; | ||
584 | } | 493 | } |
585 | } else { | ||
586 | bucket->irq_info = NULL; | ||
587 | } | 494 | } |
588 | 495 | ||
589 | /* This unique interrupt source is now inactive. */ | 496 | if (!desc->action_active_mask) { |
590 | bucket->flags &= ~IBF_ACTIVE; | 497 | /* This unique interrupt source is now inactive. */ |
498 | bucket->flags &= ~IBF_ACTIVE; | ||
591 | 499 | ||
592 | /* See if any other buckets share this bucket's IMAP | 500 | /* See if any other buckets share this bucket's IMAP |
593 | * and are still active. | 501 | * and are still active. |
594 | */ | 502 | */ |
595 | for (ent = 0; ent < NUM_IVECS; ent++) { | 503 | for (ent = 0; ent < NUM_IVECS; ent++) { |
596 | bp = &ivector_table[ent]; | 504 | struct ino_bucket *bp = &ivector_table[ent]; |
597 | if (bp != bucket && | 505 | if (bp != bucket && |
598 | bp->imap == imap && | 506 | bp->imap == imap && |
599 | (bp->flags & IBF_ACTIVE) != 0) | 507 | (bp->flags & IBF_ACTIVE) != 0) |
600 | break; | 508 | break; |
601 | } | 509 | } |
602 | 510 | ||
603 | /* Only disable when no other sub-irq levels of | 511 | /* Only disable when no other sub-irq levels of |
604 | * the same IMAP are active. | 512 | * the same IMAP are active. |
605 | */ | 513 | */ |
606 | if (ent == NUM_IVECS) | 514 | if (ent == NUM_IVECS) |
607 | disable_irq(irq); | 515 | disable_irq(irq); |
516 | } | ||
608 | } | 517 | } |
609 | 518 | ||
610 | out: | ||
611 | kfree(action); | ||
612 | spin_unlock_irqrestore(&irq_action_lock, flags); | 519 | spin_unlock_irqrestore(&irq_action_lock, flags); |
613 | } | 520 | } |
614 | 521 | ||
@@ -647,99 +554,55 @@ void synchronize_irq(unsigned int irq) | |||
647 | } | 554 | } |
648 | #endif /* CONFIG_SMP */ | 555 | #endif /* CONFIG_SMP */ |
649 | 556 | ||
650 | void catch_disabled_ivec(struct pt_regs *regs) | 557 | static void process_bucket(int irq, struct ino_bucket *bp, struct pt_regs *regs) |
651 | { | 558 | { |
652 | int cpu = smp_processor_id(); | 559 | struct irq_desc *desc = bp->irq_info; |
653 | struct ino_bucket *bucket = __bucket(*irq_work(cpu, 0)); | 560 | unsigned char flags = bp->flags; |
561 | u32 action_mask, i; | ||
562 | int random; | ||
654 | 563 | ||
655 | /* We can actually see this on Ultra/PCI PCI cards, which are bridges | 564 | bp->flags |= IBF_INPROGRESS; |
656 | * to other devices. Here a single IMAP enabled potentially multiple | ||
657 | * unique interrupt sources (which each do have a unique ICLR register. | ||
658 | * | ||
659 | * So what we do is just register that the IVEC arrived, when registered | ||
660 | * for real the request_irq() code will check the bit and signal | ||
661 | * a local CPU interrupt for it. | ||
662 | */ | ||
663 | #if 0 | ||
664 | printk("IVEC: Spurious interrupt vector (%x) received at (%016lx)\n", | ||
665 | bucket - &ivector_table[0], regs->tpc); | ||
666 | #endif | ||
667 | *irq_work(cpu, 0) = 0; | ||
668 | bucket->pending = 1; | ||
669 | } | ||
670 | |||
671 | /* Tune this... */ | ||
672 | #define FORWARD_VOLUME 12 | ||
673 | |||
674 | #ifdef CONFIG_SMP | ||
675 | |||
676 | static inline void redirect_intr(int cpu, struct ino_bucket *bp) | ||
677 | { | ||
678 | /* Ok, here is what is going on: | ||
679 | * 1) Retargeting IRQs on Starfire is very | ||
680 | * expensive so just forget about it on them. | ||
681 | * 2) Moving around very high priority interrupts | ||
682 | * is a losing game. | ||
683 | * 3) If the current cpu is idle, interrupts are | ||
684 | * useful work, so keep them here. But do not | ||
685 | * pass to our neighbour if he is not very idle. | ||
686 | * 4) If sysadmin explicitly asks for directed intrs, | ||
687 | * Just Do It. | ||
688 | */ | ||
689 | struct irqaction *ap = bp->irq_info; | ||
690 | cpumask_t cpu_mask; | ||
691 | unsigned int buddy, ticks; | ||
692 | 565 | ||
693 | cpu_mask = get_smpaff_in_irqaction(ap); | 566 | if (unlikely(!(flags & IBF_ACTIVE))) { |
694 | cpus_and(cpu_mask, cpu_mask, cpu_online_map); | 567 | bp->pending = 1; |
695 | if (cpus_empty(cpu_mask)) | ||
696 | cpu_mask = cpu_online_map; | ||
697 | |||
698 | if (this_is_starfire != 0 || | ||
699 | bp->pil >= 10 || current->pid == 0) | ||
700 | goto out; | 568 | goto out; |
701 | |||
702 | /* 'cpu' is the MID (ie. UPAID), calculate the MID | ||
703 | * of our buddy. | ||
704 | */ | ||
705 | buddy = cpu + 1; | ||
706 | if (buddy >= NR_CPUS) | ||
707 | buddy = 0; | ||
708 | |||
709 | ticks = 0; | ||
710 | while (!cpu_isset(buddy, cpu_mask)) { | ||
711 | if (++buddy >= NR_CPUS) | ||
712 | buddy = 0; | ||
713 | if (++ticks > NR_CPUS) { | ||
714 | put_smpaff_in_irqaction(ap, CPU_MASK_NONE); | ||
715 | goto out; | ||
716 | } | ||
717 | } | 569 | } |
718 | 570 | ||
719 | if (buddy == cpu) | 571 | if (desc->pre_handler) |
720 | goto out; | 572 | desc->pre_handler(bp, |
573 | desc->pre_handler_arg1, | ||
574 | desc->pre_handler_arg2); | ||
721 | 575 | ||
722 | /* Voo-doo programming. */ | 576 | action_mask = desc->action_active_mask; |
723 | if (cpu_data(buddy).idle_volume < FORWARD_VOLUME) | 577 | random = 0; |
724 | goto out; | 578 | for (i = 0; i < MAX_IRQ_DESC_ACTION; i++) { |
579 | struct irqaction *p = &desc->action[i]; | ||
580 | u32 mask = (1 << i); | ||
725 | 581 | ||
726 | /* This just so happens to be correct on Cheetah | 582 | if (!(action_mask & mask)) |
727 | * at the moment. | 583 | continue; |
728 | */ | ||
729 | buddy <<= 26; | ||
730 | 584 | ||
731 | /* Push it to our buddy. */ | 585 | action_mask &= ~mask; |
732 | upa_writel(buddy | IMAP_VALID, bp->imap); | ||
733 | 586 | ||
587 | if (p->handler(__irq(bp), p->dev_id, regs) == IRQ_HANDLED) | ||
588 | random |= p->flags; | ||
589 | |||
590 | if (!action_mask) | ||
591 | break; | ||
592 | } | ||
593 | if (bp->pil != 0) { | ||
594 | upa_writel(ICLR_IDLE, bp->iclr); | ||
595 | /* Test and add entropy */ | ||
596 | if (random & SA_SAMPLE_RANDOM) | ||
597 | add_interrupt_randomness(irq); | ||
598 | } | ||
734 | out: | 599 | out: |
735 | return; | 600 | bp->flags &= ~IBF_INPROGRESS; |
736 | } | 601 | } |
737 | 602 | ||
738 | #endif | ||
739 | |||
740 | void handler_irq(int irq, struct pt_regs *regs) | 603 | void handler_irq(int irq, struct pt_regs *regs) |
741 | { | 604 | { |
742 | struct ino_bucket *bp, *nbp; | 605 | struct ino_bucket *bp; |
743 | int cpu = smp_processor_id(); | 606 | int cpu = smp_processor_id(); |
744 | 607 | ||
745 | #ifndef CONFIG_SMP | 608 | #ifndef CONFIG_SMP |
@@ -757,8 +620,6 @@ void handler_irq(int irq, struct pt_regs *regs) | |||
757 | clear_softint(clr_mask); | 620 | clear_softint(clr_mask); |
758 | } | 621 | } |
759 | #else | 622 | #else |
760 | int should_forward = 0; | ||
761 | |||
762 | clear_softint(1 << irq); | 623 | clear_softint(1 << irq); |
763 | #endif | 624 | #endif |
764 | 625 | ||
@@ -773,63 +634,12 @@ void handler_irq(int irq, struct pt_regs *regs) | |||
773 | #else | 634 | #else |
774 | bp = __bucket(xchg32(irq_work(cpu, irq), 0)); | 635 | bp = __bucket(xchg32(irq_work(cpu, irq), 0)); |
775 | #endif | 636 | #endif |
776 | for ( ; bp != NULL; bp = nbp) { | 637 | while (bp) { |
777 | unsigned char flags = bp->flags; | 638 | struct ino_bucket *nbp = __bucket(bp->irq_chain); |
778 | unsigned char random = 0; | ||
779 | 639 | ||
780 | nbp = __bucket(bp->irq_chain); | ||
781 | bp->irq_chain = 0; | 640 | bp->irq_chain = 0; |
782 | 641 | process_bucket(irq, bp, regs); | |
783 | bp->flags |= IBF_INPROGRESS; | 642 | bp = nbp; |
784 | |||
785 | if ((flags & IBF_ACTIVE) != 0) { | ||
786 | #ifdef CONFIG_PCI | ||
787 | if ((flags & IBF_DMA_SYNC) != 0) { | ||
788 | upa_readl(dma_sync_reg_table[bp->synctab_ent]); | ||
789 | upa_readq(pci_dma_wsync); | ||
790 | } | ||
791 | #endif | ||
792 | if ((flags & IBF_MULTI) == 0) { | ||
793 | struct irqaction *ap = bp->irq_info; | ||
794 | int ret; | ||
795 | |||
796 | ret = ap->handler(__irq(bp), ap->dev_id, regs); | ||
797 | if (ret == IRQ_HANDLED) | ||
798 | random |= ap->flags; | ||
799 | } else { | ||
800 | void **vector = (void **)bp->irq_info; | ||
801 | int ent; | ||
802 | for (ent = 0; ent < 4; ent++) { | ||
803 | struct irqaction *ap = vector[ent]; | ||
804 | if (ap != NULL) { | ||
805 | int ret; | ||
806 | |||
807 | ret = ap->handler(__irq(bp), | ||
808 | ap->dev_id, | ||
809 | regs); | ||
810 | if (ret == IRQ_HANDLED) | ||
811 | random |= ap->flags; | ||
812 | } | ||
813 | } | ||
814 | } | ||
815 | /* Only the dummy bucket lacks IMAP/ICLR. */ | ||
816 | if (bp->pil != 0) { | ||
817 | #ifdef CONFIG_SMP | ||
818 | if (should_forward) { | ||
819 | redirect_intr(cpu, bp); | ||
820 | should_forward = 0; | ||
821 | } | ||
822 | #endif | ||
823 | upa_writel(ICLR_IDLE, bp->iclr); | ||
824 | |||
825 | /* Test and add entropy */ | ||
826 | if (random & SA_SAMPLE_RANDOM) | ||
827 | add_interrupt_randomness(irq); | ||
828 | } | ||
829 | } else | ||
830 | bp->pending = 1; | ||
831 | |||
832 | bp->flags &= ~IBF_INPROGRESS; | ||
833 | } | 643 | } |
834 | irq_exit(); | 644 | irq_exit(); |
835 | } | 645 | } |
@@ -959,7 +769,10 @@ static void distribute_irqs(void) | |||
959 | */ | 769 | */ |
960 | for (level = 1; level < NR_IRQS; level++) { | 770 | for (level = 1; level < NR_IRQS; level++) { |
961 | struct irqaction *p = irq_action[level]; | 771 | struct irqaction *p = irq_action[level]; |
962 | if (level == 12) continue; | 772 | |
773 | if (level == 12) | ||
774 | continue; | ||
775 | |||
963 | while(p) { | 776 | while(p) { |
964 | cpu = retarget_one_irq(p, cpu); | 777 | cpu = retarget_one_irq(p, cpu); |
965 | p = p->next; | 778 | p = p->next; |
@@ -1104,7 +917,8 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off, | |||
1104 | int count, int *eof, void *data) | 917 | int count, int *eof, void *data) |
1105 | { | 918 | { |
1106 | struct ino_bucket *bp = ivector_table + (long)data; | 919 | struct ino_bucket *bp = ivector_table + (long)data; |
1107 | struct irqaction *ap = bp->irq_info; | 920 | struct irq_desc *desc = bp->irq_info; |
921 | struct irqaction *ap = desc->action; | ||
1108 | cpumask_t mask; | 922 | cpumask_t mask; |
1109 | int len; | 923 | int len; |
1110 | 924 | ||
@@ -1122,11 +936,13 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off, | |||
1122 | static inline void set_intr_affinity(int irq, cpumask_t hw_aff) | 936 | static inline void set_intr_affinity(int irq, cpumask_t hw_aff) |
1123 | { | 937 | { |
1124 | struct ino_bucket *bp = ivector_table + irq; | 938 | struct ino_bucket *bp = ivector_table + irq; |
939 | struct irq_desc *desc = bp->irq_info; | ||
940 | struct irqaction *ap = desc->action; | ||
1125 | 941 | ||
1126 | /* Users specify affinity in terms of hw cpu ids. | 942 | /* Users specify affinity in terms of hw cpu ids. |
1127 | * As soon as we do this, handler_irq() might see and take action. | 943 | * As soon as we do this, handler_irq() might see and take action. |
1128 | */ | 944 | */ |
1129 | put_smpaff_in_irqaction((struct irqaction *)bp->irq_info, hw_aff); | 945 | put_smpaff_in_irqaction(ap, hw_aff); |
1130 | 946 | ||
1131 | /* Migration is simply done by the next cpu to service this | 947 | /* Migration is simply done by the next cpu to service this |
1132 | * interrupt. | 948 | * interrupt. |
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c index bdac631cf011..bbf11f85dab1 100644 --- a/arch/sparc64/kernel/kprobes.c +++ b/arch/sparc64/kernel/kprobes.c | |||
@@ -433,3 +433,8 @@ int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) | |||
433 | return 0; | 433 | return 0; |
434 | } | 434 | } |
435 | 435 | ||
436 | /* architecture specific initialization */ | ||
437 | int arch_init_kprobes(void) | ||
438 | { | ||
439 | return 0; | ||
440 | } | ||
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c index 534320ef0db2..91ab466d6c66 100644 --- a/arch/sparc64/kernel/pci_psycho.c +++ b/arch/sparc64/kernel/pci_psycho.c | |||
@@ -1303,8 +1303,7 @@ static void psycho_controller_hwinit(struct pci_controller_info *p) | |||
1303 | { | 1303 | { |
1304 | u64 tmp; | 1304 | u64 tmp; |
1305 | 1305 | ||
1306 | /* PROM sets the IRQ retry value too low, increase it. */ | 1306 | psycho_write(p->pbm_A.controller_regs + PSYCHO_IRQ_RETRY, 5); |
1307 | psycho_write(p->pbm_A.controller_regs + PSYCHO_IRQ_RETRY, 0xff); | ||
1308 | 1307 | ||
1309 | /* Enable arbiter for all PCI slots. */ | 1308 | /* Enable arbiter for all PCI slots. */ |
1310 | tmp = psycho_read(p->pbm_A.controller_regs + PSYCHO_PCIA_CTRL); | 1309 | tmp = psycho_read(p->pbm_A.controller_regs + PSYCHO_PCIA_CTRL); |
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c index 53d333b4a4e8..52bf3431a422 100644 --- a/arch/sparc64/kernel/pci_sabre.c +++ b/arch/sparc64/kernel/pci_sabre.c | |||
@@ -595,6 +595,23 @@ static int __init sabre_ino_to_pil(struct pci_dev *pdev, unsigned int ino) | |||
595 | return ret; | 595 | return ret; |
596 | } | 596 | } |
597 | 597 | ||
598 | /* When a device lives behind a bridge deeper in the PCI bus topology | ||
599 | * than APB, a special sequence must run to make sure all pending DMA | ||
600 | * transfers at the time of IRQ delivery are visible in the coherency | ||
601 | * domain by the cpu. This sequence is to perform a read on the far | ||
602 | * side of the non-APB bridge, then perform a read of Sabre's DMA | ||
603 | * write-sync register. | ||
604 | */ | ||
605 | static void sabre_wsync_handler(struct ino_bucket *bucket, void *_arg1, void *_arg2) | ||
606 | { | ||
607 | struct pci_dev *pdev = _arg1; | ||
608 | unsigned long sync_reg = (unsigned long) _arg2; | ||
609 | u16 _unused; | ||
610 | |||
611 | pci_read_config_word(pdev, PCI_VENDOR_ID, &_unused); | ||
612 | sabre_read(sync_reg); | ||
613 | } | ||
614 | |||
598 | static unsigned int __init sabre_irq_build(struct pci_pbm_info *pbm, | 615 | static unsigned int __init sabre_irq_build(struct pci_pbm_info *pbm, |
599 | struct pci_dev *pdev, | 616 | struct pci_dev *pdev, |
600 | unsigned int ino) | 617 | unsigned int ino) |
@@ -639,24 +656,14 @@ static unsigned int __init sabre_irq_build(struct pci_pbm_info *pbm, | |||
639 | if (pdev) { | 656 | if (pdev) { |
640 | struct pcidev_cookie *pcp = pdev->sysdata; | 657 | struct pcidev_cookie *pcp = pdev->sysdata; |
641 | 658 | ||
642 | /* When a device lives behind a bridge deeper in the | ||
643 | * PCI bus topology than APB, a special sequence must | ||
644 | * run to make sure all pending DMA transfers at the | ||
645 | * time of IRQ delivery are visible in the coherency | ||
646 | * domain by the cpu. This sequence is to perform | ||
647 | * a read on the far side of the non-APB bridge, then | ||
648 | * perform a read of Sabre's DMA write-sync register. | ||
649 | * | ||
650 | * Currently, the PCI_CONFIG register for the device | ||
651 | * is used for this read from the far side of the bridge. | ||
652 | */ | ||
653 | if (pdev->bus->number != pcp->pbm->pci_first_busno) { | 659 | if (pdev->bus->number != pcp->pbm->pci_first_busno) { |
654 | bucket->flags |= IBF_DMA_SYNC; | 660 | struct pci_controller_info *p = pcp->pbm->parent; |
655 | bucket->synctab_ent = dma_sync_reg_table_entry++; | 661 | struct irq_desc *d = bucket->irq_info; |
656 | dma_sync_reg_table[bucket->synctab_ent] = | 662 | |
657 | (unsigned long) sabre_pci_config_mkaddr( | 663 | d->pre_handler = sabre_wsync_handler; |
658 | pcp->pbm, | 664 | d->pre_handler_arg1 = pdev; |
659 | pdev->bus->number, pdev->devfn, PCI_COMMAND); | 665 | d->pre_handler_arg2 = (void *) |
666 | p->pbm_A.controller_regs + SABRE_WRSYNC; | ||
660 | } | 667 | } |
661 | } | 668 | } |
662 | return __irq(bucket); | 669 | return __irq(bucket); |
@@ -1626,10 +1633,9 @@ void __init sabre_init(int pnode, char *model_name) | |||
1626 | */ | 1633 | */ |
1627 | p->pbm_A.controller_regs = pr_regs[0].phys_addr; | 1634 | p->pbm_A.controller_regs = pr_regs[0].phys_addr; |
1628 | p->pbm_B.controller_regs = pr_regs[0].phys_addr; | 1635 | p->pbm_B.controller_regs = pr_regs[0].phys_addr; |
1629 | pci_dma_wsync = p->pbm_A.controller_regs + SABRE_WRSYNC; | ||
1630 | 1636 | ||
1631 | printk("PCI: Found SABRE, main regs at %016lx, wsync at %016lx\n", | 1637 | printk("PCI: Found SABRE, main regs at %016lx\n", |
1632 | p->pbm_A.controller_regs, pci_dma_wsync); | 1638 | p->pbm_A.controller_regs); |
1633 | 1639 | ||
1634 | /* Clear interrupts */ | 1640 | /* Clear interrupts */ |
1635 | 1641 | ||
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c index 5753175b94e6..6a182bb66281 100644 --- a/arch/sparc64/kernel/pci_schizo.c +++ b/arch/sparc64/kernel/pci_schizo.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <asm/iommu.h> | 15 | #include <asm/iommu.h> |
16 | #include <asm/irq.h> | 16 | #include <asm/irq.h> |
17 | #include <asm/upa.h> | 17 | #include <asm/upa.h> |
18 | #include <asm/pstate.h> | ||
18 | 19 | ||
19 | #include "pci_impl.h" | 20 | #include "pci_impl.h" |
20 | #include "iommu_common.h" | 21 | #include "iommu_common.h" |
@@ -326,6 +327,44 @@ static int __init schizo_ino_to_pil(struct pci_dev *pdev, unsigned int ino) | |||
326 | return ret; | 327 | return ret; |
327 | } | 328 | } |
328 | 329 | ||
330 | static void tomatillo_wsync_handler(struct ino_bucket *bucket, void *_arg1, void *_arg2) | ||
331 | { | ||
332 | unsigned long sync_reg = (unsigned long) _arg2; | ||
333 | u64 mask = 1 << (__irq_ino(__irq(bucket)) & IMAP_INO); | ||
334 | u64 val; | ||
335 | int limit; | ||
336 | |||
337 | schizo_write(sync_reg, mask); | ||
338 | |||
339 | limit = 100000; | ||
340 | val = 0; | ||
341 | while (--limit) { | ||
342 | val = schizo_read(sync_reg); | ||
343 | if (!(val & mask)) | ||
344 | break; | ||
345 | } | ||
346 | if (limit <= 0) { | ||
347 | printk("tomatillo_wsync_handler: DMA won't sync [%lx:%lx]\n", | ||
348 | val, mask); | ||
349 | } | ||
350 | |||
351 | if (_arg1) { | ||
352 | static unsigned char cacheline[64] | ||
353 | __attribute__ ((aligned (64))); | ||
354 | |||
355 | __asm__ __volatile__("rd %%fprs, %0\n\t" | ||
356 | "or %0, %4, %1\n\t" | ||
357 | "wr %1, 0x0, %%fprs\n\t" | ||
358 | "stda %%f0, [%5] %6\n\t" | ||
359 | "wr %0, 0x0, %%fprs\n\t" | ||
360 | "membar #Sync" | ||
361 | : "=&r" (mask), "=&r" (val) | ||
362 | : "0" (mask), "1" (val), | ||
363 | "i" (FPRS_FEF), "r" (&cacheline[0]), | ||
364 | "i" (ASI_BLK_COMMIT_P)); | ||
365 | } | ||
366 | } | ||
367 | |||
329 | static unsigned int schizo_irq_build(struct pci_pbm_info *pbm, | 368 | static unsigned int schizo_irq_build(struct pci_pbm_info *pbm, |
330 | struct pci_dev *pdev, | 369 | struct pci_dev *pdev, |
331 | unsigned int ino) | 370 | unsigned int ino) |
@@ -369,6 +408,15 @@ static unsigned int schizo_irq_build(struct pci_pbm_info *pbm, | |||
369 | bucket = __bucket(build_irq(pil, ign_fixup, iclr, imap)); | 408 | bucket = __bucket(build_irq(pil, ign_fixup, iclr, imap)); |
370 | bucket->flags |= IBF_PCI; | 409 | bucket->flags |= IBF_PCI; |
371 | 410 | ||
411 | if (pdev && pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO) { | ||
412 | struct irq_desc *p = bucket->irq_info; | ||
413 | |||
414 | p->pre_handler = tomatillo_wsync_handler; | ||
415 | p->pre_handler_arg1 = ((pbm->chip_version <= 4) ? | ||
416 | (void *) 1 : (void *) 0); | ||
417 | p->pre_handler_arg2 = (void *) pbm->sync_reg; | ||
418 | } | ||
419 | |||
372 | return __irq(bucket); | 420 | return __irq(bucket); |
373 | } | 421 | } |
374 | 422 | ||
@@ -885,6 +933,7 @@ static irqreturn_t schizo_ce_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
885 | 933 | ||
886 | #define SCHIZO_PCI_CTRL (0x2000UL) | 934 | #define SCHIZO_PCI_CTRL (0x2000UL) |
887 | #define SCHIZO_PCICTRL_BUS_UNUS (1UL << 63UL) /* Safari */ | 935 | #define SCHIZO_PCICTRL_BUS_UNUS (1UL << 63UL) /* Safari */ |
936 | #define SCHIZO_PCICTRL_DTO_INT (1UL << 61UL) /* Tomatillo */ | ||
888 | #define SCHIZO_PCICTRL_ARB_PRIO (0x1ff << 52UL) /* Tomatillo */ | 937 | #define SCHIZO_PCICTRL_ARB_PRIO (0x1ff << 52UL) /* Tomatillo */ |
889 | #define SCHIZO_PCICTRL_ESLCK (1UL << 51UL) /* Safari */ | 938 | #define SCHIZO_PCICTRL_ESLCK (1UL << 51UL) /* Safari */ |
890 | #define SCHIZO_PCICTRL_ERRSLOT (7UL << 48UL) /* Safari */ | 939 | #define SCHIZO_PCICTRL_ERRSLOT (7UL << 48UL) /* Safari */ |
@@ -1887,37 +1936,27 @@ static void __init schizo_pbm_hw_init(struct pci_pbm_info *pbm) | |||
1887 | { | 1936 | { |
1888 | u64 tmp; | 1937 | u64 tmp; |
1889 | 1938 | ||
1890 | /* Set IRQ retry to infinity. */ | 1939 | schizo_write(pbm->pbm_regs + SCHIZO_PCI_IRQ_RETRY, 5); |
1891 | schizo_write(pbm->pbm_regs + SCHIZO_PCI_IRQ_RETRY, | ||
1892 | SCHIZO_IRQ_RETRY_INF); | ||
1893 | 1940 | ||
1894 | /* Enable arbiter for all PCI slots. Also, disable PCI interval | ||
1895 | * timer so that DTO (Discard TimeOuts) are not reported because | ||
1896 | * some Schizo revisions report them erroneously. | ||
1897 | */ | ||
1898 | tmp = schizo_read(pbm->pbm_regs + SCHIZO_PCI_CTRL); | 1941 | tmp = schizo_read(pbm->pbm_regs + SCHIZO_PCI_CTRL); |
1899 | if (pbm->chip_type == PBM_CHIP_TYPE_SCHIZO_PLUS && | ||
1900 | pbm->chip_version == 0x5 && | ||
1901 | pbm->chip_revision == 0x1) | ||
1902 | tmp |= 0x0f; | ||
1903 | else | ||
1904 | tmp |= 0xff; | ||
1905 | 1942 | ||
1906 | tmp &= ~SCHIZO_PCICTRL_PTO; | 1943 | /* Enable arbiter for all PCI slots. */ |
1944 | tmp |= 0xff; | ||
1945 | |||
1907 | if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO && | 1946 | if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO && |
1908 | pbm->chip_version >= 0x2) | 1947 | pbm->chip_version >= 0x2) |
1909 | tmp |= 0x3UL << SCHIZO_PCICTRL_PTO_SHIFT; | 1948 | tmp |= 0x3UL << SCHIZO_PCICTRL_PTO_SHIFT; |
1910 | else | ||
1911 | tmp |= 0x1UL << SCHIZO_PCICTRL_PTO_SHIFT; | ||
1912 | 1949 | ||
1913 | if (!prom_getbool(pbm->prom_node, "no-bus-parking")) | 1950 | if (!prom_getbool(pbm->prom_node, "no-bus-parking")) |
1914 | tmp |= SCHIZO_PCICTRL_PARK; | 1951 | tmp |= SCHIZO_PCICTRL_PARK; |
1952 | else | ||
1953 | tmp &= ~SCHIZO_PCICTRL_PARK; | ||
1915 | 1954 | ||
1916 | if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO && | 1955 | if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO && |
1917 | pbm->chip_version <= 0x1) | 1956 | pbm->chip_version <= 0x1) |
1918 | tmp |= (1UL << 61); | 1957 | tmp |= SCHIZO_PCICTRL_DTO_INT; |
1919 | else | 1958 | else |
1920 | tmp &= ~(1UL << 61); | 1959 | tmp &= ~SCHIZO_PCICTRL_DTO_INT; |
1921 | 1960 | ||
1922 | if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO) | 1961 | if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO) |
1923 | tmp |= (SCHIZO_PCICTRL_MRM_PREF | | 1962 | tmp |= (SCHIZO_PCICTRL_MRM_PREF | |
@@ -2015,6 +2054,9 @@ static void __init schizo_pbm_init(struct pci_controller_info *p, | |||
2015 | pbm->pbm_regs = pr_regs[0].phys_addr; | 2054 | pbm->pbm_regs = pr_regs[0].phys_addr; |
2016 | pbm->controller_regs = pr_regs[1].phys_addr - 0x10000UL; | 2055 | pbm->controller_regs = pr_regs[1].phys_addr - 0x10000UL; |
2017 | 2056 | ||
2057 | if (chip_type == PBM_CHIP_TYPE_TOMATILLO) | ||
2058 | pbm->sync_reg = pr_regs[3].phys_addr + 0x1a18UL; | ||
2059 | |||
2018 | sprintf(pbm->name, | 2060 | sprintf(pbm->name, |
2019 | (chip_type == PBM_CHIP_TYPE_TOMATILLO ? | 2061 | (chip_type == PBM_CHIP_TYPE_TOMATILLO ? |
2020 | "TOMATILLO%d PBM%c" : | 2062 | "TOMATILLO%d PBM%c" : |
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c index 71b4e3807694..b40db389f90b 100644 --- a/arch/sparc64/kernel/time.c +++ b/arch/sparc64/kernel/time.c | |||
@@ -973,7 +973,7 @@ static void sparc64_start_timers(irqreturn_t (*cfunc)(int, void *, struct pt_reg | |||
973 | int err; | 973 | int err; |
974 | 974 | ||
975 | /* Register IRQ handler. */ | 975 | /* Register IRQ handler. */ |
976 | err = request_irq(build_irq(0, 0, 0UL, 0UL), cfunc, SA_STATIC_ALLOC, | 976 | err = request_irq(build_irq(0, 0, 0UL, 0UL), cfunc, 0, |
977 | "timer", NULL); | 977 | "timer", NULL); |
978 | 978 | ||
979 | if (err) { | 979 | if (err) { |
diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S index 7a2431d3abc7..363770893797 100644 --- a/arch/sparc64/mm/ultra.S +++ b/arch/sparc64/mm/ultra.S | |||
@@ -72,6 +72,7 @@ __flush_tlb_pending: | |||
72 | flush %g6 | 72 | flush %g6 |
73 | retl | 73 | retl |
74 | wrpr %g7, 0x0, %pstate | 74 | wrpr %g7, 0x0, %pstate |
75 | nop | ||
75 | 76 | ||
76 | .align 32 | 77 | .align 32 |
77 | .globl __flush_tlb_kernel_range | 78 | .globl __flush_tlb_kernel_range |
@@ -249,7 +250,7 @@ __cheetah_flush_tlb_mm: /* 15 insns */ | |||
249 | retl | 250 | retl |
250 | wrpr %g7, 0x0, %pstate | 251 | wrpr %g7, 0x0, %pstate |
251 | 252 | ||
252 | __cheetah_flush_tlb_pending: /* 22 insns */ | 253 | __cheetah_flush_tlb_pending: /* 23 insns */ |
253 | /* %o0 = context, %o1 = nr, %o2 = vaddrs[] */ | 254 | /* %o0 = context, %o1 = nr, %o2 = vaddrs[] */ |
254 | rdpr %pstate, %g7 | 255 | rdpr %pstate, %g7 |
255 | sllx %o1, 3, %o1 | 256 | sllx %o1, 3, %o1 |
@@ -317,7 +318,7 @@ cheetah_patch_cachetlbops: | |||
317 | sethi %hi(__cheetah_flush_tlb_pending), %o1 | 318 | sethi %hi(__cheetah_flush_tlb_pending), %o1 |
318 | or %o1, %lo(__cheetah_flush_tlb_pending), %o1 | 319 | or %o1, %lo(__cheetah_flush_tlb_pending), %o1 |
319 | call cheetah_patch_one | 320 | call cheetah_patch_one |
320 | mov 22, %o2 | 321 | mov 23, %o2 |
321 | 322 | ||
322 | #ifdef DCACHE_ALIASING_POSSIBLE | 323 | #ifdef DCACHE_ALIASING_POSSIBLE |
323 | sethi %hi(__flush_dcache_page), %o0 | 324 | sethi %hi(__flush_dcache_page), %o0 |
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile index 8a73794f9b90..428915697675 100644 --- a/arch/x86_64/Makefile +++ b/arch/x86_64/Makefile | |||
@@ -65,7 +65,9 @@ CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) | |||
65 | head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o | 65 | head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o |
66 | 66 | ||
67 | libs-y += arch/x86_64/lib/ | 67 | libs-y += arch/x86_64/lib/ |
68 | core-y += arch/x86_64/kernel/ arch/x86_64/mm/ | 68 | core-y += arch/x86_64/kernel/ \ |
69 | arch/x86_64/mm/ \ | ||
70 | arch/x86_64/crypto/ | ||
69 | core-$(CONFIG_IA32_EMULATION) += arch/x86_64/ia32/ | 71 | core-$(CONFIG_IA32_EMULATION) += arch/x86_64/ia32/ |
70 | drivers-$(CONFIG_PCI) += arch/x86_64/pci/ | 72 | drivers-$(CONFIG_PCI) += arch/x86_64/pci/ |
71 | drivers-$(CONFIG_OPROFILE) += arch/x86_64/oprofile/ | 73 | drivers-$(CONFIG_OPROFILE) += arch/x86_64/oprofile/ |
diff --git a/arch/x86_64/crypto/Makefile b/arch/x86_64/crypto/Makefile new file mode 100644 index 000000000000..426d20f4b72e --- /dev/null +++ b/arch/x86_64/crypto/Makefile | |||
@@ -0,0 +1,9 @@ | |||
1 | # | ||
2 | # x86_64/crypto/Makefile | ||
3 | # | ||
4 | # Arch-specific CryptoAPI modules. | ||
5 | # | ||
6 | |||
7 | obj-$(CONFIG_CRYPTO_AES_X86_64) += aes-x86_64.o | ||
8 | |||
9 | aes-x86_64-y := aes-x86_64-asm.o aes.o | ||
diff --git a/arch/x86_64/crypto/aes-x86_64-asm.S b/arch/x86_64/crypto/aes-x86_64-asm.S new file mode 100644 index 000000000000..483cbb23ab8d --- /dev/null +++ b/arch/x86_64/crypto/aes-x86_64-asm.S | |||
@@ -0,0 +1,186 @@ | |||
1 | /* AES (Rijndael) implementation (FIPS PUB 197) for x86_64 | ||
2 | * | ||
3 | * Copyright (C) 2005 Andreas Steinmetz, <ast@domdv.de> | ||
4 | * | ||
5 | * License: | ||
6 | * This code can be distributed under the terms of the GNU General Public | ||
7 | * License (GPL) Version 2 provided that the above header down to and | ||
8 | * including this sentence is retained in full. | ||
9 | */ | ||
10 | |||
11 | .extern aes_ft_tab | ||
12 | .extern aes_it_tab | ||
13 | .extern aes_fl_tab | ||
14 | .extern aes_il_tab | ||
15 | |||
16 | .text | ||
17 | |||
18 | #define R1 %rax | ||
19 | #define R1E %eax | ||
20 | #define R1X %ax | ||
21 | #define R1H %ah | ||
22 | #define R1L %al | ||
23 | #define R2 %rbx | ||
24 | #define R2E %ebx | ||
25 | #define R2X %bx | ||
26 | #define R2H %bh | ||
27 | #define R2L %bl | ||
28 | #define R3 %rcx | ||
29 | #define R3E %ecx | ||
30 | #define R3X %cx | ||
31 | #define R3H %ch | ||
32 | #define R3L %cl | ||
33 | #define R4 %rdx | ||
34 | #define R4E %edx | ||
35 | #define R4X %dx | ||
36 | #define R4H %dh | ||
37 | #define R4L %dl | ||
38 | #define R5 %rsi | ||
39 | #define R5E %esi | ||
40 | #define R6 %rdi | ||
41 | #define R6E %edi | ||
42 | #define R7 %rbp | ||
43 | #define R7E %ebp | ||
44 | #define R8 %r8 | ||
45 | #define R9 %r9 | ||
46 | #define R10 %r10 | ||
47 | #define R11 %r11 | ||
48 | |||
49 | #define prologue(FUNC,BASE,B128,B192,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11) \ | ||
50 | .global FUNC; \ | ||
51 | .type FUNC,@function; \ | ||
52 | .align 8; \ | ||
53 | FUNC: movq r1,r2; \ | ||
54 | movq r3,r4; \ | ||
55 | leaq BASE+52(r8),r9; \ | ||
56 | movq r10,r11; \ | ||
57 | movl (r7),r5 ## E; \ | ||
58 | movl 4(r7),r1 ## E; \ | ||
59 | movl 8(r7),r6 ## E; \ | ||
60 | movl 12(r7),r7 ## E; \ | ||
61 | movl (r8),r10 ## E; \ | ||
62 | xorl -48(r9),r5 ## E; \ | ||
63 | xorl -44(r9),r1 ## E; \ | ||
64 | xorl -40(r9),r6 ## E; \ | ||
65 | xorl -36(r9),r7 ## E; \ | ||
66 | cmpl $24,r10 ## E; \ | ||
67 | jb B128; \ | ||
68 | leaq 32(r9),r9; \ | ||
69 | je B192; \ | ||
70 | leaq 32(r9),r9; | ||
71 | |||
72 | #define epilogue(r1,r2,r3,r4,r5,r6,r7,r8,r9) \ | ||
73 | movq r1,r2; \ | ||
74 | movq r3,r4; \ | ||
75 | movl r5 ## E,(r9); \ | ||
76 | movl r6 ## E,4(r9); \ | ||
77 | movl r7 ## E,8(r9); \ | ||
78 | movl r8 ## E,12(r9); \ | ||
79 | ret; | ||
80 | |||
81 | #define round(TAB,OFFSET,r1,r2,r3,r4,r5,r6,r7,r8,ra,rb,rc,rd) \ | ||
82 | movzbl r2 ## H,r5 ## E; \ | ||
83 | movzbl r2 ## L,r6 ## E; \ | ||
84 | movl TAB+1024(,r5,4),r5 ## E;\ | ||
85 | movw r4 ## X,r2 ## X; \ | ||
86 | movl TAB(,r6,4),r6 ## E; \ | ||
87 | roll $16,r2 ## E; \ | ||
88 | shrl $16,r4 ## E; \ | ||
89 | movzbl r4 ## H,r7 ## E; \ | ||
90 | movzbl r4 ## L,r4 ## E; \ | ||
91 | xorl OFFSET(r8),ra ## E; \ | ||
92 | xorl OFFSET+4(r8),rb ## E; \ | ||
93 | xorl TAB+3072(,r7,4),r5 ## E;\ | ||
94 | xorl TAB+2048(,r4,4),r6 ## E;\ | ||
95 | movzbl r1 ## L,r7 ## E; \ | ||
96 | movzbl r1 ## H,r4 ## E; \ | ||
97 | movl TAB+1024(,r4,4),r4 ## E;\ | ||
98 | movw r3 ## X,r1 ## X; \ | ||
99 | roll $16,r1 ## E; \ | ||
100 | shrl $16,r3 ## E; \ | ||
101 | xorl TAB(,r7,4),r5 ## E; \ | ||
102 | movzbl r3 ## H,r7 ## E; \ | ||
103 | movzbl r3 ## L,r3 ## E; \ | ||
104 | xorl TAB+3072(,r7,4),r4 ## E;\ | ||
105 | xorl TAB+2048(,r3,4),r5 ## E;\ | ||
106 | movzbl r1 ## H,r7 ## E; \ | ||
107 | movzbl r1 ## L,r3 ## E; \ | ||
108 | shrl $16,r1 ## E; \ | ||
109 | xorl TAB+3072(,r7,4),r6 ## E;\ | ||
110 | movl TAB+2048(,r3,4),r3 ## E;\ | ||
111 | movzbl r1 ## H,r7 ## E; \ | ||
112 | movzbl r1 ## L,r1 ## E; \ | ||
113 | xorl TAB+1024(,r7,4),r6 ## E;\ | ||
114 | xorl TAB(,r1,4),r3 ## E; \ | ||
115 | movzbl r2 ## H,r1 ## E; \ | ||
116 | movzbl r2 ## L,r7 ## E; \ | ||
117 | shrl $16,r2 ## E; \ | ||
118 | xorl TAB+3072(,r1,4),r3 ## E;\ | ||
119 | xorl TAB+2048(,r7,4),r4 ## E;\ | ||
120 | movzbl r2 ## H,r1 ## E; \ | ||
121 | movzbl r2 ## L,r2 ## E; \ | ||
122 | xorl OFFSET+8(r8),rc ## E; \ | ||
123 | xorl OFFSET+12(r8),rd ## E; \ | ||
124 | xorl TAB+1024(,r1,4),r3 ## E;\ | ||
125 | xorl TAB(,r2,4),r4 ## E; | ||
126 | |||
127 | #define move_regs(r1,r2,r3,r4) \ | ||
128 | movl r3 ## E,r1 ## E; \ | ||
129 | movl r4 ## E,r2 ## E; | ||
130 | |||
131 | #define entry(FUNC,BASE,B128,B192) \ | ||
132 | prologue(FUNC,BASE,B128,B192,R2,R8,R7,R9,R1,R3,R4,R6,R10,R5,R11) | ||
133 | |||
134 | #define return epilogue(R8,R2,R9,R7,R5,R6,R3,R4,R11) | ||
135 | |||
136 | #define encrypt_round(TAB,OFFSET) \ | ||
137 | round(TAB,OFFSET,R1,R2,R3,R4,R5,R6,R7,R10,R5,R6,R3,R4) \ | ||
138 | move_regs(R1,R2,R5,R6) | ||
139 | |||
140 | #define encrypt_final(TAB,OFFSET) \ | ||
141 | round(TAB,OFFSET,R1,R2,R3,R4,R5,R6,R7,R10,R5,R6,R3,R4) | ||
142 | |||
143 | #define decrypt_round(TAB,OFFSET) \ | ||
144 | round(TAB,OFFSET,R2,R1,R4,R3,R6,R5,R7,R10,R5,R6,R3,R4) \ | ||
145 | move_regs(R1,R2,R5,R6) | ||
146 | |||
147 | #define decrypt_final(TAB,OFFSET) \ | ||
148 | round(TAB,OFFSET,R2,R1,R4,R3,R6,R5,R7,R10,R5,R6,R3,R4) | ||
149 | |||
150 | /* void aes_encrypt(void *ctx, u8 *out, const u8 *in) */ | ||
151 | |||
152 | entry(aes_encrypt,0,enc128,enc192) | ||
153 | encrypt_round(aes_ft_tab,-96) | ||
154 | encrypt_round(aes_ft_tab,-80) | ||
155 | enc192: encrypt_round(aes_ft_tab,-64) | ||
156 | encrypt_round(aes_ft_tab,-48) | ||
157 | enc128: encrypt_round(aes_ft_tab,-32) | ||
158 | encrypt_round(aes_ft_tab,-16) | ||
159 | encrypt_round(aes_ft_tab, 0) | ||
160 | encrypt_round(aes_ft_tab, 16) | ||
161 | encrypt_round(aes_ft_tab, 32) | ||
162 | encrypt_round(aes_ft_tab, 48) | ||
163 | encrypt_round(aes_ft_tab, 64) | ||
164 | encrypt_round(aes_ft_tab, 80) | ||
165 | encrypt_round(aes_ft_tab, 96) | ||
166 | encrypt_final(aes_fl_tab,112) | ||
167 | return | ||
168 | |||
169 | /* void aes_decrypt(void *ctx, u8 *out, const u8 *in) */ | ||
170 | |||
171 | entry(aes_decrypt,240,dec128,dec192) | ||
172 | decrypt_round(aes_it_tab,-96) | ||
173 | decrypt_round(aes_it_tab,-80) | ||
174 | dec192: decrypt_round(aes_it_tab,-64) | ||
175 | decrypt_round(aes_it_tab,-48) | ||
176 | dec128: decrypt_round(aes_it_tab,-32) | ||
177 | decrypt_round(aes_it_tab,-16) | ||
178 | decrypt_round(aes_it_tab, 0) | ||
179 | decrypt_round(aes_it_tab, 16) | ||
180 | decrypt_round(aes_it_tab, 32) | ||
181 | decrypt_round(aes_it_tab, 48) | ||
182 | decrypt_round(aes_it_tab, 64) | ||
183 | decrypt_round(aes_it_tab, 80) | ||
184 | decrypt_round(aes_it_tab, 96) | ||
185 | decrypt_final(aes_il_tab,112) | ||
186 | return | ||
diff --git a/arch/x86_64/crypto/aes.c b/arch/x86_64/crypto/aes.c new file mode 100644 index 000000000000..2b5c4010ce38 --- /dev/null +++ b/arch/x86_64/crypto/aes.c | |||
@@ -0,0 +1,324 @@ | |||
1 | /* | ||
2 | * Cryptographic API. | ||
3 | * | ||
4 | * AES Cipher Algorithm. | ||
5 | * | ||
6 | * Based on Brian Gladman's code. | ||
7 | * | ||
8 | * Linux developers: | ||
9 | * Alexander Kjeldaas <astor@fast.no> | ||
10 | * Herbert Valerio Riedel <hvr@hvrlab.org> | ||
11 | * Kyle McMartin <kyle@debian.org> | ||
12 | * Adam J. Richter <adam@yggdrasil.com> (conversion to 2.5 API). | ||
13 | * Andreas Steinmetz <ast@domdv.de> (adapted to x86_64 assembler) | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License as published by | ||
17 | * the Free Software Foundation; either version 2 of the License, or | ||
18 | * (at your option) any later version. | ||
19 | * | ||
20 | * --------------------------------------------------------------------------- | ||
21 | * Copyright (c) 2002, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK. | ||
22 | * All rights reserved. | ||
23 | * | ||
24 | * LICENSE TERMS | ||
25 | * | ||
26 | * The free distribution and use of this software in both source and binary | ||
27 | * form is allowed (with or without changes) provided that: | ||
28 | * | ||
29 | * 1. distributions of this source code include the above copyright | ||
30 | * notice, this list of conditions and the following disclaimer; | ||
31 | * | ||
32 | * 2. distributions in binary form include the above copyright | ||
33 | * notice, this list of conditions and the following disclaimer | ||
34 | * in the documentation and/or other associated materials; | ||
35 | * | ||
36 | * 3. the copyright holder's name is not used to endorse products | ||
37 | * built using this software without specific written permission. | ||
38 | * | ||
39 | * ALTERNATIVELY, provided that this notice is retained in full, this product | ||
40 | * may be distributed under the terms of the GNU General Public License (GPL), | ||
41 | * in which case the provisions of the GPL apply INSTEAD OF those given above. | ||
42 | * | ||
43 | * DISCLAIMER | ||
44 | * | ||
45 | * This software is provided 'as is' with no explicit or implied warranties | ||
46 | * in respect of its properties, including, but not limited to, correctness | ||
47 | * and/or fitness for purpose. | ||
48 | * --------------------------------------------------------------------------- | ||
49 | */ | ||
50 | |||
51 | /* Some changes from the Gladman version: | ||
52 | s/RIJNDAEL(e_key)/E_KEY/g | ||
53 | s/RIJNDAEL(d_key)/D_KEY/g | ||
54 | */ | ||
55 | |||
56 | #include <asm/byteorder.h> | ||
57 | #include <linux/bitops.h> | ||
58 | #include <linux/crypto.h> | ||
59 | #include <linux/errno.h> | ||
60 | #include <linux/init.h> | ||
61 | #include <linux/module.h> | ||
62 | #include <linux/types.h> | ||
63 | |||
64 | #define AES_MIN_KEY_SIZE 16 | ||
65 | #define AES_MAX_KEY_SIZE 32 | ||
66 | |||
67 | #define AES_BLOCK_SIZE 16 | ||
68 | |||
69 | /* | ||
70 | * #define byte(x, nr) ((unsigned char)((x) >> (nr*8))) | ||
71 | */ | ||
72 | static inline u8 byte(const u32 x, const unsigned n) | ||
73 | { | ||
74 | return x >> (n << 3); | ||
75 | } | ||
76 | |||
77 | #define u32_in(x) le32_to_cpu(*(const __le32 *)(x)) | ||
78 | |||
79 | struct aes_ctx | ||
80 | { | ||
81 | u32 key_length; | ||
82 | u32 E[60]; | ||
83 | u32 D[60]; | ||
84 | }; | ||
85 | |||
86 | #define E_KEY ctx->E | ||
87 | #define D_KEY ctx->D | ||
88 | |||
89 | static u8 pow_tab[256] __initdata; | ||
90 | static u8 log_tab[256] __initdata; | ||
91 | static u8 sbx_tab[256] __initdata; | ||
92 | static u8 isb_tab[256] __initdata; | ||
93 | static u32 rco_tab[10]; | ||
94 | u32 aes_ft_tab[4][256]; | ||
95 | u32 aes_it_tab[4][256]; | ||
96 | |||
97 | u32 aes_fl_tab[4][256]; | ||
98 | u32 aes_il_tab[4][256]; | ||
99 | |||
100 | static inline u8 f_mult(u8 a, u8 b) | ||
101 | { | ||
102 | u8 aa = log_tab[a], cc = aa + log_tab[b]; | ||
103 | |||
104 | return pow_tab[cc + (cc < aa ? 1 : 0)]; | ||
105 | } | ||
106 | |||
107 | #define ff_mult(a, b) (a && b ? f_mult(a, b) : 0) | ||
108 | |||
109 | #define ls_box(x) \ | ||
110 | (aes_fl_tab[0][byte(x, 0)] ^ \ | ||
111 | aes_fl_tab[1][byte(x, 1)] ^ \ | ||
112 | aes_fl_tab[2][byte(x, 2)] ^ \ | ||
113 | aes_fl_tab[3][byte(x, 3)]) | ||
114 | |||
115 | static void __init gen_tabs(void) | ||
116 | { | ||
117 | u32 i, t; | ||
118 | u8 p, q; | ||
119 | |||
120 | /* log and power tables for GF(2**8) finite field with | ||
121 | 0x011b as modular polynomial - the simplest primitive | ||
122 | root is 0x03, used here to generate the tables */ | ||
123 | |||
124 | for (i = 0, p = 1; i < 256; ++i) { | ||
125 | pow_tab[i] = (u8)p; | ||
126 | log_tab[p] = (u8)i; | ||
127 | |||
128 | p ^= (p << 1) ^ (p & 0x80 ? 0x01b : 0); | ||
129 | } | ||
130 | |||
131 | log_tab[1] = 0; | ||
132 | |||
133 | for (i = 0, p = 1; i < 10; ++i) { | ||
134 | rco_tab[i] = p; | ||
135 | |||
136 | p = (p << 1) ^ (p & 0x80 ? 0x01b : 0); | ||
137 | } | ||
138 | |||
139 | for (i = 0; i < 256; ++i) { | ||
140 | p = (i ? pow_tab[255 - log_tab[i]] : 0); | ||
141 | q = ((p >> 7) | (p << 1)) ^ ((p >> 6) | (p << 2)); | ||
142 | p ^= 0x63 ^ q ^ ((q >> 6) | (q << 2)); | ||
143 | sbx_tab[i] = p; | ||
144 | isb_tab[p] = (u8)i; | ||
145 | } | ||
146 | |||
147 | for (i = 0; i < 256; ++i) { | ||
148 | p = sbx_tab[i]; | ||
149 | |||
150 | t = p; | ||
151 | aes_fl_tab[0][i] = t; | ||
152 | aes_fl_tab[1][i] = rol32(t, 8); | ||
153 | aes_fl_tab[2][i] = rol32(t, 16); | ||
154 | aes_fl_tab[3][i] = rol32(t, 24); | ||
155 | |||
156 | t = ((u32)ff_mult(2, p)) | | ||
157 | ((u32)p << 8) | | ||
158 | ((u32)p << 16) | ((u32)ff_mult(3, p) << 24); | ||
159 | |||
160 | aes_ft_tab[0][i] = t; | ||
161 | aes_ft_tab[1][i] = rol32(t, 8); | ||
162 | aes_ft_tab[2][i] = rol32(t, 16); | ||
163 | aes_ft_tab[3][i] = rol32(t, 24); | ||
164 | |||
165 | p = isb_tab[i]; | ||
166 | |||
167 | t = p; | ||
168 | aes_il_tab[0][i] = t; | ||
169 | aes_il_tab[1][i] = rol32(t, 8); | ||
170 | aes_il_tab[2][i] = rol32(t, 16); | ||
171 | aes_il_tab[3][i] = rol32(t, 24); | ||
172 | |||
173 | t = ((u32)ff_mult(14, p)) | | ||
174 | ((u32)ff_mult(9, p) << 8) | | ||
175 | ((u32)ff_mult(13, p) << 16) | | ||
176 | ((u32)ff_mult(11, p) << 24); | ||
177 | |||
178 | aes_it_tab[0][i] = t; | ||
179 | aes_it_tab[1][i] = rol32(t, 8); | ||
180 | aes_it_tab[2][i] = rol32(t, 16); | ||
181 | aes_it_tab[3][i] = rol32(t, 24); | ||
182 | } | ||
183 | } | ||
184 | |||
185 | #define star_x(x) (((x) & 0x7f7f7f7f) << 1) ^ ((((x) & 0x80808080) >> 7) * 0x1b) | ||
186 | |||
187 | #define imix_col(y, x) \ | ||
188 | u = star_x(x); \ | ||
189 | v = star_x(u); \ | ||
190 | w = star_x(v); \ | ||
191 | t = w ^ (x); \ | ||
192 | (y) = u ^ v ^ w; \ | ||
193 | (y) ^= ror32(u ^ t, 8) ^ \ | ||
194 | ror32(v ^ t, 16) ^ \ | ||
195 | ror32(t, 24) | ||
196 | |||
197 | /* initialise the key schedule from the user supplied key */ | ||
198 | |||
199 | #define loop4(i) \ | ||
200 | { \ | ||
201 | t = ror32(t, 8); t = ls_box(t) ^ rco_tab[i]; \ | ||
202 | t ^= E_KEY[4 * i]; E_KEY[4 * i + 4] = t; \ | ||
203 | t ^= E_KEY[4 * i + 1]; E_KEY[4 * i + 5] = t; \ | ||
204 | t ^= E_KEY[4 * i + 2]; E_KEY[4 * i + 6] = t; \ | ||
205 | t ^= E_KEY[4 * i + 3]; E_KEY[4 * i + 7] = t; \ | ||
206 | } | ||
207 | |||
208 | #define loop6(i) \ | ||
209 | { \ | ||
210 | t = ror32(t, 8); t = ls_box(t) ^ rco_tab[i]; \ | ||
211 | t ^= E_KEY[6 * i]; E_KEY[6 * i + 6] = t; \ | ||
212 | t ^= E_KEY[6 * i + 1]; E_KEY[6 * i + 7] = t; \ | ||
213 | t ^= E_KEY[6 * i + 2]; E_KEY[6 * i + 8] = t; \ | ||
214 | t ^= E_KEY[6 * i + 3]; E_KEY[6 * i + 9] = t; \ | ||
215 | t ^= E_KEY[6 * i + 4]; E_KEY[6 * i + 10] = t; \ | ||
216 | t ^= E_KEY[6 * i + 5]; E_KEY[6 * i + 11] = t; \ | ||
217 | } | ||
218 | |||
219 | #define loop8(i) \ | ||
220 | { \ | ||
221 | t = ror32(t, 8); ; t = ls_box(t) ^ rco_tab[i]; \ | ||
222 | t ^= E_KEY[8 * i]; E_KEY[8 * i + 8] = t; \ | ||
223 | t ^= E_KEY[8 * i + 1]; E_KEY[8 * i + 9] = t; \ | ||
224 | t ^= E_KEY[8 * i + 2]; E_KEY[8 * i + 10] = t; \ | ||
225 | t ^= E_KEY[8 * i + 3]; E_KEY[8 * i + 11] = t; \ | ||
226 | t = E_KEY[8 * i + 4] ^ ls_box(t); \ | ||
227 | E_KEY[8 * i + 12] = t; \ | ||
228 | t ^= E_KEY[8 * i + 5]; E_KEY[8 * i + 13] = t; \ | ||
229 | t ^= E_KEY[8 * i + 6]; E_KEY[8 * i + 14] = t; \ | ||
230 | t ^= E_KEY[8 * i + 7]; E_KEY[8 * i + 15] = t; \ | ||
231 | } | ||
232 | |||
233 | static int aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, | ||
234 | u32 *flags) | ||
235 | { | ||
236 | struct aes_ctx *ctx = ctx_arg; | ||
237 | u32 i, j, t, u, v, w; | ||
238 | |||
239 | if (key_len != 16 && key_len != 24 && key_len != 32) { | ||
240 | *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; | ||
241 | return -EINVAL; | ||
242 | } | ||
243 | |||
244 | ctx->key_length = key_len; | ||
245 | |||
246 | D_KEY[key_len + 24] = E_KEY[0] = u32_in(in_key); | ||
247 | D_KEY[key_len + 25] = E_KEY[1] = u32_in(in_key + 4); | ||
248 | D_KEY[key_len + 26] = E_KEY[2] = u32_in(in_key + 8); | ||
249 | D_KEY[key_len + 27] = E_KEY[3] = u32_in(in_key + 12); | ||
250 | |||
251 | switch (key_len) { | ||
252 | case 16: | ||
253 | t = E_KEY[3]; | ||
254 | for (i = 0; i < 10; ++i) | ||
255 | loop4(i); | ||
256 | break; | ||
257 | |||
258 | case 24: | ||
259 | E_KEY[4] = u32_in(in_key + 16); | ||
260 | t = E_KEY[5] = u32_in(in_key + 20); | ||
261 | for (i = 0; i < 8; ++i) | ||
262 | loop6 (i); | ||
263 | break; | ||
264 | |||
265 | case 32: | ||
266 | E_KEY[4] = u32_in(in_key + 16); | ||
267 | E_KEY[5] = u32_in(in_key + 20); | ||
268 | E_KEY[6] = u32_in(in_key + 24); | ||
269 | t = E_KEY[7] = u32_in(in_key + 28); | ||
270 | for (i = 0; i < 7; ++i) | ||
271 | loop8(i); | ||
272 | break; | ||
273 | } | ||
274 | |||
275 | D_KEY[0] = E_KEY[key_len + 24]; | ||
276 | D_KEY[1] = E_KEY[key_len + 25]; | ||
277 | D_KEY[2] = E_KEY[key_len + 26]; | ||
278 | D_KEY[3] = E_KEY[key_len + 27]; | ||
279 | |||
280 | for (i = 4; i < key_len + 24; ++i) { | ||
281 | j = key_len + 24 - (i & ~3) + (i & 3); | ||
282 | imix_col(D_KEY[j], E_KEY[i]); | ||
283 | } | ||
284 | |||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | extern void aes_encrypt(void *ctx_arg, u8 *out, const u8 *in); | ||
289 | extern void aes_decrypt(void *ctx_arg, u8 *out, const u8 *in); | ||
290 | |||
291 | static struct crypto_alg aes_alg = { | ||
292 | .cra_name = "aes", | ||
293 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
294 | .cra_blocksize = AES_BLOCK_SIZE, | ||
295 | .cra_ctxsize = sizeof(struct aes_ctx), | ||
296 | .cra_module = THIS_MODULE, | ||
297 | .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), | ||
298 | .cra_u = { | ||
299 | .cipher = { | ||
300 | .cia_min_keysize = AES_MIN_KEY_SIZE, | ||
301 | .cia_max_keysize = AES_MAX_KEY_SIZE, | ||
302 | .cia_setkey = aes_set_key, | ||
303 | .cia_encrypt = aes_encrypt, | ||
304 | .cia_decrypt = aes_decrypt | ||
305 | } | ||
306 | } | ||
307 | }; | ||
308 | |||
309 | static int __init aes_init(void) | ||
310 | { | ||
311 | gen_tabs(); | ||
312 | return crypto_register_alg(&aes_alg); | ||
313 | } | ||
314 | |||
315 | static void __exit aes_fini(void) | ||
316 | { | ||
317 | crypto_unregister_alg(&aes_alg); | ||
318 | } | ||
319 | |||
320 | module_init(aes_init); | ||
321 | module_exit(aes_fini); | ||
322 | |||
323 | MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm"); | ||
324 | MODULE_LICENSE("GPL"); | ||
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index 157190d986bb..d206d7e49cf5 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c | |||
@@ -1064,7 +1064,6 @@ void print_all_local_APICs (void) | |||
1064 | 1064 | ||
1065 | void __apicdebuginit print_PIC(void) | 1065 | void __apicdebuginit print_PIC(void) |
1066 | { | 1066 | { |
1067 | extern spinlock_t i8259A_lock; | ||
1068 | unsigned int v; | 1067 | unsigned int v; |
1069 | unsigned long flags; | 1068 | unsigned long flags; |
1070 | 1069 | ||
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c index acd2a778ebe6..5c6dc7051482 100644 --- a/arch/x86_64/kernel/kprobes.c +++ b/arch/x86_64/kernel/kprobes.c | |||
@@ -682,7 +682,7 @@ static struct kprobe trampoline_p = { | |||
682 | .pre_handler = trampoline_probe_handler | 682 | .pre_handler = trampoline_probe_handler |
683 | }; | 683 | }; |
684 | 684 | ||
685 | int __init arch_init(void) | 685 | int __init arch_init_kprobes(void) |
686 | { | 686 | { |
687 | return register_kprobe(&trampoline_p); | 687 | return register_kprobe(&trampoline_p); |
688 | } | 688 | } |
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c index b693c232fd07..657e88aa0902 100644 --- a/arch/x86_64/pci/mmconfig.c +++ b/arch/x86_64/pci/mmconfig.c | |||
@@ -7,25 +7,50 @@ | |||
7 | 7 | ||
8 | #include <linux/pci.h> | 8 | #include <linux/pci.h> |
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/acpi.h> | ||
10 | #include "pci.h" | 11 | #include "pci.h" |
11 | 12 | ||
12 | #define MMCONFIG_APER_SIZE (256*1024*1024) | 13 | #define MMCONFIG_APER_SIZE (256*1024*1024) |
13 | 14 | ||
14 | /* The physical address of the MMCONFIG aperture. Set from ACPI tables. */ | ||
15 | u32 pci_mmcfg_base_addr; | ||
16 | |||
17 | /* Static virtual mapping of the MMCONFIG aperture */ | 15 | /* Static virtual mapping of the MMCONFIG aperture */ |
18 | char *pci_mmcfg_virt; | 16 | struct mmcfg_virt { |
17 | struct acpi_table_mcfg_config *cfg; | ||
18 | char *virt; | ||
19 | }; | ||
20 | static struct mmcfg_virt *pci_mmcfg_virt; | ||
19 | 21 | ||
20 | static inline char *pci_dev_base(unsigned int bus, unsigned int devfn) | 22 | static char *get_virt(unsigned int seg, int bus) |
21 | { | 23 | { |
22 | return pci_mmcfg_virt + ((bus << 20) | (devfn << 12)); | 24 | int cfg_num = -1; |
25 | struct acpi_table_mcfg_config *cfg; | ||
26 | |||
27 | while (1) { | ||
28 | ++cfg_num; | ||
29 | if (cfg_num >= pci_mmcfg_config_num) { | ||
30 | /* something bad is going on, no cfg table is found. */ | ||
31 | /* so we fall back to the old way we used to do this */ | ||
32 | /* and just rely on the first entry to be correct. */ | ||
33 | return pci_mmcfg_virt[0].virt; | ||
34 | } | ||
35 | cfg = pci_mmcfg_virt[cfg_num].cfg; | ||
36 | if (cfg->pci_segment_group_number != seg) | ||
37 | continue; | ||
38 | if ((cfg->start_bus_number <= bus) && | ||
39 | (cfg->end_bus_number >= bus)) | ||
40 | return pci_mmcfg_virt[cfg_num].virt; | ||
41 | } | ||
42 | } | ||
43 | |||
44 | static inline char *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) | ||
45 | { | ||
46 | |||
47 | return get_virt(seg, bus) + ((bus << 20) | (devfn << 12)); | ||
23 | } | 48 | } |
24 | 49 | ||
25 | static int pci_mmcfg_read(unsigned int seg, unsigned int bus, | 50 | static int pci_mmcfg_read(unsigned int seg, unsigned int bus, |
26 | unsigned int devfn, int reg, int len, u32 *value) | 51 | unsigned int devfn, int reg, int len, u32 *value) |
27 | { | 52 | { |
28 | char *addr = pci_dev_base(bus, devfn); | 53 | char *addr = pci_dev_base(seg, bus, devfn); |
29 | 54 | ||
30 | if (unlikely(!value || (bus > 255) || (devfn > 255) || (reg > 4095))) | 55 | if (unlikely(!value || (bus > 255) || (devfn > 255) || (reg > 4095))) |
31 | return -EINVAL; | 56 | return -EINVAL; |
@@ -48,7 +73,7 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus, | |||
48 | static int pci_mmcfg_write(unsigned int seg, unsigned int bus, | 73 | static int pci_mmcfg_write(unsigned int seg, unsigned int bus, |
49 | unsigned int devfn, int reg, int len, u32 value) | 74 | unsigned int devfn, int reg, int len, u32 value) |
50 | { | 75 | { |
51 | char *addr = pci_dev_base(bus,devfn); | 76 | char *addr = pci_dev_base(seg, bus, devfn); |
52 | 77 | ||
53 | if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) | 78 | if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) |
54 | return -EINVAL; | 79 | return -EINVAL; |
@@ -75,9 +100,15 @@ static struct pci_raw_ops pci_mmcfg = { | |||
75 | 100 | ||
76 | static int __init pci_mmcfg_init(void) | 101 | static int __init pci_mmcfg_init(void) |
77 | { | 102 | { |
103 | int i; | ||
104 | |||
78 | if ((pci_probe & PCI_PROBE_MMCONF) == 0) | 105 | if ((pci_probe & PCI_PROBE_MMCONF) == 0) |
79 | return 0; | 106 | return 0; |
80 | if (!pci_mmcfg_base_addr) | 107 | |
108 | acpi_table_parse(ACPI_MCFG, acpi_parse_mcfg); | ||
109 | if ((pci_mmcfg_config_num == 0) || | ||
110 | (pci_mmcfg_config == NULL) || | ||
111 | (pci_mmcfg_config[0].base_address == 0)) | ||
81 | return 0; | 112 | return 0; |
82 | 113 | ||
83 | /* Kludge for now. Don't use mmconfig on AMD systems because | 114 | /* Kludge for now. Don't use mmconfig on AMD systems because |
@@ -88,13 +119,22 @@ static int __init pci_mmcfg_init(void) | |||
88 | return 0; | 119 | return 0; |
89 | 120 | ||
90 | /* RED-PEN i386 doesn't do _nocache right now */ | 121 | /* RED-PEN i386 doesn't do _nocache right now */ |
91 | pci_mmcfg_virt = ioremap_nocache(pci_mmcfg_base_addr, MMCONFIG_APER_SIZE); | 122 | pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL); |
92 | if (!pci_mmcfg_virt) { | 123 | if (pci_mmcfg_virt == NULL) { |
93 | printk("PCI: Cannot map mmconfig aperture\n"); | 124 | printk("PCI: Can not allocate memory for mmconfig structures\n"); |
94 | return 0; | 125 | return 0; |
95 | } | 126 | } |
127 | for (i = 0; i < pci_mmcfg_config_num; ++i) { | ||
128 | pci_mmcfg_virt[i].cfg = &pci_mmcfg_config[i]; | ||
129 | pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].base_address, MMCONFIG_APER_SIZE); | ||
130 | if (!pci_mmcfg_virt[i].virt) { | ||
131 | printk("PCI: Cannot map mmconfig aperture for segment %d\n", | ||
132 | pci_mmcfg_config[i].pci_segment_group_number); | ||
133 | return 0; | ||
134 | } | ||
135 | printk(KERN_INFO "PCI: Using MMCONFIG at %x\n", pci_mmcfg_config[i].base_address); | ||
136 | } | ||
96 | 137 | ||
97 | printk(KERN_INFO "PCI: Using MMCONFIG at %x\n", pci_mmcfg_base_addr); | ||
98 | raw_pci_ops = &pci_mmcfg; | 138 | raw_pci_ops = &pci_mmcfg; |
99 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; | 139 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; |
100 | 140 | ||
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 3e89767cea72..c9b5d298e3c4 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -132,7 +132,7 @@ config XTENSA_CPU_CLOCK | |||
132 | config GENERIC_CALIBRATE_DELAY | 132 | config GENERIC_CALIBRATE_DELAY |
133 | bool "Auto calibration of the BogoMIPS value" | 133 | bool "Auto calibration of the BogoMIPS value" |
134 | ---help--- | 134 | ---help--- |
135 | The BogoMIPS value can easily derived from the CPU frequency. | 135 | The BogoMIPS value can easily be derived from the CPU frequency. |
136 | 136 | ||
137 | config CMDLINE_BOOL | 137 | config CMDLINE_BOOL |
138 | bool "Default bootloader kernel arguments" | 138 | bool "Default bootloader kernel arguments" |
@@ -158,6 +158,8 @@ config XTENSA_ISS_NETWORK | |||
158 | depends on XTENSA_PLATFORM_ISS | 158 | depends on XTENSA_PLATFORM_ISS |
159 | default y | 159 | default y |
160 | 160 | ||
161 | source "mm/Kconfig" | ||
162 | |||
161 | endmenu | 163 | endmenu |
162 | 164 | ||
163 | menu "Bus options" | 165 | menu "Bus options" |
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile index 4fa27453b1f9..27847e4ffcbf 100644 --- a/arch/xtensa/Makefile +++ b/arch/xtensa/Makefile | |||
@@ -21,23 +21,17 @@ export CPU | |||
21 | 21 | ||
22 | # Platform configuration | 22 | # Platform configuration |
23 | 23 | ||
24 | platform-y := common | ||
25 | platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000 | 24 | platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000 |
26 | platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss | 25 | platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss |
27 | 26 | ||
28 | PLATFORM = $(platform-y) | 27 | PLATFORM = $(platform-y) |
29 | export PLATFORM | 28 | export PLATFORM |
30 | 29 | ||
31 | #LDFLAGS_vmlinux := -T$(word 1,$(LINKSCRIPT)) | 30 | CPPFLAGS += $(if $(KBUILD_SRC),-I$(srctree)/include/asm-xtensa/) |
32 | AFLAGS_vmlinux.lds.o := -Uxtensa | 31 | CPPFLAGS += -Iinclude/asm |
33 | CPPFLAGS += -Iarch/xtensa -Iinclude/asm -mlongcalls -g | 32 | CFLAGS += -pipe -mlongcalls |
34 | AFLAGS += -Iarch/xtensa -Iinclude/asm | ||
35 | CPP = $(CC) -E $(CFLAGS) | ||
36 | 33 | ||
37 | cflags-y += -Iarch/xtensa -pipe -mlongcalls | 34 | KBUILD_DEFCONFIG := iss_defconfig |
38 | |||
39 | |||
40 | KBUILD_DEFCONFIG := common_defconfig | ||
41 | 35 | ||
42 | # ramdisk/initrd support | 36 | # ramdisk/initrd support |
43 | # You need a compressed ramdisk image, named ramdisk.gz in | 37 | # You need a compressed ramdisk image, named ramdisk.gz in |
@@ -62,30 +56,36 @@ endif | |||
62 | LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) | 56 | LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) |
63 | 57 | ||
64 | head-y := arch/xtensa/kernel/head.o | 58 | head-y := arch/xtensa/kernel/head.o |
65 | core-y += arch/xtensa/kernel/ \ | 59 | core-y += arch/xtensa/kernel/ arch/xtensa/mm/ |
66 | arch/xtensa/mm/ arch/xtensa/platform-$(PLATFORM)/ | 60 | ifneq ($(PLATFORM),) |
61 | core-y += arch/xtensa/platform-$(PLATFORM)/ | ||
62 | endif | ||
67 | libs-y += arch/xtensa/lib/ $(LIBGCC) | 63 | libs-y += arch/xtensa/lib/ $(LIBGCC) |
68 | 64 | ||
69 | boot := arch/xtensa/boot | 65 | boot := arch/xtensa/boot |
66 | |||
67 | archinc := include/asm-xtensa | ||
70 | 68 | ||
71 | arch/xtensa/kernel/asm-offsets.s: \ | 69 | arch/xtensa/kernel/asm-offsets.s: \ |
72 | arch/xtensa/kernel/asm-offsets.c \ | 70 | arch/xtensa/kernel/asm-offsets.c $(archinc)/.platform |
73 | include/asm-xtensa/.platform | ||
74 | 71 | ||
75 | include/asm-xtensa/offsets.h: arch/xtensa/kernel/asm-offsets.s | 72 | include/asm-xtensa/offsets.h: arch/xtensa/kernel/asm-offsets.s |
76 | $(call filechk,gen-asm-offsets) | 73 | $(call filechk,gen-asm-offsets) |
77 | 74 | ||
78 | prepare: include/asm-xtensa/.platform include/asm-xtensa/offsets.h | 75 | prepare: $(archinc)/.platform $(archinc)/offsets.h |
79 | 76 | ||
80 | # Update machine cpu and platform symlinks if something which affects | 77 | # Update machine cpu and platform symlinks if something which affects |
81 | # them changed. | 78 | # them changed. |
82 | 79 | ||
83 | include/asm-xtensa/.platform: $(wildcard include/config/arch/*.h) | 80 | $(archinc)/.platform: $(wildcard include/config/arch/*.h) include/config/MARKER |
84 | @echo ' Setting up cpu ($(CPU)) and platform ($(PLATFORM)) symlinks' | 81 | @echo ' SYMLINK $(archinc)/xtensa/config -> $(archinc)/xtensa/config-$(CPU)' |
85 | $(Q)rm -f include/asm-xtensa/platform | 82 | $(Q)mkdir -p $(archinc) |
86 | $(Q)rm -f include/asm-xtensa/xtensa/config | 83 | $(Q)mkdir -p $(archinc)/xtensa |
87 | $(Q)(cd include/asm-xtensa/; ln -sf platform-$(PLATFORM) platform) | 84 | $(Q)ln -fsn $(srctree)/$(archinc)/xtensa/config-$(CPU) $(archinc)/xtensa/config |
88 | $(Q)(cd include/asm-xtensa/xtensa; ln -sf config-$(CPU) config) | 85 | @echo ' SYMLINK $(archinc)/platform -> $(archinc)/platform-$(PLATFORM)' |
86 | $(Q)ln -fsn $(srctree)/$(archinc)/platform-$(PLATFORM) $(archinc)/platform | ||
87 | @touch $@ | ||
88 | |||
89 | 89 | ||
90 | all: zImage | 90 | all: zImage |
91 | 91 | ||
@@ -94,7 +94,9 @@ bzImage : zImage | |||
94 | zImage zImage.initrd: vmlinux | 94 | zImage zImage.initrd: vmlinux |
95 | $(Q)$(MAKE) $(build)=$(boot) $@ | 95 | $(Q)$(MAKE) $(build)=$(boot) $@ |
96 | 96 | ||
97 | CLEAN_FILES += arch/xtensa/vmlinux.lds include/asm-xtensa/offset.h | 97 | CLEAN_FILES += arch/xtensa/vmlinux.lds $(archinc)/offset.h \ |
98 | $(archinc)/platform $(archinc)/xtensa/config \ | ||
99 | $(archinc)/.platform | ||
98 | 100 | ||
99 | define archhelp | 101 | define archhelp |
100 | @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)' | 102 | @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)' |
diff --git a/arch/xtensa/boot/Makefile b/arch/xtensa/boot/Makefile index 260f456ccf0b..820b31d10ae4 100644 --- a/arch/xtensa/boot/Makefile +++ b/arch/xtensa/boot/Makefile | |||
@@ -11,21 +11,19 @@ | |||
11 | CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include | 11 | CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include |
12 | HOSTFLAGS += -Iarch/$(ARCH)/boot/include | 12 | HOSTFLAGS += -Iarch/$(ARCH)/boot/include |
13 | 13 | ||
14 | BIG_ENDIAN := $(shell echo -e "\#ifdef __XTENSA_EL__\nint little;\n\#else\nint big;\n\#endif" | $(CC) -E -|grep -c big) | 14 | BIG_ENDIAN := $(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#") |
15 | |||
16 | 15 | ||
17 | export CFLAGS | 16 | export CFLAGS |
18 | export AFLAGS | 17 | export AFLAGS |
19 | export BIG_ENDIAN | 18 | export BIG_ENDIAN |
20 | 19 | ||
20 | subdir-y := lib | ||
21 | |||
21 | # Subdirs for the boot loader(s) | 22 | # Subdirs for the boot loader(s) |
22 | 23 | ||
23 | bootdir-$(CONFIG_XTENSA_PLATFORM_ISS) += boot-elf | 24 | bootdir-$(CONFIG_XTENSA_PLATFORM_ISS) += boot-elf |
24 | bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf | 25 | bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf |
25 | 26 | ||
26 | subdir-y := lib/ | ||
27 | |||
28 | subdir-y += boot-elf/ boot-redboot/ | ||
29 | 27 | ||
30 | zImage zImage.initrd Image Image.initrd: $(bootdir-y) | 28 | zImage zImage.initrd Image Image.initrd: $(bootdir-y) |
31 | 29 | ||
@@ -33,5 +31,3 @@ $(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \ | |||
33 | $(addprefix $(obj)/,$(host-progs)) | 31 | $(addprefix $(obj)/,$(host-progs)) |
34 | $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) | 32 | $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) |
35 | 33 | ||
36 | |||
37 | |||
diff --git a/arch/xtensa/boot/boot-elf/Makefile b/arch/xtensa/boot/boot-elf/Makefile index f6ef6a369667..734db7f76583 100644 --- a/arch/xtensa/boot/boot-elf/Makefile +++ b/arch/xtensa/boot/boot-elf/Makefile | |||
@@ -27,7 +27,7 @@ Image: vmlinux $(OBJS) | |||
27 | --set-section-flags image=contents,alloc,load,load,data \ | 27 | --set-section-flags image=contents,alloc,load,load,data \ |
28 | $(OBJS) $@.tmp | 28 | $(OBJS) $@.tmp |
29 | $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \ | 29 | $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \ |
30 | -T arch/$(ARCH)/boot/boot-elf/boot.ld \ | 30 | -T $(srctree)/arch/$(ARCH)/boot/boot-elf/boot.ld \ |
31 | -o arch/$(ARCH)/boot/$@.elf $@.tmp | 31 | -o arch/$(ARCH)/boot/$@.elf $@.tmp |
32 | rm -f $@.tmp vmlinux.tmp | 32 | rm -f $@.tmp vmlinux.tmp |
33 | 33 | ||
@@ -41,7 +41,7 @@ Image.initrd: vmlinux $(OBJS) | |||
41 | --set-section-flags image=contents,alloc,load,load,data \ | 41 | --set-section-flags image=contents,alloc,load,load,data \ |
42 | $(OBJS) $@.tmp | 42 | $(OBJS) $@.tmp |
43 | $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \ | 43 | $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \ |
44 | -T arch/$(ARCH)/boot/boot-elf/boot.ld \ | 44 | -T $(srctree)/arch/$(ARCH)/boot/boot-elf/boot.ld \ |
45 | -o arch/$(ARCH)/boot/$@.elf $@.tmp | 45 | -o arch/$(ARCH)/boot/$@.elf $@.tmp |
46 | rm -f $@.tmp vmlinux.tmp | 46 | rm -f $@.tmp vmlinux.tmp |
47 | 47 | ||
diff --git a/arch/xtensa/boot/boot-redboot/Makefile b/arch/xtensa/boot/boot-redboot/Makefile index ca8a68bc8472..f53262c2e1f3 100644 --- a/arch/xtensa/boot/boot-redboot/Makefile +++ b/arch/xtensa/boot/boot-redboot/Makefile | |||
@@ -12,24 +12,24 @@ else | |||
12 | OBJCOPY_ARGS := -O elf32-xtensa-le | 12 | OBJCOPY_ARGS := -O elf32-xtensa-le |
13 | endif | 13 | endif |
14 | 14 | ||
15 | LD_ARGS = -T $(obj)/boot.ld | 15 | LD_ARGS = -T $(srctree)/$(obj)/boot.ld |
16 | 16 | ||
17 | boot-y := bootstrap.o | 17 | boot-y := bootstrap.o |
18 | 18 | ||
19 | OBJS := $(addprefix $(obj)/,$(boot-y)) | 19 | OBJS := $(addprefix $(obj)/,$(boot-y)) |
20 | LIBS := arch/$(ARCH)/boot/lib/lib.a arch/$(ARCH)/lib/lib.a | 20 | LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a |
21 | 21 | ||
22 | LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) | 22 | LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) |
23 | 23 | ||
24 | zImage: vmlinux $(OBJS) $(LIBS) | 24 | zImage: vmlinux $(OBJS) $(LIBS) |
25 | $(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \ | 25 | $(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \ |
26 | $(TOPDIR)/vmlinux vmlinux.tmp | 26 | vmlinux vmlinux.tmp |
27 | gzip -vf9 vmlinux.tmp | 27 | gzip -vf9 vmlinux.tmp |
28 | $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \ | 28 | $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \ |
29 | --add-section image=vmlinux.tmp.gz \ | 29 | --add-section image=vmlinux.tmp.gz \ |
30 | --set-section-flags image=contents,alloc,load,load,data \ | 30 | --set-section-flags image=contents,alloc,load,load,data \ |
31 | $(OBJS) $@.tmp | 31 | $(OBJS) $@.tmp |
32 | $(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC) | 32 | $(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC) |
33 | $(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/images/$@.redboot | 33 | $(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/$@.redboot |
34 | # rm -f $@.tmp $@.elf vmlinux.tmp.gz | 34 | rm -f $@.tmp $@.elf vmlinux.tmp.gz |
35 | 35 | ||
diff --git a/arch/xtensa/boot/include/zlib.h b/arch/xtensa/boot/include/zlib.h deleted file mode 100644 index ea29b6237852..000000000000 --- a/arch/xtensa/boot/include/zlib.h +++ /dev/null | |||
@@ -1,433 +0,0 @@ | |||
1 | /* | ||
2 | * BK Id: SCCS/s.zlib.h 1.8 05/18/01 15:17:23 cort | ||
3 | */ | ||
4 | /* | ||
5 | * This file is derived from zlib.h and zconf.h from the zlib-0.95 | ||
6 | * distribution by Jean-loup Gailly and Mark Adler, with some additions | ||
7 | * by Paul Mackerras to aid in implementing Deflate compression and | ||
8 | * decompression for PPP packets. | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * ==FILEVERSION 960122== | ||
13 | * | ||
14 | * This marker is used by the Linux installation script to determine | ||
15 | * whether an up-to-date version of this file is already installed. | ||
16 | */ | ||
17 | |||
18 | /* zlib.h -- interface of the 'zlib' general purpose compression library | ||
19 | version 0.95, Aug 16th, 1995. | ||
20 | |||
21 | Copyright (C) 1995 Jean-loup Gailly and Mark Adler | ||
22 | |||
23 | This software is provided 'as-is', without any express or implied | ||
24 | warranty. In no event will the authors be held liable for any damages | ||
25 | arising from the use of this software. | ||
26 | |||
27 | Permission is granted to anyone to use this software for any purpose, | ||
28 | including commercial applications, and to alter it and redistribute it | ||
29 | freely, subject to the following restrictions: | ||
30 | |||
31 | 1. The origin of this software must not be misrepresented; you must not | ||
32 | claim that you wrote the original software. If you use this software | ||
33 | in a product, an acknowledgment in the product documentation would be | ||
34 | appreciated but is not required. | ||
35 | 2. Altered source versions must be plainly marked as such, and must not be | ||
36 | misrepresented as being the original software. | ||
37 | 3. This notice may not be removed or altered from any source distribution. | ||
38 | |||
39 | Jean-loup Gailly Mark Adler | ||
40 | gzip@prep.ai.mit.edu madler@alumni.caltech.edu | ||
41 | */ | ||
42 | |||
43 | #ifndef _ZLIB_H | ||
44 | #define _ZLIB_H | ||
45 | |||
46 | /* #include "zconf.h" */ /* included directly here */ | ||
47 | |||
48 | /* zconf.h -- configuration of the zlib compression library | ||
49 | * Copyright (C) 1995 Jean-loup Gailly. | ||
50 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
51 | */ | ||
52 | |||
53 | /* From: zconf.h,v 1.12 1995/05/03 17:27:12 jloup Exp */ | ||
54 | |||
55 | /* | ||
56 | The library does not install any signal handler. It is recommended to | ||
57 | add at least a handler for SIGSEGV when decompressing; the library checks | ||
58 | the consistency of the input data whenever possible but may go nuts | ||
59 | for some forms of corrupted input. | ||
60 | */ | ||
61 | |||
62 | /* | ||
63 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more | ||
64 | * than 64k bytes at a time (needed on systems with 16-bit int). | ||
65 | * Compile with -DUNALIGNED_OK if it is OK to access shorts or ints | ||
66 | * at addresses which are not a multiple of their size. | ||
67 | * Under DOS, -DFAR=far or -DFAR=__far may be needed. | ||
68 | */ | ||
69 | |||
70 | #ifndef STDC | ||
71 | # if defined(MSDOS) || defined(__STDC__) || defined(__cplusplus) | ||
72 | # define STDC | ||
73 | # endif | ||
74 | #endif | ||
75 | |||
76 | #ifdef __MWERKS__ /* Metrowerks CodeWarrior declares fileno() in unix.h */ | ||
77 | # include <unix.h> | ||
78 | #endif | ||
79 | |||
80 | /* Maximum value for memLevel in deflateInit2 */ | ||
81 | #ifndef MAX_MEM_LEVEL | ||
82 | # ifdef MAXSEG_64K | ||
83 | # define MAX_MEM_LEVEL 8 | ||
84 | # else | ||
85 | # define MAX_MEM_LEVEL 9 | ||
86 | # endif | ||
87 | #endif | ||
88 | |||
89 | #ifndef FAR | ||
90 | # define FAR | ||
91 | #endif | ||
92 | |||
93 | /* Maximum value for windowBits in deflateInit2 and inflateInit2 */ | ||
94 | #ifndef MAX_WBITS | ||
95 | # define MAX_WBITS 15 /* 32K LZ77 window */ | ||
96 | #endif | ||
97 | |||
98 | /* The memory requirements for deflate are (in bytes): | ||
99 | 1 << (windowBits+2) + 1 << (memLevel+9) | ||
100 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) | ||
101 | plus a few kilobytes for small objects. For example, if you want to reduce | ||
102 | the default memory requirements from 256K to 128K, compile with | ||
103 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" | ||
104 | Of course this will generally degrade compression (there's no free lunch). | ||
105 | |||
106 | The memory requirements for inflate are (in bytes) 1 << windowBits | ||
107 | that is, 32K for windowBits=15 (default value) plus a few kilobytes | ||
108 | for small objects. | ||
109 | */ | ||
110 | |||
111 | /* Type declarations */ | ||
112 | |||
113 | #ifndef OF /* function prototypes */ | ||
114 | # ifdef STDC | ||
115 | # define OF(args) args | ||
116 | # else | ||
117 | # define OF(args) () | ||
118 | # endif | ||
119 | #endif | ||
120 | |||
121 | typedef unsigned char Byte; /* 8 bits */ | ||
122 | typedef unsigned int uInt; /* 16 bits or more */ | ||
123 | typedef unsigned long uLong; /* 32 bits or more */ | ||
124 | |||
125 | typedef Byte FAR Bytef; | ||
126 | typedef char FAR charf; | ||
127 | typedef int FAR intf; | ||
128 | typedef uInt FAR uIntf; | ||
129 | typedef uLong FAR uLongf; | ||
130 | |||
131 | #ifdef STDC | ||
132 | typedef void FAR *voidpf; | ||
133 | typedef void *voidp; | ||
134 | #else | ||
135 | typedef Byte FAR *voidpf; | ||
136 | typedef Byte *voidp; | ||
137 | #endif | ||
138 | |||
139 | /* end of original zconf.h */ | ||
140 | |||
141 | #define ZLIB_VERSION "0.95P" | ||
142 | |||
143 | /* | ||
144 | The 'zlib' compression library provides in-memory compression and | ||
145 | decompression functions, including integrity checks of the uncompressed | ||
146 | data. This version of the library supports only one compression method | ||
147 | (deflation) but other algorithms may be added later and will have the same | ||
148 | stream interface. | ||
149 | |||
150 | For compression the application must provide the output buffer and | ||
151 | may optionally provide the input buffer for optimization. For decompression, | ||
152 | the application must provide the input buffer and may optionally provide | ||
153 | the output buffer for optimization. | ||
154 | |||
155 | Compression can be done in a single step if the buffers are large | ||
156 | enough (for example if an input file is mmap'ed), or can be done by | ||
157 | repeated calls of the compression function. In the latter case, the | ||
158 | application must provide more input and/or consume the output | ||
159 | (providing more output space) before each call. | ||
160 | */ | ||
161 | |||
162 | typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); | ||
163 | typedef void (*free_func) OF((voidpf opaque, voidpf address, uInt nbytes)); | ||
164 | |||
165 | struct internal_state; | ||
166 | |||
167 | typedef struct z_stream_s { | ||
168 | Bytef *next_in; /* next input byte */ | ||
169 | uInt avail_in; /* number of bytes available at next_in */ | ||
170 | uLong total_in; /* total nb of input bytes read so far */ | ||
171 | |||
172 | Bytef *next_out; /* next output byte should be put there */ | ||
173 | uInt avail_out; /* remaining free space at next_out */ | ||
174 | uLong total_out; /* total nb of bytes output so far */ | ||
175 | |||
176 | char *msg; /* last error message, NULL if no error */ | ||
177 | struct internal_state FAR *state; /* not visible by applications */ | ||
178 | |||
179 | alloc_func zalloc; /* used to allocate the internal state */ | ||
180 | free_func zfree; /* used to free the internal state */ | ||
181 | voidp opaque; /* private data object passed to zalloc and zfree */ | ||
182 | |||
183 | Byte data_type; /* best guess about the data type: ascii or binary */ | ||
184 | |||
185 | } z_stream; | ||
186 | |||
187 | /* | ||
188 | The application must update next_in and avail_in when avail_in has | ||
189 | dropped to zero. It must update next_out and avail_out when avail_out | ||
190 | has dropped to zero. The application must initialize zalloc, zfree and | ||
191 | opaque before calling the init function. All other fields are set by the | ||
192 | compression library and must not be updated by the application. | ||
193 | |||
194 | The opaque value provided by the application will be passed as the first | ||
195 | parameter for calls of zalloc and zfree. This can be useful for custom | ||
196 | memory management. The compression library attaches no meaning to the | ||
197 | opaque value. | ||
198 | |||
199 | zalloc must return Z_NULL if there is not enough memory for the object. | ||
200 | On 16-bit systems, the functions zalloc and zfree must be able to allocate | ||
201 | exactly 65536 bytes, but will not be required to allocate more than this | ||
202 | if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, | ||
203 | pointers returned by zalloc for objects of exactly 65536 bytes *must* | ||
204 | have their offset normalized to zero. The default allocation function | ||
205 | provided by this library ensures this (see zutil.c). To reduce memory | ||
206 | requirements and avoid any allocation of 64K objects, at the expense of | ||
207 | compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). | ||
208 | |||
209 | The fields total_in and total_out can be used for statistics or | ||
210 | progress reports. After compression, total_in holds the total size of | ||
211 | the uncompressed data and may be saved for use in the decompressor | ||
212 | (particularly if the decompressor wants to decompress everything in | ||
213 | a single step). | ||
214 | */ | ||
215 | |||
216 | /* constants */ | ||
217 | |||
218 | #define Z_NO_FLUSH 0 | ||
219 | #define Z_PARTIAL_FLUSH 1 | ||
220 | #define Z_FULL_FLUSH 2 | ||
221 | #define Z_SYNC_FLUSH 3 /* experimental: partial_flush + byte align */ | ||
222 | #define Z_FINISH 4 | ||
223 | #define Z_PACKET_FLUSH 5 | ||
224 | /* See deflate() below for the usage of these constants */ | ||
225 | |||
226 | #define Z_OK 0 | ||
227 | #define Z_STREAM_END 1 | ||
228 | #define Z_ERRNO (-1) | ||
229 | #define Z_STREAM_ERROR (-2) | ||
230 | #define Z_DATA_ERROR (-3) | ||
231 | #define Z_MEM_ERROR (-4) | ||
232 | #define Z_BUF_ERROR (-5) | ||
233 | /* error codes for the compression/decompression functions */ | ||
234 | |||
235 | #define Z_BEST_SPEED 1 | ||
236 | #define Z_BEST_COMPRESSION 9 | ||
237 | #define Z_DEFAULT_COMPRESSION (-1) | ||
238 | /* compression levels */ | ||
239 | |||
240 | #define Z_FILTERED 1 | ||
241 | #define Z_HUFFMAN_ONLY 2 | ||
242 | #define Z_DEFAULT_STRATEGY 0 | ||
243 | |||
244 | #define Z_BINARY 0 | ||
245 | #define Z_ASCII 1 | ||
246 | #define Z_UNKNOWN 2 | ||
247 | /* Used to set the data_type field */ | ||
248 | |||
249 | #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ | ||
250 | |||
251 | extern char *zlib_version; | ||
252 | /* The application can compare zlib_version and ZLIB_VERSION for consistency. | ||
253 | If the first character differs, the library code actually used is | ||
254 | not compatible with the zlib.h header file used by the application. | ||
255 | */ | ||
256 | |||
257 | /* basic functions */ | ||
258 | |||
259 | extern int inflateInit OF((z_stream *strm)); | ||
260 | /* | ||
261 | Initializes the internal stream state for decompression. The fields | ||
262 | zalloc and zfree must be initialized before by the caller. If zalloc and | ||
263 | zfree are set to Z_NULL, inflateInit updates them to use default allocation | ||
264 | functions. | ||
265 | |||
266 | inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not | ||
267 | enough memory. msg is set to null if there is no error message. | ||
268 | inflateInit does not perform any decompression: this will be done by | ||
269 | inflate(). | ||
270 | */ | ||
271 | |||
272 | |||
273 | extern int inflate OF((z_stream *strm, int flush)); | ||
274 | /* | ||
275 | Performs one or both of the following actions: | ||
276 | |||
277 | - Decompress more input starting at next_in and update next_in and avail_in | ||
278 | accordingly. If not all input can be processed (because there is not | ||
279 | enough room in the output buffer), next_in is updated and processing | ||
280 | will resume at this point for the next call of inflate(). | ||
281 | |||
282 | - Provide more output starting at next_out and update next_out and avail_out | ||
283 | accordingly. inflate() always provides as much output as possible | ||
284 | (until there is no more input data or no more space in the output buffer). | ||
285 | |||
286 | Before the call of inflate(), the application should ensure that at least | ||
287 | one of the actions is possible, by providing more input and/or consuming | ||
288 | more output, and updating the next_* and avail_* values accordingly. | ||
289 | The application can consume the uncompressed output when it wants, for | ||
290 | example when the output buffer is full (avail_out == 0), or after each | ||
291 | call of inflate(). | ||
292 | |||
293 | If the parameter flush is set to Z_PARTIAL_FLUSH or Z_PACKET_FLUSH, | ||
294 | inflate flushes as much output as possible to the output buffer. The | ||
295 | flushing behavior of inflate is not specified for values of the flush | ||
296 | parameter other than Z_PARTIAL_FLUSH, Z_PACKET_FLUSH or Z_FINISH, but the | ||
297 | current implementation actually flushes as much output as possible | ||
298 | anyway. For Z_PACKET_FLUSH, inflate checks that once all the input data | ||
299 | has been consumed, it is expecting to see the length field of a stored | ||
300 | block; if not, it returns Z_DATA_ERROR. | ||
301 | |||
302 | inflate() should normally be called until it returns Z_STREAM_END or an | ||
303 | error. However if all decompression is to be performed in a single step | ||
304 | (a single call of inflate), the parameter flush should be set to | ||
305 | Z_FINISH. In this case all pending input is processed and all pending | ||
306 | output is flushed; avail_out must be large enough to hold all the | ||
307 | uncompressed data. (The size of the uncompressed data may have been saved | ||
308 | by the compressor for this purpose.) The next operation on this stream must | ||
309 | be inflateEnd to deallocate the decompression state. The use of Z_FINISH | ||
310 | is never required, but can be used to inform inflate that a faster routine | ||
311 | may be used for the single inflate() call. | ||
312 | |||
313 | inflate() returns Z_OK if some progress has been made (more input | ||
314 | processed or more output produced), Z_STREAM_END if the end of the | ||
315 | compressed data has been reached and all uncompressed output has been | ||
316 | produced, Z_DATA_ERROR if the input data was corrupted, Z_STREAM_ERROR if | ||
317 | the stream structure was inconsistent (for example if next_in or next_out | ||
318 | was NULL), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no | ||
319 | progress is possible or if there was not enough room in the output buffer | ||
320 | when Z_FINISH is used. In the Z_DATA_ERROR case, the application may then | ||
321 | call inflateSync to look for a good compression block. */ | ||
322 | |||
323 | |||
324 | extern int inflateEnd OF((z_stream *strm)); | ||
325 | /* | ||
326 | All dynamically allocated data structures for this stream are freed. | ||
327 | This function discards any unprocessed input and does not flush any | ||
328 | pending output. | ||
329 | |||
330 | inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state | ||
331 | was inconsistent. In the error case, msg may be set but then points to a | ||
332 | static string (which must not be deallocated). | ||
333 | */ | ||
334 | |||
335 | /* advanced functions */ | ||
336 | |||
337 | extern int inflateInit2 OF((z_stream *strm, | ||
338 | int windowBits)); | ||
339 | /* | ||
340 | This is another version of inflateInit with more compression options. The | ||
341 | fields next_out, zalloc and zfree must be initialized before by the caller. | ||
342 | |||
343 | The windowBits parameter is the base two logarithm of the maximum window | ||
344 | size (the size of the history buffer). It should be in the range 8..15 for | ||
345 | this version of the library (the value 16 will be allowed soon). The | ||
346 | default value is 15 if inflateInit is used instead. If a compressed stream | ||
347 | with a larger window size is given as input, inflate() will return with | ||
348 | the error code Z_DATA_ERROR instead of trying to allocate a larger window. | ||
349 | |||
350 | If next_out is not null, the library will use this buffer for the history | ||
351 | buffer; the buffer must either be large enough to hold the entire output | ||
352 | data, or have at least 1<<windowBits bytes. If next_out is null, the | ||
353 | library will allocate its own buffer (and leave next_out null). next_in | ||
354 | need not be provided here but must be provided by the application for the | ||
355 | next call of inflate(). | ||
356 | |||
357 | If the history buffer is provided by the application, next_out must | ||
358 | never be changed by the application since the decompressor maintains | ||
359 | history information inside this buffer from call to call; the application | ||
360 | can only reset next_out to the beginning of the history buffer when | ||
361 | avail_out is zero and all output has been consumed. | ||
362 | |||
363 | inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was | ||
364 | not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as | ||
365 | windowBits < 8). msg is set to null if there is no error message. | ||
366 | inflateInit2 does not perform any decompression: this will be done by | ||
367 | inflate(). | ||
368 | */ | ||
369 | |||
370 | extern int inflateSync OF((z_stream *strm)); | ||
371 | /* | ||
372 | Skips invalid compressed data until the special marker (see deflate() | ||
373 | above) can be found, or until all available input is skipped. No output | ||
374 | is provided. | ||
375 | |||
376 | inflateSync returns Z_OK if the special marker has been found, Z_BUF_ERROR | ||
377 | if no more input was provided, Z_DATA_ERROR if no marker has been found, | ||
378 | or Z_STREAM_ERROR if the stream structure was inconsistent. In the success | ||
379 | case, the application may save the current current value of total_in which | ||
380 | indicates where valid compressed data was found. In the error case, the | ||
381 | application may repeatedly call inflateSync, providing more input each time, | ||
382 | until success or end of the input data. | ||
383 | */ | ||
384 | |||
385 | extern int inflateReset OF((z_stream *strm)); | ||
386 | /* | ||
387 | This function is equivalent to inflateEnd followed by inflateInit, | ||
388 | but does not free and reallocate all the internal decompression state. | ||
389 | The stream will keep attributes that may have been set by inflateInit2. | ||
390 | |||
391 | inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
392 | stream state was inconsistent (such as zalloc or state being NULL). | ||
393 | */ | ||
394 | |||
395 | extern int inflateIncomp OF((z_stream *strm)); | ||
396 | /* | ||
397 | This function adds the data at next_in (avail_in bytes) to the output | ||
398 | history without performing any output. There must be no pending output, | ||
399 | and the decompressor must be expecting to see the start of a block. | ||
400 | Calling this function is equivalent to decompressing a stored block | ||
401 | containing the data at next_in (except that the data is not output). | ||
402 | */ | ||
403 | |||
404 | /* checksum functions */ | ||
405 | |||
406 | /* | ||
407 | This function is not related to compression but is exported | ||
408 | anyway because it might be useful in applications using the | ||
409 | compression library. | ||
410 | */ | ||
411 | |||
412 | extern uLong adler32 OF((uLong adler, Bytef *buf, uInt len)); | ||
413 | |||
414 | /* | ||
415 | Update a running Adler-32 checksum with the bytes buf[0..len-1] and | ||
416 | return the updated checksum. If buf is NULL, this function returns | ||
417 | the required initial value for the checksum. | ||
418 | An Adler-32 checksum is almost as reliable as a CRC32 but can be computed | ||
419 | much faster. Usage example: | ||
420 | |||
421 | uLong adler = adler32(0L, Z_NULL, 0); | ||
422 | |||
423 | while (read_buffer(buffer, length) != EOF) { | ||
424 | adler = adler32(adler, buffer, length); | ||
425 | } | ||
426 | if (adler != original_adler) error(); | ||
427 | */ | ||
428 | |||
429 | #ifndef _Z_UTIL_H | ||
430 | struct internal_state {int dummy;}; /* hack for buggy compilers */ | ||
431 | #endif | ||
432 | |||
433 | #endif /* _ZLIB_H */ | ||
diff --git a/arch/xtensa/boot/lib/Makefile b/arch/xtensa/boot/lib/Makefile index c0a74dc3a0df..9e73bb8aeb7a 100644 --- a/arch/xtensa/boot/lib/Makefile +++ b/arch/xtensa/boot/lib/Makefile | |||
@@ -2,5 +2,16 @@ | |||
2 | # Makefile for some libs needed by zImage. | 2 | # Makefile for some libs needed by zImage. |
3 | # | 3 | # |
4 | 4 | ||
5 | zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c | ||
5 | 6 | ||
6 | lib-y := zlib.o zmem.o | 7 | lib-y += $(zlib:.c=.o) zmem.o |
8 | |||
9 | EXTRA_CFLAGS += -Ilib/zlib_inflate | ||
10 | |||
11 | quiet_cmd_copy_zlib = COPY $@ | ||
12 | cmd_copy_zlib = cat $< > $@ | ||
13 | |||
14 | $(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/% | ||
15 | $(call cmd,copy_zlib) | ||
16 | |||
17 | clean-files := $(zlib) | ||
diff --git a/arch/xtensa/boot/lib/memcpy.S b/arch/xtensa/boot/lib/memcpy.S deleted file mode 100644 index a029f5df2d5c..000000000000 --- a/arch/xtensa/boot/lib/memcpy.S +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* | ||
2 | * arch/xtensa/lib/memcpy.S | ||
3 | * | ||
4 | * ANSI C standard library function memcpy | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General | ||
7 | * Public License. See the file "COPYING" in the main directory of | ||
8 | * this archive for more details. | ||
9 | * | ||
10 | * Copyright (C) 2002 Tensilica Inc. | ||
11 | */ | ||
12 | |||
13 | #define _ASMLANGUAGE | ||
14 | #include <xtensa/config/core.h> | ||
15 | |||
16 | .text | ||
17 | .align 4 | ||
18 | .global bcopy | ||
19 | .type bcopy,@function | ||
20 | bcopy: | ||
21 | movi a14, xthal_bcopy // a14 safe to use regardless of whether caller | ||
22 | // used call4 or call8 (can't have used call12) | ||
23 | jx a14 // let the Core HAL do the work | ||
24 | |||
25 | .text | ||
26 | .align 4 | ||
27 | .global memcpy | ||
28 | .type memcpy,@function | ||
29 | memcpy: | ||
30 | .global memmove | ||
31 | .type memmove,@function | ||
32 | memmove: | ||
33 | movi a14, xthal_memcpy // a14 safe to use regardless of whether caller | ||
34 | // used call4 or call8 (can't have used call12) | ||
35 | jx a14 // let the Core HAL do the work | ||
36 | |||
diff --git a/arch/xtensa/boot/lib/zlib.c b/arch/xtensa/boot/lib/zlib.c deleted file mode 100644 index e3859f631077..000000000000 --- a/arch/xtensa/boot/lib/zlib.c +++ /dev/null | |||
@@ -1,2150 +0,0 @@ | |||
1 | /* | ||
2 | * BK Id: SCCS/s.zlib.c 1.8 05/18/01 15:17:24 cort | ||
3 | */ | ||
4 | /* | ||
5 | * This file is derived from various .h and .c files from the zlib-0.95 | ||
6 | * distribution by Jean-loup Gailly and Mark Adler, with some additions | ||
7 | * by Paul Mackerras to aid in implementing Deflate compression and | ||
8 | * decompression for PPP packets. See zlib.h for conditions of | ||
9 | * distribution and use. | ||
10 | * | ||
11 | * Changes that have been made include: | ||
12 | * - changed functions not used outside this file to "local" | ||
13 | * - added minCompression parameter to deflateInit2 | ||
14 | * - added Z_PACKET_FLUSH (see zlib.h for details) | ||
15 | * - added inflateIncomp | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | /*+++++*/ | ||
20 | /* zutil.h -- internal interface and configuration of the compression library | ||
21 | * Copyright (C) 1995 Jean-loup Gailly. | ||
22 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
23 | */ | ||
24 | |||
25 | /* WARNING: this file should *not* be used by applications. It is | ||
26 | part of the implementation of the compression library and is | ||
27 | subject to change. Applications should only use zlib.h. | ||
28 | */ | ||
29 | |||
30 | /* From: zutil.h,v 1.9 1995/05/03 17:27:12 jloup Exp */ | ||
31 | |||
32 | #define _Z_UTIL_H | ||
33 | |||
34 | #include "zlib.h" | ||
35 | |||
36 | #ifndef local | ||
37 | # define local static | ||
38 | #endif | ||
39 | /* compile with -Dlocal if your debugger can't find static symbols */ | ||
40 | |||
41 | #define FAR | ||
42 | |||
43 | typedef unsigned char uch; | ||
44 | typedef uch FAR uchf; | ||
45 | typedef unsigned short ush; | ||
46 | typedef ush FAR ushf; | ||
47 | typedef unsigned long ulg; | ||
48 | |||
49 | extern char *z_errmsg[]; /* indexed by 1-zlib_error */ | ||
50 | |||
51 | #define ERR_RETURN(strm,err) return (strm->msg=z_errmsg[1-err], err) | ||
52 | /* To be used only when the state is known to be valid */ | ||
53 | |||
54 | #ifndef NULL | ||
55 | #define NULL ((void *) 0) | ||
56 | #endif | ||
57 | |||
58 | /* common constants */ | ||
59 | |||
60 | #define DEFLATED 8 | ||
61 | |||
62 | #ifndef DEF_WBITS | ||
63 | # define DEF_WBITS MAX_WBITS | ||
64 | #endif | ||
65 | /* default windowBits for decompression. MAX_WBITS is for compression only */ | ||
66 | |||
67 | #if MAX_MEM_LEVEL >= 8 | ||
68 | # define DEF_MEM_LEVEL 8 | ||
69 | #else | ||
70 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL | ||
71 | #endif | ||
72 | /* default memLevel */ | ||
73 | |||
74 | #define STORED_BLOCK 0 | ||
75 | #define STATIC_TREES 1 | ||
76 | #define DYN_TREES 2 | ||
77 | /* The three kinds of block type */ | ||
78 | |||
79 | #define MIN_MATCH 3 | ||
80 | #define MAX_MATCH 258 | ||
81 | /* The minimum and maximum match lengths */ | ||
82 | |||
83 | /* functions */ | ||
84 | |||
85 | #include <linux/string.h> | ||
86 | #define zmemcpy memcpy | ||
87 | #define zmemzero(dest, len) memset(dest, 0, len) | ||
88 | |||
89 | /* Diagnostic functions */ | ||
90 | #ifdef DEBUG_ZLIB | ||
91 | # include <stdio.h> | ||
92 | # ifndef verbose | ||
93 | # define verbose 0 | ||
94 | # endif | ||
95 | # define Assert(cond,msg) {if(!(cond)) z_error(msg);} | ||
96 | # define Trace(x) fprintf x | ||
97 | # define Tracev(x) {if (verbose) fprintf x ;} | ||
98 | # define Tracevv(x) {if (verbose>1) fprintf x ;} | ||
99 | # define Tracec(c,x) {if (verbose && (c)) fprintf x ;} | ||
100 | # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} | ||
101 | #else | ||
102 | # define Assert(cond,msg) | ||
103 | # define Trace(x) | ||
104 | # define Tracev(x) | ||
105 | # define Tracevv(x) | ||
106 | # define Tracec(c,x) | ||
107 | # define Tracecv(c,x) | ||
108 | #endif | ||
109 | |||
110 | |||
111 | typedef uLong (*check_func) OF((uLong check, Bytef *buf, uInt len)); | ||
112 | |||
113 | /* voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); */ | ||
114 | /* void zcfree OF((voidpf opaque, voidpf ptr)); */ | ||
115 | |||
116 | #define ZALLOC(strm, items, size) \ | ||
117 | (*((strm)->zalloc))((strm)->opaque, (items), (size)) | ||
118 | #define ZFREE(strm, addr, size) \ | ||
119 | (*((strm)->zfree))((strm)->opaque, (voidpf)(addr), (size)) | ||
120 | #define TRY_FREE(s, p, n) {if (p) ZFREE(s, p, n);} | ||
121 | |||
122 | /* deflate.h -- internal compression state | ||
123 | * Copyright (C) 1995 Jean-loup Gailly | ||
124 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
125 | */ | ||
126 | |||
127 | /* WARNING: this file should *not* be used by applications. It is | ||
128 | part of the implementation of the compression library and is | ||
129 | subject to change. Applications should only use zlib.h. | ||
130 | */ | ||
131 | |||
132 | /*+++++*/ | ||
133 | /* infblock.h -- header to use infblock.c | ||
134 | * Copyright (C) 1995 Mark Adler | ||
135 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
136 | */ | ||
137 | |||
138 | /* WARNING: this file should *not* be used by applications. It is | ||
139 | part of the implementation of the compression library and is | ||
140 | subject to change. Applications should only use zlib.h. | ||
141 | */ | ||
142 | |||
143 | struct inflate_blocks_state; | ||
144 | typedef struct inflate_blocks_state FAR inflate_blocks_statef; | ||
145 | |||
146 | local inflate_blocks_statef * inflate_blocks_new OF(( | ||
147 | z_stream *z, | ||
148 | check_func c, /* check function */ | ||
149 | uInt w)); /* window size */ | ||
150 | |||
151 | local int inflate_blocks OF(( | ||
152 | inflate_blocks_statef *, | ||
153 | z_stream *, | ||
154 | int)); /* initial return code */ | ||
155 | |||
156 | local void inflate_blocks_reset OF(( | ||
157 | inflate_blocks_statef *, | ||
158 | z_stream *, | ||
159 | uLongf *)); /* check value on output */ | ||
160 | |||
161 | local int inflate_blocks_free OF(( | ||
162 | inflate_blocks_statef *, | ||
163 | z_stream *, | ||
164 | uLongf *)); /* check value on output */ | ||
165 | |||
166 | local int inflate_addhistory OF(( | ||
167 | inflate_blocks_statef *, | ||
168 | z_stream *)); | ||
169 | |||
170 | local int inflate_packet_flush OF(( | ||
171 | inflate_blocks_statef *)); | ||
172 | |||
173 | /*+++++*/ | ||
174 | /* inftrees.h -- header to use inftrees.c | ||
175 | * Copyright (C) 1995 Mark Adler | ||
176 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
177 | */ | ||
178 | |||
179 | /* WARNING: this file should *not* be used by applications. It is | ||
180 | part of the implementation of the compression library and is | ||
181 | subject to change. Applications should only use zlib.h. | ||
182 | */ | ||
183 | |||
184 | /* Huffman code lookup table entry--this entry is four bytes for machines | ||
185 | that have 16-bit pointers (e.g. PC's in the small or medium model). */ | ||
186 | |||
187 | typedef struct inflate_huft_s FAR inflate_huft; | ||
188 | |||
189 | struct inflate_huft_s { | ||
190 | union { | ||
191 | struct { | ||
192 | Byte Exop; /* number of extra bits or operation */ | ||
193 | Byte Bits; /* number of bits in this code or subcode */ | ||
194 | } what; | ||
195 | uInt Nalloc; /* number of these allocated here */ | ||
196 | Bytef *pad; /* pad structure to a power of 2 (4 bytes for */ | ||
197 | } word; /* 16-bit, 8 bytes for 32-bit machines) */ | ||
198 | union { | ||
199 | uInt Base; /* literal, length base, or distance base */ | ||
200 | inflate_huft *Next; /* pointer to next level of table */ | ||
201 | } more; | ||
202 | }; | ||
203 | |||
204 | #ifdef DEBUG_ZLIB | ||
205 | local uInt inflate_hufts; | ||
206 | #endif | ||
207 | |||
208 | local int inflate_trees_bits OF(( | ||
209 | uIntf *, /* 19 code lengths */ | ||
210 | uIntf *, /* bits tree desired/actual depth */ | ||
211 | inflate_huft * FAR *, /* bits tree result */ | ||
212 | z_stream *)); /* for zalloc, zfree functions */ | ||
213 | |||
214 | local int inflate_trees_dynamic OF(( | ||
215 | uInt, /* number of literal/length codes */ | ||
216 | uInt, /* number of distance codes */ | ||
217 | uIntf *, /* that many (total) code lengths */ | ||
218 | uIntf *, /* literal desired/actual bit depth */ | ||
219 | uIntf *, /* distance desired/actual bit depth */ | ||
220 | inflate_huft * FAR *, /* literal/length tree result */ | ||
221 | inflate_huft * FAR *, /* distance tree result */ | ||
222 | z_stream *)); /* for zalloc, zfree functions */ | ||
223 | |||
224 | local int inflate_trees_fixed OF(( | ||
225 | uIntf *, /* literal desired/actual bit depth */ | ||
226 | uIntf *, /* distance desired/actual bit depth */ | ||
227 | inflate_huft * FAR *, /* literal/length tree result */ | ||
228 | inflate_huft * FAR *)); /* distance tree result */ | ||
229 | |||
230 | local int inflate_trees_free OF(( | ||
231 | inflate_huft *, /* tables to free */ | ||
232 | z_stream *)); /* for zfree function */ | ||
233 | |||
234 | |||
235 | /*+++++*/ | ||
236 | /* infcodes.h -- header to use infcodes.c | ||
237 | * Copyright (C) 1995 Mark Adler | ||
238 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
239 | */ | ||
240 | |||
241 | /* WARNING: this file should *not* be used by applications. It is | ||
242 | part of the implementation of the compression library and is | ||
243 | subject to change. Applications should only use zlib.h. | ||
244 | */ | ||
245 | |||
246 | struct inflate_codes_state; | ||
247 | typedef struct inflate_codes_state FAR inflate_codes_statef; | ||
248 | |||
249 | local inflate_codes_statef *inflate_codes_new OF(( | ||
250 | uInt, uInt, | ||
251 | inflate_huft *, inflate_huft *, | ||
252 | z_stream *)); | ||
253 | |||
254 | local int inflate_codes OF(( | ||
255 | inflate_blocks_statef *, | ||
256 | z_stream *, | ||
257 | int)); | ||
258 | |||
259 | local void inflate_codes_free OF(( | ||
260 | inflate_codes_statef *, | ||
261 | z_stream *)); | ||
262 | |||
263 | |||
264 | /*+++++*/ | ||
265 | /* inflate.c -- zlib interface to inflate modules | ||
266 | * Copyright (C) 1995 Mark Adler | ||
267 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
268 | */ | ||
269 | |||
270 | /* inflate private state */ | ||
271 | struct internal_state { | ||
272 | |||
273 | /* mode */ | ||
274 | enum { | ||
275 | METHOD, /* waiting for method byte */ | ||
276 | FLAG, /* waiting for flag byte */ | ||
277 | BLOCKS, /* decompressing blocks */ | ||
278 | CHECK4, /* four check bytes to go */ | ||
279 | CHECK3, /* three check bytes to go */ | ||
280 | CHECK2, /* two check bytes to go */ | ||
281 | CHECK1, /* one check byte to go */ | ||
282 | DONE, /* finished check, done */ | ||
283 | BAD} /* got an error--stay here */ | ||
284 | mode; /* current inflate mode */ | ||
285 | |||
286 | /* mode dependent information */ | ||
287 | union { | ||
288 | uInt method; /* if FLAGS, method byte */ | ||
289 | struct { | ||
290 | uLong was; /* computed check value */ | ||
291 | uLong need; /* stream check value */ | ||
292 | } check; /* if CHECK, check values to compare */ | ||
293 | uInt marker; /* if BAD, inflateSync's marker bytes count */ | ||
294 | } sub; /* submode */ | ||
295 | |||
296 | /* mode independent information */ | ||
297 | int nowrap; /* flag for no wrapper */ | ||
298 | uInt wbits; /* log2(window size) (8..15, defaults to 15) */ | ||
299 | inflate_blocks_statef | ||
300 | *blocks; /* current inflate_blocks state */ | ||
301 | |||
302 | }; | ||
303 | |||
304 | |||
305 | int inflateReset(z) | ||
306 | z_stream *z; | ||
307 | { | ||
308 | uLong c; | ||
309 | |||
310 | if (z == Z_NULL || z->state == Z_NULL) | ||
311 | return Z_STREAM_ERROR; | ||
312 | z->total_in = z->total_out = 0; | ||
313 | z->msg = Z_NULL; | ||
314 | z->state->mode = z->state->nowrap ? BLOCKS : METHOD; | ||
315 | inflate_blocks_reset(z->state->blocks, z, &c); | ||
316 | Trace((stderr, "inflate: reset\n")); | ||
317 | return Z_OK; | ||
318 | } | ||
319 | |||
320 | |||
321 | int inflateEnd(z) | ||
322 | z_stream *z; | ||
323 | { | ||
324 | uLong c; | ||
325 | |||
326 | if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL) | ||
327 | return Z_STREAM_ERROR; | ||
328 | if (z->state->blocks != Z_NULL) | ||
329 | inflate_blocks_free(z->state->blocks, z, &c); | ||
330 | ZFREE(z, z->state, sizeof(struct internal_state)); | ||
331 | z->state = Z_NULL; | ||
332 | Trace((stderr, "inflate: end\n")); | ||
333 | return Z_OK; | ||
334 | } | ||
335 | |||
336 | |||
337 | int inflateInit2(z, w) | ||
338 | z_stream *z; | ||
339 | int w; | ||
340 | { | ||
341 | /* initialize state */ | ||
342 | if (z == Z_NULL) | ||
343 | return Z_STREAM_ERROR; | ||
344 | /* if (z->zalloc == Z_NULL) z->zalloc = zcalloc; */ | ||
345 | /* if (z->zfree == Z_NULL) z->zfree = zcfree; */ | ||
346 | if ((z->state = (struct internal_state FAR *) | ||
347 | ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL) | ||
348 | return Z_MEM_ERROR; | ||
349 | z->state->blocks = Z_NULL; | ||
350 | |||
351 | /* handle undocumented nowrap option (no zlib header or check) */ | ||
352 | z->state->nowrap = 0; | ||
353 | if (w < 0) | ||
354 | { | ||
355 | w = - w; | ||
356 | z->state->nowrap = 1; | ||
357 | } | ||
358 | |||
359 | /* set window size */ | ||
360 | if (w < 8 || w > 15) | ||
361 | { | ||
362 | inflateEnd(z); | ||
363 | return Z_STREAM_ERROR; | ||
364 | } | ||
365 | z->state->wbits = (uInt)w; | ||
366 | |||
367 | /* create inflate_blocks state */ | ||
368 | if ((z->state->blocks = | ||
369 | inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, 1 << w)) | ||
370 | == Z_NULL) | ||
371 | { | ||
372 | inflateEnd(z); | ||
373 | return Z_MEM_ERROR; | ||
374 | } | ||
375 | Trace((stderr, "inflate: allocated\n")); | ||
376 | |||
377 | /* reset state */ | ||
378 | inflateReset(z); | ||
379 | return Z_OK; | ||
380 | } | ||
381 | |||
382 | |||
383 | int inflateInit(z) | ||
384 | z_stream *z; | ||
385 | { | ||
386 | return inflateInit2(z, DEF_WBITS); | ||
387 | } | ||
388 | |||
389 | |||
390 | #define NEEDBYTE {if(z->avail_in==0)goto empty;r=Z_OK;} | ||
391 | #define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++) | ||
392 | |||
393 | int inflate(z, f) | ||
394 | z_stream *z; | ||
395 | int f; | ||
396 | { | ||
397 | int r; | ||
398 | uInt b; | ||
399 | |||
400 | if (z == Z_NULL || z->next_in == Z_NULL) | ||
401 | return Z_STREAM_ERROR; | ||
402 | r = Z_BUF_ERROR; | ||
403 | while (1) switch (z->state->mode) | ||
404 | { | ||
405 | case METHOD: | ||
406 | NEEDBYTE | ||
407 | if (((z->state->sub.method = NEXTBYTE) & 0xf) != DEFLATED) | ||
408 | { | ||
409 | z->state->mode = BAD; | ||
410 | z->msg = "unknown compression method"; | ||
411 | z->state->sub.marker = 5; /* can't try inflateSync */ | ||
412 | break; | ||
413 | } | ||
414 | if ((z->state->sub.method >> 4) + 8 > z->state->wbits) | ||
415 | { | ||
416 | z->state->mode = BAD; | ||
417 | z->msg = "invalid window size"; | ||
418 | z->state->sub.marker = 5; /* can't try inflateSync */ | ||
419 | break; | ||
420 | } | ||
421 | z->state->mode = FLAG; | ||
422 | case FLAG: | ||
423 | NEEDBYTE | ||
424 | if ((b = NEXTBYTE) & 0x20) | ||
425 | { | ||
426 | z->state->mode = BAD; | ||
427 | z->msg = "invalid reserved bit"; | ||
428 | z->state->sub.marker = 5; /* can't try inflateSync */ | ||
429 | break; | ||
430 | } | ||
431 | if (((z->state->sub.method << 8) + b) % 31) | ||
432 | { | ||
433 | z->state->mode = BAD; | ||
434 | z->msg = "incorrect header check"; | ||
435 | z->state->sub.marker = 5; /* can't try inflateSync */ | ||
436 | break; | ||
437 | } | ||
438 | Trace((stderr, "inflate: zlib header ok\n")); | ||
439 | z->state->mode = BLOCKS; | ||
440 | case BLOCKS: | ||
441 | r = inflate_blocks(z->state->blocks, z, r); | ||
442 | if (f == Z_PACKET_FLUSH && z->avail_in == 0 && z->avail_out != 0) | ||
443 | r = inflate_packet_flush(z->state->blocks); | ||
444 | if (r == Z_DATA_ERROR) | ||
445 | { | ||
446 | z->state->mode = BAD; | ||
447 | z->state->sub.marker = 0; /* can try inflateSync */ | ||
448 | break; | ||
449 | } | ||
450 | if (r != Z_STREAM_END) | ||
451 | return r; | ||
452 | r = Z_OK; | ||
453 | inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was); | ||
454 | if (z->state->nowrap) | ||
455 | { | ||
456 | z->state->mode = DONE; | ||
457 | break; | ||
458 | } | ||
459 | z->state->mode = CHECK4; | ||
460 | case CHECK4: | ||
461 | NEEDBYTE | ||
462 | z->state->sub.check.need = (uLong)NEXTBYTE << 24; | ||
463 | z->state->mode = CHECK3; | ||
464 | case CHECK3: | ||
465 | NEEDBYTE | ||
466 | z->state->sub.check.need += (uLong)NEXTBYTE << 16; | ||
467 | z->state->mode = CHECK2; | ||
468 | case CHECK2: | ||
469 | NEEDBYTE | ||
470 | z->state->sub.check.need += (uLong)NEXTBYTE << 8; | ||
471 | z->state->mode = CHECK1; | ||
472 | case CHECK1: | ||
473 | NEEDBYTE | ||
474 | z->state->sub.check.need += (uLong)NEXTBYTE; | ||
475 | |||
476 | if (z->state->sub.check.was != z->state->sub.check.need) | ||
477 | { | ||
478 | z->state->mode = BAD; | ||
479 | z->msg = "incorrect data check"; | ||
480 | z->state->sub.marker = 5; /* can't try inflateSync */ | ||
481 | break; | ||
482 | } | ||
483 | Trace((stderr, "inflate: zlib check ok\n")); | ||
484 | z->state->mode = DONE; | ||
485 | case DONE: | ||
486 | return Z_STREAM_END; | ||
487 | case BAD: | ||
488 | return Z_DATA_ERROR; | ||
489 | default: | ||
490 | return Z_STREAM_ERROR; | ||
491 | } | ||
492 | |||
493 | empty: | ||
494 | if (f != Z_PACKET_FLUSH) | ||
495 | return r; | ||
496 | z->state->mode = BAD; | ||
497 | z->state->sub.marker = 0; /* can try inflateSync */ | ||
498 | return Z_DATA_ERROR; | ||
499 | } | ||
500 | |||
501 | /* | ||
502 | * This subroutine adds the data at next_in/avail_in to the output history | ||
503 | * without performing any output. The output buffer must be "caught up"; | ||
504 | * i.e. no pending output (hence s->read equals s->write), and the state must | ||
505 | * be BLOCKS (i.e. we should be willing to see the start of a series of | ||
506 | * BLOCKS). On exit, the output will also be caught up, and the checksum | ||
507 | * will have been updated if need be. | ||
508 | */ | ||
509 | |||
510 | int inflateIncomp(z) | ||
511 | z_stream *z; | ||
512 | { | ||
513 | if (z->state->mode != BLOCKS) | ||
514 | return Z_DATA_ERROR; | ||
515 | return inflate_addhistory(z->state->blocks, z); | ||
516 | } | ||
517 | |||
518 | |||
519 | int inflateSync(z) | ||
520 | z_stream *z; | ||
521 | { | ||
522 | uInt n; /* number of bytes to look at */ | ||
523 | Bytef *p; /* pointer to bytes */ | ||
524 | uInt m; /* number of marker bytes found in a row */ | ||
525 | uLong r, w; /* temporaries to save total_in and total_out */ | ||
526 | |||
527 | /* set up */ | ||
528 | if (z == Z_NULL || z->state == Z_NULL) | ||
529 | return Z_STREAM_ERROR; | ||
530 | if (z->state->mode != BAD) | ||
531 | { | ||
532 | z->state->mode = BAD; | ||
533 | z->state->sub.marker = 0; | ||
534 | } | ||
535 | if ((n = z->avail_in) == 0) | ||
536 | return Z_BUF_ERROR; | ||
537 | p = z->next_in; | ||
538 | m = z->state->sub.marker; | ||
539 | |||
540 | /* search */ | ||
541 | while (n && m < 4) | ||
542 | { | ||
543 | if (*p == (Byte)(m < 2 ? 0 : 0xff)) | ||
544 | m++; | ||
545 | else if (*p) | ||
546 | m = 0; | ||
547 | else | ||
548 | m = 4 - m; | ||
549 | p++, n--; | ||
550 | } | ||
551 | |||
552 | /* restore */ | ||
553 | z->total_in += p - z->next_in; | ||
554 | z->next_in = p; | ||
555 | z->avail_in = n; | ||
556 | z->state->sub.marker = m; | ||
557 | |||
558 | /* return no joy or set up to restart on a new block */ | ||
559 | if (m != 4) | ||
560 | return Z_DATA_ERROR; | ||
561 | r = z->total_in; w = z->total_out; | ||
562 | inflateReset(z); | ||
563 | z->total_in = r; z->total_out = w; | ||
564 | z->state->mode = BLOCKS; | ||
565 | return Z_OK; | ||
566 | } | ||
567 | |||
568 | #undef NEEDBYTE | ||
569 | #undef NEXTBYTE | ||
570 | |||
571 | /*+++++*/ | ||
572 | /* infutil.h -- types and macros common to blocks and codes | ||
573 | * Copyright (C) 1995 Mark Adler | ||
574 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
575 | */ | ||
576 | |||
577 | /* WARNING: this file should *not* be used by applications. It is | ||
578 | part of the implementation of the compression library and is | ||
579 | subject to change. Applications should only use zlib.h. | ||
580 | */ | ||
581 | |||
582 | /* inflate blocks semi-private state */ | ||
583 | struct inflate_blocks_state { | ||
584 | |||
585 | /* mode */ | ||
586 | enum { | ||
587 | TYPE, /* get type bits (3, including end bit) */ | ||
588 | LENS, /* get lengths for stored */ | ||
589 | STORED, /* processing stored block */ | ||
590 | TABLE, /* get table lengths */ | ||
591 | BTREE, /* get bit lengths tree for a dynamic block */ | ||
592 | DTREE, /* get length, distance trees for a dynamic block */ | ||
593 | CODES, /* processing fixed or dynamic block */ | ||
594 | DRY, /* output remaining window bytes */ | ||
595 | DONEB, /* finished last block, done */ | ||
596 | BADB} /* got a data error--stuck here */ | ||
597 | mode; /* current inflate_block mode */ | ||
598 | |||
599 | /* mode dependent information */ | ||
600 | union { | ||
601 | uInt left; /* if STORED, bytes left to copy */ | ||
602 | struct { | ||
603 | uInt table; /* table lengths (14 bits) */ | ||
604 | uInt index; /* index into blens (or border) */ | ||
605 | uIntf *blens; /* bit lengths of codes */ | ||
606 | uInt bb; /* bit length tree depth */ | ||
607 | inflate_huft *tb; /* bit length decoding tree */ | ||
608 | int nblens; /* # elements allocated at blens */ | ||
609 | } trees; /* if DTREE, decoding info for trees */ | ||
610 | struct { | ||
611 | inflate_huft *tl, *td; /* trees to free */ | ||
612 | inflate_codes_statef | ||
613 | *codes; | ||
614 | } decode; /* if CODES, current state */ | ||
615 | } sub; /* submode */ | ||
616 | uInt last; /* true if this block is the last block */ | ||
617 | |||
618 | /* mode independent information */ | ||
619 | uInt bitk; /* bits in bit buffer */ | ||
620 | uLong bitb; /* bit buffer */ | ||
621 | Bytef *window; /* sliding window */ | ||
622 | Bytef *end; /* one byte after sliding window */ | ||
623 | Bytef *read; /* window read pointer */ | ||
624 | Bytef *write; /* window write pointer */ | ||
625 | check_func checkfn; /* check function */ | ||
626 | uLong check; /* check on output */ | ||
627 | |||
628 | }; | ||
629 | |||
630 | |||
631 | /* defines for inflate input/output */ | ||
632 | /* update pointers and return */ | ||
633 | #define UPDBITS {s->bitb=b;s->bitk=k;} | ||
634 | #define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;} | ||
635 | #define UPDOUT {s->write=q;} | ||
636 | #define UPDATE {UPDBITS UPDIN UPDOUT} | ||
637 | #define LEAVE {UPDATE return inflate_flush(s,z,r);} | ||
638 | /* get bytes and bits */ | ||
639 | #define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;} | ||
640 | #define NEEDBYTE {if(n)r=Z_OK;else LEAVE} | ||
641 | #define NEXTBYTE (n--,*p++) | ||
642 | #define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}} | ||
643 | #define DUMPBITS(j) {b>>=(j);k-=(j);} | ||
644 | /* output bytes */ | ||
645 | #define WAVAIL (q<s->read?s->read-q-1:s->end-q) | ||
646 | #define LOADOUT {q=s->write;m=WAVAIL;} | ||
647 | #define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=WAVAIL;}} | ||
648 | #define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT} | ||
649 | #define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;} | ||
650 | #define OUTBYTE(a) {*q++=(Byte)(a);m--;} | ||
651 | /* load local pointers */ | ||
652 | #define LOAD {LOADIN LOADOUT} | ||
653 | |||
654 | /* | ||
655 | * The IBM 150 firmware munges the data right after _etext[]. This | ||
656 | * protects it. -- Cort | ||
657 | */ | ||
658 | local uInt protect_mask[] = {0, 0, 0, 0, 0, 0, 0, 0, 0 ,0 ,0 ,0}; | ||
659 | /* And'ing with mask[n] masks the lower n bits */ | ||
660 | local uInt inflate_mask[] = { | ||
661 | 0x0000, | ||
662 | 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, | ||
663 | 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff | ||
664 | }; | ||
665 | |||
666 | /* copy as much as possible from the sliding window to the output area */ | ||
667 | local int inflate_flush OF(( | ||
668 | inflate_blocks_statef *, | ||
669 | z_stream *, | ||
670 | int)); | ||
671 | |||
672 | /*+++++*/ | ||
673 | /* inffast.h -- header to use inffast.c | ||
674 | * Copyright (C) 1995 Mark Adler | ||
675 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
676 | */ | ||
677 | |||
678 | /* WARNING: this file should *not* be used by applications. It is | ||
679 | part of the implementation of the compression library and is | ||
680 | subject to change. Applications should only use zlib.h. | ||
681 | */ | ||
682 | |||
683 | local int inflate_fast OF(( | ||
684 | uInt, | ||
685 | uInt, | ||
686 | inflate_huft *, | ||
687 | inflate_huft *, | ||
688 | inflate_blocks_statef *, | ||
689 | z_stream *)); | ||
690 | |||
691 | |||
692 | /*+++++*/ | ||
693 | /* infblock.c -- interpret and process block types to last block | ||
694 | * Copyright (C) 1995 Mark Adler | ||
695 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
696 | */ | ||
697 | |||
698 | /* Table for deflate from PKZIP's appnote.txt. */ | ||
699 | local uInt border[] = { /* Order of the bit length code lengths */ | ||
700 | 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; | ||
701 | |||
702 | /* | ||
703 | Notes beyond the 1.93a appnote.txt: | ||
704 | |||
705 | 1. Distance pointers never point before the beginning of the output | ||
706 | stream. | ||
707 | 2. Distance pointers can point back across blocks, up to 32k away. | ||
708 | 3. There is an implied maximum of 7 bits for the bit length table and | ||
709 | 15 bits for the actual data. | ||
710 | 4. If only one code exists, then it is encoded using one bit. (Zero | ||
711 | would be more efficient, but perhaps a little confusing.) If two | ||
712 | codes exist, they are coded using one bit each (0 and 1). | ||
713 | 5. There is no way of sending zero distance codes--a dummy must be | ||
714 | sent if there are none. (History: a pre 2.0 version of PKZIP would | ||
715 | store blocks with no distance codes, but this was discovered to be | ||
716 | too harsh a criterion.) Valid only for 1.93a. 2.04c does allow | ||
717 | zero distance codes, which is sent as one code of zero bits in | ||
718 | length. | ||
719 | 6. There are up to 286 literal/length codes. Code 256 represents the | ||
720 | end-of-block. Note however that the static length tree defines | ||
721 | 288 codes just to fill out the Huffman codes. Codes 286 and 287 | ||
722 | cannot be used though, since there is no length base or extra bits | ||
723 | defined for them. Similarily, there are up to 30 distance codes. | ||
724 | However, static trees define 32 codes (all 5 bits) to fill out the | ||
725 | Huffman codes, but the last two had better not show up in the data. | ||
726 | 7. Unzip can check dynamic Huffman blocks for complete code sets. | ||
727 | The exception is that a single code would not be complete (see #4). | ||
728 | 8. The five bits following the block type is really the number of | ||
729 | literal codes sent minus 257. | ||
730 | 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits | ||
731 | (1+6+6). Therefore, to output three times the length, you output | ||
732 | three codes (1+1+1), whereas to output four times the same length, | ||
733 | you only need two codes (1+3). Hmm. | ||
734 | 10. In the tree reconstruction algorithm, Code = Code + Increment | ||
735 | only if BitLength(i) is not zero. (Pretty obvious.) | ||
736 | 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19) | ||
737 | 12. Note: length code 284 can represent 227-258, but length code 285 | ||
738 | really is 258. The last length deserves its own, short code | ||
739 | since it gets used a lot in very redundant files. The length | ||
740 | 258 is special since 258 - 3 (the min match length) is 255. | ||
741 | 13. The literal/length and distance code bit lengths are read as a | ||
742 | single stream of lengths. It is possible (and advantageous) for | ||
743 | a repeat code (16, 17, or 18) to go across the boundary between | ||
744 | the two sets of lengths. | ||
745 | */ | ||
746 | |||
747 | |||
748 | local void inflate_blocks_reset(s, z, c) | ||
749 | inflate_blocks_statef *s; | ||
750 | z_stream *z; | ||
751 | uLongf *c; | ||
752 | { | ||
753 | if (s->checkfn != Z_NULL) | ||
754 | *c = s->check; | ||
755 | if (s->mode == BTREE || s->mode == DTREE) | ||
756 | ZFREE(z, s->sub.trees.blens, s->sub.trees.nblens * sizeof(uInt)); | ||
757 | if (s->mode == CODES) | ||
758 | { | ||
759 | inflate_codes_free(s->sub.decode.codes, z); | ||
760 | inflate_trees_free(s->sub.decode.td, z); | ||
761 | inflate_trees_free(s->sub.decode.tl, z); | ||
762 | } | ||
763 | s->mode = TYPE; | ||
764 | s->bitk = 0; | ||
765 | s->bitb = 0; | ||
766 | s->read = s->write = s->window; | ||
767 | if (s->checkfn != Z_NULL) | ||
768 | s->check = (*s->checkfn)(0L, Z_NULL, 0); | ||
769 | Trace((stderr, "inflate: blocks reset\n")); | ||
770 | } | ||
771 | |||
772 | |||
773 | local inflate_blocks_statef *inflate_blocks_new(z, c, w) | ||
774 | z_stream *z; | ||
775 | check_func c; | ||
776 | uInt w; | ||
777 | { | ||
778 | inflate_blocks_statef *s; | ||
779 | |||
780 | if ((s = (inflate_blocks_statef *)ZALLOC | ||
781 | (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL) | ||
782 | return s; | ||
783 | if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL) | ||
784 | { | ||
785 | ZFREE(z, s, sizeof(struct inflate_blocks_state)); | ||
786 | return Z_NULL; | ||
787 | } | ||
788 | s->end = s->window + w; | ||
789 | s->checkfn = c; | ||
790 | s->mode = TYPE; | ||
791 | Trace((stderr, "inflate: blocks allocated\n")); | ||
792 | inflate_blocks_reset(s, z, &s->check); | ||
793 | return s; | ||
794 | } | ||
795 | |||
796 | |||
797 | local int inflate_blocks(s, z, r) | ||
798 | inflate_blocks_statef *s; | ||
799 | z_stream *z; | ||
800 | int r; | ||
801 | { | ||
802 | uInt t; /* temporary storage */ | ||
803 | uLong b; /* bit buffer */ | ||
804 | uInt k; /* bits in bit buffer */ | ||
805 | Bytef *p; /* input data pointer */ | ||
806 | uInt n; /* bytes available there */ | ||
807 | Bytef *q; /* output window write pointer */ | ||
808 | uInt m; /* bytes to end of window or read pointer */ | ||
809 | |||
810 | /* copy input/output information to locals (UPDATE macro restores) */ | ||
811 | LOAD | ||
812 | |||
813 | /* process input based on current state */ | ||
814 | while (1) switch (s->mode) | ||
815 | { | ||
816 | case TYPE: | ||
817 | NEEDBITS(3) | ||
818 | t = (uInt)b & 7; | ||
819 | s->last = t & 1; | ||
820 | switch (t >> 1) | ||
821 | { | ||
822 | case 0: /* stored */ | ||
823 | Trace((stderr, "inflate: stored block%s\n", | ||
824 | s->last ? " (last)" : "")); | ||
825 | DUMPBITS(3) | ||
826 | t = k & 7; /* go to byte boundary */ | ||
827 | DUMPBITS(t) | ||
828 | s->mode = LENS; /* get length of stored block */ | ||
829 | break; | ||
830 | case 1: /* fixed */ | ||
831 | Trace((stderr, "inflate: fixed codes block%s\n", | ||
832 | s->last ? " (last)" : "")); | ||
833 | { | ||
834 | uInt bl, bd; | ||
835 | inflate_huft *tl, *td; | ||
836 | |||
837 | inflate_trees_fixed(&bl, &bd, &tl, &td); | ||
838 | s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z); | ||
839 | if (s->sub.decode.codes == Z_NULL) | ||
840 | { | ||
841 | r = Z_MEM_ERROR; | ||
842 | LEAVE | ||
843 | } | ||
844 | s->sub.decode.tl = Z_NULL; /* don't try to free these */ | ||
845 | s->sub.decode.td = Z_NULL; | ||
846 | } | ||
847 | DUMPBITS(3) | ||
848 | s->mode = CODES; | ||
849 | break; | ||
850 | case 2: /* dynamic */ | ||
851 | Trace((stderr, "inflate: dynamic codes block%s\n", | ||
852 | s->last ? " (last)" : "")); | ||
853 | DUMPBITS(3) | ||
854 | s->mode = TABLE; | ||
855 | break; | ||
856 | case 3: /* illegal */ | ||
857 | DUMPBITS(3) | ||
858 | s->mode = BADB; | ||
859 | z->msg = "invalid block type"; | ||
860 | r = Z_DATA_ERROR; | ||
861 | LEAVE | ||
862 | } | ||
863 | break; | ||
864 | case LENS: | ||
865 | NEEDBITS(32) | ||
866 | if (((~b) >> 16) != (b & 0xffff)) | ||
867 | { | ||
868 | s->mode = BADB; | ||
869 | z->msg = "invalid stored block lengths"; | ||
870 | r = Z_DATA_ERROR; | ||
871 | LEAVE | ||
872 | } | ||
873 | s->sub.left = (uInt)b & 0xffff; | ||
874 | b = k = 0; /* dump bits */ | ||
875 | Tracev((stderr, "inflate: stored length %u\n", s->sub.left)); | ||
876 | s->mode = s->sub.left ? STORED : TYPE; | ||
877 | break; | ||
878 | case STORED: | ||
879 | if (n == 0) | ||
880 | LEAVE | ||
881 | NEEDOUT | ||
882 | t = s->sub.left; | ||
883 | if (t > n) t = n; | ||
884 | if (t > m) t = m; | ||
885 | zmemcpy(q, p, t); | ||
886 | p += t; n -= t; | ||
887 | q += t; m -= t; | ||
888 | if ((s->sub.left -= t) != 0) | ||
889 | break; | ||
890 | Tracev((stderr, "inflate: stored end, %lu total out\n", | ||
891 | z->total_out + (q >= s->read ? q - s->read : | ||
892 | (s->end - s->read) + (q - s->window)))); | ||
893 | s->mode = s->last ? DRY : TYPE; | ||
894 | break; | ||
895 | case TABLE: | ||
896 | NEEDBITS(14) | ||
897 | s->sub.trees.table = t = (uInt)b & 0x3fff; | ||
898 | #ifndef PKZIP_BUG_WORKAROUND | ||
899 | if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29) | ||
900 | { | ||
901 | s->mode = BADB; | ||
902 | z->msg = "too many length or distance symbols"; | ||
903 | r = Z_DATA_ERROR; | ||
904 | LEAVE | ||
905 | } | ||
906 | #endif | ||
907 | t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f); | ||
908 | if (t < 19) | ||
909 | t = 19; | ||
910 | if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL) | ||
911 | { | ||
912 | r = Z_MEM_ERROR; | ||
913 | LEAVE | ||
914 | } | ||
915 | s->sub.trees.nblens = t; | ||
916 | DUMPBITS(14) | ||
917 | s->sub.trees.index = 0; | ||
918 | Tracev((stderr, "inflate: table sizes ok\n")); | ||
919 | s->mode = BTREE; | ||
920 | case BTREE: | ||
921 | while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10)) | ||
922 | { | ||
923 | NEEDBITS(3) | ||
924 | s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7; | ||
925 | DUMPBITS(3) | ||
926 | } | ||
927 | while (s->sub.trees.index < 19) | ||
928 | s->sub.trees.blens[border[s->sub.trees.index++]] = 0; | ||
929 | s->sub.trees.bb = 7; | ||
930 | t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb, | ||
931 | &s->sub.trees.tb, z); | ||
932 | if (t != Z_OK) | ||
933 | { | ||
934 | r = t; | ||
935 | if (r == Z_DATA_ERROR) | ||
936 | s->mode = BADB; | ||
937 | LEAVE | ||
938 | } | ||
939 | s->sub.trees.index = 0; | ||
940 | Tracev((stderr, "inflate: bits tree ok\n")); | ||
941 | s->mode = DTREE; | ||
942 | case DTREE: | ||
943 | while (t = s->sub.trees.table, | ||
944 | s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f)) | ||
945 | { | ||
946 | inflate_huft *h; | ||
947 | uInt i, j, c; | ||
948 | |||
949 | t = s->sub.trees.bb; | ||
950 | NEEDBITS(t) | ||
951 | h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]); | ||
952 | t = h->word.what.Bits; | ||
953 | c = h->more.Base; | ||
954 | if (c < 16) | ||
955 | { | ||
956 | DUMPBITS(t) | ||
957 | s->sub.trees.blens[s->sub.trees.index++] = c; | ||
958 | } | ||
959 | else /* c == 16..18 */ | ||
960 | { | ||
961 | i = c == 18 ? 7 : c - 14; | ||
962 | j = c == 18 ? 11 : 3; | ||
963 | NEEDBITS(t + i) | ||
964 | DUMPBITS(t) | ||
965 | j += (uInt)b & inflate_mask[i]; | ||
966 | DUMPBITS(i) | ||
967 | i = s->sub.trees.index; | ||
968 | t = s->sub.trees.table; | ||
969 | if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) || | ||
970 | (c == 16 && i < 1)) | ||
971 | { | ||
972 | s->mode = BADB; | ||
973 | z->msg = "invalid bit length repeat"; | ||
974 | r = Z_DATA_ERROR; | ||
975 | LEAVE | ||
976 | } | ||
977 | c = c == 16 ? s->sub.trees.blens[i - 1] : 0; | ||
978 | do { | ||
979 | s->sub.trees.blens[i++] = c; | ||
980 | } while (--j); | ||
981 | s->sub.trees.index = i; | ||
982 | } | ||
983 | } | ||
984 | inflate_trees_free(s->sub.trees.tb, z); | ||
985 | s->sub.trees.tb = Z_NULL; | ||
986 | { | ||
987 | uInt bl, bd; | ||
988 | inflate_huft *tl, *td; | ||
989 | inflate_codes_statef *c; | ||
990 | |||
991 | bl = 9; /* must be <= 9 for lookahead assumptions */ | ||
992 | bd = 6; /* must be <= 9 for lookahead assumptions */ | ||
993 | t = s->sub.trees.table; | ||
994 | t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), | ||
995 | s->sub.trees.blens, &bl, &bd, &tl, &td, z); | ||
996 | if (t != Z_OK) | ||
997 | { | ||
998 | if (t == (uInt)Z_DATA_ERROR) | ||
999 | s->mode = BADB; | ||
1000 | r = t; | ||
1001 | LEAVE | ||
1002 | } | ||
1003 | Tracev((stderr, "inflate: trees ok\n")); | ||
1004 | if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL) | ||
1005 | { | ||
1006 | inflate_trees_free(td, z); | ||
1007 | inflate_trees_free(tl, z); | ||
1008 | r = Z_MEM_ERROR; | ||
1009 | LEAVE | ||
1010 | } | ||
1011 | ZFREE(z, s->sub.trees.blens, s->sub.trees.nblens * sizeof(uInt)); | ||
1012 | s->sub.decode.codes = c; | ||
1013 | s->sub.decode.tl = tl; | ||
1014 | s->sub.decode.td = td; | ||
1015 | } | ||
1016 | s->mode = CODES; | ||
1017 | case CODES: | ||
1018 | UPDATE | ||
1019 | if ((r = inflate_codes(s, z, r)) != Z_STREAM_END) | ||
1020 | return inflate_flush(s, z, r); | ||
1021 | r = Z_OK; | ||
1022 | inflate_codes_free(s->sub.decode.codes, z); | ||
1023 | inflate_trees_free(s->sub.decode.td, z); | ||
1024 | inflate_trees_free(s->sub.decode.tl, z); | ||
1025 | LOAD | ||
1026 | Tracev((stderr, "inflate: codes end, %lu total out\n", | ||
1027 | z->total_out + (q >= s->read ? q - s->read : | ||
1028 | (s->end - s->read) + (q - s->window)))); | ||
1029 | if (!s->last) | ||
1030 | { | ||
1031 | s->mode = TYPE; | ||
1032 | break; | ||
1033 | } | ||
1034 | if (k > 7) /* return unused byte, if any */ | ||
1035 | { | ||
1036 | Assert(k < 16, "inflate_codes grabbed too many bytes") | ||
1037 | k -= 8; | ||
1038 | n++; | ||
1039 | p--; /* can always return one */ | ||
1040 | } | ||
1041 | s->mode = DRY; | ||
1042 | case DRY: | ||
1043 | FLUSH | ||
1044 | if (s->read != s->write) | ||
1045 | LEAVE | ||
1046 | s->mode = DONEB; | ||
1047 | case DONEB: | ||
1048 | r = Z_STREAM_END; | ||
1049 | LEAVE | ||
1050 | case BADB: | ||
1051 | r = Z_DATA_ERROR; | ||
1052 | LEAVE | ||
1053 | default: | ||
1054 | r = Z_STREAM_ERROR; | ||
1055 | LEAVE | ||
1056 | } | ||
1057 | } | ||
1058 | |||
1059 | |||
1060 | local int inflate_blocks_free(s, z, c) | ||
1061 | inflate_blocks_statef *s; | ||
1062 | z_stream *z; | ||
1063 | uLongf *c; | ||
1064 | { | ||
1065 | inflate_blocks_reset(s, z, c); | ||
1066 | ZFREE(z, s->window, s->end - s->window); | ||
1067 | ZFREE(z, s, sizeof(struct inflate_blocks_state)); | ||
1068 | Trace((stderr, "inflate: blocks freed\n")); | ||
1069 | return Z_OK; | ||
1070 | } | ||
1071 | |||
1072 | /* | ||
1073 | * This subroutine adds the data at next_in/avail_in to the output history | ||
1074 | * without performing any output. The output buffer must be "caught up"; | ||
1075 | * i.e. no pending output (hence s->read equals s->write), and the state must | ||
1076 | * be BLOCKS (i.e. we should be willing to see the start of a series of | ||
1077 | * BLOCKS). On exit, the output will also be caught up, and the checksum | ||
1078 | * will have been updated if need be. | ||
1079 | */ | ||
1080 | local int inflate_addhistory(s, z) | ||
1081 | inflate_blocks_statef *s; | ||
1082 | z_stream *z; | ||
1083 | { | ||
1084 | uLong b; /* bit buffer */ /* NOT USED HERE */ | ||
1085 | uInt k; /* bits in bit buffer */ /* NOT USED HERE */ | ||
1086 | uInt t; /* temporary storage */ | ||
1087 | Bytef *p; /* input data pointer */ | ||
1088 | uInt n; /* bytes available there */ | ||
1089 | Bytef *q; /* output window write pointer */ | ||
1090 | uInt m; /* bytes to end of window or read pointer */ | ||
1091 | |||
1092 | if (s->read != s->write) | ||
1093 | return Z_STREAM_ERROR; | ||
1094 | if (s->mode != TYPE) | ||
1095 | return Z_DATA_ERROR; | ||
1096 | |||
1097 | /* we're ready to rock */ | ||
1098 | LOAD | ||
1099 | /* while there is input ready, copy to output buffer, moving | ||
1100 | * pointers as needed. | ||
1101 | */ | ||
1102 | while (n) { | ||
1103 | t = n; /* how many to do */ | ||
1104 | /* is there room until end of buffer? */ | ||
1105 | if (t > m) t = m; | ||
1106 | /* update check information */ | ||
1107 | if (s->checkfn != Z_NULL) | ||
1108 | s->check = (*s->checkfn)(s->check, q, t); | ||
1109 | zmemcpy(q, p, t); | ||
1110 | q += t; | ||
1111 | p += t; | ||
1112 | n -= t; | ||
1113 | z->total_out += t; | ||
1114 | s->read = q; /* drag read pointer forward */ | ||
1115 | /* WRAP */ /* expand WRAP macro by hand to handle s->read */ | ||
1116 | if (q == s->end) { | ||
1117 | s->read = q = s->window; | ||
1118 | m = WAVAIL; | ||
1119 | } | ||
1120 | } | ||
1121 | UPDATE | ||
1122 | return Z_OK; | ||
1123 | } | ||
1124 | |||
1125 | |||
1126 | /* | ||
1127 | * At the end of a Deflate-compressed PPP packet, we expect to have seen | ||
1128 | * a `stored' block type value but not the (zero) length bytes. | ||
1129 | */ | ||
1130 | local int inflate_packet_flush(s) | ||
1131 | inflate_blocks_statef *s; | ||
1132 | { | ||
1133 | if (s->mode != LENS) | ||
1134 | return Z_DATA_ERROR; | ||
1135 | s->mode = TYPE; | ||
1136 | return Z_OK; | ||
1137 | } | ||
1138 | |||
1139 | |||
1140 | /*+++++*/ | ||
1141 | /* inftrees.c -- generate Huffman trees for efficient decoding | ||
1142 | * Copyright (C) 1995 Mark Adler | ||
1143 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
1144 | */ | ||
1145 | |||
1146 | /* simplify the use of the inflate_huft type with some defines */ | ||
1147 | #define base more.Base | ||
1148 | #define next more.Next | ||
1149 | #define exop word.what.Exop | ||
1150 | #define bits word.what.Bits | ||
1151 | |||
1152 | |||
1153 | local int huft_build OF(( | ||
1154 | uIntf *, /* code lengths in bits */ | ||
1155 | uInt, /* number of codes */ | ||
1156 | uInt, /* number of "simple" codes */ | ||
1157 | uIntf *, /* list of base values for non-simple codes */ | ||
1158 | uIntf *, /* list of extra bits for non-simple codes */ | ||
1159 | inflate_huft * FAR*,/* result: starting table */ | ||
1160 | uIntf *, /* maximum lookup bits (returns actual) */ | ||
1161 | z_stream *)); /* for zalloc function */ | ||
1162 | |||
1163 | local voidpf falloc OF(( | ||
1164 | voidpf, /* opaque pointer (not used) */ | ||
1165 | uInt, /* number of items */ | ||
1166 | uInt)); /* size of item */ | ||
1167 | |||
1168 | local void ffree OF(( | ||
1169 | voidpf q, /* opaque pointer (not used) */ | ||
1170 | voidpf p, /* what to free (not used) */ | ||
1171 | uInt n)); /* number of bytes (not used) */ | ||
1172 | |||
1173 | /* Tables for deflate from PKZIP's appnote.txt. */ | ||
1174 | local uInt cplens[] = { /* Copy lengths for literal codes 257..285 */ | ||
1175 | 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, | ||
1176 | 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; | ||
1177 | /* actually lengths - 2; also see note #13 above about 258 */ | ||
1178 | local uInt cplext[] = { /* Extra bits for literal codes 257..285 */ | ||
1179 | 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, | ||
1180 | 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 192, 192}; /* 192==invalid */ | ||
1181 | local uInt cpdist[] = { /* Copy offsets for distance codes 0..29 */ | ||
1182 | 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, | ||
1183 | 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, | ||
1184 | 8193, 12289, 16385, 24577}; | ||
1185 | local uInt cpdext[] = { /* Extra bits for distance codes */ | ||
1186 | 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, | ||
1187 | 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, | ||
1188 | 12, 12, 13, 13}; | ||
1189 | |||
1190 | /* | ||
1191 | Huffman code decoding is performed using a multi-level table lookup. | ||
1192 | The fastest way to decode is to simply build a lookup table whose | ||
1193 | size is determined by the longest code. However, the time it takes | ||
1194 | to build this table can also be a factor if the data being decoded | ||
1195 | is not very long. The most common codes are necessarily the | ||
1196 | shortest codes, so those codes dominate the decoding time, and hence | ||
1197 | the speed. The idea is you can have a shorter table that decodes the | ||
1198 | shorter, more probable codes, and then point to subsidiary tables for | ||
1199 | the longer codes. The time it costs to decode the longer codes is | ||
1200 | then traded against the time it takes to make longer tables. | ||
1201 | |||
1202 | This results of this trade are in the variables lbits and dbits | ||
1203 | below. lbits is the number of bits the first level table for literal/ | ||
1204 | length codes can decode in one step, and dbits is the same thing for | ||
1205 | the distance codes. Subsequent tables are also less than or equal to | ||
1206 | those sizes. These values may be adjusted either when all of the | ||
1207 | codes are shorter than that, in which case the longest code length in | ||
1208 | bits is used, or when the shortest code is *longer* than the requested | ||
1209 | table size, in which case the length of the shortest code in bits is | ||
1210 | used. | ||
1211 | |||
1212 | There are two different values for the two tables, since they code a | ||
1213 | different number of possibilities each. The literal/length table | ||
1214 | codes 286 possible values, or in a flat code, a little over eight | ||
1215 | bits. The distance table codes 30 possible values, or a little less | ||
1216 | than five bits, flat. The optimum values for speed end up being | ||
1217 | about one bit more than those, so lbits is 8+1 and dbits is 5+1. | ||
1218 | The optimum values may differ though from machine to machine, and | ||
1219 | possibly even between compilers. Your mileage may vary. | ||
1220 | */ | ||
1221 | |||
1222 | |||
1223 | /* If BMAX needs to be larger than 16, then h and x[] should be uLong. */ | ||
1224 | #define BMAX 15 /* maximum bit length of any code */ | ||
1225 | #define N_MAX 288 /* maximum number of codes in any set */ | ||
1226 | |||
1227 | #ifdef DEBUG_ZLIB | ||
1228 | uInt inflate_hufts; | ||
1229 | #endif | ||
1230 | |||
1231 | local int huft_build(b, n, s, d, e, t, m, zs) | ||
1232 | uIntf *b; /* code lengths in bits (all assumed <= BMAX) */ | ||
1233 | uInt n; /* number of codes (assumed <= N_MAX) */ | ||
1234 | uInt s; /* number of simple-valued codes (0..s-1) */ | ||
1235 | uIntf *d; /* list of base values for non-simple codes */ | ||
1236 | uIntf *e; /* list of extra bits for non-simple codes */ | ||
1237 | inflate_huft * FAR *t; /* result: starting table */ | ||
1238 | uIntf *m; /* maximum lookup bits, returns actual */ | ||
1239 | z_stream *zs; /* for zalloc function */ | ||
1240 | /* Given a list of code lengths and a maximum table size, make a set of | ||
1241 | tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR | ||
1242 | if the given code set is incomplete (the tables are still built in this | ||
1243 | case), Z_DATA_ERROR if the input is invalid (all zero length codes or an | ||
1244 | over-subscribed set of lengths), or Z_MEM_ERROR if not enough memory. */ | ||
1245 | { | ||
1246 | |||
1247 | uInt a; /* counter for codes of length k */ | ||
1248 | uInt c[BMAX+1]; /* bit length count table */ | ||
1249 | uInt f; /* i repeats in table every f entries */ | ||
1250 | int g; /* maximum code length */ | ||
1251 | int h; /* table level */ | ||
1252 | register uInt i; /* counter, current code */ | ||
1253 | register uInt j; /* counter */ | ||
1254 | register int k; /* number of bits in current code */ | ||
1255 | int l; /* bits per table (returned in m) */ | ||
1256 | register uIntf *p; /* pointer into c[], b[], or v[] */ | ||
1257 | inflate_huft *q; /* points to current table */ | ||
1258 | struct inflate_huft_s r; /* table entry for structure assignment */ | ||
1259 | inflate_huft *u[BMAX]; /* table stack */ | ||
1260 | uInt v[N_MAX]; /* values in order of bit length */ | ||
1261 | register int w; /* bits before this table == (l * h) */ | ||
1262 | uInt x[BMAX+1]; /* bit offsets, then code stack */ | ||
1263 | uIntf *xp; /* pointer into x */ | ||
1264 | int y; /* number of dummy codes added */ | ||
1265 | uInt z; /* number of entries in current table */ | ||
1266 | |||
1267 | |||
1268 | /* Generate counts for each bit length */ | ||
1269 | p = c; | ||
1270 | #define C0 *p++ = 0; | ||
1271 | #define C2 C0 C0 C0 C0 | ||
1272 | #define C4 C2 C2 C2 C2 | ||
1273 | C4 /* clear c[]--assume BMAX+1 is 16 */ | ||
1274 | p = b; i = n; | ||
1275 | do { | ||
1276 | c[*p++]++; /* assume all entries <= BMAX */ | ||
1277 | } while (--i); | ||
1278 | if (c[0] == n) /* null input--all zero length codes */ | ||
1279 | { | ||
1280 | *t = (inflate_huft *)Z_NULL; | ||
1281 | *m = 0; | ||
1282 | return Z_OK; | ||
1283 | } | ||
1284 | |||
1285 | |||
1286 | /* Find minimum and maximum length, bound *m by those */ | ||
1287 | l = *m; | ||
1288 | for (j = 1; j <= BMAX; j++) | ||
1289 | if (c[j]) | ||
1290 | break; | ||
1291 | k = j; /* minimum code length */ | ||
1292 | if ((uInt)l < j) | ||
1293 | l = j; | ||
1294 | for (i = BMAX; i; i--) | ||
1295 | if (c[i]) | ||
1296 | break; | ||
1297 | g = i; /* maximum code length */ | ||
1298 | if ((uInt)l > i) | ||
1299 | l = i; | ||
1300 | *m = l; | ||
1301 | |||
1302 | |||
1303 | /* Adjust last length count to fill out codes, if needed */ | ||
1304 | for (y = 1 << j; j < i; j++, y <<= 1) | ||
1305 | if ((y -= c[j]) < 0) | ||
1306 | return Z_DATA_ERROR; | ||
1307 | if ((y -= c[i]) < 0) | ||
1308 | return Z_DATA_ERROR; | ||
1309 | c[i] += y; | ||
1310 | |||
1311 | |||
1312 | /* Generate starting offsets into the value table for each length */ | ||
1313 | x[1] = j = 0; | ||
1314 | p = c + 1; xp = x + 2; | ||
1315 | while (--i) { /* note that i == g from above */ | ||
1316 | *xp++ = (j += *p++); | ||
1317 | } | ||
1318 | |||
1319 | |||
1320 | /* Make a table of values in order of bit lengths */ | ||
1321 | p = b; i = 0; | ||
1322 | do { | ||
1323 | if ((j = *p++) != 0) | ||
1324 | v[x[j]++] = i; | ||
1325 | } while (++i < n); | ||
1326 | |||
1327 | |||
1328 | /* Generate the Huffman codes and for each, make the table entries */ | ||
1329 | x[0] = i = 0; /* first Huffman code is zero */ | ||
1330 | p = v; /* grab values in bit order */ | ||
1331 | h = -1; /* no tables yet--level -1 */ | ||
1332 | w = -l; /* bits decoded == (l * h) */ | ||
1333 | u[0] = (inflate_huft *)Z_NULL; /* just to keep compilers happy */ | ||
1334 | q = (inflate_huft *)Z_NULL; /* ditto */ | ||
1335 | z = 0; /* ditto */ | ||
1336 | |||
1337 | /* go through the bit lengths (k already is bits in shortest code) */ | ||
1338 | for (; k <= g; k++) | ||
1339 | { | ||
1340 | a = c[k]; | ||
1341 | while (a--) | ||
1342 | { | ||
1343 | /* here i is the Huffman code of length k bits for value *p */ | ||
1344 | /* make tables up to required level */ | ||
1345 | while (k > w + l) | ||
1346 | { | ||
1347 | h++; | ||
1348 | w += l; /* previous table always l bits */ | ||
1349 | |||
1350 | /* compute minimum size table less than or equal to l bits */ | ||
1351 | z = (z = g - w) > (uInt)l ? l : z; /* table size upper limit */ | ||
1352 | if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ | ||
1353 | { /* too few codes for k-w bit table */ | ||
1354 | f -= a + 1; /* deduct codes from patterns left */ | ||
1355 | xp = c + k; | ||
1356 | if (j < z) | ||
1357 | while (++j < z) /* try smaller tables up to z bits */ | ||
1358 | { | ||
1359 | if ((f <<= 1) <= *++xp) | ||
1360 | break; /* enough codes to use up j bits */ | ||
1361 | f -= *xp; /* else deduct codes from patterns */ | ||
1362 | } | ||
1363 | } | ||
1364 | z = 1 << j; /* table entries for j-bit table */ | ||
1365 | |||
1366 | /* allocate and link in new table */ | ||
1367 | if ((q = (inflate_huft *)ZALLOC | ||
1368 | (zs,z + 1,sizeof(inflate_huft))) == Z_NULL) | ||
1369 | { | ||
1370 | if (h) | ||
1371 | inflate_trees_free(u[0], zs); | ||
1372 | return Z_MEM_ERROR; /* not enough memory */ | ||
1373 | } | ||
1374 | q->word.Nalloc = z + 1; | ||
1375 | #ifdef DEBUG_ZLIB | ||
1376 | inflate_hufts += z + 1; | ||
1377 | #endif | ||
1378 | *t = q + 1; /* link to list for huft_free() */ | ||
1379 | *(t = &(q->next)) = Z_NULL; | ||
1380 | u[h] = ++q; /* table starts after link */ | ||
1381 | |||
1382 | /* connect to last table, if there is one */ | ||
1383 | if (h) | ||
1384 | { | ||
1385 | x[h] = i; /* save pattern for backing up */ | ||
1386 | r.bits = (Byte)l; /* bits to dump before this table */ | ||
1387 | r.exop = (Byte)j; /* bits in this table */ | ||
1388 | r.next = q; /* pointer to this table */ | ||
1389 | j = i >> (w - l); /* (get around Turbo C bug) */ | ||
1390 | u[h-1][j] = r; /* connect to last table */ | ||
1391 | } | ||
1392 | } | ||
1393 | |||
1394 | /* set up table entry in r */ | ||
1395 | r.bits = (Byte)(k - w); | ||
1396 | if (p >= v + n) | ||
1397 | r.exop = 128 + 64; /* out of values--invalid code */ | ||
1398 | else if (*p < s) | ||
1399 | { | ||
1400 | r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */ | ||
1401 | r.base = *p++; /* simple code is just the value */ | ||
1402 | } | ||
1403 | else | ||
1404 | { | ||
1405 | r.exop = (Byte)e[*p - s] + 16 + 64; /* non-simple--look up in lists */ | ||
1406 | r.base = d[*p++ - s]; | ||
1407 | } | ||
1408 | |||
1409 | /* fill code-like entries with r */ | ||
1410 | f = 1 << (k - w); | ||
1411 | for (j = i >> w; j < z; j += f) | ||
1412 | q[j] = r; | ||
1413 | |||
1414 | /* backwards increment the k-bit code i */ | ||
1415 | for (j = 1 << (k - 1); i & j; j >>= 1) | ||
1416 | i ^= j; | ||
1417 | i ^= j; | ||
1418 | |||
1419 | /* backup over finished tables */ | ||
1420 | while ((i & ((1 << w) - 1)) != x[h]) | ||
1421 | { | ||
1422 | h--; /* don't need to update q */ | ||
1423 | w -= l; | ||
1424 | } | ||
1425 | } | ||
1426 | } | ||
1427 | |||
1428 | |||
1429 | /* Return Z_BUF_ERROR if we were given an incomplete table */ | ||
1430 | return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK; | ||
1431 | } | ||
1432 | |||
1433 | |||
1434 | local int inflate_trees_bits(c, bb, tb, z) | ||
1435 | uIntf *c; /* 19 code lengths */ | ||
1436 | uIntf *bb; /* bits tree desired/actual depth */ | ||
1437 | inflate_huft * FAR *tb; /* bits tree result */ | ||
1438 | z_stream *z; /* for zfree function */ | ||
1439 | { | ||
1440 | int r; | ||
1441 | |||
1442 | r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL, tb, bb, z); | ||
1443 | if (r == Z_DATA_ERROR) | ||
1444 | z->msg = "oversubscribed dynamic bit lengths tree"; | ||
1445 | else if (r == Z_BUF_ERROR) | ||
1446 | { | ||
1447 | inflate_trees_free(*tb, z); | ||
1448 | z->msg = "incomplete dynamic bit lengths tree"; | ||
1449 | r = Z_DATA_ERROR; | ||
1450 | } | ||
1451 | return r; | ||
1452 | } | ||
1453 | |||
1454 | |||
1455 | local int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, z) | ||
1456 | uInt nl; /* number of literal/length codes */ | ||
1457 | uInt nd; /* number of distance codes */ | ||
1458 | uIntf *c; /* that many (total) code lengths */ | ||
1459 | uIntf *bl; /* literal desired/actual bit depth */ | ||
1460 | uIntf *bd; /* distance desired/actual bit depth */ | ||
1461 | inflate_huft * FAR *tl; /* literal/length tree result */ | ||
1462 | inflate_huft * FAR *td; /* distance tree result */ | ||
1463 | z_stream *z; /* for zfree function */ | ||
1464 | { | ||
1465 | int r; | ||
1466 | |||
1467 | /* build literal/length tree */ | ||
1468 | if ((r = huft_build(c, nl, 257, cplens, cplext, tl, bl, z)) != Z_OK) | ||
1469 | { | ||
1470 | if (r == Z_DATA_ERROR) | ||
1471 | z->msg = "oversubscribed literal/length tree"; | ||
1472 | else if (r == Z_BUF_ERROR) | ||
1473 | { | ||
1474 | inflate_trees_free(*tl, z); | ||
1475 | z->msg = "incomplete literal/length tree"; | ||
1476 | r = Z_DATA_ERROR; | ||
1477 | } | ||
1478 | return r; | ||
1479 | } | ||
1480 | |||
1481 | /* build distance tree */ | ||
1482 | if ((r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, z)) != Z_OK) | ||
1483 | { | ||
1484 | if (r == Z_DATA_ERROR) | ||
1485 | z->msg = "oversubscribed literal/length tree"; | ||
1486 | else if (r == Z_BUF_ERROR) { | ||
1487 | #ifdef PKZIP_BUG_WORKAROUND | ||
1488 | r = Z_OK; | ||
1489 | } | ||
1490 | #else | ||
1491 | inflate_trees_free(*td, z); | ||
1492 | z->msg = "incomplete literal/length tree"; | ||
1493 | r = Z_DATA_ERROR; | ||
1494 | } | ||
1495 | inflate_trees_free(*tl, z); | ||
1496 | return r; | ||
1497 | #endif | ||
1498 | } | ||
1499 | |||
1500 | /* done */ | ||
1501 | return Z_OK; | ||
1502 | } | ||
1503 | |||
1504 | |||
1505 | /* build fixed tables only once--keep them here */ | ||
1506 | local int fixed_lock = 0; | ||
1507 | local int fixed_built = 0; | ||
1508 | #define FIXEDH 530 /* number of hufts used by fixed tables */ | ||
1509 | local uInt fixed_left = FIXEDH; | ||
1510 | local inflate_huft fixed_mem[FIXEDH]; | ||
1511 | local uInt fixed_bl; | ||
1512 | local uInt fixed_bd; | ||
1513 | local inflate_huft *fixed_tl; | ||
1514 | local inflate_huft *fixed_td; | ||
1515 | |||
1516 | |||
1517 | local voidpf falloc(q, n, s) | ||
1518 | voidpf q; /* opaque pointer (not used) */ | ||
1519 | uInt n; /* number of items */ | ||
1520 | uInt s; /* size of item */ | ||
1521 | { | ||
1522 | Assert(s == sizeof(inflate_huft) && n <= fixed_left, | ||
1523 | "inflate_trees falloc overflow"); | ||
1524 | if (q) s++; /* to make some compilers happy */ | ||
1525 | fixed_left -= n; | ||
1526 | return (voidpf)(fixed_mem + fixed_left); | ||
1527 | } | ||
1528 | |||
1529 | |||
1530 | local void ffree(q, p, n) | ||
1531 | voidpf q; | ||
1532 | voidpf p; | ||
1533 | uInt n; | ||
1534 | { | ||
1535 | Assert(0, "inflate_trees ffree called!"); | ||
1536 | if (q) q = p; /* to make some compilers happy */ | ||
1537 | } | ||
1538 | |||
1539 | |||
1540 | local int inflate_trees_fixed(bl, bd, tl, td) | ||
1541 | uIntf *bl; /* literal desired/actual bit depth */ | ||
1542 | uIntf *bd; /* distance desired/actual bit depth */ | ||
1543 | inflate_huft * FAR *tl; /* literal/length tree result */ | ||
1544 | inflate_huft * FAR *td; /* distance tree result */ | ||
1545 | { | ||
1546 | /* build fixed tables if not built already--lock out other instances */ | ||
1547 | while (++fixed_lock > 1) | ||
1548 | fixed_lock--; | ||
1549 | if (!fixed_built) | ||
1550 | { | ||
1551 | int k; /* temporary variable */ | ||
1552 | unsigned c[288]; /* length list for huft_build */ | ||
1553 | z_stream z; /* for falloc function */ | ||
1554 | |||
1555 | /* set up fake z_stream for memory routines */ | ||
1556 | z.zalloc = falloc; | ||
1557 | z.zfree = ffree; | ||
1558 | z.opaque = Z_NULL; | ||
1559 | |||
1560 | /* literal table */ | ||
1561 | for (k = 0; k < 144; k++) | ||
1562 | c[k] = 8; | ||
1563 | for (; k < 256; k++) | ||
1564 | c[k] = 9; | ||
1565 | for (; k < 280; k++) | ||
1566 | c[k] = 7; | ||
1567 | for (; k < 288; k++) | ||
1568 | c[k] = 8; | ||
1569 | fixed_bl = 7; | ||
1570 | huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl, &z); | ||
1571 | |||
1572 | /* distance table */ | ||
1573 | for (k = 0; k < 30; k++) | ||
1574 | c[k] = 5; | ||
1575 | fixed_bd = 5; | ||
1576 | huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd, &z); | ||
1577 | |||
1578 | /* done */ | ||
1579 | fixed_built = 1; | ||
1580 | } | ||
1581 | fixed_lock--; | ||
1582 | *bl = fixed_bl; | ||
1583 | *bd = fixed_bd; | ||
1584 | *tl = fixed_tl; | ||
1585 | *td = fixed_td; | ||
1586 | return Z_OK; | ||
1587 | } | ||
1588 | |||
1589 | |||
1590 | local int inflate_trees_free(t, z) | ||
1591 | inflate_huft *t; /* table to free */ | ||
1592 | z_stream *z; /* for zfree function */ | ||
1593 | /* Free the malloc'ed tables built by huft_build(), which makes a linked | ||
1594 | list of the tables it made, with the links in a dummy first entry of | ||
1595 | each table. */ | ||
1596 | { | ||
1597 | register inflate_huft *p, *q; | ||
1598 | |||
1599 | /* Go through linked list, freeing from the malloced (t[-1]) address. */ | ||
1600 | p = t; | ||
1601 | while (p != Z_NULL) | ||
1602 | { | ||
1603 | q = (--p)->next; | ||
1604 | ZFREE(z, p, p->word.Nalloc * sizeof(inflate_huft)); | ||
1605 | p = q; | ||
1606 | } | ||
1607 | return Z_OK; | ||
1608 | } | ||
1609 | |||
1610 | /*+++++*/ | ||
1611 | /* infcodes.c -- process literals and length/distance pairs | ||
1612 | * Copyright (C) 1995 Mark Adler | ||
1613 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
1614 | */ | ||
1615 | |||
1616 | /* simplify the use of the inflate_huft type with some defines */ | ||
1617 | #define base more.Base | ||
1618 | #define next more.Next | ||
1619 | #define exop word.what.Exop | ||
1620 | #define bits word.what.Bits | ||
1621 | |||
1622 | /* inflate codes private state */ | ||
1623 | struct inflate_codes_state { | ||
1624 | |||
1625 | /* mode */ | ||
1626 | enum { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */ | ||
1627 | START, /* x: set up for LEN */ | ||
1628 | LEN, /* i: get length/literal/eob next */ | ||
1629 | LENEXT, /* i: getting length extra (have base) */ | ||
1630 | DIST, /* i: get distance next */ | ||
1631 | DISTEXT, /* i: getting distance extra */ | ||
1632 | COPY, /* o: copying bytes in window, waiting for space */ | ||
1633 | LIT, /* o: got literal, waiting for output space */ | ||
1634 | WASH, /* o: got eob, possibly still output waiting */ | ||
1635 | END, /* x: got eob and all data flushed */ | ||
1636 | BADCODE} /* x: got error */ | ||
1637 | mode; /* current inflate_codes mode */ | ||
1638 | |||
1639 | /* mode dependent information */ | ||
1640 | uInt len; | ||
1641 | union { | ||
1642 | struct { | ||
1643 | inflate_huft *tree; /* pointer into tree */ | ||
1644 | uInt need; /* bits needed */ | ||
1645 | } code; /* if LEN or DIST, where in tree */ | ||
1646 | uInt lit; /* if LIT, literal */ | ||
1647 | struct { | ||
1648 | uInt get; /* bits to get for extra */ | ||
1649 | uInt dist; /* distance back to copy from */ | ||
1650 | } copy; /* if EXT or COPY, where and how much */ | ||
1651 | } sub; /* submode */ | ||
1652 | |||
1653 | /* mode independent information */ | ||
1654 | Byte lbits; /* ltree bits decoded per branch */ | ||
1655 | Byte dbits; /* dtree bits decoder per branch */ | ||
1656 | inflate_huft *ltree; /* literal/length/eob tree */ | ||
1657 | inflate_huft *dtree; /* distance tree */ | ||
1658 | |||
1659 | }; | ||
1660 | |||
1661 | |||
1662 | local inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z) | ||
1663 | uInt bl, bd; | ||
1664 | inflate_huft *tl, *td; | ||
1665 | z_stream *z; | ||
1666 | { | ||
1667 | inflate_codes_statef *c; | ||
1668 | |||
1669 | if ((c = (inflate_codes_statef *) | ||
1670 | ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL) | ||
1671 | { | ||
1672 | c->mode = START; | ||
1673 | c->lbits = (Byte)bl; | ||
1674 | c->dbits = (Byte)bd; | ||
1675 | c->ltree = tl; | ||
1676 | c->dtree = td; | ||
1677 | Tracev((stderr, "inflate: codes new\n")); | ||
1678 | } | ||
1679 | return c; | ||
1680 | } | ||
1681 | |||
1682 | |||
1683 | local int inflate_codes(s, z, r) | ||
1684 | inflate_blocks_statef *s; | ||
1685 | z_stream *z; | ||
1686 | int r; | ||
1687 | { | ||
1688 | uInt j; /* temporary storage */ | ||
1689 | inflate_huft *t; /* temporary pointer */ | ||
1690 | uInt e; /* extra bits or operation */ | ||
1691 | uLong b; /* bit buffer */ | ||
1692 | uInt k; /* bits in bit buffer */ | ||
1693 | Bytef *p; /* input data pointer */ | ||
1694 | uInt n; /* bytes available there */ | ||
1695 | Bytef *q; /* output window write pointer */ | ||
1696 | uInt m; /* bytes to end of window or read pointer */ | ||
1697 | Bytef *f; /* pointer to copy strings from */ | ||
1698 | inflate_codes_statef *c = s->sub.decode.codes; /* codes state */ | ||
1699 | |||
1700 | /* copy input/output information to locals (UPDATE macro restores) */ | ||
1701 | LOAD | ||
1702 | |||
1703 | /* process input and output based on current state */ | ||
1704 | while (1) switch (c->mode) | ||
1705 | { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */ | ||
1706 | case START: /* x: set up for LEN */ | ||
1707 | #ifndef SLOW | ||
1708 | if (m >= 258 && n >= 10) | ||
1709 | { | ||
1710 | UPDATE | ||
1711 | r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z); | ||
1712 | LOAD | ||
1713 | if (r != Z_OK) | ||
1714 | { | ||
1715 | c->mode = r == Z_STREAM_END ? WASH : BADCODE; | ||
1716 | break; | ||
1717 | } | ||
1718 | } | ||
1719 | #endif /* !SLOW */ | ||
1720 | c->sub.code.need = c->lbits; | ||
1721 | c->sub.code.tree = c->ltree; | ||
1722 | c->mode = LEN; | ||
1723 | case LEN: /* i: get length/literal/eob next */ | ||
1724 | j = c->sub.code.need; | ||
1725 | NEEDBITS(j) | ||
1726 | t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); | ||
1727 | DUMPBITS(t->bits) | ||
1728 | e = (uInt)(t->exop); | ||
1729 | if (e == 0) /* literal */ | ||
1730 | { | ||
1731 | c->sub.lit = t->base; | ||
1732 | Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? | ||
1733 | "inflate: literal '%c'\n" : | ||
1734 | "inflate: literal 0x%02x\n", t->base)); | ||
1735 | c->mode = LIT; | ||
1736 | break; | ||
1737 | } | ||
1738 | if (e & 16) /* length */ | ||
1739 | { | ||
1740 | c->sub.copy.get = e & 15; | ||
1741 | c->len = t->base; | ||
1742 | c->mode = LENEXT; | ||
1743 | break; | ||
1744 | } | ||
1745 | if ((e & 64) == 0) /* next table */ | ||
1746 | { | ||
1747 | c->sub.code.need = e; | ||
1748 | c->sub.code.tree = t->next; | ||
1749 | break; | ||
1750 | } | ||
1751 | if (e & 32) /* end of block */ | ||
1752 | { | ||
1753 | Tracevv((stderr, "inflate: end of block\n")); | ||
1754 | c->mode = WASH; | ||
1755 | break; | ||
1756 | } | ||
1757 | c->mode = BADCODE; /* invalid code */ | ||
1758 | z->msg = "invalid literal/length code"; | ||
1759 | r = Z_DATA_ERROR; | ||
1760 | LEAVE | ||
1761 | case LENEXT: /* i: getting length extra (have base) */ | ||
1762 | j = c->sub.copy.get; | ||
1763 | NEEDBITS(j) | ||
1764 | c->len += (uInt)b & inflate_mask[j]; | ||
1765 | DUMPBITS(j) | ||
1766 | c->sub.code.need = c->dbits; | ||
1767 | c->sub.code.tree = c->dtree; | ||
1768 | Tracevv((stderr, "inflate: length %u\n", c->len)); | ||
1769 | c->mode = DIST; | ||
1770 | case DIST: /* i: get distance next */ | ||
1771 | j = c->sub.code.need; | ||
1772 | NEEDBITS(j) | ||
1773 | t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); | ||
1774 | DUMPBITS(t->bits) | ||
1775 | e = (uInt)(t->exop); | ||
1776 | if (e & 16) /* distance */ | ||
1777 | { | ||
1778 | c->sub.copy.get = e & 15; | ||
1779 | c->sub.copy.dist = t->base; | ||
1780 | c->mode = DISTEXT; | ||
1781 | break; | ||
1782 | } | ||
1783 | if ((e & 64) == 0) /* next table */ | ||
1784 | { | ||
1785 | c->sub.code.need = e; | ||
1786 | c->sub.code.tree = t->next; | ||
1787 | break; | ||
1788 | } | ||
1789 | c->mode = BADCODE; /* invalid code */ | ||
1790 | z->msg = "invalid distance code"; | ||
1791 | r = Z_DATA_ERROR; | ||
1792 | LEAVE | ||
1793 | case DISTEXT: /* i: getting distance extra */ | ||
1794 | j = c->sub.copy.get; | ||
1795 | NEEDBITS(j) | ||
1796 | c->sub.copy.dist += (uInt)b & inflate_mask[j]; | ||
1797 | DUMPBITS(j) | ||
1798 | Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist)); | ||
1799 | c->mode = COPY; | ||
1800 | case COPY: /* o: copying bytes in window, waiting for space */ | ||
1801 | #ifndef __TURBOC__ /* Turbo C bug for following expression */ | ||
1802 | f = (uInt)(q - s->window) < c->sub.copy.dist ? | ||
1803 | s->end - (c->sub.copy.dist - (q - s->window)) : | ||
1804 | q - c->sub.copy.dist; | ||
1805 | #else | ||
1806 | f = q - c->sub.copy.dist; | ||
1807 | if ((uInt)(q - s->window) < c->sub.copy.dist) | ||
1808 | f = s->end - (c->sub.copy.dist - (q - s->window)); | ||
1809 | #endif | ||
1810 | while (c->len) | ||
1811 | { | ||
1812 | NEEDOUT | ||
1813 | OUTBYTE(*f++) | ||
1814 | if (f == s->end) | ||
1815 | f = s->window; | ||
1816 | c->len--; | ||
1817 | } | ||
1818 | c->mode = START; | ||
1819 | break; | ||
1820 | case LIT: /* o: got literal, waiting for output space */ | ||
1821 | NEEDOUT | ||
1822 | OUTBYTE(c->sub.lit) | ||
1823 | c->mode = START; | ||
1824 | break; | ||
1825 | case WASH: /* o: got eob, possibly more output */ | ||
1826 | FLUSH | ||
1827 | if (s->read != s->write) | ||
1828 | LEAVE | ||
1829 | c->mode = END; | ||
1830 | case END: | ||
1831 | r = Z_STREAM_END; | ||
1832 | LEAVE | ||
1833 | case BADCODE: /* x: got error */ | ||
1834 | r = Z_DATA_ERROR; | ||
1835 | LEAVE | ||
1836 | default: | ||
1837 | r = Z_STREAM_ERROR; | ||
1838 | LEAVE | ||
1839 | } | ||
1840 | } | ||
1841 | |||
1842 | |||
1843 | local void inflate_codes_free(c, z) | ||
1844 | inflate_codes_statef *c; | ||
1845 | z_stream *z; | ||
1846 | { | ||
1847 | ZFREE(z, c, sizeof(struct inflate_codes_state)); | ||
1848 | Tracev((stderr, "inflate: codes free\n")); | ||
1849 | } | ||
1850 | |||
1851 | /*+++++*/ | ||
1852 | /* inflate_util.c -- data and routines common to blocks and codes | ||
1853 | * Copyright (C) 1995 Mark Adler | ||
1854 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
1855 | */ | ||
1856 | |||
1857 | /* copy as much as possible from the sliding window to the output area */ | ||
1858 | local int inflate_flush(s, z, r) | ||
1859 | inflate_blocks_statef *s; | ||
1860 | z_stream *z; | ||
1861 | int r; | ||
1862 | { | ||
1863 | uInt n; | ||
1864 | Bytef *p, *q; | ||
1865 | |||
1866 | /* local copies of source and destination pointers */ | ||
1867 | p = z->next_out; | ||
1868 | q = s->read; | ||
1869 | |||
1870 | /* compute number of bytes to copy as far as end of window */ | ||
1871 | n = (uInt)((q <= s->write ? s->write : s->end) - q); | ||
1872 | if (n > z->avail_out) n = z->avail_out; | ||
1873 | if (n && r == Z_BUF_ERROR) r = Z_OK; | ||
1874 | |||
1875 | /* update counters */ | ||
1876 | z->avail_out -= n; | ||
1877 | z->total_out += n; | ||
1878 | |||
1879 | /* update check information */ | ||
1880 | if (s->checkfn != Z_NULL) | ||
1881 | s->check = (*s->checkfn)(s->check, q, n); | ||
1882 | |||
1883 | /* copy as far as end of window */ | ||
1884 | zmemcpy(p, q, n); | ||
1885 | p += n; | ||
1886 | q += n; | ||
1887 | |||
1888 | /* see if more to copy at beginning of window */ | ||
1889 | if (q == s->end) | ||
1890 | { | ||
1891 | /* wrap pointers */ | ||
1892 | q = s->window; | ||
1893 | if (s->write == s->end) | ||
1894 | s->write = s->window; | ||
1895 | |||
1896 | /* compute bytes to copy */ | ||
1897 | n = (uInt)(s->write - q); | ||
1898 | if (n > z->avail_out) n = z->avail_out; | ||
1899 | if (n && r == Z_BUF_ERROR) r = Z_OK; | ||
1900 | |||
1901 | /* update counters */ | ||
1902 | z->avail_out -= n; | ||
1903 | z->total_out += n; | ||
1904 | |||
1905 | /* update check information */ | ||
1906 | if (s->checkfn != Z_NULL) | ||
1907 | s->check = (*s->checkfn)(s->check, q, n); | ||
1908 | |||
1909 | /* copy */ | ||
1910 | zmemcpy(p, q, n); | ||
1911 | p += n; | ||
1912 | q += n; | ||
1913 | } | ||
1914 | |||
1915 | /* update pointers */ | ||
1916 | z->next_out = p; | ||
1917 | s->read = q; | ||
1918 | |||
1919 | /* done */ | ||
1920 | return r; | ||
1921 | } | ||
1922 | |||
1923 | |||
1924 | /*+++++*/ | ||
1925 | /* inffast.c -- process literals and length/distance pairs fast | ||
1926 | * Copyright (C) 1995 Mark Adler | ||
1927 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
1928 | */ | ||
1929 | |||
1930 | /* simplify the use of the inflate_huft type with some defines */ | ||
1931 | #define base more.Base | ||
1932 | #define next more.Next | ||
1933 | #define exop word.what.Exop | ||
1934 | #define bits word.what.Bits | ||
1935 | |||
1936 | /* macros for bit input with no checking and for returning unused bytes */ | ||
1937 | #define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}} | ||
1938 | #define UNGRAB {n+=(c=k>>3);p-=c;k&=7;} | ||
1939 | |||
1940 | /* Called with number of bytes left to write in window at least 258 | ||
1941 | (the maximum string length) and number of input bytes available | ||
1942 | at least ten. The ten bytes are six bytes for the longest length/ | ||
1943 | distance pair plus four bytes for overloading the bit buffer. */ | ||
1944 | |||
1945 | local int inflate_fast(bl, bd, tl, td, s, z) | ||
1946 | uInt bl, bd; | ||
1947 | inflate_huft *tl, *td; | ||
1948 | inflate_blocks_statef *s; | ||
1949 | z_stream *z; | ||
1950 | { | ||
1951 | inflate_huft *t; /* temporary pointer */ | ||
1952 | uInt e; /* extra bits or operation */ | ||
1953 | uLong b; /* bit buffer */ | ||
1954 | uInt k; /* bits in bit buffer */ | ||
1955 | Bytef *p; /* input data pointer */ | ||
1956 | uInt n; /* bytes available there */ | ||
1957 | Bytef *q; /* output window write pointer */ | ||
1958 | uInt m; /* bytes to end of window or read pointer */ | ||
1959 | uInt ml; /* mask for literal/length tree */ | ||
1960 | uInt md; /* mask for distance tree */ | ||
1961 | uInt c; /* bytes to copy */ | ||
1962 | uInt d; /* distance back to copy from */ | ||
1963 | Bytef *r; /* copy source pointer */ | ||
1964 | |||
1965 | /* load input, output, bit values */ | ||
1966 | LOAD | ||
1967 | |||
1968 | /* initialize masks */ | ||
1969 | ml = inflate_mask[bl]; | ||
1970 | md = inflate_mask[bd]; | ||
1971 | |||
1972 | /* do until not enough input or output space for fast loop */ | ||
1973 | do { /* assume called with m >= 258 && n >= 10 */ | ||
1974 | /* get literal/length code */ | ||
1975 | GRABBITS(20) /* max bits for literal/length code */ | ||
1976 | if ((e = (t = tl + ((uInt)b & ml))->exop) == 0) | ||
1977 | { | ||
1978 | DUMPBITS(t->bits) | ||
1979 | Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? | ||
1980 | "inflate: * literal '%c'\n" : | ||
1981 | "inflate: * literal 0x%02x\n", t->base)); | ||
1982 | *q++ = (Byte)t->base; | ||
1983 | m--; | ||
1984 | continue; | ||
1985 | } | ||
1986 | do { | ||
1987 | DUMPBITS(t->bits) | ||
1988 | if (e & 16) | ||
1989 | { | ||
1990 | /* get extra bits for length */ | ||
1991 | e &= 15; | ||
1992 | c = t->base + ((uInt)b & inflate_mask[e]); | ||
1993 | DUMPBITS(e) | ||
1994 | Tracevv((stderr, "inflate: * length %u\n", c)); | ||
1995 | |||
1996 | /* decode distance base of block to copy */ | ||
1997 | GRABBITS(15); /* max bits for distance code */ | ||
1998 | e = (t = td + ((uInt)b & md))->exop; | ||
1999 | do { | ||
2000 | DUMPBITS(t->bits) | ||
2001 | if (e & 16) | ||
2002 | { | ||
2003 | /* get extra bits to add to distance base */ | ||
2004 | e &= 15; | ||
2005 | GRABBITS(e) /* get extra bits (up to 13) */ | ||
2006 | d = t->base + ((uInt)b & inflate_mask[e]); | ||
2007 | DUMPBITS(e) | ||
2008 | Tracevv((stderr, "inflate: * distance %u\n", d)); | ||
2009 | |||
2010 | /* do the copy */ | ||
2011 | m -= c; | ||
2012 | if ((uInt)(q - s->window) >= d) /* offset before dest */ | ||
2013 | { /* just copy */ | ||
2014 | r = q - d; | ||
2015 | *q++ = *r++; c--; /* minimum count is three, */ | ||
2016 | *q++ = *r++; c--; /* so unroll loop a little */ | ||
2017 | } | ||
2018 | else /* else offset after destination */ | ||
2019 | { | ||
2020 | e = d - (q - s->window); /* bytes from offset to end */ | ||
2021 | r = s->end - e; /* pointer to offset */ | ||
2022 | if (c > e) /* if source crosses, */ | ||
2023 | { | ||
2024 | c -= e; /* copy to end of window */ | ||
2025 | do { | ||
2026 | *q++ = *r++; | ||
2027 | } while (--e); | ||
2028 | r = s->window; /* copy rest from start of window */ | ||
2029 | } | ||
2030 | } | ||
2031 | do { /* copy all or what's left */ | ||
2032 | *q++ = *r++; | ||
2033 | } while (--c); | ||
2034 | break; | ||
2035 | } | ||
2036 | else if ((e & 64) == 0) | ||
2037 | e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop; | ||
2038 | else | ||
2039 | { | ||
2040 | z->msg = "invalid distance code"; | ||
2041 | UNGRAB | ||
2042 | UPDATE | ||
2043 | return Z_DATA_ERROR; | ||
2044 | } | ||
2045 | } while (1); | ||
2046 | break; | ||
2047 | } | ||
2048 | if ((e & 64) == 0) | ||
2049 | { | ||
2050 | if ((e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop) == 0) | ||
2051 | { | ||
2052 | DUMPBITS(t->bits) | ||
2053 | Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? | ||
2054 | "inflate: * literal '%c'\n" : | ||
2055 | "inflate: * literal 0x%02x\n", t->base)); | ||
2056 | *q++ = (Byte)t->base; | ||
2057 | m--; | ||
2058 | break; | ||
2059 | } | ||
2060 | } | ||
2061 | else if (e & 32) | ||
2062 | { | ||
2063 | Tracevv((stderr, "inflate: * end of block\n")); | ||
2064 | UNGRAB | ||
2065 | UPDATE | ||
2066 | return Z_STREAM_END; | ||
2067 | } | ||
2068 | else | ||
2069 | { | ||
2070 | z->msg = "invalid literal/length code"; | ||
2071 | UNGRAB | ||
2072 | UPDATE | ||
2073 | return Z_DATA_ERROR; | ||
2074 | } | ||
2075 | } while (1); | ||
2076 | } while (m >= 258 && n >= 10); | ||
2077 | |||
2078 | /* not enough input or output--restore pointers and return */ | ||
2079 | UNGRAB | ||
2080 | UPDATE | ||
2081 | return Z_OK; | ||
2082 | } | ||
2083 | |||
2084 | |||
2085 | /*+++++*/ | ||
2086 | /* zutil.c -- target dependent utility functions for the compression library | ||
2087 | * Copyright (C) 1995 Jean-loup Gailly. | ||
2088 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
2089 | */ | ||
2090 | |||
2091 | /* From: zutil.c,v 1.8 1995/05/03 17:27:12 jloup Exp */ | ||
2092 | |||
2093 | char *zlib_version = ZLIB_VERSION; | ||
2094 | |||
2095 | char *z_errmsg[] = { | ||
2096 | "stream end", /* Z_STREAM_END 1 */ | ||
2097 | "", /* Z_OK 0 */ | ||
2098 | "file error", /* Z_ERRNO (-1) */ | ||
2099 | "stream error", /* Z_STREAM_ERROR (-2) */ | ||
2100 | "data error", /* Z_DATA_ERROR (-3) */ | ||
2101 | "insufficient memory", /* Z_MEM_ERROR (-4) */ | ||
2102 | "buffer error", /* Z_BUF_ERROR (-5) */ | ||
2103 | ""}; | ||
2104 | |||
2105 | |||
2106 | /*+++++*/ | ||
2107 | /* adler32.c -- compute the Adler-32 checksum of a data stream | ||
2108 | * Copyright (C) 1995 Mark Adler | ||
2109 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
2110 | */ | ||
2111 | |||
2112 | /* From: adler32.c,v 1.6 1995/05/03 17:27:08 jloup Exp */ | ||
2113 | |||
2114 | #define BASE 65521L /* largest prime smaller than 65536 */ | ||
2115 | #define NMAX 5552 | ||
2116 | /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ | ||
2117 | |||
2118 | #define DO1(buf) {s1 += *buf++; s2 += s1;} | ||
2119 | #define DO2(buf) DO1(buf); DO1(buf); | ||
2120 | #define DO4(buf) DO2(buf); DO2(buf); | ||
2121 | #define DO8(buf) DO4(buf); DO4(buf); | ||
2122 | #define DO16(buf) DO8(buf); DO8(buf); | ||
2123 | |||
2124 | /* ========================================================================= */ | ||
2125 | uLong adler32(adler, buf, len) | ||
2126 | uLong adler; | ||
2127 | Bytef *buf; | ||
2128 | uInt len; | ||
2129 | { | ||
2130 | unsigned long s1 = adler & 0xffff; | ||
2131 | unsigned long s2 = (adler >> 16) & 0xffff; | ||
2132 | int k; | ||
2133 | |||
2134 | if (buf == Z_NULL) return 1L; | ||
2135 | |||
2136 | while (len > 0) { | ||
2137 | k = len < NMAX ? len : NMAX; | ||
2138 | len -= k; | ||
2139 | while (k >= 16) { | ||
2140 | DO16(buf); | ||
2141 | k -= 16; | ||
2142 | } | ||
2143 | if (k != 0) do { | ||
2144 | DO1(buf); | ||
2145 | } while (--k); | ||
2146 | s1 %= BASE; | ||
2147 | s2 %= BASE; | ||
2148 | } | ||
2149 | return (s2 << 16) | s1; | ||
2150 | } | ||
diff --git a/arch/xtensa/boot/lib/zmem.c b/arch/xtensa/boot/lib/zmem.c index 7848f126d67d..d9862aa8ca25 100644 --- a/arch/xtensa/boot/lib/zmem.c +++ b/arch/xtensa/boot/lib/zmem.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #include "zlib.h" | 1 | #include <linux/zlib.h> |
2 | 2 | ||
3 | /* bits taken from ppc */ | 3 | /* bits taken from ppc */ |
4 | 4 | ||
@@ -9,11 +9,10 @@ void exit (void) | |||
9 | for (;;); | 9 | for (;;); |
10 | } | 10 | } |
11 | 11 | ||
12 | void *zalloc(void *x, unsigned items, unsigned size) | 12 | void *zalloc(unsigned size) |
13 | { | 13 | { |
14 | void *p = avail_ram; | 14 | void *p = avail_ram; |
15 | 15 | ||
16 | size *= items; | ||
17 | size = (size + 7) & -8; | 16 | size = (size + 7) & -8; |
18 | avail_ram += size; | 17 | avail_ram += size; |
19 | if (avail_ram > end_avail) { | 18 | if (avail_ram > end_avail) { |
@@ -24,11 +23,6 @@ void *zalloc(void *x, unsigned items, unsigned size) | |||
24 | return p; | 23 | return p; |
25 | } | 24 | } |
26 | 25 | ||
27 | void zfree(void *x, void *addr, unsigned nb) | ||
28 | { | ||
29 | } | ||
30 | |||
31 | |||
32 | #define HEAD_CRC 2 | 26 | #define HEAD_CRC 2 |
33 | #define EXTRA_FIELD 4 | 27 | #define EXTRA_FIELD 4 |
34 | #define ORIG_NAME 8 | 28 | #define ORIG_NAME 8 |
@@ -43,7 +37,6 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp) | |||
43 | int r, i, flags; | 37 | int r, i, flags; |
44 | 38 | ||
45 | /* skip header */ | 39 | /* skip header */ |
46 | |||
47 | i = 10; | 40 | i = 10; |
48 | flags = src[3]; | 41 | flags = src[3]; |
49 | if (src[2] != DEFLATED || (flags & RESERVED) != 0) { | 42 | if (src[2] != DEFLATED || (flags & RESERVED) != 0) { |
@@ -65,9 +58,8 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp) | |||
65 | exit(); | 58 | exit(); |
66 | } | 59 | } |
67 | 60 | ||
68 | s.zalloc = zalloc; | 61 | s.workspace = zalloc(zlib_inflate_workspacesize()); |
69 | s.zfree = zfree; | 62 | r = zlib_inflateInit2(&s, -MAX_WBITS); |
70 | r = inflateInit2(&s, -MAX_WBITS); | ||
71 | if (r != Z_OK) { | 63 | if (r != Z_OK) { |
72 | //puts("inflateInit2 returned "); puthex(r); puts("\n"); | 64 | //puts("inflateInit2 returned "); puthex(r); puts("\n"); |
73 | exit(); | 65 | exit(); |
@@ -76,12 +68,12 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp) | |||
76 | s.avail_in = *lenp - i; | 68 | s.avail_in = *lenp - i; |
77 | s.next_out = dst; | 69 | s.next_out = dst; |
78 | s.avail_out = dstlen; | 70 | s.avail_out = dstlen; |
79 | r = inflate(&s, Z_FINISH); | 71 | r = zlib_inflate(&s, Z_FINISH); |
80 | if (r != Z_OK && r != Z_STREAM_END) { | 72 | if (r != Z_OK && r != Z_STREAM_END) { |
81 | //puts("inflate returned "); puthex(r); puts("\n"); | 73 | //puts("inflate returned "); puthex(r); puts("\n"); |
82 | exit(); | 74 | exit(); |
83 | } | 75 | } |
84 | *lenp = s.next_out - (unsigned char *) dst; | 76 | *lenp = s.next_out - (unsigned char *) dst; |
85 | inflateEnd(&s); | 77 | zlib_inflateEnd(&s); |
86 | } | 78 | } |
87 | 79 | ||
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c index d29a81648637..09887c96e9a1 100644 --- a/arch/xtensa/kernel/pci.c +++ b/arch/xtensa/kernel/pci.c | |||
@@ -57,50 +57,6 @@ struct pci_controller** pci_ctrl_tail = &pci_ctrl_head; | |||
57 | 57 | ||
58 | static int pci_bus_count; | 58 | static int pci_bus_count; |
59 | 59 | ||
60 | static void pcibios_fixup_resources(struct pci_dev* dev); | ||
61 | |||
62 | #if 0 // FIXME | ||
63 | struct pci_fixup pcibios_fixups[] = { | ||
64 | { DECLARE_PCI_FIXUP_HEADER, PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources }, | ||
65 | { 0 } | ||
66 | }; | ||
67 | #endif | ||
68 | |||
69 | void | ||
70 | pcibios_update_resource(struct pci_dev *dev, struct resource *root, | ||
71 | struct resource *res, int resource) | ||
72 | { | ||
73 | u32 new, check, mask; | ||
74 | int reg; | ||
75 | struct pci_controller* pci_ctrl = dev->sysdata; | ||
76 | |||
77 | new = res->start; | ||
78 | if (pci_ctrl && res->flags & IORESOURCE_IO) { | ||
79 | new -= pci_ctrl->io_space.base; | ||
80 | } | ||
81 | new |= (res->flags & PCI_REGION_FLAG_MASK); | ||
82 | if (resource < 6) { | ||
83 | reg = PCI_BASE_ADDRESS_0 + 4*resource; | ||
84 | } else if (resource == PCI_ROM_RESOURCE) { | ||
85 | res->flags |= PCI_ROM_ADDRESS_ENABLE; | ||
86 | reg = dev->rom_base_reg; | ||
87 | } else { | ||
88 | /* Somebody might have asked allocation of a non-standard resource */ | ||
89 | return; | ||
90 | } | ||
91 | |||
92 | pci_write_config_dword(dev, reg, new); | ||
93 | pci_read_config_dword(dev, reg, &check); | ||
94 | mask = (new & PCI_BASE_ADDRESS_SPACE_IO) ? | ||
95 | PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK; | ||
96 | |||
97 | if ((new ^ check) & mask) { | ||
98 | printk(KERN_ERR "PCI: Error while updating region " | ||
99 | "%s/%d (%08x != %08x)\n", dev->slot_name, resource, | ||
100 | new, check); | ||
101 | } | ||
102 | } | ||
103 | |||
104 | /* | 60 | /* |
105 | * We need to avoid collisions with `mirrored' VGA ports | 61 | * We need to avoid collisions with `mirrored' VGA ports |
106 | * and other strange ISA hardware, so we always want the | 62 | * and other strange ISA hardware, so we always want the |
@@ -125,7 +81,7 @@ pcibios_align_resource(void *data, struct resource *res, unsigned long size, | |||
125 | 81 | ||
126 | if (size > 0x100) { | 82 | if (size > 0x100) { |
127 | printk(KERN_ERR "PCI: I/O Region %s/%d too large" | 83 | printk(KERN_ERR "PCI: I/O Region %s/%d too large" |
128 | " (%ld bytes)\n", dev->slot_name, | 84 | " (%ld bytes)\n", pci_name(dev), |
129 | dev->resource - res, size); | 85 | dev->resource - res, size); |
130 | } | 86 | } |
131 | 87 | ||
@@ -149,7 +105,7 @@ pcibios_enable_resources(struct pci_dev *dev, int mask) | |||
149 | r = &dev->resource[idx]; | 105 | r = &dev->resource[idx]; |
150 | if (!r->start && r->end) { | 106 | if (!r->start && r->end) { |
151 | printk (KERN_ERR "PCI: Device %s not available because " | 107 | printk (KERN_ERR "PCI: Device %s not available because " |
152 | "of resource collisions\n", dev->slot_name); | 108 | "of resource collisions\n", pci_name(dev)); |
153 | return -EINVAL; | 109 | return -EINVAL; |
154 | } | 110 | } |
155 | if (r->flags & IORESOURCE_IO) | 111 | if (r->flags & IORESOURCE_IO) |
@@ -161,7 +117,7 @@ pcibios_enable_resources(struct pci_dev *dev, int mask) | |||
161 | cmd |= PCI_COMMAND_MEMORY; | 117 | cmd |= PCI_COMMAND_MEMORY; |
162 | if (cmd != old_cmd) { | 118 | if (cmd != old_cmd) { |
163 | printk("PCI: Enabling device %s (%04x -> %04x)\n", | 119 | printk("PCI: Enabling device %s (%04x -> %04x)\n", |
164 | dev->slot_name, old_cmd, cmd); | 120 | pci_name(dev), old_cmd, cmd); |
165 | pci_write_config_word(dev, PCI_COMMAND, cmd); | 121 | pci_write_config_word(dev, PCI_COMMAND, cmd); |
166 | } | 122 | } |
167 | return 0; | 123 | return 0; |
@@ -293,7 +249,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) | |||
293 | r = &dev->resource[idx]; | 249 | r = &dev->resource[idx]; |
294 | if (!r->start && r->end) { | 250 | if (!r->start && r->end) { |
295 | printk(KERN_ERR "PCI: Device %s not available because " | 251 | printk(KERN_ERR "PCI: Device %s not available because " |
296 | "of resource collisions\n", dev->slot_name); | 252 | "of resource collisions\n", pci_name(dev)); |
297 | return -EINVAL; | 253 | return -EINVAL; |
298 | } | 254 | } |
299 | if (r->flags & IORESOURCE_IO) | 255 | if (r->flags & IORESOURCE_IO) |
@@ -303,7 +259,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) | |||
303 | } | 259 | } |
304 | if (cmd != old_cmd) { | 260 | if (cmd != old_cmd) { |
305 | printk("PCI: Enabling device %s (%04x -> %04x)\n", | 261 | printk("PCI: Enabling device %s (%04x -> %04x)\n", |
306 | dev->slot_name, old_cmd, cmd); | 262 | pci_name(dev), old_cmd, cmd); |
307 | pci_write_config_word(dev, PCI_COMMAND, cmd); | 263 | pci_write_config_word(dev, PCI_COMMAND, cmd); |
308 | } | 264 | } |
309 | 265 | ||
@@ -325,47 +281,6 @@ pci_controller_num(struct pci_dev *dev) | |||
325 | 281 | ||
326 | #endif /* CONFIG_PROC_FS */ | 282 | #endif /* CONFIG_PROC_FS */ |
327 | 283 | ||
328 | |||
329 | static void | ||
330 | pcibios_fixup_resources(struct pci_dev *dev) | ||
331 | { | ||
332 | struct pci_controller* pci_ctrl = (struct pci_controller *)dev->sysdata; | ||
333 | int i; | ||
334 | unsigned long offset; | ||
335 | |||
336 | if (!pci_ctrl) { | ||
337 | printk(KERN_ERR "No pci_ctrl for PCI dev %s!\n",dev->slot_name); | ||
338 | return; | ||
339 | } | ||
340 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | ||
341 | struct resource *res = dev->resource + i; | ||
342 | if (!res->start || !res->flags) | ||
343 | continue; | ||
344 | if (res->end == 0xffffffff) { | ||
345 | DBG("PCI:%s Resource %d [%08lx-%08lx] is unassigned\n", | ||
346 | dev->slot_name, i, res->start, res->end); | ||
347 | res->end -= res->start; | ||
348 | res->start = 0; | ||
349 | continue; | ||
350 | } | ||
351 | offset = 0; | ||
352 | if (res->flags & IORESOURCE_IO) | ||
353 | offset = (unsigned long) pci_ctrl->io_space.base; | ||
354 | else if (res->flags & IORESOURCE_MEM) | ||
355 | offset = (unsigned long) pci_ctrl->mem_space.base; | ||
356 | |||
357 | if (offset != 0) { | ||
358 | res->start += offset; | ||
359 | res->end += offset; | ||
360 | #ifdef DEBUG | ||
361 | printk("Fixup res %d (%lx) of dev %s: %lx -> %lx\n", | ||
362 | i, res->flags, dev->slot_name, | ||
363 | res->start - offset, res->start); | ||
364 | #endif | ||
365 | } | ||
366 | } | ||
367 | } | ||
368 | |||
369 | /* | 284 | /* |
370 | * Platform support for /proc/bus/pci/X/Y mmap()s, | 285 | * Platform support for /proc/bus/pci/X/Y mmap()s, |
371 | * modelled on the sparc64 implementation by Dave Miller. | 286 | * modelled on the sparc64 implementation by Dave Miller. |
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c index 9ef07a4dd2a2..2659efdd4e99 100644 --- a/arch/xtensa/kernel/ptrace.c +++ b/arch/xtensa/kernel/ptrace.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/smp.h> | 22 | #include <linux/smp.h> |
23 | #include <linux/smp_lock.h> | 23 | #include <linux/smp_lock.h> |
24 | #include <linux/security.h> | 24 | #include <linux/security.h> |
25 | #include <linux/signal.h> | ||
25 | 26 | ||
26 | #include <asm/pgtable.h> | 27 | #include <asm/pgtable.h> |
27 | #include <asm/page.h> | 28 | #include <asm/page.h> |
@@ -239,7 +240,7 @@ int sys_ptrace(long request, long pid, long addr, long data) | |||
239 | case PTRACE_CONT: /* restart after signal. */ | 240 | case PTRACE_CONT: /* restart after signal. */ |
240 | { | 241 | { |
241 | ret = -EIO; | 242 | ret = -EIO; |
242 | if ((unsigned long) data > _NSIG) | 243 | if (!valid_signal(data)) |
243 | break; | 244 | break; |
244 | if (request == PTRACE_SYSCALL) | 245 | if (request == PTRACE_SYSCALL) |
245 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 246 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
@@ -269,7 +270,7 @@ int sys_ptrace(long request, long pid, long addr, long data) | |||
269 | 270 | ||
270 | case PTRACE_SINGLESTEP: | 271 | case PTRACE_SINGLESTEP: |
271 | ret = -EIO; | 272 | ret = -EIO; |
272 | if ((unsigned long) data > _NSIG) | 273 | if (!valid_signal(data)) |
273 | break; | 274 | break; |
274 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 275 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
275 | child->ptrace |= PT_SINGLESTEP; | 276 | child->ptrace |= PT_SINGLESTEP; |
diff --git a/crypto/Kconfig b/crypto/Kconfig index 90d6089d60ed..256c0b1fed10 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig | |||
@@ -146,7 +146,7 @@ config CRYPTO_SERPENT | |||
146 | 146 | ||
147 | config CRYPTO_AES | 147 | config CRYPTO_AES |
148 | tristate "AES cipher algorithms" | 148 | tristate "AES cipher algorithms" |
149 | depends on CRYPTO && !((X86 || UML_X86) && !64BIT) | 149 | depends on CRYPTO && !(X86 || UML_X86) |
150 | help | 150 | help |
151 | AES cipher algorithms (FIPS-197). AES uses the Rijndael | 151 | AES cipher algorithms (FIPS-197). AES uses the Rijndael |
152 | algorithm. | 152 | algorithm. |
@@ -184,6 +184,26 @@ config CRYPTO_AES_586 | |||
184 | 184 | ||
185 | See <http://csrc.nist.gov/encryption/aes/> for more information. | 185 | See <http://csrc.nist.gov/encryption/aes/> for more information. |
186 | 186 | ||
187 | config CRYPTO_AES_X86_64 | ||
188 | tristate "AES cipher algorithms (x86_64)" | ||
189 | depends on CRYPTO && ((X86 || UML_X86) && 64BIT) | ||
190 | help | ||
191 | AES cipher algorithms (FIPS-197). AES uses the Rijndael | ||
192 | algorithm. | ||
193 | |||
194 | Rijndael appears to be consistently a very good performer in | ||
195 | both hardware and software across a wide range of computing | ||
196 | environments regardless of its use in feedback or non-feedback | ||
197 | modes. Its key setup time is excellent, and its key agility is | ||
198 | good. Rijndael's very low memory requirements make it very well | ||
199 | suited for restricted-space environments, in which it also | ||
200 | demonstrates excellent performance. Rijndael's operations are | ||
201 | among the easiest to defend against power and timing attacks. | ||
202 | |||
203 | The AES specifies three key sizes: 128, 192 and 256 bits | ||
204 | |||
205 | See <http://csrc.nist.gov/encryption/aes/> for more information. | ||
206 | |||
187 | config CRYPTO_CAST5 | 207 | config CRYPTO_CAST5 |
188 | tristate "CAST5 (CAST-128) cipher algorithm" | 208 | tristate "CAST5 (CAST-128) cipher algorithm" |
189 | depends on CRYPTO | 209 | depends on CRYPTO |
diff --git a/crypto/api.c b/crypto/api.c index 394169a8577d..b4728811ce3b 100644 --- a/crypto/api.c +++ b/crypto/api.c | |||
@@ -13,9 +13,12 @@ | |||
13 | * any later version. | 13 | * any later version. |
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | |||
17 | #include <linux/compiler.h> | ||
16 | #include <linux/init.h> | 18 | #include <linux/init.h> |
17 | #include <linux/crypto.h> | 19 | #include <linux/crypto.h> |
18 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/kmod.h> | ||
19 | #include <linux/rwsem.h> | 22 | #include <linux/rwsem.h> |
20 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
21 | #include "internal.h" | 24 | #include "internal.h" |
@@ -33,7 +36,7 @@ static inline void crypto_alg_put(struct crypto_alg *alg) | |||
33 | module_put(alg->cra_module); | 36 | module_put(alg->cra_module); |
34 | } | 37 | } |
35 | 38 | ||
36 | struct crypto_alg *crypto_alg_lookup(const char *name) | 39 | static struct crypto_alg *crypto_alg_lookup(const char *name) |
37 | { | 40 | { |
38 | struct crypto_alg *q, *alg = NULL; | 41 | struct crypto_alg *q, *alg = NULL; |
39 | 42 | ||
@@ -54,6 +57,13 @@ struct crypto_alg *crypto_alg_lookup(const char *name) | |||
54 | return alg; | 57 | return alg; |
55 | } | 58 | } |
56 | 59 | ||
60 | /* A far more intelligent version of this is planned. For now, just | ||
61 | * try an exact match on the name of the algorithm. */ | ||
62 | static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name) | ||
63 | { | ||
64 | return try_then_request_module(crypto_alg_lookup(name), name); | ||
65 | } | ||
66 | |||
57 | static int crypto_init_flags(struct crypto_tfm *tfm, u32 flags) | 67 | static int crypto_init_flags(struct crypto_tfm *tfm, u32 flags) |
58 | { | 68 | { |
59 | tfm->crt_flags = 0; | 69 | tfm->crt_flags = 0; |
@@ -117,20 +127,46 @@ static void crypto_exit_ops(struct crypto_tfm *tfm) | |||
117 | } | 127 | } |
118 | } | 128 | } |
119 | 129 | ||
130 | static unsigned int crypto_ctxsize(struct crypto_alg *alg, int flags) | ||
131 | { | ||
132 | unsigned int len; | ||
133 | |||
134 | switch (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) { | ||
135 | default: | ||
136 | BUG(); | ||
137 | |||
138 | case CRYPTO_ALG_TYPE_CIPHER: | ||
139 | len = crypto_cipher_ctxsize(alg, flags); | ||
140 | break; | ||
141 | |||
142 | case CRYPTO_ALG_TYPE_DIGEST: | ||
143 | len = crypto_digest_ctxsize(alg, flags); | ||
144 | break; | ||
145 | |||
146 | case CRYPTO_ALG_TYPE_COMPRESS: | ||
147 | len = crypto_compress_ctxsize(alg, flags); | ||
148 | break; | ||
149 | } | ||
150 | |||
151 | return len + alg->cra_alignmask; | ||
152 | } | ||
153 | |||
120 | struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags) | 154 | struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags) |
121 | { | 155 | { |
122 | struct crypto_tfm *tfm = NULL; | 156 | struct crypto_tfm *tfm = NULL; |
123 | struct crypto_alg *alg; | 157 | struct crypto_alg *alg; |
158 | unsigned int tfm_size; | ||
124 | 159 | ||
125 | alg = crypto_alg_mod_lookup(name); | 160 | alg = crypto_alg_mod_lookup(name); |
126 | if (alg == NULL) | 161 | if (alg == NULL) |
127 | goto out; | 162 | goto out; |
128 | 163 | ||
129 | tfm = kmalloc(sizeof(*tfm) + alg->cra_ctxsize, GFP_KERNEL); | 164 | tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, flags); |
165 | tfm = kmalloc(tfm_size, GFP_KERNEL); | ||
130 | if (tfm == NULL) | 166 | if (tfm == NULL) |
131 | goto out_put; | 167 | goto out_put; |
132 | 168 | ||
133 | memset(tfm, 0, sizeof(*tfm) + alg->cra_ctxsize); | 169 | memset(tfm, 0, tfm_size); |
134 | 170 | ||
135 | tfm->__crt_alg = alg; | 171 | tfm->__crt_alg = alg; |
136 | 172 | ||
@@ -155,8 +191,14 @@ out: | |||
155 | 191 | ||
156 | void crypto_free_tfm(struct crypto_tfm *tfm) | 192 | void crypto_free_tfm(struct crypto_tfm *tfm) |
157 | { | 193 | { |
158 | struct crypto_alg *alg = tfm->__crt_alg; | 194 | struct crypto_alg *alg; |
159 | int size = sizeof(*tfm) + alg->cra_ctxsize; | 195 | int size; |
196 | |||
197 | if (unlikely(!tfm)) | ||
198 | return; | ||
199 | |||
200 | alg = tfm->__crt_alg; | ||
201 | size = sizeof(*tfm) + alg->cra_ctxsize; | ||
160 | 202 | ||
161 | crypto_exit_ops(tfm); | 203 | crypto_exit_ops(tfm); |
162 | crypto_alg_put(alg); | 204 | crypto_alg_put(alg); |
@@ -168,6 +210,12 @@ int crypto_register_alg(struct crypto_alg *alg) | |||
168 | { | 210 | { |
169 | int ret = 0; | 211 | int ret = 0; |
170 | struct crypto_alg *q; | 212 | struct crypto_alg *q; |
213 | |||
214 | if (alg->cra_alignmask & (alg->cra_alignmask + 1)) | ||
215 | return -EINVAL; | ||
216 | |||
217 | if (alg->cra_alignmask > PAGE_SIZE) | ||
218 | return -EINVAL; | ||
171 | 219 | ||
172 | down_write(&crypto_alg_sem); | 220 | down_write(&crypto_alg_sem); |
173 | 221 | ||
diff --git a/crypto/cipher.c b/crypto/cipher.c index f434ce7c2d0b..1c92c6bb138b 100644 --- a/crypto/cipher.c +++ b/crypto/cipher.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Cipher operations. | 4 | * Cipher operations. |
5 | * | 5 | * |
6 | * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> | 6 | * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> |
7 | * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au> | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 9 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the Free | 10 | * under the terms of the GNU General Public License as published by the Free |
@@ -22,10 +23,6 @@ | |||
22 | #include "internal.h" | 23 | #include "internal.h" |
23 | #include "scatterwalk.h" | 24 | #include "scatterwalk.h" |
24 | 25 | ||
25 | typedef void (cryptfn_t)(void *, u8 *, const u8 *); | ||
26 | typedef void (procfn_t)(struct crypto_tfm *, u8 *, | ||
27 | u8*, cryptfn_t, void *); | ||
28 | |||
29 | static inline void xor_64(u8 *a, const u8 *b) | 26 | static inline void xor_64(u8 *a, const u8 *b) |
30 | { | 27 | { |
31 | ((u32 *)a)[0] ^= ((u32 *)b)[0]; | 28 | ((u32 *)a)[0] ^= ((u32 *)b)[0]; |
@@ -39,63 +36,70 @@ static inline void xor_128(u8 *a, const u8 *b) | |||
39 | ((u32 *)a)[2] ^= ((u32 *)b)[2]; | 36 | ((u32 *)a)[2] ^= ((u32 *)b)[2]; |
40 | ((u32 *)a)[3] ^= ((u32 *)b)[3]; | 37 | ((u32 *)a)[3] ^= ((u32 *)b)[3]; |
41 | } | 38 | } |
42 | 39 | ||
43 | static inline void *prepare_src(struct scatter_walk *walk, int bsize, | 40 | static unsigned int crypt_slow(const struct cipher_desc *desc, |
44 | void *tmp, int in_place) | 41 | struct scatter_walk *in, |
42 | struct scatter_walk *out, unsigned int bsize) | ||
45 | { | 43 | { |
46 | void *src = walk->data; | 44 | unsigned int alignmask = crypto_tfm_alg_alignmask(desc->tfm); |
47 | int n = bsize; | 45 | u8 buffer[bsize * 2 + alignmask]; |
46 | u8 *src = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1); | ||
47 | u8 *dst = src + bsize; | ||
48 | unsigned int n; | ||
48 | 49 | ||
49 | if (unlikely(scatterwalk_across_pages(walk, bsize))) { | 50 | n = scatterwalk_copychunks(src, in, bsize, 0); |
50 | src = tmp; | 51 | scatterwalk_advance(in, n); |
51 | n = scatterwalk_copychunks(src, walk, bsize, 0); | 52 | |
52 | } | 53 | desc->prfn(desc, dst, src, bsize); |
53 | scatterwalk_advance(walk, n); | 54 | |
54 | return src; | 55 | n = scatterwalk_copychunks(dst, out, bsize, 1); |
56 | scatterwalk_advance(out, n); | ||
57 | |||
58 | return bsize; | ||
55 | } | 59 | } |
56 | 60 | ||
57 | static inline void *prepare_dst(struct scatter_walk *walk, int bsize, | 61 | static inline unsigned int crypt_fast(const struct cipher_desc *desc, |
58 | void *tmp, int in_place) | 62 | struct scatter_walk *in, |
63 | struct scatter_walk *out, | ||
64 | unsigned int nbytes, u8 *tmp) | ||
59 | { | 65 | { |
60 | void *dst = walk->data; | 66 | u8 *src, *dst; |
61 | 67 | ||
62 | if (unlikely(scatterwalk_across_pages(walk, bsize)) || in_place) | 68 | src = in->data; |
69 | dst = scatterwalk_samebuf(in, out) ? src : out->data; | ||
70 | |||
71 | if (tmp) { | ||
72 | memcpy(tmp, in->data, nbytes); | ||
73 | src = tmp; | ||
63 | dst = tmp; | 74 | dst = tmp; |
64 | return dst; | 75 | } |
65 | } | ||
66 | 76 | ||
67 | static inline void complete_src(struct scatter_walk *walk, int bsize, | 77 | nbytes = desc->prfn(desc, dst, src, nbytes); |
68 | void *src, int in_place) | ||
69 | { | ||
70 | } | ||
71 | 78 | ||
72 | static inline void complete_dst(struct scatter_walk *walk, int bsize, | 79 | if (tmp) |
73 | void *dst, int in_place) | 80 | memcpy(out->data, tmp, nbytes); |
74 | { | 81 | |
75 | int n = bsize; | 82 | scatterwalk_advance(in, nbytes); |
83 | scatterwalk_advance(out, nbytes); | ||
76 | 84 | ||
77 | if (unlikely(scatterwalk_across_pages(walk, bsize))) | 85 | return nbytes; |
78 | n = scatterwalk_copychunks(dst, walk, bsize, 1); | ||
79 | else if (in_place) | ||
80 | memcpy(walk->data, dst, bsize); | ||
81 | scatterwalk_advance(walk, n); | ||
82 | } | 86 | } |
83 | 87 | ||
84 | /* | 88 | /* |
85 | * Generic encrypt/decrypt wrapper for ciphers, handles operations across | 89 | * Generic encrypt/decrypt wrapper for ciphers, handles operations across |
86 | * multiple page boundaries by using temporary blocks. In user context, | 90 | * multiple page boundaries by using temporary blocks. In user context, |
87 | * the kernel is given a chance to schedule us once per block. | 91 | * the kernel is given a chance to schedule us once per page. |
88 | */ | 92 | */ |
89 | static int crypt(struct crypto_tfm *tfm, | 93 | static int crypt(const struct cipher_desc *desc, |
90 | struct scatterlist *dst, | 94 | struct scatterlist *dst, |
91 | struct scatterlist *src, | 95 | struct scatterlist *src, |
92 | unsigned int nbytes, cryptfn_t crfn, | 96 | unsigned int nbytes) |
93 | procfn_t prfn, void *info) | ||
94 | { | 97 | { |
95 | struct scatter_walk walk_in, walk_out; | 98 | struct scatter_walk walk_in, walk_out; |
99 | struct crypto_tfm *tfm = desc->tfm; | ||
96 | const unsigned int bsize = crypto_tfm_alg_blocksize(tfm); | 100 | const unsigned int bsize = crypto_tfm_alg_blocksize(tfm); |
97 | u8 tmp_src[bsize]; | 101 | unsigned int alignmask = crypto_tfm_alg_alignmask(tfm); |
98 | u8 tmp_dst[bsize]; | 102 | unsigned long buffer = 0; |
99 | 103 | ||
100 | if (!nbytes) | 104 | if (!nbytes) |
101 | return 0; | 105 | return 0; |
@@ -109,64 +113,144 @@ static int crypt(struct crypto_tfm *tfm, | |||
109 | scatterwalk_start(&walk_out, dst); | 113 | scatterwalk_start(&walk_out, dst); |
110 | 114 | ||
111 | for(;;) { | 115 | for(;;) { |
112 | u8 *src_p, *dst_p; | 116 | unsigned int n = nbytes; |
113 | int in_place; | 117 | u8 *tmp = NULL; |
118 | |||
119 | if (!scatterwalk_aligned(&walk_in, alignmask) || | ||
120 | !scatterwalk_aligned(&walk_out, alignmask)) { | ||
121 | if (!buffer) { | ||
122 | buffer = __get_free_page(GFP_ATOMIC); | ||
123 | if (!buffer) | ||
124 | n = 0; | ||
125 | } | ||
126 | tmp = (u8 *)buffer; | ||
127 | } | ||
114 | 128 | ||
115 | scatterwalk_map(&walk_in, 0); | 129 | scatterwalk_map(&walk_in, 0); |
116 | scatterwalk_map(&walk_out, 1); | 130 | scatterwalk_map(&walk_out, 1); |
117 | 131 | ||
118 | in_place = scatterwalk_samebuf(&walk_in, &walk_out); | 132 | n = scatterwalk_clamp(&walk_in, n); |
119 | 133 | n = scatterwalk_clamp(&walk_out, n); | |
120 | do { | ||
121 | src_p = prepare_src(&walk_in, bsize, tmp_src, | ||
122 | in_place); | ||
123 | dst_p = prepare_dst(&walk_out, bsize, tmp_dst, | ||
124 | in_place); | ||
125 | |||
126 | prfn(tfm, dst_p, src_p, crfn, info); | ||
127 | 134 | ||
128 | complete_src(&walk_in, bsize, src_p, in_place); | 135 | if (likely(n >= bsize)) |
129 | complete_dst(&walk_out, bsize, dst_p, in_place); | 136 | n = crypt_fast(desc, &walk_in, &walk_out, n, tmp); |
137 | else | ||
138 | n = crypt_slow(desc, &walk_in, &walk_out, bsize); | ||
130 | 139 | ||
131 | nbytes -= bsize; | 140 | nbytes -= n; |
132 | } while (nbytes && | ||
133 | !scatterwalk_across_pages(&walk_in, bsize) && | ||
134 | !scatterwalk_across_pages(&walk_out, bsize)); | ||
135 | 141 | ||
136 | scatterwalk_done(&walk_in, 0, nbytes); | 142 | scatterwalk_done(&walk_in, 0, nbytes); |
137 | scatterwalk_done(&walk_out, 1, nbytes); | 143 | scatterwalk_done(&walk_out, 1, nbytes); |
138 | 144 | ||
139 | if (!nbytes) | 145 | if (!nbytes) |
140 | return 0; | 146 | break; |
141 | 147 | ||
142 | crypto_yield(tfm); | 148 | crypto_yield(tfm); |
143 | } | 149 | } |
150 | |||
151 | if (buffer) | ||
152 | free_page(buffer); | ||
153 | |||
154 | return 0; | ||
144 | } | 155 | } |
145 | 156 | ||
146 | static void cbc_process_encrypt(struct crypto_tfm *tfm, u8 *dst, u8 *src, | 157 | static int crypt_iv_unaligned(struct cipher_desc *desc, |
147 | cryptfn_t fn, void *info) | 158 | struct scatterlist *dst, |
159 | struct scatterlist *src, | ||
160 | unsigned int nbytes) | ||
148 | { | 161 | { |
149 | u8 *iv = info; | 162 | struct crypto_tfm *tfm = desc->tfm; |
163 | unsigned int alignmask = crypto_tfm_alg_alignmask(tfm); | ||
164 | u8 *iv = desc->info; | ||
150 | 165 | ||
151 | tfm->crt_u.cipher.cit_xor_block(iv, src); | 166 | if (unlikely(((unsigned long)iv & alignmask))) { |
152 | fn(crypto_tfm_ctx(tfm), dst, iv); | 167 | unsigned int ivsize = tfm->crt_cipher.cit_ivsize; |
153 | memcpy(iv, dst, crypto_tfm_alg_blocksize(tfm)); | 168 | u8 buffer[ivsize + alignmask]; |
169 | u8 *tmp = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1); | ||
170 | int err; | ||
171 | |||
172 | desc->info = memcpy(tmp, iv, ivsize); | ||
173 | err = crypt(desc, dst, src, nbytes); | ||
174 | memcpy(iv, tmp, ivsize); | ||
175 | |||
176 | return err; | ||
177 | } | ||
178 | |||
179 | return crypt(desc, dst, src, nbytes); | ||
154 | } | 180 | } |
155 | 181 | ||
156 | static void cbc_process_decrypt(struct crypto_tfm *tfm, u8 *dst, u8 *src, | 182 | static unsigned int cbc_process_encrypt(const struct cipher_desc *desc, |
157 | cryptfn_t fn, void *info) | 183 | u8 *dst, const u8 *src, |
184 | unsigned int nbytes) | ||
158 | { | 185 | { |
159 | u8 *iv = info; | 186 | struct crypto_tfm *tfm = desc->tfm; |
187 | void (*xor)(u8 *, const u8 *) = tfm->crt_u.cipher.cit_xor_block; | ||
188 | int bsize = crypto_tfm_alg_blocksize(tfm); | ||
189 | |||
190 | void (*fn)(void *, u8 *, const u8 *) = desc->crfn; | ||
191 | u8 *iv = desc->info; | ||
192 | unsigned int done = 0; | ||
193 | |||
194 | do { | ||
195 | xor(iv, src); | ||
196 | fn(crypto_tfm_ctx(tfm), dst, iv); | ||
197 | memcpy(iv, dst, bsize); | ||
160 | 198 | ||
161 | fn(crypto_tfm_ctx(tfm), dst, src); | 199 | src += bsize; |
162 | tfm->crt_u.cipher.cit_xor_block(dst, iv); | 200 | dst += bsize; |
163 | memcpy(iv, src, crypto_tfm_alg_blocksize(tfm)); | 201 | } while ((done += bsize) < nbytes); |
202 | |||
203 | return done; | ||
164 | } | 204 | } |
165 | 205 | ||
166 | static void ecb_process(struct crypto_tfm *tfm, u8 *dst, u8 *src, | 206 | static unsigned int cbc_process_decrypt(const struct cipher_desc *desc, |
167 | cryptfn_t fn, void *info) | 207 | u8 *dst, const u8 *src, |
208 | unsigned int nbytes) | ||
168 | { | 209 | { |
169 | fn(crypto_tfm_ctx(tfm), dst, src); | 210 | struct crypto_tfm *tfm = desc->tfm; |
211 | void (*xor)(u8 *, const u8 *) = tfm->crt_u.cipher.cit_xor_block; | ||
212 | int bsize = crypto_tfm_alg_blocksize(tfm); | ||
213 | |||
214 | u8 stack[src == dst ? bsize : 0]; | ||
215 | u8 *buf = stack; | ||
216 | u8 **dst_p = src == dst ? &buf : &dst; | ||
217 | |||
218 | void (*fn)(void *, u8 *, const u8 *) = desc->crfn; | ||
219 | u8 *iv = desc->info; | ||
220 | unsigned int done = 0; | ||
221 | |||
222 | do { | ||
223 | u8 *tmp_dst = *dst_p; | ||
224 | |||
225 | fn(crypto_tfm_ctx(tfm), tmp_dst, src); | ||
226 | xor(tmp_dst, iv); | ||
227 | memcpy(iv, src, bsize); | ||
228 | if (tmp_dst != dst) | ||
229 | memcpy(dst, tmp_dst, bsize); | ||
230 | |||
231 | src += bsize; | ||
232 | dst += bsize; | ||
233 | } while ((done += bsize) < nbytes); | ||
234 | |||
235 | return done; | ||
236 | } | ||
237 | |||
238 | static unsigned int ecb_process(const struct cipher_desc *desc, u8 *dst, | ||
239 | const u8 *src, unsigned int nbytes) | ||
240 | { | ||
241 | struct crypto_tfm *tfm = desc->tfm; | ||
242 | int bsize = crypto_tfm_alg_blocksize(tfm); | ||
243 | void (*fn)(void *, u8 *, const u8 *) = desc->crfn; | ||
244 | unsigned int done = 0; | ||
245 | |||
246 | do { | ||
247 | fn(crypto_tfm_ctx(tfm), dst, src); | ||
248 | |||
249 | src += bsize; | ||
250 | dst += bsize; | ||
251 | } while ((done += bsize) < nbytes); | ||
252 | |||
253 | return done; | ||
170 | } | 254 | } |
171 | 255 | ||
172 | static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) | 256 | static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) |
@@ -185,9 +269,14 @@ static int ecb_encrypt(struct crypto_tfm *tfm, | |||
185 | struct scatterlist *dst, | 269 | struct scatterlist *dst, |
186 | struct scatterlist *src, unsigned int nbytes) | 270 | struct scatterlist *src, unsigned int nbytes) |
187 | { | 271 | { |
188 | return crypt(tfm, dst, src, nbytes, | 272 | struct cipher_desc desc; |
189 | tfm->__crt_alg->cra_cipher.cia_encrypt, | 273 | struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; |
190 | ecb_process, NULL); | 274 | |
275 | desc.tfm = tfm; | ||
276 | desc.crfn = cipher->cia_encrypt; | ||
277 | desc.prfn = cipher->cia_encrypt_ecb ?: ecb_process; | ||
278 | |||
279 | return crypt(&desc, dst, src, nbytes); | ||
191 | } | 280 | } |
192 | 281 | ||
193 | static int ecb_decrypt(struct crypto_tfm *tfm, | 282 | static int ecb_decrypt(struct crypto_tfm *tfm, |
@@ -195,9 +284,14 @@ static int ecb_decrypt(struct crypto_tfm *tfm, | |||
195 | struct scatterlist *src, | 284 | struct scatterlist *src, |
196 | unsigned int nbytes) | 285 | unsigned int nbytes) |
197 | { | 286 | { |
198 | return crypt(tfm, dst, src, nbytes, | 287 | struct cipher_desc desc; |
199 | tfm->__crt_alg->cra_cipher.cia_decrypt, | 288 | struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; |
200 | ecb_process, NULL); | 289 | |
290 | desc.tfm = tfm; | ||
291 | desc.crfn = cipher->cia_decrypt; | ||
292 | desc.prfn = cipher->cia_decrypt_ecb ?: ecb_process; | ||
293 | |||
294 | return crypt(&desc, dst, src, nbytes); | ||
201 | } | 295 | } |
202 | 296 | ||
203 | static int cbc_encrypt(struct crypto_tfm *tfm, | 297 | static int cbc_encrypt(struct crypto_tfm *tfm, |
@@ -205,9 +299,15 @@ static int cbc_encrypt(struct crypto_tfm *tfm, | |||
205 | struct scatterlist *src, | 299 | struct scatterlist *src, |
206 | unsigned int nbytes) | 300 | unsigned int nbytes) |
207 | { | 301 | { |
208 | return crypt(tfm, dst, src, nbytes, | 302 | struct cipher_desc desc; |
209 | tfm->__crt_alg->cra_cipher.cia_encrypt, | 303 | struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; |
210 | cbc_process_encrypt, tfm->crt_cipher.cit_iv); | 304 | |
305 | desc.tfm = tfm; | ||
306 | desc.crfn = cipher->cia_encrypt; | ||
307 | desc.prfn = cipher->cia_encrypt_cbc ?: cbc_process_encrypt; | ||
308 | desc.info = tfm->crt_cipher.cit_iv; | ||
309 | |||
310 | return crypt(&desc, dst, src, nbytes); | ||
211 | } | 311 | } |
212 | 312 | ||
213 | static int cbc_encrypt_iv(struct crypto_tfm *tfm, | 313 | static int cbc_encrypt_iv(struct crypto_tfm *tfm, |
@@ -215,9 +315,15 @@ static int cbc_encrypt_iv(struct crypto_tfm *tfm, | |||
215 | struct scatterlist *src, | 315 | struct scatterlist *src, |
216 | unsigned int nbytes, u8 *iv) | 316 | unsigned int nbytes, u8 *iv) |
217 | { | 317 | { |
218 | return crypt(tfm, dst, src, nbytes, | 318 | struct cipher_desc desc; |
219 | tfm->__crt_alg->cra_cipher.cia_encrypt, | 319 | struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; |
220 | cbc_process_encrypt, iv); | 320 | |
321 | desc.tfm = tfm; | ||
322 | desc.crfn = cipher->cia_encrypt; | ||
323 | desc.prfn = cipher->cia_encrypt_cbc ?: cbc_process_encrypt; | ||
324 | desc.info = iv; | ||
325 | |||
326 | return crypt_iv_unaligned(&desc, dst, src, nbytes); | ||
221 | } | 327 | } |
222 | 328 | ||
223 | static int cbc_decrypt(struct crypto_tfm *tfm, | 329 | static int cbc_decrypt(struct crypto_tfm *tfm, |
@@ -225,9 +331,15 @@ static int cbc_decrypt(struct crypto_tfm *tfm, | |||
225 | struct scatterlist *src, | 331 | struct scatterlist *src, |
226 | unsigned int nbytes) | 332 | unsigned int nbytes) |
227 | { | 333 | { |
228 | return crypt(tfm, dst, src, nbytes, | 334 | struct cipher_desc desc; |
229 | tfm->__crt_alg->cra_cipher.cia_decrypt, | 335 | struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; |
230 | cbc_process_decrypt, tfm->crt_cipher.cit_iv); | 336 | |
337 | desc.tfm = tfm; | ||
338 | desc.crfn = cipher->cia_decrypt; | ||
339 | desc.prfn = cipher->cia_decrypt_cbc ?: cbc_process_decrypt; | ||
340 | desc.info = tfm->crt_cipher.cit_iv; | ||
341 | |||
342 | return crypt(&desc, dst, src, nbytes); | ||
231 | } | 343 | } |
232 | 344 | ||
233 | static int cbc_decrypt_iv(struct crypto_tfm *tfm, | 345 | static int cbc_decrypt_iv(struct crypto_tfm *tfm, |
@@ -235,9 +347,15 @@ static int cbc_decrypt_iv(struct crypto_tfm *tfm, | |||
235 | struct scatterlist *src, | 347 | struct scatterlist *src, |
236 | unsigned int nbytes, u8 *iv) | 348 | unsigned int nbytes, u8 *iv) |
237 | { | 349 | { |
238 | return crypt(tfm, dst, src, nbytes, | 350 | struct cipher_desc desc; |
239 | tfm->__crt_alg->cra_cipher.cia_decrypt, | 351 | struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; |
240 | cbc_process_decrypt, iv); | 352 | |
353 | desc.tfm = tfm; | ||
354 | desc.crfn = cipher->cia_decrypt; | ||
355 | desc.prfn = cipher->cia_decrypt_cbc ?: cbc_process_decrypt; | ||
356 | desc.info = iv; | ||
357 | |||
358 | return crypt_iv_unaligned(&desc, dst, src, nbytes); | ||
241 | } | 359 | } |
242 | 360 | ||
243 | static int nocrypt(struct crypto_tfm *tfm, | 361 | static int nocrypt(struct crypto_tfm *tfm, |
@@ -306,6 +424,8 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm) | |||
306 | } | 424 | } |
307 | 425 | ||
308 | if (ops->cit_mode == CRYPTO_TFM_MODE_CBC) { | 426 | if (ops->cit_mode == CRYPTO_TFM_MODE_CBC) { |
427 | unsigned int align; | ||
428 | unsigned long addr; | ||
309 | 429 | ||
310 | switch (crypto_tfm_alg_blocksize(tfm)) { | 430 | switch (crypto_tfm_alg_blocksize(tfm)) { |
311 | case 8: | 431 | case 8: |
@@ -325,9 +445,11 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm) | |||
325 | } | 445 | } |
326 | 446 | ||
327 | ops->cit_ivsize = crypto_tfm_alg_blocksize(tfm); | 447 | ops->cit_ivsize = crypto_tfm_alg_blocksize(tfm); |
328 | ops->cit_iv = kmalloc(ops->cit_ivsize, GFP_KERNEL); | 448 | align = crypto_tfm_alg_alignmask(tfm) + 1; |
329 | if (ops->cit_iv == NULL) | 449 | addr = (unsigned long)crypto_tfm_ctx(tfm); |
330 | ret = -ENOMEM; | 450 | addr = ALIGN(addr, align); |
451 | addr += ALIGN(tfm->__crt_alg->cra_ctxsize, align); | ||
452 | ops->cit_iv = (void *)addr; | ||
331 | } | 453 | } |
332 | 454 | ||
333 | out: | 455 | out: |
@@ -336,6 +458,4 @@ out: | |||
336 | 458 | ||
337 | void crypto_exit_cipher_ops(struct crypto_tfm *tfm) | 459 | void crypto_exit_cipher_ops(struct crypto_tfm *tfm) |
338 | { | 460 | { |
339 | if (tfm->crt_cipher.cit_iv) | ||
340 | kfree(tfm->crt_cipher.cit_iv); | ||
341 | } | 461 | } |
diff --git a/crypto/des.c b/crypto/des.c index 1c7e6de9356c..a3c863dddded 100644 --- a/crypto/des.c +++ b/crypto/des.c | |||
@@ -1,18 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * Cryptographic API. | 2 | * Cryptographic API. |
3 | * | 3 | * |
4 | * DES & Triple DES EDE Cipher Algorithms. | 4 | * DES & Triple DES EDE Cipher Algorithms. |
5 | * | 5 | * |
6 | * Originally released as descore by Dana L. How <how@isl.stanford.edu>. | 6 | * Copyright (c) 2005 Dag Arne Osvik <da@osvik.no> |
7 | * Modified by Raimar Falke <rf13@inf.tu-dresden.de> for the Linux-Kernel. | ||
8 | * Derived from Cryptoapi and Nettle implementations, adapted for in-place | ||
9 | * scatterlist interface. Changed LGPL to GPL per section 3 of the LGPL. | ||
10 | * | ||
11 | * Copyright (c) 1992 Dana L. How. | ||
12 | * Copyright (c) Raimar Falke <rf13@inf.tu-dresden.de> | ||
13 | * Copyright (c) Gisle Sælensminde <gisle@ii.uib.no> | ||
14 | * Copyright (C) 2001 Niels Möller. | ||
15 | * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> | ||
16 | * | 7 | * |
17 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
18 | * it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
@@ -20,11 +11,11 @@ | |||
20 | * (at your option) any later version. | 11 | * (at your option) any later version. |
21 | * | 12 | * |
22 | */ | 13 | */ |
14 | |||
15 | #include <linux/bitops.h> | ||
23 | #include <linux/init.h> | 16 | #include <linux/init.h> |
24 | #include <linux/module.h> | 17 | #include <linux/module.h> |
25 | #include <linux/mm.h> | ||
26 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
27 | #include <asm/scatterlist.h> | ||
28 | #include <linux/crypto.h> | 19 | #include <linux/crypto.h> |
29 | 20 | ||
30 | #define DES_KEY_SIZE 8 | 21 | #define DES_KEY_SIZE 8 |
@@ -35,1157 +26,826 @@ | |||
35 | #define DES3_EDE_EXPKEY_WORDS (3 * DES_EXPKEY_WORDS) | 26 | #define DES3_EDE_EXPKEY_WORDS (3 * DES_EXPKEY_WORDS) |
36 | #define DES3_EDE_BLOCK_SIZE DES_BLOCK_SIZE | 27 | #define DES3_EDE_BLOCK_SIZE DES_BLOCK_SIZE |
37 | 28 | ||
38 | #define ROR(d,c,o) ((d) = (d) >> (c) | (d) << (o)) | 29 | #define ROL(x, r) ((x) = rol32((x), (r))) |
30 | #define ROR(x, r) ((x) = ror32((x), (r))) | ||
39 | 31 | ||
40 | struct des_ctx { | 32 | struct des_ctx { |
41 | u8 iv[DES_BLOCK_SIZE]; | ||
42 | u32 expkey[DES_EXPKEY_WORDS]; | 33 | u32 expkey[DES_EXPKEY_WORDS]; |
43 | }; | 34 | }; |
44 | 35 | ||
45 | struct des3_ede_ctx { | 36 | struct des3_ede_ctx { |
46 | u8 iv[DES_BLOCK_SIZE]; | ||
47 | u32 expkey[DES3_EDE_EXPKEY_WORDS]; | 37 | u32 expkey[DES3_EDE_EXPKEY_WORDS]; |
48 | }; | 38 | }; |
49 | 39 | ||
50 | static const u32 des_keymap[] = { | 40 | /* Lookup tables for key expansion */ |
51 | 0x02080008, 0x02082000, 0x00002008, 0x00000000, | 41 | |
52 | 0x02002000, 0x00080008, 0x02080000, 0x02082008, | 42 | static const u8 pc1[256] = { |
53 | 0x00000008, 0x02000000, 0x00082000, 0x00002008, | 43 | 0x00, 0x00, 0x40, 0x04, 0x10, 0x10, 0x50, 0x14, |
54 | 0x00082008, 0x02002008, 0x02000008, 0x02080000, | 44 | 0x04, 0x40, 0x44, 0x44, 0x14, 0x50, 0x54, 0x54, |
55 | 0x00002000, 0x00082008, 0x00080008, 0x02002000, | 45 | 0x02, 0x02, 0x42, 0x06, 0x12, 0x12, 0x52, 0x16, |
56 | 0x02082008, 0x02000008, 0x00000000, 0x00082000, | 46 | 0x06, 0x42, 0x46, 0x46, 0x16, 0x52, 0x56, 0x56, |
57 | 0x02000000, 0x00080000, 0x02002008, 0x02080008, | 47 | 0x80, 0x08, 0xc0, 0x0c, 0x90, 0x18, 0xd0, 0x1c, |
58 | 0x00080000, 0x00002000, 0x02082000, 0x00000008, | 48 | 0x84, 0x48, 0xc4, 0x4c, 0x94, 0x58, 0xd4, 0x5c, |
59 | 0x00080000, 0x00002000, 0x02000008, 0x02082008, | 49 | 0x82, 0x0a, 0xc2, 0x0e, 0x92, 0x1a, 0xd2, 0x1e, |
60 | 0x00002008, 0x02000000, 0x00000000, 0x00082000, | 50 | 0x86, 0x4a, 0xc6, 0x4e, 0x96, 0x5a, 0xd6, 0x5e, |
61 | 0x02080008, 0x02002008, 0x02002000, 0x00080008, | 51 | 0x20, 0x20, 0x60, 0x24, 0x30, 0x30, 0x70, 0x34, |
62 | 0x02082000, 0x00000008, 0x00080008, 0x02002000, | 52 | 0x24, 0x60, 0x64, 0x64, 0x34, 0x70, 0x74, 0x74, |
63 | 0x02082008, 0x00080000, 0x02080000, 0x02000008, | 53 | 0x22, 0x22, 0x62, 0x26, 0x32, 0x32, 0x72, 0x36, |
64 | 0x00082000, 0x00002008, 0x02002008, 0x02080000, | 54 | 0x26, 0x62, 0x66, 0x66, 0x36, 0x72, 0x76, 0x76, |
65 | 0x00000008, 0x02082000, 0x00082008, 0x00000000, | 55 | 0xa0, 0x28, 0xe0, 0x2c, 0xb0, 0x38, 0xf0, 0x3c, |
66 | 0x02000000, 0x02080008, 0x00002000, 0x00082008, | 56 | 0xa4, 0x68, 0xe4, 0x6c, 0xb4, 0x78, 0xf4, 0x7c, |
67 | 57 | 0xa2, 0x2a, 0xe2, 0x2e, 0xb2, 0x3a, 0xf2, 0x3e, | |
68 | 0x08000004, 0x00020004, 0x00000000, 0x08020200, | 58 | 0xa6, 0x6a, 0xe6, 0x6e, 0xb6, 0x7a, 0xf6, 0x7e, |
69 | 0x00020004, 0x00000200, 0x08000204, 0x00020000, | 59 | 0x08, 0x80, 0x48, 0x84, 0x18, 0x90, 0x58, 0x94, |
70 | 0x00000204, 0x08020204, 0x00020200, 0x08000000, | 60 | 0x0c, 0xc0, 0x4c, 0xc4, 0x1c, 0xd0, 0x5c, 0xd4, |
71 | 0x08000200, 0x08000004, 0x08020000, 0x00020204, | 61 | 0x0a, 0x82, 0x4a, 0x86, 0x1a, 0x92, 0x5a, 0x96, |
72 | 0x00020000, 0x08000204, 0x08020004, 0x00000000, | 62 | 0x0e, 0xc2, 0x4e, 0xc6, 0x1e, 0xd2, 0x5e, 0xd6, |
73 | 0x00000200, 0x00000004, 0x08020200, 0x08020004, | 63 | 0x88, 0x88, 0xc8, 0x8c, 0x98, 0x98, 0xd8, 0x9c, |
74 | 0x08020204, 0x08020000, 0x08000000, 0x00000204, | 64 | 0x8c, 0xc8, 0xcc, 0xcc, 0x9c, 0xd8, 0xdc, 0xdc, |
75 | 0x00000004, 0x00020200, 0x00020204, 0x08000200, | 65 | 0x8a, 0x8a, 0xca, 0x8e, 0x9a, 0x9a, 0xda, 0x9e, |
76 | 0x00000204, 0x08000000, 0x08000200, 0x00020204, | 66 | 0x8e, 0xca, 0xce, 0xce, 0x9e, 0xda, 0xde, 0xde, |
77 | 0x08020200, 0x00020004, 0x00000000, 0x08000200, | 67 | 0x28, 0xa0, 0x68, 0xa4, 0x38, 0xb0, 0x78, 0xb4, |
78 | 0x08000000, 0x00000200, 0x08020004, 0x00020000, | 68 | 0x2c, 0xe0, 0x6c, 0xe4, 0x3c, 0xf0, 0x7c, 0xf4, |
79 | 0x00020004, 0x08020204, 0x00020200, 0x00000004, | 69 | 0x2a, 0xa2, 0x6a, 0xa6, 0x3a, 0xb2, 0x7a, 0xb6, |
80 | 0x08020204, 0x00020200, 0x00020000, 0x08000204, | 70 | 0x2e, 0xe2, 0x6e, 0xe6, 0x3e, 0xf2, 0x7e, 0xf6, |
81 | 0x08000004, 0x08020000, 0x00020204, 0x00000000, | 71 | 0xa8, 0xa8, 0xe8, 0xac, 0xb8, 0xb8, 0xf8, 0xbc, |
82 | 0x00000200, 0x08000004, 0x08000204, 0x08020200, | 72 | 0xac, 0xe8, 0xec, 0xec, 0xbc, 0xf8, 0xfc, 0xfc, |
83 | 0x08020000, 0x00000204, 0x00000004, 0x08020004, | 73 | 0xaa, 0xaa, 0xea, 0xae, 0xba, 0xba, 0xfa, 0xbe, |
84 | 74 | 0xae, 0xea, 0xee, 0xee, 0xbe, 0xfa, 0xfe, 0xfe | |
85 | 0x80040100, 0x01000100, 0x80000000, 0x81040100, | ||
86 | 0x00000000, 0x01040000, 0x81000100, 0x80040000, | ||
87 | 0x01040100, 0x81000000, 0x01000000, 0x80000100, | ||
88 | 0x81000000, 0x80040100, 0x00040000, 0x01000000, | ||
89 | 0x81040000, 0x00040100, 0x00000100, 0x80000000, | ||
90 | 0x00040100, 0x81000100, 0x01040000, 0x00000100, | ||
91 | 0x80000100, 0x00000000, 0x80040000, 0x01040100, | ||
92 | 0x01000100, 0x81040000, 0x81040100, 0x00040000, | ||
93 | 0x81040000, 0x80000100, 0x00040000, 0x81000000, | ||
94 | 0x00040100, 0x01000100, 0x80000000, 0x01040000, | ||
95 | 0x81000100, 0x00000000, 0x00000100, 0x80040000, | ||
96 | 0x00000000, 0x81040000, 0x01040100, 0x00000100, | ||
97 | 0x01000000, 0x81040100, 0x80040100, 0x00040000, | ||
98 | 0x81040100, 0x80000000, 0x01000100, 0x80040100, | ||
99 | 0x80040000, 0x00040100, 0x01040000, 0x81000100, | ||
100 | 0x80000100, 0x01000000, 0x81000000, 0x01040100, | ||
101 | |||
102 | 0x04010801, 0x00000000, 0x00010800, 0x04010000, | ||
103 | 0x04000001, 0x00000801, 0x04000800, 0x00010800, | ||
104 | 0x00000800, 0x04010001, 0x00000001, 0x04000800, | ||
105 | 0x00010001, 0x04010800, 0x04010000, 0x00000001, | ||
106 | 0x00010000, 0x04000801, 0x04010001, 0x00000800, | ||
107 | 0x00010801, 0x04000000, 0x00000000, 0x00010001, | ||
108 | 0x04000801, 0x00010801, 0x04010800, 0x04000001, | ||
109 | 0x04000000, 0x00010000, 0x00000801, 0x04010801, | ||
110 | 0x00010001, 0x04010800, 0x04000800, 0x00010801, | ||
111 | 0x04010801, 0x00010001, 0x04000001, 0x00000000, | ||
112 | 0x04000000, 0x00000801, 0x00010000, 0x04010001, | ||
113 | 0x00000800, 0x04000000, 0x00010801, 0x04000801, | ||
114 | 0x04010800, 0x00000800, 0x00000000, 0x04000001, | ||
115 | 0x00000001, 0x04010801, 0x00010800, 0x04010000, | ||
116 | 0x04010001, 0x00010000, 0x00000801, 0x04000800, | ||
117 | 0x04000801, 0x00000001, 0x04010000, 0x00010800, | ||
118 | |||
119 | 0x00000400, 0x00000020, 0x00100020, 0x40100000, | ||
120 | 0x40100420, 0x40000400, 0x00000420, 0x00000000, | ||
121 | 0x00100000, 0x40100020, 0x40000020, 0x00100400, | ||
122 | 0x40000000, 0x00100420, 0x00100400, 0x40000020, | ||
123 | 0x40100020, 0x00000400, 0x40000400, 0x40100420, | ||
124 | 0x00000000, 0x00100020, 0x40100000, 0x00000420, | ||
125 | 0x40100400, 0x40000420, 0x00100420, 0x40000000, | ||
126 | 0x40000420, 0x40100400, 0x00000020, 0x00100000, | ||
127 | 0x40000420, 0x00100400, 0x40100400, 0x40000020, | ||
128 | 0x00000400, 0x00000020, 0x00100000, 0x40100400, | ||
129 | 0x40100020, 0x40000420, 0x00000420, 0x00000000, | ||
130 | 0x00000020, 0x40100000, 0x40000000, 0x00100020, | ||
131 | 0x00000000, 0x40100020, 0x00100020, 0x00000420, | ||
132 | 0x40000020, 0x00000400, 0x40100420, 0x00100000, | ||
133 | 0x00100420, 0x40000000, 0x40000400, 0x40100420, | ||
134 | 0x40100000, 0x00100420, 0x00100400, 0x40000400, | ||
135 | |||
136 | 0x00800000, 0x00001000, 0x00000040, 0x00801042, | ||
137 | 0x00801002, 0x00800040, 0x00001042, 0x00801000, | ||
138 | 0x00001000, 0x00000002, 0x00800002, 0x00001040, | ||
139 | 0x00800042, 0x00801002, 0x00801040, 0x00000000, | ||
140 | 0x00001040, 0x00800000, 0x00001002, 0x00000042, | ||
141 | 0x00800040, 0x00001042, 0x00000000, 0x00800002, | ||
142 | 0x00000002, 0x00800042, 0x00801042, 0x00001002, | ||
143 | 0x00801000, 0x00000040, 0x00000042, 0x00801040, | ||
144 | 0x00801040, 0x00800042, 0x00001002, 0x00801000, | ||
145 | 0x00001000, 0x00000002, 0x00800002, 0x00800040, | ||
146 | 0x00800000, 0x00001040, 0x00801042, 0x00000000, | ||
147 | 0x00001042, 0x00800000, 0x00000040, 0x00001002, | ||
148 | 0x00800042, 0x00000040, 0x00000000, 0x00801042, | ||
149 | 0x00801002, 0x00801040, 0x00000042, 0x00001000, | ||
150 | 0x00001040, 0x00801002, 0x00800040, 0x00000042, | ||
151 | 0x00000002, 0x00001042, 0x00801000, 0x00800002, | ||
152 | |||
153 | 0x10400000, 0x00404010, 0x00000010, 0x10400010, | ||
154 | 0x10004000, 0x00400000, 0x10400010, 0x00004010, | ||
155 | 0x00400010, 0x00004000, 0x00404000, 0x10000000, | ||
156 | 0x10404010, 0x10000010, 0x10000000, 0x10404000, | ||
157 | 0x00000000, 0x10004000, 0x00404010, 0x00000010, | ||
158 | 0x10000010, 0x10404010, 0x00004000, 0x10400000, | ||
159 | 0x10404000, 0x00400010, 0x10004010, 0x00404000, | ||
160 | 0x00004010, 0x00000000, 0x00400000, 0x10004010, | ||
161 | 0x00404010, 0x00000010, 0x10000000, 0x00004000, | ||
162 | 0x10000010, 0x10004000, 0x00404000, 0x10400010, | ||
163 | 0x00000000, 0x00404010, 0x00004010, 0x10404000, | ||
164 | 0x10004000, 0x00400000, 0x10404010, 0x10000000, | ||
165 | 0x10004010, 0x10400000, 0x00400000, 0x10404010, | ||
166 | 0x00004000, 0x00400010, 0x10400010, 0x00004010, | ||
167 | 0x00400010, 0x00000000, 0x10404000, 0x10000010, | ||
168 | 0x10400000, 0x10004010, 0x00000010, 0x00404000, | ||
169 | |||
170 | 0x00208080, 0x00008000, 0x20200000, 0x20208080, | ||
171 | 0x00200000, 0x20008080, 0x20008000, 0x20200000, | ||
172 | 0x20008080, 0x00208080, 0x00208000, 0x20000080, | ||
173 | 0x20200080, 0x00200000, 0x00000000, 0x20008000, | ||
174 | 0x00008000, 0x20000000, 0x00200080, 0x00008080, | ||
175 | 0x20208080, 0x00208000, 0x20000080, 0x00200080, | ||
176 | 0x20000000, 0x00000080, 0x00008080, 0x20208000, | ||
177 | 0x00000080, 0x20200080, 0x20208000, 0x00000000, | ||
178 | 0x00000000, 0x20208080, 0x00200080, 0x20008000, | ||
179 | 0x00208080, 0x00008000, 0x20000080, 0x00200080, | ||
180 | 0x20208000, 0x00000080, 0x00008080, 0x20200000, | ||
181 | 0x20008080, 0x20000000, 0x20200000, 0x00208000, | ||
182 | 0x20208080, 0x00008080, 0x00208000, 0x20200080, | ||
183 | 0x00200000, 0x20000080, 0x20008000, 0x00000000, | ||
184 | 0x00008000, 0x00200000, 0x20200080, 0x00208080, | ||
185 | 0x20000000, 0x20208000, 0x00000080, 0x20008080, | ||
186 | }; | 75 | }; |
187 | 76 | ||
188 | static const u8 rotors[] = { | 77 | static const u8 rs[256] = { |
189 | 34, 13, 5, 46, 47, 18, 32, 41, 11, 53, 33, 20, | 78 | 0x00, 0x00, 0x80, 0x80, 0x02, 0x02, 0x82, 0x82, |
190 | 14, 36, 30, 24, 49, 2, 15, 37, 42, 50, 0, 21, | 79 | 0x04, 0x04, 0x84, 0x84, 0x06, 0x06, 0x86, 0x86, |
191 | 38, 48, 6, 26, 39, 4, 52, 25, 12, 27, 31, 40, | 80 | 0x08, 0x08, 0x88, 0x88, 0x0a, 0x0a, 0x8a, 0x8a, |
192 | 1, 17, 28, 29, 23, 51, 35, 7, 3, 22, 9, 43, | 81 | 0x0c, 0x0c, 0x8c, 0x8c, 0x0e, 0x0e, 0x8e, 0x8e, |
193 | 82 | 0x10, 0x10, 0x90, 0x90, 0x12, 0x12, 0x92, 0x92, | |
194 | 41, 20, 12, 53, 54, 25, 39, 48, 18, 31, 40, 27, | 83 | 0x14, 0x14, 0x94, 0x94, 0x16, 0x16, 0x96, 0x96, |
195 | 21, 43, 37, 0, 1, 9, 22, 44, 49, 2, 7, 28, | 84 | 0x18, 0x18, 0x98, 0x98, 0x1a, 0x1a, 0x9a, 0x9a, |
196 | 45, 55, 13, 33, 46, 11, 6, 32, 19, 34, 38, 47, | 85 | 0x1c, 0x1c, 0x9c, 0x9c, 0x1e, 0x1e, 0x9e, 0x9e, |
197 | 8, 24, 35, 36, 30, 3, 42, 14, 10, 29, 16, 50, | 86 | 0x20, 0x20, 0xa0, 0xa0, 0x22, 0x22, 0xa2, 0xa2, |
198 | 87 | 0x24, 0x24, 0xa4, 0xa4, 0x26, 0x26, 0xa6, 0xa6, | |
199 | 55, 34, 26, 38, 11, 39, 53, 5, 32, 45, 54, 41, | 88 | 0x28, 0x28, 0xa8, 0xa8, 0x2a, 0x2a, 0xaa, 0xaa, |
200 | 35, 2, 51, 14, 15, 23, 36, 3, 8, 16, 21, 42, | 89 | 0x2c, 0x2c, 0xac, 0xac, 0x2e, 0x2e, 0xae, 0xae, |
201 | 6, 12, 27, 47, 31, 25, 20, 46, 33, 48, 52, 4, | 90 | 0x30, 0x30, 0xb0, 0xb0, 0x32, 0x32, 0xb2, 0xb2, |
202 | 22, 7, 49, 50, 44, 17, 1, 28, 24, 43, 30, 9, | 91 | 0x34, 0x34, 0xb4, 0xb4, 0x36, 0x36, 0xb6, 0xb6, |
203 | 92 | 0x38, 0x38, 0xb8, 0xb8, 0x3a, 0x3a, 0xba, 0xba, | |
204 | 12, 48, 40, 52, 25, 53, 38, 19, 46, 6, 11, 55, | 93 | 0x3c, 0x3c, 0xbc, 0xbc, 0x3e, 0x3e, 0xbe, 0xbe, |
205 | 49, 16, 10, 28, 29, 37, 50, 17, 22, 30, 35, 1, | 94 | 0x40, 0x40, 0xc0, 0xc0, 0x42, 0x42, 0xc2, 0xc2, |
206 | 20, 26, 41, 4, 45, 39, 34, 31, 47, 5, 13, 18, | 95 | 0x44, 0x44, 0xc4, 0xc4, 0x46, 0x46, 0xc6, 0xc6, |
207 | 36, 21, 8, 9, 3, 0, 15, 42, 7, 2, 44, 23, | 96 | 0x48, 0x48, 0xc8, 0xc8, 0x4a, 0x4a, 0xca, 0xca, |
208 | 97 | 0x4c, 0x4c, 0xcc, 0xcc, 0x4e, 0x4e, 0xce, 0xce, | |
209 | 26, 5, 54, 13, 39, 38, 52, 33, 31, 20, 25, 12, | 98 | 0x50, 0x50, 0xd0, 0xd0, 0x52, 0x52, 0xd2, 0xd2, |
210 | 8, 30, 24, 42, 43, 51, 9, 0, 36, 44, 49, 15, | 99 | 0x54, 0x54, 0xd4, 0xd4, 0x56, 0x56, 0xd6, 0xd6, |
211 | 34, 40, 55, 18, 6, 53, 48, 45, 4, 19, 27, 32, | 100 | 0x58, 0x58, 0xd8, 0xd8, 0x5a, 0x5a, 0xda, 0xda, |
212 | 50, 35, 22, 23, 17, 14, 29, 1, 21, 16, 3, 37, | 101 | 0x5c, 0x5c, 0xdc, 0xdc, 0x5e, 0x5e, 0xde, 0xde, |
213 | 102 | 0x60, 0x60, 0xe0, 0xe0, 0x62, 0x62, 0xe2, 0xe2, | |
214 | 40, 19, 11, 27, 53, 52, 13, 47, 45, 34, 39, 26, | 103 | 0x64, 0x64, 0xe4, 0xe4, 0x66, 0x66, 0xe6, 0xe6, |
215 | 22, 44, 7, 1, 2, 10, 23, 14, 50, 3, 8, 29, | 104 | 0x68, 0x68, 0xe8, 0xe8, 0x6a, 0x6a, 0xea, 0xea, |
216 | 48, 54, 12, 32, 20, 38, 5, 6, 18, 33, 41, 46, | 105 | 0x6c, 0x6c, 0xec, 0xec, 0x6e, 0x6e, 0xee, 0xee, |
217 | 9, 49, 36, 37, 0, 28, 43, 15, 35, 30, 17, 51, | 106 | 0x70, 0x70, 0xf0, 0xf0, 0x72, 0x72, 0xf2, 0xf2, |
218 | 107 | 0x74, 0x74, 0xf4, 0xf4, 0x76, 0x76, 0xf6, 0xf6, | |
219 | 54, 33, 25, 41, 38, 13, 27, 4, 6, 48, 53, 40, | 108 | 0x78, 0x78, 0xf8, 0xf8, 0x7a, 0x7a, 0xfa, 0xfa, |
220 | 36, 3, 21, 15, 16, 24, 37, 28, 9, 17, 22, 43, | 109 | 0x7c, 0x7c, 0xfc, 0xfc, 0x7e, 0x7e, 0xfe, 0xfe |
221 | 5, 11, 26, 46, 34, 52, 19, 20, 32, 47, 55, 31, | ||
222 | 23, 8, 50, 51, 14, 42, 2, 29, 49, 44, 0, 10, | ||
223 | |||
224 | 11, 47, 39, 55, 52, 27, 41, 18, 20, 5, 38, 54, | ||
225 | 50, 17, 35, 29, 30, 7, 51, 42, 23, 0, 36, 2, | ||
226 | 19, 25, 40, 31, 48, 13, 33, 34, 46, 4, 12, 45, | ||
227 | 37, 22, 9, 10, 28, 1, 16, 43, 8, 3, 14, 24, | ||
228 | |||
229 | 18, 54, 46, 5, 6, 34, 48, 25, 27, 12, 45, 4, | ||
230 | 2, 24, 42, 36, 37, 14, 3, 49, 30, 7, 43, 9, | ||
231 | 26, 32, 47, 38, 55, 20, 40, 41, 53, 11, 19, 52, | ||
232 | 44, 29, 16, 17, 35, 8, 23, 50, 15, 10, 21, 0, | ||
233 | |||
234 | 32, 11, 31, 19, 20, 48, 5, 39, 41, 26, 6, 18, | ||
235 | 16, 7, 1, 50, 51, 28, 17, 8, 44, 21, 2, 23, | ||
236 | 40, 46, 4, 52, 12, 34, 54, 55, 38, 25, 33, 13, | ||
237 | 3, 43, 30, 0, 49, 22, 37, 9, 29, 24, 35, 14, | ||
238 | |||
239 | 46, 25, 45, 33, 34, 5, 19, 53, 55, 40, 20, 32, | ||
240 | 30, 21, 15, 9, 10, 42, 0, 22, 3, 35, 16, 37, | ||
241 | 54, 31, 18, 13, 26, 48, 11, 12, 52, 39, 47, 27, | ||
242 | 17, 2, 44, 14, 8, 36, 51, 23, 43, 7, 49, 28, | ||
243 | |||
244 | 31, 39, 6, 47, 48, 19, 33, 38, 12, 54, 34, 46, | ||
245 | 44, 35, 29, 23, 24, 1, 14, 36, 17, 49, 30, 51, | ||
246 | 11, 45, 32, 27, 40, 5, 25, 26, 13, 53, 4, 41, | ||
247 | 0, 16, 3, 28, 22, 50, 10, 37, 2, 21, 8, 42, | ||
248 | |||
249 | 45, 53, 20, 4, 5, 33, 47, 52, 26, 11, 48, 31, | ||
250 | 3, 49, 43, 37, 7, 15, 28, 50, 0, 8, 44, 10, | ||
251 | 25, 6, 46, 41, 54, 19, 39, 40, 27, 38, 18, 55, | ||
252 | 14, 30, 17, 42, 36, 9, 24, 51, 16, 35, 22, 1, | ||
253 | |||
254 | 6, 38, 34, 18, 19, 47, 4, 13, 40, 25, 5, 45, | ||
255 | 17, 8, 2, 51, 21, 29, 42, 9, 14, 22, 3, 24, | ||
256 | 39, 20, 31, 55, 11, 33, 53, 54, 41, 52, 32, 12, | ||
257 | 28, 44, 0, 1, 50, 23, 7, 10, 30, 49, 36, 15, | ||
258 | |||
259 | 20, 52, 48, 32, 33, 4, 18, 27, 54, 39, 19, 6, | ||
260 | 0, 22, 16, 10, 35, 43, 1, 23, 28, 36, 17, 7, | ||
261 | 53, 34, 45, 12, 25, 47, 38, 11, 55, 13, 46, 26, | ||
262 | 42, 3, 14, 15, 9, 37, 21, 24, 44, 8, 50, 29, | ||
263 | |||
264 | 27, 6, 55, 39, 40, 11, 25, 34, 4, 46, 26, 13, | ||
265 | 7, 29, 23, 17, 42, 50, 8, 30, 35, 43, 24, 14, | ||
266 | 31, 41, 52, 19, 32, 54, 45, 18, 5, 20, 53, 33, | ||
267 | 49, 10, 21, 22, 16, 44, 28, 0, 51, 15, 2, 36, | ||
268 | }; | 110 | }; |
269 | 111 | ||
270 | static const u8 parity[] = { | 112 | static const u32 pc2[1024] = { |
271 | 8,1,0,8,0,8,8,0,0,8,8,0,8,0,2,8,0,8,8,0,8,0,0,8,8,0,0,8,0,8,8,3, | 113 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
272 | 0,8,8,0,8,0,0,8,8,0,0,8,0,8,8,0,8,0,0,8,0,8,8,0,0,8,8,0,8,0,0,8, | 114 | 0x00040000, 0x00000000, 0x04000000, 0x00100000, |
273 | 0,8,8,0,8,0,0,8,8,0,0,8,0,8,8,0,8,0,0,8,0,8,8,0,0,8,8,0,8,0,0,8, | 115 | 0x00400000, 0x00000008, 0x00000800, 0x40000000, |
274 | 8,0,0,8,0,8,8,0,0,8,8,0,8,0,0,8,0,8,8,0,8,0,0,8,8,0,0,8,0,8,8,0, | 116 | 0x00440000, 0x00000008, 0x04000800, 0x40100000, |
275 | 0,8,8,0,8,0,0,8,8,0,0,8,0,8,8,0,8,0,0,8,0,8,8,0,0,8,8,0,8,0,0,8, | 117 | 0x00000400, 0x00000020, 0x08000000, 0x00000100, |
276 | 8,0,0,8,0,8,8,0,0,8,8,0,8,0,0,8,0,8,8,0,8,0,0,8,8,0,0,8,0,8,8,0, | 118 | 0x00040400, 0x00000020, 0x0c000000, 0x00100100, |
277 | 8,0,0,8,0,8,8,0,0,8,8,0,8,0,0,8,0,8,8,0,8,0,0,8,8,0,0,8,0,8,8,0, | 119 | 0x00400400, 0x00000028, 0x08000800, 0x40000100, |
278 | 4,8,8,0,8,0,0,8,8,0,0,8,0,8,8,0,8,5,0,8,0,8,8,0,0,8,8,0,8,0,6,8, | 120 | 0x00440400, 0x00000028, 0x0c000800, 0x40100100, |
121 | 0x80000000, 0x00000010, 0x00000000, 0x00800000, | ||
122 | 0x80040000, 0x00000010, 0x04000000, 0x00900000, | ||
123 | 0x80400000, 0x00000018, 0x00000800, 0x40800000, | ||
124 | 0x80440000, 0x00000018, 0x04000800, 0x40900000, | ||
125 | 0x80000400, 0x00000030, 0x08000000, 0x00800100, | ||
126 | 0x80040400, 0x00000030, 0x0c000000, 0x00900100, | ||
127 | 0x80400400, 0x00000038, 0x08000800, 0x40800100, | ||
128 | 0x80440400, 0x00000038, 0x0c000800, 0x40900100, | ||
129 | 0x10000000, 0x00000000, 0x00200000, 0x00001000, | ||
130 | 0x10040000, 0x00000000, 0x04200000, 0x00101000, | ||
131 | 0x10400000, 0x00000008, 0x00200800, 0x40001000, | ||
132 | 0x10440000, 0x00000008, 0x04200800, 0x40101000, | ||
133 | 0x10000400, 0x00000020, 0x08200000, 0x00001100, | ||
134 | 0x10040400, 0x00000020, 0x0c200000, 0x00101100, | ||
135 | 0x10400400, 0x00000028, 0x08200800, 0x40001100, | ||
136 | 0x10440400, 0x00000028, 0x0c200800, 0x40101100, | ||
137 | 0x90000000, 0x00000010, 0x00200000, 0x00801000, | ||
138 | 0x90040000, 0x00000010, 0x04200000, 0x00901000, | ||
139 | 0x90400000, 0x00000018, 0x00200800, 0x40801000, | ||
140 | 0x90440000, 0x00000018, 0x04200800, 0x40901000, | ||
141 | 0x90000400, 0x00000030, 0x08200000, 0x00801100, | ||
142 | 0x90040400, 0x00000030, 0x0c200000, 0x00901100, | ||
143 | 0x90400400, 0x00000038, 0x08200800, 0x40801100, | ||
144 | 0x90440400, 0x00000038, 0x0c200800, 0x40901100, | ||
145 | 0x00000200, 0x00080000, 0x00000000, 0x00000004, | ||
146 | 0x00040200, 0x00080000, 0x04000000, 0x00100004, | ||
147 | 0x00400200, 0x00080008, 0x00000800, 0x40000004, | ||
148 | 0x00440200, 0x00080008, 0x04000800, 0x40100004, | ||
149 | 0x00000600, 0x00080020, 0x08000000, 0x00000104, | ||
150 | 0x00040600, 0x00080020, 0x0c000000, 0x00100104, | ||
151 | 0x00400600, 0x00080028, 0x08000800, 0x40000104, | ||
152 | 0x00440600, 0x00080028, 0x0c000800, 0x40100104, | ||
153 | 0x80000200, 0x00080010, 0x00000000, 0x00800004, | ||
154 | 0x80040200, 0x00080010, 0x04000000, 0x00900004, | ||
155 | 0x80400200, 0x00080018, 0x00000800, 0x40800004, | ||
156 | 0x80440200, 0x00080018, 0x04000800, 0x40900004, | ||
157 | 0x80000600, 0x00080030, 0x08000000, 0x00800104, | ||
158 | 0x80040600, 0x00080030, 0x0c000000, 0x00900104, | ||
159 | 0x80400600, 0x00080038, 0x08000800, 0x40800104, | ||
160 | 0x80440600, 0x00080038, 0x0c000800, 0x40900104, | ||
161 | 0x10000200, 0x00080000, 0x00200000, 0x00001004, | ||
162 | 0x10040200, 0x00080000, 0x04200000, 0x00101004, | ||
163 | 0x10400200, 0x00080008, 0x00200800, 0x40001004, | ||
164 | 0x10440200, 0x00080008, 0x04200800, 0x40101004, | ||
165 | 0x10000600, 0x00080020, 0x08200000, 0x00001104, | ||
166 | 0x10040600, 0x00080020, 0x0c200000, 0x00101104, | ||
167 | 0x10400600, 0x00080028, 0x08200800, 0x40001104, | ||
168 | 0x10440600, 0x00080028, 0x0c200800, 0x40101104, | ||
169 | 0x90000200, 0x00080010, 0x00200000, 0x00801004, | ||
170 | 0x90040200, 0x00080010, 0x04200000, 0x00901004, | ||
171 | 0x90400200, 0x00080018, 0x00200800, 0x40801004, | ||
172 | 0x90440200, 0x00080018, 0x04200800, 0x40901004, | ||
173 | 0x90000600, 0x00080030, 0x08200000, 0x00801104, | ||
174 | 0x90040600, 0x00080030, 0x0c200000, 0x00901104, | ||
175 | 0x90400600, 0x00080038, 0x08200800, 0x40801104, | ||
176 | 0x90440600, 0x00080038, 0x0c200800, 0x40901104, | ||
177 | 0x00000002, 0x00002000, 0x20000000, 0x00000001, | ||
178 | 0x00040002, 0x00002000, 0x24000000, 0x00100001, | ||
179 | 0x00400002, 0x00002008, 0x20000800, 0x40000001, | ||
180 | 0x00440002, 0x00002008, 0x24000800, 0x40100001, | ||
181 | 0x00000402, 0x00002020, 0x28000000, 0x00000101, | ||
182 | 0x00040402, 0x00002020, 0x2c000000, 0x00100101, | ||
183 | 0x00400402, 0x00002028, 0x28000800, 0x40000101, | ||
184 | 0x00440402, 0x00002028, 0x2c000800, 0x40100101, | ||
185 | 0x80000002, 0x00002010, 0x20000000, 0x00800001, | ||
186 | 0x80040002, 0x00002010, 0x24000000, 0x00900001, | ||
187 | 0x80400002, 0x00002018, 0x20000800, 0x40800001, | ||
188 | 0x80440002, 0x00002018, 0x24000800, 0x40900001, | ||
189 | 0x80000402, 0x00002030, 0x28000000, 0x00800101, | ||
190 | 0x80040402, 0x00002030, 0x2c000000, 0x00900101, | ||
191 | 0x80400402, 0x00002038, 0x28000800, 0x40800101, | ||
192 | 0x80440402, 0x00002038, 0x2c000800, 0x40900101, | ||
193 | 0x10000002, 0x00002000, 0x20200000, 0x00001001, | ||
194 | 0x10040002, 0x00002000, 0x24200000, 0x00101001, | ||
195 | 0x10400002, 0x00002008, 0x20200800, 0x40001001, | ||
196 | 0x10440002, 0x00002008, 0x24200800, 0x40101001, | ||
197 | 0x10000402, 0x00002020, 0x28200000, 0x00001101, | ||
198 | 0x10040402, 0x00002020, 0x2c200000, 0x00101101, | ||
199 | 0x10400402, 0x00002028, 0x28200800, 0x40001101, | ||
200 | 0x10440402, 0x00002028, 0x2c200800, 0x40101101, | ||
201 | 0x90000002, 0x00002010, 0x20200000, 0x00801001, | ||
202 | 0x90040002, 0x00002010, 0x24200000, 0x00901001, | ||
203 | 0x90400002, 0x00002018, 0x20200800, 0x40801001, | ||
204 | 0x90440002, 0x00002018, 0x24200800, 0x40901001, | ||
205 | 0x90000402, 0x00002030, 0x28200000, 0x00801101, | ||
206 | 0x90040402, 0x00002030, 0x2c200000, 0x00901101, | ||
207 | 0x90400402, 0x00002038, 0x28200800, 0x40801101, | ||
208 | 0x90440402, 0x00002038, 0x2c200800, 0x40901101, | ||
209 | 0x00000202, 0x00082000, 0x20000000, 0x00000005, | ||
210 | 0x00040202, 0x00082000, 0x24000000, 0x00100005, | ||
211 | 0x00400202, 0x00082008, 0x20000800, 0x40000005, | ||
212 | 0x00440202, 0x00082008, 0x24000800, 0x40100005, | ||
213 | 0x00000602, 0x00082020, 0x28000000, 0x00000105, | ||
214 | 0x00040602, 0x00082020, 0x2c000000, 0x00100105, | ||
215 | 0x00400602, 0x00082028, 0x28000800, 0x40000105, | ||
216 | 0x00440602, 0x00082028, 0x2c000800, 0x40100105, | ||
217 | 0x80000202, 0x00082010, 0x20000000, 0x00800005, | ||
218 | 0x80040202, 0x00082010, 0x24000000, 0x00900005, | ||
219 | 0x80400202, 0x00082018, 0x20000800, 0x40800005, | ||
220 | 0x80440202, 0x00082018, 0x24000800, 0x40900005, | ||
221 | 0x80000602, 0x00082030, 0x28000000, 0x00800105, | ||
222 | 0x80040602, 0x00082030, 0x2c000000, 0x00900105, | ||
223 | 0x80400602, 0x00082038, 0x28000800, 0x40800105, | ||
224 | 0x80440602, 0x00082038, 0x2c000800, 0x40900105, | ||
225 | 0x10000202, 0x00082000, 0x20200000, 0x00001005, | ||
226 | 0x10040202, 0x00082000, 0x24200000, 0x00101005, | ||
227 | 0x10400202, 0x00082008, 0x20200800, 0x40001005, | ||
228 | 0x10440202, 0x00082008, 0x24200800, 0x40101005, | ||
229 | 0x10000602, 0x00082020, 0x28200000, 0x00001105, | ||
230 | 0x10040602, 0x00082020, 0x2c200000, 0x00101105, | ||
231 | 0x10400602, 0x00082028, 0x28200800, 0x40001105, | ||
232 | 0x10440602, 0x00082028, 0x2c200800, 0x40101105, | ||
233 | 0x90000202, 0x00082010, 0x20200000, 0x00801005, | ||
234 | 0x90040202, 0x00082010, 0x24200000, 0x00901005, | ||
235 | 0x90400202, 0x00082018, 0x20200800, 0x40801005, | ||
236 | 0x90440202, 0x00082018, 0x24200800, 0x40901005, | ||
237 | 0x90000602, 0x00082030, 0x28200000, 0x00801105, | ||
238 | 0x90040602, 0x00082030, 0x2c200000, 0x00901105, | ||
239 | 0x90400602, 0x00082038, 0x28200800, 0x40801105, | ||
240 | 0x90440602, 0x00082038, 0x2c200800, 0x40901105, | ||
241 | |||
242 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, | ||
243 | 0x00000000, 0x00000008, 0x00080000, 0x10000000, | ||
244 | 0x02000000, 0x00000000, 0x00000080, 0x00001000, | ||
245 | 0x02000000, 0x00000008, 0x00080080, 0x10001000, | ||
246 | 0x00004000, 0x00000000, 0x00000040, 0x00040000, | ||
247 | 0x00004000, 0x00000008, 0x00080040, 0x10040000, | ||
248 | 0x02004000, 0x00000000, 0x000000c0, 0x00041000, | ||
249 | 0x02004000, 0x00000008, 0x000800c0, 0x10041000, | ||
250 | 0x00020000, 0x00008000, 0x08000000, 0x00200000, | ||
251 | 0x00020000, 0x00008008, 0x08080000, 0x10200000, | ||
252 | 0x02020000, 0x00008000, 0x08000080, 0x00201000, | ||
253 | 0x02020000, 0x00008008, 0x08080080, 0x10201000, | ||
254 | 0x00024000, 0x00008000, 0x08000040, 0x00240000, | ||
255 | 0x00024000, 0x00008008, 0x08080040, 0x10240000, | ||
256 | 0x02024000, 0x00008000, 0x080000c0, 0x00241000, | ||
257 | 0x02024000, 0x00008008, 0x080800c0, 0x10241000, | ||
258 | 0x00000000, 0x01000000, 0x00002000, 0x00000020, | ||
259 | 0x00000000, 0x01000008, 0x00082000, 0x10000020, | ||
260 | 0x02000000, 0x01000000, 0x00002080, 0x00001020, | ||
261 | 0x02000000, 0x01000008, 0x00082080, 0x10001020, | ||
262 | 0x00004000, 0x01000000, 0x00002040, 0x00040020, | ||
263 | 0x00004000, 0x01000008, 0x00082040, 0x10040020, | ||
264 | 0x02004000, 0x01000000, 0x000020c0, 0x00041020, | ||
265 | 0x02004000, 0x01000008, 0x000820c0, 0x10041020, | ||
266 | 0x00020000, 0x01008000, 0x08002000, 0x00200020, | ||
267 | 0x00020000, 0x01008008, 0x08082000, 0x10200020, | ||
268 | 0x02020000, 0x01008000, 0x08002080, 0x00201020, | ||
269 | 0x02020000, 0x01008008, 0x08082080, 0x10201020, | ||
270 | 0x00024000, 0x01008000, 0x08002040, 0x00240020, | ||
271 | 0x00024000, 0x01008008, 0x08082040, 0x10240020, | ||
272 | 0x02024000, 0x01008000, 0x080020c0, 0x00241020, | ||
273 | 0x02024000, 0x01008008, 0x080820c0, 0x10241020, | ||
274 | 0x00000400, 0x04000000, 0x00100000, 0x00000004, | ||
275 | 0x00000400, 0x04000008, 0x00180000, 0x10000004, | ||
276 | 0x02000400, 0x04000000, 0x00100080, 0x00001004, | ||
277 | 0x02000400, 0x04000008, 0x00180080, 0x10001004, | ||
278 | 0x00004400, 0x04000000, 0x00100040, 0x00040004, | ||
279 | 0x00004400, 0x04000008, 0x00180040, 0x10040004, | ||
280 | 0x02004400, 0x04000000, 0x001000c0, 0x00041004, | ||
281 | 0x02004400, 0x04000008, 0x001800c0, 0x10041004, | ||
282 | 0x00020400, 0x04008000, 0x08100000, 0x00200004, | ||
283 | 0x00020400, 0x04008008, 0x08180000, 0x10200004, | ||
284 | 0x02020400, 0x04008000, 0x08100080, 0x00201004, | ||
285 | 0x02020400, 0x04008008, 0x08180080, 0x10201004, | ||
286 | 0x00024400, 0x04008000, 0x08100040, 0x00240004, | ||
287 | 0x00024400, 0x04008008, 0x08180040, 0x10240004, | ||
288 | 0x02024400, 0x04008000, 0x081000c0, 0x00241004, | ||
289 | 0x02024400, 0x04008008, 0x081800c0, 0x10241004, | ||
290 | 0x00000400, 0x05000000, 0x00102000, 0x00000024, | ||
291 | 0x00000400, 0x05000008, 0x00182000, 0x10000024, | ||
292 | 0x02000400, 0x05000000, 0x00102080, 0x00001024, | ||
293 | 0x02000400, 0x05000008, 0x00182080, 0x10001024, | ||
294 | 0x00004400, 0x05000000, 0x00102040, 0x00040024, | ||
295 | 0x00004400, 0x05000008, 0x00182040, 0x10040024, | ||
296 | 0x02004400, 0x05000000, 0x001020c0, 0x00041024, | ||
297 | 0x02004400, 0x05000008, 0x001820c0, 0x10041024, | ||
298 | 0x00020400, 0x05008000, 0x08102000, 0x00200024, | ||
299 | 0x00020400, 0x05008008, 0x08182000, 0x10200024, | ||
300 | 0x02020400, 0x05008000, 0x08102080, 0x00201024, | ||
301 | 0x02020400, 0x05008008, 0x08182080, 0x10201024, | ||
302 | 0x00024400, 0x05008000, 0x08102040, 0x00240024, | ||
303 | 0x00024400, 0x05008008, 0x08182040, 0x10240024, | ||
304 | 0x02024400, 0x05008000, 0x081020c0, 0x00241024, | ||
305 | 0x02024400, 0x05008008, 0x081820c0, 0x10241024, | ||
306 | 0x00000800, 0x00010000, 0x20000000, 0x00000010, | ||
307 | 0x00000800, 0x00010008, 0x20080000, 0x10000010, | ||
308 | 0x02000800, 0x00010000, 0x20000080, 0x00001010, | ||
309 | 0x02000800, 0x00010008, 0x20080080, 0x10001010, | ||
310 | 0x00004800, 0x00010000, 0x20000040, 0x00040010, | ||
311 | 0x00004800, 0x00010008, 0x20080040, 0x10040010, | ||
312 | 0x02004800, 0x00010000, 0x200000c0, 0x00041010, | ||
313 | 0x02004800, 0x00010008, 0x200800c0, 0x10041010, | ||
314 | 0x00020800, 0x00018000, 0x28000000, 0x00200010, | ||
315 | 0x00020800, 0x00018008, 0x28080000, 0x10200010, | ||
316 | 0x02020800, 0x00018000, 0x28000080, 0x00201010, | ||
317 | 0x02020800, 0x00018008, 0x28080080, 0x10201010, | ||
318 | 0x00024800, 0x00018000, 0x28000040, 0x00240010, | ||
319 | 0x00024800, 0x00018008, 0x28080040, 0x10240010, | ||
320 | 0x02024800, 0x00018000, 0x280000c0, 0x00241010, | ||
321 | 0x02024800, 0x00018008, 0x280800c0, 0x10241010, | ||
322 | 0x00000800, 0x01010000, 0x20002000, 0x00000030, | ||
323 | 0x00000800, 0x01010008, 0x20082000, 0x10000030, | ||
324 | 0x02000800, 0x01010000, 0x20002080, 0x00001030, | ||
325 | 0x02000800, 0x01010008, 0x20082080, 0x10001030, | ||
326 | 0x00004800, 0x01010000, 0x20002040, 0x00040030, | ||
327 | 0x00004800, 0x01010008, 0x20082040, 0x10040030, | ||
328 | 0x02004800, 0x01010000, 0x200020c0, 0x00041030, | ||
329 | 0x02004800, 0x01010008, 0x200820c0, 0x10041030, | ||
330 | 0x00020800, 0x01018000, 0x28002000, 0x00200030, | ||
331 | 0x00020800, 0x01018008, 0x28082000, 0x10200030, | ||
332 | 0x02020800, 0x01018000, 0x28002080, 0x00201030, | ||
333 | 0x02020800, 0x01018008, 0x28082080, 0x10201030, | ||
334 | 0x00024800, 0x01018000, 0x28002040, 0x00240030, | ||
335 | 0x00024800, 0x01018008, 0x28082040, 0x10240030, | ||
336 | 0x02024800, 0x01018000, 0x280020c0, 0x00241030, | ||
337 | 0x02024800, 0x01018008, 0x280820c0, 0x10241030, | ||
338 | 0x00000c00, 0x04010000, 0x20100000, 0x00000014, | ||
339 | 0x00000c00, 0x04010008, 0x20180000, 0x10000014, | ||
340 | 0x02000c00, 0x04010000, 0x20100080, 0x00001014, | ||
341 | 0x02000c00, 0x04010008, 0x20180080, 0x10001014, | ||
342 | 0x00004c00, 0x04010000, 0x20100040, 0x00040014, | ||
343 | 0x00004c00, 0x04010008, 0x20180040, 0x10040014, | ||
344 | 0x02004c00, 0x04010000, 0x201000c0, 0x00041014, | ||
345 | 0x02004c00, 0x04010008, 0x201800c0, 0x10041014, | ||
346 | 0x00020c00, 0x04018000, 0x28100000, 0x00200014, | ||
347 | 0x00020c00, 0x04018008, 0x28180000, 0x10200014, | ||
348 | 0x02020c00, 0x04018000, 0x28100080, 0x00201014, | ||
349 | 0x02020c00, 0x04018008, 0x28180080, 0x10201014, | ||
350 | 0x00024c00, 0x04018000, 0x28100040, 0x00240014, | ||
351 | 0x00024c00, 0x04018008, 0x28180040, 0x10240014, | ||
352 | 0x02024c00, 0x04018000, 0x281000c0, 0x00241014, | ||
353 | 0x02024c00, 0x04018008, 0x281800c0, 0x10241014, | ||
354 | 0x00000c00, 0x05010000, 0x20102000, 0x00000034, | ||
355 | 0x00000c00, 0x05010008, 0x20182000, 0x10000034, | ||
356 | 0x02000c00, 0x05010000, 0x20102080, 0x00001034, | ||
357 | 0x02000c00, 0x05010008, 0x20182080, 0x10001034, | ||
358 | 0x00004c00, 0x05010000, 0x20102040, 0x00040034, | ||
359 | 0x00004c00, 0x05010008, 0x20182040, 0x10040034, | ||
360 | 0x02004c00, 0x05010000, 0x201020c0, 0x00041034, | ||
361 | 0x02004c00, 0x05010008, 0x201820c0, 0x10041034, | ||
362 | 0x00020c00, 0x05018000, 0x28102000, 0x00200034, | ||
363 | 0x00020c00, 0x05018008, 0x28182000, 0x10200034, | ||
364 | 0x02020c00, 0x05018000, 0x28102080, 0x00201034, | ||
365 | 0x02020c00, 0x05018008, 0x28182080, 0x10201034, | ||
366 | 0x00024c00, 0x05018000, 0x28102040, 0x00240034, | ||
367 | 0x00024c00, 0x05018008, 0x28182040, 0x10240034, | ||
368 | 0x02024c00, 0x05018000, 0x281020c0, 0x00241034, | ||
369 | 0x02024c00, 0x05018008, 0x281820c0, 0x10241034 | ||
279 | }; | 370 | }; |
280 | 371 | ||
372 | /* S-box lookup tables */ | ||
373 | |||
374 | static const u32 S1[64] = { | ||
375 | 0x01010400, 0x00000000, 0x00010000, 0x01010404, | ||
376 | 0x01010004, 0x00010404, 0x00000004, 0x00010000, | ||
377 | 0x00000400, 0x01010400, 0x01010404, 0x00000400, | ||
378 | 0x01000404, 0x01010004, 0x01000000, 0x00000004, | ||
379 | 0x00000404, 0x01000400, 0x01000400, 0x00010400, | ||
380 | 0x00010400, 0x01010000, 0x01010000, 0x01000404, | ||
381 | 0x00010004, 0x01000004, 0x01000004, 0x00010004, | ||
382 | 0x00000000, 0x00000404, 0x00010404, 0x01000000, | ||
383 | 0x00010000, 0x01010404, 0x00000004, 0x01010000, | ||
384 | 0x01010400, 0x01000000, 0x01000000, 0x00000400, | ||
385 | 0x01010004, 0x00010000, 0x00010400, 0x01000004, | ||
386 | 0x00000400, 0x00000004, 0x01000404, 0x00010404, | ||
387 | 0x01010404, 0x00010004, 0x01010000, 0x01000404, | ||
388 | 0x01000004, 0x00000404, 0x00010404, 0x01010400, | ||
389 | 0x00000404, 0x01000400, 0x01000400, 0x00000000, | ||
390 | 0x00010004, 0x00010400, 0x00000000, 0x01010004 | ||
391 | }; | ||
281 | 392 | ||
282 | static void des_small_fips_encrypt(u32 *expkey, u8 *dst, const u8 *src) | 393 | static const u32 S2[64] = { |
283 | { | 394 | 0x80108020, 0x80008000, 0x00008000, 0x00108020, |
284 | u32 x, y, z; | 395 | 0x00100000, 0x00000020, 0x80100020, 0x80008020, |
285 | 396 | 0x80000020, 0x80108020, 0x80108000, 0x80000000, | |
286 | x = src[7]; | 397 | 0x80008000, 0x00100000, 0x00000020, 0x80100020, |
287 | x <<= 8; | 398 | 0x00108000, 0x00100020, 0x80008020, 0x00000000, |
288 | x |= src[6]; | 399 | 0x80000000, 0x00008000, 0x00108020, 0x80100000, |
289 | x <<= 8; | 400 | 0x00100020, 0x80000020, 0x00000000, 0x00108000, |
290 | x |= src[5]; | 401 | 0x00008020, 0x80108000, 0x80100000, 0x00008020, |
291 | x <<= 8; | 402 | 0x00000000, 0x00108020, 0x80100020, 0x00100000, |
292 | x |= src[4]; | 403 | 0x80008020, 0x80100000, 0x80108000, 0x00008000, |
293 | y = src[3]; | 404 | 0x80100000, 0x80008000, 0x00000020, 0x80108020, |
294 | y <<= 8; | 405 | 0x00108020, 0x00000020, 0x00008000, 0x80000000, |
295 | y |= src[2]; | 406 | 0x00008020, 0x80108000, 0x00100000, 0x80000020, |
296 | y <<= 8; | 407 | 0x00100020, 0x80008020, 0x80000020, 0x00100020, |
297 | y |= src[1]; | 408 | 0x00108000, 0x00000000, 0x80008000, 0x00008020, |
298 | y <<= 8; | 409 | 0x80000000, 0x80100020, 0x80108020, 0x00108000 |
299 | y |= src[0]; | 410 | }; |
300 | z = ((x >> 004) ^ y) & 0x0F0F0F0FL; | ||
301 | x ^= z << 004; | ||
302 | y ^= z; | ||
303 | z = ((y >> 020) ^ x) & 0x0000FFFFL; | ||
304 | y ^= z << 020; | ||
305 | x ^= z; | ||
306 | z = ((x >> 002) ^ y) & 0x33333333L; | ||
307 | x ^= z << 002; | ||
308 | y ^= z; | ||
309 | z = ((y >> 010) ^ x) & 0x00FF00FFL; | ||
310 | y ^= z << 010; | ||
311 | x ^= z; | ||
312 | x = x >> 1 | x << 31; | ||
313 | z = (x ^ y) & 0x55555555L; | ||
314 | y ^= z; | ||
315 | x ^= z; | ||
316 | y = y >> 1 | y << 31; | ||
317 | z = expkey[0]; | ||
318 | z ^= y; | ||
319 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
320 | z >>= 8; | ||
321 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
322 | z >>= 8; | ||
323 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
324 | z >>= 8; | ||
325 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
326 | z = expkey[1]; | ||
327 | z ^= y; | ||
328 | z = z << 4 | z >> 28; | ||
329 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
330 | z >>= 8; | ||
331 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
332 | z >>= 8; | ||
333 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
334 | z >>= 8; | ||
335 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
336 | z = expkey[2]; | ||
337 | z ^= x; | ||
338 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
339 | z >>= 8; | ||
340 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
341 | z >>= 8; | ||
342 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
343 | z >>= 8; | ||
344 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
345 | z = expkey[3]; | ||
346 | z ^= x; | ||
347 | z = z << 4 | z >> 28; | ||
348 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
349 | z >>= 8; | ||
350 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
351 | z >>= 8; | ||
352 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
353 | z >>= 8; | ||
354 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
355 | z = expkey[4]; | ||
356 | z ^= y; | ||
357 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
358 | z >>= 8; | ||
359 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
360 | z >>= 8; | ||
361 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
362 | z >>= 8; | ||
363 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
364 | z = expkey[5]; | ||
365 | z ^= y; | ||
366 | z = z << 4 | z >> 28; | ||
367 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
368 | z >>= 8; | ||
369 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
370 | z >>= 8; | ||
371 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
372 | z >>= 8; | ||
373 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
374 | z = expkey[6]; | ||
375 | z ^= x; | ||
376 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
377 | z >>= 8; | ||
378 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
379 | z >>= 8; | ||
380 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
381 | z >>= 8; | ||
382 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
383 | z = expkey[7]; | ||
384 | z ^= x; | ||
385 | z = z << 4 | z >> 28; | ||
386 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
387 | z >>= 8; | ||
388 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
389 | z >>= 8; | ||
390 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
391 | z >>= 8; | ||
392 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
393 | z = expkey[8]; | ||
394 | z ^= y; | ||
395 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
396 | z >>= 8; | ||
397 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
398 | z >>= 8; | ||
399 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
400 | z >>= 8; | ||
401 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
402 | z = expkey[9]; | ||
403 | z ^= y; | ||
404 | z = z << 4 | z >> 28; | ||
405 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
406 | z >>= 8; | ||
407 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
408 | z >>= 8; | ||
409 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
410 | z >>= 8; | ||
411 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
412 | z = expkey[10]; | ||
413 | z ^= x; | ||
414 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
415 | z >>= 8; | ||
416 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
417 | z >>= 8; | ||
418 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
419 | z >>= 8; | ||
420 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
421 | z = expkey[11]; | ||
422 | z ^= x; | ||
423 | z = z << 4 | z >> 28; | ||
424 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
425 | z >>= 8; | ||
426 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
427 | z >>= 8; | ||
428 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
429 | z >>= 8; | ||
430 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
431 | z = expkey[12]; | ||
432 | z ^= y; | ||
433 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
434 | z >>= 8; | ||
435 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
436 | z >>= 8; | ||
437 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
438 | z >>= 8; | ||
439 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
440 | z = expkey[13]; | ||
441 | z ^= y; | ||
442 | z = z << 4 | z >> 28; | ||
443 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
444 | z >>= 8; | ||
445 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
446 | z >>= 8; | ||
447 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
448 | z >>= 8; | ||
449 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
450 | z = expkey[14]; | ||
451 | z ^= x; | ||
452 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
453 | z >>= 8; | ||
454 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
455 | z >>= 8; | ||
456 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
457 | z >>= 8; | ||
458 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
459 | z = expkey[15]; | ||
460 | z ^= x; | ||
461 | z = z << 4 | z >> 28; | ||
462 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
463 | z >>= 8; | ||
464 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
465 | z >>= 8; | ||
466 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
467 | z >>= 8; | ||
468 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
469 | z = expkey[16]; | ||
470 | z ^= y; | ||
471 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
472 | z >>= 8; | ||
473 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
474 | z >>= 8; | ||
475 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
476 | z >>= 8; | ||
477 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
478 | z = expkey[17]; | ||
479 | z ^= y; | ||
480 | z = z << 4 | z >> 28; | ||
481 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
482 | z >>= 8; | ||
483 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
484 | z >>= 8; | ||
485 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
486 | z >>= 8; | ||
487 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
488 | z = expkey[18]; | ||
489 | z ^= x; | ||
490 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
491 | z >>= 8; | ||
492 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
493 | z >>= 8; | ||
494 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
495 | z >>= 8; | ||
496 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
497 | z = expkey[19]; | ||
498 | z ^= x; | ||
499 | z = z << 4 | z >> 28; | ||
500 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
501 | z >>= 8; | ||
502 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
503 | z >>= 8; | ||
504 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
505 | z >>= 8; | ||
506 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
507 | z = expkey[20]; | ||
508 | z ^= y; | ||
509 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
510 | z >>= 8; | ||
511 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
512 | z >>= 8; | ||
513 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
514 | z >>= 8; | ||
515 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
516 | z = expkey[21]; | ||
517 | z ^= y; | ||
518 | z = z << 4 | z >> 28; | ||
519 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
520 | z >>= 8; | ||
521 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
522 | z >>= 8; | ||
523 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
524 | z >>= 8; | ||
525 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
526 | z = expkey[22]; | ||
527 | z ^= x; | ||
528 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
529 | z >>= 8; | ||
530 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
531 | z >>= 8; | ||
532 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
533 | z >>= 8; | ||
534 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
535 | z = expkey[23]; | ||
536 | z ^= x; | ||
537 | z = z << 4 | z >> 28; | ||
538 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
539 | z >>= 8; | ||
540 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
541 | z >>= 8; | ||
542 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
543 | z >>= 8; | ||
544 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
545 | z = expkey[24]; | ||
546 | z ^= y; | ||
547 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
548 | z >>= 8; | ||
549 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
550 | z >>= 8; | ||
551 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
552 | z >>= 8; | ||
553 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
554 | z = expkey[25]; | ||
555 | z ^= y; | ||
556 | z = z << 4 | z >> 28; | ||
557 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
558 | z >>= 8; | ||
559 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
560 | z >>= 8; | ||
561 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
562 | z >>= 8; | ||
563 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
564 | z = expkey[26]; | ||
565 | z ^= x; | ||
566 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
567 | z >>= 8; | ||
568 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
569 | z >>= 8; | ||
570 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
571 | z >>= 8; | ||
572 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
573 | z = expkey[27]; | ||
574 | z ^= x; | ||
575 | z = z << 4 | z >> 28; | ||
576 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
577 | z >>= 8; | ||
578 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
579 | z >>= 8; | ||
580 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
581 | z >>= 8; | ||
582 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
583 | z = expkey[28]; | ||
584 | z ^= y; | ||
585 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
586 | z >>= 8; | ||
587 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
588 | z >>= 8; | ||
589 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
590 | z >>= 8; | ||
591 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
592 | z = expkey[29]; | ||
593 | z ^= y; | ||
594 | z = z << 4 | z >> 28; | ||
595 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
596 | z >>= 8; | ||
597 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
598 | z >>= 8; | ||
599 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
600 | z >>= 8; | ||
601 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
602 | z = expkey[30]; | ||
603 | z ^= x; | ||
604 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
605 | z >>= 8; | ||
606 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
607 | z >>= 8; | ||
608 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
609 | z >>= 8; | ||
610 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
611 | z = expkey[31]; | ||
612 | z ^= x; | ||
613 | z = z << 4 | z >> 28; | ||
614 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
615 | z >>= 8; | ||
616 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
617 | z >>= 8; | ||
618 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
619 | z >>= 8; | ||
620 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
621 | x = x << 1 | x >> 31; | ||
622 | z = (x ^ y) & 0x55555555L; | ||
623 | y ^= z; | ||
624 | x ^= z; | ||
625 | y = y << 1 | y >> 31; | ||
626 | z = ((x >> 010) ^ y) & 0x00FF00FFL; | ||
627 | x ^= z << 010; | ||
628 | y ^= z; | ||
629 | z = ((y >> 002) ^ x) & 0x33333333L; | ||
630 | y ^= z << 002; | ||
631 | x ^= z; | ||
632 | z = ((x >> 020) ^ y) & 0x0000FFFFL; | ||
633 | x ^= z << 020; | ||
634 | y ^= z; | ||
635 | z = ((y >> 004) ^ x) & 0x0F0F0F0FL; | ||
636 | y ^= z << 004; | ||
637 | x ^= z; | ||
638 | dst[0] = x; | ||
639 | x >>= 8; | ||
640 | dst[1] = x; | ||
641 | x >>= 8; | ||
642 | dst[2] = x; | ||
643 | x >>= 8; | ||
644 | dst[3] = x; | ||
645 | dst[4] = y; | ||
646 | y >>= 8; | ||
647 | dst[5] = y; | ||
648 | y >>= 8; | ||
649 | dst[6] = y; | ||
650 | y >>= 8; | ||
651 | dst[7] = y; | ||
652 | } | ||
653 | 411 | ||
654 | static void des_small_fips_decrypt(u32 *expkey, u8 *dst, const u8 *src) | 412 | static const u32 S3[64] = { |
655 | { | 413 | 0x00000208, 0x08020200, 0x00000000, 0x08020008, |
656 | u32 x, y, z; | 414 | 0x08000200, 0x00000000, 0x00020208, 0x08000200, |
657 | 415 | 0x00020008, 0x08000008, 0x08000008, 0x00020000, | |
658 | x = src[7]; | 416 | 0x08020208, 0x00020008, 0x08020000, 0x00000208, |
659 | x <<= 8; | 417 | 0x08000000, 0x00000008, 0x08020200, 0x00000200, |
660 | x |= src[6]; | 418 | 0x00020200, 0x08020000, 0x08020008, 0x00020208, |
661 | x <<= 8; | 419 | 0x08000208, 0x00020200, 0x00020000, 0x08000208, |
662 | x |= src[5]; | 420 | 0x00000008, 0x08020208, 0x00000200, 0x08000000, |
663 | x <<= 8; | 421 | 0x08020200, 0x08000000, 0x00020008, 0x00000208, |
664 | x |= src[4]; | 422 | 0x00020000, 0x08020200, 0x08000200, 0x00000000, |
665 | y = src[3]; | 423 | 0x00000200, 0x00020008, 0x08020208, 0x08000200, |
666 | y <<= 8; | 424 | 0x08000008, 0x00000200, 0x00000000, 0x08020008, |
667 | y |= src[2]; | 425 | 0x08000208, 0x00020000, 0x08000000, 0x08020208, |
668 | y <<= 8; | 426 | 0x00000008, 0x00020208, 0x00020200, 0x08000008, |
669 | y |= src[1]; | 427 | 0x08020000, 0x08000208, 0x00000208, 0x08020000, |
670 | y <<= 8; | 428 | 0x00020208, 0x00000008, 0x08020008, 0x00020200 |
671 | y |= src[0]; | 429 | }; |
672 | z = ((x >> 004) ^ y) & 0x0F0F0F0FL; | 430 | |
673 | x ^= z << 004; | 431 | static const u32 S4[64] = { |
674 | y ^= z; | 432 | 0x00802001, 0x00002081, 0x00002081, 0x00000080, |
675 | z = ((y >> 020) ^ x) & 0x0000FFFFL; | 433 | 0x00802080, 0x00800081, 0x00800001, 0x00002001, |
676 | y ^= z << 020; | 434 | 0x00000000, 0x00802000, 0x00802000, 0x00802081, |
677 | x ^= z; | 435 | 0x00000081, 0x00000000, 0x00800080, 0x00800001, |
678 | z = ((x >> 002) ^ y) & 0x33333333L; | 436 | 0x00000001, 0x00002000, 0x00800000, 0x00802001, |
679 | x ^= z << 002; | 437 | 0x00000080, 0x00800000, 0x00002001, 0x00002080, |
680 | y ^= z; | 438 | 0x00800081, 0x00000001, 0x00002080, 0x00800080, |
681 | z = ((y >> 010) ^ x) & 0x00FF00FFL; | 439 | 0x00002000, 0x00802080, 0x00802081, 0x00000081, |
682 | y ^= z << 010; | 440 | 0x00800080, 0x00800001, 0x00802000, 0x00802081, |
683 | x ^= z; | 441 | 0x00000081, 0x00000000, 0x00000000, 0x00802000, |
684 | x = x >> 1 | x << 31; | 442 | 0x00002080, 0x00800080, 0x00800081, 0x00000001, |
685 | z = (x ^ y) & 0x55555555L; | 443 | 0x00802001, 0x00002081, 0x00002081, 0x00000080, |
686 | y ^= z; | 444 | 0x00802081, 0x00000081, 0x00000001, 0x00002000, |
687 | x ^= z; | 445 | 0x00800001, 0x00002001, 0x00802080, 0x00800081, |
688 | y = y >> 1 | y << 31; | 446 | 0x00002001, 0x00002080, 0x00800000, 0x00802001, |
689 | z = expkey[31]; | 447 | 0x00000080, 0x00800000, 0x00002000, 0x00802080 |
690 | z ^= y; | 448 | }; |
691 | z = z << 4 | z >> 28; | 449 | |
692 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | 450 | static const u32 S5[64] = { |
693 | z >>= 8; | 451 | 0x00000100, 0x02080100, 0x02080000, 0x42000100, |
694 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | 452 | 0x00080000, 0x00000100, 0x40000000, 0x02080000, |
695 | z >>= 8; | 453 | 0x40080100, 0x00080000, 0x02000100, 0x40080100, |
696 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | 454 | 0x42000100, 0x42080000, 0x00080100, 0x40000000, |
697 | z >>= 8; | 455 | 0x02000000, 0x40080000, 0x40080000, 0x00000000, |
698 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | 456 | 0x40000100, 0x42080100, 0x42080100, 0x02000100, |
699 | z = expkey[30]; | 457 | 0x42080000, 0x40000100, 0x00000000, 0x42000000, |
700 | z ^= y; | 458 | 0x02080100, 0x02000000, 0x42000000, 0x00080100, |
701 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | 459 | 0x00080000, 0x42000100, 0x00000100, 0x02000000, |
702 | z >>= 8; | 460 | 0x40000000, 0x02080000, 0x42000100, 0x40080100, |
703 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | 461 | 0x02000100, 0x40000000, 0x42080000, 0x02080100, |
704 | z >>= 8; | 462 | 0x40080100, 0x00000100, 0x02000000, 0x42080000, |
705 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | 463 | 0x42080100, 0x00080100, 0x42000000, 0x42080100, |
706 | z >>= 8; | 464 | 0x02080000, 0x00000000, 0x40080000, 0x42000000, |
707 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | 465 | 0x00080100, 0x02000100, 0x40000100, 0x00080000, |
708 | z = expkey[29]; | 466 | 0x00000000, 0x40080000, 0x02080100, 0x40000100 |
709 | z ^= x; | 467 | }; |
710 | z = z << 4 | z >> 28; | 468 | |
711 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | 469 | static const u32 S6[64] = { |
712 | z >>= 8; | 470 | 0x20000010, 0x20400000, 0x00004000, 0x20404010, |
713 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | 471 | 0x20400000, 0x00000010, 0x20404010, 0x00400000, |
714 | z >>= 8; | 472 | 0x20004000, 0x00404010, 0x00400000, 0x20000010, |
715 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | 473 | 0x00400010, 0x20004000, 0x20000000, 0x00004010, |
716 | z >>= 8; | 474 | 0x00000000, 0x00400010, 0x20004010, 0x00004000, |
717 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | 475 | 0x00404000, 0x20004010, 0x00000010, 0x20400010, |
718 | z = expkey[28]; | 476 | 0x20400010, 0x00000000, 0x00404010, 0x20404000, |
719 | z ^= x; | 477 | 0x00004010, 0x00404000, 0x20404000, 0x20000000, |
720 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | 478 | 0x20004000, 0x00000010, 0x20400010, 0x00404000, |
721 | z >>= 8; | 479 | 0x20404010, 0x00400000, 0x00004010, 0x20000010, |
722 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | 480 | 0x00400000, 0x20004000, 0x20000000, 0x00004010, |
723 | z >>= 8; | 481 | 0x20000010, 0x20404010, 0x00404000, 0x20400000, |
724 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | 482 | 0x00404010, 0x20404000, 0x00000000, 0x20400010, |
725 | z >>= 8; | 483 | 0x00000010, 0x00004000, 0x20400000, 0x00404010, |
726 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | 484 | 0x00004000, 0x00400010, 0x20004010, 0x00000000, |
727 | z = expkey[27]; | 485 | 0x20404000, 0x20000000, 0x00400010, 0x20004010 |
728 | z ^= y; | 486 | }; |
729 | z = z << 4 | z >> 28; | 487 | |
730 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | 488 | static const u32 S7[64] = { |
731 | z >>= 8; | 489 | 0x00200000, 0x04200002, 0x04000802, 0x00000000, |
732 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | 490 | 0x00000800, 0x04000802, 0x00200802, 0x04200800, |
733 | z >>= 8; | 491 | 0x04200802, 0x00200000, 0x00000000, 0x04000002, |
734 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | 492 | 0x00000002, 0x04000000, 0x04200002, 0x00000802, |
735 | z >>= 8; | 493 | 0x04000800, 0x00200802, 0x00200002, 0x04000800, |
736 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | 494 | 0x04000002, 0x04200000, 0x04200800, 0x00200002, |
737 | z = expkey[26]; | 495 | 0x04200000, 0x00000800, 0x00000802, 0x04200802, |
738 | z ^= y; | 496 | 0x00200800, 0x00000002, 0x04000000, 0x00200800, |
739 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | 497 | 0x04000000, 0x00200800, 0x00200000, 0x04000802, |
740 | z >>= 8; | 498 | 0x04000802, 0x04200002, 0x04200002, 0x00000002, |
741 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | 499 | 0x00200002, 0x04000000, 0x04000800, 0x00200000, |
742 | z >>= 8; | 500 | 0x04200800, 0x00000802, 0x00200802, 0x04200800, |
743 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | 501 | 0x00000802, 0x04000002, 0x04200802, 0x04200000, |
744 | z >>= 8; | 502 | 0x00200800, 0x00000000, 0x00000002, 0x04200802, |
745 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | 503 | 0x00000000, 0x00200802, 0x04200000, 0x00000800, |
746 | z = expkey[25]; | 504 | 0x04000002, 0x04000800, 0x00000800, 0x00200002 |
747 | z ^= x; | 505 | }; |
748 | z = z << 4 | z >> 28; | 506 | |
749 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | 507 | static const u32 S8[64] = { |
750 | z >>= 8; | 508 | 0x10001040, 0x00001000, 0x00040000, 0x10041040, |
751 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | 509 | 0x10000000, 0x10001040, 0x00000040, 0x10000000, |
752 | z >>= 8; | 510 | 0x00040040, 0x10040000, 0x10041040, 0x00041000, |
753 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | 511 | 0x10041000, 0x00041040, 0x00001000, 0x00000040, |
754 | z >>= 8; | 512 | 0x10040000, 0x10000040, 0x10001000, 0x00001040, |
755 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | 513 | 0x00041000, 0x00040040, 0x10040040, 0x10041000, |
756 | z = expkey[24]; | 514 | 0x00001040, 0x00000000, 0x00000000, 0x10040040, |
757 | z ^= x; | 515 | 0x10000040, 0x10001000, 0x00041040, 0x00040000, |
758 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | 516 | 0x00041040, 0x00040000, 0x10041000, 0x00001000, |
759 | z >>= 8; | 517 | 0x00000040, 0x10040040, 0x00001000, 0x00041040, |
760 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | 518 | 0x10001000, 0x00000040, 0x10000040, 0x10040000, |
761 | z >>= 8; | 519 | 0x10040040, 0x10000000, 0x00040000, 0x10001040, |
762 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | 520 | 0x00000000, 0x10041040, 0x00040040, 0x10000040, |
763 | z >>= 8; | 521 | 0x10040000, 0x10001000, 0x10001040, 0x00000000, |
764 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | 522 | 0x10041040, 0x00041000, 0x00041000, 0x00001040, |
765 | z = expkey[23]; | 523 | 0x00001040, 0x00040040, 0x10000000, 0x10041000 |
766 | z ^= y; | 524 | }; |
767 | z = z << 4 | z >> 28; | 525 | |
768 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | 526 | /* Encryption components: IP, FP, and round function */ |
769 | z >>= 8; | 527 | |
770 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | 528 | #define IP(L, R, T) \ |
771 | z >>= 8; | 529 | ROL(R, 4); \ |
772 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | 530 | T = L; \ |
773 | z >>= 8; | 531 | L ^= R; \ |
774 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | 532 | L &= 0xf0f0f0f0; \ |
775 | z = expkey[22]; | 533 | R ^= L; \ |
776 | z ^= y; | 534 | L ^= T; \ |
777 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | 535 | ROL(R, 12); \ |
778 | z >>= 8; | 536 | T = L; \ |
779 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | 537 | L ^= R; \ |
780 | z >>= 8; | 538 | L &= 0xffff0000; \ |
781 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | 539 | R ^= L; \ |
782 | z >>= 8; | 540 | L ^= T; \ |
783 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | 541 | ROR(R, 14); \ |
784 | z = expkey[21]; | 542 | T = L; \ |
785 | z ^= x; | 543 | L ^= R; \ |
786 | z = z << 4 | z >> 28; | 544 | L &= 0xcccccccc; \ |
787 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | 545 | R ^= L; \ |
788 | z >>= 8; | 546 | L ^= T; \ |
789 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | 547 | ROL(R, 6); \ |
790 | z >>= 8; | 548 | T = L; \ |
791 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | 549 | L ^= R; \ |
792 | z >>= 8; | 550 | L &= 0xff00ff00; \ |
793 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | 551 | R ^= L; \ |
794 | z = expkey[20]; | 552 | L ^= T; \ |
795 | z ^= x; | 553 | ROR(R, 7); \ |
796 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | 554 | T = L; \ |
797 | z >>= 8; | 555 | L ^= R; \ |
798 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | 556 | L &= 0xaaaaaaaa; \ |
799 | z >>= 8; | 557 | R ^= L; \ |
800 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | 558 | L ^= T; \ |
801 | z >>= 8; | 559 | ROL(L, 1); |
802 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | 560 | |
803 | z = expkey[19]; | 561 | #define FP(L, R, T) \ |
804 | z ^= y; | 562 | ROR(L, 1); \ |
805 | z = z << 4 | z >> 28; | 563 | T = L; \ |
806 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | 564 | L ^= R; \ |
807 | z >>= 8; | 565 | L &= 0xaaaaaaaa; \ |
808 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | 566 | R ^= L; \ |
809 | z >>= 8; | 567 | L ^= T; \ |
810 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | 568 | ROL(R, 7); \ |
811 | z >>= 8; | 569 | T = L; \ |
812 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | 570 | L ^= R; \ |
813 | z = expkey[18]; | 571 | L &= 0xff00ff00; \ |
814 | z ^= y; | 572 | R ^= L; \ |
815 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | 573 | L ^= T; \ |
816 | z >>= 8; | 574 | ROR(R, 6); \ |
817 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | 575 | T = L; \ |
818 | z >>= 8; | 576 | L ^= R; \ |
819 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | 577 | L &= 0xcccccccc; \ |
820 | z >>= 8; | 578 | R ^= L; \ |
821 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | 579 | L ^= T; \ |
822 | z = expkey[17]; | 580 | ROL(R, 14); \ |
823 | z ^= x; | 581 | T = L; \ |
824 | z = z << 4 | z >> 28; | 582 | L ^= R; \ |
825 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | 583 | L &= 0xffff0000; \ |
826 | z >>= 8; | 584 | R ^= L; \ |
827 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | 585 | L ^= T; \ |
828 | z >>= 8; | 586 | ROR(R, 12); \ |
829 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | 587 | T = L; \ |
830 | z >>= 8; | 588 | L ^= R; \ |
831 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | 589 | L &= 0xf0f0f0f0; \ |
832 | z = expkey[16]; | 590 | R ^= L; \ |
833 | z ^= x; | 591 | L ^= T; \ |
834 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | 592 | ROR(R, 4); |
835 | z >>= 8; | 593 | |
836 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | 594 | #define ROUND(L, R, A, B, K, d) \ |
837 | z >>= 8; | 595 | B = K[0]; A = K[1]; K += d; \ |
838 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | 596 | B ^= R; A ^= R; \ |
839 | z >>= 8; | 597 | B &= 0x3f3f3f3f; ROR(A, 4); \ |
840 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | 598 | L ^= S8[0xff & B]; A &= 0x3f3f3f3f; \ |
841 | z = expkey[15]; | 599 | L ^= S6[0xff & (B >> 8)]; B >>= 16; \ |
842 | z ^= y; | 600 | L ^= S7[0xff & A]; \ |
843 | z = z << 4 | z >> 28; | 601 | L ^= S5[0xff & (A >> 8)]; A >>= 16; \ |
844 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | 602 | L ^= S4[0xff & B]; \ |
845 | z >>= 8; | 603 | L ^= S2[0xff & (B >> 8)]; \ |
846 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | 604 | L ^= S3[0xff & A]; \ |
847 | z >>= 8; | 605 | L ^= S1[0xff & (A >> 8)]; |
848 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | 606 | |
849 | z >>= 8; | 607 | /* |
850 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | 608 | * PC2 lookup tables are organized as 2 consecutive sets of 4 interleaved |
851 | z = expkey[14]; | 609 | * tables of 128 elements. One set is for C_i and the other for D_i, while |
852 | z ^= y; | 610 | * the 4 interleaved tables correspond to four 7-bit subsets of C_i or D_i. |
853 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | 611 | * |
854 | z >>= 8; | 612 | * After PC1 each of the variables a,b,c,d contains a 7 bit subset of C_i |
855 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | 613 | * or D_i in bits 7-1 (bit 0 being the least significant). |
856 | z >>= 8; | 614 | */ |
857 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | 615 | |
858 | z >>= 8; | 616 | #define T1(x) pt[2 * (x) + 0] |
859 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | 617 | #define T2(x) pt[2 * (x) + 1] |
860 | z = expkey[13]; | 618 | #define T3(x) pt[2 * (x) + 2] |
861 | z ^= x; | 619 | #define T4(x) pt[2 * (x) + 3] |
862 | z = z << 4 | z >> 28; | 620 | |
863 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | 621 | #define PC2(a, b, c, d) (T4(d) | T3(c) | T2(b) | T1(a)) |
864 | z >>= 8; | ||
865 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
866 | z >>= 8; | ||
867 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
868 | z >>= 8; | ||
869 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
870 | z = expkey[12]; | ||
871 | z ^= x; | ||
872 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
873 | z >>= 8; | ||
874 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
875 | z >>= 8; | ||
876 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
877 | z >>= 8; | ||
878 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
879 | z = expkey[11]; | ||
880 | z ^= y; | ||
881 | z = z << 4 | z >> 28; | ||
882 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
883 | z >>= 8; | ||
884 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
885 | z >>= 8; | ||
886 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
887 | z >>= 8; | ||
888 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
889 | z = expkey[10]; | ||
890 | z ^= y; | ||
891 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
892 | z >>= 8; | ||
893 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
894 | z >>= 8; | ||
895 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
896 | z >>= 8; | ||
897 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
898 | z = expkey[9]; | ||
899 | z ^= x; | ||
900 | z = z << 4 | z >> 28; | ||
901 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
902 | z >>= 8; | ||
903 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
904 | z >>= 8; | ||
905 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
906 | z >>= 8; | ||
907 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
908 | z = expkey[8]; | ||
909 | z ^= x; | ||
910 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
911 | z >>= 8; | ||
912 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
913 | z >>= 8; | ||
914 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
915 | z >>= 8; | ||
916 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
917 | z = expkey[7]; | ||
918 | z ^= y; | ||
919 | z = z << 4 | z >> 28; | ||
920 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
921 | z >>= 8; | ||
922 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
923 | z >>= 8; | ||
924 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
925 | z >>= 8; | ||
926 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
927 | z = expkey[6]; | ||
928 | z ^= y; | ||
929 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
930 | z >>= 8; | ||
931 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
932 | z >>= 8; | ||
933 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
934 | z >>= 8; | ||
935 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
936 | z = expkey[5]; | ||
937 | z ^= x; | ||
938 | z = z << 4 | z >> 28; | ||
939 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
940 | z >>= 8; | ||
941 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
942 | z >>= 8; | ||
943 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
944 | z >>= 8; | ||
945 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
946 | z = expkey[4]; | ||
947 | z ^= x; | ||
948 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
949 | z >>= 8; | ||
950 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
951 | z >>= 8; | ||
952 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
953 | z >>= 8; | ||
954 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
955 | z = expkey[3]; | ||
956 | z ^= y; | ||
957 | z = z << 4 | z >> 28; | ||
958 | x ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
959 | z >>= 8; | ||
960 | x ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
961 | z >>= 8; | ||
962 | x ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
963 | z >>= 8; | ||
964 | x ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
965 | z = expkey[2]; | ||
966 | z ^= y; | ||
967 | x ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
968 | z >>= 8; | ||
969 | x ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
970 | z >>= 8; | ||
971 | x ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
972 | z >>= 8; | ||
973 | x ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
974 | z = expkey[1]; | ||
975 | z ^= x; | ||
976 | z = z << 4 | z >> 28; | ||
977 | y ^= * (u32 *) ((u8 *) (des_keymap + 448) + (0xFC & z)); | ||
978 | z >>= 8; | ||
979 | y ^= * (u32 *) ((u8 *) (des_keymap + 384) + (0xFC & z)); | ||
980 | z >>= 8; | ||
981 | y ^= * (u32 *) ((u8 *) (des_keymap + 320) + (0xFC & z)); | ||
982 | z >>= 8; | ||
983 | y ^= * (u32 *) ((u8 *) (des_keymap + 256) + (0xFC & z)); | ||
984 | z = expkey[0]; | ||
985 | z ^= x; | ||
986 | y ^= * (u32 *) ((u8 *) (des_keymap + 192) + (0xFC & z)); | ||
987 | z >>= 8; | ||
988 | y ^= * (u32 *) ((u8 *) (des_keymap + 128) + (0xFC & z)); | ||
989 | z >>= 8; | ||
990 | y ^= * (u32 *) ((u8 *) (des_keymap + 64) + (0xFC & z)); | ||
991 | z >>= 8; | ||
992 | y ^= * (u32 *) ((u8 *) des_keymap + (0xFC & z)); | ||
993 | x = x << 1 | x >> 31; | ||
994 | z = (x ^ y) & 0x55555555L; | ||
995 | y ^= z; | ||
996 | x ^= z; | ||
997 | y = y << 1 | y >> 31; | ||
998 | z = ((x >> 010) ^ y) & 0x00FF00FFL; | ||
999 | x ^= z << 010; | ||
1000 | y ^= z; | ||
1001 | z = ((y >> 002) ^ x) & 0x33333333L; | ||
1002 | y ^= z << 002; | ||
1003 | x ^= z; | ||
1004 | z = ((x >> 020) ^ y) & 0x0000FFFFL; | ||
1005 | x ^= z << 020; | ||
1006 | y ^= z; | ||
1007 | z = ((y >> 004) ^ x) & 0x0F0F0F0FL; | ||
1008 | y ^= z << 004; | ||
1009 | x ^= z; | ||
1010 | dst[0] = x; | ||
1011 | x >>= 8; | ||
1012 | dst[1] = x; | ||
1013 | x >>= 8; | ||
1014 | dst[2] = x; | ||
1015 | x >>= 8; | ||
1016 | dst[3] = x; | ||
1017 | dst[4] = y; | ||
1018 | y >>= 8; | ||
1019 | dst[5] = y; | ||
1020 | y >>= 8; | ||
1021 | dst[6] = y; | ||
1022 | y >>= 8; | ||
1023 | dst[7] = y; | ||
1024 | } | ||
1025 | 622 | ||
1026 | /* | 623 | /* |
624 | * Encryption key expansion | ||
625 | * | ||
1027 | * RFC2451: Weak key checks SHOULD be performed. | 626 | * RFC2451: Weak key checks SHOULD be performed. |
627 | * | ||
628 | * FIPS 74: | ||
629 | * | ||
630 | * Keys having duals are keys which produce all zeros, all ones, or | ||
631 | * alternating zero-one patterns in the C and D registers after Permuted | ||
632 | * Choice 1 has operated on the key. | ||
633 | * | ||
1028 | */ | 634 | */ |
1029 | static int setkey(u32 *expkey, const u8 *key, unsigned int keylen, u32 *flags) | 635 | static unsigned long ekey(u32 *pe, const u8 *k) |
1030 | { | 636 | { |
1031 | const u8 *k; | 637 | /* K&R: long is at least 32 bits */ |
1032 | u8 *b0, *b1; | 638 | unsigned long a, b, c, d, w; |
1033 | u32 n, w; | 639 | const u32 *pt = pc2; |
1034 | u8 bits0[56], bits1[56]; | 640 | |
1035 | 641 | d = k[4]; d &= 0x0e; d <<= 4; d |= k[0] & 0x1e; d = pc1[d]; | |
1036 | n = parity[key[0]]; n <<= 4; | 642 | c = k[5]; c &= 0x0e; c <<= 4; c |= k[1] & 0x1e; c = pc1[c]; |
1037 | n |= parity[key[1]]; n <<= 4; | 643 | b = k[6]; b &= 0x0e; b <<= 4; b |= k[2] & 0x1e; b = pc1[b]; |
1038 | n |= parity[key[2]]; n <<= 4; | 644 | a = k[7]; a &= 0x0e; a <<= 4; a |= k[3] & 0x1e; a = pc1[a]; |
1039 | n |= parity[key[3]]; n <<= 4; | 645 | |
1040 | n |= parity[key[4]]; n <<= 4; | 646 | pe[15 * 2 + 0] = PC2(a, b, c, d); d = rs[d]; |
1041 | n |= parity[key[5]]; n <<= 4; | 647 | pe[14 * 2 + 0] = PC2(d, a, b, c); c = rs[c]; b = rs[b]; |
1042 | n |= parity[key[6]]; n <<= 4; | 648 | pe[13 * 2 + 0] = PC2(b, c, d, a); a = rs[a]; d = rs[d]; |
1043 | n |= parity[key[7]]; | 649 | pe[12 * 2 + 0] = PC2(d, a, b, c); c = rs[c]; b = rs[b]; |
1044 | w = 0x88888888L; | 650 | pe[11 * 2 + 0] = PC2(b, c, d, a); a = rs[a]; d = rs[d]; |
1045 | 651 | pe[10 * 2 + 0] = PC2(d, a, b, c); c = rs[c]; b = rs[b]; | |
1046 | if ((*flags & CRYPTO_TFM_REQ_WEAK_KEY) | 652 | pe[ 9 * 2 + 0] = PC2(b, c, d, a); a = rs[a]; d = rs[d]; |
1047 | && !((n - (w >> 3)) & w)) { /* 1 in 10^10 keys passes this test */ | 653 | pe[ 8 * 2 + 0] = PC2(d, a, b, c); c = rs[c]; |
1048 | if (n < 0x41415151) { | 654 | pe[ 7 * 2 + 0] = PC2(c, d, a, b); b = rs[b]; a = rs[a]; |
1049 | if (n < 0x31312121) { | 655 | pe[ 6 * 2 + 0] = PC2(a, b, c, d); d = rs[d]; c = rs[c]; |
1050 | if (n < 0x14141515) { | 656 | pe[ 5 * 2 + 0] = PC2(c, d, a, b); b = rs[b]; a = rs[a]; |
1051 | /* 01 01 01 01 01 01 01 01 */ | 657 | pe[ 4 * 2 + 0] = PC2(a, b, c, d); d = rs[d]; c = rs[c]; |
1052 | if (n == 0x11111111) goto weak; | 658 | pe[ 3 * 2 + 0] = PC2(c, d, a, b); b = rs[b]; a = rs[a]; |
1053 | /* 01 1F 01 1F 01 0E 01 0E */ | 659 | pe[ 2 * 2 + 0] = PC2(a, b, c, d); d = rs[d]; c = rs[c]; |
1054 | if (n == 0x13131212) goto weak; | 660 | pe[ 1 * 2 + 0] = PC2(c, d, a, b); b = rs[b]; |
1055 | } else { | 661 | pe[ 0 * 2 + 0] = PC2(b, c, d, a); |
1056 | /* 01 E0 01 E0 01 F1 01 F1 */ | 662 | |
1057 | if (n == 0x14141515) goto weak; | 663 | /* Check if first half is weak */ |
1058 | /* 01 FE 01 FE 01 FE 01 FE */ | 664 | w = (a ^ c) | (b ^ d) | (rs[a] ^ c) | (b ^ rs[d]); |
1059 | if (n == 0x16161616) goto weak; | 665 | |
1060 | } | 666 | /* Skip to next table set */ |
1061 | } else { | 667 | pt += 512; |
1062 | if (n < 0x34342525) { | 668 | |
1063 | /* 1F 01 1F 01 0E 01 0E 01 */ | 669 | d = k[0]; d &= 0xe0; d >>= 4; d |= k[4] & 0xf0; d = pc1[d + 1]; |
1064 | if (n == 0x31312121) goto weak; | 670 | c = k[1]; c &= 0xe0; c >>= 4; c |= k[5] & 0xf0; c = pc1[c + 1]; |
1065 | /* 1F 1F 1F 1F 0E 0E 0E 0E (?) */ | 671 | b = k[2]; b &= 0xe0; b >>= 4; b |= k[6] & 0xf0; b = pc1[b + 1]; |
1066 | if (n == 0x33332222) goto weak; | 672 | a = k[3]; a &= 0xe0; a >>= 4; a |= k[7] & 0xf0; a = pc1[a + 1]; |
1067 | } else { | 673 | |
1068 | /* 1F E0 1F E0 0E F1 0E F1 */ | 674 | /* Check if second half is weak */ |
1069 | if (n == 0x34342525) goto weak; | 675 | w |= (a ^ c) | (b ^ d) | (rs[a] ^ c) | (b ^ rs[d]); |
1070 | /* 1F FE 1F FE 0E FE 0E FE */ | 676 | |
1071 | if (n == 0x36362626) goto weak; | 677 | pe[15 * 2 + 1] = PC2(a, b, c, d); d = rs[d]; |
1072 | } | 678 | pe[14 * 2 + 1] = PC2(d, a, b, c); c = rs[c]; b = rs[b]; |
1073 | } | 679 | pe[13 * 2 + 1] = PC2(b, c, d, a); a = rs[a]; d = rs[d]; |
1074 | } else { | 680 | pe[12 * 2 + 1] = PC2(d, a, b, c); c = rs[c]; b = rs[b]; |
1075 | if (n < 0x61616161) { | 681 | pe[11 * 2 + 1] = PC2(b, c, d, a); a = rs[a]; d = rs[d]; |
1076 | if (n < 0x44445555) { | 682 | pe[10 * 2 + 1] = PC2(d, a, b, c); c = rs[c]; b = rs[b]; |
1077 | /* E0 01 E0 01 F1 01 F1 01 */ | 683 | pe[ 9 * 2 + 1] = PC2(b, c, d, a); a = rs[a]; d = rs[d]; |
1078 | if (n == 0x41415151) goto weak; | 684 | pe[ 8 * 2 + 1] = PC2(d, a, b, c); c = rs[c]; |
1079 | /* E0 1F E0 1F F1 0E F1 0E */ | 685 | pe[ 7 * 2 + 1] = PC2(c, d, a, b); b = rs[b]; a = rs[a]; |
1080 | if (n == 0x43435252) goto weak; | 686 | pe[ 6 * 2 + 1] = PC2(a, b, c, d); d = rs[d]; c = rs[c]; |
1081 | } else { | 687 | pe[ 5 * 2 + 1] = PC2(c, d, a, b); b = rs[b]; a = rs[a]; |
1082 | /* E0 E0 E0 E0 F1 F1 F1 F1 (?) */ | 688 | pe[ 4 * 2 + 1] = PC2(a, b, c, d); d = rs[d]; c = rs[c]; |
1083 | if (n == 0x44445555) goto weak; | 689 | pe[ 3 * 2 + 1] = PC2(c, d, a, b); b = rs[b]; a = rs[a]; |
1084 | /* E0 FE E0 FE F1 FE F1 FE */ | 690 | pe[ 2 * 2 + 1] = PC2(a, b, c, d); d = rs[d]; c = rs[c]; |
1085 | if (n == 0x46465656) goto weak; | 691 | pe[ 1 * 2 + 1] = PC2(c, d, a, b); b = rs[b]; |
1086 | } | 692 | pe[ 0 * 2 + 1] = PC2(b, c, d, a); |
1087 | } else { | 693 | |
1088 | if (n < 0x64646565) { | 694 | /* Fixup: 2413 5768 -> 1357 2468 */ |
1089 | /* FE 01 FE 01 FE 01 FE 01 */ | 695 | for (d = 0; d < 16; ++d) { |
1090 | if (n == 0x61616161) goto weak; | 696 | a = pe[2 * d]; |
1091 | /* FE 1F FE 1F FE 0E FE 0E */ | 697 | b = pe[2 * d + 1]; |
1092 | if (n == 0x63636262) goto weak; | 698 | c = a ^ b; |
1093 | } else { | 699 | c &= 0xffff0000; |
1094 | /* FE E0 FE E0 FE F1 FE F1 */ | 700 | a ^= c; |
1095 | if (n == 0x64646565) goto weak; | 701 | b ^= c; |
1096 | /* FE FE FE FE FE FE FE FE */ | 702 | ROL(b, 18); |
1097 | if (n == 0x66666666) goto weak; | 703 | pe[2 * d] = a; |
1098 | } | 704 | pe[2 * d + 1] = b; |
1099 | } | ||
1100 | } | ||
1101 | |||
1102 | goto not_weak; | ||
1103 | weak: | ||
1104 | *flags |= CRYPTO_TFM_RES_WEAK_KEY; | ||
1105 | return -EINVAL; | ||
1106 | } | 705 | } |
1107 | 706 | ||
1108 | not_weak: | 707 | /* Zero if weak key */ |
1109 | 708 | return w; | |
1110 | /* explode the bits */ | 709 | } |
1111 | n = 56; | ||
1112 | b0 = bits0; | ||
1113 | b1 = bits1; | ||
1114 | |||
1115 | do { | ||
1116 | w = (256 | *key++) << 2; | ||
1117 | do { | ||
1118 | --n; | ||
1119 | b1[n] = 8 & w; | ||
1120 | w >>= 1; | ||
1121 | b0[n] = 4 & w; | ||
1122 | } while ( w >= 16 ); | ||
1123 | } while ( n ); | ||
1124 | |||
1125 | /* put the bits in the correct places */ | ||
1126 | n = 16; | ||
1127 | k = rotors; | ||
1128 | |||
1129 | do { | ||
1130 | w = (b1[k[ 0 ]] | b0[k[ 1 ]]) << 4; | ||
1131 | w |= (b1[k[ 2 ]] | b0[k[ 3 ]]) << 2; | ||
1132 | w |= b1[k[ 4 ]] | b0[k[ 5 ]]; | ||
1133 | w <<= 8; | ||
1134 | w |= (b1[k[ 6 ]] | b0[k[ 7 ]]) << 4; | ||
1135 | w |= (b1[k[ 8 ]] | b0[k[ 9 ]]) << 2; | ||
1136 | w |= b1[k[10 ]] | b0[k[11 ]]; | ||
1137 | w <<= 8; | ||
1138 | w |= (b1[k[12 ]] | b0[k[13 ]]) << 4; | ||
1139 | w |= (b1[k[14 ]] | b0[k[15 ]]) << 2; | ||
1140 | w |= b1[k[16 ]] | b0[k[17 ]]; | ||
1141 | w <<= 8; | ||
1142 | w |= (b1[k[18 ]] | b0[k[19 ]]) << 4; | ||
1143 | w |= (b1[k[20 ]] | b0[k[21 ]]) << 2; | ||
1144 | w |= b1[k[22 ]] | b0[k[23 ]]; | ||
1145 | expkey[0] = w; | ||
1146 | |||
1147 | w = (b1[k[ 0+24]] | b0[k[ 1+24]]) << 4; | ||
1148 | w |= (b1[k[ 2+24]] | b0[k[ 3+24]]) << 2; | ||
1149 | w |= b1[k[ 4+24]] | b0[k[ 5+24]]; | ||
1150 | w <<= 8; | ||
1151 | w |= (b1[k[ 6+24]] | b0[k[ 7+24]]) << 4; | ||
1152 | w |= (b1[k[ 8+24]] | b0[k[ 9+24]]) << 2; | ||
1153 | w |= b1[k[10+24]] | b0[k[11+24]]; | ||
1154 | w <<= 8; | ||
1155 | w |= (b1[k[12+24]] | b0[k[13+24]]) << 4; | ||
1156 | w |= (b1[k[14+24]] | b0[k[15+24]]) << 2; | ||
1157 | w |= b1[k[16+24]] | b0[k[17+24]]; | ||
1158 | w <<= 8; | ||
1159 | w |= (b1[k[18+24]] | b0[k[19+24]]) << 4; | ||
1160 | w |= (b1[k[20+24]] | b0[k[21+24]]) << 2; | ||
1161 | w |= b1[k[22+24]] | b0[k[23+24]]; | ||
1162 | |||
1163 | ROR(w, 4, 28); /* could be eliminated */ | ||
1164 | expkey[1] = w; | ||
1165 | |||
1166 | k += 48; | ||
1167 | expkey += 2; | ||
1168 | } while (--n); | ||
1169 | 710 | ||
1170 | return 0; | 711 | /* |
712 | * Decryption key expansion | ||
713 | * | ||
714 | * No weak key checking is performed, as this is only used by triple DES | ||
715 | * | ||
716 | */ | ||
717 | static void dkey(u32 *pe, const u8 *k) | ||
718 | { | ||
719 | /* K&R: long is at least 32 bits */ | ||
720 | unsigned long a, b, c, d; | ||
721 | const u32 *pt = pc2; | ||
722 | |||
723 | d = k[4]; d &= 0x0e; d <<= 4; d |= k[0] & 0x1e; d = pc1[d]; | ||
724 | c = k[5]; c &= 0x0e; c <<= 4; c |= k[1] & 0x1e; c = pc1[c]; | ||
725 | b = k[6]; b &= 0x0e; b <<= 4; b |= k[2] & 0x1e; b = pc1[b]; | ||
726 | a = k[7]; a &= 0x0e; a <<= 4; a |= k[3] & 0x1e; a = pc1[a]; | ||
727 | |||
728 | pe[ 0 * 2] = PC2(a, b, c, d); d = rs[d]; | ||
729 | pe[ 1 * 2] = PC2(d, a, b, c); c = rs[c]; b = rs[b]; | ||
730 | pe[ 2 * 2] = PC2(b, c, d, a); a = rs[a]; d = rs[d]; | ||
731 | pe[ 3 * 2] = PC2(d, a, b, c); c = rs[c]; b = rs[b]; | ||
732 | pe[ 4 * 2] = PC2(b, c, d, a); a = rs[a]; d = rs[d]; | ||
733 | pe[ 5 * 2] = PC2(d, a, b, c); c = rs[c]; b = rs[b]; | ||
734 | pe[ 6 * 2] = PC2(b, c, d, a); a = rs[a]; d = rs[d]; | ||
735 | pe[ 7 * 2] = PC2(d, a, b, c); c = rs[c]; | ||
736 | pe[ 8 * 2] = PC2(c, d, a, b); b = rs[b]; a = rs[a]; | ||
737 | pe[ 9 * 2] = PC2(a, b, c, d); d = rs[d]; c = rs[c]; | ||
738 | pe[10 * 2] = PC2(c, d, a, b); b = rs[b]; a = rs[a]; | ||
739 | pe[11 * 2] = PC2(a, b, c, d); d = rs[d]; c = rs[c]; | ||
740 | pe[12 * 2] = PC2(c, d, a, b); b = rs[b]; a = rs[a]; | ||
741 | pe[13 * 2] = PC2(a, b, c, d); d = rs[d]; c = rs[c]; | ||
742 | pe[14 * 2] = PC2(c, d, a, b); b = rs[b]; | ||
743 | pe[15 * 2] = PC2(b, c, d, a); | ||
744 | |||
745 | /* Skip to next table set */ | ||
746 | pt += 512; | ||
747 | |||
748 | d = k[0]; d &= 0xe0; d >>= 4; d |= k[4] & 0xf0; d = pc1[d + 1]; | ||
749 | c = k[1]; c &= 0xe0; c >>= 4; c |= k[5] & 0xf0; c = pc1[c + 1]; | ||
750 | b = k[2]; b &= 0xe0; b >>= 4; b |= k[6] & 0xf0; b = pc1[b + 1]; | ||
751 | a = k[3]; a &= 0xe0; a >>= 4; a |= k[7] & 0xf0; a = pc1[a + 1]; | ||
752 | |||
753 | pe[ 0 * 2 + 1] = PC2(a, b, c, d); d = rs[d]; | ||
754 | pe[ 1 * 2 + 1] = PC2(d, a, b, c); c = rs[c]; b = rs[b]; | ||
755 | pe[ 2 * 2 + 1] = PC2(b, c, d, a); a = rs[a]; d = rs[d]; | ||
756 | pe[ 3 * 2 + 1] = PC2(d, a, b, c); c = rs[c]; b = rs[b]; | ||
757 | pe[ 4 * 2 + 1] = PC2(b, c, d, a); a = rs[a]; d = rs[d]; | ||
758 | pe[ 5 * 2 + 1] = PC2(d, a, b, c); c = rs[c]; b = rs[b]; | ||
759 | pe[ 6 * 2 + 1] = PC2(b, c, d, a); a = rs[a]; d = rs[d]; | ||
760 | pe[ 7 * 2 + 1] = PC2(d, a, b, c); c = rs[c]; | ||
761 | pe[ 8 * 2 + 1] = PC2(c, d, a, b); b = rs[b]; a = rs[a]; | ||
762 | pe[ 9 * 2 + 1] = PC2(a, b, c, d); d = rs[d]; c = rs[c]; | ||
763 | pe[10 * 2 + 1] = PC2(c, d, a, b); b = rs[b]; a = rs[a]; | ||
764 | pe[11 * 2 + 1] = PC2(a, b, c, d); d = rs[d]; c = rs[c]; | ||
765 | pe[12 * 2 + 1] = PC2(c, d, a, b); b = rs[b]; a = rs[a]; | ||
766 | pe[13 * 2 + 1] = PC2(a, b, c, d); d = rs[d]; c = rs[c]; | ||
767 | pe[14 * 2 + 1] = PC2(c, d, a, b); b = rs[b]; | ||
768 | pe[15 * 2 + 1] = PC2(b, c, d, a); | ||
769 | |||
770 | /* Fixup: 2413 5768 -> 1357 2468 */ | ||
771 | for (d = 0; d < 16; ++d) { | ||
772 | a = pe[2 * d]; | ||
773 | b = pe[2 * d + 1]; | ||
774 | c = a ^ b; | ||
775 | c &= 0xffff0000; | ||
776 | a ^= c; | ||
777 | b ^= c; | ||
778 | ROL(b, 18); | ||
779 | pe[2 * d] = a; | ||
780 | pe[2 * d + 1] = b; | ||
781 | } | ||
1171 | } | 782 | } |
1172 | 783 | ||
1173 | static int des_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags) | 784 | static int des_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags) |
1174 | { | 785 | { |
1175 | return setkey(((struct des_ctx *)ctx)->expkey, key, keylen, flags); | 786 | struct des_ctx *dctx = ctx; |
787 | u32 tmp[DES_EXPKEY_WORDS]; | ||
788 | int ret; | ||
789 | |||
790 | /* Expand to tmp */ | ||
791 | ret = ekey(tmp, key); | ||
792 | |||
793 | if (unlikely(ret == 0) && (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) { | ||
794 | *flags |= CRYPTO_TFM_RES_WEAK_KEY; | ||
795 | return -EINVAL; | ||
796 | } | ||
797 | |||
798 | /* Copy to output */ | ||
799 | memcpy(dctx->expkey, tmp, sizeof(dctx->expkey)); | ||
800 | |||
801 | return 0; | ||
1176 | } | 802 | } |
1177 | 803 | ||
1178 | static void des_encrypt(void *ctx, u8 *dst, const u8 *src) | 804 | static void des_encrypt(void *ctx, u8 *dst, const u8 *src) |
1179 | { | 805 | { |
1180 | des_small_fips_encrypt(((struct des_ctx *)ctx)->expkey, dst, src); | 806 | const u32 *K = ((struct des_ctx *)ctx)->expkey; |
807 | const __le32 *s = (const __le32 *)src; | ||
808 | __le32 *d = (__le32 *)dst; | ||
809 | u32 L, R, A, B; | ||
810 | int i; | ||
811 | |||
812 | L = le32_to_cpu(s[0]); | ||
813 | R = le32_to_cpu(s[1]); | ||
814 | |||
815 | IP(L, R, A); | ||
816 | for (i = 0; i < 8; i++) { | ||
817 | ROUND(L, R, A, B, K, 2); | ||
818 | ROUND(R, L, A, B, K, 2); | ||
819 | } | ||
820 | FP(R, L, A); | ||
821 | |||
822 | d[0] = cpu_to_le32(R); | ||
823 | d[1] = cpu_to_le32(L); | ||
1181 | } | 824 | } |
1182 | 825 | ||
1183 | static void des_decrypt(void *ctx, u8 *dst, const u8 *src) | 826 | static void des_decrypt(void *ctx, u8 *dst, const u8 *src) |
1184 | { | 827 | { |
1185 | des_small_fips_decrypt(((struct des_ctx *)ctx)->expkey, dst, src); | 828 | const u32 *K = ((struct des_ctx *)ctx)->expkey + DES_EXPKEY_WORDS - 2; |
829 | const __le32 *s = (const __le32 *)src; | ||
830 | __le32 *d = (__le32 *)dst; | ||
831 | u32 L, R, A, B; | ||
832 | int i; | ||
833 | |||
834 | L = le32_to_cpu(s[0]); | ||
835 | R = le32_to_cpu(s[1]); | ||
836 | |||
837 | IP(L, R, A); | ||
838 | for (i = 0; i < 8; i++) { | ||
839 | ROUND(L, R, A, B, K, -2); | ||
840 | ROUND(R, L, A, B, K, -2); | ||
841 | } | ||
842 | FP(R, L, A); | ||
843 | |||
844 | d[0] = cpu_to_le32(R); | ||
845 | d[1] = cpu_to_le32(L); | ||
1186 | } | 846 | } |
1187 | 847 | ||
1188 | /* | 848 | /* |
1189 | * RFC2451: | 849 | * RFC2451: |
1190 | * | 850 | * |
1191 | * For DES-EDE3, there is no known need to reject weak or | 851 | * For DES-EDE3, there is no known need to reject weak or |
@@ -1199,44 +859,86 @@ static void des_decrypt(void *ctx, u8 *dst, const u8 *src) | |||
1199 | * | 859 | * |
1200 | */ | 860 | */ |
1201 | static int des3_ede_setkey(void *ctx, const u8 *key, | 861 | static int des3_ede_setkey(void *ctx, const u8 *key, |
1202 | unsigned int keylen, u32 *flags) | 862 | unsigned int keylen, u32 *flags) |
1203 | { | 863 | { |
1204 | unsigned int i, off; | 864 | const u32 *K = (const u32 *)key; |
1205 | struct des3_ede_ctx *dctx = ctx; | 865 | struct des3_ede_ctx *dctx = ctx; |
866 | u32 *expkey = dctx->expkey; | ||
1206 | 867 | ||
1207 | if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && | 868 | if (unlikely(!((K[0] ^ K[2]) | (K[1] ^ K[3])) || |
1208 | memcmp(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2], | 869 | !((K[2] ^ K[4]) | (K[3] ^ K[5])))) |
1209 | DES_KEY_SIZE))) { | 870 | { |
1210 | |||
1211 | *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED; | 871 | *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED; |
1212 | return -EINVAL; | 872 | return -EINVAL; |
1213 | } | 873 | } |
1214 | 874 | ||
1215 | for (i = 0, off = 0; i < 3; i++, off += DES_EXPKEY_WORDS, | 875 | ekey(expkey, key); expkey += DES_EXPKEY_WORDS; key += DES_KEY_SIZE; |
1216 | key += DES_KEY_SIZE) { | 876 | dkey(expkey, key); expkey += DES_EXPKEY_WORDS; key += DES_KEY_SIZE; |
1217 | int ret = setkey(&dctx->expkey[off], key, DES_KEY_SIZE, flags); | 877 | ekey(expkey, key); |
1218 | if (ret < 0) | 878 | |
1219 | return ret; | ||
1220 | } | ||
1221 | return 0; | 879 | return 0; |
1222 | } | 880 | } |
1223 | 881 | ||
1224 | static void des3_ede_encrypt(void *ctx, u8 *dst, const u8 *src) | 882 | static void des3_ede_encrypt(void *ctx, u8 *dst, const u8 *src) |
1225 | { | 883 | { |
1226 | struct des3_ede_ctx *dctx = ctx; | 884 | struct des3_ede_ctx *dctx = ctx; |
1227 | 885 | const u32 *K = dctx->expkey; | |
1228 | des_small_fips_encrypt(dctx->expkey, dst, src); | 886 | const __le32 *s = (const __le32 *)src; |
1229 | des_small_fips_decrypt(&dctx->expkey[DES_EXPKEY_WORDS], dst, dst); | 887 | __le32 *d = (__le32 *)dst; |
1230 | des_small_fips_encrypt(&dctx->expkey[DES_EXPKEY_WORDS * 2], dst, dst); | 888 | u32 L, R, A, B; |
889 | int i; | ||
890 | |||
891 | L = le32_to_cpu(s[0]); | ||
892 | R = le32_to_cpu(s[1]); | ||
893 | |||
894 | IP(L, R, A); | ||
895 | for (i = 0; i < 8; i++) { | ||
896 | ROUND(L, R, A, B, K, 2); | ||
897 | ROUND(R, L, A, B, K, 2); | ||
898 | } | ||
899 | for (i = 0; i < 8; i++) { | ||
900 | ROUND(R, L, A, B, K, 2); | ||
901 | ROUND(L, R, A, B, K, 2); | ||
902 | } | ||
903 | for (i = 0; i < 8; i++) { | ||
904 | ROUND(L, R, A, B, K, 2); | ||
905 | ROUND(R, L, A, B, K, 2); | ||
906 | } | ||
907 | FP(R, L, A); | ||
908 | |||
909 | d[0] = cpu_to_le32(R); | ||
910 | d[1] = cpu_to_le32(L); | ||
1231 | } | 911 | } |
1232 | 912 | ||
1233 | static void des3_ede_decrypt(void *ctx, u8 *dst, const u8 *src) | 913 | static void des3_ede_decrypt(void *ctx, u8 *dst, const u8 *src) |
1234 | { | 914 | { |
1235 | struct des3_ede_ctx *dctx = ctx; | 915 | struct des3_ede_ctx *dctx = ctx; |
916 | const u32 *K = dctx->expkey + DES3_EDE_EXPKEY_WORDS - 2; | ||
917 | const __le32 *s = (const __le32 *)src; | ||
918 | __le32 *d = (__le32 *)dst; | ||
919 | u32 L, R, A, B; | ||
920 | int i; | ||
921 | |||
922 | L = le32_to_cpu(s[0]); | ||
923 | R = le32_to_cpu(s[1]); | ||
924 | |||
925 | IP(L, R, A); | ||
926 | for (i = 0; i < 8; i++) { | ||
927 | ROUND(L, R, A, B, K, -2); | ||
928 | ROUND(R, L, A, B, K, -2); | ||
929 | } | ||
930 | for (i = 0; i < 8; i++) { | ||
931 | ROUND(R, L, A, B, K, -2); | ||
932 | ROUND(L, R, A, B, K, -2); | ||
933 | } | ||
934 | for (i = 0; i < 8; i++) { | ||
935 | ROUND(L, R, A, B, K, -2); | ||
936 | ROUND(R, L, A, B, K, -2); | ||
937 | } | ||
938 | FP(R, L, A); | ||
1236 | 939 | ||
1237 | des_small_fips_decrypt(&dctx->expkey[DES_EXPKEY_WORDS * 2], dst, src); | 940 | d[0] = cpu_to_le32(R); |
1238 | des_small_fips_encrypt(&dctx->expkey[DES_EXPKEY_WORDS], dst, dst); | 941 | d[1] = cpu_to_le32(L); |
1239 | des_small_fips_decrypt(dctx->expkey, dst, dst); | ||
1240 | } | 942 | } |
1241 | 943 | ||
1242 | static struct crypto_alg des_alg = { | 944 | static struct crypto_alg des_alg = { |
@@ -1249,7 +951,7 @@ static struct crypto_alg des_alg = { | |||
1249 | .cra_u = { .cipher = { | 951 | .cra_u = { .cipher = { |
1250 | .cia_min_keysize = DES_KEY_SIZE, | 952 | .cia_min_keysize = DES_KEY_SIZE, |
1251 | .cia_max_keysize = DES_KEY_SIZE, | 953 | .cia_max_keysize = DES_KEY_SIZE, |
1252 | .cia_setkey = des_setkey, | 954 | .cia_setkey = des_setkey, |
1253 | .cia_encrypt = des_encrypt, | 955 | .cia_encrypt = des_encrypt, |
1254 | .cia_decrypt = des_decrypt } } | 956 | .cia_decrypt = des_decrypt } } |
1255 | }; | 957 | }; |
@@ -1264,9 +966,9 @@ static struct crypto_alg des3_ede_alg = { | |||
1264 | .cra_u = { .cipher = { | 966 | .cra_u = { .cipher = { |
1265 | .cia_min_keysize = DES3_EDE_KEY_SIZE, | 967 | .cia_min_keysize = DES3_EDE_KEY_SIZE, |
1266 | .cia_max_keysize = DES3_EDE_KEY_SIZE, | 968 | .cia_max_keysize = DES3_EDE_KEY_SIZE, |
1267 | .cia_setkey = des3_ede_setkey, | 969 | .cia_setkey = des3_ede_setkey, |
1268 | .cia_encrypt = des3_ede_encrypt, | 970 | .cia_encrypt = des3_ede_encrypt, |
1269 | .cia_decrypt = des3_ede_decrypt } } | 971 | .cia_decrypt = des3_ede_decrypt } } |
1270 | }; | 972 | }; |
1271 | 973 | ||
1272 | MODULE_ALIAS("des3_ede"); | 974 | MODULE_ALIAS("des3_ede"); |
@@ -1274,7 +976,7 @@ MODULE_ALIAS("des3_ede"); | |||
1274 | static int __init init(void) | 976 | static int __init init(void) |
1275 | { | 977 | { |
1276 | int ret = 0; | 978 | int ret = 0; |
1277 | 979 | ||
1278 | ret = crypto_register_alg(&des_alg); | 980 | ret = crypto_register_alg(&des_alg); |
1279 | if (ret < 0) | 981 | if (ret < 0) |
1280 | goto out; | 982 | goto out; |
@@ -1282,7 +984,7 @@ static int __init init(void) | |||
1282 | ret = crypto_register_alg(&des3_ede_alg); | 984 | ret = crypto_register_alg(&des3_ede_alg); |
1283 | if (ret < 0) | 985 | if (ret < 0) |
1284 | crypto_unregister_alg(&des_alg); | 986 | crypto_unregister_alg(&des_alg); |
1285 | out: | 987 | out: |
1286 | return ret; | 988 | return ret; |
1287 | } | 989 | } |
1288 | 990 | ||
@@ -1297,3 +999,4 @@ module_exit(fini); | |||
1297 | 999 | ||
1298 | MODULE_LICENSE("GPL"); | 1000 | MODULE_LICENSE("GPL"); |
1299 | MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms"); | 1001 | MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms"); |
1002 | MODULE_AUTHOR("Dag Arne Osvik <da@osvik.no>"); | ||
diff --git a/crypto/hmac.c b/crypto/hmac.c index 847df9263e16..da0456b37109 100644 --- a/crypto/hmac.c +++ b/crypto/hmac.c | |||
@@ -49,8 +49,7 @@ int crypto_alloc_hmac_block(struct crypto_tfm *tfm) | |||
49 | 49 | ||
50 | void crypto_free_hmac_block(struct crypto_tfm *tfm) | 50 | void crypto_free_hmac_block(struct crypto_tfm *tfm) |
51 | { | 51 | { |
52 | if (tfm->crt_digest.dit_hmac_block) | 52 | kfree(tfm->crt_digest.dit_hmac_block); |
53 | kfree(tfm->crt_digest.dit_hmac_block); | ||
54 | } | 53 | } |
55 | 54 | ||
56 | void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen) | 55 | void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen) |
diff --git a/crypto/internal.h b/crypto/internal.h index 964b9a60ca24..68612874b5fd 100644 --- a/crypto/internal.h +++ b/crypto/internal.h | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/highmem.h> | 16 | #include <linux/highmem.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/kmod.h> | 19 | #include <linux/kernel.h> |
20 | #include <asm/kmap_types.h> | 20 | #include <asm/kmap_types.h> |
21 | 21 | ||
22 | extern enum km_type crypto_km_types[]; | 22 | extern enum km_type crypto_km_types[]; |
@@ -42,20 +42,6 @@ static inline void crypto_yield(struct crypto_tfm *tfm) | |||
42 | cond_resched(); | 42 | cond_resched(); |
43 | } | 43 | } |
44 | 44 | ||
45 | static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) | ||
46 | { | ||
47 | return (void *)&tfm[1]; | ||
48 | } | ||
49 | |||
50 | struct crypto_alg *crypto_alg_lookup(const char *name); | ||
51 | |||
52 | /* A far more intelligent version of this is planned. For now, just | ||
53 | * try an exact match on the name of the algorithm. */ | ||
54 | static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name) | ||
55 | { | ||
56 | return try_then_request_module(crypto_alg_lookup(name), name); | ||
57 | } | ||
58 | |||
59 | #ifdef CONFIG_CRYPTO_HMAC | 45 | #ifdef CONFIG_CRYPTO_HMAC |
60 | int crypto_alloc_hmac_block(struct crypto_tfm *tfm); | 46 | int crypto_alloc_hmac_block(struct crypto_tfm *tfm); |
61 | void crypto_free_hmac_block(struct crypto_tfm *tfm); | 47 | void crypto_free_hmac_block(struct crypto_tfm *tfm); |
@@ -76,6 +62,33 @@ static inline void crypto_init_proc(void) | |||
76 | { } | 62 | { } |
77 | #endif | 63 | #endif |
78 | 64 | ||
65 | static inline unsigned int crypto_digest_ctxsize(struct crypto_alg *alg, | ||
66 | int flags) | ||
67 | { | ||
68 | return alg->cra_ctxsize; | ||
69 | } | ||
70 | |||
71 | static inline unsigned int crypto_cipher_ctxsize(struct crypto_alg *alg, | ||
72 | int flags) | ||
73 | { | ||
74 | unsigned int len = alg->cra_ctxsize; | ||
75 | |||
76 | switch (flags & CRYPTO_TFM_MODE_MASK) { | ||
77 | case CRYPTO_TFM_MODE_CBC: | ||
78 | len = ALIGN(len, alg->cra_alignmask + 1); | ||
79 | len += alg->cra_blocksize; | ||
80 | break; | ||
81 | } | ||
82 | |||
83 | return len; | ||
84 | } | ||
85 | |||
86 | static inline unsigned int crypto_compress_ctxsize(struct crypto_alg *alg, | ||
87 | int flags) | ||
88 | { | ||
89 | return alg->cra_ctxsize; | ||
90 | } | ||
91 | |||
79 | int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags); | 92 | int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags); |
80 | int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags); | 93 | int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags); |
81 | int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags); | 94 | int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags); |
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c index 50c9461e8cc6..47ac90e615f4 100644 --- a/crypto/scatterwalk.c +++ b/crypto/scatterwalk.c | |||
@@ -100,7 +100,7 @@ void scatterwalk_done(struct scatter_walk *walk, int out, int more) | |||
100 | int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, | 100 | int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, |
101 | size_t nbytes, int out) | 101 | size_t nbytes, int out) |
102 | { | 102 | { |
103 | do { | 103 | while (nbytes > walk->len_this_page) { |
104 | memcpy_dir(buf, walk->data, walk->len_this_page, out); | 104 | memcpy_dir(buf, walk->data, walk->len_this_page, out); |
105 | buf += walk->len_this_page; | 105 | buf += walk->len_this_page; |
106 | nbytes -= walk->len_this_page; | 106 | nbytes -= walk->len_this_page; |
@@ -108,7 +108,7 @@ int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, | |||
108 | scatterwalk_unmap(walk, out); | 108 | scatterwalk_unmap(walk, out); |
109 | scatterwalk_pagedone(walk, out, 1); | 109 | scatterwalk_pagedone(walk, out, 1); |
110 | scatterwalk_map(walk, out); | 110 | scatterwalk_map(walk, out); |
111 | } while (nbytes > walk->len_this_page); | 111 | } |
112 | 112 | ||
113 | memcpy_dir(buf, walk->data, nbytes, out); | 113 | memcpy_dir(buf, walk->data, nbytes, out); |
114 | return nbytes; | 114 | return nbytes; |
diff --git a/crypto/scatterwalk.h b/crypto/scatterwalk.h index 02aa56c649b4..e79925c474a3 100644 --- a/crypto/scatterwalk.h +++ b/crypto/scatterwalk.h | |||
@@ -40,10 +40,10 @@ static inline int scatterwalk_samebuf(struct scatter_walk *walk_in, | |||
40 | walk_in->offset == walk_out->offset; | 40 | walk_in->offset == walk_out->offset; |
41 | } | 41 | } |
42 | 42 | ||
43 | static inline int scatterwalk_across_pages(struct scatter_walk *walk, | 43 | static inline unsigned int scatterwalk_clamp(struct scatter_walk *walk, |
44 | unsigned int nbytes) | 44 | unsigned int nbytes) |
45 | { | 45 | { |
46 | return nbytes > walk->len_this_page; | 46 | return nbytes > walk->len_this_page ? walk->len_this_page : nbytes; |
47 | } | 47 | } |
48 | 48 | ||
49 | static inline void scatterwalk_advance(struct scatter_walk *walk, | 49 | static inline void scatterwalk_advance(struct scatter_walk *walk, |
@@ -55,6 +55,12 @@ static inline void scatterwalk_advance(struct scatter_walk *walk, | |||
55 | walk->len_this_segment -= nbytes; | 55 | walk->len_this_segment -= nbytes; |
56 | } | 56 | } |
57 | 57 | ||
58 | static inline unsigned int scatterwalk_aligned(struct scatter_walk *walk, | ||
59 | unsigned int alignmask) | ||
60 | { | ||
61 | return !(walk->offset & alignmask); | ||
62 | } | ||
63 | |||
58 | void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg); | 64 | void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg); |
59 | int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, size_t nbytes, int out); | 65 | int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, size_t nbytes, int out); |
60 | void scatterwalk_map(struct scatter_walk *walk, int out); | 66 | void scatterwalk_map(struct scatter_walk *walk, int out); |
diff --git a/crypto/serpent.c b/crypto/serpent.c index 7d152e89016f..3cf2c5067eea 100644 --- a/crypto/serpent.c +++ b/crypto/serpent.c | |||
@@ -210,7 +210,6 @@ | |||
210 | x4 ^= x2; | 210 | x4 ^= x2; |
211 | 211 | ||
212 | struct serpent_ctx { | 212 | struct serpent_ctx { |
213 | u8 iv[SERPENT_BLOCK_SIZE]; | ||
214 | u32 expkey[SERPENT_EXPKEY_WORDS]; | 213 | u32 expkey[SERPENT_EXPKEY_WORDS]; |
215 | }; | 214 | }; |
216 | 215 | ||
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 5a0adbf8bc04..97013ddfa202 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
@@ -153,7 +153,7 @@ container_device_add(struct acpi_device **device, acpi_handle handle) | |||
153 | return_VALUE(-ENODEV); | 153 | return_VALUE(-ENODEV); |
154 | } | 154 | } |
155 | 155 | ||
156 | result = acpi_bus_scan(*device); | 156 | result = acpi_bus_start(*device); |
157 | 157 | ||
158 | return_VALUE(result); | 158 | return_VALUE(result); |
159 | } | 159 | } |
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index 5d19b39e9e2b..5148f3c10b5c 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c | |||
@@ -61,15 +61,14 @@ acpi_pci_data_handler ( | |||
61 | 61 | ||
62 | 62 | ||
63 | /** | 63 | /** |
64 | * acpi_os_get_pci_id | 64 | * acpi_get_pci_id |
65 | * ------------------ | 65 | * ------------------ |
66 | * This function is used by the ACPI Interpreter (a.k.a. Core Subsystem) | 66 | * This function is used by the ACPI Interpreter (a.k.a. Core Subsystem) |
67 | * to resolve PCI information for ACPI-PCI devices defined in the namespace. | 67 | * to resolve PCI information for ACPI-PCI devices defined in the namespace. |
68 | * This typically occurs when resolving PCI operation region information. | 68 | * This typically occurs when resolving PCI operation region information. |
69 | */ | 69 | */ |
70 | #ifdef ACPI_FUTURE_USAGE | ||
71 | acpi_status | 70 | acpi_status |
72 | acpi_os_get_pci_id ( | 71 | acpi_get_pci_id ( |
73 | acpi_handle handle, | 72 | acpi_handle handle, |
74 | struct acpi_pci_id *id) | 73 | struct acpi_pci_id *id) |
75 | { | 74 | { |
@@ -78,7 +77,7 @@ acpi_os_get_pci_id ( | |||
78 | struct acpi_device *device = NULL; | 77 | struct acpi_device *device = NULL; |
79 | struct acpi_pci_data *data = NULL; | 78 | struct acpi_pci_data *data = NULL; |
80 | 79 | ||
81 | ACPI_FUNCTION_TRACE("acpi_os_get_pci_id"); | 80 | ACPI_FUNCTION_TRACE("acpi_get_pci_id"); |
82 | 81 | ||
83 | if (!id) | 82 | if (!id) |
84 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 83 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -92,7 +91,7 @@ acpi_os_get_pci_id ( | |||
92 | } | 91 | } |
93 | 92 | ||
94 | status = acpi_get_data(handle, acpi_pci_data_handler, (void**) &data); | 93 | status = acpi_get_data(handle, acpi_pci_data_handler, (void**) &data); |
95 | if (ACPI_FAILURE(status) || !data || !data->dev) { | 94 | if (ACPI_FAILURE(status) || !data) { |
96 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 95 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
97 | "Invalid ACPI-PCI context for device %s\n", | 96 | "Invalid ACPI-PCI context for device %s\n", |
98 | acpi_device_bid(device))); | 97 | acpi_device_bid(device))); |
@@ -115,7 +114,7 @@ acpi_os_get_pci_id ( | |||
115 | 114 | ||
116 | return_ACPI_STATUS(AE_OK); | 115 | return_ACPI_STATUS(AE_OK); |
117 | } | 116 | } |
118 | #endif /* ACPI_FUTURE_USAGE */ | 117 | EXPORT_SYMBOL(acpi_get_pci_id); |
119 | 118 | ||
120 | 119 | ||
121 | int | 120 | int |
@@ -129,6 +128,8 @@ acpi_pci_bind ( | |||
129 | char *pathname = NULL; | 128 | char *pathname = NULL; |
130 | struct acpi_buffer buffer = {0, NULL}; | 129 | struct acpi_buffer buffer = {0, NULL}; |
131 | acpi_handle handle = NULL; | 130 | acpi_handle handle = NULL; |
131 | struct pci_dev *dev; | ||
132 | struct pci_bus *bus; | ||
132 | 133 | ||
133 | ACPI_FUNCTION_TRACE("acpi_pci_bind"); | 134 | ACPI_FUNCTION_TRACE("acpi_pci_bind"); |
134 | 135 | ||
@@ -193,8 +194,20 @@ acpi_pci_bind ( | |||
193 | * Locate matching device in PCI namespace. If it doesn't exist | 194 | * Locate matching device in PCI namespace. If it doesn't exist |
194 | * this typically means that the device isn't currently inserted | 195 | * this typically means that the device isn't currently inserted |
195 | * (e.g. docking station, port replicator, etc.). | 196 | * (e.g. docking station, port replicator, etc.). |
197 | * We cannot simply search the global pci device list, since | ||
198 | * PCI devices are added to the global pci list when the root | ||
199 | * bridge start ops are run, which may not have happened yet. | ||
196 | */ | 200 | */ |
197 | data->dev = pci_find_slot(data->id.bus, PCI_DEVFN(data->id.device, data->id.function)); | 201 | bus = pci_find_bus(data->id.segment, data->id.bus); |
202 | if (bus) { | ||
203 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
204 | if (dev->devfn == PCI_DEVFN(data->id.device, | ||
205 | data->id.function)) { | ||
206 | data->dev = dev; | ||
207 | break; | ||
208 | } | ||
209 | } | ||
210 | } | ||
198 | if (!data->dev) { | 211 | if (!data->dev) { |
199 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 212 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
200 | "Device %02x:%02x:%02x.%02x not present in PCI namespace\n", | 213 | "Device %02x:%02x:%02x.%02x not present in PCI namespace\n", |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 8dbf802ee7f8..d1f42b972821 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -433,7 +433,7 @@ acpi_pci_irq_enable ( | |||
433 | printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI", | 433 | printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI", |
434 | pci_name(dev), ('A' + pin)); | 434 | pci_name(dev), ('A' + pin)); |
435 | /* Interrupt Line values above 0xF are forbidden */ | 435 | /* Interrupt Line values above 0xF are forbidden */ |
436 | if (dev->irq >= 0 && (dev->irq <= 0xF)) { | 436 | if (dev->irq > 0 && (dev->irq <= 0xF)) { |
437 | printk(" - using IRQ %d\n", dev->irq); | 437 | printk(" - using IRQ %d\n", dev->irq); |
438 | acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); | 438 | acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); |
439 | return_VALUE(0); | 439 | return_VALUE(0); |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 7e6b8e3b2ed4..5d2f77fcd50c 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -46,6 +46,7 @@ ACPI_MODULE_NAME ("pci_root") | |||
46 | 46 | ||
47 | static int acpi_pci_root_add (struct acpi_device *device); | 47 | static int acpi_pci_root_add (struct acpi_device *device); |
48 | static int acpi_pci_root_remove (struct acpi_device *device, int type); | 48 | static int acpi_pci_root_remove (struct acpi_device *device, int type); |
49 | static int acpi_pci_root_start (struct acpi_device *device); | ||
49 | 50 | ||
50 | static struct acpi_driver acpi_pci_root_driver = { | 51 | static struct acpi_driver acpi_pci_root_driver = { |
51 | .name = ACPI_PCI_ROOT_DRIVER_NAME, | 52 | .name = ACPI_PCI_ROOT_DRIVER_NAME, |
@@ -54,6 +55,7 @@ static struct acpi_driver acpi_pci_root_driver = { | |||
54 | .ops = { | 55 | .ops = { |
55 | .add = acpi_pci_root_add, | 56 | .add = acpi_pci_root_add, |
56 | .remove = acpi_pci_root_remove, | 57 | .remove = acpi_pci_root_remove, |
58 | .start = acpi_pci_root_start, | ||
57 | }, | 59 | }, |
58 | }; | 60 | }; |
59 | 61 | ||
@@ -169,6 +171,7 @@ acpi_pci_root_add ( | |||
169 | if (!root) | 171 | if (!root) |
170 | return_VALUE(-ENOMEM); | 172 | return_VALUE(-ENOMEM); |
171 | memset(root, 0, sizeof(struct acpi_pci_root)); | 173 | memset(root, 0, sizeof(struct acpi_pci_root)); |
174 | INIT_LIST_HEAD(&root->node); | ||
172 | 175 | ||
173 | root->handle = device->handle; | 176 | root->handle = device->handle; |
174 | strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME); | 177 | strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME); |
@@ -298,12 +301,31 @@ acpi_pci_root_add ( | |||
298 | root->id.bus); | 301 | root->id.bus); |
299 | 302 | ||
300 | end: | 303 | end: |
301 | if (result) | 304 | if (result) { |
305 | if (!list_empty(&root->node)) | ||
306 | list_del(&root->node); | ||
302 | kfree(root); | 307 | kfree(root); |
308 | } | ||
303 | 309 | ||
304 | return_VALUE(result); | 310 | return_VALUE(result); |
305 | } | 311 | } |
306 | 312 | ||
313 | static int | ||
314 | acpi_pci_root_start ( | ||
315 | struct acpi_device *device) | ||
316 | { | ||
317 | struct acpi_pci_root *root; | ||
318 | |||
319 | ACPI_FUNCTION_TRACE("acpi_pci_root_start"); | ||
320 | |||
321 | list_for_each_entry(root, &acpi_pci_roots, node) { | ||
322 | if (root->handle == device->handle) { | ||
323 | pci_bus_add_devices(root->bus); | ||
324 | return_VALUE(0); | ||
325 | } | ||
326 | } | ||
327 | return_VALUE(-ENODEV); | ||
328 | } | ||
307 | 329 | ||
308 | static int | 330 | static int |
309 | acpi_pci_root_remove ( | 331 | acpi_pci_root_remove ( |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index f4778747e889..76156ac91bd3 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -723,7 +723,7 @@ int acpi_processor_device_add( | |||
723 | return_VALUE(-ENODEV); | 723 | return_VALUE(-ENODEV); |
724 | } | 724 | } |
725 | 725 | ||
726 | acpi_bus_scan(*device); | 726 | acpi_bus_start(*device); |
727 | 727 | ||
728 | pr = acpi_driver_data(*device); | 728 | pr = acpi_driver_data(*device); |
729 | if (!pr) | 729 | if (!pr) |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index e85885593280..337d49b5564b 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -553,20 +553,29 @@ acpi_bus_driver_init ( | |||
553 | * upon possible configuration and currently allocated resources. | 553 | * upon possible configuration and currently allocated resources. |
554 | */ | 554 | */ |
555 | 555 | ||
556 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Driver successfully bound to device\n")); | ||
557 | return_VALUE(0); | ||
558 | } | ||
559 | |||
560 | int | ||
561 | acpi_start_single_object ( | ||
562 | struct acpi_device *device) | ||
563 | { | ||
564 | int result = 0; | ||
565 | struct acpi_driver *driver; | ||
566 | |||
567 | ACPI_FUNCTION_TRACE("acpi_start_single_object"); | ||
568 | |||
569 | if (!(driver = device->driver)) | ||
570 | return_VALUE(0); | ||
571 | |||
556 | if (driver->ops.start) { | 572 | if (driver->ops.start) { |
557 | result = driver->ops.start(device); | 573 | result = driver->ops.start(device); |
558 | if (result && driver->ops.remove) | 574 | if (result && driver->ops.remove) |
559 | driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL); | 575 | driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL); |
560 | return_VALUE(result); | ||
561 | } | 576 | } |
562 | 577 | ||
563 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Driver successfully bound to device\n")); | 578 | return_VALUE(result); |
564 | |||
565 | if (driver->ops.scan) { | ||
566 | driver->ops.scan(device); | ||
567 | } | ||
568 | |||
569 | return_VALUE(0); | ||
570 | } | 579 | } |
571 | 580 | ||
572 | static int acpi_driver_attach(struct acpi_driver * drv) | 581 | static int acpi_driver_attach(struct acpi_driver * drv) |
@@ -586,6 +595,7 @@ static int acpi_driver_attach(struct acpi_driver * drv) | |||
586 | 595 | ||
587 | if (!acpi_bus_match(dev, drv)) { | 596 | if (!acpi_bus_match(dev, drv)) { |
588 | if (!acpi_bus_driver_init(dev, drv)) { | 597 | if (!acpi_bus_driver_init(dev, drv)) { |
598 | acpi_start_single_object(dev); | ||
589 | atomic_inc(&drv->references); | 599 | atomic_inc(&drv->references); |
590 | count++; | 600 | count++; |
591 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n", | 601 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n", |
@@ -1009,8 +1019,8 @@ acpi_bus_remove ( | |||
1009 | } | 1019 | } |
1010 | 1020 | ||
1011 | 1021 | ||
1012 | int | 1022 | static int |
1013 | acpi_bus_add ( | 1023 | acpi_add_single_object ( |
1014 | struct acpi_device **child, | 1024 | struct acpi_device **child, |
1015 | struct acpi_device *parent, | 1025 | struct acpi_device *parent, |
1016 | acpi_handle handle, | 1026 | acpi_handle handle, |
@@ -1019,7 +1029,7 @@ acpi_bus_add ( | |||
1019 | int result = 0; | 1029 | int result = 0; |
1020 | struct acpi_device *device = NULL; | 1030 | struct acpi_device *device = NULL; |
1021 | 1031 | ||
1022 | ACPI_FUNCTION_TRACE("acpi_bus_add"); | 1032 | ACPI_FUNCTION_TRACE("acpi_add_single_object"); |
1023 | 1033 | ||
1024 | if (!child) | 1034 | if (!child) |
1025 | return_VALUE(-EINVAL); | 1035 | return_VALUE(-EINVAL); |
@@ -1140,7 +1150,7 @@ acpi_bus_add ( | |||
1140 | * | 1150 | * |
1141 | * TBD: Assumes LDM provides driver hot-plug capability. | 1151 | * TBD: Assumes LDM provides driver hot-plug capability. |
1142 | */ | 1152 | */ |
1143 | acpi_bus_find_driver(device); | 1153 | result = acpi_bus_find_driver(device); |
1144 | 1154 | ||
1145 | end: | 1155 | end: |
1146 | if (!result) | 1156 | if (!result) |
@@ -1153,10 +1163,10 @@ end: | |||
1153 | 1163 | ||
1154 | return_VALUE(result); | 1164 | return_VALUE(result); |
1155 | } | 1165 | } |
1156 | EXPORT_SYMBOL(acpi_bus_add); | ||
1157 | 1166 | ||
1158 | 1167 | ||
1159 | int acpi_bus_scan (struct acpi_device *start) | 1168 | static int acpi_bus_scan (struct acpi_device *start, |
1169 | struct acpi_bus_ops *ops) | ||
1160 | { | 1170 | { |
1161 | acpi_status status = AE_OK; | 1171 | acpi_status status = AE_OK; |
1162 | struct acpi_device *parent = NULL; | 1172 | struct acpi_device *parent = NULL; |
@@ -1229,9 +1239,20 @@ int acpi_bus_scan (struct acpi_device *start) | |||
1229 | continue; | 1239 | continue; |
1230 | } | 1240 | } |
1231 | 1241 | ||
1232 | status = acpi_bus_add(&child, parent, chandle, type); | 1242 | if (ops->acpi_op_add) |
1233 | if (ACPI_FAILURE(status)) | 1243 | status = acpi_add_single_object(&child, parent, |
1234 | continue; | 1244 | chandle, type); |
1245 | else | ||
1246 | status = acpi_bus_get_device(chandle, &child); | ||
1247 | |||
1248 | if (ACPI_FAILURE(status)) | ||
1249 | continue; | ||
1250 | |||
1251 | if (ops->acpi_op_start) { | ||
1252 | status = acpi_start_single_object(child); | ||
1253 | if (ACPI_FAILURE(status)) | ||
1254 | continue; | ||
1255 | } | ||
1235 | 1256 | ||
1236 | /* | 1257 | /* |
1237 | * If the device is present, enabled, and functioning then | 1258 | * If the device is present, enabled, and functioning then |
@@ -1257,8 +1278,50 @@ int acpi_bus_scan (struct acpi_device *start) | |||
1257 | 1278 | ||
1258 | return_VALUE(0); | 1279 | return_VALUE(0); |
1259 | } | 1280 | } |
1260 | EXPORT_SYMBOL(acpi_bus_scan); | ||
1261 | 1281 | ||
1282 | int | ||
1283 | acpi_bus_add ( | ||
1284 | struct acpi_device **child, | ||
1285 | struct acpi_device *parent, | ||
1286 | acpi_handle handle, | ||
1287 | int type) | ||
1288 | { | ||
1289 | int result; | ||
1290 | struct acpi_bus_ops ops; | ||
1291 | |||
1292 | ACPI_FUNCTION_TRACE("acpi_bus_add"); | ||
1293 | |||
1294 | result = acpi_add_single_object(child, parent, handle, type); | ||
1295 | if (!result) { | ||
1296 | memset(&ops, 0, sizeof(ops)); | ||
1297 | ops.acpi_op_add = 1; | ||
1298 | result = acpi_bus_scan(*child, &ops); | ||
1299 | } | ||
1300 | return_VALUE(result); | ||
1301 | } | ||
1302 | EXPORT_SYMBOL(acpi_bus_add); | ||
1303 | |||
1304 | int | ||
1305 | acpi_bus_start ( | ||
1306 | struct acpi_device *device) | ||
1307 | { | ||
1308 | int result; | ||
1309 | struct acpi_bus_ops ops; | ||
1310 | |||
1311 | ACPI_FUNCTION_TRACE("acpi_bus_start"); | ||
1312 | |||
1313 | if (!device) | ||
1314 | return_VALUE(-EINVAL); | ||
1315 | |||
1316 | result = acpi_start_single_object(device); | ||
1317 | if (!result) { | ||
1318 | memset(&ops, 0, sizeof(ops)); | ||
1319 | ops.acpi_op_start = 1; | ||
1320 | result = acpi_bus_scan(device, &ops); | ||
1321 | } | ||
1322 | return_VALUE(result); | ||
1323 | } | ||
1324 | EXPORT_SYMBOL(acpi_bus_start); | ||
1262 | 1325 | ||
1263 | static int | 1326 | static int |
1264 | acpi_bus_trim(struct acpi_device *start, | 1327 | acpi_bus_trim(struct acpi_device *start, |
@@ -1331,13 +1394,19 @@ acpi_bus_scan_fixed ( | |||
1331 | /* | 1394 | /* |
1332 | * Enumerate all fixed-feature devices. | 1395 | * Enumerate all fixed-feature devices. |
1333 | */ | 1396 | */ |
1334 | if (acpi_fadt.pwr_button == 0) | 1397 | if (acpi_fadt.pwr_button == 0) { |
1335 | result = acpi_bus_add(&device, acpi_root, | 1398 | result = acpi_add_single_object(&device, acpi_root, |
1336 | NULL, ACPI_BUS_TYPE_POWER_BUTTON); | 1399 | NULL, ACPI_BUS_TYPE_POWER_BUTTON); |
1400 | if (!result) | ||
1401 | result = acpi_start_single_object(device); | ||
1402 | } | ||
1337 | 1403 | ||
1338 | if (acpi_fadt.sleep_button == 0) | 1404 | if (acpi_fadt.sleep_button == 0) { |
1339 | result = acpi_bus_add(&device, acpi_root, | 1405 | result = acpi_add_single_object(&device, acpi_root, |
1340 | NULL, ACPI_BUS_TYPE_SLEEP_BUTTON); | 1406 | NULL, ACPI_BUS_TYPE_SLEEP_BUTTON); |
1407 | if (!result) | ||
1408 | result = acpi_start_single_object(device); | ||
1409 | } | ||
1341 | 1410 | ||
1342 | return_VALUE(result); | 1411 | return_VALUE(result); |
1343 | } | 1412 | } |
@@ -1346,6 +1415,7 @@ acpi_bus_scan_fixed ( | |||
1346 | static int __init acpi_scan_init(void) | 1415 | static int __init acpi_scan_init(void) |
1347 | { | 1416 | { |
1348 | int result; | 1417 | int result; |
1418 | struct acpi_bus_ops ops; | ||
1349 | 1419 | ||
1350 | ACPI_FUNCTION_TRACE("acpi_scan_init"); | 1420 | ACPI_FUNCTION_TRACE("acpi_scan_init"); |
1351 | 1421 | ||
@@ -1357,17 +1427,23 @@ static int __init acpi_scan_init(void) | |||
1357 | /* | 1427 | /* |
1358 | * Create the root device in the bus's device tree | 1428 | * Create the root device in the bus's device tree |
1359 | */ | 1429 | */ |
1360 | result = acpi_bus_add(&acpi_root, NULL, ACPI_ROOT_OBJECT, | 1430 | result = acpi_add_single_object(&acpi_root, NULL, ACPI_ROOT_OBJECT, |
1361 | ACPI_BUS_TYPE_SYSTEM); | 1431 | ACPI_BUS_TYPE_SYSTEM); |
1362 | if (result) | 1432 | if (result) |
1363 | goto Done; | 1433 | goto Done; |
1364 | 1434 | ||
1435 | result = acpi_start_single_object(acpi_root); | ||
1436 | |||
1365 | /* | 1437 | /* |
1366 | * Enumerate devices in the ACPI namespace. | 1438 | * Enumerate devices in the ACPI namespace. |
1367 | */ | 1439 | */ |
1368 | result = acpi_bus_scan_fixed(acpi_root); | 1440 | result = acpi_bus_scan_fixed(acpi_root); |
1369 | if (!result) | 1441 | if (!result) { |
1370 | result = acpi_bus_scan(acpi_root); | 1442 | memset(&ops, 0, sizeof(ops)); |
1443 | ops.acpi_op_add = 1; | ||
1444 | ops.acpi_op_start = 1; | ||
1445 | result = acpi_bus_scan(acpi_root, &ops); | ||
1446 | } | ||
1371 | 1447 | ||
1372 | if (result) | 1448 | if (result) |
1373 | acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); | 1449 | acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); |
diff --git a/drivers/base/base.h b/drivers/base/base.h index 645f62692920..783752b68a9a 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
@@ -5,6 +5,7 @@ extern int bus_add_driver(struct device_driver *); | |||
5 | extern void bus_remove_driver(struct device_driver *); | 5 | extern void bus_remove_driver(struct device_driver *); |
6 | 6 | ||
7 | extern void driver_detach(struct device_driver * drv); | 7 | extern void driver_detach(struct device_driver * drv); |
8 | extern int driver_probe_device(struct device_driver *, struct device *); | ||
8 | 9 | ||
9 | static inline struct class_device *to_class_dev(struct kobject *obj) | 10 | static inline struct class_device *to_class_dev(struct kobject *obj) |
10 | { | 11 | { |
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index c3fac7fd555e..96fe2f956754 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -133,6 +133,58 @@ 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 | /* Manually detach a device from it's associated driver. */ | ||
137 | static int driver_helper(struct device *dev, void *data) | ||
138 | { | ||
139 | const char *name = data; | ||
140 | |||
141 | if (strcmp(name, dev->bus_id) == 0) | ||
142 | return 1; | ||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | static ssize_t driver_unbind(struct device_driver *drv, | ||
147 | const char *buf, size_t count) | ||
148 | { | ||
149 | struct bus_type *bus = get_bus(drv->bus); | ||
150 | struct device *dev; | ||
151 | int err = -ENODEV; | ||
152 | |||
153 | dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); | ||
154 | if ((dev) && | ||
155 | (dev->driver == drv)) { | ||
156 | device_release_driver(dev); | ||
157 | err = count; | ||
158 | } | ||
159 | return err; | ||
160 | } | ||
161 | static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); | ||
162 | |||
163 | /* | ||
164 | * Manually attach a device to a driver. | ||
165 | * Note: the driver must want to bind to the device, | ||
166 | * it is not possible to override the driver's id table. | ||
167 | */ | ||
168 | static ssize_t driver_bind(struct device_driver *drv, | ||
169 | const char *buf, size_t count) | ||
170 | { | ||
171 | struct bus_type *bus = get_bus(drv->bus); | ||
172 | struct device *dev; | ||
173 | int err = -ENODEV; | ||
174 | |||
175 | dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); | ||
176 | if ((dev) && | ||
177 | (dev->driver == NULL)) { | ||
178 | down(&dev->sem); | ||
179 | err = driver_probe_device(drv, dev); | ||
180 | up(&dev->sem); | ||
181 | put_device(dev); | ||
182 | } | ||
183 | return err; | ||
184 | } | ||
185 | static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); | ||
186 | |||
187 | |||
136 | static struct device * next_device(struct klist_iter * i) | 188 | static struct device * next_device(struct klist_iter * i) |
137 | { | 189 | { |
138 | struct klist_node * n = klist_next(i); | 190 | struct klist_node * n = klist_next(i); |
@@ -177,6 +229,39 @@ int bus_for_each_dev(struct bus_type * bus, struct device * start, | |||
177 | return error; | 229 | return error; |
178 | } | 230 | } |
179 | 231 | ||
232 | /** | ||
233 | * bus_find_device - device iterator for locating a particular device. | ||
234 | * @bus: bus type | ||
235 | * @start: Device to begin with | ||
236 | * @data: Data to pass to match function | ||
237 | * @match: Callback function to check device | ||
238 | * | ||
239 | * This is similar to the bus_for_each_dev() function above, but it | ||
240 | * returns a reference to a device that is 'found' for later use, as | ||
241 | * determined by the @match callback. | ||
242 | * | ||
243 | * The callback should return 0 if the device doesn't match and non-zero | ||
244 | * if it does. If the callback returns non-zero, this function will | ||
245 | * return to the caller and not iterate over any more devices. | ||
246 | */ | ||
247 | struct device * bus_find_device(struct bus_type *bus, | ||
248 | struct device *start, void *data, | ||
249 | int (*match)(struct device *, void *)) | ||
250 | { | ||
251 | struct klist_iter i; | ||
252 | struct device *dev; | ||
253 | |||
254 | if (!bus) | ||
255 | return NULL; | ||
256 | |||
257 | klist_iter_init_node(&bus->klist_devices, &i, | ||
258 | (start ? &start->knode_bus : NULL)); | ||
259 | while ((dev = next_device(&i))) | ||
260 | if (match(dev, data) && get_device(dev)) | ||
261 | break; | ||
262 | klist_iter_exit(&i); | ||
263 | return dev; | ||
264 | } | ||
180 | 265 | ||
181 | 266 | ||
182 | static struct device_driver * next_driver(struct klist_iter * i) | 267 | static struct device_driver * next_driver(struct klist_iter * i) |
@@ -363,6 +448,8 @@ int bus_add_driver(struct device_driver * drv) | |||
363 | module_add_driver(drv->owner, drv); | 448 | module_add_driver(drv->owner, drv); |
364 | 449 | ||
365 | driver_add_attrs(bus, drv); | 450 | driver_add_attrs(bus, drv); |
451 | driver_create_file(drv, &driver_attr_unbind); | ||
452 | driver_create_file(drv, &driver_attr_bind); | ||
366 | } | 453 | } |
367 | return error; | 454 | return error; |
368 | } | 455 | } |
@@ -380,6 +467,8 @@ int bus_add_driver(struct device_driver * drv) | |||
380 | void bus_remove_driver(struct device_driver * drv) | 467 | void bus_remove_driver(struct device_driver * drv) |
381 | { | 468 | { |
382 | if (drv->bus) { | 469 | if (drv->bus) { |
470 | driver_remove_file(drv, &driver_attr_bind); | ||
471 | driver_remove_file(drv, &driver_attr_unbind); | ||
383 | driver_remove_attrs(drv->bus, drv); | 472 | driver_remove_attrs(drv->bus, drv); |
384 | klist_remove(&drv->knode_bus); | 473 | klist_remove(&drv->knode_bus); |
385 | pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name); | 474 | pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name); |
@@ -394,31 +483,22 @@ void bus_remove_driver(struct device_driver * drv) | |||
394 | /* Helper for bus_rescan_devices's iter */ | 483 | /* Helper for bus_rescan_devices's iter */ |
395 | static int bus_rescan_devices_helper(struct device *dev, void *data) | 484 | static int bus_rescan_devices_helper(struct device *dev, void *data) |
396 | { | 485 | { |
397 | int *count = data; | 486 | if (!dev->driver) |
398 | 487 | device_attach(dev); | |
399 | if (!dev->driver && (device_attach(dev) > 0)) | ||
400 | (*count)++; | ||
401 | |||
402 | return 0; | 488 | return 0; |
403 | } | 489 | } |
404 | 490 | ||
405 | |||
406 | /** | 491 | /** |
407 | * bus_rescan_devices - rescan devices on the bus for possible drivers | 492 | * bus_rescan_devices - rescan devices on the bus for possible drivers |
408 | * @bus: the bus to scan. | 493 | * @bus: the bus to scan. |
409 | * | 494 | * |
410 | * This function will look for devices on the bus with no driver | 495 | * This function will look for devices on the bus with no driver |
411 | * attached and rescan it against existing drivers to see if it | 496 | * attached and rescan it against existing drivers to see if it matches |
412 | * matches any. Calls device_attach(). Returns the number of devices | 497 | * any by calling device_attach() for the unbound devices. |
413 | * that were sucessfully bound to a driver. | ||
414 | */ | 498 | */ |
415 | int bus_rescan_devices(struct bus_type * bus) | 499 | void bus_rescan_devices(struct bus_type * bus) |
416 | { | 500 | { |
417 | int count = 0; | 501 | bus_for_each_dev(bus, NULL, NULL, bus_rescan_devices_helper); |
418 | |||
419 | bus_for_each_dev(bus, NULL, &count, bus_rescan_devices_helper); | ||
420 | |||
421 | return count; | ||
422 | } | 502 | } |
423 | 503 | ||
424 | 504 | ||
@@ -557,6 +637,7 @@ int __init buses_init(void) | |||
557 | 637 | ||
558 | 638 | ||
559 | EXPORT_SYMBOL_GPL(bus_for_each_dev); | 639 | EXPORT_SYMBOL_GPL(bus_for_each_dev); |
640 | EXPORT_SYMBOL_GPL(bus_find_device); | ||
560 | EXPORT_SYMBOL_GPL(bus_for_each_drv); | 641 | EXPORT_SYMBOL_GPL(bus_for_each_drv); |
561 | 642 | ||
562 | EXPORT_SYMBOL_GPL(bus_add_device); | 643 | EXPORT_SYMBOL_GPL(bus_add_device); |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 86d79755fbfb..efe03a024a5b 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -333,7 +333,7 @@ void device_del(struct device * dev) | |||
333 | struct device * parent = dev->parent; | 333 | struct device * parent = dev->parent; |
334 | 334 | ||
335 | if (parent) | 335 | if (parent) |
336 | klist_remove(&dev->knode_parent); | 336 | klist_del(&dev->knode_parent); |
337 | 337 | ||
338 | /* Notify the platform of the removal, in case they | 338 | /* Notify the platform of the removal, in case they |
339 | * need to do anything... | 339 | * need to do anything... |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 6db3a789c54f..16323f9cbff0 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -65,7 +65,7 @@ void device_bind_driver(struct device * dev) | |||
65 | * | 65 | * |
66 | * This function must be called with @dev->sem held. | 66 | * This function must be called with @dev->sem held. |
67 | */ | 67 | */ |
68 | static int driver_probe_device(struct device_driver * drv, struct device * dev) | 68 | int driver_probe_device(struct device_driver * drv, struct device * dev) |
69 | { | 69 | { |
70 | int ret = 0; | 70 | int ret = 0; |
71 | 71 | ||
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 1b645886e9eb..291c5954a3af 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
@@ -56,6 +56,41 @@ EXPORT_SYMBOL_GPL(driver_for_each_device); | |||
56 | 56 | ||
57 | 57 | ||
58 | /** | 58 | /** |
59 | * driver_find_device - device iterator for locating a particular device. | ||
60 | * @driver: The device's driver | ||
61 | * @start: Device to begin with | ||
62 | * @data: Data to pass to match function | ||
63 | * @match: Callback function to check device | ||
64 | * | ||
65 | * This is similar to the driver_for_each_device() function above, but | ||
66 | * it returns a reference to a device that is 'found' for later use, as | ||
67 | * determined by the @match callback. | ||
68 | * | ||
69 | * The callback should return 0 if the device doesn't match and non-zero | ||
70 | * if it does. If the callback returns non-zero, this function will | ||
71 | * return to the caller and not iterate over any more devices. | ||
72 | */ | ||
73 | struct device * driver_find_device(struct device_driver *drv, | ||
74 | struct device * start, void * data, | ||
75 | int (*match)(struct device *, void *)) | ||
76 | { | ||
77 | struct klist_iter i; | ||
78 | struct device *dev; | ||
79 | |||
80 | if (!drv) | ||
81 | return NULL; | ||
82 | |||
83 | klist_iter_init_node(&drv->klist_devices, &i, | ||
84 | (start ? &start->knode_driver : NULL)); | ||
85 | while ((dev = next_device(&i))) | ||
86 | if (match(dev, data) && get_device(dev)) | ||
87 | break; | ||
88 | klist_iter_exit(&i); | ||
89 | return dev; | ||
90 | } | ||
91 | EXPORT_SYMBOL_GPL(driver_find_device); | ||
92 | |||
93 | /** | ||
59 | * driver_create_file - create sysfs file for driver. | 94 | * driver_create_file - create sysfs file for driver. |
60 | * @drv: driver. | 95 | * @drv: driver. |
61 | * @attr: driver attribute descriptor. | 96 | * @attr: driver attribute descriptor. |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 97fe13f7f07c..652281402c92 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -74,6 +74,8 @@ static ssize_t | |||
74 | firmware_timeout_store(struct class *class, const char *buf, size_t count) | 74 | firmware_timeout_store(struct class *class, const char *buf, size_t count) |
75 | { | 75 | { |
76 | loading_timeout = simple_strtol(buf, NULL, 10); | 76 | loading_timeout = simple_strtol(buf, NULL, 10); |
77 | if (loading_timeout < 0) | ||
78 | loading_timeout = 0; | ||
77 | return count; | 79 | return count; |
78 | } | 80 | } |
79 | 81 | ||
@@ -138,6 +140,10 @@ firmware_loading_store(struct class_device *class_dev, | |||
138 | switch (loading) { | 140 | switch (loading) { |
139 | case 1: | 141 | case 1: |
140 | down(&fw_lock); | 142 | down(&fw_lock); |
143 | if (!fw_priv->fw) { | ||
144 | up(&fw_lock); | ||
145 | break; | ||
146 | } | ||
141 | vfree(fw_priv->fw->data); | 147 | vfree(fw_priv->fw->data); |
142 | fw_priv->fw->data = NULL; | 148 | fw_priv->fw->data = NULL; |
143 | fw_priv->fw->size = 0; | 149 | fw_priv->fw->size = 0; |
@@ -178,7 +184,7 @@ firmware_data_read(struct kobject *kobj, | |||
178 | 184 | ||
179 | down(&fw_lock); | 185 | down(&fw_lock); |
180 | fw = fw_priv->fw; | 186 | fw = fw_priv->fw; |
181 | if (test_bit(FW_STATUS_DONE, &fw_priv->status)) { | 187 | if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) { |
182 | ret_count = -ENODEV; | 188 | ret_count = -ENODEV; |
183 | goto out; | 189 | goto out; |
184 | } | 190 | } |
@@ -238,9 +244,10 @@ firmware_data_write(struct kobject *kobj, | |||
238 | 244 | ||
239 | if (!capable(CAP_SYS_RAWIO)) | 245 | if (!capable(CAP_SYS_RAWIO)) |
240 | return -EPERM; | 246 | return -EPERM; |
247 | |||
241 | down(&fw_lock); | 248 | down(&fw_lock); |
242 | fw = fw_priv->fw; | 249 | fw = fw_priv->fw; |
243 | if (test_bit(FW_STATUS_DONE, &fw_priv->status)) { | 250 | if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) { |
244 | retval = -ENODEV; | 251 | retval = -ENODEV; |
245 | goto out; | 252 | goto out; |
246 | } | 253 | } |
@@ -418,7 +425,7 @@ request_firmware(const struct firmware **firmware_p, const char *name, | |||
418 | 425 | ||
419 | fw_priv = class_get_devdata(class_dev); | 426 | fw_priv = class_get_devdata(class_dev); |
420 | 427 | ||
421 | if (loading_timeout) { | 428 | if (loading_timeout > 0) { |
422 | fw_priv->timeout.expires = jiffies + loading_timeout * HZ; | 429 | fw_priv->timeout.expires = jiffies + loading_timeout * HZ; |
423 | add_timer(&fw_priv->timeout); | 430 | add_timer(&fw_priv->timeout); |
424 | } | 431 | } |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 653512b77570..3e9fb6e4a52a 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -786,7 +786,6 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, | |||
786 | 786 | ||
787 | case CCISS_GETLUNINFO: { | 787 | case CCISS_GETLUNINFO: { |
788 | LogvolInfo_struct luninfo; | 788 | LogvolInfo_struct luninfo; |
789 | int i; | ||
790 | 789 | ||
791 | luninfo.LunID = drv->LunID; | 790 | luninfo.LunID = drv->LunID; |
792 | luninfo.num_opens = drv->usage_count; | 791 | luninfo.num_opens = drv->usage_count; |
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 234fdcfbdf01..692a5fced76e 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c | |||
@@ -1867,19 +1867,20 @@ static void freed_request(request_queue_t *q, int rw) | |||
1867 | 1867 | ||
1868 | #define blkdev_free_rq(list) list_entry((list)->next, struct request, queuelist) | 1868 | #define blkdev_free_rq(list) list_entry((list)->next, struct request, queuelist) |
1869 | /* | 1869 | /* |
1870 | * Get a free request, queue_lock must not be held | 1870 | * Get a free request, queue_lock must be held. |
1871 | * Returns NULL on failure, with queue_lock held. | ||
1872 | * Returns !NULL on success, with queue_lock *not held*. | ||
1871 | */ | 1873 | */ |
1872 | static struct request *get_request(request_queue_t *q, int rw, struct bio *bio, | 1874 | static struct request *get_request(request_queue_t *q, int rw, struct bio *bio, |
1873 | int gfp_mask) | 1875 | int gfp_mask) |
1874 | { | 1876 | { |
1875 | struct request *rq = NULL; | 1877 | struct request *rq = NULL; |
1876 | struct request_list *rl = &q->rq; | 1878 | struct request_list *rl = &q->rq; |
1877 | struct io_context *ioc = get_io_context(gfp_mask); | 1879 | struct io_context *ioc = current_io_context(GFP_ATOMIC); |
1878 | 1880 | ||
1879 | if (unlikely(test_bit(QUEUE_FLAG_DRAIN, &q->queue_flags))) | 1881 | if (unlikely(test_bit(QUEUE_FLAG_DRAIN, &q->queue_flags))) |
1880 | goto out; | 1882 | goto out; |
1881 | 1883 | ||
1882 | spin_lock_irq(q->queue_lock); | ||
1883 | if (rl->count[rw]+1 >= q->nr_requests) { | 1884 | if (rl->count[rw]+1 >= q->nr_requests) { |
1884 | /* | 1885 | /* |
1885 | * The queue will fill after this allocation, so set it as | 1886 | * The queue will fill after this allocation, so set it as |
@@ -1907,11 +1908,18 @@ static struct request *get_request(request_queue_t *q, int rw, struct bio *bio, | |||
1907 | * The queue is full and the allocating process is not a | 1908 | * The queue is full and the allocating process is not a |
1908 | * "batcher", and not exempted by the IO scheduler | 1909 | * "batcher", and not exempted by the IO scheduler |
1909 | */ | 1910 | */ |
1910 | spin_unlock_irq(q->queue_lock); | ||
1911 | goto out; | 1911 | goto out; |
1912 | } | 1912 | } |
1913 | 1913 | ||
1914 | get_rq: | 1914 | get_rq: |
1915 | /* | ||
1916 | * Only allow batching queuers to allocate up to 50% over the defined | ||
1917 | * limit of requests, otherwise we could have thousands of requests | ||
1918 | * allocated with any setting of ->nr_requests | ||
1919 | */ | ||
1920 | if (rl->count[rw] >= (3 * q->nr_requests / 2)) | ||
1921 | goto out; | ||
1922 | |||
1915 | rl->count[rw]++; | 1923 | rl->count[rw]++; |
1916 | rl->starved[rw] = 0; | 1924 | rl->starved[rw] = 0; |
1917 | if (rl->count[rw] >= queue_congestion_on_threshold(q)) | 1925 | if (rl->count[rw] >= queue_congestion_on_threshold(q)) |
@@ -1941,7 +1949,6 @@ rq_starved: | |||
1941 | if (unlikely(rl->count[rw] == 0)) | 1949 | if (unlikely(rl->count[rw] == 0)) |
1942 | rl->starved[rw] = 1; | 1950 | rl->starved[rw] = 1; |
1943 | 1951 | ||
1944 | spin_unlock_irq(q->queue_lock); | ||
1945 | goto out; | 1952 | goto out; |
1946 | } | 1953 | } |
1947 | 1954 | ||
@@ -1951,21 +1958,23 @@ rq_starved: | |||
1951 | rq_init(q, rq); | 1958 | rq_init(q, rq); |
1952 | rq->rl = rl; | 1959 | rq->rl = rl; |
1953 | out: | 1960 | out: |
1954 | put_io_context(ioc); | ||
1955 | return rq; | 1961 | return rq; |
1956 | } | 1962 | } |
1957 | 1963 | ||
1958 | /* | 1964 | /* |
1959 | * No available requests for this queue, unplug the device and wait for some | 1965 | * No available requests for this queue, unplug the device and wait for some |
1960 | * requests to become available. | 1966 | * requests to become available. |
1967 | * | ||
1968 | * Called with q->queue_lock held, and returns with it unlocked. | ||
1961 | */ | 1969 | */ |
1962 | static struct request *get_request_wait(request_queue_t *q, int rw, | 1970 | static struct request *get_request_wait(request_queue_t *q, int rw, |
1963 | struct bio *bio) | 1971 | struct bio *bio) |
1964 | { | 1972 | { |
1965 | DEFINE_WAIT(wait); | ||
1966 | struct request *rq; | 1973 | struct request *rq; |
1967 | 1974 | ||
1968 | do { | 1975 | rq = get_request(q, rw, bio, GFP_NOIO); |
1976 | while (!rq) { | ||
1977 | DEFINE_WAIT(wait); | ||
1969 | struct request_list *rl = &q->rq; | 1978 | struct request_list *rl = &q->rq; |
1970 | 1979 | ||
1971 | prepare_to_wait_exclusive(&rl->wait[rw], &wait, | 1980 | prepare_to_wait_exclusive(&rl->wait[rw], &wait, |
@@ -1976,7 +1985,8 @@ static struct request *get_request_wait(request_queue_t *q, int rw, | |||
1976 | if (!rq) { | 1985 | if (!rq) { |
1977 | struct io_context *ioc; | 1986 | struct io_context *ioc; |
1978 | 1987 | ||
1979 | generic_unplug_device(q); | 1988 | __generic_unplug_device(q); |
1989 | spin_unlock_irq(q->queue_lock); | ||
1980 | io_schedule(); | 1990 | io_schedule(); |
1981 | 1991 | ||
1982 | /* | 1992 | /* |
@@ -1985,12 +1995,13 @@ static struct request *get_request_wait(request_queue_t *q, int rw, | |||
1985 | * up to a big batch of them for a small period time. | 1995 | * up to a big batch of them for a small period time. |
1986 | * See ioc_batching, ioc_set_batching | 1996 | * See ioc_batching, ioc_set_batching |
1987 | */ | 1997 | */ |
1988 | ioc = get_io_context(GFP_NOIO); | 1998 | ioc = current_io_context(GFP_NOIO); |
1989 | ioc_set_batching(q, ioc); | 1999 | ioc_set_batching(q, ioc); |
1990 | put_io_context(ioc); | 2000 | |
2001 | spin_lock_irq(q->queue_lock); | ||
1991 | } | 2002 | } |
1992 | finish_wait(&rl->wait[rw], &wait); | 2003 | finish_wait(&rl->wait[rw], &wait); |
1993 | } while (!rq); | 2004 | } |
1994 | 2005 | ||
1995 | return rq; | 2006 | return rq; |
1996 | } | 2007 | } |
@@ -2001,14 +2012,18 @@ struct request *blk_get_request(request_queue_t *q, int rw, int gfp_mask) | |||
2001 | 2012 | ||
2002 | BUG_ON(rw != READ && rw != WRITE); | 2013 | BUG_ON(rw != READ && rw != WRITE); |
2003 | 2014 | ||
2004 | if (gfp_mask & __GFP_WAIT) | 2015 | spin_lock_irq(q->queue_lock); |
2016 | if (gfp_mask & __GFP_WAIT) { | ||
2005 | rq = get_request_wait(q, rw, NULL); | 2017 | rq = get_request_wait(q, rw, NULL); |
2006 | else | 2018 | } else { |
2007 | rq = get_request(q, rw, NULL, gfp_mask); | 2019 | rq = get_request(q, rw, NULL, gfp_mask); |
2020 | if (!rq) | ||
2021 | spin_unlock_irq(q->queue_lock); | ||
2022 | } | ||
2023 | /* q->queue_lock is unlocked at this point */ | ||
2008 | 2024 | ||
2009 | return rq; | 2025 | return rq; |
2010 | } | 2026 | } |
2011 | |||
2012 | EXPORT_SYMBOL(blk_get_request); | 2027 | EXPORT_SYMBOL(blk_get_request); |
2013 | 2028 | ||
2014 | /** | 2029 | /** |
@@ -2512,7 +2527,7 @@ EXPORT_SYMBOL(blk_attempt_remerge); | |||
2512 | 2527 | ||
2513 | static int __make_request(request_queue_t *q, struct bio *bio) | 2528 | static int __make_request(request_queue_t *q, struct bio *bio) |
2514 | { | 2529 | { |
2515 | struct request *req, *freereq = NULL; | 2530 | struct request *req; |
2516 | int el_ret, rw, nr_sectors, cur_nr_sectors, barrier, err, sync; | 2531 | int el_ret, rw, nr_sectors, cur_nr_sectors, barrier, err, sync; |
2517 | unsigned short prio; | 2532 | unsigned short prio; |
2518 | sector_t sector; | 2533 | sector_t sector; |
@@ -2540,14 +2555,9 @@ static int __make_request(request_queue_t *q, struct bio *bio) | |||
2540 | goto end_io; | 2555 | goto end_io; |
2541 | } | 2556 | } |
2542 | 2557 | ||
2543 | again: | ||
2544 | spin_lock_irq(q->queue_lock); | 2558 | spin_lock_irq(q->queue_lock); |
2545 | 2559 | ||
2546 | if (elv_queue_empty(q)) { | 2560 | if (unlikely(barrier) || elv_queue_empty(q)) |
2547 | blk_plug_device(q); | ||
2548 | goto get_rq; | ||
2549 | } | ||
2550 | if (barrier) | ||
2551 | goto get_rq; | 2561 | goto get_rq; |
2552 | 2562 | ||
2553 | el_ret = elv_merge(q, &req, bio); | 2563 | el_ret = elv_merge(q, &req, bio); |
@@ -2592,40 +2602,24 @@ again: | |||
2592 | elv_merged_request(q, req); | 2602 | elv_merged_request(q, req); |
2593 | goto out; | 2603 | goto out; |
2594 | 2604 | ||
2595 | /* | 2605 | /* ELV_NO_MERGE: elevator says don't/can't merge. */ |
2596 | * elevator says don't/can't merge. get new request | ||
2597 | */ | ||
2598 | case ELEVATOR_NO_MERGE: | ||
2599 | break; | ||
2600 | |||
2601 | default: | 2606 | default: |
2602 | printk("elevator returned crap (%d)\n", el_ret); | 2607 | ; |
2603 | BUG(); | ||
2604 | } | 2608 | } |
2605 | 2609 | ||
2610 | get_rq: | ||
2606 | /* | 2611 | /* |
2607 | * Grab a free request from the freelist - if that is empty, check | 2612 | * Grab a free request. This is might sleep but can not fail. |
2608 | * if we are doing read ahead and abort instead of blocking for | 2613 | * Returns with the queue unlocked. |
2609 | * a free slot. | 2614 | */ |
2615 | req = get_request_wait(q, rw, bio); | ||
2616 | |||
2617 | /* | ||
2618 | * After dropping the lock and possibly sleeping here, our request | ||
2619 | * may now be mergeable after it had proven unmergeable (above). | ||
2620 | * We don't worry about that case for efficiency. It won't happen | ||
2621 | * often, and the elevators are able to handle it. | ||
2610 | */ | 2622 | */ |
2611 | get_rq: | ||
2612 | if (freereq) { | ||
2613 | req = freereq; | ||
2614 | freereq = NULL; | ||
2615 | } else { | ||
2616 | spin_unlock_irq(q->queue_lock); | ||
2617 | if ((freereq = get_request(q, rw, bio, GFP_ATOMIC)) == NULL) { | ||
2618 | /* | ||
2619 | * READA bit set | ||
2620 | */ | ||
2621 | err = -EWOULDBLOCK; | ||
2622 | if (bio_rw_ahead(bio)) | ||
2623 | goto end_io; | ||
2624 | |||
2625 | freereq = get_request_wait(q, rw, bio); | ||
2626 | } | ||
2627 | goto again; | ||
2628 | } | ||
2629 | 2623 | ||
2630 | req->flags |= REQ_CMD; | 2624 | req->flags |= REQ_CMD; |
2631 | 2625 | ||
@@ -2654,10 +2648,11 @@ get_rq: | |||
2654 | req->rq_disk = bio->bi_bdev->bd_disk; | 2648 | req->rq_disk = bio->bi_bdev->bd_disk; |
2655 | req->start_time = jiffies; | 2649 | req->start_time = jiffies; |
2656 | 2650 | ||
2651 | spin_lock_irq(q->queue_lock); | ||
2652 | if (elv_queue_empty(q)) | ||
2653 | blk_plug_device(q); | ||
2657 | add_request(q, req); | 2654 | add_request(q, req); |
2658 | out: | 2655 | out: |
2659 | if (freereq) | ||
2660 | __blk_put_request(q, freereq); | ||
2661 | if (sync) | 2656 | if (sync) |
2662 | __generic_unplug_device(q); | 2657 | __generic_unplug_device(q); |
2663 | 2658 | ||
@@ -3284,24 +3279,20 @@ void exit_io_context(void) | |||
3284 | 3279 | ||
3285 | /* | 3280 | /* |
3286 | * If the current task has no IO context then create one and initialise it. | 3281 | * If the current task has no IO context then create one and initialise it. |
3287 | * If it does have a context, take a ref on it. | 3282 | * Otherwise, return its existing IO context. |
3288 | * | 3283 | * |
3289 | * This is always called in the context of the task which submitted the I/O. | 3284 | * This returned IO context doesn't have a specifically elevated refcount, |
3290 | * But weird things happen, so we disable local interrupts to ensure exclusive | 3285 | * but since the current task itself holds a reference, the context can be |
3291 | * access to *current. | 3286 | * used in general code, so long as it stays within `current` context. |
3292 | */ | 3287 | */ |
3293 | struct io_context *get_io_context(int gfp_flags) | 3288 | struct io_context *current_io_context(int gfp_flags) |
3294 | { | 3289 | { |
3295 | struct task_struct *tsk = current; | 3290 | struct task_struct *tsk = current; |
3296 | unsigned long flags; | ||
3297 | struct io_context *ret; | 3291 | struct io_context *ret; |
3298 | 3292 | ||
3299 | local_irq_save(flags); | ||
3300 | ret = tsk->io_context; | 3293 | ret = tsk->io_context; |
3301 | if (ret) | 3294 | if (likely(ret)) |
3302 | goto out; | 3295 | return ret; |
3303 | |||
3304 | local_irq_restore(flags); | ||
3305 | 3296 | ||
3306 | ret = kmem_cache_alloc(iocontext_cachep, gfp_flags); | 3297 | ret = kmem_cache_alloc(iocontext_cachep, gfp_flags); |
3307 | if (ret) { | 3298 | if (ret) { |
@@ -3312,25 +3303,25 @@ struct io_context *get_io_context(int gfp_flags) | |||
3312 | ret->nr_batch_requests = 0; /* because this is 0 */ | 3303 | ret->nr_batch_requests = 0; /* because this is 0 */ |
3313 | ret->aic = NULL; | 3304 | ret->aic = NULL; |
3314 | ret->cic = NULL; | 3305 | ret->cic = NULL; |
3306 | tsk->io_context = ret; | ||
3307 | } | ||
3315 | 3308 | ||
3316 | local_irq_save(flags); | 3309 | return ret; |
3317 | 3310 | } | |
3318 | /* | 3311 | EXPORT_SYMBOL(current_io_context); |
3319 | * very unlikely, someone raced with us in setting up the task | ||
3320 | * io context. free new context and just grab a reference. | ||
3321 | */ | ||
3322 | if (!tsk->io_context) | ||
3323 | tsk->io_context = ret; | ||
3324 | else { | ||
3325 | kmem_cache_free(iocontext_cachep, ret); | ||
3326 | ret = tsk->io_context; | ||
3327 | } | ||
3328 | 3312 | ||
3329 | out: | 3313 | /* |
3314 | * If the current task has no IO context then create one and initialise it. | ||
3315 | * If it does have a context, take a ref on it. | ||
3316 | * | ||
3317 | * This is always called in the context of the task which submitted the I/O. | ||
3318 | */ | ||
3319 | struct io_context *get_io_context(int gfp_flags) | ||
3320 | { | ||
3321 | struct io_context *ret; | ||
3322 | ret = current_io_context(gfp_flags); | ||
3323 | if (likely(ret)) | ||
3330 | atomic_inc(&ret->refcount); | 3324 | atomic_inc(&ret->refcount); |
3331 | local_irq_restore(flags); | ||
3332 | } | ||
3333 | |||
3334 | return ret; | 3325 | return ret; |
3335 | } | 3326 | } |
3336 | EXPORT_SYMBOL(get_io_context); | 3327 | EXPORT_SYMBOL(get_io_context); |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 1407945a5892..59f589d733f9 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -686,6 +686,15 @@ static struct pci_device_id agp_amd64_pci_table[] = { | |||
686 | .subvendor = PCI_ANY_ID, | 686 | .subvendor = PCI_ANY_ID, |
687 | .subdevice = PCI_ANY_ID, | 687 | .subdevice = PCI_ANY_ID, |
688 | }, | 688 | }, |
689 | /* SIS 760 */ | ||
690 | { | ||
691 | .class = (PCI_CLASS_BRIDGE_HOST << 8), | ||
692 | .class_mask = ~0, | ||
693 | .vendor = PCI_VENDOR_ID_SI, | ||
694 | .device = PCI_DEVICE_ID_SI_760, | ||
695 | .subvendor = PCI_ANY_ID, | ||
696 | .subdevice = PCI_ANY_ID, | ||
697 | }, | ||
689 | { } | 698 | { } |
690 | }; | 699 | }; |
691 | 700 | ||
diff --git a/drivers/char/hw_random.c b/drivers/char/hw_random.c index 7e6ac14c2450..3480535a09c5 100644 --- a/drivers/char/hw_random.c +++ b/drivers/char/hw_random.c | |||
@@ -579,7 +579,7 @@ static int __init rng_init (void) | |||
579 | 579 | ||
580 | /* Probe for Intel, AMD RNGs */ | 580 | /* Probe for Intel, AMD RNGs */ |
581 | for_each_pci_dev(pdev) { | 581 | for_each_pci_dev(pdev) { |
582 | ent = pci_match_device (rng_pci_tbl, pdev); | 582 | ent = pci_match_id(rng_pci_tbl, pdev); |
583 | if (ent) { | 583 | if (ent) { |
584 | rng_ops = &rng_vendor_ops[ent->driver_data]; | 584 | rng_ops = &rng_vendor_ops[ent->driver_data]; |
585 | goto match; | 585 | goto match; |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 1813d0d198f1..e16c13fe698d 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -1088,8 +1088,8 @@ static inline int i_ipmi_request(ipmi_user_t user, | |||
1088 | long seqid; | 1088 | long seqid; |
1089 | int broadcast = 0; | 1089 | int broadcast = 0; |
1090 | 1090 | ||
1091 | if (addr->channel > IPMI_NUM_CHANNELS) { | 1091 | if (addr->channel >= IPMI_MAX_CHANNELS) { |
1092 | spin_lock_irqsave(&intf->counter_lock, flags); | 1092 | spin_lock_irqsave(&intf->counter_lock, flags); |
1093 | intf->sent_invalid_commands++; | 1093 | intf->sent_invalid_commands++; |
1094 | spin_unlock_irqrestore(&intf->counter_lock, flags); | 1094 | spin_unlock_irqrestore(&intf->counter_lock, flags); |
1095 | rv = -EINVAL; | 1095 | rv = -EINVAL; |
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 7c24fbe831f8..95f7046ff059 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -451,7 +451,7 @@ static int __init moxa_init(void) | |||
451 | int n = (sizeof(moxa_pcibrds) / sizeof(moxa_pcibrds[0])) - 1; | 451 | int n = (sizeof(moxa_pcibrds) / sizeof(moxa_pcibrds[0])) - 1; |
452 | i = 0; | 452 | i = 0; |
453 | while (i < n) { | 453 | while (i < n) { |
454 | while ((p = pci_find_device(moxa_pcibrds[i].vendor, moxa_pcibrds[i].device, p))!=NULL) | 454 | while ((p = pci_get_device(moxa_pcibrds[i].vendor, moxa_pcibrds[i].device, p))!=NULL) |
455 | { | 455 | { |
456 | if (pci_enable_device(p)) | 456 | if (pci_enable_device(p)) |
457 | continue; | 457 | continue; |
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index 7db3370f4972..d7d484024e2b 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -1095,7 +1095,7 @@ static int __init rio_init(void) | |||
1095 | 1095 | ||
1096 | #ifdef CONFIG_PCI | 1096 | #ifdef CONFIG_PCI |
1097 | /* First look for the JET devices: */ | 1097 | /* First look for the JET devices: */ |
1098 | while ((pdev = pci_find_device (PCI_VENDOR_ID_SPECIALIX, | 1098 | while ((pdev = pci_get_device (PCI_VENDOR_ID_SPECIALIX, |
1099 | PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, | 1099 | PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, |
1100 | pdev))) { | 1100 | pdev))) { |
1101 | if (pci_enable_device(pdev)) continue; | 1101 | if (pci_enable_device(pdev)) continue; |
@@ -1169,7 +1169,7 @@ static int __init rio_init(void) | |||
1169 | */ | 1169 | */ |
1170 | 1170 | ||
1171 | /* Then look for the older RIO/PCI devices: */ | 1171 | /* Then look for the older RIO/PCI devices: */ |
1172 | while ((pdev = pci_find_device (PCI_VENDOR_ID_SPECIALIX, | 1172 | while ((pdev = pci_get_device (PCI_VENDOR_ID_SPECIALIX, |
1173 | PCI_DEVICE_ID_SPECIALIX_RIO, | 1173 | PCI_DEVICE_ID_SPECIALIX_RIO, |
1174 | pdev))) { | 1174 | pdev))) { |
1175 | if (pci_enable_device(pdev)) continue; | 1175 | if (pci_enable_device(pdev)) continue; |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index ff4f09804865..d8f9e94ae475 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -78,6 +78,7 @@ | |||
78 | #include <linux/sysctl.h> | 78 | #include <linux/sysctl.h> |
79 | #include <linux/wait.h> | 79 | #include <linux/wait.h> |
80 | #include <linux/bcd.h> | 80 | #include <linux/bcd.h> |
81 | #include <linux/delay.h> | ||
81 | 82 | ||
82 | #include <asm/current.h> | 83 | #include <asm/current.h> |
83 | #include <asm/uaccess.h> | 84 | #include <asm/uaccess.h> |
@@ -894,7 +895,6 @@ static int __init rtc_init(void) | |||
894 | struct proc_dir_entry *ent; | 895 | struct proc_dir_entry *ent; |
895 | #if defined(__alpha__) || defined(__mips__) | 896 | #if defined(__alpha__) || defined(__mips__) |
896 | unsigned int year, ctrl; | 897 | unsigned int year, ctrl; |
897 | unsigned long uip_watchdog; | ||
898 | char *guess = NULL; | 898 | char *guess = NULL; |
899 | #endif | 899 | #endif |
900 | #ifdef __sparc__ | 900 | #ifdef __sparc__ |
@@ -1000,12 +1000,8 @@ no_irq: | |||
1000 | /* Each operating system on an Alpha uses its own epoch. | 1000 | /* Each operating system on an Alpha uses its own epoch. |
1001 | Let's try to guess which one we are using now. */ | 1001 | Let's try to guess which one we are using now. */ |
1002 | 1002 | ||
1003 | uip_watchdog = jiffies; | ||
1004 | if (rtc_is_updating() != 0) | 1003 | if (rtc_is_updating() != 0) |
1005 | while (jiffies - uip_watchdog < 2*HZ/100) { | 1004 | msleep(20); |
1006 | barrier(); | ||
1007 | cpu_relax(); | ||
1008 | } | ||
1009 | 1005 | ||
1010 | spin_lock_irq(&rtc_lock); | 1006 | spin_lock_irq(&rtc_lock); |
1011 | year = CMOS_READ(RTC_YEAR); | 1007 | year = CMOS_READ(RTC_YEAR); |
@@ -1213,7 +1209,6 @@ static int rtc_proc_open(struct inode *inode, struct file *file) | |||
1213 | 1209 | ||
1214 | void rtc_get_rtc_time(struct rtc_time *rtc_tm) | 1210 | void rtc_get_rtc_time(struct rtc_time *rtc_tm) |
1215 | { | 1211 | { |
1216 | unsigned long uip_watchdog = jiffies; | ||
1217 | unsigned char ctrl; | 1212 | unsigned char ctrl; |
1218 | #ifdef CONFIG_MACH_DECSTATION | 1213 | #ifdef CONFIG_MACH_DECSTATION |
1219 | unsigned int real_year; | 1214 | unsigned int real_year; |
@@ -1221,7 +1216,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) | |||
1221 | 1216 | ||
1222 | /* | 1217 | /* |
1223 | * read RTC once any update in progress is done. The update | 1218 | * read RTC once any update in progress is done. The update |
1224 | * can take just over 2ms. We wait 10 to 20ms. There is no need to | 1219 | * can take just over 2ms. We wait 20ms. There is no need to |
1225 | * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP. | 1220 | * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP. |
1226 | * If you need to know *exactly* when a second has started, enable | 1221 | * If you need to know *exactly* when a second has started, enable |
1227 | * periodic update complete interrupts, (via ioctl) and then | 1222 | * periodic update complete interrupts, (via ioctl) and then |
@@ -1230,10 +1225,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) | |||
1230 | */ | 1225 | */ |
1231 | 1226 | ||
1232 | if (rtc_is_updating() != 0) | 1227 | if (rtc_is_updating() != 0) |
1233 | while (jiffies - uip_watchdog < 2*HZ/100) { | 1228 | msleep(20); |
1234 | barrier(); | ||
1235 | cpu_relax(); | ||
1236 | } | ||
1237 | 1229 | ||
1238 | /* | 1230 | /* |
1239 | * Only the values that we read from the RTC are set. We leave | 1231 | * Only the values that we read from the RTC are set. We leave |
diff --git a/drivers/char/tipar.c b/drivers/char/tipar.c index 659335d80ee7..ec78d2f161f7 100644 --- a/drivers/char/tipar.c +++ b/drivers/char/tipar.c | |||
@@ -396,7 +396,7 @@ static struct file_operations tipar_fops = { | |||
396 | static int __init | 396 | static int __init |
397 | tipar_setup(char *str) | 397 | tipar_setup(char *str) |
398 | { | 398 | { |
399 | int ints[2]; | 399 | int ints[3]; |
400 | 400 | ||
401 | str = get_options(str, ARRAY_SIZE(ints), ints); | 401 | str = get_options(str, ARRAY_SIZE(ints), ints); |
402 | 402 | ||
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 854475c54f0e..049d128ae7f0 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -464,7 +464,7 @@ void __devexit tpm_remove(struct pci_dev *pci_dev) | |||
464 | 464 | ||
465 | pci_set_drvdata(pci_dev, NULL); | 465 | pci_set_drvdata(pci_dev, NULL); |
466 | misc_deregister(&chip->vendor->miscdev); | 466 | misc_deregister(&chip->vendor->miscdev); |
467 | kfree(&chip->vendor->miscdev.name); | 467 | kfree(chip->vendor->miscdev.name); |
468 | 468 | ||
469 | sysfs_remove_group(&pci_dev->dev.kobj, chip->vendor->attr_group); | 469 | sysfs_remove_group(&pci_dev->dev.kobj, chip->vendor->attr_group); |
470 | 470 | ||
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index 58597993954f..f19cf9d7792d 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -476,11 +476,11 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file, | |||
476 | ld = tty_ldisc_ref(tty); | 476 | ld = tty_ldisc_ref(tty); |
477 | switch (arg) { | 477 | switch (arg) { |
478 | case TCIFLUSH: | 478 | case TCIFLUSH: |
479 | if (ld->flush_buffer) | 479 | if (ld && ld->flush_buffer) |
480 | ld->flush_buffer(tty); | 480 | ld->flush_buffer(tty); |
481 | break; | 481 | break; |
482 | case TCIOFLUSH: | 482 | case TCIOFLUSH: |
483 | if (ld->flush_buffer) | 483 | if (ld && ld->flush_buffer) |
484 | ld->flush_buffer(tty); | 484 | ld->flush_buffer(tty); |
485 | /* fall through */ | 485 | /* fall through */ |
486 | case TCOFLUSH: | 486 | case TCOFLUSH: |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 8971484b956b..1d44f69e1fda 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
26 | #include <linux/console.h> | 26 | #include <linux/console.h> |
27 | #include <linux/signal.h> | 27 | #include <linux/signal.h> |
28 | #include <linux/timex.h> | ||
28 | 29 | ||
29 | #include <asm/io.h> | 30 | #include <asm/io.h> |
30 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
@@ -386,7 +387,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
386 | if (!perm) | 387 | if (!perm) |
387 | return -EPERM; | 388 | return -EPERM; |
388 | if (arg) | 389 | if (arg) |
389 | arg = 1193182 / arg; | 390 | arg = CLOCK_TICK_RATE / arg; |
390 | kd_mksound(arg, 0); | 391 | kd_mksound(arg, 0); |
391 | return 0; | 392 | return 0; |
392 | 393 | ||
@@ -403,7 +404,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
403 | ticks = HZ * ((arg >> 16) & 0xffff) / 1000; | 404 | ticks = HZ * ((arg >> 16) & 0xffff) / 1000; |
404 | count = ticks ? (arg & 0xffff) : 0; | 405 | count = ticks ? (arg & 0xffff) : 0; |
405 | if (count) | 406 | if (count) |
406 | count = 1193182 / count; | 407 | count = CLOCK_TICK_RATE / count; |
407 | kd_mksound(count, ticks); | 408 | kd_mksound(count, ticks); |
408 | return 0; | 409 | return 0; |
409 | } | 410 | } |
diff --git a/drivers/char/watchdog/i8xx_tco.c b/drivers/char/watchdog/i8xx_tco.c index b14d642439ed..5d07ee59679d 100644 --- a/drivers/char/watchdog/i8xx_tco.c +++ b/drivers/char/watchdog/i8xx_tco.c | |||
@@ -401,7 +401,7 @@ static unsigned char __init i8xx_tco_getdevice (void) | |||
401 | */ | 401 | */ |
402 | 402 | ||
403 | while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { | 403 | while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { |
404 | if (pci_match_device(i8xx_tco_pci_tbl, dev)) { | 404 | if (pci_match_id(i8xx_tco_pci_tbl, dev)) { |
405 | i8xx_tco_pci = dev; | 405 | i8xx_tco_pci = dev; |
406 | break; | 406 | break; |
407 | } | 407 | } |
diff --git a/drivers/char/watchdog/ixp2000_wdt.c b/drivers/char/watchdog/ixp2000_wdt.c index 4e98c215e5b1..4b039516cc86 100644 --- a/drivers/char/watchdog/ixp2000_wdt.c +++ b/drivers/char/watchdog/ixp2000_wdt.c | |||
@@ -162,7 +162,7 @@ ixp2000_wdt_release(struct inode *inode, struct file *file) | |||
162 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) { | 162 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) { |
163 | wdt_disable(); | 163 | wdt_disable(); |
164 | } else { | 164 | } else { |
165 | printk(KERN_CRIT "WATCHDOG: Device closed unexpectdly - " | 165 | printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - " |
166 | "timer will not stop\n"); | 166 | "timer will not stop\n"); |
167 | } | 167 | } |
168 | 168 | ||
diff --git a/drivers/char/watchdog/ixp4xx_wdt.c b/drivers/char/watchdog/ixp4xx_wdt.c index 82396e06c8a8..83df369113a4 100644 --- a/drivers/char/watchdog/ixp4xx_wdt.c +++ b/drivers/char/watchdog/ixp4xx_wdt.c | |||
@@ -156,7 +156,7 @@ ixp4xx_wdt_release(struct inode *inode, struct file *file) | |||
156 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) { | 156 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) { |
157 | wdt_disable(); | 157 | wdt_disable(); |
158 | } else { | 158 | } else { |
159 | printk(KERN_CRIT "WATCHDOG: Device closed unexpectdly - " | 159 | printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - " |
160 | "timer will not stop\n"); | 160 | "timer will not stop\n"); |
161 | } | 161 | } |
162 | 162 | ||
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c index ed708b4427b0..71407c578afe 100644 --- a/drivers/crypto/padlock-aes.c +++ b/drivers/crypto/padlock-aes.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/errno.h> | 49 | #include <linux/errno.h> |
50 | #include <linux/crypto.h> | 50 | #include <linux/crypto.h> |
51 | #include <linux/interrupt.h> | 51 | #include <linux/interrupt.h> |
52 | #include <linux/kernel.h> | ||
52 | #include <asm/byteorder.h> | 53 | #include <asm/byteorder.h> |
53 | #include "padlock.h" | 54 | #include "padlock.h" |
54 | 55 | ||
@@ -59,8 +60,12 @@ | |||
59 | #define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t)) | 60 | #define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t)) |
60 | 61 | ||
61 | struct aes_ctx { | 62 | struct aes_ctx { |
62 | uint32_t e_data[AES_EXTENDED_KEY_SIZE+4]; | 63 | uint32_t e_data[AES_EXTENDED_KEY_SIZE]; |
63 | uint32_t d_data[AES_EXTENDED_KEY_SIZE+4]; | 64 | uint32_t d_data[AES_EXTENDED_KEY_SIZE]; |
65 | struct { | ||
66 | struct cword encrypt; | ||
67 | struct cword decrypt; | ||
68 | } cword; | ||
64 | uint32_t *E; | 69 | uint32_t *E; |
65 | uint32_t *D; | 70 | uint32_t *D; |
66 | int key_length; | 71 | int key_length; |
@@ -280,10 +285,15 @@ aes_hw_extkey_available(uint8_t key_len) | |||
280 | return 0; | 285 | return 0; |
281 | } | 286 | } |
282 | 287 | ||
288 | static inline struct aes_ctx *aes_ctx(void *ctx) | ||
289 | { | ||
290 | return (struct aes_ctx *)ALIGN((unsigned long)ctx, PADLOCK_ALIGNMENT); | ||
291 | } | ||
292 | |||
283 | static int | 293 | static int |
284 | aes_set_key(void *ctx_arg, const uint8_t *in_key, unsigned int key_len, uint32_t *flags) | 294 | aes_set_key(void *ctx_arg, const uint8_t *in_key, unsigned int key_len, uint32_t *flags) |
285 | { | 295 | { |
286 | struct aes_ctx *ctx = ctx_arg; | 296 | struct aes_ctx *ctx = aes_ctx(ctx_arg); |
287 | uint32_t i, t, u, v, w; | 297 | uint32_t i, t, u, v, w; |
288 | uint32_t P[AES_EXTENDED_KEY_SIZE]; | 298 | uint32_t P[AES_EXTENDED_KEY_SIZE]; |
289 | uint32_t rounds; | 299 | uint32_t rounds; |
@@ -295,25 +305,36 @@ aes_set_key(void *ctx_arg, const uint8_t *in_key, unsigned int key_len, uint32_t | |||
295 | 305 | ||
296 | ctx->key_length = key_len; | 306 | ctx->key_length = key_len; |
297 | 307 | ||
308 | /* | ||
309 | * If the hardware is capable of generating the extended key | ||
310 | * itself we must supply the plain key for both encryption | ||
311 | * and decryption. | ||
312 | */ | ||
298 | ctx->E = ctx->e_data; | 313 | ctx->E = ctx->e_data; |
299 | ctx->D = ctx->d_data; | 314 | ctx->D = ctx->e_data; |
300 | |||
301 | /* Ensure 16-Bytes alignmentation of keys for VIA PadLock. */ | ||
302 | if ((int)(ctx->e_data) & 0x0F) | ||
303 | ctx->E += 4 - (((int)(ctx->e_data) & 0x0F) / sizeof (ctx->e_data[0])); | ||
304 | |||
305 | if ((int)(ctx->d_data) & 0x0F) | ||
306 | ctx->D += 4 - (((int)(ctx->d_data) & 0x0F) / sizeof (ctx->d_data[0])); | ||
307 | 315 | ||
308 | E_KEY[0] = uint32_t_in (in_key); | 316 | E_KEY[0] = uint32_t_in (in_key); |
309 | E_KEY[1] = uint32_t_in (in_key + 4); | 317 | E_KEY[1] = uint32_t_in (in_key + 4); |
310 | E_KEY[2] = uint32_t_in (in_key + 8); | 318 | E_KEY[2] = uint32_t_in (in_key + 8); |
311 | E_KEY[3] = uint32_t_in (in_key + 12); | 319 | E_KEY[3] = uint32_t_in (in_key + 12); |
312 | 320 | ||
321 | /* Prepare control words. */ | ||
322 | memset(&ctx->cword, 0, sizeof(ctx->cword)); | ||
323 | |||
324 | ctx->cword.decrypt.encdec = 1; | ||
325 | ctx->cword.encrypt.rounds = 10 + (key_len - 16) / 4; | ||
326 | ctx->cword.decrypt.rounds = ctx->cword.encrypt.rounds; | ||
327 | ctx->cword.encrypt.ksize = (key_len - 16) / 8; | ||
328 | ctx->cword.decrypt.ksize = ctx->cword.encrypt.ksize; | ||
329 | |||
313 | /* Don't generate extended keys if the hardware can do it. */ | 330 | /* Don't generate extended keys if the hardware can do it. */ |
314 | if (aes_hw_extkey_available(key_len)) | 331 | if (aes_hw_extkey_available(key_len)) |
315 | return 0; | 332 | return 0; |
316 | 333 | ||
334 | ctx->D = ctx->d_data; | ||
335 | ctx->cword.encrypt.keygen = 1; | ||
336 | ctx->cword.decrypt.keygen = 1; | ||
337 | |||
317 | switch (key_len) { | 338 | switch (key_len) { |
318 | case 16: | 339 | case 16: |
319 | t = E_KEY[3]; | 340 | t = E_KEY[3]; |
@@ -369,10 +390,9 @@ aes_set_key(void *ctx_arg, const uint8_t *in_key, unsigned int key_len, uint32_t | |||
369 | 390 | ||
370 | /* ====== Encryption/decryption routines ====== */ | 391 | /* ====== Encryption/decryption routines ====== */ |
371 | 392 | ||
372 | /* This is the real call to PadLock. */ | 393 | /* These are the real call to PadLock. */ |
373 | static inline void | 394 | static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key, |
374 | padlock_xcrypt_ecb(uint8_t *input, uint8_t *output, uint8_t *key, | 395 | void *control_word, u32 count) |
375 | void *control_word, uint32_t count) | ||
376 | { | 396 | { |
377 | asm volatile ("pushfl; popfl"); /* enforce key reload. */ | 397 | asm volatile ("pushfl; popfl"); /* enforce key reload. */ |
378 | asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */ | 398 | asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */ |
@@ -380,60 +400,70 @@ padlock_xcrypt_ecb(uint8_t *input, uint8_t *output, uint8_t *key, | |||
380 | : "d"(control_word), "b"(key), "c"(count)); | 400 | : "d"(control_word), "b"(key), "c"(count)); |
381 | } | 401 | } |
382 | 402 | ||
383 | static void | 403 | static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key, |
384 | aes_padlock(void *ctx_arg, uint8_t *out_arg, const uint8_t *in_arg, int encdec) | 404 | u8 *iv, void *control_word, u32 count) |
385 | { | 405 | { |
386 | /* Don't blindly modify this structure - the items must | 406 | /* Enforce key reload. */ |
387 | fit on 16-Bytes boundaries! */ | 407 | asm volatile ("pushfl; popfl"); |
388 | struct padlock_xcrypt_data { | 408 | /* rep xcryptcbc */ |
389 | uint8_t buf[AES_BLOCK_SIZE]; | 409 | asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" |
390 | union cword cword; | 410 | : "+S" (input), "+D" (output), "+a" (iv) |
391 | }; | 411 | : "d" (control_word), "b" (key), "c" (count)); |
392 | 412 | return iv; | |
393 | struct aes_ctx *ctx = ctx_arg; | ||
394 | char bigbuf[sizeof(struct padlock_xcrypt_data) + 16]; | ||
395 | struct padlock_xcrypt_data *data; | ||
396 | void *key; | ||
397 | |||
398 | /* Place 'data' at the first 16-Bytes aligned address in 'bigbuf'. */ | ||
399 | if (((long)bigbuf) & 0x0F) | ||
400 | data = (void*)(bigbuf + 16 - ((long)bigbuf & 0x0F)); | ||
401 | else | ||
402 | data = (void*)bigbuf; | ||
403 | |||
404 | /* Prepare Control word. */ | ||
405 | memset (data, 0, sizeof(struct padlock_xcrypt_data)); | ||
406 | data->cword.b.encdec = !encdec; /* in the rest of cryptoapi ENC=1/DEC=0 */ | ||
407 | data->cword.b.rounds = 10 + (ctx->key_length - 16) / 4; | ||
408 | data->cword.b.ksize = (ctx->key_length - 16) / 8; | ||
409 | |||
410 | /* Is the hardware capable to generate the extended key? */ | ||
411 | if (!aes_hw_extkey_available(ctx->key_length)) | ||
412 | data->cword.b.keygen = 1; | ||
413 | |||
414 | /* ctx->E starts with a plain key - if the hardware is capable | ||
415 | to generate the extended key itself we must supply | ||
416 | the plain key for both Encryption and Decryption. */ | ||
417 | if (encdec == CRYPTO_DIR_ENCRYPT || data->cword.b.keygen == 0) | ||
418 | key = ctx->E; | ||
419 | else | ||
420 | key = ctx->D; | ||
421 | |||
422 | memcpy(data->buf, in_arg, AES_BLOCK_SIZE); | ||
423 | padlock_xcrypt_ecb(data->buf, data->buf, key, &data->cword, 1); | ||
424 | memcpy(out_arg, data->buf, AES_BLOCK_SIZE); | ||
425 | } | 413 | } |
426 | 414 | ||
427 | static void | 415 | static void |
428 | aes_encrypt(void *ctx_arg, uint8_t *out, const uint8_t *in) | 416 | aes_encrypt(void *ctx_arg, uint8_t *out, const uint8_t *in) |
429 | { | 417 | { |
430 | aes_padlock(ctx_arg, out, in, CRYPTO_DIR_ENCRYPT); | 418 | struct aes_ctx *ctx = aes_ctx(ctx_arg); |
419 | padlock_xcrypt_ecb(in, out, ctx->E, &ctx->cword.encrypt, 1); | ||
431 | } | 420 | } |
432 | 421 | ||
433 | static void | 422 | static void |
434 | aes_decrypt(void *ctx_arg, uint8_t *out, const uint8_t *in) | 423 | aes_decrypt(void *ctx_arg, uint8_t *out, const uint8_t *in) |
435 | { | 424 | { |
436 | aes_padlock(ctx_arg, out, in, CRYPTO_DIR_DECRYPT); | 425 | struct aes_ctx *ctx = aes_ctx(ctx_arg); |
426 | padlock_xcrypt_ecb(in, out, ctx->D, &ctx->cword.decrypt, 1); | ||
427 | } | ||
428 | |||
429 | static unsigned int aes_encrypt_ecb(const struct cipher_desc *desc, u8 *out, | ||
430 | const u8 *in, unsigned int nbytes) | ||
431 | { | ||
432 | struct aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(desc->tfm)); | ||
433 | padlock_xcrypt_ecb(in, out, ctx->E, &ctx->cword.encrypt, | ||
434 | nbytes / AES_BLOCK_SIZE); | ||
435 | return nbytes & ~(AES_BLOCK_SIZE - 1); | ||
436 | } | ||
437 | |||
438 | static unsigned int aes_decrypt_ecb(const struct cipher_desc *desc, u8 *out, | ||
439 | const u8 *in, unsigned int nbytes) | ||
440 | { | ||
441 | struct aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(desc->tfm)); | ||
442 | padlock_xcrypt_ecb(in, out, ctx->D, &ctx->cword.decrypt, | ||
443 | nbytes / AES_BLOCK_SIZE); | ||
444 | return nbytes & ~(AES_BLOCK_SIZE - 1); | ||
445 | } | ||
446 | |||
447 | static unsigned int aes_encrypt_cbc(const struct cipher_desc *desc, u8 *out, | ||
448 | const u8 *in, unsigned int nbytes) | ||
449 | { | ||
450 | struct aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(desc->tfm)); | ||
451 | u8 *iv; | ||
452 | |||
453 | iv = padlock_xcrypt_cbc(in, out, ctx->E, desc->info, | ||
454 | &ctx->cword.encrypt, nbytes / AES_BLOCK_SIZE); | ||
455 | memcpy(desc->info, iv, AES_BLOCK_SIZE); | ||
456 | |||
457 | return nbytes & ~(AES_BLOCK_SIZE - 1); | ||
458 | } | ||
459 | |||
460 | static unsigned int aes_decrypt_cbc(const struct cipher_desc *desc, u8 *out, | ||
461 | const u8 *in, unsigned int nbytes) | ||
462 | { | ||
463 | struct aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(desc->tfm)); | ||
464 | padlock_xcrypt_cbc(in, out, ctx->D, desc->info, &ctx->cword.decrypt, | ||
465 | nbytes / AES_BLOCK_SIZE); | ||
466 | return nbytes & ~(AES_BLOCK_SIZE - 1); | ||
437 | } | 467 | } |
438 | 468 | ||
439 | static struct crypto_alg aes_alg = { | 469 | static struct crypto_alg aes_alg = { |
@@ -441,6 +471,7 @@ static struct crypto_alg aes_alg = { | |||
441 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | 471 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, |
442 | .cra_blocksize = AES_BLOCK_SIZE, | 472 | .cra_blocksize = AES_BLOCK_SIZE, |
443 | .cra_ctxsize = sizeof(struct aes_ctx), | 473 | .cra_ctxsize = sizeof(struct aes_ctx), |
474 | .cra_alignmask = PADLOCK_ALIGNMENT - 1, | ||
444 | .cra_module = THIS_MODULE, | 475 | .cra_module = THIS_MODULE, |
445 | .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), | 476 | .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), |
446 | .cra_u = { | 477 | .cra_u = { |
@@ -449,7 +480,11 @@ static struct crypto_alg aes_alg = { | |||
449 | .cia_max_keysize = AES_MAX_KEY_SIZE, | 480 | .cia_max_keysize = AES_MAX_KEY_SIZE, |
450 | .cia_setkey = aes_set_key, | 481 | .cia_setkey = aes_set_key, |
451 | .cia_encrypt = aes_encrypt, | 482 | .cia_encrypt = aes_encrypt, |
452 | .cia_decrypt = aes_decrypt | 483 | .cia_decrypt = aes_decrypt, |
484 | .cia_encrypt_ecb = aes_encrypt_ecb, | ||
485 | .cia_decrypt_ecb = aes_decrypt_ecb, | ||
486 | .cia_encrypt_cbc = aes_encrypt_cbc, | ||
487 | .cia_decrypt_cbc = aes_decrypt_cbc, | ||
453 | } | 488 | } |
454 | } | 489 | } |
455 | }; | 490 | }; |
diff --git a/drivers/crypto/padlock.h b/drivers/crypto/padlock.h index 7a500605e449..3cf2b7a12348 100644 --- a/drivers/crypto/padlock.h +++ b/drivers/crypto/padlock.h | |||
@@ -13,18 +13,18 @@ | |||
13 | #ifndef _CRYPTO_PADLOCK_H | 13 | #ifndef _CRYPTO_PADLOCK_H |
14 | #define _CRYPTO_PADLOCK_H | 14 | #define _CRYPTO_PADLOCK_H |
15 | 15 | ||
16 | #define PADLOCK_ALIGNMENT 16 | ||
17 | |||
16 | /* Control word. */ | 18 | /* Control word. */ |
17 | union cword { | 19 | struct cword { |
18 | uint32_t cword[4]; | 20 | int __attribute__ ((__packed__)) |
19 | struct { | 21 | rounds:4, |
20 | int rounds:4; | 22 | algo:3, |
21 | int algo:3; | 23 | keygen:1, |
22 | int keygen:1; | 24 | interm:1, |
23 | int interm:1; | 25 | encdec:1, |
24 | int encdec:1; | 26 | ksize:2; |
25 | int ksize:2; | 27 | } __attribute__ ((__aligned__(PADLOCK_ALIGNMENT))); |
26 | } b; | ||
27 | }; | ||
28 | 28 | ||
29 | #define PFX "padlock: " | 29 | #define PFX "padlock: " |
30 | 30 | ||
diff --git a/drivers/firmware/pcdp.c b/drivers/firmware/pcdp.c index 839b44a7e08b..53c95c0bbf46 100644 --- a/drivers/firmware/pcdp.c +++ b/drivers/firmware/pcdp.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/console.h> | 16 | #include <linux/console.h> |
17 | #include <linux/efi.h> | 17 | #include <linux/efi.h> |
18 | #include <linux/serial.h> | 18 | #include <linux/serial.h> |
19 | #include <asm/vga.h> | ||
19 | #include "pcdp.h" | 20 | #include "pcdp.h" |
20 | 21 | ||
21 | static int __init | 22 | static int __init |
@@ -40,10 +41,27 @@ setup_serial_console(struct pcdp_uart *uart) | |||
40 | } | 41 | } |
41 | 42 | ||
42 | static int __init | 43 | static int __init |
43 | setup_vga_console(struct pcdp_vga *vga) | 44 | setup_vga_console(struct pcdp_device *dev) |
44 | { | 45 | { |
45 | #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) | 46 | #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) |
46 | if (efi_mem_type(0xA0000) == EFI_CONVENTIONAL_MEMORY) { | 47 | u8 *if_ptr; |
48 | |||
49 | if_ptr = ((u8 *)dev + sizeof(struct pcdp_device)); | ||
50 | if (if_ptr[0] == PCDP_IF_PCI) { | ||
51 | struct pcdp_if_pci if_pci; | ||
52 | |||
53 | /* struct copy since ifptr might not be correctly aligned */ | ||
54 | |||
55 | memcpy(&if_pci, if_ptr, sizeof(if_pci)); | ||
56 | |||
57 | if (if_pci.trans & PCDP_PCI_TRANS_IOPORT) | ||
58 | vga_console_iobase = if_pci.ioport_tra; | ||
59 | |||
60 | if (if_pci.trans & PCDP_PCI_TRANS_MMIO) | ||
61 | vga_console_membase = if_pci.mmio_tra; | ||
62 | } | ||
63 | |||
64 | if (efi_mem_type(vga_console_membase + 0xA0000) == EFI_CONVENTIONAL_MEMORY) { | ||
47 | printk(KERN_ERR "PCDP: VGA selected, but frame buffer is not MMIO!\n"); | 65 | printk(KERN_ERR "PCDP: VGA selected, but frame buffer is not MMIO!\n"); |
48 | return -ENODEV; | 66 | return -ENODEV; |
49 | } | 67 | } |
@@ -95,7 +113,7 @@ efi_setup_pcdp_console(char *cmdline) | |||
95 | dev = (struct pcdp_device *) ((u8 *) dev + dev->length)) { | 113 | dev = (struct pcdp_device *) ((u8 *) dev + dev->length)) { |
96 | if (dev->flags & PCDP_PRIMARY_CONSOLE) { | 114 | if (dev->flags & PCDP_PRIMARY_CONSOLE) { |
97 | if (dev->type == PCDP_CONSOLE_VGA) { | 115 | if (dev->type == PCDP_CONSOLE_VGA) { |
98 | return setup_vga_console((struct pcdp_vga *) dev); | 116 | return setup_vga_console(dev); |
99 | } | 117 | } |
100 | } | 118 | } |
101 | } | 119 | } |
diff --git a/drivers/firmware/pcdp.h b/drivers/firmware/pcdp.h index 1dc7c88b7b4d..e72cc47de33b 100644 --- a/drivers/firmware/pcdp.h +++ b/drivers/firmware/pcdp.h | |||
@@ -52,11 +52,34 @@ struct pcdp_uart { | |||
52 | u32 clock_rate; | 52 | u32 clock_rate; |
53 | u8 pci_prog_intfc; | 53 | u8 pci_prog_intfc; |
54 | u8 flags; | 54 | u8 flags; |
55 | }; | 55 | } __attribute__((packed)); |
56 | |||
57 | #define PCDP_IF_PCI 1 | ||
58 | |||
59 | /* pcdp_if_pci.trans */ | ||
60 | #define PCDP_PCI_TRANS_IOPORT 0x02 | ||
61 | #define PCDP_PCI_TRANS_MMIO 0x01 | ||
62 | |||
63 | struct pcdp_if_pci { | ||
64 | u8 interconnect; | ||
65 | u8 reserved; | ||
66 | u16 length; | ||
67 | u8 segment; | ||
68 | u8 bus; | ||
69 | u8 dev; | ||
70 | u8 fun; | ||
71 | u16 dev_id; | ||
72 | u16 vendor_id; | ||
73 | u32 acpi_interrupt; | ||
74 | u64 mmio_tra; | ||
75 | u64 ioport_tra; | ||
76 | u8 flags; | ||
77 | u8 trans; | ||
78 | } __attribute__((packed)); | ||
56 | 79 | ||
57 | struct pcdp_vga { | 80 | struct pcdp_vga { |
58 | u8 count; /* address space descriptors */ | 81 | u8 count; /* address space descriptors */ |
59 | }; | 82 | } __attribute__((packed)); |
60 | 83 | ||
61 | /* pcdp_device.flags */ | 84 | /* pcdp_device.flags */ |
62 | #define PCDP_PRIMARY_CONSOLE 1 | 85 | #define PCDP_PRIMARY_CONSOLE 1 |
@@ -66,7 +89,9 @@ struct pcdp_device { | |||
66 | u8 flags; | 89 | u8 flags; |
67 | u16 length; | 90 | u16 length; |
68 | u16 efi_index; | 91 | u16 efi_index; |
69 | }; | 92 | /* next data is pcdp_if_pci or pcdp_if_acpi (not yet supported) */ |
93 | /* next data is device specific type (currently only pcdp_vga) */ | ||
94 | } __attribute__((packed)); | ||
70 | 95 | ||
71 | struct pcdp { | 96 | struct pcdp { |
72 | u8 signature[4]; | 97 | u8 signature[4]; |
@@ -81,4 +106,4 @@ struct pcdp { | |||
81 | u32 num_uarts; | 106 | u32 num_uarts; |
82 | struct pcdp_uart uart[0]; /* actual size is num_uarts */ | 107 | struct pcdp_uart uart[0]; /* actual size is num_uarts */ |
83 | /* remainder of table is pcdp_device structures */ | 108 | /* remainder of table is pcdp_device structures */ |
84 | }; | 109 | } __attribute__((packed)); |
diff --git a/drivers/i2c/busses/i2c-keywest.c b/drivers/i2c/busses/i2c-keywest.c index 363e545fc01f..94ae808314f7 100644 --- a/drivers/i2c/busses/i2c-keywest.c +++ b/drivers/i2c/busses/i2c-keywest.c | |||
@@ -698,7 +698,7 @@ dispose_iface(struct device *dev) | |||
698 | } | 698 | } |
699 | 699 | ||
700 | static int | 700 | static int |
701 | create_iface_macio(struct macio_dev* dev, const struct of_match *match) | 701 | create_iface_macio(struct macio_dev* dev, const struct of_device_id *match) |
702 | { | 702 | { |
703 | return create_iface(dev->ofdev.node, &dev->ofdev.dev); | 703 | return create_iface(dev->ofdev.node, &dev->ofdev.dev); |
704 | } | 704 | } |
@@ -710,7 +710,7 @@ dispose_iface_macio(struct macio_dev* dev) | |||
710 | } | 710 | } |
711 | 711 | ||
712 | static int | 712 | static int |
713 | create_iface_of_platform(struct of_device* dev, const struct of_match *match) | 713 | create_iface_of_platform(struct of_device* dev, const struct of_device_id *match) |
714 | { | 714 | { |
715 | return create_iface(dev->node, &dev->dev); | 715 | return create_iface(dev->node, &dev->dev); |
716 | } | 716 | } |
@@ -721,10 +721,9 @@ dispose_iface_of_platform(struct of_device* dev) | |||
721 | return dispose_iface(&dev->dev); | 721 | return dispose_iface(&dev->dev); |
722 | } | 722 | } |
723 | 723 | ||
724 | static struct of_match i2c_keywest_match[] = | 724 | static struct of_device_id i2c_keywest_match[] = |
725 | { | 725 | { |
726 | { | 726 | { |
727 | .name = OF_ANY_MATCH, | ||
728 | .type = "i2c", | 727 | .type = "i2c", |
729 | .compatible = "keywest" | 728 | .compatible = "keywest" |
730 | }, | 729 | }, |
diff --git a/drivers/i2c/chips/atxp1.c b/drivers/i2c/chips/atxp1.c index 5c6597aa2c7f..0bcf82b4c07b 100644 --- a/drivers/i2c/chips/atxp1.c +++ b/drivers/i2c/chips/atxp1.c | |||
@@ -144,7 +144,7 @@ static ssize_t atxp1_storevcore(struct device *dev, struct device_attribute *att | |||
144 | if (vid == cvid) | 144 | if (vid == cvid) |
145 | return count; | 145 | return count; |
146 | 146 | ||
147 | dev_info(dev, "Setting VCore to %d mV (0x%02x)\n", vcore, vid); | 147 | dev_dbg(dev, "Setting VCore to %d mV (0x%02x)\n", vcore, vid); |
148 | 148 | ||
149 | /* Write every 25 mV step to increase stability */ | 149 | /* Write every 25 mV step to increase stability */ |
150 | if (cvid > vid) { | 150 | if (cvid > vid) { |
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index 5be8ad6dc9ed..cca9c075966d 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile | |||
@@ -20,7 +20,6 @@ ide-core-$(CONFIG_BLK_DEV_CMD640) += pci/cmd640.o | |||
20 | # Core IDE code - must come before legacy | 20 | # Core IDE code - must come before legacy |
21 | ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o | 21 | ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o |
22 | ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o | 22 | ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o |
23 | ide-core-$(CONFIG_BLK_DEV_IDE_TCQ) += ide-tcq.o | ||
24 | ide-core-$(CONFIG_PROC_FS) += ide-proc.o | 23 | ide-core-$(CONFIG_PROC_FS) += ide-proc.o |
25 | ide-core-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o | 24 | ide-core-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o |
26 | 25 | ||
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 6806d407e9c1..b09a6537c7a8 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -487,8 +487,7 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat) | |||
487 | u8 err = 0; | 487 | u8 err = 0; |
488 | 488 | ||
489 | local_irq_set(flags); | 489 | local_irq_set(flags); |
490 | printk("%s: %s: status=0x%02x", drive->name, msg, stat); | 490 | printk("%s: %s: status=0x%02x { ", drive->name, msg, stat); |
491 | printk(" { "); | ||
492 | if (stat & BUSY_STAT) | 491 | if (stat & BUSY_STAT) |
493 | printk("Busy "); | 492 | printk("Busy "); |
494 | else { | 493 | else { |
@@ -500,15 +499,13 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat) | |||
500 | if (stat & INDEX_STAT) printk("Index "); | 499 | if (stat & INDEX_STAT) printk("Index "); |
501 | if (stat & ERR_STAT) printk("Error "); | 500 | if (stat & ERR_STAT) printk("Error "); |
502 | } | 501 | } |
503 | printk("}"); | 502 | printk("}\n"); |
504 | printk("\n"); | ||
505 | if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) { | 503 | if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) { |
506 | err = hwif->INB(IDE_ERROR_REG); | 504 | err = hwif->INB(IDE_ERROR_REG); |
507 | printk("%s: %s: error=0x%02x", drive->name, msg, err); | 505 | printk("%s: %s: error=0x%02x { ", drive->name, msg, err); |
508 | printk(" { "); | ||
509 | if (err & ABRT_ERR) printk("DriveStatusError "); | 506 | if (err & ABRT_ERR) printk("DriveStatusError "); |
510 | if (err & ICRC_ERR) | 507 | if (err & ICRC_ERR) |
511 | printk("Bad%s ", (err & ABRT_ERR) ? "CRC" : "Sector"); | 508 | printk((err & ABRT_ERR) ? "BadCRC " : "BadSector "); |
512 | if (err & ECC_ERR) printk("UncorrectableError "); | 509 | if (err & ECC_ERR) printk("UncorrectableError "); |
513 | if (err & ID_ERR) printk("SectorIdNotFound "); | 510 | if (err & ID_ERR) printk("SectorIdNotFound "); |
514 | if (err & TRK0_ERR) printk("TrackZeroNotFound "); | 511 | if (err & TRK0_ERR) printk("TrackZeroNotFound "); |
@@ -546,8 +543,8 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat) | |||
546 | printk(", sector=%llu", | 543 | printk(", sector=%llu", |
547 | (unsigned long long)HWGROUP(drive)->rq->sector); | 544 | (unsigned long long)HWGROUP(drive)->rq->sector); |
548 | } | 545 | } |
546 | printk("\n"); | ||
549 | } | 547 | } |
550 | printk("\n"); | ||
551 | ide_dump_opcode(drive); | 548 | ide_dump_opcode(drive); |
552 | local_irq_restore(flags); | 549 | local_irq_restore(flags); |
553 | return err; | 550 | return err; |
diff --git a/drivers/ide/legacy/hd.c b/drivers/ide/legacy/hd.c index e884cd4b22fd..242029c9c0ca 100644 --- a/drivers/ide/legacy/hd.c +++ b/drivers/ide/legacy/hd.c | |||
@@ -156,11 +156,13 @@ else \ | |||
156 | 156 | ||
157 | 157 | ||
158 | #if (HD_DELAY > 0) | 158 | #if (HD_DELAY > 0) |
159 | |||
160 | #include <asm/i8253.h> | ||
161 | |||
159 | unsigned long last_req; | 162 | unsigned long last_req; |
160 | 163 | ||
161 | unsigned long read_timer(void) | 164 | unsigned long read_timer(void) |
162 | { | 165 | { |
163 | extern spinlock_t i8253_lock; | ||
164 | unsigned long t, flags; | 166 | unsigned long t, flags; |
165 | int i; | 167 | int i; |
166 | 168 | ||
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 67efb38a9f6c..6cf49394a80f 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -583,7 +583,7 @@ static int ali15x3_dma_setup(ide_drive_t *drive) | |||
583 | * appropriate also sets up the 1533 southbridge. | 583 | * appropriate also sets up the 1533 southbridge. |
584 | */ | 584 | */ |
585 | 585 | ||
586 | static unsigned int __init init_chipset_ali15x3 (struct pci_dev *dev, const char *name) | 586 | static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const char *name) |
587 | { | 587 | { |
588 | unsigned long flags; | 588 | unsigned long flags; |
589 | u8 tmpbyte; | 589 | u8 tmpbyte; |
@@ -677,7 +677,7 @@ static unsigned int __init init_chipset_ali15x3 (struct pci_dev *dev, const char | |||
677 | * FIXME: frobs bits that are not defined on newer ALi devicea | 677 | * FIXME: frobs bits that are not defined on newer ALi devicea |
678 | */ | 678 | */ |
679 | 679 | ||
680 | static unsigned int __init ata66_ali15x3 (ide_hwif_t *hwif) | 680 | static unsigned int __devinit ata66_ali15x3 (ide_hwif_t *hwif) |
681 | { | 681 | { |
682 | struct pci_dev *dev = hwif->pci_dev; | 682 | struct pci_dev *dev = hwif->pci_dev; |
683 | unsigned int ata66 = 0; | 683 | unsigned int ata66 = 0; |
@@ -748,7 +748,7 @@ static unsigned int __init ata66_ali15x3 (ide_hwif_t *hwif) | |||
748 | * Initialize the IDE structure side of the ALi 15x3 driver. | 748 | * Initialize the IDE structure side of the ALi 15x3 driver. |
749 | */ | 749 | */ |
750 | 750 | ||
751 | static void __init init_hwif_common_ali15x3 (ide_hwif_t *hwif) | 751 | static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif) |
752 | { | 752 | { |
753 | hwif->autodma = 0; | 753 | hwif->autodma = 0; |
754 | hwif->tuneproc = &ali15x3_tune_drive; | 754 | hwif->tuneproc = &ali15x3_tune_drive; |
@@ -794,7 +794,7 @@ static void __init init_hwif_common_ali15x3 (ide_hwif_t *hwif) | |||
794 | * Sparc systems | 794 | * Sparc systems |
795 | */ | 795 | */ |
796 | 796 | ||
797 | static void __init init_hwif_ali15x3 (ide_hwif_t *hwif) | 797 | static void __devinit init_hwif_ali15x3 (ide_hwif_t *hwif) |
798 | { | 798 | { |
799 | u8 ideic, inmir; | 799 | u8 ideic, inmir; |
800 | s8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6, | 800 | s8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6, |
@@ -847,7 +847,7 @@ static void __init init_hwif_ali15x3 (ide_hwif_t *hwif) | |||
847 | * the actual work. | 847 | * the actual work. |
848 | */ | 848 | */ |
849 | 849 | ||
850 | static void __init init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase) | 850 | static void __devinit init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase) |
851 | { | 851 | { |
852 | if (m5229_revision < 0x20) | 852 | if (m5229_revision < 0x20) |
853 | return; | 853 | return; |
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 4e0f13d1d060..844a6c9fb949 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c | |||
@@ -73,6 +73,7 @@ static struct amd_ide_chip { | |||
73 | { PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, 0x50, AMD_UDMA_133 }, | 73 | { PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, 0x50, AMD_UDMA_133 }, |
74 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, 0x50, AMD_UDMA_133 }, | 74 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, 0x50, AMD_UDMA_133 }, |
75 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, 0x50, AMD_UDMA_133 }, | 75 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, 0x50, AMD_UDMA_133 }, |
76 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE, 0x50, AMD_UDMA_133 }, | ||
76 | { 0 } | 77 | { 0 } |
77 | }; | 78 | }; |
78 | 79 | ||
@@ -309,7 +310,7 @@ static int amd74xx_ide_dma_check(ide_drive_t *drive) | |||
309 | * and initialize its drive independent registers. | 310 | * and initialize its drive independent registers. |
310 | */ | 311 | */ |
311 | 312 | ||
312 | static unsigned int __init init_chipset_amd74xx(struct pci_dev *dev, const char *name) | 313 | static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const char *name) |
313 | { | 314 | { |
314 | unsigned char t; | 315 | unsigned char t; |
315 | unsigned int u; | 316 | unsigned int u; |
@@ -413,7 +414,7 @@ static unsigned int __init init_chipset_amd74xx(struct pci_dev *dev, const char | |||
413 | return dev->irq; | 414 | return dev->irq; |
414 | } | 415 | } |
415 | 416 | ||
416 | static void __init init_hwif_amd74xx(ide_hwif_t *hwif) | 417 | static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) |
417 | { | 418 | { |
418 | int i; | 419 | int i; |
419 | 420 | ||
@@ -489,6 +490,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { | |||
489 | /* 13 */ DECLARE_NV_DEV("NFORCE-CK804"), | 490 | /* 13 */ DECLARE_NV_DEV("NFORCE-CK804"), |
490 | /* 14 */ DECLARE_NV_DEV("NFORCE-MCP04"), | 491 | /* 14 */ DECLARE_NV_DEV("NFORCE-MCP04"), |
491 | /* 15 */ DECLARE_NV_DEV("NFORCE-MCP51"), | 492 | /* 15 */ DECLARE_NV_DEV("NFORCE-MCP51"), |
493 | /* 16 */ DECLARE_NV_DEV("NFORCE-MCP55"), | ||
492 | }; | 494 | }; |
493 | 495 | ||
494 | static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) | 496 | static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) |
@@ -524,6 +526,7 @@ static struct pci_device_id amd74xx_pci_tbl[] = { | |||
524 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13 }, | 526 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13 }, |
525 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14 }, | 527 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14 }, |
526 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 15 }, | 528 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 15 }, |
529 | { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 16 }, | ||
527 | { 0, }, | 530 | { 0, }, |
528 | }; | 531 | }; |
529 | MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl); | 532 | MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl); |
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index 0381961db263..09269e574b3e 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c | |||
@@ -217,7 +217,7 @@ static int cs5530_config_dma (ide_drive_t *drive) | |||
217 | * Initialize the cs5530 bridge for reliable IDE DMA operation. | 217 | * Initialize the cs5530 bridge for reliable IDE DMA operation. |
218 | */ | 218 | */ |
219 | 219 | ||
220 | static unsigned int __init init_chipset_cs5530 (struct pci_dev *dev, const char *name) | 220 | static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const char *name) |
221 | { | 221 | { |
222 | struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; | 222 | struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; |
223 | unsigned long flags; | 223 | unsigned long flags; |
@@ -308,7 +308,7 @@ static unsigned int __init init_chipset_cs5530 (struct pci_dev *dev, const char | |||
308 | * performs channel-specific pre-initialization before drive probing. | 308 | * performs channel-specific pre-initialization before drive probing. |
309 | */ | 309 | */ |
310 | 310 | ||
311 | static void __init init_hwif_cs5530 (ide_hwif_t *hwif) | 311 | static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif) |
312 | { | 312 | { |
313 | unsigned long basereg; | 313 | unsigned long basereg; |
314 | u32 d0_timings; | 314 | u32 d0_timings; |
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index 80d67e99ccb5..5a33513f3dd1 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c | |||
@@ -391,7 +391,7 @@ static void cy82c693_tune_drive (ide_drive_t *drive, u8 pio) | |||
391 | /* | 391 | /* |
392 | * this function is called during init and is used to setup the cy82c693 chip | 392 | * this function is called during init and is used to setup the cy82c693 chip |
393 | */ | 393 | */ |
394 | static unsigned int __init init_chipset_cy82c693(struct pci_dev *dev, const char *name) | 394 | static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const char *name) |
395 | { | 395 | { |
396 | if (PCI_FUNC(dev->devfn) != 1) | 396 | if (PCI_FUNC(dev->devfn) != 1) |
397 | return 0; | 397 | return 0; |
@@ -443,7 +443,7 @@ static unsigned int __init init_chipset_cy82c693(struct pci_dev *dev, const char | |||
443 | /* | 443 | /* |
444 | * the init function - called for each ide channel once | 444 | * the init function - called for each ide channel once |
445 | */ | 445 | */ |
446 | static void __init init_hwif_cy82c693(ide_hwif_t *hwif) | 446 | static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) |
447 | { | 447 | { |
448 | hwif->autodma = 0; | 448 | hwif->autodma = 0; |
449 | 449 | ||
@@ -467,9 +467,9 @@ static void __init init_hwif_cy82c693(ide_hwif_t *hwif) | |||
467 | hwif->drives[1].autodma = hwif->autodma; | 467 | hwif->drives[1].autodma = hwif->autodma; |
468 | } | 468 | } |
469 | 469 | ||
470 | static __initdata ide_hwif_t *primary; | 470 | static __devinitdata ide_hwif_t *primary; |
471 | 471 | ||
472 | void __init init_iops_cy82c693(ide_hwif_t *hwif) | 472 | void __devinit init_iops_cy82c693(ide_hwif_t *hwif) |
473 | { | 473 | { |
474 | if (PCI_FUNC(hwif->pci_dev->devfn) == 1) | 474 | if (PCI_FUNC(hwif->pci_dev->devfn) == 1) |
475 | primary = hwif; | 475 | primary = hwif; |
diff --git a/drivers/ide/pci/it8172.c b/drivers/ide/pci/it8172.c index 631927cf17d4..93462926b9d5 100644 --- a/drivers/ide/pci/it8172.c +++ b/drivers/ide/pci/it8172.c | |||
@@ -216,7 +216,7 @@ fast_ata_pio: | |||
216 | return 0; | 216 | return 0; |
217 | } | 217 | } |
218 | 218 | ||
219 | static unsigned int __init init_chipset_it8172 (struct pci_dev *dev, const char *name) | 219 | static unsigned int __devinit init_chipset_it8172 (struct pci_dev *dev, const char *name) |
220 | { | 220 | { |
221 | unsigned char progif; | 221 | unsigned char progif; |
222 | 222 | ||
@@ -230,7 +230,7 @@ static unsigned int __init init_chipset_it8172 (struct pci_dev *dev, const char | |||
230 | } | 230 | } |
231 | 231 | ||
232 | 232 | ||
233 | static void __init init_hwif_it8172 (ide_hwif_t *hwif) | 233 | static void __devinit init_hwif_it8172 (ide_hwif_t *hwif) |
234 | { | 234 | { |
235 | struct pci_dev* dev = hwif->pci_dev; | 235 | struct pci_dev* dev = hwif->pci_dev; |
236 | unsigned long cmdBase, ctrlBase; | 236 | unsigned long cmdBase, ctrlBase; |
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index 205a32fbc2f0..fcd5142f5cfe 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c | |||
@@ -195,7 +195,7 @@ static int ns87415_ide_dma_check (ide_drive_t *drive) | |||
195 | return __ide_dma_check(drive); | 195 | return __ide_dma_check(drive); |
196 | } | 196 | } |
197 | 197 | ||
198 | static void __init init_hwif_ns87415 (ide_hwif_t *hwif) | 198 | static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) |
199 | { | 199 | { |
200 | struct pci_dev *dev = hwif->pci_dev; | 200 | struct pci_dev *dev = hwif->pci_dev; |
201 | unsigned int ctrl, using_inta; | 201 | unsigned int ctrl, using_inta; |
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index cf4fd91d396a..7a7c2ef78ac2 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c | |||
@@ -326,7 +326,7 @@ static void opti621_tune_drive (ide_drive_t *drive, u8 pio) | |||
326 | /* | 326 | /* |
327 | * init_hwif_opti621() is called once for each hwif found at boot. | 327 | * init_hwif_opti621() is called once for each hwif found at boot. |
328 | */ | 328 | */ |
329 | static void __init init_hwif_opti621 (ide_hwif_t *hwif) | 329 | static void __devinit init_hwif_opti621 (ide_hwif_t *hwif) |
330 | { | 330 | { |
331 | hwif->autodma = 0; | 331 | hwif->autodma = 0; |
332 | hwif->drives[0].drive_data = PIO_DONT_KNOW; | 332 | hwif->drives[0].drive_data = PIO_DONT_KNOW; |
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 3bc3bf1be49b..10592cec6c43 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -459,7 +459,7 @@ printk("%s: SC1200: resume\n", hwif->name); | |||
459 | * This gets invoked by the IDE driver once for each channel, | 459 | * This gets invoked by the IDE driver once for each channel, |
460 | * and performs channel-specific pre-initialization before drive probing. | 460 | * and performs channel-specific pre-initialization before drive probing. |
461 | */ | 461 | */ |
462 | static void __init init_hwif_sc1200 (ide_hwif_t *hwif) | 462 | static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif) |
463 | { | 463 | { |
464 | if (hwif->mate) | 464 | if (hwif->mate) |
465 | hwif->serialized = hwif->mate->serialized = 1; | 465 | hwif->serialized = hwif->mate->serialized = 1; |
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index 1d970a0de21a..ea0806c82be0 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c | |||
@@ -386,7 +386,7 @@ static unsigned int sl82c105_bridge_revision(struct pci_dev *dev) | |||
386 | * channel 0 here at least, but channel 1 has to be enabled by | 386 | * channel 0 here at least, but channel 1 has to be enabled by |
387 | * firmware or arch code. We still set both to 16 bits mode. | 387 | * firmware or arch code. We still set both to 16 bits mode. |
388 | */ | 388 | */ |
389 | static unsigned int __init init_chipset_sl82c105(struct pci_dev *dev, const char *msg) | 389 | static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev, const char *msg) |
390 | { | 390 | { |
391 | u32 val; | 391 | u32 val; |
392 | 392 | ||
@@ -399,7 +399,7 @@ static unsigned int __init init_chipset_sl82c105(struct pci_dev *dev, const char | |||
399 | return dev->irq; | 399 | return dev->irq; |
400 | } | 400 | } |
401 | 401 | ||
402 | static void __init init_dma_sl82c105(ide_hwif_t *hwif, unsigned long dma_base) | 402 | static void __devinit init_dma_sl82c105(ide_hwif_t *hwif, unsigned long dma_base) |
403 | { | 403 | { |
404 | unsigned int rev; | 404 | unsigned int rev; |
405 | u8 dma_state; | 405 | u8 dma_state; |
@@ -431,7 +431,7 @@ static void __init init_dma_sl82c105(ide_hwif_t *hwif, unsigned long dma_base) | |||
431 | * Initialise the chip | 431 | * Initialise the chip |
432 | */ | 432 | */ |
433 | 433 | ||
434 | static void __init init_hwif_sl82c105(ide_hwif_t *hwif) | 434 | static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) |
435 | { | 435 | { |
436 | struct pci_dev *dev = hwif->pci_dev; | 436 | struct pci_dev *dev = hwif->pci_dev; |
437 | u32 val; | 437 | u32 val; |
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index 7fbf36342f73..5112c726633b 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c | |||
@@ -196,7 +196,7 @@ fast_ata_pio: | |||
196 | } | 196 | } |
197 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | 197 | #endif /* CONFIG_BLK_DEV_IDEDMA */ |
198 | 198 | ||
199 | static void __init init_hwif_slc90e66 (ide_hwif_t *hwif) | 199 | static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) |
200 | { | 200 | { |
201 | u8 reg47 = 0; | 201 | u8 reg47 = 0; |
202 | u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */ | 202 | u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */ |
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index a1df2bfe3631..f96b56838f33 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c | |||
@@ -130,7 +130,7 @@ static int triflex_config_drive_xfer_rate(ide_drive_t *drive) | |||
130 | return hwif->ide_dma_off_quietly(drive); | 130 | return hwif->ide_dma_off_quietly(drive); |
131 | } | 131 | } |
132 | 132 | ||
133 | static void __init init_hwif_triflex(ide_hwif_t *hwif) | 133 | static void __devinit init_hwif_triflex(ide_hwif_t *hwif) |
134 | { | 134 | { |
135 | hwif->tuneproc = &triflex_tune_drive; | 135 | hwif->tuneproc = &triflex_tune_drive; |
136 | hwif->speedproc = &triflex_tune_chipset; | 136 | hwif->speedproc = &triflex_tune_chipset; |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 069dbffe2116..a4d099c937ff 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -415,7 +415,7 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive) | |||
415 | * and initialize its drive independent registers. | 415 | * and initialize its drive independent registers. |
416 | */ | 416 | */ |
417 | 417 | ||
418 | static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const char *name) | 418 | static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name) |
419 | { | 419 | { |
420 | struct pci_dev *isa = NULL; | 420 | struct pci_dev *isa = NULL; |
421 | u8 t, v; | 421 | u8 t, v; |
@@ -576,7 +576,7 @@ static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const cha | |||
576 | return 0; | 576 | return 0; |
577 | } | 577 | } |
578 | 578 | ||
579 | static void __init init_hwif_via82cxxx(ide_hwif_t *hwif) | 579 | static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) |
580 | { | 580 | { |
581 | int i; | 581 | int i; |
582 | 582 | ||
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 818380b5fd27..be0fcc8f4b15 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1419,7 +1419,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1419 | * Attach to a macio probed interface | 1419 | * Attach to a macio probed interface |
1420 | */ | 1420 | */ |
1421 | static int __devinit | 1421 | static int __devinit |
1422 | pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_match *match) | 1422 | pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) |
1423 | { | 1423 | { |
1424 | void __iomem *base; | 1424 | void __iomem *base; |
1425 | unsigned long regbase; | 1425 | unsigned long regbase; |
@@ -1637,27 +1637,19 @@ pmac_ide_pci_resume(struct pci_dev *pdev) | |||
1637 | return rc; | 1637 | return rc; |
1638 | } | 1638 | } |
1639 | 1639 | ||
1640 | static struct of_match pmac_ide_macio_match[] = | 1640 | static struct of_device_id pmac_ide_macio_match[] = |
1641 | { | 1641 | { |
1642 | { | 1642 | { |
1643 | .name = "IDE", | 1643 | .name = "IDE", |
1644 | .type = OF_ANY_MATCH, | ||
1645 | .compatible = OF_ANY_MATCH | ||
1646 | }, | 1644 | }, |
1647 | { | 1645 | { |
1648 | .name = "ATA", | 1646 | .name = "ATA", |
1649 | .type = OF_ANY_MATCH, | ||
1650 | .compatible = OF_ANY_MATCH | ||
1651 | }, | 1647 | }, |
1652 | { | 1648 | { |
1653 | .name = OF_ANY_MATCH, | ||
1654 | .type = "ide", | 1649 | .type = "ide", |
1655 | .compatible = OF_ANY_MATCH | ||
1656 | }, | 1650 | }, |
1657 | { | 1651 | { |
1658 | .name = OF_ANY_MATCH, | ||
1659 | .type = "ata", | 1652 | .type = "ata", |
1660 | .compatible = OF_ANY_MATCH | ||
1661 | }, | 1653 | }, |
1662 | {}, | 1654 | {}, |
1663 | }; | 1655 | }; |
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index e501675ad72e..77da827b2898 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -847,7 +847,7 @@ static int __init ide_scan_pcidev(struct pci_dev *dev) | |||
847 | d = list_entry(l, struct pci_driver, node); | 847 | d = list_entry(l, struct pci_driver, node); |
848 | if(d->id_table) | 848 | if(d->id_table) |
849 | { | 849 | { |
850 | const struct pci_device_id *id = pci_match_device(d->id_table, dev); | 850 | const struct pci_device_id *id = pci_match_id(d->id_table, dev); |
851 | if(id != NULL) | 851 | if(id != NULL) |
852 | { | 852 | { |
853 | if(d->probe(dev, id) >= 0) | 853 | if(d->probe(dev, id) >= 0) |
diff --git a/drivers/ieee1394/ieee1394_core.h b/drivers/ieee1394/ieee1394_core.h index 73bd8efd2b6c..0b31429d0a68 100644 --- a/drivers/ieee1394/ieee1394_core.h +++ b/drivers/ieee1394/ieee1394_core.h | |||
@@ -38,8 +38,8 @@ struct hpsb_packet { | |||
38 | 38 | ||
39 | /* These are core internal. */ | 39 | /* These are core internal. */ |
40 | signed char tlabel; | 40 | signed char tlabel; |
41 | char ack_code; | 41 | signed char ack_code; |
42 | char tcode; | 42 | unsigned char tcode; |
43 | 43 | ||
44 | unsigned expect_response:1; | 44 | unsigned expect_response:1; |
45 | unsigned no_waiter:1; | 45 | unsigned no_waiter:1; |
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index 3e72c9b1461e..ab09cf4093e3 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -60,12 +60,13 @@ static void gameport_disconnect_port(struct gameport *gameport); | |||
60 | 60 | ||
61 | #if defined(__i386__) | 61 | #if defined(__i386__) |
62 | 62 | ||
63 | #include <asm/i8253.h> | ||
64 | |||
63 | #define DELTA(x,y) ((y)-(x)+((y)<(x)?1193182/HZ:0)) | 65 | #define DELTA(x,y) ((y)-(x)+((y)<(x)?1193182/HZ:0)) |
64 | #define GET_TIME(x) do { x = get_time_pit(); } while (0) | 66 | #define GET_TIME(x) do { x = get_time_pit(); } while (0) |
65 | 67 | ||
66 | static unsigned int get_time_pit(void) | 68 | static unsigned int get_time_pit(void) |
67 | { | 69 | { |
68 | extern spinlock_t i8253_lock; | ||
69 | unsigned long flags; | 70 | unsigned long flags; |
70 | unsigned int count; | 71 | unsigned int count; |
71 | 72 | ||
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c index 504b7d550567..c3a5739030c3 100644 --- a/drivers/input/joystick/analog.c +++ b/drivers/input/joystick/analog.c | |||
@@ -140,12 +140,14 @@ struct analog_port { | |||
140 | */ | 140 | */ |
141 | 141 | ||
142 | #ifdef __i386__ | 142 | #ifdef __i386__ |
143 | |||
144 | #include <asm/i8253.h> | ||
145 | |||
143 | #define GET_TIME(x) do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0) | 146 | #define GET_TIME(x) do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0) |
144 | #define DELTA(x,y) (cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? CLOCK_TICK_RATE / HZ : 0))) | 147 | #define DELTA(x,y) (cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? CLOCK_TICK_RATE / HZ : 0))) |
145 | #define TIME_NAME (cpu_has_tsc?"TSC":"PIT") | 148 | #define TIME_NAME (cpu_has_tsc?"TSC":"PIT") |
146 | static unsigned int get_time_pit(void) | 149 | static unsigned int get_time_pit(void) |
147 | { | 150 | { |
148 | extern spinlock_t i8253_lock; | ||
149 | unsigned long flags; | 151 | unsigned long flags; |
150 | unsigned int count; | 152 | unsigned int count; |
151 | 153 | ||
diff --git a/drivers/isdn/hardware/eicon/dadapter.c b/drivers/isdn/hardware/eicon/dadapter.c index 6e548a222ef1..89497890158d 100644 --- a/drivers/isdn/hardware/eicon/dadapter.c +++ b/drivers/isdn/hardware/eicon/dadapter.c | |||
@@ -44,7 +44,7 @@ static didd_adapter_change_notification_t\ | |||
44 | Array to held adapter information | 44 | Array to held adapter information |
45 | -------------------------------------------------------------------------- */ | 45 | -------------------------------------------------------------------------- */ |
46 | static DESCRIPTOR HandleTable[NEW_MAX_DESCRIPTORS]; | 46 | static DESCRIPTOR HandleTable[NEW_MAX_DESCRIPTORS]; |
47 | dword Adapters = 0; /* Number of adapters */ | 47 | static dword Adapters = 0; /* Number of adapters */ |
48 | /* -------------------------------------------------------------------------- | 48 | /* -------------------------------------------------------------------------- |
49 | Shadow IDI_DIMAINT | 49 | Shadow IDI_DIMAINT |
50 | and 'shadow' debug stuff | 50 | and 'shadow' debug stuff |
diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c index 6e7e060716b7..7333377ab31d 100644 --- a/drivers/isdn/hisax/hfc4s8s_l1.c +++ b/drivers/isdn/hisax/hfc4s8s_l1.c | |||
@@ -312,7 +312,7 @@ wait_busy(hfc4s8s_hw * a) | |||
312 | /* function to read critical counter registers that */ | 312 | /* function to read critical counter registers that */ |
313 | /* may be udpated by the chip during read */ | 313 | /* may be udpated by the chip during read */ |
314 | /******************************************************/ | 314 | /******************************************************/ |
315 | static volatile u_char | 315 | static u_char |
316 | Read_hfc8_stable(hfc4s8s_hw * hw, int reg) | 316 | Read_hfc8_stable(hfc4s8s_hw * hw, int reg) |
317 | { | 317 | { |
318 | u_char ref8; | 318 | u_char ref8; |
@@ -324,7 +324,7 @@ Read_hfc8_stable(hfc4s8s_hw * hw, int reg) | |||
324 | return in8; | 324 | return in8; |
325 | } | 325 | } |
326 | 326 | ||
327 | static volatile int | 327 | static int |
328 | Read_hfc16_stable(hfc4s8s_hw * hw, int reg) | 328 | Read_hfc16_stable(hfc4s8s_hw * hw, int reg) |
329 | { | 329 | { |
330 | int ref16; | 330 | int ref16; |
@@ -1465,7 +1465,7 @@ hfc_hardware_enable(hfc4s8s_hw * hw, int enable, int nt_mode) | |||
1465 | /******************************************/ | 1465 | /******************************************/ |
1466 | /* disable memory mapped ports / io ports */ | 1466 | /* disable memory mapped ports / io ports */ |
1467 | /******************************************/ | 1467 | /******************************************/ |
1468 | void | 1468 | static void |
1469 | release_pci_ports(hfc4s8s_hw * hw) | 1469 | release_pci_ports(hfc4s8s_hw * hw) |
1470 | { | 1470 | { |
1471 | pci_write_config_word(hw->pdev, PCI_COMMAND, 0); | 1471 | pci_write_config_word(hw->pdev, PCI_COMMAND, 0); |
@@ -1481,7 +1481,7 @@ release_pci_ports(hfc4s8s_hw * hw) | |||
1481 | /*****************************************/ | 1481 | /*****************************************/ |
1482 | /* enable memory mapped ports / io ports */ | 1482 | /* enable memory mapped ports / io ports */ |
1483 | /*****************************************/ | 1483 | /*****************************************/ |
1484 | void | 1484 | static void |
1485 | enable_pci_ports(hfc4s8s_hw * hw) | 1485 | enable_pci_ports(hfc4s8s_hw * hw) |
1486 | { | 1486 | { |
1487 | #ifdef CONFIG_HISAX_HFC4S8S_PCIMEM | 1487 | #ifdef CONFIG_HISAX_HFC4S8S_PCIMEM |
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index 8ee25b2ccce1..1fd3d4e5f284 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c | |||
@@ -42,6 +42,8 @@ typedef struct _hycapi_appl { | |||
42 | 42 | ||
43 | static hycapi_appl hycapi_applications[CAPI_MAXAPPL]; | 43 | static hycapi_appl hycapi_applications[CAPI_MAXAPPL]; |
44 | 44 | ||
45 | static u16 hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb); | ||
46 | |||
45 | static inline int _hycapi_appCheck(int app_id, int ctrl_no) | 47 | static inline int _hycapi_appCheck(int app_id, int ctrl_no) |
46 | { | 48 | { |
47 | if((ctrl_no <= 0) || (ctrl_no > CAPI_MAXCONTR) || (app_id <= 0) || | 49 | if((ctrl_no <= 0) || (ctrl_no > CAPI_MAXCONTR) || (app_id <= 0) || |
@@ -57,7 +59,7 @@ static inline int _hycapi_appCheck(int app_id, int ctrl_no) | |||
57 | Kernel-Capi callback reset_ctr | 59 | Kernel-Capi callback reset_ctr |
58 | ******************************/ | 60 | ******************************/ |
59 | 61 | ||
60 | void | 62 | static void |
61 | hycapi_reset_ctr(struct capi_ctr *ctrl) | 63 | hycapi_reset_ctr(struct capi_ctr *ctrl) |
62 | { | 64 | { |
63 | hycapictrl_info *cinfo = ctrl->driverdata; | 65 | hycapictrl_info *cinfo = ctrl->driverdata; |
@@ -73,7 +75,7 @@ hycapi_reset_ctr(struct capi_ctr *ctrl) | |||
73 | Kernel-Capi callback remove_ctr | 75 | Kernel-Capi callback remove_ctr |
74 | ******************************/ | 76 | ******************************/ |
75 | 77 | ||
76 | void | 78 | static void |
77 | hycapi_remove_ctr(struct capi_ctr *ctrl) | 79 | hycapi_remove_ctr(struct capi_ctr *ctrl) |
78 | { | 80 | { |
79 | int i; | 81 | int i; |
@@ -215,7 +217,7 @@ Error-checking is done for CAPI-compliance. | |||
215 | The application is recorded in the internal list. | 217 | The application is recorded in the internal list. |
216 | *************************************************************/ | 218 | *************************************************************/ |
217 | 219 | ||
218 | void | 220 | static void |
219 | hycapi_register_appl(struct capi_ctr *ctrl, __u16 appl, | 221 | hycapi_register_appl(struct capi_ctr *ctrl, __u16 appl, |
220 | capi_register_params *rp) | 222 | capi_register_params *rp) |
221 | { | 223 | { |
@@ -291,7 +293,7 @@ Release the application from the internal list an remove it's | |||
291 | registration at controller-level | 293 | registration at controller-level |
292 | ******************************************************************/ | 294 | ******************************************************************/ |
293 | 295 | ||
294 | void | 296 | static void |
295 | hycapi_release_appl(struct capi_ctr *ctrl, __u16 appl) | 297 | hycapi_release_appl(struct capi_ctr *ctrl, __u16 appl) |
296 | { | 298 | { |
297 | int chk; | 299 | int chk; |
@@ -364,7 +366,7 @@ firmware-releases that do not check the MsgLen-Indication! | |||
364 | 366 | ||
365 | ***************************************************************/ | 367 | ***************************************************************/ |
366 | 368 | ||
367 | u16 hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) | 369 | static u16 hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) |
368 | { | 370 | { |
369 | __u16 appl_id; | 371 | __u16 appl_id; |
370 | int _len, _len2; | 372 | int _len, _len2; |
@@ -437,8 +439,8 @@ Informations provided in the /proc/capi-entries. | |||
437 | 439 | ||
438 | *********************************************************************/ | 440 | *********************************************************************/ |
439 | 441 | ||
440 | int hycapi_read_proc(char *page, char **start, off_t off, | 442 | static int hycapi_read_proc(char *page, char **start, off_t off, |
441 | int count, int *eof, struct capi_ctr *ctrl) | 443 | int count, int *eof, struct capi_ctr *ctrl) |
442 | { | 444 | { |
443 | hycapictrl_info *cinfo = (hycapictrl_info *)(ctrl->driverdata); | 445 | hycapictrl_info *cinfo = (hycapictrl_info *)(ctrl->driverdata); |
444 | hysdn_card *card = cinfo->card; | 446 | hysdn_card *card = cinfo->card; |
@@ -485,7 +487,7 @@ on capi-interface registration. | |||
485 | 487 | ||
486 | **************************************************************/ | 488 | **************************************************************/ |
487 | 489 | ||
488 | int hycapi_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) | 490 | static int hycapi_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) |
489 | { | 491 | { |
490 | #ifdef HYCAPI_PRINTFNAMES | 492 | #ifdef HYCAPI_PRINTFNAMES |
491 | printk(KERN_NOTICE "hycapi_load_firmware\n"); | 493 | printk(KERN_NOTICE "hycapi_load_firmware\n"); |
@@ -494,7 +496,7 @@ int hycapi_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) | |||
494 | } | 496 | } |
495 | 497 | ||
496 | 498 | ||
497 | char *hycapi_procinfo(struct capi_ctr *ctrl) | 499 | static char *hycapi_procinfo(struct capi_ctr *ctrl) |
498 | { | 500 | { |
499 | hycapictrl_info *cinfo = (hycapictrl_info *)(ctrl->driverdata); | 501 | hycapictrl_info *cinfo = (hycapictrl_info *)(ctrl->driverdata); |
500 | #ifdef HYCAPI_PRINTFNAMES | 502 | #ifdef HYCAPI_PRINTFNAMES |
diff --git a/drivers/isdn/hysdn/hysdn_boot.c b/drivers/isdn/hysdn/hysdn_boot.c index 6c04281e57b8..7bfba196f315 100644 --- a/drivers/isdn/hysdn/hysdn_boot.c +++ b/drivers/isdn/hysdn/hysdn_boot.c | |||
@@ -53,7 +53,7 @@ struct boot_data { | |||
53 | /* to be called at start of POF file reading, */ | 53 | /* to be called at start of POF file reading, */ |
54 | /* before starting any decryption on any POF record. */ | 54 | /* before starting any decryption on any POF record. */ |
55 | /*****************************************************/ | 55 | /*****************************************************/ |
56 | void | 56 | static void |
57 | StartDecryption(struct boot_data *boot) | 57 | StartDecryption(struct boot_data *boot) |
58 | { | 58 | { |
59 | boot->Cryptor = CRYPT_STARTTERM; | 59 | boot->Cryptor = CRYPT_STARTTERM; |
@@ -66,7 +66,7 @@ StartDecryption(struct boot_data *boot) | |||
66 | /* to HI and LO boot loader and (all) seq tags, because */ | 66 | /* to HI and LO boot loader and (all) seq tags, because */ |
67 | /* global Cryptor is started for whole POF. */ | 67 | /* global Cryptor is started for whole POF. */ |
68 | /***************************************************************/ | 68 | /***************************************************************/ |
69 | void | 69 | static void |
70 | DecryptBuf(struct boot_data *boot, int cnt) | 70 | DecryptBuf(struct boot_data *boot, int cnt) |
71 | { | 71 | { |
72 | uchar *bufp = boot->buf.BootBuf; | 72 | uchar *bufp = boot->buf.BootBuf; |
diff --git a/drivers/isdn/hysdn/hysdn_defs.h b/drivers/isdn/hysdn/hysdn_defs.h index 4cee26e558ee..432f6f99089e 100644 --- a/drivers/isdn/hysdn/hysdn_defs.h +++ b/drivers/isdn/hysdn/hysdn_defs.h | |||
@@ -227,7 +227,6 @@ typedef struct hycapictrl_info hycapictrl_info; | |||
227 | /*****************/ | 227 | /*****************/ |
228 | /* exported vars */ | 228 | /* exported vars */ |
229 | /*****************/ | 229 | /*****************/ |
230 | extern int cardmax; /* number of found cards */ | ||
231 | extern hysdn_card *card_root; /* pointer to first card */ | 230 | extern hysdn_card *card_root; /* pointer to first card */ |
232 | 231 | ||
233 | 232 | ||
@@ -244,7 +243,6 @@ extern void hysdn_procconf_release(void); /* deinit proc config filesys */ | |||
244 | /* hysdn_proclog.c */ | 243 | /* hysdn_proclog.c */ |
245 | extern int hysdn_proclog_init(hysdn_card *); /* init proc log entry */ | 244 | extern int hysdn_proclog_init(hysdn_card *); /* init proc log entry */ |
246 | extern void hysdn_proclog_release(hysdn_card *); /* deinit proc log entry */ | 245 | extern void hysdn_proclog_release(hysdn_card *); /* deinit proc log entry */ |
247 | extern void put_log_buffer(hysdn_card *, char *); /* output log data */ | ||
248 | extern void hysdn_addlog(hysdn_card *, char *,...); /* output data to log */ | 246 | extern void hysdn_addlog(hysdn_card *, char *,...); /* output data to log */ |
249 | extern void hysdn_card_errlog(hysdn_card *, tErrLogEntry *, int); /* output card log */ | 247 | extern void hysdn_card_errlog(hysdn_card *, tErrLogEntry *, int); /* output card log */ |
250 | 248 | ||
@@ -278,16 +276,6 @@ extern unsigned int hycapi_enable; | |||
278 | extern int hycapi_capi_create(hysdn_card *); /* create a new capi device */ | 276 | extern int hycapi_capi_create(hysdn_card *); /* create a new capi device */ |
279 | extern int hycapi_capi_release(hysdn_card *); /* delete the device */ | 277 | extern int hycapi_capi_release(hysdn_card *); /* delete the device */ |
280 | extern int hycapi_capi_stop(hysdn_card *card); /* suspend */ | 278 | extern int hycapi_capi_stop(hysdn_card *card); /* suspend */ |
281 | extern int hycapi_load_firmware(struct capi_ctr *, capiloaddata *); | ||
282 | extern void hycapi_reset_ctr(struct capi_ctr *); | ||
283 | extern void hycapi_remove_ctr(struct capi_ctr *); | ||
284 | extern void hycapi_register_appl(struct capi_ctr *, __u16 appl, | ||
285 | capi_register_params *); | ||
286 | extern void hycapi_release_appl(struct capi_ctr *, __u16 appl); | ||
287 | extern u16 hycapi_send_message(struct capi_ctr *, struct sk_buff *skb); | ||
288 | extern char *hycapi_procinfo(struct capi_ctr *); | ||
289 | extern int hycapi_read_proc(char *page, char **start, off_t off, | ||
290 | int count, int *eof, struct capi_ctr *card); | ||
291 | extern void hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len); | 279 | extern void hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len); |
292 | extern void hycapi_tx_capiack(hysdn_card * card); | 280 | extern void hycapi_tx_capiack(hysdn_card * card); |
293 | extern struct sk_buff *hycapi_tx_capiget(hysdn_card *card); | 281 | extern struct sk_buff *hycapi_tx_capiget(hysdn_card *card); |
diff --git a/drivers/isdn/hysdn/hysdn_init.c b/drivers/isdn/hysdn/hysdn_init.c index 5cac2bf5f4b0..12c8137b5161 100644 --- a/drivers/isdn/hysdn/hysdn_init.c +++ b/drivers/isdn/hysdn/hysdn_init.c | |||
@@ -34,7 +34,7 @@ MODULE_AUTHOR("Werner Cornelius"); | |||
34 | MODULE_LICENSE("GPL"); | 34 | MODULE_LICENSE("GPL"); |
35 | 35 | ||
36 | static char *hysdn_init_revision = "$Revision: 1.6.6.6 $"; | 36 | static char *hysdn_init_revision = "$Revision: 1.6.6.6 $"; |
37 | int cardmax; /* number of found cards */ | 37 | static int cardmax; /* number of found cards */ |
38 | hysdn_card *card_root = NULL; /* pointer to first card */ | 38 | hysdn_card *card_root = NULL; /* pointer to first card */ |
39 | 39 | ||
40 | /**********************************************/ | 40 | /**********************************************/ |
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c index 8ef2b7c952a6..4d57011c5737 100644 --- a/drivers/isdn/hysdn/hysdn_proclog.c +++ b/drivers/isdn/hysdn/hysdn_proclog.c | |||
@@ -22,6 +22,8 @@ | |||
22 | /* the proc subdir for the interface is defined in the procconf module */ | 22 | /* the proc subdir for the interface is defined in the procconf module */ |
23 | extern struct proc_dir_entry *hysdn_proc_entry; | 23 | extern struct proc_dir_entry *hysdn_proc_entry; |
24 | 24 | ||
25 | static void put_log_buffer(hysdn_card * card, char *cp); | ||
26 | |||
25 | /*************************************************/ | 27 | /*************************************************/ |
26 | /* structure keeping ascii log for device output */ | 28 | /* structure keeping ascii log for device output */ |
27 | /*************************************************/ | 29 | /*************************************************/ |
@@ -93,7 +95,7 @@ hysdn_addlog(hysdn_card * card, char *fmt,...) | |||
93 | /* opened for read got the contents. */ | 95 | /* opened for read got the contents. */ |
94 | /* Flushes buffers not longer in use. */ | 96 | /* Flushes buffers not longer in use. */ |
95 | /********************************************/ | 97 | /********************************************/ |
96 | void | 98 | static void |
97 | put_log_buffer(hysdn_card * card, char *cp) | 99 | put_log_buffer(hysdn_card * card, char *cp) |
98 | { | 100 | { |
99 | struct log_data *ib; | 101 | struct log_data *ib; |
diff --git a/drivers/macintosh/Makefile b/drivers/macintosh/Makefile index f5ae171dbfef..236291bd48a4 100644 --- a/drivers/macintosh/Makefile +++ b/drivers/macintosh/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | # Each configuration option enables a list of files. | 5 | # Each configuration option enables a list of files. |
6 | 6 | ||
7 | obj-$(CONFIG_PPC_PMAC) += macio_asic.o | 7 | obj-$(CONFIG_PPC_PMAC) += macio_asic.o macio_sysfs.o |
8 | 8 | ||
9 | obj-$(CONFIG_PMAC_MEDIABAY) += mediabay.o | 9 | obj-$(CONFIG_PMAC_MEDIABAY) += mediabay.o |
10 | obj-$(CONFIG_MAC_EMUMOUSEBTN) += mac_hid.o | 10 | obj-$(CONFIG_MAC_EMUMOUSEBTN) += mac_hid.o |
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index d0bda7e3e6aa..1ee003346923 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c | |||
@@ -33,7 +33,7 @@ static int macio_bus_match(struct device *dev, struct device_driver *drv) | |||
33 | { | 33 | { |
34 | struct macio_dev * macio_dev = to_macio_device(dev); | 34 | struct macio_dev * macio_dev = to_macio_device(dev); |
35 | struct macio_driver * macio_drv = to_macio_driver(drv); | 35 | struct macio_driver * macio_drv = to_macio_driver(drv); |
36 | const struct of_match * matches = macio_drv->match_table; | 36 | const struct of_device_id * matches = macio_drv->match_table; |
37 | 37 | ||
38 | if (!matches) | 38 | if (!matches) |
39 | return 0; | 39 | return 0; |
@@ -66,7 +66,7 @@ static int macio_device_probe(struct device *dev) | |||
66 | int error = -ENODEV; | 66 | int error = -ENODEV; |
67 | struct macio_driver *drv; | 67 | struct macio_driver *drv; |
68 | struct macio_dev *macio_dev; | 68 | struct macio_dev *macio_dev; |
69 | const struct of_match *match; | 69 | const struct of_device_id *match; |
70 | 70 | ||
71 | drv = to_macio_driver(dev->driver); | 71 | drv = to_macio_driver(dev->driver); |
72 | macio_dev = to_macio_device(dev); | 72 | macio_dev = to_macio_device(dev); |
@@ -126,11 +126,85 @@ static int macio_device_resume(struct device * dev) | |||
126 | return 0; | 126 | return 0; |
127 | } | 127 | } |
128 | 128 | ||
129 | static int macio_hotplug (struct device *dev, char **envp, int num_envp, | ||
130 | char *buffer, int buffer_size) | ||
131 | { | ||
132 | struct macio_dev * macio_dev; | ||
133 | struct of_device * of; | ||
134 | char *scratch, *compat; | ||
135 | int i = 0; | ||
136 | int length = 0; | ||
137 | int cplen, seen = 0; | ||
138 | |||
139 | if (!dev) | ||
140 | return -ENODEV; | ||
141 | |||
142 | macio_dev = to_macio_device(dev); | ||
143 | if (!macio_dev) | ||
144 | return -ENODEV; | ||
145 | |||
146 | of = &macio_dev->ofdev; | ||
147 | scratch = buffer; | ||
148 | |||
149 | /* stuff we want to pass to /sbin/hotplug */ | ||
150 | envp[i++] = scratch; | ||
151 | length += scnprintf (scratch, buffer_size - length, "OF_NAME=%s", | ||
152 | of->node->name); | ||
153 | if ((buffer_size - length <= 0) || (i >= num_envp)) | ||
154 | return -ENOMEM; | ||
155 | ++length; | ||
156 | scratch += length; | ||
157 | |||
158 | envp[i++] = scratch; | ||
159 | length += scnprintf (scratch, buffer_size - length, "OF_TYPE=%s", | ||
160 | of->node->type); | ||
161 | if ((buffer_size - length <= 0) || (i >= num_envp)) | ||
162 | return -ENOMEM; | ||
163 | ++length; | ||
164 | scratch += length; | ||
165 | |||
166 | /* Since the compatible field can contain pretty much anything | ||
167 | * it's not really legal to split it out with commas. We split it | ||
168 | * up using a number of environment variables instead. */ | ||
169 | |||
170 | compat = (char *) get_property(of->node, "compatible", &cplen); | ||
171 | while (compat && cplen > 0) { | ||
172 | int l; | ||
173 | envp[i++] = scratch; | ||
174 | length += scnprintf (scratch, buffer_size - length, | ||
175 | "OF_COMPATIBLE_%d=%s", seen, compat); | ||
176 | if ((buffer_size - length <= 0) || (i >= num_envp)) | ||
177 | return -ENOMEM; | ||
178 | length++; | ||
179 | scratch += length; | ||
180 | l = strlen (compat) + 1; | ||
181 | compat += l; | ||
182 | cplen -= l; | ||
183 | seen++; | ||
184 | } | ||
185 | |||
186 | envp[i++] = scratch; | ||
187 | length += scnprintf (scratch, buffer_size - length, | ||
188 | "OF_COMPATIBLE_N=%d", seen); | ||
189 | if ((buffer_size - length <= 0) || (i >= num_envp)) | ||
190 | return -ENOMEM; | ||
191 | ++length; | ||
192 | scratch += length; | ||
193 | |||
194 | envp[i] = NULL; | ||
195 | |||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | extern struct device_attribute macio_dev_attrs[]; | ||
200 | |||
129 | struct bus_type macio_bus_type = { | 201 | struct bus_type macio_bus_type = { |
130 | .name = "macio", | 202 | .name = "macio", |
131 | .match = macio_bus_match, | 203 | .match = macio_bus_match, |
204 | .hotplug = macio_hotplug, | ||
132 | .suspend = macio_device_suspend, | 205 | .suspend = macio_device_suspend, |
133 | .resume = macio_device_resume, | 206 | .resume = macio_device_resume, |
207 | .dev_attrs = macio_dev_attrs, | ||
134 | }; | 208 | }; |
135 | 209 | ||
136 | static int __init macio_bus_driver_init(void) | 210 | static int __init macio_bus_driver_init(void) |
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c new file mode 100644 index 000000000000..97d22bb4516a --- /dev/null +++ b/drivers/macintosh/macio_sysfs.c | |||
@@ -0,0 +1,50 @@ | |||
1 | #include <linux/config.h> | ||
2 | #include <linux/kernel.h> | ||
3 | #include <linux/stat.h> | ||
4 | #include <asm/macio.h> | ||
5 | |||
6 | |||
7 | #define macio_config_of_attr(field, format_string) \ | ||
8 | static ssize_t \ | ||
9 | field##_show (struct device *dev, struct device_attribute *attr, \ | ||
10 | char *buf) \ | ||
11 | { \ | ||
12 | struct macio_dev *mdev = to_macio_device (dev); \ | ||
13 | return sprintf (buf, format_string, mdev->ofdev.node->field); \ | ||
14 | } | ||
15 | |||
16 | static ssize_t | ||
17 | compatible_show (struct device *dev, struct device_attribute *attr, char *buf) | ||
18 | { | ||
19 | struct of_device *of; | ||
20 | char *compat; | ||
21 | int cplen; | ||
22 | int length = 0; | ||
23 | |||
24 | of = &to_macio_device (dev)->ofdev; | ||
25 | compat = (char *) get_property(of->node, "compatible", &cplen); | ||
26 | if (!compat) { | ||
27 | *buf = '\0'; | ||
28 | return 0; | ||
29 | } | ||
30 | while (cplen > 0) { | ||
31 | int l; | ||
32 | length += sprintf (buf, "%s\n", compat); | ||
33 | buf += length; | ||
34 | l = strlen (compat) + 1; | ||
35 | compat += l; | ||
36 | cplen -= l; | ||
37 | } | ||
38 | |||
39 | return length; | ||
40 | } | ||
41 | |||
42 | macio_config_of_attr (name, "%s\n"); | ||
43 | macio_config_of_attr (type, "%s\n"); | ||
44 | |||
45 | struct device_attribute macio_dev_attrs[] = { | ||
46 | __ATTR_RO(name), | ||
47 | __ATTR_RO(type), | ||
48 | __ATTR_RO(compatible), | ||
49 | __ATTR_NULL | ||
50 | }; | ||
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index 4be709e13eec..7c16c25fc5d4 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c | |||
@@ -642,7 +642,7 @@ static int __pmac media_bay_task(void *x) | |||
642 | } | 642 | } |
643 | } | 643 | } |
644 | 644 | ||
645 | static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_match *match) | 645 | static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_device_id *match) |
646 | { | 646 | { |
647 | struct media_bay_info* bay; | 647 | struct media_bay_info* bay; |
648 | u32 __iomem *regbase; | 648 | u32 __iomem *regbase; |
@@ -797,23 +797,20 @@ static struct mb_ops keylargo_mb_ops __pmacdata = { | |||
797 | * Therefore we do it all by polling the media bay once each tick. | 797 | * Therefore we do it all by polling the media bay once each tick. |
798 | */ | 798 | */ |
799 | 799 | ||
800 | static struct of_match media_bay_match[] = | 800 | static struct of_device_id media_bay_match[] = |
801 | { | 801 | { |
802 | { | 802 | { |
803 | .name = "media-bay", | 803 | .name = "media-bay", |
804 | .type = OF_ANY_MATCH, | ||
805 | .compatible = "keylargo-media-bay", | 804 | .compatible = "keylargo-media-bay", |
806 | .data = &keylargo_mb_ops, | 805 | .data = &keylargo_mb_ops, |
807 | }, | 806 | }, |
808 | { | 807 | { |
809 | .name = "media-bay", | 808 | .name = "media-bay", |
810 | .type = OF_ANY_MATCH, | ||
811 | .compatible = "heathrow-media-bay", | 809 | .compatible = "heathrow-media-bay", |
812 | .data = &heathrow_mb_ops, | 810 | .data = &heathrow_mb_ops, |
813 | }, | 811 | }, |
814 | { | 812 | { |
815 | .name = "media-bay", | 813 | .name = "media-bay", |
816 | .type = OF_ANY_MATCH, | ||
817 | .compatible = "ohare-media-bay", | 814 | .compatible = "ohare-media-bay", |
818 | .data = &ohare_mb_ops, | 815 | .data = &ohare_mb_ops, |
819 | }, | 816 | }, |
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index feb4e2413858..703e31973314 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c | |||
@@ -120,6 +120,7 @@ | |||
120 | #include <asm/system.h> | 120 | #include <asm/system.h> |
121 | #include <asm/sections.h> | 121 | #include <asm/sections.h> |
122 | #include <asm/of_device.h> | 122 | #include <asm/of_device.h> |
123 | #include <asm/macio.h> | ||
123 | 124 | ||
124 | #include "therm_pm72.h" | 125 | #include "therm_pm72.h" |
125 | 126 | ||
@@ -1986,7 +1987,7 @@ static void fcu_lookup_fans(struct device_node *fcu_node) | |||
1986 | } | 1987 | } |
1987 | } | 1988 | } |
1988 | 1989 | ||
1989 | static int fcu_of_probe(struct of_device* dev, const struct of_match *match) | 1990 | static int fcu_of_probe(struct of_device* dev, const struct of_device_id *match) |
1990 | { | 1991 | { |
1991 | int rc; | 1992 | int rc; |
1992 | 1993 | ||
@@ -2009,12 +2010,10 @@ static int fcu_of_remove(struct of_device* dev) | |||
2009 | return 0; | 2010 | return 0; |
2010 | } | 2011 | } |
2011 | 2012 | ||
2012 | static struct of_match fcu_of_match[] = | 2013 | static struct of_device_id fcu_match[] = |
2013 | { | 2014 | { |
2014 | { | 2015 | { |
2015 | .name = OF_ANY_MATCH, | ||
2016 | .type = "fcu", | 2016 | .type = "fcu", |
2017 | .compatible = OF_ANY_MATCH | ||
2018 | }, | 2017 | }, |
2019 | {}, | 2018 | {}, |
2020 | }; | 2019 | }; |
@@ -2022,7 +2021,7 @@ static struct of_match fcu_of_match[] = | |||
2022 | static struct of_platform_driver fcu_of_platform_driver = | 2021 | static struct of_platform_driver fcu_of_platform_driver = |
2023 | { | 2022 | { |
2024 | .name = "temperature", | 2023 | .name = "temperature", |
2025 | .match_table = fcu_of_match, | 2024 | .match_table = fcu_match, |
2026 | .probe = fcu_of_probe, | 2025 | .probe = fcu_of_probe, |
2027 | .remove = fcu_of_remove | 2026 | .remove = fcu_of_remove |
2028 | }; | 2027 | }; |
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index 61400f04015e..cbb72eb0426d 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <asm/system.h> | 43 | #include <asm/system.h> |
44 | #include <asm/sections.h> | 44 | #include <asm/sections.h> |
45 | #include <asm/of_device.h> | 45 | #include <asm/of_device.h> |
46 | #include <asm/macio.h> | ||
46 | 47 | ||
47 | #define LOG_TEMP 0 /* continously log temperature */ | 48 | #define LOG_TEMP 0 /* continously log temperature */ |
48 | 49 | ||
@@ -450,7 +451,7 @@ do_probe( struct i2c_adapter *adapter, int addr, int kind ) | |||
450 | /************************************************************************/ | 451 | /************************************************************************/ |
451 | 452 | ||
452 | static int | 453 | static int |
453 | therm_of_probe( struct of_device *dev, const struct of_match *match ) | 454 | therm_of_probe( struct of_device *dev, const struct of_device_id *match ) |
454 | { | 455 | { |
455 | return i2c_add_driver( &g4fan_driver ); | 456 | return i2c_add_driver( &g4fan_driver ); |
456 | } | 457 | } |
@@ -461,9 +462,8 @@ therm_of_remove( struct of_device *dev ) | |||
461 | return i2c_del_driver( &g4fan_driver ); | 462 | return i2c_del_driver( &g4fan_driver ); |
462 | } | 463 | } |
463 | 464 | ||
464 | static struct of_match therm_of_match[] = {{ | 465 | static struct of_device_id therm_of_match[] = {{ |
465 | .name = "fan", | 466 | .name = "fan", |
466 | .type = OF_ANY_MATCH, | ||
467 | .compatible = "adm1030" | 467 | .compatible = "adm1030" |
468 | }, {} | 468 | }, {} |
469 | }; | 469 | }; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 3802f7a17f16..4a0c57db2b67 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -338,6 +338,7 @@ static int super_written(struct bio *bio, unsigned int bytes_done, int error) | |||
338 | 338 | ||
339 | if (atomic_dec_and_test(&rdev->mddev->pending_writes)) | 339 | if (atomic_dec_and_test(&rdev->mddev->pending_writes)) |
340 | wake_up(&rdev->mddev->sb_wait); | 340 | wake_up(&rdev->mddev->sb_wait); |
341 | bio_put(bio); | ||
341 | return 0; | 342 | return 0; |
342 | } | 343 | } |
343 | 344 | ||
diff --git a/drivers/media/dvb/frontends/tda80xx.c b/drivers/media/dvb/frontends/tda80xx.c index 032d348dafb7..88e125079ca1 100644 --- a/drivers/media/dvb/frontends/tda80xx.c +++ b/drivers/media/dvb/frontends/tda80xx.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/threads.h> | 28 | #include <linux/threads.h> |
29 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
30 | #include <linux/irq.h> | ||
31 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
32 | #include <linux/module.h> | 31 | #include <linux/module.h> |
33 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 2dc906fdfa55..810e7aac0a53 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -7,8 +7,7 @@ bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ | |||
7 | zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o | 7 | zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o |
8 | zr36067-objs := zoran_procfs.o zoran_device.o \ | 8 | zr36067-objs := zoran_procfs.o zoran_device.o \ |
9 | zoran_driver.o zoran_card.o | 9 | zoran_driver.o zoran_card.o |
10 | tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o | 10 | tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o |
11 | |||
12 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o | 11 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o |
13 | 12 | ||
14 | obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \ | 13 | obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \ |
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 290289a99757..7d62b394c509 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-driver.c,v 1.38 2005/06/10 17:20:24 mchehab Exp $ | 2 | $Id: bttv-driver.c,v 1.40 2005/06/16 21:38:45 nsh Exp $ |
3 | 3 | ||
4 | bttv - Bt848 frame grabber driver | 4 | bttv - Bt848 frame grabber driver |
5 | 5 | ||
@@ -76,6 +76,9 @@ static unsigned int whitecrush_upper = 0xCF; | |||
76 | static unsigned int whitecrush_lower = 0x7F; | 76 | static unsigned int whitecrush_lower = 0x7F; |
77 | static unsigned int vcr_hack = 0; | 77 | static unsigned int vcr_hack = 0; |
78 | static unsigned int irq_iswitch = 0; | 78 | static unsigned int irq_iswitch = 0; |
79 | static unsigned int uv_ratio = 50; | ||
80 | static unsigned int full_luma_range = 0; | ||
81 | static unsigned int coring = 0; | ||
79 | 82 | ||
80 | /* API features (turn on/off stuff for testing) */ | 83 | /* API features (turn on/off stuff for testing) */ |
81 | static unsigned int v4l2 = 1; | 84 | static unsigned int v4l2 = 1; |
@@ -106,6 +109,9 @@ module_param(adc_crush, int, 0444); | |||
106 | module_param(whitecrush_upper, int, 0444); | 109 | module_param(whitecrush_upper, int, 0444); |
107 | module_param(whitecrush_lower, int, 0444); | 110 | module_param(whitecrush_lower, int, 0444); |
108 | module_param(vcr_hack, int, 0444); | 111 | module_param(vcr_hack, int, 0444); |
112 | module_param(uv_ratio, int, 0444); | ||
113 | module_param(full_luma_range, int, 0444); | ||
114 | module_param(coring, int, 0444); | ||
109 | 115 | ||
110 | module_param_array(radio, int, NULL, 0444); | 116 | module_param_array(radio, int, NULL, 0444); |
111 | 117 | ||
@@ -124,6 +130,9 @@ MODULE_PARM_DESC(whitecrush_upper,"sets the white crush upper value, default is | |||
124 | MODULE_PARM_DESC(whitecrush_lower,"sets the white crush lower value, default is 127"); | 130 | MODULE_PARM_DESC(whitecrush_lower,"sets the white crush lower value, default is 127"); |
125 | MODULE_PARM_DESC(vcr_hack,"enables the VCR hack (improves synch on poor VCR tapes), default is 0 (no)"); | 131 | MODULE_PARM_DESC(vcr_hack,"enables the VCR hack (improves synch on poor VCR tapes), default is 0 (no)"); |
126 | MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler"); | 132 | MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler"); |
133 | MODULE_PARM_DESC(uv_ratio,"ratio between u and v gains, default is 50"); | ||
134 | MODULE_PARM_DESC(full_luma_range,"use the full luma range, default is 0 (no)"); | ||
135 | MODULE_PARM_DESC(coring,"set the luma coring level, default is 0 (no)"); | ||
127 | 136 | ||
128 | MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); | 137 | MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); |
129 | MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); | 138 | MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); |
@@ -484,7 +493,10 @@ static const unsigned int BTTV_FORMATS = ARRAY_SIZE(bttv_formats); | |||
484 | #define V4L2_CID_PRIVATE_VCR_HACK (V4L2_CID_PRIVATE_BASE + 5) | 493 | #define V4L2_CID_PRIVATE_VCR_HACK (V4L2_CID_PRIVATE_BASE + 5) |
485 | #define V4L2_CID_PRIVATE_WHITECRUSH_UPPER (V4L2_CID_PRIVATE_BASE + 6) | 494 | #define V4L2_CID_PRIVATE_WHITECRUSH_UPPER (V4L2_CID_PRIVATE_BASE + 6) |
486 | #define V4L2_CID_PRIVATE_WHITECRUSH_LOWER (V4L2_CID_PRIVATE_BASE + 7) | 495 | #define V4L2_CID_PRIVATE_WHITECRUSH_LOWER (V4L2_CID_PRIVATE_BASE + 7) |
487 | #define V4L2_CID_PRIVATE_LASTP1 (V4L2_CID_PRIVATE_BASE + 8) | 496 | #define V4L2_CID_PRIVATE_UV_RATIO (V4L2_CID_PRIVATE_BASE + 8) |
497 | #define V4L2_CID_PRIVATE_FULL_LUMA_RANGE (V4L2_CID_PRIVATE_BASE + 9) | ||
498 | #define V4L2_CID_PRIVATE_CORING (V4L2_CID_PRIVATE_BASE + 10) | ||
499 | #define V4L2_CID_PRIVATE_LASTP1 (V4L2_CID_PRIVATE_BASE + 11) | ||
488 | 500 | ||
489 | static const struct v4l2_queryctrl no_ctl = { | 501 | static const struct v4l2_queryctrl no_ctl = { |
490 | .name = "42", | 502 | .name = "42", |
@@ -618,8 +630,32 @@ static const struct v4l2_queryctrl bttv_ctls[] = { | |||
618 | .step = 1, | 630 | .step = 1, |
619 | .default_value = 0x7F, | 631 | .default_value = 0x7F, |
620 | .type = V4L2_CTRL_TYPE_INTEGER, | 632 | .type = V4L2_CTRL_TYPE_INTEGER, |
633 | },{ | ||
634 | .id = V4L2_CID_PRIVATE_UV_RATIO, | ||
635 | .name = "uv ratio", | ||
636 | .minimum = 0, | ||
637 | .maximum = 100, | ||
638 | .step = 1, | ||
639 | .default_value = 50, | ||
640 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
641 | },{ | ||
642 | .id = V4L2_CID_PRIVATE_FULL_LUMA_RANGE, | ||
643 | .name = "full luma range", | ||
644 | .minimum = 0, | ||
645 | .maximum = 1, | ||
646 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
647 | },{ | ||
648 | .id = V4L2_CID_PRIVATE_CORING, | ||
649 | .name = "coring", | ||
650 | .minimum = 0, | ||
651 | .maximum = 3, | ||
652 | .step = 1, | ||
653 | .default_value = 0, | ||
654 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
621 | } | 655 | } |
622 | 656 | ||
657 | |||
658 | |||
623 | }; | 659 | }; |
624 | static const int BTTV_CTLS = ARRAY_SIZE(bttv_ctls); | 660 | static const int BTTV_CTLS = ARRAY_SIZE(bttv_ctls); |
625 | 661 | ||
@@ -833,8 +869,8 @@ static void bt848_sat(struct bttv *btv, int color) | |||
833 | btv->saturation = color; | 869 | btv->saturation = color; |
834 | 870 | ||
835 | /* 0-511 for the color */ | 871 | /* 0-511 for the color */ |
836 | val_u = color >> 7; | 872 | val_u = ((color * btv->opt_uv_ratio) / 50) >> 7; |
837 | val_v = ((color>>7)*180L)/254; | 873 | val_v = (((color * (100 - btv->opt_uv_ratio) / 50) >>7)*180L)/254; |
838 | hibits = (val_u >> 7) & 2; | 874 | hibits = (val_u >> 7) & 2; |
839 | hibits |= (val_v >> 8) & 1; | 875 | hibits |= (val_v >> 8) & 1; |
840 | btwrite(val_u & 0xff, BT848_SAT_U_LO); | 876 | btwrite(val_u & 0xff, BT848_SAT_U_LO); |
@@ -1151,6 +1187,15 @@ static int get_control(struct bttv *btv, struct v4l2_control *c) | |||
1151 | case V4L2_CID_PRIVATE_WHITECRUSH_LOWER: | 1187 | case V4L2_CID_PRIVATE_WHITECRUSH_LOWER: |
1152 | c->value = btv->opt_whitecrush_lower; | 1188 | c->value = btv->opt_whitecrush_lower; |
1153 | break; | 1189 | break; |
1190 | case V4L2_CID_PRIVATE_UV_RATIO: | ||
1191 | c->value = btv->opt_uv_ratio; | ||
1192 | break; | ||
1193 | case V4L2_CID_PRIVATE_FULL_LUMA_RANGE: | ||
1194 | c->value = btv->opt_full_luma_range; | ||
1195 | break; | ||
1196 | case V4L2_CID_PRIVATE_CORING: | ||
1197 | c->value = btv->opt_coring; | ||
1198 | break; | ||
1154 | default: | 1199 | default: |
1155 | return -EINVAL; | 1200 | return -EINVAL; |
1156 | } | 1201 | } |
@@ -1247,6 +1292,18 @@ static int set_control(struct bttv *btv, struct v4l2_control *c) | |||
1247 | btv->opt_whitecrush_lower = c->value; | 1292 | btv->opt_whitecrush_lower = c->value; |
1248 | btwrite(c->value, BT848_WC_DOWN); | 1293 | btwrite(c->value, BT848_WC_DOWN); |
1249 | break; | 1294 | break; |
1295 | case V4L2_CID_PRIVATE_UV_RATIO: | ||
1296 | btv->opt_uv_ratio = c->value; | ||
1297 | bt848_sat(btv, btv->saturation); | ||
1298 | break; | ||
1299 | case V4L2_CID_PRIVATE_FULL_LUMA_RANGE: | ||
1300 | btv->opt_full_luma_range = c->value; | ||
1301 | btaor((c->value<<7), ~BT848_OFORM_RANGE, BT848_OFORM); | ||
1302 | break; | ||
1303 | case V4L2_CID_PRIVATE_CORING: | ||
1304 | btv->opt_coring = c->value; | ||
1305 | btaor((c->value<<5), ~BT848_OFORM_CORE32, BT848_OFORM); | ||
1306 | break; | ||
1250 | default: | 1307 | default: |
1251 | return -EINVAL; | 1308 | return -EINVAL; |
1252 | } | 1309 | } |
@@ -3117,11 +3174,6 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
3117 | return -EINVAL; | 3174 | return -EINVAL; |
3118 | memset(v,0,sizeof(*v)); | 3175 | memset(v,0,sizeof(*v)); |
3119 | strcpy(v->name, "Radio"); | 3176 | strcpy(v->name, "Radio"); |
3120 | /* japan: 76.0 MHz - 89.9 MHz | ||
3121 | western europe: 87.5 MHz - 108.0 MHz | ||
3122 | russia: 65.0 MHz - 108.0 MHz */ | ||
3123 | v->rangelow=(int)(65*16); | ||
3124 | v->rangehigh=(int)(108*16); | ||
3125 | bttv_call_i2c_clients(btv,cmd,v); | 3177 | bttv_call_i2c_clients(btv,cmd,v); |
3126 | return 0; | 3178 | return 0; |
3127 | } | 3179 | } |
@@ -3876,6 +3928,9 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
3876 | btv->opt_vcr_hack = vcr_hack; | 3928 | btv->opt_vcr_hack = vcr_hack; |
3877 | btv->opt_whitecrush_upper = whitecrush_upper; | 3929 | btv->opt_whitecrush_upper = whitecrush_upper; |
3878 | btv->opt_whitecrush_lower = whitecrush_lower; | 3930 | btv->opt_whitecrush_lower = whitecrush_lower; |
3931 | btv->opt_uv_ratio = uv_ratio; | ||
3932 | btv->opt_full_luma_range = full_luma_range; | ||
3933 | btv->opt_coring = coring; | ||
3879 | 3934 | ||
3880 | /* fill struct bttv with some useful defaults */ | 3935 | /* fill struct bttv with some useful defaults */ |
3881 | btv->init.btv = btv; | 3936 | btv->init.btv = btv; |
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h index 7b6f1e856028..f3293e4a15ad 100644 --- a/drivers/media/video/bttvp.h +++ b/drivers/media/video/bttvp.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttvp.h,v 1.17 2005/02/16 12:14:10 kraxel Exp $ | 2 | $Id: bttvp.h,v 1.19 2005/06/16 21:38:45 nsh Exp $ |
3 | 3 | ||
4 | bttv - Bt848 frame grabber driver | 4 | bttv - Bt848 frame grabber driver |
5 | 5 | ||
@@ -326,6 +326,9 @@ struct bttv { | |||
326 | int opt_vcr_hack; | 326 | int opt_vcr_hack; |
327 | int opt_whitecrush_upper; | 327 | int opt_whitecrush_upper; |
328 | int opt_whitecrush_lower; | 328 | int opt_whitecrush_lower; |
329 | int opt_uv_ratio; | ||
330 | int opt_full_luma_range; | ||
331 | int opt_coring; | ||
329 | 332 | ||
330 | /* radio data/state */ | 333 | /* radio data/state */ |
331 | int has_radio; | 334 | int has_radio; |
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c index 95ad17b7f38e..9c005cb128d7 100644 --- a/drivers/media/video/mt20xx.c +++ b/drivers/media/video/mt20xx.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: mt20xx.c,v 1.4 2005/03/04 09:24:56 kraxel Exp $ | 2 | * $Id: mt20xx.c,v 1.5 2005/06/16 08:29:49 nsh Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * controls microtune tuners, mt2032 + mt2050 at the moment. | 5 | * controls microtune tuners, mt2032 + mt2050 at the moment. |
@@ -295,8 +295,8 @@ static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
295 | int if2 = t->radio_if2; | 295 | int if2 = t->radio_if2; |
296 | 296 | ||
297 | // per Manual for FM tuning: first if center freq. 1085 MHz | 297 | // per Manual for FM tuning: first if center freq. 1085 MHz |
298 | mt2032_set_if_freq(c, freq*62500 /* freq*1000*1000/16 */, | 298 | mt2032_set_if_freq(c, freq * 1000 / 16, |
299 | 1085*1000*1000,if2,if2,if2); | 299 | 1085*1000*1000,if2,if2,if2); |
300 | } | 300 | } |
301 | 301 | ||
302 | // Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001 | 302 | // Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001 |
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index b27cc348d95c..f59d4601cc63 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tda8290.c,v 1.7 2005/03/07 12:01:51 kraxel Exp $ | 2 | * $Id: tda8290.c,v 1.11 2005/06/18 06:09:06 nsh Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * controls the philips tda8290+75 tuner chip combo. | 5 | * controls the philips tda8290+75 tuner chip combo. |
@@ -69,7 +69,7 @@ static __u8 get_freq_entry( struct freq_entry* table, __u16 freq) | |||
69 | static unsigned char i2c_enable_bridge[2] = { 0x21, 0xC0 }; | 69 | static unsigned char i2c_enable_bridge[2] = { 0x21, 0xC0 }; |
70 | static unsigned char i2c_disable_bridge[2] = { 0x21, 0x80 }; | 70 | static unsigned char i2c_disable_bridge[2] = { 0x21, 0x80 }; |
71 | static unsigned char i2c_init_tda8275[14] = { 0x00, 0x00, 0x00, 0x00, | 71 | static unsigned char i2c_init_tda8275[14] = { 0x00, 0x00, 0x00, 0x00, |
72 | 0x7C, 0x04, 0xA3, 0x3F, | 72 | 0xfC, 0x04, 0xA3, 0x3F, |
73 | 0x2A, 0x04, 0xFF, 0x00, | 73 | 0x2A, 0x04, 0xFF, 0x00, |
74 | 0x00, 0x40 }; | 74 | 0x00, 0x40 }; |
75 | static unsigned char i2c_set_VS[2] = { 0x30, 0x6F }; | 75 | static unsigned char i2c_set_VS[2] = { 0x30, 0x6F }; |
@@ -138,16 +138,24 @@ static int tda8290_tune(struct i2c_client *c) | |||
138 | 138 | ||
139 | static void set_frequency(struct tuner *t, u16 ifc) | 139 | static void set_frequency(struct tuner *t, u16 ifc) |
140 | { | 140 | { |
141 | u32 N = (((t->freq<<3)+ifc)&0x3fffc); | 141 | u32 freq; |
142 | u32 N; | ||
142 | 143 | ||
143 | N = N >> get_freq_entry(div_table, t->freq); | 144 | if (t->mode == V4L2_TUNER_RADIO) |
145 | freq = t->freq / 1000; | ||
146 | else | ||
147 | freq = t->freq; | ||
148 | |||
149 | N = (((freq<<3)+ifc)&0x3fffc); | ||
150 | |||
151 | N = N >> get_freq_entry(div_table, freq); | ||
144 | t->i2c_set_freq[0] = 0; | 152 | t->i2c_set_freq[0] = 0; |
145 | t->i2c_set_freq[1] = (unsigned char)(N>>8); | 153 | t->i2c_set_freq[1] = (unsigned char)(N>>8); |
146 | t->i2c_set_freq[2] = (unsigned char) N; | 154 | t->i2c_set_freq[2] = (unsigned char) N; |
147 | t->i2c_set_freq[3] = 0x40; | 155 | t->i2c_set_freq[3] = 0x40; |
148 | t->i2c_set_freq[4] = 0x52; | 156 | t->i2c_set_freq[4] = 0x52; |
149 | t->i2c_set_freq[5] = get_freq_entry(band_table, t->freq); | 157 | t->i2c_set_freq[5] = get_freq_entry(band_table, freq); |
150 | t->i2c_set_freq[6] = get_freq_entry(agc_table, t->freq); | 158 | t->i2c_set_freq[6] = get_freq_entry(agc_table, freq); |
151 | t->i2c_set_freq[7] = 0x8f; | 159 | t->i2c_set_freq[7] = 0x8f; |
152 | } | 160 | } |
153 | 161 | ||
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 39773633cc3c..ee35562f4d1a 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
@@ -368,7 +368,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) | |||
368 | if (t->radio_mode == V4L2_TUNER_MODE_MONO) | 368 | if (t->radio_mode == V4L2_TUNER_MODE_MONO) |
369 | norm = &radio_mono; | 369 | norm = &radio_mono; |
370 | else | 370 | else |
371 | norm = &radio_stereo; | 371 | norm = &radio_stereo; |
372 | } else { | 372 | } else { |
373 | for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { | 373 | for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { |
374 | if (tvnorms[i].std & t->std) { | 374 | if (tvnorms[i].std & t->std) { |
@@ -566,7 +566,6 @@ static int tda9887_configure(struct tda9887 *t) | |||
566 | if (UNSET != t->pinnacle_id) { | 566 | if (UNSET != t->pinnacle_id) { |
567 | tda9887_set_pinnacle(t,buf); | 567 | tda9887_set_pinnacle(t,buf); |
568 | } | 568 | } |
569 | |||
570 | tda9887_set_config(t,buf); | 569 | tda9887_set_config(t,buf); |
571 | tda9887_set_insmod(t,buf); | 570 | tda9887_set_insmod(t,buf); |
572 | 571 | ||
@@ -615,8 +614,8 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind) | |||
615 | t->pinnacle_id = UNSET; | 614 | t->pinnacle_id = UNSET; |
616 | t->radio_mode = V4L2_TUNER_MODE_STEREO; | 615 | t->radio_mode = V4L2_TUNER_MODE_STEREO; |
617 | 616 | ||
618 | i2c_set_clientdata(&t->client, t); | 617 | i2c_set_clientdata(&t->client, t); |
619 | i2c_attach_client(&t->client); | 618 | i2c_attach_client(&t->client); |
620 | 619 | ||
621 | return 0; | 620 | return 0; |
622 | } | 621 | } |
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c new file mode 100644 index 000000000000..a29f08f81f63 --- /dev/null +++ b/drivers/media/video/tea5767.c | |||
@@ -0,0 +1,334 @@ | |||
1 | /* | ||
2 | * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview | ||
3 | * I2C address is allways 0xC0. | ||
4 | * | ||
5 | * $Id: tea5767.c,v 1.11 2005/06/21 15:40:33 mchehab Exp $ | ||
6 | * | ||
7 | * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) | ||
8 | * This code is placed under the terms of the GNU General Public License | ||
9 | * | ||
10 | * tea5767 autodetection thanks to Torsten Seeboth and Atsushi Nakagawa | ||
11 | * from their contributions on DScaler. | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/sched.h> | ||
18 | #include <linux/string.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/errno.h> | ||
22 | #include <linux/slab.h> | ||
23 | #include <linux/videodev.h> | ||
24 | #include <linux/i2c.h> | ||
25 | #include <linux/i2c-algo-bit.h> | ||
26 | |||
27 | #include <media/tuner.h> | ||
28 | |||
29 | /* Declared at tuner-core.c */ | ||
30 | extern unsigned int tuner_debug; | ||
31 | |||
32 | #define PREFIX "TEA5767 " | ||
33 | |||
34 | /*****************************************************************************/ | ||
35 | |||
36 | /****************************** | ||
37 | * Write mode register values * | ||
38 | ******************************/ | ||
39 | |||
40 | /* First register */ | ||
41 | #define TEA5767_MUTE 0x80 /* Mutes output */ | ||
42 | #define TEA5767_SEARCH 0x40 /* Activates station search */ | ||
43 | /* Bits 0-5 for divider MSB */ | ||
44 | |||
45 | /* Second register */ | ||
46 | /* Bits 0-7 for divider LSB */ | ||
47 | |||
48 | /* Third register */ | ||
49 | |||
50 | /* Station search from botton to up */ | ||
51 | #define TEA5767_SEARCH_UP 0x80 | ||
52 | |||
53 | /* Searches with ADC output = 10 */ | ||
54 | #define TEA5767_SRCH_HIGH_LVL 0x60 | ||
55 | |||
56 | /* Searches with ADC output = 10 */ | ||
57 | #define TEA5767_SRCH_MID_LVL 0x40 | ||
58 | |||
59 | /* Searches with ADC output = 5 */ | ||
60 | #define TEA5767_SRCH_LOW_LVL 0x20 | ||
61 | |||
62 | /* if on, div=4*(Frf+Fif)/Fref otherwise, div=4*(Frf-Fif)/Freq) */ | ||
63 | #define TEA5767_HIGH_LO_INJECT 0x10 | ||
64 | |||
65 | /* Disable stereo */ | ||
66 | #define TEA5767_MONO 0x08 | ||
67 | |||
68 | /* Disable right channel and turns to mono */ | ||
69 | #define TEA5767_MUTE_RIGHT 0x04 | ||
70 | |||
71 | /* Disable left channel and turns to mono */ | ||
72 | #define TEA5767_MUTE_LEFT 0x02 | ||
73 | |||
74 | #define TEA5767_PORT1_HIGH 0x01 | ||
75 | |||
76 | /* Forth register */ | ||
77 | #define TEA5767_PORT2_HIGH 0x80 | ||
78 | /* Chips stops working. Only I2C bus remains on */ | ||
79 | #define TEA5767_STDBY 0x40 | ||
80 | |||
81 | /* Japan freq (76-108 MHz. If disabled, 87.5-108 MHz */ | ||
82 | #define TEA5767_JAPAN_BAND 0x20 | ||
83 | |||
84 | /* Unselected means 32.768 KHz freq as reference. Otherwise Xtal at 13 MHz */ | ||
85 | #define TEA5767_XTAL_32768 0x10 | ||
86 | |||
87 | /* Cuts weak signals */ | ||
88 | #define TEA5767_SOFT_MUTE 0x08 | ||
89 | |||
90 | /* Activates high cut control */ | ||
91 | #define TEA5767_HIGH_CUT_CTRL 0x04 | ||
92 | |||
93 | /* Activates stereo noise control */ | ||
94 | #define TEA5767_ST_NOISE_CTL 0x02 | ||
95 | |||
96 | /* If activate PORT 1 indicates SEARCH or else it is used as PORT1 */ | ||
97 | #define TEA5767_SRCH_IND 0x01 | ||
98 | |||
99 | /* Fiveth register */ | ||
100 | |||
101 | /* By activating, it will use Xtal at 13 MHz as reference for divider */ | ||
102 | #define TEA5767_PLLREF_ENABLE 0x80 | ||
103 | |||
104 | /* By activating, deemphasis=50, or else, deemphasis of 50us */ | ||
105 | #define TEA5767_DEEMPH_75 0X40 | ||
106 | |||
107 | /***************************** | ||
108 | * Read mode register values * | ||
109 | *****************************/ | ||
110 | |||
111 | /* First register */ | ||
112 | #define TEA5767_READY_FLAG_MASK 0x80 | ||
113 | #define TEA5767_BAND_LIMIT_MASK 0X40 | ||
114 | /* Bits 0-5 for divider MSB after search or preset */ | ||
115 | |||
116 | /* Second register */ | ||
117 | /* Bits 0-7 for divider LSB after search or preset */ | ||
118 | |||
119 | /* Third register */ | ||
120 | #define TEA5767_STEREO_MASK 0x80 | ||
121 | #define TEA5767_IF_CNTR_MASK 0x7f | ||
122 | |||
123 | /* Four register */ | ||
124 | #define TEA5767_ADC_LEVEL_MASK 0xf0 | ||
125 | |||
126 | /* should be 0 */ | ||
127 | #define TEA5767_CHIP_ID_MASK 0x0f | ||
128 | |||
129 | /* Fiveth register */ | ||
130 | /* Reserved for future extensions */ | ||
131 | #define TEA5767_RESERVED_MASK 0xff | ||
132 | |||
133 | /*****************************************************************************/ | ||
134 | |||
135 | static void set_tv_freq(struct i2c_client *c, unsigned int freq) | ||
136 | { | ||
137 | struct tuner *t = i2c_get_clientdata(c); | ||
138 | |||
139 | tuner_warn("This tuner doesn't support TV freq.\n"); | ||
140 | } | ||
141 | |||
142 | static void tea5767_status_dump(unsigned char *buffer) | ||
143 | { | ||
144 | unsigned int div, frq; | ||
145 | |||
146 | if (TEA5767_READY_FLAG_MASK & buffer[0]) | ||
147 | printk(PREFIX "Ready Flag ON\n"); | ||
148 | else | ||
149 | printk(PREFIX "Ready Flag OFF\n"); | ||
150 | |||
151 | if (TEA5767_BAND_LIMIT_MASK & buffer[0]) | ||
152 | printk(PREFIX "Tuner at band limit\n"); | ||
153 | else | ||
154 | printk(PREFIX "Tuner not at band limit\n"); | ||
155 | |||
156 | div=((buffer[0]&0x3f)<<8) | buffer[1]; | ||
157 | |||
158 | switch (TEA5767_HIGH_LO_32768) { | ||
159 | case TEA5767_HIGH_LO_13MHz: | ||
160 | frq = 1000*(div*50-700-225)/4; /* Freq in KHz */ | ||
161 | break; | ||
162 | case TEA5767_LOW_LO_13MHz: | ||
163 | frq = 1000*(div*50+700+225)/4; /* Freq in KHz */ | ||
164 | break; | ||
165 | case TEA5767_LOW_LO_32768: | ||
166 | frq = 1000*(div*32768/1000+700+225)/4; /* Freq in KHz */ | ||
167 | break; | ||
168 | case TEA5767_HIGH_LO_32768: | ||
169 | default: | ||
170 | frq = 1000*(div*32768/1000-700-225)/4; /* Freq in KHz */ | ||
171 | break; | ||
172 | } | ||
173 | buffer[0] = (div>>8) & 0x3f; | ||
174 | buffer[1] = div & 0xff; | ||
175 | |||
176 | printk(PREFIX "Frequency %d.%03d KHz (divider = 0x%04x)\n", | ||
177 | frq/1000,frq%1000,div); | ||
178 | |||
179 | if (TEA5767_STEREO_MASK & buffer[2]) | ||
180 | printk(PREFIX "Stereo\n"); | ||
181 | else | ||
182 | printk(PREFIX "Mono\n"); | ||
183 | |||
184 | printk(PREFIX "IF Counter = %d\n",buffer[2] & TEA5767_IF_CNTR_MASK); | ||
185 | |||
186 | printk(PREFIX "ADC Level = %d\n",(buffer[3] & TEA5767_ADC_LEVEL_MASK)>>4); | ||
187 | |||
188 | printk(PREFIX "Chip ID = %d\n",(buffer[3] & TEA5767_CHIP_ID_MASK)); | ||
189 | |||
190 | printk(PREFIX "Reserved = 0x%02x\n",(buffer[4] & TEA5767_RESERVED_MASK)); | ||
191 | } | ||
192 | |||
193 | /* Freq should be specifyed at 62.5 Hz */ | ||
194 | static void set_radio_freq(struct i2c_client *c, unsigned int frq) | ||
195 | { | ||
196 | struct tuner *t = i2c_get_clientdata(c); | ||
197 | unsigned char buffer[5]; | ||
198 | unsigned div; | ||
199 | int rc; | ||
200 | |||
201 | if ( tuner_debug ) | ||
202 | printk(PREFIX "radio freq counter %d\n",frq); | ||
203 | |||
204 | /* Rounds freq to next decimal value - for 62.5 KHz step */ | ||
205 | /* frq = 20*(frq/16)+radio_frq[frq%16]; */ | ||
206 | |||
207 | buffer[2] = TEA5767_PORT1_HIGH; | ||
208 | buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND; | ||
209 | buffer[4]=0; | ||
210 | |||
211 | if (t->audmode == V4L2_TUNER_MODE_MONO) { | ||
212 | tuner_dbg("TEA5767 set to mono\n"); | ||
213 | buffer[2] |= TEA5767_MONO; | ||
214 | } else | ||
215 | tuner_dbg("TEA5767 set to stereo\n"); | ||
216 | |||
217 | switch (t->type) { | ||
218 | case TEA5767_HIGH_LO_13MHz: | ||
219 | tuner_dbg("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n"); | ||
220 | buffer[2] |= TEA5767_HIGH_LO_INJECT; | ||
221 | buffer[4] |= TEA5767_PLLREF_ENABLE; | ||
222 | div = (frq*4/16+700+225+25)/50; | ||
223 | break; | ||
224 | case TEA5767_LOW_LO_13MHz: | ||
225 | tuner_dbg("TEA5767 radio LOW LO inject xtal @ 13 MHz\n"); | ||
226 | |||
227 | buffer[4] |= TEA5767_PLLREF_ENABLE; | ||
228 | div = (frq*4/16-700-225+25)/50; | ||
229 | break; | ||
230 | case TEA5767_LOW_LO_32768: | ||
231 | tuner_dbg("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n"); | ||
232 | buffer[3] |= TEA5767_XTAL_32768; | ||
233 | /* const 700=4000*175 Khz - to adjust freq to right value */ | ||
234 | div = (1000*(frq*4/16-700-225)+16384)>>15; | ||
235 | break; | ||
236 | case TEA5767_HIGH_LO_32768: | ||
237 | default: | ||
238 | tuner_dbg("TEA5767 radio HIGH LO inject xtal @ 32,768 MHz\n"); | ||
239 | |||
240 | buffer[2] |= TEA5767_HIGH_LO_INJECT; | ||
241 | buffer[3] |= TEA5767_XTAL_32768; | ||
242 | div = (1000*(frq*4/16+700+225)+16384)>>15; | ||
243 | break; | ||
244 | } | ||
245 | buffer[0] = (div>>8) & 0x3f; | ||
246 | buffer[1] = div & 0xff; | ||
247 | |||
248 | if ( tuner_debug ) | ||
249 | tea5767_status_dump(buffer); | ||
250 | |||
251 | if (5 != (rc = i2c_master_send(c,buffer,5))) | ||
252 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n",rc); | ||
253 | } | ||
254 | |||
255 | static int tea5767_signal(struct i2c_client *c) | ||
256 | { | ||
257 | unsigned char buffer[5]; | ||
258 | int rc; | ||
259 | struct tuner *t = i2c_get_clientdata(c); | ||
260 | |||
261 | memset(buffer,0,sizeof(buffer)); | ||
262 | if (5 != (rc = i2c_master_recv(c,buffer,5))) | ||
263 | tuner_warn ( "i2c i/o error: rc == %d (should be 5)\n",rc); | ||
264 | |||
265 | return ((buffer[3] & TEA5767_ADC_LEVEL_MASK) <<(13-4)); | ||
266 | } | ||
267 | |||
268 | static int tea5767_stereo(struct i2c_client *c) | ||
269 | { | ||
270 | unsigned char buffer[5]; | ||
271 | int rc; | ||
272 | struct tuner *t = i2c_get_clientdata(c); | ||
273 | |||
274 | memset(buffer,0,sizeof(buffer)); | ||
275 | if (5 != (rc = i2c_master_recv(c,buffer,5))) | ||
276 | tuner_warn ( "i2c i/o error: rc == %d (should be 5)\n",rc); | ||
277 | |||
278 | rc = buffer[2] & TEA5767_STEREO_MASK; | ||
279 | |||
280 | if ( tuner_debug ) | ||
281 | tuner_dbg("TEA5767 radio ST GET = %02x\n", rc); | ||
282 | |||
283 | return ( (buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO: 0); | ||
284 | } | ||
285 | |||
286 | int tea_detection(struct i2c_client *c) | ||
287 | { | ||
288 | unsigned char buffer[5]= { 0xff, 0xff, 0xff, 0xff, 0xff }; | ||
289 | int rc; | ||
290 | struct tuner *t = i2c_get_clientdata(c); | ||
291 | |||
292 | if (5 != (rc = i2c_master_recv(c,buffer,5))) { | ||
293 | tuner_warn ( "it is not a TEA5767. Received %i chars.\n",rc ); | ||
294 | return EINVAL; | ||
295 | } | ||
296 | |||
297 | /* If all bytes are the same then it's a TV tuner and not a tea5767 chip. */ | ||
298 | if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && | ||
299 | buffer[0] == buffer[3] && buffer[0] == buffer[4]) { | ||
300 | tuner_warn ( "All bytes are equal. It is not a TEA5767\n" ); | ||
301 | return EINVAL; | ||
302 | } | ||
303 | |||
304 | /* Status bytes: | ||
305 | * Byte 4: bit 3:1 : CI (Chip Identification) == 0 | ||
306 | * bit 0 : internally set to 0 | ||
307 | * Byte 5: bit 7:0 : == 0 | ||
308 | */ | ||
309 | |||
310 | if (!((buffer[3] & 0x0f) == 0x00) && (buffer[4] == 0x00)) { | ||
311 | tuner_warn ( "Chip ID is not zero. It is not a TEA5767\n" ); | ||
312 | return EINVAL; | ||
313 | } | ||
314 | tuner_warn ( "TEA5767 detected.\n" ); | ||
315 | return 0; | ||
316 | } | ||
317 | |||
318 | int tea5767_tuner_init(struct i2c_client *c) | ||
319 | { | ||
320 | struct tuner *t = i2c_get_clientdata(c); | ||
321 | |||
322 | if (tea_detection(c)==EINVAL) return EINVAL; | ||
323 | |||
324 | tuner_info("type set to %d (%s)\n", | ||
325 | t->type, TEA5767_TUNER_NAME); | ||
326 | strlcpy(c->name, TEA5767_TUNER_NAME, sizeof(c->name)); | ||
327 | |||
328 | t->tv_freq = set_tv_freq; | ||
329 | t->radio_freq = set_radio_freq; | ||
330 | t->has_signal = tea5767_signal; | ||
331 | t->is_stereo = tea5767_stereo; | ||
332 | |||
333 | return (0); | ||
334 | } | ||
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index eaabfc858703..6f6bf4a633fc 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tuner-core.c,v 1.15 2005/06/12 01:36:14 mchehab Exp $ | 2 | * $Id: tuner-core.c,v 1.29 2005/06/21 15:40:33 mchehab Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * core core, i.e. kernel interfaces, registering and so on | 5 | * core core, i.e. kernel interfaces, registering and so on |
@@ -26,7 +26,6 @@ | |||
26 | /* | 26 | /* |
27 | * comment line bellow to return to old behavor, where only one I2C device is supported | 27 | * comment line bellow to return to old behavor, where only one I2C device is supported |
28 | */ | 28 | */ |
29 | #define CONFIG_TUNER_MULTI_I2C /**/ | ||
30 | 29 | ||
31 | #define UNSET (-1U) | 30 | #define UNSET (-1U) |
32 | 31 | ||
@@ -58,9 +57,7 @@ MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer"); | |||
58 | MODULE_LICENSE("GPL"); | 57 | MODULE_LICENSE("GPL"); |
59 | 58 | ||
60 | static int this_adap; | 59 | static int this_adap; |
61 | #ifdef CONFIG_TUNER_MULTI_I2C | ||
62 | static unsigned short first_tuner, tv_tuner, radio_tuner; | 60 | static unsigned short first_tuner, tv_tuner, radio_tuner; |
63 | #endif | ||
64 | 61 | ||
65 | static struct i2c_driver driver; | 62 | static struct i2c_driver driver; |
66 | static struct i2c_client client_template; | 63 | static struct i2c_client client_template; |
@@ -81,26 +78,9 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
81 | return; | 78 | return; |
82 | } | 79 | } |
83 | if (freq < tv_range[0]*16 || freq > tv_range[1]*16) { | 80 | if (freq < tv_range[0]*16 || freq > tv_range[1]*16) { |
84 | |||
85 | if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) { | ||
86 | /* V4L2_TUNER_CAP_LOW frequency */ | ||
87 | |||
88 | tuner_dbg("V4L2_TUNER_CAP_LOW freq selected for TV. Tuners yet doesn't support converting it to valid freq.\n"); | ||
89 | |||
90 | t->tv_freq(c,freq>>10); | ||
91 | |||
92 | return; | ||
93 | } else { | ||
94 | /* FIXME: better do that chip-specific, but | ||
95 | right now we don't have that in the config | ||
96 | struct and this way is still better than no | ||
97 | check at all */ | ||
98 | tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n", | 81 | tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n", |
99 | freq/16,freq%16*100/16,tv_range[0],tv_range[1]); | 82 | freq/16,freq%16*100/16,tv_range[0],tv_range[1]); |
100 | return; | ||
101 | } | ||
102 | } | 83 | } |
103 | tuner_dbg("62.5 Khz freq step selected for TV.\n"); | ||
104 | t->tv_freq(c,freq); | 84 | t->tv_freq(c,freq); |
105 | } | 85 | } |
106 | 86 | ||
@@ -116,31 +96,18 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
116 | tuner_info("no radio tuning for this one, sorry.\n"); | 96 | tuner_info("no radio tuning for this one, sorry.\n"); |
117 | return; | 97 | return; |
118 | } | 98 | } |
119 | if (freq < radio_range[0]*16 || freq > radio_range[1]*16) { | 99 | if (freq >= radio_range[0]*16000 && freq <= radio_range[1]*16000) { |
120 | if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) { | 100 | if (tuner_debug) |
121 | /* V4L2_TUNER_CAP_LOW frequency */ | 101 | tuner_info("radio freq step 62.5Hz (%d.%06d)\n", |
122 | if (t->type == TUNER_TEA5767) { | 102 | freq/16000,freq%16000*1000/16); |
123 | tuner_info("radio freq step 62.5Hz (%d.%06d)\n",(freq>>14),freq%(1<<14)*10000); | 103 | t->radio_freq(c,freq); |
124 | t->radio_freq(c,freq>>10); | 104 | } else { |
125 | return; | 105 | tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n", |
126 | } | 106 | freq/16,freq%16*100/16, |
127 | 107 | radio_range[0],radio_range[1]); | |
128 | tuner_dbg("V4L2_TUNER_CAP_LOW freq selected for Radio. Tuners yet doesn't support converting it to valid freq.\n"); | ||
129 | |||
130 | tuner_info("radio freq (%d.%06d)\n",(freq>>14),freq%(1<<14)*10000); | ||
131 | |||
132 | t->radio_freq(c,freq>>10); | ||
133 | return; | ||
134 | |||
135 | } else { | ||
136 | tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n", | ||
137 | freq/16,freq%16*100/16, | ||
138 | radio_range[0],radio_range[1]); | ||
139 | return; | ||
140 | } | ||
141 | } | 108 | } |
142 | tuner_dbg("62.5 Khz freq step selected for Radio.\n"); | 109 | |
143 | t->radio_freq(c,freq); | 110 | return; |
144 | } | 111 | } |
145 | 112 | ||
146 | static void set_freq(struct i2c_client *c, unsigned long freq) | 113 | static void set_freq(struct i2c_client *c, unsigned long freq) |
@@ -166,8 +133,8 @@ static void set_freq(struct i2c_client *c, unsigned long freq) | |||
166 | static void set_type(struct i2c_client *c, unsigned int type) | 133 | static void set_type(struct i2c_client *c, unsigned int type) |
167 | { | 134 | { |
168 | struct tuner *t = i2c_get_clientdata(c); | 135 | struct tuner *t = i2c_get_clientdata(c); |
136 | unsigned char buffer[4]; | ||
169 | 137 | ||
170 | tuner_dbg ("I2C addr 0x%02x with type %d\n",c->addr<<1,type); | ||
171 | /* sanity check */ | 138 | /* sanity check */ |
172 | if (type == UNSET || type == TUNER_ABSENT) | 139 | if (type == UNSET || type == TUNER_ABSENT) |
173 | return; | 140 | return; |
@@ -179,8 +146,8 @@ static void set_type(struct i2c_client *c, unsigned int type) | |||
179 | t->type = type; | 146 | t->type = type; |
180 | return; | 147 | return; |
181 | } | 148 | } |
182 | if (t->initialized) | 149 | if ((t->initialized) && (t->type == type)) |
183 | /* run only once */ | 150 | /* run only once except type change Hac 04/05*/ |
184 | return; | 151 | return; |
185 | 152 | ||
186 | t->initialized = 1; | 153 | t->initialized = 1; |
@@ -193,25 +160,42 @@ static void set_type(struct i2c_client *c, unsigned int type) | |||
193 | case TUNER_PHILIPS_TDA8290: | 160 | case TUNER_PHILIPS_TDA8290: |
194 | tda8290_init(c); | 161 | tda8290_init(c); |
195 | break; | 162 | break; |
163 | case TUNER_TEA5767: | ||
164 | if (tea5767_tuner_init(c)==EINVAL) t->type=TUNER_ABSENT; | ||
165 | break; | ||
166 | case TUNER_PHILIPS_FMD1216ME_MK3: | ||
167 | buffer[0] = 0x0b; | ||
168 | buffer[1] = 0xdc; | ||
169 | buffer[2] = 0x9c; | ||
170 | buffer[3] = 0x60; | ||
171 | i2c_master_send(c,buffer,4); | ||
172 | mdelay(1); | ||
173 | buffer[2] = 0x86; | ||
174 | buffer[3] = 0x54; | ||
175 | i2c_master_send(c,buffer,4); | ||
176 | default_tuner_init(c); | ||
177 | break; | ||
196 | default: | 178 | default: |
179 | /* TEA5767 autodetection code */ | ||
180 | if (tea5767_tuner_init(c)!=EINVAL) { | ||
181 | t->type = TUNER_TEA5767; | ||
182 | if (first_tuner == 0x60) | ||
183 | first_tuner++; | ||
184 | break; | ||
185 | } | ||
186 | |||
197 | default_tuner_init(c); | 187 | default_tuner_init(c); |
198 | break; | 188 | break; |
199 | } | 189 | } |
190 | tuner_dbg ("I2C addr 0x%02x with type %d\n",c->addr<<1,type); | ||
200 | } | 191 | } |
201 | 192 | ||
202 | #ifdef CONFIG_TUNER_MULTI_I2C | ||
203 | #define CHECK_ADDR(tp,cmd,tun) if (client->addr!=tp) { \ | 193 | #define CHECK_ADDR(tp,cmd,tun) if (client->addr!=tp) { \ |
204 | return 0; } else \ | 194 | return 0; } else if (tuner_debug) \ |
205 | tuner_info ("Cmd %s accepted to "tun"\n",cmd); | 195 | tuner_info ("Cmd %s accepted to "tun"\n",cmd); |
206 | #define CHECK_MODE(cmd) if (t->mode == V4L2_TUNER_RADIO) { \ | 196 | #define CHECK_MODE(cmd) if (t->mode == V4L2_TUNER_RADIO) { \ |
207 | CHECK_ADDR(radio_tuner,cmd,"radio") } else \ | 197 | CHECK_ADDR(radio_tuner,cmd,"radio") } else \ |
208 | { CHECK_ADDR(tv_tuner,cmd,"TV"); } | 198 | { CHECK_ADDR(tv_tuner,cmd,"TV"); } |
209 | #else | ||
210 | #define CHECK_ADDR(tp,cmd,tun) tuner_info ("Cmd %s accepted to "tun"\n",cmd); | ||
211 | #define CHECK_MODE(cmd) tuner_info ("Cmd %s accepted\n",cmd); | ||
212 | #endif | ||
213 | |||
214 | #ifdef CONFIG_TUNER_MULTI_I2C | ||
215 | 199 | ||
216 | static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr) | 200 | static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr) |
217 | { | 201 | { |
@@ -242,9 +226,6 @@ static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr) | |||
242 | } | 226 | } |
243 | set_type(c,tun_addr->type); | 227 | set_type(c,tun_addr->type); |
244 | } | 228 | } |
245 | #else | ||
246 | #define set_addr(c,tun_addr) set_type(c,(tun_addr)->type) | ||
247 | #endif | ||
248 | 229 | ||
249 | static char pal[] = "-"; | 230 | static char pal[] = "-"; |
250 | module_param_string(pal, pal, sizeof(pal), 0644); | 231 | module_param_string(pal, pal, sizeof(pal), 0644); |
@@ -284,17 +265,12 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
284 | { | 265 | { |
285 | struct tuner *t; | 266 | struct tuner *t; |
286 | 267 | ||
287 | #ifndef CONFIG_TUNER_MULTI_I2C | ||
288 | if (this_adap > 0) | ||
289 | return -1; | ||
290 | #else | ||
291 | /* by default, first I2C card is both tv and radio tuner */ | 268 | /* by default, first I2C card is both tv and radio tuner */ |
292 | if (this_adap == 0) { | 269 | if (this_adap == 0) { |
293 | first_tuner = addr; | 270 | first_tuner = addr; |
294 | tv_tuner = addr; | 271 | tv_tuner = addr; |
295 | radio_tuner = addr; | 272 | radio_tuner = addr; |
296 | } | 273 | } |
297 | #endif | ||
298 | this_adap++; | 274 | this_adap++; |
299 | 275 | ||
300 | client_template.adapter = adap; | 276 | client_template.adapter = adap; |
@@ -308,6 +284,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
308 | i2c_set_clientdata(&t->i2c, t); | 284 | i2c_set_clientdata(&t->i2c, t); |
309 | t->type = UNSET; | 285 | t->type = UNSET; |
310 | t->radio_if2 = 10700*1000; /* 10.7MHz - FM radio */ | 286 | t->radio_if2 = 10700*1000; /* 10.7MHz - FM radio */ |
287 | t->audmode = V4L2_TUNER_MODE_STEREO; | ||
311 | 288 | ||
312 | i2c_attach_client(&t->i2c); | 289 | i2c_attach_client(&t->i2c); |
313 | tuner_info("chip found @ 0x%x (%s)\n", | 290 | tuner_info("chip found @ 0x%x (%s)\n", |
@@ -325,11 +302,9 @@ static int tuner_probe(struct i2c_adapter *adap) | |||
325 | } | 302 | } |
326 | this_adap = 0; | 303 | this_adap = 0; |
327 | 304 | ||
328 | #ifdef CONFIG_TUNER_MULTI_I2C | ||
329 | first_tuner = 0; | 305 | first_tuner = 0; |
330 | tv_tuner = 0; | 306 | tv_tuner = 0; |
331 | radio_tuner = 0; | 307 | radio_tuner = 0; |
332 | #endif | ||
333 | 308 | ||
334 | if (adap->class & I2C_CLASS_TV_ANALOG) | 309 | if (adap->class & I2C_CLASS_TV_ANALOG) |
335 | return i2c_probe(adap, &addr_data, tuner_attach); | 310 | return i2c_probe(adap, &addr_data, tuner_attach); |
@@ -392,8 +367,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
392 | t->radio_if2 = 41300 * 1000; | 367 | t->radio_if2 = 41300 * 1000; |
393 | break; | 368 | break; |
394 | } | 369 | } |
395 | break; | 370 | break; |
396 | |||
397 | /* --- v4l ioctls --- */ | 371 | /* --- v4l ioctls --- */ |
398 | /* take care: bttv does userspace copying, we'll get a | 372 | /* take care: bttv does userspace copying, we'll get a |
399 | kernel pointer here... */ | 373 | kernel pointer here... */ |
@@ -440,11 +414,18 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
440 | vt->signal = t->has_signal(client); | 414 | vt->signal = t->has_signal(client); |
441 | if (t->is_stereo) { | 415 | if (t->is_stereo) { |
442 | if (t->is_stereo(client)) | 416 | if (t->is_stereo(client)) |
443 | vt-> flags |= VIDEO_TUNER_STEREO_ON; | 417 | vt->flags |= VIDEO_TUNER_STEREO_ON; |
444 | else | 418 | else |
445 | vt-> flags &= 0xffff ^ VIDEO_TUNER_STEREO_ON; | 419 | vt->flags &= ~VIDEO_TUNER_STEREO_ON; |
446 | } | 420 | } |
447 | vt->flags |= V4L2_TUNER_CAP_LOW; /* Allow freqs at 62.5 Hz */ | 421 | vt->flags |= V4L2_TUNER_CAP_LOW; /* Allow freqs at 62.5 Hz */ |
422 | |||
423 | vt->rangelow = radio_range[0] * 16000; | ||
424 | vt->rangehigh = radio_range[1] * 16000; | ||
425 | |||
426 | } else { | ||
427 | vt->rangelow = tv_range[0] * 16; | ||
428 | vt->rangehigh = tv_range[1] * 16; | ||
448 | } | 429 | } |
449 | 430 | ||
450 | return 0; | 431 | return 0; |
@@ -510,20 +491,46 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
510 | tuner -> signal = t->has_signal(client); | 491 | tuner -> signal = t->has_signal(client); |
511 | if (t->is_stereo) { | 492 | if (t->is_stereo) { |
512 | if (t->is_stereo(client)) { | 493 | if (t->is_stereo(client)) { |
513 | tuner -> capability |= V4L2_TUNER_CAP_STEREO; | 494 | tuner -> rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO; |
514 | tuner -> rxsubchans |= V4L2_TUNER_SUB_STEREO; | ||
515 | } else { | 495 | } else { |
516 | tuner -> rxsubchans &= 0xffff ^ V4L2_TUNER_SUB_STEREO; | 496 | tuner -> rxsubchans = V4L2_TUNER_SUB_MONO; |
517 | } | 497 | } |
518 | } | 498 | } |
499 | tuner->capability |= V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; | ||
500 | tuner->audmode = t->audmode; | ||
501 | |||
502 | tuner->rangelow = radio_range[0] * 16000; | ||
503 | tuner->rangehigh = radio_range[1] * 16000; | ||
504 | } else { | ||
505 | tuner->rangelow = tv_range[0] * 16; | ||
506 | tuner->rangehigh = tv_range[1] * 16; | ||
519 | } | 507 | } |
520 | /* Wow to deal with V4L2_TUNER_CAP_LOW ? For now, it accepts from low at 62.5KHz step to high at 62.5 Hz */ | ||
521 | tuner->rangelow = tv_range[0] * 16; | ||
522 | // tuner->rangehigh = tv_range[1] * 16; | ||
523 | // tuner->rangelow = tv_range[0] * 16384; | ||
524 | tuner->rangehigh = tv_range[1] * 16384; | ||
525 | break; | 508 | break; |
526 | } | 509 | } |
510 | case VIDIOC_S_TUNER: /* Allow changing radio range and audio mode */ | ||
511 | { | ||
512 | struct v4l2_tuner *tuner = arg; | ||
513 | |||
514 | CHECK_ADDR(radio_tuner,"VIDIOC_S_TUNER","radio"); | ||
515 | SWITCH_V4L2; | ||
516 | |||
517 | /* To switch the audio mode, applications initialize the | ||
518 | index and audmode fields and the reserved array and | ||
519 | call the VIDIOC_S_TUNER ioctl. */ | ||
520 | /* rxsubchannels: V4L2_TUNER_MODE_MONO, V4L2_TUNER_MODE_STEREO, | ||
521 | V4L2_TUNER_MODE_LANG1, V4L2_TUNER_MODE_LANG2, | ||
522 | V4L2_TUNER_MODE_SAP */ | ||
523 | |||
524 | if (tuner->audmode == V4L2_TUNER_MODE_MONO) | ||
525 | t->audmode = V4L2_TUNER_MODE_MONO; | ||
526 | else | ||
527 | t->audmode = V4L2_TUNER_MODE_STEREO; | ||
528 | |||
529 | set_radio_freq(client, t->freq); | ||
530 | break; | ||
531 | } | ||
532 | case TDA9887_SET_CONFIG: /* Nothing to do on tuner-core */ | ||
533 | break; | ||
527 | default: | 534 | default: |
528 | tuner_dbg ("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd); | 535 | tuner_dbg ("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd); |
529 | /* nothing */ | 536 | /* nothing */ |
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index 539f30557317..c39ed6226ee0 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tuner-simple.c,v 1.21 2005/06/10 19:53:26 nsh Exp $ | 2 | * $Id: tuner-simple.c,v 1.31 2005/06/21 16:02:25 mkrufky Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * controls all those simple 4-control-bytes style tuners. | 5 | * controls all those simple 4-control-bytes style tuners. |
@@ -207,28 +207,27 @@ static struct tunertype tuners[] = { | |||
207 | { "LG PAL (TAPE series)", LGINNOTEK, PAL, | 207 | { "LG PAL (TAPE series)", LGINNOTEK, PAL, |
208 | 16*170.00, 16*450.00, 0x01,0x02,0x08,0xce,623}, | 208 | 16*170.00, 16*450.00, 0x01,0x02,0x08,0xce,623}, |
209 | 209 | ||
210 | { "Philips PAL/SECAM multi (FQ1216AME MK4)", Philips, PAL, | 210 | { "Philips PAL/SECAM multi (FQ1216AME MK4)", Philips, PAL, |
211 | 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 }, | 211 | 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 }, |
212 | { "Philips FQ1236A MK4", Philips, NTSC, | 212 | { "Philips FQ1236A MK4", Philips, NTSC, |
213 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, | 213 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, |
214 | 214 | ||
215 | /* Should work for TVF8531MF, TVF8831MF, TVF8731MF */ | 215 | /* Should work for TVF8531MF, TVF8831MF, TVF8731MF */ |
216 | { "Ymec TVision TVF-8531MF", Philips, NTSC, | 216 | { "Ymec TVision TVF-8531MF", Philips, NTSC, |
217 | 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732}, | 217 | 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732}, |
218 | { "Ymec TVision TVF-5533MF", Philips, NTSC, | 218 | { "Ymec TVision TVF-5533MF", Philips, NTSC, |
219 | 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732}, | 219 | 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732}, |
220 | |||
221 | { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, | 220 | { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, |
222 | 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, | 221 | 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, |
223 | { "Tena TNF9533-D/IF", LGINNOTEK, PAL, | 222 | /* Should work for TNF9533-D/IF, TNF9533-B/DF */ |
224 | 16*160.25, 16*464.25, 0x01,0x02,0x08,0x8e,623}, | 223 | { "Tena TNF9533-D/IF", Philips, PAL, |
224 | 16*160.25,16*464.25,0x01,0x02,0x04,0x8e,623}, | ||
225 | 225 | ||
226 | /* | 226 | /* This entry is for TEA5767 FM radio only chip used on several boards w/TV tuner */ |
227 | * This entry is for TEA5767 FM radio only chip used on several boards | ||
228 | * w/TV tuner | ||
229 | */ | ||
230 | { TEA5767_TUNER_NAME, Philips, RADIO, | 227 | { TEA5767_TUNER_NAME, Philips, RADIO, |
231 | -1, -1, 0, 0, 0, TEA5767_LOW_LO_32768,0}, | 228 | -1, -1, 0, 0, 0, TEA5767_LOW_LO_32768,0}, |
229 | { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL, | ||
230 | 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 }, | ||
232 | }; | 231 | }; |
233 | 232 | ||
234 | unsigned const int tuner_count = ARRAY_SIZE(tuners); | 233 | unsigned const int tuner_count = ARRAY_SIZE(tuners); |
@@ -455,24 +454,24 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
455 | int rc; | 454 | int rc; |
456 | 455 | ||
457 | tun=&tuners[t->type]; | 456 | tun=&tuners[t->type]; |
458 | div = freq + (int)(16*10.7); | 457 | div = (freq / 1000) + (int)(16*10.7); |
459 | buffer[2] = tun->config; | 458 | buffer[2] = tun->config; |
460 | 459 | ||
461 | switch (t->type) { | 460 | switch (t->type) { |
462 | case TUNER_TENA_9533_DI: | 461 | case TUNER_TENA_9533_DI: |
463 | case TUNER_YMEC_TVF_5533MF: | 462 | case TUNER_YMEC_TVF_5533MF: |
464 | |||
465 | /*These values are empirically determinated */ | 463 | /*These values are empirically determinated */ |
466 | div = (freq*122)/16 - 20; | 464 | div = (freq * 122) / 16000 - 20; |
467 | buffer[2] = 0x88; /* could be also 0x80 */ | 465 | buffer[2] = 0x88; /* could be also 0x80 */ |
468 | buffer[3] = 0x19; /* could be also 0x10, 0x18, 0x99 */ | 466 | buffer[3] = 0x19; /* could be also 0x10, 0x18, 0x99 */ |
469 | break; | 467 | break; |
470 | case TUNER_PHILIPS_FM1216ME_MK3: | 468 | case TUNER_PHILIPS_FM1216ME_MK3: |
471 | case TUNER_PHILIPS_FM1236_MK3: | 469 | case TUNER_PHILIPS_FM1236_MK3: |
470 | case TUNER_PHILIPS_FMD1216ME_MK3: | ||
472 | buffer[3] = 0x19; | 471 | buffer[3] = 0x19; |
473 | break; | 472 | break; |
474 | case TUNER_PHILIPS_FM1256_IH3: | 473 | case TUNER_PHILIPS_FM1256_IH3: |
475 | div = (20 * freq)/16 + 333 * 2; | 474 | div = (20 * freq) / 16000 + 333 * 2; |
476 | buffer[2] = 0x80; | 475 | buffer[2] = 0x80; |
477 | buffer[3] = 0x19; | 476 | buffer[3] = 0x19; |
478 | break; | 477 | break; |
@@ -505,6 +504,7 @@ int default_tuner_init(struct i2c_client *c) | |||
505 | t->radio_freq = default_set_radio_freq; | 504 | t->radio_freq = default_set_radio_freq; |
506 | t->has_signal = tuner_signal; | 505 | t->has_signal = tuner_signal; |
507 | t->is_stereo = tuner_stereo; | 506 | t->is_stereo = tuner_stereo; |
507 | |||
508 | return 0; | 508 | return 0; |
509 | } | 509 | } |
510 | 510 | ||
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index d8d65397e06e..353deb25e397 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c | |||
@@ -364,9 +364,7 @@ static struct pci_driver mptfc_driver = { | |||
364 | .id_table = mptfc_pci_table, | 364 | .id_table = mptfc_pci_table, |
365 | .probe = mptfc_probe, | 365 | .probe = mptfc_probe, |
366 | .remove = __devexit_p(mptscsih_remove), | 366 | .remove = __devexit_p(mptscsih_remove), |
367 | .driver = { | 367 | .shutdown = mptscsih_shutdown, |
368 | .shutdown = mptscsih_shutdown, | ||
369 | }, | ||
370 | #ifdef CONFIG_PM | 368 | #ifdef CONFIG_PM |
371 | .suspend = mptscsih_suspend, | 369 | .suspend = mptscsih_suspend, |
372 | .resume = mptscsih_resume, | 370 | .resume = mptscsih_resume, |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index a0078ae5b9b8..4f973a49be4c 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -170,7 +170,7 @@ static void mptscsih_fillbuf(char *buffer, int size, int index, int width); | |||
170 | #endif | 170 | #endif |
171 | 171 | ||
172 | void mptscsih_remove(struct pci_dev *); | 172 | void mptscsih_remove(struct pci_dev *); |
173 | void mptscsih_shutdown(struct device *); | 173 | void mptscsih_shutdown(struct pci_dev *); |
174 | #ifdef CONFIG_PM | 174 | #ifdef CONFIG_PM |
175 | int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state); | 175 | int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state); |
176 | int mptscsih_resume(struct pci_dev *pdev); | 176 | int mptscsih_resume(struct pci_dev *pdev); |
@@ -988,7 +988,7 @@ mptscsih_remove(struct pci_dev *pdev) | |||
988 | #endif | 988 | #endif |
989 | #endif | 989 | #endif |
990 | 990 | ||
991 | mptscsih_shutdown(&pdev->dev); | 991 | mptscsih_shutdown(pdev); |
992 | 992 | ||
993 | sz1=0; | 993 | sz1=0; |
994 | 994 | ||
@@ -1026,9 +1026,9 @@ mptscsih_remove(struct pci_dev *pdev) | |||
1026 | * | 1026 | * |
1027 | */ | 1027 | */ |
1028 | void | 1028 | void |
1029 | mptscsih_shutdown(struct device * dev) | 1029 | mptscsih_shutdown(struct pci_dev *pdev) |
1030 | { | 1030 | { |
1031 | MPT_ADAPTER *ioc = pci_get_drvdata(to_pci_dev(dev)); | 1031 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
1032 | struct Scsi_Host *host = ioc->sh; | 1032 | struct Scsi_Host *host = ioc->sh; |
1033 | MPT_SCSI_HOST *hd; | 1033 | MPT_SCSI_HOST *hd; |
1034 | 1034 | ||
@@ -1054,7 +1054,7 @@ mptscsih_shutdown(struct device * dev) | |||
1054 | int | 1054 | int |
1055 | mptscsih_suspend(struct pci_dev *pdev, pm_message_t state) | 1055 | mptscsih_suspend(struct pci_dev *pdev, pm_message_t state) |
1056 | { | 1056 | { |
1057 | mptscsih_shutdown(&pdev->dev); | 1057 | mptscsih_shutdown(pdev); |
1058 | return mpt_suspend(pdev,state); | 1058 | return mpt_suspend(pdev,state); |
1059 | } | 1059 | } |
1060 | 1060 | ||
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h index d73aec33e16a..5ea89bf0df19 100644 --- a/drivers/message/fusion/mptscsih.h +++ b/drivers/message/fusion/mptscsih.h | |||
@@ -82,7 +82,7 @@ | |||
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | extern void mptscsih_remove(struct pci_dev *); | 84 | extern void mptscsih_remove(struct pci_dev *); |
85 | extern void mptscsih_shutdown(struct device *); | 85 | extern void mptscsih_shutdown(struct pci_dev *); |
86 | #ifdef CONFIG_PM | 86 | #ifdef CONFIG_PM |
87 | extern int mptscsih_suspend(struct pci_dev *pdev, u32 state); | 87 | extern int mptscsih_suspend(struct pci_dev *pdev, u32 state); |
88 | extern int mptscsih_resume(struct pci_dev *pdev); | 88 | extern int mptscsih_resume(struct pci_dev *pdev); |
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c index 5f9a61b85b3b..e0c0ee5bc966 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c | |||
@@ -419,9 +419,7 @@ static struct pci_driver mptspi_driver = { | |||
419 | .id_table = mptspi_pci_table, | 419 | .id_table = mptspi_pci_table, |
420 | .probe = mptspi_probe, | 420 | .probe = mptspi_probe, |
421 | .remove = __devexit_p(mptscsih_remove), | 421 | .remove = __devexit_p(mptscsih_remove), |
422 | .driver = { | 422 | .shutdown = mptscsih_shutdown, |
423 | .shutdown = mptscsih_shutdown, | ||
424 | }, | ||
425 | #ifdef CONFIG_PM | 423 | #ifdef CONFIG_PM |
426 | .suspend = mptscsih_suspend, | 424 | .suspend = mptscsih_suspend, |
427 | .resume = mptscsih_resume, | 425 | .resume = mptscsih_resume, |
diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c index 3a5f6ac5b364..7a42966d755b 100644 --- a/drivers/mmc/mmci.c +++ b/drivers/mmc/mmci.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/mmc/host.h> | 20 | #include <linux/mmc/host.h> |
21 | #include <linux/mmc/protocol.h> | 21 | #include <linux/mmc/protocol.h> |
22 | 22 | ||
23 | #include <asm/div64.h> | ||
23 | #include <asm/io.h> | 24 | #include <asm/io.h> |
24 | #include <asm/irq.h> | 25 | #include <asm/irq.h> |
25 | #include <asm/scatterlist.h> | 26 | #include <asm/scatterlist.h> |
@@ -70,6 +71,7 @@ static void mmci_stop_data(struct mmci_host *host) | |||
70 | static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) | 71 | static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) |
71 | { | 72 | { |
72 | unsigned int datactrl, timeout, irqmask; | 73 | unsigned int datactrl, timeout, irqmask; |
74 | unsigned long long clks; | ||
73 | void __iomem *base; | 75 | void __iomem *base; |
74 | 76 | ||
75 | DBG(host, "blksz %04x blks %04x flags %08x\n", | 77 | DBG(host, "blksz %04x blks %04x flags %08x\n", |
@@ -81,9 +83,10 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) | |||
81 | 83 | ||
82 | mmci_init_sg(host, data); | 84 | mmci_init_sg(host, data); |
83 | 85 | ||
84 | timeout = data->timeout_clks + | 86 | clks = (unsigned long long)data->timeout_ns * host->cclk; |
85 | ((unsigned long long)data->timeout_ns * host->cclk) / | 87 | do_div(clks, 1000000000UL); |
86 | 1000000000ULL; | 88 | |
89 | timeout = data->timeout_clks + (unsigned int)clks; | ||
87 | 90 | ||
88 | base = host->base; | 91 | base = host->base; |
89 | writel(timeout, base + MMCIDATATIMER); | 92 | writel(timeout, base + MMCIDATATIMER); |
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c index b7fbd30b49a0..0c41d4b41a65 100644 --- a/drivers/mmc/wbsd.c +++ b/drivers/mmc/wbsd.c | |||
@@ -54,28 +54,6 @@ | |||
54 | #define DBGF(x...) do { } while (0) | 54 | #define DBGF(x...) do { } while (0) |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | #ifdef CONFIG_MMC_DEBUG | ||
58 | void DBG_REG(int reg, u8 value) | ||
59 | { | ||
60 | int i; | ||
61 | |||
62 | printk(KERN_DEBUG "wbsd: Register %d: 0x%02X %3d '%c' ", | ||
63 | reg, (int)value, (int)value, (value < 0x20)?'.':value); | ||
64 | |||
65 | for (i = 7;i >= 0;i--) | ||
66 | { | ||
67 | if (value & (1 << i)) | ||
68 | printk("x"); | ||
69 | else | ||
70 | printk("."); | ||
71 | } | ||
72 | |||
73 | printk("\n"); | ||
74 | } | ||
75 | #else | ||
76 | #define DBG_REG(r, v) do {} while (0) | ||
77 | #endif | ||
78 | |||
79 | /* | 57 | /* |
80 | * Device resources | 58 | * Device resources |
81 | */ | 59 | */ |
@@ -92,6 +70,13 @@ MODULE_DEVICE_TABLE(pnp, pnp_dev_table); | |||
92 | 70 | ||
93 | #endif /* CONFIG_PNP */ | 71 | #endif /* CONFIG_PNP */ |
94 | 72 | ||
73 | static const int config_ports[] = { 0x2E, 0x4E }; | ||
74 | static const int unlock_codes[] = { 0x83, 0x87 }; | ||
75 | |||
76 | static const int valid_ids[] = { | ||
77 | 0x7112, | ||
78 | }; | ||
79 | |||
95 | #ifdef CONFIG_PNP | 80 | #ifdef CONFIG_PNP |
96 | static unsigned int nopnp = 0; | 81 | static unsigned int nopnp = 0; |
97 | #else | 82 | #else |
@@ -1051,6 +1036,20 @@ static struct mmc_host_ops wbsd_ops = { | |||
1051 | \*****************************************************************************/ | 1036 | \*****************************************************************************/ |
1052 | 1037 | ||
1053 | /* | 1038 | /* |
1039 | * Helper function for card detection | ||
1040 | */ | ||
1041 | static void wbsd_detect_card(unsigned long data) | ||
1042 | { | ||
1043 | struct wbsd_host *host = (struct wbsd_host*)data; | ||
1044 | |||
1045 | BUG_ON(host == NULL); | ||
1046 | |||
1047 | DBG("Executing card detection\n"); | ||
1048 | |||
1049 | mmc_detect_change(host->mmc); | ||
1050 | } | ||
1051 | |||
1052 | /* | ||
1054 | * Tasklets | 1053 | * Tasklets |
1055 | */ | 1054 | */ |
1056 | 1055 | ||
@@ -1075,7 +1074,6 @@ static void wbsd_tasklet_card(unsigned long param) | |||
1075 | { | 1074 | { |
1076 | struct wbsd_host* host = (struct wbsd_host*)param; | 1075 | struct wbsd_host* host = (struct wbsd_host*)param; |
1077 | u8 csr; | 1076 | u8 csr; |
1078 | int change = 0; | ||
1079 | 1077 | ||
1080 | spin_lock(&host->lock); | 1078 | spin_lock(&host->lock); |
1081 | 1079 | ||
@@ -1094,14 +1092,20 @@ static void wbsd_tasklet_card(unsigned long param) | |||
1094 | { | 1092 | { |
1095 | DBG("Card inserted\n"); | 1093 | DBG("Card inserted\n"); |
1096 | host->flags |= WBSD_FCARD_PRESENT; | 1094 | host->flags |= WBSD_FCARD_PRESENT; |
1097 | change = 1; | 1095 | |
1096 | /* | ||
1097 | * Delay card detection to allow electrical connections | ||
1098 | * to stabilise. | ||
1099 | */ | ||
1100 | mod_timer(&host->timer, jiffies + HZ/2); | ||
1098 | } | 1101 | } |
1102 | |||
1103 | spin_unlock(&host->lock); | ||
1099 | } | 1104 | } |
1100 | else if (host->flags & WBSD_FCARD_PRESENT) | 1105 | else if (host->flags & WBSD_FCARD_PRESENT) |
1101 | { | 1106 | { |
1102 | DBG("Card removed\n"); | 1107 | DBG("Card removed\n"); |
1103 | host->flags &= ~WBSD_FCARD_PRESENT; | 1108 | host->flags &= ~WBSD_FCARD_PRESENT; |
1104 | change = 1; | ||
1105 | 1109 | ||
1106 | if (host->mrq) | 1110 | if (host->mrq) |
1107 | { | 1111 | { |
@@ -1112,15 +1116,14 @@ static void wbsd_tasklet_card(unsigned long param) | |||
1112 | host->mrq->cmd->error = MMC_ERR_FAILED; | 1116 | host->mrq->cmd->error = MMC_ERR_FAILED; |
1113 | tasklet_schedule(&host->finish_tasklet); | 1117 | tasklet_schedule(&host->finish_tasklet); |
1114 | } | 1118 | } |
1115 | } | 1119 | |
1116 | 1120 | /* | |
1117 | /* | 1121 | * Unlock first since we might get a call back. |
1118 | * Unlock first since we might get a call back. | 1122 | */ |
1119 | */ | 1123 | spin_unlock(&host->lock); |
1120 | spin_unlock(&host->lock); | ||
1121 | 1124 | ||
1122 | if (change) | ||
1123 | mmc_detect_change(host->mmc); | 1125 | mmc_detect_change(host->mmc); |
1126 | } | ||
1124 | } | 1127 | } |
1125 | 1128 | ||
1126 | static void wbsd_tasklet_fifo(unsigned long param) | 1129 | static void wbsd_tasklet_fifo(unsigned long param) |
@@ -1325,6 +1328,13 @@ static int __devinit wbsd_alloc_mmc(struct device* dev) | |||
1325 | spin_lock_init(&host->lock); | 1328 | spin_lock_init(&host->lock); |
1326 | 1329 | ||
1327 | /* | 1330 | /* |
1331 | * Set up detection timer | ||
1332 | */ | ||
1333 | init_timer(&host->timer); | ||
1334 | host->timer.data = (unsigned long)host; | ||
1335 | host->timer.function = wbsd_detect_card; | ||
1336 | |||
1337 | /* | ||
1328 | * Maximum number of segments. Worst case is one sector per segment | 1338 | * Maximum number of segments. Worst case is one sector per segment |
1329 | * so this will be 64kB/512. | 1339 | * so this will be 64kB/512. |
1330 | */ | 1340 | */ |
@@ -1351,11 +1361,17 @@ static int __devinit wbsd_alloc_mmc(struct device* dev) | |||
1351 | static void __devexit wbsd_free_mmc(struct device* dev) | 1361 | static void __devexit wbsd_free_mmc(struct device* dev) |
1352 | { | 1362 | { |
1353 | struct mmc_host* mmc; | 1363 | struct mmc_host* mmc; |
1364 | struct wbsd_host* host; | ||
1354 | 1365 | ||
1355 | mmc = dev_get_drvdata(dev); | 1366 | mmc = dev_get_drvdata(dev); |
1356 | if (!mmc) | 1367 | if (!mmc) |
1357 | return; | 1368 | return; |
1358 | 1369 | ||
1370 | host = mmc_priv(mmc); | ||
1371 | BUG_ON(host == NULL); | ||
1372 | |||
1373 | del_timer_sync(&host->timer); | ||
1374 | |||
1359 | mmc_free_host(mmc); | 1375 | mmc_free_host(mmc); |
1360 | 1376 | ||
1361 | dev_set_drvdata(dev, NULL); | 1377 | dev_set_drvdata(dev, NULL); |
diff --git a/drivers/mmc/wbsd.h b/drivers/mmc/wbsd.h index 864f30828d01..661a9f6a6e6f 100644 --- a/drivers/mmc/wbsd.h +++ b/drivers/mmc/wbsd.h | |||
@@ -8,13 +8,6 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | const int config_ports[] = { 0x2E, 0x4E }; | ||
12 | const int unlock_codes[] = { 0x83, 0x87 }; | ||
13 | |||
14 | const int valid_ids[] = { | ||
15 | 0x7112, | ||
16 | }; | ||
17 | |||
18 | #define LOCK_CODE 0xAA | 11 | #define LOCK_CODE 0xAA |
19 | 12 | ||
20 | #define WBSD_CONF_SWRST 0x02 | 13 | #define WBSD_CONF_SWRST 0x02 |
@@ -187,4 +180,6 @@ struct wbsd_host | |||
187 | struct tasklet_struct timeout_tasklet; | 180 | struct tasklet_struct timeout_tasklet; |
188 | struct tasklet_struct finish_tasklet; | 181 | struct tasklet_struct finish_tasklet; |
189 | struct tasklet_struct block_tasklet; | 182 | struct tasklet_struct block_tasklet; |
183 | |||
184 | struct timer_list timer; /* Card detection timer */ | ||
190 | }; | 185 | }; |
diff --git a/drivers/mtd/afs.c b/drivers/mtd/afs.c index 801e6c7d0892..7363e101eb0f 100644 --- a/drivers/mtd/afs.c +++ b/drivers/mtd/afs.c | |||
@@ -219,7 +219,7 @@ static int parse_afs_partitions(struct mtd_info *mtd, | |||
219 | */ | 219 | */ |
220 | for (idx = off = 0; off < mtd->size; off += mtd->erasesize) { | 220 | for (idx = off = 0; off < mtd->size; off += mtd->erasesize) { |
221 | struct image_info_struct iis; | 221 | struct image_info_struct iis; |
222 | u_int iis_ptr, img_ptr, size; | 222 | u_int iis_ptr, img_ptr; |
223 | 223 | ||
224 | /* Read the footer. */ | 224 | /* Read the footer. */ |
225 | ret = afs_read_footer(mtd, &img_ptr, &iis_ptr, off, mask); | 225 | ret = afs_read_footer(mtd, &img_ptr, &iis_ptr, off, mask); |
@@ -236,21 +236,9 @@ static int parse_afs_partitions(struct mtd_info *mtd, | |||
236 | continue; | 236 | continue; |
237 | 237 | ||
238 | strcpy(str, iis.name); | 238 | strcpy(str, iis.name); |
239 | size = mtd->erasesize + off - img_ptr; | ||
240 | |||
241 | /* | ||
242 | * In order to support JFFS2 partitions on this layout, | ||
243 | * we must lie to MTD about the real size of JFFS2 | ||
244 | * partitions; this ensures that the AFS flash footer | ||
245 | * won't be erased by JFFS2. Please ensure that your | ||
246 | * JFFS2 partitions are given image numbers between | ||
247 | * 1000 and 2000 inclusive. | ||
248 | */ | ||
249 | if (iis.imageNumber >= 1000 && iis.imageNumber < 2000) | ||
250 | size -= mtd->erasesize; | ||
251 | 239 | ||
252 | parts[idx].name = str; | 240 | parts[idx].name = str; |
253 | parts[idx].size = size; | 241 | parts[idx].size = (iis.length + mtd->erasesize - 1) & ~(mtd->erasesize - 1); |
254 | parts[idx].offset = img_ptr; | 242 | parts[idx].offset = img_ptr; |
255 | parts[idx].mask_flags = 0; | 243 | parts[idx].mask_flags = 0; |
256 | 244 | ||
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c index d272ea36a578..91d1c4c24d9b 100644 --- a/drivers/net/3c515.c +++ b/drivers/net/3c515.c | |||
@@ -822,7 +822,7 @@ static int corkscrew_open(struct net_device *dev) | |||
822 | break; /* Bad news! */ | 822 | break; /* Bad news! */ |
823 | skb->dev = dev; /* Mark as being used by this device. */ | 823 | skb->dev = dev; /* Mark as being used by this device. */ |
824 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 824 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
825 | vp->rx_ring[i].addr = isa_virt_to_bus(skb->tail); | 825 | vp->rx_ring[i].addr = isa_virt_to_bus(skb->data); |
826 | } | 826 | } |
827 | vp->rx_ring[i - 1].next = isa_virt_to_bus(&vp->rx_ring[0]); /* Wrap the ring. */ | 827 | vp->rx_ring[i - 1].next = isa_virt_to_bus(&vp->rx_ring[0]); /* Wrap the ring. */ |
828 | outl(isa_virt_to_bus(&vp->rx_ring[0]), ioaddr + UpListPtr); | 828 | outl(isa_virt_to_bus(&vp->rx_ring[0]), ioaddr + UpListPtr); |
@@ -1406,7 +1406,7 @@ static int boomerang_rx(struct net_device *dev) | |||
1406 | break; /* Bad news! */ | 1406 | break; /* Bad news! */ |
1407 | skb->dev = dev; /* Mark as being used by this device. */ | 1407 | skb->dev = dev; /* Mark as being used by this device. */ |
1408 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 1408 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
1409 | vp->rx_ring[entry].addr = isa_virt_to_bus(skb->tail); | 1409 | vp->rx_ring[entry].addr = isa_virt_to_bus(skb->data); |
1410 | vp->rx_skbuff[entry] = skb; | 1410 | vp->rx_skbuff[entry] = skb; |
1411 | } | 1411 | } |
1412 | vp->rx_ring[entry].status = 0; /* Clear complete bit. */ | 1412 | vp->rx_ring[entry].status = 0; /* Clear complete bit. */ |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 80ec9aa575bb..07746b95fd83 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -1802,7 +1802,7 @@ vortex_open(struct net_device *dev) | |||
1802 | break; /* Bad news! */ | 1802 | break; /* Bad news! */ |
1803 | skb->dev = dev; /* Mark as being used by this device. */ | 1803 | skb->dev = dev; /* Mark as being used by this device. */ |
1804 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 1804 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
1805 | vp->rx_ring[i].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->tail, PKT_BUF_SZ, PCI_DMA_FROMDEVICE)); | 1805 | vp->rx_ring[i].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE)); |
1806 | } | 1806 | } |
1807 | if (i != RX_RING_SIZE) { | 1807 | if (i != RX_RING_SIZE) { |
1808 | int j; | 1808 | int j; |
@@ -2632,7 +2632,7 @@ boomerang_rx(struct net_device *dev) | |||
2632 | pci_dma_sync_single_for_cpu(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE); | 2632 | pci_dma_sync_single_for_cpu(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE); |
2633 | /* 'skb_put()' points to the start of sk_buff data area. */ | 2633 | /* 'skb_put()' points to the start of sk_buff data area. */ |
2634 | memcpy(skb_put(skb, pkt_len), | 2634 | memcpy(skb_put(skb, pkt_len), |
2635 | vp->rx_skbuff[entry]->tail, | 2635 | vp->rx_skbuff[entry]->data, |
2636 | pkt_len); | 2636 | pkt_len); |
2637 | pci_dma_sync_single_for_device(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE); | 2637 | pci_dma_sync_single_for_device(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE); |
2638 | vp->rx_copy++; | 2638 | vp->rx_copy++; |
@@ -2678,7 +2678,7 @@ boomerang_rx(struct net_device *dev) | |||
2678 | } | 2678 | } |
2679 | skb->dev = dev; /* Mark as being used by this device. */ | 2679 | skb->dev = dev; /* Mark as being used by this device. */ |
2680 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 2680 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
2681 | vp->rx_ring[entry].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->tail, PKT_BUF_SZ, PCI_DMA_FROMDEVICE)); | 2681 | vp->rx_ring[entry].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE)); |
2682 | vp->rx_skbuff[entry] = skb; | 2682 | vp->rx_skbuff[entry] = skb; |
2683 | } | 2683 | } |
2684 | vp->rx_ring[entry].status = 0; /* Clear complete bit. */ | 2684 | vp->rx_ring[entry].status = 0; /* Clear complete bit. */ |
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index e4b3c5c88542..7b293f01c9ed 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
@@ -596,7 +596,7 @@ rx_status_loop: | |||
596 | 596 | ||
597 | mapping = | 597 | mapping = |
598 | cp->rx_skb[rx_tail].mapping = | 598 | cp->rx_skb[rx_tail].mapping = |
599 | pci_map_single(cp->pdev, new_skb->tail, | 599 | pci_map_single(cp->pdev, new_skb->data, |
600 | buflen, PCI_DMA_FROMDEVICE); | 600 | buflen, PCI_DMA_FROMDEVICE); |
601 | cp->rx_skb[rx_tail].skb = new_skb; | 601 | cp->rx_skb[rx_tail].skb = new_skb; |
602 | 602 | ||
@@ -1101,7 +1101,7 @@ static int cp_refill_rx (struct cp_private *cp) | |||
1101 | skb_reserve(skb, RX_OFFSET); | 1101 | skb_reserve(skb, RX_OFFSET); |
1102 | 1102 | ||
1103 | cp->rx_skb[i].mapping = pci_map_single(cp->pdev, | 1103 | cp->rx_skb[i].mapping = pci_map_single(cp->pdev, |
1104 | skb->tail, cp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1104 | skb->data, cp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1105 | cp->rx_skb[i].skb = skb; | 1105 | cp->rx_skb[i].skb = skb; |
1106 | 1106 | ||
1107 | cp->rx_ring[i].opts2 = 0; | 1107 | cp->rx_ring[i].opts2 = 0; |
diff --git a/drivers/net/82596.c b/drivers/net/82596.c index 65f97b1dc581..13b745b39667 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c | |||
@@ -546,11 +546,11 @@ static inline void init_rx_bufs(struct net_device *dev) | |||
546 | rbd->b_next = WSWAPrbd(virt_to_bus(rbd+1)); | 546 | rbd->b_next = WSWAPrbd(virt_to_bus(rbd+1)); |
547 | rbd->b_addr = WSWAPrbd(virt_to_bus(rbd)); | 547 | rbd->b_addr = WSWAPrbd(virt_to_bus(rbd)); |
548 | rbd->skb = skb; | 548 | rbd->skb = skb; |
549 | rbd->v_data = skb->tail; | 549 | rbd->v_data = skb->data; |
550 | rbd->b_data = WSWAPchar(virt_to_bus(skb->tail)); | 550 | rbd->b_data = WSWAPchar(virt_to_bus(skb->data)); |
551 | rbd->size = PKT_BUF_SZ; | 551 | rbd->size = PKT_BUF_SZ; |
552 | #ifdef __mc68000__ | 552 | #ifdef __mc68000__ |
553 | cache_clear(virt_to_phys(skb->tail), PKT_BUF_SZ); | 553 | cache_clear(virt_to_phys(skb->data), PKT_BUF_SZ); |
554 | #endif | 554 | #endif |
555 | } | 555 | } |
556 | lp->rbd_head = lp->rbds; | 556 | lp->rbd_head = lp->rbds; |
@@ -816,10 +816,10 @@ static inline int i596_rx(struct net_device *dev) | |||
816 | rx_in_place = 1; | 816 | rx_in_place = 1; |
817 | rbd->skb = newskb; | 817 | rbd->skb = newskb; |
818 | newskb->dev = dev; | 818 | newskb->dev = dev; |
819 | rbd->v_data = newskb->tail; | 819 | rbd->v_data = newskb->data; |
820 | rbd->b_data = WSWAPchar(virt_to_bus(newskb->tail)); | 820 | rbd->b_data = WSWAPchar(virt_to_bus(newskb->data)); |
821 | #ifdef __mc68000__ | 821 | #ifdef __mc68000__ |
822 | cache_clear(virt_to_phys(newskb->tail), PKT_BUF_SZ); | 822 | cache_clear(virt_to_phys(newskb->data), PKT_BUF_SZ); |
823 | #endif | 823 | #endif |
824 | } | 824 | } |
825 | else | 825 | else |
@@ -840,7 +840,7 @@ memory_squeeze: | |||
840 | skb->protocol=eth_type_trans(skb,dev); | 840 | skb->protocol=eth_type_trans(skb,dev); |
841 | skb->len = pkt_len; | 841 | skb->len = pkt_len; |
842 | #ifdef __mc68000__ | 842 | #ifdef __mc68000__ |
843 | cache_clear(virt_to_phys(rbd->skb->tail), | 843 | cache_clear(virt_to_phys(rbd->skb->data), |
844 | pkt_len); | 844 | pkt_len); |
845 | #endif | 845 | #endif |
846 | netif_rx(skb); | 846 | netif_rx(skb); |
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c index b7dd7260cafb..8618012df06a 100755 --- a/drivers/net/amd8111e.c +++ b/drivers/net/amd8111e.c | |||
@@ -87,6 +87,7 @@ Revision History: | |||
87 | #include <linux/if_vlan.h> | 87 | #include <linux/if_vlan.h> |
88 | #include <linux/ctype.h> | 88 | #include <linux/ctype.h> |
89 | #include <linux/crc32.h> | 89 | #include <linux/crc32.h> |
90 | #include <linux/dma-mapping.h> | ||
90 | 91 | ||
91 | #include <asm/system.h> | 92 | #include <asm/system.h> |
92 | #include <asm/io.h> | 93 | #include <asm/io.h> |
@@ -2006,12 +2007,11 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev, | |||
2006 | } | 2007 | } |
2007 | 2008 | ||
2008 | /* Initialize DMA */ | 2009 | /* Initialize DMA */ |
2009 | if(!pci_dma_supported(pdev, 0xffffffff)){ | 2010 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) < 0) { |
2010 | printk(KERN_ERR "amd8111e: DMA not supported," | 2011 | printk(KERN_ERR "amd8111e: DMA not supported," |
2011 | "exiting.\n"); | 2012 | "exiting.\n"); |
2012 | goto err_free_reg; | 2013 | goto err_free_reg; |
2013 | } else | 2014 | } |
2014 | pdev->dma_mask = 0xffffffff; | ||
2015 | 2015 | ||
2016 | reg_addr = pci_resource_start(pdev, 0); | 2016 | reg_addr = pci_resource_start(pdev, 0); |
2017 | reg_len = pci_resource_len(pdev, 0); | 2017 | reg_len = pci_resource_len(pdev, 0); |
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c index 2e28c201dcc0..942a2819576c 100644 --- a/drivers/net/arm/etherh.c +++ b/drivers/net/arm/etherh.c | |||
@@ -68,7 +68,6 @@ struct etherh_priv { | |||
68 | void __iomem *dma_base; | 68 | void __iomem *dma_base; |
69 | unsigned int id; | 69 | unsigned int id; |
70 | void __iomem *ctrl_port; | 70 | void __iomem *ctrl_port; |
71 | void __iomem *base; | ||
72 | unsigned char ctrl; | 71 | unsigned char ctrl; |
73 | u32 supported; | 72 | u32 supported; |
74 | }; | 73 | }; |
@@ -178,7 +177,7 @@ etherh_setif(struct net_device *dev) | |||
178 | switch (etherh_priv(dev)->id) { | 177 | switch (etherh_priv(dev)->id) { |
179 | case PROD_I3_ETHERLAN600: | 178 | case PROD_I3_ETHERLAN600: |
180 | case PROD_I3_ETHERLAN600A: | 179 | case PROD_I3_ETHERLAN600A: |
181 | addr = etherh_priv(dev)->base + EN0_RCNTHI; | 180 | addr = (void *)dev->base_addr + EN0_RCNTHI; |
182 | 181 | ||
183 | switch (dev->if_port) { | 182 | switch (dev->if_port) { |
184 | case IF_PORT_10BASE2: | 183 | case IF_PORT_10BASE2: |
@@ -219,7 +218,7 @@ etherh_getifstat(struct net_device *dev) | |||
219 | switch (etherh_priv(dev)->id) { | 218 | switch (etherh_priv(dev)->id) { |
220 | case PROD_I3_ETHERLAN600: | 219 | case PROD_I3_ETHERLAN600: |
221 | case PROD_I3_ETHERLAN600A: | 220 | case PROD_I3_ETHERLAN600A: |
222 | addr = etherh_priv(dev)->base + EN0_RCNTHI; | 221 | addr = (void *)dev->base_addr + EN0_RCNTHI; |
223 | switch (dev->if_port) { | 222 | switch (dev->if_port) { |
224 | case IF_PORT_10BASE2: | 223 | case IF_PORT_10BASE2: |
225 | stat = 1; | 224 | stat = 1; |
@@ -282,7 +281,7 @@ static void | |||
282 | etherh_reset(struct net_device *dev) | 281 | etherh_reset(struct net_device *dev) |
283 | { | 282 | { |
284 | struct ei_device *ei_local = netdev_priv(dev); | 283 | struct ei_device *ei_local = netdev_priv(dev); |
285 | void __iomem *addr = etherh_priv(dev)->base; | 284 | void __iomem *addr = (void *)dev->base_addr; |
286 | 285 | ||
287 | writeb(E8390_NODMA+E8390_PAGE0+E8390_STOP, addr); | 286 | writeb(E8390_NODMA+E8390_PAGE0+E8390_STOP, addr); |
288 | 287 | ||
@@ -328,7 +327,7 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf | |||
328 | 327 | ||
329 | ei_local->dmaing = 1; | 328 | ei_local->dmaing = 1; |
330 | 329 | ||
331 | addr = etherh_priv(dev)->base; | 330 | addr = (void *)dev->base_addr; |
332 | dma_base = etherh_priv(dev)->dma_base; | 331 | dma_base = etherh_priv(dev)->dma_base; |
333 | 332 | ||
334 | count = (count + 1) & ~1; | 333 | count = (count + 1) & ~1; |
@@ -388,7 +387,7 @@ etherh_block_input (struct net_device *dev, int count, struct sk_buff *skb, int | |||
388 | 387 | ||
389 | ei_local->dmaing = 1; | 388 | ei_local->dmaing = 1; |
390 | 389 | ||
391 | addr = etherh_priv(dev)->base; | 390 | addr = (void *)dev->base_addr; |
392 | dma_base = etherh_priv(dev)->dma_base; | 391 | dma_base = etherh_priv(dev)->dma_base; |
393 | 392 | ||
394 | buf = skb->data; | 393 | buf = skb->data; |
@@ -428,7 +427,7 @@ etherh_get_header (struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_p | |||
428 | 427 | ||
429 | ei_local->dmaing = 1; | 428 | ei_local->dmaing = 1; |
430 | 429 | ||
431 | addr = etherh_priv(dev)->base; | 430 | addr = (void *)dev->base_addr; |
432 | dma_base = etherh_priv(dev)->dma_base; | 431 | dma_base = etherh_priv(dev)->dma_base; |
433 | 432 | ||
434 | writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD); | 433 | writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD); |
@@ -697,8 +696,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
697 | eh->ctrl_port = eh->ioc_fast; | 696 | eh->ctrl_port = eh->ioc_fast; |
698 | } | 697 | } |
699 | 698 | ||
700 | eh->base = eh->memc + data->ns8390_offset; | 699 | dev->base_addr = (unsigned long)eh->memc + data->ns8390_offset; |
701 | dev->base_addr = (unsigned long)eh->base; | ||
702 | eh->dma_base = eh->memc + data->dataport_offset; | 700 | eh->dma_base = eh->memc + data->dataport_offset; |
703 | eh->ctrl_port += data->ctrlport_offset; | 701 | eh->ctrl_port += data->ctrlport_offset; |
704 | 702 | ||
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c index b8ab2b6355eb..e613cc289749 100644 --- a/drivers/net/at1700.c +++ b/drivers/net/at1700.c | |||
@@ -34,10 +34,6 @@ | |||
34 | only is it difficult to detect, it also moves around in I/O space in | 34 | only is it difficult to detect, it also moves around in I/O space in |
35 | response to inb()s from other device probes! | 35 | response to inb()s from other device probes! |
36 | */ | 36 | */ |
37 | /* | ||
38 | 99/03/03 Allied Telesis RE1000 Plus support by T.Hagawa | ||
39 | 99/12/30 port to 2.3.35 by K.Takai | ||
40 | */ | ||
41 | 37 | ||
42 | #include <linux/config.h> | 38 | #include <linux/config.h> |
43 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c index 00e5257b176f..8dc657fc8afb 100644 --- a/drivers/net/bmac.c +++ b/drivers/net/bmac.c | |||
@@ -1261,7 +1261,7 @@ static void bmac_reset_and_enable(struct net_device *dev) | |||
1261 | spin_unlock_irqrestore(&bp->lock, flags); | 1261 | spin_unlock_irqrestore(&bp->lock, flags); |
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_match *match) | 1264 | static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_id *match) |
1265 | { | 1265 | { |
1266 | int j, rev, ret; | 1266 | int j, rev, ret; |
1267 | struct bmac_data *bp; | 1267 | struct bmac_data *bp; |
@@ -1645,16 +1645,13 @@ static int __devexit bmac_remove(struct macio_dev *mdev) | |||
1645 | return 0; | 1645 | return 0; |
1646 | } | 1646 | } |
1647 | 1647 | ||
1648 | static struct of_match bmac_match[] = | 1648 | static struct of_device_id bmac_match[] = |
1649 | { | 1649 | { |
1650 | { | 1650 | { |
1651 | .name = "bmac", | 1651 | .name = "bmac", |
1652 | .type = OF_ANY_MATCH, | ||
1653 | .compatible = OF_ANY_MATCH, | ||
1654 | .data = (void *)0, | 1652 | .data = (void *)0, |
1655 | }, | 1653 | }, |
1656 | { | 1654 | { |
1657 | .name = OF_ANY_MATCH, | ||
1658 | .type = "network", | 1655 | .type = "network", |
1659 | .compatible = "bmac+", | 1656 | .compatible = "bmac+", |
1660 | .data = (void *)1, | 1657 | .data = (void *)1, |
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index aa42b7a27735..430c628279b3 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -547,7 +547,7 @@ rio_timer (unsigned long data) | |||
547 | skb_reserve (skb, 2); | 547 | skb_reserve (skb, 2); |
548 | np->rx_ring[entry].fraginfo = | 548 | np->rx_ring[entry].fraginfo = |
549 | cpu_to_le64 (pci_map_single | 549 | cpu_to_le64 (pci_map_single |
550 | (np->pdev, skb->tail, np->rx_buf_sz, | 550 | (np->pdev, skb->data, np->rx_buf_sz, |
551 | PCI_DMA_FROMDEVICE)); | 551 | PCI_DMA_FROMDEVICE)); |
552 | } | 552 | } |
553 | np->rx_ring[entry].fraginfo |= | 553 | np->rx_ring[entry].fraginfo |= |
@@ -618,7 +618,7 @@ alloc_list (struct net_device *dev) | |||
618 | /* Rubicon now supports 40 bits of addressing space. */ | 618 | /* Rubicon now supports 40 bits of addressing space. */ |
619 | np->rx_ring[i].fraginfo = | 619 | np->rx_ring[i].fraginfo = |
620 | cpu_to_le64 ( pci_map_single ( | 620 | cpu_to_le64 ( pci_map_single ( |
621 | np->pdev, skb->tail, np->rx_buf_sz, | 621 | np->pdev, skb->data, np->rx_buf_sz, |
622 | PCI_DMA_FROMDEVICE)); | 622 | PCI_DMA_FROMDEVICE)); |
623 | np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48; | 623 | np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48; |
624 | } | 624 | } |
@@ -906,7 +906,7 @@ receive_packet (struct net_device *dev) | |||
906 | /* 16 byte align the IP header */ | 906 | /* 16 byte align the IP header */ |
907 | skb_reserve (skb, 2); | 907 | skb_reserve (skb, 2); |
908 | eth_copy_and_sum (skb, | 908 | eth_copy_and_sum (skb, |
909 | np->rx_skbuff[entry]->tail, | 909 | np->rx_skbuff[entry]->data, |
910 | pkt_len, 0); | 910 | pkt_len, 0); |
911 | skb_put (skb, pkt_len); | 911 | skb_put (skb, pkt_len); |
912 | pci_dma_sync_single_for_device(np->pdev, | 912 | pci_dma_sync_single_for_device(np->pdev, |
@@ -950,7 +950,7 @@ receive_packet (struct net_device *dev) | |||
950 | skb_reserve (skb, 2); | 950 | skb_reserve (skb, 2); |
951 | np->rx_ring[entry].fraginfo = | 951 | np->rx_ring[entry].fraginfo = |
952 | cpu_to_le64 (pci_map_single | 952 | cpu_to_le64 (pci_map_single |
953 | (np->pdev, skb->tail, np->rx_buf_sz, | 953 | (np->pdev, skb->data, np->rx_buf_sz, |
954 | PCI_DMA_FROMDEVICE)); | 954 | PCI_DMA_FROMDEVICE)); |
955 | } | 955 | } |
956 | np->rx_ring[entry].fraginfo |= | 956 | np->rx_ring[entry].fraginfo |= |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 1e56c8eea35f..d0fa2448761d 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -2447,9 +2447,8 @@ static int e100_resume(struct pci_dev *pdev) | |||
2447 | #endif | 2447 | #endif |
2448 | 2448 | ||
2449 | 2449 | ||
2450 | static void e100_shutdown(struct device *dev) | 2450 | static void e100_shutdown(struct pci_dev *pdev) |
2451 | { | 2451 | { |
2452 | struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); | ||
2453 | struct net_device *netdev = pci_get_drvdata(pdev); | 2452 | struct net_device *netdev = pci_get_drvdata(pdev); |
2454 | struct nic *nic = netdev_priv(netdev); | 2453 | struct nic *nic = netdev_priv(netdev); |
2455 | 2454 | ||
@@ -2470,11 +2469,7 @@ static struct pci_driver e100_driver = { | |||
2470 | .suspend = e100_suspend, | 2469 | .suspend = e100_suspend, |
2471 | .resume = e100_resume, | 2470 | .resume = e100_resume, |
2472 | #endif | 2471 | #endif |
2473 | 2472 | .shutdown = e100_shutdown, | |
2474 | .driver = { | ||
2475 | .shutdown = e100_shutdown, | ||
2476 | } | ||
2477 | |||
2478 | }; | 2473 | }; |
2479 | 2474 | ||
2480 | static int __init e100_init_module(void) | 2475 | static int __init e100_init_module(void) |
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 98b3a2fdce90..1795425f512e 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c | |||
@@ -1269,7 +1269,7 @@ speedo_init_rx_ring(struct net_device *dev) | |||
1269 | if (skb == NULL) | 1269 | if (skb == NULL) |
1270 | break; /* OK. Just initially short of Rx bufs. */ | 1270 | break; /* OK. Just initially short of Rx bufs. */ |
1271 | skb->dev = dev; /* Mark as being used by this device. */ | 1271 | skb->dev = dev; /* Mark as being used by this device. */ |
1272 | rxf = (struct RxFD *)skb->tail; | 1272 | rxf = (struct RxFD *)skb->data; |
1273 | sp->rx_ringp[i] = rxf; | 1273 | sp->rx_ringp[i] = rxf; |
1274 | sp->rx_ring_dma[i] = | 1274 | sp->rx_ring_dma[i] = |
1275 | pci_map_single(sp->pdev, rxf, | 1275 | pci_map_single(sp->pdev, rxf, |
@@ -1661,7 +1661,7 @@ static inline struct RxFD *speedo_rx_alloc(struct net_device *dev, int entry) | |||
1661 | sp->rx_ringp[entry] = NULL; | 1661 | sp->rx_ringp[entry] = NULL; |
1662 | return NULL; | 1662 | return NULL; |
1663 | } | 1663 | } |
1664 | rxf = sp->rx_ringp[entry] = (struct RxFD *)skb->tail; | 1664 | rxf = sp->rx_ringp[entry] = (struct RxFD *)skb->data; |
1665 | sp->rx_ring_dma[entry] = | 1665 | sp->rx_ring_dma[entry] = |
1666 | pci_map_single(sp->pdev, rxf, | 1666 | pci_map_single(sp->pdev, rxf, |
1667 | PKT_BUF_SZ + sizeof(struct RxFD), PCI_DMA_FROMDEVICE); | 1667 | PKT_BUF_SZ + sizeof(struct RxFD), PCI_DMA_FROMDEVICE); |
@@ -1808,10 +1808,10 @@ speedo_rx(struct net_device *dev) | |||
1808 | 1808 | ||
1809 | #if 1 || USE_IP_CSUM | 1809 | #if 1 || USE_IP_CSUM |
1810 | /* Packet is in one chunk -- we can copy + cksum. */ | 1810 | /* Packet is in one chunk -- we can copy + cksum. */ |
1811 | eth_copy_and_sum(skb, sp->rx_skbuff[entry]->tail, pkt_len, 0); | 1811 | eth_copy_and_sum(skb, sp->rx_skbuff[entry]->data, pkt_len, 0); |
1812 | skb_put(skb, pkt_len); | 1812 | skb_put(skb, pkt_len); |
1813 | #else | 1813 | #else |
1814 | memcpy(skb_put(skb, pkt_len), sp->rx_skbuff[entry]->tail, | 1814 | memcpy(skb_put(skb, pkt_len), sp->rx_skbuff[entry]->data, |
1815 | pkt_len); | 1815 | pkt_len); |
1816 | #endif | 1816 | #endif |
1817 | pci_dma_sync_single_for_device(sp->pdev, sp->rx_ring_dma[entry], | 1817 | pci_dma_sync_single_for_device(sp->pdev, sp->rx_ring_dma[entry], |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index 81ebaedaa240..87f522738bfc 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -1003,7 +1003,7 @@ static void epic_init_ring(struct net_device *dev) | |||
1003 | skb->dev = dev; /* Mark as being used by this device. */ | 1003 | skb->dev = dev; /* Mark as being used by this device. */ |
1004 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ | 1004 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ |
1005 | ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev, | 1005 | ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev, |
1006 | skb->tail, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1006 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1007 | ep->rx_ring[i].rxstatus = cpu_to_le32(DescOwn); | 1007 | ep->rx_ring[i].rxstatus = cpu_to_le32(DescOwn); |
1008 | } | 1008 | } |
1009 | ep->dirty_rx = (unsigned int)(i - RX_RING_SIZE); | 1009 | ep->dirty_rx = (unsigned int)(i - RX_RING_SIZE); |
@@ -1274,7 +1274,7 @@ static int epic_rx(struct net_device *dev, int budget) | |||
1274 | ep->rx_ring[entry].bufaddr, | 1274 | ep->rx_ring[entry].bufaddr, |
1275 | ep->rx_buf_sz, | 1275 | ep->rx_buf_sz, |
1276 | PCI_DMA_FROMDEVICE); | 1276 | PCI_DMA_FROMDEVICE); |
1277 | eth_copy_and_sum(skb, ep->rx_skbuff[entry]->tail, pkt_len, 0); | 1277 | eth_copy_and_sum(skb, ep->rx_skbuff[entry]->data, pkt_len, 0); |
1278 | skb_put(skb, pkt_len); | 1278 | skb_put(skb, pkt_len); |
1279 | pci_dma_sync_single_for_device(ep->pci_dev, | 1279 | pci_dma_sync_single_for_device(ep->pci_dev, |
1280 | ep->rx_ring[entry].bufaddr, | 1280 | ep->rx_ring[entry].bufaddr, |
@@ -1308,7 +1308,7 @@ static int epic_rx(struct net_device *dev, int budget) | |||
1308 | skb->dev = dev; /* Mark as being used by this device. */ | 1308 | skb->dev = dev; /* Mark as being used by this device. */ |
1309 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 1309 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
1310 | ep->rx_ring[entry].bufaddr = pci_map_single(ep->pci_dev, | 1310 | ep->rx_ring[entry].bufaddr = pci_map_single(ep->pci_dev, |
1311 | skb->tail, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1311 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1312 | work_done++; | 1312 | work_done++; |
1313 | } | 1313 | } |
1314 | ep->rx_ring[entry].rxstatus = cpu_to_le32(DescOwn); | 1314 | ep->rx_ring[entry].rxstatus = cpu_to_le32(DescOwn); |
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c index 9e0303f6d73c..55dbe9a3fd56 100644 --- a/drivers/net/fealnx.c +++ b/drivers/net/fealnx.c | |||
@@ -1107,7 +1107,7 @@ static void allocate_rx_buffers(struct net_device *dev) | |||
1107 | 1107 | ||
1108 | skb->dev = dev; /* Mark as being used by this device. */ | 1108 | skb->dev = dev; /* Mark as being used by this device. */ |
1109 | np->lack_rxbuf->skbuff = skb; | 1109 | np->lack_rxbuf->skbuff = skb; |
1110 | np->lack_rxbuf->buffer = pci_map_single(np->pci_dev, skb->tail, | 1110 | np->lack_rxbuf->buffer = pci_map_single(np->pci_dev, skb->data, |
1111 | np->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1111 | np->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1112 | np->lack_rxbuf->status = RXOWN; | 1112 | np->lack_rxbuf->status = RXOWN; |
1113 | ++np->really_rx_count; | 1113 | ++np->really_rx_count; |
@@ -1300,7 +1300,7 @@ static void init_ring(struct net_device *dev) | |||
1300 | ++np->really_rx_count; | 1300 | ++np->really_rx_count; |
1301 | np->rx_ring[i].skbuff = skb; | 1301 | np->rx_ring[i].skbuff = skb; |
1302 | skb->dev = dev; /* Mark as being used by this device. */ | 1302 | skb->dev = dev; /* Mark as being used by this device. */ |
1303 | np->rx_ring[i].buffer = pci_map_single(np->pci_dev, skb->tail, | 1303 | np->rx_ring[i].buffer = pci_map_single(np->pci_dev, skb->data, |
1304 | np->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1304 | np->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1305 | np->rx_ring[i].status = RXOWN; | 1305 | np->rx_ring[i].status = RXOWN; |
1306 | np->rx_ring[i].control |= RXIC; | 1306 | np->rx_ring[i].control |= RXIC; |
@@ -1737,11 +1737,11 @@ static int netdev_rx(struct net_device *dev) | |||
1737 | 1737 | ||
1738 | #if ! defined(__alpha__) | 1738 | #if ! defined(__alpha__) |
1739 | eth_copy_and_sum(skb, | 1739 | eth_copy_and_sum(skb, |
1740 | np->cur_rx->skbuff->tail, pkt_len, 0); | 1740 | np->cur_rx->skbuff->data, pkt_len, 0); |
1741 | skb_put(skb, pkt_len); | 1741 | skb_put(skb, pkt_len); |
1742 | #else | 1742 | #else |
1743 | memcpy(skb_put(skb, pkt_len), | 1743 | memcpy(skb_put(skb, pkt_len), |
1744 | np->cur_rx->skbuff->tail, pkt_len); | 1744 | np->cur_rx->skbuff->data, pkt_len); |
1745 | #endif | 1745 | #endif |
1746 | pci_dma_sync_single_for_device(np->pci_dev, | 1746 | pci_dma_sync_single_for_device(np->pci_dev, |
1747 | np->cur_rx->buffer, | 1747 | np->cur_rx->buffer, |
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c index 3d96714ed3cf..d9df1d9a5739 100644 --- a/drivers/net/hamachi.c +++ b/drivers/net/hamachi.c | |||
@@ -1149,7 +1149,7 @@ static void hamachi_tx_timeout(struct net_device *dev) | |||
1149 | skb->dev = dev; /* Mark as being used by this device. */ | 1149 | skb->dev = dev; /* Mark as being used by this device. */ |
1150 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ | 1150 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ |
1151 | hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, | 1151 | hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, |
1152 | skb->tail, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); | 1152 | skb->data, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); |
1153 | hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | | 1153 | hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | |
1154 | DescEndPacket | DescIntr | (hmp->rx_buf_sz - 2)); | 1154 | DescEndPacket | DescIntr | (hmp->rx_buf_sz - 2)); |
1155 | } | 1155 | } |
@@ -1210,7 +1210,7 @@ static void hamachi_init_ring(struct net_device *dev) | |||
1210 | skb->dev = dev; /* Mark as being used by this device. */ | 1210 | skb->dev = dev; /* Mark as being used by this device. */ |
1211 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ | 1211 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ |
1212 | hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, | 1212 | hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, |
1213 | skb->tail, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); | 1213 | skb->data, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); |
1214 | /* -2 because it doesn't REALLY have that first 2 bytes -KDU */ | 1214 | /* -2 because it doesn't REALLY have that first 2 bytes -KDU */ |
1215 | hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | | 1215 | hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn | |
1216 | DescEndPacket | DescIntr | (hmp->rx_buf_sz -2)); | 1216 | DescEndPacket | DescIntr | (hmp->rx_buf_sz -2)); |
@@ -1509,7 +1509,7 @@ static int hamachi_rx(struct net_device *dev) | |||
1509 | desc->addr, | 1509 | desc->addr, |
1510 | hmp->rx_buf_sz, | 1510 | hmp->rx_buf_sz, |
1511 | PCI_DMA_FROMDEVICE); | 1511 | PCI_DMA_FROMDEVICE); |
1512 | buf_addr = (u8 *) hmp->rx_skbuff[entry]->tail; | 1512 | buf_addr = (u8 *) hmp->rx_skbuff[entry]->data; |
1513 | frame_status = le32_to_cpu(get_unaligned((s32*)&(buf_addr[data_size - 12]))); | 1513 | frame_status = le32_to_cpu(get_unaligned((s32*)&(buf_addr[data_size - 12]))); |
1514 | if (hamachi_debug > 4) | 1514 | if (hamachi_debug > 4) |
1515 | printk(KERN_DEBUG " hamachi_rx() status was %8.8x.\n", | 1515 | printk(KERN_DEBUG " hamachi_rx() status was %8.8x.\n", |
@@ -1678,7 +1678,7 @@ static int hamachi_rx(struct net_device *dev) | |||
1678 | skb->dev = dev; /* Mark as being used by this device. */ | 1678 | skb->dev = dev; /* Mark as being used by this device. */ |
1679 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 1679 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
1680 | desc->addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, | 1680 | desc->addr = cpu_to_leXX(pci_map_single(hmp->pci_dev, |
1681 | skb->tail, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); | 1681 | skb->data, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE)); |
1682 | } | 1682 | } |
1683 | desc->status_n_length = cpu_to_le32(hmp->rx_buf_sz); | 1683 | desc->status_n_length = cpu_to_le32(hmp->rx_buf_sz); |
1684 | if (entry >= RX_RING_SIZE-1) | 1684 | if (entry >= RX_RING_SIZE-1) |
@@ -1772,9 +1772,9 @@ static int hamachi_close(struct net_device *dev) | |||
1772 | readl(ioaddr + RxCurPtr) == (long)&hmp->rx_ring[i] ? '>' : ' ', | 1772 | readl(ioaddr + RxCurPtr) == (long)&hmp->rx_ring[i] ? '>' : ' ', |
1773 | i, hmp->rx_ring[i].status_n_length, hmp->rx_ring[i].addr); | 1773 | i, hmp->rx_ring[i].status_n_length, hmp->rx_ring[i].addr); |
1774 | if (hamachi_debug > 6) { | 1774 | if (hamachi_debug > 6) { |
1775 | if (*(u8*)hmp->rx_skbuff[i]->tail != 0x69) { | 1775 | if (*(u8*)hmp->rx_skbuff[i]->data != 0x69) { |
1776 | u16 *addr = (u16 *) | 1776 | u16 *addr = (u16 *) |
1777 | hmp->rx_skbuff[i]->tail; | 1777 | hmp->rx_skbuff[i]->data; |
1778 | int j; | 1778 | int j; |
1779 | 1779 | ||
1780 | for (j = 0; j < 0x50; j++) | 1780 | for (j = 0; j < 0x50; j++) |
diff --git a/drivers/net/lance.c b/drivers/net/lance.c index ca90f0d1e4b0..b4929beb33b2 100644 --- a/drivers/net/lance.c +++ b/drivers/net/lance.c | |||
@@ -862,7 +862,7 @@ lance_init_ring(struct net_device *dev, int gfp) | |||
862 | lp->rx_skbuff[i] = skb; | 862 | lp->rx_skbuff[i] = skb; |
863 | if (skb) { | 863 | if (skb) { |
864 | skb->dev = dev; | 864 | skb->dev = dev; |
865 | rx_buff = skb->tail; | 865 | rx_buff = skb->data; |
866 | } else | 866 | } else |
867 | rx_buff = kmalloc(PKT_BUF_SZ, GFP_DMA | gfp); | 867 | rx_buff = kmalloc(PKT_BUF_SZ, GFP_DMA | gfp); |
868 | if (rx_buff == NULL) | 868 | if (rx_buff == NULL) |
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c index 5e263fcba669..41bad07ac1ac 100644 --- a/drivers/net/lasi_82596.c +++ b/drivers/net/lasi_82596.c | |||
@@ -553,14 +553,14 @@ static inline void init_rx_bufs(struct net_device *dev) | |||
553 | if (skb == NULL) | 553 | if (skb == NULL) |
554 | panic("%s: alloc_skb() failed", __FILE__); | 554 | panic("%s: alloc_skb() failed", __FILE__); |
555 | skb_reserve(skb, 2); | 555 | skb_reserve(skb, 2); |
556 | dma_addr = dma_map_single(lp->dev, skb->tail,PKT_BUF_SZ, | 556 | dma_addr = dma_map_single(lp->dev, skb->data,PKT_BUF_SZ, |
557 | DMA_FROM_DEVICE); | 557 | DMA_FROM_DEVICE); |
558 | skb->dev = dev; | 558 | skb->dev = dev; |
559 | rbd->v_next = rbd+1; | 559 | rbd->v_next = rbd+1; |
560 | rbd->b_next = WSWAPrbd(virt_to_dma(lp,rbd+1)); | 560 | rbd->b_next = WSWAPrbd(virt_to_dma(lp,rbd+1)); |
561 | rbd->b_addr = WSWAPrbd(virt_to_dma(lp,rbd)); | 561 | rbd->b_addr = WSWAPrbd(virt_to_dma(lp,rbd)); |
562 | rbd->skb = skb; | 562 | rbd->skb = skb; |
563 | rbd->v_data = skb->tail; | 563 | rbd->v_data = skb->data; |
564 | rbd->b_data = WSWAPchar(dma_addr); | 564 | rbd->b_data = WSWAPchar(dma_addr); |
565 | rbd->size = PKT_BUF_SZ; | 565 | rbd->size = PKT_BUF_SZ; |
566 | } | 566 | } |
@@ -783,8 +783,8 @@ static inline int i596_rx(struct net_device *dev) | |||
783 | rx_in_place = 1; | 783 | rx_in_place = 1; |
784 | rbd->skb = newskb; | 784 | rbd->skb = newskb; |
785 | newskb->dev = dev; | 785 | newskb->dev = dev; |
786 | dma_addr = dma_map_single(lp->dev, newskb->tail, PKT_BUF_SZ, DMA_FROM_DEVICE); | 786 | dma_addr = dma_map_single(lp->dev, newskb->data, PKT_BUF_SZ, DMA_FROM_DEVICE); |
787 | rbd->v_data = newskb->tail; | 787 | rbd->v_data = newskb->data; |
788 | rbd->b_data = WSWAPchar(dma_addr); | 788 | rbd->b_data = WSWAPchar(dma_addr); |
789 | CHECK_WBACK_INV(rbd, sizeof(struct i596_rbd)); | 789 | CHECK_WBACK_INV(rbd, sizeof(struct i596_rbd)); |
790 | } | 790 | } |
diff --git a/drivers/net/mace.c b/drivers/net/mace.c index 6ed2d7dbd44c..81d0a26e4f41 100644 --- a/drivers/net/mace.c +++ b/drivers/net/mace.c | |||
@@ -109,7 +109,7 @@ bitrev(int b) | |||
109 | } | 109 | } |
110 | 110 | ||
111 | 111 | ||
112 | static int __devinit mace_probe(struct macio_dev *mdev, const struct of_match *match) | 112 | static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_id *match) |
113 | { | 113 | { |
114 | struct device_node *mace = macio_get_of_node(mdev); | 114 | struct device_node *mace = macio_get_of_node(mdev); |
115 | struct net_device *dev; | 115 | struct net_device *dev; |
@@ -1009,12 +1009,10 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
1009 | return IRQ_HANDLED; | 1009 | return IRQ_HANDLED; |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | static struct of_match mace_match[] = | 1012 | static struct of_device_id mace_match[] = |
1013 | { | 1013 | { |
1014 | { | 1014 | { |
1015 | .name = "mace", | 1015 | .name = "mace", |
1016 | .type = OF_ANY_MATCH, | ||
1017 | .compatible = OF_ANY_MATCH | ||
1018 | }, | 1016 | }, |
1019 | {}, | 1017 | {}, |
1020 | }; | 1018 | }; |
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index babb59e146ea..9d6d2548c2d3 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -1926,7 +1926,7 @@ static void refill_rx(struct net_device *dev) | |||
1926 | break; /* Better luck next round. */ | 1926 | break; /* Better luck next round. */ |
1927 | skb->dev = dev; /* Mark as being used by this device. */ | 1927 | skb->dev = dev; /* Mark as being used by this device. */ |
1928 | np->rx_dma[entry] = pci_map_single(np->pci_dev, | 1928 | np->rx_dma[entry] = pci_map_single(np->pci_dev, |
1929 | skb->tail, buflen, PCI_DMA_FROMDEVICE); | 1929 | skb->data, buflen, PCI_DMA_FROMDEVICE); |
1930 | np->rx_ring[entry].addr = cpu_to_le32(np->rx_dma[entry]); | 1930 | np->rx_ring[entry].addr = cpu_to_le32(np->rx_dma[entry]); |
1931 | } | 1931 | } |
1932 | np->rx_ring[entry].cmd_status = cpu_to_le32(np->rx_buf_sz); | 1932 | np->rx_ring[entry].cmd_status = cpu_to_le32(np->rx_buf_sz); |
@@ -2280,7 +2280,7 @@ static void netdev_rx(struct net_device *dev) | |||
2280 | buflen, | 2280 | buflen, |
2281 | PCI_DMA_FROMDEVICE); | 2281 | PCI_DMA_FROMDEVICE); |
2282 | eth_copy_and_sum(skb, | 2282 | eth_copy_and_sum(skb, |
2283 | np->rx_skbuff[entry]->tail, pkt_len, 0); | 2283 | np->rx_skbuff[entry]->data, pkt_len, 0); |
2284 | skb_put(skb, pkt_len); | 2284 | skb_put(skb, pkt_len); |
2285 | pci_dma_sync_single_for_device(np->pci_dev, | 2285 | pci_dma_sync_single_for_device(np->pci_dev, |
2286 | np->rx_dma[entry], | 2286 | np->rx_dma[entry], |
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index cc7965271778..e64df4d0800b 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c | |||
@@ -574,7 +574,7 @@ static inline int ns83820_add_rx_skb(struct ns83820 *dev, struct sk_buff *skb) | |||
574 | 574 | ||
575 | dev->rx_info.next_empty = (next_empty + 1) % NR_RX_DESC; | 575 | dev->rx_info.next_empty = (next_empty + 1) % NR_RX_DESC; |
576 | cmdsts = REAL_RX_BUF_SIZE | CMDSTS_INTR; | 576 | cmdsts = REAL_RX_BUF_SIZE | CMDSTS_INTR; |
577 | buf = pci_map_single(dev->pci_dev, skb->tail, | 577 | buf = pci_map_single(dev->pci_dev, skb->data, |
578 | REAL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 578 | REAL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
579 | build_rx_desc(dev, sg, 0, buf, cmdsts, 0); | 579 | build_rx_desc(dev, sg, 0, buf, cmdsts, 0); |
580 | /* update link of previous rx */ | 580 | /* update link of previous rx */ |
@@ -604,7 +604,7 @@ static inline int rx_refill(struct net_device *ndev, int gfp) | |||
604 | if (unlikely(!skb)) | 604 | if (unlikely(!skb)) |
605 | break; | 605 | break; |
606 | 606 | ||
607 | res = (long)skb->tail & 0xf; | 607 | res = (long)skb->data & 0xf; |
608 | res = 0x10 - res; | 608 | res = 0x10 - res; |
609 | res &= 0xf; | 609 | res &= 0xf; |
610 | skb_reserve(skb, res); | 610 | skb_reserve(skb, res); |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 3213f3e50487..113b68099216 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -1602,7 +1602,7 @@ pcnet32_init_ring(struct net_device *dev) | |||
1602 | 1602 | ||
1603 | rmb(); | 1603 | rmb(); |
1604 | if (lp->rx_dma_addr[i] == 0) | 1604 | if (lp->rx_dma_addr[i] == 0) |
1605 | lp->rx_dma_addr[i] = pci_map_single(lp->pci_dev, rx_skbuff->tail, | 1605 | lp->rx_dma_addr[i] = pci_map_single(lp->pci_dev, rx_skbuff->data, |
1606 | PKT_BUF_SZ-2, PCI_DMA_FROMDEVICE); | 1606 | PKT_BUF_SZ-2, PCI_DMA_FROMDEVICE); |
1607 | lp->rx_ring[i].base = (u32)le32_to_cpu(lp->rx_dma_addr[i]); | 1607 | lp->rx_ring[i].base = (u32)le32_to_cpu(lp->rx_dma_addr[i]); |
1608 | lp->rx_ring[i].buf_length = le16_to_cpu(2-PKT_BUF_SZ); | 1608 | lp->rx_ring[i].buf_length = le16_to_cpu(2-PKT_BUF_SZ); |
@@ -1983,7 +1983,7 @@ pcnet32_rx(struct net_device *dev) | |||
1983 | lp->rx_skbuff[entry] = newskb; | 1983 | lp->rx_skbuff[entry] = newskb; |
1984 | newskb->dev = dev; | 1984 | newskb->dev = dev; |
1985 | lp->rx_dma_addr[entry] = | 1985 | lp->rx_dma_addr[entry] = |
1986 | pci_map_single(lp->pci_dev, newskb->tail, | 1986 | pci_map_single(lp->pci_dev, newskb->data, |
1987 | PKT_BUF_SZ-2, PCI_DMA_FROMDEVICE); | 1987 | PKT_BUF_SZ-2, PCI_DMA_FROMDEVICE); |
1988 | lp->rx_ring[entry].base = le32_to_cpu(lp->rx_dma_addr[entry]); | 1988 | lp->rx_ring[entry].base = le32_to_cpu(lp->rx_dma_addr[entry]); |
1989 | rx_in_place = 1; | 1989 | rx_in_place = 1; |
@@ -2020,7 +2020,7 @@ pcnet32_rx(struct net_device *dev) | |||
2020 | PKT_BUF_SZ-2, | 2020 | PKT_BUF_SZ-2, |
2021 | PCI_DMA_FROMDEVICE); | 2021 | PCI_DMA_FROMDEVICE); |
2022 | eth_copy_and_sum(skb, | 2022 | eth_copy_and_sum(skb, |
2023 | (unsigned char *)(lp->rx_skbuff[entry]->tail), | 2023 | (unsigned char *)(lp->rx_skbuff[entry]->data), |
2024 | pkt_len,0); | 2024 | pkt_len,0); |
2025 | pci_dma_sync_single_for_device(lp->pci_dev, | 2025 | pci_dma_sync_single_for_device(lp->pci_dev, |
2026 | lp->rx_dma_addr[entry], | 2026 | lp->rx_dma_addr[entry], |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index ce449fe90e6d..d5afe05cd826 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1876,7 +1876,7 @@ static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff, | |||
1876 | skb_reserve(skb, NET_IP_ALIGN); | 1876 | skb_reserve(skb, NET_IP_ALIGN); |
1877 | *sk_buff = skb; | 1877 | *sk_buff = skb; |
1878 | 1878 | ||
1879 | mapping = pci_map_single(pdev, skb->tail, rx_buf_sz, | 1879 | mapping = pci_map_single(pdev, skb->data, rx_buf_sz, |
1880 | PCI_DMA_FROMDEVICE); | 1880 | PCI_DMA_FROMDEVICE); |
1881 | 1881 | ||
1882 | rtl8169_map_to_asic(desc, mapping, rx_buf_sz); | 1882 | rtl8169_map_to_asic(desc, mapping, rx_buf_sz); |
@@ -2336,7 +2336,7 @@ static inline int rtl8169_try_rx_copy(struct sk_buff **sk_buff, int pkt_size, | |||
2336 | skb = dev_alloc_skb(pkt_size + NET_IP_ALIGN); | 2336 | skb = dev_alloc_skb(pkt_size + NET_IP_ALIGN); |
2337 | if (skb) { | 2337 | if (skb) { |
2338 | skb_reserve(skb, NET_IP_ALIGN); | 2338 | skb_reserve(skb, NET_IP_ALIGN); |
2339 | eth_copy_and_sum(skb, sk_buff[0]->tail, pkt_size, 0); | 2339 | eth_copy_and_sum(skb, sk_buff[0]->data, pkt_size, 0); |
2340 | *sk_buff = skb; | 2340 | *sk_buff = skb; |
2341 | rtl8169_mark_to_asic(desc, rx_buf_sz); | 2341 | rtl8169_mark_to_asic(desc, rx_buf_sz); |
2342 | ret = 0; | 2342 | ret = 0; |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index bb639a8794d4..ea638b162d3f 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -1699,11 +1699,9 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | |||
1699 | #else | 1699 | #else |
1700 | ba = &nic->ba[ring_no][block_no][off]; | 1700 | ba = &nic->ba[ring_no][block_no][off]; |
1701 | skb_reserve(skb, BUF0_LEN); | 1701 | skb_reserve(skb, BUF0_LEN); |
1702 | tmp = (unsigned long) skb->data; | 1702 | tmp = ((unsigned long) skb->data & ALIGN_SIZE); |
1703 | tmp += ALIGN_SIZE; | 1703 | if (tmp) |
1704 | tmp &= ~ALIGN_SIZE; | 1704 | skb_reserve(skb, (ALIGN_SIZE + 1) - tmp); |
1705 | skb->data = (void *) tmp; | ||
1706 | skb->tail = (void *) tmp; | ||
1707 | 1705 | ||
1708 | memset(rxdp, 0, sizeof(RxD_t)); | 1706 | memset(rxdp, 0, sizeof(RxD_t)); |
1709 | rxdp->Buffer2_ptr = pci_map_single | 1707 | rxdp->Buffer2_ptr = pci_map_single |
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c index fd2e7c374906..7abd55a4fb21 100644 --- a/drivers/net/sb1250-mac.c +++ b/drivers/net/sb1250-mac.c | |||
@@ -963,11 +963,11 @@ static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb) | |||
963 | /* | 963 | /* |
964 | * Do not interrupt per DMA transfer. | 964 | * Do not interrupt per DMA transfer. |
965 | */ | 965 | */ |
966 | dsc->dscr_a = virt_to_phys(sb_new->tail) | | 966 | dsc->dscr_a = virt_to_phys(sb_new->data) | |
967 | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | | 967 | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | |
968 | 0; | 968 | 0; |
969 | #else | 969 | #else |
970 | dsc->dscr_a = virt_to_phys(sb_new->tail) | | 970 | dsc->dscr_a = virt_to_phys(sb_new->data) | |
971 | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | | 971 | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | |
972 | M_DMA_DSCRA_INTERRUPT; | 972 | M_DMA_DSCRA_INTERRUPT; |
973 | #endif | 973 | #endif |
diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c index 20edeb345792..3ad0b6751f6f 100644 --- a/drivers/net/shaper.c +++ b/drivers/net/shaper.c | |||
@@ -135,10 +135,8 @@ static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
135 | { | 135 | { |
136 | struct shaper *shaper = dev->priv; | 136 | struct shaper *shaper = dev->priv; |
137 | struct sk_buff *ptr; | 137 | struct sk_buff *ptr; |
138 | 138 | ||
139 | if (down_trylock(&shaper->sem)) | 139 | spin_lock(&shaper->lock); |
140 | return -1; | ||
141 | |||
142 | ptr=shaper->sendq.prev; | 140 | ptr=shaper->sendq.prev; |
143 | 141 | ||
144 | /* | 142 | /* |
@@ -232,7 +230,7 @@ static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
232 | shaper->stats.collisions++; | 230 | shaper->stats.collisions++; |
233 | } | 231 | } |
234 | shaper_kick(shaper); | 232 | shaper_kick(shaper); |
235 | up(&shaper->sem); | 233 | spin_unlock(&shaper->lock); |
236 | return 0; | 234 | return 0; |
237 | } | 235 | } |
238 | 236 | ||
@@ -271,11 +269,9 @@ static void shaper_timer(unsigned long data) | |||
271 | { | 269 | { |
272 | struct shaper *shaper = (struct shaper *)data; | 270 | struct shaper *shaper = (struct shaper *)data; |
273 | 271 | ||
274 | if (!down_trylock(&shaper->sem)) { | 272 | spin_lock(&shaper->lock); |
275 | shaper_kick(shaper); | 273 | shaper_kick(shaper); |
276 | up(&shaper->sem); | 274 | spin_unlock(&shaper->lock); |
277 | } else | ||
278 | mod_timer(&shaper->timer, jiffies); | ||
279 | } | 275 | } |
280 | 276 | ||
281 | /* | 277 | /* |
@@ -332,21 +328,6 @@ static void shaper_kick(struct shaper *shaper) | |||
332 | 328 | ||
333 | 329 | ||
334 | /* | 330 | /* |
335 | * Flush the shaper queues on a closedown | ||
336 | */ | ||
337 | |||
338 | static void shaper_flush(struct shaper *shaper) | ||
339 | { | ||
340 | struct sk_buff *skb; | ||
341 | |||
342 | down(&shaper->sem); | ||
343 | while((skb=skb_dequeue(&shaper->sendq))!=NULL) | ||
344 | dev_kfree_skb(skb); | ||
345 | shaper_kick(shaper); | ||
346 | up(&shaper->sem); | ||
347 | } | ||
348 | |||
349 | /* | ||
350 | * Bring the interface up. We just disallow this until a | 331 | * Bring the interface up. We just disallow this until a |
351 | * bind. | 332 | * bind. |
352 | */ | 333 | */ |
@@ -375,7 +356,15 @@ static int shaper_open(struct net_device *dev) | |||
375 | static int shaper_close(struct net_device *dev) | 356 | static int shaper_close(struct net_device *dev) |
376 | { | 357 | { |
377 | struct shaper *shaper=dev->priv; | 358 | struct shaper *shaper=dev->priv; |
378 | shaper_flush(shaper); | 359 | struct sk_buff *skb; |
360 | |||
361 | while ((skb = skb_dequeue(&shaper->sendq)) != NULL) | ||
362 | dev_kfree_skb(skb); | ||
363 | |||
364 | spin_lock_bh(&shaper->lock); | ||
365 | shaper_kick(shaper); | ||
366 | spin_unlock_bh(&shaper->lock); | ||
367 | |||
379 | del_timer_sync(&shaper->timer); | 368 | del_timer_sync(&shaper->timer); |
380 | return 0; | 369 | return 0; |
381 | } | 370 | } |
@@ -576,6 +565,7 @@ static void shaper_init_priv(struct net_device *dev) | |||
576 | init_timer(&sh->timer); | 565 | init_timer(&sh->timer); |
577 | sh->timer.function=shaper_timer; | 566 | sh->timer.function=shaper_timer; |
578 | sh->timer.data=(unsigned long)sh; | 567 | sh->timer.data=(unsigned long)sh; |
568 | spin_lock_init(&sh->lock); | ||
579 | } | 569 | } |
580 | 570 | ||
581 | /* | 571 | /* |
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index 127324f014de..23b713c700b3 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c | |||
@@ -1154,7 +1154,7 @@ sis900_init_rx_ring(struct net_device *net_dev) | |||
1154 | sis_priv->rx_skbuff[i] = skb; | 1154 | sis_priv->rx_skbuff[i] = skb; |
1155 | sis_priv->rx_ring[i].cmdsts = RX_BUF_SIZE; | 1155 | sis_priv->rx_ring[i].cmdsts = RX_BUF_SIZE; |
1156 | sis_priv->rx_ring[i].bufptr = pci_map_single(sis_priv->pci_dev, | 1156 | sis_priv->rx_ring[i].bufptr = pci_map_single(sis_priv->pci_dev, |
1157 | skb->tail, RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 1157 | skb->data, RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
1158 | } | 1158 | } |
1159 | sis_priv->dirty_rx = (unsigned int) (i - NUM_RX_DESC); | 1159 | sis_priv->dirty_rx = (unsigned int) (i - NUM_RX_DESC); |
1160 | 1160 | ||
@@ -1776,7 +1776,7 @@ static int sis900_rx(struct net_device *net_dev) | |||
1776 | sis_priv->rx_skbuff[entry] = skb; | 1776 | sis_priv->rx_skbuff[entry] = skb; |
1777 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; | 1777 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; |
1778 | sis_priv->rx_ring[entry].bufptr = | 1778 | sis_priv->rx_ring[entry].bufptr = |
1779 | pci_map_single(sis_priv->pci_dev, skb->tail, | 1779 | pci_map_single(sis_priv->pci_dev, skb->data, |
1780 | RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 1780 | RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
1781 | sis_priv->dirty_rx++; | 1781 | sis_priv->dirty_rx++; |
1782 | } | 1782 | } |
@@ -1809,7 +1809,7 @@ static int sis900_rx(struct net_device *net_dev) | |||
1809 | sis_priv->rx_skbuff[entry] = skb; | 1809 | sis_priv->rx_skbuff[entry] = skb; |
1810 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; | 1810 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; |
1811 | sis_priv->rx_ring[entry].bufptr = | 1811 | sis_priv->rx_ring[entry].bufptr = |
1812 | pci_map_single(sis_priv->pci_dev, skb->tail, | 1812 | pci_map_single(sis_priv->pci_dev, skb->data, |
1813 | RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 1813 | RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
1814 | } | 1814 | } |
1815 | } | 1815 | } |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 30e8d589d167..3dbb1cb09ed8 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * of the original driver such as link fail-over and link management because | 7 | * of the original driver such as link fail-over and link management because |
8 | * those should be done at higher levels. | 8 | * those should be done at higher levels. |
9 | * | 9 | * |
10 | * Copyright (C) 2004, Stephen Hemminger <shemminger@osdl.org> | 10 | * Copyright (C) 2004, 2005 Stephen Hemminger <shemminger@osdl.org> |
11 | * | 11 | * |
12 | * 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 |
13 | * 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 |
@@ -42,19 +42,20 @@ | |||
42 | #include "skge.h" | 42 | #include "skge.h" |
43 | 43 | ||
44 | #define DRV_NAME "skge" | 44 | #define DRV_NAME "skge" |
45 | #define DRV_VERSION "0.6" | 45 | #define DRV_VERSION "0.7" |
46 | #define PFX DRV_NAME " " | 46 | #define PFX DRV_NAME " " |
47 | 47 | ||
48 | #define DEFAULT_TX_RING_SIZE 128 | 48 | #define DEFAULT_TX_RING_SIZE 128 |
49 | #define DEFAULT_RX_RING_SIZE 512 | 49 | #define DEFAULT_RX_RING_SIZE 512 |
50 | #define MAX_TX_RING_SIZE 1024 | 50 | #define MAX_TX_RING_SIZE 1024 |
51 | #define MAX_RX_RING_SIZE 4096 | 51 | #define MAX_RX_RING_SIZE 4096 |
52 | #define RX_COPY_THRESHOLD 128 | ||
53 | #define RX_BUF_SIZE 1536 | ||
52 | #define PHY_RETRIES 1000 | 54 | #define PHY_RETRIES 1000 |
53 | #define ETH_JUMBO_MTU 9000 | 55 | #define ETH_JUMBO_MTU 9000 |
54 | #define TX_WATCHDOG (5 * HZ) | 56 | #define TX_WATCHDOG (5 * HZ) |
55 | #define NAPI_WEIGHT 64 | 57 | #define NAPI_WEIGHT 64 |
56 | #define BLINK_HZ (HZ/4) | 58 | #define BLINK_HZ (HZ/4) |
57 | #define LINK_POLL_HZ (HZ/10) | ||
58 | 59 | ||
59 | MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver"); | 60 | MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver"); |
60 | MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); | 61 | MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); |
@@ -70,28 +71,17 @@ module_param(debug, int, 0); | |||
70 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | 71 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); |
71 | 72 | ||
72 | static const struct pci_device_id skge_id_table[] = { | 73 | static const struct pci_device_id skge_id_table[] = { |
73 | { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C940, | 74 | { PCI_DEVICE(PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C940) }, |
74 | PCI_ANY_ID, PCI_ANY_ID }, | 75 | { PCI_DEVICE(PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C940B) }, |
75 | { PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C940B, | 76 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE) }, |
76 | PCI_ANY_ID, PCI_ANY_ID }, | 77 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU) }, |
77 | { PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE, | 78 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */ |
78 | PCI_ANY_ID, PCI_ANY_ID }, | 79 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T), }, |
79 | { PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU, | 80 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4320) }, |
80 | PCI_ANY_ID, PCI_ANY_ID }, | 81 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5005) }, /* Belkin */ |
81 | { PCI_VENDOR_ID_SYSKONNECT, 0x9E00, /* SK-9Exx */ | 82 | { PCI_DEVICE(PCI_VENDOR_ID_CNET, PCI_DEVICE_ID_CNET_GIGACARD) }, |
82 | PCI_ANY_ID, PCI_ANY_ID }, | 83 | { PCI_DEVICE(PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_LINKSYS_EG1032) }, |
83 | { PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T, | 84 | { PCI_DEVICE(PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_LINKSYS_EG1064) }, |
84 | PCI_ANY_ID, PCI_ANY_ID }, | ||
85 | { PCI_VENDOR_ID_MARVELL, 0x4320, /* Gigabit Ethernet Controller */ | ||
86 | PCI_ANY_ID, PCI_ANY_ID }, | ||
87 | { PCI_VENDOR_ID_MARVELL, 0x5005, /* Marvell (11ab), Belkin */ | ||
88 | PCI_ANY_ID, PCI_ANY_ID }, | ||
89 | { PCI_VENDOR_ID_CNET, PCI_DEVICE_ID_CNET_GIGACARD, | ||
90 | PCI_ANY_ID, PCI_ANY_ID }, | ||
91 | { PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_LINKSYS_EG1032, | ||
92 | PCI_ANY_ID, PCI_ANY_ID }, | ||
93 | { PCI_VENDOR_ID_LINKSYS, PCI_DEVICE_ID_LINKSYS_EG1064, | ||
94 | PCI_ANY_ID, PCI_ANY_ID }, | ||
95 | { 0 } | 85 | { 0 } |
96 | }; | 86 | }; |
97 | MODULE_DEVICE_TABLE(pci, skge_id_table); | 87 | MODULE_DEVICE_TABLE(pci, skge_id_table); |
@@ -99,19 +89,22 @@ MODULE_DEVICE_TABLE(pci, skge_id_table); | |||
99 | static int skge_up(struct net_device *dev); | 89 | static int skge_up(struct net_device *dev); |
100 | static int skge_down(struct net_device *dev); | 90 | static int skge_down(struct net_device *dev); |
101 | static void skge_tx_clean(struct skge_port *skge); | 91 | static void skge_tx_clean(struct skge_port *skge); |
102 | static void skge_xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); | 92 | static void xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); |
103 | static void skge_gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); | 93 | static void gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); |
104 | static void genesis_get_stats(struct skge_port *skge, u64 *data); | 94 | static void genesis_get_stats(struct skge_port *skge, u64 *data); |
105 | static void yukon_get_stats(struct skge_port *skge, u64 *data); | 95 | static void yukon_get_stats(struct skge_port *skge, u64 *data); |
106 | static void yukon_init(struct skge_hw *hw, int port); | 96 | static void yukon_init(struct skge_hw *hw, int port); |
107 | static void yukon_reset(struct skge_hw *hw, int port); | 97 | static void yukon_reset(struct skge_hw *hw, int port); |
108 | static void genesis_mac_init(struct skge_hw *hw, int port); | 98 | static void genesis_mac_init(struct skge_hw *hw, int port); |
109 | static void genesis_reset(struct skge_hw *hw, int port); | 99 | static void genesis_reset(struct skge_hw *hw, int port); |
100 | static void genesis_link_up(struct skge_port *skge); | ||
110 | 101 | ||
102 | /* Avoid conditionals by using array */ | ||
111 | static const int txqaddr[] = { Q_XA1, Q_XA2 }; | 103 | static const int txqaddr[] = { Q_XA1, Q_XA2 }; |
112 | static const int rxqaddr[] = { Q_R1, Q_R2 }; | 104 | static const int rxqaddr[] = { Q_R1, Q_R2 }; |
113 | static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F }; | 105 | static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F }; |
114 | static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F }; | 106 | static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F }; |
107 | static const u32 portirqmask[] = { IS_PORT_1, IS_PORT_2 }; | ||
115 | 108 | ||
116 | /* Don't need to look at whole 16K. | 109 | /* Don't need to look at whole 16K. |
117 | * last interesting register is descriptor poll timer. | 110 | * last interesting register is descriptor poll timer. |
@@ -154,7 +147,7 @@ static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
154 | static int wol_supported(const struct skge_hw *hw) | 147 | static int wol_supported(const struct skge_hw *hw) |
155 | { | 148 | { |
156 | return !((hw->chip_id == CHIP_ID_GENESIS || | 149 | return !((hw->chip_id == CHIP_ID_GENESIS || |
157 | (hw->chip_id == CHIP_ID_YUKON && chip_rev(hw) == 0))); | 150 | (hw->chip_id == CHIP_ID_YUKON && hw->chip_rev == 0))); |
158 | } | 151 | } |
159 | 152 | ||
160 | static void skge_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | 153 | static void skge_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) |
@@ -170,7 +163,7 @@ static int skge_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
170 | struct skge_port *skge = netdev_priv(dev); | 163 | struct skge_port *skge = netdev_priv(dev); |
171 | struct skge_hw *hw = skge->hw; | 164 | struct skge_hw *hw = skge->hw; |
172 | 165 | ||
173 | if(wol->wolopts != WAKE_MAGIC && wol->wolopts != 0) | 166 | if (wol->wolopts != WAKE_MAGIC && wol->wolopts != 0) |
174 | return -EOPNOTSUPP; | 167 | return -EOPNOTSUPP; |
175 | 168 | ||
176 | if (wol->wolopts == WAKE_MAGIC && !wol_supported(hw)) | 169 | if (wol->wolopts == WAKE_MAGIC && !wol_supported(hw)) |
@@ -190,6 +183,36 @@ static int skge_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
190 | return 0; | 183 | return 0; |
191 | } | 184 | } |
192 | 185 | ||
186 | /* Determine supported/adverised modes based on hardware. | ||
187 | * Note: ethtoool ADVERTISED_xxx == SUPPORTED_xxx | ||
188 | */ | ||
189 | static u32 skge_supported_modes(const struct skge_hw *hw) | ||
190 | { | ||
191 | u32 supported; | ||
192 | |||
193 | if (iscopper(hw)) { | ||
194 | supported = SUPPORTED_10baseT_Half | ||
195 | | SUPPORTED_10baseT_Full | ||
196 | | SUPPORTED_100baseT_Half | ||
197 | | SUPPORTED_100baseT_Full | ||
198 | | SUPPORTED_1000baseT_Half | ||
199 | | SUPPORTED_1000baseT_Full | ||
200 | | SUPPORTED_Autoneg| SUPPORTED_TP; | ||
201 | |||
202 | if (hw->chip_id == CHIP_ID_GENESIS) | ||
203 | supported &= ~(SUPPORTED_10baseT_Half | ||
204 | | SUPPORTED_10baseT_Full | ||
205 | | SUPPORTED_100baseT_Half | ||
206 | | SUPPORTED_100baseT_Full); | ||
207 | |||
208 | else if (hw->chip_id == CHIP_ID_YUKON) | ||
209 | supported &= ~SUPPORTED_1000baseT_Half; | ||
210 | } else | ||
211 | supported = SUPPORTED_1000baseT_Full | SUPPORTED_FIBRE | ||
212 | | SUPPORTED_Autoneg; | ||
213 | |||
214 | return supported; | ||
215 | } | ||
193 | 216 | ||
194 | static int skge_get_settings(struct net_device *dev, | 217 | static int skge_get_settings(struct net_device *dev, |
195 | struct ethtool_cmd *ecmd) | 218 | struct ethtool_cmd *ecmd) |
@@ -198,38 +221,13 @@ static int skge_get_settings(struct net_device *dev, | |||
198 | struct skge_hw *hw = skge->hw; | 221 | struct skge_hw *hw = skge->hw; |
199 | 222 | ||
200 | ecmd->transceiver = XCVR_INTERNAL; | 223 | ecmd->transceiver = XCVR_INTERNAL; |
224 | ecmd->supported = skge_supported_modes(hw); | ||
201 | 225 | ||
202 | if (iscopper(hw)) { | 226 | if (iscopper(hw)) { |
203 | if (hw->chip_id == CHIP_ID_GENESIS) | ||
204 | ecmd->supported = SUPPORTED_1000baseT_Full | ||
205 | | SUPPORTED_1000baseT_Half | ||
206 | | SUPPORTED_Autoneg | SUPPORTED_TP; | ||
207 | else { | ||
208 | ecmd->supported = SUPPORTED_10baseT_Half | ||
209 | | SUPPORTED_10baseT_Full | ||
210 | | SUPPORTED_100baseT_Half | ||
211 | | SUPPORTED_100baseT_Full | ||
212 | | SUPPORTED_1000baseT_Half | ||
213 | | SUPPORTED_1000baseT_Full | ||
214 | | SUPPORTED_Autoneg| SUPPORTED_TP; | ||
215 | |||
216 | if (hw->chip_id == CHIP_ID_YUKON) | ||
217 | ecmd->supported &= ~SUPPORTED_1000baseT_Half; | ||
218 | |||
219 | else if (hw->chip_id == CHIP_ID_YUKON_FE) | ||
220 | ecmd->supported &= ~(SUPPORTED_1000baseT_Half | ||
221 | | SUPPORTED_1000baseT_Full); | ||
222 | } | ||
223 | |||
224 | ecmd->port = PORT_TP; | 227 | ecmd->port = PORT_TP; |
225 | ecmd->phy_address = hw->phy_addr; | 228 | ecmd->phy_address = hw->phy_addr; |
226 | } else { | 229 | } else |
227 | ecmd->supported = SUPPORTED_1000baseT_Full | ||
228 | | SUPPORTED_FIBRE | ||
229 | | SUPPORTED_Autoneg; | ||
230 | |||
231 | ecmd->port = PORT_FIBRE; | 230 | ecmd->port = PORT_FIBRE; |
232 | } | ||
233 | 231 | ||
234 | ecmd->advertising = skge->advertising; | 232 | ecmd->advertising = skge->advertising; |
235 | ecmd->autoneg = skge->autoneg; | 233 | ecmd->autoneg = skge->autoneg; |
@@ -238,65 +236,57 @@ static int skge_get_settings(struct net_device *dev, | |||
238 | return 0; | 236 | return 0; |
239 | } | 237 | } |
240 | 238 | ||
241 | static u32 skge_modes(const struct skge_hw *hw) | ||
242 | { | ||
243 | u32 modes = ADVERTISED_Autoneg | ||
244 | | ADVERTISED_1000baseT_Full | ADVERTISED_1000baseT_Half | ||
245 | | ADVERTISED_100baseT_Full | ADVERTISED_100baseT_Half | ||
246 | | ADVERTISED_10baseT_Full | ADVERTISED_10baseT_Half; | ||
247 | |||
248 | if (iscopper(hw)) { | ||
249 | modes |= ADVERTISED_TP; | ||
250 | switch(hw->chip_id) { | ||
251 | case CHIP_ID_GENESIS: | ||
252 | modes &= ~(ADVERTISED_100baseT_Full | ||
253 | | ADVERTISED_100baseT_Half | ||
254 | | ADVERTISED_10baseT_Full | ||
255 | | ADVERTISED_10baseT_Half); | ||
256 | break; | ||
257 | |||
258 | case CHIP_ID_YUKON: | ||
259 | modes &= ~ADVERTISED_1000baseT_Half; | ||
260 | break; | ||
261 | |||
262 | case CHIP_ID_YUKON_FE: | ||
263 | modes &= ~(ADVERTISED_1000baseT_Half|ADVERTISED_1000baseT_Full); | ||
264 | break; | ||
265 | } | ||
266 | } else { | ||
267 | modes |= ADVERTISED_FIBRE; | ||
268 | modes &= ~ADVERTISED_1000baseT_Half; | ||
269 | } | ||
270 | return modes; | ||
271 | } | ||
272 | |||
273 | static int skge_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | 239 | static int skge_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
274 | { | 240 | { |
275 | struct skge_port *skge = netdev_priv(dev); | 241 | struct skge_port *skge = netdev_priv(dev); |
276 | const struct skge_hw *hw = skge->hw; | 242 | const struct skge_hw *hw = skge->hw; |
243 | u32 supported = skge_supported_modes(hw); | ||
277 | 244 | ||
278 | if (ecmd->autoneg == AUTONEG_ENABLE) { | 245 | if (ecmd->autoneg == AUTONEG_ENABLE) { |
279 | if (ecmd->advertising & skge_modes(hw)) | 246 | ecmd->advertising = supported; |
280 | return -EINVAL; | 247 | skge->duplex = -1; |
248 | skge->speed = -1; | ||
281 | } else { | 249 | } else { |
250 | u32 setting; | ||
251 | |||
282 | switch(ecmd->speed) { | 252 | switch(ecmd->speed) { |
283 | case SPEED_1000: | 253 | case SPEED_1000: |
284 | if (hw->chip_id == CHIP_ID_YUKON_FE) | 254 | if (ecmd->duplex == DUPLEX_FULL) |
255 | setting = SUPPORTED_1000baseT_Full; | ||
256 | else if (ecmd->duplex == DUPLEX_HALF) | ||
257 | setting = SUPPORTED_1000baseT_Half; | ||
258 | else | ||
285 | return -EINVAL; | 259 | return -EINVAL; |
286 | break; | 260 | break; |
287 | case SPEED_100: | 261 | case SPEED_100: |
262 | if (ecmd->duplex == DUPLEX_FULL) | ||
263 | setting = SUPPORTED_100baseT_Full; | ||
264 | else if (ecmd->duplex == DUPLEX_HALF) | ||
265 | setting = SUPPORTED_100baseT_Half; | ||
266 | else | ||
267 | return -EINVAL; | ||
268 | break; | ||
269 | |||
288 | case SPEED_10: | 270 | case SPEED_10: |
289 | if (iscopper(hw) || hw->chip_id == CHIP_ID_GENESIS) | 271 | if (ecmd->duplex == DUPLEX_FULL) |
272 | setting = SUPPORTED_10baseT_Full; | ||
273 | else if (ecmd->duplex == DUPLEX_HALF) | ||
274 | setting = SUPPORTED_10baseT_Half; | ||
275 | else | ||
290 | return -EINVAL; | 276 | return -EINVAL; |
291 | break; | 277 | break; |
292 | default: | 278 | default: |
293 | return -EINVAL; | 279 | return -EINVAL; |
294 | } | 280 | } |
281 | |||
282 | if ((setting & supported) == 0) | ||
283 | return -EINVAL; | ||
284 | |||
285 | skge->speed = ecmd->speed; | ||
286 | skge->duplex = ecmd->duplex; | ||
295 | } | 287 | } |
296 | 288 | ||
297 | skge->autoneg = ecmd->autoneg; | 289 | skge->autoneg = ecmd->autoneg; |
298 | skge->speed = ecmd->speed; | ||
299 | skge->duplex = ecmd->duplex; | ||
300 | skge->advertising = ecmd->advertising; | 290 | skge->advertising = ecmd->advertising; |
301 | 291 | ||
302 | if (netif_running(dev)) { | 292 | if (netif_running(dev)) { |
@@ -393,7 +383,7 @@ static void skge_get_strings(struct net_device *dev, u32 stringset, u8 *data) | |||
393 | { | 383 | { |
394 | int i; | 384 | int i; |
395 | 385 | ||
396 | switch(stringset) { | 386 | switch (stringset) { |
397 | case ETH_SS_STATS: | 387 | case ETH_SS_STATS: |
398 | for (i = 0; i < ARRAY_SIZE(skge_stats); i++) | 388 | for (i = 0; i < ARRAY_SIZE(skge_stats); i++) |
399 | memcpy(data + i * ETH_GSTRING_LEN, | 389 | memcpy(data + i * ETH_GSTRING_LEN, |
@@ -511,14 +501,6 @@ static int skge_set_rx_csum(struct net_device *dev, u32 data) | |||
511 | return 0; | 501 | return 0; |
512 | } | 502 | } |
513 | 503 | ||
514 | /* Only Yukon II supports TSO (not implemented yet) */ | ||
515 | static int skge_set_tso(struct net_device *dev, u32 data) | ||
516 | { | ||
517 | if (data) | ||
518 | return -EOPNOTSUPP; | ||
519 | return 0; | ||
520 | } | ||
521 | |||
522 | static void skge_get_pauseparam(struct net_device *dev, | 504 | static void skge_get_pauseparam(struct net_device *dev, |
523 | struct ethtool_pauseparam *ecmd) | 505 | struct ethtool_pauseparam *ecmd) |
524 | { | 506 | { |
@@ -540,9 +522,9 @@ static int skge_set_pauseparam(struct net_device *dev, | |||
540 | skge->autoneg = ecmd->autoneg; | 522 | skge->autoneg = ecmd->autoneg; |
541 | if (ecmd->rx_pause && ecmd->tx_pause) | 523 | if (ecmd->rx_pause && ecmd->tx_pause) |
542 | skge->flow_control = FLOW_MODE_SYMMETRIC; | 524 | skge->flow_control = FLOW_MODE_SYMMETRIC; |
543 | else if(ecmd->rx_pause && !ecmd->tx_pause) | 525 | else if (ecmd->rx_pause && !ecmd->tx_pause) |
544 | skge->flow_control = FLOW_MODE_REM_SEND; | 526 | skge->flow_control = FLOW_MODE_REM_SEND; |
545 | else if(!ecmd->rx_pause && ecmd->tx_pause) | 527 | else if (!ecmd->rx_pause && ecmd->tx_pause) |
546 | skge->flow_control = FLOW_MODE_LOC_SEND; | 528 | skge->flow_control = FLOW_MODE_LOC_SEND; |
547 | else | 529 | else |
548 | skge->flow_control = FLOW_MODE_NONE; | 530 | skge->flow_control = FLOW_MODE_NONE; |
@@ -559,8 +541,6 @@ static inline u32 hwkhz(const struct skge_hw *hw) | |||
559 | { | 541 | { |
560 | if (hw->chip_id == CHIP_ID_GENESIS) | 542 | if (hw->chip_id == CHIP_ID_GENESIS) |
561 | return 53215; /* or: 53.125 MHz */ | 543 | return 53215; /* or: 53.125 MHz */ |
562 | else if (hw->chip_id == CHIP_ID_YUKON_EC) | ||
563 | return 125000; /* or: 125.000 MHz */ | ||
564 | else | 544 | else |
565 | return 78215; /* or: 78.125 MHz */ | 545 | return 78215; /* or: 78.125 MHz */ |
566 | } | 546 | } |
@@ -643,30 +623,18 @@ static int skge_set_coalesce(struct net_device *dev, | |||
643 | static void skge_led_on(struct skge_hw *hw, int port) | 623 | static void skge_led_on(struct skge_hw *hw, int port) |
644 | { | 624 | { |
645 | if (hw->chip_id == CHIP_ID_GENESIS) { | 625 | if (hw->chip_id == CHIP_ID_GENESIS) { |
646 | skge_write8(hw, SKGEMAC_REG(port, LNK_LED_REG), LINKLED_ON); | 626 | skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_ON); |
647 | skge_write8(hw, B0_LED, LED_STAT_ON); | 627 | skge_write8(hw, B0_LED, LED_STAT_ON); |
648 | 628 | ||
649 | skge_write8(hw, SKGEMAC_REG(port, RX_LED_TST), LED_T_ON); | 629 | skge_write8(hw, SK_REG(port, RX_LED_TST), LED_T_ON); |
650 | skge_write32(hw, SKGEMAC_REG(port, RX_LED_VAL), 100); | 630 | skge_write32(hw, SK_REG(port, RX_LED_VAL), 100); |
651 | skge_write8(hw, SKGEMAC_REG(port, RX_LED_CTRL), LED_START); | 631 | skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START); |
652 | 632 | ||
653 | switch (hw->phy_type) { | 633 | /* For Broadcom Phy only */ |
654 | case SK_PHY_BCOM: | 634 | xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_ON); |
655 | skge_xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, | ||
656 | PHY_B_PEC_LED_ON); | ||
657 | break; | ||
658 | case SK_PHY_LONE: | ||
659 | skge_xm_phy_write(hw, port, PHY_LONE_LED_CFG, | ||
660 | 0x0800); | ||
661 | break; | ||
662 | default: | ||
663 | skge_write8(hw, SKGEMAC_REG(port, TX_LED_TST), LED_T_ON); | ||
664 | skge_write32(hw, SKGEMAC_REG(port, TX_LED_VAL), 100); | ||
665 | skge_write8(hw, SKGEMAC_REG(port, TX_LED_CTRL), LED_START); | ||
666 | } | ||
667 | } else { | 635 | } else { |
668 | skge_gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0); | 636 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0); |
669 | skge_gm_phy_write(hw, port, PHY_MARV_LED_OVER, | 637 | gm_phy_write(hw, port, PHY_MARV_LED_OVER, |
670 | PHY_M_LED_MO_DUP(MO_LED_ON) | | 638 | PHY_M_LED_MO_DUP(MO_LED_ON) | |
671 | PHY_M_LED_MO_10(MO_LED_ON) | | 639 | PHY_M_LED_MO_10(MO_LED_ON) | |
672 | PHY_M_LED_MO_100(MO_LED_ON) | | 640 | PHY_M_LED_MO_100(MO_LED_ON) | |
@@ -678,28 +646,17 @@ static void skge_led_on(struct skge_hw *hw, int port) | |||
678 | static void skge_led_off(struct skge_hw *hw, int port) | 646 | static void skge_led_off(struct skge_hw *hw, int port) |
679 | { | 647 | { |
680 | if (hw->chip_id == CHIP_ID_GENESIS) { | 648 | if (hw->chip_id == CHIP_ID_GENESIS) { |
681 | skge_write8(hw, SKGEMAC_REG(port, LNK_LED_REG), LINKLED_OFF); | 649 | skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF); |
682 | skge_write8(hw, B0_LED, LED_STAT_OFF); | 650 | skge_write8(hw, B0_LED, LED_STAT_OFF); |
683 | 651 | ||
684 | skge_write32(hw, SKGEMAC_REG(port, RX_LED_VAL), 0); | 652 | skge_write32(hw, SK_REG(port, RX_LED_VAL), 0); |
685 | skge_write8(hw, SKGEMAC_REG(port, RX_LED_CTRL), LED_T_OFF); | 653 | skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_T_OFF); |
686 | 654 | ||
687 | switch (hw->phy_type) { | 655 | /* Broadcom only */ |
688 | case SK_PHY_BCOM: | 656 | xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_OFF); |
689 | skge_xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, | ||
690 | PHY_B_PEC_LED_OFF); | ||
691 | break; | ||
692 | case SK_PHY_LONE: | ||
693 | skge_xm_phy_write(hw, port, PHY_LONE_LED_CFG, | ||
694 | PHY_L_LC_LEDT); | ||
695 | break; | ||
696 | default: | ||
697 | skge_write32(hw, SKGEMAC_REG(port, TX_LED_VAL), 0); | ||
698 | skge_write8(hw, SKGEMAC_REG(port, TX_LED_CTRL), LED_T_OFF); | ||
699 | } | ||
700 | } else { | 657 | } else { |
701 | skge_gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0); | 658 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0); |
702 | skge_gm_phy_write(hw, port, PHY_MARV_LED_OVER, | 659 | gm_phy_write(hw, port, PHY_MARV_LED_OVER, |
703 | PHY_M_LED_MO_DUP(MO_LED_OFF) | | 660 | PHY_M_LED_MO_DUP(MO_LED_OFF) | |
704 | PHY_M_LED_MO_10(MO_LED_OFF) | | 661 | PHY_M_LED_MO_10(MO_LED_OFF) | |
705 | PHY_M_LED_MO_100(MO_LED_OFF) | | 662 | PHY_M_LED_MO_100(MO_LED_OFF) | |
@@ -730,7 +687,7 @@ static int skge_phys_id(struct net_device *dev, u32 data) | |||
730 | { | 687 | { |
731 | struct skge_port *skge = netdev_priv(dev); | 688 | struct skge_port *skge = netdev_priv(dev); |
732 | 689 | ||
733 | if(!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) | 690 | if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) |
734 | data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); | 691 | data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); |
735 | 692 | ||
736 | /* start blinking */ | 693 | /* start blinking */ |
@@ -763,8 +720,6 @@ static struct ethtool_ops skge_ethtool_ops = { | |||
763 | .set_pauseparam = skge_set_pauseparam, | 720 | .set_pauseparam = skge_set_pauseparam, |
764 | .get_coalesce = skge_get_coalesce, | 721 | .get_coalesce = skge_get_coalesce, |
765 | .set_coalesce = skge_set_coalesce, | 722 | .set_coalesce = skge_set_coalesce, |
766 | .get_tso = ethtool_op_get_tso, | ||
767 | .set_tso = skge_set_tso, | ||
768 | .get_sg = ethtool_op_get_sg, | 723 | .get_sg = ethtool_op_get_sg, |
769 | .set_sg = skge_set_sg, | 724 | .set_sg = skge_set_sg, |
770 | .get_tx_csum = ethtool_op_get_tx_csum, | 725 | .get_tx_csum = ethtool_op_get_tx_csum, |
@@ -793,6 +748,7 @@ static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u64 base) | |||
793 | 748 | ||
794 | for (i = 0, e = ring->start, d = vaddr; i < ring->count; i++, e++, d++) { | 749 | for (i = 0, e = ring->start, d = vaddr; i < ring->count; i++, e++, d++) { |
795 | e->desc = d; | 750 | e->desc = d; |
751 | e->skb = NULL; | ||
796 | if (i == ring->count - 1) { | 752 | if (i == ring->count - 1) { |
797 | e->next = ring->start; | 753 | e->next = ring->start; |
798 | d->next_offset = base; | 754 | d->next_offset = base; |
@@ -806,24 +762,23 @@ static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u64 base) | |||
806 | return 0; | 762 | return 0; |
807 | } | 763 | } |
808 | 764 | ||
809 | /* Setup buffer for receiving */ | 765 | static struct sk_buff *skge_rx_alloc(struct net_device *dev, unsigned int size) |
810 | static inline int skge_rx_alloc(struct skge_port *skge, | ||
811 | struct skge_element *e) | ||
812 | { | 766 | { |
813 | unsigned long bufsize = skge->netdev->mtu + ETH_HLEN; /* VLAN? */ | 767 | struct sk_buff *skb = dev_alloc_skb(size); |
814 | struct skge_rx_desc *rd = e->desc; | ||
815 | struct sk_buff *skb; | ||
816 | u64 map; | ||
817 | 768 | ||
818 | skb = dev_alloc_skb(bufsize + NET_IP_ALIGN); | 769 | if (likely(skb)) { |
819 | if (unlikely(!skb)) { | 770 | skb->dev = dev; |
820 | printk(KERN_DEBUG PFX "%s: out of memory for receive\n", | 771 | skb_reserve(skb, NET_IP_ALIGN); |
821 | skge->netdev->name); | ||
822 | return -ENOMEM; | ||
823 | } | 772 | } |
773 | return skb; | ||
774 | } | ||
824 | 775 | ||
825 | skb->dev = skge->netdev; | 776 | /* Allocate and setup a new buffer for receiving */ |
826 | skb_reserve(skb, NET_IP_ALIGN); | 777 | static void skge_rx_setup(struct skge_port *skge, struct skge_element *e, |
778 | struct sk_buff *skb, unsigned int bufsize) | ||
779 | { | ||
780 | struct skge_rx_desc *rd = e->desc; | ||
781 | u64 map; | ||
827 | 782 | ||
828 | map = pci_map_single(skge->hw->pdev, skb->data, bufsize, | 783 | map = pci_map_single(skge->hw->pdev, skb->data, bufsize, |
829 | PCI_DMA_FROMDEVICE); | 784 | PCI_DMA_FROMDEVICE); |
@@ -841,55 +796,69 @@ static inline int skge_rx_alloc(struct skge_port *skge, | |||
841 | rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize; | 796 | rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize; |
842 | pci_unmap_addr_set(e, mapaddr, map); | 797 | pci_unmap_addr_set(e, mapaddr, map); |
843 | pci_unmap_len_set(e, maplen, bufsize); | 798 | pci_unmap_len_set(e, maplen, bufsize); |
844 | return 0; | ||
845 | } | 799 | } |
846 | 800 | ||
847 | /* Free all unused buffers in receive ring, assumes receiver stopped */ | 801 | /* Resume receiving using existing skb, |
802 | * Note: DMA address is not changed by chip. | ||
803 | * MTU not changed while receiver active. | ||
804 | */ | ||
805 | static void skge_rx_reuse(struct skge_element *e, unsigned int size) | ||
806 | { | ||
807 | struct skge_rx_desc *rd = e->desc; | ||
808 | |||
809 | rd->csum2 = 0; | ||
810 | rd->csum2_start = ETH_HLEN; | ||
811 | |||
812 | wmb(); | ||
813 | |||
814 | rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | size; | ||
815 | } | ||
816 | |||
817 | |||
818 | /* Free all buffers in receive ring, assumes receiver stopped */ | ||
848 | static void skge_rx_clean(struct skge_port *skge) | 819 | static void skge_rx_clean(struct skge_port *skge) |
849 | { | 820 | { |
850 | struct skge_hw *hw = skge->hw; | 821 | struct skge_hw *hw = skge->hw; |
851 | struct skge_ring *ring = &skge->rx_ring; | 822 | struct skge_ring *ring = &skge->rx_ring; |
852 | struct skge_element *e; | 823 | struct skge_element *e; |
853 | 824 | ||
854 | for (e = ring->to_clean; e != ring->to_use; e = e->next) { | 825 | e = ring->start; |
826 | do { | ||
855 | struct skge_rx_desc *rd = e->desc; | 827 | struct skge_rx_desc *rd = e->desc; |
856 | rd->control = 0; | 828 | rd->control = 0; |
857 | 829 | if (e->skb) { | |
858 | pci_unmap_single(hw->pdev, | 830 | pci_unmap_single(hw->pdev, |
859 | pci_unmap_addr(e, mapaddr), | 831 | pci_unmap_addr(e, mapaddr), |
860 | pci_unmap_len(e, maplen), | 832 | pci_unmap_len(e, maplen), |
861 | PCI_DMA_FROMDEVICE); | 833 | PCI_DMA_FROMDEVICE); |
862 | dev_kfree_skb(e->skb); | 834 | dev_kfree_skb(e->skb); |
863 | e->skb = NULL; | 835 | e->skb = NULL; |
864 | } | 836 | } |
865 | ring->to_clean = e; | 837 | } while ((e = e->next) != ring->start); |
866 | } | 838 | } |
867 | 839 | ||
840 | |||
868 | /* Allocate buffers for receive ring | 841 | /* Allocate buffers for receive ring |
869 | * For receive: to_use is refill location | 842 | * For receive: to_clean is next received frame. |
870 | * to_clean is next received frame. | ||
871 | * | ||
872 | * if (to_use == to_clean) | ||
873 | * then ring all frames in ring need buffers | ||
874 | * if (to_use->next == to_clean) | ||
875 | * then ring all frames in ring have buffers | ||
876 | */ | 843 | */ |
877 | static int skge_rx_fill(struct skge_port *skge) | 844 | static int skge_rx_fill(struct skge_port *skge) |
878 | { | 845 | { |
879 | struct skge_ring *ring = &skge->rx_ring; | 846 | struct skge_ring *ring = &skge->rx_ring; |
880 | struct skge_element *e; | 847 | struct skge_element *e; |
881 | int ret = 0; | 848 | unsigned int bufsize = skge->rx_buf_size; |
882 | 849 | ||
883 | for (e = ring->to_use; e->next != ring->to_clean; e = e->next) { | 850 | e = ring->start; |
884 | if (skge_rx_alloc(skge, e)) { | 851 | do { |
885 | ret = 1; | 852 | struct sk_buff *skb = skge_rx_alloc(skge->netdev, bufsize); |
886 | break; | ||
887 | } | ||
888 | 853 | ||
889 | } | 854 | if (!skb) |
890 | ring->to_use = e; | 855 | return -ENOMEM; |
856 | |||
857 | skge_rx_setup(skge, e, skb, bufsize); | ||
858 | } while ( (e = e->next) != ring->start); | ||
891 | 859 | ||
892 | return ret; | 860 | ring->to_clean = ring->start; |
861 | return 0; | ||
893 | } | 862 | } |
894 | 863 | ||
895 | static void skge_link_up(struct skge_port *skge) | 864 | static void skge_link_up(struct skge_port *skge) |
@@ -919,50 +888,50 @@ static void skge_link_down(struct skge_port *skge) | |||
919 | printk(KERN_INFO PFX "%s: Link is down.\n", skge->netdev->name); | 888 | printk(KERN_INFO PFX "%s: Link is down.\n", skge->netdev->name); |
920 | } | 889 | } |
921 | 890 | ||
922 | static u16 skge_xm_phy_read(struct skge_hw *hw, int port, u16 reg) | 891 | static u16 xm_phy_read(struct skge_hw *hw, int port, u16 reg) |
923 | { | 892 | { |
924 | int i; | 893 | int i; |
925 | u16 v; | 894 | u16 v; |
926 | 895 | ||
927 | skge_xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); | 896 | xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); |
928 | v = skge_xm_read16(hw, port, XM_PHY_DATA); | 897 | v = xm_read16(hw, port, XM_PHY_DATA); |
929 | if (hw->phy_type != SK_PHY_XMAC) { | ||
930 | for (i = 0; i < PHY_RETRIES; i++) { | ||
931 | udelay(1); | ||
932 | if (skge_xm_read16(hw, port, XM_MMU_CMD) | ||
933 | & XM_MMU_PHY_RDY) | ||
934 | goto ready; | ||
935 | } | ||
936 | 898 | ||
937 | printk(KERN_WARNING PFX "%s: phy read timed out\n", | 899 | /* Need to wait for external PHY */ |
938 | hw->dev[port]->name); | 900 | for (i = 0; i < PHY_RETRIES; i++) { |
939 | return 0; | 901 | udelay(1); |
940 | ready: | 902 | if (xm_read16(hw, port, XM_MMU_CMD) |
941 | v = skge_xm_read16(hw, port, XM_PHY_DATA); | 903 | & XM_MMU_PHY_RDY) |
904 | goto ready; | ||
942 | } | 905 | } |
943 | 906 | ||
907 | printk(KERN_WARNING PFX "%s: phy read timed out\n", | ||
908 | hw->dev[port]->name); | ||
909 | return 0; | ||
910 | ready: | ||
911 | v = xm_read16(hw, port, XM_PHY_DATA); | ||
912 | |||
944 | return v; | 913 | return v; |
945 | } | 914 | } |
946 | 915 | ||
947 | static void skge_xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) | 916 | static void xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) |
948 | { | 917 | { |
949 | int i; | 918 | int i; |
950 | 919 | ||
951 | skge_xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); | 920 | xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); |
952 | for (i = 0; i < PHY_RETRIES; i++) { | 921 | for (i = 0; i < PHY_RETRIES; i++) { |
953 | if (!(skge_xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_BUSY)) | 922 | if (!(xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_BUSY)) |
954 | goto ready; | 923 | goto ready; |
955 | cpu_relax(); | 924 | udelay(1); |
956 | } | 925 | } |
957 | printk(KERN_WARNING PFX "%s: phy write failed to come ready\n", | 926 | printk(KERN_WARNING PFX "%s: phy write failed to come ready\n", |
958 | hw->dev[port]->name); | 927 | hw->dev[port]->name); |
959 | 928 | ||
960 | 929 | ||
961 | ready: | 930 | ready: |
962 | skge_xm_write16(hw, port, XM_PHY_DATA, val); | 931 | xm_write16(hw, port, XM_PHY_DATA, val); |
963 | for (i = 0; i < PHY_RETRIES; i++) { | 932 | for (i = 0; i < PHY_RETRIES; i++) { |
964 | udelay(1); | 933 | udelay(1); |
965 | if (!(skge_xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_BUSY)) | 934 | if (!(xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_BUSY)) |
966 | return; | 935 | return; |
967 | } | 936 | } |
968 | printk(KERN_WARNING PFX "%s: phy write timed out\n", | 937 | printk(KERN_WARNING PFX "%s: phy write timed out\n", |
@@ -999,34 +968,112 @@ static void genesis_init(struct skge_hw *hw) | |||
999 | 968 | ||
1000 | static void genesis_reset(struct skge_hw *hw, int port) | 969 | static void genesis_reset(struct skge_hw *hw, int port) |
1001 | { | 970 | { |
1002 | int i; | 971 | const u8 zero[8] = { 0 }; |
1003 | u64 zero = 0; | ||
1004 | 972 | ||
1005 | /* reset the statistics module */ | 973 | /* reset the statistics module */ |
1006 | skge_xm_write32(hw, port, XM_GP_PORT, XM_GP_RES_STAT); | 974 | xm_write32(hw, port, XM_GP_PORT, XM_GP_RES_STAT); |
1007 | skge_xm_write16(hw, port, XM_IMSK, 0xffff); /* disable XMAC IRQs */ | 975 | xm_write16(hw, port, XM_IMSK, 0xffff); /* disable XMAC IRQs */ |
1008 | skge_xm_write32(hw, port, XM_MODE, 0); /* clear Mode Reg */ | 976 | xm_write32(hw, port, XM_MODE, 0); /* clear Mode Reg */ |
1009 | skge_xm_write16(hw, port, XM_TX_CMD, 0); /* reset TX CMD Reg */ | 977 | xm_write16(hw, port, XM_TX_CMD, 0); /* reset TX CMD Reg */ |
1010 | skge_xm_write16(hw, port, XM_RX_CMD, 0); /* reset RX CMD Reg */ | 978 | xm_write16(hw, port, XM_RX_CMD, 0); /* reset RX CMD Reg */ |
1011 | 979 | ||
1012 | /* disable all PHY IRQs */ | 980 | /* disable Broadcom PHY IRQ */ |
1013 | if (hw->phy_type == SK_PHY_BCOM) | 981 | xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff); |
1014 | skge_xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff); | ||
1015 | 982 | ||
1016 | skge_xm_outhash(hw, port, XM_HSM, (u8 *) &zero); | 983 | xm_outhash(hw, port, XM_HSM, zero); |
1017 | for (i = 0; i < 15; i++) | ||
1018 | skge_xm_outaddr(hw, port, XM_EXM(i), (u8 *) &zero); | ||
1019 | skge_xm_outhash(hw, port, XM_SRC_CHK, (u8 *) &zero); | ||
1020 | } | 984 | } |
1021 | 985 | ||
1022 | 986 | ||
1023 | static void genesis_mac_init(struct skge_hw *hw, int port) | 987 | /* Convert mode to MII values */ |
988 | static const u16 phy_pause_map[] = { | ||
989 | [FLOW_MODE_NONE] = 0, | ||
990 | [FLOW_MODE_LOC_SEND] = PHY_AN_PAUSE_ASYM, | ||
991 | [FLOW_MODE_SYMMETRIC] = PHY_AN_PAUSE_CAP, | ||
992 | [FLOW_MODE_REM_SEND] = PHY_AN_PAUSE_CAP | PHY_AN_PAUSE_ASYM, | ||
993 | }; | ||
994 | |||
995 | |||
996 | /* Check status of Broadcom phy link */ | ||
997 | static void bcom_check_link(struct skge_hw *hw, int port) | ||
1024 | { | 998 | { |
1025 | struct skge_port *skge = netdev_priv(hw->dev[port]); | 999 | struct net_device *dev = hw->dev[port]; |
1000 | struct skge_port *skge = netdev_priv(dev); | ||
1001 | u16 status; | ||
1002 | |||
1003 | /* read twice because of latch */ | ||
1004 | (void) xm_phy_read(hw, port, PHY_BCOM_STAT); | ||
1005 | status = xm_phy_read(hw, port, PHY_BCOM_STAT); | ||
1006 | |||
1007 | pr_debug("bcom_check_link status=0x%x\n", status); | ||
1008 | |||
1009 | if ((status & PHY_ST_LSYNC) == 0) { | ||
1010 | u16 cmd = xm_read16(hw, port, XM_MMU_CMD); | ||
1011 | cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX); | ||
1012 | xm_write16(hw, port, XM_MMU_CMD, cmd); | ||
1013 | /* dummy read to ensure writing */ | ||
1014 | (void) xm_read16(hw, port, XM_MMU_CMD); | ||
1015 | |||
1016 | if (netif_carrier_ok(dev)) | ||
1017 | skge_link_down(skge); | ||
1018 | } else { | ||
1019 | if (skge->autoneg == AUTONEG_ENABLE && | ||
1020 | (status & PHY_ST_AN_OVER)) { | ||
1021 | u16 lpa = xm_phy_read(hw, port, PHY_BCOM_AUNE_LP); | ||
1022 | u16 aux = xm_phy_read(hw, port, PHY_BCOM_AUX_STAT); | ||
1023 | |||
1024 | if (lpa & PHY_B_AN_RF) { | ||
1025 | printk(KERN_NOTICE PFX "%s: remote fault\n", | ||
1026 | dev->name); | ||
1027 | return; | ||
1028 | } | ||
1029 | |||
1030 | /* Check Duplex mismatch */ | ||
1031 | switch(aux & PHY_B_AS_AN_RES_MSK) { | ||
1032 | case PHY_B_RES_1000FD: | ||
1033 | skge->duplex = DUPLEX_FULL; | ||
1034 | break; | ||
1035 | case PHY_B_RES_1000HD: | ||
1036 | skge->duplex = DUPLEX_HALF; | ||
1037 | break; | ||
1038 | default: | ||
1039 | printk(KERN_NOTICE PFX "%s: duplex mismatch\n", | ||
1040 | dev->name); | ||
1041 | return; | ||
1042 | } | ||
1043 | |||
1044 | |||
1045 | /* We are using IEEE 802.3z/D5.0 Table 37-4 */ | ||
1046 | switch (aux & PHY_B_AS_PAUSE_MSK) { | ||
1047 | case PHY_B_AS_PAUSE_MSK: | ||
1048 | skge->flow_control = FLOW_MODE_SYMMETRIC; | ||
1049 | break; | ||
1050 | case PHY_B_AS_PRR: | ||
1051 | skge->flow_control = FLOW_MODE_REM_SEND; | ||
1052 | break; | ||
1053 | case PHY_B_AS_PRT: | ||
1054 | skge->flow_control = FLOW_MODE_LOC_SEND; | ||
1055 | break; | ||
1056 | default: | ||
1057 | skge->flow_control = FLOW_MODE_NONE; | ||
1058 | } | ||
1059 | |||
1060 | skge->speed = SPEED_1000; | ||
1061 | } | ||
1062 | |||
1063 | if (!netif_carrier_ok(dev)) | ||
1064 | genesis_link_up(skge); | ||
1065 | } | ||
1066 | } | ||
1067 | |||
1068 | /* Broadcom 5400 only supports giagabit! SysKonnect did not put an additional | ||
1069 | * Phy on for 100 or 10Mbit operation | ||
1070 | */ | ||
1071 | static void bcom_phy_init(struct skge_port *skge, int jumbo) | ||
1072 | { | ||
1073 | struct skge_hw *hw = skge->hw; | ||
1074 | int port = skge->port; | ||
1026 | int i; | 1075 | int i; |
1027 | u32 r; | 1076 | u16 id1, r, ext, ctl; |
1028 | u16 id1; | ||
1029 | u16 ctrl1, ctrl2, ctrl3, ctrl4, ctrl5; | ||
1030 | 1077 | ||
1031 | /* magic workaround patterns for Broadcom */ | 1078 | /* magic workaround patterns for Broadcom */ |
1032 | static const struct { | 1079 | static const struct { |
@@ -1042,16 +1089,120 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1042 | { 0x17, 0x0013 }, { 0x15, 0x0A04 }, { 0x18, 0x0420 }, | 1089 | { 0x17, 0x0013 }, { 0x15, 0x0A04 }, { 0x18, 0x0420 }, |
1043 | }; | 1090 | }; |
1044 | 1091 | ||
1092 | pr_debug("bcom_phy_init\n"); | ||
1093 | |||
1094 | /* read Id from external PHY (all have the same address) */ | ||
1095 | id1 = xm_phy_read(hw, port, PHY_XMAC_ID1); | ||
1096 | |||
1097 | /* Optimize MDIO transfer by suppressing preamble. */ | ||
1098 | r = xm_read16(hw, port, XM_MMU_CMD); | ||
1099 | r |= XM_MMU_NO_PRE; | ||
1100 | xm_write16(hw, port, XM_MMU_CMD,r); | ||
1101 | |||
1102 | switch(id1) { | ||
1103 | case PHY_BCOM_ID1_C0: | ||
1104 | /* | ||
1105 | * Workaround BCOM Errata for the C0 type. | ||
1106 | * Write magic patterns to reserved registers. | ||
1107 | */ | ||
1108 | for (i = 0; i < ARRAY_SIZE(C0hack); i++) | ||
1109 | xm_phy_write(hw, port, | ||
1110 | C0hack[i].reg, C0hack[i].val); | ||
1111 | |||
1112 | break; | ||
1113 | case PHY_BCOM_ID1_A1: | ||
1114 | /* | ||
1115 | * Workaround BCOM Errata for the A1 type. | ||
1116 | * Write magic patterns to reserved registers. | ||
1117 | */ | ||
1118 | for (i = 0; i < ARRAY_SIZE(A1hack); i++) | ||
1119 | xm_phy_write(hw, port, | ||
1120 | A1hack[i].reg, A1hack[i].val); | ||
1121 | break; | ||
1122 | } | ||
1123 | |||
1124 | /* | ||
1125 | * Workaround BCOM Errata (#10523) for all BCom PHYs. | ||
1126 | * Disable Power Management after reset. | ||
1127 | */ | ||
1128 | r = xm_phy_read(hw, port, PHY_BCOM_AUX_CTRL); | ||
1129 | r |= PHY_B_AC_DIS_PM; | ||
1130 | xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL, r); | ||
1131 | |||
1132 | /* Dummy read */ | ||
1133 | xm_read16(hw, port, XM_ISRC); | ||
1134 | |||
1135 | ext = PHY_B_PEC_EN_LTR; /* enable tx led */ | ||
1136 | ctl = PHY_CT_SP1000; /* always 1000mbit */ | ||
1137 | |||
1138 | if (skge->autoneg == AUTONEG_ENABLE) { | ||
1139 | /* | ||
1140 | * Workaround BCOM Errata #1 for the C5 type. | ||
1141 | * 1000Base-T Link Acquisition Failure in Slave Mode | ||
1142 | * Set Repeater/DTE bit 10 of the 1000Base-T Control Register | ||
1143 | */ | ||
1144 | u16 adv = PHY_B_1000C_RD; | ||
1145 | if (skge->advertising & ADVERTISED_1000baseT_Half) | ||
1146 | adv |= PHY_B_1000C_AHD; | ||
1147 | if (skge->advertising & ADVERTISED_1000baseT_Full) | ||
1148 | adv |= PHY_B_1000C_AFD; | ||
1149 | xm_phy_write(hw, port, PHY_BCOM_1000T_CTRL, adv); | ||
1150 | |||
1151 | ctl |= PHY_CT_ANE | PHY_CT_RE_CFG; | ||
1152 | } else { | ||
1153 | if (skge->duplex == DUPLEX_FULL) | ||
1154 | ctl |= PHY_CT_DUP_MD; | ||
1155 | /* Force to slave */ | ||
1156 | xm_phy_write(hw, port, PHY_BCOM_1000T_CTRL, PHY_B_1000C_MSE); | ||
1157 | } | ||
1158 | |||
1159 | /* Set autonegotiation pause parameters */ | ||
1160 | xm_phy_write(hw, port, PHY_BCOM_AUNE_ADV, | ||
1161 | phy_pause_map[skge->flow_control] | PHY_AN_CSMA); | ||
1162 | |||
1163 | /* Handle Jumbo frames */ | ||
1164 | if (jumbo) { | ||
1165 | xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL, | ||
1166 | PHY_B_AC_TX_TST | PHY_B_AC_LONG_PACK); | ||
1167 | |||
1168 | ext |= PHY_B_PEC_HIGH_LA; | ||
1169 | |||
1170 | } | ||
1171 | |||
1172 | xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, ext); | ||
1173 | xm_phy_write(hw, port, PHY_BCOM_CTRL, ctl); | ||
1174 | |||
1175 | /* Use link status change interrrupt */ | ||
1176 | xm_phy_write(hw, port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK); | ||
1177 | |||
1178 | bcom_check_link(hw, port); | ||
1179 | } | ||
1180 | |||
1181 | static void genesis_mac_init(struct skge_hw *hw, int port) | ||
1182 | { | ||
1183 | struct net_device *dev = hw->dev[port]; | ||
1184 | struct skge_port *skge = netdev_priv(dev); | ||
1185 | int jumbo = hw->dev[port]->mtu > ETH_DATA_LEN; | ||
1186 | int i; | ||
1187 | u32 r; | ||
1188 | const u8 zero[6] = { 0 }; | ||
1189 | |||
1190 | /* Clear MIB counters */ | ||
1191 | xm_write16(hw, port, XM_STAT_CMD, | ||
1192 | XM_SC_CLR_RXC | XM_SC_CLR_TXC); | ||
1193 | /* Clear two times according to Errata #3 */ | ||
1194 | xm_write16(hw, port, XM_STAT_CMD, | ||
1195 | XM_SC_CLR_RXC | XM_SC_CLR_TXC); | ||
1045 | 1196 | ||
1046 | /* initialize Rx, Tx and Link LED */ | 1197 | /* initialize Rx, Tx and Link LED */ |
1047 | skge_write8(hw, SKGEMAC_REG(port, LNK_LED_REG), LINKLED_ON); | 1198 | skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_ON); |
1048 | skge_write8(hw, SKGEMAC_REG(port, LNK_LED_REG), LINKLED_LINKSYNC_ON); | 1199 | skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_LINKSYNC_ON); |
1049 | 1200 | ||
1050 | skge_write8(hw, SKGEMAC_REG(port, RX_LED_CTRL), LED_START); | 1201 | skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START); |
1051 | skge_write8(hw, SKGEMAC_REG(port, TX_LED_CTRL), LED_START); | 1202 | skge_write8(hw, SK_REG(port, TX_LED_CTRL), LED_START); |
1052 | 1203 | ||
1053 | /* Unreset the XMAC. */ | 1204 | /* Unreset the XMAC. */ |
1054 | skge_write16(hw, SKGEMAC_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST); | 1205 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST); |
1055 | 1206 | ||
1056 | /* | 1207 | /* |
1057 | * Perform additional initialization for external PHYs, | 1208 | * Perform additional initialization for external PHYs, |
@@ -1059,67 +1210,56 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1059 | * GMII mode. | 1210 | * GMII mode. |
1060 | */ | 1211 | */ |
1061 | spin_lock_bh(&hw->phy_lock); | 1212 | spin_lock_bh(&hw->phy_lock); |
1062 | if (hw->phy_type != SK_PHY_XMAC) { | 1213 | /* Take external Phy out of reset */ |
1063 | /* Take PHY out of reset. */ | 1214 | r = skge_read32(hw, B2_GP_IO); |
1064 | r = skge_read32(hw, B2_GP_IO); | 1215 | if (port == 0) |
1065 | if (port == 0) | 1216 | r |= GP_DIR_0|GP_IO_0; |
1066 | r |= GP_DIR_0|GP_IO_0; | 1217 | else |
1067 | else | 1218 | r |= GP_DIR_2|GP_IO_2; |
1068 | r |= GP_DIR_2|GP_IO_2; | ||
1069 | |||
1070 | skge_write32(hw, B2_GP_IO, r); | ||
1071 | skge_read32(hw, B2_GP_IO); | ||
1072 | |||
1073 | /* Enable GMII mode on the XMAC. */ | ||
1074 | skge_xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD); | ||
1075 | |||
1076 | id1 = skge_xm_phy_read(hw, port, PHY_XMAC_ID1); | ||
1077 | |||
1078 | /* Optimize MDIO transfer by suppressing preamble. */ | ||
1079 | skge_xm_write16(hw, port, XM_MMU_CMD, | ||
1080 | skge_xm_read16(hw, port, XM_MMU_CMD) | ||
1081 | | XM_MMU_NO_PRE); | ||
1082 | |||
1083 | if (id1 == PHY_BCOM_ID1_C0) { | ||
1084 | /* | ||
1085 | * Workaround BCOM Errata for the C0 type. | ||
1086 | * Write magic patterns to reserved registers. | ||
1087 | */ | ||
1088 | for (i = 0; i < ARRAY_SIZE(C0hack); i++) | ||
1089 | skge_xm_phy_write(hw, port, | ||
1090 | C0hack[i].reg, C0hack[i].val); | ||
1091 | |||
1092 | } else if (id1 == PHY_BCOM_ID1_A1) { | ||
1093 | /* | ||
1094 | * Workaround BCOM Errata for the A1 type. | ||
1095 | * Write magic patterns to reserved registers. | ||
1096 | */ | ||
1097 | for (i = 0; i < ARRAY_SIZE(A1hack); i++) | ||
1098 | skge_xm_phy_write(hw, port, | ||
1099 | A1hack[i].reg, A1hack[i].val); | ||
1100 | } | ||
1101 | 1219 | ||
1102 | /* | 1220 | skge_write32(hw, B2_GP_IO, r); |
1103 | * Workaround BCOM Errata (#10523) for all BCom PHYs. | 1221 | skge_read32(hw, B2_GP_IO); |
1104 | * Disable Power Management after reset. | 1222 | spin_unlock_bh(&hw->phy_lock); |
1105 | */ | ||
1106 | r = skge_xm_phy_read(hw, port, PHY_BCOM_AUX_CTRL); | ||
1107 | skge_xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL, r | PHY_B_AC_DIS_PM); | ||
1108 | } | ||
1109 | 1223 | ||
1110 | /* Dummy read */ | 1224 | /* Enable GMII interfac */ |
1111 | skge_xm_read16(hw, port, XM_ISRC); | 1225 | xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD); |
1226 | |||
1227 | bcom_phy_init(skge, jumbo); | ||
1228 | |||
1229 | /* Set Station Address */ | ||
1230 | xm_outaddr(hw, port, XM_SA, dev->dev_addr); | ||
1231 | |||
1232 | /* We don't use match addresses so clear */ | ||
1233 | for (i = 1; i < 16; i++) | ||
1234 | xm_outaddr(hw, port, XM_EXM(i), zero); | ||
1112 | 1235 | ||
1113 | r = skge_xm_read32(hw, port, XM_MODE); | 1236 | /* configure Rx High Water Mark (XM_RX_HI_WM) */ |
1114 | skge_xm_write32(hw, port, XM_MODE, r|XM_MD_CSA); | 1237 | xm_write16(hw, port, XM_RX_HI_WM, 1450); |
1115 | 1238 | ||
1116 | /* We don't need the FCS appended to the packet. */ | 1239 | /* We don't need the FCS appended to the packet. */ |
1117 | r = skge_xm_read16(hw, port, XM_RX_CMD); | 1240 | r = XM_RX_LENERR_OK | XM_RX_STRIP_FCS; |
1118 | skge_xm_write16(hw, port, XM_RX_CMD, r | XM_RX_STRIP_FCS); | 1241 | if (jumbo) |
1242 | r |= XM_RX_BIG_PK_OK; | ||
1243 | |||
1244 | if (skge->duplex == DUPLEX_HALF) { | ||
1245 | /* | ||
1246 | * If in manual half duplex mode the other side might be in | ||
1247 | * full duplex mode, so ignore if a carrier extension is not seen | ||
1248 | * on frames received | ||
1249 | */ | ||
1250 | r |= XM_RX_DIS_CEXT; | ||
1251 | } | ||
1252 | xm_write16(hw, port, XM_RX_CMD, r); | ||
1253 | |||
1119 | 1254 | ||
1120 | /* We want short frames padded to 60 bytes. */ | 1255 | /* We want short frames padded to 60 bytes. */ |
1121 | r = skge_xm_read16(hw, port, XM_TX_CMD); | 1256 | xm_write16(hw, port, XM_TX_CMD, XM_TX_AUTO_PAD); |
1122 | skge_xm_write16(hw, port, XM_TX_CMD, r | XM_TX_AUTO_PAD); | 1257 | |
1258 | /* | ||
1259 | * Bump up the transmit threshold. This helps hold off transmit | ||
1260 | * underruns when we're blasting traffic from both ports at once. | ||
1261 | */ | ||
1262 | xm_write16(hw, port, XM_TX_THR, 512); | ||
1123 | 1263 | ||
1124 | /* | 1264 | /* |
1125 | * Enable the reception of all error frames. This is is | 1265 | * Enable the reception of all error frames. This is is |
@@ -1135,19 +1275,22 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1135 | * case the XMAC will start transfering frames out of the | 1275 | * case the XMAC will start transfering frames out of the |
1136 | * RX FIFO as soon as the FIFO threshold is reached. | 1276 | * RX FIFO as soon as the FIFO threshold is reached. |
1137 | */ | 1277 | */ |
1138 | r = skge_xm_read32(hw, port, XM_MODE); | 1278 | xm_write32(hw, port, XM_MODE, XM_DEF_MODE); |
1139 | skge_xm_write32(hw, port, XM_MODE, | ||
1140 | XM_MD_RX_CRCE|XM_MD_RX_LONG|XM_MD_RX_RUNT| | ||
1141 | XM_MD_RX_ERR|XM_MD_RX_IRLE); | ||
1142 | 1279 | ||
1143 | skge_xm_outaddr(hw, port, XM_SA, hw->dev[port]->dev_addr); | ||
1144 | skge_xm_outaddr(hw, port, XM_EXM(0), hw->dev[port]->dev_addr); | ||
1145 | 1280 | ||
1146 | /* | 1281 | /* |
1147 | * Bump up the transmit threshold. This helps hold off transmit | 1282 | * Initialize the Receive Counter Event Mask (XM_RX_EV_MSK) |
1148 | * underruns when we're blasting traffic from both ports at once. | 1283 | * - Enable all bits excepting 'Octets Rx OK Low CntOv' |
1284 | * and 'Octets Rx OK Hi Cnt Ov'. | ||
1149 | */ | 1285 | */ |
1150 | skge_xm_write16(hw, port, XM_TX_THR, 512); | 1286 | xm_write32(hw, port, XM_RX_EV_MSK, XMR_DEF_MSK); |
1287 | |||
1288 | /* | ||
1289 | * Initialize the Transmit Counter Event Mask (XM_TX_EV_MSK) | ||
1290 | * - Enable all bits excepting 'Octets Tx OK Low CntOv' | ||
1291 | * and 'Octets Tx OK Hi Cnt Ov'. | ||
1292 | */ | ||
1293 | xm_write32(hw, port, XM_TX_EV_MSK, XMT_DEF_MSK); | ||
1151 | 1294 | ||
1152 | /* Configure MAC arbiter */ | 1295 | /* Configure MAC arbiter */ |
1153 | skge_write16(hw, B3_MA_TO_CTRL, MA_RST_CLR); | 1296 | skge_write16(hw, B3_MA_TO_CTRL, MA_RST_CLR); |
@@ -1164,137 +1307,30 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1164 | skge_write8(hw, B3_MA_RCINI_TX2, 0); | 1307 | skge_write8(hw, B3_MA_RCINI_TX2, 0); |
1165 | 1308 | ||
1166 | /* Configure Rx MAC FIFO */ | 1309 | /* Configure Rx MAC FIFO */ |
1167 | skge_write8(hw, SKGEMAC_REG(port, RX_MFF_CTRL2), MFF_RST_CLR); | 1310 | skge_write8(hw, SK_REG(port, RX_MFF_CTRL2), MFF_RST_CLR); |
1168 | skge_write16(hw, SKGEMAC_REG(port, RX_MFF_CTRL1), MFF_ENA_TIM_PAT); | 1311 | skge_write16(hw, SK_REG(port, RX_MFF_CTRL1), MFF_ENA_TIM_PAT); |
1169 | skge_write8(hw, SKGEMAC_REG(port, RX_MFF_CTRL2), MFF_ENA_OP_MD); | 1312 | skge_write8(hw, SK_REG(port, RX_MFF_CTRL2), MFF_ENA_OP_MD); |
1170 | 1313 | ||
1171 | /* Configure Tx MAC FIFO */ | 1314 | /* Configure Tx MAC FIFO */ |
1172 | skge_write8(hw, SKGEMAC_REG(port, TX_MFF_CTRL2), MFF_RST_CLR); | 1315 | skge_write8(hw, SK_REG(port, TX_MFF_CTRL2), MFF_RST_CLR); |
1173 | skge_write16(hw, SKGEMAC_REG(port, TX_MFF_CTRL1), MFF_TX_CTRL_DEF); | 1316 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_TX_CTRL_DEF); |
1174 | skge_write8(hw, SKGEMAC_REG(port, TX_MFF_CTRL2), MFF_ENA_OP_MD); | 1317 | skge_write8(hw, SK_REG(port, TX_MFF_CTRL2), MFF_ENA_OP_MD); |
1175 | 1318 | ||
1176 | if (hw->dev[port]->mtu > ETH_DATA_LEN) { | 1319 | if (jumbo) { |
1177 | /* Enable frame flushing if jumbo frames used */ | 1320 | /* Enable frame flushing if jumbo frames used */ |
1178 | skge_write16(hw, SKGEMAC_REG(port,RX_MFF_CTRL1), MFF_ENA_FLUSH); | 1321 | skge_write16(hw, SK_REG(port,RX_MFF_CTRL1), MFF_ENA_FLUSH); |
1179 | } else { | 1322 | } else { |
1180 | /* enable timeout timers if normal frames */ | 1323 | /* enable timeout timers if normal frames */ |
1181 | skge_write16(hw, B3_PA_CTRL, | 1324 | skge_write16(hw, B3_PA_CTRL, |
1182 | port == 0 ? PA_ENA_TO_TX1 : PA_ENA_TO_TX2); | 1325 | (port == 0) ? PA_ENA_TO_TX1 : PA_ENA_TO_TX2); |
1183 | } | 1326 | } |
1184 | |||
1185 | |||
1186 | r = skge_xm_read16(hw, port, XM_RX_CMD); | ||
1187 | if (hw->dev[port]->mtu > ETH_DATA_LEN) | ||
1188 | skge_xm_write16(hw, port, XM_RX_CMD, r | XM_RX_BIG_PK_OK); | ||
1189 | else | ||
1190 | skge_xm_write16(hw, port, XM_RX_CMD, r & ~(XM_RX_BIG_PK_OK)); | ||
1191 | |||
1192 | switch (hw->phy_type) { | ||
1193 | case SK_PHY_XMAC: | ||
1194 | if (skge->autoneg == AUTONEG_ENABLE) { | ||
1195 | ctrl1 = PHY_X_AN_FD | PHY_X_AN_HD; | ||
1196 | |||
1197 | switch (skge->flow_control) { | ||
1198 | case FLOW_MODE_NONE: | ||
1199 | ctrl1 |= PHY_X_P_NO_PAUSE; | ||
1200 | break; | ||
1201 | case FLOW_MODE_LOC_SEND: | ||
1202 | ctrl1 |= PHY_X_P_ASYM_MD; | ||
1203 | break; | ||
1204 | case FLOW_MODE_SYMMETRIC: | ||
1205 | ctrl1 |= PHY_X_P_SYM_MD; | ||
1206 | break; | ||
1207 | case FLOW_MODE_REM_SEND: | ||
1208 | ctrl1 |= PHY_X_P_BOTH_MD; | ||
1209 | break; | ||
1210 | } | ||
1211 | |||
1212 | skge_xm_phy_write(hw, port, PHY_XMAC_AUNE_ADV, ctrl1); | ||
1213 | ctrl2 = PHY_CT_ANE | PHY_CT_RE_CFG; | ||
1214 | } else { | ||
1215 | ctrl2 = 0; | ||
1216 | if (skge->duplex == DUPLEX_FULL) | ||
1217 | ctrl2 |= PHY_CT_DUP_MD; | ||
1218 | } | ||
1219 | |||
1220 | skge_xm_phy_write(hw, port, PHY_XMAC_CTRL, ctrl2); | ||
1221 | break; | ||
1222 | |||
1223 | case SK_PHY_BCOM: | ||
1224 | ctrl1 = PHY_CT_SP1000; | ||
1225 | ctrl2 = 0; | ||
1226 | ctrl3 = PHY_SEL_TYPE; | ||
1227 | ctrl4 = PHY_B_PEC_EN_LTR; | ||
1228 | ctrl5 = PHY_B_AC_TX_TST; | ||
1229 | |||
1230 | if (skge->autoneg == AUTONEG_ENABLE) { | ||
1231 | /* | ||
1232 | * Workaround BCOM Errata #1 for the C5 type. | ||
1233 | * 1000Base-T Link Acquisition Failure in Slave Mode | ||
1234 | * Set Repeater/DTE bit 10 of the 1000Base-T Control Register | ||
1235 | */ | ||
1236 | ctrl2 |= PHY_B_1000C_RD; | ||
1237 | if (skge->advertising & ADVERTISED_1000baseT_Half) | ||
1238 | ctrl2 |= PHY_B_1000C_AHD; | ||
1239 | if (skge->advertising & ADVERTISED_1000baseT_Full) | ||
1240 | ctrl2 |= PHY_B_1000C_AFD; | ||
1241 | |||
1242 | /* Set Flow-control capabilities */ | ||
1243 | switch (skge->flow_control) { | ||
1244 | case FLOW_MODE_NONE: | ||
1245 | ctrl3 |= PHY_B_P_NO_PAUSE; | ||
1246 | break; | ||
1247 | case FLOW_MODE_LOC_SEND: | ||
1248 | ctrl3 |= PHY_B_P_ASYM_MD; | ||
1249 | break; | ||
1250 | case FLOW_MODE_SYMMETRIC: | ||
1251 | ctrl3 |= PHY_B_P_SYM_MD; | ||
1252 | break; | ||
1253 | case FLOW_MODE_REM_SEND: | ||
1254 | ctrl3 |= PHY_B_P_BOTH_MD; | ||
1255 | break; | ||
1256 | } | ||
1257 | |||
1258 | /* Restart Auto-negotiation */ | ||
1259 | ctrl1 |= PHY_CT_ANE | PHY_CT_RE_CFG; | ||
1260 | } else { | ||
1261 | if (skge->duplex == DUPLEX_FULL) | ||
1262 | ctrl1 |= PHY_CT_DUP_MD; | ||
1263 | |||
1264 | ctrl2 |= PHY_B_1000C_MSE; /* set it to Slave */ | ||
1265 | } | ||
1266 | |||
1267 | skge_xm_phy_write(hw, port, PHY_BCOM_1000T_CTRL, ctrl2); | ||
1268 | skge_xm_phy_write(hw, port, PHY_BCOM_AUNE_ADV, ctrl3); | ||
1269 | |||
1270 | if (skge->netdev->mtu > ETH_DATA_LEN) { | ||
1271 | ctrl4 |= PHY_B_PEC_HIGH_LA; | ||
1272 | ctrl5 |= PHY_B_AC_LONG_PACK; | ||
1273 | |||
1274 | skge_xm_phy_write(hw, port,PHY_BCOM_AUX_CTRL, ctrl5); | ||
1275 | } | ||
1276 | |||
1277 | skge_xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, ctrl4); | ||
1278 | skge_xm_phy_write(hw, port, PHY_BCOM_CTRL, ctrl1); | ||
1279 | break; | ||
1280 | } | ||
1281 | spin_unlock_bh(&hw->phy_lock); | ||
1282 | |||
1283 | /* Clear MIB counters */ | ||
1284 | skge_xm_write16(hw, port, XM_STAT_CMD, | ||
1285 | XM_SC_CLR_RXC | XM_SC_CLR_TXC); | ||
1286 | /* Clear two times according to Errata #3 */ | ||
1287 | skge_xm_write16(hw, port, XM_STAT_CMD, | ||
1288 | XM_SC_CLR_RXC | XM_SC_CLR_TXC); | ||
1289 | |||
1290 | /* Start polling for link status */ | ||
1291 | mod_timer(&skge->link_check, jiffies + LINK_POLL_HZ); | ||
1292 | } | 1327 | } |
1293 | 1328 | ||
1294 | static void genesis_stop(struct skge_port *skge) | 1329 | static void genesis_stop(struct skge_port *skge) |
1295 | { | 1330 | { |
1296 | struct skge_hw *hw = skge->hw; | 1331 | struct skge_hw *hw = skge->hw; |
1297 | int port = skge->port; | 1332 | int port = skge->port; |
1333 | u32 reg; | ||
1298 | 1334 | ||
1299 | /* Clear Tx packet arbiter timeout IRQ */ | 1335 | /* Clear Tx packet arbiter timeout IRQ */ |
1300 | skge_write16(hw, B3_PA_CTRL, | 1336 | skge_write16(hw, B3_PA_CTRL, |
@@ -1304,33 +1340,30 @@ static void genesis_stop(struct skge_port *skge) | |||
1304 | * If the transfer stucks at the MAC the STOP command will not | 1340 | * If the transfer stucks at the MAC the STOP command will not |
1305 | * terminate if we don't flush the XMAC's transmit FIFO ! | 1341 | * terminate if we don't flush the XMAC's transmit FIFO ! |
1306 | */ | 1342 | */ |
1307 | skge_xm_write32(hw, port, XM_MODE, | 1343 | xm_write32(hw, port, XM_MODE, |
1308 | skge_xm_read32(hw, port, XM_MODE)|XM_MD_FTF); | 1344 | xm_read32(hw, port, XM_MODE)|XM_MD_FTF); |
1309 | 1345 | ||
1310 | 1346 | ||
1311 | /* Reset the MAC */ | 1347 | /* Reset the MAC */ |
1312 | skge_write16(hw, SKGEMAC_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST); | 1348 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST); |
1313 | 1349 | ||
1314 | /* For external PHYs there must be special handling */ | 1350 | /* For external PHYs there must be special handling */ |
1315 | if (hw->phy_type != SK_PHY_XMAC) { | 1351 | reg = skge_read32(hw, B2_GP_IO); |
1316 | u32 reg = skge_read32(hw, B2_GP_IO); | 1352 | if (port == 0) { |
1317 | 1353 | reg |= GP_DIR_0; | |
1318 | if (port == 0) { | 1354 | reg &= ~GP_IO_0; |
1319 | reg |= GP_DIR_0; | 1355 | } else { |
1320 | reg &= ~GP_IO_0; | 1356 | reg |= GP_DIR_2; |
1321 | } else { | 1357 | reg &= ~GP_IO_2; |
1322 | reg |= GP_DIR_2; | ||
1323 | reg &= ~GP_IO_2; | ||
1324 | } | ||
1325 | skge_write32(hw, B2_GP_IO, reg); | ||
1326 | skge_read32(hw, B2_GP_IO); | ||
1327 | } | 1358 | } |
1359 | skge_write32(hw, B2_GP_IO, reg); | ||
1360 | skge_read32(hw, B2_GP_IO); | ||
1328 | 1361 | ||
1329 | skge_xm_write16(hw, port, XM_MMU_CMD, | 1362 | xm_write16(hw, port, XM_MMU_CMD, |
1330 | skge_xm_read16(hw, port, XM_MMU_CMD) | 1363 | xm_read16(hw, port, XM_MMU_CMD) |
1331 | & ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX)); | 1364 | & ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX)); |
1332 | 1365 | ||
1333 | skge_xm_read16(hw, port, XM_MMU_CMD); | 1366 | xm_read16(hw, port, XM_MMU_CMD); |
1334 | } | 1367 | } |
1335 | 1368 | ||
1336 | 1369 | ||
@@ -1341,11 +1374,11 @@ static void genesis_get_stats(struct skge_port *skge, u64 *data) | |||
1341 | int i; | 1374 | int i; |
1342 | unsigned long timeout = jiffies + HZ; | 1375 | unsigned long timeout = jiffies + HZ; |
1343 | 1376 | ||
1344 | skge_xm_write16(hw, port, | 1377 | xm_write16(hw, port, |
1345 | XM_STAT_CMD, XM_SC_SNP_TXC | XM_SC_SNP_RXC); | 1378 | XM_STAT_CMD, XM_SC_SNP_TXC | XM_SC_SNP_RXC); |
1346 | 1379 | ||
1347 | /* wait for update to complete */ | 1380 | /* wait for update to complete */ |
1348 | while (skge_xm_read16(hw, port, XM_STAT_CMD) | 1381 | while (xm_read16(hw, port, XM_STAT_CMD) |
1349 | & (XM_SC_SNP_TXC | XM_SC_SNP_RXC)) { | 1382 | & (XM_SC_SNP_TXC | XM_SC_SNP_RXC)) { |
1350 | if (time_after(jiffies, timeout)) | 1383 | if (time_after(jiffies, timeout)) |
1351 | break; | 1384 | break; |
@@ -1353,68 +1386,60 @@ static void genesis_get_stats(struct skge_port *skge, u64 *data) | |||
1353 | } | 1386 | } |
1354 | 1387 | ||
1355 | /* special case for 64 bit octet counter */ | 1388 | /* special case for 64 bit octet counter */ |
1356 | data[0] = (u64) skge_xm_read32(hw, port, XM_TXO_OK_HI) << 32 | 1389 | data[0] = (u64) xm_read32(hw, port, XM_TXO_OK_HI) << 32 |
1357 | | skge_xm_read32(hw, port, XM_TXO_OK_LO); | 1390 | | xm_read32(hw, port, XM_TXO_OK_LO); |
1358 | data[1] = (u64) skge_xm_read32(hw, port, XM_RXO_OK_HI) << 32 | 1391 | data[1] = (u64) xm_read32(hw, port, XM_RXO_OK_HI) << 32 |
1359 | | skge_xm_read32(hw, port, XM_RXO_OK_LO); | 1392 | | xm_read32(hw, port, XM_RXO_OK_LO); |
1360 | 1393 | ||
1361 | for (i = 2; i < ARRAY_SIZE(skge_stats); i++) | 1394 | for (i = 2; i < ARRAY_SIZE(skge_stats); i++) |
1362 | data[i] = skge_xm_read32(hw, port, skge_stats[i].xmac_offset); | 1395 | data[i] = xm_read32(hw, port, skge_stats[i].xmac_offset); |
1363 | } | 1396 | } |
1364 | 1397 | ||
1365 | static void genesis_mac_intr(struct skge_hw *hw, int port) | 1398 | static void genesis_mac_intr(struct skge_hw *hw, int port) |
1366 | { | 1399 | { |
1367 | struct skge_port *skge = netdev_priv(hw->dev[port]); | 1400 | struct skge_port *skge = netdev_priv(hw->dev[port]); |
1368 | u16 status = skge_xm_read16(hw, port, XM_ISRC); | 1401 | u16 status = xm_read16(hw, port, XM_ISRC); |
1369 | 1402 | ||
1370 | pr_debug("genesis_intr status %x\n", status); | 1403 | if (netif_msg_intr(skge)) |
1371 | if (hw->phy_type == SK_PHY_XMAC) { | 1404 | printk(KERN_DEBUG PFX "%s: mac interrupt status 0x%x\n", |
1372 | /* LInk down, start polling for state change */ | 1405 | skge->netdev->name, status); |
1373 | if (status & XM_IS_INP_ASS) { | ||
1374 | skge_xm_write16(hw, port, XM_IMSK, | ||
1375 | skge_xm_read16(hw, port, XM_IMSK) | XM_IS_INP_ASS); | ||
1376 | mod_timer(&skge->link_check, jiffies + LINK_POLL_HZ); | ||
1377 | } | ||
1378 | else if (status & XM_IS_AND) | ||
1379 | mod_timer(&skge->link_check, jiffies + LINK_POLL_HZ); | ||
1380 | } | ||
1381 | 1406 | ||
1382 | if (status & XM_IS_TXF_UR) { | 1407 | if (status & XM_IS_TXF_UR) { |
1383 | skge_xm_write32(hw, port, XM_MODE, XM_MD_FTF); | 1408 | xm_write32(hw, port, XM_MODE, XM_MD_FTF); |
1384 | ++skge->net_stats.tx_fifo_errors; | 1409 | ++skge->net_stats.tx_fifo_errors; |
1385 | } | 1410 | } |
1386 | if (status & XM_IS_RXF_OV) { | 1411 | if (status & XM_IS_RXF_OV) { |
1387 | skge_xm_write32(hw, port, XM_MODE, XM_MD_FRF); | 1412 | xm_write32(hw, port, XM_MODE, XM_MD_FRF); |
1388 | ++skge->net_stats.rx_fifo_errors; | 1413 | ++skge->net_stats.rx_fifo_errors; |
1389 | } | 1414 | } |
1390 | } | 1415 | } |
1391 | 1416 | ||
1392 | static void skge_gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) | 1417 | static void gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) |
1393 | { | 1418 | { |
1394 | int i; | 1419 | int i; |
1395 | 1420 | ||
1396 | skge_gma_write16(hw, port, GM_SMI_DATA, val); | 1421 | gma_write16(hw, port, GM_SMI_DATA, val); |
1397 | skge_gma_write16(hw, port, GM_SMI_CTRL, | 1422 | gma_write16(hw, port, GM_SMI_CTRL, |
1398 | GM_SMI_CT_PHY_AD(hw->phy_addr) | GM_SMI_CT_REG_AD(reg)); | 1423 | GM_SMI_CT_PHY_AD(hw->phy_addr) | GM_SMI_CT_REG_AD(reg)); |
1399 | for (i = 0; i < PHY_RETRIES; i++) { | 1424 | for (i = 0; i < PHY_RETRIES; i++) { |
1400 | udelay(1); | 1425 | udelay(1); |
1401 | 1426 | ||
1402 | if (!(skge_gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_BUSY)) | 1427 | if (!(gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_BUSY)) |
1403 | break; | 1428 | break; |
1404 | } | 1429 | } |
1405 | } | 1430 | } |
1406 | 1431 | ||
1407 | static u16 skge_gm_phy_read(struct skge_hw *hw, int port, u16 reg) | 1432 | static u16 gm_phy_read(struct skge_hw *hw, int port, u16 reg) |
1408 | { | 1433 | { |
1409 | int i; | 1434 | int i; |
1410 | 1435 | ||
1411 | skge_gma_write16(hw, port, GM_SMI_CTRL, | 1436 | gma_write16(hw, port, GM_SMI_CTRL, |
1412 | GM_SMI_CT_PHY_AD(hw->phy_addr) | 1437 | GM_SMI_CT_PHY_AD(hw->phy_addr) |
1413 | | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD); | 1438 | | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD); |
1414 | 1439 | ||
1415 | for (i = 0; i < PHY_RETRIES; i++) { | 1440 | for (i = 0; i < PHY_RETRIES; i++) { |
1416 | udelay(1); | 1441 | udelay(1); |
1417 | if (skge_gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_RD_VAL) | 1442 | if (gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_RD_VAL) |
1418 | goto ready; | 1443 | goto ready; |
1419 | } | 1444 | } |
1420 | 1445 | ||
@@ -1422,24 +1447,7 @@ static u16 skge_gm_phy_read(struct skge_hw *hw, int port, u16 reg) | |||
1422 | hw->dev[port]->name); | 1447 | hw->dev[port]->name); |
1423 | return 0; | 1448 | return 0; |
1424 | ready: | 1449 | ready: |
1425 | return skge_gma_read16(hw, port, GM_SMI_DATA); | 1450 | return gma_read16(hw, port, GM_SMI_DATA); |
1426 | } | ||
1427 | |||
1428 | static void genesis_link_down(struct skge_port *skge) | ||
1429 | { | ||
1430 | struct skge_hw *hw = skge->hw; | ||
1431 | int port = skge->port; | ||
1432 | |||
1433 | pr_debug("genesis_link_down\n"); | ||
1434 | |||
1435 | skge_xm_write16(hw, port, XM_MMU_CMD, | ||
1436 | skge_xm_read16(hw, port, XM_MMU_CMD) | ||
1437 | & ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX)); | ||
1438 | |||
1439 | /* dummy read to ensure writing */ | ||
1440 | (void) skge_xm_read16(hw, port, XM_MMU_CMD); | ||
1441 | |||
1442 | skge_link_down(skge); | ||
1443 | } | 1451 | } |
1444 | 1452 | ||
1445 | static void genesis_link_up(struct skge_port *skge) | 1453 | static void genesis_link_up(struct skge_port *skge) |
@@ -1450,7 +1458,7 @@ static void genesis_link_up(struct skge_port *skge) | |||
1450 | u32 mode, msk; | 1458 | u32 mode, msk; |
1451 | 1459 | ||
1452 | pr_debug("genesis_link_up\n"); | 1460 | pr_debug("genesis_link_up\n"); |
1453 | cmd = skge_xm_read16(hw, port, XM_MMU_CMD); | 1461 | cmd = xm_read16(hw, port, XM_MMU_CMD); |
1454 | 1462 | ||
1455 | /* | 1463 | /* |
1456 | * enabling pause frame reception is required for 1000BT | 1464 | * enabling pause frame reception is required for 1000BT |
@@ -1458,14 +1466,15 @@ static void genesis_link_up(struct skge_port *skge) | |||
1458 | */ | 1466 | */ |
1459 | if (skge->flow_control == FLOW_MODE_NONE || | 1467 | if (skge->flow_control == FLOW_MODE_NONE || |
1460 | skge->flow_control == FLOW_MODE_LOC_SEND) | 1468 | skge->flow_control == FLOW_MODE_LOC_SEND) |
1469 | /* Disable Pause Frame Reception */ | ||
1461 | cmd |= XM_MMU_IGN_PF; | 1470 | cmd |= XM_MMU_IGN_PF; |
1462 | else | 1471 | else |
1463 | /* Enable Pause Frame Reception */ | 1472 | /* Enable Pause Frame Reception */ |
1464 | cmd &= ~XM_MMU_IGN_PF; | 1473 | cmd &= ~XM_MMU_IGN_PF; |
1465 | 1474 | ||
1466 | skge_xm_write16(hw, port, XM_MMU_CMD, cmd); | 1475 | xm_write16(hw, port, XM_MMU_CMD, cmd); |
1467 | 1476 | ||
1468 | mode = skge_xm_read32(hw, port, XM_MODE); | 1477 | mode = xm_read32(hw, port, XM_MODE); |
1469 | if (skge->flow_control == FLOW_MODE_SYMMETRIC || | 1478 | if (skge->flow_control == FLOW_MODE_SYMMETRIC || |
1470 | skge->flow_control == FLOW_MODE_LOC_SEND) { | 1479 | skge->flow_control == FLOW_MODE_LOC_SEND) { |
1471 | /* | 1480 | /* |
@@ -1479,10 +1488,10 @@ static void genesis_link_up(struct skge_port *skge) | |||
1479 | /* XM_PAUSE_DA = '010000C28001' (default) */ | 1488 | /* XM_PAUSE_DA = '010000C28001' (default) */ |
1480 | /* XM_MAC_PTIME = 0xffff (maximum) */ | 1489 | /* XM_MAC_PTIME = 0xffff (maximum) */ |
1481 | /* remember this value is defined in big endian (!) */ | 1490 | /* remember this value is defined in big endian (!) */ |
1482 | skge_xm_write16(hw, port, XM_MAC_PTIME, 0xffff); | 1491 | xm_write16(hw, port, XM_MAC_PTIME, 0xffff); |
1483 | 1492 | ||
1484 | mode |= XM_PAUSE_MODE; | 1493 | mode |= XM_PAUSE_MODE; |
1485 | skge_write16(hw, SKGEMAC_REG(port, RX_MFF_CTRL1), MFF_ENA_PAUSE); | 1494 | skge_write16(hw, SK_REG(port, RX_MFF_CTRL1), MFF_ENA_PAUSE); |
1486 | } else { | 1495 | } else { |
1487 | /* | 1496 | /* |
1488 | * disable pause frame generation is required for 1000BT | 1497 | * disable pause frame generation is required for 1000BT |
@@ -1491,125 +1500,68 @@ static void genesis_link_up(struct skge_port *skge) | |||
1491 | /* Disable Pause Mode in Mode Register */ | 1500 | /* Disable Pause Mode in Mode Register */ |
1492 | mode &= ~XM_PAUSE_MODE; | 1501 | mode &= ~XM_PAUSE_MODE; |
1493 | 1502 | ||
1494 | skge_write16(hw, SKGEMAC_REG(port, RX_MFF_CTRL1), MFF_DIS_PAUSE); | 1503 | skge_write16(hw, SK_REG(port, RX_MFF_CTRL1), MFF_DIS_PAUSE); |
1495 | } | 1504 | } |
1496 | 1505 | ||
1497 | skge_xm_write32(hw, port, XM_MODE, mode); | 1506 | xm_write32(hw, port, XM_MODE, mode); |
1498 | 1507 | ||
1499 | msk = XM_DEF_MSK; | 1508 | msk = XM_DEF_MSK; |
1500 | if (hw->phy_type != SK_PHY_XMAC) | 1509 | /* disable GP0 interrupt bit for external Phy */ |
1501 | msk |= XM_IS_INP_ASS; /* disable GP0 interrupt bit */ | 1510 | msk |= XM_IS_INP_ASS; |
1502 | 1511 | ||
1503 | skge_xm_write16(hw, port, XM_IMSK, msk); | 1512 | xm_write16(hw, port, XM_IMSK, msk); |
1504 | skge_xm_read16(hw, port, XM_ISRC); | 1513 | xm_read16(hw, port, XM_ISRC); |
1505 | 1514 | ||
1506 | /* get MMU Command Reg. */ | 1515 | /* get MMU Command Reg. */ |
1507 | cmd = skge_xm_read16(hw, port, XM_MMU_CMD); | 1516 | cmd = xm_read16(hw, port, XM_MMU_CMD); |
1508 | if (hw->phy_type != SK_PHY_XMAC && skge->duplex == DUPLEX_FULL) | 1517 | if (skge->duplex == DUPLEX_FULL) |
1509 | cmd |= XM_MMU_GMII_FD; | 1518 | cmd |= XM_MMU_GMII_FD; |
1510 | 1519 | ||
1511 | if (hw->phy_type == SK_PHY_BCOM) { | 1520 | /* |
1512 | /* | 1521 | * Workaround BCOM Errata (#10523) for all BCom Phys |
1513 | * Workaround BCOM Errata (#10523) for all BCom Phys | 1522 | * Enable Power Management after link up |
1514 | * Enable Power Management after link up | 1523 | */ |
1515 | */ | 1524 | xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL, |
1516 | skge_xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL, | 1525 | xm_phy_read(hw, port, PHY_BCOM_AUX_CTRL) |
1517 | skge_xm_phy_read(hw, port, PHY_BCOM_AUX_CTRL) | 1526 | & ~PHY_B_AC_DIS_PM); |
1518 | & ~PHY_B_AC_DIS_PM); | 1527 | xm_phy_write(hw, port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK); |
1519 | skge_xm_phy_write(hw, port, PHY_BCOM_INT_MASK, | ||
1520 | PHY_B_DEF_MSK); | ||
1521 | } | ||
1522 | 1528 | ||
1523 | /* enable Rx/Tx */ | 1529 | /* enable Rx/Tx */ |
1524 | skge_xm_write16(hw, port, XM_MMU_CMD, | 1530 | xm_write16(hw, port, XM_MMU_CMD, |
1525 | cmd | XM_MMU_ENA_RX | XM_MMU_ENA_TX); | 1531 | cmd | XM_MMU_ENA_RX | XM_MMU_ENA_TX); |
1526 | skge_link_up(skge); | 1532 | skge_link_up(skge); |
1527 | } | 1533 | } |
1528 | 1534 | ||
1529 | 1535 | ||
1530 | static void genesis_bcom_intr(struct skge_port *skge) | 1536 | static inline void bcom_phy_intr(struct skge_port *skge) |
1531 | { | 1537 | { |
1532 | struct skge_hw *hw = skge->hw; | 1538 | struct skge_hw *hw = skge->hw; |
1533 | int port = skge->port; | 1539 | int port = skge->port; |
1534 | u16 stat = skge_xm_phy_read(hw, port, PHY_BCOM_INT_STAT); | 1540 | u16 isrc; |
1541 | |||
1542 | isrc = xm_phy_read(hw, port, PHY_BCOM_INT_STAT); | ||
1543 | if (netif_msg_intr(skge)) | ||
1544 | printk(KERN_DEBUG PFX "%s: phy interrupt status 0x%x\n", | ||
1545 | skge->netdev->name, isrc); | ||
1535 | 1546 | ||
1536 | pr_debug("genesis_bcom intr stat=%x\n", stat); | 1547 | if (isrc & PHY_B_IS_PSE) |
1548 | printk(KERN_ERR PFX "%s: uncorrectable pair swap error\n", | ||
1549 | hw->dev[port]->name); | ||
1537 | 1550 | ||
1538 | /* Workaround BCom Errata: | 1551 | /* Workaround BCom Errata: |
1539 | * enable and disable loopback mode if "NO HCD" occurs. | 1552 | * enable and disable loopback mode if "NO HCD" occurs. |
1540 | */ | 1553 | */ |
1541 | if (stat & PHY_B_IS_NO_HDCL) { | 1554 | if (isrc & PHY_B_IS_NO_HDCL) { |
1542 | u16 ctrl = skge_xm_phy_read(hw, port, PHY_BCOM_CTRL); | 1555 | u16 ctrl = xm_phy_read(hw, port, PHY_BCOM_CTRL); |
1543 | skge_xm_phy_write(hw, port, PHY_BCOM_CTRL, | 1556 | xm_phy_write(hw, port, PHY_BCOM_CTRL, |
1544 | ctrl | PHY_CT_LOOP); | 1557 | ctrl | PHY_CT_LOOP); |
1545 | skge_xm_phy_write(hw, port, PHY_BCOM_CTRL, | 1558 | xm_phy_write(hw, port, PHY_BCOM_CTRL, |
1546 | ctrl & ~PHY_CT_LOOP); | 1559 | ctrl & ~PHY_CT_LOOP); |
1547 | } | 1560 | } |
1548 | 1561 | ||
1549 | stat = skge_xm_phy_read(hw, port, PHY_BCOM_STAT); | 1562 | if (isrc & (PHY_B_IS_AN_PR | PHY_B_IS_LST_CHANGE)) |
1550 | if (stat & (PHY_B_IS_AN_PR | PHY_B_IS_LST_CHANGE)) { | 1563 | bcom_check_link(hw, port); |
1551 | u16 aux = skge_xm_phy_read(hw, port, PHY_BCOM_AUX_STAT); | ||
1552 | if ( !(aux & PHY_B_AS_LS) && netif_carrier_ok(skge->netdev)) | ||
1553 | genesis_link_down(skge); | ||
1554 | |||
1555 | else if (stat & PHY_B_IS_LST_CHANGE) { | ||
1556 | if (aux & PHY_B_AS_AN_C) { | ||
1557 | switch (aux & PHY_B_AS_AN_RES_MSK) { | ||
1558 | case PHY_B_RES_1000FD: | ||
1559 | skge->duplex = DUPLEX_FULL; | ||
1560 | break; | ||
1561 | case PHY_B_RES_1000HD: | ||
1562 | skge->duplex = DUPLEX_HALF; | ||
1563 | break; | ||
1564 | } | ||
1565 | |||
1566 | switch (aux & PHY_B_AS_PAUSE_MSK) { | ||
1567 | case PHY_B_AS_PAUSE_MSK: | ||
1568 | skge->flow_control = FLOW_MODE_SYMMETRIC; | ||
1569 | break; | ||
1570 | case PHY_B_AS_PRR: | ||
1571 | skge->flow_control = FLOW_MODE_REM_SEND; | ||
1572 | break; | ||
1573 | case PHY_B_AS_PRT: | ||
1574 | skge->flow_control = FLOW_MODE_LOC_SEND; | ||
1575 | break; | ||
1576 | default: | ||
1577 | skge->flow_control = FLOW_MODE_NONE; | ||
1578 | } | ||
1579 | skge->speed = SPEED_1000; | ||
1580 | } | ||
1581 | genesis_link_up(skge); | ||
1582 | } | ||
1583 | else | ||
1584 | mod_timer(&skge->link_check, jiffies + LINK_POLL_HZ); | ||
1585 | } | ||
1586 | } | ||
1587 | 1564 | ||
1588 | /* Perodic poll of phy status to check for link transistion */ | ||
1589 | static void skge_link_timer(unsigned long __arg) | ||
1590 | { | ||
1591 | struct skge_port *skge = (struct skge_port *) __arg; | ||
1592 | struct skge_hw *hw = skge->hw; | ||
1593 | int port = skge->port; | ||
1594 | |||
1595 | if (hw->chip_id != CHIP_ID_GENESIS || !netif_running(skge->netdev)) | ||
1596 | return; | ||
1597 | |||
1598 | spin_lock_bh(&hw->phy_lock); | ||
1599 | if (hw->phy_type == SK_PHY_BCOM) | ||
1600 | genesis_bcom_intr(skge); | ||
1601 | else { | ||
1602 | int i; | ||
1603 | for (i = 0; i < 3; i++) | ||
1604 | if (skge_xm_read16(hw, port, XM_ISRC) & XM_IS_INP_ASS) | ||
1605 | break; | ||
1606 | |||
1607 | if (i == 3) | ||
1608 | mod_timer(&skge->link_check, jiffies + LINK_POLL_HZ); | ||
1609 | else | ||
1610 | genesis_link_up(skge); | ||
1611 | } | ||
1612 | spin_unlock_bh(&hw->phy_lock); | ||
1613 | } | 1565 | } |
1614 | 1566 | ||
1615 | /* Marvell Phy Initailization */ | 1567 | /* Marvell Phy Initailization */ |
@@ -1621,31 +1573,27 @@ static void yukon_init(struct skge_hw *hw, int port) | |||
1621 | 1573 | ||
1622 | pr_debug("yukon_init\n"); | 1574 | pr_debug("yukon_init\n"); |
1623 | if (skge->autoneg == AUTONEG_ENABLE) { | 1575 | if (skge->autoneg == AUTONEG_ENABLE) { |
1624 | u16 ectrl = skge_gm_phy_read(hw, port, PHY_MARV_EXT_CTRL); | 1576 | u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL); |
1625 | 1577 | ||
1626 | ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK | | 1578 | ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK | |
1627 | PHY_M_EC_MAC_S_MSK); | 1579 | PHY_M_EC_MAC_S_MSK); |
1628 | ectrl |= PHY_M_EC_MAC_S(MAC_TX_CLK_25_MHZ); | 1580 | ectrl |= PHY_M_EC_MAC_S(MAC_TX_CLK_25_MHZ); |
1629 | 1581 | ||
1630 | /* on PHY 88E1111 there is a change for downshift control */ | 1582 | ectrl |= PHY_M_EC_M_DSC(0) | PHY_M_EC_S_DSC(1); |
1631 | if (hw->chip_id == CHIP_ID_YUKON_EC) | ||
1632 | ectrl |= PHY_M_EC_M_DSC_2(0) | PHY_M_EC_DOWN_S_ENA; | ||
1633 | else | ||
1634 | ectrl |= PHY_M_EC_M_DSC(0) | PHY_M_EC_S_DSC(1); | ||
1635 | 1583 | ||
1636 | skge_gm_phy_write(hw, port, PHY_MARV_EXT_CTRL, ectrl); | 1584 | gm_phy_write(hw, port, PHY_MARV_EXT_CTRL, ectrl); |
1637 | } | 1585 | } |
1638 | 1586 | ||
1639 | ctrl = skge_gm_phy_read(hw, port, PHY_MARV_CTRL); | 1587 | ctrl = gm_phy_read(hw, port, PHY_MARV_CTRL); |
1640 | if (skge->autoneg == AUTONEG_DISABLE) | 1588 | if (skge->autoneg == AUTONEG_DISABLE) |
1641 | ctrl &= ~PHY_CT_ANE; | 1589 | ctrl &= ~PHY_CT_ANE; |
1642 | 1590 | ||
1643 | ctrl |= PHY_CT_RESET; | 1591 | ctrl |= PHY_CT_RESET; |
1644 | skge_gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); | 1592 | gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); |
1645 | 1593 | ||
1646 | ctrl = 0; | 1594 | ctrl = 0; |
1647 | ct1000 = 0; | 1595 | ct1000 = 0; |
1648 | adv = PHY_SEL_TYPE; | 1596 | adv = PHY_AN_CSMA; |
1649 | 1597 | ||
1650 | if (skge->autoneg == AUTONEG_ENABLE) { | 1598 | if (skge->autoneg == AUTONEG_ENABLE) { |
1651 | if (iscopper(hw)) { | 1599 | if (iscopper(hw)) { |
@@ -1661,41 +1609,12 @@ static void yukon_init(struct skge_hw *hw, int port) | |||
1661 | adv |= PHY_M_AN_10_FD; | 1609 | adv |= PHY_M_AN_10_FD; |
1662 | if (skge->advertising & ADVERTISED_10baseT_Half) | 1610 | if (skge->advertising & ADVERTISED_10baseT_Half) |
1663 | adv |= PHY_M_AN_10_HD; | 1611 | adv |= PHY_M_AN_10_HD; |
1664 | 1612 | } else /* special defines for FIBER (88E1011S only) */ | |
1665 | /* Set Flow-control capabilities */ | ||
1666 | switch (skge->flow_control) { | ||
1667 | case FLOW_MODE_NONE: | ||
1668 | adv |= PHY_B_P_NO_PAUSE; | ||
1669 | break; | ||
1670 | case FLOW_MODE_LOC_SEND: | ||
1671 | adv |= PHY_B_P_ASYM_MD; | ||
1672 | break; | ||
1673 | case FLOW_MODE_SYMMETRIC: | ||
1674 | adv |= PHY_B_P_SYM_MD; | ||
1675 | break; | ||
1676 | case FLOW_MODE_REM_SEND: | ||
1677 | adv |= PHY_B_P_BOTH_MD; | ||
1678 | break; | ||
1679 | } | ||
1680 | } else { /* special defines for FIBER (88E1011S only) */ | ||
1681 | adv |= PHY_M_AN_1000X_AHD | PHY_M_AN_1000X_AFD; | 1613 | adv |= PHY_M_AN_1000X_AHD | PHY_M_AN_1000X_AFD; |
1682 | 1614 | ||
1683 | /* Set Flow-control capabilities */ | 1615 | /* Set Flow-control capabilities */ |
1684 | switch (skge->flow_control) { | 1616 | adv |= phy_pause_map[skge->flow_control]; |
1685 | case FLOW_MODE_NONE: | 1617 | |
1686 | adv |= PHY_M_P_NO_PAUSE_X; | ||
1687 | break; | ||
1688 | case FLOW_MODE_LOC_SEND: | ||
1689 | adv |= PHY_M_P_ASYM_MD_X; | ||
1690 | break; | ||
1691 | case FLOW_MODE_SYMMETRIC: | ||
1692 | adv |= PHY_M_P_SYM_MD_X; | ||
1693 | break; | ||
1694 | case FLOW_MODE_REM_SEND: | ||
1695 | adv |= PHY_M_P_BOTH_MD_X; | ||
1696 | break; | ||
1697 | } | ||
1698 | } | ||
1699 | /* Restart Auto-negotiation */ | 1618 | /* Restart Auto-negotiation */ |
1700 | ctrl |= PHY_CT_ANE | PHY_CT_RE_CFG; | 1619 | ctrl |= PHY_CT_ANE | PHY_CT_RE_CFG; |
1701 | } else { | 1620 | } else { |
@@ -1717,36 +1636,23 @@ static void yukon_init(struct skge_hw *hw, int port) | |||
1717 | ctrl |= PHY_CT_RESET; | 1636 | ctrl |= PHY_CT_RESET; |
1718 | } | 1637 | } |
1719 | 1638 | ||
1720 | if (hw->chip_id != CHIP_ID_YUKON_FE) | 1639 | gm_phy_write(hw, port, PHY_MARV_1000T_CTRL, ct1000); |
1721 | skge_gm_phy_write(hw, port, PHY_MARV_1000T_CTRL, ct1000); | ||
1722 | 1640 | ||
1723 | skge_gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, adv); | 1641 | gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, adv); |
1724 | skge_gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); | 1642 | gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); |
1725 | 1643 | ||
1726 | /* Setup Phy LED's */ | 1644 | /* Setup Phy LED's */ |
1727 | ledctrl = PHY_M_LED_PULS_DUR(PULS_170MS); | 1645 | ledctrl = PHY_M_LED_PULS_DUR(PULS_170MS); |
1728 | ledover = 0; | 1646 | ledover = 0; |
1729 | 1647 | ||
1730 | if (hw->chip_id == CHIP_ID_YUKON_FE) { | 1648 | ledctrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) | PHY_M_LEDC_TX_CTRL; |
1731 | /* on 88E3082 these bits are at 11..9 (shifted left) */ | ||
1732 | ledctrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) << 1; | ||
1733 | |||
1734 | skge_gm_phy_write(hw, port, PHY_MARV_FE_LED_PAR, | ||
1735 | ((skge_gm_phy_read(hw, port, PHY_MARV_FE_LED_PAR) | ||
1736 | |||
1737 | & ~PHY_M_FELP_LED1_MSK) | ||
1738 | | PHY_M_FELP_LED1_CTRL(LED_PAR_CTRL_ACT_BL))); | ||
1739 | } else { | ||
1740 | /* set Tx LED (LED_TX) to blink mode on Rx OR Tx activity */ | ||
1741 | ledctrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) | PHY_M_LEDC_TX_CTRL; | ||
1742 | 1649 | ||
1743 | /* turn off the Rx LED (LED_RX) */ | 1650 | /* turn off the Rx LED (LED_RX) */ |
1744 | ledover |= PHY_M_LED_MO_RX(MO_LED_OFF); | 1651 | ledover |= PHY_M_LED_MO_RX(MO_LED_OFF); |
1745 | } | ||
1746 | 1652 | ||
1747 | /* disable blink mode (LED_DUPLEX) on collisions */ | 1653 | /* disable blink mode (LED_DUPLEX) on collisions */ |
1748 | ctrl |= PHY_M_LEDC_DP_CTRL; | 1654 | ctrl |= PHY_M_LEDC_DP_CTRL; |
1749 | skge_gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl); | 1655 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl); |
1750 | 1656 | ||
1751 | if (skge->autoneg == AUTONEG_DISABLE || skge->speed == SPEED_100) { | 1657 | if (skge->autoneg == AUTONEG_DISABLE || skge->speed == SPEED_100) { |
1752 | /* turn on 100 Mbps LED (LED_LINK100) */ | 1658 | /* turn on 100 Mbps LED (LED_LINK100) */ |
@@ -1754,25 +1660,25 @@ static void yukon_init(struct skge_hw *hw, int port) | |||
1754 | } | 1660 | } |
1755 | 1661 | ||
1756 | if (ledover) | 1662 | if (ledover) |
1757 | skge_gm_phy_write(hw, port, PHY_MARV_LED_OVER, ledover); | 1663 | gm_phy_write(hw, port, PHY_MARV_LED_OVER, ledover); |
1758 | 1664 | ||
1759 | /* Enable phy interrupt on autonegotiation complete (or link up) */ | 1665 | /* Enable phy interrupt on autonegotiation complete (or link up) */ |
1760 | if (skge->autoneg == AUTONEG_ENABLE) | 1666 | if (skge->autoneg == AUTONEG_ENABLE) |
1761 | skge_gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_AN_COMPL); | 1667 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_AN_COMPL); |
1762 | else | 1668 | else |
1763 | skge_gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); | 1669 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); |
1764 | } | 1670 | } |
1765 | 1671 | ||
1766 | static void yukon_reset(struct skge_hw *hw, int port) | 1672 | static void yukon_reset(struct skge_hw *hw, int port) |
1767 | { | 1673 | { |
1768 | skge_gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0);/* disable PHY IRQs */ | 1674 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0);/* disable PHY IRQs */ |
1769 | skge_gma_write16(hw, port, GM_MC_ADDR_H1, 0); /* clear MC hash */ | 1675 | gma_write16(hw, port, GM_MC_ADDR_H1, 0); /* clear MC hash */ |
1770 | skge_gma_write16(hw, port, GM_MC_ADDR_H2, 0); | 1676 | gma_write16(hw, port, GM_MC_ADDR_H2, 0); |
1771 | skge_gma_write16(hw, port, GM_MC_ADDR_H3, 0); | 1677 | gma_write16(hw, port, GM_MC_ADDR_H3, 0); |
1772 | skge_gma_write16(hw, port, GM_MC_ADDR_H4, 0); | 1678 | gma_write16(hw, port, GM_MC_ADDR_H4, 0); |
1773 | 1679 | ||
1774 | skge_gma_write16(hw, port, GM_RX_CTRL, | 1680 | gma_write16(hw, port, GM_RX_CTRL, |
1775 | skge_gma_read16(hw, port, GM_RX_CTRL) | 1681 | gma_read16(hw, port, GM_RX_CTRL) |
1776 | | GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); | 1682 | | GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); |
1777 | } | 1683 | } |
1778 | 1684 | ||
@@ -1785,17 +1691,17 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
1785 | 1691 | ||
1786 | /* WA code for COMA mode -- set PHY reset */ | 1692 | /* WA code for COMA mode -- set PHY reset */ |
1787 | if (hw->chip_id == CHIP_ID_YUKON_LITE && | 1693 | if (hw->chip_id == CHIP_ID_YUKON_LITE && |
1788 | chip_rev(hw) == CHIP_REV_YU_LITE_A3) | 1694 | hw->chip_rev == CHIP_REV_YU_LITE_A3) |
1789 | skge_write32(hw, B2_GP_IO, | 1695 | skge_write32(hw, B2_GP_IO, |
1790 | (skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9)); | 1696 | (skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9)); |
1791 | 1697 | ||
1792 | /* hard reset */ | 1698 | /* hard reset */ |
1793 | skge_write32(hw, SKGEMAC_REG(port, GPHY_CTRL), GPC_RST_SET); | 1699 | skge_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); |
1794 | skge_write32(hw, SKGEMAC_REG(port, GMAC_CTRL), GMC_RST_SET); | 1700 | skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_RST_SET); |
1795 | 1701 | ||
1796 | /* WA code for COMA mode -- clear PHY reset */ | 1702 | /* WA code for COMA mode -- clear PHY reset */ |
1797 | if (hw->chip_id == CHIP_ID_YUKON_LITE && | 1703 | if (hw->chip_id == CHIP_ID_YUKON_LITE && |
1798 | chip_rev(hw) == CHIP_REV_YU_LITE_A3) | 1704 | hw->chip_rev == CHIP_REV_YU_LITE_A3) |
1799 | skge_write32(hw, B2_GP_IO, | 1705 | skge_write32(hw, B2_GP_IO, |
1800 | (skge_read32(hw, B2_GP_IO) | GP_DIR_9) | 1706 | (skge_read32(hw, B2_GP_IO) | GP_DIR_9) |
1801 | & ~GP_IO_9); | 1707 | & ~GP_IO_9); |
@@ -1806,13 +1712,13 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
1806 | reg |= iscopper(hw) ? GPC_HWCFG_GMII_COP : GPC_HWCFG_GMII_FIB; | 1712 | reg |= iscopper(hw) ? GPC_HWCFG_GMII_COP : GPC_HWCFG_GMII_FIB; |
1807 | 1713 | ||
1808 | /* Clear GMC reset */ | 1714 | /* Clear GMC reset */ |
1809 | skge_write32(hw, SKGEMAC_REG(port, GPHY_CTRL), reg | GPC_RST_SET); | 1715 | skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_SET); |
1810 | skge_write32(hw, SKGEMAC_REG(port, GPHY_CTRL), reg | GPC_RST_CLR); | 1716 | skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_CLR); |
1811 | skge_write32(hw, SKGEMAC_REG(port, GMAC_CTRL), GMC_PAUSE_ON | GMC_RST_CLR); | 1717 | skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON | GMC_RST_CLR); |
1812 | if (skge->autoneg == AUTONEG_DISABLE) { | 1718 | if (skge->autoneg == AUTONEG_DISABLE) { |
1813 | reg = GM_GPCR_AU_ALL_DIS; | 1719 | reg = GM_GPCR_AU_ALL_DIS; |
1814 | skge_gma_write16(hw, port, GM_GP_CTRL, | 1720 | gma_write16(hw, port, GM_GP_CTRL, |
1815 | skge_gma_read16(hw, port, GM_GP_CTRL) | reg); | 1721 | gma_read16(hw, port, GM_GP_CTRL) | reg); |
1816 | 1722 | ||
1817 | switch (skge->speed) { | 1723 | switch (skge->speed) { |
1818 | case SPEED_1000: | 1724 | case SPEED_1000: |
@@ -1828,7 +1734,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
1828 | reg = GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100 | GM_GPCR_DUP_FULL; | 1734 | reg = GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100 | GM_GPCR_DUP_FULL; |
1829 | switch (skge->flow_control) { | 1735 | switch (skge->flow_control) { |
1830 | case FLOW_MODE_NONE: | 1736 | case FLOW_MODE_NONE: |
1831 | skge_write32(hw, SKGEMAC_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); | 1737 | skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); |
1832 | reg |= GM_GPCR_FC_TX_DIS | GM_GPCR_FC_RX_DIS | GM_GPCR_AU_FCT_DIS; | 1738 | reg |= GM_GPCR_FC_TX_DIS | GM_GPCR_FC_RX_DIS | GM_GPCR_AU_FCT_DIS; |
1833 | break; | 1739 | break; |
1834 | case FLOW_MODE_LOC_SEND: | 1740 | case FLOW_MODE_LOC_SEND: |
@@ -1836,7 +1742,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
1836 | reg |= GM_GPCR_FC_RX_DIS | GM_GPCR_AU_FCT_DIS; | 1742 | reg |= GM_GPCR_FC_RX_DIS | GM_GPCR_AU_FCT_DIS; |
1837 | } | 1743 | } |
1838 | 1744 | ||
1839 | skge_gma_write16(hw, port, GM_GP_CTRL, reg); | 1745 | gma_write16(hw, port, GM_GP_CTRL, reg); |
1840 | skge_read16(hw, GMAC_IRQ_SRC); | 1746 | skge_read16(hw, GMAC_IRQ_SRC); |
1841 | 1747 | ||
1842 | spin_lock_bh(&hw->phy_lock); | 1748 | spin_lock_bh(&hw->phy_lock); |
@@ -1844,25 +1750,25 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
1844 | spin_unlock_bh(&hw->phy_lock); | 1750 | spin_unlock_bh(&hw->phy_lock); |
1845 | 1751 | ||
1846 | /* MIB clear */ | 1752 | /* MIB clear */ |
1847 | reg = skge_gma_read16(hw, port, GM_PHY_ADDR); | 1753 | reg = gma_read16(hw, port, GM_PHY_ADDR); |
1848 | skge_gma_write16(hw, port, GM_PHY_ADDR, reg | GM_PAR_MIB_CLR); | 1754 | gma_write16(hw, port, GM_PHY_ADDR, reg | GM_PAR_MIB_CLR); |
1849 | 1755 | ||
1850 | for (i = 0; i < GM_MIB_CNT_SIZE; i++) | 1756 | for (i = 0; i < GM_MIB_CNT_SIZE; i++) |
1851 | skge_gma_read16(hw, port, GM_MIB_CNT_BASE + 8*i); | 1757 | gma_read16(hw, port, GM_MIB_CNT_BASE + 8*i); |
1852 | skge_gma_write16(hw, port, GM_PHY_ADDR, reg); | 1758 | gma_write16(hw, port, GM_PHY_ADDR, reg); |
1853 | 1759 | ||
1854 | /* transmit control */ | 1760 | /* transmit control */ |
1855 | skge_gma_write16(hw, port, GM_TX_CTRL, TX_COL_THR(TX_COL_DEF)); | 1761 | gma_write16(hw, port, GM_TX_CTRL, TX_COL_THR(TX_COL_DEF)); |
1856 | 1762 | ||
1857 | /* receive control reg: unicast + multicast + no FCS */ | 1763 | /* receive control reg: unicast + multicast + no FCS */ |
1858 | skge_gma_write16(hw, port, GM_RX_CTRL, | 1764 | gma_write16(hw, port, GM_RX_CTRL, |
1859 | GM_RXCR_UCF_ENA | GM_RXCR_CRC_DIS | GM_RXCR_MCF_ENA); | 1765 | GM_RXCR_UCF_ENA | GM_RXCR_CRC_DIS | GM_RXCR_MCF_ENA); |
1860 | 1766 | ||
1861 | /* transmit flow control */ | 1767 | /* transmit flow control */ |
1862 | skge_gma_write16(hw, port, GM_TX_FLOW_CTRL, 0xffff); | 1768 | gma_write16(hw, port, GM_TX_FLOW_CTRL, 0xffff); |
1863 | 1769 | ||
1864 | /* transmit parameter */ | 1770 | /* transmit parameter */ |
1865 | skge_gma_write16(hw, port, GM_TX_PARAM, | 1771 | gma_write16(hw, port, GM_TX_PARAM, |
1866 | TX_JAM_LEN_VAL(TX_JAM_LEN_DEF) | | 1772 | TX_JAM_LEN_VAL(TX_JAM_LEN_DEF) | |
1867 | TX_JAM_IPG_VAL(TX_JAM_IPG_DEF) | | 1773 | TX_JAM_IPG_VAL(TX_JAM_IPG_DEF) | |
1868 | TX_IPG_JAM_DATA(TX_IPG_JAM_DEF)); | 1774 | TX_IPG_JAM_DATA(TX_IPG_JAM_DEF)); |
@@ -1872,33 +1778,33 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
1872 | if (hw->dev[port]->mtu > 1500) | 1778 | if (hw->dev[port]->mtu > 1500) |
1873 | reg |= GM_SMOD_JUMBO_ENA; | 1779 | reg |= GM_SMOD_JUMBO_ENA; |
1874 | 1780 | ||
1875 | skge_gma_write16(hw, port, GM_SERIAL_MODE, reg); | 1781 | gma_write16(hw, port, GM_SERIAL_MODE, reg); |
1876 | 1782 | ||
1877 | /* physical address: used for pause frames */ | 1783 | /* physical address: used for pause frames */ |
1878 | skge_gm_set_addr(hw, port, GM_SRC_ADDR_1L, addr); | 1784 | gma_set_addr(hw, port, GM_SRC_ADDR_1L, addr); |
1879 | /* virtual address for data */ | 1785 | /* virtual address for data */ |
1880 | skge_gm_set_addr(hw, port, GM_SRC_ADDR_2L, addr); | 1786 | gma_set_addr(hw, port, GM_SRC_ADDR_2L, addr); |
1881 | 1787 | ||
1882 | /* enable interrupt mask for counter overflows */ | 1788 | /* enable interrupt mask for counter overflows */ |
1883 | skge_gma_write16(hw, port, GM_TX_IRQ_MSK, 0); | 1789 | gma_write16(hw, port, GM_TX_IRQ_MSK, 0); |
1884 | skge_gma_write16(hw, port, GM_RX_IRQ_MSK, 0); | 1790 | gma_write16(hw, port, GM_RX_IRQ_MSK, 0); |
1885 | skge_gma_write16(hw, port, GM_TR_IRQ_MSK, 0); | 1791 | gma_write16(hw, port, GM_TR_IRQ_MSK, 0); |
1886 | 1792 | ||
1887 | /* Initialize Mac Fifo */ | 1793 | /* Initialize Mac Fifo */ |
1888 | 1794 | ||
1889 | /* Configure Rx MAC FIFO */ | 1795 | /* Configure Rx MAC FIFO */ |
1890 | skge_write16(hw, SKGEMAC_REG(port, RX_GMF_FL_MSK), RX_FF_FL_DEF_MSK); | 1796 | skge_write16(hw, SK_REG(port, RX_GMF_FL_MSK), RX_FF_FL_DEF_MSK); |
1891 | reg = GMF_OPER_ON | GMF_RX_F_FL_ON; | 1797 | reg = GMF_OPER_ON | GMF_RX_F_FL_ON; |
1892 | if (hw->chip_id == CHIP_ID_YUKON_LITE && | 1798 | if (hw->chip_id == CHIP_ID_YUKON_LITE && |
1893 | chip_rev(hw) == CHIP_REV_YU_LITE_A3) | 1799 | hw->chip_rev == CHIP_REV_YU_LITE_A3) |
1894 | reg &= ~GMF_RX_F_FL_ON; | 1800 | reg &= ~GMF_RX_F_FL_ON; |
1895 | skge_write8(hw, SKGEMAC_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR); | 1801 | skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR); |
1896 | skge_write16(hw, SKGEMAC_REG(port, RX_GMF_CTRL_T), reg); | 1802 | skge_write16(hw, SK_REG(port, RX_GMF_CTRL_T), reg); |
1897 | skge_write16(hw, SKGEMAC_REG(port, RX_GMF_FL_THR), RX_GMF_FL_THR_DEF); | 1803 | skge_write16(hw, SK_REG(port, RX_GMF_FL_THR), RX_GMF_FL_THR_DEF); |
1898 | 1804 | ||
1899 | /* Configure Tx MAC FIFO */ | 1805 | /* Configure Tx MAC FIFO */ |
1900 | skge_write8(hw, SKGEMAC_REG(port, TX_GMF_CTRL_T), GMF_RST_CLR); | 1806 | skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_CLR); |
1901 | skge_write16(hw, SKGEMAC_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON); | 1807 | skge_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON); |
1902 | } | 1808 | } |
1903 | 1809 | ||
1904 | static void yukon_stop(struct skge_port *skge) | 1810 | static void yukon_stop(struct skge_port *skge) |
@@ -1907,19 +1813,19 @@ static void yukon_stop(struct skge_port *skge) | |||
1907 | int port = skge->port; | 1813 | int port = skge->port; |
1908 | 1814 | ||
1909 | if (hw->chip_id == CHIP_ID_YUKON_LITE && | 1815 | if (hw->chip_id == CHIP_ID_YUKON_LITE && |
1910 | chip_rev(hw) == CHIP_REV_YU_LITE_A3) { | 1816 | hw->chip_rev == CHIP_REV_YU_LITE_A3) { |
1911 | skge_write32(hw, B2_GP_IO, | 1817 | skge_write32(hw, B2_GP_IO, |
1912 | skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9); | 1818 | skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9); |
1913 | } | 1819 | } |
1914 | 1820 | ||
1915 | skge_gma_write16(hw, port, GM_GP_CTRL, | 1821 | gma_write16(hw, port, GM_GP_CTRL, |
1916 | skge_gma_read16(hw, port, GM_GP_CTRL) | 1822 | gma_read16(hw, port, GM_GP_CTRL) |
1917 | & ~(GM_GPCR_RX_ENA|GM_GPCR_RX_ENA)); | 1823 | & ~(GM_GPCR_RX_ENA|GM_GPCR_RX_ENA)); |
1918 | skge_gma_read16(hw, port, GM_GP_CTRL); | 1824 | gma_read16(hw, port, GM_GP_CTRL); |
1919 | 1825 | ||
1920 | /* set GPHY Control reset */ | 1826 | /* set GPHY Control reset */ |
1921 | skge_gma_write32(hw, port, GPHY_CTRL, GPC_RST_SET); | 1827 | gma_write32(hw, port, GPHY_CTRL, GPC_RST_SET); |
1922 | skge_gma_write32(hw, port, GMAC_CTRL, GMC_RST_SET); | 1828 | gma_write32(hw, port, GMAC_CTRL, GMC_RST_SET); |
1923 | } | 1829 | } |
1924 | 1830 | ||
1925 | static void yukon_get_stats(struct skge_port *skge, u64 *data) | 1831 | static void yukon_get_stats(struct skge_port *skge, u64 *data) |
@@ -1928,39 +1834,40 @@ static void yukon_get_stats(struct skge_port *skge, u64 *data) | |||
1928 | int port = skge->port; | 1834 | int port = skge->port; |
1929 | int i; | 1835 | int i; |
1930 | 1836 | ||
1931 | data[0] = (u64) skge_gma_read32(hw, port, GM_TXO_OK_HI) << 32 | 1837 | data[0] = (u64) gma_read32(hw, port, GM_TXO_OK_HI) << 32 |
1932 | | skge_gma_read32(hw, port, GM_TXO_OK_LO); | 1838 | | gma_read32(hw, port, GM_TXO_OK_LO); |
1933 | data[1] = (u64) skge_gma_read32(hw, port, GM_RXO_OK_HI) << 32 | 1839 | data[1] = (u64) gma_read32(hw, port, GM_RXO_OK_HI) << 32 |
1934 | | skge_gma_read32(hw, port, GM_RXO_OK_LO); | 1840 | | gma_read32(hw, port, GM_RXO_OK_LO); |
1935 | 1841 | ||
1936 | for (i = 2; i < ARRAY_SIZE(skge_stats); i++) | 1842 | for (i = 2; i < ARRAY_SIZE(skge_stats); i++) |
1937 | data[i] = skge_gma_read32(hw, port, | 1843 | data[i] = gma_read32(hw, port, |
1938 | skge_stats[i].gma_offset); | 1844 | skge_stats[i].gma_offset); |
1939 | } | 1845 | } |
1940 | 1846 | ||
1941 | static void yukon_mac_intr(struct skge_hw *hw, int port) | 1847 | static void yukon_mac_intr(struct skge_hw *hw, int port) |
1942 | { | 1848 | { |
1943 | struct skge_port *skge = netdev_priv(hw->dev[port]); | 1849 | struct net_device *dev = hw->dev[port]; |
1944 | u8 status = skge_read8(hw, SKGEMAC_REG(port, GMAC_IRQ_SRC)); | 1850 | struct skge_port *skge = netdev_priv(dev); |
1851 | u8 status = skge_read8(hw, SK_REG(port, GMAC_IRQ_SRC)); | ||
1852 | |||
1853 | if (netif_msg_intr(skge)) | ||
1854 | printk(KERN_DEBUG PFX "%s: mac interrupt status 0x%x\n", | ||
1855 | dev->name, status); | ||
1945 | 1856 | ||
1946 | pr_debug("yukon_intr status %x\n", status); | ||
1947 | if (status & GM_IS_RX_FF_OR) { | 1857 | if (status & GM_IS_RX_FF_OR) { |
1948 | ++skge->net_stats.rx_fifo_errors; | 1858 | ++skge->net_stats.rx_fifo_errors; |
1949 | skge_gma_write8(hw, port, RX_GMF_CTRL_T, GMF_CLI_RX_FO); | 1859 | gma_write8(hw, port, RX_GMF_CTRL_T, GMF_CLI_RX_FO); |
1950 | } | 1860 | } |
1951 | if (status & GM_IS_TX_FF_UR) { | 1861 | if (status & GM_IS_TX_FF_UR) { |
1952 | ++skge->net_stats.tx_fifo_errors; | 1862 | ++skge->net_stats.tx_fifo_errors; |
1953 | skge_gma_write8(hw, port, TX_GMF_CTRL_T, GMF_CLI_TX_FU); | 1863 | gma_write8(hw, port, TX_GMF_CTRL_T, GMF_CLI_TX_FU); |
1954 | } | 1864 | } |
1955 | 1865 | ||
1956 | } | 1866 | } |
1957 | 1867 | ||
1958 | static u16 yukon_speed(const struct skge_hw *hw, u16 aux) | 1868 | static u16 yukon_speed(const struct skge_hw *hw, u16 aux) |
1959 | { | 1869 | { |
1960 | if (hw->chip_id == CHIP_ID_YUKON_FE) | 1870 | switch (aux & PHY_M_PS_SPEED_MSK) { |
1961 | return (aux & PHY_M_PS_SPEED_100) ? SPEED_100 : SPEED_10; | ||
1962 | |||
1963 | switch(aux & PHY_M_PS_SPEED_MSK) { | ||
1964 | case PHY_M_PS_SPEED_1000: | 1871 | case PHY_M_PS_SPEED_1000: |
1965 | return SPEED_1000; | 1872 | return SPEED_1000; |
1966 | case PHY_M_PS_SPEED_100: | 1873 | case PHY_M_PS_SPEED_100: |
@@ -1981,15 +1888,15 @@ static void yukon_link_up(struct skge_port *skge) | |||
1981 | /* Enable Transmit FIFO Underrun */ | 1888 | /* Enable Transmit FIFO Underrun */ |
1982 | skge_write8(hw, GMAC_IRQ_MSK, GMAC_DEF_MSK); | 1889 | skge_write8(hw, GMAC_IRQ_MSK, GMAC_DEF_MSK); |
1983 | 1890 | ||
1984 | reg = skge_gma_read16(hw, port, GM_GP_CTRL); | 1891 | reg = gma_read16(hw, port, GM_GP_CTRL); |
1985 | if (skge->duplex == DUPLEX_FULL || skge->autoneg == AUTONEG_ENABLE) | 1892 | if (skge->duplex == DUPLEX_FULL || skge->autoneg == AUTONEG_ENABLE) |
1986 | reg |= GM_GPCR_DUP_FULL; | 1893 | reg |= GM_GPCR_DUP_FULL; |
1987 | 1894 | ||
1988 | /* enable Rx/Tx */ | 1895 | /* enable Rx/Tx */ |
1989 | reg |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA; | 1896 | reg |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA; |
1990 | skge_gma_write16(hw, port, GM_GP_CTRL, reg); | 1897 | gma_write16(hw, port, GM_GP_CTRL, reg); |
1991 | 1898 | ||
1992 | skge_gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); | 1899 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); |
1993 | skge_link_up(skge); | 1900 | skge_link_up(skge); |
1994 | } | 1901 | } |
1995 | 1902 | ||
@@ -1999,16 +1906,15 @@ static void yukon_link_down(struct skge_port *skge) | |||
1999 | int port = skge->port; | 1906 | int port = skge->port; |
2000 | 1907 | ||
2001 | pr_debug("yukon_link_down\n"); | 1908 | pr_debug("yukon_link_down\n"); |
2002 | skge_gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0); | 1909 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0); |
2003 | skge_gm_phy_write(hw, port, GM_GP_CTRL, | 1910 | gm_phy_write(hw, port, GM_GP_CTRL, |
2004 | skge_gm_phy_read(hw, port, GM_GP_CTRL) | 1911 | gm_phy_read(hw, port, GM_GP_CTRL) |
2005 | & ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA)); | 1912 | & ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA)); |
2006 | 1913 | ||
2007 | if (hw->chip_id != CHIP_ID_YUKON_FE && | 1914 | if (skge->flow_control == FLOW_MODE_REM_SEND) { |
2008 | skge->flow_control == FLOW_MODE_REM_SEND) { | ||
2009 | /* restore Asymmetric Pause bit */ | 1915 | /* restore Asymmetric Pause bit */ |
2010 | skge_gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, | 1916 | gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, |
2011 | skge_gm_phy_read(hw, port, | 1917 | gm_phy_read(hw, port, |
2012 | PHY_MARV_AUNE_ADV) | 1918 | PHY_MARV_AUNE_ADV) |
2013 | | PHY_M_AN_ASP); | 1919 | | PHY_M_AN_ASP); |
2014 | 1920 | ||
@@ -2027,20 +1933,21 @@ static void yukon_phy_intr(struct skge_port *skge) | |||
2027 | const char *reason = NULL; | 1933 | const char *reason = NULL; |
2028 | u16 istatus, phystat; | 1934 | u16 istatus, phystat; |
2029 | 1935 | ||
2030 | istatus = skge_gm_phy_read(hw, port, PHY_MARV_INT_STAT); | 1936 | istatus = gm_phy_read(hw, port, PHY_MARV_INT_STAT); |
2031 | phystat = skge_gm_phy_read(hw, port, PHY_MARV_PHY_STAT); | 1937 | phystat = gm_phy_read(hw, port, PHY_MARV_PHY_STAT); |
2032 | pr_debug("yukon phy intr istat=%x phy_stat=%x\n", istatus, phystat); | 1938 | |
1939 | if (netif_msg_intr(skge)) | ||
1940 | printk(KERN_DEBUG PFX "%s: phy interrupt status 0x%x 0x%x\n", | ||
1941 | skge->netdev->name, istatus, phystat); | ||
2033 | 1942 | ||
2034 | if (istatus & PHY_M_IS_AN_COMPL) { | 1943 | if (istatus & PHY_M_IS_AN_COMPL) { |
2035 | if (skge_gm_phy_read(hw, port, PHY_MARV_AUNE_LP) | 1944 | if (gm_phy_read(hw, port, PHY_MARV_AUNE_LP) |
2036 | & PHY_M_AN_RF) { | 1945 | & PHY_M_AN_RF) { |
2037 | reason = "remote fault"; | 1946 | reason = "remote fault"; |
2038 | goto failed; | 1947 | goto failed; |
2039 | } | 1948 | } |
2040 | 1949 | ||
2041 | if (!(hw->chip_id == CHIP_ID_YUKON_FE || hw->chip_id == CHIP_ID_YUKON_EC) | 1950 | if (gm_phy_read(hw, port, PHY_MARV_1000T_STAT) & PHY_B_1000S_MSF) { |
2042 | && (skge_gm_phy_read(hw, port, PHY_MARV_1000T_STAT) | ||
2043 | & PHY_B_1000S_MSF)) { | ||
2044 | reason = "master/slave fault"; | 1951 | reason = "master/slave fault"; |
2045 | goto failed; | 1952 | goto failed; |
2046 | } | 1953 | } |
@@ -2054,10 +1961,6 @@ static void yukon_phy_intr(struct skge_port *skge) | |||
2054 | ? DUPLEX_FULL : DUPLEX_HALF; | 1961 | ? DUPLEX_FULL : DUPLEX_HALF; |
2055 | skge->speed = yukon_speed(hw, phystat); | 1962 | skge->speed = yukon_speed(hw, phystat); |
2056 | 1963 | ||
2057 | /* Tx & Rx Pause Enabled bits are at 9..8 */ | ||
2058 | if (hw->chip_id == CHIP_ID_YUKON_XL) | ||
2059 | phystat >>= 6; | ||
2060 | |||
2061 | /* We are using IEEE 802.3z/D5.0 Table 37-4 */ | 1964 | /* We are using IEEE 802.3z/D5.0 Table 37-4 */ |
2062 | switch (phystat & PHY_M_PS_PAUSE_MSK) { | 1965 | switch (phystat & PHY_M_PS_PAUSE_MSK) { |
2063 | case PHY_M_PS_PAUSE_MSK: | 1966 | case PHY_M_PS_PAUSE_MSK: |
@@ -2075,9 +1978,9 @@ static void yukon_phy_intr(struct skge_port *skge) | |||
2075 | 1978 | ||
2076 | if (skge->flow_control == FLOW_MODE_NONE || | 1979 | if (skge->flow_control == FLOW_MODE_NONE || |
2077 | (skge->speed < SPEED_1000 && skge->duplex == DUPLEX_HALF)) | 1980 | (skge->speed < SPEED_1000 && skge->duplex == DUPLEX_HALF)) |
2078 | skge_write8(hw, SKGEMAC_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); | 1981 | skge_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); |
2079 | else | 1982 | else |
2080 | skge_write8(hw, SKGEMAC_REG(port, GMAC_CTRL), GMC_PAUSE_ON); | 1983 | skge_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON); |
2081 | yukon_link_up(skge); | 1984 | yukon_link_up(skge); |
2082 | return; | 1985 | return; |
2083 | } | 1986 | } |
@@ -2161,6 +2064,12 @@ static int skge_up(struct net_device *dev) | |||
2161 | if (netif_msg_ifup(skge)) | 2064 | if (netif_msg_ifup(skge)) |
2162 | printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); | 2065 | printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); |
2163 | 2066 | ||
2067 | if (dev->mtu > RX_BUF_SIZE) | ||
2068 | skge->rx_buf_size = dev->mtu + ETH_HLEN + NET_IP_ALIGN; | ||
2069 | else | ||
2070 | skge->rx_buf_size = RX_BUF_SIZE; | ||
2071 | |||
2072 | |||
2164 | rx_size = skge->rx_ring.count * sizeof(struct skge_rx_desc); | 2073 | rx_size = skge->rx_ring.count * sizeof(struct skge_rx_desc); |
2165 | tx_size = skge->tx_ring.count * sizeof(struct skge_tx_desc); | 2074 | tx_size = skge->tx_ring.count * sizeof(struct skge_tx_desc); |
2166 | skge->mem_size = tx_size + rx_size; | 2075 | skge->mem_size = tx_size + rx_size; |
@@ -2173,7 +2082,8 @@ static int skge_up(struct net_device *dev) | |||
2173 | if ((err = skge_ring_alloc(&skge->rx_ring, skge->mem, skge->dma))) | 2082 | if ((err = skge_ring_alloc(&skge->rx_ring, skge->mem, skge->dma))) |
2174 | goto free_pci_mem; | 2083 | goto free_pci_mem; |
2175 | 2084 | ||
2176 | if (skge_rx_fill(skge)) | 2085 | err = skge_rx_fill(skge); |
2086 | if (err) | ||
2177 | goto free_rx_ring; | 2087 | goto free_rx_ring; |
2178 | 2088 | ||
2179 | if ((err = skge_ring_alloc(&skge->tx_ring, skge->mem + rx_size, | 2089 | if ((err = skge_ring_alloc(&skge->tx_ring, skge->mem + rx_size, |
@@ -2182,6 +2092,10 @@ static int skge_up(struct net_device *dev) | |||
2182 | 2092 | ||
2183 | skge->tx_avail = skge->tx_ring.count - 1; | 2093 | skge->tx_avail = skge->tx_ring.count - 1; |
2184 | 2094 | ||
2095 | /* Enable IRQ from port */ | ||
2096 | hw->intr_mask |= portirqmask[port]; | ||
2097 | skge_write32(hw, B0_IMSK, hw->intr_mask); | ||
2098 | |||
2185 | /* Initialze MAC */ | 2099 | /* Initialze MAC */ |
2186 | if (hw->chip_id == CHIP_ID_GENESIS) | 2100 | if (hw->chip_id == CHIP_ID_GENESIS) |
2187 | genesis_mac_init(hw, port); | 2101 | genesis_mac_init(hw, port); |
@@ -2189,7 +2103,7 @@ static int skge_up(struct net_device *dev) | |||
2189 | yukon_mac_init(hw, port); | 2103 | yukon_mac_init(hw, port); |
2190 | 2104 | ||
2191 | /* Configure RAMbuffers */ | 2105 | /* Configure RAMbuffers */ |
2192 | chunk = hw->ram_size / (isdualport(hw) ? 4 : 2); | 2106 | chunk = hw->ram_size / ((hw->ports + 1)*2); |
2193 | ram_addr = hw->ram_offset + 2 * chunk * port; | 2107 | ram_addr = hw->ram_offset + 2 * chunk * port; |
2194 | 2108 | ||
2195 | skge_ramset(hw, rxqaddr[port], ram_addr, chunk); | 2109 | skge_ramset(hw, rxqaddr[port], ram_addr, chunk); |
@@ -2227,7 +2141,6 @@ static int skge_down(struct net_device *dev) | |||
2227 | netif_stop_queue(dev); | 2141 | netif_stop_queue(dev); |
2228 | 2142 | ||
2229 | del_timer_sync(&skge->led_blink); | 2143 | del_timer_sync(&skge->led_blink); |
2230 | del_timer_sync(&skge->link_check); | ||
2231 | 2144 | ||
2232 | /* Stop transmitter */ | 2145 | /* Stop transmitter */ |
2233 | skge_write8(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_STOP); | 2146 | skge_write8(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_STOP); |
@@ -2240,12 +2153,12 @@ static int skge_down(struct net_device *dev) | |||
2240 | yukon_stop(skge); | 2153 | yukon_stop(skge); |
2241 | 2154 | ||
2242 | /* Disable Force Sync bit and Enable Alloc bit */ | 2155 | /* Disable Force Sync bit and Enable Alloc bit */ |
2243 | skge_write8(hw, SKGEMAC_REG(port, TXA_CTRL), | 2156 | skge_write8(hw, SK_REG(port, TXA_CTRL), |
2244 | TXA_DIS_FSYNC | TXA_DIS_ALLOC | TXA_STOP_RC); | 2157 | TXA_DIS_FSYNC | TXA_DIS_ALLOC | TXA_STOP_RC); |
2245 | 2158 | ||
2246 | /* Stop Interval Timer and Limit Counter of Tx Arbiter */ | 2159 | /* Stop Interval Timer and Limit Counter of Tx Arbiter */ |
2247 | skge_write32(hw, SKGEMAC_REG(port, TXA_ITI_INI), 0L); | 2160 | skge_write32(hw, SK_REG(port, TXA_ITI_INI), 0L); |
2248 | skge_write32(hw, SKGEMAC_REG(port, TXA_LIM_INI), 0L); | 2161 | skge_write32(hw, SK_REG(port, TXA_LIM_INI), 0L); |
2249 | 2162 | ||
2250 | /* Reset PCI FIFO */ | 2163 | /* Reset PCI FIFO */ |
2251 | skge_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_SET_RESET); | 2164 | skge_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_SET_RESET); |
@@ -2260,13 +2173,13 @@ static int skge_down(struct net_device *dev) | |||
2260 | skge_write32(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_SET_RESET); | 2173 | skge_write32(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_SET_RESET); |
2261 | 2174 | ||
2262 | if (hw->chip_id == CHIP_ID_GENESIS) { | 2175 | if (hw->chip_id == CHIP_ID_GENESIS) { |
2263 | skge_write8(hw, SKGEMAC_REG(port, TX_MFF_CTRL2), MFF_RST_SET); | 2176 | skge_write8(hw, SK_REG(port, TX_MFF_CTRL2), MFF_RST_SET); |
2264 | skge_write8(hw, SKGEMAC_REG(port, RX_MFF_CTRL2), MFF_RST_SET); | 2177 | skge_write8(hw, SK_REG(port, RX_MFF_CTRL2), MFF_RST_SET); |
2265 | skge_write8(hw, SKGEMAC_REG(port, TX_LED_CTRL), LED_STOP); | 2178 | skge_write8(hw, SK_REG(port, TX_LED_CTRL), LED_STOP); |
2266 | skge_write8(hw, SKGEMAC_REG(port, RX_LED_CTRL), LED_STOP); | 2179 | skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_STOP); |
2267 | } else { | 2180 | } else { |
2268 | skge_write8(hw, SKGEMAC_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); | 2181 | skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); |
2269 | skge_write8(hw, SKGEMAC_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); | 2182 | skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); |
2270 | } | 2183 | } |
2271 | 2184 | ||
2272 | /* turn off led's */ | 2185 | /* turn off led's */ |
@@ -2299,10 +2212,10 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
2299 | 2212 | ||
2300 | local_irq_save(flags); | 2213 | local_irq_save(flags); |
2301 | if (!spin_trylock(&skge->tx_lock)) { | 2214 | if (!spin_trylock(&skge->tx_lock)) { |
2302 | /* Collision - tell upper layer to requeue */ | 2215 | /* Collision - tell upper layer to requeue */ |
2303 | local_irq_restore(flags); | 2216 | local_irq_restore(flags); |
2304 | return NETDEV_TX_LOCKED; | 2217 | return NETDEV_TX_LOCKED; |
2305 | } | 2218 | } |
2306 | 2219 | ||
2307 | if (unlikely(skge->tx_avail < skb_shinfo(skb)->nr_frags +1)) { | 2220 | if (unlikely(skge->tx_avail < skb_shinfo(skb)->nr_frags +1)) { |
2308 | netif_stop_queue(dev); | 2221 | netif_stop_queue(dev); |
@@ -2333,7 +2246,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
2333 | * does. Looks like hardware is wrong? | 2246 | * does. Looks like hardware is wrong? |
2334 | */ | 2247 | */ |
2335 | if (ip->protocol == IPPROTO_UDP | 2248 | if (ip->protocol == IPPROTO_UDP |
2336 | && chip_rev(hw) == 0 && hw->chip_id == CHIP_ID_YUKON) | 2249 | && hw->chip_rev == 0 && hw->chip_id == CHIP_ID_YUKON) |
2337 | control = BMU_TCP_CHECK; | 2250 | control = BMU_TCP_CHECK; |
2338 | else | 2251 | else |
2339 | control = BMU_UDP_CHECK; | 2252 | control = BMU_UDP_CHECK; |
@@ -2394,6 +2307,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
2394 | 2307 | ||
2395 | static inline void skge_tx_free(struct skge_hw *hw, struct skge_element *e) | 2308 | static inline void skge_tx_free(struct skge_hw *hw, struct skge_element *e) |
2396 | { | 2309 | { |
2310 | /* This ring element can be skb or fragment */ | ||
2397 | if (e->skb) { | 2311 | if (e->skb) { |
2398 | pci_unmap_single(hw->pdev, | 2312 | pci_unmap_single(hw->pdev, |
2399 | pci_unmap_addr(e, mapaddr), | 2313 | pci_unmap_addr(e, mapaddr), |
@@ -2438,16 +2352,17 @@ static void skge_tx_timeout(struct net_device *dev) | |||
2438 | static int skge_change_mtu(struct net_device *dev, int new_mtu) | 2352 | static int skge_change_mtu(struct net_device *dev, int new_mtu) |
2439 | { | 2353 | { |
2440 | int err = 0; | 2354 | int err = 0; |
2355 | int running = netif_running(dev); | ||
2441 | 2356 | ||
2442 | if(new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) | 2357 | if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) |
2443 | return -EINVAL; | 2358 | return -EINVAL; |
2444 | 2359 | ||
2445 | dev->mtu = new_mtu; | ||
2446 | 2360 | ||
2447 | if (netif_running(dev)) { | 2361 | if (running) |
2448 | skge_down(dev); | 2362 | skge_down(dev); |
2363 | dev->mtu = new_mtu; | ||
2364 | if (running) | ||
2449 | skge_up(dev); | 2365 | skge_up(dev); |
2450 | } | ||
2451 | 2366 | ||
2452 | return err; | 2367 | return err; |
2453 | } | 2368 | } |
@@ -2462,7 +2377,9 @@ static void genesis_set_multicast(struct net_device *dev) | |||
2462 | u32 mode; | 2377 | u32 mode; |
2463 | u8 filter[8]; | 2378 | u8 filter[8]; |
2464 | 2379 | ||
2465 | mode = skge_xm_read32(hw, port, XM_MODE); | 2380 | pr_debug("genesis_set_multicast flags=%x count=%d\n", dev->flags, dev->mc_count); |
2381 | |||
2382 | mode = xm_read32(hw, port, XM_MODE); | ||
2466 | mode |= XM_MD_ENA_HASH; | 2383 | mode |= XM_MD_ENA_HASH; |
2467 | if (dev->flags & IFF_PROMISC) | 2384 | if (dev->flags & IFF_PROMISC) |
2468 | mode |= XM_MD_ENA_PROM; | 2385 | mode |= XM_MD_ENA_PROM; |
@@ -2473,17 +2390,16 @@ static void genesis_set_multicast(struct net_device *dev) | |||
2473 | memset(filter, 0xff, sizeof(filter)); | 2390 | memset(filter, 0xff, sizeof(filter)); |
2474 | else { | 2391 | else { |
2475 | memset(filter, 0, sizeof(filter)); | 2392 | memset(filter, 0, sizeof(filter)); |
2476 | for(i = 0; list && i < count; i++, list = list->next) { | 2393 | for (i = 0; list && i < count; i++, list = list->next) { |
2477 | u32 crc = crc32_le(~0, list->dmi_addr, ETH_ALEN); | 2394 | u32 crc, bit; |
2478 | u8 bit = 63 - (crc & 63); | 2395 | crc = ether_crc_le(ETH_ALEN, list->dmi_addr); |
2479 | 2396 | bit = ~crc & 0x3f; | |
2480 | filter[bit/8] |= 1 << (bit%8); | 2397 | filter[bit/8] |= 1 << (bit%8); |
2481 | } | 2398 | } |
2482 | } | 2399 | } |
2483 | 2400 | ||
2484 | skge_xm_outhash(hw, port, XM_HSM, filter); | 2401 | xm_write32(hw, port, XM_MODE, mode); |
2485 | 2402 | xm_outhash(hw, port, XM_HSM, filter); | |
2486 | skge_xm_write32(hw, port, XM_MODE, mode); | ||
2487 | } | 2403 | } |
2488 | 2404 | ||
2489 | static void yukon_set_multicast(struct net_device *dev) | 2405 | static void yukon_set_multicast(struct net_device *dev) |
@@ -2497,7 +2413,7 @@ static void yukon_set_multicast(struct net_device *dev) | |||
2497 | 2413 | ||
2498 | memset(filter, 0, sizeof(filter)); | 2414 | memset(filter, 0, sizeof(filter)); |
2499 | 2415 | ||
2500 | reg = skge_gma_read16(hw, port, GM_RX_CTRL); | 2416 | reg = gma_read16(hw, port, GM_RX_CTRL); |
2501 | reg |= GM_RXCR_UCF_ENA; | 2417 | reg |= GM_RXCR_UCF_ENA; |
2502 | 2418 | ||
2503 | if (dev->flags & IFF_PROMISC) /* promiscious */ | 2419 | if (dev->flags & IFF_PROMISC) /* promiscious */ |
@@ -2510,23 +2426,23 @@ static void yukon_set_multicast(struct net_device *dev) | |||
2510 | int i; | 2426 | int i; |
2511 | reg |= GM_RXCR_MCF_ENA; | 2427 | reg |= GM_RXCR_MCF_ENA; |
2512 | 2428 | ||
2513 | for(i = 0; list && i < dev->mc_count; i++, list = list->next) { | 2429 | for (i = 0; list && i < dev->mc_count; i++, list = list->next) { |
2514 | u32 bit = ether_crc(ETH_ALEN, list->dmi_addr) & 0x3f; | 2430 | u32 bit = ether_crc(ETH_ALEN, list->dmi_addr) & 0x3f; |
2515 | filter[bit/8] |= 1 << (bit%8); | 2431 | filter[bit/8] |= 1 << (bit%8); |
2516 | } | 2432 | } |
2517 | } | 2433 | } |
2518 | 2434 | ||
2519 | 2435 | ||
2520 | skge_gma_write16(hw, port, GM_MC_ADDR_H1, | 2436 | gma_write16(hw, port, GM_MC_ADDR_H1, |
2521 | (u16)filter[0] | ((u16)filter[1] << 8)); | 2437 | (u16)filter[0] | ((u16)filter[1] << 8)); |
2522 | skge_gma_write16(hw, port, GM_MC_ADDR_H2, | 2438 | gma_write16(hw, port, GM_MC_ADDR_H2, |
2523 | (u16)filter[2] | ((u16)filter[3] << 8)); | 2439 | (u16)filter[2] | ((u16)filter[3] << 8)); |
2524 | skge_gma_write16(hw, port, GM_MC_ADDR_H3, | 2440 | gma_write16(hw, port, GM_MC_ADDR_H3, |
2525 | (u16)filter[4] | ((u16)filter[5] << 8)); | 2441 | (u16)filter[4] | ((u16)filter[5] << 8)); |
2526 | skge_gma_write16(hw, port, GM_MC_ADDR_H4, | 2442 | gma_write16(hw, port, GM_MC_ADDR_H4, |
2527 | (u16)filter[6] | ((u16)filter[7] << 8)); | 2443 | (u16)filter[6] | ((u16)filter[7] << 8)); |
2528 | 2444 | ||
2529 | skge_gma_write16(hw, port, GM_RX_CTRL, reg); | 2445 | gma_write16(hw, port, GM_RX_CTRL, reg); |
2530 | } | 2446 | } |
2531 | 2447 | ||
2532 | static inline int bad_phy_status(const struct skge_hw *hw, u32 status) | 2448 | static inline int bad_phy_status(const struct skge_hw *hw, u32 status) |
@@ -2545,28 +2461,76 @@ static void skge_rx_error(struct skge_port *skge, int slot, | |||
2545 | printk(KERN_DEBUG PFX "%s: rx err, slot %d control 0x%x status 0x%x\n", | 2461 | printk(KERN_DEBUG PFX "%s: rx err, slot %d control 0x%x status 0x%x\n", |
2546 | skge->netdev->name, slot, control, status); | 2462 | skge->netdev->name, slot, control, status); |
2547 | 2463 | ||
2548 | if ((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF) | 2464 | if ((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF)) |
2549 | || (control & BMU_BBC) > skge->netdev->mtu + VLAN_ETH_HLEN) | ||
2550 | skge->net_stats.rx_length_errors++; | 2465 | skge->net_stats.rx_length_errors++; |
2551 | else { | 2466 | else if (skge->hw->chip_id == CHIP_ID_GENESIS) { |
2552 | if (skge->hw->chip_id == CHIP_ID_GENESIS) { | 2467 | if (status & (XMR_FS_RUNT|XMR_FS_LNG_ERR)) |
2553 | if (status & (XMR_FS_RUNT|XMR_FS_LNG_ERR)) | 2468 | skge->net_stats.rx_length_errors++; |
2554 | skge->net_stats.rx_length_errors++; | 2469 | if (status & XMR_FS_FRA_ERR) |
2555 | if (status & XMR_FS_FRA_ERR) | 2470 | skge->net_stats.rx_frame_errors++; |
2556 | skge->net_stats.rx_frame_errors++; | 2471 | if (status & XMR_FS_FCS_ERR) |
2557 | if (status & XMR_FS_FCS_ERR) | 2472 | skge->net_stats.rx_crc_errors++; |
2558 | skge->net_stats.rx_crc_errors++; | 2473 | } else { |
2559 | } else { | 2474 | if (status & (GMR_FS_LONG_ERR|GMR_FS_UN_SIZE)) |
2560 | if (status & (GMR_FS_LONG_ERR|GMR_FS_UN_SIZE)) | 2475 | skge->net_stats.rx_length_errors++; |
2561 | skge->net_stats.rx_length_errors++; | 2476 | if (status & GMR_FS_FRAGMENT) |
2562 | if (status & GMR_FS_FRAGMENT) | 2477 | skge->net_stats.rx_frame_errors++; |
2563 | skge->net_stats.rx_frame_errors++; | 2478 | if (status & GMR_FS_CRC_ERR) |
2564 | if (status & GMR_FS_CRC_ERR) | 2479 | skge->net_stats.rx_crc_errors++; |
2565 | skge->net_stats.rx_crc_errors++; | 2480 | } |
2481 | } | ||
2482 | |||
2483 | /* Get receive buffer from descriptor. | ||
2484 | * Handles copy of small buffers and reallocation failures | ||
2485 | */ | ||
2486 | static inline struct sk_buff *skge_rx_get(struct skge_port *skge, | ||
2487 | struct skge_element *e, | ||
2488 | unsigned int len) | ||
2489 | { | ||
2490 | struct sk_buff *nskb, *skb; | ||
2491 | |||
2492 | if (len < RX_COPY_THRESHOLD) { | ||
2493 | nskb = skge_rx_alloc(skge->netdev, len + NET_IP_ALIGN); | ||
2494 | if (unlikely(!nskb)) | ||
2495 | return NULL; | ||
2496 | |||
2497 | pci_dma_sync_single_for_cpu(skge->hw->pdev, | ||
2498 | pci_unmap_addr(e, mapaddr), | ||
2499 | len, PCI_DMA_FROMDEVICE); | ||
2500 | memcpy(nskb->data, e->skb->data, len); | ||
2501 | pci_dma_sync_single_for_device(skge->hw->pdev, | ||
2502 | pci_unmap_addr(e, mapaddr), | ||
2503 | len, PCI_DMA_FROMDEVICE); | ||
2504 | |||
2505 | if (skge->rx_csum) { | ||
2506 | struct skge_rx_desc *rd = e->desc; | ||
2507 | nskb->csum = le16_to_cpu(rd->csum2); | ||
2508 | nskb->ip_summed = CHECKSUM_HW; | ||
2566 | } | 2509 | } |
2510 | skge_rx_reuse(e, skge->rx_buf_size); | ||
2511 | return nskb; | ||
2512 | } else { | ||
2513 | nskb = skge_rx_alloc(skge->netdev, skge->rx_buf_size); | ||
2514 | if (unlikely(!nskb)) | ||
2515 | return NULL; | ||
2516 | |||
2517 | pci_unmap_single(skge->hw->pdev, | ||
2518 | pci_unmap_addr(e, mapaddr), | ||
2519 | pci_unmap_len(e, maplen), | ||
2520 | PCI_DMA_FROMDEVICE); | ||
2521 | skb = e->skb; | ||
2522 | if (skge->rx_csum) { | ||
2523 | struct skge_rx_desc *rd = e->desc; | ||
2524 | skb->csum = le16_to_cpu(rd->csum2); | ||
2525 | skb->ip_summed = CHECKSUM_HW; | ||
2526 | } | ||
2527 | |||
2528 | skge_rx_setup(skge, e, nskb, skge->rx_buf_size); | ||
2529 | return skb; | ||
2567 | } | 2530 | } |
2568 | } | 2531 | } |
2569 | 2532 | ||
2533 | |||
2570 | static int skge_poll(struct net_device *dev, int *budget) | 2534 | static int skge_poll(struct net_device *dev, int *budget) |
2571 | { | 2535 | { |
2572 | struct skge_port *skge = netdev_priv(dev); | 2536 | struct skge_port *skge = netdev_priv(dev); |
@@ -2575,13 +2539,12 @@ static int skge_poll(struct net_device *dev, int *budget) | |||
2575 | struct skge_element *e; | 2539 | struct skge_element *e; |
2576 | unsigned int to_do = min(dev->quota, *budget); | 2540 | unsigned int to_do = min(dev->quota, *budget); |
2577 | unsigned int work_done = 0; | 2541 | unsigned int work_done = 0; |
2578 | int done; | ||
2579 | static const u32 irqmask[] = { IS_PORT_1, IS_PORT_2 }; | ||
2580 | 2542 | ||
2581 | for (e = ring->to_clean; e != ring->to_use && work_done < to_do; | 2543 | pr_debug("skge_poll\n"); |
2582 | e = e->next) { | 2544 | |
2545 | for (e = ring->to_clean; work_done < to_do; e = e->next) { | ||
2583 | struct skge_rx_desc *rd = e->desc; | 2546 | struct skge_rx_desc *rd = e->desc; |
2584 | struct sk_buff *skb = e->skb; | 2547 | struct sk_buff *skb; |
2585 | u32 control, len, status; | 2548 | u32 control, len, status; |
2586 | 2549 | ||
2587 | rmb(); | 2550 | rmb(); |
@@ -2590,19 +2553,12 @@ static int skge_poll(struct net_device *dev, int *budget) | |||
2590 | break; | 2553 | break; |
2591 | 2554 | ||
2592 | len = control & BMU_BBC; | 2555 | len = control & BMU_BBC; |
2593 | e->skb = NULL; | ||
2594 | |||
2595 | pci_unmap_single(hw->pdev, | ||
2596 | pci_unmap_addr(e, mapaddr), | ||
2597 | pci_unmap_len(e, maplen), | ||
2598 | PCI_DMA_FROMDEVICE); | ||
2599 | |||
2600 | status = rd->status; | 2556 | status = rd->status; |
2601 | if ((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF) | 2557 | |
2602 | || len > dev->mtu + VLAN_ETH_HLEN | 2558 | if (unlikely((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF) |
2603 | || bad_phy_status(hw, status)) { | 2559 | || bad_phy_status(hw, status))) { |
2604 | skge_rx_error(skge, e - ring->start, control, status); | 2560 | skge_rx_error(skge, e - ring->start, control, status); |
2605 | dev_kfree_skb(skb); | 2561 | skge_rx_reuse(e, skge->rx_buf_size); |
2606 | continue; | 2562 | continue; |
2607 | } | 2563 | } |
2608 | 2564 | ||
@@ -2610,43 +2566,37 @@ static int skge_poll(struct net_device *dev, int *budget) | |||
2610 | printk(KERN_DEBUG PFX "%s: rx slot %td status 0x%x len %d\n", | 2566 | printk(KERN_DEBUG PFX "%s: rx slot %td status 0x%x len %d\n", |
2611 | dev->name, e - ring->start, rd->status, len); | 2567 | dev->name, e - ring->start, rd->status, len); |
2612 | 2568 | ||
2613 | skb_put(skb, len); | 2569 | skb = skge_rx_get(skge, e, len); |
2614 | skb->protocol = eth_type_trans(skb, dev); | 2570 | if (likely(skb)) { |
2615 | 2571 | skb_put(skb, len); | |
2616 | if (skge->rx_csum) { | 2572 | skb->protocol = eth_type_trans(skb, dev); |
2617 | skb->csum = le16_to_cpu(rd->csum2); | ||
2618 | skb->ip_summed = CHECKSUM_HW; | ||
2619 | } | ||
2620 | 2573 | ||
2621 | dev->last_rx = jiffies; | 2574 | dev->last_rx = jiffies; |
2622 | netif_receive_skb(skb); | 2575 | netif_receive_skb(skb); |
2623 | 2576 | ||
2624 | ++work_done; | 2577 | ++work_done; |
2578 | } else | ||
2579 | skge_rx_reuse(e, skge->rx_buf_size); | ||
2625 | } | 2580 | } |
2626 | ring->to_clean = e; | 2581 | ring->to_clean = e; |
2627 | 2582 | ||
2628 | *budget -= work_done; | ||
2629 | dev->quota -= work_done; | ||
2630 | done = work_done < to_do; | ||
2631 | |||
2632 | if (skge_rx_fill(skge)) | ||
2633 | done = 0; | ||
2634 | |||
2635 | /* restart receiver */ | 2583 | /* restart receiver */ |
2636 | wmb(); | 2584 | wmb(); |
2637 | skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), | 2585 | skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), |
2638 | CSR_START | CSR_IRQ_CL_F); | 2586 | CSR_START | CSR_IRQ_CL_F); |
2639 | 2587 | ||
2640 | if (done) { | 2588 | *budget -= work_done; |
2641 | local_irq_disable(); | 2589 | dev->quota -= work_done; |
2642 | hw->intr_mask |= irqmask[skge->port]; | ||
2643 | /* Order is important since data can get interrupted */ | ||
2644 | skge_write32(hw, B0_IMSK, hw->intr_mask); | ||
2645 | __netif_rx_complete(dev); | ||
2646 | local_irq_enable(); | ||
2647 | } | ||
2648 | 2590 | ||
2649 | return !done; | 2591 | if (work_done >= to_do) |
2592 | return 1; /* not done */ | ||
2593 | |||
2594 | local_irq_disable(); | ||
2595 | __netif_rx_complete(dev); | ||
2596 | hw->intr_mask |= portirqmask[skge->port]; | ||
2597 | skge_write32(hw, B0_IMSK, hw->intr_mask); | ||
2598 | local_irq_enable(); | ||
2599 | return 0; | ||
2650 | } | 2600 | } |
2651 | 2601 | ||
2652 | static inline void skge_tx_intr(struct net_device *dev) | 2602 | static inline void skge_tx_intr(struct net_device *dev) |
@@ -2657,7 +2607,7 @@ static inline void skge_tx_intr(struct net_device *dev) | |||
2657 | struct skge_element *e; | 2607 | struct skge_element *e; |
2658 | 2608 | ||
2659 | spin_lock(&skge->tx_lock); | 2609 | spin_lock(&skge->tx_lock); |
2660 | for(e = ring->to_clean; e != ring->to_use; e = e->next) { | 2610 | for (e = ring->to_clean; e != ring->to_use; e = e->next) { |
2661 | struct skge_tx_desc *td = e->desc; | 2611 | struct skge_tx_desc *td = e->desc; |
2662 | u32 control; | 2612 | u32 control; |
2663 | 2613 | ||
@@ -2690,12 +2640,12 @@ static void skge_mac_parity(struct skge_hw *hw, int port) | |||
2690 | : (port == 0 ? "(port A)": "(port B")); | 2640 | : (port == 0 ? "(port A)": "(port B")); |
2691 | 2641 | ||
2692 | if (hw->chip_id == CHIP_ID_GENESIS) | 2642 | if (hw->chip_id == CHIP_ID_GENESIS) |
2693 | skge_write16(hw, SKGEMAC_REG(port, TX_MFF_CTRL1), | 2643 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), |
2694 | MFF_CLR_PERR); | 2644 | MFF_CLR_PERR); |
2695 | else | 2645 | else |
2696 | /* HW-Bug #8: cleared by GMF_CLI_TX_FC instead of GMF_CLI_TX_PE */ | 2646 | /* HW-Bug #8: cleared by GMF_CLI_TX_FC instead of GMF_CLI_TX_PE */ |
2697 | skge_write8(hw, SKGEMAC_REG(port, TX_GMF_CTRL_T), | 2647 | skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), |
2698 | (hw->chip_id == CHIP_ID_YUKON && chip_rev(hw) == 0) | 2648 | (hw->chip_id == CHIP_ID_YUKON && hw->chip_rev == 0) |
2699 | ? GMF_CLI_TX_FC : GMF_CLI_TX_PE); | 2649 | ? GMF_CLI_TX_FC : GMF_CLI_TX_PE); |
2700 | } | 2650 | } |
2701 | 2651 | ||
@@ -2703,16 +2653,16 @@ static void skge_pci_clear(struct skge_hw *hw) | |||
2703 | { | 2653 | { |
2704 | u16 status; | 2654 | u16 status; |
2705 | 2655 | ||
2706 | status = skge_read16(hw, SKGEPCI_REG(PCI_STATUS)); | 2656 | pci_read_config_word(hw->pdev, PCI_STATUS, &status); |
2707 | skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 2657 | skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |
2708 | skge_write16(hw, SKGEPCI_REG(PCI_STATUS), | 2658 | pci_write_config_word(hw->pdev, PCI_STATUS, |
2709 | status | PCI_STATUS_ERROR_BITS); | 2659 | status | PCI_STATUS_ERROR_BITS); |
2710 | skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | 2660 | skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); |
2711 | } | 2661 | } |
2712 | 2662 | ||
2713 | static void skge_mac_intr(struct skge_hw *hw, int port) | 2663 | static void skge_mac_intr(struct skge_hw *hw, int port) |
2714 | { | 2664 | { |
2715 | if (hw->chip_id == CHIP_ID_GENESIS) | 2665 | if (hw->chip_id == CHIP_ID_GENESIS) |
2716 | genesis_mac_intr(hw, port); | 2666 | genesis_mac_intr(hw, port); |
2717 | else | 2667 | else |
2718 | yukon_mac_intr(hw, port); | 2668 | yukon_mac_intr(hw, port); |
@@ -2726,9 +2676,9 @@ static void skge_error_irq(struct skge_hw *hw) | |||
2726 | if (hw->chip_id == CHIP_ID_GENESIS) { | 2676 | if (hw->chip_id == CHIP_ID_GENESIS) { |
2727 | /* clear xmac errors */ | 2677 | /* clear xmac errors */ |
2728 | if (hwstatus & (IS_NO_STAT_M1|IS_NO_TIST_M1)) | 2678 | if (hwstatus & (IS_NO_STAT_M1|IS_NO_TIST_M1)) |
2729 | skge_write16(hw, SKGEMAC_REG(0, RX_MFF_CTRL1), MFF_CLR_INSTAT); | 2679 | skge_write16(hw, SK_REG(0, RX_MFF_CTRL1), MFF_CLR_INSTAT); |
2730 | if (hwstatus & (IS_NO_STAT_M2|IS_NO_TIST_M2)) | 2680 | if (hwstatus & (IS_NO_STAT_M2|IS_NO_TIST_M2)) |
2731 | skge_write16(hw, SKGEMAC_REG(0, RX_MFF_CTRL2), MFF_CLR_INSTAT); | 2681 | skge_write16(hw, SK_REG(0, RX_MFF_CTRL2), MFF_CLR_INSTAT); |
2732 | } else { | 2682 | } else { |
2733 | /* Timestamp (unused) overflow */ | 2683 | /* Timestamp (unused) overflow */ |
2734 | if (hwstatus & IS_IRQ_TIST_OV) | 2684 | if (hwstatus & IS_IRQ_TIST_OV) |
@@ -2803,8 +2753,8 @@ static void skge_extirq(unsigned long data) | |||
2803 | 2753 | ||
2804 | if (hw->chip_id != CHIP_ID_GENESIS) | 2754 | if (hw->chip_id != CHIP_ID_GENESIS) |
2805 | yukon_phy_intr(skge); | 2755 | yukon_phy_intr(skge); |
2806 | else if (hw->phy_type == SK_PHY_BCOM) | 2756 | else |
2807 | genesis_bcom_intr(skge); | 2757 | bcom_phy_intr(skge); |
2808 | } | 2758 | } |
2809 | } | 2759 | } |
2810 | spin_unlock(&hw->phy_lock); | 2760 | spin_unlock(&hw->phy_lock); |
@@ -2824,19 +2774,14 @@ static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2824 | return IRQ_NONE; | 2774 | return IRQ_NONE; |
2825 | 2775 | ||
2826 | status &= hw->intr_mask; | 2776 | status &= hw->intr_mask; |
2827 | 2777 | if (status & IS_R1_F) { | |
2828 | if ((status & IS_R1_F) && netif_rx_schedule_prep(hw->dev[0])) { | ||
2829 | status &= ~IS_R1_F; | ||
2830 | hw->intr_mask &= ~IS_R1_F; | 2778 | hw->intr_mask &= ~IS_R1_F; |
2831 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 2779 | netif_rx_schedule(hw->dev[0]); |
2832 | __netif_rx_schedule(hw->dev[0]); | ||
2833 | } | 2780 | } |
2834 | 2781 | ||
2835 | if ((status & IS_R2_F) && netif_rx_schedule_prep(hw->dev[1])) { | 2782 | if (status & IS_R2_F) { |
2836 | status &= ~IS_R2_F; | ||
2837 | hw->intr_mask &= ~IS_R2_F; | 2783 | hw->intr_mask &= ~IS_R2_F; |
2838 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 2784 | netif_rx_schedule(hw->dev[1]); |
2839 | __netif_rx_schedule(hw->dev[1]); | ||
2840 | } | 2785 | } |
2841 | 2786 | ||
2842 | if (status & IS_XA1_F) | 2787 | if (status & IS_XA1_F) |
@@ -2845,9 +2790,27 @@ static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2845 | if (status & IS_XA2_F) | 2790 | if (status & IS_XA2_F) |
2846 | skge_tx_intr(hw->dev[1]); | 2791 | skge_tx_intr(hw->dev[1]); |
2847 | 2792 | ||
2793 | if (status & IS_PA_TO_RX1) { | ||
2794 | struct skge_port *skge = netdev_priv(hw->dev[0]); | ||
2795 | ++skge->net_stats.rx_over_errors; | ||
2796 | skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_RX1); | ||
2797 | } | ||
2798 | |||
2799 | if (status & IS_PA_TO_RX2) { | ||
2800 | struct skge_port *skge = netdev_priv(hw->dev[1]); | ||
2801 | ++skge->net_stats.rx_over_errors; | ||
2802 | skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_RX2); | ||
2803 | } | ||
2804 | |||
2805 | if (status & IS_PA_TO_TX1) | ||
2806 | skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_TX1); | ||
2807 | |||
2808 | if (status & IS_PA_TO_TX2) | ||
2809 | skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_TX2); | ||
2810 | |||
2848 | if (status & IS_MAC1) | 2811 | if (status & IS_MAC1) |
2849 | skge_mac_intr(hw, 0); | 2812 | skge_mac_intr(hw, 0); |
2850 | 2813 | ||
2851 | if (status & IS_MAC2) | 2814 | if (status & IS_MAC2) |
2852 | skge_mac_intr(hw, 1); | 2815 | skge_mac_intr(hw, 1); |
2853 | 2816 | ||
@@ -2859,8 +2822,7 @@ static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2859 | tasklet_schedule(&hw->ext_tasklet); | 2822 | tasklet_schedule(&hw->ext_tasklet); |
2860 | } | 2823 | } |
2861 | 2824 | ||
2862 | if (status) | 2825 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
2863 | skge_write32(hw, B0_IMSK, hw->intr_mask); | ||
2864 | 2826 | ||
2865 | return IRQ_HANDLED; | 2827 | return IRQ_HANDLED; |
2866 | } | 2828 | } |
@@ -2904,9 +2866,6 @@ static const struct { | |||
2904 | { CHIP_ID_YUKON, "Yukon" }, | 2866 | { CHIP_ID_YUKON, "Yukon" }, |
2905 | { CHIP_ID_YUKON_LITE, "Yukon-Lite"}, | 2867 | { CHIP_ID_YUKON_LITE, "Yukon-Lite"}, |
2906 | { CHIP_ID_YUKON_LP, "Yukon-LP"}, | 2868 | { CHIP_ID_YUKON_LP, "Yukon-LP"}, |
2907 | { CHIP_ID_YUKON_XL, "Yukon-2 XL"}, | ||
2908 | { CHIP_ID_YUKON_EC, "YUKON-2 EC"}, | ||
2909 | { CHIP_ID_YUKON_FE, "YUKON-2 FE"}, | ||
2910 | }; | 2869 | }; |
2911 | 2870 | ||
2912 | static const char *skge_board_name(const struct skge_hw *hw) | 2871 | static const char *skge_board_name(const struct skge_hw *hw) |
@@ -2930,8 +2889,8 @@ static const char *skge_board_name(const struct skge_hw *hw) | |||
2930 | static int skge_reset(struct skge_hw *hw) | 2889 | static int skge_reset(struct skge_hw *hw) |
2931 | { | 2890 | { |
2932 | u16 ctst; | 2891 | u16 ctst; |
2933 | u8 t8; | 2892 | u8 t8, mac_cfg; |
2934 | int i, ports; | 2893 | int i; |
2935 | 2894 | ||
2936 | ctst = skge_read16(hw, B0_CTST); | 2895 | ctst = skge_read16(hw, B0_CTST); |
2937 | 2896 | ||
@@ -2952,12 +2911,9 @@ static int skge_reset(struct skge_hw *hw) | |||
2952 | hw->phy_type = skge_read8(hw, B2_E_1) & 0xf; | 2911 | hw->phy_type = skge_read8(hw, B2_E_1) & 0xf; |
2953 | hw->pmd_type = skge_read8(hw, B2_PMD_TYP); | 2912 | hw->pmd_type = skge_read8(hw, B2_PMD_TYP); |
2954 | 2913 | ||
2955 | switch(hw->chip_id) { | 2914 | switch (hw->chip_id) { |
2956 | case CHIP_ID_GENESIS: | 2915 | case CHIP_ID_GENESIS: |
2957 | switch (hw->phy_type) { | 2916 | switch (hw->phy_type) { |
2958 | case SK_PHY_XMAC: | ||
2959 | hw->phy_addr = PHY_ADDR_XMAC; | ||
2960 | break; | ||
2961 | case SK_PHY_BCOM: | 2917 | case SK_PHY_BCOM: |
2962 | hw->phy_addr = PHY_ADDR_BCOM; | 2918 | hw->phy_addr = PHY_ADDR_BCOM; |
2963 | break; | 2919 | break; |
@@ -2986,8 +2942,9 @@ static int skge_reset(struct skge_hw *hw) | |||
2986 | return -EOPNOTSUPP; | 2942 | return -EOPNOTSUPP; |
2987 | } | 2943 | } |
2988 | 2944 | ||
2989 | hw->mac_cfg = skge_read8(hw, B2_MAC_CFG); | 2945 | mac_cfg = skge_read8(hw, B2_MAC_CFG); |
2990 | ports = isdualport(hw) ? 2 : 1; | 2946 | hw->ports = (mac_cfg & CFG_SNG_MAC) ? 1 : 2; |
2947 | hw->chip_rev = (mac_cfg & CFG_CHIP_R_MSK) >> 4; | ||
2991 | 2948 | ||
2992 | /* read the adapters RAM size */ | 2949 | /* read the adapters RAM size */ |
2993 | t8 = skge_read8(hw, B2_E_0); | 2950 | t8 = skge_read8(hw, B2_E_0); |
@@ -3010,9 +2967,9 @@ static int skge_reset(struct skge_hw *hw) | |||
3010 | /* switch power to VCC (WA for VAUX problem) */ | 2967 | /* switch power to VCC (WA for VAUX problem) */ |
3011 | skge_write8(hw, B0_POWER_CTRL, | 2968 | skge_write8(hw, B0_POWER_CTRL, |
3012 | PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_OFF | PC_VCC_ON); | 2969 | PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_OFF | PC_VCC_ON); |
3013 | for (i = 0; i < ports; i++) { | 2970 | for (i = 0; i < hw->ports; i++) { |
3014 | skge_write16(hw, SKGEMAC_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); | 2971 | skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); |
3015 | skge_write16(hw, SKGEMAC_REG(i, GMAC_LINK_CTRL), GMLC_RST_CLR); | 2972 | skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_CLR); |
3016 | } | 2973 | } |
3017 | } | 2974 | } |
3018 | 2975 | ||
@@ -3022,8 +2979,8 @@ static int skge_reset(struct skge_hw *hw) | |||
3022 | skge_write8(hw, B0_LED, LED_STAT_ON); | 2979 | skge_write8(hw, B0_LED, LED_STAT_ON); |
3023 | 2980 | ||
3024 | /* enable the Tx Arbiters */ | 2981 | /* enable the Tx Arbiters */ |
3025 | for (i = 0; i < ports; i++) | 2982 | for (i = 0; i < hw->ports; i++) |
3026 | skge_write8(hw, SKGEMAC_REG(i, TXA_CTRL), TXA_ENA_ARB); | 2983 | skge_write8(hw, SK_REG(i, TXA_CTRL), TXA_ENA_ARB); |
3027 | 2984 | ||
3028 | /* Initialize ram interface */ | 2985 | /* Initialize ram interface */ |
3029 | skge_write16(hw, B3_RI_CTRL, RI_RST_CLR); | 2986 | skge_write16(hw, B3_RI_CTRL, RI_RST_CLR); |
@@ -3050,16 +3007,14 @@ static int skge_reset(struct skge_hw *hw) | |||
3050 | skge_write32(hw, B2_IRQM_INI, skge_usecs2clk(hw, 100)); | 3007 | skge_write32(hw, B2_IRQM_INI, skge_usecs2clk(hw, 100)); |
3051 | skge_write32(hw, B2_IRQM_CTRL, TIM_START); | 3008 | skge_write32(hw, B2_IRQM_CTRL, TIM_START); |
3052 | 3009 | ||
3053 | hw->intr_mask = IS_HW_ERR | IS_EXT_REG | IS_PORT_1; | 3010 | hw->intr_mask = IS_HW_ERR | IS_EXT_REG; |
3054 | if (isdualport(hw)) | ||
3055 | hw->intr_mask |= IS_PORT_2; | ||
3056 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 3011 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
3057 | 3012 | ||
3058 | if (hw->chip_id != CHIP_ID_GENESIS) | 3013 | if (hw->chip_id != CHIP_ID_GENESIS) |
3059 | skge_write8(hw, GMAC_IRQ_MSK, 0); | 3014 | skge_write8(hw, GMAC_IRQ_MSK, 0); |
3060 | 3015 | ||
3061 | spin_lock_bh(&hw->phy_lock); | 3016 | spin_lock_bh(&hw->phy_lock); |
3062 | for (i = 0; i < ports; i++) { | 3017 | for (i = 0; i < hw->ports; i++) { |
3063 | if (hw->chip_id == CHIP_ID_GENESIS) | 3018 | if (hw->chip_id == CHIP_ID_GENESIS) |
3064 | genesis_reset(hw, i); | 3019 | genesis_reset(hw, i); |
3065 | else | 3020 | else |
@@ -3071,7 +3026,8 @@ static int skge_reset(struct skge_hw *hw) | |||
3071 | } | 3026 | } |
3072 | 3027 | ||
3073 | /* Initialize network device */ | 3028 | /* Initialize network device */ |
3074 | static struct net_device *skge_devinit(struct skge_hw *hw, int port) | 3029 | static struct net_device *skge_devinit(struct skge_hw *hw, int port, |
3030 | int highmem) | ||
3075 | { | 3031 | { |
3076 | struct skge_port *skge; | 3032 | struct skge_port *skge; |
3077 | struct net_device *dev = alloc_etherdev(sizeof(*skge)); | 3033 | struct net_device *dev = alloc_etherdev(sizeof(*skge)); |
@@ -3104,6 +3060,8 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port) | |||
3104 | #endif | 3060 | #endif |
3105 | dev->irq = hw->pdev->irq; | 3061 | dev->irq = hw->pdev->irq; |
3106 | dev->features = NETIF_F_LLTX; | 3062 | dev->features = NETIF_F_LLTX; |
3063 | if (highmem) | ||
3064 | dev->features |= NETIF_F_HIGHDMA; | ||
3107 | 3065 | ||
3108 | skge = netdev_priv(dev); | 3066 | skge = netdev_priv(dev); |
3109 | skge->netdev = dev; | 3067 | skge->netdev = dev; |
@@ -3117,7 +3075,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port) | |||
3117 | skge->flow_control = FLOW_MODE_SYMMETRIC; | 3075 | skge->flow_control = FLOW_MODE_SYMMETRIC; |
3118 | skge->duplex = -1; | 3076 | skge->duplex = -1; |
3119 | skge->speed = -1; | 3077 | skge->speed = -1; |
3120 | skge->advertising = skge_modes(hw); | 3078 | skge->advertising = skge_supported_modes(hw); |
3121 | 3079 | ||
3122 | hw->dev[port] = dev; | 3080 | hw->dev[port] = dev; |
3123 | 3081 | ||
@@ -3125,10 +3083,6 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port) | |||
3125 | 3083 | ||
3126 | spin_lock_init(&skge->tx_lock); | 3084 | spin_lock_init(&skge->tx_lock); |
3127 | 3085 | ||
3128 | init_timer(&skge->link_check); | ||
3129 | skge->link_check.function = skge_link_timer; | ||
3130 | skge->link_check.data = (unsigned long) skge; | ||
3131 | |||
3132 | init_timer(&skge->led_blink); | 3086 | init_timer(&skge->led_blink); |
3133 | skge->led_blink.function = skge_blink_timer; | 3087 | skge->led_blink.function = skge_blink_timer; |
3134 | skge->led_blink.data = (unsigned long) skge; | 3088 | skge->led_blink.data = (unsigned long) skge; |
@@ -3232,14 +3186,11 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3232 | 3186 | ||
3233 | printk(KERN_INFO PFX "addr 0x%lx irq %d chip %s rev %d\n", | 3187 | printk(KERN_INFO PFX "addr 0x%lx irq %d chip %s rev %d\n", |
3234 | pci_resource_start(pdev, 0), pdev->irq, | 3188 | pci_resource_start(pdev, 0), pdev->irq, |
3235 | skge_board_name(hw), chip_rev(hw)); | 3189 | skge_board_name(hw), hw->chip_rev); |
3236 | 3190 | ||
3237 | if ((dev = skge_devinit(hw, 0)) == NULL) | 3191 | if ((dev = skge_devinit(hw, 0, using_dac)) == NULL) |
3238 | goto err_out_led_off; | 3192 | goto err_out_led_off; |
3239 | 3193 | ||
3240 | if (using_dac) | ||
3241 | dev->features |= NETIF_F_HIGHDMA; | ||
3242 | |||
3243 | if ((err = register_netdev(dev))) { | 3194 | if ((err = register_netdev(dev))) { |
3244 | printk(KERN_ERR PFX "%s: cannot register net device\n", | 3195 | printk(KERN_ERR PFX "%s: cannot register net device\n", |
3245 | pci_name(pdev)); | 3196 | pci_name(pdev)); |
@@ -3248,10 +3199,7 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3248 | 3199 | ||
3249 | skge_show_addr(dev); | 3200 | skge_show_addr(dev); |
3250 | 3201 | ||
3251 | if (isdualport(hw) && (dev1 = skge_devinit(hw, 1))) { | 3202 | if (hw->ports > 1 && (dev1 = skge_devinit(hw, 1, using_dac))) { |
3252 | if (using_dac) | ||
3253 | dev1->features |= NETIF_F_HIGHDMA; | ||
3254 | |||
3255 | if (register_netdev(dev1) == 0) | 3203 | if (register_netdev(dev1) == 0) |
3256 | skge_show_addr(dev1); | 3204 | skge_show_addr(dev1); |
3257 | else { | 3205 | else { |
@@ -3288,7 +3236,7 @@ static void __devexit skge_remove(struct pci_dev *pdev) | |||
3288 | struct skge_hw *hw = pci_get_drvdata(pdev); | 3236 | struct skge_hw *hw = pci_get_drvdata(pdev); |
3289 | struct net_device *dev0, *dev1; | 3237 | struct net_device *dev0, *dev1; |
3290 | 3238 | ||
3291 | if(!hw) | 3239 | if (!hw) |
3292 | return; | 3240 | return; |
3293 | 3241 | ||
3294 | if ((dev1 = hw->dev[1])) | 3242 | if ((dev1 = hw->dev[1])) |
@@ -3316,7 +3264,7 @@ static int skge_suspend(struct pci_dev *pdev, u32 state) | |||
3316 | struct skge_hw *hw = pci_get_drvdata(pdev); | 3264 | struct skge_hw *hw = pci_get_drvdata(pdev); |
3317 | int i, wol = 0; | 3265 | int i, wol = 0; |
3318 | 3266 | ||
3319 | for(i = 0; i < 2; i++) { | 3267 | for (i = 0; i < 2; i++) { |
3320 | struct net_device *dev = hw->dev[i]; | 3268 | struct net_device *dev = hw->dev[i]; |
3321 | 3269 | ||
3322 | if (dev) { | 3270 | if (dev) { |
@@ -3349,11 +3297,11 @@ static int skge_resume(struct pci_dev *pdev) | |||
3349 | 3297 | ||
3350 | skge_reset(hw); | 3298 | skge_reset(hw); |
3351 | 3299 | ||
3352 | for(i = 0; i < 2; i++) { | 3300 | for (i = 0; i < 2; i++) { |
3353 | struct net_device *dev = hw->dev[i]; | 3301 | struct net_device *dev = hw->dev[i]; |
3354 | if (dev) { | 3302 | if (dev) { |
3355 | netif_device_attach(dev); | 3303 | netif_device_attach(dev); |
3356 | if(netif_running(dev)) | 3304 | if (netif_running(dev)) |
3357 | skge_up(dev); | 3305 | skge_up(dev); |
3358 | } | 3306 | } |
3359 | } | 3307 | } |
diff --git a/drivers/net/skge.h b/drivers/net/skge.h index 36c62b68fab4..fced3d2bc072 100644 --- a/drivers/net/skge.h +++ b/drivers/net/skge.h | |||
@@ -7,31 +7,7 @@ | |||
7 | /* PCI config registers */ | 7 | /* PCI config registers */ |
8 | #define PCI_DEV_REG1 0x40 | 8 | #define PCI_DEV_REG1 0x40 |
9 | #define PCI_DEV_REG2 0x44 | 9 | #define PCI_DEV_REG2 0x44 |
10 | #ifndef PCI_VPD | 10 | #define PCI_REV_DESC 0x4 |
11 | #define PCI_VPD 0x50 | ||
12 | #endif | ||
13 | |||
14 | /* PCI_OUR_REG_2 32 bit Our Register 2 */ | ||
15 | enum { | ||
16 | PCI_VPD_WR_THR = 0xff<<24, /* Bit 31..24: VPD Write Threshold */ | ||
17 | PCI_DEV_SEL = 0x7f<<17, /* Bit 23..17: EEPROM Device Select */ | ||
18 | PCI_VPD_ROM_SZ = 7 <<14, /* Bit 16..14: VPD ROM Size */ | ||
19 | /* Bit 13..12: reserved */ | ||
20 | PCI_EN_DUMMY_RD = 1<<3, /* Enable Dummy Read */ | ||
21 | PCI_REV_DESC = 1<<2, /* Reverse Desc. Bytes */ | ||
22 | PCI_USEDATA64 = 1<<0, /* Use 64Bit Data bus ext */ | ||
23 | }; | ||
24 | |||
25 | /* PCI_VPD_ADR_REG 16 bit VPD Address Register */ | ||
26 | enum { | ||
27 | PCI_VPD_FLAG = 1<<15, /* starts VPD rd/wr cycle */ | ||
28 | PCI_VPD_ADR_MSK =0x7fffL, /* Bit 14.. 0: VPD Address Mask */ | ||
29 | VPD_RES_ID = 0x82, | ||
30 | VPD_RES_READ = 0x90, | ||
31 | VPD_RES_WRITE = 0x81, | ||
32 | VPD_RES_END = 0x78, | ||
33 | }; | ||
34 | |||
35 | 11 | ||
36 | #define PCI_STATUS_ERROR_BITS (PCI_STATUS_DETECTED_PARITY | \ | 12 | #define PCI_STATUS_ERROR_BITS (PCI_STATUS_DETECTED_PARITY | \ |
37 | PCI_STATUS_SIG_SYSTEM_ERROR | \ | 13 | PCI_STATUS_SIG_SYSTEM_ERROR | \ |
@@ -39,7 +15,6 @@ enum { | |||
39 | PCI_STATUS_REC_TARGET_ABORT | \ | 15 | PCI_STATUS_REC_TARGET_ABORT | \ |
40 | PCI_STATUS_PARITY) | 16 | PCI_STATUS_PARITY) |
41 | 17 | ||
42 | |||
43 | enum csr_regs { | 18 | enum csr_regs { |
44 | B0_RAP = 0x0000, | 19 | B0_RAP = 0x0000, |
45 | B0_CTST = 0x0004, | 20 | B0_CTST = 0x0004, |
@@ -229,8 +204,11 @@ enum { | |||
229 | IS_XA2_F = 1<<1, /* Q_XA2 End of Frame */ | 204 | IS_XA2_F = 1<<1, /* Q_XA2 End of Frame */ |
230 | IS_XA2_C = 1<<0, /* Q_XA2 Encoding Error */ | 205 | IS_XA2_C = 1<<0, /* Q_XA2 Encoding Error */ |
231 | 206 | ||
232 | IS_PORT_1 = IS_XA1_F| IS_R1_F| IS_MAC1, | 207 | IS_TO_PORT1 = IS_PA_TO_RX1 | IS_PA_TO_TX1, |
233 | IS_PORT_2 = IS_XA2_F| IS_R2_F| IS_MAC2, | 208 | IS_TO_PORT2 = IS_PA_TO_RX2 | IS_PA_TO_TX2, |
209 | |||
210 | IS_PORT_1 = IS_XA1_F| IS_R1_F | IS_TO_PORT1 | IS_MAC1, | ||
211 | IS_PORT_2 = IS_XA2_F| IS_R2_F | IS_TO_PORT2 | IS_MAC2, | ||
234 | }; | 212 | }; |
235 | 213 | ||
236 | 214 | ||
@@ -288,14 +266,6 @@ enum { | |||
288 | CHIP_REV_YU_LITE_A3 = 7, /* Chip Rev. for YUKON-Lite A3 */ | 266 | CHIP_REV_YU_LITE_A3 = 7, /* Chip Rev. for YUKON-Lite A3 */ |
289 | }; | 267 | }; |
290 | 268 | ||
291 | /* B2_LD_TEST 8 bit EPROM loader test register */ | ||
292 | enum { | ||
293 | LD_T_ON = 1<<3, /* Loader Test mode on */ | ||
294 | LD_T_OFF = 1<<2, /* Loader Test mode off */ | ||
295 | LD_T_STEP = 1<<1, /* Decrement FPROM addr. Counter */ | ||
296 | LD_START = 1<<0, /* Start loading FPROM */ | ||
297 | }; | ||
298 | |||
299 | /* B2_TI_CTRL 8 bit Timer control */ | 269 | /* B2_TI_CTRL 8 bit Timer control */ |
300 | /* B2_IRQM_CTRL 8 bit IRQ Moderation Timer Control */ | 270 | /* B2_IRQM_CTRL 8 bit IRQ Moderation Timer Control */ |
301 | enum { | 271 | enum { |
@@ -313,16 +283,6 @@ enum { | |||
313 | TIM_T_STEP = 1<<0, /* Test step */ | 283 | TIM_T_STEP = 1<<0, /* Test step */ |
314 | }; | 284 | }; |
315 | 285 | ||
316 | /* B28_DPT_INI 32 bit Descriptor Poll Timer Init Val */ | ||
317 | /* B28_DPT_VAL 32 bit Descriptor Poll Timer Curr Val */ | ||
318 | /* B28_DPT_CTRL 8 bit Descriptor Poll Timer Ctrl Reg */ | ||
319 | enum { | ||
320 | DPT_MSK = 0x00ffffffL, /* Bit 23.. 0: Desc Poll Timer Bits */ | ||
321 | |||
322 | DPT_START = 1<<1, /* Start Descriptor Poll Timer */ | ||
323 | DPT_STOP = 1<<0, /* Stop Descriptor Poll Timer */ | ||
324 | }; | ||
325 | |||
326 | /* B2_GP_IO 32 bit General Purpose I/O Register */ | 286 | /* B2_GP_IO 32 bit General Purpose I/O Register */ |
327 | enum { | 287 | enum { |
328 | GP_DIR_9 = 1<<25, /* IO_9 direct, 0=In/1=Out */ | 288 | GP_DIR_9 = 1<<25, /* IO_9 direct, 0=In/1=Out */ |
@@ -348,30 +308,6 @@ enum { | |||
348 | GP_IO_0 = 1<<0, /* IO_0 pin */ | 308 | GP_IO_0 = 1<<0, /* IO_0 pin */ |
349 | }; | 309 | }; |
350 | 310 | ||
351 | /* Rx/Tx Path related Arbiter Test Registers */ | ||
352 | /* B3_MA_TO_TEST 16 bit MAC Arbiter Timeout Test Reg */ | ||
353 | /* B3_MA_RC_TEST 16 bit MAC Arbiter Recovery Test Reg */ | ||
354 | /* B3_PA_TEST 16 bit Packet Arbiter Test Register */ | ||
355 | /* Bit 15, 11, 7, and 3 are reserved in B3_PA_TEST */ | ||
356 | enum { | ||
357 | TX2_T_EV = 1<<15,/* TX2 Timeout/Recv Event occured */ | ||
358 | TX2_T_ON = 1<<14,/* TX2 Timeout/Recv Timer Test On */ | ||
359 | TX2_T_OFF = 1<<13,/* TX2 Timeout/Recv Timer Tst Off */ | ||
360 | TX2_T_STEP = 1<<12,/* TX2 Timeout/Recv Timer Step */ | ||
361 | TX1_T_EV = 1<<11,/* TX1 Timeout/Recv Event occured */ | ||
362 | TX1_T_ON = 1<<10,/* TX1 Timeout/Recv Timer Test On */ | ||
363 | TX1_T_OFF = 1<<9, /* TX1 Timeout/Recv Timer Tst Off */ | ||
364 | TX1_T_STEP = 1<<8, /* TX1 Timeout/Recv Timer Step */ | ||
365 | RX2_T_EV = 1<<7, /* RX2 Timeout/Recv Event occured */ | ||
366 | RX2_T_ON = 1<<6, /* RX2 Timeout/Recv Timer Test On */ | ||
367 | RX2_T_OFF = 1<<5, /* RX2 Timeout/Recv Timer Tst Off */ | ||
368 | RX2_T_STEP = 1<<4, /* RX2 Timeout/Recv Timer Step */ | ||
369 | RX1_T_EV = 1<<3, /* RX1 Timeout/Recv Event occured */ | ||
370 | RX1_T_ON = 1<<2, /* RX1 Timeout/Recv Timer Test On */ | ||
371 | RX1_T_OFF = 1<<1, /* RX1 Timeout/Recv Timer Tst Off */ | ||
372 | RX1_T_STEP = 1<<0, /* RX1 Timeout/Recv Timer Step */ | ||
373 | }; | ||
374 | |||
375 | /* Descriptor Bit Definition */ | 311 | /* Descriptor Bit Definition */ |
376 | /* TxCtrl Transmit Buffer Control Field */ | 312 | /* TxCtrl Transmit Buffer Control Field */ |
377 | /* RxCtrl Receive Buffer Control Field */ | 313 | /* RxCtrl Receive Buffer Control Field */ |
@@ -428,14 +364,6 @@ enum { | |||
428 | RI_RST_SET = 1<<0, /* Set RAM Interface Reset */ | 364 | RI_RST_SET = 1<<0, /* Set RAM Interface Reset */ |
429 | }; | 365 | }; |
430 | 366 | ||
431 | /* B3_RI_TEST 8 bit RAM Iface Test Register */ | ||
432 | enum { | ||
433 | RI_T_EV = 1<<3, /* Timeout Event occured */ | ||
434 | RI_T_ON = 1<<2, /* Timeout Timer Test On */ | ||
435 | RI_T_OFF = 1<<1, /* Timeout Timer Test Off */ | ||
436 | RI_T_STEP = 1<<0, /* Timeout Timer Step */ | ||
437 | }; | ||
438 | |||
439 | /* MAC Arbiter Registers */ | 367 | /* MAC Arbiter Registers */ |
440 | /* B3_MA_TO_CTRL 16 bit MAC Arbiter Timeout Ctrl Reg */ | 368 | /* B3_MA_TO_CTRL 16 bit MAC Arbiter Timeout Ctrl Reg */ |
441 | enum { | 369 | enum { |
@@ -452,19 +380,6 @@ enum { | |||
452 | #define SK_PKT_TO_MAX 0xffff /* Maximum value */ | 380 | #define SK_PKT_TO_MAX 0xffff /* Maximum value */ |
453 | #define SK_RI_TO_53 36 /* RAM interface timeout */ | 381 | #define SK_RI_TO_53 36 /* RAM interface timeout */ |
454 | 382 | ||
455 | |||
456 | /* B3_MA_RC_CTRL 16 bit MAC Arbiter Recovery Ctrl Reg */ | ||
457 | enum { | ||
458 | MA_ENA_REC_TX2 = 1<<7, /* Enable Recovery Timer TX2 */ | ||
459 | MA_DIS_REC_TX2 = 1<<6, /* Disable Recovery Timer TX2 */ | ||
460 | MA_ENA_REC_TX1 = 1<<5, /* Enable Recovery Timer TX1 */ | ||
461 | MA_DIS_REC_TX1 = 1<<4, /* Disable Recovery Timer TX1 */ | ||
462 | MA_ENA_REC_RX2 = 1<<3, /* Enable Recovery Timer RX2 */ | ||
463 | MA_DIS_REC_RX2 = 1<<2, /* Disable Recovery Timer RX2 */ | ||
464 | MA_ENA_REC_RX1 = 1<<1, /* Enable Recovery Timer RX1 */ | ||
465 | MA_DIS_REC_RX1 = 1<<0, /* Disable Recovery Timer RX1 */ | ||
466 | }; | ||
467 | |||
468 | /* Packet Arbiter Registers */ | 383 | /* Packet Arbiter Registers */ |
469 | /* B3_PA_CTRL 16 bit Packet Arbiter Ctrl Register */ | 384 | /* B3_PA_CTRL 16 bit Packet Arbiter Ctrl Register */ |
470 | enum { | 385 | enum { |
@@ -488,7 +403,7 @@ enum { | |||
488 | PA_ENA_TO_TX1 | PA_ENA_TO_TX2) | 403 | PA_ENA_TO_TX1 | PA_ENA_TO_TX2) |
489 | 404 | ||
490 | 405 | ||
491 | /* Transmit Arbiter Registers MAC 1 and 2, use MR_ADDR() to access */ | 406 | /* Transmit Arbiter Registers MAC 1 and 2, use SK_REG() to access */ |
492 | /* TXA_ITI_INI 32 bit Tx Arb Interval Timer Init Val */ | 407 | /* TXA_ITI_INI 32 bit Tx Arb Interval Timer Init Val */ |
493 | /* TXA_ITI_VAL 32 bit Tx Arb Interval Timer Value */ | 408 | /* TXA_ITI_VAL 32 bit Tx Arb Interval Timer Value */ |
494 | /* TXA_LIM_INI 32 bit Tx Arb Limit Counter Init Val */ | 409 | /* TXA_LIM_INI 32 bit Tx Arb Limit Counter Init Val */ |
@@ -511,7 +426,7 @@ enum { | |||
511 | /* | 426 | /* |
512 | * Bank 4 - 5 | 427 | * Bank 4 - 5 |
513 | */ | 428 | */ |
514 | /* Transmit Arbiter Registers MAC 1 and 2, use MR_ADDR() to access */ | 429 | /* Transmit Arbiter Registers MAC 1 and 2, use SK_REG() to access */ |
515 | enum { | 430 | enum { |
516 | TXA_ITI_INI = 0x0200,/* 32 bit Tx Arb Interval Timer Init Val*/ | 431 | TXA_ITI_INI = 0x0200,/* 32 bit Tx Arb Interval Timer Init Val*/ |
517 | TXA_ITI_VAL = 0x0204,/* 32 bit Tx Arb Interval Timer Value */ | 432 | TXA_ITI_VAL = 0x0204,/* 32 bit Tx Arb Interval Timer Value */ |
@@ -537,7 +452,7 @@ enum { | |||
537 | 452 | ||
538 | /* Queue Register Offsets, use Q_ADDR() to access */ | 453 | /* Queue Register Offsets, use Q_ADDR() to access */ |
539 | enum { | 454 | enum { |
540 | B8_Q_REGS = 0x0400, /* base of Queue registers */ | 455 | B8_Q_REGS = 0x0400, /* base of Queue registers */ |
541 | Q_D = 0x00, /* 8*32 bit Current Descriptor */ | 456 | Q_D = 0x00, /* 8*32 bit Current Descriptor */ |
542 | Q_DA_L = 0x20, /* 32 bit Current Descriptor Address Low dWord */ | 457 | Q_DA_L = 0x20, /* 32 bit Current Descriptor Address Low dWord */ |
543 | Q_DA_H = 0x24, /* 32 bit Current Descriptor Address High dWord */ | 458 | Q_DA_H = 0x24, /* 32 bit Current Descriptor Address High dWord */ |
@@ -618,8 +533,7 @@ enum { | |||
618 | enum { | 533 | enum { |
619 | PHY_ADDR_XMAC = 0<<8, | 534 | PHY_ADDR_XMAC = 0<<8, |
620 | PHY_ADDR_BCOM = 1<<8, | 535 | PHY_ADDR_BCOM = 1<<8, |
621 | PHY_ADDR_LONE = 3<<8, | 536 | |
622 | PHY_ADDR_NAT = 0<<8, | ||
623 | /* GPHY address (bits 15..11 of SMI control reg) */ | 537 | /* GPHY address (bits 15..11 of SMI control reg) */ |
624 | PHY_ADDR_MARV = 0, | 538 | PHY_ADDR_MARV = 0, |
625 | }; | 539 | }; |
@@ -986,7 +900,7 @@ enum { | |||
986 | LINKLED_BLINK_OFF = 0x10, | 900 | LINKLED_BLINK_OFF = 0x10, |
987 | LINKLED_BLINK_ON = 0x20, | 901 | LINKLED_BLINK_ON = 0x20, |
988 | }; | 902 | }; |
989 | 903 | ||
990 | /* GMAC and GPHY Control Registers (YUKON only) */ | 904 | /* GMAC and GPHY Control Registers (YUKON only) */ |
991 | enum { | 905 | enum { |
992 | GMAC_CTRL = 0x0f00,/* 32 bit GMAC Control Reg */ | 906 | GMAC_CTRL = 0x0f00,/* 32 bit GMAC Control Reg */ |
@@ -1151,54 +1065,6 @@ enum { | |||
1151 | PHY_MARV_FE_SPEC_2 = 0x1c,/* 16 bit r/w Specific Control Reg. 2 */ | 1065 | PHY_MARV_FE_SPEC_2 = 0x1c,/* 16 bit r/w Specific Control Reg. 2 */ |
1152 | }; | 1066 | }; |
1153 | 1067 | ||
1154 | /* Level One-PHY Registers, indirect addressed over XMAC */ | ||
1155 | enum { | ||
1156 | PHY_LONE_CTRL = 0x00,/* 16 bit r/w PHY Control Register */ | ||
1157 | PHY_LONE_STAT = 0x01,/* 16 bit r/o PHY Status Register */ | ||
1158 | PHY_LONE_ID0 = 0x02,/* 16 bit r/o PHY ID0 Register */ | ||
1159 | PHY_LONE_ID1 = 0x03,/* 16 bit r/o PHY ID1 Register */ | ||
1160 | PHY_LONE_AUNE_ADV = 0x04,/* 16 bit r/w Auto-Neg. Advertisement */ | ||
1161 | PHY_LONE_AUNE_LP = 0x05,/* 16 bit r/o Link Part Ability Reg */ | ||
1162 | PHY_LONE_AUNE_EXP = 0x06,/* 16 bit r/o Auto-Neg. Expansion Reg */ | ||
1163 | PHY_LONE_NEPG = 0x07,/* 16 bit r/w Next Page Register */ | ||
1164 | PHY_LONE_NEPG_LP = 0x08,/* 16 bit r/o Next Page Link Partner */ | ||
1165 | /* Level One-specific registers */ | ||
1166 | PHY_LONE_1000T_CTRL = 0x09,/* 16 bit r/w 1000Base-T Control Reg */ | ||
1167 | PHY_LONE_1000T_STAT = 0x0a,/* 16 bit r/o 1000Base-T Status Reg */ | ||
1168 | PHY_LONE_EXT_STAT = 0x0f,/* 16 bit r/o Extended Status Reg */ | ||
1169 | PHY_LONE_PORT_CFG = 0x10,/* 16 bit r/w Port Configuration Reg*/ | ||
1170 | PHY_LONE_Q_STAT = 0x11,/* 16 bit r/o Quick Status Reg */ | ||
1171 | PHY_LONE_INT_ENAB = 0x12,/* 16 bit r/w Interrupt Enable Reg */ | ||
1172 | PHY_LONE_INT_STAT = 0x13,/* 16 bit r/o Interrupt Status Reg */ | ||
1173 | PHY_LONE_LED_CFG = 0x14,/* 16 bit r/w LED Configuration Reg */ | ||
1174 | PHY_LONE_PORT_CTRL = 0x15,/* 16 bit r/w Port Control Reg */ | ||
1175 | PHY_LONE_CIM = 0x16,/* 16 bit r/o CIM Reg */ | ||
1176 | }; | ||
1177 | |||
1178 | /* National-PHY Registers, indirect addressed over XMAC */ | ||
1179 | enum { | ||
1180 | PHY_NAT_CTRL = 0x00,/* 16 bit r/w PHY Control Register */ | ||
1181 | PHY_NAT_STAT = 0x01,/* 16 bit r/w PHY Status Register */ | ||
1182 | PHY_NAT_ID0 = 0x02,/* 16 bit r/o PHY ID0 Register */ | ||
1183 | PHY_NAT_ID1 = 0x03,/* 16 bit r/o PHY ID1 Register */ | ||
1184 | PHY_NAT_AUNE_ADV = 0x04,/* 16 bit r/w Auto-Neg. Advertisement */ | ||
1185 | PHY_NAT_AUNE_LP = 0x05,/* 16 bit r/o Link Partner Ability Reg */ | ||
1186 | PHY_NAT_AUNE_EXP = 0x06,/* 16 bit r/o Auto-Neg. Expansion Reg */ | ||
1187 | PHY_NAT_NEPG = 0x07,/* 16 bit r/w Next Page Register */ | ||
1188 | PHY_NAT_NEPG_LP = 0x08,/* 16 bit r/o Next Page Link Partner Reg */ | ||
1189 | /* National-specific registers */ | ||
1190 | PHY_NAT_1000T_CTRL = 0x09,/* 16 bit r/w 1000Base-T Control Reg */ | ||
1191 | PHY_NAT_1000T_STAT = 0x0a,/* 16 bit r/o 1000Base-T Status Reg */ | ||
1192 | PHY_NAT_EXT_STAT = 0x0f,/* 16 bit r/o Extended Status Register */ | ||
1193 | PHY_NAT_EXT_CTRL1 = 0x10,/* 16 bit r/o Extended Control Reg1 */ | ||
1194 | PHY_NAT_Q_STAT1 = 0x11,/* 16 bit r/o Quick Status Reg1 */ | ||
1195 | PHY_NAT_10B_OP = 0x12,/* 16 bit r/o 10Base-T Operations Reg */ | ||
1196 | PHY_NAT_EXT_CTRL2 = 0x13,/* 16 bit r/o Extended Control Reg1 */ | ||
1197 | PHY_NAT_Q_STAT2 = 0x14,/* 16 bit r/o Quick Status Reg2 */ | ||
1198 | |||
1199 | PHY_NAT_PHY_ADDR = 0x19,/* 16 bit r/o PHY Address Register */ | ||
1200 | }; | ||
1201 | |||
1202 | enum { | 1068 | enum { |
1203 | PHY_CT_RESET = 1<<15, /* Bit 15: (sc) clear all PHY related regs */ | 1069 | PHY_CT_RESET = 1<<15, /* Bit 15: (sc) clear all PHY related regs */ |
1204 | PHY_CT_LOOP = 1<<14, /* Bit 14: enable Loopback over PHY */ | 1070 | PHY_CT_LOOP = 1<<14, /* Bit 14: enable Loopback over PHY */ |
@@ -1253,8 +1119,29 @@ enum { | |||
1253 | PHY_MARV_ID1_Y2 = 0x0C91, /* Yukon-2 (PHY 88E1112) */ | 1119 | PHY_MARV_ID1_Y2 = 0x0C91, /* Yukon-2 (PHY 88E1112) */ |
1254 | }; | 1120 | }; |
1255 | 1121 | ||
1122 | /* Advertisement register bits */ | ||
1256 | enum { | 1123 | enum { |
1257 | PHY_AN_NXT_PG = 1<<15, /* Bit 15: Request Next Page */ | 1124 | PHY_AN_NXT_PG = 1<<15, /* Bit 15: Request Next Page */ |
1125 | PHY_AN_ACK = 1<<14, /* Bit 14: (ro) Acknowledge Received */ | ||
1126 | PHY_AN_RF = 1<<13, /* Bit 13: Remote Fault Bits */ | ||
1127 | |||
1128 | PHY_AN_PAUSE_ASYM = 1<<11,/* Bit 11: Try for asymmetric */ | ||
1129 | PHY_AN_PAUSE_CAP = 1<<10, /* Bit 10: Try for pause */ | ||
1130 | PHY_AN_100BASE4 = 1<<9, /* Bit 9: Try for 100mbps 4k packets */ | ||
1131 | PHY_AN_100FULL = 1<<8, /* Bit 8: Try for 100mbps full-duplex */ | ||
1132 | PHY_AN_100HALF = 1<<7, /* Bit 7: Try for 100mbps half-duplex */ | ||
1133 | PHY_AN_10FULL = 1<<6, /* Bit 6: Try for 10mbps full-duplex */ | ||
1134 | PHY_AN_10HALF = 1<<5, /* Bit 5: Try for 10mbps half-duplex */ | ||
1135 | PHY_AN_CSMA = 1<<0, /* Bit 0: Only selector supported */ | ||
1136 | PHY_AN_SEL = 0x1f, /* Bit 4..0: Selector Field, 00001=Ethernet*/ | ||
1137 | PHY_AN_FULL = PHY_AN_100FULL | PHY_AN_10FULL | PHY_AN_CSMA, | ||
1138 | PHY_AN_ALL = PHY_AN_10HALF | PHY_AN_10FULL | | ||
1139 | PHY_AN_100HALF | PHY_AN_100FULL, | ||
1140 | }; | ||
1141 | |||
1142 | /* Xmac Specific */ | ||
1143 | enum { | ||
1144 | PHY_X_AN_NXT_PG = 1<<15, /* Bit 15: Request Next Page */ | ||
1258 | PHY_X_AN_ACK = 1<<14, /* Bit 14: (ro) Acknowledge Received */ | 1145 | PHY_X_AN_ACK = 1<<14, /* Bit 14: (ro) Acknowledge Received */ |
1259 | PHY_X_AN_RFB = 3<<12,/* Bit 13..12: Remote Fault Bits */ | 1146 | PHY_X_AN_RFB = 3<<12,/* Bit 13..12: Remote Fault Bits */ |
1260 | 1147 | ||
@@ -1263,82 +1150,6 @@ enum { | |||
1263 | PHY_X_AN_FD = 1<<5, /* Bit 5: Full Duplex */ | 1150 | PHY_X_AN_FD = 1<<5, /* Bit 5: Full Duplex */ |
1264 | }; | 1151 | }; |
1265 | 1152 | ||
1266 | enum { | ||
1267 | PHY_B_AN_RF = 1<<13, /* Bit 13: Remote Fault */ | ||
1268 | |||
1269 | PHY_B_AN_ASP = 1<<11, /* Bit 11: Asymmetric Pause */ | ||
1270 | PHY_B_AN_PC = 1<<10, /* Bit 10: Pause Capable */ | ||
1271 | PHY_B_AN_SEL = 0x1f, /* Bit 4..0: Selector Field, 00001=Ethernet*/ | ||
1272 | }; | ||
1273 | |||
1274 | enum { | ||
1275 | PHY_L_AN_RF = 1<<13, /* Bit 13: Remote Fault */ | ||
1276 | /* Bit 12: reserved */ | ||
1277 | PHY_L_AN_ASP = 1<<11, /* Bit 11: Asymmetric Pause */ | ||
1278 | PHY_L_AN_PC = 1<<10, /* Bit 10: Pause Capable */ | ||
1279 | |||
1280 | PHY_L_AN_SEL = 0x1f, /* Bit 4..0: Selector Field, 00001=Ethernet*/ | ||
1281 | }; | ||
1282 | |||
1283 | /* PHY_NAT_AUNE_ADV 16 bit r/w Auto-Negotiation Advertisement */ | ||
1284 | /* PHY_NAT_AUNE_LP 16 bit r/o Link Partner Ability Reg *****/ | ||
1285 | /* PHY_AN_NXT_PG (see XMAC) Bit 15: Request Next Page */ | ||
1286 | enum { | ||
1287 | PHY_N_AN_RF = 1<<13, /* Bit 13: Remote Fault */ | ||
1288 | |||
1289 | PHY_N_AN_100F = 1<<11, /* Bit 11: 100Base-T2 FD Support */ | ||
1290 | PHY_N_AN_100H = 1<<10, /* Bit 10: 100Base-T2 HD Support */ | ||
1291 | |||
1292 | PHY_N_AN_SEL = 0x1f, /* Bit 4..0: Selector Field, 00001=Ethernet*/ | ||
1293 | }; | ||
1294 | |||
1295 | /* field type definition for PHY_x_AN_SEL */ | ||
1296 | enum { | ||
1297 | PHY_SEL_TYPE = 1, /* 00001 = Ethernet */ | ||
1298 | }; | ||
1299 | |||
1300 | enum { | ||
1301 | PHY_ANE_LP_NP = 1<<3, /* Bit 3: Link Partner can Next Page */ | ||
1302 | PHY_ANE_LOC_NP = 1<<2, /* Bit 2: Local PHY can Next Page */ | ||
1303 | PHY_ANE_RX_PG = 1<<1, /* Bit 1: Page Received */ | ||
1304 | }; | ||
1305 | |||
1306 | enum { | ||
1307 | PHY_ANE_PAR_DF = 1<<4, /* Bit 4: Parallel Detection Fault */ | ||
1308 | |||
1309 | PHY_ANE_LP_CAP = 1<<0, /* Bit 0: Link Partner Auto-Neg. Cap. */ | ||
1310 | }; | ||
1311 | |||
1312 | enum { | ||
1313 | PHY_NP_MORE = 1<<15, /* Bit 15: More, Next Pages to follow */ | ||
1314 | PHY_NP_ACK1 = 1<<14, /* Bit 14: (ro) Ack1, for receiving a message */ | ||
1315 | PHY_NP_MSG_VAL = 1<<13, /* Bit 13: Message Page valid */ | ||
1316 | PHY_NP_ACK2 = 1<<12, /* Bit 12: Ack2, comply with msg content */ | ||
1317 | PHY_NP_TOG = 1<<11, /* Bit 11: Toggle Bit, ensure sync */ | ||
1318 | PHY_NP_MSG = 0x07ff, /* Bit 10..0: Message from/to Link Partner */ | ||
1319 | }; | ||
1320 | |||
1321 | enum { | ||
1322 | PHY_X_EX_FD = 1<<15, /* Bit 15: Device Supports Full Duplex */ | ||
1323 | PHY_X_EX_HD = 1<<14, /* Bit 14: Device Supports Half Duplex */ | ||
1324 | }; | ||
1325 | |||
1326 | enum { | ||
1327 | PHY_X_RS_PAUSE = 3<<7,/* Bit 8..7: selected Pause Mode */ | ||
1328 | PHY_X_RS_HD = 1<<6, /* Bit 6: Half Duplex Mode selected */ | ||
1329 | PHY_X_RS_FD = 1<<5, /* Bit 5: Full Duplex Mode selected */ | ||
1330 | PHY_X_RS_ABLMIS = 1<<4, /* Bit 4: duplex or pause cap mismatch */ | ||
1331 | PHY_X_RS_PAUMIS = 1<<3, /* Bit 3: pause capability mismatch */ | ||
1332 | }; | ||
1333 | |||
1334 | /** Remote Fault Bits (PHY_X_AN_RFB) encoding */ | ||
1335 | enum { | ||
1336 | X_RFB_OK = 0<<12,/* Bit 13..12 No errors, Link OK */ | ||
1337 | X_RFB_LF = 1<<12, /* Bit 13..12 Link Failure */ | ||
1338 | X_RFB_OFF = 2<<12,/* Bit 13..12 Offline */ | ||
1339 | X_RFB_AN_ERR = 3<<12,/* Bit 13..12 Auto-Negotiation Error */ | ||
1340 | }; | ||
1341 | |||
1342 | /* Pause Bits (PHY_X_AN_PAUSE and PHY_X_RS_PAUSE) encoding */ | 1153 | /* Pause Bits (PHY_X_AN_PAUSE and PHY_X_RS_PAUSE) encoding */ |
1343 | enum { | 1154 | enum { |
1344 | PHY_X_P_NO_PAUSE = 0<<7,/* Bit 8..7: no Pause Mode */ | 1155 | PHY_X_P_NO_PAUSE = 0<<7,/* Bit 8..7: no Pause Mode */ |
@@ -1418,6 +1229,16 @@ enum { | |||
1418 | PHY_B_PES_MLT3_ER = 1<<0, /* Bit 0: MLT3 code Error */ | 1229 | PHY_B_PES_MLT3_ER = 1<<0, /* Bit 0: MLT3 code Error */ |
1419 | }; | 1230 | }; |
1420 | 1231 | ||
1232 | /* PHY_BCOM_AUNE_ADV 16 bit r/w Auto-Negotiation Advertisement *****/ | ||
1233 | /* PHY_BCOM_AUNE_LP 16 bit r/o Link Partner Ability Reg *****/ | ||
1234 | enum { | ||
1235 | PHY_B_AN_RF = 1<<13, /* Bit 13: Remote Fault */ | ||
1236 | |||
1237 | PHY_B_AN_ASP = 1<<11, /* Bit 11: Asymmetric Pause */ | ||
1238 | PHY_B_AN_PC = 1<<10, /* Bit 10: Pause Capable */ | ||
1239 | }; | ||
1240 | |||
1241 | |||
1421 | /***** PHY_BCOM_FC_CTR 16 bit r/w False Carrier Counter *****/ | 1242 | /***** PHY_BCOM_FC_CTR 16 bit r/w False Carrier Counter *****/ |
1422 | enum { | 1243 | enum { |
1423 | PHY_B_FC_CTR = 0xff, /* Bit 7..0: False Carrier Counter */ | 1244 | PHY_B_FC_CTR = 0xff, /* Bit 7..0: False Carrier Counter */ |
@@ -1478,7 +1299,9 @@ enum { | |||
1478 | PHY_B_IS_LST_CHANGE = 1<<1, /* Bit 1: Link Status Changed */ | 1299 | PHY_B_IS_LST_CHANGE = 1<<1, /* Bit 1: Link Status Changed */ |
1479 | PHY_B_IS_CRC_ER = 1<<0, /* Bit 0: CRC Error */ | 1300 | PHY_B_IS_CRC_ER = 1<<0, /* Bit 0: CRC Error */ |
1480 | }; | 1301 | }; |
1481 | #define PHY_B_DEF_MSK (~(PHY_B_IS_AN_PR | PHY_B_IS_LST_CHANGE)) | 1302 | #define PHY_B_DEF_MSK \ |
1303 | (~(PHY_B_IS_PSE | PHY_B_IS_AN_PR | PHY_B_IS_DUP_CHANGE | \ | ||
1304 | PHY_B_IS_LSP_CHANGE | PHY_B_IS_LST_CHANGE)) | ||
1482 | 1305 | ||
1483 | /* Pause Bits (PHY_B_AN_ASP and PHY_B_AN_PC) encoding */ | 1306 | /* Pause Bits (PHY_B_AN_ASP and PHY_B_AN_PC) encoding */ |
1484 | enum { | 1307 | enum { |
@@ -1495,166 +1318,6 @@ enum { | |||
1495 | PHY_B_RES_1000HD = 6<<8,/* Bit 10..8: 1000Base-T Half Dup. */ | 1318 | PHY_B_RES_1000HD = 6<<8,/* Bit 10..8: 1000Base-T Half Dup. */ |
1496 | }; | 1319 | }; |
1497 | 1320 | ||
1498 | /* | ||
1499 | * Level One-Specific | ||
1500 | */ | ||
1501 | /***** PHY_LONE_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/ | ||
1502 | enum { | ||
1503 | PHY_L_1000C_TEST = 7<<13,/* Bit 15..13: Test Modes */ | ||
1504 | PHY_L_1000C_MSE = 1<<12, /* Bit 12: Master/Slave Enable */ | ||
1505 | PHY_L_1000C_MSC = 1<<11, /* Bit 11: M/S Configuration */ | ||
1506 | PHY_L_1000C_RD = 1<<10, /* Bit 10: Repeater/DTE */ | ||
1507 | PHY_L_1000C_AFD = 1<<9, /* Bit 9: Advertise Full Duplex */ | ||
1508 | PHY_L_1000C_AHD = 1<<8, /* Bit 8: Advertise Half Duplex */ | ||
1509 | }; | ||
1510 | |||
1511 | /***** PHY_LONE_1000T_STAT 16 bit r/o 1000Base-T Status Reg *****/ | ||
1512 | enum { | ||
1513 | PHY_L_1000S_MSF = 1<<15, /* Bit 15: Master/Slave Fault */ | ||
1514 | PHY_L_1000S_MSR = 1<<14, /* Bit 14: Master/Slave Result */ | ||
1515 | PHY_L_1000S_LRS = 1<<13, /* Bit 13: Local Receiver Status */ | ||
1516 | PHY_L_1000S_RRS = 1<<12, /* Bit 12: Remote Receiver Status */ | ||
1517 | PHY_L_1000S_LP_FD = 1<<11, /* Bit 11: Link Partner can FD */ | ||
1518 | PHY_L_1000S_LP_HD = 1<<10, /* Bit 10: Link Partner can HD */ | ||
1519 | |||
1520 | PHY_L_1000S_IEC = 0xff, /* Bit 7..0: Idle Error Count */ | ||
1521 | |||
1522 | /***** PHY_LONE_EXT_STAT 16 bit r/o Extended Status Register *****/ | ||
1523 | PHY_L_ES_X_FD_CAP = 1<<15, /* Bit 15: 1000Base-X FD capable */ | ||
1524 | PHY_L_ES_X_HD_CAP = 1<<14, /* Bit 14: 1000Base-X HD capable */ | ||
1525 | PHY_L_ES_T_FD_CAP = 1<<13, /* Bit 13: 1000Base-T FD capable */ | ||
1526 | PHY_L_ES_T_HD_CAP = 1<<12, /* Bit 12: 1000Base-T HD capable */ | ||
1527 | }; | ||
1528 | |||
1529 | /***** PHY_LONE_PORT_CFG 16 bit r/w Port Configuration Reg *****/ | ||
1530 | enum { | ||
1531 | PHY_L_PC_REP_MODE = 1<<15, /* Bit 15: Repeater Mode */ | ||
1532 | |||
1533 | PHY_L_PC_TX_DIS = 1<<13, /* Bit 13: Tx output Disabled */ | ||
1534 | PHY_L_PC_BY_SCR = 1<<12, /* Bit 12: Bypass Scrambler */ | ||
1535 | PHY_L_PC_BY_45 = 1<<11, /* Bit 11: Bypass 4B5B-Decoder */ | ||
1536 | PHY_L_PC_JAB_DIS = 1<<10, /* Bit 10: Jabber Disabled */ | ||
1537 | PHY_L_PC_SQE = 1<<9, /* Bit 9: Enable Heartbeat */ | ||
1538 | PHY_L_PC_TP_LOOP = 1<<8, /* Bit 8: TP Loopback */ | ||
1539 | PHY_L_PC_SSS = 1<<7, /* Bit 7: Smart Speed Selection */ | ||
1540 | PHY_L_PC_FIFO_SIZE = 1<<6, /* Bit 6: FIFO Size */ | ||
1541 | PHY_L_PC_PRE_EN = 1<<5, /* Bit 5: Preamble Enable */ | ||
1542 | PHY_L_PC_CIM = 1<<4, /* Bit 4: Carrier Integrity Mon */ | ||
1543 | PHY_L_PC_10_SER = 1<<3, /* Bit 3: Use Serial Output */ | ||
1544 | PHY_L_PC_ANISOL = 1<<2, /* Bit 2: Unisolate Port */ | ||
1545 | PHY_L_PC_TEN_BIT = 1<<1, /* Bit 1: 10bit iface mode on */ | ||
1546 | PHY_L_PC_ALTCLOCK = 1<<0, /* Bit 0: (ro) ALTCLOCK Mode on */ | ||
1547 | }; | ||
1548 | |||
1549 | /***** PHY_LONE_Q_STAT 16 bit r/o Quick Status Reg *****/ | ||
1550 | enum { | ||
1551 | PHY_L_QS_D_RATE = 3<<14,/* Bit 15..14: Data Rate */ | ||
1552 | PHY_L_QS_TX_STAT = 1<<13, /* Bit 13: Transmitting */ | ||
1553 | PHY_L_QS_RX_STAT = 1<<12, /* Bit 12: Receiving */ | ||
1554 | PHY_L_QS_COL_STAT = 1<<11, /* Bit 11: Collision */ | ||
1555 | PHY_L_QS_L_STAT = 1<<10, /* Bit 10: Link is up */ | ||
1556 | PHY_L_QS_DUP_MOD = 1<<9, /* Bit 9: Full/Half Duplex */ | ||
1557 | PHY_L_QS_AN = 1<<8, /* Bit 8: AutoNeg is On */ | ||
1558 | PHY_L_QS_AN_C = 1<<7, /* Bit 7: AN is Complete */ | ||
1559 | PHY_L_QS_LLE = 7<<4,/* Bit 6..4: Line Length Estim. */ | ||
1560 | PHY_L_QS_PAUSE = 1<<3, /* Bit 3: LP advertised Pause */ | ||
1561 | PHY_L_QS_AS_PAUSE = 1<<2, /* Bit 2: LP adv. asym. Pause */ | ||
1562 | PHY_L_QS_ISOLATE = 1<<1, /* Bit 1: CIM Isolated */ | ||
1563 | PHY_L_QS_EVENT = 1<<0, /* Bit 0: Event has occurred */ | ||
1564 | }; | ||
1565 | |||
1566 | /***** PHY_LONE_INT_ENAB 16 bit r/w Interrupt Enable Reg *****/ | ||
1567 | /***** PHY_LONE_INT_STAT 16 bit r/o Interrupt Status Reg *****/ | ||
1568 | enum { | ||
1569 | PHY_L_IS_AN_F = 1<<13, /* Bit 13: Auto-Negotiation fault */ | ||
1570 | PHY_L_IS_CROSS = 1<<11, /* Bit 11: Crossover used */ | ||
1571 | PHY_L_IS_POL = 1<<10, /* Bit 10: Polarity correct. used */ | ||
1572 | PHY_L_IS_SS = 1<<9, /* Bit 9: Smart Speed Downgrade */ | ||
1573 | PHY_L_IS_CFULL = 1<<8, /* Bit 8: Counter Full */ | ||
1574 | PHY_L_IS_AN_C = 1<<7, /* Bit 7: AutoNeg Complete */ | ||
1575 | PHY_L_IS_SPEED = 1<<6, /* Bit 6: Speed Changed */ | ||
1576 | PHY_L_IS_DUP = 1<<5, /* Bit 5: Duplex Changed */ | ||
1577 | PHY_L_IS_LS = 1<<4, /* Bit 4: Link Status Changed */ | ||
1578 | PHY_L_IS_ISOL = 1<<3, /* Bit 3: Isolate Occured */ | ||
1579 | PHY_L_IS_MDINT = 1<<2, /* Bit 2: (ro) STAT: MII Int Pending */ | ||
1580 | PHY_L_IS_INTEN = 1<<1, /* Bit 1: ENAB: Enable IRQs */ | ||
1581 | PHY_L_IS_FORCE = 1<<0, /* Bit 0: ENAB: Force Interrupt */ | ||
1582 | }; | ||
1583 | |||
1584 | /* int. mask */ | ||
1585 | #define PHY_L_DEF_MSK (PHY_L_IS_LS | PHY_L_IS_ISOL | PHY_L_IS_INTEN) | ||
1586 | |||
1587 | /***** PHY_LONE_LED_CFG 16 bit r/w LED Configuration Reg *****/ | ||
1588 | enum { | ||
1589 | PHY_L_LC_LEDC = 3<<14,/* Bit 15..14: Col/Blink/On/Off */ | ||
1590 | PHY_L_LC_LEDR = 3<<12,/* Bit 13..12: Rx/Blink/On/Off */ | ||
1591 | PHY_L_LC_LEDT = 3<<10,/* Bit 11..10: Tx/Blink/On/Off */ | ||
1592 | PHY_L_LC_LEDG = 3<<8,/* Bit 9..8: Giga/Blink/On/Off */ | ||
1593 | PHY_L_LC_LEDS = 3<<6,/* Bit 7..6: 10-100/Blink/On/Off */ | ||
1594 | PHY_L_LC_LEDL = 3<<4,/* Bit 5..4: Link/Blink/On/Off */ | ||
1595 | PHY_L_LC_LEDF = 3<<2,/* Bit 3..2: Duplex/Blink/On/Off */ | ||
1596 | PHY_L_LC_PSTRECH= 1<<1, /* Bit 1: Strech LED Pulses */ | ||
1597 | PHY_L_LC_FREQ = 1<<0, /* Bit 0: 30/100 ms */ | ||
1598 | }; | ||
1599 | |||
1600 | /***** PHY_LONE_PORT_CTRL 16 bit r/w Port Control Reg *****/ | ||
1601 | enum { | ||
1602 | PHY_L_PC_TX_TCLK = 1<<15, /* Bit 15: Enable TX_TCLK */ | ||
1603 | PHY_L_PC_ALT_NP = 1<<13, /* Bit 14: Alternate Next Page */ | ||
1604 | PHY_L_PC_GMII_ALT= 1<<12, /* Bit 13: Alternate GMII driver */ | ||
1605 | PHY_L_PC_TEN_CRS = 1<<10, /* Bit 10: Extend CRS*/ | ||
1606 | }; | ||
1607 | |||
1608 | /***** PHY_LONE_CIM 16 bit r/o CIM Reg *****/ | ||
1609 | enum { | ||
1610 | PHY_L_CIM_ISOL = 0xff<<8,/* Bit 15..8: Isolate Count */ | ||
1611 | PHY_L_CIM_FALSE_CAR = 0xff, /* Bit 7..0: False Carrier Count */ | ||
1612 | }; | ||
1613 | |||
1614 | /* | ||
1615 | * Pause Bits (PHY_L_AN_ASP and PHY_L_AN_PC) encoding | ||
1616 | */ | ||
1617 | enum { | ||
1618 | PHY_L_P_NO_PAUSE= 0<<10,/* Bit 11..10: no Pause Mode */ | ||
1619 | PHY_L_P_SYM_MD = 1<<10, /* Bit 11..10: symmetric Pause Mode */ | ||
1620 | PHY_L_P_ASYM_MD = 2<<10,/* Bit 11..10: asymmetric Pause Mode */ | ||
1621 | PHY_L_P_BOTH_MD = 3<<10,/* Bit 11..10: both Pause Mode */ | ||
1622 | }; | ||
1623 | |||
1624 | /* | ||
1625 | * National-Specific | ||
1626 | */ | ||
1627 | /***** PHY_NAT_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/ | ||
1628 | enum { | ||
1629 | PHY_N_1000C_TEST= 7<<13,/* Bit 15..13: Test Modes */ | ||
1630 | PHY_N_1000C_MSE = 1<<12, /* Bit 12: Master/Slave Enable */ | ||
1631 | PHY_N_1000C_MSC = 1<<11, /* Bit 11: M/S Configuration */ | ||
1632 | PHY_N_1000C_RD = 1<<10, /* Bit 10: Repeater/DTE */ | ||
1633 | PHY_N_1000C_AFD = 1<<9, /* Bit 9: Advertise Full Duplex */ | ||
1634 | PHY_N_1000C_AHD = 1<<8, /* Bit 8: Advertise Half Duplex */ | ||
1635 | PHY_N_1000C_APC = 1<<7, /* Bit 7: Asymmetric Pause Cap. */}; | ||
1636 | |||
1637 | |||
1638 | /***** PHY_NAT_1000T_STAT 16 bit r/o 1000Base-T Status Reg *****/ | ||
1639 | enum { | ||
1640 | PHY_N_1000S_MSF = 1<<15, /* Bit 15: Master/Slave Fault */ | ||
1641 | PHY_N_1000S_MSR = 1<<14, /* Bit 14: Master/Slave Result */ | ||
1642 | PHY_N_1000S_LRS = 1<<13, /* Bit 13: Local Receiver Status */ | ||
1643 | PHY_N_1000S_RRS = 1<<12, /* Bit 12: Remote Receiver Status*/ | ||
1644 | PHY_N_1000S_LP_FD= 1<<11, /* Bit 11: Link Partner can FD */ | ||
1645 | PHY_N_1000S_LP_HD= 1<<10, /* Bit 10: Link Partner can HD */ | ||
1646 | PHY_N_1000C_LP_APC= 1<<9, /* Bit 9: LP Asym. Pause Cap. */ | ||
1647 | PHY_N_1000S_IEC = 0xff, /* Bit 7..0: Idle Error Count */ | ||
1648 | }; | ||
1649 | |||
1650 | /***** PHY_NAT_EXT_STAT 16 bit r/o Extended Status Register *****/ | ||
1651 | enum { | ||
1652 | PHY_N_ES_X_FD_CAP= 1<<15, /* Bit 15: 1000Base-X FD capable */ | ||
1653 | PHY_N_ES_X_HD_CAP= 1<<14, /* Bit 14: 1000Base-X HD capable */ | ||
1654 | PHY_N_ES_T_FD_CAP= 1<<13, /* Bit 13: 1000Base-T FD capable */ | ||
1655 | PHY_N_ES_T_HD_CAP= 1<<12, /* Bit 12: 1000Base-T HD capable */ | ||
1656 | }; | ||
1657 | |||
1658 | /** Marvell-Specific */ | 1321 | /** Marvell-Specific */ |
1659 | enum { | 1322 | enum { |
1660 | PHY_M_AN_NXT_PG = 1<<15, /* Request Next Page */ | 1323 | PHY_M_AN_NXT_PG = 1<<15, /* Request Next Page */ |
@@ -1718,7 +1381,7 @@ enum { | |||
1718 | PHY_M_PC_EN_DET_PLUS = 3<<8, /* Energy Detect Plus (Mode 2) */ | 1381 | PHY_M_PC_EN_DET_PLUS = 3<<8, /* Energy Detect Plus (Mode 2) */ |
1719 | }; | 1382 | }; |
1720 | 1383 | ||
1721 | #define PHY_M_PC_MDI_XMODE(x) (((x)<<5) & PHY_M_PC_MDIX_MSK) | 1384 | #define PHY_M_PC_MDI_XMODE(x) (((x)<<5) & PHY_M_PC_MDIX_MSK) |
1722 | 1385 | ||
1723 | enum { | 1386 | enum { |
1724 | PHY_M_PC_MAN_MDI = 0, /* 00 = Manual MDI configuration */ | 1387 | PHY_M_PC_MAN_MDI = 0, /* 00 = Manual MDI configuration */ |
@@ -2105,7 +1768,7 @@ enum { | |||
2105 | GM_GPSR_FC_RX_DIS = 1<<2, /* Bit 2: Rx Flow-Control Mode Disabled */ | 1768 | GM_GPSR_FC_RX_DIS = 1<<2, /* Bit 2: Rx Flow-Control Mode Disabled */ |
2106 | GM_GPSR_PROM_EN = 1<<1, /* Bit 1: Promiscuous Mode Enabled */ | 1769 | GM_GPSR_PROM_EN = 1<<1, /* Bit 1: Promiscuous Mode Enabled */ |
2107 | }; | 1770 | }; |
2108 | 1771 | ||
2109 | /* GM_GP_CTRL 16 bit r/w General Purpose Control Register */ | 1772 | /* GM_GP_CTRL 16 bit r/w General Purpose Control Register */ |
2110 | enum { | 1773 | enum { |
2111 | GM_GPCR_PROM_ENA = 1<<14, /* Bit 14: Enable Promiscuous Mode */ | 1774 | GM_GPCR_PROM_ENA = 1<<14, /* Bit 14: Enable Promiscuous Mode */ |
@@ -2127,7 +1790,7 @@ enum { | |||
2127 | 1790 | ||
2128 | #define GM_GPCR_SPEED_1000 (GM_GPCR_GIGS_ENA | GM_GPCR_SPEED_100) | 1791 | #define GM_GPCR_SPEED_1000 (GM_GPCR_GIGS_ENA | GM_GPCR_SPEED_100) |
2129 | #define GM_GPCR_AU_ALL_DIS (GM_GPCR_AU_DUP_DIS | GM_GPCR_AU_FCT_DIS|GM_GPCR_AU_SPD_DIS) | 1792 | #define GM_GPCR_AU_ALL_DIS (GM_GPCR_AU_DUP_DIS | GM_GPCR_AU_FCT_DIS|GM_GPCR_AU_SPD_DIS) |
2130 | 1793 | ||
2131 | /* GM_TX_CTRL 16 bit r/w Transmit Control Register */ | 1794 | /* GM_TX_CTRL 16 bit r/w Transmit Control Register */ |
2132 | enum { | 1795 | enum { |
2133 | GM_TXCR_FORCE_JAM = 1<<15, /* Bit 15: Force Jam / Flow-Control */ | 1796 | GM_TXCR_FORCE_JAM = 1<<15, /* Bit 15: Force Jam / Flow-Control */ |
@@ -2138,7 +1801,7 @@ enum { | |||
2138 | 1801 | ||
2139 | #define TX_COL_THR(x) (((x)<<10) & GM_TXCR_COL_THR_MSK) | 1802 | #define TX_COL_THR(x) (((x)<<10) & GM_TXCR_COL_THR_MSK) |
2140 | #define TX_COL_DEF 0x04 | 1803 | #define TX_COL_DEF 0x04 |
2141 | 1804 | ||
2142 | /* GM_RX_CTRL 16 bit r/w Receive Control Register */ | 1805 | /* GM_RX_CTRL 16 bit r/w Receive Control Register */ |
2143 | enum { | 1806 | enum { |
2144 | GM_RXCR_UCF_ENA = 1<<15, /* Bit 15: Enable Unicast filtering */ | 1807 | GM_RXCR_UCF_ENA = 1<<15, /* Bit 15: Enable Unicast filtering */ |
@@ -2146,7 +1809,7 @@ enum { | |||
2146 | GM_RXCR_CRC_DIS = 1<<13, /* Bit 13: Remove 4-byte CRC */ | 1809 | GM_RXCR_CRC_DIS = 1<<13, /* Bit 13: Remove 4-byte CRC */ |
2147 | GM_RXCR_PASS_FC = 1<<12, /* Bit 12: Pass FC packets to FIFO */ | 1810 | GM_RXCR_PASS_FC = 1<<12, /* Bit 12: Pass FC packets to FIFO */ |
2148 | }; | 1811 | }; |
2149 | 1812 | ||
2150 | /* GM_TX_PARAM 16 bit r/w Transmit Parameter Register */ | 1813 | /* GM_TX_PARAM 16 bit r/w Transmit Parameter Register */ |
2151 | enum { | 1814 | enum { |
2152 | GM_TXPA_JAMLEN_MSK = 0x03<<14, /* Bit 15..14: Jam Length */ | 1815 | GM_TXPA_JAMLEN_MSK = 0x03<<14, /* Bit 15..14: Jam Length */ |
@@ -2171,7 +1834,7 @@ enum { | |||
2171 | GM_SMOD_JUMBO_ENA = 1<<8, /* Bit 8: Enable Jumbo (Max. Frame Len) */ | 1834 | GM_SMOD_JUMBO_ENA = 1<<8, /* Bit 8: Enable Jumbo (Max. Frame Len) */ |
2172 | GM_SMOD_IPG_MSK = 0x1f /* Bit 4..0: Inter-Packet Gap (IPG) */ | 1835 | GM_SMOD_IPG_MSK = 0x1f /* Bit 4..0: Inter-Packet Gap (IPG) */ |
2173 | }; | 1836 | }; |
2174 | 1837 | ||
2175 | #define DATA_BLIND_VAL(x) (((x)<<11) & GM_SMOD_DATABL_MSK) | 1838 | #define DATA_BLIND_VAL(x) (((x)<<11) & GM_SMOD_DATABL_MSK) |
2176 | #define DATA_BLIND_DEF 0x04 | 1839 | #define DATA_BLIND_DEF 0x04 |
2177 | 1840 | ||
@@ -2186,7 +1849,7 @@ enum { | |||
2186 | GM_SMI_CT_RD_VAL = 1<<4, /* Bit 4: Read Valid (Read completed) */ | 1849 | GM_SMI_CT_RD_VAL = 1<<4, /* Bit 4: Read Valid (Read completed) */ |
2187 | GM_SMI_CT_BUSY = 1<<3, /* Bit 3: Busy (Operation in progress) */ | 1850 | GM_SMI_CT_BUSY = 1<<3, /* Bit 3: Busy (Operation in progress) */ |
2188 | }; | 1851 | }; |
2189 | 1852 | ||
2190 | #define GM_SMI_CT_PHY_AD(x) (((x)<<11) & GM_SMI_CT_PHY_A_MSK) | 1853 | #define GM_SMI_CT_PHY_AD(x) (((x)<<11) & GM_SMI_CT_PHY_A_MSK) |
2191 | #define GM_SMI_CT_REG_AD(x) (((x)<<6) & GM_SMI_CT_REG_A_MSK) | 1854 | #define GM_SMI_CT_REG_AD(x) (((x)<<6) & GM_SMI_CT_REG_A_MSK) |
2192 | 1855 | ||
@@ -2195,7 +1858,7 @@ enum { | |||
2195 | GM_PAR_MIB_CLR = 1<<5, /* Bit 5: Set MIB Clear Counter Mode */ | 1858 | GM_PAR_MIB_CLR = 1<<5, /* Bit 5: Set MIB Clear Counter Mode */ |
2196 | GM_PAR_MIB_TST = 1<<4, /* Bit 4: MIB Load Counter (Test Mode) */ | 1859 | GM_PAR_MIB_TST = 1<<4, /* Bit 4: MIB Load Counter (Test Mode) */ |
2197 | }; | 1860 | }; |
2198 | 1861 | ||
2199 | /* Receive Frame Status Encoding */ | 1862 | /* Receive Frame Status Encoding */ |
2200 | enum { | 1863 | enum { |
2201 | GMR_FS_LEN = 0xffff<<16, /* Bit 31..16: Rx Frame Length */ | 1864 | GMR_FS_LEN = 0xffff<<16, /* Bit 31..16: Rx Frame Length */ |
@@ -2217,12 +1880,12 @@ enum { | |||
2217 | /* | 1880 | /* |
2218 | * GMR_FS_ANY_ERR (analogous to XMR_FS_ANY_ERR) | 1881 | * GMR_FS_ANY_ERR (analogous to XMR_FS_ANY_ERR) |
2219 | */ | 1882 | */ |
2220 | GMR_FS_ANY_ERR = GMR_FS_CRC_ERR | GMR_FS_LONG_ERR | | 1883 | GMR_FS_ANY_ERR = GMR_FS_CRC_ERR | GMR_FS_LONG_ERR | |
2221 | GMR_FS_MII_ERR | GMR_FS_BAD_FC | GMR_FS_GOOD_FC | | 1884 | GMR_FS_MII_ERR | GMR_FS_BAD_FC | GMR_FS_GOOD_FC | |
2222 | GMR_FS_JABBER, | 1885 | GMR_FS_JABBER, |
2223 | /* Rx GMAC FIFO Flush Mask (default) */ | 1886 | /* Rx GMAC FIFO Flush Mask (default) */ |
2224 | RX_FF_FL_DEF_MSK = GMR_FS_CRC_ERR | GMR_FS_RX_FF_OV |GMR_FS_MII_ERR | | 1887 | RX_FF_FL_DEF_MSK = GMR_FS_CRC_ERR | GMR_FS_RX_FF_OV |GMR_FS_MII_ERR | |
2225 | GMR_FS_BAD_FC | GMR_FS_GOOD_FC | GMR_FS_UN_SIZE | | 1888 | GMR_FS_BAD_FC | GMR_FS_GOOD_FC | GMR_FS_UN_SIZE | |
2226 | GMR_FS_JABBER, | 1889 | GMR_FS_JABBER, |
2227 | }; | 1890 | }; |
2228 | 1891 | ||
@@ -2540,10 +2203,6 @@ enum { | |||
2540 | }; | 2203 | }; |
2541 | 2204 | ||
2542 | 2205 | ||
2543 | /* XM_PHY_ADDR 16 bit r/w PHY Address Register */ | ||
2544 | #define XM_PHY_ADDR_SZ 0x1f /* Bit 4..0: PHY Address bits */ | ||
2545 | |||
2546 | |||
2547 | /* XM_GP_PORT 32 bit r/w General Purpose Port Register */ | 2206 | /* XM_GP_PORT 32 bit r/w General Purpose Port Register */ |
2548 | enum { | 2207 | enum { |
2549 | XM_GP_ANIP = 1<<6, /* Bit 6: (ro) Auto-Neg. in progress */ | 2208 | XM_GP_ANIP = 1<<6, /* Bit 6: (ro) Auto-Neg. in progress */ |
@@ -2662,8 +2321,8 @@ enum { | |||
2662 | }; | 2321 | }; |
2663 | 2322 | ||
2664 | #define XM_PAUSE_MODE (XM_MD_SPOE_E | XM_MD_SPOL_I | XM_MD_SPOH_I) | 2323 | #define XM_PAUSE_MODE (XM_MD_SPOE_E | XM_MD_SPOL_I | XM_MD_SPOH_I) |
2665 | #define XM_DEF_MODE (XM_MD_RX_RUNT | XM_MD_RX_IRLE | XM_MD_RX_LONG |\ | 2324 | #define XM_DEF_MODE (XM_MD_RX_RUNT | XM_MD_RX_IRLE | XM_MD_RX_LONG |\ |
2666 | XM_MD_RX_CRCE | XM_MD_RX_ERR | XM_MD_CSA | XM_MD_CAA) | 2325 | XM_MD_RX_CRCE | XM_MD_RX_ERR | XM_MD_CSA) |
2667 | 2326 | ||
2668 | /* XM_STAT_CMD 16 bit r/w Statistics Command Register */ | 2327 | /* XM_STAT_CMD 16 bit r/w Statistics Command Register */ |
2669 | enum { | 2328 | enum { |
@@ -2793,28 +2452,20 @@ struct skge_hw { | |||
2793 | u32 intr_mask; | 2452 | u32 intr_mask; |
2794 | struct net_device *dev[2]; | 2453 | struct net_device *dev[2]; |
2795 | 2454 | ||
2796 | u8 mac_cfg; | ||
2797 | u8 chip_id; | 2455 | u8 chip_id; |
2456 | u8 chip_rev; | ||
2798 | u8 phy_type; | 2457 | u8 phy_type; |
2799 | u8 pmd_type; | 2458 | u8 pmd_type; |
2800 | u16 phy_addr; | 2459 | u16 phy_addr; |
2460 | u8 ports; | ||
2801 | 2461 | ||
2802 | u32 ram_size; | 2462 | u32 ram_size; |
2803 | u32 ram_offset; | 2463 | u32 ram_offset; |
2804 | 2464 | ||
2805 | struct tasklet_struct ext_tasklet; | 2465 | struct tasklet_struct ext_tasklet; |
2806 | spinlock_t phy_lock; | 2466 | spinlock_t phy_lock; |
2807 | }; | 2467 | }; |
2808 | 2468 | ||
2809 | static inline int isdualport(const struct skge_hw *hw) | ||
2810 | { | ||
2811 | return !(hw->mac_cfg & CFG_SNG_MAC); | ||
2812 | } | ||
2813 | |||
2814 | static inline u8 chip_rev(const struct skge_hw *hw) | ||
2815 | { | ||
2816 | return (hw->mac_cfg & CFG_CHIP_R_MSK) >> 4; | ||
2817 | } | ||
2818 | 2469 | ||
2819 | static inline int iscopper(const struct skge_hw *hw) | 2470 | static inline int iscopper(const struct skge_hw *hw) |
2820 | { | 2471 | { |
@@ -2827,7 +2478,7 @@ enum { | |||
2827 | FLOW_MODE_REM_SEND = 2, /* Symmetric or just remote */ | 2478 | FLOW_MODE_REM_SEND = 2, /* Symmetric or just remote */ |
2828 | FLOW_MODE_SYMMETRIC = 3, /* Both stations may send PAUSE */ | 2479 | FLOW_MODE_SYMMETRIC = 3, /* Both stations may send PAUSE */ |
2829 | }; | 2480 | }; |
2830 | 2481 | ||
2831 | struct skge_port { | 2482 | struct skge_port { |
2832 | u32 msg_enable; | 2483 | u32 msg_enable; |
2833 | struct skge_hw *hw; | 2484 | struct skge_hw *hw; |
@@ -2853,8 +2504,8 @@ struct skge_port { | |||
2853 | void *mem; /* PCI memory for rings */ | 2504 | void *mem; /* PCI memory for rings */ |
2854 | dma_addr_t dma; | 2505 | dma_addr_t dma; |
2855 | unsigned long mem_size; | 2506 | unsigned long mem_size; |
2507 | unsigned int rx_buf_size; | ||
2856 | 2508 | ||
2857 | struct timer_list link_check; | ||
2858 | struct timer_list led_blink; | 2509 | struct timer_list led_blink; |
2859 | }; | 2510 | }; |
2860 | 2511 | ||
@@ -2863,7 +2514,6 @@ struct skge_port { | |||
2863 | static inline u32 skge_read32(const struct skge_hw *hw, int reg) | 2514 | static inline u32 skge_read32(const struct skge_hw *hw, int reg) |
2864 | { | 2515 | { |
2865 | return readl(hw->regs + reg); | 2516 | return readl(hw->regs + reg); |
2866 | |||
2867 | } | 2517 | } |
2868 | 2518 | ||
2869 | static inline u16 skge_read16(const struct skge_hw *hw, int reg) | 2519 | static inline u16 skge_read16(const struct skge_hw *hw, int reg) |
@@ -2892,114 +2542,87 @@ static inline void skge_write8(const struct skge_hw *hw, int reg, u8 val) | |||
2892 | } | 2542 | } |
2893 | 2543 | ||
2894 | /* MAC Related Registers inside the device. */ | 2544 | /* MAC Related Registers inside the device. */ |
2895 | #define SKGEMAC_REG(port,reg) (((port)<<7)+(reg)) | 2545 | #define SK_REG(port,reg) (((port)<<7)+(reg)) |
2896 | 2546 | #define SK_XMAC_REG(port, reg) \ | |
2897 | /* PCI config space can be accessed via memory mapped space */ | ||
2898 | #define SKGEPCI_REG(reg) ((reg)+ 0x380) | ||
2899 | |||
2900 | #define SKGEXM_REG(port, reg) \ | ||
2901 | ((BASE_XMAC_1 + (port) * (BASE_XMAC_2 - BASE_XMAC_1)) | (reg) << 1) | 2547 | ((BASE_XMAC_1 + (port) * (BASE_XMAC_2 - BASE_XMAC_1)) | (reg) << 1) |
2902 | 2548 | ||
2903 | static inline u32 skge_xm_read32(const struct skge_hw *hw, int port, int reg) | 2549 | static inline u32 xm_read32(const struct skge_hw *hw, int port, int reg) |
2904 | { | ||
2905 | return skge_read32(hw, SKGEXM_REG(port,reg)); | ||
2906 | } | ||
2907 | |||
2908 | static inline u16 skge_xm_read16(const struct skge_hw *hw, int port, int reg) | ||
2909 | { | 2550 | { |
2910 | return skge_read16(hw, SKGEXM_REG(port,reg)); | 2551 | u32 v; |
2552 | v = skge_read16(hw, SK_XMAC_REG(port, reg)); | ||
2553 | v |= (u32)skge_read16(hw, SK_XMAC_REG(port, reg+2)) << 16; | ||
2554 | return v; | ||
2911 | } | 2555 | } |
2912 | 2556 | ||
2913 | static inline u8 skge_xm_read8(const struct skge_hw *hw, int port, int reg) | 2557 | static inline u16 xm_read16(const struct skge_hw *hw, int port, int reg) |
2914 | { | 2558 | { |
2915 | return skge_read8(hw, SKGEXM_REG(port,reg)); | 2559 | return skge_read16(hw, SK_XMAC_REG(port,reg)); |
2916 | } | 2560 | } |
2917 | 2561 | ||
2918 | static inline void skge_xm_write32(const struct skge_hw *hw, int port, int r, u32 v) | 2562 | static inline void xm_write32(const struct skge_hw *hw, int port, int r, u32 v) |
2919 | { | 2563 | { |
2920 | skge_write32(hw, SKGEXM_REG(port,r), v); | 2564 | skge_write16(hw, SK_XMAC_REG(port,r), v & 0xffff); |
2565 | skge_write16(hw, SK_XMAC_REG(port,r+2), v >> 16); | ||
2921 | } | 2566 | } |
2922 | 2567 | ||
2923 | static inline void skge_xm_write16(const struct skge_hw *hw, int port, int r, u16 v) | 2568 | static inline void xm_write16(const struct skge_hw *hw, int port, int r, u16 v) |
2924 | { | 2569 | { |
2925 | skge_write16(hw, SKGEXM_REG(port,r), v); | 2570 | skge_write16(hw, SK_XMAC_REG(port,r), v); |
2926 | } | 2571 | } |
2927 | 2572 | ||
2928 | static inline void skge_xm_write8(const struct skge_hw *hw, int port, int r, u8 v) | 2573 | static inline void xm_outhash(const struct skge_hw *hw, int port, int reg, |
2929 | { | ||
2930 | skge_write8(hw, SKGEXM_REG(port,r), v); | ||
2931 | } | ||
2932 | |||
2933 | static inline void skge_xm_outhash(const struct skge_hw *hw, int port, int reg, | ||
2934 | const u8 *hash) | 2574 | const u8 *hash) |
2935 | { | 2575 | { |
2936 | skge_xm_write16(hw, port, reg, | 2576 | xm_write16(hw, port, reg, (u16)hash[0] | ((u16)hash[1] << 8)); |
2937 | (u16)hash[0] | ((u16)hash[1] << 8)); | 2577 | xm_write16(hw, port, reg+2, (u16)hash[2] | ((u16)hash[3] << 8)); |
2938 | skge_xm_write16(hw, port, reg+2, | 2578 | xm_write16(hw, port, reg+4, (u16)hash[4] | ((u16)hash[5] << 8)); |
2939 | (u16)hash[2] | ((u16)hash[3] << 8)); | 2579 | xm_write16(hw, port, reg+6, (u16)hash[6] | ((u16)hash[7] << 8)); |
2940 | skge_xm_write16(hw, port, reg+4, | ||
2941 | (u16)hash[4] | ((u16)hash[5] << 8)); | ||
2942 | skge_xm_write16(hw, port, reg+6, | ||
2943 | (u16)hash[6] | ((u16)hash[7] << 8)); | ||
2944 | } | 2580 | } |
2945 | 2581 | ||
2946 | static inline void skge_xm_outaddr(const struct skge_hw *hw, int port, int reg, | 2582 | static inline void xm_outaddr(const struct skge_hw *hw, int port, int reg, |
2947 | const u8 *addr) | 2583 | const u8 *addr) |
2948 | { | 2584 | { |
2949 | skge_xm_write16(hw, port, reg, | 2585 | xm_write16(hw, port, reg, (u16)addr[0] | ((u16)addr[1] << 8)); |
2950 | (u16)addr[0] | ((u16)addr[1] << 8)); | 2586 | xm_write16(hw, port, reg+2, (u16)addr[2] | ((u16)addr[3] << 8)); |
2951 | skge_xm_write16(hw, port, reg, | 2587 | xm_write16(hw, port, reg+4, (u16)addr[4] | ((u16)addr[5] << 8)); |
2952 | (u16)addr[2] | ((u16)addr[3] << 8)); | ||
2953 | skge_xm_write16(hw, port, reg, | ||
2954 | (u16)addr[4] | ((u16)addr[5] << 8)); | ||
2955 | } | 2588 | } |
2956 | 2589 | ||
2590 | #define SK_GMAC_REG(port,reg) \ | ||
2591 | (BASE_GMAC_1 + (port) * (BASE_GMAC_2-BASE_GMAC_1) + (reg)) | ||
2957 | 2592 | ||
2958 | #define SKGEGMA_REG(port,reg) \ | 2593 | static inline u16 gma_read16(const struct skge_hw *hw, int port, int reg) |
2959 | ((reg) + BASE_GMAC_1 + \ | ||
2960 | (port) * (BASE_GMAC_2-BASE_GMAC_1)) | ||
2961 | |||
2962 | static inline u16 skge_gma_read16(const struct skge_hw *hw, int port, int reg) | ||
2963 | { | 2594 | { |
2964 | return skge_read16(hw, SKGEGMA_REG(port,reg)); | 2595 | return skge_read16(hw, SK_GMAC_REG(port,reg)); |
2965 | } | 2596 | } |
2966 | 2597 | ||
2967 | static inline u32 skge_gma_read32(const struct skge_hw *hw, int port, int reg) | 2598 | static inline u32 gma_read32(const struct skge_hw *hw, int port, int reg) |
2968 | { | 2599 | { |
2969 | return (u32) skge_read16(hw, SKGEGMA_REG(port,reg)) | 2600 | return (u32) skge_read16(hw, SK_GMAC_REG(port,reg)) |
2970 | | ((u32)skge_read16(hw, SKGEGMA_REG(port,reg+4)) << 16); | 2601 | | ((u32)skge_read16(hw, SK_GMAC_REG(port,reg+4)) << 16); |
2971 | } | 2602 | } |
2972 | 2603 | ||
2973 | static inline u8 skge_gma_read8(const struct skge_hw *hw, int port, int reg) | 2604 | static inline void gma_write16(const struct skge_hw *hw, int port, int r, u16 v) |
2974 | { | 2605 | { |
2975 | return skge_read8(hw, SKGEGMA_REG(port,reg)); | 2606 | skge_write16(hw, SK_GMAC_REG(port,r), v); |
2976 | } | 2607 | } |
2977 | 2608 | ||
2978 | static inline void skge_gma_write16(const struct skge_hw *hw, int port, int r, u16 v) | 2609 | static inline void gma_write32(const struct skge_hw *hw, int port, int r, u32 v) |
2979 | { | 2610 | { |
2980 | skge_write16(hw, SKGEGMA_REG(port,r), v); | 2611 | skge_write16(hw, SK_GMAC_REG(port, r), (u16) v); |
2612 | skge_write32(hw, SK_GMAC_REG(port, r+4), (u16)(v >> 16)); | ||
2981 | } | 2613 | } |
2982 | 2614 | ||
2983 | static inline void skge_gma_write32(const struct skge_hw *hw, int port, int r, u32 v) | 2615 | static inline void gma_write8(const struct skge_hw *hw, int port, int r, u8 v) |
2984 | { | 2616 | { |
2985 | skge_write16(hw, SKGEGMA_REG(port, r), (u16) v); | 2617 | skge_write8(hw, SK_GMAC_REG(port,r), v); |
2986 | skge_write32(hw, SKGEGMA_REG(port, r+4), (u16)(v >> 16)); | ||
2987 | } | 2618 | } |
2988 | 2619 | ||
2989 | static inline void skge_gma_write8(const struct skge_hw *hw, int port, int r, u8 v) | 2620 | static inline void gma_set_addr(struct skge_hw *hw, int port, int reg, |
2990 | { | ||
2991 | skge_write8(hw, SKGEGMA_REG(port,r), v); | ||
2992 | } | ||
2993 | |||
2994 | static inline void skge_gm_set_addr(struct skge_hw *hw, int port, int reg, | ||
2995 | const u8 *addr) | 2621 | const u8 *addr) |
2996 | { | 2622 | { |
2997 | skge_gma_write16(hw, port, reg, | 2623 | gma_write16(hw, port, reg, (u16) addr[0] | ((u16) addr[1] << 8)); |
2998 | (u16) addr[0] | ((u16) addr[1] << 8)); | 2624 | gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8)); |
2999 | skge_gma_write16(hw, port, reg+4, | 2625 | gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8)); |
3000 | (u16) addr[2] | ((u16) addr[3] << 8)); | ||
3001 | skge_gma_write16(hw, port, reg+8, | ||
3002 | (u16) addr[4] | ((u16) addr[5] << 8)); | ||
3003 | } | 2626 | } |
3004 | 2627 | ||
3005 | #endif | 2628 | #endif |
diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 16363b5c6f56..404ea4297e32 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c | |||
@@ -74,6 +74,7 @@ | |||
74 | #include <linux/rtnetlink.h> | 74 | #include <linux/rtnetlink.h> |
75 | #include <linux/if_arp.h> | 75 | #include <linux/if_arp.h> |
76 | #include <linux/if_slip.h> | 76 | #include <linux/if_slip.h> |
77 | #include <linux/delay.h> | ||
77 | #include <linux/init.h> | 78 | #include <linux/init.h> |
78 | #include "slip.h" | 79 | #include "slip.h" |
79 | #ifdef CONFIG_INET | 80 | #ifdef CONFIG_INET |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index cfb9d3cdb04a..1438fdd20826 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -1998,7 +1998,7 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr) | |||
1998 | if (retval) | 1998 | if (retval) |
1999 | goto err_out; | 1999 | goto err_out; |
2000 | 2000 | ||
2001 | set_irq_type(dev->irq, IRQT_RISING); | 2001 | set_irq_type(dev->irq, SMC_IRQ_TRIGGER_TYPE); |
2002 | 2002 | ||
2003 | #ifdef SMC_USE_PXA_DMA | 2003 | #ifdef SMC_USE_PXA_DMA |
2004 | { | 2004 | { |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index 946528e6b742..7089d86e857a 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -182,6 +182,16 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
182 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | 182 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) |
183 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | 183 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) |
184 | 184 | ||
185 | #include <asm/mach-types.h> | ||
186 | #include <asm/arch/cpu.h> | ||
187 | |||
188 | #define SMC_IRQ_TRIGGER_TYPE (( \ | ||
189 | machine_is_omap_h2() \ | ||
190 | || machine_is_omap_h3() \ | ||
191 | || (machine_is_omap_innovator() && !cpu_is_omap150()) \ | ||
192 | ) ? IRQT_FALLING : IRQT_RISING) | ||
193 | |||
194 | |||
185 | #elif defined(CONFIG_SH_SH4202_MICRODEV) | 195 | #elif defined(CONFIG_SH_SH4202_MICRODEV) |
186 | 196 | ||
187 | #define SMC_CAN_USE_8BIT 0 | 197 | #define SMC_CAN_USE_8BIT 0 |
@@ -300,6 +310,9 @@ static inline void SMC_outsw (unsigned long a, int r, unsigned char* p, int l) | |||
300 | 310 | ||
301 | #endif | 311 | #endif |
302 | 312 | ||
313 | #ifndef SMC_IRQ_TRIGGER_TYPE | ||
314 | #define SMC_IRQ_TRIGGER_TYPE IRQT_RISING | ||
315 | #endif | ||
303 | 316 | ||
304 | #ifdef SMC_USE_PXA_DMA | 317 | #ifdef SMC_USE_PXA_DMA |
305 | /* | 318 | /* |
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 12e2b6826fa3..88b89dc95c77 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -1286,7 +1286,7 @@ static void init_ring(struct net_device *dev) | |||
1286 | np->rx_info[i].skb = skb; | 1286 | np->rx_info[i].skb = skb; |
1287 | if (skb == NULL) | 1287 | if (skb == NULL) |
1288 | break; | 1288 | break; |
1289 | np->rx_info[i].mapping = pci_map_single(np->pci_dev, skb->tail, np->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1289 | np->rx_info[i].mapping = pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1290 | skb->dev = dev; /* Mark as being used by this device. */ | 1290 | skb->dev = dev; /* Mark as being used by this device. */ |
1291 | /* Grrr, we cannot offset to correctly align the IP header. */ | 1291 | /* Grrr, we cannot offset to correctly align the IP header. */ |
1292 | np->rx_ring[i].rxaddr = cpu_to_dma(np->rx_info[i].mapping | RxDescValid); | 1292 | np->rx_ring[i].rxaddr = cpu_to_dma(np->rx_info[i].mapping | RxDescValid); |
@@ -1572,7 +1572,7 @@ static int __netdev_rx(struct net_device *dev, int *quota) | |||
1572 | pci_dma_sync_single_for_cpu(np->pci_dev, | 1572 | pci_dma_sync_single_for_cpu(np->pci_dev, |
1573 | np->rx_info[entry].mapping, | 1573 | np->rx_info[entry].mapping, |
1574 | pkt_len, PCI_DMA_FROMDEVICE); | 1574 | pkt_len, PCI_DMA_FROMDEVICE); |
1575 | eth_copy_and_sum(skb, np->rx_info[entry].skb->tail, pkt_len, 0); | 1575 | eth_copy_and_sum(skb, np->rx_info[entry].skb->data, pkt_len, 0); |
1576 | pci_dma_sync_single_for_device(np->pci_dev, | 1576 | pci_dma_sync_single_for_device(np->pci_dev, |
1577 | np->rx_info[entry].mapping, | 1577 | np->rx_info[entry].mapping, |
1578 | pkt_len, PCI_DMA_FROMDEVICE); | 1578 | pkt_len, PCI_DMA_FROMDEVICE); |
@@ -1696,7 +1696,7 @@ static void refill_rx_ring(struct net_device *dev) | |||
1696 | if (skb == NULL) | 1696 | if (skb == NULL) |
1697 | break; /* Better luck next round. */ | 1697 | break; /* Better luck next round. */ |
1698 | np->rx_info[entry].mapping = | 1698 | np->rx_info[entry].mapping = |
1699 | pci_map_single(np->pci_dev, skb->tail, np->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1699 | pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1700 | skb->dev = dev; /* Mark as being used by this device. */ | 1700 | skb->dev = dev; /* Mark as being used by this device. */ |
1701 | np->rx_ring[entry].rxaddr = | 1701 | np->rx_ring[entry].rxaddr = |
1702 | cpu_to_dma(np->rx_info[entry].mapping | RxDescValid); | 1702 | cpu_to_dma(np->rx_info[entry].mapping | RxDescValid); |
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index 08cb7177a175..d500a5771dbc 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c | |||
@@ -1028,7 +1028,7 @@ static void init_ring(struct net_device *dev) | |||
1028 | skb->dev = dev; /* Mark as being used by this device. */ | 1028 | skb->dev = dev; /* Mark as being used by this device. */ |
1029 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ | 1029 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ |
1030 | np->rx_ring[i].frag[0].addr = cpu_to_le32( | 1030 | np->rx_ring[i].frag[0].addr = cpu_to_le32( |
1031 | pci_map_single(np->pci_dev, skb->tail, np->rx_buf_sz, | 1031 | pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz, |
1032 | PCI_DMA_FROMDEVICE)); | 1032 | PCI_DMA_FROMDEVICE)); |
1033 | np->rx_ring[i].frag[0].length = cpu_to_le32(np->rx_buf_sz | LastFrag); | 1033 | np->rx_ring[i].frag[0].length = cpu_to_le32(np->rx_buf_sz | LastFrag); |
1034 | } | 1034 | } |
@@ -1341,7 +1341,7 @@ static void rx_poll(unsigned long data) | |||
1341 | np->rx_buf_sz, | 1341 | np->rx_buf_sz, |
1342 | PCI_DMA_FROMDEVICE); | 1342 | PCI_DMA_FROMDEVICE); |
1343 | 1343 | ||
1344 | eth_copy_and_sum(skb, np->rx_skbuff[entry]->tail, pkt_len, 0); | 1344 | eth_copy_and_sum(skb, np->rx_skbuff[entry]->data, pkt_len, 0); |
1345 | pci_dma_sync_single_for_device(np->pci_dev, | 1345 | pci_dma_sync_single_for_device(np->pci_dev, |
1346 | desc->frag[0].addr, | 1346 | desc->frag[0].addr, |
1347 | np->rx_buf_sz, | 1347 | np->rx_buf_sz, |
@@ -1400,7 +1400,7 @@ static void refill_rx (struct net_device *dev) | |||
1400 | skb->dev = dev; /* Mark as being used by this device. */ | 1400 | skb->dev = dev; /* Mark as being used by this device. */ |
1401 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 1401 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
1402 | np->rx_ring[entry].frag[0].addr = cpu_to_le32( | 1402 | np->rx_ring[entry].frag[0].addr = cpu_to_le32( |
1403 | pci_map_single(np->pci_dev, skb->tail, | 1403 | pci_map_single(np->pci_dev, skb->data, |
1404 | np->rx_buf_sz, PCI_DMA_FROMDEVICE)); | 1404 | np->rx_buf_sz, PCI_DMA_FROMDEVICE)); |
1405 | } | 1405 | } |
1406 | /* Perhaps we need not reset this field. */ | 1406 | /* Perhaps we need not reset this field. */ |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 7e371b1209a1..54640686e983 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -66,8 +66,8 @@ | |||
66 | 66 | ||
67 | #define DRV_MODULE_NAME "tg3" | 67 | #define DRV_MODULE_NAME "tg3" |
68 | #define PFX DRV_MODULE_NAME ": " | 68 | #define PFX DRV_MODULE_NAME ": " |
69 | #define DRV_MODULE_VERSION "3.32" | 69 | #define DRV_MODULE_VERSION "3.33" |
70 | #define DRV_MODULE_RELDATE "June 24, 2005" | 70 | #define DRV_MODULE_RELDATE "July 5, 2005" |
71 | 71 | ||
72 | #define TG3_DEF_MAC_MODE 0 | 72 | #define TG3_DEF_MAC_MODE 0 |
73 | #define TG3_DEF_RX_MODE 0 | 73 | #define TG3_DEF_RX_MODE 0 |
@@ -5117,7 +5117,7 @@ static void tg3_set_bdinfo(struct tg3 *tp, u32 bdinfo_addr, | |||
5117 | } | 5117 | } |
5118 | 5118 | ||
5119 | static void __tg3_set_rx_mode(struct net_device *); | 5119 | static void __tg3_set_rx_mode(struct net_device *); |
5120 | static void tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec) | 5120 | static void __tg3_set_coalesce(struct tg3 *tp, struct ethtool_coalesce *ec) |
5121 | { | 5121 | { |
5122 | tw32(HOSTCC_RXCOL_TICKS, ec->rx_coalesce_usecs); | 5122 | tw32(HOSTCC_RXCOL_TICKS, ec->rx_coalesce_usecs); |
5123 | tw32(HOSTCC_TXCOL_TICKS, ec->tx_coalesce_usecs); | 5123 | tw32(HOSTCC_TXCOL_TICKS, ec->tx_coalesce_usecs); |
@@ -5460,7 +5460,7 @@ static int tg3_reset_hw(struct tg3 *tp) | |||
5460 | udelay(10); | 5460 | udelay(10); |
5461 | } | 5461 | } |
5462 | 5462 | ||
5463 | tg3_set_coalesce(tp, &tp->coal); | 5463 | __tg3_set_coalesce(tp, &tp->coal); |
5464 | 5464 | ||
5465 | /* set status block DMA address */ | 5465 | /* set status block DMA address */ |
5466 | tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH, | 5466 | tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_HIGH, |
@@ -7821,6 +7821,60 @@ static int tg3_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) | |||
7821 | return 0; | 7821 | return 0; |
7822 | } | 7822 | } |
7823 | 7823 | ||
7824 | static int tg3_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) | ||
7825 | { | ||
7826 | struct tg3 *tp = netdev_priv(dev); | ||
7827 | u32 max_rxcoal_tick_int = 0, max_txcoal_tick_int = 0; | ||
7828 | u32 max_stat_coal_ticks = 0, min_stat_coal_ticks = 0; | ||
7829 | |||
7830 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { | ||
7831 | max_rxcoal_tick_int = MAX_RXCOAL_TICK_INT; | ||
7832 | max_txcoal_tick_int = MAX_TXCOAL_TICK_INT; | ||
7833 | max_stat_coal_ticks = MAX_STAT_COAL_TICKS; | ||
7834 | min_stat_coal_ticks = MIN_STAT_COAL_TICKS; | ||
7835 | } | ||
7836 | |||
7837 | if ((ec->rx_coalesce_usecs > MAX_RXCOL_TICKS) || | ||
7838 | (ec->tx_coalesce_usecs > MAX_TXCOL_TICKS) || | ||
7839 | (ec->rx_max_coalesced_frames > MAX_RXMAX_FRAMES) || | ||
7840 | (ec->tx_max_coalesced_frames > MAX_TXMAX_FRAMES) || | ||
7841 | (ec->rx_coalesce_usecs_irq > max_rxcoal_tick_int) || | ||
7842 | (ec->tx_coalesce_usecs_irq > max_txcoal_tick_int) || | ||
7843 | (ec->rx_max_coalesced_frames_irq > MAX_RXCOAL_MAXF_INT) || | ||
7844 | (ec->tx_max_coalesced_frames_irq > MAX_TXCOAL_MAXF_INT) || | ||
7845 | (ec->stats_block_coalesce_usecs > max_stat_coal_ticks) || | ||
7846 | (ec->stats_block_coalesce_usecs < min_stat_coal_ticks)) | ||
7847 | return -EINVAL; | ||
7848 | |||
7849 | /* No rx interrupts will be generated if both are zero */ | ||
7850 | if ((ec->rx_coalesce_usecs == 0) && | ||
7851 | (ec->rx_max_coalesced_frames == 0)) | ||
7852 | return -EINVAL; | ||
7853 | |||
7854 | /* No tx interrupts will be generated if both are zero */ | ||
7855 | if ((ec->tx_coalesce_usecs == 0) && | ||
7856 | (ec->tx_max_coalesced_frames == 0)) | ||
7857 | return -EINVAL; | ||
7858 | |||
7859 | /* Only copy relevant parameters, ignore all others. */ | ||
7860 | tp->coal.rx_coalesce_usecs = ec->rx_coalesce_usecs; | ||
7861 | tp->coal.tx_coalesce_usecs = ec->tx_coalesce_usecs; | ||
7862 | tp->coal.rx_max_coalesced_frames = ec->rx_max_coalesced_frames; | ||
7863 | tp->coal.tx_max_coalesced_frames = ec->tx_max_coalesced_frames; | ||
7864 | tp->coal.rx_coalesce_usecs_irq = ec->rx_coalesce_usecs_irq; | ||
7865 | tp->coal.tx_coalesce_usecs_irq = ec->tx_coalesce_usecs_irq; | ||
7866 | tp->coal.rx_max_coalesced_frames_irq = ec->rx_max_coalesced_frames_irq; | ||
7867 | tp->coal.tx_max_coalesced_frames_irq = ec->tx_max_coalesced_frames_irq; | ||
7868 | tp->coal.stats_block_coalesce_usecs = ec->stats_block_coalesce_usecs; | ||
7869 | |||
7870 | if (netif_running(dev)) { | ||
7871 | tg3_full_lock(tp, 0); | ||
7872 | __tg3_set_coalesce(tp, &tp->coal); | ||
7873 | tg3_full_unlock(tp); | ||
7874 | } | ||
7875 | return 0; | ||
7876 | } | ||
7877 | |||
7824 | static struct ethtool_ops tg3_ethtool_ops = { | 7878 | static struct ethtool_ops tg3_ethtool_ops = { |
7825 | .get_settings = tg3_get_settings, | 7879 | .get_settings = tg3_get_settings, |
7826 | .set_settings = tg3_set_settings, | 7880 | .set_settings = tg3_set_settings, |
@@ -7856,6 +7910,7 @@ static struct ethtool_ops tg3_ethtool_ops = { | |||
7856 | .get_stats_count = tg3_get_stats_count, | 7910 | .get_stats_count = tg3_get_stats_count, |
7857 | .get_ethtool_stats = tg3_get_ethtool_stats, | 7911 | .get_ethtool_stats = tg3_get_ethtool_stats, |
7858 | .get_coalesce = tg3_get_coalesce, | 7912 | .get_coalesce = tg3_get_coalesce, |
7913 | .set_coalesce = tg3_set_coalesce, | ||
7859 | }; | 7914 | }; |
7860 | 7915 | ||
7861 | static void __devinit tg3_get_eeprom_size(struct tg3 *tp) | 7916 | static void __devinit tg3_get_eeprom_size(struct tg3 *tp) |
@@ -9800,6 +9855,12 @@ static void __devinit tg3_init_coal(struct tg3 *tp) | |||
9800 | ec->tx_coalesce_usecs = LOW_TXCOL_TICKS_CLRTCKS; | 9855 | ec->tx_coalesce_usecs = LOW_TXCOL_TICKS_CLRTCKS; |
9801 | ec->tx_coalesce_usecs_irq = DEFAULT_TXCOAL_TICK_INT_CLRTCKS; | 9856 | ec->tx_coalesce_usecs_irq = DEFAULT_TXCOAL_TICK_INT_CLRTCKS; |
9802 | } | 9857 | } |
9858 | |||
9859 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) { | ||
9860 | ec->rx_coalesce_usecs_irq = 0; | ||
9861 | ec->tx_coalesce_usecs_irq = 0; | ||
9862 | ec->stats_block_coalesce_usecs = 0; | ||
9863 | } | ||
9803 | } | 9864 | } |
9804 | 9865 | ||
9805 | static int __devinit tg3_init_one(struct pci_dev *pdev, | 9866 | static int __devinit tg3_init_one(struct pci_dev *pdev, |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 99c5f9675a56..70ad450733e6 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -879,31 +879,41 @@ | |||
879 | #define LOW_RXCOL_TICKS_CLRTCKS 0x00000014 | 879 | #define LOW_RXCOL_TICKS_CLRTCKS 0x00000014 |
880 | #define DEFAULT_RXCOL_TICKS 0x00000048 | 880 | #define DEFAULT_RXCOL_TICKS 0x00000048 |
881 | #define HIGH_RXCOL_TICKS 0x00000096 | 881 | #define HIGH_RXCOL_TICKS 0x00000096 |
882 | #define MAX_RXCOL_TICKS 0x000003ff | ||
882 | #define HOSTCC_TXCOL_TICKS 0x00003c0c | 883 | #define HOSTCC_TXCOL_TICKS 0x00003c0c |
883 | #define LOW_TXCOL_TICKS 0x00000096 | 884 | #define LOW_TXCOL_TICKS 0x00000096 |
884 | #define LOW_TXCOL_TICKS_CLRTCKS 0x00000048 | 885 | #define LOW_TXCOL_TICKS_CLRTCKS 0x00000048 |
885 | #define DEFAULT_TXCOL_TICKS 0x0000012c | 886 | #define DEFAULT_TXCOL_TICKS 0x0000012c |
886 | #define HIGH_TXCOL_TICKS 0x00000145 | 887 | #define HIGH_TXCOL_TICKS 0x00000145 |
888 | #define MAX_TXCOL_TICKS 0x000003ff | ||
887 | #define HOSTCC_RXMAX_FRAMES 0x00003c10 | 889 | #define HOSTCC_RXMAX_FRAMES 0x00003c10 |
888 | #define LOW_RXMAX_FRAMES 0x00000005 | 890 | #define LOW_RXMAX_FRAMES 0x00000005 |
889 | #define DEFAULT_RXMAX_FRAMES 0x00000008 | 891 | #define DEFAULT_RXMAX_FRAMES 0x00000008 |
890 | #define HIGH_RXMAX_FRAMES 0x00000012 | 892 | #define HIGH_RXMAX_FRAMES 0x00000012 |
893 | #define MAX_RXMAX_FRAMES 0x000000ff | ||
891 | #define HOSTCC_TXMAX_FRAMES 0x00003c14 | 894 | #define HOSTCC_TXMAX_FRAMES 0x00003c14 |
892 | #define LOW_TXMAX_FRAMES 0x00000035 | 895 | #define LOW_TXMAX_FRAMES 0x00000035 |
893 | #define DEFAULT_TXMAX_FRAMES 0x0000004b | 896 | #define DEFAULT_TXMAX_FRAMES 0x0000004b |
894 | #define HIGH_TXMAX_FRAMES 0x00000052 | 897 | #define HIGH_TXMAX_FRAMES 0x00000052 |
898 | #define MAX_TXMAX_FRAMES 0x000000ff | ||
895 | #define HOSTCC_RXCOAL_TICK_INT 0x00003c18 | 899 | #define HOSTCC_RXCOAL_TICK_INT 0x00003c18 |
896 | #define DEFAULT_RXCOAL_TICK_INT 0x00000019 | 900 | #define DEFAULT_RXCOAL_TICK_INT 0x00000019 |
897 | #define DEFAULT_RXCOAL_TICK_INT_CLRTCKS 0x00000014 | 901 | #define DEFAULT_RXCOAL_TICK_INT_CLRTCKS 0x00000014 |
902 | #define MAX_RXCOAL_TICK_INT 0x000003ff | ||
898 | #define HOSTCC_TXCOAL_TICK_INT 0x00003c1c | 903 | #define HOSTCC_TXCOAL_TICK_INT 0x00003c1c |
899 | #define DEFAULT_TXCOAL_TICK_INT 0x00000019 | 904 | #define DEFAULT_TXCOAL_TICK_INT 0x00000019 |
900 | #define DEFAULT_TXCOAL_TICK_INT_CLRTCKS 0x00000014 | 905 | #define DEFAULT_TXCOAL_TICK_INT_CLRTCKS 0x00000014 |
906 | #define MAX_TXCOAL_TICK_INT 0x000003ff | ||
901 | #define HOSTCC_RXCOAL_MAXF_INT 0x00003c20 | 907 | #define HOSTCC_RXCOAL_MAXF_INT 0x00003c20 |
902 | #define DEFAULT_RXCOAL_MAXF_INT 0x00000005 | 908 | #define DEFAULT_RXCOAL_MAXF_INT 0x00000005 |
909 | #define MAX_RXCOAL_MAXF_INT 0x000000ff | ||
903 | #define HOSTCC_TXCOAL_MAXF_INT 0x00003c24 | 910 | #define HOSTCC_TXCOAL_MAXF_INT 0x00003c24 |
904 | #define DEFAULT_TXCOAL_MAXF_INT 0x00000005 | 911 | #define DEFAULT_TXCOAL_MAXF_INT 0x00000005 |
912 | #define MAX_TXCOAL_MAXF_INT 0x000000ff | ||
905 | #define HOSTCC_STAT_COAL_TICKS 0x00003c28 | 913 | #define HOSTCC_STAT_COAL_TICKS 0x00003c28 |
906 | #define DEFAULT_STAT_COAL_TICKS 0x000f4240 | 914 | #define DEFAULT_STAT_COAL_TICKS 0x000f4240 |
915 | #define MAX_STAT_COAL_TICKS 0xd693d400 | ||
916 | #define MIN_STAT_COAL_TICKS 0x00000064 | ||
907 | /* 0x3c2c --> 0x3c30 unused */ | 917 | /* 0x3c2c --> 0x3c30 unused */ |
908 | #define HOSTCC_STATS_BLK_HOST_ADDR 0x00003c30 /* 64-bit */ | 918 | #define HOSTCC_STATS_BLK_HOST_ADDR 0x00003c30 /* 64-bit */ |
909 | #define HOSTCC_STATUS_BLK_HOST_ADDR 0x00003c38 /* 64-bit */ | 919 | #define HOSTCC_STATUS_BLK_HOST_ADDR 0x00003c38 /* 64-bit */ |
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index dd357dd8c370..fc353e348f9a 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -446,13 +446,13 @@ static void de_rx (struct de_private *de) | |||
446 | 446 | ||
447 | mapping = | 447 | mapping = |
448 | de->rx_skb[rx_tail].mapping = | 448 | de->rx_skb[rx_tail].mapping = |
449 | pci_map_single(de->pdev, copy_skb->tail, | 449 | pci_map_single(de->pdev, copy_skb->data, |
450 | buflen, PCI_DMA_FROMDEVICE); | 450 | buflen, PCI_DMA_FROMDEVICE); |
451 | de->rx_skb[rx_tail].skb = copy_skb; | 451 | de->rx_skb[rx_tail].skb = copy_skb; |
452 | } else { | 452 | } else { |
453 | pci_dma_sync_single_for_cpu(de->pdev, mapping, len, PCI_DMA_FROMDEVICE); | 453 | pci_dma_sync_single_for_cpu(de->pdev, mapping, len, PCI_DMA_FROMDEVICE); |
454 | skb_reserve(copy_skb, RX_OFFSET); | 454 | skb_reserve(copy_skb, RX_OFFSET); |
455 | memcpy(skb_put(copy_skb, len), skb->tail, len); | 455 | memcpy(skb_put(copy_skb, len), skb->data, len); |
456 | 456 | ||
457 | pci_dma_sync_single_for_device(de->pdev, mapping, len, PCI_DMA_FROMDEVICE); | 457 | pci_dma_sync_single_for_device(de->pdev, mapping, len, PCI_DMA_FROMDEVICE); |
458 | 458 | ||
@@ -1269,7 +1269,7 @@ static int de_refill_rx (struct de_private *de) | |||
1269 | skb->dev = de->dev; | 1269 | skb->dev = de->dev; |
1270 | 1270 | ||
1271 | de->rx_skb[i].mapping = pci_map_single(de->pdev, | 1271 | de->rx_skb[i].mapping = pci_map_single(de->pdev, |
1272 | skb->tail, de->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1272 | skb->data, de->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1273 | de->rx_skb[i].skb = skb; | 1273 | de->rx_skb[i].skb = skb; |
1274 | 1274 | ||
1275 | de->rx_ring[i].opts1 = cpu_to_le32(DescOwn); | 1275 | de->rx_ring[i].opts1 = cpu_to_le32(DescOwn); |
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index 7b899702ceb9..74e9075d9c48 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c | |||
@@ -945,8 +945,8 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db) | |||
945 | 945 | ||
946 | /* Received Packet CRC check need or not */ | 946 | /* Received Packet CRC check need or not */ |
947 | if ( (db->dm910x_chk_mode & 1) && | 947 | if ( (db->dm910x_chk_mode & 1) && |
948 | (cal_CRC(skb->tail, rxlen, 1) != | 948 | (cal_CRC(skb->data, rxlen, 1) != |
949 | (*(u32 *) (skb->tail+rxlen) ))) { /* FIXME (?) */ | 949 | (*(u32 *) (skb->data+rxlen) ))) { /* FIXME (?) */ |
950 | /* Found a error received packet */ | 950 | /* Found a error received packet */ |
951 | dmfe_reuse_skb(db, rxptr->rx_skb_ptr); | 951 | dmfe_reuse_skb(db, rxptr->rx_skb_ptr); |
952 | db->dm910x_chk_mode = 3; | 952 | db->dm910x_chk_mode = 3; |
@@ -959,7 +959,7 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db) | |||
959 | /* size less than COPY_SIZE, allocate a rxlen SKB */ | 959 | /* size less than COPY_SIZE, allocate a rxlen SKB */ |
960 | skb->dev = dev; | 960 | skb->dev = dev; |
961 | skb_reserve(skb, 2); /* 16byte align */ | 961 | skb_reserve(skb, 2); /* 16byte align */ |
962 | memcpy(skb_put(skb, rxlen), rxptr->rx_skb_ptr->tail, rxlen); | 962 | memcpy(skb_put(skb, rxlen), rxptr->rx_skb_ptr->data, rxlen); |
963 | dmfe_reuse_skb(db, rxptr->rx_skb_ptr); | 963 | dmfe_reuse_skb(db, rxptr->rx_skb_ptr); |
964 | } else { | 964 | } else { |
965 | skb->dev = dev; | 965 | skb->dev = dev; |
@@ -1252,7 +1252,7 @@ static void dmfe_reuse_skb(struct dmfe_board_info *db, struct sk_buff * skb) | |||
1252 | 1252 | ||
1253 | if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) { | 1253 | if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) { |
1254 | rxptr->rx_skb_ptr = skb; | 1254 | rxptr->rx_skb_ptr = skb; |
1255 | rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); | 1255 | rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->data, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); |
1256 | wmb(); | 1256 | wmb(); |
1257 | rxptr->rdes0 = cpu_to_le32(0x80000000); | 1257 | rxptr->rdes0 = cpu_to_le32(0x80000000); |
1258 | db->rx_avail_cnt++; | 1258 | db->rx_avail_cnt++; |
@@ -1463,7 +1463,7 @@ static void allocate_rx_buffer(struct dmfe_board_info *db) | |||
1463 | if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL ) | 1463 | if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL ) |
1464 | break; | 1464 | break; |
1465 | rxptr->rx_skb_ptr = skb; /* FIXME (?) */ | 1465 | rxptr->rx_skb_ptr = skb; /* FIXME (?) */ |
1466 | rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); | 1466 | rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->data, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); |
1467 | wmb(); | 1467 | wmb(); |
1468 | rxptr->rdes0 = cpu_to_le32(0x80000000); | 1468 | rxptr->rdes0 = cpu_to_le32(0x80000000); |
1469 | rxptr = rxptr->next_rx_desc; | 1469 | rxptr = rxptr->next_rx_desc; |
diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c index afb5cda9d8e1..bb3558164a5b 100644 --- a/drivers/net/tulip/interrupt.c +++ b/drivers/net/tulip/interrupt.c | |||
@@ -78,7 +78,7 @@ int tulip_refill_rx(struct net_device *dev) | |||
78 | if (skb == NULL) | 78 | if (skb == NULL) |
79 | break; | 79 | break; |
80 | 80 | ||
81 | mapping = pci_map_single(tp->pdev, skb->tail, PKT_BUF_SZ, | 81 | mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ, |
82 | PCI_DMA_FROMDEVICE); | 82 | PCI_DMA_FROMDEVICE); |
83 | tp->rx_buffers[entry].mapping = mapping; | 83 | tp->rx_buffers[entry].mapping = mapping; |
84 | 84 | ||
@@ -199,12 +199,12 @@ int tulip_poll(struct net_device *dev, int *budget) | |||
199 | tp->rx_buffers[entry].mapping, | 199 | tp->rx_buffers[entry].mapping, |
200 | pkt_len, PCI_DMA_FROMDEVICE); | 200 | pkt_len, PCI_DMA_FROMDEVICE); |
201 | #if ! defined(__alpha__) | 201 | #if ! defined(__alpha__) |
202 | eth_copy_and_sum(skb, tp->rx_buffers[entry].skb->tail, | 202 | eth_copy_and_sum(skb, tp->rx_buffers[entry].skb->data, |
203 | pkt_len, 0); | 203 | pkt_len, 0); |
204 | skb_put(skb, pkt_len); | 204 | skb_put(skb, pkt_len); |
205 | #else | 205 | #else |
206 | memcpy(skb_put(skb, pkt_len), | 206 | memcpy(skb_put(skb, pkt_len), |
207 | tp->rx_buffers[entry].skb->tail, | 207 | tp->rx_buffers[entry].skb->data, |
208 | pkt_len); | 208 | pkt_len); |
209 | #endif | 209 | #endif |
210 | pci_dma_sync_single_for_device(tp->pdev, | 210 | pci_dma_sync_single_for_device(tp->pdev, |
@@ -423,12 +423,12 @@ static int tulip_rx(struct net_device *dev) | |||
423 | tp->rx_buffers[entry].mapping, | 423 | tp->rx_buffers[entry].mapping, |
424 | pkt_len, PCI_DMA_FROMDEVICE); | 424 | pkt_len, PCI_DMA_FROMDEVICE); |
425 | #if ! defined(__alpha__) | 425 | #if ! defined(__alpha__) |
426 | eth_copy_and_sum(skb, tp->rx_buffers[entry].skb->tail, | 426 | eth_copy_and_sum(skb, tp->rx_buffers[entry].skb->data, |
427 | pkt_len, 0); | 427 | pkt_len, 0); |
428 | skb_put(skb, pkt_len); | 428 | skb_put(skb, pkt_len); |
429 | #else | 429 | #else |
430 | memcpy(skb_put(skb, pkt_len), | 430 | memcpy(skb_put(skb, pkt_len), |
431 | tp->rx_buffers[entry].skb->tail, | 431 | tp->rx_buffers[entry].skb->data, |
432 | pkt_len); | 432 | pkt_len); |
433 | #endif | 433 | #endif |
434 | pci_dma_sync_single_for_device(tp->pdev, | 434 | pci_dma_sync_single_for_device(tp->pdev, |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 08e0f80f89d5..d45d8f56e5b4 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -625,7 +625,7 @@ static void tulip_init_ring(struct net_device *dev) | |||
625 | tp->rx_buffers[i].skb = skb; | 625 | tp->rx_buffers[i].skb = skb; |
626 | if (skb == NULL) | 626 | if (skb == NULL) |
627 | break; | 627 | break; |
628 | mapping = pci_map_single(tp->pdev, skb->tail, | 628 | mapping = pci_map_single(tp->pdev, skb->data, |
629 | PKT_BUF_SZ, PCI_DMA_FROMDEVICE); | 629 | PKT_BUF_SZ, PCI_DMA_FROMDEVICE); |
630 | tp->rx_buffers[i].mapping = mapping; | 630 | tp->rx_buffers[i].mapping = mapping; |
631 | skb->dev = dev; /* Mark as being used by this device. */ | 631 | skb->dev = dev; /* Mark as being used by this device. */ |
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index db4b32c2369a..5b1af3986abf 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -849,7 +849,7 @@ static void init_rxtx_rings(struct net_device *dev) | |||
849 | if (skb == NULL) | 849 | if (skb == NULL) |
850 | break; | 850 | break; |
851 | skb->dev = dev; /* Mark as being used by this device. */ | 851 | skb->dev = dev; /* Mark as being used by this device. */ |
852 | np->rx_addr[i] = pci_map_single(np->pci_dev,skb->tail, | 852 | np->rx_addr[i] = pci_map_single(np->pci_dev,skb->data, |
853 | skb->len,PCI_DMA_FROMDEVICE); | 853 | skb->len,PCI_DMA_FROMDEVICE); |
854 | 854 | ||
855 | np->rx_ring[i].buffer1 = np->rx_addr[i]; | 855 | np->rx_ring[i].buffer1 = np->rx_addr[i]; |
@@ -1269,7 +1269,7 @@ static int netdev_rx(struct net_device *dev) | |||
1269 | pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry], | 1269 | pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry], |
1270 | np->rx_skbuff[entry]->len, | 1270 | np->rx_skbuff[entry]->len, |
1271 | PCI_DMA_FROMDEVICE); | 1271 | PCI_DMA_FROMDEVICE); |
1272 | eth_copy_and_sum(skb, np->rx_skbuff[entry]->tail, pkt_len, 0); | 1272 | eth_copy_and_sum(skb, np->rx_skbuff[entry]->data, pkt_len, 0); |
1273 | skb_put(skb, pkt_len); | 1273 | skb_put(skb, pkt_len); |
1274 | pci_dma_sync_single_for_device(np->pci_dev,np->rx_addr[entry], | 1274 | pci_dma_sync_single_for_device(np->pci_dev,np->rx_addr[entry], |
1275 | np->rx_skbuff[entry]->len, | 1275 | np->rx_skbuff[entry]->len, |
@@ -1315,7 +1315,7 @@ static int netdev_rx(struct net_device *dev) | |||
1315 | break; /* Better luck next round. */ | 1315 | break; /* Better luck next round. */ |
1316 | skb->dev = dev; /* Mark as being used by this device. */ | 1316 | skb->dev = dev; /* Mark as being used by this device. */ |
1317 | np->rx_addr[entry] = pci_map_single(np->pci_dev, | 1317 | np->rx_addr[entry] = pci_map_single(np->pci_dev, |
1318 | skb->tail, | 1318 | skb->data, |
1319 | skb->len, PCI_DMA_FROMDEVICE); | 1319 | skb->len, PCI_DMA_FROMDEVICE); |
1320 | np->rx_ring[entry].buffer1 = np->rx_addr[entry]; | 1320 | np->rx_ring[entry].buffer1 = np->rx_addr[entry]; |
1321 | } | 1321 | } |
diff --git a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c index b8a9b395c5ea..887d7245fe7b 100644 --- a/drivers/net/tulip/xircom_tulip_cb.c +++ b/drivers/net/tulip/xircom_tulip_cb.c | |||
@@ -899,7 +899,7 @@ static void xircom_init_ring(struct net_device *dev) | |||
899 | break; | 899 | break; |
900 | skb->dev = dev; /* Mark as being used by this device. */ | 900 | skb->dev = dev; /* Mark as being used by this device. */ |
901 | tp->rx_ring[i].status = Rx0DescOwned; /* Owned by Xircom chip */ | 901 | tp->rx_ring[i].status = Rx0DescOwned; /* Owned by Xircom chip */ |
902 | tp->rx_ring[i].buffer1 = virt_to_bus(skb->tail); | 902 | tp->rx_ring[i].buffer1 = virt_to_bus(skb->data); |
903 | } | 903 | } |
904 | tp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); | 904 | tp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); |
905 | 905 | ||
@@ -1291,7 +1291,7 @@ xircom_rx(struct net_device *dev) | |||
1291 | if (skb == NULL) | 1291 | if (skb == NULL) |
1292 | break; | 1292 | break; |
1293 | skb->dev = dev; /* Mark as being used by this device. */ | 1293 | skb->dev = dev; /* Mark as being used by this device. */ |
1294 | tp->rx_ring[entry].buffer1 = virt_to_bus(skb->tail); | 1294 | tp->rx_ring[entry].buffer1 = virt_to_bus(skb->data); |
1295 | work_done++; | 1295 | work_done++; |
1296 | } | 1296 | } |
1297 | tp->rx_ring[entry].status = Rx0DescOwned; | 1297 | tp->rx_ring[entry].status = Rx0DescOwned; |
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 8f3392989a06..0b5ca2537963 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -1661,7 +1661,7 @@ typhoon_alloc_rx_skb(struct typhoon *tp, u32 idx) | |||
1661 | #endif | 1661 | #endif |
1662 | 1662 | ||
1663 | skb->dev = tp->dev; | 1663 | skb->dev = tp->dev; |
1664 | dma_addr = pci_map_single(tp->pdev, skb->tail, | 1664 | dma_addr = pci_map_single(tp->pdev, skb->data, |
1665 | PKT_BUF_SZ, PCI_DMA_FROMDEVICE); | 1665 | PKT_BUF_SZ, PCI_DMA_FROMDEVICE); |
1666 | 1666 | ||
1667 | /* Since no card does 64 bit DAC, the high bits will never | 1667 | /* Since no card does 64 bit DAC, the high bits will never |
@@ -1721,7 +1721,7 @@ typhoon_rx(struct typhoon *tp, struct basic_ring *rxRing, volatile u32 * ready, | |||
1721 | pci_dma_sync_single_for_cpu(tp->pdev, dma_addr, | 1721 | pci_dma_sync_single_for_cpu(tp->pdev, dma_addr, |
1722 | PKT_BUF_SZ, | 1722 | PKT_BUF_SZ, |
1723 | PCI_DMA_FROMDEVICE); | 1723 | PCI_DMA_FROMDEVICE); |
1724 | eth_copy_and_sum(new_skb, skb->tail, pkt_len, 0); | 1724 | eth_copy_and_sum(new_skb, skb->data, pkt_len, 0); |
1725 | pci_dma_sync_single_for_device(tp->pdev, dma_addr, | 1725 | pci_dma_sync_single_for_device(tp->pdev, dma_addr, |
1726 | PKT_BUF_SZ, | 1726 | PKT_BUF_SZ, |
1727 | PCI_DMA_FROMDEVICE); | 1727 | PCI_DMA_FROMDEVICE); |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index be1c1047b9ba..fc7738ffbfff 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -507,7 +507,7 @@ static struct net_device_stats *rhine_get_stats(struct net_device *dev); | |||
507 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 507 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
508 | static struct ethtool_ops netdev_ethtool_ops; | 508 | static struct ethtool_ops netdev_ethtool_ops; |
509 | static int rhine_close(struct net_device *dev); | 509 | static int rhine_close(struct net_device *dev); |
510 | static void rhine_shutdown (struct device *gdev); | 510 | static void rhine_shutdown (struct pci_dev *pdev); |
511 | 511 | ||
512 | #define RHINE_WAIT_FOR(condition) do { \ | 512 | #define RHINE_WAIT_FOR(condition) do { \ |
513 | int i=1024; \ | 513 | int i=1024; \ |
@@ -990,7 +990,7 @@ static void alloc_rbufs(struct net_device *dev) | |||
990 | skb->dev = dev; /* Mark as being used by this device. */ | 990 | skb->dev = dev; /* Mark as being used by this device. */ |
991 | 991 | ||
992 | rp->rx_skbuff_dma[i] = | 992 | rp->rx_skbuff_dma[i] = |
993 | pci_map_single(rp->pdev, skb->tail, rp->rx_buf_sz, | 993 | pci_map_single(rp->pdev, skb->data, rp->rx_buf_sz, |
994 | PCI_DMA_FROMDEVICE); | 994 | PCI_DMA_FROMDEVICE); |
995 | 995 | ||
996 | rp->rx_ring[i].addr = cpu_to_le32(rp->rx_skbuff_dma[i]); | 996 | rp->rx_ring[i].addr = cpu_to_le32(rp->rx_skbuff_dma[i]); |
@@ -1518,7 +1518,7 @@ static void rhine_rx(struct net_device *dev) | |||
1518 | PCI_DMA_FROMDEVICE); | 1518 | PCI_DMA_FROMDEVICE); |
1519 | 1519 | ||
1520 | eth_copy_and_sum(skb, | 1520 | eth_copy_and_sum(skb, |
1521 | rp->rx_skbuff[entry]->tail, | 1521 | rp->rx_skbuff[entry]->data, |
1522 | pkt_len, 0); | 1522 | pkt_len, 0); |
1523 | skb_put(skb, pkt_len); | 1523 | skb_put(skb, pkt_len); |
1524 | pci_dma_sync_single_for_device(rp->pdev, | 1524 | pci_dma_sync_single_for_device(rp->pdev, |
@@ -1561,7 +1561,7 @@ static void rhine_rx(struct net_device *dev) | |||
1561 | break; /* Better luck next round. */ | 1561 | break; /* Better luck next round. */ |
1562 | skb->dev = dev; /* Mark as being used by this device. */ | 1562 | skb->dev = dev; /* Mark as being used by this device. */ |
1563 | rp->rx_skbuff_dma[entry] = | 1563 | rp->rx_skbuff_dma[entry] = |
1564 | pci_map_single(rp->pdev, skb->tail, | 1564 | pci_map_single(rp->pdev, skb->data, |
1565 | rp->rx_buf_sz, | 1565 | rp->rx_buf_sz, |
1566 | PCI_DMA_FROMDEVICE); | 1566 | PCI_DMA_FROMDEVICE); |
1567 | rp->rx_ring[entry].addr = cpu_to_le32(rp->rx_skbuff_dma[entry]); | 1567 | rp->rx_ring[entry].addr = cpu_to_le32(rp->rx_skbuff_dma[entry]); |
@@ -1895,9 +1895,8 @@ static void __devexit rhine_remove_one(struct pci_dev *pdev) | |||
1895 | pci_set_drvdata(pdev, NULL); | 1895 | pci_set_drvdata(pdev, NULL); |
1896 | } | 1896 | } |
1897 | 1897 | ||
1898 | static void rhine_shutdown (struct device *gendev) | 1898 | static void rhine_shutdown (struct pci_dev *pdev) |
1899 | { | 1899 | { |
1900 | struct pci_dev *pdev = to_pci_dev(gendev); | ||
1901 | struct net_device *dev = pci_get_drvdata(pdev); | 1900 | struct net_device *dev = pci_get_drvdata(pdev); |
1902 | struct rhine_private *rp = netdev_priv(dev); | 1901 | struct rhine_private *rp = netdev_priv(dev); |
1903 | void __iomem *ioaddr = rp->base; | 1902 | void __iomem *ioaddr = rp->base; |
@@ -1956,7 +1955,7 @@ static int rhine_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1956 | pci_save_state(pdev); | 1955 | pci_save_state(pdev); |
1957 | 1956 | ||
1958 | spin_lock_irqsave(&rp->lock, flags); | 1957 | spin_lock_irqsave(&rp->lock, flags); |
1959 | rhine_shutdown(&pdev->dev); | 1958 | rhine_shutdown(pdev); |
1960 | spin_unlock_irqrestore(&rp->lock, flags); | 1959 | spin_unlock_irqrestore(&rp->lock, flags); |
1961 | 1960 | ||
1962 | free_irq(dev->irq, dev); | 1961 | free_irq(dev->irq, dev); |
@@ -2010,9 +2009,7 @@ static struct pci_driver rhine_driver = { | |||
2010 | .suspend = rhine_suspend, | 2009 | .suspend = rhine_suspend, |
2011 | .resume = rhine_resume, | 2010 | .resume = rhine_resume, |
2012 | #endif /* CONFIG_PM */ | 2011 | #endif /* CONFIG_PM */ |
2013 | .driver = { | 2012 | .shutdown = rhine_shutdown, |
2014 | .shutdown = rhine_shutdown, | ||
2015 | } | ||
2016 | }; | 2013 | }; |
2017 | 2014 | ||
2018 | 2015 | ||
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 15e710283493..abc5cee6eedc 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -1335,7 +1335,7 @@ static inline int velocity_rx_copy(struct sk_buff **rx_skb, int pkt_size, | |||
1335 | if (vptr->flags & VELOCITY_FLAGS_IP_ALIGN) | 1335 | if (vptr->flags & VELOCITY_FLAGS_IP_ALIGN) |
1336 | skb_reserve(new_skb, 2); | 1336 | skb_reserve(new_skb, 2); |
1337 | 1337 | ||
1338 | memcpy(new_skb->data, rx_skb[0]->tail, pkt_size); | 1338 | memcpy(new_skb->data, rx_skb[0]->data, pkt_size); |
1339 | *rx_skb = new_skb; | 1339 | *rx_skb = new_skb; |
1340 | ret = 0; | 1340 | ret = 0; |
1341 | } | 1341 | } |
@@ -1456,9 +1456,9 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) | |||
1456 | * Do the gymnastics to get the buffer head for data at | 1456 | * Do the gymnastics to get the buffer head for data at |
1457 | * 64byte alignment. | 1457 | * 64byte alignment. |
1458 | */ | 1458 | */ |
1459 | skb_reserve(rd_info->skb, (unsigned long) rd_info->skb->tail & 63); | 1459 | skb_reserve(rd_info->skb, (unsigned long) rd_info->skb->data & 63); |
1460 | rd_info->skb->dev = vptr->dev; | 1460 | rd_info->skb->dev = vptr->dev; |
1461 | rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->tail, vptr->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1461 | rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, vptr->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1462 | 1462 | ||
1463 | /* | 1463 | /* |
1464 | * Fill in the descriptor to match | 1464 | * Fill in the descriptor to match |
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index c1b6896d7007..87496843681a 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c | |||
@@ -72,7 +72,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type, | |||
72 | } | 72 | } |
73 | skb_reserve(skb, 4); | 73 | skb_reserve(skb, 4); |
74 | cisco_hard_header(skb, dev, CISCO_KEEPALIVE, NULL, NULL, 0); | 74 | cisco_hard_header(skb, dev, CISCO_KEEPALIVE, NULL, NULL, 0); |
75 | data = (cisco_packet*)skb->tail; | 75 | data = (cisco_packet*)skb->data; |
76 | 76 | ||
77 | data->type = htonl(type); | 77 | data->type = htonl(type); |
78 | data->par1 = htonl(par1); | 78 | data->par1 = htonl(par1); |
diff --git a/drivers/net/wireless/airport.c b/drivers/net/wireless/airport.c index b4f4bd7956a2..9d496703c465 100644 --- a/drivers/net/wireless/airport.c +++ b/drivers/net/wireless/airport.c | |||
@@ -184,7 +184,7 @@ static int airport_hard_reset(struct orinoco_private *priv) | |||
184 | } | 184 | } |
185 | 185 | ||
186 | static int | 186 | static int |
187 | airport_attach(struct macio_dev *mdev, const struct of_match *match) | 187 | airport_attach(struct macio_dev *mdev, const struct of_device_id *match) |
188 | { | 188 | { |
189 | struct orinoco_private *priv; | 189 | struct orinoco_private *priv; |
190 | struct net_device *dev; | 190 | struct net_device *dev; |
@@ -266,16 +266,16 @@ MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>"); | |||
266 | MODULE_DESCRIPTION("Driver for the Apple Airport wireless card."); | 266 | MODULE_DESCRIPTION("Driver for the Apple Airport wireless card."); |
267 | MODULE_LICENSE("Dual MPL/GPL"); | 267 | MODULE_LICENSE("Dual MPL/GPL"); |
268 | 268 | ||
269 | static struct of_match airport_match[] = | 269 | static struct of_device_id airport_match[] = |
270 | { | 270 | { |
271 | { | 271 | { |
272 | .name = "radio", | 272 | .name = "radio", |
273 | .type = OF_ANY_MATCH, | ||
274 | .compatible = OF_ANY_MATCH | ||
275 | }, | 273 | }, |
276 | {}, | 274 | {}, |
277 | }; | 275 | }; |
278 | 276 | ||
277 | MODULE_DEVICE_TABLE (of, airport_match); | ||
278 | |||
279 | static struct macio_driver airport_driver = | 279 | static struct macio_driver airport_driver = |
280 | { | 280 | { |
281 | .name = DRIVER_NAME, | 281 | .name = DRIVER_NAME, |
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index 9da925430109..1c2506535f7e 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -786,7 +786,7 @@ static void yellowfin_init_ring(struct net_device *dev) | |||
786 | skb->dev = dev; /* Mark as being used by this device. */ | 786 | skb->dev = dev; /* Mark as being used by this device. */ |
787 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ | 787 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ |
788 | yp->rx_ring[i].addr = cpu_to_le32(pci_map_single(yp->pci_dev, | 788 | yp->rx_ring[i].addr = cpu_to_le32(pci_map_single(yp->pci_dev, |
789 | skb->tail, yp->rx_buf_sz, PCI_DMA_FROMDEVICE)); | 789 | skb->data, yp->rx_buf_sz, PCI_DMA_FROMDEVICE)); |
790 | } | 790 | } |
791 | yp->rx_ring[i-1].dbdma_cmd = cpu_to_le32(CMD_STOP); | 791 | yp->rx_ring[i-1].dbdma_cmd = cpu_to_le32(CMD_STOP); |
792 | yp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); | 792 | yp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); |
@@ -1111,7 +1111,7 @@ static int yellowfin_rx(struct net_device *dev) | |||
1111 | pci_dma_sync_single_for_cpu(yp->pci_dev, desc->addr, | 1111 | pci_dma_sync_single_for_cpu(yp->pci_dev, desc->addr, |
1112 | yp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1112 | yp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1113 | desc_status = le32_to_cpu(desc->result_status) >> 16; | 1113 | desc_status = le32_to_cpu(desc->result_status) >> 16; |
1114 | buf_addr = rx_skb->tail; | 1114 | buf_addr = rx_skb->data; |
1115 | data_size = (le32_to_cpu(desc->dbdma_cmd) - | 1115 | data_size = (le32_to_cpu(desc->dbdma_cmd) - |
1116 | le32_to_cpu(desc->result_status)) & 0xffff; | 1116 | le32_to_cpu(desc->result_status)) & 0xffff; |
1117 | frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2]))); | 1117 | frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2]))); |
@@ -1185,7 +1185,7 @@ static int yellowfin_rx(struct net_device *dev) | |||
1185 | break; | 1185 | break; |
1186 | skb->dev = dev; | 1186 | skb->dev = dev; |
1187 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1187 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1188 | eth_copy_and_sum(skb, rx_skb->tail, pkt_len, 0); | 1188 | eth_copy_and_sum(skb, rx_skb->data, pkt_len, 0); |
1189 | skb_put(skb, pkt_len); | 1189 | skb_put(skb, pkt_len); |
1190 | pci_dma_sync_single_for_device(yp->pci_dev, desc->addr, | 1190 | pci_dma_sync_single_for_device(yp->pci_dev, desc->addr, |
1191 | yp->rx_buf_sz, | 1191 | yp->rx_buf_sz, |
@@ -1211,7 +1211,7 @@ static int yellowfin_rx(struct net_device *dev) | |||
1211 | skb->dev = dev; /* Mark as being used by this device. */ | 1211 | skb->dev = dev; /* Mark as being used by this device. */ |
1212 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 1212 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
1213 | yp->rx_ring[entry].addr = cpu_to_le32(pci_map_single(yp->pci_dev, | 1213 | yp->rx_ring[entry].addr = cpu_to_le32(pci_map_single(yp->pci_dev, |
1214 | skb->tail, yp->rx_buf_sz, PCI_DMA_FROMDEVICE)); | 1214 | skb->data, yp->rx_buf_sz, PCI_DMA_FROMDEVICE)); |
1215 | } | 1215 | } |
1216 | yp->rx_ring[entry].dbdma_cmd = cpu_to_le32(CMD_STOP); | 1216 | yp->rx_ring[entry].dbdma_cmd = cpu_to_le32(CMD_STOP); |
1217 | yp->rx_ring[entry].result_status = 0; /* Clear complete bit. */ | 1217 | yp->rx_ring[entry].result_status = 0; /* Clear complete bit. */ |
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index b0d2a73d1d47..2f2dbef2c3b7 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c | |||
@@ -993,6 +993,7 @@ dino_driver_callback(struct parisc_device *dev) | |||
993 | bus = pci_scan_bus_parented(&dev->dev, dino_current_bus, | 993 | bus = pci_scan_bus_parented(&dev->dev, dino_current_bus, |
994 | &dino_cfg_ops, NULL); | 994 | &dino_cfg_ops, NULL); |
995 | if(bus) { | 995 | if(bus) { |
996 | pci_bus_add_devices(bus); | ||
996 | /* This code *depends* on scanning being single threaded | 997 | /* This code *depends* on scanning being single threaded |
997 | * if it isn't, this global bus number count will fail | 998 | * if it isn't, this global bus number count will fail |
998 | */ | 999 | */ |
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index dc838804c0dd..7fdd80b7eb47 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c | |||
@@ -1570,6 +1570,8 @@ lba_driver_probe(struct parisc_device *dev) | |||
1570 | lba_bus = lba_dev->hba.hba_bus = | 1570 | lba_bus = lba_dev->hba.hba_bus = |
1571 | pci_scan_bus_parented(&dev->dev, lba_dev->hba.bus_num.start, | 1571 | pci_scan_bus_parented(&dev->dev, lba_dev->hba.bus_num.start, |
1572 | cfg_ops, NULL); | 1572 | cfg_ops, NULL); |
1573 | if (lba_bus) | ||
1574 | pci_bus_add_devices(lba_bus); | ||
1573 | 1575 | ||
1574 | /* This is in lieu of calling pci_assign_unassigned_resources() */ | 1576 | /* This is in lieu of calling pci_assign_unassigned_resources() */ |
1575 | if (is_pdc_pat()) { | 1577 | if (is_pdc_pat()) { |
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 80edfa3abd29..4598c6a9212d 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c | |||
@@ -3008,7 +3008,7 @@ static int __init parport_pc_init_superio (int autoirq, int autodma) | |||
3008 | int ret = 0; | 3008 | int ret = 0; |
3009 | 3009 | ||
3010 | while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) { | 3010 | while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) { |
3011 | id = pci_match_device (parport_pc_pci_tbl, pdev); | 3011 | id = pci_match_id(parport_pc_pci_tbl, pdev); |
3012 | if (id == NULL || id->driver_data >= last_sio) | 3012 | if (id == NULL || id->driver_data >= last_sio) |
3013 | continue; | 3013 | continue; |
3014 | 3014 | ||
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 7dea494c0d7b..3657f6199c48 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile | |||
@@ -19,6 +19,7 @@ obj-$(CONFIG_HOTPLUG_PCI) += hotplug/ | |||
19 | # | 19 | # |
20 | # Some architectures use the generic PCI setup functions | 20 | # Some architectures use the generic PCI setup functions |
21 | # | 21 | # |
22 | obj-$(CONFIG_X86) += setup-bus.o | ||
22 | obj-$(CONFIG_ALPHA) += setup-bus.o setup-irq.o | 23 | obj-$(CONFIG_ALPHA) += setup-bus.o setup-irq.o |
23 | obj-$(CONFIG_ARM) += setup-bus.o setup-irq.o | 24 | obj-$(CONFIG_ARM) += setup-bus.o setup-irq.o |
24 | obj-$(CONFIG_PARISC) += setup-bus.o | 25 | obj-$(CONFIG_PARISC) += setup-bus.o |
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index dbd33605cc10..fedae89d8f7d 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -121,10 +121,13 @@ void __devinit pci_bus_add_devices(struct pci_bus *bus) | |||
121 | * If there is an unattached subordinate bus, attach | 121 | * If there is an unattached subordinate bus, attach |
122 | * it and then scan for unattached PCI devices. | 122 | * it and then scan for unattached PCI devices. |
123 | */ | 123 | */ |
124 | if (dev->subordinate && list_empty(&dev->subordinate->node)) { | 124 | if (dev->subordinate) { |
125 | spin_lock(&pci_bus_lock); | 125 | if (list_empty(&dev->subordinate->node)) { |
126 | list_add_tail(&dev->subordinate->node, &dev->bus->children); | 126 | spin_lock(&pci_bus_lock); |
127 | spin_unlock(&pci_bus_lock); | 127 | list_add_tail(&dev->subordinate->node, |
128 | &dev->bus->children); | ||
129 | spin_unlock(&pci_bus_lock); | ||
130 | } | ||
128 | pci_bus_add_devices(dev->subordinate); | 131 | pci_bus_add_devices(dev->subordinate); |
129 | 132 | ||
130 | sysfs_create_link(&dev->subordinate->class_dev.kobj, &dev->dev.kobj, "bridge"); | 133 | sysfs_create_link(&dev->subordinate->class_dev.kobj, &dev->dev.kobj, "bridge"); |
diff --git a/drivers/pci/hotplug.c b/drivers/pci/hotplug.c index 3903f8c559b6..b844bc972324 100644 --- a/drivers/pci/hotplug.c +++ b/drivers/pci/hotplug.c | |||
@@ -54,7 +54,7 @@ int pci_hotplug (struct device *dev, char **envp, int num_envp, | |||
54 | 54 | ||
55 | envp[i++] = scratch; | 55 | envp[i++] = scratch; |
56 | length += scnprintf (scratch, buffer_size - length, | 56 | length += scnprintf (scratch, buffer_size - length, |
57 | "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x\n", | 57 | "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x", |
58 | pdev->vendor, pdev->device, | 58 | pdev->vendor, pdev->device, |
59 | pdev->subsystem_vendor, pdev->subsystem_device, | 59 | pdev->subsystem_vendor, pdev->subsystem_device, |
60 | (u8)(pdev->class >> 16), (u8)(pdev->class >> 8), | 60 | (u8)(pdev->class >> 16), (u8)(pdev->class >> 8), |
diff --git a/drivers/pci/hotplug/Makefile b/drivers/pci/hotplug/Makefile index 93c120ddbd39..3e632ff8c717 100644 --- a/drivers/pci/hotplug/Makefile +++ b/drivers/pci/hotplug/Makefile | |||
@@ -36,9 +36,7 @@ ibmphp-objs := ibmphp_core.o \ | |||
36 | ibmphp_hpc.o | 36 | ibmphp_hpc.o |
37 | 37 | ||
38 | acpiphp-objs := acpiphp_core.o \ | 38 | acpiphp-objs := acpiphp_core.o \ |
39 | acpiphp_glue.o \ | 39 | acpiphp_glue.o |
40 | acpiphp_pci.o \ | ||
41 | acpiphp_res.o | ||
42 | 40 | ||
43 | rpaphp-objs := rpaphp_core.o \ | 41 | rpaphp-objs := rpaphp_core.o \ |
44 | rpaphp_pci.o \ | 42 | rpaphp_pci.o \ |
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index d9499874c8a9..293603e1b7c3 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
@@ -7,6 +7,8 @@ | |||
7 | * Copyright (C) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) | 7 | * Copyright (C) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) |
8 | * Copyright (C) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com) | 8 | * Copyright (C) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com) |
9 | * Copyright (C) 2002,2003 NEC Corporation | 9 | * Copyright (C) 2002,2003 NEC Corporation |
10 | * Copyright (C) 2003-2005 Matthew Wilcox (matthew.wilcox@hp.com) | ||
11 | * Copyright (C) 2003-2005 Hewlett Packard | ||
10 | * | 12 | * |
11 | * All rights reserved. | 13 | * All rights reserved. |
12 | * | 14 | * |
@@ -52,7 +54,6 @@ | |||
52 | 54 | ||
53 | struct acpiphp_bridge; | 55 | struct acpiphp_bridge; |
54 | struct acpiphp_slot; | 56 | struct acpiphp_slot; |
55 | struct pci_resource; | ||
56 | 57 | ||
57 | /* | 58 | /* |
58 | * struct slot - slot information for each *physical* slot | 59 | * struct slot - slot information for each *physical* slot |
@@ -65,15 +66,6 @@ struct slot { | |||
65 | struct acpiphp_slot *acpi_slot; | 66 | struct acpiphp_slot *acpi_slot; |
66 | }; | 67 | }; |
67 | 68 | ||
68 | /* | ||
69 | * struct pci_resource - describes pci resource (mem, pfmem, io, bus) | ||
70 | */ | ||
71 | struct pci_resource { | ||
72 | struct pci_resource * next; | ||
73 | u64 base; | ||
74 | u32 length; | ||
75 | }; | ||
76 | |||
77 | /** | 69 | /** |
78 | * struct hpp_param - ACPI 2.0 _HPP Hot Plug Parameters | 70 | * struct hpp_param - ACPI 2.0 _HPP Hot Plug Parameters |
79 | * @cache_line_size in DWORD | 71 | * @cache_line_size in DWORD |
@@ -101,10 +93,6 @@ struct acpiphp_bridge { | |||
101 | int type; | 93 | int type; |
102 | int nr_slots; | 94 | int nr_slots; |
103 | 95 | ||
104 | u8 seg; | ||
105 | u8 bus; | ||
106 | u8 sub; | ||
107 | |||
108 | u32 flags; | 96 | u32 flags; |
109 | 97 | ||
110 | /* This bus (host bridge) or Secondary bus (PCI-to-PCI bridge) */ | 98 | /* This bus (host bridge) or Secondary bus (PCI-to-PCI bridge) */ |
@@ -117,12 +105,6 @@ struct acpiphp_bridge { | |||
117 | struct hpp_param hpp; | 105 | struct hpp_param hpp; |
118 | 106 | ||
119 | spinlock_t res_lock; | 107 | spinlock_t res_lock; |
120 | |||
121 | /* available resources on this bus */ | ||
122 | struct pci_resource *mem_head; | ||
123 | struct pci_resource *p_mem_head; | ||
124 | struct pci_resource *io_head; | ||
125 | struct pci_resource *bus_head; | ||
126 | }; | 108 | }; |
127 | 109 | ||
128 | 110 | ||
@@ -163,12 +145,6 @@ struct acpiphp_func { | |||
163 | 145 | ||
164 | u8 function; /* pci function# */ | 146 | u8 function; /* pci function# */ |
165 | u32 flags; /* see below */ | 147 | u32 flags; /* see below */ |
166 | |||
167 | /* resources used for this function */ | ||
168 | struct pci_resource *mem_head; | ||
169 | struct pci_resource *p_mem_head; | ||
170 | struct pci_resource *io_head; | ||
171 | struct pci_resource *bus_head; | ||
172 | }; | 148 | }; |
173 | 149 | ||
174 | /** | 150 | /** |
@@ -243,25 +219,6 @@ extern u8 acpiphp_get_latch_status (struct acpiphp_slot *slot); | |||
243 | extern u8 acpiphp_get_adapter_status (struct acpiphp_slot *slot); | 219 | extern u8 acpiphp_get_adapter_status (struct acpiphp_slot *slot); |
244 | extern u32 acpiphp_get_address (struct acpiphp_slot *slot); | 220 | extern u32 acpiphp_get_address (struct acpiphp_slot *slot); |
245 | 221 | ||
246 | /* acpiphp_pci.c */ | ||
247 | extern struct pci_dev *acpiphp_allocate_pcidev (struct pci_bus *pbus, int dev, int fn); | ||
248 | extern int acpiphp_configure_slot (struct acpiphp_slot *slot); | ||
249 | extern int acpiphp_configure_function (struct acpiphp_func *func); | ||
250 | extern void acpiphp_unconfigure_function (struct acpiphp_func *func); | ||
251 | extern int acpiphp_detect_pci_resource (struct acpiphp_bridge *bridge); | ||
252 | extern int acpiphp_init_func_resource (struct acpiphp_func *func); | ||
253 | |||
254 | /* acpiphp_res.c */ | ||
255 | extern struct pci_resource *acpiphp_get_io_resource (struct pci_resource **head, u32 size); | ||
256 | extern struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size); | ||
257 | extern struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head, u64 base, u32 size); | ||
258 | extern int acpiphp_resource_sort_and_combine (struct pci_resource **head); | ||
259 | extern struct pci_resource *acpiphp_make_resource (u64 base, u32 length); | ||
260 | extern void acpiphp_move_resource (struct pci_resource **from, struct pci_resource **to); | ||
261 | extern void acpiphp_free_resource (struct pci_resource **res); | ||
262 | extern void acpiphp_dump_resource (struct acpiphp_bridge *bridge); /* debug */ | ||
263 | extern void acpiphp_dump_func_resource (struct acpiphp_func *func); /* debug */ | ||
264 | |||
265 | /* variables */ | 222 | /* variables */ |
266 | extern int acpiphp_debug; | 223 | extern int acpiphp_debug; |
267 | 224 | ||
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index 4539e61a3dc1..60c4c38047a3 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c | |||
@@ -7,6 +7,8 @@ | |||
7 | * Copyright (C) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) | 7 | * Copyright (C) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) |
8 | * Copyright (C) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com) | 8 | * Copyright (C) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com) |
9 | * Copyright (C) 2002,2003 NEC Corporation | 9 | * Copyright (C) 2002,2003 NEC Corporation |
10 | * Copyright (C) 2003-2005 Matthew Wilcox (matthew.wilcox@hp.com) | ||
11 | * Copyright (C) 2003-2005 Hewlett Packard | ||
10 | * | 12 | * |
11 | * All rights reserved. | 13 | * All rights reserved. |
12 | * | 14 | * |
@@ -53,8 +55,8 @@ int acpiphp_debug; | |||
53 | static int num_slots; | 55 | static int num_slots; |
54 | static struct acpiphp_attention_info *attention_info; | 56 | static struct acpiphp_attention_info *attention_info; |
55 | 57 | ||
56 | #define DRIVER_VERSION "0.4" | 58 | #define DRIVER_VERSION "0.5" |
57 | #define DRIVER_AUTHOR "Greg Kroah-Hartman <gregkh@us.ibm.com>, Takayoshi Kochi <t-kochi@bq.jp.nec.com>" | 59 | #define DRIVER_AUTHOR "Greg Kroah-Hartman <gregkh@us.ibm.com>, Takayoshi Kochi <t-kochi@bq.jp.nec.com>, Matthew Wilcox <willy@hp.com>" |
58 | #define DRIVER_DESC "ACPI Hot Plug PCI Controller Driver" | 60 | #define DRIVER_DESC "ACPI Hot Plug PCI Controller Driver" |
59 | 61 | ||
60 | MODULE_AUTHOR(DRIVER_AUTHOR); | 62 | MODULE_AUTHOR(DRIVER_AUTHOR); |
@@ -281,8 +283,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
281 | /** | 283 | /** |
282 | * get_address - get pci address of a slot | 284 | * get_address - get pci address of a slot |
283 | * @hotplug_slot: slot to get status | 285 | * @hotplug_slot: slot to get status |
284 | * @busdev: pointer to struct pci_busdev (seg, bus, dev) | 286 | * @value: pointer to struct pci_busdev (seg, bus, dev) |
285 | * | ||
286 | */ | 287 | */ |
287 | static int get_address(struct hotplug_slot *hotplug_slot, u32 *value) | 288 | static int get_address(struct hotplug_slot *hotplug_slot, u32 *value) |
288 | { | 289 | { |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index e7f41294f811..424e7de181ae 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -4,6 +4,10 @@ | |||
4 | * Copyright (C) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com) | 4 | * Copyright (C) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com) |
5 | * Copyright (C) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) | 5 | * Copyright (C) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) |
6 | * Copyright (C) 2002,2003 NEC Corporation | 6 | * Copyright (C) 2002,2003 NEC Corporation |
7 | * Copyright (C) 2003-2005 Matthew Wilcox (matthew.wilcox@hp.com) | ||
8 | * Copyright (C) 2003-2005 Hewlett Packard | ||
9 | * Copyright (C) 2005 Rajesh Shah (rajesh.shah@intel.com) | ||
10 | * Copyright (C) 2005 Intel Corporation | ||
7 | * | 11 | * |
8 | * All rights reserved. | 12 | * All rights reserved. |
9 | * | 13 | * |
@@ -26,6 +30,16 @@ | |||
26 | * | 30 | * |
27 | */ | 31 | */ |
28 | 32 | ||
33 | /* | ||
34 | * Lifetime rules for pci_dev: | ||
35 | * - The one in acpiphp_func has its refcount elevated by pci_get_slot() | ||
36 | * when the driver is loaded or when an insertion event occurs. It loses | ||
37 | * a refcount when its ejected or the driver unloads. | ||
38 | * - The one in acpiphp_bridge has its refcount elevated by pci_get_slot() | ||
39 | * when the bridge is scanned and it loses a refcount when the bridge | ||
40 | * is removed. | ||
41 | */ | ||
42 | |||
29 | #include <linux/init.h> | 43 | #include <linux/init.h> |
30 | #include <linux/module.h> | 44 | #include <linux/module.h> |
31 | 45 | ||
@@ -178,21 +192,18 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
178 | 192 | ||
179 | bridge->nr_slots++; | 193 | bridge->nr_slots++; |
180 | 194 | ||
181 | dbg("found ACPI PCI Hotplug slot at PCI %02x:%02x Slot:%d\n", | 195 | dbg("found ACPI PCI Hotplug slot %d at PCI %04x:%02x:%02x\n", |
182 | slot->bridge->bus, slot->device, slot->sun); | 196 | slot->sun, pci_domain_nr(bridge->pci_bus), |
197 | bridge->pci_bus->number, slot->device); | ||
183 | } | 198 | } |
184 | 199 | ||
185 | newfunc->slot = slot; | 200 | newfunc->slot = slot; |
186 | list_add_tail(&newfunc->sibling, &slot->funcs); | 201 | list_add_tail(&newfunc->sibling, &slot->funcs); |
187 | 202 | ||
188 | /* associate corresponding pci_dev */ | 203 | /* associate corresponding pci_dev */ |
189 | newfunc->pci_dev = pci_find_slot(bridge->bus, | 204 | newfunc->pci_dev = pci_get_slot(bridge->pci_bus, |
190 | PCI_DEVFN(device, function)); | 205 | PCI_DEVFN(device, function)); |
191 | if (newfunc->pci_dev) { | 206 | if (newfunc->pci_dev) { |
192 | if (acpiphp_init_func_resource(newfunc) < 0) { | ||
193 | kfree(newfunc); | ||
194 | return AE_ERROR; | ||
195 | } | ||
196 | slot->flags |= (SLOT_ENABLED | SLOT_POWEREDON); | 207 | slot->flags |= (SLOT_ENABLED | SLOT_POWEREDON); |
197 | } | 208 | } |
198 | 209 | ||
@@ -227,62 +238,6 @@ static int detect_ejectable_slots(acpi_handle *bridge_handle) | |||
227 | } | 238 | } |
228 | 239 | ||
229 | 240 | ||
230 | /* decode ACPI _CRS data and convert into our internal resource list | ||
231 | * TBD: _TRA, etc. | ||
232 | */ | ||
233 | static acpi_status | ||
234 | decode_acpi_resource(struct acpi_resource *resource, void *context) | ||
235 | { | ||
236 | struct acpiphp_bridge *bridge = (struct acpiphp_bridge *) context; | ||
237 | struct acpi_resource_address64 address; | ||
238 | struct pci_resource *res; | ||
239 | |||
240 | if (resource->id != ACPI_RSTYPE_ADDRESS16 && | ||
241 | resource->id != ACPI_RSTYPE_ADDRESS32 && | ||
242 | resource->id != ACPI_RSTYPE_ADDRESS64) | ||
243 | return AE_OK; | ||
244 | |||
245 | acpi_resource_to_address64(resource, &address); | ||
246 | |||
247 | if (address.producer_consumer == ACPI_PRODUCER && address.address_length > 0) { | ||
248 | dbg("resource type: %d: 0x%llx - 0x%llx\n", address.resource_type, | ||
249 | (unsigned long long)address.min_address_range, | ||
250 | (unsigned long long)address.max_address_range); | ||
251 | res = acpiphp_make_resource(address.min_address_range, | ||
252 | address.address_length); | ||
253 | if (!res) { | ||
254 | err("out of memory\n"); | ||
255 | return AE_OK; | ||
256 | } | ||
257 | |||
258 | switch (address.resource_type) { | ||
259 | case ACPI_MEMORY_RANGE: | ||
260 | if (address.attribute.memory.cache_attribute == ACPI_PREFETCHABLE_MEMORY) { | ||
261 | res->next = bridge->p_mem_head; | ||
262 | bridge->p_mem_head = res; | ||
263 | } else { | ||
264 | res->next = bridge->mem_head; | ||
265 | bridge->mem_head = res; | ||
266 | } | ||
267 | break; | ||
268 | case ACPI_IO_RANGE: | ||
269 | res->next = bridge->io_head; | ||
270 | bridge->io_head = res; | ||
271 | break; | ||
272 | case ACPI_BUS_NUMBER_RANGE: | ||
273 | res->next = bridge->bus_head; | ||
274 | bridge->bus_head = res; | ||
275 | break; | ||
276 | default: | ||
277 | /* invalid type */ | ||
278 | kfree(res); | ||
279 | break; | ||
280 | } | ||
281 | } | ||
282 | |||
283 | return AE_OK; | ||
284 | } | ||
285 | |||
286 | /* decode ACPI 2.0 _HPP hot plug parameters */ | 241 | /* decode ACPI 2.0 _HPP hot plug parameters */ |
287 | static void decode_hpp(struct acpiphp_bridge *bridge) | 242 | static void decode_hpp(struct acpiphp_bridge *bridge) |
288 | { | 243 | { |
@@ -346,34 +301,29 @@ static void init_bridge_misc(struct acpiphp_bridge *bridge) | |||
346 | /* decode ACPI 2.0 _HPP (hot plug parameters) */ | 301 | /* decode ACPI 2.0 _HPP (hot plug parameters) */ |
347 | decode_hpp(bridge); | 302 | decode_hpp(bridge); |
348 | 303 | ||
349 | /* subtract all resources already allocated */ | ||
350 | acpiphp_detect_pci_resource(bridge); | ||
351 | |||
352 | /* register all slot objects under this bridge */ | 304 | /* register all slot objects under this bridge */ |
353 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge->handle, (u32)1, | 305 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge->handle, (u32)1, |
354 | register_slot, bridge, NULL); | 306 | register_slot, bridge, NULL); |
355 | 307 | ||
356 | /* install notify handler */ | 308 | /* install notify handler */ |
357 | status = acpi_install_notify_handler(bridge->handle, | 309 | if (bridge->type != BRIDGE_TYPE_HOST) { |
310 | status = acpi_install_notify_handler(bridge->handle, | ||
358 | ACPI_SYSTEM_NOTIFY, | 311 | ACPI_SYSTEM_NOTIFY, |
359 | handle_hotplug_event_bridge, | 312 | handle_hotplug_event_bridge, |
360 | bridge); | 313 | bridge); |
361 | 314 | ||
362 | if (ACPI_FAILURE(status)) { | 315 | if (ACPI_FAILURE(status)) { |
363 | err("failed to register interrupt notify handler\n"); | 316 | err("failed to register interrupt notify handler\n"); |
317 | } | ||
364 | } | 318 | } |
365 | 319 | ||
366 | list_add(&bridge->list, &bridge_list); | 320 | list_add(&bridge->list, &bridge_list); |
367 | |||
368 | dbg("Bridge resource:\n"); | ||
369 | acpiphp_dump_resource(bridge); | ||
370 | } | 321 | } |
371 | 322 | ||
372 | 323 | ||
373 | /* allocate and initialize host bridge data structure */ | 324 | /* allocate and initialize host bridge data structure */ |
374 | static void add_host_bridge(acpi_handle *handle, int seg, int bus) | 325 | static void add_host_bridge(acpi_handle *handle, struct pci_bus *pci_bus) |
375 | { | 326 | { |
376 | acpi_status status; | ||
377 | struct acpiphp_bridge *bridge; | 327 | struct acpiphp_bridge *bridge; |
378 | 328 | ||
379 | bridge = kmalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); | 329 | bridge = kmalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); |
@@ -384,52 +334,19 @@ static void add_host_bridge(acpi_handle *handle, int seg, int bus) | |||
384 | 334 | ||
385 | bridge->type = BRIDGE_TYPE_HOST; | 335 | bridge->type = BRIDGE_TYPE_HOST; |
386 | bridge->handle = handle; | 336 | bridge->handle = handle; |
387 | bridge->seg = seg; | ||
388 | bridge->bus = bus; | ||
389 | 337 | ||
390 | bridge->pci_bus = pci_find_bus(seg, bus); | 338 | bridge->pci_bus = pci_bus; |
391 | 339 | ||
392 | spin_lock_init(&bridge->res_lock); | 340 | spin_lock_init(&bridge->res_lock); |
393 | 341 | ||
394 | /* to be overridden when we decode _CRS */ | ||
395 | bridge->sub = bridge->bus; | ||
396 | |||
397 | /* decode resources */ | ||
398 | |||
399 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | ||
400 | decode_acpi_resource, bridge); | ||
401 | |||
402 | if (ACPI_FAILURE(status)) { | ||
403 | err("failed to decode bridge resources\n"); | ||
404 | kfree(bridge); | ||
405 | return; | ||
406 | } | ||
407 | |||
408 | acpiphp_resource_sort_and_combine(&bridge->io_head); | ||
409 | acpiphp_resource_sort_and_combine(&bridge->mem_head); | ||
410 | acpiphp_resource_sort_and_combine(&bridge->p_mem_head); | ||
411 | acpiphp_resource_sort_and_combine(&bridge->bus_head); | ||
412 | |||
413 | dbg("ACPI _CRS resource:\n"); | ||
414 | acpiphp_dump_resource(bridge); | ||
415 | |||
416 | if (bridge->bus_head) { | ||
417 | bridge->bus = bridge->bus_head->base; | ||
418 | bridge->sub = bridge->bus_head->base + bridge->bus_head->length - 1; | ||
419 | } | ||
420 | |||
421 | init_bridge_misc(bridge); | 342 | init_bridge_misc(bridge); |
422 | } | 343 | } |
423 | 344 | ||
424 | 345 | ||
425 | /* allocate and initialize PCI-to-PCI bridge data structure */ | 346 | /* allocate and initialize PCI-to-PCI bridge data structure */ |
426 | static void add_p2p_bridge(acpi_handle *handle, int seg, int bus, int dev, int fn) | 347 | static void add_p2p_bridge(acpi_handle *handle, struct pci_dev *pci_dev) |
427 | { | 348 | { |
428 | struct acpiphp_bridge *bridge; | 349 | struct acpiphp_bridge *bridge; |
429 | u8 tmp8; | ||
430 | u16 tmp16; | ||
431 | u64 base64, limit64; | ||
432 | u32 base, limit, base32u, limit32u; | ||
433 | 350 | ||
434 | bridge = kmalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); | 351 | bridge = kmalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); |
435 | if (bridge == NULL) { | 352 | if (bridge == NULL) { |
@@ -441,133 +358,22 @@ static void add_p2p_bridge(acpi_handle *handle, int seg, int bus, int dev, int f | |||
441 | 358 | ||
442 | bridge->type = BRIDGE_TYPE_P2P; | 359 | bridge->type = BRIDGE_TYPE_P2P; |
443 | bridge->handle = handle; | 360 | bridge->handle = handle; |
444 | bridge->seg = seg; | ||
445 | |||
446 | bridge->pci_dev = pci_find_slot(bus, PCI_DEVFN(dev, fn)); | ||
447 | if (!bridge->pci_dev) { | ||
448 | err("Can't get pci_dev\n"); | ||
449 | kfree(bridge); | ||
450 | return; | ||
451 | } | ||
452 | 361 | ||
453 | bridge->pci_bus = bridge->pci_dev->subordinate; | 362 | bridge->pci_dev = pci_dev_get(pci_dev); |
363 | bridge->pci_bus = pci_dev->subordinate; | ||
454 | if (!bridge->pci_bus) { | 364 | if (!bridge->pci_bus) { |
455 | err("This is not a PCI-to-PCI bridge!\n"); | 365 | err("This is not a PCI-to-PCI bridge!\n"); |
456 | kfree(bridge); | 366 | goto err; |
457 | return; | ||
458 | } | 367 | } |
459 | 368 | ||
460 | spin_lock_init(&bridge->res_lock); | 369 | spin_lock_init(&bridge->res_lock); |
461 | 370 | ||
462 | bridge->bus = bridge->pci_bus->number; | ||
463 | bridge->sub = bridge->pci_bus->subordinate; | ||
464 | |||
465 | /* | ||
466 | * decode resources under this P2P bridge | ||
467 | */ | ||
468 | |||
469 | /* I/O resources */ | ||
470 | pci_read_config_byte(bridge->pci_dev, PCI_IO_BASE, &tmp8); | ||
471 | base = tmp8; | ||
472 | pci_read_config_byte(bridge->pci_dev, PCI_IO_LIMIT, &tmp8); | ||
473 | limit = tmp8; | ||
474 | |||
475 | switch (base & PCI_IO_RANGE_TYPE_MASK) { | ||
476 | case PCI_IO_RANGE_TYPE_16: | ||
477 | base = (base << 8) & 0xf000; | ||
478 | limit = ((limit << 8) & 0xf000) + 0xfff; | ||
479 | bridge->io_head = acpiphp_make_resource((u64)base, limit - base + 1); | ||
480 | if (!bridge->io_head) { | ||
481 | err("out of memory\n"); | ||
482 | kfree(bridge); | ||
483 | return; | ||
484 | } | ||
485 | dbg("16bit I/O range: %04x-%04x\n", | ||
486 | (u32)bridge->io_head->base, | ||
487 | (u32)(bridge->io_head->base + bridge->io_head->length - 1)); | ||
488 | break; | ||
489 | case PCI_IO_RANGE_TYPE_32: | ||
490 | pci_read_config_word(bridge->pci_dev, PCI_IO_BASE_UPPER16, &tmp16); | ||
491 | base = ((u32)tmp16 << 16) | ((base << 8) & 0xf000); | ||
492 | pci_read_config_word(bridge->pci_dev, PCI_IO_LIMIT_UPPER16, &tmp16); | ||
493 | limit = (((u32)tmp16 << 16) | ((limit << 8) & 0xf000)) + 0xfff; | ||
494 | bridge->io_head = acpiphp_make_resource((u64)base, limit - base + 1); | ||
495 | if (!bridge->io_head) { | ||
496 | err("out of memory\n"); | ||
497 | kfree(bridge); | ||
498 | return; | ||
499 | } | ||
500 | dbg("32bit I/O range: %08x-%08x\n", | ||
501 | (u32)bridge->io_head->base, | ||
502 | (u32)(bridge->io_head->base + bridge->io_head->length - 1)); | ||
503 | break; | ||
504 | case 0x0f: | ||
505 | dbg("I/O space unsupported\n"); | ||
506 | break; | ||
507 | default: | ||
508 | warn("Unknown I/O range type\n"); | ||
509 | } | ||
510 | |||
511 | /* Memory resources (mandatory for P2P bridge) */ | ||
512 | pci_read_config_word(bridge->pci_dev, PCI_MEMORY_BASE, &tmp16); | ||
513 | base = (tmp16 & 0xfff0) << 16; | ||
514 | pci_read_config_word(bridge->pci_dev, PCI_MEMORY_LIMIT, &tmp16); | ||
515 | limit = ((tmp16 & 0xfff0) << 16) | 0xfffff; | ||
516 | bridge->mem_head = acpiphp_make_resource((u64)base, limit - base + 1); | ||
517 | if (!bridge->mem_head) { | ||
518 | err("out of memory\n"); | ||
519 | kfree(bridge); | ||
520 | return; | ||
521 | } | ||
522 | dbg("32bit Memory range: %08x-%08x\n", | ||
523 | (u32)bridge->mem_head->base, | ||
524 | (u32)(bridge->mem_head->base + bridge->mem_head->length-1)); | ||
525 | |||
526 | /* Prefetchable Memory resources (optional) */ | ||
527 | pci_read_config_word(bridge->pci_dev, PCI_PREF_MEMORY_BASE, &tmp16); | ||
528 | base = tmp16; | ||
529 | pci_read_config_word(bridge->pci_dev, PCI_PREF_MEMORY_LIMIT, &tmp16); | ||
530 | limit = tmp16; | ||
531 | |||
532 | switch (base & PCI_MEMORY_RANGE_TYPE_MASK) { | ||
533 | case PCI_PREF_RANGE_TYPE_32: | ||
534 | base = (base & 0xfff0) << 16; | ||
535 | limit = ((limit & 0xfff0) << 16) | 0xfffff; | ||
536 | bridge->p_mem_head = acpiphp_make_resource((u64)base, limit - base + 1); | ||
537 | if (!bridge->p_mem_head) { | ||
538 | err("out of memory\n"); | ||
539 | kfree(bridge); | ||
540 | return; | ||
541 | } | ||
542 | dbg("32bit Prefetchable memory range: %08x-%08x\n", | ||
543 | (u32)bridge->p_mem_head->base, | ||
544 | (u32)(bridge->p_mem_head->base + bridge->p_mem_head->length - 1)); | ||
545 | break; | ||
546 | case PCI_PREF_RANGE_TYPE_64: | ||
547 | pci_read_config_dword(bridge->pci_dev, PCI_PREF_BASE_UPPER32, &base32u); | ||
548 | pci_read_config_dword(bridge->pci_dev, PCI_PREF_LIMIT_UPPER32, &limit32u); | ||
549 | base64 = ((u64)base32u << 32) | ((base & 0xfff0) << 16); | ||
550 | limit64 = (((u64)limit32u << 32) | ((limit & 0xfff0) << 16)) + 0xfffff; | ||
551 | |||
552 | bridge->p_mem_head = acpiphp_make_resource(base64, limit64 - base64 + 1); | ||
553 | if (!bridge->p_mem_head) { | ||
554 | err("out of memory\n"); | ||
555 | kfree(bridge); | ||
556 | return; | ||
557 | } | ||
558 | dbg("64bit Prefetchable memory range: %08x%08x-%08x%08x\n", | ||
559 | (u32)(bridge->p_mem_head->base >> 32), | ||
560 | (u32)(bridge->p_mem_head->base & 0xffffffff), | ||
561 | (u32)((bridge->p_mem_head->base + bridge->p_mem_head->length - 1) >> 32), | ||
562 | (u32)((bridge->p_mem_head->base + bridge->p_mem_head->length - 1) & 0xffffffff)); | ||
563 | break; | ||
564 | case 0x0f: | ||
565 | break; | ||
566 | default: | ||
567 | warn("Unknown prefetchale memory type\n"); | ||
568 | } | ||
569 | |||
570 | init_bridge_misc(bridge); | 371 | init_bridge_misc(bridge); |
372 | return; | ||
373 | err: | ||
374 | pci_dev_put(pci_dev); | ||
375 | kfree(bridge); | ||
376 | return; | ||
571 | } | 377 | } |
572 | 378 | ||
573 | 379 | ||
@@ -577,14 +383,10 @@ find_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
577 | { | 383 | { |
578 | acpi_status status; | 384 | acpi_status status; |
579 | acpi_handle dummy_handle; | 385 | acpi_handle dummy_handle; |
580 | unsigned long *segbus = context; | ||
581 | unsigned long tmp; | 386 | unsigned long tmp; |
582 | int seg, bus, device, function; | 387 | int device, function; |
583 | struct pci_dev *dev; | 388 | struct pci_dev *dev; |
584 | 389 | struct pci_bus *pci_bus = context; | |
585 | /* get PCI address */ | ||
586 | seg = (*segbus >> 8) & 0xff; | ||
587 | bus = *segbus & 0xff; | ||
588 | 390 | ||
589 | status = acpi_get_handle(handle, "_ADR", &dummy_handle); | 391 | status = acpi_get_handle(handle, "_ADR", &dummy_handle); |
590 | if (ACPI_FAILURE(status)) | 392 | if (ACPI_FAILURE(status)) |
@@ -599,20 +401,19 @@ find_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
599 | device = (tmp >> 16) & 0xffff; | 401 | device = (tmp >> 16) & 0xffff; |
600 | function = tmp & 0xffff; | 402 | function = tmp & 0xffff; |
601 | 403 | ||
602 | dev = pci_find_slot(bus, PCI_DEVFN(device, function)); | 404 | dev = pci_get_slot(pci_bus, PCI_DEVFN(device, function)); |
603 | 405 | ||
604 | if (!dev) | 406 | if (!dev || !dev->subordinate) |
605 | return AE_OK; | 407 | goto out; |
606 | |||
607 | if (!dev->subordinate) | ||
608 | return AE_OK; | ||
609 | 408 | ||
610 | /* check if this bridge has ejectable slots */ | 409 | /* check if this bridge has ejectable slots */ |
611 | if (detect_ejectable_slots(handle) > 0) { | 410 | if (detect_ejectable_slots(handle) > 0) { |
612 | dbg("found PCI-to-PCI bridge at PCI %s\n", pci_name(dev)); | 411 | dbg("found PCI-to-PCI bridge at PCI %s\n", pci_name(dev)); |
613 | add_p2p_bridge(handle, seg, bus, device, function); | 412 | add_p2p_bridge(handle, dev); |
614 | } | 413 | } |
615 | 414 | ||
415 | out: | ||
416 | pci_dev_put(dev); | ||
616 | return AE_OK; | 417 | return AE_OK; |
617 | } | 418 | } |
618 | 419 | ||
@@ -624,6 +425,7 @@ static int add_bridge(acpi_handle handle) | |||
624 | unsigned long tmp; | 425 | unsigned long tmp; |
625 | int seg, bus; | 426 | int seg, bus; |
626 | acpi_handle dummy_handle; | 427 | acpi_handle dummy_handle; |
428 | struct pci_bus *pci_bus; | ||
627 | 429 | ||
628 | /* if the bridge doesn't have _STA, we assume it is always there */ | 430 | /* if the bridge doesn't have _STA, we assume it is always there */ |
629 | status = acpi_get_handle(handle, "_STA", &dummy_handle); | 431 | status = acpi_get_handle(handle, "_STA", &dummy_handle); |
@@ -653,18 +455,22 @@ static int add_bridge(acpi_handle handle) | |||
653 | bus = 0; | 455 | bus = 0; |
654 | } | 456 | } |
655 | 457 | ||
458 | pci_bus = pci_find_bus(seg, bus); | ||
459 | if (!pci_bus) { | ||
460 | err("Can't find bus %04x:%02x\n", seg, bus); | ||
461 | return 0; | ||
462 | } | ||
463 | |||
656 | /* check if this bridge has ejectable slots */ | 464 | /* check if this bridge has ejectable slots */ |
657 | if (detect_ejectable_slots(handle) > 0) { | 465 | if (detect_ejectable_slots(handle) > 0) { |
658 | dbg("found PCI host-bus bridge with hot-pluggable slots\n"); | 466 | dbg("found PCI host-bus bridge with hot-pluggable slots\n"); |
659 | add_host_bridge(handle, seg, bus); | 467 | add_host_bridge(handle, pci_bus); |
660 | return 0; | 468 | return 0; |
661 | } | 469 | } |
662 | 470 | ||
663 | tmp = seg << 8 | bus; | ||
664 | |||
665 | /* search P2P bridges under this host bridge */ | 471 | /* search P2P bridges under this host bridge */ |
666 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, | 472 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, |
667 | find_p2p_bridge, &tmp, NULL); | 473 | find_p2p_bridge, pci_bus, NULL); |
668 | 474 | ||
669 | if (ACPI_FAILURE(status)) | 475 | if (ACPI_FAILURE(status)) |
670 | warn("find_p2p_bridge faied (error code = 0x%x)\n",status); | 476 | warn("find_p2p_bridge faied (error code = 0x%x)\n",status); |
@@ -672,12 +478,205 @@ static int add_bridge(acpi_handle handle) | |||
672 | return 0; | 478 | return 0; |
673 | } | 479 | } |
674 | 480 | ||
481 | static struct acpiphp_bridge *acpiphp_handle_to_bridge(acpi_handle handle) | ||
482 | { | ||
483 | struct list_head *head; | ||
484 | list_for_each(head, &bridge_list) { | ||
485 | struct acpiphp_bridge *bridge = list_entry(head, | ||
486 | struct acpiphp_bridge, list); | ||
487 | if (bridge->handle == handle) | ||
488 | return bridge; | ||
489 | } | ||
490 | |||
491 | return NULL; | ||
492 | } | ||
493 | |||
494 | static void cleanup_bridge(struct acpiphp_bridge *bridge) | ||
495 | { | ||
496 | struct list_head *list, *tmp; | ||
497 | struct acpiphp_slot *slot; | ||
498 | acpi_status status; | ||
499 | acpi_handle handle = bridge->handle; | ||
500 | |||
501 | status = acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | ||
502 | handle_hotplug_event_bridge); | ||
503 | if (ACPI_FAILURE(status)) | ||
504 | err("failed to remove notify handler\n"); | ||
505 | |||
506 | slot = bridge->slots; | ||
507 | while (slot) { | ||
508 | struct acpiphp_slot *next = slot->next; | ||
509 | list_for_each_safe (list, tmp, &slot->funcs) { | ||
510 | struct acpiphp_func *func; | ||
511 | func = list_entry(list, struct acpiphp_func, sibling); | ||
512 | status = acpi_remove_notify_handler(func->handle, | ||
513 | ACPI_SYSTEM_NOTIFY, | ||
514 | handle_hotplug_event_func); | ||
515 | if (ACPI_FAILURE(status)) | ||
516 | err("failed to remove notify handler\n"); | ||
517 | pci_dev_put(func->pci_dev); | ||
518 | list_del(list); | ||
519 | kfree(func); | ||
520 | } | ||
521 | kfree(slot); | ||
522 | slot = next; | ||
523 | } | ||
524 | |||
525 | pci_dev_put(bridge->pci_dev); | ||
526 | list_del(&bridge->list); | ||
527 | kfree(bridge); | ||
528 | } | ||
529 | |||
530 | static acpi_status | ||
531 | cleanup_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
532 | { | ||
533 | struct acpiphp_bridge *bridge; | ||
534 | |||
535 | if (!(bridge = acpiphp_handle_to_bridge(handle))) | ||
536 | return AE_OK; | ||
537 | cleanup_bridge(bridge); | ||
538 | return AE_OK; | ||
539 | } | ||
675 | 540 | ||
676 | static void remove_bridge(acpi_handle handle) | 541 | static void remove_bridge(acpi_handle handle) |
677 | { | 542 | { |
678 | /* No-op for now .. */ | 543 | struct acpiphp_bridge *bridge; |
544 | |||
545 | bridge = acpiphp_handle_to_bridge(handle); | ||
546 | if (bridge) { | ||
547 | cleanup_bridge(bridge); | ||
548 | } else { | ||
549 | /* clean-up p2p bridges under this host bridge */ | ||
550 | acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, | ||
551 | (u32)1, cleanup_p2p_bridge, NULL, NULL); | ||
552 | } | ||
553 | } | ||
554 | |||
555 | static struct pci_dev * get_apic_pci_info(acpi_handle handle) | ||
556 | { | ||
557 | struct acpi_pci_id id; | ||
558 | struct pci_bus *bus; | ||
559 | struct pci_dev *dev; | ||
560 | |||
561 | if (ACPI_FAILURE(acpi_get_pci_id(handle, &id))) | ||
562 | return NULL; | ||
563 | |||
564 | bus = pci_find_bus(id.segment, id.bus); | ||
565 | if (!bus) | ||
566 | return NULL; | ||
567 | |||
568 | dev = pci_get_slot(bus, PCI_DEVFN(id.device, id.function)); | ||
569 | if (!dev) | ||
570 | return NULL; | ||
571 | |||
572 | if ((dev->class != PCI_CLASS_SYSTEM_PIC_IOAPIC) && | ||
573 | (dev->class != PCI_CLASS_SYSTEM_PIC_IOXAPIC)) | ||
574 | { | ||
575 | pci_dev_put(dev); | ||
576 | return NULL; | ||
577 | } | ||
578 | |||
579 | return dev; | ||
580 | } | ||
581 | |||
582 | static int get_gsi_base(acpi_handle handle, u32 *gsi_base) | ||
583 | { | ||
584 | acpi_status status; | ||
585 | int result = -1; | ||
586 | unsigned long gsb; | ||
587 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
588 | union acpi_object *obj; | ||
589 | void *table; | ||
590 | |||
591 | status = acpi_evaluate_integer(handle, "_GSB", NULL, &gsb); | ||
592 | if (ACPI_SUCCESS(status)) { | ||
593 | *gsi_base = (u32)gsb; | ||
594 | return 0; | ||
595 | } | ||
596 | |||
597 | status = acpi_evaluate_object(handle, "_MAT", NULL, &buffer); | ||
598 | if (ACPI_FAILURE(status) || !buffer.length || !buffer.pointer) | ||
599 | return -1; | ||
600 | |||
601 | obj = buffer.pointer; | ||
602 | if (obj->type != ACPI_TYPE_BUFFER) | ||
603 | goto out; | ||
604 | |||
605 | table = obj->buffer.pointer; | ||
606 | switch (((acpi_table_entry_header *)table)->type) { | ||
607 | case ACPI_MADT_IOSAPIC: | ||
608 | *gsi_base = ((struct acpi_table_iosapic *)table)->global_irq_base; | ||
609 | result = 0; | ||
610 | break; | ||
611 | case ACPI_MADT_IOAPIC: | ||
612 | *gsi_base = ((struct acpi_table_ioapic *)table)->global_irq_base; | ||
613 | result = 0; | ||
614 | break; | ||
615 | default: | ||
616 | break; | ||
617 | } | ||
618 | out: | ||
619 | acpi_os_free(buffer.pointer); | ||
620 | return result; | ||
621 | } | ||
622 | |||
623 | static acpi_status | ||
624 | ioapic_add(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
625 | { | ||
626 | acpi_status status; | ||
627 | unsigned long sta; | ||
628 | acpi_handle tmp; | ||
629 | struct pci_dev *pdev; | ||
630 | u32 gsi_base; | ||
631 | u64 phys_addr; | ||
632 | |||
633 | /* Evaluate _STA if present */ | ||
634 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | ||
635 | if (ACPI_SUCCESS(status) && sta != ACPI_STA_ALL) | ||
636 | return AE_CTRL_DEPTH; | ||
637 | |||
638 | /* Scan only PCI bus scope */ | ||
639 | status = acpi_get_handle(handle, "_HID", &tmp); | ||
640 | if (ACPI_SUCCESS(status)) | ||
641 | return AE_CTRL_DEPTH; | ||
642 | |||
643 | if (get_gsi_base(handle, &gsi_base)) | ||
644 | return AE_OK; | ||
645 | |||
646 | pdev = get_apic_pci_info(handle); | ||
647 | if (!pdev) | ||
648 | return AE_OK; | ||
649 | |||
650 | if (pci_enable_device(pdev)) { | ||
651 | pci_dev_put(pdev); | ||
652 | return AE_OK; | ||
653 | } | ||
654 | |||
655 | pci_set_master(pdev); | ||
656 | |||
657 | if (pci_request_region(pdev, 0, "I/O APIC(acpiphp)")) { | ||
658 | pci_disable_device(pdev); | ||
659 | pci_dev_put(pdev); | ||
660 | return AE_OK; | ||
661 | } | ||
662 | |||
663 | phys_addr = pci_resource_start(pdev, 0); | ||
664 | if (acpi_register_ioapic(handle, phys_addr, gsi_base)) { | ||
665 | pci_release_region(pdev, 0); | ||
666 | pci_disable_device(pdev); | ||
667 | pci_dev_put(pdev); | ||
668 | return AE_OK; | ||
669 | } | ||
670 | |||
671 | return AE_OK; | ||
679 | } | 672 | } |
680 | 673 | ||
674 | static int acpiphp_configure_ioapics(acpi_handle handle) | ||
675 | { | ||
676 | acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, | ||
677 | ACPI_UINT32_MAX, ioapic_add, NULL, NULL); | ||
678 | return 0; | ||
679 | } | ||
681 | 680 | ||
682 | static int power_on_slot(struct acpiphp_slot *slot) | 681 | static int power_on_slot(struct acpiphp_slot *slot) |
683 | { | 682 | { |
@@ -719,8 +718,6 @@ static int power_off_slot(struct acpiphp_slot *slot) | |||
719 | acpi_status status; | 718 | acpi_status status; |
720 | struct acpiphp_func *func; | 719 | struct acpiphp_func *func; |
721 | struct list_head *l; | 720 | struct list_head *l; |
722 | struct acpi_object_list arg_list; | ||
723 | union acpi_object arg; | ||
724 | 721 | ||
725 | int retval = 0; | 722 | int retval = 0; |
726 | 723 | ||
@@ -731,7 +728,7 @@ static int power_off_slot(struct acpiphp_slot *slot) | |||
731 | list_for_each (l, &slot->funcs) { | 728 | list_for_each (l, &slot->funcs) { |
732 | func = list_entry(l, struct acpiphp_func, sibling); | 729 | func = list_entry(l, struct acpiphp_func, sibling); |
733 | 730 | ||
734 | if (func->pci_dev && (func->flags & FUNC_HAS_PS3)) { | 731 | if (func->flags & FUNC_HAS_PS3) { |
735 | status = acpi_evaluate_object(func->handle, "_PS3", NULL, NULL); | 732 | status = acpi_evaluate_object(func->handle, "_PS3", NULL, NULL); |
736 | if (ACPI_FAILURE(status)) { | 733 | if (ACPI_FAILURE(status)) { |
737 | warn("%s: _PS3 failed\n", __FUNCTION__); | 734 | warn("%s: _PS3 failed\n", __FUNCTION__); |
@@ -742,27 +739,6 @@ static int power_off_slot(struct acpiphp_slot *slot) | |||
742 | } | 739 | } |
743 | } | 740 | } |
744 | 741 | ||
745 | list_for_each (l, &slot->funcs) { | ||
746 | func = list_entry(l, struct acpiphp_func, sibling); | ||
747 | |||
748 | /* We don't want to call _EJ0 on non-existing functions. */ | ||
749 | if (func->pci_dev && (func->flags & FUNC_HAS_EJ0)) { | ||
750 | /* _EJ0 method take one argument */ | ||
751 | arg_list.count = 1; | ||
752 | arg_list.pointer = &arg; | ||
753 | arg.type = ACPI_TYPE_INTEGER; | ||
754 | arg.integer.value = 1; | ||
755 | |||
756 | status = acpi_evaluate_object(func->handle, "_EJ0", &arg_list, NULL); | ||
757 | if (ACPI_FAILURE(status)) { | ||
758 | warn("%s: _EJ0 failed\n", __FUNCTION__); | ||
759 | retval = -1; | ||
760 | goto err_exit; | ||
761 | } else | ||
762 | break; | ||
763 | } | ||
764 | } | ||
765 | |||
766 | /* TBD: evaluate _STA to check if the slot is disabled */ | 742 | /* TBD: evaluate _STA to check if the slot is disabled */ |
767 | 743 | ||
768 | slot->flags &= (~SLOT_POWEREDON); | 744 | slot->flags &= (~SLOT_POWEREDON); |
@@ -782,70 +758,56 @@ static int power_off_slot(struct acpiphp_slot *slot) | |||
782 | */ | 758 | */ |
783 | static int enable_device(struct acpiphp_slot *slot) | 759 | static int enable_device(struct acpiphp_slot *slot) |
784 | { | 760 | { |
785 | u8 bus; | ||
786 | struct pci_dev *dev; | 761 | struct pci_dev *dev; |
787 | struct pci_bus *child; | 762 | struct pci_bus *bus = slot->bridge->pci_bus; |
788 | struct list_head *l; | 763 | struct list_head *l; |
789 | struct acpiphp_func *func; | 764 | struct acpiphp_func *func; |
790 | int retval = 0; | 765 | int retval = 0; |
791 | int num; | 766 | int num, max, pass; |
792 | 767 | ||
793 | if (slot->flags & SLOT_ENABLED) | 768 | if (slot->flags & SLOT_ENABLED) |
794 | goto err_exit; | 769 | goto err_exit; |
795 | 770 | ||
796 | /* sanity check: dev should be NULL when hot-plugged in */ | 771 | /* sanity check: dev should be NULL when hot-plugged in */ |
797 | dev = pci_find_slot(slot->bridge->bus, PCI_DEVFN(slot->device, 0)); | 772 | dev = pci_get_slot(bus, PCI_DEVFN(slot->device, 0)); |
798 | if (dev) { | 773 | if (dev) { |
799 | /* This case shouldn't happen */ | 774 | /* This case shouldn't happen */ |
800 | err("pci_dev structure already exists.\n"); | 775 | err("pci_dev structure already exists.\n"); |
776 | pci_dev_put(dev); | ||
801 | retval = -1; | 777 | retval = -1; |
802 | goto err_exit; | 778 | goto err_exit; |
803 | } | 779 | } |
804 | 780 | ||
805 | /* allocate resources to device */ | 781 | num = pci_scan_slot(bus, PCI_DEVFN(slot->device, 0)); |
806 | retval = acpiphp_configure_slot(slot); | 782 | if (num == 0) { |
807 | if (retval) | ||
808 | goto err_exit; | ||
809 | |||
810 | /* returned `dev' is the *first function* only! */ | ||
811 | num = pci_scan_slot(slot->bridge->pci_bus, PCI_DEVFN(slot->device, 0)); | ||
812 | if (num) | ||
813 | pci_bus_add_devices(slot->bridge->pci_bus); | ||
814 | dev = pci_find_slot(slot->bridge->bus, PCI_DEVFN(slot->device, 0)); | ||
815 | |||
816 | if (!dev) { | ||
817 | err("No new device found\n"); | 783 | err("No new device found\n"); |
818 | retval = -1; | 784 | retval = -1; |
819 | goto err_exit; | 785 | goto err_exit; |
820 | } | 786 | } |
821 | 787 | ||
822 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { | 788 | max = bus->secondary; |
823 | pci_read_config_byte(dev, PCI_SECONDARY_BUS, &bus); | 789 | for (pass = 0; pass < 2; pass++) { |
824 | child = (struct pci_bus*) pci_add_new_bus(dev->bus, dev, bus); | 790 | list_for_each_entry(dev, &bus->devices, bus_list) { |
825 | pci_do_scan_bus(child); | 791 | if (PCI_SLOT(dev->devfn) != slot->device) |
792 | continue; | ||
793 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | ||
794 | dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) | ||
795 | max = pci_scan_bridge(bus, dev, max, pass); | ||
796 | } | ||
826 | } | 797 | } |
827 | 798 | ||
799 | pci_bus_assign_resources(bus); | ||
800 | pci_bus_add_devices(bus); | ||
801 | |||
828 | /* associate pci_dev to our representation */ | 802 | /* associate pci_dev to our representation */ |
829 | list_for_each (l, &slot->funcs) { | 803 | list_for_each (l, &slot->funcs) { |
830 | func = list_entry(l, struct acpiphp_func, sibling); | 804 | func = list_entry(l, struct acpiphp_func, sibling); |
831 | 805 | func->pci_dev = pci_get_slot(bus, PCI_DEVFN(slot->device, | |
832 | func->pci_dev = pci_find_slot(slot->bridge->bus, | ||
833 | PCI_DEVFN(slot->device, | ||
834 | func->function)); | 806 | func->function)); |
835 | if (!func->pci_dev) | ||
836 | continue; | ||
837 | |||
838 | /* configure device */ | ||
839 | retval = acpiphp_configure_function(func); | ||
840 | if (retval) | ||
841 | goto err_exit; | ||
842 | } | 807 | } |
843 | 808 | ||
844 | slot->flags |= SLOT_ENABLED; | 809 | slot->flags |= SLOT_ENABLED; |
845 | 810 | ||
846 | dbg("Available resources:\n"); | ||
847 | acpiphp_dump_resource(slot->bridge); | ||
848 | |||
849 | err_exit: | 811 | err_exit: |
850 | return retval; | 812 | return retval; |
851 | } | 813 | } |
@@ -866,9 +828,12 @@ static int disable_device(struct acpiphp_slot *slot) | |||
866 | 828 | ||
867 | list_for_each (l, &slot->funcs) { | 829 | list_for_each (l, &slot->funcs) { |
868 | func = list_entry(l, struct acpiphp_func, sibling); | 830 | func = list_entry(l, struct acpiphp_func, sibling); |
831 | if (!func->pci_dev) | ||
832 | continue; | ||
869 | 833 | ||
870 | if (func->pci_dev) | 834 | pci_remove_bus_device(func->pci_dev); |
871 | acpiphp_unconfigure_function(func); | 835 | pci_dev_put(func->pci_dev); |
836 | func->pci_dev = NULL; | ||
872 | } | 837 | } |
873 | 838 | ||
874 | slot->flags &= (~SLOT_ENABLED); | 839 | slot->flags &= (~SLOT_ENABLED); |
@@ -920,6 +885,39 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot) | |||
920 | } | 885 | } |
921 | 886 | ||
922 | /** | 887 | /** |
888 | * acpiphp_eject_slot - physically eject the slot | ||
889 | */ | ||
890 | static int acpiphp_eject_slot(struct acpiphp_slot *slot) | ||
891 | { | ||
892 | acpi_status status; | ||
893 | struct acpiphp_func *func; | ||
894 | struct list_head *l; | ||
895 | struct acpi_object_list arg_list; | ||
896 | union acpi_object arg; | ||
897 | |||
898 | list_for_each (l, &slot->funcs) { | ||
899 | func = list_entry(l, struct acpiphp_func, sibling); | ||
900 | |||
901 | /* We don't want to call _EJ0 on non-existing functions. */ | ||
902 | if ((func->flags & FUNC_HAS_EJ0)) { | ||
903 | /* _EJ0 method take one argument */ | ||
904 | arg_list.count = 1; | ||
905 | arg_list.pointer = &arg; | ||
906 | arg.type = ACPI_TYPE_INTEGER; | ||
907 | arg.integer.value = 1; | ||
908 | |||
909 | status = acpi_evaluate_object(func->handle, "_EJ0", &arg_list, NULL); | ||
910 | if (ACPI_FAILURE(status)) { | ||
911 | warn("%s: _EJ0 failed\n", __FUNCTION__); | ||
912 | return -1; | ||
913 | } else | ||
914 | break; | ||
915 | } | ||
916 | } | ||
917 | return 0; | ||
918 | } | ||
919 | |||
920 | /** | ||
923 | * acpiphp_check_bridge - re-enumerate devices | 921 | * acpiphp_check_bridge - re-enumerate devices |
924 | * | 922 | * |
925 | * Iterate over all slots under this bridge and make sure that if a | 923 | * Iterate over all slots under this bridge and make sure that if a |
@@ -942,6 +940,8 @@ static int acpiphp_check_bridge(struct acpiphp_bridge *bridge) | |||
942 | if (retval) { | 940 | if (retval) { |
943 | err("Error occurred in disabling\n"); | 941 | err("Error occurred in disabling\n"); |
944 | goto err_exit; | 942 | goto err_exit; |
943 | } else { | ||
944 | acpiphp_eject_slot(slot); | ||
945 | } | 945 | } |
946 | disabled++; | 946 | disabled++; |
947 | } else { | 947 | } else { |
@@ -962,6 +962,144 @@ static int acpiphp_check_bridge(struct acpiphp_bridge *bridge) | |||
962 | return retval; | 962 | return retval; |
963 | } | 963 | } |
964 | 964 | ||
965 | static void program_hpp(struct pci_dev *dev, struct acpiphp_bridge *bridge) | ||
966 | { | ||
967 | u16 pci_cmd, pci_bctl; | ||
968 | struct pci_dev *cdev; | ||
969 | |||
970 | /* Program hpp values for this device */ | ||
971 | if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL || | ||
972 | (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && | ||
973 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI))) | ||
974 | return; | ||
975 | pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, | ||
976 | bridge->hpp.cache_line_size); | ||
977 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, | ||
978 | bridge->hpp.latency_timer); | ||
979 | pci_read_config_word(dev, PCI_COMMAND, &pci_cmd); | ||
980 | if (bridge->hpp.enable_SERR) | ||
981 | pci_cmd |= PCI_COMMAND_SERR; | ||
982 | else | ||
983 | pci_cmd &= ~PCI_COMMAND_SERR; | ||
984 | if (bridge->hpp.enable_PERR) | ||
985 | pci_cmd |= PCI_COMMAND_PARITY; | ||
986 | else | ||
987 | pci_cmd &= ~PCI_COMMAND_PARITY; | ||
988 | pci_write_config_word(dev, PCI_COMMAND, pci_cmd); | ||
989 | |||
990 | /* Program bridge control value and child devices */ | ||
991 | if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { | ||
992 | pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER, | ||
993 | bridge->hpp.latency_timer); | ||
994 | pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &pci_bctl); | ||
995 | if (bridge->hpp.enable_SERR) | ||
996 | pci_bctl |= PCI_BRIDGE_CTL_SERR; | ||
997 | else | ||
998 | pci_bctl &= ~PCI_BRIDGE_CTL_SERR; | ||
999 | if (bridge->hpp.enable_PERR) | ||
1000 | pci_bctl |= PCI_BRIDGE_CTL_PARITY; | ||
1001 | else | ||
1002 | pci_bctl &= ~PCI_BRIDGE_CTL_PARITY; | ||
1003 | pci_write_config_word(dev, PCI_BRIDGE_CONTROL, pci_bctl); | ||
1004 | if (dev->subordinate) { | ||
1005 | list_for_each_entry(cdev, &dev->subordinate->devices, | ||
1006 | bus_list) | ||
1007 | program_hpp(cdev, bridge); | ||
1008 | } | ||
1009 | } | ||
1010 | } | ||
1011 | |||
1012 | static void acpiphp_set_hpp_values(acpi_handle handle, struct pci_bus *bus) | ||
1013 | { | ||
1014 | struct acpiphp_bridge bridge; | ||
1015 | struct pci_dev *dev; | ||
1016 | |||
1017 | memset(&bridge, 0, sizeof(bridge)); | ||
1018 | bridge.handle = handle; | ||
1019 | decode_hpp(&bridge); | ||
1020 | list_for_each_entry(dev, &bus->devices, bus_list) | ||
1021 | program_hpp(dev, &bridge); | ||
1022 | |||
1023 | } | ||
1024 | |||
1025 | /* | ||
1026 | * Remove devices for which we could not assign resources, call | ||
1027 | * arch specific code to fix-up the bus | ||
1028 | */ | ||
1029 | static void acpiphp_sanitize_bus(struct pci_bus *bus) | ||
1030 | { | ||
1031 | struct pci_dev *dev; | ||
1032 | int i; | ||
1033 | unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM; | ||
1034 | |||
1035 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
1036 | for (i=0; i<PCI_BRIDGE_RESOURCES; i++) { | ||
1037 | struct resource *res = &dev->resource[i]; | ||
1038 | if ((res->flags & type_mask) && !res->start && | ||
1039 | res->end) { | ||
1040 | /* Could not assign a required resources | ||
1041 | * for this device, remove it */ | ||
1042 | pci_remove_bus_device(dev); | ||
1043 | break; | ||
1044 | } | ||
1045 | } | ||
1046 | } | ||
1047 | } | ||
1048 | |||
1049 | /* Program resources in newly inserted bridge */ | ||
1050 | static int acpiphp_configure_bridge (acpi_handle handle) | ||
1051 | { | ||
1052 | struct acpi_pci_id pci_id; | ||
1053 | struct pci_bus *bus; | ||
1054 | |||
1055 | if (ACPI_FAILURE(acpi_get_pci_id(handle, &pci_id))) { | ||
1056 | err("cannot get PCI domain and bus number for bridge\n"); | ||
1057 | return -EINVAL; | ||
1058 | } | ||
1059 | bus = pci_find_bus(pci_id.segment, pci_id.bus); | ||
1060 | if (!bus) { | ||
1061 | err("cannot find bus %d:%d\n", | ||
1062 | pci_id.segment, pci_id.bus); | ||
1063 | return -EINVAL; | ||
1064 | } | ||
1065 | |||
1066 | pci_bus_size_bridges(bus); | ||
1067 | pci_bus_assign_resources(bus); | ||
1068 | acpiphp_sanitize_bus(bus); | ||
1069 | acpiphp_set_hpp_values(handle, bus); | ||
1070 | pci_enable_bridges(bus); | ||
1071 | acpiphp_configure_ioapics(handle); | ||
1072 | return 0; | ||
1073 | } | ||
1074 | |||
1075 | static void handle_bridge_insertion(acpi_handle handle, u32 type) | ||
1076 | { | ||
1077 | struct acpi_device *device, *pdevice; | ||
1078 | acpi_handle phandle; | ||
1079 | |||
1080 | if ((type != ACPI_NOTIFY_BUS_CHECK) && | ||
1081 | (type != ACPI_NOTIFY_DEVICE_CHECK)) { | ||
1082 | err("unexpected notification type %d\n", type); | ||
1083 | return; | ||
1084 | } | ||
1085 | |||
1086 | acpi_get_parent(handle, &phandle); | ||
1087 | if (acpi_bus_get_device(phandle, &pdevice)) { | ||
1088 | dbg("no parent device, assuming NULL\n"); | ||
1089 | pdevice = NULL; | ||
1090 | } | ||
1091 | if (acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE)) { | ||
1092 | err("cannot add bridge to acpi list\n"); | ||
1093 | return; | ||
1094 | } | ||
1095 | if (!acpiphp_configure_bridge(handle) && | ||
1096 | !acpi_bus_start(device)) | ||
1097 | add_bridge(handle); | ||
1098 | else | ||
1099 | err("cannot configure and start bridge\n"); | ||
1100 | |||
1101 | } | ||
1102 | |||
965 | /* | 1103 | /* |
966 | * ACPI event handlers | 1104 | * ACPI event handlers |
967 | */ | 1105 | */ |
@@ -982,8 +1120,19 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont | |||
982 | char objname[64]; | 1120 | char objname[64]; |
983 | struct acpi_buffer buffer = { .length = sizeof(objname), | 1121 | struct acpi_buffer buffer = { .length = sizeof(objname), |
984 | .pointer = objname }; | 1122 | .pointer = objname }; |
1123 | struct acpi_device *device; | ||
985 | 1124 | ||
986 | bridge = (struct acpiphp_bridge *)context; | 1125 | if (acpi_bus_get_device(handle, &device)) { |
1126 | /* This bridge must have just been physically inserted */ | ||
1127 | handle_bridge_insertion(handle, type); | ||
1128 | return; | ||
1129 | } | ||
1130 | |||
1131 | bridge = acpiphp_handle_to_bridge(handle); | ||
1132 | if (!bridge) { | ||
1133 | err("cannot get bridge info\n"); | ||
1134 | return; | ||
1135 | } | ||
987 | 1136 | ||
988 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | 1137 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); |
989 | 1138 | ||
@@ -1031,7 +1180,6 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont | |||
1031 | } | 1180 | } |
1032 | } | 1181 | } |
1033 | 1182 | ||
1034 | |||
1035 | /** | 1183 | /** |
1036 | * handle_hotplug_event_func - handle ACPI event on functions (i.e. slots) | 1184 | * handle_hotplug_event_func - handle ACPI event on functions (i.e. slots) |
1037 | * | 1185 | * |
@@ -1074,7 +1222,8 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *contex | |||
1074 | case ACPI_NOTIFY_EJECT_REQUEST: | 1222 | case ACPI_NOTIFY_EJECT_REQUEST: |
1075 | /* request device eject */ | 1223 | /* request device eject */ |
1076 | dbg("%s: Device eject notify on %s\n", __FUNCTION__, objname); | 1224 | dbg("%s: Device eject notify on %s\n", __FUNCTION__, objname); |
1077 | acpiphp_disable_slot(func->slot); | 1225 | if (!(acpiphp_disable_slot(func->slot))) |
1226 | acpiphp_eject_slot(func->slot); | ||
1078 | break; | 1227 | break; |
1079 | 1228 | ||
1080 | default: | 1229 | default: |
@@ -1083,6 +1232,47 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *contex | |||
1083 | } | 1232 | } |
1084 | } | 1233 | } |
1085 | 1234 | ||
1235 | static int is_root_bridge(acpi_handle handle) | ||
1236 | { | ||
1237 | acpi_status status; | ||
1238 | struct acpi_device_info *info; | ||
1239 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
1240 | int i; | ||
1241 | |||
1242 | status = acpi_get_object_info(handle, &buffer); | ||
1243 | if (ACPI_SUCCESS(status)) { | ||
1244 | info = buffer.pointer; | ||
1245 | if ((info->valid & ACPI_VALID_HID) && | ||
1246 | !strcmp(PCI_ROOT_HID_STRING, | ||
1247 | info->hardware_id.value)) { | ||
1248 | acpi_os_free(buffer.pointer); | ||
1249 | return 1; | ||
1250 | } | ||
1251 | if (info->valid & ACPI_VALID_CID) { | ||
1252 | for (i=0; i < info->compatibility_id.count; i++) { | ||
1253 | if (!strcmp(PCI_ROOT_HID_STRING, | ||
1254 | info->compatibility_id.id[i].value)) { | ||
1255 | acpi_os_free(buffer.pointer); | ||
1256 | return 1; | ||
1257 | } | ||
1258 | } | ||
1259 | } | ||
1260 | } | ||
1261 | return 0; | ||
1262 | } | ||
1263 | |||
1264 | static acpi_status | ||
1265 | find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
1266 | { | ||
1267 | int *count = (int *)context; | ||
1268 | |||
1269 | if (is_root_bridge(handle)) { | ||
1270 | acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | ||
1271 | handle_hotplug_event_bridge, NULL); | ||
1272 | (*count)++; | ||
1273 | } | ||
1274 | return AE_OK ; | ||
1275 | } | ||
1086 | 1276 | ||
1087 | static struct acpi_pci_driver acpi_pci_hp_driver = { | 1277 | static struct acpi_pci_driver acpi_pci_hp_driver = { |
1088 | .add = add_bridge, | 1278 | .add = add_bridge, |
@@ -1095,15 +1285,15 @@ static struct acpi_pci_driver acpi_pci_hp_driver = { | |||
1095 | */ | 1285 | */ |
1096 | int __init acpiphp_glue_init(void) | 1286 | int __init acpiphp_glue_init(void) |
1097 | { | 1287 | { |
1098 | int num; | 1288 | int num = 0; |
1099 | |||
1100 | if (list_empty(&pci_root_buses)) | ||
1101 | return -1; | ||
1102 | 1289 | ||
1103 | num = acpi_pci_register_driver(&acpi_pci_hp_driver); | 1290 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
1291 | ACPI_UINT32_MAX, find_root_bridges, &num, NULL); | ||
1104 | 1292 | ||
1105 | if (num <= 0) | 1293 | if (num <= 0) |
1106 | return -1; | 1294 | return -1; |
1295 | else | ||
1296 | acpi_pci_register_driver(&acpi_pci_hp_driver); | ||
1107 | 1297 | ||
1108 | return 0; | 1298 | return 0; |
1109 | } | 1299 | } |
@@ -1116,46 +1306,6 @@ int __init acpiphp_glue_init(void) | |||
1116 | */ | 1306 | */ |
1117 | void __exit acpiphp_glue_exit(void) | 1307 | void __exit acpiphp_glue_exit(void) |
1118 | { | 1308 | { |
1119 | struct list_head *l1, *l2, *n1, *n2; | ||
1120 | struct acpiphp_bridge *bridge; | ||
1121 | struct acpiphp_slot *slot, *next; | ||
1122 | struct acpiphp_func *func; | ||
1123 | acpi_status status; | ||
1124 | |||
1125 | list_for_each_safe (l1, n1, &bridge_list) { | ||
1126 | bridge = (struct acpiphp_bridge *)l1; | ||
1127 | slot = bridge->slots; | ||
1128 | while (slot) { | ||
1129 | next = slot->next; | ||
1130 | list_for_each_safe (l2, n2, &slot->funcs) { | ||
1131 | func = list_entry(l2, struct acpiphp_func, sibling); | ||
1132 | acpiphp_free_resource(&func->io_head); | ||
1133 | acpiphp_free_resource(&func->mem_head); | ||
1134 | acpiphp_free_resource(&func->p_mem_head); | ||
1135 | acpiphp_free_resource(&func->bus_head); | ||
1136 | status = acpi_remove_notify_handler(func->handle, | ||
1137 | ACPI_SYSTEM_NOTIFY, | ||
1138 | handle_hotplug_event_func); | ||
1139 | if (ACPI_FAILURE(status)) | ||
1140 | err("failed to remove notify handler\n"); | ||
1141 | kfree(func); | ||
1142 | } | ||
1143 | kfree(slot); | ||
1144 | slot = next; | ||
1145 | } | ||
1146 | status = acpi_remove_notify_handler(bridge->handle, ACPI_SYSTEM_NOTIFY, | ||
1147 | handle_hotplug_event_bridge); | ||
1148 | if (ACPI_FAILURE(status)) | ||
1149 | err("failed to remove notify handler\n"); | ||
1150 | |||
1151 | acpiphp_free_resource(&bridge->io_head); | ||
1152 | acpiphp_free_resource(&bridge->mem_head); | ||
1153 | acpiphp_free_resource(&bridge->p_mem_head); | ||
1154 | acpiphp_free_resource(&bridge->bus_head); | ||
1155 | |||
1156 | kfree(bridge); | ||
1157 | } | ||
1158 | |||
1159 | acpi_pci_unregister_driver(&acpi_pci_hp_driver); | 1309 | acpi_pci_unregister_driver(&acpi_pci_hp_driver); |
1160 | } | 1310 | } |
1161 | 1311 | ||
@@ -1173,11 +1323,14 @@ int __init acpiphp_get_num_slots(void) | |||
1173 | 1323 | ||
1174 | list_for_each (node, &bridge_list) { | 1324 | list_for_each (node, &bridge_list) { |
1175 | bridge = (struct acpiphp_bridge *)node; | 1325 | bridge = (struct acpiphp_bridge *)node; |
1176 | dbg("Bus%d %dslot(s)\n", bridge->bus, bridge->nr_slots); | 1326 | dbg("Bus %04x:%02x has %d slot%s\n", |
1327 | pci_domain_nr(bridge->pci_bus), | ||
1328 | bridge->pci_bus->number, bridge->nr_slots, | ||
1329 | bridge->nr_slots == 1 ? "" : "s"); | ||
1177 | num_slots += bridge->nr_slots; | 1330 | num_slots += bridge->nr_slots; |
1178 | } | 1331 | } |
1179 | 1332 | ||
1180 | dbg("Total %dslots\n", num_slots); | 1333 | dbg("Total %d slots\n", num_slots); |
1181 | return num_slots; | 1334 | return num_slots; |
1182 | } | 1335 | } |
1183 | 1336 | ||
@@ -1254,7 +1407,6 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot) | |||
1254 | return retval; | 1407 | return retval; |
1255 | } | 1408 | } |
1256 | 1409 | ||
1257 | |||
1258 | /** | 1410 | /** |
1259 | * acpiphp_disable_slot - power off slot | 1411 | * acpiphp_disable_slot - power off slot |
1260 | */ | 1412 | */ |
@@ -1274,13 +1426,6 @@ int acpiphp_disable_slot(struct acpiphp_slot *slot) | |||
1274 | if (retval) | 1426 | if (retval) |
1275 | goto err_exit; | 1427 | goto err_exit; |
1276 | 1428 | ||
1277 | acpiphp_resource_sort_and_combine(&slot->bridge->io_head); | ||
1278 | acpiphp_resource_sort_and_combine(&slot->bridge->mem_head); | ||
1279 | acpiphp_resource_sort_and_combine(&slot->bridge->p_mem_head); | ||
1280 | acpiphp_resource_sort_and_combine(&slot->bridge->bus_head); | ||
1281 | dbg("Available resources:\n"); | ||
1282 | acpiphp_dump_resource(slot->bridge); | ||
1283 | |||
1284 | err_exit: | 1429 | err_exit: |
1285 | up(&slot->crit_sect); | 1430 | up(&slot->crit_sect); |
1286 | return retval; | 1431 | return retval; |
@@ -1293,11 +1438,7 @@ int acpiphp_disable_slot(struct acpiphp_slot *slot) | |||
1293 | */ | 1438 | */ |
1294 | u8 acpiphp_get_power_status(struct acpiphp_slot *slot) | 1439 | u8 acpiphp_get_power_status(struct acpiphp_slot *slot) |
1295 | { | 1440 | { |
1296 | unsigned int sta; | 1441 | return (slot->flags & SLOT_POWEREDON); |
1297 | |||
1298 | sta = get_slot_status(slot); | ||
1299 | |||
1300 | return (sta & ACPI_STA_ENABLED) ? 1 : 0; | ||
1301 | } | 1442 | } |
1302 | 1443 | ||
1303 | 1444 | ||
@@ -1335,9 +1476,10 @@ u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot) | |||
1335 | u32 acpiphp_get_address(struct acpiphp_slot *slot) | 1476 | u32 acpiphp_get_address(struct acpiphp_slot *slot) |
1336 | { | 1477 | { |
1337 | u32 address; | 1478 | u32 address; |
1479 | struct pci_bus *pci_bus = slot->bridge->pci_bus; | ||
1338 | 1480 | ||
1339 | address = ((slot->bridge->seg) << 16) | | 1481 | address = (pci_domain_nr(pci_bus) << 16) | |
1340 | ((slot->bridge->bus) << 8) | | 1482 | (pci_bus->number << 8) | |
1341 | slot->device; | 1483 | slot->device; |
1342 | 1484 | ||
1343 | return address; | 1485 | return address; |
diff --git a/drivers/pci/hotplug/acpiphp_pci.c b/drivers/pci/hotplug/acpiphp_pci.c deleted file mode 100644 index 54d97c9d1dff..000000000000 --- a/drivers/pci/hotplug/acpiphp_pci.c +++ /dev/null | |||
@@ -1,449 +0,0 @@ | |||
1 | /* | ||
2 | * ACPI PCI HotPlug PCI configuration space management | ||
3 | * | ||
4 | * Copyright (C) 1995,2001 Compaq Computer Corporation | ||
5 | * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com) | ||
6 | * Copyright (C) 2001,2002 IBM Corp. | ||
7 | * Copyright (C) 2002 Takayoshi Kochi (t-kochi@bq.jp.nec.com) | ||
8 | * Copyright (C) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) | ||
9 | * Copyright (C) 2002 NEC Corporation | ||
10 | * | ||
11 | * All rights reserved. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or (at | ||
16 | * your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, but | ||
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
21 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
22 | * details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, write to the Free Software | ||
26 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
27 | * | ||
28 | * Send feedback to <t-kochi@bq.jp.nec.com> | ||
29 | * | ||
30 | */ | ||
31 | |||
32 | #include <linux/init.h> | ||
33 | #include <linux/module.h> | ||
34 | |||
35 | #include <linux/kernel.h> | ||
36 | #include <linux/pci.h> | ||
37 | #include <linux/acpi.h> | ||
38 | #include "../pci.h" | ||
39 | #include "pci_hotplug.h" | ||
40 | #include "acpiphp.h" | ||
41 | |||
42 | #define MY_NAME "acpiphp_pci" | ||
43 | |||
44 | |||
45 | /* allocate mem/pmem/io resource to a new function */ | ||
46 | static int init_config_space (struct acpiphp_func *func) | ||
47 | { | ||
48 | u32 bar, len; | ||
49 | u32 address[] = { | ||
50 | PCI_BASE_ADDRESS_0, | ||
51 | PCI_BASE_ADDRESS_1, | ||
52 | PCI_BASE_ADDRESS_2, | ||
53 | PCI_BASE_ADDRESS_3, | ||
54 | PCI_BASE_ADDRESS_4, | ||
55 | PCI_BASE_ADDRESS_5, | ||
56 | 0 | ||
57 | }; | ||
58 | int count; | ||
59 | struct acpiphp_bridge *bridge; | ||
60 | struct pci_resource *res; | ||
61 | struct pci_bus *pbus; | ||
62 | int bus, device, function; | ||
63 | unsigned int devfn; | ||
64 | u16 tmp; | ||
65 | |||
66 | bridge = func->slot->bridge; | ||
67 | pbus = bridge->pci_bus; | ||
68 | bus = bridge->bus; | ||
69 | device = func->slot->device; | ||
70 | function = func->function; | ||
71 | devfn = PCI_DEVFN(device, function); | ||
72 | |||
73 | for (count = 0; address[count]; count++) { /* for 6 BARs */ | ||
74 | pci_bus_write_config_dword(pbus, devfn, | ||
75 | address[count], 0xFFFFFFFF); | ||
76 | pci_bus_read_config_dword(pbus, devfn, address[count], &bar); | ||
77 | |||
78 | if (!bar) /* This BAR is not implemented */ | ||
79 | continue; | ||
80 | |||
81 | dbg("Device %02x.%02x BAR %d wants %x\n", device, function, count, bar); | ||
82 | |||
83 | if (bar & PCI_BASE_ADDRESS_SPACE_IO) { | ||
84 | /* This is IO */ | ||
85 | |||
86 | len = bar & (PCI_BASE_ADDRESS_IO_MASK & 0xFFFF); | ||
87 | len = len & ~(len - 1); | ||
88 | |||
89 | dbg("len in IO %x, BAR %d\n", len, count); | ||
90 | |||
91 | spin_lock(&bridge->res_lock); | ||
92 | res = acpiphp_get_io_resource(&bridge->io_head, len); | ||
93 | spin_unlock(&bridge->res_lock); | ||
94 | |||
95 | if (!res) { | ||
96 | err("cannot allocate requested io for %02x:%02x.%d len %x\n", | ||
97 | bus, device, function, len); | ||
98 | return -1; | ||
99 | } | ||
100 | pci_bus_write_config_dword(pbus, devfn, | ||
101 | address[count], | ||
102 | (u32)res->base); | ||
103 | res->next = func->io_head; | ||
104 | func->io_head = res; | ||
105 | |||
106 | } else { | ||
107 | /* This is Memory */ | ||
108 | if (bar & PCI_BASE_ADDRESS_MEM_PREFETCH) { | ||
109 | /* pfmem */ | ||
110 | |||
111 | len = bar & 0xFFFFFFF0; | ||
112 | len = ~len + 1; | ||
113 | |||
114 | dbg("len in PFMEM %x, BAR %d\n", len, count); | ||
115 | |||
116 | spin_lock(&bridge->res_lock); | ||
117 | res = acpiphp_get_resource(&bridge->p_mem_head, len); | ||
118 | spin_unlock(&bridge->res_lock); | ||
119 | |||
120 | if (!res) { | ||
121 | err("cannot allocate requested pfmem for %02x:%02x.%d len %x\n", | ||
122 | bus, device, function, len); | ||
123 | return -1; | ||
124 | } | ||
125 | |||
126 | pci_bus_write_config_dword(pbus, devfn, | ||
127 | address[count], | ||
128 | (u32)res->base); | ||
129 | |||
130 | if (bar & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */ | ||
131 | dbg("inside the pfmem 64 case, count %d\n", count); | ||
132 | count += 1; | ||
133 | pci_bus_write_config_dword(pbus, devfn, | ||
134 | address[count], | ||
135 | (u32)(res->base >> 32)); | ||
136 | } | ||
137 | |||
138 | res->next = func->p_mem_head; | ||
139 | func->p_mem_head = res; | ||
140 | |||
141 | } else { | ||
142 | /* regular memory */ | ||
143 | |||
144 | len = bar & 0xFFFFFFF0; | ||
145 | len = ~len + 1; | ||
146 | |||
147 | dbg("len in MEM %x, BAR %d\n", len, count); | ||
148 | |||
149 | spin_lock(&bridge->res_lock); | ||
150 | res = acpiphp_get_resource(&bridge->mem_head, len); | ||
151 | spin_unlock(&bridge->res_lock); | ||
152 | |||
153 | if (!res) { | ||
154 | err("cannot allocate requested pfmem for %02x:%02x.%d len %x\n", | ||
155 | bus, device, function, len); | ||
156 | return -1; | ||
157 | } | ||
158 | |||
159 | pci_bus_write_config_dword(pbus, devfn, | ||
160 | address[count], | ||
161 | (u32)res->base); | ||
162 | |||
163 | if (bar & PCI_BASE_ADDRESS_MEM_TYPE_64) { | ||
164 | /* takes up another dword */ | ||
165 | dbg("inside mem 64 case, reg. mem, count %d\n", count); | ||
166 | count += 1; | ||
167 | pci_bus_write_config_dword(pbus, devfn, | ||
168 | address[count], | ||
169 | (u32)(res->base >> 32)); | ||
170 | } | ||
171 | |||
172 | res->next = func->mem_head; | ||
173 | func->mem_head = res; | ||
174 | |||
175 | } | ||
176 | } | ||
177 | } | ||
178 | |||
179 | /* disable expansion rom */ | ||
180 | pci_bus_write_config_dword(pbus, devfn, PCI_ROM_ADDRESS, 0x00000000); | ||
181 | |||
182 | /* set PCI parameters from _HPP */ | ||
183 | pci_bus_write_config_byte(pbus, devfn, PCI_CACHE_LINE_SIZE, | ||
184 | bridge->hpp.cache_line_size); | ||
185 | pci_bus_write_config_byte(pbus, devfn, PCI_LATENCY_TIMER, | ||
186 | bridge->hpp.latency_timer); | ||
187 | |||
188 | pci_bus_read_config_word(pbus, devfn, PCI_COMMAND, &tmp); | ||
189 | if (bridge->hpp.enable_SERR) | ||
190 | tmp |= PCI_COMMAND_SERR; | ||
191 | if (bridge->hpp.enable_PERR) | ||
192 | tmp |= PCI_COMMAND_PARITY; | ||
193 | pci_bus_write_config_word(pbus, devfn, PCI_COMMAND, tmp); | ||
194 | |||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | /* detect_used_resource - subtract resource under dev from bridge */ | ||
199 | static int detect_used_resource (struct acpiphp_bridge *bridge, struct pci_dev *dev) | ||
200 | { | ||
201 | int count; | ||
202 | |||
203 | dbg("Device %s\n", pci_name(dev)); | ||
204 | |||
205 | for (count = 0; count < DEVICE_COUNT_RESOURCE; count++) { | ||
206 | struct pci_resource *res; | ||
207 | struct pci_resource **head; | ||
208 | unsigned long base = dev->resource[count].start; | ||
209 | unsigned long len = dev->resource[count].end - base + 1; | ||
210 | unsigned long flags = dev->resource[count].flags; | ||
211 | |||
212 | if (!flags) | ||
213 | continue; | ||
214 | |||
215 | dbg("BAR[%d] 0x%lx - 0x%lx (0x%lx)\n", count, base, | ||
216 | base + len - 1, flags); | ||
217 | |||
218 | if (flags & IORESOURCE_IO) { | ||
219 | head = &bridge->io_head; | ||
220 | } else if (flags & IORESOURCE_PREFETCH) { | ||
221 | head = &bridge->p_mem_head; | ||
222 | } else { | ||
223 | head = &bridge->mem_head; | ||
224 | } | ||
225 | |||
226 | spin_lock(&bridge->res_lock); | ||
227 | res = acpiphp_get_resource_with_base(head, base, len); | ||
228 | spin_unlock(&bridge->res_lock); | ||
229 | if (res) | ||
230 | kfree(res); | ||
231 | } | ||
232 | |||
233 | return 0; | ||
234 | } | ||
235 | |||
236 | |||
237 | /** | ||
238 | * acpiphp_detect_pci_resource - detect resources under bridge | ||
239 | * @bridge: detect all resources already used under this bridge | ||
240 | * | ||
241 | * collect all resources already allocated for all devices under a bridge. | ||
242 | */ | ||
243 | int acpiphp_detect_pci_resource (struct acpiphp_bridge *bridge) | ||
244 | { | ||
245 | struct list_head *l; | ||
246 | struct pci_dev *dev; | ||
247 | |||
248 | list_for_each (l, &bridge->pci_bus->devices) { | ||
249 | dev = pci_dev_b(l); | ||
250 | detect_used_resource(bridge, dev); | ||
251 | } | ||
252 | |||
253 | return 0; | ||
254 | } | ||
255 | |||
256 | |||
257 | /** | ||
258 | * acpiphp_init_slot_resource - gather resource usage information of a slot | ||
259 | * @slot: ACPI slot object to be checked, should have valid pci_dev member | ||
260 | * | ||
261 | * TBD: PCI-to-PCI bridge case | ||
262 | * use pci_dev->resource[] | ||
263 | */ | ||
264 | int acpiphp_init_func_resource (struct acpiphp_func *func) | ||
265 | { | ||
266 | u64 base; | ||
267 | u32 bar, len; | ||
268 | u32 address[] = { | ||
269 | PCI_BASE_ADDRESS_0, | ||
270 | PCI_BASE_ADDRESS_1, | ||
271 | PCI_BASE_ADDRESS_2, | ||
272 | PCI_BASE_ADDRESS_3, | ||
273 | PCI_BASE_ADDRESS_4, | ||
274 | PCI_BASE_ADDRESS_5, | ||
275 | 0 | ||
276 | }; | ||
277 | int count; | ||
278 | struct pci_resource *res; | ||
279 | struct pci_dev *dev; | ||
280 | |||
281 | dev = func->pci_dev; | ||
282 | dbg("Hot-pluggable device %s\n", pci_name(dev)); | ||
283 | |||
284 | for (count = 0; address[count]; count++) { /* for 6 BARs */ | ||
285 | pci_read_config_dword(dev, address[count], &bar); | ||
286 | |||
287 | if (!bar) /* This BAR is not implemented */ | ||
288 | continue; | ||
289 | |||
290 | pci_write_config_dword(dev, address[count], 0xFFFFFFFF); | ||
291 | pci_read_config_dword(dev, address[count], &len); | ||
292 | |||
293 | if (len & PCI_BASE_ADDRESS_SPACE_IO) { | ||
294 | /* This is IO */ | ||
295 | base = bar & 0xFFFFFFFC; | ||
296 | len = len & (PCI_BASE_ADDRESS_IO_MASK & 0xFFFF); | ||
297 | len = len & ~(len - 1); | ||
298 | |||
299 | dbg("BAR[%d] %08x - %08x (IO)\n", count, (u32)base, (u32)base + len - 1); | ||
300 | |||
301 | res = acpiphp_make_resource(base, len); | ||
302 | if (!res) | ||
303 | goto no_memory; | ||
304 | |||
305 | res->next = func->io_head; | ||
306 | func->io_head = res; | ||
307 | |||
308 | } else { | ||
309 | /* This is Memory */ | ||
310 | base = bar & 0xFFFFFFF0; | ||
311 | if (len & PCI_BASE_ADDRESS_MEM_PREFETCH) { | ||
312 | /* pfmem */ | ||
313 | |||
314 | len &= 0xFFFFFFF0; | ||
315 | len = ~len + 1; | ||
316 | |||
317 | if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) { /* takes up another dword */ | ||
318 | dbg("prefetch mem 64\n"); | ||
319 | count += 1; | ||
320 | } | ||
321 | dbg("BAR[%d] %08x - %08x (PMEM)\n", count, (u32)base, (u32)base + len - 1); | ||
322 | res = acpiphp_make_resource(base, len); | ||
323 | if (!res) | ||
324 | goto no_memory; | ||
325 | |||
326 | res->next = func->p_mem_head; | ||
327 | func->p_mem_head = res; | ||
328 | |||
329 | } else { | ||
330 | /* regular memory */ | ||
331 | |||
332 | len &= 0xFFFFFFF0; | ||
333 | len = ~len + 1; | ||
334 | |||
335 | if (len & PCI_BASE_ADDRESS_MEM_TYPE_64) { | ||
336 | /* takes up another dword */ | ||
337 | dbg("mem 64\n"); | ||
338 | count += 1; | ||
339 | } | ||
340 | dbg("BAR[%d] %08x - %08x (MEM)\n", count, (u32)base, (u32)base + len - 1); | ||
341 | res = acpiphp_make_resource(base, len); | ||
342 | if (!res) | ||
343 | goto no_memory; | ||
344 | |||
345 | res->next = func->mem_head; | ||
346 | func->mem_head = res; | ||
347 | |||
348 | } | ||
349 | } | ||
350 | |||
351 | pci_write_config_dword(dev, address[count], bar); | ||
352 | } | ||
353 | #if 1 | ||
354 | acpiphp_dump_func_resource(func); | ||
355 | #endif | ||
356 | |||
357 | return 0; | ||
358 | |||
359 | no_memory: | ||
360 | err("out of memory\n"); | ||
361 | acpiphp_free_resource(&func->io_head); | ||
362 | acpiphp_free_resource(&func->mem_head); | ||
363 | acpiphp_free_resource(&func->p_mem_head); | ||
364 | |||
365 | return -1; | ||
366 | } | ||
367 | |||
368 | |||
369 | /** | ||
370 | * acpiphp_configure_slot - allocate PCI resources | ||
371 | * @slot: slot to be configured | ||
372 | * | ||
373 | * initializes a PCI functions on a device inserted | ||
374 | * into the slot | ||
375 | * | ||
376 | */ | ||
377 | int acpiphp_configure_slot (struct acpiphp_slot *slot) | ||
378 | { | ||
379 | struct acpiphp_func *func; | ||
380 | struct list_head *l; | ||
381 | u8 hdr; | ||
382 | u32 dvid; | ||
383 | int retval = 0; | ||
384 | int is_multi = 0; | ||
385 | |||
386 | pci_bus_read_config_byte(slot->bridge->pci_bus, | ||
387 | PCI_DEVFN(slot->device, 0), | ||
388 | PCI_HEADER_TYPE, &hdr); | ||
389 | |||
390 | if (hdr & 0x80) | ||
391 | is_multi = 1; | ||
392 | |||
393 | list_for_each (l, &slot->funcs) { | ||
394 | func = list_entry(l, struct acpiphp_func, sibling); | ||
395 | if (is_multi || func->function == 0) { | ||
396 | pci_bus_read_config_dword(slot->bridge->pci_bus, | ||
397 | PCI_DEVFN(slot->device, | ||
398 | func->function), | ||
399 | PCI_VENDOR_ID, &dvid); | ||
400 | if (dvid != 0xffffffff) { | ||
401 | retval = init_config_space(func); | ||
402 | if (retval) | ||
403 | break; | ||
404 | } | ||
405 | } | ||
406 | } | ||
407 | |||
408 | return retval; | ||
409 | } | ||
410 | |||
411 | /** | ||
412 | * acpiphp_configure_function - configure PCI function | ||
413 | * @func: function to be configured | ||
414 | * | ||
415 | * initializes a PCI functions on a device inserted | ||
416 | * into the slot | ||
417 | * | ||
418 | */ | ||
419 | int acpiphp_configure_function (struct acpiphp_func *func) | ||
420 | { | ||
421 | /* all handled by the pci core now */ | ||
422 | return 0; | ||
423 | } | ||
424 | |||
425 | /** | ||
426 | * acpiphp_unconfigure_function - unconfigure PCI function | ||
427 | * @func: function to be unconfigured | ||
428 | * | ||
429 | */ | ||
430 | void acpiphp_unconfigure_function (struct acpiphp_func *func) | ||
431 | { | ||
432 | struct acpiphp_bridge *bridge; | ||
433 | |||
434 | /* if pci_dev is NULL, ignore it */ | ||
435 | if (!func->pci_dev) | ||
436 | return; | ||
437 | |||
438 | pci_remove_bus_device(func->pci_dev); | ||
439 | |||
440 | /* free all resources */ | ||
441 | bridge = func->slot->bridge; | ||
442 | |||
443 | spin_lock(&bridge->res_lock); | ||
444 | acpiphp_move_resource(&func->io_head, &bridge->io_head); | ||
445 | acpiphp_move_resource(&func->mem_head, &bridge->mem_head); | ||
446 | acpiphp_move_resource(&func->p_mem_head, &bridge->p_mem_head); | ||
447 | acpiphp_move_resource(&func->bus_head, &bridge->bus_head); | ||
448 | spin_unlock(&bridge->res_lock); | ||
449 | } | ||
diff --git a/drivers/pci/hotplug/acpiphp_res.c b/drivers/pci/hotplug/acpiphp_res.c deleted file mode 100644 index f54b1fa7b75a..000000000000 --- a/drivers/pci/hotplug/acpiphp_res.c +++ /dev/null | |||
@@ -1,700 +0,0 @@ | |||
1 | /* | ||
2 | * ACPI PCI HotPlug Utility functions | ||
3 | * | ||
4 | * Copyright (C) 1995,2001 Compaq Computer Corporation | ||
5 | * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com) | ||
6 | * Copyright (C) 2001 IBM Corp. | ||
7 | * Copyright (C) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) | ||
8 | * Copyright (C) 2002 Takayoshi Kochi (t-kochi@bq.jp.nec.com) | ||
9 | * Copyright (C) 2002 NEC Corporation | ||
10 | * | ||
11 | * All rights reserved. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or (at | ||
16 | * your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, but | ||
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
21 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
22 | * details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, write to the Free Software | ||
26 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
27 | * | ||
28 | * Send feedback to <gregkh@us.ibm.com>, <t-kochi@bq.jp.nec.com> | ||
29 | * | ||
30 | */ | ||
31 | |||
32 | #include <linux/init.h> | ||
33 | #include <linux/module.h> | ||
34 | |||
35 | #include <linux/kernel.h> | ||
36 | #include <linux/types.h> | ||
37 | #include <linux/proc_fs.h> | ||
38 | #include <linux/sysctl.h> | ||
39 | #include <linux/pci.h> | ||
40 | #include <linux/smp.h> | ||
41 | #include <linux/smp_lock.h> | ||
42 | |||
43 | #include <linux/string.h> | ||
44 | #include <linux/mm.h> | ||
45 | #include <linux/errno.h> | ||
46 | #include <linux/ioport.h> | ||
47 | #include <linux/slab.h> | ||
48 | #include <linux/interrupt.h> | ||
49 | #include <linux/timer.h> | ||
50 | |||
51 | #include <linux/ioctl.h> | ||
52 | #include <linux/fcntl.h> | ||
53 | |||
54 | #include <linux/list.h> | ||
55 | |||
56 | #include "pci_hotplug.h" | ||
57 | #include "acpiphp.h" | ||
58 | |||
59 | #define MY_NAME "acpiphp_res" | ||
60 | |||
61 | |||
62 | /* | ||
63 | * sort_by_size - sort nodes by their length, smallest first | ||
64 | */ | ||
65 | static int sort_by_size(struct pci_resource **head) | ||
66 | { | ||
67 | struct pci_resource *current_res; | ||
68 | struct pci_resource *next_res; | ||
69 | int out_of_order = 1; | ||
70 | |||
71 | if (!(*head)) | ||
72 | return 1; | ||
73 | |||
74 | if (!((*head)->next)) | ||
75 | return 0; | ||
76 | |||
77 | while (out_of_order) { | ||
78 | out_of_order = 0; | ||
79 | |||
80 | /* Special case for swapping list head */ | ||
81 | if (((*head)->next) && | ||
82 | ((*head)->length > (*head)->next->length)) { | ||
83 | out_of_order++; | ||
84 | current_res = *head; | ||
85 | *head = (*head)->next; | ||
86 | current_res->next = (*head)->next; | ||
87 | (*head)->next = current_res; | ||
88 | } | ||
89 | |||
90 | current_res = *head; | ||
91 | |||
92 | while (current_res->next && current_res->next->next) { | ||
93 | if (current_res->next->length > current_res->next->next->length) { | ||
94 | out_of_order++; | ||
95 | next_res = current_res->next; | ||
96 | current_res->next = current_res->next->next; | ||
97 | current_res = current_res->next; | ||
98 | next_res->next = current_res->next; | ||
99 | current_res->next = next_res; | ||
100 | } else | ||
101 | current_res = current_res->next; | ||
102 | } | ||
103 | } /* End of out_of_order loop */ | ||
104 | |||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | #if 0 | ||
109 | /* | ||
110 | * sort_by_max_size - sort nodes by their length, largest first | ||
111 | */ | ||
112 | static int sort_by_max_size(struct pci_resource **head) | ||
113 | { | ||
114 | struct pci_resource *current_res; | ||
115 | struct pci_resource *next_res; | ||
116 | int out_of_order = 1; | ||
117 | |||
118 | if (!(*head)) | ||
119 | return 1; | ||
120 | |||
121 | if (!((*head)->next)) | ||
122 | return 0; | ||
123 | |||
124 | while (out_of_order) { | ||
125 | out_of_order = 0; | ||
126 | |||
127 | /* Special case for swapping list head */ | ||
128 | if (((*head)->next) && | ||
129 | ((*head)->length < (*head)->next->length)) { | ||
130 | out_of_order++; | ||
131 | current_res = *head; | ||
132 | *head = (*head)->next; | ||
133 | current_res->next = (*head)->next; | ||
134 | (*head)->next = current_res; | ||
135 | } | ||
136 | |||
137 | current_res = *head; | ||
138 | |||
139 | while (current_res->next && current_res->next->next) { | ||
140 | if (current_res->next->length < current_res->next->next->length) { | ||
141 | out_of_order++; | ||
142 | next_res = current_res->next; | ||
143 | current_res->next = current_res->next->next; | ||
144 | current_res = current_res->next; | ||
145 | next_res->next = current_res->next; | ||
146 | current_res->next = next_res; | ||
147 | } else | ||
148 | current_res = current_res->next; | ||
149 | } | ||
150 | } /* End of out_of_order loop */ | ||
151 | |||
152 | return 0; | ||
153 | } | ||
154 | #endif | ||
155 | |||
156 | /** | ||
157 | * get_io_resource - get resource for I/O ports | ||
158 | * | ||
159 | * this function sorts the resource list by size and then | ||
160 | * returns the first node of "size" length that is not in the | ||
161 | * ISA aliasing window. If it finds a node larger than "size" | ||
162 | * it will split it up. | ||
163 | * | ||
164 | * size must be a power of two. | ||
165 | * | ||
166 | * difference from get_resource is handling of ISA aliasing space. | ||
167 | * | ||
168 | */ | ||
169 | struct pci_resource *acpiphp_get_io_resource (struct pci_resource **head, u32 size) | ||
170 | { | ||
171 | struct pci_resource *prevnode; | ||
172 | struct pci_resource *node; | ||
173 | struct pci_resource *split_node; | ||
174 | u64 temp_qword; | ||
175 | |||
176 | if (!(*head)) | ||
177 | return NULL; | ||
178 | |||
179 | if (acpiphp_resource_sort_and_combine(head)) | ||
180 | return NULL; | ||
181 | |||
182 | if (sort_by_size(head)) | ||
183 | return NULL; | ||
184 | |||
185 | for (node = *head; node; node = node->next) { | ||
186 | if (node->length < size) | ||
187 | continue; | ||
188 | |||
189 | if (node->base & (size - 1)) { | ||
190 | /* this one isn't base aligned properly | ||
191 | so we'll make a new entry and split it up */ | ||
192 | temp_qword = (node->base | (size-1)) + 1; | ||
193 | |||
194 | /* Short circuit if adjusted size is too small */ | ||
195 | if ((node->length - (temp_qword - node->base)) < size) | ||
196 | continue; | ||
197 | |||
198 | split_node = acpiphp_make_resource(node->base, temp_qword - node->base); | ||
199 | |||
200 | if (!split_node) | ||
201 | return NULL; | ||
202 | |||
203 | node->base = temp_qword; | ||
204 | node->length -= split_node->length; | ||
205 | |||
206 | /* Put it in the list */ | ||
207 | split_node->next = node->next; | ||
208 | node->next = split_node; | ||
209 | } /* End of non-aligned base */ | ||
210 | |||
211 | /* Don't need to check if too small since we already did */ | ||
212 | if (node->length > size) { | ||
213 | /* this one is longer than we need | ||
214 | so we'll make a new entry and split it up */ | ||
215 | split_node = acpiphp_make_resource(node->base + size, node->length - size); | ||
216 | |||
217 | if (!split_node) | ||
218 | return NULL; | ||
219 | |||
220 | node->length = size; | ||
221 | |||
222 | /* Put it in the list */ | ||
223 | split_node->next = node->next; | ||
224 | node->next = split_node; | ||
225 | } /* End of too big on top end */ | ||
226 | |||
227 | /* For IO make sure it's not in the ISA aliasing space */ | ||
228 | if ((node->base & 0x300L) && !(node->base & 0xfffff000)) | ||
229 | continue; | ||
230 | |||
231 | /* If we got here, then it is the right size | ||
232 | Now take it out of the list */ | ||
233 | if (*head == node) { | ||
234 | *head = node->next; | ||
235 | } else { | ||
236 | prevnode = *head; | ||
237 | while (prevnode->next != node) | ||
238 | prevnode = prevnode->next; | ||
239 | |||
240 | prevnode->next = node->next; | ||
241 | } | ||
242 | node->next = NULL; | ||
243 | /* Stop looping */ | ||
244 | break; | ||
245 | } | ||
246 | |||
247 | return node; | ||
248 | } | ||
249 | |||
250 | |||
251 | #if 0 | ||
252 | /** | ||
253 | * get_max_resource - get the largest resource | ||
254 | * | ||
255 | * Gets the largest node that is at least "size" big from the | ||
256 | * list pointed to by head. It aligns the node on top and bottom | ||
257 | * to "size" alignment before returning it. | ||
258 | */ | ||
259 | static struct pci_resource *acpiphp_get_max_resource (struct pci_resource **head, u32 size) | ||
260 | { | ||
261 | struct pci_resource *max; | ||
262 | struct pci_resource *temp; | ||
263 | struct pci_resource *split_node; | ||
264 | u64 temp_qword; | ||
265 | |||
266 | if (!(*head)) | ||
267 | return NULL; | ||
268 | |||
269 | if (acpiphp_resource_sort_and_combine(head)) | ||
270 | return NULL; | ||
271 | |||
272 | if (sort_by_max_size(head)) | ||
273 | return NULL; | ||
274 | |||
275 | for (max = *head;max; max = max->next) { | ||
276 | |||
277 | /* If not big enough we could probably just bail, | ||
278 | instead we'll continue to the next. */ | ||
279 | if (max->length < size) | ||
280 | continue; | ||
281 | |||
282 | if (max->base & (size - 1)) { | ||
283 | /* this one isn't base aligned properly | ||
284 | so we'll make a new entry and split it up */ | ||
285 | temp_qword = (max->base | (size-1)) + 1; | ||
286 | |||
287 | /* Short circuit if adjusted size is too small */ | ||
288 | if ((max->length - (temp_qword - max->base)) < size) | ||
289 | continue; | ||
290 | |||
291 | split_node = acpiphp_make_resource(max->base, temp_qword - max->base); | ||
292 | |||
293 | if (!split_node) | ||
294 | return NULL; | ||
295 | |||
296 | max->base = temp_qword; | ||
297 | max->length -= split_node->length; | ||
298 | |||
299 | /* Put it next in the list */ | ||
300 | split_node->next = max->next; | ||
301 | max->next = split_node; | ||
302 | } | ||
303 | |||
304 | if ((max->base + max->length) & (size - 1)) { | ||
305 | /* this one isn't end aligned properly at the top | ||
306 | so we'll make a new entry and split it up */ | ||
307 | temp_qword = ((max->base + max->length) & ~(size - 1)); | ||
308 | |||
309 | split_node = acpiphp_make_resource(temp_qword, | ||
310 | max->length + max->base - temp_qword); | ||
311 | |||
312 | if (!split_node) | ||
313 | return NULL; | ||
314 | |||
315 | max->length -= split_node->length; | ||
316 | |||
317 | /* Put it in the list */ | ||
318 | split_node->next = max->next; | ||
319 | max->next = split_node; | ||
320 | } | ||
321 | |||
322 | /* Make sure it didn't shrink too much when we aligned it */ | ||
323 | if (max->length < size) | ||
324 | continue; | ||
325 | |||
326 | /* Now take it out of the list */ | ||
327 | temp = (struct pci_resource*) *head; | ||
328 | if (temp == max) { | ||
329 | *head = max->next; | ||
330 | } else { | ||
331 | while (temp && temp->next != max) { | ||
332 | temp = temp->next; | ||
333 | } | ||
334 | |||
335 | temp->next = max->next; | ||
336 | } | ||
337 | |||
338 | max->next = NULL; | ||
339 | return max; | ||
340 | } | ||
341 | |||
342 | /* If we get here, we couldn't find one */ | ||
343 | return NULL; | ||
344 | } | ||
345 | #endif | ||
346 | |||
347 | /** | ||
348 | * get_resource - get resource (mem, pfmem) | ||
349 | * | ||
350 | * this function sorts the resource list by size and then | ||
351 | * returns the first node of "size" length. If it finds a node | ||
352 | * larger than "size" it will split it up. | ||
353 | * | ||
354 | * size must be a power of two. | ||
355 | * | ||
356 | */ | ||
357 | struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size) | ||
358 | { | ||
359 | struct pci_resource *prevnode; | ||
360 | struct pci_resource *node; | ||
361 | struct pci_resource *split_node; | ||
362 | u64 temp_qword; | ||
363 | |||
364 | if (!(*head)) | ||
365 | return NULL; | ||
366 | |||
367 | if (acpiphp_resource_sort_and_combine(head)) | ||
368 | return NULL; | ||
369 | |||
370 | if (sort_by_size(head)) | ||
371 | return NULL; | ||
372 | |||
373 | for (node = *head; node; node = node->next) { | ||
374 | dbg("%s: req_size =%x node=%p, base=%x, length=%x\n", | ||
375 | __FUNCTION__, size, node, (u32)node->base, node->length); | ||
376 | if (node->length < size) | ||
377 | continue; | ||
378 | |||
379 | if (node->base & (size - 1)) { | ||
380 | dbg("%s: not aligned\n", __FUNCTION__); | ||
381 | /* this one isn't base aligned properly | ||
382 | so we'll make a new entry and split it up */ | ||
383 | temp_qword = (node->base | (size-1)) + 1; | ||
384 | |||
385 | /* Short circuit if adjusted size is too small */ | ||
386 | if ((node->length - (temp_qword - node->base)) < size) | ||
387 | continue; | ||
388 | |||
389 | split_node = acpiphp_make_resource(node->base, temp_qword - node->base); | ||
390 | |||
391 | if (!split_node) | ||
392 | return NULL; | ||
393 | |||
394 | node->base = temp_qword; | ||
395 | node->length -= split_node->length; | ||
396 | |||
397 | /* Put it in the list */ | ||
398 | split_node->next = node->next; | ||
399 | node->next = split_node; | ||
400 | } /* End of non-aligned base */ | ||
401 | |||
402 | /* Don't need to check if too small since we already did */ | ||
403 | if (node->length > size) { | ||
404 | dbg("%s: too big\n", __FUNCTION__); | ||
405 | /* this one is longer than we need | ||
406 | so we'll make a new entry and split it up */ | ||
407 | split_node = acpiphp_make_resource(node->base + size, node->length - size); | ||
408 | |||
409 | if (!split_node) | ||
410 | return NULL; | ||
411 | |||
412 | node->length = size; | ||
413 | |||
414 | /* Put it in the list */ | ||
415 | split_node->next = node->next; | ||
416 | node->next = split_node; | ||
417 | } /* End of too big on top end */ | ||
418 | |||
419 | dbg("%s: got one!!!\n", __FUNCTION__); | ||
420 | /* If we got here, then it is the right size | ||
421 | Now take it out of the list */ | ||
422 | if (*head == node) { | ||
423 | *head = node->next; | ||
424 | } else { | ||
425 | prevnode = *head; | ||
426 | while (prevnode->next != node) | ||
427 | prevnode = prevnode->next; | ||
428 | |||
429 | prevnode->next = node->next; | ||
430 | } | ||
431 | node->next = NULL; | ||
432 | /* Stop looping */ | ||
433 | break; | ||
434 | } | ||
435 | return node; | ||
436 | } | ||
437 | |||
438 | /** | ||
439 | * get_resource_with_base - get resource with specific base address | ||
440 | * | ||
441 | * this function | ||
442 | * returns the first node of "size" length located at specified base address. | ||
443 | * If it finds a node larger than "size" it will split it up. | ||
444 | * | ||
445 | * size must be a power of two. | ||
446 | * | ||
447 | */ | ||
448 | struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head, u64 base, u32 size) | ||
449 | { | ||
450 | struct pci_resource *prevnode; | ||
451 | struct pci_resource *node; | ||
452 | struct pci_resource *split_node; | ||
453 | u64 temp_qword; | ||
454 | |||
455 | if (!(*head)) | ||
456 | return NULL; | ||
457 | |||
458 | if (acpiphp_resource_sort_and_combine(head)) | ||
459 | return NULL; | ||
460 | |||
461 | for (node = *head; node; node = node->next) { | ||
462 | dbg(": 1st req_base=%x req_size =%x node=%p, base=%x, length=%x\n", | ||
463 | (u32)base, size, node, (u32)node->base, node->length); | ||
464 | if (node->base > base) | ||
465 | continue; | ||
466 | |||
467 | if ((node->base + node->length) < (base + size)) | ||
468 | continue; | ||
469 | |||
470 | if (node->base < base) { | ||
471 | dbg(": split 1\n"); | ||
472 | /* this one isn't base aligned properly | ||
473 | so we'll make a new entry and split it up */ | ||
474 | temp_qword = base; | ||
475 | |||
476 | /* Short circuit if adjusted size is too small */ | ||
477 | if ((node->length - (temp_qword - node->base)) < size) | ||
478 | continue; | ||
479 | |||
480 | split_node = acpiphp_make_resource(node->base, temp_qword - node->base); | ||
481 | |||
482 | if (!split_node) | ||
483 | return NULL; | ||
484 | |||
485 | node->base = temp_qword; | ||
486 | node->length -= split_node->length; | ||
487 | |||
488 | /* Put it in the list */ | ||
489 | split_node->next = node->next; | ||
490 | node->next = split_node; | ||
491 | } | ||
492 | |||
493 | dbg(": 2nd req_base=%x req_size =%x node=%p, base=%x, length=%x\n", | ||
494 | (u32)base, size, node, (u32)node->base, node->length); | ||
495 | |||
496 | /* Don't need to check if too small since we already did */ | ||
497 | if (node->length > size) { | ||
498 | dbg(": split 2\n"); | ||
499 | /* this one is longer than we need | ||
500 | so we'll make a new entry and split it up */ | ||
501 | split_node = acpiphp_make_resource(node->base + size, node->length - size); | ||
502 | |||
503 | if (!split_node) | ||
504 | return NULL; | ||
505 | |||
506 | node->length = size; | ||
507 | |||
508 | /* Put it in the list */ | ||
509 | split_node->next = node->next; | ||
510 | node->next = split_node; | ||
511 | } /* End of too big on top end */ | ||
512 | |||
513 | dbg(": got one!!!\n"); | ||
514 | /* If we got here, then it is the right size | ||
515 | Now take it out of the list */ | ||
516 | if (*head == node) { | ||
517 | *head = node->next; | ||
518 | } else { | ||
519 | prevnode = *head; | ||
520 | while (prevnode->next != node) | ||
521 | prevnode = prevnode->next; | ||
522 | |||
523 | prevnode->next = node->next; | ||
524 | } | ||
525 | node->next = NULL; | ||
526 | /* Stop looping */ | ||
527 | break; | ||
528 | } | ||
529 | return node; | ||
530 | } | ||
531 | |||
532 | |||
533 | /** | ||
534 | * acpiphp_resource_sort_and_combine | ||
535 | * | ||
536 | * Sorts all of the nodes in the list in ascending order by | ||
537 | * their base addresses. Also does garbage collection by | ||
538 | * combining adjacent nodes. | ||
539 | * | ||
540 | * returns 0 if success | ||
541 | */ | ||
542 | int acpiphp_resource_sort_and_combine (struct pci_resource **head) | ||
543 | { | ||
544 | struct pci_resource *node1; | ||
545 | struct pci_resource *node2; | ||
546 | int out_of_order = 1; | ||
547 | |||
548 | if (!(*head)) | ||
549 | return 1; | ||
550 | |||
551 | dbg("*head->next = %p\n",(*head)->next); | ||
552 | |||
553 | if (!(*head)->next) | ||
554 | return 0; /* only one item on the list, already sorted! */ | ||
555 | |||
556 | dbg("*head->base = 0x%x\n",(u32)(*head)->base); | ||
557 | dbg("*head->next->base = 0x%x\n", (u32)(*head)->next->base); | ||
558 | while (out_of_order) { | ||
559 | out_of_order = 0; | ||
560 | |||
561 | /* Special case for swapping list head */ | ||
562 | if (((*head)->next) && | ||
563 | ((*head)->base > (*head)->next->base)) { | ||
564 | node1 = *head; | ||
565 | (*head) = (*head)->next; | ||
566 | node1->next = (*head)->next; | ||
567 | (*head)->next = node1; | ||
568 | out_of_order++; | ||
569 | } | ||
570 | |||
571 | node1 = (*head); | ||
572 | |||
573 | while (node1->next && node1->next->next) { | ||
574 | if (node1->next->base > node1->next->next->base) { | ||
575 | out_of_order++; | ||
576 | node2 = node1->next; | ||
577 | node1->next = node1->next->next; | ||
578 | node1 = node1->next; | ||
579 | node2->next = node1->next; | ||
580 | node1->next = node2; | ||
581 | } else | ||
582 | node1 = node1->next; | ||
583 | } | ||
584 | } /* End of out_of_order loop */ | ||
585 | |||
586 | node1 = *head; | ||
587 | |||
588 | while (node1 && node1->next) { | ||
589 | if ((node1->base + node1->length) == node1->next->base) { | ||
590 | /* Combine */ | ||
591 | dbg("8..\n"); | ||
592 | node1->length += node1->next->length; | ||
593 | node2 = node1->next; | ||
594 | node1->next = node1->next->next; | ||
595 | kfree(node2); | ||
596 | } else | ||
597 | node1 = node1->next; | ||
598 | } | ||
599 | |||
600 | return 0; | ||
601 | } | ||
602 | |||
603 | |||
604 | /** | ||
605 | * acpiphp_make_resource - make resource structure | ||
606 | * @base: base address of a resource | ||
607 | * @length: length of a resource | ||
608 | */ | ||
609 | struct pci_resource *acpiphp_make_resource (u64 base, u32 length) | ||
610 | { | ||
611 | struct pci_resource *res; | ||
612 | |||
613 | res = kmalloc(sizeof(struct pci_resource), GFP_KERNEL); | ||
614 | if (res) { | ||
615 | memset(res, 0, sizeof(struct pci_resource)); | ||
616 | res->base = base; | ||
617 | res->length = length; | ||
618 | } | ||
619 | |||
620 | return res; | ||
621 | } | ||
622 | |||
623 | |||
624 | /** | ||
625 | * acpiphp_move_resource - move linked resources from one to another | ||
626 | * @from: head of linked resource list | ||
627 | * @to: head of linked resource list | ||
628 | */ | ||
629 | void acpiphp_move_resource (struct pci_resource **from, struct pci_resource **to) | ||
630 | { | ||
631 | struct pci_resource *tmp; | ||
632 | |||
633 | while (*from) { | ||
634 | tmp = (*from)->next; | ||
635 | (*from)->next = *to; | ||
636 | *to = *from; | ||
637 | *from = tmp; | ||
638 | } | ||
639 | |||
640 | /* *from = NULL is guaranteed */ | ||
641 | } | ||
642 | |||
643 | |||
644 | /** | ||
645 | * acpiphp_free_resource - free all linked resources | ||
646 | * @res: head of linked resource list | ||
647 | */ | ||
648 | void acpiphp_free_resource (struct pci_resource **res) | ||
649 | { | ||
650 | struct pci_resource *tmp; | ||
651 | |||
652 | while (*res) { | ||
653 | tmp = (*res)->next; | ||
654 | kfree(*res); | ||
655 | *res = tmp; | ||
656 | } | ||
657 | |||
658 | /* *res = NULL is guaranteed */ | ||
659 | } | ||
660 | |||
661 | |||
662 | /* debug support functions; will go away sometime :) */ | ||
663 | static void dump_resource(struct pci_resource *head) | ||
664 | { | ||
665 | struct pci_resource *p; | ||
666 | int cnt; | ||
667 | |||
668 | p = head; | ||
669 | cnt = 0; | ||
670 | |||
671 | while (p) { | ||
672 | dbg("[%02d] %08x - %08x\n", | ||
673 | cnt++, (u32)p->base, (u32)p->base + p->length - 1); | ||
674 | p = p->next; | ||
675 | } | ||
676 | } | ||
677 | |||
678 | void acpiphp_dump_resource(struct acpiphp_bridge *bridge) | ||
679 | { | ||
680 | dbg("I/O resource:\n"); | ||
681 | dump_resource(bridge->io_head); | ||
682 | dbg("MEM resource:\n"); | ||
683 | dump_resource(bridge->mem_head); | ||
684 | dbg("PMEM resource:\n"); | ||
685 | dump_resource(bridge->p_mem_head); | ||
686 | dbg("BUS resource:\n"); | ||
687 | dump_resource(bridge->bus_head); | ||
688 | } | ||
689 | |||
690 | void acpiphp_dump_func_resource(struct acpiphp_func *func) | ||
691 | { | ||
692 | dbg("I/O resource:\n"); | ||
693 | dump_resource(func->io_head); | ||
694 | dbg("MEM resource:\n"); | ||
695 | dump_resource(func->mem_head); | ||
696 | dbg("PMEM resource:\n"); | ||
697 | dump_resource(func->p_mem_head); | ||
698 | dbg("BUS resource:\n"); | ||
699 | dump_resource(func->bus_head); | ||
700 | } | ||
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index afbccfa5217d..8c6d3987d461 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c | |||
@@ -60,6 +60,7 @@ static void __iomem *smbios_start; | |||
60 | static void __iomem *cpqhp_rom_start; | 60 | static void __iomem *cpqhp_rom_start; |
61 | static int power_mode; | 61 | static int power_mode; |
62 | static int debug; | 62 | static int debug; |
63 | static int initialized; | ||
63 | 64 | ||
64 | #define DRIVER_VERSION "0.9.8" | 65 | #define DRIVER_VERSION "0.9.8" |
65 | #define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>" | 66 | #define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>" |
@@ -1271,7 +1272,6 @@ static int one_time_init(void) | |||
1271 | { | 1272 | { |
1272 | int loop; | 1273 | int loop; |
1273 | int retval = 0; | 1274 | int retval = 0; |
1274 | static int initialized = 0; | ||
1275 | 1275 | ||
1276 | if (initialized) | 1276 | if (initialized) |
1277 | return 0; | 1277 | return 0; |
@@ -1441,7 +1441,8 @@ static void __exit unload_cpqphpd(void) | |||
1441 | } | 1441 | } |
1442 | 1442 | ||
1443 | // Stop the notification mechanism | 1443 | // Stop the notification mechanism |
1444 | cpqhp_event_stop_thread(); | 1444 | if (initialized) |
1445 | cpqhp_event_stop_thread(); | ||
1445 | 1446 | ||
1446 | //unmap the rom address | 1447 | //unmap the rom address |
1447 | if (cpqhp_rom_start) | 1448 | if (cpqhp_rom_start) |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 30206ac43c44..b5ab9aa6ff7c 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -28,10 +28,10 @@ static struct msi_desc* msi_desc[NR_IRQS] = { [0 ... NR_IRQS-1] = NULL }; | |||
28 | static kmem_cache_t* msi_cachep; | 28 | static kmem_cache_t* msi_cachep; |
29 | 29 | ||
30 | static int pci_msi_enable = 1; | 30 | static int pci_msi_enable = 1; |
31 | static int last_alloc_vector = 0; | 31 | static int last_alloc_vector; |
32 | static int nr_released_vectors = 0; | 32 | static int nr_released_vectors; |
33 | static int nr_reserved_vectors = NR_HP_RESERVED_VECTORS; | 33 | static int nr_reserved_vectors = NR_HP_RESERVED_VECTORS; |
34 | static int nr_msix_devices = 0; | 34 | static int nr_msix_devices; |
35 | 35 | ||
36 | #ifndef CONFIG_X86_IO_APIC | 36 | #ifndef CONFIG_X86_IO_APIC |
37 | int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1}; | 37 | int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1}; |
@@ -170,44 +170,30 @@ static unsigned int startup_msi_irq_wo_maskbit(unsigned int vector) | |||
170 | return 0; /* never anything pending */ | 170 | return 0; /* never anything pending */ |
171 | } | 171 | } |
172 | 172 | ||
173 | static void release_msi(unsigned int vector); | 173 | static unsigned int startup_msi_irq_w_maskbit(unsigned int vector) |
174 | static void shutdown_msi_irq(unsigned int vector) | ||
175 | { | ||
176 | release_msi(vector); | ||
177 | } | ||
178 | |||
179 | #define shutdown_msi_irq_wo_maskbit shutdown_msi_irq | ||
180 | static void enable_msi_irq_wo_maskbit(unsigned int vector) {} | ||
181 | static void disable_msi_irq_wo_maskbit(unsigned int vector) {} | ||
182 | static void ack_msi_irq_wo_maskbit(unsigned int vector) {} | ||
183 | static void end_msi_irq_wo_maskbit(unsigned int vector) | ||
184 | { | 174 | { |
185 | move_msi(vector); | 175 | startup_msi_irq_wo_maskbit(vector); |
186 | ack_APIC_irq(); | 176 | unmask_MSI_irq(vector); |
177 | return 0; /* never anything pending */ | ||
187 | } | 178 | } |
188 | 179 | ||
189 | static unsigned int startup_msi_irq_w_maskbit(unsigned int vector) | 180 | static void shutdown_msi_irq(unsigned int vector) |
190 | { | 181 | { |
191 | struct msi_desc *entry; | 182 | struct msi_desc *entry; |
192 | unsigned long flags; | 183 | unsigned long flags; |
193 | 184 | ||
194 | spin_lock_irqsave(&msi_lock, flags); | 185 | spin_lock_irqsave(&msi_lock, flags); |
195 | entry = msi_desc[vector]; | 186 | entry = msi_desc[vector]; |
196 | if (!entry || !entry->dev) { | 187 | if (entry && entry->dev) |
197 | spin_unlock_irqrestore(&msi_lock, flags); | 188 | entry->msi_attrib.state = 0; /* Mark it not active */ |
198 | return 0; | ||
199 | } | ||
200 | entry->msi_attrib.state = 1; /* Mark it active */ | ||
201 | spin_unlock_irqrestore(&msi_lock, flags); | 189 | spin_unlock_irqrestore(&msi_lock, flags); |
202 | |||
203 | unmask_MSI_irq(vector); | ||
204 | return 0; /* never anything pending */ | ||
205 | } | 190 | } |
206 | 191 | ||
207 | #define shutdown_msi_irq_w_maskbit shutdown_msi_irq | 192 | static void end_msi_irq_wo_maskbit(unsigned int vector) |
208 | #define enable_msi_irq_w_maskbit unmask_MSI_irq | 193 | { |
209 | #define disable_msi_irq_w_maskbit mask_MSI_irq | 194 | move_msi(vector); |
210 | #define ack_msi_irq_w_maskbit mask_MSI_irq | 195 | ack_APIC_irq(); |
196 | } | ||
211 | 197 | ||
212 | static void end_msi_irq_w_maskbit(unsigned int vector) | 198 | static void end_msi_irq_w_maskbit(unsigned int vector) |
213 | { | 199 | { |
@@ -216,6 +202,10 @@ static void end_msi_irq_w_maskbit(unsigned int vector) | |||
216 | ack_APIC_irq(); | 202 | ack_APIC_irq(); |
217 | } | 203 | } |
218 | 204 | ||
205 | static void do_nothing(unsigned int vector) | ||
206 | { | ||
207 | } | ||
208 | |||
219 | /* | 209 | /* |
220 | * Interrupt Type for MSI-X PCI/PCI-X/PCI-Express Devices, | 210 | * Interrupt Type for MSI-X PCI/PCI-X/PCI-Express Devices, |
221 | * which implement the MSI-X Capability Structure. | 211 | * which implement the MSI-X Capability Structure. |
@@ -223,10 +213,10 @@ static void end_msi_irq_w_maskbit(unsigned int vector) | |||
223 | static struct hw_interrupt_type msix_irq_type = { | 213 | static struct hw_interrupt_type msix_irq_type = { |
224 | .typename = "PCI-MSI-X", | 214 | .typename = "PCI-MSI-X", |
225 | .startup = startup_msi_irq_w_maskbit, | 215 | .startup = startup_msi_irq_w_maskbit, |
226 | .shutdown = shutdown_msi_irq_w_maskbit, | 216 | .shutdown = shutdown_msi_irq, |
227 | .enable = enable_msi_irq_w_maskbit, | 217 | .enable = unmask_MSI_irq, |
228 | .disable = disable_msi_irq_w_maskbit, | 218 | .disable = mask_MSI_irq, |
229 | .ack = ack_msi_irq_w_maskbit, | 219 | .ack = mask_MSI_irq, |
230 | .end = end_msi_irq_w_maskbit, | 220 | .end = end_msi_irq_w_maskbit, |
231 | .set_affinity = set_msi_irq_affinity | 221 | .set_affinity = set_msi_irq_affinity |
232 | }; | 222 | }; |
@@ -239,10 +229,10 @@ static struct hw_interrupt_type msix_irq_type = { | |||
239 | static struct hw_interrupt_type msi_irq_w_maskbit_type = { | 229 | static struct hw_interrupt_type msi_irq_w_maskbit_type = { |
240 | .typename = "PCI-MSI", | 230 | .typename = "PCI-MSI", |
241 | .startup = startup_msi_irq_w_maskbit, | 231 | .startup = startup_msi_irq_w_maskbit, |
242 | .shutdown = shutdown_msi_irq_w_maskbit, | 232 | .shutdown = shutdown_msi_irq, |
243 | .enable = enable_msi_irq_w_maskbit, | 233 | .enable = unmask_MSI_irq, |
244 | .disable = disable_msi_irq_w_maskbit, | 234 | .disable = mask_MSI_irq, |
245 | .ack = ack_msi_irq_w_maskbit, | 235 | .ack = mask_MSI_irq, |
246 | .end = end_msi_irq_w_maskbit, | 236 | .end = end_msi_irq_w_maskbit, |
247 | .set_affinity = set_msi_irq_affinity | 237 | .set_affinity = set_msi_irq_affinity |
248 | }; | 238 | }; |
@@ -255,10 +245,10 @@ static struct hw_interrupt_type msi_irq_w_maskbit_type = { | |||
255 | static struct hw_interrupt_type msi_irq_wo_maskbit_type = { | 245 | static struct hw_interrupt_type msi_irq_wo_maskbit_type = { |
256 | .typename = "PCI-MSI", | 246 | .typename = "PCI-MSI", |
257 | .startup = startup_msi_irq_wo_maskbit, | 247 | .startup = startup_msi_irq_wo_maskbit, |
258 | .shutdown = shutdown_msi_irq_wo_maskbit, | 248 | .shutdown = shutdown_msi_irq, |
259 | .enable = enable_msi_irq_wo_maskbit, | 249 | .enable = do_nothing, |
260 | .disable = disable_msi_irq_wo_maskbit, | 250 | .disable = do_nothing, |
261 | .ack = ack_msi_irq_wo_maskbit, | 251 | .ack = do_nothing, |
262 | .end = end_msi_irq_wo_maskbit, | 252 | .end = end_msi_irq_wo_maskbit, |
263 | .set_affinity = set_msi_irq_affinity | 253 | .set_affinity = set_msi_irq_affinity |
264 | }; | 254 | }; |
@@ -407,7 +397,7 @@ static struct msi_desc* alloc_msi_entry(void) | |||
407 | { | 397 | { |
408 | struct msi_desc *entry; | 398 | struct msi_desc *entry; |
409 | 399 | ||
410 | entry = (struct msi_desc*) kmem_cache_alloc(msi_cachep, SLAB_KERNEL); | 400 | entry = kmem_cache_alloc(msi_cachep, SLAB_KERNEL); |
411 | if (!entry) | 401 | if (!entry) |
412 | return NULL; | 402 | return NULL; |
413 | 403 | ||
@@ -796,18 +786,6 @@ void pci_disable_msi(struct pci_dev* dev) | |||
796 | } | 786 | } |
797 | } | 787 | } |
798 | 788 | ||
799 | static void release_msi(unsigned int vector) | ||
800 | { | ||
801 | struct msi_desc *entry; | ||
802 | unsigned long flags; | ||
803 | |||
804 | spin_lock_irqsave(&msi_lock, flags); | ||
805 | entry = msi_desc[vector]; | ||
806 | if (entry && entry->dev) | ||
807 | entry->msi_attrib.state = 0; /* Mark it not active */ | ||
808 | spin_unlock_irqrestore(&msi_lock, flags); | ||
809 | } | ||
810 | |||
811 | static int msi_free_vector(struct pci_dev* dev, int vector, int reassign) | 789 | static int msi_free_vector(struct pci_dev* dev, int vector, int reassign) |
812 | { | 790 | { |
813 | struct msi_desc *entry; | 791 | struct msi_desc *entry; |
@@ -924,7 +902,7 @@ static int reroute_msix_table(int head, struct msix_entry *entries, int *nvec) | |||
924 | /** | 902 | /** |
925 | * pci_enable_msix - configure device's MSI-X capability structure | 903 | * pci_enable_msix - configure device's MSI-X capability structure |
926 | * @dev: pointer to the pci_dev data structure of MSI-X device function | 904 | * @dev: pointer to the pci_dev data structure of MSI-X device function |
927 | * @data: pointer to an array of MSI-X entries | 905 | * @entries: pointer to an array of MSI-X entries |
928 | * @nvec: number of MSI-X vectors requested for allocation by device driver | 906 | * @nvec: number of MSI-X vectors requested for allocation by device driver |
929 | * | 907 | * |
930 | * Setup the MSI-X capability structure of device function with the number | 908 | * Setup the MSI-X capability structure of device function with the number |
diff --git a/drivers/pci/msi.h b/drivers/pci/msi.h index bef21ae3cbd0..390f1851c0f1 100644 --- a/drivers/pci/msi.h +++ b/drivers/pci/msi.h | |||
@@ -41,11 +41,11 @@ static inline void move_msi(int vector) {} | |||
41 | #define PCI_MSIX_FLAGS_BIRMASK (7 << 0) | 41 | #define PCI_MSIX_FLAGS_BIRMASK (7 << 0) |
42 | #define PCI_MSIX_FLAGS_BITMASK (1 << 0) | 42 | #define PCI_MSIX_FLAGS_BITMASK (1 << 0) |
43 | 43 | ||
44 | #define PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET 0 | ||
45 | #define PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET 4 | ||
46 | #define PCI_MSIX_ENTRY_DATA_OFFSET 8 | ||
47 | #define PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET 12 | ||
48 | #define PCI_MSIX_ENTRY_SIZE 16 | 44 | #define PCI_MSIX_ENTRY_SIZE 16 |
45 | #define PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET 0 | ||
46 | #define PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET 4 | ||
47 | #define PCI_MSIX_ENTRY_DATA_OFFSET 8 | ||
48 | #define PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET 12 | ||
49 | 49 | ||
50 | #define msi_control_reg(base) (base + PCI_MSI_FLAGS) | 50 | #define msi_control_reg(base) (base + PCI_MSI_FLAGS) |
51 | #define msi_lower_address_reg(base) (base + PCI_MSI_ADDRESS_LO) | 51 | #define msi_lower_address_reg(base) (base + PCI_MSI_ADDRESS_LO) |
@@ -64,7 +64,6 @@ static inline void move_msi(int vector) {} | |||
64 | #define msi_enable(control, num) multi_msi_enable(control, num); \ | 64 | #define msi_enable(control, num) multi_msi_enable(control, num); \ |
65 | control |= PCI_MSI_FLAGS_ENABLE | 65 | control |= PCI_MSI_FLAGS_ENABLE |
66 | 66 | ||
67 | #define msix_control_reg msi_control_reg | ||
68 | #define msix_table_offset_reg(base) (base + 0x04) | 67 | #define msix_table_offset_reg(base) (base + 0x04) |
69 | #define msix_pba_offset_reg(base) (base + 0x08) | 68 | #define msix_pba_offset_reg(base) (base + 0x08) |
70 | #define msix_enable(control) control |= PCI_MSIX_FLAGS_ENABLE | 69 | #define msix_enable(control) control |= PCI_MSIX_FLAGS_ENABLE |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index e65bf2b395aa..e4115a0d5ba6 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/device.h> | 9 | #include <linux/device.h> |
10 | #include <linux/pci-dynids.h> | ||
11 | #include "pci.h" | 10 | #include "pci.h" |
12 | 11 | ||
13 | /* | 12 | /* |
@@ -18,36 +17,12 @@ | |||
18 | * Dynamic device IDs are disabled for !CONFIG_HOTPLUG | 17 | * Dynamic device IDs are disabled for !CONFIG_HOTPLUG |
19 | */ | 18 | */ |
20 | 19 | ||
21 | #ifdef CONFIG_HOTPLUG | 20 | struct pci_dynid { |
22 | /** | 21 | struct list_head node; |
23 | * pci_device_probe_dynamic() | 22 | struct pci_device_id id; |
24 | * | 23 | }; |
25 | * Walk the dynamic ID list looking for a match. | ||
26 | * returns 0 and sets pci_dev->driver when drv claims pci_dev, else error. | ||
27 | */ | ||
28 | static int | ||
29 | pci_device_probe_dynamic(struct pci_driver *drv, struct pci_dev *pci_dev) | ||
30 | { | ||
31 | int error = -ENODEV; | ||
32 | struct list_head *pos; | ||
33 | struct dynid *dynid; | ||
34 | 24 | ||
35 | spin_lock(&drv->dynids.lock); | 25 | #ifdef CONFIG_HOTPLUG |
36 | list_for_each(pos, &drv->dynids.list) { | ||
37 | dynid = list_entry(pos, struct dynid, node); | ||
38 | if (pci_match_one_device(&dynid->id, pci_dev)) { | ||
39 | spin_unlock(&drv->dynids.lock); | ||
40 | error = drv->probe(pci_dev, &dynid->id); | ||
41 | if (error >= 0) { | ||
42 | pci_dev->driver = drv; | ||
43 | return 0; | ||
44 | } | ||
45 | return error; | ||
46 | } | ||
47 | } | ||
48 | spin_unlock(&drv->dynids.lock); | ||
49 | return error; | ||
50 | } | ||
51 | 26 | ||
52 | /** | 27 | /** |
53 | * store_new_id | 28 | * store_new_id |
@@ -58,8 +33,7 @@ pci_device_probe_dynamic(struct pci_driver *drv, struct pci_dev *pci_dev) | |||
58 | static inline ssize_t | 33 | static inline ssize_t |
59 | store_new_id(struct device_driver *driver, const char *buf, size_t count) | 34 | store_new_id(struct device_driver *driver, const char *buf, size_t count) |
60 | { | 35 | { |
61 | struct dynid *dynid; | 36 | struct pci_dynid *dynid; |
62 | struct bus_type * bus; | ||
63 | struct pci_driver *pdrv = to_pci_driver(driver); | 37 | struct pci_driver *pdrv = to_pci_driver(driver); |
64 | __u32 vendor=PCI_ANY_ID, device=PCI_ANY_ID, subvendor=PCI_ANY_ID, | 38 | __u32 vendor=PCI_ANY_ID, device=PCI_ANY_ID, subvendor=PCI_ANY_ID, |
65 | subdevice=PCI_ANY_ID, class=0, class_mask=0; | 39 | subdevice=PCI_ANY_ID, class=0, class_mask=0; |
@@ -91,37 +65,22 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count) | |||
91 | list_add_tail(&pdrv->dynids.list, &dynid->node); | 65 | list_add_tail(&pdrv->dynids.list, &dynid->node); |
92 | spin_unlock(&pdrv->dynids.lock); | 66 | spin_unlock(&pdrv->dynids.lock); |
93 | 67 | ||
94 | bus = get_bus(pdrv->driver.bus); | 68 | if (get_driver(&pdrv->driver)) { |
95 | if (bus) { | 69 | driver_attach(&pdrv->driver); |
96 | if (get_driver(&pdrv->driver)) { | 70 | put_driver(&pdrv->driver); |
97 | down_write(&bus->subsys.rwsem); | ||
98 | driver_attach(&pdrv->driver); | ||
99 | up_write(&bus->subsys.rwsem); | ||
100 | put_driver(&pdrv->driver); | ||
101 | } | ||
102 | put_bus(bus); | ||
103 | } | 71 | } |
104 | 72 | ||
105 | return count; | 73 | return count; |
106 | } | 74 | } |
107 | |||
108 | static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); | 75 | static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); |
109 | static inline void | ||
110 | pci_init_dynids(struct pci_dynids *dynids) | ||
111 | { | ||
112 | spin_lock_init(&dynids->lock); | ||
113 | INIT_LIST_HEAD(&dynids->list); | ||
114 | } | ||
115 | 76 | ||
116 | static void | 77 | static void |
117 | pci_free_dynids(struct pci_driver *drv) | 78 | pci_free_dynids(struct pci_driver *drv) |
118 | { | 79 | { |
119 | struct list_head *pos, *n; | 80 | struct pci_dynid *dynid, *n; |
120 | struct dynid *dynid; | ||
121 | 81 | ||
122 | spin_lock(&drv->dynids.lock); | 82 | spin_lock(&drv->dynids.lock); |
123 | list_for_each_safe(pos, n, &drv->dynids.list) { | 83 | list_for_each_entry_safe(dynid, n, &drv->dynids.list, node) { |
124 | dynid = list_entry(pos, struct dynid, node); | ||
125 | list_del(&dynid->node); | 84 | list_del(&dynid->node); |
126 | kfree(dynid); | 85 | kfree(dynid); |
127 | } | 86 | } |
@@ -138,83 +97,70 @@ pci_create_newid_file(struct pci_driver *drv) | |||
138 | return error; | 97 | return error; |
139 | } | 98 | } |
140 | 99 | ||
141 | static int | ||
142 | pci_bus_match_dynids(const struct pci_dev *pci_dev, struct pci_driver *pci_drv) | ||
143 | { | ||
144 | struct list_head *pos; | ||
145 | struct dynid *dynid; | ||
146 | |||
147 | spin_lock(&pci_drv->dynids.lock); | ||
148 | list_for_each(pos, &pci_drv->dynids.list) { | ||
149 | dynid = list_entry(pos, struct dynid, node); | ||
150 | if (pci_match_one_device(&dynid->id, pci_dev)) { | ||
151 | spin_unlock(&pci_drv->dynids.lock); | ||
152 | return 1; | ||
153 | } | ||
154 | } | ||
155 | spin_unlock(&pci_drv->dynids.lock); | ||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | #else /* !CONFIG_HOTPLUG */ | 100 | #else /* !CONFIG_HOTPLUG */ |
160 | static inline int pci_device_probe_dynamic(struct pci_driver *drv, struct pci_dev *pci_dev) | ||
161 | { | ||
162 | return -ENODEV; | ||
163 | } | ||
164 | static inline void pci_init_dynids(struct pci_dynids *dynids) {} | ||
165 | static inline void pci_free_dynids(struct pci_driver *drv) {} | 101 | static inline void pci_free_dynids(struct pci_driver *drv) {} |
166 | static inline int pci_create_newid_file(struct pci_driver *drv) | 102 | static inline int pci_create_newid_file(struct pci_driver *drv) |
167 | { | 103 | { |
168 | return 0; | 104 | return 0; |
169 | } | 105 | } |
170 | static inline int pci_bus_match_dynids(const struct pci_dev *pci_dev, struct pci_driver *pci_drv) | ||
171 | { | ||
172 | return 0; | ||
173 | } | ||
174 | #endif | 106 | #endif |
175 | 107 | ||
176 | /** | 108 | /** |
177 | * pci_match_device - Tell if a PCI device structure has a matching | 109 | * pci_match_id - See if a pci device matches a given pci_id table |
178 | * PCI device id structure | ||
179 | * @ids: array of PCI device id structures to search in | 110 | * @ids: array of PCI device id structures to search in |
180 | * @dev: the PCI device structure to match against | 111 | * @dev: the PCI device structure to match against. |
181 | * | 112 | * |
182 | * Used by a driver to check whether a PCI device present in the | 113 | * Used by a driver to check whether a PCI device present in the |
183 | * system is in its list of supported devices.Returns the matching | 114 | * system is in its list of supported devices. Returns the matching |
184 | * pci_device_id structure or %NULL if there is no match. | 115 | * pci_device_id structure or %NULL if there is no match. |
116 | * | ||
117 | * Depreciated, don't use this as it will not catch any dynamic ids | ||
118 | * that a driver might want to check for. | ||
185 | */ | 119 | */ |
186 | const struct pci_device_id * | 120 | const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, |
187 | pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev) | 121 | struct pci_dev *dev) |
188 | { | 122 | { |
189 | while (ids->vendor || ids->subvendor || ids->class_mask) { | 123 | if (ids) { |
190 | if (pci_match_one_device(ids, dev)) | 124 | while (ids->vendor || ids->subvendor || ids->class_mask) { |
191 | return ids; | 125 | if (pci_match_one_device(ids, dev)) |
192 | ids++; | 126 | return ids; |
127 | ids++; | ||
128 | } | ||
193 | } | 129 | } |
194 | return NULL; | 130 | return NULL; |
195 | } | 131 | } |
196 | 132 | ||
197 | /** | 133 | /** |
198 | * pci_device_probe_static() | 134 | * pci_match_device - Tell if a PCI device structure has a matching |
199 | * | 135 | * PCI device id structure |
200 | * returns 0 and sets pci_dev->driver when drv claims pci_dev, else error. | 136 | * @ids: array of PCI device id structures to search in |
137 | * @dev: the PCI device structure to match against | ||
138 | * @drv: the PCI driver to match against | ||
139 | * | ||
140 | * Used by a driver to check whether a PCI device present in the | ||
141 | * system is in its list of supported devices. Returns the matching | ||
142 | * pci_device_id structure or %NULL if there is no match. | ||
201 | */ | 143 | */ |
202 | static int | 144 | const struct pci_device_id *pci_match_device(struct pci_driver *drv, |
203 | pci_device_probe_static(struct pci_driver *drv, struct pci_dev *pci_dev) | 145 | struct pci_dev *dev) |
204 | { | 146 | { |
205 | int error = -ENODEV; | ||
206 | const struct pci_device_id *id; | 147 | const struct pci_device_id *id; |
148 | struct pci_dynid *dynid; | ||
207 | 149 | ||
208 | if (!drv->id_table) | 150 | id = pci_match_id(drv->id_table, dev); |
209 | return error; | ||
210 | id = pci_match_device(drv->id_table, pci_dev); | ||
211 | if (id) | 151 | if (id) |
212 | error = drv->probe(pci_dev, id); | 152 | return id; |
213 | if (error >= 0) { | 153 | |
214 | pci_dev->driver = drv; | 154 | /* static ids didn't match, lets look at the dynamic ones */ |
215 | error = 0; | 155 | spin_lock(&drv->dynids.lock); |
156 | list_for_each_entry(dynid, &drv->dynids.list, node) { | ||
157 | if (pci_match_one_device(&dynid->id, dev)) { | ||
158 | spin_unlock(&drv->dynids.lock); | ||
159 | return &dynid->id; | ||
160 | } | ||
216 | } | 161 | } |
217 | return error; | 162 | spin_unlock(&drv->dynids.lock); |
163 | return NULL; | ||
218 | } | 164 | } |
219 | 165 | ||
220 | /** | 166 | /** |
@@ -225,13 +171,20 @@ pci_device_probe_static(struct pci_driver *drv, struct pci_dev *pci_dev) | |||
225 | */ | 171 | */ |
226 | static int | 172 | static int |
227 | __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev) | 173 | __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev) |
228 | { | 174 | { |
175 | const struct pci_device_id *id; | ||
229 | int error = 0; | 176 | int error = 0; |
230 | 177 | ||
231 | if (!pci_dev->driver && drv->probe) { | 178 | if (!pci_dev->driver && drv->probe) { |
232 | error = pci_device_probe_static(drv, pci_dev); | 179 | error = -ENODEV; |
233 | if (error == -ENODEV) | 180 | |
234 | error = pci_device_probe_dynamic(drv, pci_dev); | 181 | id = pci_match_device(drv, pci_dev); |
182 | if (id) | ||
183 | error = drv->probe(pci_dev, id); | ||
184 | if (error >= 0) { | ||
185 | pci_dev->driver = drv; | ||
186 | error = 0; | ||
187 | } | ||
235 | } | 188 | } |
236 | return error; | 189 | return error; |
237 | } | 190 | } |
@@ -371,12 +324,6 @@ static struct kobj_type pci_driver_kobj_type = { | |||
371 | .sysfs_ops = &pci_driver_sysfs_ops, | 324 | .sysfs_ops = &pci_driver_sysfs_ops, |
372 | }; | 325 | }; |
373 | 326 | ||
374 | static int | ||
375 | pci_populate_driver_dir(struct pci_driver *drv) | ||
376 | { | ||
377 | return pci_create_newid_file(drv); | ||
378 | } | ||
379 | |||
380 | /** | 327 | /** |
381 | * pci_register_driver - register a new pci driver | 328 | * pci_register_driver - register a new pci driver |
382 | * @drv: the driver structure to register | 329 | * @drv: the driver structure to register |
@@ -401,13 +348,15 @@ int pci_register_driver(struct pci_driver *drv) | |||
401 | drv->driver.shutdown = pci_device_shutdown; | 348 | drv->driver.shutdown = pci_device_shutdown; |
402 | drv->driver.owner = drv->owner; | 349 | drv->driver.owner = drv->owner; |
403 | drv->driver.kobj.ktype = &pci_driver_kobj_type; | 350 | drv->driver.kobj.ktype = &pci_driver_kobj_type; |
404 | pci_init_dynids(&drv->dynids); | 351 | |
352 | spin_lock_init(&drv->dynids.lock); | ||
353 | INIT_LIST_HEAD(&drv->dynids.list); | ||
405 | 354 | ||
406 | /* register with core */ | 355 | /* register with core */ |
407 | error = driver_register(&drv->driver); | 356 | error = driver_register(&drv->driver); |
408 | 357 | ||
409 | if (!error) | 358 | if (!error) |
410 | pci_populate_driver_dir(drv); | 359 | error = pci_create_newid_file(drv); |
411 | 360 | ||
412 | return error; | 361 | return error; |
413 | } | 362 | } |
@@ -463,21 +412,17 @@ pci_dev_driver(const struct pci_dev *dev) | |||
463 | * system is in its list of supported devices.Returns the matching | 412 | * system is in its list of supported devices.Returns the matching |
464 | * pci_device_id structure or %NULL if there is no match. | 413 | * pci_device_id structure or %NULL if there is no match. |
465 | */ | 414 | */ |
466 | static int pci_bus_match(struct device * dev, struct device_driver * drv) | 415 | static int pci_bus_match(struct device *dev, struct device_driver *drv) |
467 | { | 416 | { |
468 | const struct pci_dev * pci_dev = to_pci_dev(dev); | 417 | struct pci_dev *pci_dev = to_pci_dev(dev); |
469 | struct pci_driver * pci_drv = to_pci_driver(drv); | 418 | struct pci_driver *pci_drv = to_pci_driver(drv); |
470 | const struct pci_device_id * ids = pci_drv->id_table; | ||
471 | const struct pci_device_id *found_id; | 419 | const struct pci_device_id *found_id; |
472 | 420 | ||
473 | if (!ids) | 421 | found_id = pci_match_device(pci_drv, pci_dev); |
474 | return 0; | ||
475 | |||
476 | found_id = pci_match_device(ids, pci_dev); | ||
477 | if (found_id) | 422 | if (found_id) |
478 | return 1; | 423 | return 1; |
479 | 424 | ||
480 | return pci_bus_match_dynids(pci_dev, pci_drv); | 425 | return 0; |
481 | } | 426 | } |
482 | 427 | ||
483 | /** | 428 | /** |
@@ -536,6 +481,7 @@ static int __init pci_driver_init(void) | |||
536 | 481 | ||
537 | postcore_initcall(pci_driver_init); | 482 | postcore_initcall(pci_driver_init); |
538 | 483 | ||
484 | EXPORT_SYMBOL(pci_match_id); | ||
539 | EXPORT_SYMBOL(pci_match_device); | 485 | EXPORT_SYMBOL(pci_match_device); |
540 | EXPORT_SYMBOL(pci_register_driver); | 486 | EXPORT_SYMBOL(pci_register_driver); |
541 | EXPORT_SYMBOL(pci_unregister_driver); | 487 | EXPORT_SYMBOL(pci_unregister_driver); |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index a15f94072a6f..cc9d65388e62 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -60,15 +60,18 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf) | |||
60 | char * str = buf; | 60 | char * str = buf; |
61 | int i; | 61 | int i; |
62 | int max = 7; | 62 | int max = 7; |
63 | u64 start, end; | ||
63 | 64 | ||
64 | if (pci_dev->subordinate) | 65 | if (pci_dev->subordinate) |
65 | max = DEVICE_COUNT_RESOURCE; | 66 | max = DEVICE_COUNT_RESOURCE; |
66 | 67 | ||
67 | for (i = 0; i < max; i++) { | 68 | for (i = 0; i < max; i++) { |
68 | str += sprintf(str,"0x%016lx 0x%016lx 0x%016lx\n", | 69 | struct resource *res = &pci_dev->resource[i]; |
69 | pci_resource_start(pci_dev,i), | 70 | pci_resource_to_user(pci_dev, i, res, &start, &end); |
70 | pci_resource_end(pci_dev,i), | 71 | str += sprintf(str,"0x%016llx 0x%016llx 0x%016llx\n", |
71 | pci_resource_flags(pci_dev,i)); | 72 | (unsigned long long)start, |
73 | (unsigned long long)end, | ||
74 | (unsigned long long)res->flags); | ||
72 | } | 75 | } |
73 | return (str - buf); | 76 | return (str - buf); |
74 | } | 77 | } |
@@ -313,8 +316,21 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, | |||
313 | struct device, kobj)); | 316 | struct device, kobj)); |
314 | struct resource *res = (struct resource *)attr->private; | 317 | struct resource *res = (struct resource *)attr->private; |
315 | enum pci_mmap_state mmap_type; | 318 | enum pci_mmap_state mmap_type; |
319 | u64 start, end; | ||
320 | int i; | ||
316 | 321 | ||
317 | vma->vm_pgoff += res->start >> PAGE_SHIFT; | 322 | for (i = 0; i < PCI_ROM_RESOURCE; i++) |
323 | if (res == &pdev->resource[i]) | ||
324 | break; | ||
325 | if (i >= PCI_ROM_RESOURCE) | ||
326 | return -ENODEV; | ||
327 | |||
328 | /* pci_mmap_page_range() expects the same kind of entry as coming | ||
329 | * from /proc/bus/pci/ which is a "user visible" value. If this is | ||
330 | * different from the resource itself, arch will do necessary fixup. | ||
331 | */ | ||
332 | pci_resource_to_user(pdev, i, res, &start, &end); | ||
333 | vma->vm_pgoff += start >> PAGE_SHIFT; | ||
318 | mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io; | 334 | mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io; |
319 | 335 | ||
320 | return pci_mmap_page_range(pdev, vma, mmap_type, 0); | 336 | return pci_mmap_page_range(pdev, vma, mmap_type, 0); |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index f04b9ffe4153..d382bdb7b560 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -334,10 +334,6 @@ EXPORT_SYMBOL(pci_choose_state); | |||
334 | /** | 334 | /** |
335 | * pci_save_state - save the PCI configuration space of a device before suspending | 335 | * pci_save_state - save the PCI configuration space of a device before suspending |
336 | * @dev: - PCI device that we're dealing with | 336 | * @dev: - PCI device that we're dealing with |
337 | * @buffer: - buffer to hold config space context | ||
338 | * | ||
339 | * @buffer must be large enough to hold the entire PCI 2.2 config space | ||
340 | * (>= 64 bytes). | ||
341 | */ | 337 | */ |
342 | int | 338 | int |
343 | pci_save_state(struct pci_dev *dev) | 339 | pci_save_state(struct pci_dev *dev) |
@@ -352,8 +348,6 @@ pci_save_state(struct pci_dev *dev) | |||
352 | /** | 348 | /** |
353 | * pci_restore_state - Restore the saved state of a PCI device | 349 | * pci_restore_state - Restore the saved state of a PCI device |
354 | * @dev: - PCI device that we're dealing with | 350 | * @dev: - PCI device that we're dealing with |
355 | * @buffer: - saved PCI config space | ||
356 | * | ||
357 | */ | 351 | */ |
358 | int | 352 | int |
359 | pci_restore_state(struct pci_dev *dev) | 353 | pci_restore_state(struct pci_dev *dev) |
diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h index 537b372dc340..a63bd8f72601 100644 --- a/drivers/pci/pcie/portdrv.h +++ b/drivers/pci/pcie/portdrv.h | |||
@@ -27,6 +27,11 @@ | |||
27 | 27 | ||
28 | #define get_descriptor_id(type, service) (((type - 4) << 4) | service) | 28 | #define get_descriptor_id(type, service) (((type - 4) << 4) | service) |
29 | 29 | ||
30 | struct pcie_port_device_ext { | ||
31 | int interrupt_mode; /* [0:INTx | 1:MSI | 2:MSI-X] */ | ||
32 | unsigned int saved_msi_config_space[5]; | ||
33 | }; | ||
34 | |||
30 | extern struct bus_type pcie_port_bus_type; | 35 | extern struct bus_type pcie_port_bus_type; |
31 | extern int pcie_port_device_probe(struct pci_dev *dev); | 36 | extern int pcie_port_device_probe(struct pci_dev *dev); |
32 | extern int pcie_port_device_register(struct pci_dev *dev); | 37 | extern int pcie_port_device_register(struct pci_dev *dev); |
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index f5c5f10a3d2f..4db69982876e 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
@@ -275,10 +275,17 @@ int pcie_port_device_probe(struct pci_dev *dev) | |||
275 | 275 | ||
276 | int pcie_port_device_register(struct pci_dev *dev) | 276 | int pcie_port_device_register(struct pci_dev *dev) |
277 | { | 277 | { |
278 | struct pcie_port_device_ext *p_ext; | ||
278 | int status, type, capabilities, irq_mode, i; | 279 | int status, type, capabilities, irq_mode, i; |
279 | int vectors[PCIE_PORT_DEVICE_MAXSERVICES]; | 280 | int vectors[PCIE_PORT_DEVICE_MAXSERVICES]; |
280 | u16 reg16; | 281 | u16 reg16; |
281 | 282 | ||
283 | /* Allocate port device extension */ | ||
284 | if (!(p_ext = kmalloc(sizeof(struct pcie_port_device_ext), GFP_KERNEL))) | ||
285 | return -ENOMEM; | ||
286 | |||
287 | pci_set_drvdata(dev, p_ext); | ||
288 | |||
282 | /* Get port type */ | 289 | /* Get port type */ |
283 | pci_read_config_word(dev, | 290 | pci_read_config_word(dev, |
284 | pci_find_capability(dev, PCI_CAP_ID_EXP) + | 291 | pci_find_capability(dev, PCI_CAP_ID_EXP) + |
@@ -288,6 +295,7 @@ int pcie_port_device_register(struct pci_dev *dev) | |||
288 | /* Now get port services */ | 295 | /* Now get port services */ |
289 | capabilities = get_port_device_capability(dev); | 296 | capabilities = get_port_device_capability(dev); |
290 | irq_mode = assign_interrupt_mode(dev, vectors, capabilities); | 297 | irq_mode = assign_interrupt_mode(dev, vectors, capabilities); |
298 | p_ext->interrupt_mode = irq_mode; | ||
291 | 299 | ||
292 | /* Allocate child services if any */ | 300 | /* Allocate child services if any */ |
293 | for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { | 301 | for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index e9095ee508e3..30bac7ed7c16 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -29,6 +29,78 @@ MODULE_LICENSE("GPL"); | |||
29 | /* global data */ | 29 | /* global data */ |
30 | static const char device_name[] = "pcieport-driver"; | 30 | static const char device_name[] = "pcieport-driver"; |
31 | 31 | ||
32 | static void pci_save_msi_state(struct pci_dev *dev) | ||
33 | { | ||
34 | struct pcie_port_device_ext *p_ext = pci_get_drvdata(dev); | ||
35 | int i = 0, pos; | ||
36 | u16 control; | ||
37 | |||
38 | if ((pos = pci_find_capability(dev, PCI_CAP_ID_MSI)) <= 0) | ||
39 | return; | ||
40 | |||
41 | pci_read_config_dword(dev, pos, &p_ext->saved_msi_config_space[i++]); | ||
42 | control = p_ext->saved_msi_config_space[0] >> 16; | ||
43 | pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, | ||
44 | &p_ext->saved_msi_config_space[i++]); | ||
45 | if (control & PCI_MSI_FLAGS_64BIT) { | ||
46 | pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, | ||
47 | &p_ext->saved_msi_config_space[i++]); | ||
48 | pci_read_config_dword(dev, pos + PCI_MSI_DATA_64, | ||
49 | &p_ext->saved_msi_config_space[i++]); | ||
50 | } else | ||
51 | pci_read_config_dword(dev, pos + PCI_MSI_DATA_32, | ||
52 | &p_ext->saved_msi_config_space[i++]); | ||
53 | if (control & PCI_MSI_FLAGS_MASKBIT) | ||
54 | pci_read_config_dword(dev, pos + PCI_MSI_MASK_BIT, | ||
55 | &p_ext->saved_msi_config_space[i++]); | ||
56 | } | ||
57 | |||
58 | static void pci_restore_msi_state(struct pci_dev *dev) | ||
59 | { | ||
60 | struct pcie_port_device_ext *p_ext = pci_get_drvdata(dev); | ||
61 | int i = 0, pos; | ||
62 | u16 control; | ||
63 | |||
64 | if ((pos = pci_find_capability(dev, PCI_CAP_ID_MSI)) <= 0) | ||
65 | return; | ||
66 | |||
67 | control = p_ext->saved_msi_config_space[i++] >> 16; | ||
68 | pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); | ||
69 | pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, | ||
70 | p_ext->saved_msi_config_space[i++]); | ||
71 | if (control & PCI_MSI_FLAGS_64BIT) { | ||
72 | pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, | ||
73 | p_ext->saved_msi_config_space[i++]); | ||
74 | pci_write_config_dword(dev, pos + PCI_MSI_DATA_64, | ||
75 | p_ext->saved_msi_config_space[i++]); | ||
76 | } else | ||
77 | pci_write_config_dword(dev, pos + PCI_MSI_DATA_32, | ||
78 | p_ext->saved_msi_config_space[i++]); | ||
79 | if (control & PCI_MSI_FLAGS_MASKBIT) | ||
80 | pci_write_config_dword(dev, pos + PCI_MSI_MASK_BIT, | ||
81 | p_ext->saved_msi_config_space[i++]); | ||
82 | } | ||
83 | |||
84 | static void pcie_portdrv_save_config(struct pci_dev *dev) | ||
85 | { | ||
86 | struct pcie_port_device_ext *p_ext = pci_get_drvdata(dev); | ||
87 | |||
88 | pci_save_state(dev); | ||
89 | if (p_ext->interrupt_mode == PCIE_PORT_MSI_MODE) | ||
90 | pci_save_msi_state(dev); | ||
91 | } | ||
92 | |||
93 | static void pcie_portdrv_restore_config(struct pci_dev *dev) | ||
94 | { | ||
95 | struct pcie_port_device_ext *p_ext = pci_get_drvdata(dev); | ||
96 | |||
97 | pci_restore_state(dev); | ||
98 | if (p_ext->interrupt_mode == PCIE_PORT_MSI_MODE) | ||
99 | pci_restore_msi_state(dev); | ||
100 | pci_enable_device(dev); | ||
101 | pci_set_master(dev); | ||
102 | } | ||
103 | |||
32 | /* | 104 | /* |
33 | * pcie_portdrv_probe - Probe PCI-Express port devices | 105 | * pcie_portdrv_probe - Probe PCI-Express port devices |
34 | * @dev: PCI-Express port device being probed | 106 | * @dev: PCI-Express port device being probed |
@@ -64,16 +136,21 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev, | |||
64 | static void pcie_portdrv_remove (struct pci_dev *dev) | 136 | static void pcie_portdrv_remove (struct pci_dev *dev) |
65 | { | 137 | { |
66 | pcie_port_device_remove(dev); | 138 | pcie_port_device_remove(dev); |
139 | kfree(pci_get_drvdata(dev)); | ||
67 | } | 140 | } |
68 | 141 | ||
69 | #ifdef CONFIG_PM | 142 | #ifdef CONFIG_PM |
70 | static int pcie_portdrv_suspend (struct pci_dev *dev, pm_message_t state) | 143 | static int pcie_portdrv_suspend (struct pci_dev *dev, pm_message_t state) |
71 | { | 144 | { |
72 | return pcie_port_device_suspend(dev, state); | 145 | int ret = pcie_port_device_suspend(dev, state); |
146 | |||
147 | pcie_portdrv_save_config(dev); | ||
148 | return ret; | ||
73 | } | 149 | } |
74 | 150 | ||
75 | static int pcie_portdrv_resume (struct pci_dev *dev) | 151 | static int pcie_portdrv_resume (struct pci_dev *dev) |
76 | { | 152 | { |
153 | pcie_portdrv_restore_config(dev); | ||
77 | return pcie_port_device_resume(dev); | 154 | return pcie_port_device_resume(dev); |
78 | } | 155 | } |
79 | #endif | 156 | #endif |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index fd48b201eb53..df3bdae2040f 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -239,9 +239,8 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
239 | 239 | ||
240 | if (dev->transparent) { | 240 | if (dev->transparent) { |
241 | printk(KERN_INFO "PCI: Transparent bridge - %s\n", pci_name(dev)); | 241 | printk(KERN_INFO "PCI: Transparent bridge - %s\n", pci_name(dev)); |
242 | for(i = 0; i < PCI_BUS_NUM_RESOURCES; i++) | 242 | for(i = 3; i < PCI_BUS_NUM_RESOURCES; i++) |
243 | child->resource[i] = child->parent->resource[i]; | 243 | child->resource[i] = child->parent->resource[i - 3]; |
244 | return; | ||
245 | } | 244 | } |
246 | 245 | ||
247 | for(i=0; i<3; i++) | 246 | for(i=0; i<3; i++) |
@@ -374,8 +373,11 @@ struct pci_bus * __devinit pci_add_new_bus(struct pci_bus *parent, struct pci_de | |||
374 | struct pci_bus *child; | 373 | struct pci_bus *child; |
375 | 374 | ||
376 | child = pci_alloc_child_bus(parent, dev, busnr); | 375 | child = pci_alloc_child_bus(parent, dev, busnr); |
377 | if (child) | 376 | if (child) { |
377 | spin_lock(&pci_bus_lock); | ||
378 | list_add_tail(&child->node, &parent->children); | 378 | list_add_tail(&child->node, &parent->children); |
379 | spin_unlock(&pci_bus_lock); | ||
380 | } | ||
379 | return child; | 381 | return child; |
380 | } | 382 | } |
381 | 383 | ||
@@ -395,6 +397,16 @@ static void pci_enable_crs(struct pci_dev *dev) | |||
395 | pci_write_config_word(dev, rpcap + PCI_EXP_RTCTL, rpctl); | 397 | pci_write_config_word(dev, rpcap + PCI_EXP_RTCTL, rpctl); |
396 | } | 398 | } |
397 | 399 | ||
400 | static void __devinit pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max) | ||
401 | { | ||
402 | struct pci_bus *parent = child->parent; | ||
403 | while (parent->parent && parent->subordinate < max) { | ||
404 | parent->subordinate = max; | ||
405 | pci_write_config_byte(parent->self, PCI_SUBORDINATE_BUS, max); | ||
406 | parent = parent->parent; | ||
407 | } | ||
408 | } | ||
409 | |||
398 | unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus); | 410 | unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus); |
399 | 411 | ||
400 | /* | 412 | /* |
@@ -411,7 +423,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max | |||
411 | { | 423 | { |
412 | struct pci_bus *child; | 424 | struct pci_bus *child; |
413 | int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); | 425 | int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); |
414 | u32 buses; | 426 | u32 buses, i; |
415 | u16 bctl; | 427 | u16 bctl; |
416 | 428 | ||
417 | pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses); | 429 | pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses); |
@@ -447,7 +459,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max | |||
447 | return max; | 459 | return max; |
448 | } | 460 | } |
449 | 461 | ||
450 | child = pci_alloc_child_bus(bus, dev, busnr); | 462 | child = pci_add_new_bus(bus, dev, busnr); |
451 | if (!child) | 463 | if (!child) |
452 | return max; | 464 | return max; |
453 | child->primary = buses & 0xFF; | 465 | child->primary = buses & 0xFF; |
@@ -470,7 +482,11 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max | |||
470 | /* Clear errors */ | 482 | /* Clear errors */ |
471 | pci_write_config_word(dev, PCI_STATUS, 0xffff); | 483 | pci_write_config_word(dev, PCI_STATUS, 0xffff); |
472 | 484 | ||
473 | child = pci_alloc_child_bus(bus, dev, ++max); | 485 | /* Prevent assigning a bus number that already exists. |
486 | * This can happen when a bridge is hot-plugged */ | ||
487 | if (pci_find_bus(pci_domain_nr(bus), max+1)) | ||
488 | return max; | ||
489 | child = pci_add_new_bus(bus, dev, ++max); | ||
474 | buses = (buses & 0xff000000) | 490 | buses = (buses & 0xff000000) |
475 | | ((unsigned int)(child->primary) << 0) | 491 | | ((unsigned int)(child->primary) << 0) |
476 | | ((unsigned int)(child->secondary) << 8) | 492 | | ((unsigned int)(child->secondary) << 8) |
@@ -492,7 +508,13 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max | |||
492 | 508 | ||
493 | if (!is_cardbus) { | 509 | if (!is_cardbus) { |
494 | child->bridge_ctl = PCI_BRIDGE_CTL_NO_ISA; | 510 | child->bridge_ctl = PCI_BRIDGE_CTL_NO_ISA; |
495 | 511 | /* | |
512 | * Adjust subordinate busnr in parent buses. | ||
513 | * We do this before scanning for children because | ||
514 | * some devices may not be detected if the bios | ||
515 | * was lazy. | ||
516 | */ | ||
517 | pci_fixup_parent_subordinate_busnr(child, max); | ||
496 | /* Now we can scan all subordinate buses... */ | 518 | /* Now we can scan all subordinate buses... */ |
497 | max = pci_scan_child_bus(child); | 519 | max = pci_scan_child_bus(child); |
498 | } else { | 520 | } else { |
@@ -501,7 +523,12 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max | |||
501 | * as cards with a PCI-to-PCI bridge can be | 523 | * as cards with a PCI-to-PCI bridge can be |
502 | * inserted later. | 524 | * inserted later. |
503 | */ | 525 | */ |
504 | max += CARDBUS_RESERVE_BUSNR; | 526 | for (i=0; i<CARDBUS_RESERVE_BUSNR; i++) |
527 | if (pci_find_bus(pci_domain_nr(bus), | ||
528 | max+i+1)) | ||
529 | break; | ||
530 | max += i; | ||
531 | pci_fixup_parent_subordinate_busnr(child, max); | ||
505 | } | 532 | } |
506 | /* | 533 | /* |
507 | * Set the subordinate bus number to its real value. | 534 | * Set the subordinate bus number to its real value. |
@@ -757,7 +784,9 @@ pci_scan_single_device(struct pci_bus *bus, int devfn) | |||
757 | * and the bus list for fixup functions, etc. | 784 | * and the bus list for fixup functions, etc. |
758 | */ | 785 | */ |
759 | INIT_LIST_HEAD(&dev->global_list); | 786 | INIT_LIST_HEAD(&dev->global_list); |
787 | spin_lock(&pci_bus_lock); | ||
760 | list_add_tail(&dev->bus_list, &bus->devices); | 788 | list_add_tail(&dev->bus_list, &bus->devices); |
789 | spin_unlock(&pci_bus_lock); | ||
761 | 790 | ||
762 | return dev; | 791 | return dev; |
763 | } | 792 | } |
@@ -878,7 +907,9 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus, | |||
878 | pr_debug("PCI: Bus %04x:%02x already known\n", pci_domain_nr(b), bus); | 907 | pr_debug("PCI: Bus %04x:%02x already known\n", pci_domain_nr(b), bus); |
879 | goto err_out; | 908 | goto err_out; |
880 | } | 909 | } |
910 | spin_lock(&pci_bus_lock); | ||
881 | list_add_tail(&b->node, &pci_root_buses); | 911 | list_add_tail(&b->node, &pci_root_buses); |
912 | spin_unlock(&pci_bus_lock); | ||
882 | 913 | ||
883 | memset(dev, 0, sizeof(*dev)); | 914 | memset(dev, 0, sizeof(*dev)); |
884 | dev->parent = parent; | 915 | dev->parent = parent; |
@@ -911,8 +942,6 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus, | |||
911 | 942 | ||
912 | b->subordinate = pci_scan_child_bus(b); | 943 | b->subordinate = pci_scan_child_bus(b); |
913 | 944 | ||
914 | pci_bus_add_devices(b); | ||
915 | |||
916 | return b; | 945 | return b; |
917 | 946 | ||
918 | sys_create_link_err: | 947 | sys_create_link_err: |
@@ -922,7 +951,9 @@ class_dev_create_file_err: | |||
922 | class_dev_reg_err: | 951 | class_dev_reg_err: |
923 | device_unregister(dev); | 952 | device_unregister(dev); |
924 | dev_reg_err: | 953 | dev_reg_err: |
954 | spin_lock(&pci_bus_lock); | ||
925 | list_del(&b->node); | 955 | list_del(&b->node); |
956 | spin_unlock(&pci_bus_lock); | ||
926 | err_out: | 957 | err_out: |
927 | kfree(dev); | 958 | kfree(dev); |
928 | kfree(b); | 959 | kfree(b); |
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index e68bbfb1e7c3..7988fc8df3fd 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c | |||
@@ -355,14 +355,20 @@ static int show_device(struct seq_file *m, void *v) | |||
355 | dev->device, | 355 | dev->device, |
356 | dev->irq); | 356 | dev->irq); |
357 | /* Here should be 7 and not PCI_NUM_RESOURCES as we need to preserve compatibility */ | 357 | /* Here should be 7 and not PCI_NUM_RESOURCES as we need to preserve compatibility */ |
358 | for(i=0; i<7; i++) | 358 | for (i=0; i<7; i++) { |
359 | u64 start, end; | ||
360 | pci_resource_to_user(dev, i, &dev->resource[i], &start, &end); | ||
359 | seq_printf(m, LONG_FORMAT, | 361 | seq_printf(m, LONG_FORMAT, |
360 | dev->resource[i].start | | 362 | ((unsigned long)start) | |
361 | (dev->resource[i].flags & PCI_REGION_FLAG_MASK)); | 363 | (dev->resource[i].flags & PCI_REGION_FLAG_MASK)); |
362 | for(i=0; i<7; i++) | 364 | } |
365 | for (i=0; i<7; i++) { | ||
366 | u64 start, end; | ||
367 | pci_resource_to_user(dev, i, &dev->resource[i], &start, &end); | ||
363 | seq_printf(m, LONG_FORMAT, | 368 | seq_printf(m, LONG_FORMAT, |
364 | dev->resource[i].start < dev->resource[i].end ? | 369 | dev->resource[i].start < dev->resource[i].end ? |
365 | dev->resource[i].end - dev->resource[i].start + 1 : 0); | 370 | (unsigned long)(end - start) + 1 : 0); |
371 | } | ||
366 | seq_putc(m, '\t'); | 372 | seq_putc(m, '\t'); |
367 | if (drv) | 373 | if (drv) |
368 | seq_printf(m, "%s", drv->name); | 374 | seq_printf(m, "%s", drv->name); |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 968033fd29f0..1521fd5d95cc 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -767,6 +767,7 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev) | |||
767 | if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) { | 767 | if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) { |
768 | if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB) | 768 | if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB) |
769 | switch(dev->subsystem_device) { | 769 | switch(dev->subsystem_device) { |
770 | case 0x8025: /* P4B-LX */ | ||
770 | case 0x8070: /* P4B */ | 771 | case 0x8070: /* P4B */ |
771 | case 0x8088: /* P4B533 */ | 772 | case 0x8088: /* P4B533 */ |
772 | case 0x1626: /* L3C notebook */ | 773 | case 0x1626: /* L3C notebook */ |
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index 96f077f9a659..27a294b6965d 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c | |||
@@ -18,17 +18,21 @@ static void pci_free_resources(struct pci_dev *dev) | |||
18 | 18 | ||
19 | static void pci_destroy_dev(struct pci_dev *dev) | 19 | static void pci_destroy_dev(struct pci_dev *dev) |
20 | { | 20 | { |
21 | pci_proc_detach_device(dev); | 21 | if (!list_empty(&dev->global_list)) { |
22 | pci_remove_sysfs_dev_files(dev); | 22 | pci_proc_detach_device(dev); |
23 | device_unregister(&dev->dev); | 23 | pci_remove_sysfs_dev_files(dev); |
24 | device_unregister(&dev->dev); | ||
25 | spin_lock(&pci_bus_lock); | ||
26 | list_del(&dev->global_list); | ||
27 | dev->global_list.next = dev->global_list.prev = NULL; | ||
28 | spin_unlock(&pci_bus_lock); | ||
29 | } | ||
24 | 30 | ||
25 | /* Remove the device from the device lists, and prevent any further | 31 | /* Remove the device from the device lists, and prevent any further |
26 | * list accesses from this device */ | 32 | * list accesses from this device */ |
27 | spin_lock(&pci_bus_lock); | 33 | spin_lock(&pci_bus_lock); |
28 | list_del(&dev->bus_list); | 34 | list_del(&dev->bus_list); |
29 | list_del(&dev->global_list); | ||
30 | dev->bus_list.next = dev->bus_list.prev = NULL; | 35 | dev->bus_list.next = dev->bus_list.prev = NULL; |
31 | dev->global_list.next = dev->global_list.prev = NULL; | ||
32 | spin_unlock(&pci_bus_lock); | 36 | spin_unlock(&pci_bus_lock); |
33 | 37 | ||
34 | pci_free_resources(dev); | 38 | pci_free_resources(dev); |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 1ba84be0b4c0..9fe48f712be9 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -72,7 +72,11 @@ pbus_assign_resources_sorted(struct pci_bus *bus) | |||
72 | for (list = head.next; list;) { | 72 | for (list = head.next; list;) { |
73 | res = list->res; | 73 | res = list->res; |
74 | idx = res - &list->dev->resource[0]; | 74 | idx = res - &list->dev->resource[0]; |
75 | pci_assign_resource(list->dev, idx); | 75 | if (pci_assign_resource(list->dev, idx)) { |
76 | res->start = 0; | ||
77 | res->end = 0; | ||
78 | res->flags = 0; | ||
79 | } | ||
76 | tmp = list; | 80 | tmp = list; |
77 | list = list->next; | 81 | list = list->next; |
78 | kfree(tmp); | 82 | kfree(tmp); |
@@ -270,6 +274,8 @@ find_free_bus_resource(struct pci_bus *bus, unsigned long type) | |||
270 | 274 | ||
271 | for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { | 275 | for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { |
272 | r = bus->resource[i]; | 276 | r = bus->resource[i]; |
277 | if (r == &ioport_resource || r == &iomem_resource) | ||
278 | continue; | ||
273 | if (r && (r->flags & type_mask) == type && !r->parent) | 279 | if (r && (r->flags & type_mask) == type && !r->parent) |
274 | return r; | 280 | return r; |
275 | } | 281 | } |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index cabddd49f6ff..d5afd557fe37 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -847,7 +847,7 @@ pcmcia_device_stringattr(prod_id2, prod_id[1]); | |||
847 | pcmcia_device_stringattr(prod_id3, prod_id[2]); | 847 | pcmcia_device_stringattr(prod_id3, prod_id[2]); |
848 | pcmcia_device_stringattr(prod_id4, prod_id[3]); | 848 | pcmcia_device_stringattr(prod_id4, prod_id[3]); |
849 | 849 | ||
850 | static ssize_t modalias_show(struct device *dev, char *buf) | 850 | static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) |
851 | { | 851 | { |
852 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 852 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
853 | int i; | 853 | int i; |
diff --git a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c index 8f0f46907a81..87302fb14885 100644 --- a/drivers/sbus/char/bpp.c +++ b/drivers/sbus/char/bpp.c | |||
@@ -79,10 +79,6 @@ struct inst { | |||
79 | 79 | ||
80 | unsigned char run_length; | 80 | unsigned char run_length; |
81 | unsigned char repeat_byte; | 81 | unsigned char repeat_byte; |
82 | |||
83 | /* These members manage timeouts for programmed delays */ | ||
84 | wait_queue_head_t wait_queue; | ||
85 | struct timer_list timer_list; | ||
86 | }; | 82 | }; |
87 | 83 | ||
88 | static struct inst instances[BPP_NO]; | 84 | static struct inst instances[BPP_NO]; |
@@ -297,16 +293,10 @@ static unsigned short get_pins(unsigned minor) | |||
297 | 293 | ||
298 | #endif /* __sparc__ */ | 294 | #endif /* __sparc__ */ |
299 | 295 | ||
300 | static void bpp_wake_up(unsigned long val) | ||
301 | { wake_up(&instances[val].wait_queue); } | ||
302 | |||
303 | static void snooze(unsigned long snooze_time, unsigned minor) | 296 | static void snooze(unsigned long snooze_time, unsigned minor) |
304 | { | 297 | { |
305 | init_timer(&instances[minor].timer_list); | 298 | set_current_state(TASK_UNINTERRUPTIBLE); |
306 | instances[minor].timer_list.expires = jiffies + snooze_time + 1; | 299 | schedule_timeout(snooze_time + 1); |
307 | instances[minor].timer_list.data = minor; | ||
308 | add_timer(&instances[minor].timer_list); | ||
309 | sleep_on (&instances[minor].wait_queue); | ||
310 | } | 300 | } |
311 | 301 | ||
312 | static int wait_for(unsigned short set, unsigned short clr, | 302 | static int wait_for(unsigned short set, unsigned short clr, |
@@ -880,11 +870,8 @@ static void probeLptPort(unsigned idx) | |||
880 | instances[idx].enhanced = 0; | 870 | instances[idx].enhanced = 0; |
881 | instances[idx].direction = 0; | 871 | instances[idx].direction = 0; |
882 | instances[idx].mode = COMPATIBILITY; | 872 | instances[idx].mode = COMPATIBILITY; |
883 | instances[idx].wait_queue = 0; | ||
884 | instances[idx].run_length = 0; | 873 | instances[idx].run_length = 0; |
885 | instances[idx].run_flag = 0; | 874 | instances[idx].run_flag = 0; |
886 | init_timer(&instances[idx].timer_list); | ||
887 | instances[idx].timer_list.function = bpp_wake_up; | ||
888 | if (!request_region(lpAddr,3, dev_name)) return; | 875 | if (!request_region(lpAddr,3, dev_name)) return; |
889 | 876 | ||
890 | /* | 877 | /* |
@@ -977,11 +964,8 @@ static void probeLptPort(unsigned idx) | |||
977 | instances[idx].enhanced = 0; | 964 | instances[idx].enhanced = 0; |
978 | instances[idx].direction = 0; | 965 | instances[idx].direction = 0; |
979 | instances[idx].mode = COMPATIBILITY; | 966 | instances[idx].mode = COMPATIBILITY; |
980 | init_waitqueue_head(&instances[idx].wait_queue); | ||
981 | instances[idx].run_length = 0; | 967 | instances[idx].run_length = 0; |
982 | instances[idx].run_flag = 0; | 968 | instances[idx].run_flag = 0; |
983 | init_timer(&instances[idx].timer_list); | ||
984 | instances[idx].timer_list.function = bpp_wake_up; | ||
985 | 969 | ||
986 | if (!rp) return; | 970 | if (!rp) return; |
987 | 971 | ||
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 34dbc37a79d4..bc6e4627c7a1 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -1916,9 +1916,9 @@ static void __twa_shutdown(TW_Device_Extension *tw_dev) | |||
1916 | } /* End __twa_shutdown() */ | 1916 | } /* End __twa_shutdown() */ |
1917 | 1917 | ||
1918 | /* Wrapper for __twa_shutdown */ | 1918 | /* Wrapper for __twa_shutdown */ |
1919 | static void twa_shutdown(struct device *dev) | 1919 | static void twa_shutdown(struct pci_dev *pdev) |
1920 | { | 1920 | { |
1921 | struct Scsi_Host *host = pci_get_drvdata(to_pci_dev(dev)); | 1921 | struct Scsi_Host *host = pci_get_drvdata(pdev); |
1922 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; | 1922 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; |
1923 | 1923 | ||
1924 | __twa_shutdown(tw_dev); | 1924 | __twa_shutdown(tw_dev); |
@@ -2140,9 +2140,7 @@ static struct pci_driver twa_driver = { | |||
2140 | .id_table = twa_pci_tbl, | 2140 | .id_table = twa_pci_tbl, |
2141 | .probe = twa_probe, | 2141 | .probe = twa_probe, |
2142 | .remove = twa_remove, | 2142 | .remove = twa_remove, |
2143 | .driver = { | 2143 | .shutdown = twa_shutdown |
2144 | .shutdown = twa_shutdown | ||
2145 | } | ||
2146 | }; | 2144 | }; |
2147 | 2145 | ||
2148 | /* This function is called on driver initialization */ | 2146 | /* This function is called on driver initialization */ |
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index b6dc576da430..973c51fb0fe2 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
@@ -2264,9 +2264,9 @@ static void __tw_shutdown(TW_Device_Extension *tw_dev) | |||
2264 | } /* End __tw_shutdown() */ | 2264 | } /* End __tw_shutdown() */ |
2265 | 2265 | ||
2266 | /* Wrapper for __tw_shutdown */ | 2266 | /* Wrapper for __tw_shutdown */ |
2267 | static void tw_shutdown(struct device *dev) | 2267 | static void tw_shutdown(struct pci_dev *pdev) |
2268 | { | 2268 | { |
2269 | struct Scsi_Host *host = pci_get_drvdata(to_pci_dev(dev)); | 2269 | struct Scsi_Host *host = pci_get_drvdata(pdev); |
2270 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; | 2270 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; |
2271 | 2271 | ||
2272 | __tw_shutdown(tw_dev); | 2272 | __tw_shutdown(tw_dev); |
@@ -2451,9 +2451,7 @@ static struct pci_driver tw_driver = { | |||
2451 | .id_table = tw_pci_tbl, | 2451 | .id_table = tw_pci_tbl, |
2452 | .probe = tw_probe, | 2452 | .probe = tw_probe, |
2453 | .remove = tw_remove, | 2453 | .remove = tw_remove, |
2454 | .driver = { | 2454 | .shutdown = tw_shutdown, |
2455 | .shutdown = tw_shutdown | ||
2456 | } | ||
2457 | }; | 2455 | }; |
2458 | 2456 | ||
2459 | /* This function is called on driver initialization */ | 2457 | /* This function is called on driver initialization */ |
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 9a547ca9c864..c5623694d10f 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -304,26 +304,19 @@ static int ahci_port_start(struct ata_port *ap) | |||
304 | struct device *dev = ap->host_set->dev; | 304 | struct device *dev = ap->host_set->dev; |
305 | struct ahci_host_priv *hpriv = ap->host_set->private_data; | 305 | struct ahci_host_priv *hpriv = ap->host_set->private_data; |
306 | struct ahci_port_priv *pp; | 306 | struct ahci_port_priv *pp; |
307 | int rc; | ||
308 | void *mem, *mmio = ap->host_set->mmio_base; | 307 | void *mem, *mmio = ap->host_set->mmio_base; |
309 | void *port_mmio = ahci_port_base(mmio, ap->port_no); | 308 | void *port_mmio = ahci_port_base(mmio, ap->port_no); |
310 | dma_addr_t mem_dma; | 309 | dma_addr_t mem_dma; |
311 | 310 | ||
312 | rc = ata_port_start(ap); | ||
313 | if (rc) | ||
314 | return rc; | ||
315 | |||
316 | pp = kmalloc(sizeof(*pp), GFP_KERNEL); | 311 | pp = kmalloc(sizeof(*pp), GFP_KERNEL); |
317 | if (!pp) { | 312 | if (!pp) |
318 | rc = -ENOMEM; | 313 | return -ENOMEM; |
319 | goto err_out; | ||
320 | } | ||
321 | memset(pp, 0, sizeof(*pp)); | 314 | memset(pp, 0, sizeof(*pp)); |
322 | 315 | ||
323 | mem = dma_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma, GFP_KERNEL); | 316 | mem = dma_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma, GFP_KERNEL); |
324 | if (!mem) { | 317 | if (!mem) { |
325 | rc = -ENOMEM; | 318 | kfree(pp); |
326 | goto err_out_kfree; | 319 | return -ENOMEM; |
327 | } | 320 | } |
328 | memset(mem, 0, AHCI_PORT_PRIV_DMA_SZ); | 321 | memset(mem, 0, AHCI_PORT_PRIV_DMA_SZ); |
329 | 322 | ||
@@ -373,12 +366,6 @@ static int ahci_port_start(struct ata_port *ap) | |||
373 | readl(port_mmio + PORT_CMD); /* flush */ | 366 | readl(port_mmio + PORT_CMD); /* flush */ |
374 | 367 | ||
375 | return 0; | 368 | return 0; |
376 | |||
377 | err_out_kfree: | ||
378 | kfree(pp); | ||
379 | err_out: | ||
380 | ata_port_stop(ap); | ||
381 | return rc; | ||
382 | } | 369 | } |
383 | 370 | ||
384 | 371 | ||
@@ -404,7 +391,6 @@ static void ahci_port_stop(struct ata_port *ap) | |||
404 | dma_free_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, | 391 | dma_free_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, |
405 | pp->cmd_slot, pp->cmd_slot_dma); | 392 | pp->cmd_slot, pp->cmd_slot_dma); |
406 | kfree(pp); | 393 | kfree(pp); |
407 | ata_port_stop(ap); | ||
408 | } | 394 | } |
409 | 395 | ||
410 | static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg_in) | 396 | static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg_in) |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 80d022625c82..babd48363402 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -6012,7 +6012,7 @@ static int __devinit ipr_probe(struct pci_dev *pdev, | |||
6012 | 6012 | ||
6013 | /** | 6013 | /** |
6014 | * ipr_shutdown - Shutdown handler. | 6014 | * ipr_shutdown - Shutdown handler. |
6015 | * @dev: device struct | 6015 | * @pdev: pci device struct |
6016 | * | 6016 | * |
6017 | * This function is invoked upon system shutdown/reboot. It will issue | 6017 | * This function is invoked upon system shutdown/reboot. It will issue |
6018 | * an adapter shutdown to the adapter to flush the write cache. | 6018 | * an adapter shutdown to the adapter to flush the write cache. |
@@ -6020,9 +6020,9 @@ static int __devinit ipr_probe(struct pci_dev *pdev, | |||
6020 | * Return value: | 6020 | * Return value: |
6021 | * none | 6021 | * none |
6022 | **/ | 6022 | **/ |
6023 | static void ipr_shutdown(struct device *dev) | 6023 | static void ipr_shutdown(struct pci_dev *pdev) |
6024 | { | 6024 | { |
6025 | struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(to_pci_dev(dev)); | 6025 | struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev); |
6026 | unsigned long lock_flags = 0; | 6026 | unsigned long lock_flags = 0; |
6027 | 6027 | ||
6028 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | 6028 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
@@ -6068,9 +6068,7 @@ static struct pci_driver ipr_driver = { | |||
6068 | .id_table = ipr_pci_table, | 6068 | .id_table = ipr_pci_table, |
6069 | .probe = ipr_probe, | 6069 | .probe = ipr_probe, |
6070 | .remove = ipr_remove, | 6070 | .remove = ipr_remove, |
6071 | .driver = { | 6071 | .shutdown = ipr_shutdown, |
6072 | .shutdown = ipr_shutdown, | ||
6073 | }, | ||
6074 | }; | 6072 | }; |
6075 | 6073 | ||
6076 | /** | 6074 | /** |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 36b401fee1f1..cb535fa185b9 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -1408,7 +1408,9 @@ void __sata_phy_reset(struct ata_port *ap) | |||
1408 | if (ap->flags & ATA_FLAG_SATA_RESET) { | 1408 | if (ap->flags & ATA_FLAG_SATA_RESET) { |
1409 | /* issue phy wake/reset */ | 1409 | /* issue phy wake/reset */ |
1410 | scr_write_flush(ap, SCR_CONTROL, 0x301); | 1410 | scr_write_flush(ap, SCR_CONTROL, 0x301); |
1411 | udelay(400); /* FIXME: a guess */ | 1411 | /* Couldn't find anything in SATA I/II specs, but |
1412 | * AHCI-1.1 10.4.2 says at least 1 ms. */ | ||
1413 | mdelay(1); | ||
1412 | } | 1414 | } |
1413 | scr_write_flush(ap, SCR_CONTROL, 0x300); /* phy wake/clear reset */ | 1415 | scr_write_flush(ap, SCR_CONTROL, 0x300); /* phy wake/clear reset */ |
1414 | 1416 | ||
@@ -1920,6 +1922,7 @@ static const char * ata_dma_blacklist [] = { | |||
1920 | "HITACHI CDR-8335", | 1922 | "HITACHI CDR-8335", |
1921 | "HITACHI CDR-8435", | 1923 | "HITACHI CDR-8435", |
1922 | "Toshiba CD-ROM XM-6202B", | 1924 | "Toshiba CD-ROM XM-6202B", |
1925 | "TOSHIBA CD-ROM XM-1702BC", | ||
1923 | "CD-532E-A", | 1926 | "CD-532E-A", |
1924 | "E-IDE CD-ROM CR-840", | 1927 | "E-IDE CD-ROM CR-840", |
1925 | "CD-ROM Drive/F5A", | 1928 | "CD-ROM Drive/F5A", |
@@ -1927,7 +1930,6 @@ static const char * ata_dma_blacklist [] = { | |||
1927 | "SAMSUNG CD-ROM SC-148C", | 1930 | "SAMSUNG CD-ROM SC-148C", |
1928 | "SAMSUNG CD-ROM SC", | 1931 | "SAMSUNG CD-ROM SC", |
1929 | "SanDisk SDP3B-64", | 1932 | "SanDisk SDP3B-64", |
1930 | "SAMSUNG CD-ROM SN-124", | ||
1931 | "ATAPI CD-ROM DRIVE 40X MAXIMUM", | 1933 | "ATAPI CD-ROM DRIVE 40X MAXIMUM", |
1932 | "_NEC DV5800A", | 1934 | "_NEC DV5800A", |
1933 | }; | 1935 | }; |
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c index edd47d1f0b17..932dcf0366eb 100644 --- a/drivers/scsi/mac53c94.c +++ b/drivers/scsi/mac53c94.c | |||
@@ -424,7 +424,7 @@ static struct scsi_host_template mac53c94_template = { | |||
424 | .use_clustering = DISABLE_CLUSTERING, | 424 | .use_clustering = DISABLE_CLUSTERING, |
425 | }; | 425 | }; |
426 | 426 | ||
427 | static int mac53c94_probe(struct macio_dev *mdev, const struct of_match *match) | 427 | static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *match) |
428 | { | 428 | { |
429 | struct device_node *node = macio_get_of_node(mdev); | 429 | struct device_node *node = macio_get_of_node(mdev); |
430 | struct pci_dev *pdev = macio_get_pci_dev(mdev); | 430 | struct pci_dev *pdev = macio_get_pci_dev(mdev); |
@@ -544,15 +544,14 @@ static int mac53c94_remove(struct macio_dev *mdev) | |||
544 | } | 544 | } |
545 | 545 | ||
546 | 546 | ||
547 | static struct of_match mac53c94_match[] = | 547 | static struct of_device_id mac53c94_match[] = |
548 | { | 548 | { |
549 | { | 549 | { |
550 | .name = "53c94", | 550 | .name = "53c94", |
551 | .type = OF_ANY_MATCH, | ||
552 | .compatible = OF_ANY_MATCH | ||
553 | }, | 551 | }, |
554 | {}, | 552 | {}, |
555 | }; | 553 | }; |
554 | MODULE_DEVICE_TABLE (of, mac53c94_match); | ||
556 | 555 | ||
557 | static struct macio_driver mac53c94_driver = | 556 | static struct macio_driver mac53c94_driver = |
558 | { | 557 | { |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index ec81532eb845..a70cdf31311c 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -5036,9 +5036,9 @@ megaraid_remove_one(struct pci_dev *pdev) | |||
5036 | } | 5036 | } |
5037 | 5037 | ||
5038 | static void | 5038 | static void |
5039 | megaraid_shutdown(struct device *dev) | 5039 | megaraid_shutdown(struct pci_dev *pdev) |
5040 | { | 5040 | { |
5041 | struct Scsi_Host *host = pci_get_drvdata(to_pci_dev(dev)); | 5041 | struct Scsi_Host *host = pci_get_drvdata(pdev); |
5042 | adapter_t *adapter = (adapter_t *)host->hostdata; | 5042 | adapter_t *adapter = (adapter_t *)host->hostdata; |
5043 | 5043 | ||
5044 | __megaraid_shutdown(adapter); | 5044 | __megaraid_shutdown(adapter); |
@@ -5070,9 +5070,7 @@ static struct pci_driver megaraid_pci_driver = { | |||
5070 | .id_table = megaraid_pci_tbl, | 5070 | .id_table = megaraid_pci_tbl, |
5071 | .probe = megaraid_probe_one, | 5071 | .probe = megaraid_probe_one, |
5072 | .remove = __devexit_p(megaraid_remove_one), | 5072 | .remove = __devexit_p(megaraid_remove_one), |
5073 | .driver = { | 5073 | .shutdown = megaraid_shutdown, |
5074 | .shutdown = megaraid_shutdown, | ||
5075 | }, | ||
5076 | }; | 5074 | }; |
5077 | 5075 | ||
5078 | static int __init megaraid_init(void) | 5076 | static int __init megaraid_init(void) |
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index b05737ae5eff..ff1933298da6 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c | |||
@@ -1847,7 +1847,7 @@ static struct scsi_host_template mesh_template = { | |||
1847 | .use_clustering = DISABLE_CLUSTERING, | 1847 | .use_clustering = DISABLE_CLUSTERING, |
1848 | }; | 1848 | }; |
1849 | 1849 | ||
1850 | static int mesh_probe(struct macio_dev *mdev, const struct of_match *match) | 1850 | static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) |
1851 | { | 1851 | { |
1852 | struct device_node *mesh = macio_get_of_node(mdev); | 1852 | struct device_node *mesh = macio_get_of_node(mdev); |
1853 | struct pci_dev* pdev = macio_get_pci_dev(mdev); | 1853 | struct pci_dev* pdev = macio_get_pci_dev(mdev); |
@@ -2012,20 +2012,18 @@ static int mesh_remove(struct macio_dev *mdev) | |||
2012 | } | 2012 | } |
2013 | 2013 | ||
2014 | 2014 | ||
2015 | static struct of_match mesh_match[] = | 2015 | static struct of_device_id mesh_match[] = |
2016 | { | 2016 | { |
2017 | { | 2017 | { |
2018 | .name = "mesh", | 2018 | .name = "mesh", |
2019 | .type = OF_ANY_MATCH, | ||
2020 | .compatible = OF_ANY_MATCH | ||
2021 | }, | 2019 | }, |
2022 | { | 2020 | { |
2023 | .name = OF_ANY_MATCH, | ||
2024 | .type = "scsi", | 2021 | .type = "scsi", |
2025 | .compatible = "chrp,mesh0" | 2022 | .compatible = "chrp,mesh0" |
2026 | }, | 2023 | }, |
2027 | {}, | 2024 | {}, |
2028 | }; | 2025 | }; |
2026 | MODULE_DEVICE_TABLE (of, mesh_match); | ||
2029 | 2027 | ||
2030 | static struct macio_driver mesh_driver = | 2028 | static struct macio_driver mesh_driver = |
2031 | { | 2029 | { |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 621dee8b8cb2..10506f9cd0c9 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -632,7 +632,7 @@ static void scsi_free_sgtable(struct scatterlist *sgl, int index) | |||
632 | { | 632 | { |
633 | struct scsi_host_sg_pool *sgp; | 633 | struct scsi_host_sg_pool *sgp; |
634 | 634 | ||
635 | BUG_ON(index > SG_MEMPOOL_NR); | 635 | BUG_ON(index >= SG_MEMPOOL_NR); |
636 | 636 | ||
637 | sgp = scsi_sg_pools + index; | 637 | sgp = scsi_sg_pools + index; |
638 | mempool_free(sgl, sgp->pool); | 638 | mempool_free(sgl, sgp->pool); |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 34e75bc8f4cc..7e8fc7c1d4cc 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -105,7 +105,7 @@ static struct old_serial_port old_serial_port[] = { | |||
105 | SERIAL_PORT_DFNS /* defined in asm/serial.h */ | 105 | SERIAL_PORT_DFNS /* defined in asm/serial.h */ |
106 | }; | 106 | }; |
107 | 107 | ||
108 | #define UART_NR (ARRAY_SIZE(old_serial_port) + CONFIG_SERIAL_8250_NR_UARTS) | 108 | #define UART_NR CONFIG_SERIAL_8250_NR_UARTS |
109 | 109 | ||
110 | #ifdef CONFIG_SERIAL_8250_RSA | 110 | #ifdef CONFIG_SERIAL_8250_RSA |
111 | 111 | ||
@@ -993,21 +993,24 @@ static void autoconfig_irq(struct uart_8250_port *up) | |||
993 | up->port.irq = (irq > 0) ? irq : 0; | 993 | up->port.irq = (irq > 0) ? irq : 0; |
994 | } | 994 | } |
995 | 995 | ||
996 | static inline void __stop_tx(struct uart_8250_port *p) | ||
997 | { | ||
998 | if (p->ier & UART_IER_THRI) { | ||
999 | p->ier &= ~UART_IER_THRI; | ||
1000 | serial_out(p, UART_IER, p->ier); | ||
1001 | } | ||
1002 | } | ||
1003 | |||
996 | static void serial8250_stop_tx(struct uart_port *port, unsigned int tty_stop) | 1004 | static void serial8250_stop_tx(struct uart_port *port, unsigned int tty_stop) |
997 | { | 1005 | { |
998 | struct uart_8250_port *up = (struct uart_8250_port *)port; | 1006 | struct uart_8250_port *up = (struct uart_8250_port *)port; |
999 | 1007 | ||
1000 | if (up->ier & UART_IER_THRI) { | 1008 | __stop_tx(up); |
1001 | up->ier &= ~UART_IER_THRI; | ||
1002 | serial_out(up, UART_IER, up->ier); | ||
1003 | } | ||
1004 | 1009 | ||
1005 | /* | 1010 | /* |
1006 | * We only do this from uart_stop - if we run out of | 1011 | * We really want to stop the transmitter from sending. |
1007 | * characters to send, we don't want to prevent the | ||
1008 | * FIFO from emptying. | ||
1009 | */ | 1012 | */ |
1010 | if (up->port.type == PORT_16C950 && tty_stop) { | 1013 | if (up->port.type == PORT_16C950) { |
1011 | up->acr |= UART_ACR_TXDIS; | 1014 | up->acr |= UART_ACR_TXDIS; |
1012 | serial_icr_write(up, UART_ACR, up->acr); | 1015 | serial_icr_write(up, UART_ACR, up->acr); |
1013 | } | 1016 | } |
@@ -1031,10 +1034,11 @@ static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start) | |||
1031 | transmit_chars(up); | 1034 | transmit_chars(up); |
1032 | } | 1035 | } |
1033 | } | 1036 | } |
1037 | |||
1034 | /* | 1038 | /* |
1035 | * We only do this from uart_start | 1039 | * Re-enable the transmitter if we disabled it. |
1036 | */ | 1040 | */ |
1037 | if (tty_start && up->port.type == PORT_16C950) { | 1041 | if (up->port.type == PORT_16C950 && up->acr & UART_ACR_TXDIS) { |
1038 | up->acr &= ~UART_ACR_TXDIS; | 1042 | up->acr &= ~UART_ACR_TXDIS; |
1039 | serial_icr_write(up, UART_ACR, up->acr); | 1043 | serial_icr_write(up, UART_ACR, up->acr); |
1040 | } | 1044 | } |
@@ -1155,7 +1159,7 @@ static _INLINE_ void transmit_chars(struct uart_8250_port *up) | |||
1155 | return; | 1159 | return; |
1156 | } | 1160 | } |
1157 | if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { | 1161 | if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { |
1158 | serial8250_stop_tx(&up->port, 0); | 1162 | __stop_tx(up); |
1159 | return; | 1163 | return; |
1160 | } | 1164 | } |
1161 | 1165 | ||
@@ -1174,7 +1178,7 @@ static _INLINE_ void transmit_chars(struct uart_8250_port *up) | |||
1174 | DEBUG_INTR("THRE..."); | 1178 | DEBUG_INTR("THRE..."); |
1175 | 1179 | ||
1176 | if (uart_circ_empty(xmit)) | 1180 | if (uart_circ_empty(xmit)) |
1177 | serial8250_stop_tx(&up->port, 0); | 1181 | __stop_tx(up); |
1178 | } | 1182 | } |
1179 | 1183 | ||
1180 | static _INLINE_ void check_modem_status(struct uart_8250_port *up) | 1184 | static _INLINE_ void check_modem_status(struct uart_8250_port *up) |
@@ -1376,13 +1380,10 @@ static unsigned int serial8250_tx_empty(struct uart_port *port) | |||
1376 | static unsigned int serial8250_get_mctrl(struct uart_port *port) | 1380 | static unsigned int serial8250_get_mctrl(struct uart_port *port) |
1377 | { | 1381 | { |
1378 | struct uart_8250_port *up = (struct uart_8250_port *)port; | 1382 | struct uart_8250_port *up = (struct uart_8250_port *)port; |
1379 | unsigned long flags; | ||
1380 | unsigned char status; | 1383 | unsigned char status; |
1381 | unsigned int ret; | 1384 | unsigned int ret; |
1382 | 1385 | ||
1383 | spin_lock_irqsave(&up->port.lock, flags); | ||
1384 | status = serial_in(up, UART_MSR); | 1386 | status = serial_in(up, UART_MSR); |
1385 | spin_unlock_irqrestore(&up->port.lock, flags); | ||
1386 | 1387 | ||
1387 | ret = 0; | 1388 | ret = 0; |
1388 | if (status & UART_MSR_DCD) | 1389 | if (status & UART_MSR_DCD) |
@@ -2060,7 +2061,8 @@ static void __init serial8250_isa_init_ports(void) | |||
2060 | up->port.ops = &serial8250_pops; | 2061 | up->port.ops = &serial8250_pops; |
2061 | } | 2062 | } |
2062 | 2063 | ||
2063 | for (i = 0, up = serial8250_ports; i < ARRAY_SIZE(old_serial_port); | 2064 | for (i = 0, up = serial8250_ports; |
2065 | i < ARRAY_SIZE(old_serial_port) && i < UART_NR; | ||
2064 | i++, up++) { | 2066 | i++, up++) { |
2065 | up->port.iobase = old_serial_port[i].port; | 2067 | up->port.iobase = old_serial_port[i].port; |
2066 | up->port.irq = irq_canonicalize(old_serial_port[i].irq); | 2068 | up->port.irq = irq_canonicalize(old_serial_port[i].irq); |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index e879bce160df..e0d0a470ddfc 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -86,7 +86,7 @@ config SERIAL_8250_ACPI | |||
86 | namespace, say Y here. If unsure, say N. | 86 | namespace, say Y here. If unsure, say N. |
87 | 87 | ||
88 | config SERIAL_8250_NR_UARTS | 88 | config SERIAL_8250_NR_UARTS |
89 | int "Maximum number of non-legacy 8250/16550 serial ports" | 89 | int "Maximum number of 8250/16550 serial ports" |
90 | depends on SERIAL_8250 | 90 | depends on SERIAL_8250 |
91 | default "4" | 91 | default "4" |
92 | help | 92 | help |
diff --git a/drivers/serial/au1x00_uart.c b/drivers/serial/au1x00_uart.c index 5400dc2c087e..6104aeef1243 100644 --- a/drivers/serial/au1x00_uart.c +++ b/drivers/serial/au1x00_uart.c | |||
@@ -556,13 +556,10 @@ static unsigned int serial8250_tx_empty(struct uart_port *port) | |||
556 | static unsigned int serial8250_get_mctrl(struct uart_port *port) | 556 | static unsigned int serial8250_get_mctrl(struct uart_port *port) |
557 | { | 557 | { |
558 | struct uart_8250_port *up = (struct uart_8250_port *)port; | 558 | struct uart_8250_port *up = (struct uart_8250_port *)port; |
559 | unsigned long flags; | ||
560 | unsigned char status; | 559 | unsigned char status; |
561 | unsigned int ret; | 560 | unsigned int ret; |
562 | 561 | ||
563 | spin_lock_irqsave(&up->port.lock, flags); | ||
564 | status = serial_in(up, UART_MSR); | 562 | status = serial_in(up, UART_MSR); |
565 | spin_unlock_irqrestore(&up->port.lock, flags); | ||
566 | 563 | ||
567 | ret = 0; | 564 | ret = 0; |
568 | if (status & UART_MSR_DCD) | 565 | if (status & UART_MSR_DCD) |
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c index de26cf7b003c..7911912f50c7 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c | |||
@@ -94,12 +94,42 @@ void smc1_lineif(struct uart_cpm_port *pinfo) | |||
94 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_paodr &= ~iobits; | 94 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_paodr &= ~iobits; |
95 | } | 95 | } |
96 | 96 | ||
97 | #ifdef CONFIG_MPC885ADS | ||
98 | /* Enable SMC1 transceivers */ | ||
99 | { | ||
100 | volatile uint __iomem *bcsr1 = ioremap(BCSR1, 4); | ||
101 | uint tmp; | ||
102 | |||
103 | tmp = in_be32(bcsr1); | ||
104 | tmp &= ~BCSR1_RS232EN_1; | ||
105 | out_be32(bcsr1, tmp); | ||
106 | iounmap(bcsr1); | ||
107 | } | ||
108 | #endif | ||
109 | |||
97 | pinfo->brg = 1; | 110 | pinfo->brg = 1; |
98 | } | 111 | } |
99 | 112 | ||
100 | void smc2_lineif(struct uart_cpm_port *pinfo) | 113 | void smc2_lineif(struct uart_cpm_port *pinfo) |
101 | { | 114 | { |
102 | /* XXX SMC2: insert port configuration here */ | 115 | #ifdef CONFIG_MPC885ADS |
116 | volatile cpm8xx_t *cp = cpmp; | ||
117 | volatile uint __iomem *bcsr1; | ||
118 | uint tmp; | ||
119 | |||
120 | cp->cp_pepar |= 0x00000c00; | ||
121 | cp->cp_pedir &= ~0x00000c00; | ||
122 | cp->cp_peso &= ~0x00000400; | ||
123 | cp->cp_peso |= 0x00000800; | ||
124 | |||
125 | /* Enable SMC2 transceivers */ | ||
126 | bcsr1 = ioremap(BCSR1, 4); | ||
127 | tmp = in_be32(bcsr1); | ||
128 | tmp &= ~BCSR1_RS232EN_2; | ||
129 | out_be32(bcsr1, tmp); | ||
130 | iounmap(bcsr1); | ||
131 | #endif | ||
132 | |||
103 | pinfo->brg = 2; | 133 | pinfo->brg = 2; |
104 | } | 134 | } |
105 | 135 | ||
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c index 3ea46c069f6f..ea5bf4d4daa3 100644 --- a/drivers/serial/ip22zilog.c +++ b/drivers/serial/ip22zilog.c | |||
@@ -518,27 +518,28 @@ static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id, struct pt_regs *re | |||
518 | static __inline__ unsigned char ip22zilog_read_channel_status(struct uart_port *port) | 518 | static __inline__ unsigned char ip22zilog_read_channel_status(struct uart_port *port) |
519 | { | 519 | { |
520 | struct zilog_channel *channel; | 520 | struct zilog_channel *channel; |
521 | unsigned long flags; | ||
522 | unsigned char status; | 521 | unsigned char status; |
523 | 522 | ||
524 | spin_lock_irqsave(&port->lock, flags); | ||
525 | |||
526 | channel = ZILOG_CHANNEL_FROM_PORT(port); | 523 | channel = ZILOG_CHANNEL_FROM_PORT(port); |
527 | status = readb(&channel->control); | 524 | status = readb(&channel->control); |
528 | ZSDELAY(); | 525 | ZSDELAY(); |
529 | 526 | ||
530 | spin_unlock_irqrestore(&port->lock, flags); | ||
531 | |||
532 | return status; | 527 | return status; |
533 | } | 528 | } |
534 | 529 | ||
535 | /* The port lock is not held. */ | 530 | /* The port lock is not held. */ |
536 | static unsigned int ip22zilog_tx_empty(struct uart_port *port) | 531 | static unsigned int ip22zilog_tx_empty(struct uart_port *port) |
537 | { | 532 | { |
533 | unsigned long flags; | ||
538 | unsigned char status; | 534 | unsigned char status; |
539 | unsigned int ret; | 535 | unsigned int ret; |
540 | 536 | ||
537 | spin_lock_irqsave(&port->lock, flags); | ||
538 | |||
541 | status = ip22zilog_read_channel_status(port); | 539 | status = ip22zilog_read_channel_status(port); |
540 | |||
541 | spin_unlock_irqrestore(&port->lock, flags); | ||
542 | |||
542 | if (status & Tx_BUF_EMP) | 543 | if (status & Tx_BUF_EMP) |
543 | ret = TIOCSER_TEMT; | 544 | ret = TIOCSER_TEMT; |
544 | else | 545 | else |
@@ -547,7 +548,7 @@ static unsigned int ip22zilog_tx_empty(struct uart_port *port) | |||
547 | return ret; | 548 | return ret; |
548 | } | 549 | } |
549 | 550 | ||
550 | /* The port lock is not held. */ | 551 | /* The port lock is held and interrupts are disabled. */ |
551 | static unsigned int ip22zilog_get_mctrl(struct uart_port *port) | 552 | static unsigned int ip22zilog_get_mctrl(struct uart_port *port) |
552 | { | 553 | { |
553 | unsigned char status; | 554 | unsigned char status; |
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c index a2a643318002..e43276c6a954 100644 --- a/drivers/serial/mpsc.c +++ b/drivers/serial/mpsc.c | |||
@@ -1058,12 +1058,9 @@ mpsc_get_mctrl(struct uart_port *port) | |||
1058 | { | 1058 | { |
1059 | struct mpsc_port_info *pi = (struct mpsc_port_info *)port; | 1059 | struct mpsc_port_info *pi = (struct mpsc_port_info *)port; |
1060 | u32 mflags, status; | 1060 | u32 mflags, status; |
1061 | ulong iflags; | ||
1062 | 1061 | ||
1063 | spin_lock_irqsave(&pi->port.lock, iflags); | ||
1064 | status = (pi->mirror_regs) ? pi->MPSC_CHR_10_m : | 1062 | status = (pi->mirror_regs) ? pi->MPSC_CHR_10_m : |
1065 | readl(pi->mpsc_base + MPSC_CHR_10); | 1063 | readl(pi->mpsc_base + MPSC_CHR_10); |
1066 | spin_unlock_irqrestore(&pi->port.lock, iflags); | ||
1067 | 1064 | ||
1068 | mflags = 0; | 1065 | mflags = 0; |
1069 | if (status & 0x1) | 1066 | if (status & 0x1) |
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c index 85abd8a045e0..7db2f37532cf 100644 --- a/drivers/serial/pmac_zilog.c +++ b/drivers/serial/pmac_zilog.c | |||
@@ -604,7 +604,7 @@ static void pmz_set_mctrl(struct uart_port *port, unsigned int mctrl) | |||
604 | /* | 604 | /* |
605 | * Get Modem Control bits (only the input ones, the core will | 605 | * Get Modem Control bits (only the input ones, the core will |
606 | * or that with a cached value of the control ones) | 606 | * or that with a cached value of the control ones) |
607 | * The port lock is not held. | 607 | * The port lock is held and interrupts are disabled. |
608 | */ | 608 | */ |
609 | static unsigned int pmz_get_mctrl(struct uart_port *port) | 609 | static unsigned int pmz_get_mctrl(struct uart_port *port) |
610 | { | 610 | { |
@@ -615,7 +615,7 @@ static unsigned int pmz_get_mctrl(struct uart_port *port) | |||
615 | if (ZS_IS_ASLEEP(uap) || uap->node == NULL) | 615 | if (ZS_IS_ASLEEP(uap) || uap->node == NULL) |
616 | return 0; | 616 | return 0; |
617 | 617 | ||
618 | status = pmz_peek_status(to_pmz(port)); | 618 | status = read_zsreg(uap, R0); |
619 | 619 | ||
620 | ret = 0; | 620 | ret = 0; |
621 | if (status & DCD) | 621 | if (status & DCD) |
@@ -1545,7 +1545,7 @@ static void pmz_dispose_port(struct uart_pmac_port *uap) | |||
1545 | /* | 1545 | /* |
1546 | * Called upon match with an escc node in the devive-tree. | 1546 | * Called upon match with an escc node in the devive-tree. |
1547 | */ | 1547 | */ |
1548 | static int pmz_attach(struct macio_dev *mdev, const struct of_match *match) | 1548 | static int pmz_attach(struct macio_dev *mdev, const struct of_device_id *match) |
1549 | { | 1549 | { |
1550 | int i; | 1550 | int i; |
1551 | 1551 | ||
@@ -1850,20 +1850,17 @@ err_out: | |||
1850 | return rc; | 1850 | return rc; |
1851 | } | 1851 | } |
1852 | 1852 | ||
1853 | static struct of_match pmz_match[] = | 1853 | static struct of_device_id pmz_match[] = |
1854 | { | 1854 | { |
1855 | { | 1855 | { |
1856 | .name = "ch-a", | 1856 | .name = "ch-a", |
1857 | .type = OF_ANY_MATCH, | ||
1858 | .compatible = OF_ANY_MATCH | ||
1859 | }, | 1857 | }, |
1860 | { | 1858 | { |
1861 | .name = "ch-b", | 1859 | .name = "ch-b", |
1862 | .type = OF_ANY_MATCH, | ||
1863 | .compatible = OF_ANY_MATCH | ||
1864 | }, | 1860 | }, |
1865 | {}, | 1861 | {}, |
1866 | }; | 1862 | }; |
1863 | MODULE_DEVICE_TABLE (of, pmz_match); | ||
1867 | 1864 | ||
1868 | static struct macio_driver pmz_driver = | 1865 | static struct macio_driver pmz_driver = |
1869 | { | 1866 | { |
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index 08b08d6ae904..461c81c93207 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c | |||
@@ -274,14 +274,11 @@ static unsigned int serial_pxa_tx_empty(struct uart_port *port) | |||
274 | static unsigned int serial_pxa_get_mctrl(struct uart_port *port) | 274 | static unsigned int serial_pxa_get_mctrl(struct uart_port *port) |
275 | { | 275 | { |
276 | struct uart_pxa_port *up = (struct uart_pxa_port *)port; | 276 | struct uart_pxa_port *up = (struct uart_pxa_port *)port; |
277 | unsigned long flags; | ||
278 | unsigned char status; | 277 | unsigned char status; |
279 | unsigned int ret; | 278 | unsigned int ret; |
280 | 279 | ||
281 | return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; | 280 | return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; |
282 | spin_lock_irqsave(&up->port.lock, flags); | ||
283 | status = serial_in(up, UART_MSR); | 281 | status = serial_in(up, UART_MSR); |
284 | spin_unlock_irqrestore(&up->port.lock, flags); | ||
285 | 282 | ||
286 | ret = 0; | 283 | ret = 0; |
287 | if (status & UART_MSR_DCD) | 284 | if (status & UART_MSR_DCD) |
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index 5c4678478b1d..7365d4b50b95 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c | |||
@@ -522,14 +522,11 @@ static void s3c24xx_serial_shutdown(struct uart_port *port) | |||
522 | static int s3c24xx_serial_startup(struct uart_port *port) | 522 | static int s3c24xx_serial_startup(struct uart_port *port) |
523 | { | 523 | { |
524 | struct s3c24xx_uart_port *ourport = to_ourport(port); | 524 | struct s3c24xx_uart_port *ourport = to_ourport(port); |
525 | unsigned long flags; | ||
526 | int ret; | 525 | int ret; |
527 | 526 | ||
528 | dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)\n", | 527 | dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)\n", |
529 | port->mapbase, port->membase); | 528 | port->mapbase, port->membase); |
530 | 529 | ||
531 | local_irq_save(flags); | ||
532 | |||
533 | rx_enabled(port) = 1; | 530 | rx_enabled(port) = 1; |
534 | 531 | ||
535 | ret = request_irq(RX_IRQ(port), | 532 | ret = request_irq(RX_IRQ(port), |
@@ -563,12 +560,10 @@ static int s3c24xx_serial_startup(struct uart_port *port) | |||
563 | /* the port reset code should have done the correct | 560 | /* the port reset code should have done the correct |
564 | * register setup for the port controls */ | 561 | * register setup for the port controls */ |
565 | 562 | ||
566 | local_irq_restore(flags); | ||
567 | return ret; | 563 | return ret; |
568 | 564 | ||
569 | err: | 565 | err: |
570 | s3c24xx_serial_shutdown(port); | 566 | s3c24xx_serial_shutdown(port); |
571 | local_irq_restore(flags); | ||
572 | return ret; | 567 | return ret; |
573 | } | 568 | } |
574 | 569 | ||
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 36b1ae083fb7..54699c3a00ab 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -182,6 +182,13 @@ static int uart_startup(struct uart_state *state, int init_hw) | |||
182 | uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR); | 182 | uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR); |
183 | } | 183 | } |
184 | 184 | ||
185 | if (info->flags & UIF_CTS_FLOW) { | ||
186 | spin_lock_irq(&port->lock); | ||
187 | if (!(port->ops->get_mctrl(port) & TIOCM_CTS)) | ||
188 | info->tty->hw_stopped = 1; | ||
189 | spin_unlock_irq(&port->lock); | ||
190 | } | ||
191 | |||
185 | info->flags |= UIF_INITIALIZED; | 192 | info->flags |= UIF_INITIALIZED; |
186 | 193 | ||
187 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 194 | clear_bit(TTY_IO_ERROR, &info->tty->flags); |
@@ -828,7 +835,10 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file) | |||
828 | if ((!file || !tty_hung_up_p(file)) && | 835 | if ((!file || !tty_hung_up_p(file)) && |
829 | !(tty->flags & (1 << TTY_IO_ERROR))) { | 836 | !(tty->flags & (1 << TTY_IO_ERROR))) { |
830 | result = port->mctrl; | 837 | result = port->mctrl; |
838 | |||
839 | spin_lock_irq(&port->lock); | ||
831 | result |= port->ops->get_mctrl(port); | 840 | result |= port->ops->get_mctrl(port); |
841 | spin_unlock_irq(&port->lock); | ||
832 | } | 842 | } |
833 | up(&state->sem); | 843 | up(&state->sem); |
834 | 844 | ||
@@ -1131,6 +1141,16 @@ static void uart_set_termios(struct tty_struct *tty, struct termios *old_termios | |||
1131 | spin_unlock_irqrestore(&state->port->lock, flags); | 1141 | spin_unlock_irqrestore(&state->port->lock, flags); |
1132 | } | 1142 | } |
1133 | 1143 | ||
1144 | /* Handle turning on CRTSCTS */ | ||
1145 | if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) { | ||
1146 | spin_lock_irqsave(&state->port->lock, flags); | ||
1147 | if (!(state->port->ops->get_mctrl(state->port) & TIOCM_CTS)) { | ||
1148 | tty->hw_stopped = 1; | ||
1149 | state->port->ops->stop_tx(state->port, 0); | ||
1150 | } | ||
1151 | spin_unlock_irqrestore(&state->port->lock, flags); | ||
1152 | } | ||
1153 | |||
1134 | #if 0 | 1154 | #if 0 |
1135 | /* | 1155 | /* |
1136 | * No need to wake up processes in open wait, since they | 1156 | * No need to wake up processes in open wait, since they |
@@ -1369,6 +1389,7 @@ uart_block_til_ready(struct file *filp, struct uart_state *state) | |||
1369 | DECLARE_WAITQUEUE(wait, current); | 1389 | DECLARE_WAITQUEUE(wait, current); |
1370 | struct uart_info *info = state->info; | 1390 | struct uart_info *info = state->info; |
1371 | struct uart_port *port = state->port; | 1391 | struct uart_port *port = state->port; |
1392 | unsigned int mctrl; | ||
1372 | 1393 | ||
1373 | info->blocked_open++; | 1394 | info->blocked_open++; |
1374 | state->count--; | 1395 | state->count--; |
@@ -1416,7 +1437,10 @@ uart_block_til_ready(struct file *filp, struct uart_state *state) | |||
1416 | * and wait for the carrier to indicate that the | 1437 | * and wait for the carrier to indicate that the |
1417 | * modem is ready for us. | 1438 | * modem is ready for us. |
1418 | */ | 1439 | */ |
1419 | if (port->ops->get_mctrl(port) & TIOCM_CAR) | 1440 | spin_lock_irq(&port->lock); |
1441 | mctrl = port->ops->get_mctrl(port); | ||
1442 | spin_unlock_irq(&port->lock); | ||
1443 | if (mctrl & TIOCM_CAR) | ||
1420 | break; | 1444 | break; |
1421 | 1445 | ||
1422 | up(&state->sem); | 1446 | up(&state->sem); |
@@ -1618,7 +1642,9 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i) | |||
1618 | 1642 | ||
1619 | if(capable(CAP_SYS_ADMIN)) | 1643 | if(capable(CAP_SYS_ADMIN)) |
1620 | { | 1644 | { |
1645 | spin_lock_irq(&port->lock); | ||
1621 | status = port->ops->get_mctrl(port); | 1646 | status = port->ops->get_mctrl(port); |
1647 | spin_unlock_irq(&port->lock); | ||
1622 | 1648 | ||
1623 | ret += sprintf(buf + ret, " tx:%d rx:%d", | 1649 | ret += sprintf(buf + ret, " tx:%d rx:%d", |
1624 | port->icount.tx, port->icount.rx); | 1650 | port->icount.tx, port->icount.rx); |
@@ -1782,6 +1808,12 @@ uart_set_options(struct uart_port *port, struct console *co, | |||
1782 | struct termios termios; | 1808 | struct termios termios; |
1783 | int i; | 1809 | int i; |
1784 | 1810 | ||
1811 | /* | ||
1812 | * Ensure that the serial console lock is initialised | ||
1813 | * early. | ||
1814 | */ | ||
1815 | spin_lock_init(&port->lock); | ||
1816 | |||
1785 | memset(&termios, 0, sizeof(struct termios)); | 1817 | memset(&termios, 0, sizeof(struct termios)); |
1786 | 1818 | ||
1787 | termios.c_cflag = CREAD | HUPCL | CLOCAL; | 1819 | termios.c_cflag = CREAD | HUPCL | CLOCAL; |
@@ -2170,10 +2202,16 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2170 | 2202 | ||
2171 | state->port = port; | 2203 | state->port = port; |
2172 | 2204 | ||
2173 | spin_lock_init(&port->lock); | ||
2174 | port->cons = drv->cons; | 2205 | port->cons = drv->cons; |
2175 | port->info = state->info; | 2206 | port->info = state->info; |
2176 | 2207 | ||
2208 | /* | ||
2209 | * If this port is a console, then the spinlock is already | ||
2210 | * initialised. | ||
2211 | */ | ||
2212 | if (!uart_console(port)) | ||
2213 | spin_lock_init(&port->lock); | ||
2214 | |||
2177 | uart_configure_port(drv, state, port); | 2215 | uart_configure_port(drv, state, port); |
2178 | 2216 | ||
2179 | /* | 2217 | /* |
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c index 3f1051a4a13f..d085030df70b 100644 --- a/drivers/serial/serial_txx9.c +++ b/drivers/serial/serial_txx9.c | |||
@@ -442,13 +442,10 @@ static unsigned int serial_txx9_tx_empty(struct uart_port *port) | |||
442 | static unsigned int serial_txx9_get_mctrl(struct uart_port *port) | 442 | static unsigned int serial_txx9_get_mctrl(struct uart_port *port) |
443 | { | 443 | { |
444 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; | 444 | struct uart_txx9_port *up = (struct uart_txx9_port *)port; |
445 | unsigned long flags; | ||
446 | unsigned int ret; | 445 | unsigned int ret; |
447 | 446 | ||
448 | spin_lock_irqsave(&up->port.lock, flags); | ||
449 | ret = ((sio_in(up, TXX9_SIFLCR) & TXX9_SIFLCR_RTSSC) ? 0 : TIOCM_RTS) | 447 | ret = ((sio_in(up, TXX9_SIFLCR) & TXX9_SIFLCR_RTSSC) ? 0 : TIOCM_RTS) |
450 | | ((sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS) ? 0 : TIOCM_CTS); | 448 | | ((sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS) ? 0 : TIOCM_CTS); |
451 | spin_unlock_irqrestore(&up->port.lock, flags); | ||
452 | 449 | ||
453 | return ret; | 450 | return ret; |
454 | } | 451 | } |
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index 10e2990a40d4..8d198880756a 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
@@ -426,18 +426,15 @@ static void sunsab_set_mctrl(struct uart_port *port, unsigned int mctrl) | |||
426 | sunsab_tx_idle(up); | 426 | sunsab_tx_idle(up); |
427 | } | 427 | } |
428 | 428 | ||
429 | /* port->lock is not held. */ | 429 | /* port->lock is held by caller and interrupts are disabled. */ |
430 | static unsigned int sunsab_get_mctrl(struct uart_port *port) | 430 | static unsigned int sunsab_get_mctrl(struct uart_port *port) |
431 | { | 431 | { |
432 | struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; | 432 | struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; |
433 | unsigned long flags; | ||
434 | unsigned char val; | 433 | unsigned char val; |
435 | unsigned int result; | 434 | unsigned int result; |
436 | 435 | ||
437 | result = 0; | 436 | result = 0; |
438 | 437 | ||
439 | spin_lock_irqsave(&up->port.lock, flags); | ||
440 | |||
441 | val = readb(&up->regs->r.pvr); | 438 | val = readb(&up->regs->r.pvr); |
442 | result |= (val & up->pvr_dsr_bit) ? 0 : TIOCM_DSR; | 439 | result |= (val & up->pvr_dsr_bit) ? 0 : TIOCM_DSR; |
443 | 440 | ||
@@ -447,8 +444,6 @@ static unsigned int sunsab_get_mctrl(struct uart_port *port) | |||
447 | val = readb(&up->regs->r.star); | 444 | val = readb(&up->regs->r.star); |
448 | result |= (val & SAB82532_STAR_CTS) ? TIOCM_CTS : 0; | 445 | result |= (val & SAB82532_STAR_CTS) ? TIOCM_CTS : 0; |
449 | 446 | ||
450 | spin_unlock_irqrestore(&up->port.lock, flags); | ||
451 | |||
452 | return result; | 447 | return result; |
453 | } | 448 | } |
454 | 449 | ||
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index ddc97c905e14..d57a3553aea3 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
@@ -572,13 +572,10 @@ static unsigned int sunsu_tx_empty(struct uart_port *port) | |||
572 | static unsigned int sunsu_get_mctrl(struct uart_port *port) | 572 | static unsigned int sunsu_get_mctrl(struct uart_port *port) |
573 | { | 573 | { |
574 | struct uart_sunsu_port *up = (struct uart_sunsu_port *) port; | 574 | struct uart_sunsu_port *up = (struct uart_sunsu_port *) port; |
575 | unsigned long flags; | ||
576 | unsigned char status; | 575 | unsigned char status; |
577 | unsigned int ret; | 576 | unsigned int ret; |
578 | 577 | ||
579 | spin_lock_irqsave(&up->port.lock, flags); | ||
580 | status = serial_in(up, UART_MSR); | 578 | status = serial_in(up, UART_MSR); |
581 | spin_unlock_irqrestore(&up->port.lock, flags); | ||
582 | 579 | ||
583 | ret = 0; | 580 | ret = 0; |
584 | if (status & UART_MSR_DCD) | 581 | if (status & UART_MSR_DCD) |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index 8e65206d3d76..bff42a7b89d0 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
@@ -610,27 +610,28 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id, struct pt_regs *reg | |||
610 | static __inline__ unsigned char sunzilog_read_channel_status(struct uart_port *port) | 610 | static __inline__ unsigned char sunzilog_read_channel_status(struct uart_port *port) |
611 | { | 611 | { |
612 | struct zilog_channel __iomem *channel; | 612 | struct zilog_channel __iomem *channel; |
613 | unsigned long flags; | ||
614 | unsigned char status; | 613 | unsigned char status; |
615 | 614 | ||
616 | spin_lock_irqsave(&port->lock, flags); | ||
617 | |||
618 | channel = ZILOG_CHANNEL_FROM_PORT(port); | 615 | channel = ZILOG_CHANNEL_FROM_PORT(port); |
619 | status = sbus_readb(&channel->control); | 616 | status = sbus_readb(&channel->control); |
620 | ZSDELAY(); | 617 | ZSDELAY(); |
621 | 618 | ||
622 | spin_unlock_irqrestore(&port->lock, flags); | ||
623 | |||
624 | return status; | 619 | return status; |
625 | } | 620 | } |
626 | 621 | ||
627 | /* The port lock is not held. */ | 622 | /* The port lock is not held. */ |
628 | static unsigned int sunzilog_tx_empty(struct uart_port *port) | 623 | static unsigned int sunzilog_tx_empty(struct uart_port *port) |
629 | { | 624 | { |
625 | unsigned long flags; | ||
630 | unsigned char status; | 626 | unsigned char status; |
631 | unsigned int ret; | 627 | unsigned int ret; |
632 | 628 | ||
629 | spin_lock_irqsave(&port->lock, flags); | ||
630 | |||
633 | status = sunzilog_read_channel_status(port); | 631 | status = sunzilog_read_channel_status(port); |
632 | |||
633 | spin_unlock_irqrestore(&port->lock, flags); | ||
634 | |||
634 | if (status & Tx_BUF_EMP) | 635 | if (status & Tx_BUF_EMP) |
635 | ret = TIOCSER_TEMT; | 636 | ret = TIOCSER_TEMT; |
636 | else | 637 | else |
@@ -639,7 +640,7 @@ static unsigned int sunzilog_tx_empty(struct uart_port *port) | |||
639 | return ret; | 640 | return ret; |
640 | } | 641 | } |
641 | 642 | ||
642 | /* The port lock is not held. */ | 643 | /* The port lock is held and interrupts are disabled. */ |
643 | static unsigned int sunzilog_get_mctrl(struct uart_port *port) | 644 | static unsigned int sunzilog_get_mctrl(struct uart_port *port) |
644 | { | 645 | { |
645 | unsigned char status; | 646 | unsigned char status; |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index b209adbd508a..9dd0fbccf994 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -142,7 +142,6 @@ static int fbcon_set_origin(struct vc_data *); | |||
142 | #define CURSOR_DRAW_DELAY (1) | 142 | #define CURSOR_DRAW_DELAY (1) |
143 | 143 | ||
144 | /* # VBL ints between cursor state changes */ | 144 | /* # VBL ints between cursor state changes */ |
145 | #define ARM_CURSOR_BLINK_RATE (10) | ||
146 | #define ATARI_CURSOR_BLINK_RATE (42) | 145 | #define ATARI_CURSOR_BLINK_RATE (42) |
147 | #define MAC_CURSOR_BLINK_RATE (32) | 146 | #define MAC_CURSOR_BLINK_RATE (32) |
148 | #define DEFAULT_CURSOR_BLINK_RATE (20) | 147 | #define DEFAULT_CURSOR_BLINK_RATE (20) |
@@ -288,7 +287,7 @@ static void fb_flashcursor(void *private) | |||
288 | release_console_sem(); | 287 | release_console_sem(); |
289 | } | 288 | } |
290 | 289 | ||
291 | #if (defined(__arm__) && defined(IRQ_VSYNCPULSE)) || defined(CONFIG_ATARI) || defined(CONFIG_MAC) | 290 | #if defined(CONFIG_ATARI) || defined(CONFIG_MAC) |
292 | static int cursor_blink_rate; | 291 | static int cursor_blink_rate; |
293 | static irqreturn_t fb_vbl_handler(int irq, void *dev_id, struct pt_regs *fp) | 292 | static irqreturn_t fb_vbl_handler(int irq, void *dev_id, struct pt_regs *fp) |
294 | { | 293 | { |
@@ -878,11 +877,6 @@ static const char *fbcon_startup(void) | |||
878 | } | 877 | } |
879 | #endif /* CONFIG_MAC */ | 878 | #endif /* CONFIG_MAC */ |
880 | 879 | ||
881 | #if defined(__arm__) && defined(IRQ_VSYNCPULSE) | ||
882 | cursor_blink_rate = ARM_CURSOR_BLINK_RATE; | ||
883 | irqres = request_irq(IRQ_VSYNCPULSE, fb_vbl_handler, SA_SHIRQ, | ||
884 | "framebuffer vbl", info); | ||
885 | #endif | ||
886 | /* Initialize the work queue. If the driver provides its | 880 | /* Initialize the work queue. If the driver provides its |
887 | * own work queue this means it will use something besides | 881 | * own work queue this means it will use something besides |
888 | * default timer to flash the cursor. */ | 882 | * default timer to flash the cursor. */ |
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c index 3dd1de1539d2..b00887e9851c 100644 --- a/drivers/video/platinumfb.c +++ b/drivers/video/platinumfb.c | |||
@@ -523,7 +523,7 @@ int __init platinumfb_setup(char *options) | |||
523 | #define invalidate_cache(addr) | 523 | #define invalidate_cache(addr) |
524 | #endif | 524 | #endif |
525 | 525 | ||
526 | static int __devinit platinumfb_probe(struct of_device* odev, const struct of_match *match) | 526 | static int __devinit platinumfb_probe(struct of_device* odev, const struct of_device_id *match) |
527 | { | 527 | { |
528 | struct device_node *dp = odev->node; | 528 | struct device_node *dp = odev->node; |
529 | struct fb_info *info; | 529 | struct fb_info *info; |
@@ -647,12 +647,10 @@ static int __devexit platinumfb_remove(struct of_device* odev) | |||
647 | return 0; | 647 | return 0; |
648 | } | 648 | } |
649 | 649 | ||
650 | static struct of_match platinumfb_match[] = | 650 | static struct of_device_id platinumfb_match[] = |
651 | { | 651 | { |
652 | { | 652 | { |
653 | .name = "platinum", | 653 | .name = "platinum", |
654 | .type = OF_ANY_MATCH, | ||
655 | .compatible = OF_ANY_MATCH, | ||
656 | }, | 654 | }, |
657 | {}, | 655 | {}, |
658 | }; | 656 | }; |
@@ -58,6 +58,7 @@ static DEFINE_SPINLOCK(fput_lock); | |||
58 | static LIST_HEAD(fput_head); | 58 | static LIST_HEAD(fput_head); |
59 | 59 | ||
60 | static void aio_kick_handler(void *); | 60 | static void aio_kick_handler(void *); |
61 | static void aio_queue_work(struct kioctx *); | ||
61 | 62 | ||
62 | /* aio_setup | 63 | /* aio_setup |
63 | * Creates the slab caches used by the aio routines, panic on | 64 | * Creates the slab caches used by the aio routines, panic on |
@@ -747,6 +748,14 @@ out: | |||
747 | * has already been kicked */ | 748 | * has already been kicked */ |
748 | if (kiocbIsKicked(iocb)) { | 749 | if (kiocbIsKicked(iocb)) { |
749 | __queue_kicked_iocb(iocb); | 750 | __queue_kicked_iocb(iocb); |
751 | |||
752 | /* | ||
753 | * __queue_kicked_iocb will always return 1 here, because | ||
754 | * iocb->ki_run_list is empty at this point so it should | ||
755 | * be safe to unconditionally queue the context into the | ||
756 | * work queue. | ||
757 | */ | ||
758 | aio_queue_work(ctx); | ||
750 | } | 759 | } |
751 | } | 760 | } |
752 | return ret; | 761 | return ret; |
diff --git a/fs/buffer.c b/fs/buffer.c index 13e5938a64f6..561e63a14966 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -278,7 +278,7 @@ EXPORT_SYMBOL(thaw_bdev); | |||
278 | */ | 278 | */ |
279 | static void do_sync(unsigned long wait) | 279 | static void do_sync(unsigned long wait) |
280 | { | 280 | { |
281 | wakeup_bdflush(0); | 281 | wakeup_pdflush(0); |
282 | sync_inodes(0); /* All mappings, inodes and their blockdevs */ | 282 | sync_inodes(0); /* All mappings, inodes and their blockdevs */ |
283 | DQUOT_SYNC(NULL); | 283 | DQUOT_SYNC(NULL); |
284 | sync_supers(); /* Write the superblocks */ | 284 | sync_supers(); /* Write the superblocks */ |
@@ -497,7 +497,7 @@ static void free_more_memory(void) | |||
497 | struct zone **zones; | 497 | struct zone **zones; |
498 | pg_data_t *pgdat; | 498 | pg_data_t *pgdat; |
499 | 499 | ||
500 | wakeup_bdflush(1024); | 500 | wakeup_pdflush(1024); |
501 | yield(); | 501 | yield(); |
502 | 502 | ||
503 | for_each_pgdat(pgdat) { | 503 | for_each_pgdat(pgdat) { |
diff --git a/fs/char_dev.c b/fs/char_dev.c index e82aac9cc2f5..a69a5d8a406f 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -150,7 +150,7 @@ __unregister_chrdev_region(unsigned major, unsigned baseminor, int minorct) | |||
150 | struct char_device_struct *cd = NULL, **cp; | 150 | struct char_device_struct *cd = NULL, **cp; |
151 | int i = major_to_index(major); | 151 | int i = major_to_index(major); |
152 | 152 | ||
153 | up(&chrdevs_lock); | 153 | down(&chrdevs_lock); |
154 | for (cp = &chrdevs[i]; *cp; cp = &(*cp)->next) | 154 | for (cp = &chrdevs[i]; *cp; cp = &(*cp)->next) |
155 | if ((*cp)->major == major && | 155 | if ((*cp)->major == major && |
156 | (*cp)->baseminor == baseminor && | 156 | (*cp)->baseminor == baseminor && |
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index ccd632fcc6d8..e463dca008e4 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -749,24 +749,24 @@ fail_access: | |||
749 | * to find a free region that is of my size and has not | 749 | * to find a free region that is of my size and has not |
750 | * been reserved. | 750 | * been reserved. |
751 | * | 751 | * |
752 | * on succeed, it returns the reservation window to be appended to. | ||
753 | * failed, return NULL. | ||
754 | */ | 752 | */ |
755 | static struct ext3_reserve_window_node *find_next_reservable_window( | 753 | static int find_next_reservable_window( |
756 | struct ext3_reserve_window_node *search_head, | 754 | struct ext3_reserve_window_node *search_head, |
757 | unsigned long size, int *start_block, | 755 | struct ext3_reserve_window_node *my_rsv, |
756 | struct super_block * sb, int start_block, | ||
758 | int last_block) | 757 | int last_block) |
759 | { | 758 | { |
760 | struct rb_node *next; | 759 | struct rb_node *next; |
761 | struct ext3_reserve_window_node *rsv, *prev; | 760 | struct ext3_reserve_window_node *rsv, *prev; |
762 | int cur; | 761 | int cur; |
762 | int size = my_rsv->rsv_goal_size; | ||
763 | 763 | ||
764 | /* TODO: make the start of the reservation window byte-aligned */ | 764 | /* TODO: make the start of the reservation window byte-aligned */ |
765 | /* cur = *start_block & ~7;*/ | 765 | /* cur = *start_block & ~7;*/ |
766 | cur = *start_block; | 766 | cur = start_block; |
767 | rsv = search_head; | 767 | rsv = search_head; |
768 | if (!rsv) | 768 | if (!rsv) |
769 | return NULL; | 769 | return -1; |
770 | 770 | ||
771 | while (1) { | 771 | while (1) { |
772 | if (cur <= rsv->rsv_end) | 772 | if (cur <= rsv->rsv_end) |
@@ -782,11 +782,11 @@ static struct ext3_reserve_window_node *find_next_reservable_window( | |||
782 | * space with expected-size (or more)... | 782 | * space with expected-size (or more)... |
783 | */ | 783 | */ |
784 | if (cur > last_block) | 784 | if (cur > last_block) |
785 | return NULL; /* fail */ | 785 | return -1; /* fail */ |
786 | 786 | ||
787 | prev = rsv; | 787 | prev = rsv; |
788 | next = rb_next(&rsv->rsv_node); | 788 | next = rb_next(&rsv->rsv_node); |
789 | rsv = list_entry(next, struct ext3_reserve_window_node, rsv_node); | 789 | rsv = list_entry(next,struct ext3_reserve_window_node,rsv_node); |
790 | 790 | ||
791 | /* | 791 | /* |
792 | * Reached the last reservation, we can just append to the | 792 | * Reached the last reservation, we can just append to the |
@@ -813,8 +813,25 @@ static struct ext3_reserve_window_node *find_next_reservable_window( | |||
813 | * return the reservation window that we could append to. | 813 | * return the reservation window that we could append to. |
814 | * succeed. | 814 | * succeed. |
815 | */ | 815 | */ |
816 | *start_block = cur; | 816 | |
817 | return prev; | 817 | if ((prev != my_rsv) && (!rsv_is_empty(&my_rsv->rsv_window))) |
818 | rsv_window_remove(sb, my_rsv); | ||
819 | |||
820 | /* | ||
821 | * Let's book the whole avaliable window for now. We will check the | ||
822 | * disk bitmap later and then, if there are free blocks then we adjust | ||
823 | * the window size if it's larger than requested. | ||
824 | * Otherwise, we will remove this node from the tree next time | ||
825 | * call find_next_reservable_window. | ||
826 | */ | ||
827 | my_rsv->rsv_start = cur; | ||
828 | my_rsv->rsv_end = cur + size - 1; | ||
829 | my_rsv->rsv_alloc_hit = 0; | ||
830 | |||
831 | if (prev != my_rsv) | ||
832 | ext3_rsv_window_add(sb, my_rsv); | ||
833 | |||
834 | return 0; | ||
818 | } | 835 | } |
819 | 836 | ||
820 | /** | 837 | /** |
@@ -852,6 +869,7 @@ static struct ext3_reserve_window_node *find_next_reservable_window( | |||
852 | * @sb: the super block | 869 | * @sb: the super block |
853 | * @group: the group we are trying to allocate in | 870 | * @group: the group we are trying to allocate in |
854 | * @bitmap_bh: the block group block bitmap | 871 | * @bitmap_bh: the block group block bitmap |
872 | * | ||
855 | */ | 873 | */ |
856 | static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, | 874 | static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, |
857 | int goal, struct super_block *sb, | 875 | int goal, struct super_block *sb, |
@@ -860,10 +878,10 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, | |||
860 | struct ext3_reserve_window_node *search_head; | 878 | struct ext3_reserve_window_node *search_head; |
861 | int group_first_block, group_end_block, start_block; | 879 | int group_first_block, group_end_block, start_block; |
862 | int first_free_block; | 880 | int first_free_block; |
863 | int reservable_space_start; | ||
864 | struct ext3_reserve_window_node *prev_rsv; | ||
865 | struct rb_root *fs_rsv_root = &EXT3_SB(sb)->s_rsv_window_root; | 881 | struct rb_root *fs_rsv_root = &EXT3_SB(sb)->s_rsv_window_root; |
866 | unsigned long size; | 882 | unsigned long size; |
883 | int ret; | ||
884 | spinlock_t *rsv_lock = &EXT3_SB(sb)->s_rsv_window_lock; | ||
867 | 885 | ||
868 | group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) + | 886 | group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) + |
869 | group * EXT3_BLOCKS_PER_GROUP(sb); | 887 | group * EXT3_BLOCKS_PER_GROUP(sb); |
@@ -875,6 +893,7 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, | |||
875 | start_block = goal + group_first_block; | 893 | start_block = goal + group_first_block; |
876 | 894 | ||
877 | size = my_rsv->rsv_goal_size; | 895 | size = my_rsv->rsv_goal_size; |
896 | |||
878 | if (!rsv_is_empty(&my_rsv->rsv_window)) { | 897 | if (!rsv_is_empty(&my_rsv->rsv_window)) { |
879 | /* | 898 | /* |
880 | * if the old reservation is cross group boundary | 899 | * if the old reservation is cross group boundary |
@@ -908,6 +927,8 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, | |||
908 | my_rsv->rsv_goal_size= size; | 927 | my_rsv->rsv_goal_size= size; |
909 | } | 928 | } |
910 | } | 929 | } |
930 | |||
931 | spin_lock(rsv_lock); | ||
911 | /* | 932 | /* |
912 | * shift the search start to the window near the goal block | 933 | * shift the search start to the window near the goal block |
913 | */ | 934 | */ |
@@ -921,11 +942,16 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, | |||
921 | * need to check the bitmap after we found a reservable window. | 942 | * need to check the bitmap after we found a reservable window. |
922 | */ | 943 | */ |
923 | retry: | 944 | retry: |
924 | prev_rsv = find_next_reservable_window(search_head, size, | 945 | ret = find_next_reservable_window(search_head, my_rsv, sb, |
925 | &start_block, group_end_block); | 946 | start_block, group_end_block); |
926 | if (prev_rsv == NULL) | 947 | |
927 | goto failed; | 948 | if (ret == -1) { |
928 | reservable_space_start = start_block; | 949 | if (!rsv_is_empty(&my_rsv->rsv_window)) |
950 | rsv_window_remove(sb, my_rsv); | ||
951 | spin_unlock(rsv_lock); | ||
952 | return -1; | ||
953 | } | ||
954 | |||
929 | /* | 955 | /* |
930 | * On success, find_next_reservable_window() returns the | 956 | * On success, find_next_reservable_window() returns the |
931 | * reservation window where there is a reservable space after it. | 957 | * reservation window where there is a reservable space after it. |
@@ -937,8 +963,9 @@ retry: | |||
937 | * block. Search start from the start block of the reservable space | 963 | * block. Search start from the start block of the reservable space |
938 | * we just found. | 964 | * we just found. |
939 | */ | 965 | */ |
966 | spin_unlock(rsv_lock); | ||
940 | first_free_block = bitmap_search_next_usable_block( | 967 | first_free_block = bitmap_search_next_usable_block( |
941 | reservable_space_start - group_first_block, | 968 | my_rsv->rsv_start - group_first_block, |
942 | bitmap_bh, group_end_block - group_first_block + 1); | 969 | bitmap_bh, group_end_block - group_first_block + 1); |
943 | 970 | ||
944 | if (first_free_block < 0) { | 971 | if (first_free_block < 0) { |
@@ -946,54 +973,29 @@ retry: | |||
946 | * no free block left on the bitmap, no point | 973 | * no free block left on the bitmap, no point |
947 | * to reserve the space. return failed. | 974 | * to reserve the space. return failed. |
948 | */ | 975 | */ |
949 | goto failed; | 976 | spin_lock(rsv_lock); |
977 | if (!rsv_is_empty(&my_rsv->rsv_window)) | ||
978 | rsv_window_remove(sb, my_rsv); | ||
979 | spin_unlock(rsv_lock); | ||
980 | return -1; /* failed */ | ||
950 | } | 981 | } |
982 | |||
951 | start_block = first_free_block + group_first_block; | 983 | start_block = first_free_block + group_first_block; |
952 | /* | 984 | /* |
953 | * check if the first free block is within the | 985 | * check if the first free block is within the |
954 | * free space we just found | 986 | * free space we just reserved |
955 | */ | 987 | */ |
956 | if ((start_block >= reservable_space_start) && | 988 | if (start_block >= my_rsv->rsv_start && start_block < my_rsv->rsv_end) |
957 | (start_block < reservable_space_start + size)) | 989 | return 0; /* success */ |
958 | goto found_rsv_window; | ||
959 | /* | 990 | /* |
960 | * if the first free bit we found is out of the reservable space | 991 | * if the first free bit we found is out of the reservable space |
961 | * this means there is no free block on the reservable space | 992 | * continue search for next reservable space, |
962 | * we should continue search for next reservable space, | ||
963 | * start from where the free block is, | 993 | * start from where the free block is, |
964 | * we also shift the list head to where we stopped last time | 994 | * we also shift the list head to where we stopped last time |
965 | */ | 995 | */ |
966 | search_head = prev_rsv; | 996 | search_head = my_rsv; |
997 | spin_lock(rsv_lock); | ||
967 | goto retry; | 998 | goto retry; |
968 | |||
969 | found_rsv_window: | ||
970 | /* | ||
971 | * great! the reservable space contains some free blocks. | ||
972 | * if the search returns that we should add the new | ||
973 | * window just next to where the old window, we don't | ||
974 | * need to remove the old window first then add it to the | ||
975 | * same place, just update the new start and new end. | ||
976 | */ | ||
977 | if (my_rsv != prev_rsv) { | ||
978 | if (!rsv_is_empty(&my_rsv->rsv_window)) | ||
979 | rsv_window_remove(sb, my_rsv); | ||
980 | } | ||
981 | my_rsv->rsv_start = reservable_space_start; | ||
982 | my_rsv->rsv_end = my_rsv->rsv_start + size - 1; | ||
983 | my_rsv->rsv_alloc_hit = 0; | ||
984 | if (my_rsv != prev_rsv) { | ||
985 | ext3_rsv_window_add(sb, my_rsv); | ||
986 | } | ||
987 | return 0; /* succeed */ | ||
988 | failed: | ||
989 | /* | ||
990 | * failed to find a new reservation window in the current | ||
991 | * group, remove the current(stale) reservation window | ||
992 | * if there is any | ||
993 | */ | ||
994 | if (!rsv_is_empty(&my_rsv->rsv_window)) | ||
995 | rsv_window_remove(sb, my_rsv); | ||
996 | return -1; /* failed */ | ||
997 | } | 999 | } |
998 | 1000 | ||
999 | /* | 1001 | /* |
@@ -1023,7 +1025,6 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, | |||
1023 | int goal, struct ext3_reserve_window_node * my_rsv, | 1025 | int goal, struct ext3_reserve_window_node * my_rsv, |
1024 | int *errp) | 1026 | int *errp) |
1025 | { | 1027 | { |
1026 | spinlock_t *rsv_lock; | ||
1027 | unsigned long group_first_block; | 1028 | unsigned long group_first_block; |
1028 | int ret = 0; | 1029 | int ret = 0; |
1029 | int fatal; | 1030 | int fatal; |
@@ -1052,7 +1053,6 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, | |||
1052 | ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, goal, NULL); | 1053 | ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, goal, NULL); |
1053 | goto out; | 1054 | goto out; |
1054 | } | 1055 | } |
1055 | rsv_lock = &EXT3_SB(sb)->s_rsv_window_lock; | ||
1056 | /* | 1056 | /* |
1057 | * goal is a group relative block number (if there is a goal) | 1057 | * goal is a group relative block number (if there is a goal) |
1058 | * 0 < goal < EXT3_BLOCKS_PER_GROUP(sb) | 1058 | * 0 < goal < EXT3_BLOCKS_PER_GROUP(sb) |
@@ -1078,30 +1078,21 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, | |||
1078 | * then we could go to allocate from the reservation window directly. | 1078 | * then we could go to allocate from the reservation window directly. |
1079 | */ | 1079 | */ |
1080 | while (1) { | 1080 | while (1) { |
1081 | struct ext3_reserve_window rsv_copy; | 1081 | if (rsv_is_empty(&my_rsv->rsv_window) || (ret < 0) || |
1082 | 1082 | !goal_in_my_reservation(&my_rsv->rsv_window, goal, group, sb)) { | |
1083 | rsv_copy._rsv_start = my_rsv->rsv_start; | ||
1084 | rsv_copy._rsv_end = my_rsv->rsv_end; | ||
1085 | |||
1086 | if (rsv_is_empty(&rsv_copy) || (ret < 0) || | ||
1087 | !goal_in_my_reservation(&rsv_copy, goal, group, sb)) { | ||
1088 | spin_lock(rsv_lock); | ||
1089 | ret = alloc_new_reservation(my_rsv, goal, sb, | 1083 | ret = alloc_new_reservation(my_rsv, goal, sb, |
1090 | group, bitmap_bh); | 1084 | group, bitmap_bh); |
1091 | rsv_copy._rsv_start = my_rsv->rsv_start; | ||
1092 | rsv_copy._rsv_end = my_rsv->rsv_end; | ||
1093 | spin_unlock(rsv_lock); | ||
1094 | if (ret < 0) | 1085 | if (ret < 0) |
1095 | break; /* failed */ | 1086 | break; /* failed */ |
1096 | 1087 | ||
1097 | if (!goal_in_my_reservation(&rsv_copy, goal, group, sb)) | 1088 | if (!goal_in_my_reservation(&my_rsv->rsv_window, goal, group, sb)) |
1098 | goal = -1; | 1089 | goal = -1; |
1099 | } | 1090 | } |
1100 | if ((rsv_copy._rsv_start >= group_first_block + EXT3_BLOCKS_PER_GROUP(sb)) | 1091 | if ((my_rsv->rsv_start >= group_first_block + EXT3_BLOCKS_PER_GROUP(sb)) |
1101 | || (rsv_copy._rsv_end < group_first_block)) | 1092 | || (my_rsv->rsv_end < group_first_block)) |
1102 | BUG(); | 1093 | BUG(); |
1103 | ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, goal, | 1094 | ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, goal, |
1104 | &rsv_copy); | 1095 | &my_rsv->rsv_window); |
1105 | if (ret >= 0) { | 1096 | if (ret >= 0) { |
1106 | my_rsv->rsv_alloc_hit++; | 1097 | my_rsv->rsv_alloc_hit++; |
1107 | break; /* succeed */ | 1098 | break; /* succeed */ |
diff --git a/fs/ext3/file.c b/fs/ext3/file.c index 5ad8cf0292df..98e78345ead9 100644 --- a/fs/ext3/file.c +++ b/fs/ext3/file.c | |||
@@ -36,7 +36,11 @@ static int ext3_release_file (struct inode * inode, struct file * filp) | |||
36 | /* if we are the last writer on the inode, drop the block reservation */ | 36 | /* if we are the last writer on the inode, drop the block reservation */ |
37 | if ((filp->f_mode & FMODE_WRITE) && | 37 | if ((filp->f_mode & FMODE_WRITE) && |
38 | (atomic_read(&inode->i_writecount) == 1)) | 38 | (atomic_read(&inode->i_writecount) == 1)) |
39 | { | ||
40 | down(&EXT3_I(inode)->truncate_sem); | ||
39 | ext3_discard_reservation(inode); | 41 | ext3_discard_reservation(inode); |
42 | up(&EXT3_I(inode)->truncate_sem); | ||
43 | } | ||
40 | if (is_dx(inode) && filp->private_data) | 44 | if (is_dx(inode) && filp->private_data) |
41 | ext3_htree_free_dir_info(filp->private_data); | 45 | ext3_htree_free_dir_info(filp->private_data); |
42 | 46 | ||
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index b4b3e8a39131..a6d1779d7de4 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -944,7 +944,8 @@ clear_qf_name: | |||
944 | "for remount\n"); | 944 | "for remount\n"); |
945 | return 0; | 945 | return 0; |
946 | } | 946 | } |
947 | match_int(&args[0], &option); | 947 | if (match_int(&args[0], &option) != 0) |
948 | return 0; | ||
948 | *n_blocks_count = option; | 949 | *n_blocks_count = option; |
949 | break; | 950 | break; |
950 | case Opt_nobh: | 951 | case Opt_nobh: |
diff --git a/fs/fat/cache.c b/fs/fat/cache.c index 7c52e465a619..77c24fcf712a 100644 --- a/fs/fat/cache.c +++ b/fs/fat/cache.c | |||
@@ -56,7 +56,7 @@ int __init fat_cache_init(void) | |||
56 | return 0; | 56 | return 0; |
57 | } | 57 | } |
58 | 58 | ||
59 | void __exit fat_cache_destroy(void) | 59 | void fat_cache_destroy(void) |
60 | { | 60 | { |
61 | if (kmem_cache_destroy(fat_cache_cachep)) | 61 | if (kmem_cache_destroy(fat_cache_cachep)) |
62 | printk(KERN_INFO "fat_cache: not all structures were freed\n"); | 62 | printk(KERN_INFO "fat_cache: not all structures were freed\n"); |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 8ccee8415488..96ae85b67eba 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -1327,16 +1327,25 @@ out_fail: | |||
1327 | EXPORT_SYMBOL(fat_fill_super); | 1327 | EXPORT_SYMBOL(fat_fill_super); |
1328 | 1328 | ||
1329 | int __init fat_cache_init(void); | 1329 | int __init fat_cache_init(void); |
1330 | void __exit fat_cache_destroy(void); | 1330 | void fat_cache_destroy(void); |
1331 | 1331 | ||
1332 | static int __init init_fat_fs(void) | 1332 | static int __init init_fat_fs(void) |
1333 | { | 1333 | { |
1334 | int ret; | 1334 | int err; |
1335 | 1335 | ||
1336 | ret = fat_cache_init(); | 1336 | err = fat_cache_init(); |
1337 | if (ret < 0) | 1337 | if (err) |
1338 | return ret; | 1338 | return err; |
1339 | return fat_init_inodecache(); | 1339 | |
1340 | err = fat_init_inodecache(); | ||
1341 | if (err) | ||
1342 | goto failed; | ||
1343 | |||
1344 | return 0; | ||
1345 | |||
1346 | failed: | ||
1347 | fat_cache_destroy(); | ||
1348 | return err; | ||
1340 | } | 1349 | } |
1341 | 1350 | ||
1342 | static void __exit exit_fat_fs(void) | 1351 | static void __exit exit_fat_fs(void) |
diff --git a/fs/freevxfs/vxfs.h b/fs/freevxfs/vxfs.h index 8da0252642a4..583bd78086d8 100644 --- a/fs/freevxfs/vxfs.h +++ b/fs/freevxfs/vxfs.h | |||
@@ -37,7 +37,6 @@ | |||
37 | * superblocks of the Veritas Filesystem. | 37 | * superblocks of the Veritas Filesystem. |
38 | */ | 38 | */ |
39 | #include <linux/types.h> | 39 | #include <linux/types.h> |
40 | #include "vxfs_kcompat.h" | ||
41 | 40 | ||
42 | 41 | ||
43 | /* | 42 | /* |
diff --git a/fs/freevxfs/vxfs_bmap.c b/fs/freevxfs/vxfs_bmap.c index bc4b57da306a..d3f6b2835bc8 100644 --- a/fs/freevxfs/vxfs_bmap.c +++ b/fs/freevxfs/vxfs_bmap.c | |||
@@ -101,7 +101,7 @@ vxfs_bmap_ext4(struct inode *ip, long bn) | |||
101 | return 0; | 101 | return 0; |
102 | 102 | ||
103 | fail_size: | 103 | fail_size: |
104 | printk("vxfs: indirect extent to big!\n"); | 104 | printk("vxfs: indirect extent too big!\n"); |
105 | fail_buf: | 105 | fail_buf: |
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
diff --git a/fs/freevxfs/vxfs_fshead.c b/fs/freevxfs/vxfs_fshead.c index 05b19f70bf97..6dee109aeea4 100644 --- a/fs/freevxfs/vxfs_fshead.c +++ b/fs/freevxfs/vxfs_fshead.c | |||
@@ -78,17 +78,18 @@ vxfs_getfsh(struct inode *ip, int which) | |||
78 | struct buffer_head *bp; | 78 | struct buffer_head *bp; |
79 | 79 | ||
80 | bp = vxfs_bread(ip, which); | 80 | bp = vxfs_bread(ip, which); |
81 | if (buffer_mapped(bp)) { | 81 | if (bp) { |
82 | struct vxfs_fsh *fhp; | 82 | struct vxfs_fsh *fhp; |
83 | 83 | ||
84 | if (!(fhp = kmalloc(sizeof(*fhp), SLAB_KERNEL))) | 84 | if (!(fhp = kmalloc(sizeof(*fhp), GFP_KERNEL))) |
85 | return NULL; | 85 | goto out; |
86 | memcpy(fhp, bp->b_data, sizeof(*fhp)); | 86 | memcpy(fhp, bp->b_data, sizeof(*fhp)); |
87 | 87 | ||
88 | brelse(bp); | 88 | put_bh(bp); |
89 | return (fhp); | 89 | return (fhp); |
90 | } | 90 | } |
91 | 91 | out: | |
92 | brelse(bp); | ||
92 | return NULL; | 93 | return NULL; |
93 | } | 94 | } |
94 | 95 | ||
diff --git a/fs/freevxfs/vxfs_kcompat.h b/fs/freevxfs/vxfs_kcompat.h deleted file mode 100644 index 342a4cc860f4..000000000000 --- a/fs/freevxfs/vxfs_kcompat.h +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | #ifndef _VXFS_KCOMPAT_H | ||
2 | #define _VXFS_KCOMPAT_H | ||
3 | |||
4 | #include <linux/version.h> | ||
5 | |||
6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
7 | |||
8 | #include <linux/blkdev.h> | ||
9 | |||
10 | typedef long sector_t; | ||
11 | |||
12 | /* From include/linux/fs.h (Linux 2.5.2-pre3) */ | ||
13 | static inline struct buffer_head * sb_bread(struct super_block *sb, int block) | ||
14 | { | ||
15 | return bread(sb->s_dev, block, sb->s_blocksize); | ||
16 | } | ||
17 | |||
18 | /* Dito. */ | ||
19 | static inline void map_bh(struct buffer_head *bh, struct super_block *sb, int block) | ||
20 | { | ||
21 | bh->b_state |= 1 << BH_Mapped; | ||
22 | bh->b_dev = sb->s_dev; | ||
23 | bh->b_blocknr = block; | ||
24 | } | ||
25 | |||
26 | /* From fs/block_dev.c (Linux 2.5.2-pre2) */ | ||
27 | static inline int sb_set_blocksize(struct super_block *sb, int size) | ||
28 | { | ||
29 | int bits; | ||
30 | if (set_blocksize(sb->s_dev, size) < 0) | ||
31 | return 0; | ||
32 | sb->s_blocksize = size; | ||
33 | for (bits = 9, size >>= 9; size >>= 1; bits++) | ||
34 | ; | ||
35 | sb->s_blocksize_bits = bits; | ||
36 | return sb->s_blocksize; | ||
37 | } | ||
38 | |||
39 | /* Dito. */ | ||
40 | static inline int sb_min_blocksize(struct super_block *sb, int size) | ||
41 | { | ||
42 | int minsize = get_hardsect_size(sb->s_dev); | ||
43 | if (size < minsize) | ||
44 | size = minsize; | ||
45 | return sb_set_blocksize(sb, size); | ||
46 | } | ||
47 | |||
48 | #endif /* Kernel 2.4 */ | ||
49 | #endif /* _VXFS_KCOMPAT_H */ | ||
diff --git a/fs/freevxfs/vxfs_lookup.c b/fs/freevxfs/vxfs_lookup.c index 506ae251d2c0..554eb455722c 100644 --- a/fs/freevxfs/vxfs_lookup.c +++ b/fs/freevxfs/vxfs_lookup.c | |||
@@ -61,13 +61,13 @@ struct file_operations vxfs_dir_operations = { | |||
61 | }; | 61 | }; |
62 | 62 | ||
63 | 63 | ||
64 | static __inline__ u_long | 64 | static inline u_long |
65 | dir_pages(struct inode *inode) | 65 | dir_pages(struct inode *inode) |
66 | { | 66 | { |
67 | return (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 67 | return (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; |
68 | } | 68 | } |
69 | 69 | ||
70 | static __inline__ u_long | 70 | static inline u_long |
71 | dir_blocks(struct inode *ip) | 71 | dir_blocks(struct inode *ip) |
72 | { | 72 | { |
73 | u_long bsize = ip->i_sb->s_blocksize; | 73 | u_long bsize = ip->i_sb->s_blocksize; |
@@ -79,7 +79,7 @@ dir_blocks(struct inode *ip) | |||
79 | * | 79 | * |
80 | * len <= VXFS_NAMELEN and de != NULL are guaranteed by caller. | 80 | * len <= VXFS_NAMELEN and de != NULL are guaranteed by caller. |
81 | */ | 81 | */ |
82 | static __inline__ int | 82 | static inline int |
83 | vxfs_match(int len, const char * const name, struct vxfs_direct *de) | 83 | vxfs_match(int len, const char * const name, struct vxfs_direct *de) |
84 | { | 84 | { |
85 | if (len != de->d_namelen) | 85 | if (len != de->d_namelen) |
@@ -89,7 +89,7 @@ vxfs_match(int len, const char * const name, struct vxfs_direct *de) | |||
89 | return !memcmp(name, de->d_name, len); | 89 | return !memcmp(name, de->d_name, len); |
90 | } | 90 | } |
91 | 91 | ||
92 | static __inline__ struct vxfs_direct * | 92 | static inline struct vxfs_direct * |
93 | vxfs_next_entry(struct vxfs_direct *de) | 93 | vxfs_next_entry(struct vxfs_direct *de) |
94 | { | 94 | { |
95 | return ((struct vxfs_direct *)((char*)de + de->d_reclen)); | 95 | return ((struct vxfs_direct *)((char*)de + de->d_reclen)); |
diff --git a/fs/freevxfs/vxfs_olt.c b/fs/freevxfs/vxfs_olt.c index 7a204e31aad9..133476201d84 100644 --- a/fs/freevxfs/vxfs_olt.c +++ b/fs/freevxfs/vxfs_olt.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include "vxfs_olt.h" | 38 | #include "vxfs_olt.h" |
39 | 39 | ||
40 | 40 | ||
41 | static __inline__ void | 41 | static inline void |
42 | vxfs_get_fshead(struct vxfs_oltfshead *fshp, struct vxfs_sb_info *infp) | 42 | vxfs_get_fshead(struct vxfs_oltfshead *fshp, struct vxfs_sb_info *infp) |
43 | { | 43 | { |
44 | if (infp->vsi_fshino) | 44 | if (infp->vsi_fshino) |
@@ -46,7 +46,7 @@ vxfs_get_fshead(struct vxfs_oltfshead *fshp, struct vxfs_sb_info *infp) | |||
46 | infp->vsi_fshino = fshp->olt_fsino[0]; | 46 | infp->vsi_fshino = fshp->olt_fsino[0]; |
47 | } | 47 | } |
48 | 48 | ||
49 | static __inline__ void | 49 | static inline void |
50 | vxfs_get_ilist(struct vxfs_oltilist *ilistp, struct vxfs_sb_info *infp) | 50 | vxfs_get_ilist(struct vxfs_oltilist *ilistp, struct vxfs_sb_info *infp) |
51 | { | 51 | { |
52 | if (infp->vsi_iext) | 52 | if (infp->vsi_iext) |
@@ -54,7 +54,7 @@ vxfs_get_ilist(struct vxfs_oltilist *ilistp, struct vxfs_sb_info *infp) | |||
54 | infp->vsi_iext = ilistp->olt_iext[0]; | 54 | infp->vsi_iext = ilistp->olt_iext[0]; |
55 | } | 55 | } |
56 | 56 | ||
57 | static __inline__ u_long | 57 | static inline u_long |
58 | vxfs_oblock(struct super_block *sbp, daddr_t block, u_long bsize) | 58 | vxfs_oblock(struct super_block *sbp, daddr_t block, u_long bsize) |
59 | { | 59 | { |
60 | if (sbp->s_blocksize % bsize) | 60 | if (sbp->s_blocksize % bsize) |
@@ -104,8 +104,8 @@ vxfs_read_olt(struct super_block *sbp, u_long bsize) | |||
104 | goto fail; | 104 | goto fail; |
105 | } | 105 | } |
106 | 106 | ||
107 | oaddr = (char *)bp->b_data + op->olt_size; | 107 | oaddr = bp->b_data + op->olt_size; |
108 | eaddr = (char *)bp->b_data + (infp->vsi_oltsize * sbp->s_blocksize); | 108 | eaddr = bp->b_data + (infp->vsi_oltsize * sbp->s_blocksize); |
109 | 109 | ||
110 | while (oaddr < eaddr) { | 110 | while (oaddr < eaddr) { |
111 | struct vxfs_oltcommon *ocp = | 111 | struct vxfs_oltcommon *ocp = |
diff --git a/fs/freevxfs/vxfs_subr.c b/fs/freevxfs/vxfs_subr.c index 5e305612054a..50aae77651b2 100644 --- a/fs/freevxfs/vxfs_subr.c +++ b/fs/freevxfs/vxfs_subr.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | #include <linux/pagemap.h> | 37 | #include <linux/pagemap.h> |
38 | 38 | ||
39 | #include "vxfs_kcompat.h" | ||
40 | #include "vxfs_extern.h" | 39 | #include "vxfs_extern.h" |
41 | 40 | ||
42 | 41 | ||
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index 0ae2c7b8182a..27f66d3e8a04 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c | |||
@@ -155,12 +155,11 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) | |||
155 | 155 | ||
156 | sbp->s_flags |= MS_RDONLY; | 156 | sbp->s_flags |= MS_RDONLY; |
157 | 157 | ||
158 | infp = kmalloc(sizeof(*infp), GFP_KERNEL); | 158 | infp = kcalloc(1, sizeof(*infp), GFP_KERNEL); |
159 | if (!infp) { | 159 | if (!infp) { |
160 | printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n"); | 160 | printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n"); |
161 | return -ENOMEM; | 161 | return -ENOMEM; |
162 | } | 162 | } |
163 | memset(infp, 0, sizeof(*infp)); | ||
164 | 163 | ||
165 | bsize = sb_min_blocksize(sbp, BLOCK_SIZE); | 164 | bsize = sb_min_blocksize(sbp, BLOCK_SIZE); |
166 | if (!bsize) { | 165 | if (!bsize) { |
@@ -196,7 +195,7 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) | |||
196 | #endif | 195 | #endif |
197 | 196 | ||
198 | sbp->s_magic = rsbp->vs_magic; | 197 | sbp->s_magic = rsbp->vs_magic; |
199 | sbp->s_fs_info = (void *)infp; | 198 | sbp->s_fs_info = infp; |
200 | 199 | ||
201 | infp->vsi_raw = rsbp; | 200 | infp->vsi_raw = rsbp; |
202 | infp->vsi_bp = bp; | 201 | infp->vsi_bp = bp; |
@@ -263,7 +262,7 @@ vxfs_init(void) | |||
263 | sizeof(struct vxfs_inode_info), 0, | 262 | sizeof(struct vxfs_inode_info), 0, |
264 | SLAB_RECLAIM_ACCOUNT, NULL, NULL); | 263 | SLAB_RECLAIM_ACCOUNT, NULL, NULL); |
265 | if (vxfs_inode_cachep) | 264 | if (vxfs_inode_cachep) |
266 | return (register_filesystem(&vxfs_fs_type)); | 265 | return register_filesystem(&vxfs_fs_type); |
267 | return -ENOMEM; | 266 | return -ENOMEM; |
268 | } | 267 | } |
269 | 268 | ||
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c index ee3536fc84a3..1b7a3ef2f813 100644 --- a/fs/nfs/nfs3acl.c +++ b/fs/nfs/nfs3acl.c | |||
@@ -2,7 +2,7 @@ | |||
2 | #include <linux/nfs.h> | 2 | #include <linux/nfs.h> |
3 | #include <linux/nfs3.h> | 3 | #include <linux/nfs3.h> |
4 | #include <linux/nfs_fs.h> | 4 | #include <linux/nfs_fs.h> |
5 | #include <linux/xattr_acl.h> | 5 | #include <linux/posix_acl_xattr.h> |
6 | #include <linux/nfsacl.h> | 6 | #include <linux/nfsacl.h> |
7 | 7 | ||
8 | #define NFSDBG_FACILITY NFSDBG_PROC | 8 | #define NFSDBG_FACILITY NFSDBG_PROC |
@@ -53,9 +53,9 @@ ssize_t nfs3_getxattr(struct dentry *dentry, const char *name, | |||
53 | struct posix_acl *acl; | 53 | struct posix_acl *acl; |
54 | int type, error = 0; | 54 | int type, error = 0; |
55 | 55 | ||
56 | if (strcmp(name, XATTR_NAME_ACL_ACCESS) == 0) | 56 | if (strcmp(name, POSIX_ACL_XATTR_ACCESS) == 0) |
57 | type = ACL_TYPE_ACCESS; | 57 | type = ACL_TYPE_ACCESS; |
58 | else if (strcmp(name, XATTR_NAME_ACL_DEFAULT) == 0) | 58 | else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) |
59 | type = ACL_TYPE_DEFAULT; | 59 | type = ACL_TYPE_DEFAULT; |
60 | else | 60 | else |
61 | return -EOPNOTSUPP; | 61 | return -EOPNOTSUPP; |
@@ -82,9 +82,9 @@ int nfs3_setxattr(struct dentry *dentry, const char *name, | |||
82 | struct posix_acl *acl; | 82 | struct posix_acl *acl; |
83 | int type, error; | 83 | int type, error; |
84 | 84 | ||
85 | if (strcmp(name, XATTR_NAME_ACL_ACCESS) == 0) | 85 | if (strcmp(name, POSIX_ACL_XATTR_ACCESS) == 0) |
86 | type = ACL_TYPE_ACCESS; | 86 | type = ACL_TYPE_ACCESS; |
87 | else if (strcmp(name, XATTR_NAME_ACL_DEFAULT) == 0) | 87 | else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) |
88 | type = ACL_TYPE_DEFAULT; | 88 | type = ACL_TYPE_DEFAULT; |
89 | else | 89 | else |
90 | return -EOPNOTSUPP; | 90 | return -EOPNOTSUPP; |
@@ -103,9 +103,9 @@ int nfs3_removexattr(struct dentry *dentry, const char *name) | |||
103 | struct inode *inode = dentry->d_inode; | 103 | struct inode *inode = dentry->d_inode; |
104 | int type; | 104 | int type; |
105 | 105 | ||
106 | if (strcmp(name, XATTR_NAME_ACL_ACCESS) == 0) | 106 | if (strcmp(name, POSIX_ACL_XATTR_ACCESS) == 0) |
107 | type = ACL_TYPE_ACCESS; | 107 | type = ACL_TYPE_ACCESS; |
108 | else if (strcmp(name, XATTR_NAME_ACL_DEFAULT) == 0) | 108 | else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) |
109 | type = ACL_TYPE_DEFAULT; | 109 | type = ACL_TYPE_DEFAULT; |
110 | else | 110 | else |
111 | return -EOPNOTSUPP; | 111 | return -EOPNOTSUPP; |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index de340ffd33c3..be24ead89d94 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -46,10 +46,9 @@ | |||
46 | #include <linux/nfsd/nfsfh.h> | 46 | #include <linux/nfsd/nfsfh.h> |
47 | #include <linux/quotaops.h> | 47 | #include <linux/quotaops.h> |
48 | #include <linux/dnotify.h> | 48 | #include <linux/dnotify.h> |
49 | #include <linux/xattr_acl.h> | ||
50 | #include <linux/posix_acl.h> | 49 | #include <linux/posix_acl.h> |
51 | #ifdef CONFIG_NFSD_V4 | ||
52 | #include <linux/posix_acl_xattr.h> | 50 | #include <linux/posix_acl_xattr.h> |
51 | #ifdef CONFIG_NFSD_V4 | ||
53 | #include <linux/xattr.h> | 52 | #include <linux/xattr.h> |
54 | #include <linux/nfs4.h> | 53 | #include <linux/nfs4.h> |
55 | #include <linux/nfs4_acl.h> | 54 | #include <linux/nfs4_acl.h> |
@@ -1872,10 +1871,10 @@ nfsd_get_posix_acl(struct svc_fh *fhp, int type) | |||
1872 | return ERR_PTR(-EOPNOTSUPP); | 1871 | return ERR_PTR(-EOPNOTSUPP); |
1873 | switch(type) { | 1872 | switch(type) { |
1874 | case ACL_TYPE_ACCESS: | 1873 | case ACL_TYPE_ACCESS: |
1875 | name = XATTR_NAME_ACL_ACCESS; | 1874 | name = POSIX_ACL_XATTR_ACCESS; |
1876 | break; | 1875 | break; |
1877 | case ACL_TYPE_DEFAULT: | 1876 | case ACL_TYPE_DEFAULT: |
1878 | name = XATTR_NAME_ACL_DEFAULT; | 1877 | name = POSIX_ACL_XATTR_DEFAULT; |
1879 | break; | 1878 | break; |
1880 | default: | 1879 | default: |
1881 | return ERR_PTR(-EOPNOTSUPP); | 1880 | return ERR_PTR(-EOPNOTSUPP); |
@@ -1919,17 +1918,17 @@ nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl) | |||
1919 | return -EOPNOTSUPP; | 1918 | return -EOPNOTSUPP; |
1920 | switch(type) { | 1919 | switch(type) { |
1921 | case ACL_TYPE_ACCESS: | 1920 | case ACL_TYPE_ACCESS: |
1922 | name = XATTR_NAME_ACL_ACCESS; | 1921 | name = POSIX_ACL_XATTR_ACCESS; |
1923 | break; | 1922 | break; |
1924 | case ACL_TYPE_DEFAULT: | 1923 | case ACL_TYPE_DEFAULT: |
1925 | name = XATTR_NAME_ACL_DEFAULT; | 1924 | name = POSIX_ACL_XATTR_DEFAULT; |
1926 | break; | 1925 | break; |
1927 | default: | 1926 | default: |
1928 | return -EOPNOTSUPP; | 1927 | return -EOPNOTSUPP; |
1929 | } | 1928 | } |
1930 | 1929 | ||
1931 | if (acl && acl->a_count) { | 1930 | if (acl && acl->a_count) { |
1932 | size = xattr_acl_size(acl->a_count); | 1931 | size = posix_acl_xattr_size(acl->a_count); |
1933 | value = kmalloc(size, GFP_KERNEL); | 1932 | value = kmalloc(size, GFP_KERNEL); |
1934 | if (!value) | 1933 | if (!value) |
1935 | return -ENOMEM; | 1934 | return -ENOMEM; |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 94dc42475a04..76caedf737f2 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -36,10 +36,16 @@ int reiserfs_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
36 | /* following two cases are taken from fs/ext2/ioctl.c by Remy | 36 | /* following two cases are taken from fs/ext2/ioctl.c by Remy |
37 | Card (card@masi.ibp.fr) */ | 37 | Card (card@masi.ibp.fr) */ |
38 | case REISERFS_IOC_GETFLAGS: | 38 | case REISERFS_IOC_GETFLAGS: |
39 | if (!reiserfs_attrs (inode->i_sb)) | ||
40 | return -ENOTTY; | ||
41 | |||
39 | flags = REISERFS_I(inode) -> i_attrs; | 42 | flags = REISERFS_I(inode) -> i_attrs; |
40 | i_attrs_to_sd_attrs( inode, ( __u16 * ) &flags ); | 43 | i_attrs_to_sd_attrs( inode, ( __u16 * ) &flags ); |
41 | return put_user(flags, (int __user *) arg); | 44 | return put_user(flags, (int __user *) arg); |
42 | case REISERFS_IOC_SETFLAGS: { | 45 | case REISERFS_IOC_SETFLAGS: { |
46 | if (!reiserfs_attrs (inode->i_sb)) | ||
47 | return -ENOTTY; | ||
48 | |||
43 | if (IS_RDONLY(inode)) | 49 | if (IS_RDONLY(inode)) |
44 | return -EROFS; | 50 | return -EROFS; |
45 | 51 | ||
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 660aefca1fd2..4b80ab95d338 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -1053,10 +1053,9 @@ static void handle_barrier_mode(struct super_block *s, unsigned long bits) { | |||
1053 | 1053 | ||
1054 | static void handle_attrs( struct super_block *s ) | 1054 | static void handle_attrs( struct super_block *s ) |
1055 | { | 1055 | { |
1056 | struct reiserfs_super_block * rs; | 1056 | struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s); |
1057 | 1057 | ||
1058 | if( reiserfs_attrs( s ) ) { | 1058 | if( reiserfs_attrs( s ) ) { |
1059 | rs = SB_DISK_SUPER_BLOCK (s); | ||
1060 | if( old_format_only(s) ) { | 1059 | if( old_format_only(s) ) { |
1061 | reiserfs_warning(s, "reiserfs: cannot support attributes on 3.5.x disk format" ); | 1060 | reiserfs_warning(s, "reiserfs: cannot support attributes on 3.5.x disk format" ); |
1062 | REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS ); | 1061 | REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS ); |
@@ -1066,6 +1065,8 @@ static void handle_attrs( struct super_block *s ) | |||
1066 | reiserfs_warning(s, "reiserfs: cannot support attributes until flag is set in super-block" ); | 1065 | reiserfs_warning(s, "reiserfs: cannot support attributes until flag is set in super-block" ); |
1067 | REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS ); | 1066 | REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS ); |
1068 | } | 1067 | } |
1068 | } else if (le32_to_cpu( rs -> s_flags ) & reiserfs_attrs_cleared) { | ||
1069 | REISERFS_SB(s)->s_mount_opt |= REISERFS_ATTRS; | ||
1069 | } | 1070 | } |
1070 | } | 1071 | } |
1071 | 1072 | ||
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 3f6dc7112bc6..ac191ed7df0a 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -159,14 +159,12 @@ udf_find_entry(struct inode *dir, struct dentry *dentry, | |||
159 | char *nameptr; | 159 | char *nameptr; |
160 | uint8_t lfi; | 160 | uint8_t lfi; |
161 | uint16_t liu; | 161 | uint16_t liu; |
162 | loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; | 162 | loff_t size; |
163 | kernel_lb_addr bloc, eloc; | 163 | kernel_lb_addr bloc, eloc; |
164 | uint32_t extoffset, elen, offset; | 164 | uint32_t extoffset, elen, offset; |
165 | struct buffer_head *bh = NULL; | 165 | struct buffer_head *bh = NULL; |
166 | 166 | ||
167 | if (!dir) | 167 | size = (udf_ext0_offset(dir) + dir->i_size) >> 2; |
168 | return NULL; | ||
169 | |||
170 | f_pos = (udf_ext0_offset(dir) >> 2); | 168 | f_pos = (udf_ext0_offset(dir) >> 2); |
171 | 169 | ||
172 | fibh->soffset = fibh->eoffset = (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; | 170 | fibh->soffset = fibh->eoffset = (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index c627bc408a6b..9ad142476f33 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -108,6 +108,21 @@ typedef int (*acpi_op_unbind) (struct acpi_device *device); | |||
108 | typedef int (*acpi_op_match) (struct acpi_device *device, | 108 | typedef int (*acpi_op_match) (struct acpi_device *device, |
109 | struct acpi_driver *driver); | 109 | struct acpi_driver *driver); |
110 | 110 | ||
111 | struct acpi_bus_ops { | ||
112 | u32 acpi_op_add:1; | ||
113 | u32 acpi_op_remove:1; | ||
114 | u32 acpi_op_lock:1; | ||
115 | u32 acpi_op_start:1; | ||
116 | u32 acpi_op_stop:1; | ||
117 | u32 acpi_op_suspend:1; | ||
118 | u32 acpi_op_resume:1; | ||
119 | u32 acpi_op_scan:1; | ||
120 | u32 acpi_op_bind:1; | ||
121 | u32 acpi_op_unbind:1; | ||
122 | u32 acpi_op_match:1; | ||
123 | u32 reserved:21; | ||
124 | }; | ||
125 | |||
111 | struct acpi_device_ops { | 126 | struct acpi_device_ops { |
112 | acpi_op_add add; | 127 | acpi_op_add add; |
113 | acpi_op_remove remove; | 128 | acpi_op_remove remove; |
@@ -327,9 +342,9 @@ int acpi_bus_generate_event (struct acpi_device *device, u8 type, int data); | |||
327 | int acpi_bus_receive_event (struct acpi_bus_event *event); | 342 | int acpi_bus_receive_event (struct acpi_bus_event *event); |
328 | int acpi_bus_register_driver (struct acpi_driver *driver); | 343 | int acpi_bus_register_driver (struct acpi_driver *driver); |
329 | int acpi_bus_unregister_driver (struct acpi_driver *driver); | 344 | int acpi_bus_unregister_driver (struct acpi_driver *driver); |
330 | int acpi_bus_scan (struct acpi_device *start); | ||
331 | int acpi_bus_add (struct acpi_device **child, struct acpi_device *parent, | 345 | int acpi_bus_add (struct acpi_device **child, struct acpi_device *parent, |
332 | acpi_handle handle, int type); | 346 | acpi_handle handle, int type); |
347 | int acpi_bus_start (struct acpi_device *device); | ||
333 | 348 | ||
334 | 349 | ||
335 | int acpi_match_ids (struct acpi_device *device, char *ids); | 350 | int acpi_match_ids (struct acpi_device *device, char *ids); |
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index c62e92ec43b2..4ec722d73381 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h | |||
@@ -68,6 +68,7 @@ void acpi_pci_irq_del_prt (int segment, int bus); | |||
68 | 68 | ||
69 | struct pci_bus; | 69 | struct pci_bus; |
70 | 70 | ||
71 | acpi_status acpi_get_pci_id (acpi_handle handle, struct acpi_pci_id *id); | ||
71 | int acpi_pci_bind (struct acpi_device *device); | 72 | int acpi_pci_bind (struct acpi_device *device); |
72 | int acpi_pci_unbind (struct acpi_device *device); | 73 | int acpi_pci_unbind (struct acpi_device *device); |
73 | int acpi_pci_bind_root (struct acpi_device *device, struct acpi_pci_id *id, struct pci_bus *bus); | 74 | int acpi_pci_bind_root (struct acpi_device *device, struct acpi_pci_id *id, struct pci_bus *bus); |
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h index 0c7b57bc043a..b7806aa3785c 100644 --- a/include/asm-alpha/pci.h +++ b/include/asm-alpha/pci.h | |||
@@ -223,6 +223,25 @@ pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, | |||
223 | /* Nothing to do. */ | 223 | /* Nothing to do. */ |
224 | } | 224 | } |
225 | 225 | ||
226 | #ifdef CONFIG_PCI | ||
227 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
228 | enum pci_dma_burst_strategy *strat, | ||
229 | unsigned long *strategy_parameter) | ||
230 | { | ||
231 | unsigned long cacheline_size; | ||
232 | u8 byte; | ||
233 | |||
234 | pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte); | ||
235 | if (byte == 0) | ||
236 | cacheline_size = 1024; | ||
237 | else | ||
238 | cacheline_size = (int) byte * 4; | ||
239 | |||
240 | *strat = PCI_DMA_BURST_BOUNDARY; | ||
241 | *strategy_parameter = cacheline_size; | ||
242 | } | ||
243 | #endif | ||
244 | |||
226 | /* TODO: integrate with include/asm-generic/pci.h ? */ | 245 | /* TODO: integrate with include/asm-generic/pci.h ? */ |
227 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) | 246 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) |
228 | { | 247 | { |
diff --git a/include/asm-alpha/serial.h b/include/asm-alpha/serial.h index 7b2d9ee95a44..7e4b2987d453 100644 --- a/include/asm-alpha/serial.h +++ b/include/asm-alpha/serial.h | |||
@@ -22,54 +22,9 @@ | |||
22 | #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF | 22 | #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | #ifdef CONFIG_SERIAL_MANY_PORTS | 25 | #define SERIAL_PORT_DFNS \ |
26 | #define FOURPORT_FLAGS ASYNC_FOURPORT | ||
27 | #define ACCENT_FLAGS 0 | ||
28 | #define BOCA_FLAGS 0 | ||
29 | #endif | ||
30 | |||
31 | #define STD_SERIAL_PORT_DEFNS \ | ||
32 | /* UART CLK PORT IRQ FLAGS */ \ | 26 | /* UART CLK PORT IRQ FLAGS */ \ |
33 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ | 27 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ |
34 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ | 28 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ |
35 | { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ | 29 | { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ |
36 | { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ | 30 | { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ |
37 | |||
38 | |||
39 | #ifdef CONFIG_SERIAL_MANY_PORTS | ||
40 | #define EXTRA_SERIAL_PORT_DEFNS \ | ||
41 | { 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */ \ | ||
42 | { 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS }, /* ttyS5 */ \ | ||
43 | { 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS }, /* ttyS6 */ \ | ||
44 | { 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS }, /* ttyS7 */ \ | ||
45 | { 0, BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS }, /* ttyS8 */ \ | ||
46 | { 0, BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS }, /* ttyS9 */ \ | ||
47 | { 0, BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS }, /* ttyS10 */ \ | ||
48 | { 0, BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS }, /* ttyS11 */ \ | ||
49 | { 0, BASE_BAUD, 0x330, 4, ACCENT_FLAGS }, /* ttyS12 */ \ | ||
50 | { 0, BASE_BAUD, 0x338, 4, ACCENT_FLAGS }, /* ttyS13 */ \ | ||
51 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS14 (spare) */ \ | ||
52 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS15 (spare) */ \ | ||
53 | { 0, BASE_BAUD, 0x100, 12, BOCA_FLAGS }, /* ttyS16 */ \ | ||
54 | { 0, BASE_BAUD, 0x108, 12, BOCA_FLAGS }, /* ttyS17 */ \ | ||
55 | { 0, BASE_BAUD, 0x110, 12, BOCA_FLAGS }, /* ttyS18 */ \ | ||
56 | { 0, BASE_BAUD, 0x118, 12, BOCA_FLAGS }, /* ttyS19 */ \ | ||
57 | { 0, BASE_BAUD, 0x120, 12, BOCA_FLAGS }, /* ttyS20 */ \ | ||
58 | { 0, BASE_BAUD, 0x128, 12, BOCA_FLAGS }, /* ttyS21 */ \ | ||
59 | { 0, BASE_BAUD, 0x130, 12, BOCA_FLAGS }, /* ttyS22 */ \ | ||
60 | { 0, BASE_BAUD, 0x138, 12, BOCA_FLAGS }, /* ttyS23 */ \ | ||
61 | { 0, BASE_BAUD, 0x140, 12, BOCA_FLAGS }, /* ttyS24 */ \ | ||
62 | { 0, BASE_BAUD, 0x148, 12, BOCA_FLAGS }, /* ttyS25 */ \ | ||
63 | { 0, BASE_BAUD, 0x150, 12, BOCA_FLAGS }, /* ttyS26 */ \ | ||
64 | { 0, BASE_BAUD, 0x158, 12, BOCA_FLAGS }, /* ttyS27 */ \ | ||
65 | { 0, BASE_BAUD, 0x160, 12, BOCA_FLAGS }, /* ttyS28 */ \ | ||
66 | { 0, BASE_BAUD, 0x168, 12, BOCA_FLAGS }, /* ttyS29 */ \ | ||
67 | { 0, BASE_BAUD, 0x170, 12, BOCA_FLAGS }, /* ttyS30 */ \ | ||
68 | { 0, BASE_BAUD, 0x178, 12, BOCA_FLAGS }, /* ttyS31 */ | ||
69 | #else | ||
70 | #define EXTRA_SERIAL_PORT_DEFNS | ||
71 | #endif | ||
72 | |||
73 | #define SERIAL_PORT_DFNS \ | ||
74 | STD_SERIAL_PORT_DEFNS \ | ||
75 | EXTRA_SERIAL_PORT_DEFNS | ||
diff --git a/include/asm-arm/arch-ixp4xx/io.h b/include/asm-arm/arch-ixp4xx/io.h index c27b9d3079a7..7495026e2c18 100644 --- a/include/asm-arm/arch-ixp4xx/io.h +++ b/include/asm-arm/arch-ixp4xx/io.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Author: Deepak Saxena <dsaxena@plexity.net> | 4 | * Author: Deepak Saxena <dsaxena@plexity.net> |
5 | * | 5 | * |
6 | * Copyright (C) 2002-2004 MontaVista Software, Inc. | 6 | * Copyright (C) 2002-2005 MontaVista Software, Inc. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -383,6 +383,180 @@ __ixp4xx_insl(u32 io_addr, u32 *vaddr, u32 count) | |||
383 | *vaddr++ = inl(io_addr); | 383 | *vaddr++ = inl(io_addr); |
384 | } | 384 | } |
385 | 385 | ||
386 | #define __is_io_address(p) (((unsigned long)p >= 0x0) && \ | ||
387 | ((unsigned long)p <= 0x0000ffff)) | ||
388 | static inline unsigned int | ||
389 | __ixp4xx_ioread8(void __iomem *port) | ||
390 | { | ||
391 | if (__is_io_address(port)) | ||
392 | return (unsigned int)__ixp4xx_inb((unsigned int)port); | ||
393 | else | ||
394 | #ifndef CONFIG_IXP4XX_INDIRECT_PCI | ||
395 | return (unsigned int)__raw_readb((u32)port); | ||
396 | #else | ||
397 | return (unsigned int)__ixp4xx_readb((u32)port); | ||
398 | #endif | ||
399 | } | ||
400 | |||
401 | static inline void | ||
402 | __ixp4xx_ioread8_rep(u32 port, u8 *vaddr, u32 count) | ||
403 | { | ||
404 | if (__is_io_address(port)) | ||
405 | __ixp4xx_insb(port, vaddr, count); | ||
406 | else | ||
407 | #ifndef CONFIG_IXP4XX_INDIRECT_PCI | ||
408 | __raw_readsb((void __iomem *)port, vaddr, count); | ||
409 | #else | ||
410 | __ixp4xx_readsb(port, vaddr, count); | ||
411 | #endif | ||
412 | } | ||
413 | |||
414 | static inline unsigned int | ||
415 | __ixp4xx_ioread16(void __iomem *port) | ||
416 | { | ||
417 | if (__is_io_address(port)) | ||
418 | return (unsigned int)__ixp4xx_inw((unsigned int)port); | ||
419 | else | ||
420 | #ifndef CONFIG_IXP4XX_INDIRECT_PCI | ||
421 | return le16_to_cpu(__raw_readw((u32)port)); | ||
422 | #else | ||
423 | return (unsigned int)__ixp4xx_readw((u32)port); | ||
424 | #endif | ||
425 | } | ||
426 | |||
427 | static inline void | ||
428 | __ixp4xx_ioread16_rep(u32 port, u16 *vaddr, u32 count) | ||
429 | { | ||
430 | if (__is_io_address(port)) | ||
431 | __ixp4xx_insw(port, vaddr, count); | ||
432 | else | ||
433 | #ifndef CONFIG_IXP4XX_INDIRECT_PCI | ||
434 | __raw_readsw((void __iomem *)port, vaddr, count); | ||
435 | #else | ||
436 | __ixp4xx_readsw(port, vaddr, count); | ||
437 | #endif | ||
438 | } | ||
439 | |||
440 | static inline unsigned int | ||
441 | __ixp4xx_ioread32(void __iomem *port) | ||
442 | { | ||
443 | if (__is_io_address(port)) | ||
444 | return (unsigned int)__ixp4xx_inl((unsigned int)port); | ||
445 | else { | ||
446 | #ifndef CONFIG_IXP4XX_INDIRECT_PCI | ||
447 | return le32_to_cpu(__raw_readl((u32)port)); | ||
448 | #else | ||
449 | return (unsigned int)__ixp4xx_readl((u32)port); | ||
450 | #endif | ||
451 | } | ||
452 | } | ||
453 | |||
454 | static inline void | ||
455 | __ixp4xx_ioread32_rep(u32 port, u32 *vaddr, u32 count) | ||
456 | { | ||
457 | if (__is_io_address(port)) | ||
458 | __ixp4xx_insl(port, vaddr, count); | ||
459 | else | ||
460 | #ifndef CONFIG_IXP4XX_INDIRECT_PCI | ||
461 | __raw_readsl((void __iomem *)port, vaddr, count); | ||
462 | #else | ||
463 | __ixp4xx_readsl(port, vaddr, count); | ||
464 | #endif | ||
465 | } | ||
466 | |||
467 | static inline void | ||
468 | __ixp4xx_iowrite8(u8 value, void __iomem *port) | ||
469 | { | ||
470 | if (__is_io_address(port)) | ||
471 | __ixp4xx_outb(value, (unsigned int)port); | ||
472 | else | ||
473 | #ifndef CONFIG_IXP4XX_INDIRECT_PCI | ||
474 | __raw_writeb(value, (u32)port); | ||
475 | #else | ||
476 | __ixp4xx_writeb(value, (u32)port); | ||
477 | #endif | ||
478 | } | ||
479 | |||
480 | static inline void | ||
481 | __ixp4xx_iowrite8_rep(u32 port, u8 *vaddr, u32 count) | ||
482 | { | ||
483 | if (__is_io_address(port)) | ||
484 | __ixp4xx_outsb(port, vaddr, count); | ||
485 | #ifndef CONFIG_IXP4XX_INDIRECT_PCI | ||
486 | __raw_writesb((void __iomem *)port, vaddr, count); | ||
487 | #else | ||
488 | __ixp4xx_writesb(port, vaddr, count); | ||
489 | #endif | ||
490 | } | ||
491 | |||
492 | static inline void | ||
493 | __ixp4xx_iowrite16(u16 value, void __iomem *port) | ||
494 | { | ||
495 | if (__is_io_address(port)) | ||
496 | __ixp4xx_outw(value, (unsigned int)port); | ||
497 | else | ||
498 | #ifndef CONFIG_IXP4XX_INDIRECT_PCI | ||
499 | __raw_writew(cpu_to_le16(value), (u32)port); | ||
500 | #else | ||
501 | __ixp4xx_writew(value, (u32)port); | ||
502 | #endif | ||
503 | } | ||
504 | |||
505 | static inline void | ||
506 | __ixp4xx_iowrite16_rep(u32 port, u16 *vaddr, u32 count) | ||
507 | { | ||
508 | if (__is_io_address(port)) | ||
509 | __ixp4xx_outsw(port, vaddr, count); | ||
510 | #ifndef CONFIG_IXP4XX_INDIRECT_PCI | ||
511 | __raw_readsw((void __iomem *)port, vaddr, count); | ||
512 | #else | ||
513 | __ixp4xx_writesw(port, vaddr, count); | ||
514 | #endif | ||
515 | } | ||
516 | |||
517 | static inline void | ||
518 | __ixp4xx_iowrite32(u32 value, void __iomem *port) | ||
519 | { | ||
520 | if (__is_io_address(port)) | ||
521 | __ixp4xx_outl(value, (unsigned int)port); | ||
522 | else | ||
523 | #ifndef CONFIG_IXP4XX_INDIRECT_PCI | ||
524 | __raw_writel(cpu_to_le32(value), (u32)port); | ||
525 | #else | ||
526 | __ixp4xx_writel(value, (u32)port); | ||
527 | #endif | ||
528 | } | ||
529 | |||
530 | static inline void | ||
531 | __ixp4xx_iowrite32_rep(u32 port, u32 *vaddr, u32 count) | ||
532 | { | ||
533 | if (__is_io_address(port)) | ||
534 | __ixp4xx_outsl(port, vaddr, count); | ||
535 | #ifndef CONFIG_IXP4XX_INDIRECT_PCI | ||
536 | __raw_readsl((void __iomem *)port, vaddr, count); | ||
537 | #else | ||
538 | __ixp4xx_outsl(port, vaddr, count); | ||
539 | #endif | ||
540 | } | ||
541 | |||
542 | #define ioread8(p) __ixp4xx_ioread8(p) | ||
543 | #define ioread16(p) __ixp4xx_ioread16(p) | ||
544 | #define ioread32(p) __ixp4xx_ioread32(p) | ||
545 | |||
546 | #define ioread8_rep(p, v, c) __ixp4xx_ioread8_rep(p, v, c) | ||
547 | #define ioread16_rep(p, v, c) __ixp4xx_ioread16_rep(p, v, c) | ||
548 | #define ioread32_rep(p, v, c) __ixp4xx_ioread32_rep(p, v, c) | ||
549 | |||
550 | #define iowrite8(v,p) __ixp4xx_iowrite8(v,p) | ||
551 | #define iowrite16(v,p) __ixp4xx_iowrite16(v,p) | ||
552 | #define iowrite32(v,p) __ixp4xx_iowrite32(v,p) | ||
553 | |||
554 | #define iowrite8_rep(p, v, c) __ixp4xx_iowrite8_rep(p, v, c) | ||
555 | #define iowrite16_rep(p, v, c) __ixp4xx_iowrite16_rep(p, v, c) | ||
556 | #define iowrite32_rep(p, v, c) __ixp4xx_iowrite32_rep(p, v, c) | ||
557 | |||
558 | #define ioport_map(port, nr) ((void __iomem*)port) | ||
559 | #define ioport_unmap(addr) | ||
386 | 560 | ||
387 | #endif // __ASM_ARM_ARCH_IO_H | 561 | #endif // __ASM_ARM_ARCH_IO_H |
388 | 562 | ||
diff --git a/include/asm-arm/arch-pxa/debug-macro.S b/include/asm-arm/arch-pxa/debug-macro.S index f288e74b67c2..b6ec68879176 100644 --- a/include/asm-arm/arch-pxa/debug-macro.S +++ b/include/asm-arm/arch-pxa/debug-macro.S | |||
@@ -11,6 +11,8 @@ | |||
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "hardware.h" | ||
15 | |||
14 | .macro addruart,rx | 16 | .macro addruart,rx |
15 | mrc p15, 0, \rx, c1, c0 | 17 | mrc p15, 0, \rx, c1, c0 |
16 | tst \rx, #1 @ MMU enabled? | 18 | tst \rx, #1 @ MMU enabled? |
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h index b5e54a9e9fa7..51f0fe0ac165 100644 --- a/include/asm-arm/arch-pxa/pxa-regs.h +++ b/include/asm-arm/arch-pxa/pxa-regs.h | |||
@@ -1505,6 +1505,7 @@ | |||
1505 | #define PSSR_OTGPH (1 << 6) /* OTG Peripheral control Hold */ | 1505 | #define PSSR_OTGPH (1 << 6) /* OTG Peripheral control Hold */ |
1506 | #define PSSR_RDH (1 << 5) /* Read Disable Hold */ | 1506 | #define PSSR_RDH (1 << 5) /* Read Disable Hold */ |
1507 | #define PSSR_PH (1 << 4) /* Peripheral Control Hold */ | 1507 | #define PSSR_PH (1 << 4) /* Peripheral Control Hold */ |
1508 | #define PSSR_STS (1 << 3) /* Standby Mode Status */ | ||
1508 | #define PSSR_VFS (1 << 2) /* VDD Fault Status */ | 1509 | #define PSSR_VFS (1 << 2) /* VDD Fault Status */ |
1509 | #define PSSR_BFS (1 << 1) /* Battery Fault Status */ | 1510 | #define PSSR_BFS (1 << 1) /* Battery Fault Status */ |
1510 | #define PSSR_SSS (1 << 0) /* Software Sleep Status */ | 1511 | #define PSSR_SSS (1 << 0) /* Software Sleep Status */ |
@@ -1965,6 +1966,7 @@ | |||
1965 | #define MECR_NOS (1 << 0) /* Number Of Sockets: 0 -> 1 sock, 1 -> 2 sock */ | 1966 | #define MECR_NOS (1 << 0) /* Number Of Sockets: 0 -> 1 sock, 1 -> 2 sock */ |
1966 | #define MECR_CIT (1 << 1) /* Card Is There: 0 -> no card, 1 -> card inserted */ | 1967 | #define MECR_CIT (1 << 1) /* Card Is There: 0 -> no card, 1 -> card inserted */ |
1967 | 1968 | ||
1969 | #define MDREFR_K0DB4 (1 << 29) /* SDCLK0 Divide by 4 Control/Status */ | ||
1968 | #define MDREFR_K2FREE (1 << 25) /* SDRAM Free-Running Control */ | 1970 | #define MDREFR_K2FREE (1 << 25) /* SDRAM Free-Running Control */ |
1969 | #define MDREFR_K1FREE (1 << 24) /* SDRAM Free-Running Control */ | 1971 | #define MDREFR_K1FREE (1 << 24) /* SDRAM Free-Running Control */ |
1970 | #define MDREFR_K0FREE (1 << 23) /* SDRAM Free-Running Control */ | 1972 | #define MDREFR_K0FREE (1 << 23) /* SDRAM Free-Running Control */ |
diff --git a/include/asm-arm/arch-s3c2410/audio.h b/include/asm-arm/arch-s3c2410/audio.h new file mode 100644 index 000000000000..0d276e67f2fb --- /dev/null +++ b/include/asm-arm/arch-s3c2410/audio.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* linux/include/asm-arm/arch-s3c2410/audio.h | ||
2 | * | ||
3 | * (c) 2004-2005 Simtec Electronics | ||
4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * S3C24XX - Audio platfrom_device info | ||
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 version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * Changelog: | ||
14 | * 20-Nov-2004 BJD Created file | ||
15 | * 07-Mar-2005 BJD Added suspend/resume calls | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARCH_AUDIO_H | ||
19 | #define __ASM_ARCH_AUDIO_H __FILE__ | ||
20 | |||
21 | /* struct s3c24xx_iis_ops | ||
22 | * | ||
23 | * called from the s3c24xx audio core to deal with the architecture | ||
24 | * or the codec's setup and control. | ||
25 | * | ||
26 | * the pointer to itself is passed through in case the caller wants to | ||
27 | * embed this in an larger structure for easy reference to it's context. | ||
28 | */ | ||
29 | |||
30 | struct s3c24xx_iis_ops { | ||
31 | struct module *owner; | ||
32 | |||
33 | int (*startup)(struct s3c24xx_iis_ops *me); | ||
34 | void (*shutdown)(struct s3c24xx_iis_ops *me); | ||
35 | int (*suspend)(struct s3c24xx_iis_ops *me); | ||
36 | int (*resume)(struct s3c24xx_iis_ops *me); | ||
37 | |||
38 | int (*open)(struct s3c24xx_iis_ops *me, snd_pcm_substream_t *strm); | ||
39 | int (*close)(struct s3c24xx_iis_ops *me, snd_pcm_substream_t *strm); | ||
40 | int (*prepare)(struct s3c24xx_iis_ops *me, snd_pcm_substream_t *strm, snd_pcm_runtime_t *rt); | ||
41 | }; | ||
42 | |||
43 | struct s3c24xx_platdata_iis { | ||
44 | const char *codec_clk; | ||
45 | struct s3c24xx_iis_ops *ops; | ||
46 | int (*match_dev)(struct device *dev); | ||
47 | }; | ||
48 | |||
49 | #endif /* __ASM_ARCH_AUDIO_H */ | ||
diff --git a/include/asm-arm/hardware/arm_timer.h b/include/asm-arm/hardware/arm_timer.h new file mode 100644 index 000000000000..04be3bdf46b8 --- /dev/null +++ b/include/asm-arm/hardware/arm_timer.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef __ASM_ARM_HARDWARE_ARM_TIMER_H | ||
2 | #define __ASM_ARM_HARDWARE_ARM_TIMER_H | ||
3 | |||
4 | #define TIMER_LOAD 0x00 | ||
5 | #define TIMER_VALUE 0x04 | ||
6 | #define TIMER_CTRL 0x08 | ||
7 | #define TIMER_CTRL_ONESHOT (1 << 0) | ||
8 | #define TIMER_CTRL_32BIT (1 << 1) | ||
9 | #define TIMER_CTRL_DIV1 (0 << 2) | ||
10 | #define TIMER_CTRL_DIV16 (1 << 2) | ||
11 | #define TIMER_CTRL_DIV256 (2 << 2) | ||
12 | #define TIMER_CTRL_IE (1 << 5) /* Interrupt Enable (versatile only) */ | ||
13 | #define TIMER_CTRL_PERIODIC (1 << 6) | ||
14 | #define TIMER_CTRL_ENABLE (1 << 7) | ||
15 | |||
16 | #define TIMER_INTCLR 0x0c | ||
17 | #define TIMER_RIS 0x10 | ||
18 | #define TIMER_MIS 0x14 | ||
19 | #define TIMER_BGLOAD 0x18 | ||
20 | |||
21 | #endif | ||
diff --git a/include/asm-arm/mach/arch.h b/include/asm-arm/mach/arch.h index 3a32e929ec8c..56c6bf4ab0c3 100644 --- a/include/asm-arm/mach/arch.h +++ b/include/asm-arm/mach/arch.h | |||
@@ -26,7 +26,7 @@ struct machine_desc { | |||
26 | * page tabe entry */ | 26 | * page tabe entry */ |
27 | 27 | ||
28 | const char *name; /* architecture name */ | 28 | const char *name; /* architecture name */ |
29 | unsigned int param_offset; /* parameter page */ | 29 | unsigned long boot_params; /* tagged list */ |
30 | 30 | ||
31 | unsigned int video_start; /* start of video RAM */ | 31 | unsigned int video_start; /* start of video RAM */ |
32 | unsigned int video_end; /* end of video RAM */ | 32 | unsigned int video_end; /* end of video RAM */ |
@@ -54,38 +54,6 @@ const struct machine_desc __mach_desc_##_type \ | |||
54 | .nr = MACH_TYPE_##_type, \ | 54 | .nr = MACH_TYPE_##_type, \ |
55 | .name = _name, | 55 | .name = _name, |
56 | 56 | ||
57 | #define MAINTAINER(n) | ||
58 | |||
59 | #define BOOT_MEM(_pram,_pio,_vio) \ | ||
60 | .phys_ram = _pram, \ | ||
61 | .phys_io = _pio, \ | ||
62 | .io_pg_offst = ((_vio)>>18)&0xfffc, | ||
63 | |||
64 | #define BOOT_PARAMS(_params) \ | ||
65 | .param_offset = _params, | ||
66 | |||
67 | #define VIDEO(_start,_end) \ | ||
68 | .video_start = _start, \ | ||
69 | .video_end = _end, | ||
70 | |||
71 | #define DISABLE_PARPORT(_n) \ | ||
72 | .reserve_lp##_n = 1, | ||
73 | |||
74 | #define SOFT_REBOOT \ | ||
75 | .soft_reboot = 1, | ||
76 | |||
77 | #define FIXUP(_func) \ | ||
78 | .fixup = _func, | ||
79 | |||
80 | #define MAPIO(_func) \ | ||
81 | .map_io = _func, | ||
82 | |||
83 | #define INITIRQ(_func) \ | ||
84 | .init_irq = _func, | ||
85 | |||
86 | #define INIT_MACHINE(_func) \ | ||
87 | .init_machine = _func, | ||
88 | |||
89 | #define MACHINE_END \ | 57 | #define MACHINE_END \ |
90 | }; | 58 | }; |
91 | 59 | ||
diff --git a/include/asm-arm/pci.h b/include/asm-arm/pci.h index 40ffaefbeb1a..e300646fe650 100644 --- a/include/asm-arm/pci.h +++ b/include/asm-arm/pci.h | |||
@@ -42,6 +42,16 @@ static inline void pcibios_penalize_isa_irq(int irq) | |||
42 | #define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME) | 42 | #define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME) |
43 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL)) | 43 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL)) |
44 | 44 | ||
45 | #ifdef CONFIG_PCI | ||
46 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
47 | enum pci_dma_burst_strategy *strat, | ||
48 | unsigned long *strategy_parameter) | ||
49 | { | ||
50 | *strat = PCI_DMA_BURST_INFINITY; | ||
51 | *strategy_parameter = ~0UL; | ||
52 | } | ||
53 | #endif | ||
54 | |||
45 | #define HAVE_PCI_MMAP | 55 | #define HAVE_PCI_MMAP |
46 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | 56 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, |
47 | enum pci_mmap_state mmap_state, int write_combine); | 57 | enum pci_mmap_state mmap_state, int write_combine); |
diff --git a/include/asm-arm/stat.h b/include/asm-arm/stat.h index ca8e7a8436da..ec4e2c2e3b47 100644 --- a/include/asm-arm/stat.h +++ b/include/asm-arm/stat.h | |||
@@ -89,6 +89,6 @@ struct stat64 { | |||
89 | unsigned long st_ctime_nsec; | 89 | unsigned long st_ctime_nsec; |
90 | 90 | ||
91 | unsigned long long st_ino; | 91 | unsigned long long st_ino; |
92 | }; | 92 | } __attribute__((packed)); |
93 | 93 | ||
94 | #endif | 94 | #endif |
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index 3d0d2860b6db..2f44b2044214 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h | |||
@@ -85,7 +85,9 @@ struct pt_regs; | |||
85 | void die(const char *msg, struct pt_regs *regs, int err) | 85 | void die(const char *msg, struct pt_regs *regs, int err) |
86 | __attribute__((noreturn)); | 86 | __attribute__((noreturn)); |
87 | 87 | ||
88 | void die_if_kernel(const char *str, struct pt_regs *regs, int err); | 88 | struct siginfo; |
89 | void notify_die(const char *str, struct pt_regs *regs, struct siginfo *info, | ||
90 | unsigned long err, unsigned long trap); | ||
89 | 91 | ||
90 | void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, | 92 | void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, |
91 | struct pt_regs *), | 93 | struct pt_regs *), |
@@ -290,7 +292,6 @@ do { \ | |||
290 | }) | 292 | }) |
291 | 293 | ||
292 | #ifdef CONFIG_SMP | 294 | #ifdef CONFIG_SMP |
293 | #error SMP not supported | ||
294 | 295 | ||
295 | #define smp_mb() mb() | 296 | #define smp_mb() mb() |
296 | #define smp_rmb() rmb() | 297 | #define smp_rmb() rmb() |
@@ -304,6 +305,8 @@ do { \ | |||
304 | #define smp_wmb() barrier() | 305 | #define smp_wmb() barrier() |
305 | #define smp_read_barrier_depends() do { } while(0) | 306 | #define smp_read_barrier_depends() do { } while(0) |
306 | 307 | ||
308 | #endif /* CONFIG_SMP */ | ||
309 | |||
307 | #if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110) | 310 | #if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110) |
308 | /* | 311 | /* |
309 | * On the StrongARM, "swp" is terminally broken since it bypasses the | 312 | * On the StrongARM, "swp" is terminally broken since it bypasses the |
@@ -316,9 +319,16 @@ do { \ | |||
316 | * | 319 | * |
317 | * We choose (1) since its the "easiest" to achieve here and is not | 320 | * We choose (1) since its the "easiest" to achieve here and is not |
318 | * dependent on the processor type. | 321 | * dependent on the processor type. |
322 | * | ||
323 | * NOTE that this solution won't work on an SMP system, so explcitly | ||
324 | * forbid it here. | ||
319 | */ | 325 | */ |
326 | #ifdef CONFIG_SMP | ||
327 | #error SMP is not supported on SA1100/SA110 | ||
328 | #else | ||
320 | #define swp_is_buggy | 329 | #define swp_is_buggy |
321 | #endif | 330 | #endif |
331 | #endif | ||
322 | 332 | ||
323 | static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size) | 333 | static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size) |
324 | { | 334 | { |
@@ -361,8 +371,6 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size | |||
361 | return ret; | 371 | return ret; |
362 | } | 372 | } |
363 | 373 | ||
364 | #endif /* CONFIG_SMP */ | ||
365 | |||
366 | #endif /* __ASSEMBLY__ */ | 374 | #endif /* __ASSEMBLY__ */ |
367 | 375 | ||
368 | #define arch_align_stack(x) (x) | 376 | #define arch_align_stack(x) (x) |
diff --git a/include/asm-arm/tlbflush.h b/include/asm-arm/tlbflush.h index 8a864b118569..9387a5e1ffe0 100644 --- a/include/asm-arm/tlbflush.h +++ b/include/asm-arm/tlbflush.h | |||
@@ -235,7 +235,7 @@ extern struct cpu_tlb_fns cpu_tlb; | |||
235 | 235 | ||
236 | #define tlb_flag(f) ((always_tlb_flags & (f)) || (__tlb_flag & possible_tlb_flags & (f))) | 236 | #define tlb_flag(f) ((always_tlb_flags & (f)) || (__tlb_flag & possible_tlb_flags & (f))) |
237 | 237 | ||
238 | static inline void flush_tlb_all(void) | 238 | static inline void local_flush_tlb_all(void) |
239 | { | 239 | { |
240 | const int zero = 0; | 240 | const int zero = 0; |
241 | const unsigned int __tlb_flag = __cpu_tlb_flags; | 241 | const unsigned int __tlb_flag = __cpu_tlb_flags; |
@@ -253,7 +253,7 @@ static inline void flush_tlb_all(void) | |||
253 | asm("mcr%? p15, 0, %0, c8, c5, 0" : : "r" (zero)); | 253 | asm("mcr%? p15, 0, %0, c8, c5, 0" : : "r" (zero)); |
254 | } | 254 | } |
255 | 255 | ||
256 | static inline void flush_tlb_mm(struct mm_struct *mm) | 256 | static inline void local_flush_tlb_mm(struct mm_struct *mm) |
257 | { | 257 | { |
258 | const int zero = 0; | 258 | const int zero = 0; |
259 | const int asid = ASID(mm); | 259 | const int asid = ASID(mm); |
@@ -282,7 +282,7 @@ static inline void flush_tlb_mm(struct mm_struct *mm) | |||
282 | } | 282 | } |
283 | 283 | ||
284 | static inline void | 284 | static inline void |
285 | flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) | 285 | local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) |
286 | { | 286 | { |
287 | const int zero = 0; | 287 | const int zero = 0; |
288 | const unsigned int __tlb_flag = __cpu_tlb_flags; | 288 | const unsigned int __tlb_flag = __cpu_tlb_flags; |
@@ -313,7 +313,7 @@ flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) | |||
313 | asm("mcr%? p15, 0, %0, c8, c5, 1" : : "r" (uaddr)); | 313 | asm("mcr%? p15, 0, %0, c8, c5, 1" : : "r" (uaddr)); |
314 | } | 314 | } |
315 | 315 | ||
316 | static inline void flush_tlb_kernel_page(unsigned long kaddr) | 316 | static inline void local_flush_tlb_kernel_page(unsigned long kaddr) |
317 | { | 317 | { |
318 | const int zero = 0; | 318 | const int zero = 0; |
319 | const unsigned int __tlb_flag = __cpu_tlb_flags; | 319 | const unsigned int __tlb_flag = __cpu_tlb_flags; |
@@ -384,8 +384,24 @@ static inline void clean_pmd_entry(pmd_t *pmd) | |||
384 | /* | 384 | /* |
385 | * Convert calls to our calling convention. | 385 | * Convert calls to our calling convention. |
386 | */ | 386 | */ |
387 | #define flush_tlb_range(vma,start,end) __cpu_flush_user_tlb_range(start,end,vma) | 387 | #define local_flush_tlb_range(vma,start,end) __cpu_flush_user_tlb_range(start,end,vma) |
388 | #define flush_tlb_kernel_range(s,e) __cpu_flush_kern_tlb_range(s,e) | 388 | #define local_flush_tlb_kernel_range(s,e) __cpu_flush_kern_tlb_range(s,e) |
389 | |||
390 | #ifndef CONFIG_SMP | ||
391 | #define flush_tlb_all local_flush_tlb_all | ||
392 | #define flush_tlb_mm local_flush_tlb_mm | ||
393 | #define flush_tlb_page local_flush_tlb_page | ||
394 | #define flush_tlb_kernel_page local_flush_tlb_kernel_page | ||
395 | #define flush_tlb_range local_flush_tlb_range | ||
396 | #define flush_tlb_kernel_range local_flush_tlb_kernel_range | ||
397 | #else | ||
398 | extern void flush_tlb_all(void); | ||
399 | extern void flush_tlb_mm(struct mm_struct *mm); | ||
400 | extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr); | ||
401 | extern void flush_tlb_kernel_page(unsigned long kaddr); | ||
402 | extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end); | ||
403 | extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); | ||
404 | #endif | ||
389 | 405 | ||
390 | /* | 406 | /* |
391 | * if PG_dcache_dirty is set for the page, we need to ensure that any | 407 | * if PG_dcache_dirty is set for the page, we need to ensure that any |
diff --git a/include/asm-arm26/serial.h b/include/asm-arm26/serial.h index 21e1df31f086..5fc747d1b501 100644 --- a/include/asm-arm26/serial.h +++ b/include/asm-arm26/serial.h | |||
@@ -30,34 +30,16 @@ | |||
30 | #if defined(CONFIG_ARCH_A5K) | 30 | #if defined(CONFIG_ARCH_A5K) |
31 | /* UART CLK PORT IRQ FLAGS */ | 31 | /* UART CLK PORT IRQ FLAGS */ |
32 | 32 | ||
33 | #define STD_SERIAL_PORT_DEFNS \ | 33 | #define SERIAL_PORT_DFNS \ |
34 | { 0, BASE_BAUD, 0x3F8, 10, STD_COM_FLAGS }, /* ttyS0 */ \ | 34 | { 0, BASE_BAUD, 0x3F8, 10, STD_COM_FLAGS }, /* ttyS0 */ \ |
35 | { 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS }, /* ttyS1 */ | 35 | { 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS }, /* ttyS1 */ |
36 | 36 | ||
37 | #else | 37 | #else |
38 | 38 | ||
39 | #define STD_SERIAL_PORT_DEFNS \ | 39 | #define SERIAL_PORT_DFNS \ |
40 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS0 */ \ | 40 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS0 */ \ |
41 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS1 */ | 41 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS1 */ |
42 | 42 | ||
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #define EXTRA_SERIAL_PORT_DEFNS \ | ||
46 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS2 */ \ | ||
47 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS3 */ \ | ||
48 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS4 */ \ | ||
49 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS5 */ \ | ||
50 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS6 */ \ | ||
51 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS7 */ \ | ||
52 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS8 */ \ | ||
53 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS9 */ \ | ||
54 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS10 */ \ | ||
55 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS11 */ \ | ||
56 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS12 */ \ | ||
57 | { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS13 */ | ||
58 | |||
59 | #define SERIAL_PORT_DFNS \ | ||
60 | STD_SERIAL_PORT_DEFNS \ | ||
61 | EXTRA_SERIAL_PORT_DEFNS | ||
62 | |||
63 | #endif | 45 | #endif |
diff --git a/include/asm-frv/pci.h b/include/asm-frv/pci.h index a6a469231f62..b4efe5e3591a 100644 --- a/include/asm-frv/pci.h +++ b/include/asm-frv/pci.h | |||
@@ -57,6 +57,16 @@ extern void pci_free_consistent(struct pci_dev *hwdev, size_t size, | |||
57 | */ | 57 | */ |
58 | #define PCI_DMA_BUS_IS_PHYS (1) | 58 | #define PCI_DMA_BUS_IS_PHYS (1) |
59 | 59 | ||
60 | #ifdef CONFIG_PCI | ||
61 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
62 | enum pci_dma_burst_strategy *strat, | ||
63 | unsigned long *strategy_parameter) | ||
64 | { | ||
65 | *strat = PCI_DMA_BURST_INFINITY; | ||
66 | *strategy_parameter = ~0UL; | ||
67 | } | ||
68 | #endif | ||
69 | |||
60 | /* | 70 | /* |
61 | * These are pretty much arbitary with the CoMEM implementation. | 71 | * These are pretty much arbitary with the CoMEM implementation. |
62 | * We have the whole address space to ourselves. | 72 | * We have the whole address space to ourselves. |
diff --git a/include/asm-i386/i8253.h b/include/asm-i386/i8253.h new file mode 100644 index 000000000000..015d8df07690 --- /dev/null +++ b/include/asm-i386/i8253.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_I8253_H__ | ||
2 | #define __ASM_I8253_H__ | ||
3 | |||
4 | extern spinlock_t i8253_lock; | ||
5 | |||
6 | #endif /* __ASM_I8253_H__ */ | ||
diff --git a/include/asm-i386/mach-default/do_timer.h b/include/asm-i386/mach-default/do_timer.h index 03dd13a48a8c..56211414fc95 100644 --- a/include/asm-i386/mach-default/do_timer.h +++ b/include/asm-i386/mach-default/do_timer.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* defines for inline arch setup functions */ | 1 | /* defines for inline arch setup functions */ |
2 | 2 | ||
3 | #include <asm/apic.h> | 3 | #include <asm/apic.h> |
4 | #include <asm/i8259.h> | ||
4 | 5 | ||
5 | /** | 6 | /** |
6 | * do_timer_interrupt_hook - hook into timer tick | 7 | * do_timer_interrupt_hook - hook into timer tick |
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h index fb749b85a739..3561899eb826 100644 --- a/include/asm-i386/pci.h +++ b/include/asm-i386/pci.h | |||
@@ -99,6 +99,16 @@ static inline void pcibios_add_platform_entries(struct pci_dev *dev) | |||
99 | { | 99 | { |
100 | } | 100 | } |
101 | 101 | ||
102 | #ifdef CONFIG_PCI | ||
103 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
104 | enum pci_dma_burst_strategy *strat, | ||
105 | unsigned long *strategy_parameter) | ||
106 | { | ||
107 | *strat = PCI_DMA_BURST_INFINITY; | ||
108 | *strategy_parameter = ~0UL; | ||
109 | } | ||
110 | #endif | ||
111 | |||
102 | #endif /* __KERNEL__ */ | 112 | #endif /* __KERNEL__ */ |
103 | 113 | ||
104 | /* implement the pci_ DMA API in terms of the generic device dma_ one */ | 114 | /* implement the pci_ DMA API in terms of the generic device dma_ one */ |
diff --git a/include/asm-i386/serial.h b/include/asm-i386/serial.h index 21ddecc77c77..e1ecfccb743b 100644 --- a/include/asm-i386/serial.h +++ b/include/asm-i386/serial.h | |||
@@ -22,109 +22,9 @@ | |||
22 | #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF | 22 | #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | #ifdef CONFIG_SERIAL_MANY_PORTS | 25 | #define SERIAL_PORT_DFNS \ |
26 | #define FOURPORT_FLAGS ASYNC_FOURPORT | ||
27 | #define ACCENT_FLAGS 0 | ||
28 | #define BOCA_FLAGS 0 | ||
29 | #define HUB6_FLAGS 0 | ||
30 | #endif | ||
31 | |||
32 | #define MCA_COM_FLAGS (STD_COM_FLAGS|ASYNC_BOOT_ONLYMCA) | ||
33 | |||
34 | /* | ||
35 | * The following define the access methods for the HUB6 card. All | ||
36 | * access is through two ports for all 24 possible chips. The card is | ||
37 | * selected through the high 2 bits, the port on that card with the | ||
38 | * "middle" 3 bits, and the register on that port with the bottom | ||
39 | * 3 bits. | ||
40 | * | ||
41 | * While the access port and interrupt is configurable, the default | ||
42 | * port locations are 0x302 for the port control register, and 0x303 | ||
43 | * for the data read/write register. Normally, the interrupt is at irq3 | ||
44 | * but can be anything from 3 to 7 inclusive. Note that using 3 will | ||
45 | * require disabling com2. | ||
46 | */ | ||
47 | |||
48 | #define C_P(card,port) (((card)<<6|(port)<<3) + 1) | ||
49 | |||
50 | #define STD_SERIAL_PORT_DEFNS \ | ||
51 | /* UART CLK PORT IRQ FLAGS */ \ | 26 | /* UART CLK PORT IRQ FLAGS */ \ |
52 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ | 27 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ |
53 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ | 28 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ |
54 | { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ | 29 | { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ |
55 | { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ | 30 | { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ |
56 | |||
57 | |||
58 | #ifdef CONFIG_SERIAL_MANY_PORTS | ||
59 | #define EXTRA_SERIAL_PORT_DEFNS \ | ||
60 | { 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */ \ | ||
61 | { 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS }, /* ttyS5 */ \ | ||
62 | { 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS }, /* ttyS6 */ \ | ||
63 | { 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS }, /* ttyS7 */ \ | ||
64 | { 0, BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS }, /* ttyS8 */ \ | ||
65 | { 0, BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS }, /* ttyS9 */ \ | ||
66 | { 0, BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS }, /* ttyS10 */ \ | ||
67 | { 0, BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS }, /* ttyS11 */ \ | ||
68 | { 0, BASE_BAUD, 0x330, 4, ACCENT_FLAGS }, /* ttyS12 */ \ | ||
69 | { 0, BASE_BAUD, 0x338, 4, ACCENT_FLAGS }, /* ttyS13 */ \ | ||
70 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS14 (spare) */ \ | ||
71 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS15 (spare) */ \ | ||
72 | { 0, BASE_BAUD, 0x100, 12, BOCA_FLAGS }, /* ttyS16 */ \ | ||
73 | { 0, BASE_BAUD, 0x108, 12, BOCA_FLAGS }, /* ttyS17 */ \ | ||
74 | { 0, BASE_BAUD, 0x110, 12, BOCA_FLAGS }, /* ttyS18 */ \ | ||
75 | { 0, BASE_BAUD, 0x118, 12, BOCA_FLAGS }, /* ttyS19 */ \ | ||
76 | { 0, BASE_BAUD, 0x120, 12, BOCA_FLAGS }, /* ttyS20 */ \ | ||
77 | { 0, BASE_BAUD, 0x128, 12, BOCA_FLAGS }, /* ttyS21 */ \ | ||
78 | { 0, BASE_BAUD, 0x130, 12, BOCA_FLAGS }, /* ttyS22 */ \ | ||
79 | { 0, BASE_BAUD, 0x138, 12, BOCA_FLAGS }, /* ttyS23 */ \ | ||
80 | { 0, BASE_BAUD, 0x140, 12, BOCA_FLAGS }, /* ttyS24 */ \ | ||
81 | { 0, BASE_BAUD, 0x148, 12, BOCA_FLAGS }, /* ttyS25 */ \ | ||
82 | { 0, BASE_BAUD, 0x150, 12, BOCA_FLAGS }, /* ttyS26 */ \ | ||
83 | { 0, BASE_BAUD, 0x158, 12, BOCA_FLAGS }, /* ttyS27 */ \ | ||
84 | { 0, BASE_BAUD, 0x160, 12, BOCA_FLAGS }, /* ttyS28 */ \ | ||
85 | { 0, BASE_BAUD, 0x168, 12, BOCA_FLAGS }, /* ttyS29 */ \ | ||
86 | { 0, BASE_BAUD, 0x170, 12, BOCA_FLAGS }, /* ttyS30 */ \ | ||
87 | { 0, BASE_BAUD, 0x178, 12, BOCA_FLAGS }, /* ttyS31 */ | ||
88 | #else | ||
89 | #define EXTRA_SERIAL_PORT_DEFNS | ||
90 | #endif | ||
91 | |||
92 | /* You can have up to four HUB6's in the system, but I've only | ||
93 | * included two cards here for a total of twelve ports. | ||
94 | */ | ||
95 | #if (defined(CONFIG_HUB6) && defined(CONFIG_SERIAL_MANY_PORTS)) | ||
96 | #define HUB6_SERIAL_PORT_DFNS \ | ||
97 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,0) }, /* ttyS32 */ \ | ||
98 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,1) }, /* ttyS33 */ \ | ||
99 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,2) }, /* ttyS34 */ \ | ||
100 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,3) }, /* ttyS35 */ \ | ||
101 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,4) }, /* ttyS36 */ \ | ||
102 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,5) }, /* ttyS37 */ \ | ||
103 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,0) }, /* ttyS38 */ \ | ||
104 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,1) }, /* ttyS39 */ \ | ||
105 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,2) }, /* ttyS40 */ \ | ||
106 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,3) }, /* ttyS41 */ \ | ||
107 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,4) }, /* ttyS42 */ \ | ||
108 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,5) }, /* ttyS43 */ | ||
109 | #else | ||
110 | #define HUB6_SERIAL_PORT_DFNS | ||
111 | #endif | ||
112 | |||
113 | #ifdef CONFIG_MCA | ||
114 | #define MCA_SERIAL_PORT_DFNS \ | ||
115 | { 0, BASE_BAUD, 0x3220, 3, MCA_COM_FLAGS }, \ | ||
116 | { 0, BASE_BAUD, 0x3228, 3, MCA_COM_FLAGS }, \ | ||
117 | { 0, BASE_BAUD, 0x4220, 3, MCA_COM_FLAGS }, \ | ||
118 | { 0, BASE_BAUD, 0x4228, 3, MCA_COM_FLAGS }, \ | ||
119 | { 0, BASE_BAUD, 0x5220, 3, MCA_COM_FLAGS }, \ | ||
120 | { 0, BASE_BAUD, 0x5228, 3, MCA_COM_FLAGS }, | ||
121 | #else | ||
122 | #define MCA_SERIAL_PORT_DFNS | ||
123 | #endif | ||
124 | |||
125 | #define SERIAL_PORT_DFNS \ | ||
126 | STD_SERIAL_PORT_DEFNS \ | ||
127 | EXTRA_SERIAL_PORT_DEFNS \ | ||
128 | HUB6_SERIAL_PORT_DFNS \ | ||
129 | MCA_SERIAL_PORT_DFNS | ||
130 | |||
diff --git a/include/asm-ia64/iosapic.h b/include/asm-ia64/iosapic.h index 38a7a72791cc..1093f35b3b90 100644 --- a/include/asm-ia64/iosapic.h +++ b/include/asm-ia64/iosapic.h | |||
@@ -71,8 +71,11 @@ static inline void iosapic_eoi(char __iomem *iosapic, u32 vector) | |||
71 | } | 71 | } |
72 | 72 | ||
73 | extern void __init iosapic_system_init (int pcat_compat); | 73 | extern void __init iosapic_system_init (int pcat_compat); |
74 | extern void __init iosapic_init (unsigned long address, | 74 | extern int __devinit iosapic_init (unsigned long address, |
75 | unsigned int gsi_base); | 75 | unsigned int gsi_base); |
76 | #ifdef CONFIG_HOTPLUG | ||
77 | extern int iosapic_remove (unsigned int gsi_base); | ||
78 | #endif /* CONFIG_HOTPLUG */ | ||
76 | extern int gsi_to_vector (unsigned int gsi); | 79 | extern int gsi_to_vector (unsigned int gsi); |
77 | extern int gsi_to_irq (unsigned int gsi); | 80 | extern int gsi_to_irq (unsigned int gsi); |
78 | extern void iosapic_enable_intr (unsigned int vector); | 81 | extern void iosapic_enable_intr (unsigned int vector); |
@@ -94,11 +97,14 @@ extern unsigned int iosapic_version (char __iomem *addr); | |||
94 | 97 | ||
95 | extern void iosapic_pci_fixup (int); | 98 | extern void iosapic_pci_fixup (int); |
96 | #ifdef CONFIG_NUMA | 99 | #ifdef CONFIG_NUMA |
97 | extern void __init map_iosapic_to_node (unsigned int, int); | 100 | extern void __devinit map_iosapic_to_node (unsigned int, int); |
98 | #endif | 101 | #endif |
99 | #else | 102 | #else |
100 | #define iosapic_system_init(pcat_compat) do { } while (0) | 103 | #define iosapic_system_init(pcat_compat) do { } while (0) |
101 | #define iosapic_init(address,gsi_base) do { } while (0) | 104 | #define iosapic_init(address,gsi_base) (-EINVAL) |
105 | #ifdef CONFIG_HOTPLUG | ||
106 | #define iosapic_remove(gsi_base) (-ENODEV) | ||
107 | #endif /* CONFIG_HOTPLUG */ | ||
102 | #define iosapic_register_intr(gsi,polarity,trigger) (gsi) | 108 | #define iosapic_register_intr(gsi,polarity,trigger) (gsi) |
103 | #define iosapic_unregister_intr(irq) do { } while (0) | 109 | #define iosapic_unregister_intr(irq) do { } while (0) |
104 | #define iosapic_override_isa_irq(isa_irq,gsi,polarity,trigger) do { } while (0) | 110 | #define iosapic_override_isa_irq(isa_irq,gsi,polarity,trigger) do { } while (0) |
diff --git a/include/asm-ia64/mmu_context.h b/include/asm-ia64/mmu_context.h index 0096e7e05012..e3e5fededb04 100644 --- a/include/asm-ia64/mmu_context.h +++ b/include/asm-ia64/mmu_context.h | |||
@@ -132,6 +132,9 @@ reload_context (mm_context_t context) | |||
132 | ia64_srlz_i(); /* srlz.i implies srlz.d */ | 132 | ia64_srlz_i(); /* srlz.i implies srlz.d */ |
133 | } | 133 | } |
134 | 134 | ||
135 | /* | ||
136 | * Must be called with preemption off | ||
137 | */ | ||
135 | static inline void | 138 | static inline void |
136 | activate_context (struct mm_struct *mm) | 139 | activate_context (struct mm_struct *mm) |
137 | { | 140 | { |
diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h index a8314ee4e7d2..0c4c5d801d3f 100644 --- a/include/asm-ia64/pci.h +++ b/include/asm-ia64/pci.h | |||
@@ -82,6 +82,25 @@ extern int pcibios_prep_mwi (struct pci_dev *); | |||
82 | #define sg_dma_len(sg) ((sg)->dma_length) | 82 | #define sg_dma_len(sg) ((sg)->dma_length) |
83 | #define sg_dma_address(sg) ((sg)->dma_address) | 83 | #define sg_dma_address(sg) ((sg)->dma_address) |
84 | 84 | ||
85 | #ifdef CONFIG_PCI | ||
86 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
87 | enum pci_dma_burst_strategy *strat, | ||
88 | unsigned long *strategy_parameter) | ||
89 | { | ||
90 | unsigned long cacheline_size; | ||
91 | u8 byte; | ||
92 | |||
93 | pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte); | ||
94 | if (byte == 0) | ||
95 | cacheline_size = 1024; | ||
96 | else | ||
97 | cacheline_size = (int) byte * 4; | ||
98 | |||
99 | *strat = PCI_DMA_BURST_MULTIPLE; | ||
100 | *strategy_parameter = cacheline_size; | ||
101 | } | ||
102 | #endif | ||
103 | |||
85 | #define HAVE_PCI_MMAP | 104 | #define HAVE_PCI_MMAP |
86 | extern int pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma, | 105 | extern int pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma, |
87 | enum pci_mmap_state mmap_state, int write_combine); | 106 | enum pci_mmap_state mmap_state, int write_combine); |
diff --git a/include/asm-ia64/sn/addrs.h b/include/asm-ia64/sn/addrs.h index 1bfdfb4d7b01..103d745dc5f2 100644 --- a/include/asm-ia64/sn/addrs.h +++ b/include/asm-ia64/sn/addrs.h | |||
@@ -216,6 +216,10 @@ | |||
216 | #define TIO_SWIN_WIDGETNUM(x) (((x) >> TIO_SWIN_SIZE_BITS) & TIO_SWIN_WIDGET_MASK) | 216 | #define TIO_SWIN_WIDGETNUM(x) (((x) >> TIO_SWIN_SIZE_BITS) & TIO_SWIN_WIDGET_MASK) |
217 | 217 | ||
218 | 218 | ||
219 | #define TIO_IOSPACE_ADDR(n,x) \ | ||
220 | /* Move in the Chiplet ID for TIO Local Block MMR */ \ | ||
221 | (REMOTE_ADDR(n,x) | 1UL << (NASID_SHIFT - 2)) | ||
222 | |||
219 | /* | 223 | /* |
220 | * The following macros produce the correct base virtual address for | 224 | * The following macros produce the correct base virtual address for |
221 | * the hub registers. The REMOTE_HUB_* macro produce | 225 | * the hub registers. The REMOTE_HUB_* macro produce |
@@ -233,13 +237,16 @@ | |||
233 | #define REMOTE_HUB_ADDR(n,x) \ | 237 | #define REMOTE_HUB_ADDR(n,x) \ |
234 | ((n & 1) ? \ | 238 | ((n & 1) ? \ |
235 | /* TIO: */ \ | 239 | /* TIO: */ \ |
236 | ((volatile u64 *)(GLOBAL_MMR_ADDR(n,x))) \ | 240 | (is_shub2() ? \ |
237 | : /* SHUB: */ \ | 241 | /* TIO on Shub2 */ \ |
238 | (((x) & BWIN_TOP) ? ((volatile u64 *)(GLOBAL_MMR_ADDR(n,x)))\ | 242 | (volatile u64 *)(TIO_IOSPACE_ADDR(n,x)) \ |
243 | : /* TIO on shub1 */ \ | ||
244 | (volatile u64 *)(GLOBAL_MMR_ADDR(n,x))) \ | ||
245 | \ | ||
246 | : /* SHUB1 and SHUB2 MMRs: */ \ | ||
247 | (((x) & BWIN_TOP) ? ((volatile u64 *)(GLOBAL_MMR_ADDR(n,x))) \ | ||
239 | : ((volatile u64 *)(NODE_SWIN_BASE(n,1) + 0x800000 + (x))))) | 248 | : ((volatile u64 *)(NODE_SWIN_BASE(n,1) + 0x800000 + (x))))) |
240 | 249 | ||
241 | |||
242 | |||
243 | #define HUB_L(x) (*((volatile typeof(*x) *)x)) | 250 | #define HUB_L(x) (*((volatile typeof(*x) *)x)) |
244 | #define HUB_S(x,d) (*((volatile typeof(*x) *)x) = (d)) | 251 | #define HUB_S(x,d) (*((volatile typeof(*x) *)x) = (d)) |
245 | 252 | ||
diff --git a/include/asm-ia64/sn/l1.h b/include/asm-ia64/sn/l1.h index 08050d37b662..2e5f0aa38889 100644 --- a/include/asm-ia64/sn/l1.h +++ b/include/asm-ia64/sn/l1.h | |||
@@ -33,5 +33,6 @@ | |||
33 | #define L1_BRICKTYPE_PA 0x6a /* j */ | 33 | #define L1_BRICKTYPE_PA 0x6a /* j */ |
34 | #define L1_BRICKTYPE_IA 0x6b /* k */ | 34 | #define L1_BRICKTYPE_IA 0x6b /* k */ |
35 | #define L1_BRICKTYPE_ATHENA 0x2b /* + */ | 35 | #define L1_BRICKTYPE_ATHENA 0x2b /* + */ |
36 | #define L1_BRICKTYPE_DAYTONA 0x7a /* z */ | ||
36 | 37 | ||
37 | #endif /* _ASM_IA64_SN_L1_H */ | 38 | #endif /* _ASM_IA64_SN_L1_H */ |
diff --git a/include/asm-ia64/sn/shub_mmr.h b/include/asm-ia64/sn/shub_mmr.h index 323fa0cd8d83..7de1d1d4b71a 100644 --- a/include/asm-ia64/sn/shub_mmr.h +++ b/include/asm-ia64/sn/shub_mmr.h | |||
@@ -14,96 +14,98 @@ | |||
14 | /* Register "SH_IPI_INT" */ | 14 | /* Register "SH_IPI_INT" */ |
15 | /* SHub Inter-Processor Interrupt Registers */ | 15 | /* SHub Inter-Processor Interrupt Registers */ |
16 | /* ==================================================================== */ | 16 | /* ==================================================================== */ |
17 | #define SH1_IPI_INT 0x0000000110000380 | 17 | #define SH1_IPI_INT __IA64_UL_CONST(0x0000000110000380) |
18 | #define SH2_IPI_INT 0x0000000010000380 | 18 | #define SH2_IPI_INT __IA64_UL_CONST(0x0000000010000380) |
19 | 19 | ||
20 | /* SH_IPI_INT_TYPE */ | 20 | /* SH_IPI_INT_TYPE */ |
21 | /* Description: Type of Interrupt: 0=INT, 2=PMI, 4=NMI, 5=INIT */ | 21 | /* Description: Type of Interrupt: 0=INT, 2=PMI, 4=NMI, 5=INIT */ |
22 | #define SH_IPI_INT_TYPE_SHFT 0 | 22 | #define SH_IPI_INT_TYPE_SHFT 0 |
23 | #define SH_IPI_INT_TYPE_MASK 0x0000000000000007 | 23 | #define SH_IPI_INT_TYPE_MASK __IA64_UL_CONST(0x0000000000000007) |
24 | 24 | ||
25 | /* SH_IPI_INT_AGT */ | 25 | /* SH_IPI_INT_AGT */ |
26 | /* Description: Agent, must be 0 for SHub */ | 26 | /* Description: Agent, must be 0 for SHub */ |
27 | #define SH_IPI_INT_AGT_SHFT 3 | 27 | #define SH_IPI_INT_AGT_SHFT 3 |
28 | #define SH_IPI_INT_AGT_MASK 0x0000000000000008 | 28 | #define SH_IPI_INT_AGT_MASK __IA64_UL_CONST(0x0000000000000008) |
29 | 29 | ||
30 | /* SH_IPI_INT_PID */ | 30 | /* SH_IPI_INT_PID */ |
31 | /* Description: Processor ID, same setting as on targeted McKinley */ | 31 | /* Description: Processor ID, same setting as on targeted McKinley */ |
32 | #define SH_IPI_INT_PID_SHFT 4 | 32 | #define SH_IPI_INT_PID_SHFT 4 |
33 | #define SH_IPI_INT_PID_MASK 0x00000000000ffff0 | 33 | #define SH_IPI_INT_PID_MASK __IA64_UL_CONST(0x00000000000ffff0) |
34 | 34 | ||
35 | /* SH_IPI_INT_BASE */ | 35 | /* SH_IPI_INT_BASE */ |
36 | /* Description: Optional interrupt vector area, 2MB aligned */ | 36 | /* Description: Optional interrupt vector area, 2MB aligned */ |
37 | #define SH_IPI_INT_BASE_SHFT 21 | 37 | #define SH_IPI_INT_BASE_SHFT 21 |
38 | #define SH_IPI_INT_BASE_MASK 0x0003ffffffe00000 | 38 | #define SH_IPI_INT_BASE_MASK __IA64_UL_CONST(0x0003ffffffe00000) |
39 | 39 | ||
40 | /* SH_IPI_INT_IDX */ | 40 | /* SH_IPI_INT_IDX */ |
41 | /* Description: Targeted McKinley interrupt vector */ | 41 | /* Description: Targeted McKinley interrupt vector */ |
42 | #define SH_IPI_INT_IDX_SHFT 52 | 42 | #define SH_IPI_INT_IDX_SHFT 52 |
43 | #define SH_IPI_INT_IDX_MASK 0x0ff0000000000000 | 43 | #define SH_IPI_INT_IDX_MASK __IA64_UL_CONST(0x0ff0000000000000) |
44 | 44 | ||
45 | /* SH_IPI_INT_SEND */ | 45 | /* SH_IPI_INT_SEND */ |
46 | /* Description: Send Interrupt Message to PI, This generates a puls */ | 46 | /* Description: Send Interrupt Message to PI, This generates a puls */ |
47 | #define SH_IPI_INT_SEND_SHFT 63 | 47 | #define SH_IPI_INT_SEND_SHFT 63 |
48 | #define SH_IPI_INT_SEND_MASK 0x8000000000000000 | 48 | #define SH_IPI_INT_SEND_MASK __IA64_UL_CONST(0x8000000000000000) |
49 | 49 | ||
50 | /* ==================================================================== */ | 50 | /* ==================================================================== */ |
51 | /* Register "SH_EVENT_OCCURRED" */ | 51 | /* Register "SH_EVENT_OCCURRED" */ |
52 | /* SHub Interrupt Event Occurred */ | 52 | /* SHub Interrupt Event Occurred */ |
53 | /* ==================================================================== */ | 53 | /* ==================================================================== */ |
54 | #define SH1_EVENT_OCCURRED 0x0000000110010000 | 54 | #define SH1_EVENT_OCCURRED __IA64_UL_CONST(0x0000000110010000) |
55 | #define SH1_EVENT_OCCURRED_ALIAS 0x0000000110010008 | 55 | #define SH1_EVENT_OCCURRED_ALIAS __IA64_UL_CONST(0x0000000110010008) |
56 | #define SH2_EVENT_OCCURRED 0x0000000010010000 | 56 | #define SH2_EVENT_OCCURRED __IA64_UL_CONST(0x0000000010010000) |
57 | #define SH2_EVENT_OCCURRED_ALIAS 0x0000000010010008 | 57 | #define SH2_EVENT_OCCURRED_ALIAS __IA64_UL_CONST(0x0000000010010008) |
58 | 58 | ||
59 | /* ==================================================================== */ | 59 | /* ==================================================================== */ |
60 | /* Register "SH_PI_CAM_CONTROL" */ | 60 | /* Register "SH_PI_CAM_CONTROL" */ |
61 | /* CRB CAM MMR Access Control */ | 61 | /* CRB CAM MMR Access Control */ |
62 | /* ==================================================================== */ | 62 | /* ==================================================================== */ |
63 | #define SH1_PI_CAM_CONTROL 0x0000000120050300 | 63 | #define SH1_PI_CAM_CONTROL __IA64_UL_CONST(0x0000000120050300) |
64 | 64 | ||
65 | /* ==================================================================== */ | 65 | /* ==================================================================== */ |
66 | /* Register "SH_SHUB_ID" */ | 66 | /* Register "SH_SHUB_ID" */ |
67 | /* SHub ID Number */ | 67 | /* SHub ID Number */ |
68 | /* ==================================================================== */ | 68 | /* ==================================================================== */ |
69 | #define SH1_SHUB_ID 0x0000000110060580 | 69 | #define SH1_SHUB_ID __IA64_UL_CONST(0x0000000110060580) |
70 | #define SH1_SHUB_ID_REVISION_SHFT 28 | 70 | #define SH1_SHUB_ID_REVISION_SHFT 28 |
71 | #define SH1_SHUB_ID_REVISION_MASK 0x00000000f0000000 | 71 | #define SH1_SHUB_ID_REVISION_MASK __IA64_UL_CONST(0x00000000f0000000) |
72 | 72 | ||
73 | /* ==================================================================== */ | 73 | /* ==================================================================== */ |
74 | /* Register "SH_RTC" */ | 74 | /* Register "SH_RTC" */ |
75 | /* Real-time Clock */ | 75 | /* Real-time Clock */ |
76 | /* ==================================================================== */ | 76 | /* ==================================================================== */ |
77 | #define SH1_RTC 0x00000001101c0000 | 77 | #define SH1_RTC __IA64_UL_CONST(0x00000001101c0000) |
78 | #define SH2_RTC 0x00000002101c0000 | 78 | #define SH2_RTC __IA64_UL_CONST(0x00000002101c0000) |
79 | #define SH_RTC_MASK 0x007fffffffffffff | 79 | #define SH_RTC_MASK __IA64_UL_CONST(0x007fffffffffffff) |
80 | 80 | ||
81 | /* ==================================================================== */ | 81 | /* ==================================================================== */ |
82 | /* Register "SH_PIO_WRITE_STATUS_0|1" */ | 82 | /* Register "SH_PIO_WRITE_STATUS_0|1" */ |
83 | /* PIO Write Status for CPU 0 & 1 */ | 83 | /* PIO Write Status for CPU 0 & 1 */ |
84 | /* ==================================================================== */ | 84 | /* ==================================================================== */ |
85 | #define SH1_PIO_WRITE_STATUS_0 0x0000000120070200 | 85 | #define SH1_PIO_WRITE_STATUS_0 __IA64_UL_CONST(0x0000000120070200) |
86 | #define SH1_PIO_WRITE_STATUS_1 0x0000000120070280 | 86 | #define SH1_PIO_WRITE_STATUS_1 __IA64_UL_CONST(0x0000000120070280) |
87 | #define SH2_PIO_WRITE_STATUS_0 0x0000000020070200 | 87 | #define SH2_PIO_WRITE_STATUS_0 __IA64_UL_CONST(0x0000000020070200) |
88 | #define SH2_PIO_WRITE_STATUS_1 0x0000000020070280 | 88 | #define SH2_PIO_WRITE_STATUS_1 __IA64_UL_CONST(0x0000000020070280) |
89 | #define SH2_PIO_WRITE_STATUS_2 0x0000000020070300 | 89 | #define SH2_PIO_WRITE_STATUS_2 __IA64_UL_CONST(0x0000000020070300) |
90 | #define SH2_PIO_WRITE_STATUS_3 0x0000000020070380 | 90 | #define SH2_PIO_WRITE_STATUS_3 __IA64_UL_CONST(0x0000000020070380) |
91 | 91 | ||
92 | /* SH_PIO_WRITE_STATUS_0_WRITE_DEADLOCK */ | 92 | /* SH_PIO_WRITE_STATUS_0_WRITE_DEADLOCK */ |
93 | /* Description: Deadlock response detected */ | 93 | /* Description: Deadlock response detected */ |
94 | #define SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_SHFT 1 | 94 | #define SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_SHFT 1 |
95 | #define SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_MASK 0x0000000000000002 | 95 | #define SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_MASK \ |
96 | __IA64_UL_CONST(0x0000000000000002) | ||
96 | 97 | ||
97 | /* SH_PIO_WRITE_STATUS_0_PENDING_WRITE_COUNT */ | 98 | /* SH_PIO_WRITE_STATUS_0_PENDING_WRITE_COUNT */ |
98 | /* Description: Count of currently pending PIO writes */ | 99 | /* Description: Count of currently pending PIO writes */ |
99 | #define SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_SHFT 56 | 100 | #define SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_SHFT 56 |
100 | #define SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_MASK 0x3f00000000000000 | 101 | #define SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_MASK \ |
102 | __IA64_UL_CONST(0x3f00000000000000) | ||
101 | 103 | ||
102 | /* ==================================================================== */ | 104 | /* ==================================================================== */ |
103 | /* Register "SH_PIO_WRITE_STATUS_0_ALIAS" */ | 105 | /* Register "SH_PIO_WRITE_STATUS_0_ALIAS" */ |
104 | /* ==================================================================== */ | 106 | /* ==================================================================== */ |
105 | #define SH1_PIO_WRITE_STATUS_0_ALIAS 0x0000000120070208 | 107 | #define SH1_PIO_WRITE_STATUS_0_ALIAS __IA64_UL_CONST(0x0000000120070208) |
106 | #define SH2_PIO_WRITE_STATUS_0_ALIAS 0x0000000020070208 | 108 | #define SH2_PIO_WRITE_STATUS_0_ALIAS __IA64_UL_CONST(0x0000000020070208) |
107 | 109 | ||
108 | /* ==================================================================== */ | 110 | /* ==================================================================== */ |
109 | /* Register "SH_EVENT_OCCURRED" */ | 111 | /* Register "SH_EVENT_OCCURRED" */ |
@@ -111,33 +113,33 @@ | |||
111 | /* ==================================================================== */ | 113 | /* ==================================================================== */ |
112 | /* SH_EVENT_OCCURRED_UART_INT */ | 114 | /* SH_EVENT_OCCURRED_UART_INT */ |
113 | /* Description: Pending Junk Bus UART Interrupt */ | 115 | /* Description: Pending Junk Bus UART Interrupt */ |
114 | #define SH_EVENT_OCCURRED_UART_INT_SHFT 20 | 116 | #define SH_EVENT_OCCURRED_UART_INT_SHFT 20 |
115 | #define SH_EVENT_OCCURRED_UART_INT_MASK 0x0000000000100000 | 117 | #define SH_EVENT_OCCURRED_UART_INT_MASK __IA64_UL_CONST(0x0000000000100000) |
116 | 118 | ||
117 | /* SH_EVENT_OCCURRED_IPI_INT */ | 119 | /* SH_EVENT_OCCURRED_IPI_INT */ |
118 | /* Description: Pending IPI Interrupt */ | 120 | /* Description: Pending IPI Interrupt */ |
119 | #define SH_EVENT_OCCURRED_IPI_INT_SHFT 28 | 121 | #define SH_EVENT_OCCURRED_IPI_INT_SHFT 28 |
120 | #define SH_EVENT_OCCURRED_IPI_INT_MASK 0x0000000010000000 | 122 | #define SH_EVENT_OCCURRED_IPI_INT_MASK __IA64_UL_CONST(0x0000000010000000) |
121 | 123 | ||
122 | /* SH_EVENT_OCCURRED_II_INT0 */ | 124 | /* SH_EVENT_OCCURRED_II_INT0 */ |
123 | /* Description: Pending II 0 Interrupt */ | 125 | /* Description: Pending II 0 Interrupt */ |
124 | #define SH_EVENT_OCCURRED_II_INT0_SHFT 29 | 126 | #define SH_EVENT_OCCURRED_II_INT0_SHFT 29 |
125 | #define SH_EVENT_OCCURRED_II_INT0_MASK 0x0000000020000000 | 127 | #define SH_EVENT_OCCURRED_II_INT0_MASK __IA64_UL_CONST(0x0000000020000000) |
126 | 128 | ||
127 | /* SH_EVENT_OCCURRED_II_INT1 */ | 129 | /* SH_EVENT_OCCURRED_II_INT1 */ |
128 | /* Description: Pending II 1 Interrupt */ | 130 | /* Description: Pending II 1 Interrupt */ |
129 | #define SH_EVENT_OCCURRED_II_INT1_SHFT 30 | 131 | #define SH_EVENT_OCCURRED_II_INT1_SHFT 30 |
130 | #define SH_EVENT_OCCURRED_II_INT1_MASK 0x0000000040000000 | 132 | #define SH_EVENT_OCCURRED_II_INT1_MASK __IA64_UL_CONST(0x0000000040000000) |
131 | 133 | ||
132 | /* SH2_EVENT_OCCURRED_EXTIO_INT2 */ | 134 | /* SH2_EVENT_OCCURRED_EXTIO_INT2 */ |
133 | /* Description: Pending SHUB 2 EXT IO INT2 */ | 135 | /* Description: Pending SHUB 2 EXT IO INT2 */ |
134 | #define SH2_EVENT_OCCURRED_EXTIO_INT2_SHFT 33 | 136 | #define SH2_EVENT_OCCURRED_EXTIO_INT2_SHFT 33 |
135 | #define SH2_EVENT_OCCURRED_EXTIO_INT2_MASK 0x0000000200000000 | 137 | #define SH2_EVENT_OCCURRED_EXTIO_INT2_MASK __IA64_UL_CONST(0x0000000200000000) |
136 | 138 | ||
137 | /* SH2_EVENT_OCCURRED_EXTIO_INT3 */ | 139 | /* SH2_EVENT_OCCURRED_EXTIO_INT3 */ |
138 | /* Description: Pending SHUB 2 EXT IO INT3 */ | 140 | /* Description: Pending SHUB 2 EXT IO INT3 */ |
139 | #define SH2_EVENT_OCCURRED_EXTIO_INT3_SHFT 34 | 141 | #define SH2_EVENT_OCCURRED_EXTIO_INT3_SHFT 34 |
140 | #define SH2_EVENT_OCCURRED_EXTIO_INT3_MASK 0x0000000400000000 | 142 | #define SH2_EVENT_OCCURRED_EXTIO_INT3_MASK __IA64_UL_CONST(0x0000000400000000) |
141 | 143 | ||
142 | #define SH_ALL_INT_MASK \ | 144 | #define SH_ALL_INT_MASK \ |
143 | (SH_EVENT_OCCURRED_UART_INT_MASK | SH_EVENT_OCCURRED_IPI_INT_MASK | \ | 145 | (SH_EVENT_OCCURRED_UART_INT_MASK | SH_EVENT_OCCURRED_IPI_INT_MASK | \ |
@@ -149,310 +151,310 @@ | |||
149 | /* ==================================================================== */ | 151 | /* ==================================================================== */ |
150 | /* LEDS */ | 152 | /* LEDS */ |
151 | /* ==================================================================== */ | 153 | /* ==================================================================== */ |
152 | #define SH1_REAL_JUNK_BUS_LED0 0x7fed00000UL | 154 | #define SH1_REAL_JUNK_BUS_LED0 0x7fed00000UL |
153 | #define SH1_REAL_JUNK_BUS_LED1 0x7fed10000UL | 155 | #define SH1_REAL_JUNK_BUS_LED1 0x7fed10000UL |
154 | #define SH1_REAL_JUNK_BUS_LED2 0x7fed20000UL | 156 | #define SH1_REAL_JUNK_BUS_LED2 0x7fed20000UL |
155 | #define SH1_REAL_JUNK_BUS_LED3 0x7fed30000UL | 157 | #define SH1_REAL_JUNK_BUS_LED3 0x7fed30000UL |
156 | 158 | ||
157 | #define SH2_REAL_JUNK_BUS_LED0 0xf0000000UL | 159 | #define SH2_REAL_JUNK_BUS_LED0 0xf0000000UL |
158 | #define SH2_REAL_JUNK_BUS_LED1 0xf0010000UL | 160 | #define SH2_REAL_JUNK_BUS_LED1 0xf0010000UL |
159 | #define SH2_REAL_JUNK_BUS_LED2 0xf0020000UL | 161 | #define SH2_REAL_JUNK_BUS_LED2 0xf0020000UL |
160 | #define SH2_REAL_JUNK_BUS_LED3 0xf0030000UL | 162 | #define SH2_REAL_JUNK_BUS_LED3 0xf0030000UL |
161 | 163 | ||
162 | /* ==================================================================== */ | 164 | /* ==================================================================== */ |
163 | /* Register "SH1_PTC_0" */ | 165 | /* Register "SH1_PTC_0" */ |
164 | /* Puge Translation Cache Message Configuration Information */ | 166 | /* Puge Translation Cache Message Configuration Information */ |
165 | /* ==================================================================== */ | 167 | /* ==================================================================== */ |
166 | #define SH1_PTC_0 0x00000001101a0000 | 168 | #define SH1_PTC_0 __IA64_UL_CONST(0x00000001101a0000) |
167 | 169 | ||
168 | /* SH1_PTC_0_A */ | 170 | /* SH1_PTC_0_A */ |
169 | /* Description: Type */ | 171 | /* Description: Type */ |
170 | #define SH1_PTC_0_A_SHFT 0 | 172 | #define SH1_PTC_0_A_SHFT 0 |
171 | 173 | ||
172 | /* SH1_PTC_0_PS */ | 174 | /* SH1_PTC_0_PS */ |
173 | /* Description: Page Size */ | 175 | /* Description: Page Size */ |
174 | #define SH1_PTC_0_PS_SHFT 2 | 176 | #define SH1_PTC_0_PS_SHFT 2 |
175 | 177 | ||
176 | /* SH1_PTC_0_RID */ | 178 | /* SH1_PTC_0_RID */ |
177 | /* Description: Region ID */ | 179 | /* Description: Region ID */ |
178 | #define SH1_PTC_0_RID_SHFT 8 | 180 | #define SH1_PTC_0_RID_SHFT 8 |
179 | 181 | ||
180 | /* SH1_PTC_0_START */ | 182 | /* SH1_PTC_0_START */ |
181 | /* Description: Start */ | 183 | /* Description: Start */ |
182 | #define SH1_PTC_0_START_SHFT 63 | 184 | #define SH1_PTC_0_START_SHFT 63 |
183 | 185 | ||
184 | /* ==================================================================== */ | 186 | /* ==================================================================== */ |
185 | /* Register "SH1_PTC_1" */ | 187 | /* Register "SH1_PTC_1" */ |
186 | /* Puge Translation Cache Message Configuration Information */ | 188 | /* Puge Translation Cache Message Configuration Information */ |
187 | /* ==================================================================== */ | 189 | /* ==================================================================== */ |
188 | #define SH1_PTC_1 0x00000001101a0080 | 190 | #define SH1_PTC_1 __IA64_UL_CONST(0x00000001101a0080) |
189 | 191 | ||
190 | /* SH1_PTC_1_START */ | 192 | /* SH1_PTC_1_START */ |
191 | /* Description: PTC_1 Start */ | 193 | /* Description: PTC_1 Start */ |
192 | #define SH1_PTC_1_START_SHFT 63 | 194 | #define SH1_PTC_1_START_SHFT 63 |
193 | |||
194 | 195 | ||
195 | /* ==================================================================== */ | 196 | /* ==================================================================== */ |
196 | /* Register "SH2_PTC" */ | 197 | /* Register "SH2_PTC" */ |
197 | /* Puge Translation Cache Message Configuration Information */ | 198 | /* Puge Translation Cache Message Configuration Information */ |
198 | /* ==================================================================== */ | 199 | /* ==================================================================== */ |
199 | #define SH2_PTC 0x0000000170000000 | 200 | #define SH2_PTC __IA64_UL_CONST(0x0000000170000000) |
200 | 201 | ||
201 | /* SH2_PTC_A */ | 202 | /* SH2_PTC_A */ |
202 | /* Description: Type */ | 203 | /* Description: Type */ |
203 | #define SH2_PTC_A_SHFT 0 | 204 | #define SH2_PTC_A_SHFT 0 |
204 | 205 | ||
205 | /* SH2_PTC_PS */ | 206 | /* SH2_PTC_PS */ |
206 | /* Description: Page Size */ | 207 | /* Description: Page Size */ |
207 | #define SH2_PTC_PS_SHFT 2 | 208 | #define SH2_PTC_PS_SHFT 2 |
208 | 209 | ||
209 | /* SH2_PTC_RID */ | 210 | /* SH2_PTC_RID */ |
210 | /* Description: Region ID */ | 211 | /* Description: Region ID */ |
211 | #define SH2_PTC_RID_SHFT 4 | 212 | #define SH2_PTC_RID_SHFT 4 |
212 | 213 | ||
213 | /* SH2_PTC_START */ | 214 | /* SH2_PTC_START */ |
214 | /* Description: Start */ | 215 | /* Description: Start */ |
215 | #define SH2_PTC_START_SHFT 63 | 216 | #define SH2_PTC_START_SHFT 63 |
216 | 217 | ||
217 | /* SH2_PTC_ADDR_RID */ | 218 | /* SH2_PTC_ADDR_RID */ |
218 | /* Description: Region ID */ | 219 | /* Description: Region ID */ |
219 | #define SH2_PTC_ADDR_SHFT 4 | 220 | #define SH2_PTC_ADDR_SHFT 4 |
220 | #define SH2_PTC_ADDR_MASK 0x1ffffffffffff000 | 221 | #define SH2_PTC_ADDR_MASK __IA64_UL_CONST(0x1ffffffffffff000) |
221 | 222 | ||
222 | /* ==================================================================== */ | 223 | /* ==================================================================== */ |
223 | /* Register "SH_RTC1_INT_CONFIG" */ | 224 | /* Register "SH_RTC1_INT_CONFIG" */ |
224 | /* SHub RTC 1 Interrupt Config Registers */ | 225 | /* SHub RTC 1 Interrupt Config Registers */ |
225 | /* ==================================================================== */ | 226 | /* ==================================================================== */ |
226 | 227 | ||
227 | #define SH1_RTC1_INT_CONFIG 0x0000000110001480 | 228 | #define SH1_RTC1_INT_CONFIG __IA64_UL_CONST(0x0000000110001480) |
228 | #define SH2_RTC1_INT_CONFIG 0x0000000010001480 | 229 | #define SH2_RTC1_INT_CONFIG __IA64_UL_CONST(0x0000000010001480) |
229 | #define SH_RTC1_INT_CONFIG_MASK 0x0ff3ffffffefffff | 230 | #define SH_RTC1_INT_CONFIG_MASK __IA64_UL_CONST(0x0ff3ffffffefffff) |
230 | #define SH_RTC1_INT_CONFIG_INIT 0x0000000000000000 | 231 | #define SH_RTC1_INT_CONFIG_INIT __IA64_UL_CONST(0x0000000000000000) |
231 | 232 | ||
232 | /* SH_RTC1_INT_CONFIG_TYPE */ | 233 | /* SH_RTC1_INT_CONFIG_TYPE */ |
233 | /* Description: Type of Interrupt: 0=INT, 2=PMI, 4=NMI, 5=INIT */ | 234 | /* Description: Type of Interrupt: 0=INT, 2=PMI, 4=NMI, 5=INIT */ |
234 | #define SH_RTC1_INT_CONFIG_TYPE_SHFT 0 | 235 | #define SH_RTC1_INT_CONFIG_TYPE_SHFT 0 |
235 | #define SH_RTC1_INT_CONFIG_TYPE_MASK 0x0000000000000007 | 236 | #define SH_RTC1_INT_CONFIG_TYPE_MASK __IA64_UL_CONST(0x0000000000000007) |
236 | 237 | ||
237 | /* SH_RTC1_INT_CONFIG_AGT */ | 238 | /* SH_RTC1_INT_CONFIG_AGT */ |
238 | /* Description: Agent, must be 0 for SHub */ | 239 | /* Description: Agent, must be 0 for SHub */ |
239 | #define SH_RTC1_INT_CONFIG_AGT_SHFT 3 | 240 | #define SH_RTC1_INT_CONFIG_AGT_SHFT 3 |
240 | #define SH_RTC1_INT_CONFIG_AGT_MASK 0x0000000000000008 | 241 | #define SH_RTC1_INT_CONFIG_AGT_MASK __IA64_UL_CONST(0x0000000000000008) |
241 | 242 | ||
242 | /* SH_RTC1_INT_CONFIG_PID */ | 243 | /* SH_RTC1_INT_CONFIG_PID */ |
243 | /* Description: Processor ID, same setting as on targeted McKinley */ | 244 | /* Description: Processor ID, same setting as on targeted McKinley */ |
244 | #define SH_RTC1_INT_CONFIG_PID_SHFT 4 | 245 | #define SH_RTC1_INT_CONFIG_PID_SHFT 4 |
245 | #define SH_RTC1_INT_CONFIG_PID_MASK 0x00000000000ffff0 | 246 | #define SH_RTC1_INT_CONFIG_PID_MASK __IA64_UL_CONST(0x00000000000ffff0) |
246 | 247 | ||
247 | /* SH_RTC1_INT_CONFIG_BASE */ | 248 | /* SH_RTC1_INT_CONFIG_BASE */ |
248 | /* Description: Optional interrupt vector area, 2MB aligned */ | 249 | /* Description: Optional interrupt vector area, 2MB aligned */ |
249 | #define SH_RTC1_INT_CONFIG_BASE_SHFT 21 | 250 | #define SH_RTC1_INT_CONFIG_BASE_SHFT 21 |
250 | #define SH_RTC1_INT_CONFIG_BASE_MASK 0x0003ffffffe00000 | 251 | #define SH_RTC1_INT_CONFIG_BASE_MASK __IA64_UL_CONST(0x0003ffffffe00000) |
251 | 252 | ||
252 | /* SH_RTC1_INT_CONFIG_IDX */ | 253 | /* SH_RTC1_INT_CONFIG_IDX */ |
253 | /* Description: Targeted McKinley interrupt vector */ | 254 | /* Description: Targeted McKinley interrupt vector */ |
254 | #define SH_RTC1_INT_CONFIG_IDX_SHFT 52 | 255 | #define SH_RTC1_INT_CONFIG_IDX_SHFT 52 |
255 | #define SH_RTC1_INT_CONFIG_IDX_MASK 0x0ff0000000000000 | 256 | #define SH_RTC1_INT_CONFIG_IDX_MASK __IA64_UL_CONST(0x0ff0000000000000) |
256 | 257 | ||
257 | /* ==================================================================== */ | 258 | /* ==================================================================== */ |
258 | /* Register "SH_RTC1_INT_ENABLE" */ | 259 | /* Register "SH_RTC1_INT_ENABLE" */ |
259 | /* SHub RTC 1 Interrupt Enable Registers */ | 260 | /* SHub RTC 1 Interrupt Enable Registers */ |
260 | /* ==================================================================== */ | 261 | /* ==================================================================== */ |
261 | 262 | ||
262 | #define SH1_RTC1_INT_ENABLE 0x0000000110001500 | 263 | #define SH1_RTC1_INT_ENABLE __IA64_UL_CONST(0x0000000110001500) |
263 | #define SH2_RTC1_INT_ENABLE 0x0000000010001500 | 264 | #define SH2_RTC1_INT_ENABLE __IA64_UL_CONST(0x0000000010001500) |
264 | #define SH_RTC1_INT_ENABLE_MASK 0x0000000000000001 | 265 | #define SH_RTC1_INT_ENABLE_MASK __IA64_UL_CONST(0x0000000000000001) |
265 | #define SH_RTC1_INT_ENABLE_INIT 0x0000000000000000 | 266 | #define SH_RTC1_INT_ENABLE_INIT __IA64_UL_CONST(0x0000000000000000) |
266 | 267 | ||
267 | /* SH_RTC1_INT_ENABLE_RTC1_ENABLE */ | 268 | /* SH_RTC1_INT_ENABLE_RTC1_ENABLE */ |
268 | /* Description: Enable RTC 1 Interrupt */ | 269 | /* Description: Enable RTC 1 Interrupt */ |
269 | #define SH_RTC1_INT_ENABLE_RTC1_ENABLE_SHFT 0 | 270 | #define SH_RTC1_INT_ENABLE_RTC1_ENABLE_SHFT 0 |
270 | #define SH_RTC1_INT_ENABLE_RTC1_ENABLE_MASK 0x0000000000000001 | 271 | #define SH_RTC1_INT_ENABLE_RTC1_ENABLE_MASK \ |
272 | __IA64_UL_CONST(0x0000000000000001) | ||
271 | 273 | ||
272 | /* ==================================================================== */ | 274 | /* ==================================================================== */ |
273 | /* Register "SH_RTC2_INT_CONFIG" */ | 275 | /* Register "SH_RTC2_INT_CONFIG" */ |
274 | /* SHub RTC 2 Interrupt Config Registers */ | 276 | /* SHub RTC 2 Interrupt Config Registers */ |
275 | /* ==================================================================== */ | 277 | /* ==================================================================== */ |
276 | 278 | ||
277 | #define SH1_RTC2_INT_CONFIG 0x0000000110001580 | 279 | #define SH1_RTC2_INT_CONFIG __IA64_UL_CONST(0x0000000110001580) |
278 | #define SH2_RTC2_INT_CONFIG 0x0000000010001580 | 280 | #define SH2_RTC2_INT_CONFIG __IA64_UL_CONST(0x0000000010001580) |
279 | #define SH_RTC2_INT_CONFIG_MASK 0x0ff3ffffffefffff | 281 | #define SH_RTC2_INT_CONFIG_MASK __IA64_UL_CONST(0x0ff3ffffffefffff) |
280 | #define SH_RTC2_INT_CONFIG_INIT 0x0000000000000000 | 282 | #define SH_RTC2_INT_CONFIG_INIT __IA64_UL_CONST(0x0000000000000000) |
281 | 283 | ||
282 | /* SH_RTC2_INT_CONFIG_TYPE */ | 284 | /* SH_RTC2_INT_CONFIG_TYPE */ |
283 | /* Description: Type of Interrupt: 0=INT, 2=PMI, 4=NMI, 5=INIT */ | 285 | /* Description: Type of Interrupt: 0=INT, 2=PMI, 4=NMI, 5=INIT */ |
284 | #define SH_RTC2_INT_CONFIG_TYPE_SHFT 0 | 286 | #define SH_RTC2_INT_CONFIG_TYPE_SHFT 0 |
285 | #define SH_RTC2_INT_CONFIG_TYPE_MASK 0x0000000000000007 | 287 | #define SH_RTC2_INT_CONFIG_TYPE_MASK __IA64_UL_CONST(0x0000000000000007) |
286 | 288 | ||
287 | /* SH_RTC2_INT_CONFIG_AGT */ | 289 | /* SH_RTC2_INT_CONFIG_AGT */ |
288 | /* Description: Agent, must be 0 for SHub */ | 290 | /* Description: Agent, must be 0 for SHub */ |
289 | #define SH_RTC2_INT_CONFIG_AGT_SHFT 3 | 291 | #define SH_RTC2_INT_CONFIG_AGT_SHFT 3 |
290 | #define SH_RTC2_INT_CONFIG_AGT_MASK 0x0000000000000008 | 292 | #define SH_RTC2_INT_CONFIG_AGT_MASK __IA64_UL_CONST(0x0000000000000008) |
291 | 293 | ||
292 | /* SH_RTC2_INT_CONFIG_PID */ | 294 | /* SH_RTC2_INT_CONFIG_PID */ |
293 | /* Description: Processor ID, same setting as on targeted McKinley */ | 295 | /* Description: Processor ID, same setting as on targeted McKinley */ |
294 | #define SH_RTC2_INT_CONFIG_PID_SHFT 4 | 296 | #define SH_RTC2_INT_CONFIG_PID_SHFT 4 |
295 | #define SH_RTC2_INT_CONFIG_PID_MASK 0x00000000000ffff0 | 297 | #define SH_RTC2_INT_CONFIG_PID_MASK __IA64_UL_CONST(0x00000000000ffff0) |
296 | 298 | ||
297 | /* SH_RTC2_INT_CONFIG_BASE */ | 299 | /* SH_RTC2_INT_CONFIG_BASE */ |
298 | /* Description: Optional interrupt vector area, 2MB aligned */ | 300 | /* Description: Optional interrupt vector area, 2MB aligned */ |
299 | #define SH_RTC2_INT_CONFIG_BASE_SHFT 21 | 301 | #define SH_RTC2_INT_CONFIG_BASE_SHFT 21 |
300 | #define SH_RTC2_INT_CONFIG_BASE_MASK 0x0003ffffffe00000 | 302 | #define SH_RTC2_INT_CONFIG_BASE_MASK __IA64_UL_CONST(0x0003ffffffe00000) |
301 | 303 | ||
302 | /* SH_RTC2_INT_CONFIG_IDX */ | 304 | /* SH_RTC2_INT_CONFIG_IDX */ |
303 | /* Description: Targeted McKinley interrupt vector */ | 305 | /* Description: Targeted McKinley interrupt vector */ |
304 | #define SH_RTC2_INT_CONFIG_IDX_SHFT 52 | 306 | #define SH_RTC2_INT_CONFIG_IDX_SHFT 52 |
305 | #define SH_RTC2_INT_CONFIG_IDX_MASK 0x0ff0000000000000 | 307 | #define SH_RTC2_INT_CONFIG_IDX_MASK __IA64_UL_CONST(0x0ff0000000000000) |
306 | 308 | ||
307 | /* ==================================================================== */ | 309 | /* ==================================================================== */ |
308 | /* Register "SH_RTC2_INT_ENABLE" */ | 310 | /* Register "SH_RTC2_INT_ENABLE" */ |
309 | /* SHub RTC 2 Interrupt Enable Registers */ | 311 | /* SHub RTC 2 Interrupt Enable Registers */ |
310 | /* ==================================================================== */ | 312 | /* ==================================================================== */ |
311 | 313 | ||
312 | #define SH1_RTC2_INT_ENABLE 0x0000000110001600 | 314 | #define SH1_RTC2_INT_ENABLE __IA64_UL_CONST(0x0000000110001600) |
313 | #define SH2_RTC2_INT_ENABLE 0x0000000010001600 | 315 | #define SH2_RTC2_INT_ENABLE __IA64_UL_CONST(0x0000000010001600) |
314 | #define SH_RTC2_INT_ENABLE_MASK 0x0000000000000001 | 316 | #define SH_RTC2_INT_ENABLE_MASK __IA64_UL_CONST(0x0000000000000001) |
315 | #define SH_RTC2_INT_ENABLE_INIT 0x0000000000000000 | 317 | #define SH_RTC2_INT_ENABLE_INIT __IA64_UL_CONST(0x0000000000000000) |
316 | 318 | ||
317 | /* SH_RTC2_INT_ENABLE_RTC2_ENABLE */ | 319 | /* SH_RTC2_INT_ENABLE_RTC2_ENABLE */ |
318 | /* Description: Enable RTC 2 Interrupt */ | 320 | /* Description: Enable RTC 2 Interrupt */ |
319 | #define SH_RTC2_INT_ENABLE_RTC2_ENABLE_SHFT 0 | 321 | #define SH_RTC2_INT_ENABLE_RTC2_ENABLE_SHFT 0 |
320 | #define SH_RTC2_INT_ENABLE_RTC2_ENABLE_MASK 0x0000000000000001 | 322 | #define SH_RTC2_INT_ENABLE_RTC2_ENABLE_MASK \ |
323 | __IA64_UL_CONST(0x0000000000000001) | ||
321 | 324 | ||
322 | /* ==================================================================== */ | 325 | /* ==================================================================== */ |
323 | /* Register "SH_RTC3_INT_CONFIG" */ | 326 | /* Register "SH_RTC3_INT_CONFIG" */ |
324 | /* SHub RTC 3 Interrupt Config Registers */ | 327 | /* SHub RTC 3 Interrupt Config Registers */ |
325 | /* ==================================================================== */ | 328 | /* ==================================================================== */ |
326 | 329 | ||
327 | #define SH1_RTC3_INT_CONFIG 0x0000000110001680 | 330 | #define SH1_RTC3_INT_CONFIG __IA64_UL_CONST(0x0000000110001680) |
328 | #define SH2_RTC3_INT_CONFIG 0x0000000010001680 | 331 | #define SH2_RTC3_INT_CONFIG __IA64_UL_CONST(0x0000000010001680) |
329 | #define SH_RTC3_INT_CONFIG_MASK 0x0ff3ffffffefffff | 332 | #define SH_RTC3_INT_CONFIG_MASK __IA64_UL_CONST(0x0ff3ffffffefffff) |
330 | #define SH_RTC3_INT_CONFIG_INIT 0x0000000000000000 | 333 | #define SH_RTC3_INT_CONFIG_INIT __IA64_UL_CONST(0x0000000000000000) |
331 | 334 | ||
332 | /* SH_RTC3_INT_CONFIG_TYPE */ | 335 | /* SH_RTC3_INT_CONFIG_TYPE */ |
333 | /* Description: Type of Interrupt: 0=INT, 2=PMI, 4=NMI, 5=INIT */ | 336 | /* Description: Type of Interrupt: 0=INT, 2=PMI, 4=NMI, 5=INIT */ |
334 | #define SH_RTC3_INT_CONFIG_TYPE_SHFT 0 | 337 | #define SH_RTC3_INT_CONFIG_TYPE_SHFT 0 |
335 | #define SH_RTC3_INT_CONFIG_TYPE_MASK 0x0000000000000007 | 338 | #define SH_RTC3_INT_CONFIG_TYPE_MASK __IA64_UL_CONST(0x0000000000000007) |
336 | 339 | ||
337 | /* SH_RTC3_INT_CONFIG_AGT */ | 340 | /* SH_RTC3_INT_CONFIG_AGT */ |
338 | /* Description: Agent, must be 0 for SHub */ | 341 | /* Description: Agent, must be 0 for SHub */ |
339 | #define SH_RTC3_INT_CONFIG_AGT_SHFT 3 | 342 | #define SH_RTC3_INT_CONFIG_AGT_SHFT 3 |
340 | #define SH_RTC3_INT_CONFIG_AGT_MASK 0x0000000000000008 | 343 | #define SH_RTC3_INT_CONFIG_AGT_MASK __IA64_UL_CONST(0x0000000000000008) |
341 | 344 | ||
342 | /* SH_RTC3_INT_CONFIG_PID */ | 345 | /* SH_RTC3_INT_CONFIG_PID */ |
343 | /* Description: Processor ID, same setting as on targeted McKinley */ | 346 | /* Description: Processor ID, same setting as on targeted McKinley */ |
344 | #define SH_RTC3_INT_CONFIG_PID_SHFT 4 | 347 | #define SH_RTC3_INT_CONFIG_PID_SHFT 4 |
345 | #define SH_RTC3_INT_CONFIG_PID_MASK 0x00000000000ffff0 | 348 | #define SH_RTC3_INT_CONFIG_PID_MASK __IA64_UL_CONST(0x00000000000ffff0) |
346 | 349 | ||
347 | /* SH_RTC3_INT_CONFIG_BASE */ | 350 | /* SH_RTC3_INT_CONFIG_BASE */ |
348 | /* Description: Optional interrupt vector area, 2MB aligned */ | 351 | /* Description: Optional interrupt vector area, 2MB aligned */ |
349 | #define SH_RTC3_INT_CONFIG_BASE_SHFT 21 | 352 | #define SH_RTC3_INT_CONFIG_BASE_SHFT 21 |
350 | #define SH_RTC3_INT_CONFIG_BASE_MASK 0x0003ffffffe00000 | 353 | #define SH_RTC3_INT_CONFIG_BASE_MASK __IA64_UL_CONST(0x0003ffffffe00000) |
351 | 354 | ||
352 | /* SH_RTC3_INT_CONFIG_IDX */ | 355 | /* SH_RTC3_INT_CONFIG_IDX */ |
353 | /* Description: Targeted McKinley interrupt vector */ | 356 | /* Description: Targeted McKinley interrupt vector */ |
354 | #define SH_RTC3_INT_CONFIG_IDX_SHFT 52 | 357 | #define SH_RTC3_INT_CONFIG_IDX_SHFT 52 |
355 | #define SH_RTC3_INT_CONFIG_IDX_MASK 0x0ff0000000000000 | 358 | #define SH_RTC3_INT_CONFIG_IDX_MASK __IA64_UL_CONST(0x0ff0000000000000) |
356 | 359 | ||
357 | /* ==================================================================== */ | 360 | /* ==================================================================== */ |
358 | /* Register "SH_RTC3_INT_ENABLE" */ | 361 | /* Register "SH_RTC3_INT_ENABLE" */ |
359 | /* SHub RTC 3 Interrupt Enable Registers */ | 362 | /* SHub RTC 3 Interrupt Enable Registers */ |
360 | /* ==================================================================== */ | 363 | /* ==================================================================== */ |
361 | 364 | ||
362 | #define SH1_RTC3_INT_ENABLE 0x0000000110001700 | 365 | #define SH1_RTC3_INT_ENABLE __IA64_UL_CONST(0x0000000110001700) |
363 | #define SH2_RTC3_INT_ENABLE 0x0000000010001700 | 366 | #define SH2_RTC3_INT_ENABLE __IA64_UL_CONST(0x0000000010001700) |
364 | #define SH_RTC3_INT_ENABLE_MASK 0x0000000000000001 | 367 | #define SH_RTC3_INT_ENABLE_MASK __IA64_UL_CONST(0x0000000000000001) |
365 | #define SH_RTC3_INT_ENABLE_INIT 0x0000000000000000 | 368 | #define SH_RTC3_INT_ENABLE_INIT __IA64_UL_CONST(0x0000000000000000) |
366 | 369 | ||
367 | /* SH_RTC3_INT_ENABLE_RTC3_ENABLE */ | 370 | /* SH_RTC3_INT_ENABLE_RTC3_ENABLE */ |
368 | /* Description: Enable RTC 3 Interrupt */ | 371 | /* Description: Enable RTC 3 Interrupt */ |
369 | #define SH_RTC3_INT_ENABLE_RTC3_ENABLE_SHFT 0 | 372 | #define SH_RTC3_INT_ENABLE_RTC3_ENABLE_SHFT 0 |
370 | #define SH_RTC3_INT_ENABLE_RTC3_ENABLE_MASK 0x0000000000000001 | 373 | #define SH_RTC3_INT_ENABLE_RTC3_ENABLE_MASK \ |
374 | __IA64_UL_CONST(0x0000000000000001) | ||
371 | 375 | ||
372 | /* SH_EVENT_OCCURRED_RTC1_INT */ | 376 | /* SH_EVENT_OCCURRED_RTC1_INT */ |
373 | /* Description: Pending RTC 1 Interrupt */ | 377 | /* Description: Pending RTC 1 Interrupt */ |
374 | #define SH_EVENT_OCCURRED_RTC1_INT_SHFT 24 | 378 | #define SH_EVENT_OCCURRED_RTC1_INT_SHFT 24 |
375 | #define SH_EVENT_OCCURRED_RTC1_INT_MASK 0x0000000001000000 | 379 | #define SH_EVENT_OCCURRED_RTC1_INT_MASK __IA64_UL_CONST(0x0000000001000000) |
376 | 380 | ||
377 | /* SH_EVENT_OCCURRED_RTC2_INT */ | 381 | /* SH_EVENT_OCCURRED_RTC2_INT */ |
378 | /* Description: Pending RTC 2 Interrupt */ | 382 | /* Description: Pending RTC 2 Interrupt */ |
379 | #define SH_EVENT_OCCURRED_RTC2_INT_SHFT 25 | 383 | #define SH_EVENT_OCCURRED_RTC2_INT_SHFT 25 |
380 | #define SH_EVENT_OCCURRED_RTC2_INT_MASK 0x0000000002000000 | 384 | #define SH_EVENT_OCCURRED_RTC2_INT_MASK __IA64_UL_CONST(0x0000000002000000) |
381 | 385 | ||
382 | /* SH_EVENT_OCCURRED_RTC3_INT */ | 386 | /* SH_EVENT_OCCURRED_RTC3_INT */ |
383 | /* Description: Pending RTC 3 Interrupt */ | 387 | /* Description: Pending RTC 3 Interrupt */ |
384 | #define SH_EVENT_OCCURRED_RTC3_INT_SHFT 26 | 388 | #define SH_EVENT_OCCURRED_RTC3_INT_SHFT 26 |
385 | #define SH_EVENT_OCCURRED_RTC3_INT_MASK 0x0000000004000000 | 389 | #define SH_EVENT_OCCURRED_RTC3_INT_MASK __IA64_UL_CONST(0x0000000004000000) |
386 | 390 | ||
387 | /* ==================================================================== */ | 391 | /* ==================================================================== */ |
388 | /* Register "SH_IPI_ACCESS" */ | 392 | /* Register "SH_IPI_ACCESS" */ |
389 | /* CPU interrupt Access Permission Bits */ | 393 | /* CPU interrupt Access Permission Bits */ |
390 | /* ==================================================================== */ | 394 | /* ==================================================================== */ |
391 | 395 | ||
392 | #define SH1_IPI_ACCESS 0x0000000110060480 | 396 | #define SH1_IPI_ACCESS __IA64_UL_CONST(0x0000000110060480) |
393 | #define SH2_IPI_ACCESS0 0x0000000010060c00 | 397 | #define SH2_IPI_ACCESS0 __IA64_UL_CONST(0x0000000010060c00) |
394 | #define SH2_IPI_ACCESS1 0x0000000010060c80 | 398 | #define SH2_IPI_ACCESS1 __IA64_UL_CONST(0x0000000010060c80) |
395 | #define SH2_IPI_ACCESS2 0x0000000010060d00 | 399 | #define SH2_IPI_ACCESS2 __IA64_UL_CONST(0x0000000010060d00) |
396 | #define SH2_IPI_ACCESS3 0x0000000010060d80 | 400 | #define SH2_IPI_ACCESS3 __IA64_UL_CONST(0x0000000010060d80) |
397 | 401 | ||
398 | /* ==================================================================== */ | 402 | /* ==================================================================== */ |
399 | /* Register "SH_INT_CMPB" */ | 403 | /* Register "SH_INT_CMPB" */ |
400 | /* RTC Compare Value for Processor B */ | 404 | /* RTC Compare Value for Processor B */ |
401 | /* ==================================================================== */ | 405 | /* ==================================================================== */ |
402 | 406 | ||
403 | #define SH1_INT_CMPB 0x00000001101b0080 | 407 | #define SH1_INT_CMPB __IA64_UL_CONST(0x00000001101b0080) |
404 | #define SH2_INT_CMPB 0x00000000101b0080 | 408 | #define SH2_INT_CMPB __IA64_UL_CONST(0x00000000101b0080) |
405 | #define SH_INT_CMPB_MASK 0x007fffffffffffff | 409 | #define SH_INT_CMPB_MASK __IA64_UL_CONST(0x007fffffffffffff) |
406 | #define SH_INT_CMPB_INIT 0x0000000000000000 | 410 | #define SH_INT_CMPB_INIT __IA64_UL_CONST(0x0000000000000000) |
407 | 411 | ||
408 | /* SH_INT_CMPB_REAL_TIME_CMPB */ | 412 | /* SH_INT_CMPB_REAL_TIME_CMPB */ |
409 | /* Description: Real Time Clock Compare */ | 413 | /* Description: Real Time Clock Compare */ |
410 | #define SH_INT_CMPB_REAL_TIME_CMPB_SHFT 0 | 414 | #define SH_INT_CMPB_REAL_TIME_CMPB_SHFT 0 |
411 | #define SH_INT_CMPB_REAL_TIME_CMPB_MASK 0x007fffffffffffff | 415 | #define SH_INT_CMPB_REAL_TIME_CMPB_MASK __IA64_UL_CONST(0x007fffffffffffff) |
412 | 416 | ||
413 | /* ==================================================================== */ | 417 | /* ==================================================================== */ |
414 | /* Register "SH_INT_CMPC" */ | 418 | /* Register "SH_INT_CMPC" */ |
415 | /* RTC Compare Value for Processor C */ | 419 | /* RTC Compare Value for Processor C */ |
416 | /* ==================================================================== */ | 420 | /* ==================================================================== */ |
417 | 421 | ||
418 | #define SH1_INT_CMPC 0x00000001101b0100 | 422 | #define SH1_INT_CMPC __IA64_UL_CONST(0x00000001101b0100) |
419 | #define SH2_INT_CMPC 0x00000000101b0100 | 423 | #define SH2_INT_CMPC __IA64_UL_CONST(0x00000000101b0100) |
420 | #define SH_INT_CMPC_MASK 0x007fffffffffffff | 424 | #define SH_INT_CMPC_MASK __IA64_UL_CONST(0x007fffffffffffff) |
421 | #define SH_INT_CMPC_INIT 0x0000000000000000 | 425 | #define SH_INT_CMPC_INIT __IA64_UL_CONST(0x0000000000000000) |
422 | 426 | ||
423 | /* SH_INT_CMPC_REAL_TIME_CMPC */ | 427 | /* SH_INT_CMPC_REAL_TIME_CMPC */ |
424 | /* Description: Real Time Clock Compare */ | 428 | /* Description: Real Time Clock Compare */ |
425 | #define SH_INT_CMPC_REAL_TIME_CMPC_SHFT 0 | 429 | #define SH_INT_CMPC_REAL_TIME_CMPC_SHFT 0 |
426 | #define SH_INT_CMPC_REAL_TIME_CMPC_MASK 0x007fffffffffffff | 430 | #define SH_INT_CMPC_REAL_TIME_CMPC_MASK __IA64_UL_CONST(0x007fffffffffffff) |
427 | 431 | ||
428 | /* ==================================================================== */ | 432 | /* ==================================================================== */ |
429 | /* Register "SH_INT_CMPD" */ | 433 | /* Register "SH_INT_CMPD" */ |
430 | /* RTC Compare Value for Processor D */ | 434 | /* RTC Compare Value for Processor D */ |
431 | /* ==================================================================== */ | 435 | /* ==================================================================== */ |
432 | 436 | ||
433 | #define SH1_INT_CMPD 0x00000001101b0180 | 437 | #define SH1_INT_CMPD __IA64_UL_CONST(0x00000001101b0180) |
434 | #define SH2_INT_CMPD 0x00000000101b0180 | 438 | #define SH2_INT_CMPD __IA64_UL_CONST(0x00000000101b0180) |
435 | #define SH_INT_CMPD_MASK 0x007fffffffffffff | 439 | #define SH_INT_CMPD_MASK __IA64_UL_CONST(0x007fffffffffffff) |
436 | #define SH_INT_CMPD_INIT 0x0000000000000000 | 440 | #define SH_INT_CMPD_INIT __IA64_UL_CONST(0x0000000000000000) |
437 | 441 | ||
438 | /* SH_INT_CMPD_REAL_TIME_CMPD */ | 442 | /* SH_INT_CMPD_REAL_TIME_CMPD */ |
439 | /* Description: Real Time Clock Compare */ | 443 | /* Description: Real Time Clock Compare */ |
440 | #define SH_INT_CMPD_REAL_TIME_CMPD_SHFT 0 | 444 | #define SH_INT_CMPD_REAL_TIME_CMPD_SHFT 0 |
441 | #define SH_INT_CMPD_REAL_TIME_CMPD_MASK 0x007fffffffffffff | 445 | #define SH_INT_CMPD_REAL_TIME_CMPD_MASK __IA64_UL_CONST(0x007fffffffffffff) |
442 | 446 | ||
443 | /* ==================================================================== */ | 447 | /* ==================================================================== */ |
444 | /* Register "SH_MD_DQLP_MMR_DIR_PRIVEC0" */ | 448 | /* Register "SH_MD_DQLP_MMR_DIR_PRIVEC0" */ |
445 | /* privilege vector for acc=0 */ | 449 | /* privilege vector for acc=0 */ |
446 | /* ==================================================================== */ | 450 | /* ==================================================================== */ |
447 | 451 | #define SH1_MD_DQLP_MMR_DIR_PRIVEC0 __IA64_UL_CONST(0x0000000100030300) | |
448 | #define SH1_MD_DQLP_MMR_DIR_PRIVEC0 0x0000000100030300 | ||
449 | 452 | ||
450 | /* ==================================================================== */ | 453 | /* ==================================================================== */ |
451 | /* Register "SH_MD_DQRP_MMR_DIR_PRIVEC0" */ | 454 | /* Register "SH_MD_DQRP_MMR_DIR_PRIVEC0" */ |
452 | /* privilege vector for acc=0 */ | 455 | /* privilege vector for acc=0 */ |
453 | /* ==================================================================== */ | 456 | /* ==================================================================== */ |
454 | 457 | #define SH1_MD_DQRP_MMR_DIR_PRIVEC0 __IA64_UL_CONST(0x0000000100050300) | |
455 | #define SH1_MD_DQRP_MMR_DIR_PRIVEC0 0x0000000100050300 | ||
456 | 458 | ||
457 | /* ==================================================================== */ | 459 | /* ==================================================================== */ |
458 | /* Some MMRs are functionally identical (or close enough) on both SHUB1 */ | 460 | /* Some MMRs are functionally identical (or close enough) on both SHUB1 */ |
@@ -484,17 +486,17 @@ | |||
484 | /* Engine 0 Control and Status Register */ | 486 | /* Engine 0 Control and Status Register */ |
485 | /* ========================================================================== */ | 487 | /* ========================================================================== */ |
486 | 488 | ||
487 | #define SH2_BT_ENG_CSR_0 0x0000000030040000 | 489 | #define SH2_BT_ENG_CSR_0 __IA64_UL_CONST(0x0000000030040000) |
488 | #define SH2_BT_ENG_SRC_ADDR_0 0x0000000030040080 | 490 | #define SH2_BT_ENG_SRC_ADDR_0 __IA64_UL_CONST(0x0000000030040080) |
489 | #define SH2_BT_ENG_DEST_ADDR_0 0x0000000030040100 | 491 | #define SH2_BT_ENG_DEST_ADDR_0 __IA64_UL_CONST(0x0000000030040100) |
490 | #define SH2_BT_ENG_NOTIF_ADDR_0 0x0000000030040180 | 492 | #define SH2_BT_ENG_NOTIF_ADDR_0 __IA64_UL_CONST(0x0000000030040180) |
491 | 493 | ||
492 | /* ========================================================================== */ | 494 | /* ========================================================================== */ |
493 | /* BTE interfaces 1-3 */ | 495 | /* BTE interfaces 1-3 */ |
494 | /* ========================================================================== */ | 496 | /* ========================================================================== */ |
495 | 497 | ||
496 | #define SH2_BT_ENG_CSR_1 0x0000000030050000 | 498 | #define SH2_BT_ENG_CSR_1 __IA64_UL_CONST(0x0000000030050000) |
497 | #define SH2_BT_ENG_CSR_2 0x0000000030060000 | 499 | #define SH2_BT_ENG_CSR_2 __IA64_UL_CONST(0x0000000030060000) |
498 | #define SH2_BT_ENG_CSR_3 0x0000000030070000 | 500 | #define SH2_BT_ENG_CSR_3 __IA64_UL_CONST(0x0000000030070000) |
499 | 501 | ||
500 | #endif /* _ASM_IA64_SN_SHUB_MMR_H */ | 502 | #endif /* _ASM_IA64_SN_SHUB_MMR_H */ |
diff --git a/include/asm-ia64/sn/simulator.h b/include/asm-ia64/sn/simulator.h index 78eb4f869c8b..cf770e246af5 100644 --- a/include/asm-ia64/sn/simulator.h +++ b/include/asm-ia64/sn/simulator.h | |||
@@ -10,16 +10,17 @@ | |||
10 | 10 | ||
11 | #include <linux/config.h> | 11 | #include <linux/config.h> |
12 | 12 | ||
13 | #ifdef CONFIG_IA64_SGI_SN_SIM | ||
14 | |||
15 | #define SNMAGIC 0xaeeeeeee8badbeefL | 13 | #define SNMAGIC 0xaeeeeeee8badbeefL |
16 | #define IS_RUNNING_ON_SIMULATOR() ({long sn; asm("mov %0=cpuid[%1]" : "=r"(sn) : "r"(2)); sn == SNMAGIC;}) | 14 | #define IS_MEDUSA() ({long sn; asm("mov %0=cpuid[%1]" : "=r"(sn) : "r"(2)); sn == SNMAGIC;}) |
17 | |||
18 | #define SIMULATOR_SLEEP() asm("nop.i 0x8beef") | ||
19 | 15 | ||
16 | #ifdef CONFIG_IA64_SGI_SN_SIM | ||
17 | #define SIMULATOR_SLEEP() asm("nop.i 0x8beef") | ||
18 | #define IS_RUNNING_ON_SIMULATOR() (sn_prom_type) | ||
19 | #define IS_RUNNING_ON_FAKE_PROM() (sn_prom_type == 2) | ||
20 | extern int sn_prom_type; /* 0=hardware, 1=medusa/realprom, 2=medusa/fakeprom */ | ||
20 | #else | 21 | #else |
21 | |||
22 | #define IS_RUNNING_ON_SIMULATOR() (0) | 22 | #define IS_RUNNING_ON_SIMULATOR() (0) |
23 | #define IS_RUNNING_ON_FAKE_PROM() (0) | ||
23 | #define SIMULATOR_SLEEP() | 24 | #define SIMULATOR_SLEEP() |
24 | 25 | ||
25 | #endif | 26 | #endif |
diff --git a/include/asm-ia64/sn/sn2/sn_hwperf.h b/include/asm-ia64/sn/sn2/sn_hwperf.h index b0c4d6dd77ba..df75f4c4aec3 100644 --- a/include/asm-ia64/sn/sn2/sn_hwperf.h +++ b/include/asm-ia64/sn/sn2/sn_hwperf.h | |||
@@ -223,4 +223,6 @@ struct sn_hwperf_ioctl_args { | |||
223 | #define SN_HWPERF_OP_RECONFIGURE 253 | 223 | #define SN_HWPERF_OP_RECONFIGURE 253 |
224 | #define SN_HWPERF_OP_INVAL 254 | 224 | #define SN_HWPERF_OP_INVAL 254 |
225 | 225 | ||
226 | int sn_topology_open(struct inode *inode, struct file *file); | ||
227 | int sn_topology_release(struct inode *inode, struct file *file); | ||
226 | #endif /* SN_HWPERF_H */ | 228 | #endif /* SN_HWPERF_H */ |
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h index eb0395ad0d6a..1455375d2ce4 100644 --- a/include/asm-ia64/sn/sn_sal.h +++ b/include/asm-ia64/sn/sn_sal.h | |||
@@ -132,6 +132,8 @@ | |||
132 | #define SALRET_INVALID_ARG (-2) | 132 | #define SALRET_INVALID_ARG (-2) |
133 | #define SALRET_ERROR (-3) | 133 | #define SALRET_ERROR (-3) |
134 | 134 | ||
135 | #define SN_SAL_FAKE_PROM 0x02009999 | ||
136 | |||
135 | 137 | ||
136 | /** | 138 | /** |
137 | * sn_sal_rev_major - get the major SGI SAL revision number | 139 | * sn_sal_rev_major - get the major SGI SAL revision number |
@@ -1105,4 +1107,12 @@ ia64_sn_bte_recovery(nasid_t nasid) | |||
1105 | return (int) rv.status; | 1107 | return (int) rv.status; |
1106 | } | 1108 | } |
1107 | 1109 | ||
1110 | static inline int | ||
1111 | ia64_sn_is_fake_prom(void) | ||
1112 | { | ||
1113 | struct ia64_sal_retval rv; | ||
1114 | SAL_CALL_NOLOCK(rv, SN_SAL_FAKE_PROM, 0, 0, 0, 0, 0, 0, 0); | ||
1115 | return (rv.status == 0); | ||
1116 | } | ||
1117 | |||
1108 | #endif /* _ASM_IA64_SN_SN_SAL_H */ | 1118 | #endif /* _ASM_IA64_SN_SN_SAL_H */ |
diff --git a/include/asm-ia64/sn/tioca_provider.h b/include/asm-ia64/sn/tioca_provider.h index b6acc22ab239..5ccec608d325 100644 --- a/include/asm-ia64/sn/tioca_provider.h +++ b/include/asm-ia64/sn/tioca_provider.h | |||
@@ -201,6 +201,7 @@ tioca_tlbflush(struct tioca_kernel *tioca_kernel) | |||
201 | } | 201 | } |
202 | 202 | ||
203 | extern uint32_t tioca_gart_found; | 203 | extern uint32_t tioca_gart_found; |
204 | extern struct list_head tioca_list; | ||
204 | extern int tioca_init_provider(void); | 205 | extern int tioca_init_provider(void); |
205 | extern void tioca_fastwrite_enable(struct tioca_kernel *tioca_kern); | 206 | extern void tioca_fastwrite_enable(struct tioca_kernel *tioca_kern); |
206 | #endif /* _ASM_IA64_SN_TIO_CA_AGP_PROVIDER_H */ | 207 | #endif /* _ASM_IA64_SN_TIO_CA_AGP_PROVIDER_H */ |
diff --git a/include/asm-ia64/vga.h b/include/asm-ia64/vga.h index 1f446d6841f6..bc3349ffc505 100644 --- a/include/asm-ia64/vga.h +++ b/include/asm-ia64/vga.h | |||
@@ -14,7 +14,10 @@ | |||
14 | * videoram directly without any black magic. | 14 | * videoram directly without any black magic. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define VGA_MAP_MEM(x) ((unsigned long) ioremap((x), 0)) | 17 | extern unsigned long vga_console_iobase; |
18 | extern unsigned long vga_console_membase; | ||
19 | |||
20 | #define VGA_MAP_MEM(x) ((unsigned long) ioremap(vga_console_membase + (x), 0)) | ||
18 | 21 | ||
19 | #define vga_readb(x) (*(x)) | 22 | #define vga_readb(x) (*(x)) |
20 | #define vga_writeb(x,y) (*(y) = (x)) | 23 | #define vga_writeb(x,y) (*(y) = (x)) |
diff --git a/include/asm-m68k/serial.h b/include/asm-m68k/serial.h index 9f5bcdc105fc..3fe29f8b0194 100644 --- a/include/asm-m68k/serial.h +++ b/include/asm-m68k/serial.h | |||
@@ -26,54 +26,9 @@ | |||
26 | #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF | 26 | #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | #ifdef CONFIG_SERIAL_MANY_PORTS | 29 | #define SERIAL_PORT_DFNS \ |
30 | #define FOURPORT_FLAGS ASYNC_FOURPORT | ||
31 | #define ACCENT_FLAGS 0 | ||
32 | #define BOCA_FLAGS 0 | ||
33 | #endif | ||
34 | |||
35 | #define STD_SERIAL_PORT_DEFNS \ | ||
36 | /* UART CLK PORT IRQ FLAGS */ \ | 30 | /* UART CLK PORT IRQ FLAGS */ \ |
37 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ | 31 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ |
38 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ | 32 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ |
39 | { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ | 33 | { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ |
40 | { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ | 34 | { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ |
41 | |||
42 | |||
43 | #ifdef CONFIG_SERIAL_MANY_PORTS | ||
44 | #define EXTRA_SERIAL_PORT_DEFNS \ | ||
45 | { 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */ \ | ||
46 | { 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS }, /* ttyS5 */ \ | ||
47 | { 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS }, /* ttyS6 */ \ | ||
48 | { 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS }, /* ttyS7 */ \ | ||
49 | { 0, BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS }, /* ttyS8 */ \ | ||
50 | { 0, BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS }, /* ttyS9 */ \ | ||
51 | { 0, BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS }, /* ttyS10 */ \ | ||
52 | { 0, BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS }, /* ttyS11 */ \ | ||
53 | { 0, BASE_BAUD, 0x330, 4, ACCENT_FLAGS }, /* ttyS12 */ \ | ||
54 | { 0, BASE_BAUD, 0x338, 4, ACCENT_FLAGS }, /* ttyS13 */ \ | ||
55 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS14 (spare) */ \ | ||
56 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS15 (spare) */ \ | ||
57 | { 0, BASE_BAUD, 0x100, 12, BOCA_FLAGS }, /* ttyS16 */ \ | ||
58 | { 0, BASE_BAUD, 0x108, 12, BOCA_FLAGS }, /* ttyS17 */ \ | ||
59 | { 0, BASE_BAUD, 0x110, 12, BOCA_FLAGS }, /* ttyS18 */ \ | ||
60 | { 0, BASE_BAUD, 0x118, 12, BOCA_FLAGS }, /* ttyS19 */ \ | ||
61 | { 0, BASE_BAUD, 0x120, 12, BOCA_FLAGS }, /* ttyS20 */ \ | ||
62 | { 0, BASE_BAUD, 0x128, 12, BOCA_FLAGS }, /* ttyS21 */ \ | ||
63 | { 0, BASE_BAUD, 0x130, 12, BOCA_FLAGS }, /* ttyS22 */ \ | ||
64 | { 0, BASE_BAUD, 0x138, 12, BOCA_FLAGS }, /* ttyS23 */ \ | ||
65 | { 0, BASE_BAUD, 0x140, 12, BOCA_FLAGS }, /* ttyS24 */ \ | ||
66 | { 0, BASE_BAUD, 0x148, 12, BOCA_FLAGS }, /* ttyS25 */ \ | ||
67 | { 0, BASE_BAUD, 0x150, 12, BOCA_FLAGS }, /* ttyS26 */ \ | ||
68 | { 0, BASE_BAUD, 0x158, 12, BOCA_FLAGS }, /* ttyS27 */ \ | ||
69 | { 0, BASE_BAUD, 0x160, 12, BOCA_FLAGS }, /* ttyS28 */ \ | ||
70 | { 0, BASE_BAUD, 0x168, 12, BOCA_FLAGS }, /* ttyS29 */ \ | ||
71 | { 0, BASE_BAUD, 0x170, 12, BOCA_FLAGS }, /* ttyS30 */ \ | ||
72 | { 0, BASE_BAUD, 0x178, 12, BOCA_FLAGS }, /* ttyS31 */ | ||
73 | #else | ||
74 | #define EXTRA_SERIAL_PORT_DEFNS | ||
75 | #endif | ||
76 | |||
77 | #define SERIAL_PORT_DFNS \ | ||
78 | STD_SERIAL_PORT_DEFNS \ | ||
79 | EXTRA_SERIAL_PORT_DEFNS | ||
diff --git a/include/asm-mips/pci.h b/include/asm-mips/pci.h index c9c576b48556..2d323b6e147d 100644 --- a/include/asm-mips/pci.h +++ b/include/asm-mips/pci.h | |||
@@ -130,6 +130,16 @@ extern void pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, | |||
130 | extern void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, | 130 | extern void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, |
131 | dma64_addr_t dma_addr, size_t len, int direction); | 131 | dma64_addr_t dma_addr, size_t len, int direction); |
132 | 132 | ||
133 | #ifdef CONFIG_PCI | ||
134 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
135 | enum pci_dma_burst_strategy *strat, | ||
136 | unsigned long *strategy_parameter) | ||
137 | { | ||
138 | *strat = PCI_DMA_BURST_INFINITY; | ||
139 | *strategy_parameter = ~0UL; | ||
140 | } | ||
141 | #endif | ||
142 | |||
133 | extern void pcibios_resource_to_bus(struct pci_dev *dev, | 143 | extern void pcibios_resource_to_bus(struct pci_dev *dev, |
134 | struct pci_bus_region *region, struct resource *res); | 144 | struct pci_bus_region *region, struct resource *res); |
135 | 145 | ||
diff --git a/include/asm-mips/serial.h b/include/asm-mips/serial.h index 8a70ff58f760..4eed8e2acdc3 100644 --- a/include/asm-mips/serial.h +++ b/include/asm-mips/serial.h | |||
@@ -29,32 +29,6 @@ | |||
29 | #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF | 29 | #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #ifdef CONFIG_SERIAL_MANY_PORTS | ||
33 | #define FOURPORT_FLAGS ASYNC_FOURPORT | ||
34 | #define ACCENT_FLAGS 0 | ||
35 | #define BOCA_FLAGS 0 | ||
36 | #define HUB6_FLAGS 0 | ||
37 | #define RS_TABLE_SIZE 64 | ||
38 | #else | ||
39 | #define RS_TABLE_SIZE | ||
40 | #endif | ||
41 | |||
42 | /* | ||
43 | * The following define the access methods for the HUB6 card. All | ||
44 | * access is through two ports for all 24 possible chips. The card is | ||
45 | * selected through the high 2 bits, the port on that card with the | ||
46 | * "middle" 3 bits, and the register on that port with the bottom | ||
47 | * 3 bits. | ||
48 | * | ||
49 | * While the access port and interrupt is configurable, the default | ||
50 | * port locations are 0x302 for the port control register, and 0x303 | ||
51 | * for the data read/write register. Normally, the interrupt is at irq3 | ||
52 | * but can be anything from 3 to 7 inclusive. Note that using 3 will | ||
53 | * require disabling com2. | ||
54 | */ | ||
55 | |||
56 | #define C_P(card,port) (((card)<<6|(port)<<3) + 1) | ||
57 | |||
58 | #ifdef CONFIG_MACH_JAZZ | 32 | #ifdef CONFIG_MACH_JAZZ |
59 | #include <asm/jazz.h> | 33 | #include <asm/jazz.h> |
60 | 34 | ||
@@ -240,66 +214,10 @@ | |||
240 | { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ | 214 | { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ |
241 | { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ | 215 | { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ |
242 | 216 | ||
243 | #ifdef CONFIG_SERIAL_MANY_PORTS | ||
244 | #define EXTRA_SERIAL_PORT_DEFNS \ | ||
245 | { 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */ \ | ||
246 | { 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS }, /* ttyS5 */ \ | ||
247 | { 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS }, /* ttyS6 */ \ | ||
248 | { 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS }, /* ttyS7 */ \ | ||
249 | { 0, BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS }, /* ttyS8 */ \ | ||
250 | { 0, BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS }, /* ttyS9 */ \ | ||
251 | { 0, BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS }, /* ttyS10 */ \ | ||
252 | { 0, BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS }, /* ttyS11 */ \ | ||
253 | { 0, BASE_BAUD, 0x330, 4, ACCENT_FLAGS }, /* ttyS12 */ \ | ||
254 | { 0, BASE_BAUD, 0x338, 4, ACCENT_FLAGS }, /* ttyS13 */ \ | ||
255 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS14 (spare) */ \ | ||
256 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS15 (spare) */ \ | ||
257 | { 0, BASE_BAUD, 0x100, 12, BOCA_FLAGS }, /* ttyS16 */ \ | ||
258 | { 0, BASE_BAUD, 0x108, 12, BOCA_FLAGS }, /* ttyS17 */ \ | ||
259 | { 0, BASE_BAUD, 0x110, 12, BOCA_FLAGS }, /* ttyS18 */ \ | ||
260 | { 0, BASE_BAUD, 0x118, 12, BOCA_FLAGS }, /* ttyS19 */ \ | ||
261 | { 0, BASE_BAUD, 0x120, 12, BOCA_FLAGS }, /* ttyS20 */ \ | ||
262 | { 0, BASE_BAUD, 0x128, 12, BOCA_FLAGS }, /* ttyS21 */ \ | ||
263 | { 0, BASE_BAUD, 0x130, 12, BOCA_FLAGS }, /* ttyS22 */ \ | ||
264 | { 0, BASE_BAUD, 0x138, 12, BOCA_FLAGS }, /* ttyS23 */ \ | ||
265 | { 0, BASE_BAUD, 0x140, 12, BOCA_FLAGS }, /* ttyS24 */ \ | ||
266 | { 0, BASE_BAUD, 0x148, 12, BOCA_FLAGS }, /* ttyS25 */ \ | ||
267 | { 0, BASE_BAUD, 0x150, 12, BOCA_FLAGS }, /* ttyS26 */ \ | ||
268 | { 0, BASE_BAUD, 0x158, 12, BOCA_FLAGS }, /* ttyS27 */ \ | ||
269 | { 0, BASE_BAUD, 0x160, 12, BOCA_FLAGS }, /* ttyS28 */ \ | ||
270 | { 0, BASE_BAUD, 0x168, 12, BOCA_FLAGS }, /* ttyS29 */ \ | ||
271 | { 0, BASE_BAUD, 0x170, 12, BOCA_FLAGS }, /* ttyS30 */ \ | ||
272 | { 0, BASE_BAUD, 0x178, 12, BOCA_FLAGS }, /* ttyS31 */ | ||
273 | #else /* CONFIG_SERIAL_MANY_PORTS */ | ||
274 | #define EXTRA_SERIAL_PORT_DEFNS | ||
275 | #endif /* CONFIG_SERIAL_MANY_PORTS */ | ||
276 | |||
277 | #else /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */ | 217 | #else /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */ |
278 | #define STD_SERIAL_PORT_DEFNS | 218 | #define STD_SERIAL_PORT_DEFNS |
279 | #define EXTRA_SERIAL_PORT_DEFNS | ||
280 | #endif /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */ | 219 | #endif /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */ |
281 | 220 | ||
282 | /* You can have up to four HUB6's in the system, but I've only | ||
283 | * included two cards here for a total of twelve ports. | ||
284 | */ | ||
285 | #if (defined(CONFIG_HUB6) && defined(CONFIG_SERIAL_MANY_PORTS)) | ||
286 | #define HUB6_SERIAL_PORT_DFNS \ | ||
287 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,0) }, /* ttyS32 */ \ | ||
288 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,1) }, /* ttyS33 */ \ | ||
289 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,2) }, /* ttyS34 */ \ | ||
290 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,3) }, /* ttyS35 */ \ | ||
291 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,4) }, /* ttyS36 */ \ | ||
292 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,5) }, /* ttyS37 */ \ | ||
293 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,0) }, /* ttyS38 */ \ | ||
294 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,1) }, /* ttyS39 */ \ | ||
295 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,2) }, /* ttyS40 */ \ | ||
296 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,3) }, /* ttyS41 */ \ | ||
297 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,4) }, /* ttyS42 */ \ | ||
298 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,5) }, /* ttyS43 */ | ||
299 | #else | ||
300 | #define HUB6_SERIAL_PORT_DFNS | ||
301 | #endif | ||
302 | |||
303 | #ifdef CONFIG_MOMENCO_JAGUAR_ATX | 221 | #ifdef CONFIG_MOMENCO_JAGUAR_ATX |
304 | /* Ordinary NS16552 duart with a 20MHz crystal. */ | 222 | /* Ordinary NS16552 duart with a 20MHz crystal. */ |
305 | #define JAGUAR_ATX_UART_CLK 20000000 | 223 | #define JAGUAR_ATX_UART_CLK 20000000 |
@@ -427,8 +345,6 @@ | |||
427 | COBALT_SERIAL_PORT_DEFNS \ | 345 | COBALT_SERIAL_PORT_DEFNS \ |
428 | DDB5477_SERIAL_PORT_DEFNS \ | 346 | DDB5477_SERIAL_PORT_DEFNS \ |
429 | EV96100_SERIAL_PORT_DEFNS \ | 347 | EV96100_SERIAL_PORT_DEFNS \ |
430 | EXTRA_SERIAL_PORT_DEFNS \ | ||
431 | HUB6_SERIAL_PORT_DFNS \ | ||
432 | IP32_SERIAL_PORT_DEFNS \ | 348 | IP32_SERIAL_PORT_DEFNS \ |
433 | ITE_SERIAL_PORT_DEFNS \ | 349 | ITE_SERIAL_PORT_DEFNS \ |
434 | IVR_SERIAL_PORT_DEFNS \ | 350 | IVR_SERIAL_PORT_DEFNS \ |
diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h index 0763c2982fb0..ee741c150176 100644 --- a/include/asm-parisc/pci.h +++ b/include/asm-parisc/pci.h | |||
@@ -230,6 +230,25 @@ extern inline void pcibios_register_hba(struct pci_hba_data *x) | |||
230 | /* export the pci_ DMA API in terms of the dma_ one */ | 230 | /* export the pci_ DMA API in terms of the dma_ one */ |
231 | #include <asm-generic/pci-dma-compat.h> | 231 | #include <asm-generic/pci-dma-compat.h> |
232 | 232 | ||
233 | #ifdef CONFIG_PCI | ||
234 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
235 | enum pci_dma_burst_strategy *strat, | ||
236 | unsigned long *strategy_parameter) | ||
237 | { | ||
238 | unsigned long cacheline_size; | ||
239 | u8 byte; | ||
240 | |||
241 | pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte); | ||
242 | if (byte == 0) | ||
243 | cacheline_size = 1024; | ||
244 | else | ||
245 | cacheline_size = (int) byte * 4; | ||
246 | |||
247 | *strat = PCI_DMA_BURST_MULTIPLE; | ||
248 | *strategy_parameter = cacheline_size; | ||
249 | } | ||
250 | #endif | ||
251 | |||
233 | extern void | 252 | extern void |
234 | pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | 253 | pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, |
235 | struct resource *res); | 254 | struct resource *res); |
diff --git a/include/asm-parisc/serial.h b/include/asm-parisc/serial.h index 239c5dcab7e6..82fd820d684f 100644 --- a/include/asm-parisc/serial.h +++ b/include/asm-parisc/serial.h | |||
@@ -19,18 +19,4 @@ | |||
19 | * A500 w/ PCI serial cards: 5 + 4 * card ~= 17 | 19 | * A500 w/ PCI serial cards: 5 + 4 * card ~= 17 |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define STD_SERIAL_PORT_DEFNS \ | 22 | #define SERIAL_PORT_DFNS |
23 | { 0, }, /* ttyS0 */ \ | ||
24 | { 0, }, /* ttyS1 */ \ | ||
25 | { 0, }, /* ttyS2 */ \ | ||
26 | { 0, }, /* ttyS3 */ \ | ||
27 | { 0, }, /* ttyS4 */ \ | ||
28 | { 0, }, /* ttyS5 */ \ | ||
29 | { 0, }, /* ttyS6 */ \ | ||
30 | { 0, }, /* ttyS7 */ \ | ||
31 | { 0, }, /* ttyS8 */ | ||
32 | |||
33 | |||
34 | #define SERIAL_PORT_DFNS \ | ||
35 | STD_SERIAL_PORT_DEFNS | ||
36 | |||
diff --git a/include/asm-ppc/macio.h b/include/asm-ppc/macio.h index 2cafc9978607..a481b772d154 100644 --- a/include/asm-ppc/macio.h +++ b/include/asm-ppc/macio.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __MACIO_ASIC_H__ | 1 | #ifndef __MACIO_ASIC_H__ |
2 | #define __MACIO_ASIC_H__ | 2 | #define __MACIO_ASIC_H__ |
3 | 3 | ||
4 | #include <linux/mod_devicetable.h> | ||
4 | #include <asm/of_device.h> | 5 | #include <asm/of_device.h> |
5 | 6 | ||
6 | extern struct bus_type macio_bus_type; | 7 | extern struct bus_type macio_bus_type; |
@@ -120,10 +121,10 @@ static inline struct pci_dev *macio_get_pci_dev(struct macio_dev *mdev) | |||
120 | struct macio_driver | 121 | struct macio_driver |
121 | { | 122 | { |
122 | char *name; | 123 | char *name; |
123 | struct of_match *match_table; | 124 | struct of_device_id *match_table; |
124 | struct module *owner; | 125 | struct module *owner; |
125 | 126 | ||
126 | int (*probe)(struct macio_dev* dev, const struct of_match *match); | 127 | int (*probe)(struct macio_dev* dev, const struct of_device_id *match); |
127 | int (*remove)(struct macio_dev* dev); | 128 | int (*remove)(struct macio_dev* dev); |
128 | 129 | ||
129 | int (*suspend)(struct macio_dev* dev, pm_message_t state); | 130 | int (*suspend)(struct macio_dev* dev, pm_message_t state); |
diff --git a/include/asm-ppc/mpc8xx.h b/include/asm-ppc/mpc8xx.h index 714d69c819d3..7c31f2d564a1 100644 --- a/include/asm-ppc/mpc8xx.h +++ b/include/asm-ppc/mpc8xx.h | |||
@@ -68,6 +68,10 @@ | |||
68 | #include <platforms/lantec.h> | 68 | #include <platforms/lantec.h> |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | #if defined(CONFIG_MPC885ADS) | ||
72 | #include <platforms/mpc885ads.h> | ||
73 | #endif | ||
74 | |||
71 | /* Currently, all 8xx boards that support a processor to PCI/ISA bridge | 75 | /* Currently, all 8xx boards that support a processor to PCI/ISA bridge |
72 | * use the same memory map. | 76 | * use the same memory map. |
73 | */ | 77 | */ |
diff --git a/include/asm-ppc/of_device.h b/include/asm-ppc/of_device.h index 7229735a7c18..4b264cfd3998 100644 --- a/include/asm-ppc/of_device.h +++ b/include/asm-ppc/of_device.h | |||
@@ -24,20 +24,8 @@ struct of_device | |||
24 | }; | 24 | }; |
25 | #define to_of_device(d) container_of(d, struct of_device, dev) | 25 | #define to_of_device(d) container_of(d, struct of_device, dev) |
26 | 26 | ||
27 | /* | 27 | extern const struct of_device_id *of_match_device( |
28 | * Struct used for matching a device | 28 | const struct of_device_id *matches, const struct of_device *dev); |
29 | */ | ||
30 | struct of_match | ||
31 | { | ||
32 | char *name; | ||
33 | char *type; | ||
34 | char *compatible; | ||
35 | void *data; | ||
36 | }; | ||
37 | #define OF_ANY_MATCH ((char *)-1L) | ||
38 | |||
39 | extern const struct of_match *of_match_device( | ||
40 | const struct of_match *matches, const struct of_device *dev); | ||
41 | 29 | ||
42 | extern struct of_device *of_dev_get(struct of_device *dev); | 30 | extern struct of_device *of_dev_get(struct of_device *dev); |
43 | extern void of_dev_put(struct of_device *dev); | 31 | extern void of_dev_put(struct of_device *dev); |
@@ -49,10 +37,10 @@ extern void of_dev_put(struct of_device *dev); | |||
49 | struct of_platform_driver | 37 | struct of_platform_driver |
50 | { | 38 | { |
51 | char *name; | 39 | char *name; |
52 | struct of_match *match_table; | 40 | struct of_device_id *match_table; |
53 | struct module *owner; | 41 | struct module *owner; |
54 | 42 | ||
55 | int (*probe)(struct of_device* dev, const struct of_match *match); | 43 | int (*probe)(struct of_device* dev, const struct of_device_id *match); |
56 | int (*remove)(struct of_device* dev); | 44 | int (*remove)(struct of_device* dev); |
57 | 45 | ||
58 | int (*suspend)(struct of_device* dev, pm_message_t state); | 46 | int (*suspend)(struct of_device* dev, pm_message_t state); |
diff --git a/include/asm-ppc/pc_serial.h b/include/asm-ppc/pc_serial.h index fa9cbb67ce3e..8f994f9f8857 100644 --- a/include/asm-ppc/pc_serial.h +++ b/include/asm-ppc/pc_serial.h | |||
@@ -35,93 +35,9 @@ | |||
35 | #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF | 35 | #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #ifdef CONFIG_SERIAL_MANY_PORTS | 38 | #define SERIAL_PORT_DFNS \ |
39 | #define FOURPORT_FLAGS ASYNC_FOURPORT | ||
40 | #define ACCENT_FLAGS 0 | ||
41 | #define BOCA_FLAGS 0 | ||
42 | #define HUB6_FLAGS 0 | ||
43 | #endif | ||
44 | |||
45 | /* | ||
46 | * The following define the access methods for the HUB6 card. All | ||
47 | * access is through two ports for all 24 possible chips. The card is | ||
48 | * selected through the high 2 bits, the port on that card with the | ||
49 | * "middle" 3 bits, and the register on that port with the bottom | ||
50 | * 3 bits. | ||
51 | * | ||
52 | * While the access port and interrupt is configurable, the default | ||
53 | * port locations are 0x302 for the port control register, and 0x303 | ||
54 | * for the data read/write register. Normally, the interrupt is at irq3 | ||
55 | * but can be anything from 3 to 7 inclusive. Note that using 3 will | ||
56 | * require disabling com2. | ||
57 | */ | ||
58 | |||
59 | #define C_P(card,port) (((card)<<6|(port)<<3) + 1) | ||
60 | |||
61 | #define STD_SERIAL_PORT_DEFNS \ | ||
62 | /* UART CLK PORT IRQ FLAGS */ \ | 39 | /* UART CLK PORT IRQ FLAGS */ \ |
63 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ | 40 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ |
64 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ | 41 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ |
65 | { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ | 42 | { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ |
66 | { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ | 43 | { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ |
67 | |||
68 | |||
69 | #ifdef CONFIG_SERIAL_MANY_PORTS | ||
70 | #define EXTRA_SERIAL_PORT_DEFNS \ | ||
71 | { 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */ \ | ||
72 | { 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS }, /* ttyS5 */ \ | ||
73 | { 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS }, /* ttyS6 */ \ | ||
74 | { 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS }, /* ttyS7 */ \ | ||
75 | { 0, BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS }, /* ttyS8 */ \ | ||
76 | { 0, BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS }, /* ttyS9 */ \ | ||
77 | { 0, BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS }, /* ttyS10 */ \ | ||
78 | { 0, BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS }, /* ttyS11 */ \ | ||
79 | { 0, BASE_BAUD, 0x330, 4, ACCENT_FLAGS }, /* ttyS12 */ \ | ||
80 | { 0, BASE_BAUD, 0x338, 4, ACCENT_FLAGS }, /* ttyS13 */ \ | ||
81 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS14 (spare) */ \ | ||
82 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS15 (spare) */ \ | ||
83 | { 0, BASE_BAUD, 0x100, 12, BOCA_FLAGS }, /* ttyS16 */ \ | ||
84 | { 0, BASE_BAUD, 0x108, 12, BOCA_FLAGS }, /* ttyS17 */ \ | ||
85 | { 0, BASE_BAUD, 0x110, 12, BOCA_FLAGS }, /* ttyS18 */ \ | ||
86 | { 0, BASE_BAUD, 0x118, 12, BOCA_FLAGS }, /* ttyS19 */ \ | ||
87 | { 0, BASE_BAUD, 0x120, 12, BOCA_FLAGS }, /* ttyS20 */ \ | ||
88 | { 0, BASE_BAUD, 0x128, 12, BOCA_FLAGS }, /* ttyS21 */ \ | ||
89 | { 0, BASE_BAUD, 0x130, 12, BOCA_FLAGS }, /* ttyS22 */ \ | ||
90 | { 0, BASE_BAUD, 0x138, 12, BOCA_FLAGS }, /* ttyS23 */ \ | ||
91 | { 0, BASE_BAUD, 0x140, 12, BOCA_FLAGS }, /* ttyS24 */ \ | ||
92 | { 0, BASE_BAUD, 0x148, 12, BOCA_FLAGS }, /* ttyS25 */ \ | ||
93 | { 0, BASE_BAUD, 0x150, 12, BOCA_FLAGS }, /* ttyS26 */ \ | ||
94 | { 0, BASE_BAUD, 0x158, 12, BOCA_FLAGS }, /* ttyS27 */ \ | ||
95 | { 0, BASE_BAUD, 0x160, 12, BOCA_FLAGS }, /* ttyS28 */ \ | ||
96 | { 0, BASE_BAUD, 0x168, 12, BOCA_FLAGS }, /* ttyS29 */ \ | ||
97 | { 0, BASE_BAUD, 0x170, 12, BOCA_FLAGS }, /* ttyS30 */ \ | ||
98 | { 0, BASE_BAUD, 0x178, 12, BOCA_FLAGS }, /* ttyS31 */ | ||
99 | #else | ||
100 | #define EXTRA_SERIAL_PORT_DEFNS | ||
101 | #endif | ||
102 | |||
103 | /* You can have up to four HUB6's in the system, but I've only | ||
104 | * included two cards here for a total of twelve ports. | ||
105 | */ | ||
106 | #if (defined(CONFIG_HUB6) && defined(CONFIG_SERIAL_MANY_PORTS)) | ||
107 | #define HUB6_SERIAL_PORT_DFNS \ | ||
108 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,0) }, /* ttyS32 */ \ | ||
109 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,1) }, /* ttyS33 */ \ | ||
110 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,2) }, /* ttyS34 */ \ | ||
111 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,3) }, /* ttyS35 */ \ | ||
112 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,4) }, /* ttyS36 */ \ | ||
113 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,5) }, /* ttyS37 */ \ | ||
114 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,0) }, /* ttyS38 */ \ | ||
115 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,1) }, /* ttyS39 */ \ | ||
116 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,2) }, /* ttyS40 */ \ | ||
117 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,3) }, /* ttyS41 */ \ | ||
118 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,4) }, /* ttyS42 */ \ | ||
119 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,5) }, /* ttyS43 */ | ||
120 | #else | ||
121 | #define HUB6_SERIAL_PORT_DFNS | ||
122 | #endif | ||
123 | |||
124 | #define SERIAL_PORT_DFNS \ | ||
125 | STD_SERIAL_PORT_DEFNS \ | ||
126 | EXTRA_SERIAL_PORT_DEFNS \ | ||
127 | HUB6_SERIAL_PORT_DFNS | ||
diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h index ce5ae6d048f5..db0a2a0ec74d 100644 --- a/include/asm-ppc/pci.h +++ b/include/asm-ppc/pci.h | |||
@@ -69,6 +69,16 @@ extern unsigned long pci_bus_to_phys(unsigned int ba, int busnr); | |||
69 | #define pci_unmap_len(PTR, LEN_NAME) (0) | 69 | #define pci_unmap_len(PTR, LEN_NAME) (0) |
70 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) | 70 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) |
71 | 71 | ||
72 | #ifdef CONFIG_PCI | ||
73 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
74 | enum pci_dma_burst_strategy *strat, | ||
75 | unsigned long *strategy_parameter) | ||
76 | { | ||
77 | *strat = PCI_DMA_BURST_INFINITY; | ||
78 | *strategy_parameter = ~0UL; | ||
79 | } | ||
80 | #endif | ||
81 | |||
72 | /* | 82 | /* |
73 | * At present there are very few 32-bit PPC machines that can have | 83 | * At present there are very few 32-bit PPC machines that can have |
74 | * memory above the 4GB point, and we don't support that. | 84 | * memory above the 4GB point, and we don't support that. |
@@ -103,6 +113,12 @@ extern pgprot_t pci_phys_mem_access_prot(struct file *file, | |||
103 | unsigned long size, | 113 | unsigned long size, |
104 | pgprot_t prot); | 114 | pgprot_t prot); |
105 | 115 | ||
116 | #define HAVE_ARCH_PCI_RESOURCE_TO_USER | ||
117 | extern void pci_resource_to_user(const struct pci_dev *dev, int bar, | ||
118 | const struct resource *rsrc, | ||
119 | u64 *start, u64 *end); | ||
120 | |||
121 | |||
106 | #endif /* __KERNEL__ */ | 122 | #endif /* __KERNEL__ */ |
107 | 123 | ||
108 | #endif /* __PPC_PCI_H */ | 124 | #endif /* __PPC_PCI_H */ |
diff --git a/include/asm-ppc64/byteorder.h b/include/asm-ppc64/byteorder.h index 80327532de64..8b57da62b674 100644 --- a/include/asm-ppc64/byteorder.h +++ b/include/asm-ppc64/byteorder.h | |||
@@ -40,7 +40,6 @@ static __inline__ void st_le32(volatile __u32 *addr, const __u32 val) | |||
40 | __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); | 40 | __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); |
41 | } | 41 | } |
42 | 42 | ||
43 | #if 0 | ||
44 | static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 value) | 43 | static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 value) |
45 | { | 44 | { |
46 | __u16 result; | 45 | __u16 result; |
@@ -63,17 +62,8 @@ static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 value) | |||
63 | return result; | 62 | return result; |
64 | } | 63 | } |
65 | 64 | ||
66 | static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 value) | ||
67 | { | ||
68 | __u64 result; | ||
69 | #error implement me | ||
70 | } | ||
71 | |||
72 | #define __arch__swab16(x) ___arch__swab16(x) | 65 | #define __arch__swab16(x) ___arch__swab16(x) |
73 | #define __arch__swab32(x) ___arch__swab32(x) | 66 | #define __arch__swab32(x) ___arch__swab32(x) |
74 | #define __arch__swab64(x) ___arch__swab64(x) | ||
75 | |||
76 | #endif | ||
77 | 67 | ||
78 | /* The same, but returns converted value from the location pointer by addr. */ | 68 | /* The same, but returns converted value from the location pointer by addr. */ |
79 | #define __arch__swab16p(addr) ld_le16(addr) | 69 | #define __arch__swab16p(addr) ld_le16(addr) |
diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-ppc64/iSeries/ItLpQueue.h index 393299e04d7f..69b26ad74135 100644 --- a/include/asm-ppc64/iSeries/ItLpQueue.h +++ b/include/asm-ppc64/iSeries/ItLpQueue.h | |||
@@ -41,7 +41,7 @@ struct HvLpEvent; | |||
41 | #define LpEventMaxSize 256 | 41 | #define LpEventMaxSize 256 |
42 | #define LpEventAlign 64 | 42 | #define LpEventAlign 64 |
43 | 43 | ||
44 | struct ItLpQueue { | 44 | struct hvlpevent_queue { |
45 | /* | 45 | /* |
46 | * The xSlicCurEventPtr is the pointer to the next event stack entry | 46 | * The xSlicCurEventPtr is the pointer to the next event stack entry |
47 | * that will become valid. The OS must peek at this entry to determine | 47 | * that will become valid. The OS must peek at this entry to determine |
@@ -69,16 +69,13 @@ struct ItLpQueue { | |||
69 | char *xSlicEventStackPtr; // 0x20 | 69 | char *xSlicEventStackPtr; // 0x20 |
70 | u8 xIndex; // 0x28 unique sequential index. | 70 | u8 xIndex; // 0x28 unique sequential index. |
71 | u8 xSlicRsvd[3]; // 0x29-2b | 71 | u8 xSlicRsvd[3]; // 0x29-2b |
72 | u32 xInUseWord; // 0x2C | 72 | spinlock_t lock; |
73 | u64 xLpIntCount; // 0x30 Total Lp Int msgs processed | ||
74 | u64 xLpIntCountByType[9]; // 0x38-0x7F Event counts by type | ||
75 | }; | 73 | }; |
76 | 74 | ||
77 | extern struct ItLpQueue xItLpQueue; | 75 | extern struct hvlpevent_queue hvlpevent_queue; |
78 | 76 | ||
79 | extern struct HvLpEvent *ItLpQueue_getNextLpEvent(struct ItLpQueue *); | 77 | extern int hvlpevent_is_pending(void); |
80 | extern int ItLpQueue_isLpIntPending(struct ItLpQueue *); | 78 | extern void process_hvlpevents(struct pt_regs *); |
81 | extern unsigned ItLpQueue_process(struct ItLpQueue *, struct pt_regs *); | 79 | extern void setup_hvlpevent_queue(void); |
82 | extern void ItLpQueue_clearValid(struct HvLpEvent *); | ||
83 | 80 | ||
84 | #endif /* _ITLPQUEUE_H */ | 81 | #endif /* _ITLPQUEUE_H */ |
diff --git a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h index ae76cae1483f..2f0f36f73d38 100644 --- a/include/asm-ppc64/paca.h +++ b/include/asm-ppc64/paca.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <asm/types.h> | 20 | #include <asm/types.h> |
21 | #include <asm/lppaca.h> | 21 | #include <asm/lppaca.h> |
22 | #include <asm/iSeries/ItLpRegSave.h> | 22 | #include <asm/iSeries/ItLpRegSave.h> |
23 | #include <asm/iSeries/ItLpQueue.h> | ||
24 | #include <asm/mmu.h> | 23 | #include <asm/mmu.h> |
25 | 24 | ||
26 | register struct paca_struct *local_paca asm("r13"); | 25 | register struct paca_struct *local_paca asm("r13"); |
@@ -62,7 +61,6 @@ struct paca_struct { | |||
62 | u16 paca_index; /* Logical processor number */ | 61 | u16 paca_index; /* Logical processor number */ |
63 | 62 | ||
64 | u32 default_decr; /* Default decrementer value */ | 63 | u32 default_decr; /* Default decrementer value */ |
65 | struct ItLpQueue *lpqueue_ptr; /* LpQueue handled by this CPU */ | ||
66 | u64 kernel_toc; /* Kernel TOC address */ | 64 | u64 kernel_toc; /* Kernel TOC address */ |
67 | u64 stab_real; /* Absolute address of segment table */ | 65 | u64 stab_real; /* Absolute address of segment table */ |
68 | u64 stab_addr; /* Virtual address of segment table */ | 66 | u64 stab_addr; /* Virtual address of segment table */ |
@@ -91,7 +89,6 @@ struct paca_struct { | |||
91 | u64 next_jiffy_update_tb; /* TB value for next jiffy update */ | 89 | u64 next_jiffy_update_tb; /* TB value for next jiffy update */ |
92 | u64 saved_r1; /* r1 save for RTAS calls */ | 90 | u64 saved_r1; /* r1 save for RTAS calls */ |
93 | u64 saved_msr; /* MSR saved here by enter_rtas */ | 91 | u64 saved_msr; /* MSR saved here by enter_rtas */ |
94 | u32 lpevent_count; /* lpevents processed */ | ||
95 | u8 proc_enabled; /* irq soft-enable flag */ | 92 | u8 proc_enabled; /* irq soft-enable flag */ |
96 | 93 | ||
97 | /* not yet used */ | 94 | /* not yet used */ |
diff --git a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h index 6cd593f660a0..d12dfce21e20 100644 --- a/include/asm-ppc64/pci.h +++ b/include/asm-ppc64/pci.h | |||
@@ -78,6 +78,25 @@ static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask) | |||
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
80 | 80 | ||
81 | #ifdef CONFIG_PCI | ||
82 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
83 | enum pci_dma_burst_strategy *strat, | ||
84 | unsigned long *strategy_parameter) | ||
85 | { | ||
86 | unsigned long cacheline_size; | ||
87 | u8 byte; | ||
88 | |||
89 | pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte); | ||
90 | if (byte == 0) | ||
91 | cacheline_size = 1024; | ||
92 | else | ||
93 | cacheline_size = (int) byte * 4; | ||
94 | |||
95 | *strat = PCI_DMA_BURST_MULTIPLE; | ||
96 | *strategy_parameter = cacheline_size; | ||
97 | } | ||
98 | #endif | ||
99 | |||
81 | extern int pci_domain_nr(struct pci_bus *bus); | 100 | extern int pci_domain_nr(struct pci_bus *bus); |
82 | 101 | ||
83 | /* Decide whether to display the domain number in /proc */ | 102 | /* Decide whether to display the domain number in /proc */ |
@@ -136,6 +155,13 @@ extern pgprot_t pci_phys_mem_access_prot(struct file *file, | |||
136 | unsigned long size, | 155 | unsigned long size, |
137 | pgprot_t prot); | 156 | pgprot_t prot); |
138 | 157 | ||
158 | #ifdef CONFIG_PPC_MULTIPLATFORM | ||
159 | #define HAVE_ARCH_PCI_RESOURCE_TO_USER | ||
160 | extern void pci_resource_to_user(const struct pci_dev *dev, int bar, | ||
161 | const struct resource *rsrc, | ||
162 | u64 *start, u64 *end); | ||
163 | #endif /* CONFIG_PPC_MULTIPLATFORM */ | ||
164 | |||
139 | 165 | ||
140 | #endif /* __KERNEL__ */ | 166 | #endif /* __KERNEL__ */ |
141 | 167 | ||
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h index b4a9f05a93d6..864cae7e1fd6 100644 --- a/include/asm-s390/system.h +++ b/include/asm-s390/system.h | |||
@@ -107,11 +107,9 @@ static inline void restore_access_regs(unsigned int *acrs) | |||
107 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | 107 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING |
108 | extern void account_user_vtime(struct task_struct *); | 108 | extern void account_user_vtime(struct task_struct *); |
109 | extern void account_system_vtime(struct task_struct *); | 109 | extern void account_system_vtime(struct task_struct *); |
110 | #else | ||
111 | #define account_system_vtime(prev) do { } while (0) | ||
112 | #endif | 110 | #endif |
113 | 111 | ||
114 | #define finish_arch_switch(rq, prev) do { \ | 112 | #define finish_arch_switch(prev) do { \ |
115 | set_fs(current->thread.mm_segment); \ | 113 | set_fs(current->thread.mm_segment); \ |
116 | account_system_vtime(prev); \ | 114 | account_system_vtime(prev); \ |
117 | } while (0) | 115 | } while (0) |
diff --git a/include/asm-sh/bigsur/serial.h b/include/asm-sh/bigsur/serial.h index 540f12205923..7233af42f755 100644 --- a/include/asm-sh/bigsur/serial.h +++ b/include/asm-sh/bigsur/serial.h | |||
@@ -14,13 +14,10 @@ | |||
14 | #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) | 14 | #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) |
15 | 15 | ||
16 | 16 | ||
17 | #define STD_SERIAL_PORT_DEFNS \ | 17 | #define SERIAL_PORT_DFNS \ |
18 | /* UART CLK PORT IRQ FLAGS */ \ | 18 | /* UART CLK PORT IRQ FLAGS */ \ |
19 | { 0, BASE_BAUD, 0x3F8, HD64465_IRQ_UART, STD_COM_FLAGS } /* ttyS0 */ | 19 | { 0, BASE_BAUD, 0x3F8, HD64465_IRQ_UART, STD_COM_FLAGS } /* ttyS0 */ |
20 | 20 | ||
21 | |||
22 | #define SERIAL_PORT_DFNS STD_SERIAL_PORT_DEFNS | ||
23 | |||
24 | /* XXX: This should be moved ino irq.h */ | 21 | /* XXX: This should be moved ino irq.h */ |
25 | #define irq_cannonicalize(x) (x) | 22 | #define irq_cannonicalize(x) (x) |
26 | 23 | ||
diff --git a/include/asm-sh/ec3104/serial.h b/include/asm-sh/ec3104/serial.h index f8eb16312ed9..cfe4d78ec1ee 100644 --- a/include/asm-sh/ec3104/serial.h +++ b/include/asm-sh/ec3104/serial.h | |||
@@ -10,13 +10,11 @@ | |||
10 | * it's got the keyboard controller behind it so we can't really use it | 10 | * it's got the keyboard controller behind it so we can't really use it |
11 | * (without moving the keyboard driver to userspace, which doesn't sound | 11 | * (without moving the keyboard driver to userspace, which doesn't sound |
12 | * like a very good idea) */ | 12 | * like a very good idea) */ |
13 | #define STD_SERIAL_PORT_DEFNS \ | 13 | #define SERIAL_PORT_DFNS \ |
14 | /* UART CLK PORT IRQ FLAGS */ \ | 14 | /* UART CLK PORT IRQ FLAGS */ \ |
15 | { 0, BASE_BAUD, 0x11C00, EC3104_IRQBASE+7, STD_COM_FLAGS }, /* ttyS0 */ \ | 15 | { 0, BASE_BAUD, 0x11C00, EC3104_IRQBASE+7, STD_COM_FLAGS }, /* ttyS0 */ \ |
16 | { 0, BASE_BAUD, 0x12000, EC3104_IRQBASE+8, STD_COM_FLAGS }, /* ttyS1 */ \ | 16 | { 0, BASE_BAUD, 0x12000, EC3104_IRQBASE+8, STD_COM_FLAGS }, /* ttyS1 */ \ |
17 | { 0, BASE_BAUD, 0x12400, EC3104_IRQBASE+9, STD_COM_FLAGS }, /* ttyS2 */ | 17 | { 0, BASE_BAUD, 0x12400, EC3104_IRQBASE+9, STD_COM_FLAGS }, /* ttyS2 */ |
18 | 18 | ||
19 | #define SERIAL_PORT_DFNS STD_SERIAL_PORT_DEFNS | ||
20 | |||
21 | /* XXX: This should be moved ino irq.h */ | 19 | /* XXX: This should be moved ino irq.h */ |
22 | #define irq_cannonicalize(x) (x) | 20 | #define irq_cannonicalize(x) (x) |
diff --git a/include/asm-sh/pci.h b/include/asm-sh/pci.h index 9c3b63d0105e..26044889c770 100644 --- a/include/asm-sh/pci.h +++ b/include/asm-sh/pci.h | |||
@@ -96,6 +96,16 @@ static inline void pcibios_penalize_isa_irq(int irq) | |||
96 | #define sg_dma_address(sg) (virt_to_bus((sg)->dma_address)) | 96 | #define sg_dma_address(sg) (virt_to_bus((sg)->dma_address)) |
97 | #define sg_dma_len(sg) ((sg)->length) | 97 | #define sg_dma_len(sg) ((sg)->length) |
98 | 98 | ||
99 | #ifdef CONFIG_PCI | ||
100 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
101 | enum pci_dma_burst_strategy *strat, | ||
102 | unsigned long *strategy_parameter) | ||
103 | { | ||
104 | *strat = PCI_DMA_BURST_INFINITY; | ||
105 | *strategy_parameter = ~0UL; | ||
106 | } | ||
107 | #endif | ||
108 | |||
99 | /* Board-specific fixup routines. */ | 109 | /* Board-specific fixup routines. */ |
100 | extern void pcibios_fixup(void); | 110 | extern void pcibios_fixup(void); |
101 | extern void pcibios_fixup_irqs(void); | 111 | extern void pcibios_fixup_irqs(void); |
diff --git a/include/asm-sh/serial.h b/include/asm-sh/serial.h index 5474dbdbaa86..f51e232d5cd9 100644 --- a/include/asm-sh/serial.h +++ b/include/asm-sh/serial.h | |||
@@ -29,20 +29,18 @@ | |||
29 | #ifdef CONFIG_HD64465 | 29 | #ifdef CONFIG_HD64465 |
30 | #include <asm/hd64465.h> | 30 | #include <asm/hd64465.h> |
31 | 31 | ||
32 | #define STD_SERIAL_PORT_DEFNS \ | 32 | #define SERIAL_PORT_DFNS \ |
33 | /* UART CLK PORT IRQ FLAGS */ \ | 33 | /* UART CLK PORT IRQ FLAGS */ \ |
34 | { 0, BASE_BAUD, 0x3F8, HD64465_IRQ_UART, STD_COM_FLAGS } /* ttyS0 */ | 34 | { 0, BASE_BAUD, 0x3F8, HD64465_IRQ_UART, STD_COM_FLAGS } /* ttyS0 */ |
35 | 35 | ||
36 | #else | 36 | #else |
37 | 37 | ||
38 | #define STD_SERIAL_PORT_DEFNS \ | 38 | #define SERIAL_PORT_DFNS \ |
39 | /* UART CLK PORT IRQ FLAGS */ \ | 39 | /* UART CLK PORT IRQ FLAGS */ \ |
40 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ | 40 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ |
41 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS } /* ttyS1 */ | 41 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS } /* ttyS1 */ |
42 | 42 | ||
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #define SERIAL_PORT_DFNS STD_SERIAL_PORT_DEFNS | ||
46 | |||
47 | #endif | 45 | #endif |
48 | #endif /* _ASM_SERIAL_H */ | 46 | #endif /* _ASM_SERIAL_H */ |
diff --git a/include/asm-sh64/pci.h b/include/asm-sh64/pci.h index 8cc14e139750..c68870e02d91 100644 --- a/include/asm-sh64/pci.h +++ b/include/asm-sh64/pci.h | |||
@@ -86,6 +86,16 @@ static inline void pcibios_penalize_isa_irq(int irq) | |||
86 | #define sg_dma_address(sg) ((sg)->dma_address) | 86 | #define sg_dma_address(sg) ((sg)->dma_address) |
87 | #define sg_dma_len(sg) ((sg)->length) | 87 | #define sg_dma_len(sg) ((sg)->length) |
88 | 88 | ||
89 | #ifdef CONFIG_PCI | ||
90 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
91 | enum pci_dma_burst_strategy *strat, | ||
92 | unsigned long *strategy_parameter) | ||
93 | { | ||
94 | *strat = PCI_DMA_BURST_INFINITY; | ||
95 | *strategy_parameter = ~0UL; | ||
96 | } | ||
97 | #endif | ||
98 | |||
89 | /* Board-specific fixup routines. */ | 99 | /* Board-specific fixup routines. */ |
90 | extern void pcibios_fixup(void); | 100 | extern void pcibios_fixup(void); |
91 | extern void pcibios_fixup_irqs(void); | 101 | extern void pcibios_fixup_irqs(void); |
diff --git a/include/asm-sh64/serial.h b/include/asm-sh64/serial.h index 8e39b4e90c76..29c9be15112b 100644 --- a/include/asm-sh64/serial.h +++ b/include/asm-sh64/serial.h | |||
@@ -20,13 +20,11 @@ | |||
20 | 20 | ||
21 | #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) | 21 | #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) |
22 | 22 | ||
23 | #define STD_SERIAL_PORT_DEFNS \ | 23 | #define SERIAL_PORT_DFNS \ |
24 | /* UART CLK PORT IRQ FLAGS */ \ | 24 | /* UART CLK PORT IRQ FLAGS */ \ |
25 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ | 25 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ |
26 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS } /* ttyS1 */ | 26 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS } /* ttyS1 */ |
27 | 27 | ||
28 | #define SERIAL_PORT_DFNS STD_SERIAL_PORT_DEFNS | ||
29 | |||
30 | /* XXX: This should be moved ino irq.h */ | 28 | /* XXX: This should be moved ino irq.h */ |
31 | #define irq_cannonicalize(x) (x) | 29 | #define irq_cannonicalize(x) (x) |
32 | 30 | ||
diff --git a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h index d200a25a7373..44bb38758c96 100644 --- a/include/asm-sparc/pci.h +++ b/include/asm-sparc/pci.h | |||
@@ -144,6 +144,16 @@ extern inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask) | |||
144 | 144 | ||
145 | #define pci_dac_dma_supported(dev, mask) (0) | 145 | #define pci_dac_dma_supported(dev, mask) (0) |
146 | 146 | ||
147 | #ifdef CONFIG_PCI | ||
148 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
149 | enum pci_dma_burst_strategy *strat, | ||
150 | unsigned long *strategy_parameter) | ||
151 | { | ||
152 | *strat = PCI_DMA_BURST_INFINITY; | ||
153 | *strategy_parameter = ~0UL; | ||
154 | } | ||
155 | #endif | ||
156 | |||
147 | static inline void pcibios_add_platform_entries(struct pci_dev *dev) | 157 | static inline void pcibios_add_platform_entries(struct pci_dev *dev) |
148 | { | 158 | { |
149 | } | 159 | } |
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h index 018e2e46082b..8b70edcb80dc 100644 --- a/include/asm-sparc64/irq.h +++ b/include/asm-sparc64/irq.h | |||
@@ -16,6 +16,18 @@ | |||
16 | #include <asm/pil.h> | 16 | #include <asm/pil.h> |
17 | #include <asm/ptrace.h> | 17 | #include <asm/ptrace.h> |
18 | 18 | ||
19 | struct ino_bucket; | ||
20 | |||
21 | #define MAX_IRQ_DESC_ACTION 4 | ||
22 | |||
23 | struct irq_desc { | ||
24 | void (*pre_handler)(struct ino_bucket *, void *, void *); | ||
25 | void *pre_handler_arg1; | ||
26 | void *pre_handler_arg2; | ||
27 | u32 action_active_mask; | ||
28 | struct irqaction action[MAX_IRQ_DESC_ACTION]; | ||
29 | }; | ||
30 | |||
19 | /* You should not mess with this directly. That's the job of irq.c. | 31 | /* You should not mess with this directly. That's the job of irq.c. |
20 | * | 32 | * |
21 | * If you make changes here, please update hand coded assembler of | 33 | * If you make changes here, please update hand coded assembler of |
@@ -42,24 +54,11 @@ struct ino_bucket { | |||
42 | /* Miscellaneous flags. */ | 54 | /* Miscellaneous flags. */ |
43 | /*0x06*/unsigned char flags; | 55 | /*0x06*/unsigned char flags; |
44 | 56 | ||
45 | /* This is used to deal with IBF_DMA_SYNC on | 57 | /* Currently unused. */ |
46 | * Sabre systems. | 58 | /*0x07*/unsigned char __pad; |
47 | */ | 59 | |
48 | /*0x07*/unsigned char synctab_ent; | 60 | /* Reference to IRQ descriptor for this bucket. */ |
49 | 61 | /*0x08*/struct irq_desc *irq_info; | |
50 | /* Reference to handler for this IRQ. If this is | ||
51 | * non-NULL this means it is active and should be | ||
52 | * serviced. Else the pending member is set to one | ||
53 | * and later registry of the interrupt checks for | ||
54 | * this condition. | ||
55 | * | ||
56 | * Normally this is just an irq_action structure. | ||
57 | * But, on PCI, if multiple interrupt sources behind | ||
58 | * a bridge have multiple interrupt sources that share | ||
59 | * the same INO bucket, this points to an array of | ||
60 | * pointers to four IRQ action structures. | ||
61 | */ | ||
62 | /*0x08*/void *irq_info; | ||
63 | 62 | ||
64 | /* Sun5 Interrupt Clear Register. */ | 63 | /* Sun5 Interrupt Clear Register. */ |
65 | /*0x10*/unsigned long iclr; | 64 | /*0x10*/unsigned long iclr; |
@@ -69,12 +68,6 @@ struct ino_bucket { | |||
69 | 68 | ||
70 | }; | 69 | }; |
71 | 70 | ||
72 | #ifdef CONFIG_PCI | ||
73 | extern unsigned long pci_dma_wsync; | ||
74 | extern unsigned long dma_sync_reg_table[256]; | ||
75 | extern unsigned char dma_sync_reg_table_entry; | ||
76 | #endif | ||
77 | |||
78 | /* IMAP/ICLR register defines */ | 71 | /* IMAP/ICLR register defines */ |
79 | #define IMAP_VALID 0x80000000 /* IRQ Enabled */ | 72 | #define IMAP_VALID 0x80000000 /* IRQ Enabled */ |
80 | #define IMAP_TID_UPA 0x7c000000 /* UPA TargetID */ | 73 | #define IMAP_TID_UPA 0x7c000000 /* UPA TargetID */ |
@@ -90,11 +83,9 @@ extern unsigned char dma_sync_reg_table_entry; | |||
90 | #define ICLR_PENDING 0x00000003 /* Pending state */ | 83 | #define ICLR_PENDING 0x00000003 /* Pending state */ |
91 | 84 | ||
92 | /* Only 8-bits are available, be careful. -DaveM */ | 85 | /* Only 8-bits are available, be careful. -DaveM */ |
93 | #define IBF_DMA_SYNC 0x01 /* DMA synchronization behind PCI bridge needed. */ | 86 | #define IBF_PCI 0x02 /* PSYCHO/SABRE/SCHIZO PCI interrupt. */ |
94 | #define IBF_PCI 0x02 /* Indicates PSYCHO/SABRE/SCHIZO PCI interrupt. */ | 87 | #define IBF_ACTIVE 0x04 /* Interrupt is active and has a handler.*/ |
95 | #define IBF_ACTIVE 0x04 /* This interrupt is active and has a handler. */ | 88 | #define IBF_INPROGRESS 0x10 /* IRQ is being serviced. */ |
96 | #define IBF_MULTI 0x08 /* On PCI, indicates shared bucket. */ | ||
97 | #define IBF_INPROGRESS 0x10 /* IRQ is being serviced. */ | ||
98 | 89 | ||
99 | #define NUM_IVECS (IMAP_INR + 1) | 90 | #define NUM_IVECS (IMAP_INR + 1) |
100 | extern struct ino_bucket ivector_table[NUM_IVECS]; | 91 | extern struct ino_bucket ivector_table[NUM_IVECS]; |
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h index b7e635544cec..56b5197d7898 100644 --- a/include/asm-sparc64/parport.h +++ b/include/asm-sparc64/parport.h | |||
@@ -27,12 +27,12 @@ static struct sparc_ebus_info { | |||
27 | 27 | ||
28 | static __inline__ void enable_dma(unsigned int dmanr) | 28 | static __inline__ void enable_dma(unsigned int dmanr) |
29 | { | 29 | { |
30 | ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1); | ||
31 | |||
30 | if (ebus_dma_request(&sparc_ebus_dmas[dmanr].info, | 32 | if (ebus_dma_request(&sparc_ebus_dmas[dmanr].info, |
31 | sparc_ebus_dmas[dmanr].addr, | 33 | sparc_ebus_dmas[dmanr].addr, |
32 | sparc_ebus_dmas[dmanr].count)) | 34 | sparc_ebus_dmas[dmanr].count)) |
33 | BUG(); | 35 | BUG(); |
34 | |||
35 | ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1); | ||
36 | } | 36 | } |
37 | 37 | ||
38 | static __inline__ void disable_dma(unsigned int dmanr) | 38 | static __inline__ void disable_dma(unsigned int dmanr) |
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h index 4c15610a2bac..38bbbccb4068 100644 --- a/include/asm-sparc64/pbm.h +++ b/include/asm-sparc64/pbm.h | |||
@@ -145,6 +145,9 @@ struct pci_pbm_info { | |||
145 | /* Physical address base of PBM registers. */ | 145 | /* Physical address base of PBM registers. */ |
146 | unsigned long pbm_regs; | 146 | unsigned long pbm_regs; |
147 | 147 | ||
148 | /* Physical address of DMA sync register, if any. */ | ||
149 | unsigned long sync_reg; | ||
150 | |||
148 | /* Opaque 32-bit system bus Port ID. */ | 151 | /* Opaque 32-bit system bus Port ID. */ |
149 | u32 portid; | 152 | u32 portid; |
150 | 153 | ||
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h index 2a0c85cd1c11..84e41c1ef3f8 100644 --- a/include/asm-sparc64/pci.h +++ b/include/asm-sparc64/pci.h | |||
@@ -220,6 +220,25 @@ static inline int pci_dma_mapping_error(dma_addr_t dma_addr) | |||
220 | return (dma_addr == PCI_DMA_ERROR_CODE); | 220 | return (dma_addr == PCI_DMA_ERROR_CODE); |
221 | } | 221 | } |
222 | 222 | ||
223 | #ifdef CONFIG_PCI | ||
224 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
225 | enum pci_dma_burst_strategy *strat, | ||
226 | unsigned long *strategy_parameter) | ||
227 | { | ||
228 | unsigned long cacheline_size; | ||
229 | u8 byte; | ||
230 | |||
231 | pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte); | ||
232 | if (byte == 0) | ||
233 | cacheline_size = 1024; | ||
234 | else | ||
235 | cacheline_size = (int) byte * 4; | ||
236 | |||
237 | *strat = PCI_DMA_BURST_BOUNDARY; | ||
238 | *strategy_parameter = cacheline_size; | ||
239 | } | ||
240 | #endif | ||
241 | |||
223 | /* Return the index of the PCI controller for device PDEV. */ | 242 | /* Return the index of the PCI controller for device PDEV. */ |
224 | 243 | ||
225 | extern int pci_domain_nr(struct pci_bus *bus); | 244 | extern int pci_domain_nr(struct pci_bus *bus); |
diff --git a/include/asm-sparc64/signal.h b/include/asm-sparc64/signal.h index becdf1bc5924..e3059bb4a465 100644 --- a/include/asm-sparc64/signal.h +++ b/include/asm-sparc64/signal.h | |||
@@ -162,21 +162,6 @@ struct sigstack { | |||
162 | #define MINSIGSTKSZ 4096 | 162 | #define MINSIGSTKSZ 4096 |
163 | #define SIGSTKSZ 16384 | 163 | #define SIGSTKSZ 16384 |
164 | 164 | ||
165 | #ifdef __KERNEL__ | ||
166 | /* | ||
167 | * DJHR | ||
168 | * SA_STATIC_ALLOC is used for the SPARC system to indicate that this | ||
169 | * interrupt handler's irq structure should be statically allocated | ||
170 | * by the request_irq routine. | ||
171 | * The alternative is that arch/sparc/kernel/irq.c has carnal knowledge | ||
172 | * of interrupt usage and that sucks. Also without a flag like this | ||
173 | * it may be possible for the free_irq routine to attempt to free | ||
174 | * statically allocated data.. which is NOT GOOD. | ||
175 | * | ||
176 | */ | ||
177 | #define SA_STATIC_ALLOC 0x80 | ||
178 | #endif | ||
179 | |||
180 | #include <asm-generic/signal.h> | 165 | #include <asm-generic/signal.h> |
181 | 166 | ||
182 | struct __new_sigaction { | 167 | struct __new_sigaction { |
diff --git a/include/asm-v850/pci.h b/include/asm-v850/pci.h index e41941447b49..8e79be0fe99d 100644 --- a/include/asm-v850/pci.h +++ b/include/asm-v850/pci.h | |||
@@ -81,6 +81,16 @@ extern void | |||
81 | pci_free_consistent (struct pci_dev *pdev, size_t size, void *cpu_addr, | 81 | pci_free_consistent (struct pci_dev *pdev, size_t size, void *cpu_addr, |
82 | dma_addr_t dma_addr); | 82 | dma_addr_t dma_addr); |
83 | 83 | ||
84 | #ifdef CONFIG_PCI | ||
85 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
86 | enum pci_dma_burst_strategy *strat, | ||
87 | unsigned long *strategy_parameter) | ||
88 | { | ||
89 | *strat = PCI_DMA_BURST_INFINITY; | ||
90 | *strategy_parameter = ~0UL; | ||
91 | } | ||
92 | #endif | ||
93 | |||
84 | static inline void pcibios_add_platform_entries(struct pci_dev *dev) | 94 | static inline void pcibios_add_platform_entries(struct pci_dev *dev) |
85 | { | 95 | { |
86 | } | 96 | } |
diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h index 32573749004c..a8babd2bbe84 100644 --- a/include/asm-x86_64/io_apic.h +++ b/include/asm-x86_64/io_apic.h | |||
@@ -217,4 +217,6 @@ extern int assign_irq_vector(int irq); | |||
217 | 217 | ||
218 | void enable_NMI_through_LVT0 (void * dummy); | 218 | void enable_NMI_through_LVT0 (void * dummy); |
219 | 219 | ||
220 | extern spinlock_t i8259A_lock; | ||
221 | |||
220 | #endif | 222 | #endif |
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h index 8712520ca47f..c1961db88fac 100644 --- a/include/asm-x86_64/pci.h +++ b/include/asm-x86_64/pci.h | |||
@@ -123,6 +123,16 @@ pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, | |||
123 | flush_write_buffers(); | 123 | flush_write_buffers(); |
124 | } | 124 | } |
125 | 125 | ||
126 | #ifdef CONFIG_PCI | ||
127 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | ||
128 | enum pci_dma_burst_strategy *strat, | ||
129 | unsigned long *strategy_parameter) | ||
130 | { | ||
131 | *strat = PCI_DMA_BURST_INFINITY; | ||
132 | *strategy_parameter = ~0UL; | ||
133 | } | ||
134 | #endif | ||
135 | |||
126 | #define HAVE_PCI_MMAP | 136 | #define HAVE_PCI_MMAP |
127 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | 137 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, |
128 | enum pci_mmap_state mmap_state, int write_combine); | 138 | enum pci_mmap_state mmap_state, int write_combine); |
diff --git a/include/asm-x86_64/serial.h b/include/asm-x86_64/serial.h index dbab232044cd..dc752eafa681 100644 --- a/include/asm-x86_64/serial.h +++ b/include/asm-x86_64/serial.h | |||
@@ -22,109 +22,9 @@ | |||
22 | #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF | 22 | #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | #ifdef CONFIG_SERIAL_MANY_PORTS | 25 | #define SERIAL_PORT_DFNS \ |
26 | #define FOURPORT_FLAGS ASYNC_FOURPORT | ||
27 | #define ACCENT_FLAGS 0 | ||
28 | #define BOCA_FLAGS 0 | ||
29 | #define HUB6_FLAGS 0 | ||
30 | #endif | ||
31 | |||
32 | #define MCA_COM_FLAGS (STD_COM_FLAGS|ASYNC_BOOT_ONLYMCA) | ||
33 | |||
34 | /* | ||
35 | * The following define the access methods for the HUB6 card. All | ||
36 | * access is through two ports for all 24 possible chips. The card is | ||
37 | * selected through the high 2 bits, the port on that card with the | ||
38 | * "middle" 3 bits, and the register on that port with the bottom | ||
39 | * 3 bits. | ||
40 | * | ||
41 | * While the access port and interrupt is configurable, the default | ||
42 | * port locations are 0x302 for the port control register, and 0x303 | ||
43 | * for the data read/write register. Normally, the interrupt is at irq3 | ||
44 | * but can be anything from 3 to 7 inclusive. Note that using 3 will | ||
45 | * require disabling com2. | ||
46 | */ | ||
47 | |||
48 | #define C_P(card,port) (((card)<<6|(port)<<3) + 1) | ||
49 | |||
50 | #define STD_SERIAL_PORT_DEFNS \ | ||
51 | /* UART CLK PORT IRQ FLAGS */ \ | 26 | /* UART CLK PORT IRQ FLAGS */ \ |
52 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ | 27 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ |
53 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ | 28 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ |
54 | { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ | 29 | { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ |
55 | { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ | 30 | { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ |
56 | |||
57 | |||
58 | #ifdef CONFIG_SERIAL_MANY_PORTS | ||
59 | #define EXTRA_SERIAL_PORT_DEFNS \ | ||
60 | { 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */ \ | ||
61 | { 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS }, /* ttyS5 */ \ | ||
62 | { 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS }, /* ttyS6 */ \ | ||
63 | { 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS }, /* ttyS7 */ \ | ||
64 | { 0, BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS }, /* ttyS8 */ \ | ||
65 | { 0, BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS }, /* ttyS9 */ \ | ||
66 | { 0, BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS }, /* ttyS10 */ \ | ||
67 | { 0, BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS }, /* ttyS11 */ \ | ||
68 | { 0, BASE_BAUD, 0x330, 4, ACCENT_FLAGS }, /* ttyS12 */ \ | ||
69 | { 0, BASE_BAUD, 0x338, 4, ACCENT_FLAGS }, /* ttyS13 */ \ | ||
70 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS14 (spare) */ \ | ||
71 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS15 (spare) */ \ | ||
72 | { 0, BASE_BAUD, 0x100, 12, BOCA_FLAGS }, /* ttyS16 */ \ | ||
73 | { 0, BASE_BAUD, 0x108, 12, BOCA_FLAGS }, /* ttyS17 */ \ | ||
74 | { 0, BASE_BAUD, 0x110, 12, BOCA_FLAGS }, /* ttyS18 */ \ | ||
75 | { 0, BASE_BAUD, 0x118, 12, BOCA_FLAGS }, /* ttyS19 */ \ | ||
76 | { 0, BASE_BAUD, 0x120, 12, BOCA_FLAGS }, /* ttyS20 */ \ | ||
77 | { 0, BASE_BAUD, 0x128, 12, BOCA_FLAGS }, /* ttyS21 */ \ | ||
78 | { 0, BASE_BAUD, 0x130, 12, BOCA_FLAGS }, /* ttyS22 */ \ | ||
79 | { 0, BASE_BAUD, 0x138, 12, BOCA_FLAGS }, /* ttyS23 */ \ | ||
80 | { 0, BASE_BAUD, 0x140, 12, BOCA_FLAGS }, /* ttyS24 */ \ | ||
81 | { 0, BASE_BAUD, 0x148, 12, BOCA_FLAGS }, /* ttyS25 */ \ | ||
82 | { 0, BASE_BAUD, 0x150, 12, BOCA_FLAGS }, /* ttyS26 */ \ | ||
83 | { 0, BASE_BAUD, 0x158, 12, BOCA_FLAGS }, /* ttyS27 */ \ | ||
84 | { 0, BASE_BAUD, 0x160, 12, BOCA_FLAGS }, /* ttyS28 */ \ | ||
85 | { 0, BASE_BAUD, 0x168, 12, BOCA_FLAGS }, /* ttyS29 */ \ | ||
86 | { 0, BASE_BAUD, 0x170, 12, BOCA_FLAGS }, /* ttyS30 */ \ | ||
87 | { 0, BASE_BAUD, 0x178, 12, BOCA_FLAGS }, /* ttyS31 */ | ||
88 | #else | ||
89 | #define EXTRA_SERIAL_PORT_DEFNS | ||
90 | #endif | ||
91 | |||
92 | /* You can have up to four HUB6's in the system, but I've only | ||
93 | * included two cards here for a total of twelve ports. | ||
94 | */ | ||
95 | #if (defined(CONFIG_HUB6) && defined(CONFIG_SERIAL_MANY_PORTS)) | ||
96 | #define HUB6_SERIAL_PORT_DFNS \ | ||
97 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,0) }, /* ttyS32 */ \ | ||
98 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,1) }, /* ttyS33 */ \ | ||
99 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,2) }, /* ttyS34 */ \ | ||
100 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,3) }, /* ttyS35 */ \ | ||
101 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,4) }, /* ttyS36 */ \ | ||
102 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,5) }, /* ttyS37 */ \ | ||
103 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,0) }, /* ttyS38 */ \ | ||
104 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,1) }, /* ttyS39 */ \ | ||
105 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,2) }, /* ttyS40 */ \ | ||
106 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,3) }, /* ttyS41 */ \ | ||
107 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,4) }, /* ttyS42 */ \ | ||
108 | { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,5) }, /* ttyS43 */ | ||
109 | #else | ||
110 | #define HUB6_SERIAL_PORT_DFNS | ||
111 | #endif | ||
112 | |||
113 | #ifdef CONFIG_MCA | ||
114 | #define MCA_SERIAL_PORT_DFNS \ | ||
115 | { 0, BASE_BAUD, 0x3220, 3, MCA_COM_FLAGS }, \ | ||
116 | { 0, BASE_BAUD, 0x3228, 3, MCA_COM_FLAGS }, \ | ||
117 | { 0, BASE_BAUD, 0x4220, 3, MCA_COM_FLAGS }, \ | ||
118 | { 0, BASE_BAUD, 0x4228, 3, MCA_COM_FLAGS }, \ | ||
119 | { 0, BASE_BAUD, 0x5220, 3, MCA_COM_FLAGS }, \ | ||
120 | { 0, BASE_BAUD, 0x5228, 3, MCA_COM_FLAGS }, | ||
121 | #else | ||
122 | #define MCA_SERIAL_PORT_DFNS | ||
123 | #endif | ||
124 | |||
125 | #define SERIAL_PORT_DFNS \ | ||
126 | STD_SERIAL_PORT_DEFNS \ | ||
127 | EXTRA_SERIAL_PORT_DEFNS \ | ||
128 | HUB6_SERIAL_PORT_DFNS \ | ||
129 | MCA_SERIAL_PORT_DFNS | ||
130 | |||
diff --git a/include/asm-xtensa/delay.h b/include/asm-xtensa/delay.h index 6359c55e77a8..0a123d53a636 100644 --- a/include/asm-xtensa/delay.h +++ b/include/asm-xtensa/delay.h | |||
@@ -21,7 +21,7 @@ extern unsigned long loops_per_jiffy; | |||
21 | extern __inline__ void __delay(unsigned long loops) | 21 | extern __inline__ void __delay(unsigned long loops) |
22 | { | 22 | { |
23 | /* 2 cycles per loop. */ | 23 | /* 2 cycles per loop. */ |
24 | __asm__ __volatile__ ("1: addi %0, %0, -2; bgeui %0, 1, 1b" | 24 | __asm__ __volatile__ ("1: addi %0, %0, -2; bgeui %0, 2, 1b" |
25 | : "=r" (loops) : "0" (loops)); | 25 | : "=r" (loops) : "0" (loops)); |
26 | } | 26 | } |
27 | 27 | ||
diff --git a/include/asm-xtensa/errno.h b/include/asm-xtensa/errno.h index ced5194d2750..a0f3b96b79b4 100644 --- a/include/asm-xtensa/errno.h +++ b/include/asm-xtensa/errno.h | |||
@@ -11,132 +11,6 @@ | |||
11 | #ifndef _XTENSA_ERRNO_H | 11 | #ifndef _XTENSA_ERRNO_H |
12 | #define _XTENSA_ERRNO_H | 12 | #define _XTENSA_ERRNO_H |
13 | 13 | ||
14 | #define EPERM 1 /* Operation not permitted */ | 14 | #include <asm-generic/errno.h> |
15 | #define ENOENT 2 /* No such file or directory */ | ||
16 | #define ESRCH 3 /* No such process */ | ||
17 | #define EINTR 4 /* Interrupted system call */ | ||
18 | #define EIO 5 /* I/O error */ | ||
19 | #define ENXIO 6 /* No such device or address */ | ||
20 | #define E2BIG 7 /* Arg list too long */ | ||
21 | #define ENOEXEC 8 /* Exec format error */ | ||
22 | #define EBADF 9 /* Bad file number */ | ||
23 | #define ECHILD 10 /* No child processes */ | ||
24 | #define EAGAIN 11 /* Try again */ | ||
25 | #define ENOMEM 12 /* Out of memory */ | ||
26 | #define EACCES 13 /* Permission denied */ | ||
27 | #define EFAULT 14 /* Bad address */ | ||
28 | #define ENOTBLK 15 /* Block device required */ | ||
29 | #define EBUSY 16 /* Device or resource busy */ | ||
30 | #define EEXIST 17 /* File exists */ | ||
31 | #define EXDEV 18 /* Cross-device link */ | ||
32 | #define ENODEV 19 /* No such device */ | ||
33 | #define ENOTDIR 20 /* Not a directory */ | ||
34 | #define EISDIR 21 /* Is a directory */ | ||
35 | #define EINVAL 22 /* Invalid argument */ | ||
36 | #define ENFILE 23 /* File table overflow */ | ||
37 | #define EMFILE 24 /* Too many open files */ | ||
38 | #define ENOTTY 25 /* Not a typewriter */ | ||
39 | #define ETXTBSY 26 /* Text file busy */ | ||
40 | #define EFBIG 27 /* File too large */ | ||
41 | #define ENOSPC 28 /* No space left on device */ | ||
42 | #define ESPIPE 29 /* Illegal seek */ | ||
43 | #define EROFS 30 /* Read-only file system */ | ||
44 | #define EMLINK 31 /* Too many links */ | ||
45 | #define EPIPE 32 /* Broken pipe */ | ||
46 | #define EDOM 33 /* Math argument out of domain of func */ | ||
47 | #define ERANGE 34 /* Math result not representable */ | ||
48 | #define EDEADLK 35 /* Resource deadlock would occur */ | ||
49 | #define ENAMETOOLONG 36 /* File name too long */ | ||
50 | #define ENOLCK 37 /* No record locks available */ | ||
51 | #define ENOSYS 38 /* Function not implemented */ | ||
52 | #define ENOTEMPTY 39 /* Directory not empty */ | ||
53 | #define ELOOP 40 /* Too many symbolic links encountered */ | ||
54 | #define EWOULDBLOCK EAGAIN /* Operation would block */ | ||
55 | #define ENOMSG 42 /* No message of desired type */ | ||
56 | #define EIDRM 43 /* Identifier removed */ | ||
57 | #define ECHRNG 44 /* Channel number out of range */ | ||
58 | #define EL2NSYNC 45 /* Level 2 not synchronized */ | ||
59 | #define EL3HLT 46 /* Level 3 halted */ | ||
60 | #define EL3RST 47 /* Level 3 reset */ | ||
61 | #define ELNRNG 48 /* Link number out of range */ | ||
62 | #define EUNATCH 49 /* Protocol driver not attached */ | ||
63 | #define ENOCSI 50 /* No CSI structure available */ | ||
64 | #define EL2HLT 51 /* Level 2 halted */ | ||
65 | #define EBADE 52 /* Invalid exchange */ | ||
66 | #define EBADR 53 /* Invalid request descriptor */ | ||
67 | #define EXFULL 54 /* Exchange full */ | ||
68 | #define ENOANO 55 /* No anode */ | ||
69 | #define EBADRQC 56 /* Invalid request code */ | ||
70 | #define EBADSLT 57 /* Invalid slot */ | ||
71 | |||
72 | #define EDEADLOCK EDEADLK | ||
73 | |||
74 | #define EBFONT 59 /* Bad font file format */ | ||
75 | #define ENOSTR 60 /* Device not a stream */ | ||
76 | #define ENODATA 61 /* No data available */ | ||
77 | #define ETIME 62 /* Timer expired */ | ||
78 | #define ENOSR 63 /* Out of streams resources */ | ||
79 | #define ENONET 64 /* Machine is not on the network */ | ||
80 | #define ENOPKG 65 /* Package not installed */ | ||
81 | #define EREMOTE 66 /* Object is remote */ | ||
82 | #define ENOLINK 67 /* Link has been severed */ | ||
83 | #define EADV 68 /* Advertise error */ | ||
84 | #define ESRMNT 69 /* Srmount error */ | ||
85 | #define ECOMM 70 /* Communication error on send */ | ||
86 | #define EPROTO 71 /* Protocol error */ | ||
87 | #define EMULTIHOP 72 /* Multihop attempted */ | ||
88 | #define EDOTDOT 73 /* RFS specific error */ | ||
89 | #define EBADMSG 74 /* Not a data message */ | ||
90 | #define EOVERFLOW 75 /* Value too large for defined data type */ | ||
91 | #define ENOTUNIQ 76 /* Name not unique on network */ | ||
92 | #define EBADFD 77 /* File descriptor in bad state */ | ||
93 | #define EREMCHG 78 /* Remote address changed */ | ||
94 | #define ELIBACC 79 /* Can not access a needed shared library */ | ||
95 | #define ELIBBAD 80 /* Accessing a corrupted shared library */ | ||
96 | #define ELIBSCN 81 /* .lib section in a.out corrupted */ | ||
97 | #define ELIBMAX 82 /* Attempting to link in too many shared libraries */ | ||
98 | #define ELIBEXEC 83 /* Cannot exec a shared library directly */ | ||
99 | #define EILSEQ 84 /* Illegal byte sequence */ | ||
100 | #define ERESTART 85 /* Interrupted system call should be restarted */ | ||
101 | #define ESTRPIPE 86 /* Streams pipe error */ | ||
102 | #define EUSERS 87 /* Too many users */ | ||
103 | #define ENOTSOCK 88 /* Socket operation on non-socket */ | ||
104 | #define EDESTADDRREQ 89 /* Destination address required */ | ||
105 | #define EMSGSIZE 90 /* Message too long */ | ||
106 | #define EPROTOTYPE 91 /* Protocol wrong type for socket */ | ||
107 | #define ENOPROTOOPT 92 /* Protocol not available */ | ||
108 | #define EPROTONOSUPPORT 93 /* Protocol not supported */ | ||
109 | #define ESOCKTNOSUPPORT 94 /* Socket type not supported */ | ||
110 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ | ||
111 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ | ||
112 | #define EAFNOSUPPORT 97 /* Address family not supported by protocol */ | ||
113 | #define EADDRINUSE 98 /* Address already in use */ | ||
114 | #define EADDRNOTAVAIL 99 /* Cannot assign requested address */ | ||
115 | #define ENETDOWN 100 /* Network is down */ | ||
116 | #define ENETUNREACH 101 /* Network is unreachable */ | ||
117 | #define ENETRESET 102 /* Network dropped connection because of reset */ | ||
118 | #define ECONNABORTED 103 /* Software caused connection abort */ | ||
119 | #define ECONNRESET 104 /* Connection reset by peer */ | ||
120 | #define ENOBUFS 105 /* No buffer space available */ | ||
121 | #define EISCONN 106 /* Transport endpoint is already connected */ | ||
122 | #define ENOTCONN 107 /* Transport endpoint is not connected */ | ||
123 | #define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ | ||
124 | #define ETOOMANYREFS 109 /* Too many references: cannot splice */ | ||
125 | #define ETIMEDOUT 110 /* Connection timed out */ | ||
126 | #define ECONNREFUSED 111 /* Connection refused */ | ||
127 | #define EHOSTDOWN 112 /* Host is down */ | ||
128 | #define EHOSTUNREACH 113 /* No route to host */ | ||
129 | #define EALREADY 114 /* Operation already in progress */ | ||
130 | #define EINPROGRESS 115 /* Operation now in progress */ | ||
131 | #define ESTALE 116 /* Stale NFS file handle */ | ||
132 | #define EUCLEAN 117 /* Structure needs cleaning */ | ||
133 | #define ENOTNAM 118 /* Not a XENIX named type file */ | ||
134 | #define ENAVAIL 119 /* No XENIX semaphores available */ | ||
135 | #define EISNAM 120 /* Is a named type file */ | ||
136 | #define EREMOTEIO 121 /* Remote I/O error */ | ||
137 | #define EDQUOT 122 /* Quota exceeded */ | ||
138 | |||
139 | #define ENOMEDIUM 123 /* No medium found */ | ||
140 | #define EMEDIUMTYPE 124 /* Wrong medium type */ | ||
141 | 15 | ||
142 | #endif /* _XTENSA_ERRNO_H */ | 16 | #endif /* _XTENSA_ERRNO_H */ |
diff --git a/include/asm-xtensa/ipc.h b/include/asm-xtensa/ipc.h index d37bdb4d4c9c..a9eed4e21cb9 100644 --- a/include/asm-xtensa/ipc.h +++ b/include/asm-xtensa/ipc.h | |||
@@ -11,24 +11,6 @@ | |||
11 | #ifndef _XTENSA_IPC_H | 11 | #ifndef _XTENSA_IPC_H |
12 | #define _XTENSA_IPC_H | 12 | #define _XTENSA_IPC_H |
13 | 13 | ||
14 | struct ipc_kludge { | 14 | #include <asm-generic/ipc.h> |
15 | struct msgbuf __user *msgp; | ||
16 | long msgtyp; | ||
17 | }; | ||
18 | |||
19 | #define SEMOP 1 | ||
20 | #define SEMGET 2 | ||
21 | #define SEMCTL 3 | ||
22 | #define SEMTIMEDOP 4 | ||
23 | #define MSGSND 11 | ||
24 | #define MSGRCV 12 | ||
25 | #define MSGGET 13 | ||
26 | #define MSGCTL 14 | ||
27 | #define SHMAT 21 | ||
28 | #define SHMDT 22 | ||
29 | #define SHMGET 23 | ||
30 | #define SHMCTL 24 | ||
31 | |||
32 | #define IPCCALL(version,op) ((version)<<16 | (op)) | ||
33 | 15 | ||
34 | #endif /* _XTENSA_IPC_H */ | 16 | #endif /* _XTENSA_IPC_H */ |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index b123cc08773d..ef8483673aa3 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -342,11 +342,19 @@ struct acpi_table_ecdt { | |||
342 | 342 | ||
343 | /* PCI MMCONFIG */ | 343 | /* PCI MMCONFIG */ |
344 | 344 | ||
345 | /* Defined in PCI Firmware Specification 3.0 */ | ||
346 | struct acpi_table_mcfg_config { | ||
347 | u32 base_address; | ||
348 | u32 base_reserved; | ||
349 | u16 pci_segment_group_number; | ||
350 | u8 start_bus_number; | ||
351 | u8 end_bus_number; | ||
352 | u8 reserved[4]; | ||
353 | } __attribute__ ((packed)); | ||
345 | struct acpi_table_mcfg { | 354 | struct acpi_table_mcfg { |
346 | struct acpi_table_header header; | 355 | struct acpi_table_header header; |
347 | u8 reserved[8]; | 356 | u8 reserved[8]; |
348 | u32 base_address; | 357 | struct acpi_table_mcfg_config config[0]; |
349 | u32 base_reserved; | ||
350 | } __attribute__ ((packed)); | 358 | } __attribute__ ((packed)); |
351 | 359 | ||
352 | /* Table Handlers */ | 360 | /* Table Handlers */ |
@@ -391,6 +399,7 @@ int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler); | |||
391 | int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header); | 399 | int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header); |
392 | int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries); | 400 | int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries); |
393 | int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries); | 401 | int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries); |
402 | int acpi_parse_mcfg (unsigned long phys_addr, unsigned long size); | ||
394 | void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr); | 403 | void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr); |
395 | void acpi_table_print_madt_entry (acpi_table_entry_header *madt); | 404 | void acpi_table_print_madt_entry (acpi_table_entry_header *madt); |
396 | void acpi_table_print_srat_entry (acpi_table_entry_header *srat); | 405 | void acpi_table_print_srat_entry (acpi_table_entry_header *srat); |
@@ -407,9 +416,13 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu); | |||
407 | int acpi_unmap_lsapic(int cpu); | 416 | int acpi_unmap_lsapic(int cpu); |
408 | #endif /* CONFIG_ACPI_HOTPLUG_CPU */ | 417 | #endif /* CONFIG_ACPI_HOTPLUG_CPU */ |
409 | 418 | ||
419 | int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base); | ||
420 | int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base); | ||
421 | |||
410 | extern int acpi_mp_config; | 422 | extern int acpi_mp_config; |
411 | 423 | ||
412 | extern u32 pci_mmcfg_base_addr; | 424 | extern struct acpi_table_mcfg_config *pci_mmcfg_config; |
425 | extern int pci_mmcfg_config_num; | ||
413 | 426 | ||
414 | extern int sbf_port ; | 427 | extern int sbf_port ; |
415 | 428 | ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 21a8674cd149..0881b5cdee3d 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -96,6 +96,7 @@ struct io_context { | |||
96 | 96 | ||
97 | void put_io_context(struct io_context *ioc); | 97 | void put_io_context(struct io_context *ioc); |
98 | void exit_io_context(void); | 98 | void exit_io_context(void); |
99 | struct io_context *current_io_context(int gfp_flags); | ||
99 | struct io_context *get_io_context(int gfp_flags); | 100 | struct io_context *get_io_context(int gfp_flags); |
100 | void copy_io_context(struct io_context **pdst, struct io_context **psrc); | 101 | void copy_io_context(struct io_context **pdst, struct io_context **psrc); |
101 | void swap_io_context(struct io_context **ioc1, struct io_context **ioc2); | 102 | void swap_io_context(struct io_context **ioc1, struct io_context **ioc2); |
diff --git a/include/linux/byteorder/swabb.h b/include/linux/byteorder/swabb.h index d28d9a804d3b..d5f2a3205109 100644 --- a/include/linux/byteorder/swabb.h +++ b/include/linux/byteorder/swabb.h | |||
@@ -92,29 +92,32 @@ | |||
92 | #endif /* OPTIMIZE */ | 92 | #endif /* OPTIMIZE */ |
93 | 93 | ||
94 | 94 | ||
95 | static __inline__ __const__ __u32 __fswahw32(__u32 x) | 95 | static inline __u32 __fswahw32(__u32 x) |
96 | { | 96 | { |
97 | return __arch__swahw32(x); | 97 | return __arch__swahw32(x); |
98 | } | 98 | } |
99 | static __inline__ __u32 __swahw32p(__u32 *x) | 99 | |
100 | static inline __u32 __swahw32p(__u32 *x) | ||
100 | { | 101 | { |
101 | return __arch__swahw32p(x); | 102 | return __arch__swahw32p(x); |
102 | } | 103 | } |
103 | static __inline__ void __swahw32s(__u32 *addr) | 104 | |
105 | static inline void __swahw32s(__u32 *addr) | ||
104 | { | 106 | { |
105 | __arch__swahw32s(addr); | 107 | __arch__swahw32s(addr); |
106 | } | 108 | } |
107 | 109 | ||
108 | 110 | static inline __u32 __fswahb32(__u32 x) | |
109 | static __inline__ __const__ __u32 __fswahb32(__u32 x) | ||
110 | { | 111 | { |
111 | return __arch__swahb32(x); | 112 | return __arch__swahb32(x); |
112 | } | 113 | } |
113 | static __inline__ __u32 __swahb32p(__u32 *x) | 114 | |
115 | static inline __u32 __swahb32p(__u32 *x) | ||
114 | { | 116 | { |
115 | return __arch__swahb32p(x); | 117 | return __arch__swahb32p(x); |
116 | } | 118 | } |
117 | static __inline__ void __swahb32s(__u32 *addr) | 119 | |
120 | static inline void __swahb32s(__u32 *addr) | ||
118 | { | 121 | { |
119 | __arch__swahb32s(addr); | 122 | __arch__swahb32s(addr); |
120 | } | 123 | } |
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h index 70a4ebb5d964..ecb0d39c0798 100644 --- a/include/linux/compat_ioctl.h +++ b/include/linux/compat_ioctl.h | |||
@@ -346,10 +346,27 @@ COMPATIBLE_IOCTL(PPPOEIOCDFWD) | |||
346 | /* LP */ | 346 | /* LP */ |
347 | COMPATIBLE_IOCTL(LPGETSTATUS) | 347 | COMPATIBLE_IOCTL(LPGETSTATUS) |
348 | /* ppdev */ | 348 | /* ppdev */ |
349 | COMPATIBLE_IOCTL(PPSETMODE) | ||
350 | COMPATIBLE_IOCTL(PPRSTATUS) | ||
351 | COMPATIBLE_IOCTL(PPRCONTROL) | ||
352 | COMPATIBLE_IOCTL(PPWCONTROL) | ||
353 | COMPATIBLE_IOCTL(PPFCONTROL) | ||
354 | COMPATIBLE_IOCTL(PPRDATA) | ||
355 | COMPATIBLE_IOCTL(PPWDATA) | ||
349 | COMPATIBLE_IOCTL(PPCLAIM) | 356 | COMPATIBLE_IOCTL(PPCLAIM) |
350 | COMPATIBLE_IOCTL(PPRELEASE) | 357 | COMPATIBLE_IOCTL(PPRELEASE) |
351 | COMPATIBLE_IOCTL(PPEXCL) | ||
352 | COMPATIBLE_IOCTL(PPYIELD) | 358 | COMPATIBLE_IOCTL(PPYIELD) |
359 | COMPATIBLE_IOCTL(PPEXCL) | ||
360 | COMPATIBLE_IOCTL(PPDATADIR) | ||
361 | COMPATIBLE_IOCTL(PPNEGOT) | ||
362 | COMPATIBLE_IOCTL(PPWCTLONIRQ) | ||
363 | COMPATIBLE_IOCTL(PPCLRIRQ) | ||
364 | COMPATIBLE_IOCTL(PPSETPHASE) | ||
365 | COMPATIBLE_IOCTL(PPGETMODES) | ||
366 | COMPATIBLE_IOCTL(PPGETMODE) | ||
367 | COMPATIBLE_IOCTL(PPGETPHASE) | ||
368 | COMPATIBLE_IOCTL(PPGETFLAGS) | ||
369 | COMPATIBLE_IOCTL(PPSETFLAGS) | ||
353 | /* CDROM stuff */ | 370 | /* CDROM stuff */ |
354 | COMPATIBLE_IOCTL(CDROMPAUSE) | 371 | COMPATIBLE_IOCTL(CDROMPAUSE) |
355 | COMPATIBLE_IOCTL(CDROMRESUME) | 372 | COMPATIBLE_IOCTL(CDROMRESUME) |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 387da6a3e58c..5e2bcc636a02 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
@@ -61,6 +61,15 @@ | |||
61 | #define CRYPTO_DIR_DECRYPT 0 | 61 | #define CRYPTO_DIR_DECRYPT 0 |
62 | 62 | ||
63 | struct scatterlist; | 63 | struct scatterlist; |
64 | struct crypto_tfm; | ||
65 | |||
66 | struct cipher_desc { | ||
67 | struct crypto_tfm *tfm; | ||
68 | void (*crfn)(void *ctx, u8 *dst, const u8 *src); | ||
69 | unsigned int (*prfn)(const struct cipher_desc *desc, u8 *dst, | ||
70 | const u8 *src, unsigned int nbytes); | ||
71 | void *info; | ||
72 | }; | ||
64 | 73 | ||
65 | /* | 74 | /* |
66 | * Algorithms: modular crypto algorithm implementations, managed | 75 | * Algorithms: modular crypto algorithm implementations, managed |
@@ -73,6 +82,19 @@ struct cipher_alg { | |||
73 | unsigned int keylen, u32 *flags); | 82 | unsigned int keylen, u32 *flags); |
74 | void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); | 83 | void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); |
75 | void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); | 84 | void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); |
85 | |||
86 | unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc, | ||
87 | u8 *dst, const u8 *src, | ||
88 | unsigned int nbytes); | ||
89 | unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc, | ||
90 | u8 *dst, const u8 *src, | ||
91 | unsigned int nbytes); | ||
92 | unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc, | ||
93 | u8 *dst, const u8 *src, | ||
94 | unsigned int nbytes); | ||
95 | unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc, | ||
96 | u8 *dst, const u8 *src, | ||
97 | unsigned int nbytes); | ||
76 | }; | 98 | }; |
77 | 99 | ||
78 | struct digest_alg { | 100 | struct digest_alg { |
@@ -102,6 +124,7 @@ struct crypto_alg { | |||
102 | u32 cra_flags; | 124 | u32 cra_flags; |
103 | unsigned int cra_blocksize; | 125 | unsigned int cra_blocksize; |
104 | unsigned int cra_ctxsize; | 126 | unsigned int cra_ctxsize; |
127 | unsigned int cra_alignmask; | ||
105 | const char cra_name[CRYPTO_MAX_ALG_NAME]; | 128 | const char cra_name[CRYPTO_MAX_ALG_NAME]; |
106 | 129 | ||
107 | union { | 130 | union { |
@@ -136,7 +159,6 @@ static inline int crypto_alg_available(const char *name, u32 flags) | |||
136 | * and core processing logic. Managed via crypto_alloc_tfm() and | 159 | * and core processing logic. Managed via crypto_alloc_tfm() and |
137 | * crypto_free_tfm(), as well as the various helpers below. | 160 | * crypto_free_tfm(), as well as the various helpers below. |
138 | */ | 161 | */ |
139 | struct crypto_tfm; | ||
140 | 162 | ||
141 | struct cipher_tfm { | 163 | struct cipher_tfm { |
142 | void *cit_iv; | 164 | void *cit_iv; |
@@ -266,6 +288,16 @@ static inline unsigned int crypto_tfm_alg_digestsize(struct crypto_tfm *tfm) | |||
266 | return tfm->__crt_alg->cra_digest.dia_digestsize; | 288 | return tfm->__crt_alg->cra_digest.dia_digestsize; |
267 | } | 289 | } |
268 | 290 | ||
291 | static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm) | ||
292 | { | ||
293 | return tfm->__crt_alg->cra_alignmask; | ||
294 | } | ||
295 | |||
296 | static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) | ||
297 | { | ||
298 | return (void *)&tfm[1]; | ||
299 | } | ||
300 | |||
269 | /* | 301 | /* |
270 | * API wrappers. | 302 | * API wrappers. |
271 | */ | 303 | */ |
diff --git a/include/linux/device.h b/include/linux/device.h index 7b781a72b293..f378c846e6d5 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -69,7 +69,7 @@ struct bus_type { | |||
69 | extern int bus_register(struct bus_type * bus); | 69 | extern int bus_register(struct bus_type * bus); |
70 | extern void bus_unregister(struct bus_type * bus); | 70 | extern void bus_unregister(struct bus_type * bus); |
71 | 71 | ||
72 | extern int bus_rescan_devices(struct bus_type * bus); | 72 | extern void bus_rescan_devices(struct bus_type * bus); |
73 | 73 | ||
74 | extern struct bus_type * get_bus(struct bus_type * bus); | 74 | extern struct bus_type * get_bus(struct bus_type * bus); |
75 | extern void put_bus(struct bus_type * bus); | 75 | extern void put_bus(struct bus_type * bus); |
@@ -80,6 +80,8 @@ extern struct bus_type * find_bus(char * name); | |||
80 | 80 | ||
81 | int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data, | 81 | int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data, |
82 | int (*fn)(struct device *, void *)); | 82 | int (*fn)(struct device *, void *)); |
83 | struct device * bus_find_device(struct bus_type *bus, struct device *start, | ||
84 | void *data, int (*match)(struct device *, void *)); | ||
83 | 85 | ||
84 | int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, | 86 | int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, |
85 | void * data, int (*fn)(struct device_driver *, void *)); | 87 | void * data, int (*fn)(struct device_driver *, void *)); |
@@ -142,6 +144,9 @@ extern void driver_remove_file(struct device_driver *, struct driver_attribute * | |||
142 | 144 | ||
143 | extern int driver_for_each_device(struct device_driver * drv, struct device * start, | 145 | extern int driver_for_each_device(struct device_driver * drv, struct device * start, |
144 | void * data, int (*fn)(struct device *, void *)); | 146 | void * data, int (*fn)(struct device *, void *)); |
147 | struct device * driver_find_device(struct device_driver *drv, | ||
148 | struct device *start, void *data, | ||
149 | int (*match)(struct device *, void *)); | ||
145 | 150 | ||
146 | 151 | ||
147 | /* | 152 | /* |
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index a1478258d002..cf3847edc50f 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #define _LINUX_ETHERDEVICE_H | 25 | #define _LINUX_ETHERDEVICE_H |
26 | 26 | ||
27 | #include <linux/if_ether.h> | 27 | #include <linux/if_ether.h> |
28 | #include <linux/netdevice.h> | ||
28 | #include <linux/random.h> | 29 | #include <linux/random.h> |
29 | 30 | ||
30 | #ifdef __KERNEL__ | 31 | #ifdef __KERNEL__ |
@@ -65,7 +66,7 @@ static inline int is_zero_ether_addr(const u8 *addr) | |||
65 | */ | 66 | */ |
66 | static inline int is_multicast_ether_addr(const u8 *addr) | 67 | static inline int is_multicast_ether_addr(const u8 *addr) |
67 | { | 68 | { |
68 | return addr[0] & 0x01; | 69 | return ((addr[0] != 0xff) && (0x01 & addr[0])); |
69 | } | 70 | } |
70 | 71 | ||
71 | /** | 72 | /** |
diff --git a/include/linux/i2c-dev.h b/include/linux/i2c-dev.h index d228230ffe5d..541695679762 100644 --- a/include/linux/i2c-dev.h +++ b/include/linux/i2c-dev.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #define _LINUX_I2C_DEV_H | 25 | #define _LINUX_I2C_DEV_H |
26 | 26 | ||
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/compiler.h> | ||
28 | 29 | ||
29 | /* Some IOCTL commands are defined in <linux/i2c.h> */ | 30 | /* Some IOCTL commands are defined in <linux/i2c.h> */ |
30 | /* Note: 10-bit addresses are NOT supported! */ | 31 | /* Note: 10-bit addresses are NOT supported! */ |
diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h index 004e6f09a6e2..68c896a36a34 100644 --- a/include/linux/if_shaper.h +++ b/include/linux/if_shaper.h | |||
@@ -23,7 +23,7 @@ struct shaper | |||
23 | __u32 shapeclock; | 23 | __u32 shapeclock; |
24 | unsigned long recovery; /* Time we can next clock a packet out on | 24 | unsigned long recovery; /* Time we can next clock a packet out on |
25 | an empty queue */ | 25 | an empty queue */ |
26 | struct semaphore sem; | 26 | spinlock_t lock; |
27 | struct net_device_stats stats; | 27 | struct net_device_stats stats; |
28 | struct net_device *dev; | 28 | struct net_device *dev; |
29 | int (*hard_start_xmit) (struct sk_buff *skb, | 29 | int (*hard_start_xmit) (struct sk_buff *skb, |
diff --git a/include/linux/in6.h b/include/linux/in6.h index f8256c582845..dcf5720ffcbb 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h | |||
@@ -156,7 +156,7 @@ struct in6_flowlabel_req | |||
156 | #define IPV6_CHECKSUM 7 | 156 | #define IPV6_CHECKSUM 7 |
157 | #define IPV6_HOPLIMIT 8 | 157 | #define IPV6_HOPLIMIT 8 |
158 | #define IPV6_NEXTHOP 9 | 158 | #define IPV6_NEXTHOP 9 |
159 | #define IPV6_AUTHHDR 10 | 159 | #define IPV6_AUTHHDR 10 /* obsolete */ |
160 | #define IPV6_FLOWINFO 11 | 160 | #define IPV6_FLOWINFO 11 |
161 | 161 | ||
162 | #define IPV6_UNICAST_HOPS 16 | 162 | #define IPV6_UNICAST_HOPS 16 |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 12277799c007..069d3b84d311 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -85,9 +85,10 @@ extern int no_irq_affinity; | |||
85 | extern int noirqdebug_setup(char *str); | 85 | extern int noirqdebug_setup(char *str); |
86 | 86 | ||
87 | extern fastcall int handle_IRQ_event(unsigned int irq, struct pt_regs *regs, | 87 | extern fastcall int handle_IRQ_event(unsigned int irq, struct pt_regs *regs, |
88 | struct irqaction *action); | 88 | struct irqaction *action); |
89 | extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); | 89 | extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); |
90 | extern void note_interrupt(unsigned int irq, irq_desc_t *desc, int action_ret); | 90 | extern void note_interrupt(unsigned int irq, irq_desc_t *desc, |
91 | int action_ret, struct pt_regs *regs); | ||
91 | extern int can_request_irq(unsigned int irq, unsigned long irqflags); | 92 | extern int can_request_irq(unsigned int irq, unsigned long irqflags); |
92 | 93 | ||
93 | extern void init_irq_proc(void); | 94 | extern void init_irq_proc(void); |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index b7a194c4362a..e050fc2d4c26 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -155,7 +155,7 @@ extern void arch_copy_kprobe(struct kprobe *p); | |||
155 | extern void arch_arm_kprobe(struct kprobe *p); | 155 | extern void arch_arm_kprobe(struct kprobe *p); |
156 | extern void arch_disarm_kprobe(struct kprobe *p); | 156 | extern void arch_disarm_kprobe(struct kprobe *p); |
157 | extern void arch_remove_kprobe(struct kprobe *p); | 157 | extern void arch_remove_kprobe(struct kprobe *p); |
158 | extern int arch_init(void); | 158 | extern int arch_init_kprobes(void); |
159 | extern void show_registers(struct pt_regs *regs); | 159 | extern void show_registers(struct pt_regs *regs); |
160 | extern kprobe_opcode_t *get_insn_slot(void); | 160 | extern kprobe_opcode_t *get_insn_slot(void); |
161 | extern void free_insn_slot(kprobe_opcode_t *slot); | 161 | extern void free_insn_slot(kprobe_opcode_t *slot); |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 9b6d05172ed4..dce53ac1625d 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -174,6 +174,17 @@ struct serio_device_id { | |||
174 | __u8 proto; | 174 | __u8 proto; |
175 | }; | 175 | }; |
176 | 176 | ||
177 | /* | ||
178 | * Struct used for matching a device | ||
179 | */ | ||
180 | struct of_device_id | ||
181 | { | ||
182 | char name[32]; | ||
183 | char type[32]; | ||
184 | char compatible[128]; | ||
185 | void *data; | ||
186 | }; | ||
187 | |||
177 | 188 | ||
178 | /* PCMCIA */ | 189 | /* PCMCIA */ |
179 | 190 | ||
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 3029cad63a01..27e4d164a108 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -168,6 +168,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) | |||
168 | nlh->nlmsg_flags = flags; | 168 | nlh->nlmsg_flags = flags; |
169 | nlh->nlmsg_pid = pid; | 169 | nlh->nlmsg_pid = pid; |
170 | nlh->nlmsg_seq = seq; | 170 | nlh->nlmsg_seq = seq; |
171 | memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size); | ||
171 | return nlh; | 172 | return nlh; |
172 | } | 173 | } |
173 | 174 | ||
diff --git a/include/linux/pci-dynids.h b/include/linux/pci-dynids.h deleted file mode 100644 index 183b6b0de81c..000000000000 --- a/include/linux/pci-dynids.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /* | ||
2 | * PCI defines and function prototypes | ||
3 | * Copyright 2003 Dell Inc. | ||
4 | * by Matt Domsch <Matt_Domsch@dell.com> | ||
5 | */ | ||
6 | |||
7 | #ifndef LINUX_PCI_DYNIDS_H | ||
8 | #define LINUX_PCI_DYNIDS_H | ||
9 | |||
10 | #include <linux/list.h> | ||
11 | #include <linux/mod_devicetable.h> | ||
12 | |||
13 | struct dynid { | ||
14 | struct list_head node; | ||
15 | struct pci_device_id id; | ||
16 | }; | ||
17 | |||
18 | #endif | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index b5238bd18830..7ac14961ba22 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -586,7 +586,7 @@ struct pci_dev { | |||
586 | #define PCI_NUM_RESOURCES 11 | 586 | #define PCI_NUM_RESOURCES 11 |
587 | 587 | ||
588 | #ifndef PCI_BUS_NUM_RESOURCES | 588 | #ifndef PCI_BUS_NUM_RESOURCES |
589 | #define PCI_BUS_NUM_RESOURCES 4 | 589 | #define PCI_BUS_NUM_RESOURCES 8 |
590 | #endif | 590 | #endif |
591 | 591 | ||
592 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ | 592 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ |
@@ -734,16 +734,20 @@ void pcibios_update_irq(struct pci_dev *, int irq); | |||
734 | /* Generic PCI functions used internally */ | 734 | /* Generic PCI functions used internally */ |
735 | 735 | ||
736 | extern struct pci_bus *pci_find_bus(int domain, int busnr); | 736 | extern struct pci_bus *pci_find_bus(int domain, int busnr); |
737 | void pci_bus_add_devices(struct pci_bus *bus); | ||
737 | struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); | 738 | struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); |
738 | static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata) | 739 | static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata) |
739 | { | 740 | { |
740 | return pci_scan_bus_parented(NULL, bus, ops, sysdata); | 741 | struct pci_bus *root_bus; |
742 | root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata); | ||
743 | if (root_bus) | ||
744 | pci_bus_add_devices(root_bus); | ||
745 | return root_bus; | ||
741 | } | 746 | } |
742 | int pci_scan_slot(struct pci_bus *bus, int devfn); | 747 | int pci_scan_slot(struct pci_bus *bus, int devfn); |
743 | struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); | 748 | struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); |
744 | unsigned int pci_scan_child_bus(struct pci_bus *bus); | 749 | unsigned int pci_scan_child_bus(struct pci_bus *bus); |
745 | void pci_bus_add_device(struct pci_dev *dev); | 750 | void pci_bus_add_device(struct pci_dev *dev); |
746 | void pci_bus_add_devices(struct pci_bus *bus); | ||
747 | void pci_name_device(struct pci_dev *dev); | 751 | void pci_name_device(struct pci_dev *dev); |
748 | char *pci_class_name(u32 class); | 752 | char *pci_class_name(u32 class); |
749 | void pci_read_bridge_bases(struct pci_bus *child); | 753 | void pci_read_bridge_bases(struct pci_bus *child); |
@@ -856,7 +860,8 @@ int pci_register_driver(struct pci_driver *); | |||
856 | void pci_unregister_driver(struct pci_driver *); | 860 | void pci_unregister_driver(struct pci_driver *); |
857 | void pci_remove_behind_bridge(struct pci_dev *); | 861 | void pci_remove_behind_bridge(struct pci_dev *); |
858 | struct pci_driver *pci_dev_driver(const struct pci_dev *); | 862 | struct pci_driver *pci_dev_driver(const struct pci_dev *); |
859 | const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev); | 863 | const struct pci_device_id *pci_match_device(struct pci_driver *drv, struct pci_dev *dev); |
864 | const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); | ||
860 | int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); | 865 | int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); |
861 | 866 | ||
862 | /* kmem_cache style wrapper around pci_alloc_consistent() */ | 867 | /* kmem_cache style wrapper around pci_alloc_consistent() */ |
@@ -870,6 +875,15 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass | |||
870 | #define pci_pool_alloc(pool, flags, handle) dma_pool_alloc(pool, flags, handle) | 875 | #define pci_pool_alloc(pool, flags, handle) dma_pool_alloc(pool, flags, handle) |
871 | #define pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr) | 876 | #define pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr) |
872 | 877 | ||
878 | enum pci_dma_burst_strategy { | ||
879 | PCI_DMA_BURST_INFINITY, /* make bursts as large as possible, | ||
880 | strategy_parameter is N/A */ | ||
881 | PCI_DMA_BURST_BOUNDARY, /* disconnect at every strategy_parameter | ||
882 | byte boundaries */ | ||
883 | PCI_DMA_BURST_MULTIPLE, /* disconnect at some multiple of | ||
884 | strategy_parameter byte boundaries */ | ||
885 | }; | ||
886 | |||
873 | #if defined(CONFIG_ISA) || defined(CONFIG_EISA) | 887 | #if defined(CONFIG_ISA) || defined(CONFIG_EISA) |
874 | extern struct pci_dev *isa_bridge; | 888 | extern struct pci_dev *isa_bridge; |
875 | #endif | 889 | #endif |
@@ -972,6 +986,8 @@ static inline int pci_proc_domain(struct pci_bus *bus) | |||
972 | } | 986 | } |
973 | #endif | 987 | #endif |
974 | 988 | ||
989 | #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) | ||
990 | |||
975 | #endif /* !CONFIG_PCI */ | 991 | #endif /* !CONFIG_PCI */ |
976 | 992 | ||
977 | /* these helpers provide future and backwards compatibility | 993 | /* these helpers provide future and backwards compatibility |
@@ -1016,6 +1032,20 @@ static inline char *pci_name(struct pci_dev *pdev) | |||
1016 | #define pci_pretty_name(dev) "" | 1032 | #define pci_pretty_name(dev) "" |
1017 | #endif | 1033 | #endif |
1018 | 1034 | ||
1035 | |||
1036 | /* Some archs don't want to expose struct resource to userland as-is | ||
1037 | * in sysfs and /proc | ||
1038 | */ | ||
1039 | #ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER | ||
1040 | static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, | ||
1041 | const struct resource *rsrc, u64 *start, u64 *end) | ||
1042 | { | ||
1043 | *start = rsrc->start; | ||
1044 | *end = rsrc->end; | ||
1045 | } | ||
1046 | #endif /* HAVE_ARCH_PCI_RESOURCE_TO_USER */ | ||
1047 | |||
1048 | |||
1019 | /* | 1049 | /* |
1020 | * The world is not perfect and supplies us with broken PCI devices. | 1050 | * The world is not perfect and supplies us with broken PCI devices. |
1021 | * For at least a part of these bugs we need a work-around, so both | 1051 | * For at least a part of these bugs we need a work-around, so both |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 1e0bc6a8d653..27348c22dacb 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -62,6 +62,8 @@ | |||
62 | 62 | ||
63 | #define PCI_BASE_CLASS_SYSTEM 0x08 | 63 | #define PCI_BASE_CLASS_SYSTEM 0x08 |
64 | #define PCI_CLASS_SYSTEM_PIC 0x0800 | 64 | #define PCI_CLASS_SYSTEM_PIC 0x0800 |
65 | #define PCI_CLASS_SYSTEM_PIC_IOAPIC 0x080010 | ||
66 | #define PCI_CLASS_SYSTEM_PIC_IOXAPIC 0x080020 | ||
65 | #define PCI_CLASS_SYSTEM_DMA 0x0801 | 67 | #define PCI_CLASS_SYSTEM_DMA 0x0801 |
66 | #define PCI_CLASS_SYSTEM_TIMER 0x0802 | 68 | #define PCI_CLASS_SYSTEM_TIMER 0x0802 |
67 | #define PCI_CLASS_SYSTEM_RTC 0x0803 | 69 | #define PCI_CLASS_SYSTEM_RTC 0x0803 |
@@ -1236,6 +1238,7 @@ | |||
1236 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265 | 1238 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265 |
1237 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 | 1239 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 |
1238 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 | 1240 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 |
1241 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E | ||
1239 | #define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268 | 1242 | #define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268 |
1240 | #define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269 | 1243 | #define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269 |
1241 | #define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B | 1244 | #define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B |
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h index 25d2d67c1faf..bd2c5a2bbbf5 100644 --- a/include/linux/pkt_cls.h +++ b/include/linux/pkt_cls.h | |||
@@ -276,6 +276,7 @@ struct tc_rsvp_pinfo | |||
276 | __u8 protocol; | 276 | __u8 protocol; |
277 | __u8 tunnelid; | 277 | __u8 tunnelid; |
278 | __u8 tunnelhdr; | 278 | __u8 tunnelhdr; |
279 | __u8 pad; | ||
279 | }; | 280 | }; |
280 | 281 | ||
281 | /* ROUTE filter */ | 282 | /* ROUTE filter */ |
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index 1d9da36eb9db..60ffcb9c5791 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
@@ -221,9 +221,11 @@ struct tc_gred_qopt | |||
221 | /* gred setup */ | 221 | /* gred setup */ |
222 | struct tc_gred_sopt | 222 | struct tc_gred_sopt |
223 | { | 223 | { |
224 | __u32 DPs; | 224 | __u32 DPs; |
225 | __u32 def_DP; | 225 | __u32 def_DP; |
226 | __u8 grio; | 226 | __u8 grio; |
227 | __u8 pad1; | ||
228 | __u16 pad2; | ||
227 | }; | 229 | }; |
228 | 230 | ||
229 | /* HTB section */ | 231 | /* HTB section */ |
@@ -351,6 +353,7 @@ struct tc_cbq_ovl | |||
351 | #define TC_CBQ_OVL_DROP 3 | 353 | #define TC_CBQ_OVL_DROP 3 |
352 | #define TC_CBQ_OVL_RCLASSIC 4 | 354 | #define TC_CBQ_OVL_RCLASSIC 4 |
353 | unsigned char priority2; | 355 | unsigned char priority2; |
356 | __u16 pad; | ||
354 | __u32 penalty; | 357 | __u32 penalty; |
355 | }; | 358 | }; |
356 | 359 | ||
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index d021888b58f1..657c05ab8f9e 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -363,6 +363,8 @@ enum | |||
363 | struct rta_session | 363 | struct rta_session |
364 | { | 364 | { |
365 | __u8 proto; | 365 | __u8 proto; |
366 | __u8 pad1; | ||
367 | __u16 pad2; | ||
366 | 368 | ||
367 | union { | 369 | union { |
368 | struct { | 370 | struct { |
@@ -635,10 +637,13 @@ struct ifinfomsg | |||
635 | struct prefixmsg | 637 | struct prefixmsg |
636 | { | 638 | { |
637 | unsigned char prefix_family; | 639 | unsigned char prefix_family; |
640 | unsigned char prefix_pad1; | ||
641 | unsigned short prefix_pad2; | ||
638 | int prefix_ifindex; | 642 | int prefix_ifindex; |
639 | unsigned char prefix_type; | 643 | unsigned char prefix_type; |
640 | unsigned char prefix_len; | 644 | unsigned char prefix_len; |
641 | unsigned char prefix_flags; | 645 | unsigned char prefix_flags; |
646 | unsigned char prefix_pad3; | ||
642 | }; | 647 | }; |
643 | 648 | ||
644 | enum | 649 | enum |
@@ -898,7 +903,9 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi | |||
898 | memcpy(skb_put(skb, attrlen), data, attrlen); }) | 903 | memcpy(skb_put(skb, attrlen), data, attrlen); }) |
899 | 904 | ||
900 | #define RTA_PUT_NOHDR(skb, attrlen, data) \ | 905 | #define RTA_PUT_NOHDR(skb, attrlen, data) \ |
901 | RTA_APPEND(skb, RTA_ALIGN(attrlen), data) | 906 | ({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \ |
907 | memset(skb->tail - (RTA_ALIGN(attrlen) - attrlen), 0, \ | ||
908 | RTA_ALIGN(attrlen) - attrlen); }) | ||
902 | 909 | ||
903 | #define RTA_PUT_U8(skb, attrtype, value) \ | 910 | #define RTA_PUT_U8(skb, attrtype, value) \ |
904 | ({ u8 _tmp = (value); \ | 911 | ({ u8 _tmp = (value); \ |
@@ -978,6 +985,7 @@ __rta_reserve(struct sk_buff *skb, int attrtype, int attrlen) | |||
978 | rta = (struct rtattr*)skb_put(skb, RTA_ALIGN(size)); | 985 | rta = (struct rtattr*)skb_put(skb, RTA_ALIGN(size)); |
979 | rta->rta_type = attrtype; | 986 | rta->rta_type = attrtype; |
980 | rta->rta_len = size; | 987 | rta->rta_len = size; |
988 | memset(RTA_DATA(rta) + attrlen, 0, RTA_ALIGN(size) - size); | ||
981 | return rta; | 989 | return rta; |
982 | } | 990 | } |
983 | 991 | ||
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 416a2e4024b2..14b950413495 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -183,7 +183,6 @@ struct skb_shared_info { | |||
183 | * @priority: Packet queueing priority | 183 | * @priority: Packet queueing priority |
184 | * @users: User count - see {datagram,tcp}.c | 184 | * @users: User count - see {datagram,tcp}.c |
185 | * @protocol: Packet protocol from driver | 185 | * @protocol: Packet protocol from driver |
186 | * @security: Security level of packet | ||
187 | * @truesize: Buffer size | 186 | * @truesize: Buffer size |
188 | * @head: Head of buffer | 187 | * @head: Head of buffer |
189 | * @data: Data head pointer | 188 | * @data: Data head pointer |
@@ -249,18 +248,18 @@ struct sk_buff { | |||
249 | data_len, | 248 | data_len, |
250 | mac_len, | 249 | mac_len, |
251 | csum; | 250 | csum; |
252 | unsigned char local_df, | ||
253 | cloned:1, | ||
254 | nohdr:1, | ||
255 | pkt_type, | ||
256 | ip_summed; | ||
257 | __u32 priority; | 251 | __u32 priority; |
258 | unsigned short protocol, | 252 | __u8 local_df:1, |
259 | security; | 253 | cloned:1, |
254 | ip_summed:2, | ||
255 | nohdr:1; | ||
256 | /* 3 bits spare */ | ||
257 | __u8 pkt_type; | ||
258 | __u16 protocol; | ||
260 | 259 | ||
261 | void (*destructor)(struct sk_buff *skb); | 260 | void (*destructor)(struct sk_buff *skb); |
262 | #ifdef CONFIG_NETFILTER | 261 | #ifdef CONFIG_NETFILTER |
263 | unsigned long nfmark; | 262 | unsigned long nfmark; |
264 | __u32 nfcache; | 263 | __u32 nfcache; |
265 | __u32 nfctinfo; | 264 | __u32 nfctinfo; |
266 | struct nf_conntrack *nfct; | 265 | struct nf_conntrack *nfct; |
@@ -1211,7 +1210,7 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, | |||
1211 | { | 1210 | { |
1212 | int hlen = skb_headlen(skb); | 1211 | int hlen = skb_headlen(skb); |
1213 | 1212 | ||
1214 | if (offset + len <= hlen) | 1213 | if (hlen - offset >= len) |
1215 | return skb->data + offset; | 1214 | return skb->data + offset; |
1216 | 1215 | ||
1217 | if (skb_copy_bits(skb, offset, buffer, len) < 0) | 1216 | if (skb_copy_bits(skb, offset, buffer, len) < 0) |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index ebfe1250f0a4..5b5f434ac9a0 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -641,6 +641,7 @@ enum { | |||
641 | NET_SCTP_ADDIP_ENABLE = 13, | 641 | NET_SCTP_ADDIP_ENABLE = 13, |
642 | NET_SCTP_PRSCTP_ENABLE = 14, | 642 | NET_SCTP_PRSCTP_ENABLE = 14, |
643 | NET_SCTP_SNDBUF_POLICY = 15, | 643 | NET_SCTP_SNDBUF_POLICY = 15, |
644 | NET_SCTP_SACK_TIMEOUT = 16, | ||
644 | }; | 645 | }; |
645 | 646 | ||
646 | /* /proc/sys/net/bridge */ | 647 | /* /proc/sys/net/bridge */ |
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h index a6b2cc530af5..bcb762d93123 100644 --- a/include/linux/tc_ematch/tc_em_meta.h +++ b/include/linux/tc_ematch/tc_em_meta.h | |||
@@ -45,7 +45,7 @@ enum | |||
45 | TCF_META_ID_REALDEV, | 45 | TCF_META_ID_REALDEV, |
46 | TCF_META_ID_PRIORITY, | 46 | TCF_META_ID_PRIORITY, |
47 | TCF_META_ID_PROTOCOL, | 47 | TCF_META_ID_PROTOCOL, |
48 | TCF_META_ID_SECURITY, | 48 | TCF_META_ID_SECURITY, /* obsolete */ |
49 | TCF_META_ID_PKTTYPE, | 49 | TCF_META_ID_PKTTYPE, |
50 | TCF_META_ID_PKTLEN, | 50 | TCF_META_ID_PKTLEN, |
51 | TCF_META_ID_DATALEN, | 51 | TCF_META_ID_DATALEN, |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index dfd93d03f5d2..e4fd82e42104 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -286,7 +286,7 @@ struct tcp_sock { | |||
286 | __u32 max_window; /* Maximal window ever seen from peer */ | 286 | __u32 max_window; /* Maximal window ever seen from peer */ |
287 | __u32 pmtu_cookie; /* Last pmtu seen by socket */ | 287 | __u32 pmtu_cookie; /* Last pmtu seen by socket */ |
288 | __u32 mss_cache; /* Cached effective mss, not including SACKS */ | 288 | __u32 mss_cache; /* Cached effective mss, not including SACKS */ |
289 | __u16 mss_cache_std; /* Like mss_cache, but without TSO */ | 289 | __u16 xmit_size_goal; /* Goal for segmenting output packets */ |
290 | __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ | 290 | __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ |
291 | __u8 ca_state; /* State of fast-retransmit machine */ | 291 | __u8 ca_state; /* State of fast-retransmit machine */ |
292 | __u8 retransmits; /* Number of unrecovered RTO timeouts. */ | 292 | __u8 retransmits; /* Number of unrecovered RTO timeouts. */ |
diff --git a/include/linux/usb_ch9.h b/include/linux/usb_ch9.h index 39e7ff4ffd28..ee21e6bf3867 100644 --- a/include/linux/usb_ch9.h +++ b/include/linux/usb_ch9.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #ifndef __LINUX_USB_CH9_H | 19 | #ifndef __LINUX_USB_CH9_H |
20 | #define __LINUX_USB_CH9_H | 20 | #define __LINUX_USB_CH9_H |
21 | 21 | ||
22 | #include <asm/types.h> /* __u8 etc */ | 22 | #include <linux/types.h> /* __u8 etc */ |
23 | 23 | ||
24 | /*-------------------------------------------------------------------------*/ | 24 | /*-------------------------------------------------------------------------*/ |
25 | 25 | ||
@@ -294,8 +294,8 @@ struct usb_endpoint_descriptor { | |||
294 | __le16 wMaxPacketSize; | 294 | __le16 wMaxPacketSize; |
295 | __u8 bInterval; | 295 | __u8 bInterval; |
296 | 296 | ||
297 | // NOTE: these two are _only_ in audio endpoints. | 297 | /* NOTE: these two are _only_ in audio endpoints. */ |
298 | // use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. | 298 | /* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */ |
299 | __u8 bRefresh; | 299 | __u8 bRefresh; |
300 | __u8 bSynchAddress; | 300 | __u8 bSynchAddress; |
301 | } __attribute__ ((packed)); | 301 | } __attribute__ ((packed)); |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 4e0edce53760..acbfc525576d 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -221,6 +221,8 @@ struct v4l2_pix_format | |||
221 | /* Vendor-specific formats */ | 221 | /* Vendor-specific formats */ |
222 | #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */ | 222 | #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */ |
223 | #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */ | 223 | #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */ |
224 | #define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P','W','C','1') /* pwc older webcam */ | ||
225 | #define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */ | ||
224 | 226 | ||
225 | /* | 227 | /* |
226 | * F O R M A T E N U M E R A T I O N | 228 | * F O R M A T E N U M E R A T I O N |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index d5c3fe1bf33d..542dbaee6512 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -85,7 +85,7 @@ static inline void wait_on_inode(struct inode *inode) | |||
85 | /* | 85 | /* |
86 | * mm/page-writeback.c | 86 | * mm/page-writeback.c |
87 | */ | 87 | */ |
88 | int wakeup_bdflush(long nr_pages); | 88 | int wakeup_pdflush(long nr_pages); |
89 | void laptop_io_completion(void); | 89 | void laptop_io_completion(void); |
90 | void laptop_sync_completion(void); | 90 | void laptop_sync_completion(void); |
91 | void throttle_vm_writeout(void); | 91 | void throttle_vm_writeout(void); |
diff --git a/include/linux/xattr_acl.h b/include/linux/xattr_acl.h deleted file mode 100644 index 7a1f9b93a45f..000000000000 --- a/include/linux/xattr_acl.h +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | /* | ||
2 | File: linux/xattr_acl.h | ||
3 | |||
4 | (extended attribute representation of access control lists) | ||
5 | |||
6 | (C) 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org> | ||
7 | */ | ||
8 | |||
9 | #ifndef _LINUX_XATTR_ACL_H | ||
10 | #define _LINUX_XATTR_ACL_H | ||
11 | |||
12 | #include <linux/posix_acl.h> | ||
13 | |||
14 | #define XATTR_NAME_ACL_ACCESS "system.posix_acl_access" | ||
15 | #define XATTR_NAME_ACL_DEFAULT "system.posix_acl_default" | ||
16 | |||
17 | #define XATTR_ACL_VERSION 0x0002 | ||
18 | |||
19 | typedef struct { | ||
20 | __u16 e_tag; | ||
21 | __u16 e_perm; | ||
22 | __u32 e_id; | ||
23 | } xattr_acl_entry; | ||
24 | |||
25 | typedef struct { | ||
26 | __u32 a_version; | ||
27 | xattr_acl_entry a_entries[0]; | ||
28 | } xattr_acl_header; | ||
29 | |||
30 | static inline size_t xattr_acl_size(int count) | ||
31 | { | ||
32 | return sizeof(xattr_acl_header) + count * sizeof(xattr_acl_entry); | ||
33 | } | ||
34 | |||
35 | static inline int xattr_acl_count(size_t size) | ||
36 | { | ||
37 | if (size < sizeof(xattr_acl_header)) | ||
38 | return -1; | ||
39 | size -= sizeof(xattr_acl_header); | ||
40 | if (size % sizeof(xattr_acl_entry)) | ||
41 | return -1; | ||
42 | return size / sizeof(xattr_acl_entry); | ||
43 | } | ||
44 | |||
45 | struct posix_acl * posix_acl_from_xattr(const void *value, size_t size); | ||
46 | int posix_acl_to_xattr(const struct posix_acl *acl, void *buffer, size_t size); | ||
47 | |||
48 | |||
49 | |||
50 | #endif /* _LINUX_XATTR_ACL_H */ | ||
diff --git a/include/media/tuner.h b/include/media/tuner.h index 2dd8310901e8..4794c5632360 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h | |||
@@ -1,5 +1,6 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* $Id: tuner.h,v 1.33 2005/06/21 14:58:08 mkrufky Exp $ |
3 | * | ||
3 | tuner.h - definition for different tuners | 4 | tuner.h - definition for different tuners |
4 | 5 | ||
5 | Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de) | 6 | Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de) |
@@ -23,6 +24,8 @@ | |||
23 | #ifndef _TUNER_H | 24 | #ifndef _TUNER_H |
24 | #define _TUNER_H | 25 | #define _TUNER_H |
25 | 26 | ||
27 | #include <linux/videodev2.h> | ||
28 | |||
26 | #include "id.h" | 29 | #include "id.h" |
27 | 30 | ||
28 | #define ADDR_UNSET (255) | 31 | #define ADDR_UNSET (255) |
@@ -88,7 +91,7 @@ | |||
88 | #define TUNER_LG_NTSC_TAPE 47 | 91 | #define TUNER_LG_NTSC_TAPE 47 |
89 | 92 | ||
90 | #define TUNER_TNF_8831BGFF 48 | 93 | #define TUNER_TNF_8831BGFF 48 |
91 | #define TUNER_MICROTUNE_4042FI5 49 /* FusionHDTV 3 Gold - 4042 FI5 (3X 8147) */ | 94 | #define TUNER_MICROTUNE_4042FI5 49 /* DViCO FusionHDTV 3 Gold-Q - 4042 FI5 (3X 8147) */ |
92 | #define TUNER_TCL_2002N 50 | 95 | #define TUNER_TCL_2002N 50 |
93 | #define TUNER_PHILIPS_FM1256_IH3 51 | 96 | #define TUNER_PHILIPS_FM1256_IH3 51 |
94 | 97 | ||
@@ -98,18 +101,18 @@ | |||
98 | #define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */ | 101 | #define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */ |
99 | 102 | ||
100 | #define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ | 103 | #define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ |
101 | #define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ | 104 | #define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ |
102 | 105 | ||
103 | #define TUNER_YMEC_TVF_8531MF 58 | 106 | #define TUNER_YMEC_TVF_8531MF 58 |
104 | #define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ | 107 | #define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ |
105 | #define TUNER_THOMSON_DTT7611 60 | 108 | #define TUNER_THOMSON_DTT7611 60 /* DViCO FusionHDTV 3 Gold-T */ |
106 | #define TUNER_TENA_9533_DI 61 | 109 | #define TUNER_TENA_9533_DI 61 |
110 | |||
107 | #define TUNER_TEA5767 62 /* Only FM Radio Tuner */ | 111 | #define TUNER_TEA5767 62 /* Only FM Radio Tuner */ |
112 | #define TUNER_PHILIPS_FMD1216ME_MK3 63 | ||
108 | 113 | ||
109 | #define TEA5767_TUNER_NAME "Philips TEA5767HN FM Radio" | 114 | #define TEA5767_TUNER_NAME "Philips TEA5767HN FM Radio" |
110 | 115 | ||
111 | #define TUNER_THOMSON_DTT7611 60 | ||
112 | |||
113 | #define NOTUNER 0 | 116 | #define NOTUNER 0 |
114 | #define PAL 1 /* PAL_BG */ | 117 | #define PAL 1 /* PAL_BG */ |
115 | #define PAL_I 2 | 118 | #define PAL_I 2 |
@@ -194,11 +197,15 @@ struct tuner { | |||
194 | unsigned char i2c_easy_mode[2]; | 197 | unsigned char i2c_easy_mode[2]; |
195 | unsigned char i2c_set_freq[8]; | 198 | unsigned char i2c_set_freq[8]; |
196 | 199 | ||
200 | /* used to keep track of audmode */ | ||
201 | unsigned int audmode; | ||
202 | |||
197 | /* function ptrs */ | 203 | /* function ptrs */ |
198 | void (*tv_freq)(struct i2c_client *c, unsigned int freq); | 204 | void (*tv_freq)(struct i2c_client *c, unsigned int freq); |
199 | void (*radio_freq)(struct i2c_client *c, unsigned int freq); | 205 | void (*radio_freq)(struct i2c_client *c, unsigned int freq); |
200 | int (*has_signal)(struct i2c_client *c); | 206 | int (*has_signal)(struct i2c_client *c); |
201 | int (*is_stereo)(struct i2c_client *c); | 207 | int (*is_stereo)(struct i2c_client *c); |
208 | int (*set_tuner)(struct i2c_client *c, struct v4l2_tuner *v); | ||
202 | }; | 209 | }; |
203 | 210 | ||
204 | extern unsigned int tuner_debug; | 211 | extern unsigned int tuner_debug; |
@@ -206,6 +213,7 @@ extern unsigned const int tuner_count; | |||
206 | 213 | ||
207 | extern int microtune_init(struct i2c_client *c); | 214 | extern int microtune_init(struct i2c_client *c); |
208 | extern int tda8290_init(struct i2c_client *c); | 215 | extern int tda8290_init(struct i2c_client *c); |
216 | extern int tea5767_tuner_init(struct i2c_client *c); | ||
209 | extern int default_tuner_init(struct i2c_client *c); | 217 | extern int default_tuner_init(struct i2c_client *c); |
210 | 218 | ||
211 | #define tuner_warn(fmt, arg...) \ | 219 | #define tuner_warn(fmt, arg...) \ |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index 7fe57f957a51..db09580ad14b 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -94,6 +94,8 @@ struct eapol { | |||
94 | u16 length; | 94 | u16 length; |
95 | } __attribute__ ((packed)); | 95 | } __attribute__ ((packed)); |
96 | 96 | ||
97 | #define IEEE80211_1ADDR_LEN 10 | ||
98 | #define IEEE80211_2ADDR_LEN 16 | ||
97 | #define IEEE80211_3ADDR_LEN 24 | 99 | #define IEEE80211_3ADDR_LEN 24 |
98 | #define IEEE80211_4ADDR_LEN 30 | 100 | #define IEEE80211_4ADDR_LEN 30 |
99 | #define IEEE80211_FCS_LEN 4 | 101 | #define IEEE80211_FCS_LEN 4 |
@@ -300,23 +302,6 @@ struct ieee80211_snap_hdr { | |||
300 | #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9 | 302 | #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9 |
301 | 303 | ||
302 | 304 | ||
303 | /* Information Element IDs */ | ||
304 | #define WLAN_EID_SSID 0 | ||
305 | #define WLAN_EID_SUPP_RATES 1 | ||
306 | #define WLAN_EID_FH_PARAMS 2 | ||
307 | #define WLAN_EID_DS_PARAMS 3 | ||
308 | #define WLAN_EID_CF_PARAMS 4 | ||
309 | #define WLAN_EID_TIM 5 | ||
310 | #define WLAN_EID_IBSS_PARAMS 6 | ||
311 | #define WLAN_EID_CHALLENGE 16 | ||
312 | #define WLAN_EID_RSN 48 | ||
313 | #define WLAN_EID_GENERIC 221 | ||
314 | |||
315 | #define IEEE80211_MGMT_HDR_LEN 24 | ||
316 | #define IEEE80211_DATA_HDR3_LEN 24 | ||
317 | #define IEEE80211_DATA_HDR4_LEN 30 | ||
318 | |||
319 | |||
320 | #define IEEE80211_STATMASK_SIGNAL (1<<0) | 305 | #define IEEE80211_STATMASK_SIGNAL (1<<0) |
321 | #define IEEE80211_STATMASK_RSSI (1<<1) | 306 | #define IEEE80211_STATMASK_RSSI (1<<1) |
322 | #define IEEE80211_STATMASK_NOISE (1<<2) | 307 | #define IEEE80211_STATMASK_NOISE (1<<2) |
@@ -441,6 +426,10 @@ struct ieee80211_stats { | |||
441 | 426 | ||
442 | struct ieee80211_device; | 427 | struct ieee80211_device; |
443 | 428 | ||
429 | #if 0 /* for later */ | ||
430 | #include "ieee80211_crypt.h" | ||
431 | #endif | ||
432 | |||
444 | #define SEC_KEY_1 (1<<0) | 433 | #define SEC_KEY_1 (1<<0) |
445 | #define SEC_KEY_2 (1<<1) | 434 | #define SEC_KEY_2 (1<<1) |
446 | #define SEC_KEY_3 (1<<2) | 435 | #define SEC_KEY_3 (1<<2) |
@@ -488,15 +477,6 @@ Total: 28-2340 bytes | |||
488 | 477 | ||
489 | */ | 478 | */ |
490 | 479 | ||
491 | struct ieee80211_header_data { | ||
492 | u16 frame_ctl; | ||
493 | u16 duration_id; | ||
494 | u8 addr1[6]; | ||
495 | u8 addr2[6]; | ||
496 | u8 addr3[6]; | ||
497 | u16 seq_ctrl; | ||
498 | }; | ||
499 | |||
500 | #define BEACON_PROBE_SSID_ID_POSITION 12 | 480 | #define BEACON_PROBE_SSID_ID_POSITION 12 |
501 | 481 | ||
502 | /* Management Frame Information Element Types */ | 482 | /* Management Frame Information Element Types */ |
@@ -541,7 +521,7 @@ struct ieee80211_info_element { | |||
541 | */ | 521 | */ |
542 | 522 | ||
543 | struct ieee80211_authentication { | 523 | struct ieee80211_authentication { |
544 | struct ieee80211_header_data header; | 524 | struct ieee80211_hdr_3addr header; |
545 | u16 algorithm; | 525 | u16 algorithm; |
546 | u16 transaction; | 526 | u16 transaction; |
547 | u16 status; | 527 | u16 status; |
@@ -550,7 +530,7 @@ struct ieee80211_authentication { | |||
550 | 530 | ||
551 | 531 | ||
552 | struct ieee80211_probe_response { | 532 | struct ieee80211_probe_response { |
553 | struct ieee80211_header_data header; | 533 | struct ieee80211_hdr_3addr header; |
554 | u32 time_stamp[2]; | 534 | u32 time_stamp[2]; |
555 | u16 beacon_interval; | 535 | u16 beacon_interval; |
556 | u16 capability; | 536 | u16 capability; |
@@ -648,12 +628,6 @@ enum ieee80211_state { | |||
648 | #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] | 628 | #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] |
649 | 629 | ||
650 | 630 | ||
651 | extern inline int is_broadcast_ether_addr(const u8 *addr) | ||
652 | { | ||
653 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ | ||
654 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); | ||
655 | } | ||
656 | |||
657 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) | 631 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) |
658 | #define CFG_IEEE80211_COMPUTE_FCS (1<<1) | 632 | #define CFG_IEEE80211_COMPUTE_FCS (1<<1) |
659 | 633 | ||
@@ -787,21 +761,21 @@ extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mod | |||
787 | 761 | ||
788 | extern inline int ieee80211_get_hdrlen(u16 fc) | 762 | extern inline int ieee80211_get_hdrlen(u16 fc) |
789 | { | 763 | { |
790 | int hdrlen = 24; | 764 | int hdrlen = IEEE80211_3ADDR_LEN; |
791 | 765 | ||
792 | switch (WLAN_FC_GET_TYPE(fc)) { | 766 | switch (WLAN_FC_GET_TYPE(fc)) { |
793 | case IEEE80211_FTYPE_DATA: | 767 | case IEEE80211_FTYPE_DATA: |
794 | if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) | 768 | if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) |
795 | hdrlen = 30; /* Addr4 */ | 769 | hdrlen = IEEE80211_4ADDR_LEN; |
796 | break; | 770 | break; |
797 | case IEEE80211_FTYPE_CTL: | 771 | case IEEE80211_FTYPE_CTL: |
798 | switch (WLAN_FC_GET_STYPE(fc)) { | 772 | switch (WLAN_FC_GET_STYPE(fc)) { |
799 | case IEEE80211_STYPE_CTS: | 773 | case IEEE80211_STYPE_CTS: |
800 | case IEEE80211_STYPE_ACK: | 774 | case IEEE80211_STYPE_ACK: |
801 | hdrlen = 10; | 775 | hdrlen = IEEE80211_1ADDR_LEN; |
802 | break; | 776 | break; |
803 | default: | 777 | default: |
804 | hdrlen = 16; | 778 | hdrlen = IEEE80211_2ADDR_LEN; |
805 | break; | 779 | break; |
806 | } | 780 | } |
807 | break; | 781 | break; |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 771b47e30f86..69324465e8b3 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -183,7 +183,6 @@ struct ipv6_txoptions | |||
183 | struct ipv6_opt_hdr *hopopt; | 183 | struct ipv6_opt_hdr *hopopt; |
184 | struct ipv6_opt_hdr *dst0opt; | 184 | struct ipv6_opt_hdr *dst0opt; |
185 | struct ipv6_rt_hdr *srcrt; /* Routing Header */ | 185 | struct ipv6_rt_hdr *srcrt; /* Routing Header */ |
186 | struct ipv6_opt_hdr *auth; | ||
187 | struct ipv6_opt_hdr *dst1opt; | 186 | struct ipv6_opt_hdr *dst1opt; |
188 | 187 | ||
189 | /* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */ | 188 | /* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */ |
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index fcb05a387dbe..6492e7363d84 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -13,13 +13,12 @@ struct qdisc_walker | |||
13 | 13 | ||
14 | extern rwlock_t qdisc_tree_lock; | 14 | extern rwlock_t qdisc_tree_lock; |
15 | 15 | ||
16 | #define QDISC_ALIGN 32 | 16 | #define QDISC_ALIGNTO 32 |
17 | #define QDISC_ALIGN_CONST (QDISC_ALIGN - 1) | 17 | #define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1)) |
18 | 18 | ||
19 | static inline void *qdisc_priv(struct Qdisc *q) | 19 | static inline void *qdisc_priv(struct Qdisc *q) |
20 | { | 20 | { |
21 | return (char *)q + ((sizeof(struct Qdisc) + QDISC_ALIGN_CONST) | 21 | return (char *) q + QDISC_ALIGN(sizeof(struct Qdisc)); |
22 | & ~QDISC_ALIGN_CONST); | ||
23 | } | 22 | } |
24 | 23 | ||
25 | /* | 24 | /* |
@@ -207,8 +206,6 @@ psched_tod_diff(int delta_sec, int bound) | |||
207 | 206 | ||
208 | #endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ | 207 | #endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ |
209 | 208 | ||
210 | extern struct Qdisc noop_qdisc; | ||
211 | extern struct Qdisc_ops noop_qdisc_ops; | ||
212 | extern struct Qdisc_ops pfifo_qdisc_ops; | 209 | extern struct Qdisc_ops pfifo_qdisc_ops; |
213 | extern struct Qdisc_ops bfifo_qdisc_ops; | 210 | extern struct Qdisc_ops bfifo_qdisc_ops; |
214 | 211 | ||
@@ -216,14 +213,6 @@ extern int register_qdisc(struct Qdisc_ops *qops); | |||
216 | extern int unregister_qdisc(struct Qdisc_ops *qops); | 213 | extern int unregister_qdisc(struct Qdisc_ops *qops); |
217 | extern struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle); | 214 | extern struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle); |
218 | extern struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle); | 215 | extern struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle); |
219 | extern void dev_init_scheduler(struct net_device *dev); | ||
220 | extern void dev_shutdown(struct net_device *dev); | ||
221 | extern void dev_activate(struct net_device *dev); | ||
222 | extern void dev_deactivate(struct net_device *dev); | ||
223 | extern void qdisc_reset(struct Qdisc *qdisc); | ||
224 | extern void qdisc_destroy(struct Qdisc *qdisc); | ||
225 | extern struct Qdisc * qdisc_create_dflt(struct net_device *dev, | ||
226 | struct Qdisc_ops *ops); | ||
227 | extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, | 216 | extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, |
228 | struct rtattr *tab); | 217 | struct rtattr *tab); |
229 | extern void qdisc_put_rtab(struct qdisc_rate_table *tab); | 218 | extern void qdisc_put_rtab(struct qdisc_rate_table *tab); |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 7b97405e2dbf..7b6ec9986715 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -164,6 +164,19 @@ extern void qdisc_unlock_tree(struct net_device *dev); | |||
164 | #define tcf_tree_lock(tp) qdisc_lock_tree((tp)->q->dev) | 164 | #define tcf_tree_lock(tp) qdisc_lock_tree((tp)->q->dev) |
165 | #define tcf_tree_unlock(tp) qdisc_unlock_tree((tp)->q->dev) | 165 | #define tcf_tree_unlock(tp) qdisc_unlock_tree((tp)->q->dev) |
166 | 166 | ||
167 | extern struct Qdisc noop_qdisc; | ||
168 | extern struct Qdisc_ops noop_qdisc_ops; | ||
169 | |||
170 | extern void dev_init_scheduler(struct net_device *dev); | ||
171 | extern void dev_shutdown(struct net_device *dev); | ||
172 | extern void dev_activate(struct net_device *dev); | ||
173 | extern void dev_deactivate(struct net_device *dev); | ||
174 | extern void qdisc_reset(struct Qdisc *qdisc); | ||
175 | extern void qdisc_destroy(struct Qdisc *qdisc); | ||
176 | extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops); | ||
177 | extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, | ||
178 | struct Qdisc_ops *ops); | ||
179 | |||
167 | static inline void | 180 | static inline void |
168 | tcf_destroy(struct tcf_proto *tp) | 181 | tcf_destroy(struct tcf_proto *tp) |
169 | { | 182 | { |
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index 4868c7f7749d..5999e5684bbf 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
@@ -263,23 +263,11 @@ enum { SCTP_MIN_PMTU = 576 }; | |||
263 | enum { SCTP_MAX_DUP_TSNS = 16 }; | 263 | enum { SCTP_MAX_DUP_TSNS = 16 }; |
264 | enum { SCTP_MAX_GABS = 16 }; | 264 | enum { SCTP_MAX_GABS = 16 }; |
265 | 265 | ||
266 | /* Here we define the default timers. */ | 266 | /* Heartbeat interval - 30 secs */ |
267 | #define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (30 * HZ) | ||
267 | 268 | ||
268 | /* cookie timer def = ? seconds */ | 269 | /* Delayed sack timer - 200ms */ |
269 | #define SCTP_DEFAULT_TIMEOUT_T1_COOKIE (3 * HZ) | ||
270 | |||
271 | /* init timer def = 3 seconds */ | ||
272 | #define SCTP_DEFAULT_TIMEOUT_T1_INIT (3 * HZ) | ||
273 | |||
274 | /* shutdown timer def = 300 ms */ | ||
275 | #define SCTP_DEFAULT_TIMEOUT_T2_SHUTDOWN ((300 * HZ) / 1000) | ||
276 | |||
277 | /* 0 seconds + RTO */ | ||
278 | #define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (10 * HZ) | ||
279 | |||
280 | /* recv timer def = 200ms (in usec) */ | ||
281 | #define SCTP_DEFAULT_TIMEOUT_SACK ((200 * HZ) / 1000) | 270 | #define SCTP_DEFAULT_TIMEOUT_SACK ((200 * HZ) / 1000) |
282 | #define SCTP_DEFAULT_TIMEOUT_SACK_MAX ((500 * HZ) / 1000) /* 500 ms */ | ||
283 | 271 | ||
284 | /* RTO.Initial - 3 seconds | 272 | /* RTO.Initial - 3 seconds |
285 | * RTO.Min - 1 second | 273 | * RTO.Min - 1 second |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index dfad4d3c581c..47727c7cc628 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -161,6 +161,9 @@ extern struct sctp_globals { | |||
161 | */ | 161 | */ |
162 | int sndbuf_policy; | 162 | int sndbuf_policy; |
163 | 163 | ||
164 | /* Delayed SACK timeout 200ms default*/ | ||
165 | int sack_timeout; | ||
166 | |||
164 | /* HB.interval - 30 seconds */ | 167 | /* HB.interval - 30 seconds */ |
165 | int hb_interval; | 168 | int hb_interval; |
166 | 169 | ||
@@ -217,6 +220,7 @@ extern struct sctp_globals { | |||
217 | #define sctp_sndbuf_policy (sctp_globals.sndbuf_policy) | 220 | #define sctp_sndbuf_policy (sctp_globals.sndbuf_policy) |
218 | #define sctp_max_retrans_path (sctp_globals.max_retrans_path) | 221 | #define sctp_max_retrans_path (sctp_globals.max_retrans_path) |
219 | #define sctp_max_retrans_init (sctp_globals.max_retrans_init) | 222 | #define sctp_max_retrans_init (sctp_globals.max_retrans_init) |
223 | #define sctp_sack_timeout (sctp_globals.sack_timeout) | ||
220 | #define sctp_hb_interval (sctp_globals.hb_interval) | 224 | #define sctp_hb_interval (sctp_globals.hb_interval) |
221 | #define sctp_max_instreams (sctp_globals.max_instreams) | 225 | #define sctp_max_instreams (sctp_globals.max_instreams) |
222 | #define sctp_max_outstreams (sctp_globals.max_outstreams) | 226 | #define sctp_max_outstreams (sctp_globals.max_outstreams) |
diff --git a/include/net/slhc_vj.h b/include/net/slhc_vj.h index 0b2c2784f333..8716d5942b65 100644 --- a/include/net/slhc_vj.h +++ b/include/net/slhc_vj.h | |||
@@ -170,19 +170,14 @@ struct slcompress { | |||
170 | }; | 170 | }; |
171 | #define NULLSLCOMPR (struct slcompress *)0 | 171 | #define NULLSLCOMPR (struct slcompress *)0 |
172 | 172 | ||
173 | #define __ARGS(x) x | ||
174 | |||
175 | /* In slhc.c: */ | 173 | /* In slhc.c: */ |
176 | struct slcompress *slhc_init __ARGS((int rslots, int tslots)); | 174 | struct slcompress *slhc_init(int rslots, int tslots); |
177 | void slhc_free __ARGS((struct slcompress *comp)); | 175 | void slhc_free(struct slcompress *comp); |
178 | 176 | ||
179 | int slhc_compress __ARGS((struct slcompress *comp, unsigned char *icp, | 177 | int slhc_compress(struct slcompress *comp, unsigned char *icp, int isize, |
180 | int isize, unsigned char *ocp, unsigned char **cpp, | 178 | unsigned char *ocp, unsigned char **cpp, int compress_cid); |
181 | int compress_cid)); | 179 | int slhc_uncompress(struct slcompress *comp, unsigned char *icp, int isize); |
182 | int slhc_uncompress __ARGS((struct slcompress *comp, unsigned char *icp, | 180 | int slhc_remember(struct slcompress *comp, unsigned char *icp, int isize); |
183 | int isize)); | 181 | int slhc_toss(struct slcompress *comp); |
184 | int slhc_remember __ARGS((struct slcompress *comp, unsigned char *icp, | ||
185 | int isize)); | ||
186 | int slhc_toss __ARGS((struct slcompress *comp)); | ||
187 | 182 | ||
188 | #endif /* _SLHC_H */ | 183 | #endif /* _SLHC_H */ |
diff --git a/include/net/sock.h b/include/net/sock.h index e593af5b1ecc..7b76f891ae2d 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1134,13 +1134,16 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk) | |||
1134 | static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, | 1134 | static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, |
1135 | int size, int mem, int gfp) | 1135 | int size, int mem, int gfp) |
1136 | { | 1136 | { |
1137 | struct sk_buff *skb = alloc_skb(size + sk->sk_prot->max_header, gfp); | 1137 | struct sk_buff *skb; |
1138 | int hdr_len; | ||
1138 | 1139 | ||
1140 | hdr_len = SKB_DATA_ALIGN(sk->sk_prot->max_header); | ||
1141 | skb = alloc_skb(size + hdr_len, gfp); | ||
1139 | if (skb) { | 1142 | if (skb) { |
1140 | skb->truesize += mem; | 1143 | skb->truesize += mem; |
1141 | if (sk->sk_forward_alloc >= (int)skb->truesize || | 1144 | if (sk->sk_forward_alloc >= (int)skb->truesize || |
1142 | sk_stream_mem_schedule(sk, skb->truesize, 0)) { | 1145 | sk_stream_mem_schedule(sk, skb->truesize, 0)) { |
1143 | skb_reserve(skb, sk->sk_prot->max_header); | 1146 | skb_reserve(skb, hdr_len); |
1144 | return skb; | 1147 | return skb; |
1145 | } | 1148 | } |
1146 | __kfree_skb(skb); | 1149 | __kfree_skb(skb); |
diff --git a/include/net/tcp.h b/include/net/tcp.h index ec9e20c27179..a166918ca56d 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -721,11 +721,16 @@ static inline int tcp_ack_scheduled(struct tcp_sock *tp) | |||
721 | return tp->ack.pending&TCP_ACK_SCHED; | 721 | return tp->ack.pending&TCP_ACK_SCHED; |
722 | } | 722 | } |
723 | 723 | ||
724 | static __inline__ void tcp_dec_quickack_mode(struct tcp_sock *tp) | 724 | static __inline__ void tcp_dec_quickack_mode(struct tcp_sock *tp, unsigned int pkts) |
725 | { | 725 | { |
726 | if (tp->ack.quick && --tp->ack.quick == 0) { | 726 | if (tp->ack.quick) { |
727 | /* Leaving quickack mode we deflate ATO. */ | 727 | if (pkts >= tp->ack.quick) { |
728 | tp->ack.ato = TCP_ATO_MIN; | 728 | tp->ack.quick = 0; |
729 | |||
730 | /* Leaving quickack mode we deflate ATO. */ | ||
731 | tp->ack.ato = TCP_ATO_MIN; | ||
732 | } else | ||
733 | tp->ack.quick -= pkts; | ||
729 | } | 734 | } |
730 | } | 735 | } |
731 | 736 | ||
@@ -843,7 +848,9 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, | |||
843 | 848 | ||
844 | /* tcp_output.c */ | 849 | /* tcp_output.c */ |
845 | 850 | ||
846 | extern int tcp_write_xmit(struct sock *, int nonagle); | 851 | extern void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp, |
852 | unsigned int cur_mss, int nonagle); | ||
853 | extern int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp); | ||
847 | extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); | 854 | extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); |
848 | extern void tcp_xmit_retransmit_queue(struct sock *); | 855 | extern void tcp_xmit_retransmit_queue(struct sock *); |
849 | extern void tcp_simple_retransmit(struct sock *); | 856 | extern void tcp_simple_retransmit(struct sock *); |
@@ -855,10 +862,13 @@ extern int tcp_write_wakeup(struct sock *); | |||
855 | extern void tcp_send_fin(struct sock *sk); | 862 | extern void tcp_send_fin(struct sock *sk); |
856 | extern void tcp_send_active_reset(struct sock *sk, int priority); | 863 | extern void tcp_send_active_reset(struct sock *sk, int priority); |
857 | extern int tcp_send_synack(struct sock *); | 864 | extern int tcp_send_synack(struct sock *); |
858 | extern void tcp_push_one(struct sock *, unsigned mss_now); | 865 | extern void tcp_push_one(struct sock *, unsigned int mss_now); |
859 | extern void tcp_send_ack(struct sock *sk); | 866 | extern void tcp_send_ack(struct sock *sk); |
860 | extern void tcp_send_delayed_ack(struct sock *sk); | 867 | extern void tcp_send_delayed_ack(struct sock *sk); |
861 | 868 | ||
869 | /* tcp_input.c */ | ||
870 | extern void tcp_cwnd_application_limited(struct sock *sk); | ||
871 | |||
862 | /* tcp_timer.c */ | 872 | /* tcp_timer.c */ |
863 | extern void tcp_init_xmit_timers(struct sock *); | 873 | extern void tcp_init_xmit_timers(struct sock *); |
864 | extern void tcp_clear_xmit_timers(struct sock *); | 874 | extern void tcp_clear_xmit_timers(struct sock *); |
@@ -958,7 +968,7 @@ static inline void tcp_reset_xmit_timer(struct sock *sk, int what, unsigned long | |||
958 | static inline void tcp_initialize_rcv_mss(struct sock *sk) | 968 | static inline void tcp_initialize_rcv_mss(struct sock *sk) |
959 | { | 969 | { |
960 | struct tcp_sock *tp = tcp_sk(sk); | 970 | struct tcp_sock *tp = tcp_sk(sk); |
961 | unsigned int hint = min(tp->advmss, tp->mss_cache_std); | 971 | unsigned int hint = min_t(unsigned int, tp->advmss, tp->mss_cache); |
962 | 972 | ||
963 | hint = min(hint, tp->rcv_wnd/2); | 973 | hint = min(hint, tp->rcv_wnd/2); |
964 | hint = min(hint, TCP_MIN_RCVMSS); | 974 | hint = min(hint, TCP_MIN_RCVMSS); |
@@ -1225,28 +1235,6 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp) | |||
1225 | tp->left_out = tp->sacked_out + tp->lost_out; | 1235 | tp->left_out = tp->sacked_out + tp->lost_out; |
1226 | } | 1236 | } |
1227 | 1237 | ||
1228 | extern void tcp_cwnd_application_limited(struct sock *sk); | ||
1229 | |||
1230 | /* Congestion window validation. (RFC2861) */ | ||
1231 | |||
1232 | static inline void tcp_cwnd_validate(struct sock *sk, struct tcp_sock *tp) | ||
1233 | { | ||
1234 | __u32 packets_out = tp->packets_out; | ||
1235 | |||
1236 | if (packets_out >= tp->snd_cwnd) { | ||
1237 | /* Network is feed fully. */ | ||
1238 | tp->snd_cwnd_used = 0; | ||
1239 | tp->snd_cwnd_stamp = tcp_time_stamp; | ||
1240 | } else { | ||
1241 | /* Network starves. */ | ||
1242 | if (tp->packets_out > tp->snd_cwnd_used) | ||
1243 | tp->snd_cwnd_used = tp->packets_out; | ||
1244 | |||
1245 | if ((s32)(tcp_time_stamp - tp->snd_cwnd_stamp) >= tp->rto) | ||
1246 | tcp_cwnd_application_limited(sk); | ||
1247 | } | ||
1248 | } | ||
1249 | |||
1250 | /* Set slow start threshould and cwnd not falling to slow start */ | 1238 | /* Set slow start threshould and cwnd not falling to slow start */ |
1251 | static inline void __tcp_enter_cwr(struct tcp_sock *tp) | 1239 | static inline void __tcp_enter_cwr(struct tcp_sock *tp) |
1252 | { | 1240 | { |
@@ -1279,12 +1267,6 @@ static __inline__ __u32 tcp_max_burst(const struct tcp_sock *tp) | |||
1279 | return 3; | 1267 | return 3; |
1280 | } | 1268 | } |
1281 | 1269 | ||
1282 | static __inline__ int tcp_minshall_check(const struct tcp_sock *tp) | ||
1283 | { | ||
1284 | return after(tp->snd_sml,tp->snd_una) && | ||
1285 | !after(tp->snd_sml, tp->snd_nxt); | ||
1286 | } | ||
1287 | |||
1288 | static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss, | 1270 | static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss, |
1289 | const struct sk_buff *skb) | 1271 | const struct sk_buff *skb) |
1290 | { | 1272 | { |
@@ -1292,122 +1274,18 @@ static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss, | |||
1292 | tp->snd_sml = TCP_SKB_CB(skb)->end_seq; | 1274 | tp->snd_sml = TCP_SKB_CB(skb)->end_seq; |
1293 | } | 1275 | } |
1294 | 1276 | ||
1295 | /* Return 0, if packet can be sent now without violation Nagle's rules: | ||
1296 | 1. It is full sized. | ||
1297 | 2. Or it contains FIN. | ||
1298 | 3. Or TCP_NODELAY was set. | ||
1299 | 4. Or TCP_CORK is not set, and all sent packets are ACKed. | ||
1300 | With Minshall's modification: all sent small packets are ACKed. | ||
1301 | */ | ||
1302 | |||
1303 | static __inline__ int | ||
1304 | tcp_nagle_check(const struct tcp_sock *tp, const struct sk_buff *skb, | ||
1305 | unsigned mss_now, int nonagle) | ||
1306 | { | ||
1307 | return (skb->len < mss_now && | ||
1308 | !(TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN) && | ||
1309 | ((nonagle&TCP_NAGLE_CORK) || | ||
1310 | (!nonagle && | ||
1311 | tp->packets_out && | ||
1312 | tcp_minshall_check(tp)))); | ||
1313 | } | ||
1314 | |||
1315 | extern void tcp_set_skb_tso_segs(struct sock *, struct sk_buff *); | ||
1316 | |||
1317 | /* This checks if the data bearing packet SKB (usually sk->sk_send_head) | ||
1318 | * should be put on the wire right now. | ||
1319 | */ | ||
1320 | static __inline__ int tcp_snd_test(struct sock *sk, | ||
1321 | struct sk_buff *skb, | ||
1322 | unsigned cur_mss, int nonagle) | ||
1323 | { | ||
1324 | struct tcp_sock *tp = tcp_sk(sk); | ||
1325 | int pkts = tcp_skb_pcount(skb); | ||
1326 | |||
1327 | if (!pkts) { | ||
1328 | tcp_set_skb_tso_segs(sk, skb); | ||
1329 | pkts = tcp_skb_pcount(skb); | ||
1330 | } | ||
1331 | |||
1332 | /* RFC 1122 - section 4.2.3.4 | ||
1333 | * | ||
1334 | * We must queue if | ||
1335 | * | ||
1336 | * a) The right edge of this frame exceeds the window | ||
1337 | * b) There are packets in flight and we have a small segment | ||
1338 | * [SWS avoidance and Nagle algorithm] | ||
1339 | * (part of SWS is done on packetization) | ||
1340 | * Minshall version sounds: there are no _small_ | ||
1341 | * segments in flight. (tcp_nagle_check) | ||
1342 | * c) We have too many packets 'in flight' | ||
1343 | * | ||
1344 | * Don't use the nagle rule for urgent data (or | ||
1345 | * for the final FIN -DaveM). | ||
1346 | * | ||
1347 | * Also, Nagle rule does not apply to frames, which | ||
1348 | * sit in the middle of queue (they have no chances | ||
1349 | * to get new data) and if room at tail of skb is | ||
1350 | * not enough to save something seriously (<32 for now). | ||
1351 | */ | ||
1352 | |||
1353 | /* Don't be strict about the congestion window for the | ||
1354 | * final FIN frame. -DaveM | ||
1355 | */ | ||
1356 | return (((nonagle&TCP_NAGLE_PUSH) || tp->urg_mode | ||
1357 | || !tcp_nagle_check(tp, skb, cur_mss, nonagle)) && | ||
1358 | (((tcp_packets_in_flight(tp) + (pkts-1)) < tp->snd_cwnd) || | ||
1359 | (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN)) && | ||
1360 | !after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd)); | ||
1361 | } | ||
1362 | |||
1363 | static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) | 1277 | static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) |
1364 | { | 1278 | { |
1365 | if (!tp->packets_out && !tp->pending) | 1279 | if (!tp->packets_out && !tp->pending) |
1366 | tcp_reset_xmit_timer(sk, TCP_TIME_PROBE0, tp->rto); | 1280 | tcp_reset_xmit_timer(sk, TCP_TIME_PROBE0, tp->rto); |
1367 | } | 1281 | } |
1368 | 1282 | ||
1369 | static __inline__ int tcp_skb_is_last(const struct sock *sk, | ||
1370 | const struct sk_buff *skb) | ||
1371 | { | ||
1372 | return skb->next == (struct sk_buff *)&sk->sk_write_queue; | ||
1373 | } | ||
1374 | |||
1375 | /* Push out any pending frames which were held back due to | ||
1376 | * TCP_CORK or attempt at coalescing tiny packets. | ||
1377 | * The socket must be locked by the caller. | ||
1378 | */ | ||
1379 | static __inline__ void __tcp_push_pending_frames(struct sock *sk, | ||
1380 | struct tcp_sock *tp, | ||
1381 | unsigned cur_mss, | ||
1382 | int nonagle) | ||
1383 | { | ||
1384 | struct sk_buff *skb = sk->sk_send_head; | ||
1385 | |||
1386 | if (skb) { | ||
1387 | if (!tcp_skb_is_last(sk, skb)) | ||
1388 | nonagle = TCP_NAGLE_PUSH; | ||
1389 | if (!tcp_snd_test(sk, skb, cur_mss, nonagle) || | ||
1390 | tcp_write_xmit(sk, nonagle)) | ||
1391 | tcp_check_probe_timer(sk, tp); | ||
1392 | } | ||
1393 | tcp_cwnd_validate(sk, tp); | ||
1394 | } | ||
1395 | |||
1396 | static __inline__ void tcp_push_pending_frames(struct sock *sk, | 1283 | static __inline__ void tcp_push_pending_frames(struct sock *sk, |
1397 | struct tcp_sock *tp) | 1284 | struct tcp_sock *tp) |
1398 | { | 1285 | { |
1399 | __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); | 1286 | __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); |
1400 | } | 1287 | } |
1401 | 1288 | ||
1402 | static __inline__ int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp) | ||
1403 | { | ||
1404 | struct sk_buff *skb = sk->sk_send_head; | ||
1405 | |||
1406 | return (skb && | ||
1407 | tcp_snd_test(sk, skb, tcp_current_mss(sk, 1), | ||
1408 | tcp_skb_is_last(sk, skb) ? TCP_NAGLE_PUSH : tp->nonagle)); | ||
1409 | } | ||
1410 | |||
1411 | static __inline__ void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) | 1289 | static __inline__ void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) |
1412 | { | 1290 | { |
1413 | tp->snd_wl1 = seq; | 1291 | tp->snd_wl1 = seq; |
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c index 4def882d0b31..a05cabd0fd10 100644 --- a/init/do_mounts_initrd.c +++ b/init/do_mounts_initrd.c | |||
@@ -86,7 +86,10 @@ static void __init handle_initrd(void) | |||
86 | printk("okay\n"); | 86 | printk("okay\n"); |
87 | else { | 87 | else { |
88 | int fd = sys_open("/dev/root.old", O_RDWR, 0); | 88 | int fd = sys_open("/dev/root.old", O_RDWR, 0); |
89 | printk("failed\n"); | 89 | if (error == -ENOENT) |
90 | printk("/initrd does not exist. Ignored.\n"); | ||
91 | else | ||
92 | printk("failed\n"); | ||
90 | printk(KERN_NOTICE "Unmounting old root\n"); | 93 | printk(KERN_NOTICE "Unmounting old root\n"); |
91 | sys_umount("/old", MNT_DETACH); | 94 | sys_umount("/old", MNT_DETACH); |
92 | printk(KERN_NOTICE "Trying to free ramdisk memory ... "); | 95 | printk(KERN_NOTICE "Trying to free ramdisk memory ... "); |
diff --git a/init/main.c b/init/main.c index d324801729ba..b5e421e39ede 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -383,6 +383,13 @@ static void noinline rest_init(void) | |||
383 | numa_default_policy(); | 383 | numa_default_policy(); |
384 | unlock_kernel(); | 384 | unlock_kernel(); |
385 | preempt_enable_no_resched(); | 385 | preempt_enable_no_resched(); |
386 | |||
387 | /* | ||
388 | * The boot idle thread must execute schedule() | ||
389 | * at least one to get things moving: | ||
390 | */ | ||
391 | schedule(); | ||
392 | |||
386 | cpu_idle(); | 393 | cpu_idle(); |
387 | } | 394 | } |
388 | 395 | ||
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c index 98d62d8efeaf..3467097ca61a 100644 --- a/kernel/irq/autoprobe.c +++ b/kernel/irq/autoprobe.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/irq.h> | 9 | #include <linux/irq.h> |
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
12 | #include <linux/delay.h> | ||
12 | 13 | ||
13 | /* | 14 | /* |
14 | * Autodetection depends on the fact that any interrupt that | 15 | * Autodetection depends on the fact that any interrupt that |
@@ -26,7 +27,7 @@ static DECLARE_MUTEX(probe_sem); | |||
26 | */ | 27 | */ |
27 | unsigned long probe_irq_on(void) | 28 | unsigned long probe_irq_on(void) |
28 | { | 29 | { |
29 | unsigned long val, delay; | 30 | unsigned long val; |
30 | irq_desc_t *desc; | 31 | irq_desc_t *desc; |
31 | unsigned int i; | 32 | unsigned int i; |
32 | 33 | ||
@@ -45,8 +46,7 @@ unsigned long probe_irq_on(void) | |||
45 | } | 46 | } |
46 | 47 | ||
47 | /* Wait for longstanding interrupts to trigger. */ | 48 | /* Wait for longstanding interrupts to trigger. */ |
48 | for (delay = jiffies + HZ/50; time_after(delay, jiffies); ) | 49 | msleep(20); |
49 | /* about 20ms delay */ barrier(); | ||
50 | 50 | ||
51 | /* | 51 | /* |
52 | * enable any unassigned irqs | 52 | * enable any unassigned irqs |
@@ -68,8 +68,7 @@ unsigned long probe_irq_on(void) | |||
68 | /* | 68 | /* |
69 | * Wait for spurious interrupts to trigger | 69 | * Wait for spurious interrupts to trigger |
70 | */ | 70 | */ |
71 | for (delay = jiffies + HZ/10; time_after(delay, jiffies); ) | 71 | msleep(100); |
72 | /* about 100ms delay */ barrier(); | ||
73 | 72 | ||
74 | /* | 73 | /* |
75 | * Now filter out any obviously spurious interrupts | 74 | * Now filter out any obviously spurious interrupts |
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 436c7d93c00a..c29f83c16497 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -172,7 +172,7 @@ fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs) | |||
172 | 172 | ||
173 | spin_lock(&desc->lock); | 173 | spin_lock(&desc->lock); |
174 | if (!noirqdebug) | 174 | if (!noirqdebug) |
175 | note_interrupt(irq, desc, action_ret); | 175 | note_interrupt(irq, desc, action_ret, regs); |
176 | if (likely(!(desc->status & IRQ_PENDING))) | 176 | if (likely(!(desc->status & IRQ_PENDING))) |
177 | break; | 177 | break; |
178 | desc->status &= ~IRQ_PENDING; | 178 | desc->status &= ~IRQ_PENDING; |
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index ba039e827d58..7df9abd5ec86 100644 --- a/kernel/irq/spurious.c +++ b/kernel/irq/spurious.c | |||
@@ -11,6 +11,83 @@ | |||
11 | #include <linux/kallsyms.h> | 11 | #include <linux/kallsyms.h> |
12 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
13 | 13 | ||
14 | static int irqfixup; | ||
15 | |||
16 | /* | ||
17 | * Recovery handler for misrouted interrupts. | ||
18 | */ | ||
19 | |||
20 | static int misrouted_irq(int irq, struct pt_regs *regs) | ||
21 | { | ||
22 | int i; | ||
23 | irq_desc_t *desc; | ||
24 | int ok = 0; | ||
25 | int work = 0; /* Did we do work for a real IRQ */ | ||
26 | |||
27 | for(i = 1; i < NR_IRQS; i++) { | ||
28 | struct irqaction *action; | ||
29 | |||
30 | if (i == irq) /* Already tried */ | ||
31 | continue; | ||
32 | desc = &irq_desc[i]; | ||
33 | spin_lock(&desc->lock); | ||
34 | action = desc->action; | ||
35 | /* Already running on another processor */ | ||
36 | if (desc->status & IRQ_INPROGRESS) { | ||
37 | /* | ||
38 | * Already running: If it is shared get the other | ||
39 | * CPU to go looking for our mystery interrupt too | ||
40 | */ | ||
41 | if (desc->action && (desc->action->flags & SA_SHIRQ)) | ||
42 | desc->status |= IRQ_PENDING; | ||
43 | spin_unlock(&desc->lock); | ||
44 | continue; | ||
45 | } | ||
46 | /* Honour the normal IRQ locking */ | ||
47 | desc->status |= IRQ_INPROGRESS; | ||
48 | spin_unlock(&desc->lock); | ||
49 | while (action) { | ||
50 | /* Only shared IRQ handlers are safe to call */ | ||
51 | if (action->flags & SA_SHIRQ) { | ||
52 | if (action->handler(i, action->dev_id, regs) == | ||
53 | IRQ_HANDLED) | ||
54 | ok = 1; | ||
55 | } | ||
56 | action = action->next; | ||
57 | } | ||
58 | local_irq_disable(); | ||
59 | /* Now clean up the flags */ | ||
60 | spin_lock(&desc->lock); | ||
61 | action = desc->action; | ||
62 | |||
63 | /* | ||
64 | * While we were looking for a fixup someone queued a real | ||
65 | * IRQ clashing with our walk | ||
66 | */ | ||
67 | |||
68 | while ((desc->status & IRQ_PENDING) && action) { | ||
69 | /* | ||
70 | * Perform real IRQ processing for the IRQ we deferred | ||
71 | */ | ||
72 | work = 1; | ||
73 | spin_unlock(&desc->lock); | ||
74 | handle_IRQ_event(i, regs, action); | ||
75 | spin_lock(&desc->lock); | ||
76 | desc->status &= ~IRQ_PENDING; | ||
77 | } | ||
78 | desc->status &= ~IRQ_INPROGRESS; | ||
79 | /* | ||
80 | * If we did actual work for the real IRQ line we must let the | ||
81 | * IRQ controller clean up too | ||
82 | */ | ||
83 | if(work) | ||
84 | desc->handler->end(i); | ||
85 | spin_unlock(&desc->lock); | ||
86 | } | ||
87 | /* So the caller can adjust the irq error counts */ | ||
88 | return ok; | ||
89 | } | ||
90 | |||
14 | /* | 91 | /* |
15 | * If 99,900 of the previous 100,000 interrupts have not been handled | 92 | * If 99,900 of the previous 100,000 interrupts have not been handled |
16 | * then assume that the IRQ is stuck in some manner. Drop a diagnostic | 93 | * then assume that the IRQ is stuck in some manner. Drop a diagnostic |
@@ -31,7 +108,8 @@ __report_bad_irq(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret) | |||
31 | printk(KERN_ERR "irq event %d: bogus return value %x\n", | 108 | printk(KERN_ERR "irq event %d: bogus return value %x\n", |
32 | irq, action_ret); | 109 | irq, action_ret); |
33 | } else { | 110 | } else { |
34 | printk(KERN_ERR "irq %d: nobody cared!\n", irq); | 111 | printk(KERN_ERR "irq %d: nobody cared (try booting with " |
112 | "the \"irqpoll\" option)\n", irq); | ||
35 | } | 113 | } |
36 | dump_stack(); | 114 | dump_stack(); |
37 | printk(KERN_ERR "handlers:\n"); | 115 | printk(KERN_ERR "handlers:\n"); |
@@ -55,7 +133,8 @@ static void report_bad_irq(unsigned int irq, irq_desc_t *desc, irqreturn_t actio | |||
55 | } | 133 | } |
56 | } | 134 | } |
57 | 135 | ||
58 | void note_interrupt(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret) | 136 | void note_interrupt(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret, |
137 | struct pt_regs *regs) | ||
59 | { | 138 | { |
60 | if (action_ret != IRQ_HANDLED) { | 139 | if (action_ret != IRQ_HANDLED) { |
61 | desc->irqs_unhandled++; | 140 | desc->irqs_unhandled++; |
@@ -63,6 +142,15 @@ void note_interrupt(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret) | |||
63 | report_bad_irq(irq, desc, action_ret); | 142 | report_bad_irq(irq, desc, action_ret); |
64 | } | 143 | } |
65 | 144 | ||
145 | if (unlikely(irqfixup)) { | ||
146 | /* Don't punish working computers */ | ||
147 | if ((irqfixup == 2 && irq == 0) || action_ret == IRQ_NONE) { | ||
148 | int ok = misrouted_irq(irq, regs); | ||
149 | if (action_ret == IRQ_NONE) | ||
150 | desc->irqs_unhandled -= ok; | ||
151 | } | ||
152 | } | ||
153 | |||
66 | desc->irq_count++; | 154 | desc->irq_count++; |
67 | if (desc->irq_count < 100000) | 155 | if (desc->irq_count < 100000) |
68 | return; | 156 | return; |
@@ -94,3 +182,24 @@ int __init noirqdebug_setup(char *str) | |||
94 | 182 | ||
95 | __setup("noirqdebug", noirqdebug_setup); | 183 | __setup("noirqdebug", noirqdebug_setup); |
96 | 184 | ||
185 | static int __init irqfixup_setup(char *str) | ||
186 | { | ||
187 | irqfixup = 1; | ||
188 | printk(KERN_WARNING "Misrouted IRQ fixup support enabled.\n"); | ||
189 | printk(KERN_WARNING "This may impact system performance.\n"); | ||
190 | return 1; | ||
191 | } | ||
192 | |||
193 | __setup("irqfixup", irqfixup_setup); | ||
194 | |||
195 | static int __init irqpoll_setup(char *str) | ||
196 | { | ||
197 | irqfixup = 2; | ||
198 | printk(KERN_WARNING "Misrouted IRQ fixup and polling support " | ||
199 | "enabled\n"); | ||
200 | printk(KERN_WARNING "This may significantly impact system " | ||
201 | "performance\n"); | ||
202 | return 1; | ||
203 | } | ||
204 | |||
205 | __setup("irqpoll", irqpoll_setup); | ||
diff --git a/kernel/itimer.c b/kernel/itimer.c index 1dc988e0d2c7..a72cb0e5aa4b 100644 --- a/kernel/itimer.c +++ b/kernel/itimer.c | |||
@@ -153,11 +153,15 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) | |||
153 | 153 | ||
154 | switch (which) { | 154 | switch (which) { |
155 | case ITIMER_REAL: | 155 | case ITIMER_REAL: |
156 | again: | ||
156 | spin_lock_irq(&tsk->sighand->siglock); | 157 | spin_lock_irq(&tsk->sighand->siglock); |
157 | interval = tsk->signal->it_real_incr; | 158 | interval = tsk->signal->it_real_incr; |
158 | val = it_real_value(tsk->signal); | 159 | val = it_real_value(tsk->signal); |
159 | if (val) | 160 | /* We are sharing ->siglock with it_real_fn() */ |
160 | del_timer_sync(&tsk->signal->real_timer); | 161 | if (try_to_del_timer_sync(&tsk->signal->real_timer) < 0) { |
162 | spin_unlock_irq(&tsk->sighand->siglock); | ||
163 | goto again; | ||
164 | } | ||
161 | tsk->signal->it_real_incr = | 165 | tsk->signal->it_real_incr = |
162 | timeval_to_jiffies(&value->it_interval); | 166 | timeval_to_jiffies(&value->it_interval); |
163 | it_real_arm(tsk, timeval_to_jiffies(&value->it_value)); | 167 | it_real_arm(tsk, timeval_to_jiffies(&value->it_value)); |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 7843548cf2d9..cdd4dcd8fb63 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -241,7 +241,7 @@ static int kimage_normal_alloc(struct kimage **rimage, unsigned long entry, | |||
241 | 241 | ||
242 | static int kimage_crash_alloc(struct kimage **rimage, unsigned long entry, | 242 | static int kimage_crash_alloc(struct kimage **rimage, unsigned long entry, |
243 | unsigned long nr_segments, | 243 | unsigned long nr_segments, |
244 | struct kexec_segment *segments) | 244 | struct kexec_segment __user *segments) |
245 | { | 245 | { |
246 | int result; | 246 | int result; |
247 | struct kimage *image; | 247 | struct kimage *image; |
@@ -650,7 +650,7 @@ static kimage_entry_t *kimage_dst_used(struct kimage *image, | |||
650 | } | 650 | } |
651 | } | 651 | } |
652 | 652 | ||
653 | return 0; | 653 | return NULL; |
654 | } | 654 | } |
655 | 655 | ||
656 | static struct page *kimage_alloc_page(struct kimage *image, | 656 | static struct page *kimage_alloc_page(struct kimage *image, |
@@ -696,7 +696,7 @@ static struct page *kimage_alloc_page(struct kimage *image, | |||
696 | /* Allocate a page, if we run out of memory give up */ | 696 | /* Allocate a page, if we run out of memory give up */ |
697 | page = kimage_alloc_pages(gfp_mask, 0); | 697 | page = kimage_alloc_pages(gfp_mask, 0); |
698 | if (!page) | 698 | if (!page) |
699 | return 0; | 699 | return NULL; |
700 | /* If the page cannot be used file it away */ | 700 | /* If the page cannot be used file it away */ |
701 | if (page_to_pfn(page) > | 701 | if (page_to_pfn(page) > |
702 | (KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) { | 702 | (KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) { |
@@ -754,7 +754,7 @@ static int kimage_load_normal_segment(struct kimage *image, | |||
754 | unsigned long maddr; | 754 | unsigned long maddr; |
755 | unsigned long ubytes, mbytes; | 755 | unsigned long ubytes, mbytes; |
756 | int result; | 756 | int result; |
757 | unsigned char *buf; | 757 | unsigned char __user *buf; |
758 | 758 | ||
759 | result = 0; | 759 | result = 0; |
760 | buf = segment->buf; | 760 | buf = segment->buf; |
@@ -818,7 +818,7 @@ static int kimage_load_crash_segment(struct kimage *image, | |||
818 | unsigned long maddr; | 818 | unsigned long maddr; |
819 | unsigned long ubytes, mbytes; | 819 | unsigned long ubytes, mbytes; |
820 | int result; | 820 | int result; |
821 | unsigned char *buf; | 821 | unsigned char __user *buf; |
822 | 822 | ||
823 | result = 0; | 823 | result = 0; |
824 | buf = segment->buf; | 824 | buf = segment->buf; |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 90c0e82b650c..b0237122b24e 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -574,7 +574,7 @@ static int __init init_kprobes(void) | |||
574 | INIT_HLIST_HEAD(&kretprobe_inst_table[i]); | 574 | INIT_HLIST_HEAD(&kretprobe_inst_table[i]); |
575 | } | 575 | } |
576 | 576 | ||
577 | err = arch_init(); | 577 | err = arch_init_kprobes(); |
578 | if (!err) | 578 | if (!err) |
579 | err = register_die_notifier(&kprobe_exceptions_nb); | 579 | err = register_die_notifier(&kprobe_exceptions_nb); |
580 | 580 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index e2b0d3e4dd06..5f2182d42241 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -4166,6 +4166,14 @@ void show_state(void) | |||
4166 | read_unlock(&tasklist_lock); | 4166 | read_unlock(&tasklist_lock); |
4167 | } | 4167 | } |
4168 | 4168 | ||
4169 | /** | ||
4170 | * init_idle - set up an idle thread for a given CPU | ||
4171 | * @idle: task in question | ||
4172 | * @cpu: cpu the idle task belongs to | ||
4173 | * | ||
4174 | * NOTE: this function does not set the idle thread's NEED_RESCHED | ||
4175 | * flag, to make booting more robust. | ||
4176 | */ | ||
4169 | void __devinit init_idle(task_t *idle, int cpu) | 4177 | void __devinit init_idle(task_t *idle, int cpu) |
4170 | { | 4178 | { |
4171 | runqueue_t *rq = cpu_rq(cpu); | 4179 | runqueue_t *rq = cpu_rq(cpu); |
@@ -4183,7 +4191,6 @@ void __devinit init_idle(task_t *idle, int cpu) | |||
4183 | #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) | 4191 | #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) |
4184 | idle->oncpu = 1; | 4192 | idle->oncpu = 1; |
4185 | #endif | 4193 | #endif |
4186 | set_tsk_need_resched(idle); | ||
4187 | spin_unlock_irqrestore(&rq->lock, flags); | 4194 | spin_unlock_irqrestore(&rq->lock, flags); |
4188 | 4195 | ||
4189 | /* Set the preempt count _outside_ the spinlocks! */ | 4196 | /* Set the preempt count _outside_ the spinlocks! */ |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 613b99a55917..a6329fa8f862 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -354,7 +354,7 @@ static void background_writeout(unsigned long _min_pages) | |||
354 | * the whole world. Returns 0 if a pdflush thread was dispatched. Returns | 354 | * the whole world. Returns 0 if a pdflush thread was dispatched. Returns |
355 | * -1 if all pdflush threads were busy. | 355 | * -1 if all pdflush threads were busy. |
356 | */ | 356 | */ |
357 | int wakeup_bdflush(long nr_pages) | 357 | int wakeup_pdflush(long nr_pages) |
358 | { | 358 | { |
359 | if (nr_pages == 0) { | 359 | if (nr_pages == 0) { |
360 | struct writeback_state wbs; | 360 | struct writeback_state wbs; |
@@ -2372,6 +2372,9 @@ void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int nodeid) | |||
2372 | struct slab *slabp; | 2372 | struct slab *slabp; |
2373 | kmem_bufctl_t next; | 2373 | kmem_bufctl_t next; |
2374 | 2374 | ||
2375 | if (nodeid == -1) | ||
2376 | return kmem_cache_alloc(cachep, flags); | ||
2377 | |||
2375 | for (loop = 0;;loop++) { | 2378 | for (loop = 0;;loop++) { |
2376 | struct list_head *q; | 2379 | struct list_head *q; |
2377 | 2380 | ||
diff --git a/mm/vmscan.c b/mm/vmscan.c index 1fa312a8db77..cfffe5098d53 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -972,7 +972,7 @@ int try_to_free_pages(struct zone **zones, unsigned int gfp_mask) | |||
972 | * writeout. So in laptop mode, write out the whole world. | 972 | * writeout. So in laptop mode, write out the whole world. |
973 | */ | 973 | */ |
974 | if (total_scanned > sc.swap_cluster_max + sc.swap_cluster_max/2) { | 974 | if (total_scanned > sc.swap_cluster_max + sc.swap_cluster_max/2) { |
975 | wakeup_bdflush(laptop_mode ? 0 : total_scanned); | 975 | wakeup_pdflush(laptop_mode ? 0 : total_scanned); |
976 | sc.may_writepage = 1; | 976 | sc.may_writepage = 1; |
977 | } | 977 | } |
978 | 978 | ||
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 03ae4edddac3..2d52fee63a8c 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -844,7 +844,7 @@ static unsigned int ip_sabotage_out(unsigned int hook, struct sk_buff **pskb, | |||
844 | * doesn't use the bridge parent of the indev by using | 844 | * doesn't use the bridge parent of the indev by using |
845 | * the BRNF_DONT_TAKE_PARENT mask. */ | 845 | * the BRNF_DONT_TAKE_PARENT mask. */ |
846 | if (hook == NF_IP_FORWARD && nf_bridge->physindev == NULL) { | 846 | if (hook == NF_IP_FORWARD && nf_bridge->physindev == NULL) { |
847 | nf_bridge->mask &= BRNF_DONT_TAKE_PARENT; | 847 | nf_bridge->mask |= BRNF_DONT_TAKE_PARENT; |
848 | nf_bridge->physindev = (struct net_device *)in; | 848 | nf_bridge->physindev = (struct net_device *)in; |
849 | } | 849 | } |
850 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 850 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c index e4ae34b88925..662975be3d1d 100644 --- a/net/bridge/netfilter/ebt_log.c +++ b/net/bridge/netfilter/ebt_log.c | |||
@@ -61,8 +61,6 @@ static void ebt_log(const struct sk_buff *skb, unsigned int hooknr, | |||
61 | { | 61 | { |
62 | struct ebt_log_info *info = (struct ebt_log_info *)data; | 62 | struct ebt_log_info *info = (struct ebt_log_info *)data; |
63 | char level_string[4] = "< >"; | 63 | char level_string[4] = "< >"; |
64 | union {struct iphdr iph; struct tcpudphdr ports; | ||
65 | struct arphdr arph; struct arppayload arpp;} u; | ||
66 | 64 | ||
67 | level_string[1] = '0' + info->loglevel; | 65 | level_string[1] = '0' + info->loglevel; |
68 | spin_lock_bh(&ebt_log_lock); | 66 | spin_lock_bh(&ebt_log_lock); |
@@ -88,7 +86,7 @@ static void ebt_log(const struct sk_buff *skb, unsigned int hooknr, | |||
88 | } | 86 | } |
89 | printk(" IP SRC=%u.%u.%u.%u IP DST=%u.%u.%u.%u,", | 87 | printk(" IP SRC=%u.%u.%u.%u IP DST=%u.%u.%u.%u,", |
90 | NIPQUAD(ih->saddr), NIPQUAD(ih->daddr)); | 88 | NIPQUAD(ih->saddr), NIPQUAD(ih->daddr)); |
91 | printk(" IP tos=0x%02X, IP proto=%d", u.iph.tos, | 89 | printk(" IP tos=0x%02X, IP proto=%d", ih->tos, |
92 | ih->protocol); | 90 | ih->protocol); |
93 | if (ih->protocol == IPPROTO_TCP || | 91 | if (ih->protocol == IPPROTO_TCP || |
94 | ih->protocol == IPPROTO_UDP) { | 92 | ih->protocol == IPPROTO_UDP) { |
@@ -127,7 +125,7 @@ static void ebt_log(const struct sk_buff *skb, unsigned int hooknr, | |||
127 | ah->ar_pln == sizeof(uint32_t)) { | 125 | ah->ar_pln == sizeof(uint32_t)) { |
128 | struct arppayload _arpp, *ap; | 126 | struct arppayload _arpp, *ap; |
129 | 127 | ||
130 | ap = skb_header_pointer(skb, sizeof(u.arph), | 128 | ap = skb_header_pointer(skb, sizeof(_arph), |
131 | sizeof(_arpp), &_arpp); | 129 | sizeof(_arpp), &_arpp); |
132 | if (ap == NULL) { | 130 | if (ap == NULL) { |
133 | printk(" INCOMPLETE ARP payload"); | 131 | printk(" INCOMPLETE ARP payload"); |
diff --git a/net/core/dev.c b/net/core/dev.c index 7016e0c36b3d..7f5f62c65115 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2089,10 +2089,11 @@ void dev_set_promiscuity(struct net_device *dev, int inc) | |||
2089 | { | 2089 | { |
2090 | unsigned short old_flags = dev->flags; | 2090 | unsigned short old_flags = dev->flags; |
2091 | 2091 | ||
2092 | dev->flags |= IFF_PROMISC; | ||
2093 | if ((dev->promiscuity += inc) == 0) | 2092 | if ((dev->promiscuity += inc) == 0) |
2094 | dev->flags &= ~IFF_PROMISC; | 2093 | dev->flags &= ~IFF_PROMISC; |
2095 | if (dev->flags ^ old_flags) { | 2094 | else |
2095 | dev->flags |= IFF_PROMISC; | ||
2096 | if (dev->flags != old_flags) { | ||
2096 | dev_mc_upload(dev); | 2097 | dev_mc_upload(dev); |
2097 | printk(KERN_INFO "device %s %s promiscuous mode\n", | 2098 | printk(KERN_INFO "device %s %s promiscuous mode\n", |
2098 | dev->name, (dev->flags & IFF_PROMISC) ? "entered" : | 2099 | dev->name, (dev->flags & IFF_PROMISC) ? "entered" : |
diff --git a/net/core/filter.c b/net/core/filter.c index f3b88205ace2..cd91a24f9720 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <linux/filter.h> | 36 | #include <linux/filter.h> |
37 | 37 | ||
38 | /* No hurry in this branch */ | 38 | /* No hurry in this branch */ |
39 | static u8 *load_pointer(struct sk_buff *skb, int k) | 39 | static void *__load_pointer(struct sk_buff *skb, int k) |
40 | { | 40 | { |
41 | u8 *ptr = NULL; | 41 | u8 *ptr = NULL; |
42 | 42 | ||
@@ -50,6 +50,18 @@ static u8 *load_pointer(struct sk_buff *skb, int k) | |||
50 | return NULL; | 50 | return NULL; |
51 | } | 51 | } |
52 | 52 | ||
53 | static inline void *load_pointer(struct sk_buff *skb, int k, | ||
54 | unsigned int size, void *buffer) | ||
55 | { | ||
56 | if (k >= 0) | ||
57 | return skb_header_pointer(skb, k, size, buffer); | ||
58 | else { | ||
59 | if (k >= SKF_AD_OFF) | ||
60 | return NULL; | ||
61 | return __load_pointer(skb, k); | ||
62 | } | ||
63 | } | ||
64 | |||
53 | /** | 65 | /** |
54 | * sk_run_filter - run a filter on a socket | 66 | * sk_run_filter - run a filter on a socket |
55 | * @skb: buffer to run the filter on | 67 | * @skb: buffer to run the filter on |
@@ -64,15 +76,12 @@ static u8 *load_pointer(struct sk_buff *skb, int k) | |||
64 | 76 | ||
65 | int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen) | 77 | int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen) |
66 | { | 78 | { |
67 | unsigned char *data = skb->data; | ||
68 | /* len is UNSIGNED. Byte wide insns relies only on implicit | ||
69 | type casts to prevent reading arbitrary memory locations. | ||
70 | */ | ||
71 | unsigned int len = skb->len-skb->data_len; | ||
72 | struct sock_filter *fentry; /* We walk down these */ | 79 | struct sock_filter *fentry; /* We walk down these */ |
80 | void *ptr; | ||
73 | u32 A = 0; /* Accumulator */ | 81 | u32 A = 0; /* Accumulator */ |
74 | u32 X = 0; /* Index Register */ | 82 | u32 X = 0; /* Index Register */ |
75 | u32 mem[BPF_MEMWORDS]; /* Scratch Memory Store */ | 83 | u32 mem[BPF_MEMWORDS]; /* Scratch Memory Store */ |
84 | u32 tmp; | ||
76 | int k; | 85 | int k; |
77 | int pc; | 86 | int pc; |
78 | 87 | ||
@@ -168,86 +177,35 @@ int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen) | |||
168 | case BPF_LD|BPF_W|BPF_ABS: | 177 | case BPF_LD|BPF_W|BPF_ABS: |
169 | k = fentry->k; | 178 | k = fentry->k; |
170 | load_w: | 179 | load_w: |
171 | if (k >= 0 && (unsigned int)(k+sizeof(u32)) <= len) { | 180 | ptr = load_pointer(skb, k, 4, &tmp); |
172 | A = ntohl(*(u32*)&data[k]); | 181 | if (ptr != NULL) { |
182 | A = ntohl(*(u32 *)ptr); | ||
173 | continue; | 183 | continue; |
174 | } | 184 | } |
175 | if (k < 0) { | ||
176 | u8 *ptr; | ||
177 | |||
178 | if (k >= SKF_AD_OFF) | ||
179 | break; | ||
180 | ptr = load_pointer(skb, k); | ||
181 | if (ptr) { | ||
182 | A = ntohl(*(u32*)ptr); | ||
183 | continue; | ||
184 | } | ||
185 | } else { | ||
186 | u32 _tmp, *p; | ||
187 | p = skb_header_pointer(skb, k, 4, &_tmp); | ||
188 | if (p != NULL) { | ||
189 | A = ntohl(*p); | ||
190 | continue; | ||
191 | } | ||
192 | } | ||
193 | return 0; | 185 | return 0; |
194 | case BPF_LD|BPF_H|BPF_ABS: | 186 | case BPF_LD|BPF_H|BPF_ABS: |
195 | k = fentry->k; | 187 | k = fentry->k; |
196 | load_h: | 188 | load_h: |
197 | if (k >= 0 && (unsigned int)(k + sizeof(u16)) <= len) { | 189 | ptr = load_pointer(skb, k, 2, &tmp); |
198 | A = ntohs(*(u16*)&data[k]); | 190 | if (ptr != NULL) { |
191 | A = ntohs(*(u16 *)ptr); | ||
199 | continue; | 192 | continue; |
200 | } | 193 | } |
201 | if (k < 0) { | ||
202 | u8 *ptr; | ||
203 | |||
204 | if (k >= SKF_AD_OFF) | ||
205 | break; | ||
206 | ptr = load_pointer(skb, k); | ||
207 | if (ptr) { | ||
208 | A = ntohs(*(u16*)ptr); | ||
209 | continue; | ||
210 | } | ||
211 | } else { | ||
212 | u16 _tmp, *p; | ||
213 | p = skb_header_pointer(skb, k, 2, &_tmp); | ||
214 | if (p != NULL) { | ||
215 | A = ntohs(*p); | ||
216 | continue; | ||
217 | } | ||
218 | } | ||
219 | return 0; | 194 | return 0; |
220 | case BPF_LD|BPF_B|BPF_ABS: | 195 | case BPF_LD|BPF_B|BPF_ABS: |
221 | k = fentry->k; | 196 | k = fentry->k; |
222 | load_b: | 197 | load_b: |
223 | if (k >= 0 && (unsigned int)k < len) { | 198 | ptr = load_pointer(skb, k, 1, &tmp); |
224 | A = data[k]; | 199 | if (ptr != NULL) { |
200 | A = *(u8 *)ptr; | ||
225 | continue; | 201 | continue; |
226 | } | 202 | } |
227 | if (k < 0) { | ||
228 | u8 *ptr; | ||
229 | |||
230 | if (k >= SKF_AD_OFF) | ||
231 | break; | ||
232 | ptr = load_pointer(skb, k); | ||
233 | if (ptr) { | ||
234 | A = *ptr; | ||
235 | continue; | ||
236 | } | ||
237 | } else { | ||
238 | u8 _tmp, *p; | ||
239 | p = skb_header_pointer(skb, k, 1, &_tmp); | ||
240 | if (p != NULL) { | ||
241 | A = *p; | ||
242 | continue; | ||
243 | } | ||
244 | } | ||
245 | return 0; | 203 | return 0; |
246 | case BPF_LD|BPF_W|BPF_LEN: | 204 | case BPF_LD|BPF_W|BPF_LEN: |
247 | A = len; | 205 | A = skb->len; |
248 | continue; | 206 | continue; |
249 | case BPF_LDX|BPF_W|BPF_LEN: | 207 | case BPF_LDX|BPF_W|BPF_LEN: |
250 | X = len; | 208 | X = skb->len; |
251 | continue; | 209 | continue; |
252 | case BPF_LD|BPF_W|BPF_IND: | 210 | case BPF_LD|BPF_W|BPF_IND: |
253 | k = X + fentry->k; | 211 | k = X + fentry->k; |
@@ -259,10 +217,12 @@ load_b: | |||
259 | k = X + fentry->k; | 217 | k = X + fentry->k; |
260 | goto load_b; | 218 | goto load_b; |
261 | case BPF_LDX|BPF_B|BPF_MSH: | 219 | case BPF_LDX|BPF_B|BPF_MSH: |
262 | if (fentry->k >= len) | 220 | ptr = load_pointer(skb, fentry->k, 1, &tmp); |
263 | return 0; | 221 | if (ptr != NULL) { |
264 | X = (data[fentry->k] & 0xf) << 2; | 222 | X = (*(u8 *)ptr & 0xf) << 2; |
265 | continue; | 223 | continue; |
224 | } | ||
225 | return 0; | ||
266 | case BPF_LD|BPF_IMM: | 226 | case BPF_LD|BPF_IMM: |
267 | A = fentry->k; | 227 | A = fentry->k; |
268 | continue; | 228 | continue; |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 851eb927ed97..1beb782ac41b 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1598,6 +1598,8 @@ static int neightbl_fill_info(struct neigh_table *tbl, struct sk_buff *skb, | |||
1598 | 1598 | ||
1599 | read_lock_bh(&tbl->lock); | 1599 | read_lock_bh(&tbl->lock); |
1600 | ndtmsg->ndtm_family = tbl->family; | 1600 | ndtmsg->ndtm_family = tbl->family; |
1601 | ndtmsg->ndtm_pad1 = 0; | ||
1602 | ndtmsg->ndtm_pad2 = 0; | ||
1601 | 1603 | ||
1602 | RTA_PUT_STRING(skb, NDTA_NAME, tbl->id); | 1604 | RTA_PUT_STRING(skb, NDTA_NAME, tbl->id); |
1603 | RTA_PUT_MSECS(skb, NDTA_GC_INTERVAL, tbl->gc_interval); | 1605 | RTA_PUT_MSECS(skb, NDTA_GC_INTERVAL, tbl->gc_interval); |
@@ -1683,6 +1685,8 @@ static int neightbl_fill_param_info(struct neigh_table *tbl, | |||
1683 | 1685 | ||
1684 | read_lock_bh(&tbl->lock); | 1686 | read_lock_bh(&tbl->lock); |
1685 | ndtmsg->ndtm_family = tbl->family; | 1687 | ndtmsg->ndtm_family = tbl->family; |
1688 | ndtmsg->ndtm_pad1 = 0; | ||
1689 | ndtmsg->ndtm_pad2 = 0; | ||
1686 | RTA_PUT_STRING(skb, NDTA_NAME, tbl->id); | 1690 | RTA_PUT_STRING(skb, NDTA_NAME, tbl->id); |
1687 | 1691 | ||
1688 | if (neightbl_fill_parms(skb, parms) < 0) | 1692 | if (neightbl_fill_parms(skb, parms) < 0) |
@@ -1872,6 +1876,8 @@ static int neigh_fill_info(struct sk_buff *skb, struct neighbour *n, | |||
1872 | struct ndmsg *ndm = NLMSG_DATA(nlh); | 1876 | struct ndmsg *ndm = NLMSG_DATA(nlh); |
1873 | 1877 | ||
1874 | ndm->ndm_family = n->ops->family; | 1878 | ndm->ndm_family = n->ops->family; |
1879 | ndm->ndm_pad1 = 0; | ||
1880 | ndm->ndm_pad2 = 0; | ||
1875 | ndm->ndm_flags = n->flags; | 1881 | ndm->ndm_flags = n->flags; |
1876 | ndm->ndm_type = n->type; | 1882 | ndm->ndm_type = n->type; |
1877 | ndm->ndm_ifindex = n->dev->ifindex; | 1883 | ndm->ndm_ifindex = n->dev->ifindex; |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index e013d836a7ab..4b1bb30e6381 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -126,6 +126,7 @@ void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data | |||
126 | rta->rta_type = attrtype; | 126 | rta->rta_type = attrtype; |
127 | rta->rta_len = size; | 127 | rta->rta_len = size; |
128 | memcpy(RTA_DATA(rta), data, attrlen); | 128 | memcpy(RTA_DATA(rta), data, attrlen); |
129 | memset(RTA_DATA(rta) + attrlen, 0, RTA_ALIGN(size) - size); | ||
129 | } | 130 | } |
130 | 131 | ||
131 | size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size) | 132 | size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size) |
@@ -188,6 +189,7 @@ static int rtnetlink_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, | |||
188 | nlh = NLMSG_NEW(skb, pid, seq, type, sizeof(*r), flags); | 189 | nlh = NLMSG_NEW(skb, pid, seq, type, sizeof(*r), flags); |
189 | r = NLMSG_DATA(nlh); | 190 | r = NLMSG_DATA(nlh); |
190 | r->ifi_family = AF_UNSPEC; | 191 | r->ifi_family = AF_UNSPEC; |
192 | r->__ifi_pad = 0; | ||
191 | r->ifi_type = dev->type; | 193 | r->ifi_type = dev->type; |
192 | r->ifi_index = dev->ifindex; | 194 | r->ifi_index = dev->ifindex; |
193 | r->ifi_flags = dev_get_flags(dev); | 195 | r->ifi_flags = dev_get_flags(dev); |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index bb73b2190ec7..733deee24b9f 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -357,7 +357,6 @@ struct sk_buff *skb_clone(struct sk_buff *skb, int gfp_mask) | |||
357 | C(ip_summed); | 357 | C(ip_summed); |
358 | C(priority); | 358 | C(priority); |
359 | C(protocol); | 359 | C(protocol); |
360 | C(security); | ||
361 | n->destructor = NULL; | 360 | n->destructor = NULL; |
362 | #ifdef CONFIG_NETFILTER | 361 | #ifdef CONFIG_NETFILTER |
363 | C(nfmark); | 362 | C(nfmark); |
@@ -422,7 +421,6 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | |||
422 | new->pkt_type = old->pkt_type; | 421 | new->pkt_type = old->pkt_type; |
423 | new->stamp = old->stamp; | 422 | new->stamp = old->stamp; |
424 | new->destructor = NULL; | 423 | new->destructor = NULL; |
425 | new->security = old->security; | ||
426 | #ifdef CONFIG_NETFILTER | 424 | #ifdef CONFIG_NETFILTER |
427 | new->nfmark = old->nfmark; | 425 | new->nfmark = old->nfmark; |
428 | new->nfcache = old->nfcache; | 426 | new->nfcache = old->nfcache; |
diff --git a/net/core/wireless.c b/net/core/wireless.c index b2fe378dfbf8..3ff5639c0b78 100644 --- a/net/core/wireless.c +++ b/net/core/wireless.c | |||
@@ -1102,6 +1102,7 @@ static inline int rtnetlink_fill_iwinfo(struct sk_buff * skb, | |||
1102 | nlh = NLMSG_PUT(skb, 0, 0, type, sizeof(*r)); | 1102 | nlh = NLMSG_PUT(skb, 0, 0, type, sizeof(*r)); |
1103 | r = NLMSG_DATA(nlh); | 1103 | r = NLMSG_DATA(nlh); |
1104 | r->ifi_family = AF_UNSPEC; | 1104 | r->ifi_family = AF_UNSPEC; |
1105 | r->__ifi_pad = 0; | ||
1105 | r->ifi_type = dev->type; | 1106 | r->ifi_type = dev->type; |
1106 | r->ifi_index = dev->ifindex; | 1107 | r->ifi_index = dev->ifindex; |
1107 | r->ifi_flags = dev->flags; | 1108 | r->ifi_flags = dev->flags; |
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c index 9934b25720e4..99bc061759c3 100644 --- a/net/decnet/dn_fib.c +++ b/net/decnet/dn_fib.c | |||
@@ -551,7 +551,8 @@ int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
551 | if (t < s_t) | 551 | if (t < s_t) |
552 | continue; | 552 | continue; |
553 | if (t > s_t) | 553 | if (t > s_t) |
554 | memset(&cb->args[1], 0, sizeof(cb->args)-sizeof(int)); | 554 | memset(&cb->args[1], 0, |
555 | sizeof(cb->args) - sizeof(cb->args[0])); | ||
555 | tb = dn_fib_get_table(t, 0); | 556 | tb = dn_fib_get_table(t, 0); |
556 | if (tb == NULL) | 557 | if (tb == NULL) |
557 | continue; | 558 | continue; |
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index 6617ea47d365..ab60ea63688e 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c | |||
@@ -92,10 +92,9 @@ int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, | |||
92 | * Set the source hardware address. | 92 | * Set the source hardware address. |
93 | */ | 93 | */ |
94 | 94 | ||
95 | if(saddr) | 95 | if(!saddr) |
96 | memcpy(eth->h_source,saddr,dev->addr_len); | 96 | saddr = dev->dev_addr; |
97 | else | 97 | memcpy(eth->h_source,saddr,dev->addr_len); |
98 | memcpy(eth->h_source,dev->dev_addr,dev->addr_len); | ||
99 | 98 | ||
100 | /* | 99 | /* |
101 | * Anyway, the loopback-device should never use this function... | 100 | * Anyway, the loopback-device should never use this function... |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 658e7977924d..ef7468376ae6 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1009,6 +1009,15 @@ static int __init init_ipv4_mibs(void) | |||
1009 | static int ipv4_proc_init(void); | 1009 | static int ipv4_proc_init(void); |
1010 | extern void ipfrag_init(void); | 1010 | extern void ipfrag_init(void); |
1011 | 1011 | ||
1012 | /* | ||
1013 | * IP protocol layer initialiser | ||
1014 | */ | ||
1015 | |||
1016 | static struct packet_type ip_packet_type = { | ||
1017 | .type = __constant_htons(ETH_P_IP), | ||
1018 | .func = ip_rcv, | ||
1019 | }; | ||
1020 | |||
1012 | static int __init inet_init(void) | 1021 | static int __init inet_init(void) |
1013 | { | 1022 | { |
1014 | struct sk_buff *dummy_skb; | 1023 | struct sk_buff *dummy_skb; |
@@ -1102,6 +1111,8 @@ static int __init inet_init(void) | |||
1102 | 1111 | ||
1103 | ipfrag_init(); | 1112 | ipfrag_init(); |
1104 | 1113 | ||
1114 | dev_add_pack(&ip_packet_type); | ||
1115 | |||
1105 | rc = 0; | 1116 | rc = 0; |
1106 | out: | 1117 | out: |
1107 | return rc; | 1118 | return rc; |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 0671569ee6f0..4be234c7d8c3 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -43,7 +43,7 @@ | |||
43 | * 2 of the License, or (at your option) any later version. | 43 | * 2 of the License, or (at your option) any later version. |
44 | */ | 44 | */ |
45 | 45 | ||
46 | #define VERSION "0.323" | 46 | #define VERSION "0.325" |
47 | 47 | ||
48 | #include <linux/config.h> | 48 | #include <linux/config.h> |
49 | #include <asm/uaccess.h> | 49 | #include <asm/uaccess.h> |
@@ -136,6 +136,7 @@ struct trie_use_stats { | |||
136 | unsigned int semantic_match_passed; | 136 | unsigned int semantic_match_passed; |
137 | unsigned int semantic_match_miss; | 137 | unsigned int semantic_match_miss; |
138 | unsigned int null_node_hit; | 138 | unsigned int null_node_hit; |
139 | unsigned int resize_node_skipped; | ||
139 | }; | 140 | }; |
140 | #endif | 141 | #endif |
141 | 142 | ||
@@ -164,8 +165,8 @@ static void put_child(struct trie *t, struct tnode *tn, int i, struct node *n); | |||
164 | static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n, int wasfull); | 165 | static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n, int wasfull); |
165 | static int tnode_child_length(struct tnode *tn); | 166 | static int tnode_child_length(struct tnode *tn); |
166 | static struct node *resize(struct trie *t, struct tnode *tn); | 167 | static struct node *resize(struct trie *t, struct tnode *tn); |
167 | static struct tnode *inflate(struct trie *t, struct tnode *tn); | 168 | static struct tnode *inflate(struct trie *t, struct tnode *tn, int *err); |
168 | static struct tnode *halve(struct trie *t, struct tnode *tn); | 169 | static struct tnode *halve(struct trie *t, struct tnode *tn, int *err); |
169 | static void tnode_free(struct tnode *tn); | 170 | static void tnode_free(struct tnode *tn); |
170 | static void trie_dump_seq(struct seq_file *seq, struct trie *t); | 171 | static void trie_dump_seq(struct seq_file *seq, struct trie *t); |
171 | extern struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio); | 172 | extern struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio); |
@@ -341,8 +342,10 @@ static struct leaf *leaf_new(void) | |||
341 | static struct leaf_info *leaf_info_new(int plen) | 342 | static struct leaf_info *leaf_info_new(int plen) |
342 | { | 343 | { |
343 | struct leaf_info *li = kmalloc(sizeof(struct leaf_info), GFP_KERNEL); | 344 | struct leaf_info *li = kmalloc(sizeof(struct leaf_info), GFP_KERNEL); |
344 | li->plen = plen; | 345 | if(li) { |
345 | INIT_LIST_HEAD(&li->falh); | 346 | li->plen = plen; |
347 | INIT_LIST_HEAD(&li->falh); | ||
348 | } | ||
346 | return li; | 349 | return li; |
347 | } | 350 | } |
348 | 351 | ||
@@ -356,11 +359,32 @@ static inline void free_leaf_info(struct leaf_info *li) | |||
356 | kfree(li); | 359 | kfree(li); |
357 | } | 360 | } |
358 | 361 | ||
362 | static struct tnode *tnode_alloc(unsigned int size) | ||
363 | { | ||
364 | if (size <= PAGE_SIZE) { | ||
365 | return kmalloc(size, GFP_KERNEL); | ||
366 | } else { | ||
367 | return (struct tnode *) | ||
368 | __get_free_pages(GFP_KERNEL, get_order(size)); | ||
369 | } | ||
370 | } | ||
371 | |||
372 | static void __tnode_free(struct tnode *tn) | ||
373 | { | ||
374 | unsigned int size = sizeof(struct tnode) + | ||
375 | (1<<tn->bits) * sizeof(struct node *); | ||
376 | |||
377 | if (size <= PAGE_SIZE) | ||
378 | kfree(tn); | ||
379 | else | ||
380 | free_pages((unsigned long)tn, get_order(size)); | ||
381 | } | ||
382 | |||
359 | static struct tnode* tnode_new(t_key key, int pos, int bits) | 383 | static struct tnode* tnode_new(t_key key, int pos, int bits) |
360 | { | 384 | { |
361 | int nchildren = 1<<bits; | 385 | int nchildren = 1<<bits; |
362 | int sz = sizeof(struct tnode) + nchildren * sizeof(struct node *); | 386 | int sz = sizeof(struct tnode) + nchildren * sizeof(struct node *); |
363 | struct tnode *tn = kmalloc(sz, GFP_KERNEL); | 387 | struct tnode *tn = tnode_alloc(sz); |
364 | 388 | ||
365 | if(tn) { | 389 | if(tn) { |
366 | memset(tn, 0, sz); | 390 | memset(tn, 0, sz); |
@@ -388,7 +412,7 @@ static void tnode_free(struct tnode *tn) | |||
388 | printk("FL %p \n", tn); | 412 | printk("FL %p \n", tn); |
389 | } | 413 | } |
390 | else if(IS_TNODE(tn)) { | 414 | else if(IS_TNODE(tn)) { |
391 | kfree(tn); | 415 | __tnode_free(tn); |
392 | if(trie_debug > 0 ) | 416 | if(trie_debug > 0 ) |
393 | printk("FT %p \n", tn); | 417 | printk("FT %p \n", tn); |
394 | } | 418 | } |
@@ -458,6 +482,7 @@ static void tnode_put_child_reorg(struct tnode *tn, int i, struct node *n, int w | |||
458 | static struct node *resize(struct trie *t, struct tnode *tn) | 482 | static struct node *resize(struct trie *t, struct tnode *tn) |
459 | { | 483 | { |
460 | int i; | 484 | int i; |
485 | int err = 0; | ||
461 | 486 | ||
462 | if (!tn) | 487 | if (!tn) |
463 | return NULL; | 488 | return NULL; |
@@ -554,12 +579,20 @@ static struct node *resize(struct trie *t, struct tnode *tn) | |||
554 | */ | 579 | */ |
555 | 580 | ||
556 | check_tnode(tn); | 581 | check_tnode(tn); |
557 | 582 | ||
583 | err = 0; | ||
558 | while ((tn->full_children > 0 && | 584 | while ((tn->full_children > 0 && |
559 | 50 * (tn->full_children + tnode_child_length(tn) - tn->empty_children) >= | 585 | 50 * (tn->full_children + tnode_child_length(tn) - tn->empty_children) >= |
560 | inflate_threshold * tnode_child_length(tn))) { | 586 | inflate_threshold * tnode_child_length(tn))) { |
561 | 587 | ||
562 | tn = inflate(t, tn); | 588 | tn = inflate(t, tn, &err); |
589 | |||
590 | if(err) { | ||
591 | #ifdef CONFIG_IP_FIB_TRIE_STATS | ||
592 | t->stats.resize_node_skipped++; | ||
593 | #endif | ||
594 | break; | ||
595 | } | ||
563 | } | 596 | } |
564 | 597 | ||
565 | check_tnode(tn); | 598 | check_tnode(tn); |
@@ -568,11 +601,22 @@ static struct node *resize(struct trie *t, struct tnode *tn) | |||
568 | * Halve as long as the number of empty children in this | 601 | * Halve as long as the number of empty children in this |
569 | * node is above threshold. | 602 | * node is above threshold. |
570 | */ | 603 | */ |
604 | |||
605 | err = 0; | ||
571 | while (tn->bits > 1 && | 606 | while (tn->bits > 1 && |
572 | 100 * (tnode_child_length(tn) - tn->empty_children) < | 607 | 100 * (tnode_child_length(tn) - tn->empty_children) < |
573 | halve_threshold * tnode_child_length(tn)) | 608 | halve_threshold * tnode_child_length(tn)) { |
609 | |||
610 | tn = halve(t, tn, &err); | ||
611 | |||
612 | if(err) { | ||
613 | #ifdef CONFIG_IP_FIB_TRIE_STATS | ||
614 | t->stats.resize_node_skipped++; | ||
615 | #endif | ||
616 | break; | ||
617 | } | ||
618 | } | ||
574 | 619 | ||
575 | tn = halve(t, tn); | ||
576 | 620 | ||
577 | /* Only one child remains */ | 621 | /* Only one child remains */ |
578 | 622 | ||
@@ -597,7 +641,7 @@ static struct node *resize(struct trie *t, struct tnode *tn) | |||
597 | return (struct node *) tn; | 641 | return (struct node *) tn; |
598 | } | 642 | } |
599 | 643 | ||
600 | static struct tnode *inflate(struct trie *t, struct tnode *tn) | 644 | static struct tnode *inflate(struct trie *t, struct tnode *tn, int *err) |
601 | { | 645 | { |
602 | struct tnode *inode; | 646 | struct tnode *inode; |
603 | struct tnode *oldtnode = tn; | 647 | struct tnode *oldtnode = tn; |
@@ -609,8 +653,63 @@ static struct tnode *inflate(struct trie *t, struct tnode *tn) | |||
609 | 653 | ||
610 | tn = tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits + 1); | 654 | tn = tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits + 1); |
611 | 655 | ||
612 | if (!tn) | 656 | if (!tn) { |
613 | trie_bug("tnode_new failed"); | 657 | *err = -ENOMEM; |
658 | return oldtnode; | ||
659 | } | ||
660 | |||
661 | /* | ||
662 | * Preallocate and store tnodes before the actual work so we | ||
663 | * don't get into an inconsistent state if memory allocation | ||
664 | * fails. In case of failure we return the oldnode and inflate | ||
665 | * of tnode is ignored. | ||
666 | */ | ||
667 | |||
668 | for(i = 0; i < olen; i++) { | ||
669 | struct tnode *inode = (struct tnode *) tnode_get_child(oldtnode, i); | ||
670 | |||
671 | if (inode && | ||
672 | IS_TNODE(inode) && | ||
673 | inode->pos == oldtnode->pos + oldtnode->bits && | ||
674 | inode->bits > 1) { | ||
675 | struct tnode *left, *right; | ||
676 | |||
677 | t_key m = TKEY_GET_MASK(inode->pos, 1); | ||
678 | |||
679 | left = tnode_new(inode->key&(~m), inode->pos + 1, | ||
680 | inode->bits - 1); | ||
681 | |||
682 | if(!left) { | ||
683 | *err = -ENOMEM; | ||
684 | break; | ||
685 | } | ||
686 | |||
687 | right = tnode_new(inode->key|m, inode->pos + 1, | ||
688 | inode->bits - 1); | ||
689 | |||
690 | if(!right) { | ||
691 | *err = -ENOMEM; | ||
692 | break; | ||
693 | } | ||
694 | |||
695 | put_child(t, tn, 2*i, (struct node *) left); | ||
696 | put_child(t, tn, 2*i+1, (struct node *) right); | ||
697 | } | ||
698 | } | ||
699 | |||
700 | if(*err) { | ||
701 | int size = tnode_child_length(tn); | ||
702 | int j; | ||
703 | |||
704 | for(j = 0; j < size; j++) | ||
705 | if( tn->child[j]) | ||
706 | tnode_free((struct tnode *)tn->child[j]); | ||
707 | |||
708 | tnode_free(tn); | ||
709 | |||
710 | *err = -ENOMEM; | ||
711 | return oldtnode; | ||
712 | } | ||
614 | 713 | ||
615 | for(i = 0; i < olen; i++) { | 714 | for(i = 0; i < olen; i++) { |
616 | struct node *node = tnode_get_child(oldtnode, i); | 715 | struct node *node = tnode_get_child(oldtnode, i); |
@@ -623,7 +722,7 @@ static struct tnode *inflate(struct trie *t, struct tnode *tn) | |||
623 | 722 | ||
624 | if(IS_LEAF(node) || ((struct tnode *) node)->pos > | 723 | if(IS_LEAF(node) || ((struct tnode *) node)->pos > |
625 | tn->pos + tn->bits - 1) { | 724 | tn->pos + tn->bits - 1) { |
626 | if(tkey_extract_bits(node->key, tn->pos + tn->bits - 1, | 725 | if(tkey_extract_bits(node->key, oldtnode->pos + oldtnode->bits, |
627 | 1) == 0) | 726 | 1) == 0) |
628 | put_child(t, tn, 2*i, node); | 727 | put_child(t, tn, 2*i, node); |
629 | else | 728 | else |
@@ -663,27 +762,22 @@ static struct tnode *inflate(struct trie *t, struct tnode *tn) | |||
663 | * the position (inode->pos) | 762 | * the position (inode->pos) |
664 | */ | 763 | */ |
665 | 764 | ||
666 | t_key m = TKEY_GET_MASK(inode->pos, 1); | ||
667 | |||
668 | /* Use the old key, but set the new significant | 765 | /* Use the old key, but set the new significant |
669 | * bit to zero. | 766 | * bit to zero. |
670 | */ | 767 | */ |
671 | left = tnode_new(inode->key&(~m), inode->pos + 1, | ||
672 | inode->bits - 1); | ||
673 | 768 | ||
674 | if(!left) | 769 | left = (struct tnode *) tnode_get_child(tn, 2*i); |
675 | trie_bug("tnode_new failed"); | 770 | put_child(t, tn, 2*i, NULL); |
676 | 771 | ||
677 | 772 | if(!left) | |
678 | /* Use the old key, but set the new significant | 773 | BUG(); |
679 | * bit to one. | 774 | |
680 | */ | 775 | right = (struct tnode *) tnode_get_child(tn, 2*i+1); |
681 | right = tnode_new(inode->key|m, inode->pos + 1, | 776 | put_child(t, tn, 2*i+1, NULL); |
682 | inode->bits - 1); | 777 | |
778 | if(!right) | ||
779 | BUG(); | ||
683 | 780 | ||
684 | if(!right) | ||
685 | trie_bug("tnode_new failed"); | ||
686 | |||
687 | size = tnode_child_length(left); | 781 | size = tnode_child_length(left); |
688 | for(j = 0; j < size; j++) { | 782 | for(j = 0; j < size; j++) { |
689 | put_child(t, left, j, inode->child[j]); | 783 | put_child(t, left, j, inode->child[j]); |
@@ -699,7 +793,7 @@ static struct tnode *inflate(struct trie *t, struct tnode *tn) | |||
699 | return tn; | 793 | return tn; |
700 | } | 794 | } |
701 | 795 | ||
702 | static struct tnode *halve(struct trie *t, struct tnode *tn) | 796 | static struct tnode *halve(struct trie *t, struct tnode *tn, int *err) |
703 | { | 797 | { |
704 | struct tnode *oldtnode = tn; | 798 | struct tnode *oldtnode = tn; |
705 | struct node *left, *right; | 799 | struct node *left, *right; |
@@ -710,8 +804,48 @@ static struct tnode *halve(struct trie *t, struct tnode *tn) | |||
710 | 804 | ||
711 | tn=tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits - 1); | 805 | tn=tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits - 1); |
712 | 806 | ||
713 | if(!tn) | 807 | if (!tn) { |
714 | trie_bug("tnode_new failed"); | 808 | *err = -ENOMEM; |
809 | return oldtnode; | ||
810 | } | ||
811 | |||
812 | /* | ||
813 | * Preallocate and store tnodes before the actual work so we | ||
814 | * don't get into an inconsistent state if memory allocation | ||
815 | * fails. In case of failure we return the oldnode and halve | ||
816 | * of tnode is ignored. | ||
817 | */ | ||
818 | |||
819 | for(i = 0; i < olen; i += 2) { | ||
820 | left = tnode_get_child(oldtnode, i); | ||
821 | right = tnode_get_child(oldtnode, i+1); | ||
822 | |||
823 | /* Two nonempty children */ | ||
824 | if( left && right) { | ||
825 | struct tnode *newBinNode = | ||
826 | tnode_new(left->key, tn->pos + tn->bits, 1); | ||
827 | |||
828 | if(!newBinNode) { | ||
829 | *err = -ENOMEM; | ||
830 | break; | ||
831 | } | ||
832 | put_child(t, tn, i/2, (struct node *)newBinNode); | ||
833 | } | ||
834 | } | ||
835 | |||
836 | if(*err) { | ||
837 | int size = tnode_child_length(tn); | ||
838 | int j; | ||
839 | |||
840 | for(j = 0; j < size; j++) | ||
841 | if( tn->child[j]) | ||
842 | tnode_free((struct tnode *)tn->child[j]); | ||
843 | |||
844 | tnode_free(tn); | ||
845 | |||
846 | *err = -ENOMEM; | ||
847 | return oldtnode; | ||
848 | } | ||
715 | 849 | ||
716 | for(i = 0; i < olen; i += 2) { | 850 | for(i = 0; i < olen; i += 2) { |
717 | left = tnode_get_child(oldtnode, i); | 851 | left = tnode_get_child(oldtnode, i); |
@@ -728,10 +862,11 @@ static struct tnode *halve(struct trie *t, struct tnode *tn) | |||
728 | /* Two nonempty children */ | 862 | /* Two nonempty children */ |
729 | else { | 863 | else { |
730 | struct tnode *newBinNode = | 864 | struct tnode *newBinNode = |
731 | tnode_new(left->key, tn->pos + tn->bits, 1); | 865 | (struct tnode *) tnode_get_child(tn, i/2); |
866 | put_child(t, tn, i/2, NULL); | ||
732 | 867 | ||
733 | if(!newBinNode) | 868 | if(!newBinNode) |
734 | trie_bug("tnode_new failed"); | 869 | BUG(); |
735 | 870 | ||
736 | put_child(t, newBinNode, 0, left); | 871 | put_child(t, newBinNode, 0, left); |
737 | put_child(t, newBinNode, 1, right); | 872 | put_child(t, newBinNode, 1, right); |
@@ -879,8 +1014,8 @@ static struct node *trie_rebalance(struct trie *t, struct tnode *tn) | |||
879 | return (struct node*) tn; | 1014 | return (struct node*) tn; |
880 | } | 1015 | } |
881 | 1016 | ||
882 | static struct list_head * | 1017 | static struct list_head * |
883 | fib_insert_node(struct trie *t, u32 key, int plen) | 1018 | fib_insert_node(struct trie *t, int *err, u32 key, int plen) |
884 | { | 1019 | { |
885 | int pos, newpos; | 1020 | int pos, newpos; |
886 | struct tnode *tp = NULL, *tn = NULL; | 1021 | struct tnode *tp = NULL, *tn = NULL; |
@@ -940,7 +1075,6 @@ fib_insert_node(struct trie *t, u32 key, int plen) | |||
940 | if(tp && IS_LEAF(tp)) | 1075 | if(tp && IS_LEAF(tp)) |
941 | BUG(); | 1076 | BUG(); |
942 | 1077 | ||
943 | t->revision++; | ||
944 | 1078 | ||
945 | /* Case 1: n is a leaf. Compare prefixes */ | 1079 | /* Case 1: n is a leaf. Compare prefixes */ |
946 | 1080 | ||
@@ -949,8 +1083,10 @@ fib_insert_node(struct trie *t, u32 key, int plen) | |||
949 | 1083 | ||
950 | li = leaf_info_new(plen); | 1084 | li = leaf_info_new(plen); |
951 | 1085 | ||
952 | if(! li) | 1086 | if(! li) { |
953 | BUG(); | 1087 | *err = -ENOMEM; |
1088 | goto err; | ||
1089 | } | ||
954 | 1090 | ||
955 | fa_head = &li->falh; | 1091 | fa_head = &li->falh; |
956 | insert_leaf_info(&l->list, li); | 1092 | insert_leaf_info(&l->list, li); |
@@ -959,14 +1095,19 @@ fib_insert_node(struct trie *t, u32 key, int plen) | |||
959 | t->size++; | 1095 | t->size++; |
960 | l = leaf_new(); | 1096 | l = leaf_new(); |
961 | 1097 | ||
962 | if(! l) | 1098 | if(! l) { |
963 | BUG(); | 1099 | *err = -ENOMEM; |
1100 | goto err; | ||
1101 | } | ||
964 | 1102 | ||
965 | l->key = key; | 1103 | l->key = key; |
966 | li = leaf_info_new(plen); | 1104 | li = leaf_info_new(plen); |
967 | 1105 | ||
968 | if(! li) | 1106 | if(! li) { |
969 | BUG(); | 1107 | tnode_free((struct tnode *) l); |
1108 | *err = -ENOMEM; | ||
1109 | goto err; | ||
1110 | } | ||
970 | 1111 | ||
971 | fa_head = &li->falh; | 1112 | fa_head = &li->falh; |
972 | insert_leaf_info(&l->list, li); | 1113 | insert_leaf_info(&l->list, li); |
@@ -1003,9 +1144,14 @@ fib_insert_node(struct trie *t, u32 key, int plen) | |||
1003 | newpos = 0; | 1144 | newpos = 0; |
1004 | tn = tnode_new(key, newpos, 1); /* First tnode */ | 1145 | tn = tnode_new(key, newpos, 1); /* First tnode */ |
1005 | } | 1146 | } |
1006 | if(!tn) | ||
1007 | trie_bug("tnode_pfx_new failed"); | ||
1008 | 1147 | ||
1148 | if(!tn) { | ||
1149 | free_leaf_info(li); | ||
1150 | tnode_free((struct tnode *) l); | ||
1151 | *err = -ENOMEM; | ||
1152 | goto err; | ||
1153 | } | ||
1154 | |||
1009 | NODE_SET_PARENT(tn, tp); | 1155 | NODE_SET_PARENT(tn, tp); |
1010 | 1156 | ||
1011 | missbit=tkey_extract_bits(key, newpos, 1); | 1157 | missbit=tkey_extract_bits(key, newpos, 1); |
@@ -1027,7 +1173,9 @@ fib_insert_node(struct trie *t, u32 key, int plen) | |||
1027 | } | 1173 | } |
1028 | /* Rebalance the trie */ | 1174 | /* Rebalance the trie */ |
1029 | t->trie = trie_rebalance(t, tp); | 1175 | t->trie = trie_rebalance(t, tp); |
1030 | done:; | 1176 | done: |
1177 | t->revision++; | ||
1178 | err:; | ||
1031 | return fa_head; | 1179 | return fa_head; |
1032 | } | 1180 | } |
1033 | 1181 | ||
@@ -1156,8 +1304,12 @@ fn_trie_insert(struct fib_table *tb, struct rtmsg *r, struct kern_rta *rta, | |||
1156 | * Insert new entry to the list. | 1304 | * Insert new entry to the list. |
1157 | */ | 1305 | */ |
1158 | 1306 | ||
1159 | if(!fa_head) | 1307 | if(!fa_head) { |
1160 | fa_head = fib_insert_node(t, key, plen); | 1308 | fa_head = fib_insert_node(t, &err, key, plen); |
1309 | err = 0; | ||
1310 | if(err) | ||
1311 | goto out_free_new_fa; | ||
1312 | } | ||
1161 | 1313 | ||
1162 | write_lock_bh(&fib_lock); | 1314 | write_lock_bh(&fib_lock); |
1163 | 1315 | ||
@@ -1170,6 +1322,9 @@ fn_trie_insert(struct fib_table *tb, struct rtmsg *r, struct kern_rta *rta, | |||
1170 | rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id, nlhdr, req); | 1322 | rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id, nlhdr, req); |
1171 | succeeded: | 1323 | succeeded: |
1172 | return 0; | 1324 | return 0; |
1325 | |||
1326 | out_free_new_fa: | ||
1327 | kmem_cache_free(fn_alias_kmem, new_fa); | ||
1173 | out: | 1328 | out: |
1174 | fib_release_info(fi); | 1329 | fib_release_info(fi); |
1175 | err:; | 1330 | err:; |
@@ -2279,6 +2434,7 @@ static void collect_and_show(struct trie *t, struct seq_file *seq) | |||
2279 | seq_printf(seq,"semantic match passed = %d\n", t->stats.semantic_match_passed); | 2434 | seq_printf(seq,"semantic match passed = %d\n", t->stats.semantic_match_passed); |
2280 | seq_printf(seq,"semantic match miss = %d\n", t->stats.semantic_match_miss); | 2435 | seq_printf(seq,"semantic match miss = %d\n", t->stats.semantic_match_miss); |
2281 | seq_printf(seq,"null node hit= %d\n", t->stats.null_node_hit); | 2436 | seq_printf(seq,"null node hit= %d\n", t->stats.null_node_hit); |
2437 | seq_printf(seq,"skipped node resize = %d\n", t->stats.resize_node_skipped); | ||
2282 | #ifdef CLEAR_STATS | 2438 | #ifdef CLEAR_STATS |
2283 | memset(&(t->stats), 0, sizeof(t->stats)); | 2439 | memset(&(t->stats), 0, sizeof(t->stats)); |
2284 | #endif | 2440 | #endif |
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index af2ec88bbb2f..c703528e0bcd 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -283,14 +283,18 @@ static inline int ip_rcv_finish(struct sk_buff *skb) | |||
283 | { | 283 | { |
284 | struct net_device *dev = skb->dev; | 284 | struct net_device *dev = skb->dev; |
285 | struct iphdr *iph = skb->nh.iph; | 285 | struct iphdr *iph = skb->nh.iph; |
286 | int err; | ||
286 | 287 | ||
287 | /* | 288 | /* |
288 | * Initialise the virtual path cache for the packet. It describes | 289 | * Initialise the virtual path cache for the packet. It describes |
289 | * how the packet travels inside Linux networking. | 290 | * how the packet travels inside Linux networking. |
290 | */ | 291 | */ |
291 | if (skb->dst == NULL) { | 292 | if (skb->dst == NULL) { |
292 | if (ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev)) | 293 | if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) { |
294 | if (err == -EHOSTUNREACH) | ||
295 | IP_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS); | ||
293 | goto drop; | 296 | goto drop; |
297 | } | ||
294 | } | 298 | } |
295 | 299 | ||
296 | #ifdef CONFIG_NET_CLS_ROUTE | 300 | #ifdef CONFIG_NET_CLS_ROUTE |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index ee07aec215a0..9de83e6e0f1d 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -188,7 +188,13 @@ static inline int ip_finish_output2(struct sk_buff *skb) | |||
188 | skb = skb2; | 188 | skb = skb2; |
189 | } | 189 | } |
190 | 190 | ||
191 | nf_reset(skb); | 191 | #ifdef CONFIG_BRIDGE_NETFILTER |
192 | /* bridge-netfilter defers calling some IP hooks to the bridge layer | ||
193 | * and still needs the conntrack reference. | ||
194 | */ | ||
195 | if (skb->nf_bridge == NULL) | ||
196 | #endif | ||
197 | nf_reset(skb); | ||
192 | 198 | ||
193 | if (hh) { | 199 | if (hh) { |
194 | int hh_alen; | 200 | int hh_alen; |
@@ -383,7 +389,6 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from) | |||
383 | to->pkt_type = from->pkt_type; | 389 | to->pkt_type = from->pkt_type; |
384 | to->priority = from->priority; | 390 | to->priority = from->priority; |
385 | to->protocol = from->protocol; | 391 | to->protocol = from->protocol; |
386 | to->security = from->security; | ||
387 | dst_release(to->dst); | 392 | dst_release(to->dst); |
388 | to->dst = dst_clone(from->dst); | 393 | to->dst = dst_clone(from->dst); |
389 | to->dev = from->dev; | 394 | to->dev = from->dev; |
@@ -1323,23 +1328,8 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar | |||
1323 | ip_rt_put(rt); | 1328 | ip_rt_put(rt); |
1324 | } | 1329 | } |
1325 | 1330 | ||
1326 | /* | ||
1327 | * IP protocol layer initialiser | ||
1328 | */ | ||
1329 | |||
1330 | static struct packet_type ip_packet_type = { | ||
1331 | .type = __constant_htons(ETH_P_IP), | ||
1332 | .func = ip_rcv, | ||
1333 | }; | ||
1334 | |||
1335 | /* | ||
1336 | * IP registers the packet type and then calls the subprotocol initialisers | ||
1337 | */ | ||
1338 | |||
1339 | void __init ip_init(void) | 1331 | void __init ip_init(void) |
1340 | { | 1332 | { |
1341 | dev_add_pack(&ip_packet_type); | ||
1342 | |||
1343 | ip_rt_init(); | 1333 | ip_rt_init(); |
1344 | inet_initpeers(); | 1334 | inet_initpeers(); |
1345 | 1335 | ||
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index f2509034ce72..d2bf8e1930a3 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -1149,8 +1149,10 @@ static int __init ic_dynamic(void) | |||
1149 | ic_rarp_cleanup(); | 1149 | ic_rarp_cleanup(); |
1150 | #endif | 1150 | #endif |
1151 | 1151 | ||
1152 | if (!ic_got_reply) | 1152 | if (!ic_got_reply) { |
1153 | ic_myaddr = INADDR_NONE; | ||
1153 | return -1; | 1154 | return -1; |
1155 | } | ||
1154 | 1156 | ||
1155 | printk("IP-Config: Got %s answer from %u.%u.%u.%u, ", | 1157 | printk("IP-Config: Got %s answer from %u.%u.%u.%u, ", |
1156 | ((ic_got_reply & IC_RARP) ? "RARP" | 1158 | ((ic_got_reply & IC_RARP) ? "RARP" |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index e4f809a93f47..7833d920bdba 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -297,6 +297,7 @@ static int vif_delete(int vifi) | |||
297 | static void ipmr_destroy_unres(struct mfc_cache *c) | 297 | static void ipmr_destroy_unres(struct mfc_cache *c) |
298 | { | 298 | { |
299 | struct sk_buff *skb; | 299 | struct sk_buff *skb; |
300 | struct nlmsgerr *e; | ||
300 | 301 | ||
301 | atomic_dec(&cache_resolve_queue_len); | 302 | atomic_dec(&cache_resolve_queue_len); |
302 | 303 | ||
@@ -306,7 +307,9 @@ static void ipmr_destroy_unres(struct mfc_cache *c) | |||
306 | nlh->nlmsg_type = NLMSG_ERROR; | 307 | nlh->nlmsg_type = NLMSG_ERROR; |
307 | nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); | 308 | nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); |
308 | skb_trim(skb, nlh->nlmsg_len); | 309 | skb_trim(skb, nlh->nlmsg_len); |
309 | ((struct nlmsgerr*)NLMSG_DATA(nlh))->error = -ETIMEDOUT; | 310 | e = NLMSG_DATA(nlh); |
311 | e->error = -ETIMEDOUT; | ||
312 | memset(&e->msg, 0, sizeof(e->msg)); | ||
310 | netlink_unicast(rtnl, skb, NETLINK_CB(skb).dst_pid, MSG_DONTWAIT); | 313 | netlink_unicast(rtnl, skb, NETLINK_CB(skb).dst_pid, MSG_DONTWAIT); |
311 | } else | 314 | } else |
312 | kfree_skb(skb); | 315 | kfree_skb(skb); |
@@ -499,6 +502,7 @@ static struct mfc_cache *ipmr_cache_alloc_unres(void) | |||
499 | static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c) | 502 | static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c) |
500 | { | 503 | { |
501 | struct sk_buff *skb; | 504 | struct sk_buff *skb; |
505 | struct nlmsgerr *e; | ||
502 | 506 | ||
503 | /* | 507 | /* |
504 | * Play the pending entries through our router | 508 | * Play the pending entries through our router |
@@ -515,7 +519,9 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c) | |||
515 | nlh->nlmsg_type = NLMSG_ERROR; | 519 | nlh->nlmsg_type = NLMSG_ERROR; |
516 | nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); | 520 | nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); |
517 | skb_trim(skb, nlh->nlmsg_len); | 521 | skb_trim(skb, nlh->nlmsg_len); |
518 | ((struct nlmsgerr*)NLMSG_DATA(nlh))->error = -EMSGSIZE; | 522 | e = NLMSG_DATA(nlh); |
523 | e->error = -EMSGSIZE; | ||
524 | memset(&e->msg, 0, sizeof(e->msg)); | ||
519 | } | 525 | } |
520 | err = netlink_unicast(rtnl, skb, NETLINK_CB(skb).dst_pid, MSG_DONTWAIT); | 526 | err = netlink_unicast(rtnl, skb, NETLINK_CB(skb).dst_pid, MSG_DONTWAIT); |
521 | } else | 527 | } else |
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c index fd6feb5499fe..9f16ab309106 100644 --- a/net/ipv4/ipvs/ip_vs_conn.c +++ b/net/ipv4/ipvs/ip_vs_conn.c | |||
@@ -548,7 +548,6 @@ void ip_vs_conn_expire_now(struct ip_vs_conn *cp) | |||
548 | { | 548 | { |
549 | if (del_timer(&cp->timer)) | 549 | if (del_timer(&cp->timer)) |
550 | mod_timer(&cp->timer, jiffies); | 550 | mod_timer(&cp->timer, jiffies); |
551 | __ip_vs_conn_put(cp); | ||
552 | } | 551 | } |
553 | 552 | ||
554 | 553 | ||
@@ -764,7 +763,6 @@ void ip_vs_random_dropentry(void) | |||
764 | { | 763 | { |
765 | int idx; | 764 | int idx; |
766 | struct ip_vs_conn *cp; | 765 | struct ip_vs_conn *cp; |
767 | struct ip_vs_conn *ct; | ||
768 | 766 | ||
769 | /* | 767 | /* |
770 | * Randomly scan 1/32 of the whole table every second | 768 | * Randomly scan 1/32 of the whole table every second |
@@ -801,21 +799,12 @@ void ip_vs_random_dropentry(void) | |||
801 | continue; | 799 | continue; |
802 | } | 800 | } |
803 | 801 | ||
804 | /* | ||
805 | * Drop the entry, and drop its ct if not referenced | ||
806 | */ | ||
807 | atomic_inc(&cp->refcnt); | ||
808 | ct_write_unlock(hash); | ||
809 | |||
810 | if ((ct = cp->control)) | ||
811 | atomic_inc(&ct->refcnt); | ||
812 | IP_VS_DBG(4, "del connection\n"); | 802 | IP_VS_DBG(4, "del connection\n"); |
813 | ip_vs_conn_expire_now(cp); | 803 | ip_vs_conn_expire_now(cp); |
814 | if (ct) { | 804 | if (cp->control) { |
815 | IP_VS_DBG(4, "del conn template\n"); | 805 | IP_VS_DBG(4, "del conn template\n"); |
816 | ip_vs_conn_expire_now(ct); | 806 | ip_vs_conn_expire_now(cp->control); |
817 | } | 807 | } |
818 | ct_write_lock(hash); | ||
819 | } | 808 | } |
820 | ct_write_unlock(hash); | 809 | ct_write_unlock(hash); |
821 | } | 810 | } |
@@ -829,7 +818,6 @@ static void ip_vs_conn_flush(void) | |||
829 | { | 818 | { |
830 | int idx; | 819 | int idx; |
831 | struct ip_vs_conn *cp; | 820 | struct ip_vs_conn *cp; |
832 | struct ip_vs_conn *ct; | ||
833 | 821 | ||
834 | flush_again: | 822 | flush_again: |
835 | for (idx=0; idx<IP_VS_CONN_TAB_SIZE; idx++) { | 823 | for (idx=0; idx<IP_VS_CONN_TAB_SIZE; idx++) { |
@@ -839,18 +827,13 @@ static void ip_vs_conn_flush(void) | |||
839 | ct_write_lock_bh(idx); | 827 | ct_write_lock_bh(idx); |
840 | 828 | ||
841 | list_for_each_entry(cp, &ip_vs_conn_tab[idx], c_list) { | 829 | list_for_each_entry(cp, &ip_vs_conn_tab[idx], c_list) { |
842 | atomic_inc(&cp->refcnt); | ||
843 | ct_write_unlock(idx); | ||
844 | 830 | ||
845 | if ((ct = cp->control)) | ||
846 | atomic_inc(&ct->refcnt); | ||
847 | IP_VS_DBG(4, "del connection\n"); | 831 | IP_VS_DBG(4, "del connection\n"); |
848 | ip_vs_conn_expire_now(cp); | 832 | ip_vs_conn_expire_now(cp); |
849 | if (ct) { | 833 | if (cp->control) { |
850 | IP_VS_DBG(4, "del conn template\n"); | 834 | IP_VS_DBG(4, "del conn template\n"); |
851 | ip_vs_conn_expire_now(ct); | 835 | ip_vs_conn_expire_now(cp->control); |
852 | } | 836 | } |
853 | ct_write_lock(idx); | ||
854 | } | 837 | } |
855 | ct_write_unlock_bh(idx); | 838 | ct_write_unlock_bh(idx); |
856 | } | 839 | } |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 9cde8c61f525..6706d3a1bc4f 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/netfilter_ipv4/ipt_CLUSTERIP.h> | 30 | #include <linux/netfilter_ipv4/ipt_CLUSTERIP.h> |
31 | #include <linux/netfilter_ipv4/ip_conntrack.h> | 31 | #include <linux/netfilter_ipv4/ip_conntrack.h> |
32 | 32 | ||
33 | #define CLUSTERIP_VERSION "0.6" | 33 | #define CLUSTERIP_VERSION "0.7" |
34 | 34 | ||
35 | #define DEBUG_CLUSTERIP | 35 | #define DEBUG_CLUSTERIP |
36 | 36 | ||
@@ -524,8 +524,9 @@ arp_mangle(unsigned int hook, | |||
524 | || arp->ar_pln != 4 || arp->ar_hln != ETH_ALEN) | 524 | || arp->ar_pln != 4 || arp->ar_hln != ETH_ALEN) |
525 | return NF_ACCEPT; | 525 | return NF_ACCEPT; |
526 | 526 | ||
527 | /* we only want to mangle arp replies */ | 527 | /* we only want to mangle arp requests and replies */ |
528 | if (arp->ar_op != htons(ARPOP_REPLY)) | 528 | if (arp->ar_op != htons(ARPOP_REPLY) |
529 | && arp->ar_op != htons(ARPOP_REQUEST)) | ||
529 | return NF_ACCEPT; | 530 | return NF_ACCEPT; |
530 | 531 | ||
531 | payload = (void *)(arp+1); | 532 | payload = (void *)(arp+1); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 80cf633d9f4a..726ea5e8180a 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -54,6 +54,7 @@ | |||
54 | * Marc Boucher : routing by fwmark | 54 | * Marc Boucher : routing by fwmark |
55 | * Robert Olsson : Added rt_cache statistics | 55 | * Robert Olsson : Added rt_cache statistics |
56 | * Arnaldo C. Melo : Convert proc stuff to seq_file | 56 | * Arnaldo C. Melo : Convert proc stuff to seq_file |
57 | * Eric Dumazet : hashed spinlocks and rt_check_expire() fixes. | ||
57 | * | 58 | * |
58 | * This program is free software; you can redistribute it and/or | 59 | * This program is free software; you can redistribute it and/or |
59 | * modify it under the terms of the GNU General Public License | 60 | * modify it under the terms of the GNU General Public License |
@@ -70,6 +71,7 @@ | |||
70 | #include <linux/kernel.h> | 71 | #include <linux/kernel.h> |
71 | #include <linux/sched.h> | 72 | #include <linux/sched.h> |
72 | #include <linux/mm.h> | 73 | #include <linux/mm.h> |
74 | #include <linux/bootmem.h> | ||
73 | #include <linux/string.h> | 75 | #include <linux/string.h> |
74 | #include <linux/socket.h> | 76 | #include <linux/socket.h> |
75 | #include <linux/sockios.h> | 77 | #include <linux/sockios.h> |
@@ -201,8 +203,37 @@ __u8 ip_tos2prio[16] = { | |||
201 | 203 | ||
202 | struct rt_hash_bucket { | 204 | struct rt_hash_bucket { |
203 | struct rtable *chain; | 205 | struct rtable *chain; |
204 | spinlock_t lock; | 206 | }; |
205 | } __attribute__((__aligned__(8))); | 207 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
208 | /* | ||
209 | * Instead of using one spinlock for each rt_hash_bucket, we use a table of spinlocks | ||
210 | * The size of this table is a power of two and depends on the number of CPUS. | ||
211 | */ | ||
212 | #if NR_CPUS >= 32 | ||
213 | #define RT_HASH_LOCK_SZ 4096 | ||
214 | #elif NR_CPUS >= 16 | ||
215 | #define RT_HASH_LOCK_SZ 2048 | ||
216 | #elif NR_CPUS >= 8 | ||
217 | #define RT_HASH_LOCK_SZ 1024 | ||
218 | #elif NR_CPUS >= 4 | ||
219 | #define RT_HASH_LOCK_SZ 512 | ||
220 | #else | ||
221 | #define RT_HASH_LOCK_SZ 256 | ||
222 | #endif | ||
223 | |||
224 | static spinlock_t *rt_hash_locks; | ||
225 | # define rt_hash_lock_addr(slot) &rt_hash_locks[(slot) & (RT_HASH_LOCK_SZ - 1)] | ||
226 | # define rt_hash_lock_init() { \ | ||
227 | int i; \ | ||
228 | rt_hash_locks = kmalloc(sizeof(spinlock_t) * RT_HASH_LOCK_SZ, GFP_KERNEL); \ | ||
229 | if (!rt_hash_locks) panic("IP: failed to allocate rt_hash_locks\n"); \ | ||
230 | for (i = 0; i < RT_HASH_LOCK_SZ; i++) \ | ||
231 | spin_lock_init(&rt_hash_locks[i]); \ | ||
232 | } | ||
233 | #else | ||
234 | # define rt_hash_lock_addr(slot) NULL | ||
235 | # define rt_hash_lock_init() | ||
236 | #endif | ||
206 | 237 | ||
207 | static struct rt_hash_bucket *rt_hash_table; | 238 | static struct rt_hash_bucket *rt_hash_table; |
208 | static unsigned rt_hash_mask; | 239 | static unsigned rt_hash_mask; |
@@ -575,19 +606,26 @@ static struct rtable **rt_remove_balanced_route(struct rtable **chain_head, | |||
575 | /* This runs via a timer and thus is always in BH context. */ | 606 | /* This runs via a timer and thus is always in BH context. */ |
576 | static void rt_check_expire(unsigned long dummy) | 607 | static void rt_check_expire(unsigned long dummy) |
577 | { | 608 | { |
578 | static int rover; | 609 | static unsigned int rover; |
579 | int i = rover, t; | 610 | unsigned int i = rover, goal; |
580 | struct rtable *rth, **rthp; | 611 | struct rtable *rth, **rthp; |
581 | unsigned long now = jiffies; | 612 | unsigned long now = jiffies; |
582 | 613 | u64 mult; | |
583 | for (t = ip_rt_gc_interval << rt_hash_log; t >= 0; | 614 | |
584 | t -= ip_rt_gc_timeout) { | 615 | mult = ((u64)ip_rt_gc_interval) << rt_hash_log; |
616 | if (ip_rt_gc_timeout > 1) | ||
617 | do_div(mult, ip_rt_gc_timeout); | ||
618 | goal = (unsigned int)mult; | ||
619 | if (goal > rt_hash_mask) goal = rt_hash_mask + 1; | ||
620 | for (; goal > 0; goal--) { | ||
585 | unsigned long tmo = ip_rt_gc_timeout; | 621 | unsigned long tmo = ip_rt_gc_timeout; |
586 | 622 | ||
587 | i = (i + 1) & rt_hash_mask; | 623 | i = (i + 1) & rt_hash_mask; |
588 | rthp = &rt_hash_table[i].chain; | 624 | rthp = &rt_hash_table[i].chain; |
589 | 625 | ||
590 | spin_lock(&rt_hash_table[i].lock); | 626 | if (*rthp == 0) |
627 | continue; | ||
628 | spin_lock(rt_hash_lock_addr(i)); | ||
591 | while ((rth = *rthp) != NULL) { | 629 | while ((rth = *rthp) != NULL) { |
592 | if (rth->u.dst.expires) { | 630 | if (rth->u.dst.expires) { |
593 | /* Entry is expired even if it is in use */ | 631 | /* Entry is expired even if it is in use */ |
@@ -620,14 +658,14 @@ static void rt_check_expire(unsigned long dummy) | |||
620 | rt_free(rth); | 658 | rt_free(rth); |
621 | #endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ | 659 | #endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ |
622 | } | 660 | } |
623 | spin_unlock(&rt_hash_table[i].lock); | 661 | spin_unlock(rt_hash_lock_addr(i)); |
624 | 662 | ||
625 | /* Fallback loop breaker. */ | 663 | /* Fallback loop breaker. */ |
626 | if (time_after(jiffies, now)) | 664 | if (time_after(jiffies, now)) |
627 | break; | 665 | break; |
628 | } | 666 | } |
629 | rover = i; | 667 | rover = i; |
630 | mod_timer(&rt_periodic_timer, now + ip_rt_gc_interval); | 668 | mod_timer(&rt_periodic_timer, jiffies + ip_rt_gc_interval); |
631 | } | 669 | } |
632 | 670 | ||
633 | /* This can run from both BH and non-BH contexts, the latter | 671 | /* This can run from both BH and non-BH contexts, the latter |
@@ -643,11 +681,11 @@ static void rt_run_flush(unsigned long dummy) | |||
643 | get_random_bytes(&rt_hash_rnd, 4); | 681 | get_random_bytes(&rt_hash_rnd, 4); |
644 | 682 | ||
645 | for (i = rt_hash_mask; i >= 0; i--) { | 683 | for (i = rt_hash_mask; i >= 0; i--) { |
646 | spin_lock_bh(&rt_hash_table[i].lock); | 684 | spin_lock_bh(rt_hash_lock_addr(i)); |
647 | rth = rt_hash_table[i].chain; | 685 | rth = rt_hash_table[i].chain; |
648 | if (rth) | 686 | if (rth) |
649 | rt_hash_table[i].chain = NULL; | 687 | rt_hash_table[i].chain = NULL; |
650 | spin_unlock_bh(&rt_hash_table[i].lock); | 688 | spin_unlock_bh(rt_hash_lock_addr(i)); |
651 | 689 | ||
652 | for (; rth; rth = next) { | 690 | for (; rth; rth = next) { |
653 | next = rth->u.rt_next; | 691 | next = rth->u.rt_next; |
@@ -780,7 +818,7 @@ static int rt_garbage_collect(void) | |||
780 | 818 | ||
781 | k = (k + 1) & rt_hash_mask; | 819 | k = (k + 1) & rt_hash_mask; |
782 | rthp = &rt_hash_table[k].chain; | 820 | rthp = &rt_hash_table[k].chain; |
783 | spin_lock_bh(&rt_hash_table[k].lock); | 821 | spin_lock_bh(rt_hash_lock_addr(k)); |
784 | while ((rth = *rthp) != NULL) { | 822 | while ((rth = *rthp) != NULL) { |
785 | if (!rt_may_expire(rth, tmo, expire)) { | 823 | if (!rt_may_expire(rth, tmo, expire)) { |
786 | tmo >>= 1; | 824 | tmo >>= 1; |
@@ -812,7 +850,7 @@ static int rt_garbage_collect(void) | |||
812 | goal--; | 850 | goal--; |
813 | #endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ | 851 | #endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ |
814 | } | 852 | } |
815 | spin_unlock_bh(&rt_hash_table[k].lock); | 853 | spin_unlock_bh(rt_hash_lock_addr(k)); |
816 | if (goal <= 0) | 854 | if (goal <= 0) |
817 | break; | 855 | break; |
818 | } | 856 | } |
@@ -882,7 +920,7 @@ restart: | |||
882 | 920 | ||
883 | rthp = &rt_hash_table[hash].chain; | 921 | rthp = &rt_hash_table[hash].chain; |
884 | 922 | ||
885 | spin_lock_bh(&rt_hash_table[hash].lock); | 923 | spin_lock_bh(rt_hash_lock_addr(hash)); |
886 | while ((rth = *rthp) != NULL) { | 924 | while ((rth = *rthp) != NULL) { |
887 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED | 925 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED |
888 | if (!(rth->u.dst.flags & DST_BALANCED) && | 926 | if (!(rth->u.dst.flags & DST_BALANCED) && |
@@ -908,7 +946,7 @@ restart: | |||
908 | rth->u.dst.__use++; | 946 | rth->u.dst.__use++; |
909 | dst_hold(&rth->u.dst); | 947 | dst_hold(&rth->u.dst); |
910 | rth->u.dst.lastuse = now; | 948 | rth->u.dst.lastuse = now; |
911 | spin_unlock_bh(&rt_hash_table[hash].lock); | 949 | spin_unlock_bh(rt_hash_lock_addr(hash)); |
912 | 950 | ||
913 | rt_drop(rt); | 951 | rt_drop(rt); |
914 | *rp = rth; | 952 | *rp = rth; |
@@ -949,7 +987,7 @@ restart: | |||
949 | if (rt->rt_type == RTN_UNICAST || rt->fl.iif == 0) { | 987 | if (rt->rt_type == RTN_UNICAST || rt->fl.iif == 0) { |
950 | int err = arp_bind_neighbour(&rt->u.dst); | 988 | int err = arp_bind_neighbour(&rt->u.dst); |
951 | if (err) { | 989 | if (err) { |
952 | spin_unlock_bh(&rt_hash_table[hash].lock); | 990 | spin_unlock_bh(rt_hash_lock_addr(hash)); |
953 | 991 | ||
954 | if (err != -ENOBUFS) { | 992 | if (err != -ENOBUFS) { |
955 | rt_drop(rt); | 993 | rt_drop(rt); |
@@ -990,7 +1028,7 @@ restart: | |||
990 | } | 1028 | } |
991 | #endif | 1029 | #endif |
992 | rt_hash_table[hash].chain = rt; | 1030 | rt_hash_table[hash].chain = rt; |
993 | spin_unlock_bh(&rt_hash_table[hash].lock); | 1031 | spin_unlock_bh(rt_hash_lock_addr(hash)); |
994 | *rp = rt; | 1032 | *rp = rt; |
995 | return 0; | 1033 | return 0; |
996 | } | 1034 | } |
@@ -1058,7 +1096,7 @@ static void rt_del(unsigned hash, struct rtable *rt) | |||
1058 | { | 1096 | { |
1059 | struct rtable **rthp; | 1097 | struct rtable **rthp; |
1060 | 1098 | ||
1061 | spin_lock_bh(&rt_hash_table[hash].lock); | 1099 | spin_lock_bh(rt_hash_lock_addr(hash)); |
1062 | ip_rt_put(rt); | 1100 | ip_rt_put(rt); |
1063 | for (rthp = &rt_hash_table[hash].chain; *rthp; | 1101 | for (rthp = &rt_hash_table[hash].chain; *rthp; |
1064 | rthp = &(*rthp)->u.rt_next) | 1102 | rthp = &(*rthp)->u.rt_next) |
@@ -1067,7 +1105,7 @@ static void rt_del(unsigned hash, struct rtable *rt) | |||
1067 | rt_free(rt); | 1105 | rt_free(rt); |
1068 | break; | 1106 | break; |
1069 | } | 1107 | } |
1070 | spin_unlock_bh(&rt_hash_table[hash].lock); | 1108 | spin_unlock_bh(rt_hash_lock_addr(hash)); |
1071 | } | 1109 | } |
1072 | 1110 | ||
1073 | void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw, | 1111 | void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw, |
@@ -1909,7 +1947,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr, | |||
1909 | */ | 1947 | */ |
1910 | if ((err = fib_lookup(&fl, &res)) != 0) { | 1948 | if ((err = fib_lookup(&fl, &res)) != 0) { |
1911 | if (!IN_DEV_FORWARD(in_dev)) | 1949 | if (!IN_DEV_FORWARD(in_dev)) |
1912 | goto e_inval; | 1950 | goto e_hostunreach; |
1913 | goto no_route; | 1951 | goto no_route; |
1914 | } | 1952 | } |
1915 | free_res = 1; | 1953 | free_res = 1; |
@@ -1933,7 +1971,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr, | |||
1933 | } | 1971 | } |
1934 | 1972 | ||
1935 | if (!IN_DEV_FORWARD(in_dev)) | 1973 | if (!IN_DEV_FORWARD(in_dev)) |
1936 | goto e_inval; | 1974 | goto e_hostunreach; |
1937 | if (res.type != RTN_UNICAST) | 1975 | if (res.type != RTN_UNICAST) |
1938 | goto martian_destination; | 1976 | goto martian_destination; |
1939 | 1977 | ||
@@ -2025,6 +2063,11 @@ martian_destination: | |||
2025 | "%u.%u.%u.%u, dev %s\n", | 2063 | "%u.%u.%u.%u, dev %s\n", |
2026 | NIPQUAD(daddr), NIPQUAD(saddr), dev->name); | 2064 | NIPQUAD(daddr), NIPQUAD(saddr), dev->name); |
2027 | #endif | 2065 | #endif |
2066 | |||
2067 | e_hostunreach: | ||
2068 | err = -EHOSTUNREACH; | ||
2069 | goto done; | ||
2070 | |||
2028 | e_inval: | 2071 | e_inval: |
2029 | err = -EINVAL; | 2072 | err = -EINVAL; |
2030 | goto done; | 2073 | goto done; |
@@ -3068,12 +3111,14 @@ __setup("rhash_entries=", set_rhash_entries); | |||
3068 | 3111 | ||
3069 | int __init ip_rt_init(void) | 3112 | int __init ip_rt_init(void) |
3070 | { | 3113 | { |
3071 | int i, order, goal, rc = 0; | 3114 | int rc = 0; |
3072 | 3115 | ||
3073 | rt_hash_rnd = (int) ((num_physpages ^ (num_physpages>>8)) ^ | 3116 | rt_hash_rnd = (int) ((num_physpages ^ (num_physpages>>8)) ^ |
3074 | (jiffies ^ (jiffies >> 7))); | 3117 | (jiffies ^ (jiffies >> 7))); |
3075 | 3118 | ||
3076 | #ifdef CONFIG_NET_CLS_ROUTE | 3119 | #ifdef CONFIG_NET_CLS_ROUTE |
3120 | { | ||
3121 | int order; | ||
3077 | for (order = 0; | 3122 | for (order = 0; |
3078 | (PAGE_SIZE << order) < 256 * sizeof(struct ip_rt_acct) * NR_CPUS; order++) | 3123 | (PAGE_SIZE << order) < 256 * sizeof(struct ip_rt_acct) * NR_CPUS; order++) |
3079 | /* NOTHING */; | 3124 | /* NOTHING */; |
@@ -3081,6 +3126,7 @@ int __init ip_rt_init(void) | |||
3081 | if (!ip_rt_acct) | 3126 | if (!ip_rt_acct) |
3082 | panic("IP: failed to allocate ip_rt_acct\n"); | 3127 | panic("IP: failed to allocate ip_rt_acct\n"); |
3083 | memset(ip_rt_acct, 0, PAGE_SIZE << order); | 3128 | memset(ip_rt_acct, 0, PAGE_SIZE << order); |
3129 | } | ||
3084 | #endif | 3130 | #endif |
3085 | 3131 | ||
3086 | ipv4_dst_ops.kmem_cachep = kmem_cache_create("ip_dst_cache", | 3132 | ipv4_dst_ops.kmem_cachep = kmem_cache_create("ip_dst_cache", |
@@ -3091,36 +3137,19 @@ int __init ip_rt_init(void) | |||
3091 | if (!ipv4_dst_ops.kmem_cachep) | 3137 | if (!ipv4_dst_ops.kmem_cachep) |
3092 | panic("IP: failed to allocate ip_dst_cache\n"); | 3138 | panic("IP: failed to allocate ip_dst_cache\n"); |
3093 | 3139 | ||
3094 | goal = num_physpages >> (26 - PAGE_SHIFT); | 3140 | rt_hash_table = (struct rt_hash_bucket *) |
3095 | if (rhash_entries) | 3141 | alloc_large_system_hash("IP route cache", |
3096 | goal = (rhash_entries * sizeof(struct rt_hash_bucket)) >> PAGE_SHIFT; | 3142 | sizeof(struct rt_hash_bucket), |
3097 | for (order = 0; (1UL << order) < goal; order++) | 3143 | rhash_entries, |
3098 | /* NOTHING */; | 3144 | (num_physpages >= 128 * 1024) ? |
3099 | 3145 | (27 - PAGE_SHIFT) : | |
3100 | do { | 3146 | (29 - PAGE_SHIFT), |
3101 | rt_hash_mask = (1UL << order) * PAGE_SIZE / | 3147 | HASH_HIGHMEM, |
3102 | sizeof(struct rt_hash_bucket); | 3148 | &rt_hash_log, |
3103 | while (rt_hash_mask & (rt_hash_mask - 1)) | 3149 | &rt_hash_mask, |
3104 | rt_hash_mask--; | 3150 | 0); |
3105 | rt_hash_table = (struct rt_hash_bucket *) | 3151 | memset(rt_hash_table, 0, (rt_hash_mask + 1) * sizeof(struct rt_hash_bucket)); |
3106 | __get_free_pages(GFP_ATOMIC, order); | 3152 | rt_hash_lock_init(); |
3107 | } while (rt_hash_table == NULL && --order > 0); | ||
3108 | |||
3109 | if (!rt_hash_table) | ||
3110 | panic("Failed to allocate IP route cache hash table\n"); | ||
3111 | |||
3112 | printk(KERN_INFO "IP: routing cache hash table of %u buckets, %ldKbytes\n", | ||
3113 | rt_hash_mask, | ||
3114 | (long) (rt_hash_mask * sizeof(struct rt_hash_bucket)) / 1024); | ||
3115 | |||
3116 | for (rt_hash_log = 0; (1 << rt_hash_log) != rt_hash_mask; rt_hash_log++) | ||
3117 | /* NOTHING */; | ||
3118 | |||
3119 | rt_hash_mask--; | ||
3120 | for (i = 0; i <= rt_hash_mask; i++) { | ||
3121 | spin_lock_init(&rt_hash_table[i].lock); | ||
3122 | rt_hash_table[i].chain = NULL; | ||
3123 | } | ||
3124 | 3153 | ||
3125 | ipv4_dst_ops.gc_thresh = (rt_hash_mask + 1); | 3154 | ipv4_dst_ops.gc_thresh = (rt_hash_mask + 1); |
3126 | ip_rt_max_size = (rt_hash_mask + 1) * 16; | 3155 | ip_rt_max_size = (rt_hash_mask + 1) * 16; |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 882436da9a3a..29894c749163 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -615,7 +615,7 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffse | |||
615 | size_t psize, int flags) | 615 | size_t psize, int flags) |
616 | { | 616 | { |
617 | struct tcp_sock *tp = tcp_sk(sk); | 617 | struct tcp_sock *tp = tcp_sk(sk); |
618 | int mss_now; | 618 | int mss_now, size_goal; |
619 | int err; | 619 | int err; |
620 | ssize_t copied; | 620 | ssize_t copied; |
621 | long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); | 621 | long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); |
@@ -628,6 +628,7 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffse | |||
628 | clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); | 628 | clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); |
629 | 629 | ||
630 | mss_now = tcp_current_mss(sk, !(flags&MSG_OOB)); | 630 | mss_now = tcp_current_mss(sk, !(flags&MSG_OOB)); |
631 | size_goal = tp->xmit_size_goal; | ||
631 | copied = 0; | 632 | copied = 0; |
632 | 633 | ||
633 | err = -EPIPE; | 634 | err = -EPIPE; |
@@ -641,7 +642,7 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffse | |||
641 | int offset = poffset % PAGE_SIZE; | 642 | int offset = poffset % PAGE_SIZE; |
642 | int size = min_t(size_t, psize, PAGE_SIZE - offset); | 643 | int size = min_t(size_t, psize, PAGE_SIZE - offset); |
643 | 644 | ||
644 | if (!sk->sk_send_head || (copy = mss_now - skb->len) <= 0) { | 645 | if (!sk->sk_send_head || (copy = size_goal - skb->len) <= 0) { |
645 | new_segment: | 646 | new_segment: |
646 | if (!sk_stream_memory_free(sk)) | 647 | if (!sk_stream_memory_free(sk)) |
647 | goto wait_for_sndbuf; | 648 | goto wait_for_sndbuf; |
@@ -652,7 +653,7 @@ new_segment: | |||
652 | goto wait_for_memory; | 653 | goto wait_for_memory; |
653 | 654 | ||
654 | skb_entail(sk, tp, skb); | 655 | skb_entail(sk, tp, skb); |
655 | copy = mss_now; | 656 | copy = size_goal; |
656 | } | 657 | } |
657 | 658 | ||
658 | if (copy > size) | 659 | if (copy > size) |
@@ -693,7 +694,7 @@ new_segment: | |||
693 | if (!(psize -= copy)) | 694 | if (!(psize -= copy)) |
694 | goto out; | 695 | goto out; |
695 | 696 | ||
696 | if (skb->len != mss_now || (flags & MSG_OOB)) | 697 | if (skb->len < mss_now || (flags & MSG_OOB)) |
697 | continue; | 698 | continue; |
698 | 699 | ||
699 | if (forced_push(tp)) { | 700 | if (forced_push(tp)) { |
@@ -713,6 +714,7 @@ wait_for_memory: | |||
713 | goto do_error; | 714 | goto do_error; |
714 | 715 | ||
715 | mss_now = tcp_current_mss(sk, !(flags&MSG_OOB)); | 716 | mss_now = tcp_current_mss(sk, !(flags&MSG_OOB)); |
717 | size_goal = tp->xmit_size_goal; | ||
716 | } | 718 | } |
717 | 719 | ||
718 | out: | 720 | out: |
@@ -754,15 +756,20 @@ ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset, | |||
754 | 756 | ||
755 | static inline int select_size(struct sock *sk, struct tcp_sock *tp) | 757 | static inline int select_size(struct sock *sk, struct tcp_sock *tp) |
756 | { | 758 | { |
757 | int tmp = tp->mss_cache_std; | 759 | int tmp = tp->mss_cache; |
758 | 760 | ||
759 | if (sk->sk_route_caps & NETIF_F_SG) { | 761 | if (sk->sk_route_caps & NETIF_F_SG) { |
760 | int pgbreak = SKB_MAX_HEAD(MAX_TCP_HEADER); | 762 | if (sk->sk_route_caps & NETIF_F_TSO) |
763 | tmp = 0; | ||
764 | else { | ||
765 | int pgbreak = SKB_MAX_HEAD(MAX_TCP_HEADER); | ||
761 | 766 | ||
762 | if (tmp >= pgbreak && | 767 | if (tmp >= pgbreak && |
763 | tmp <= pgbreak + (MAX_SKB_FRAGS - 1) * PAGE_SIZE) | 768 | tmp <= pgbreak + (MAX_SKB_FRAGS - 1) * PAGE_SIZE) |
764 | tmp = pgbreak; | 769 | tmp = pgbreak; |
770 | } | ||
765 | } | 771 | } |
772 | |||
766 | return tmp; | 773 | return tmp; |
767 | } | 774 | } |
768 | 775 | ||
@@ -773,7 +780,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
773 | struct tcp_sock *tp = tcp_sk(sk); | 780 | struct tcp_sock *tp = tcp_sk(sk); |
774 | struct sk_buff *skb; | 781 | struct sk_buff *skb; |
775 | int iovlen, flags; | 782 | int iovlen, flags; |
776 | int mss_now; | 783 | int mss_now, size_goal; |
777 | int err, copied; | 784 | int err, copied; |
778 | long timeo; | 785 | long timeo; |
779 | 786 | ||
@@ -792,6 +799,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
792 | clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); | 799 | clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); |
793 | 800 | ||
794 | mss_now = tcp_current_mss(sk, !(flags&MSG_OOB)); | 801 | mss_now = tcp_current_mss(sk, !(flags&MSG_OOB)); |
802 | size_goal = tp->xmit_size_goal; | ||
795 | 803 | ||
796 | /* Ok commence sending. */ | 804 | /* Ok commence sending. */ |
797 | iovlen = msg->msg_iovlen; | 805 | iovlen = msg->msg_iovlen; |
@@ -814,7 +822,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
814 | skb = sk->sk_write_queue.prev; | 822 | skb = sk->sk_write_queue.prev; |
815 | 823 | ||
816 | if (!sk->sk_send_head || | 824 | if (!sk->sk_send_head || |
817 | (copy = mss_now - skb->len) <= 0) { | 825 | (copy = size_goal - skb->len) <= 0) { |
818 | 826 | ||
819 | new_segment: | 827 | new_segment: |
820 | /* Allocate new segment. If the interface is SG, | 828 | /* Allocate new segment. If the interface is SG, |
@@ -837,7 +845,7 @@ new_segment: | |||
837 | skb->ip_summed = CHECKSUM_HW; | 845 | skb->ip_summed = CHECKSUM_HW; |
838 | 846 | ||
839 | skb_entail(sk, tp, skb); | 847 | skb_entail(sk, tp, skb); |
840 | copy = mss_now; | 848 | copy = size_goal; |
841 | } | 849 | } |
842 | 850 | ||
843 | /* Try to append data to the end of skb. */ | 851 | /* Try to append data to the end of skb. */ |
@@ -872,11 +880,6 @@ new_segment: | |||
872 | tcp_mark_push(tp, skb); | 880 | tcp_mark_push(tp, skb); |
873 | goto new_segment; | 881 | goto new_segment; |
874 | } else if (page) { | 882 | } else if (page) { |
875 | /* If page is cached, align | ||
876 | * offset to L1 cache boundary | ||
877 | */ | ||
878 | off = (off + L1_CACHE_BYTES - 1) & | ||
879 | ~(L1_CACHE_BYTES - 1); | ||
880 | if (off == PAGE_SIZE) { | 883 | if (off == PAGE_SIZE) { |
881 | put_page(page); | 884 | put_page(page); |
882 | TCP_PAGE(sk) = page = NULL; | 885 | TCP_PAGE(sk) = page = NULL; |
@@ -937,7 +940,7 @@ new_segment: | |||
937 | if ((seglen -= copy) == 0 && iovlen == 0) | 940 | if ((seglen -= copy) == 0 && iovlen == 0) |
938 | goto out; | 941 | goto out; |
939 | 942 | ||
940 | if (skb->len != mss_now || (flags & MSG_OOB)) | 943 | if (skb->len < mss_now || (flags & MSG_OOB)) |
941 | continue; | 944 | continue; |
942 | 945 | ||
943 | if (forced_push(tp)) { | 946 | if (forced_push(tp)) { |
@@ -957,6 +960,7 @@ wait_for_memory: | |||
957 | goto do_error; | 960 | goto do_error; |
958 | 961 | ||
959 | mss_now = tcp_current_mss(sk, !(flags&MSG_OOB)); | 962 | mss_now = tcp_current_mss(sk, !(flags&MSG_OOB)); |
963 | size_goal = tp->xmit_size_goal; | ||
960 | } | 964 | } |
961 | } | 965 | } |
962 | 966 | ||
@@ -2128,7 +2132,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) | |||
2128 | 2132 | ||
2129 | info->tcpi_rto = jiffies_to_usecs(tp->rto); | 2133 | info->tcpi_rto = jiffies_to_usecs(tp->rto); |
2130 | info->tcpi_ato = jiffies_to_usecs(tp->ack.ato); | 2134 | info->tcpi_ato = jiffies_to_usecs(tp->ack.ato); |
2131 | info->tcpi_snd_mss = tp->mss_cache_std; | 2135 | info->tcpi_snd_mss = tp->mss_cache; |
2132 | info->tcpi_rcv_mss = tp->ack.rcv_mss; | 2136 | info->tcpi_rcv_mss = tp->ack.rcv_mss; |
2133 | 2137 | ||
2134 | info->tcpi_unacked = tp->packets_out; | 2138 | info->tcpi_unacked = tp->packets_out; |
@@ -2178,7 +2182,7 @@ int tcp_getsockopt(struct sock *sk, int level, int optname, char __user *optval, | |||
2178 | 2182 | ||
2179 | switch (optname) { | 2183 | switch (optname) { |
2180 | case TCP_MAXSEG: | 2184 | case TCP_MAXSEG: |
2181 | val = tp->mss_cache_std; | 2185 | val = tp->mss_cache; |
2182 | if (!val && ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) | 2186 | if (!val && ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) |
2183 | val = tp->rx_opt.user_mss; | 2187 | val = tp->rx_opt.user_mss; |
2184 | break; | 2188 | break; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 7bbbbc33eb4b..8de2f1071c2b 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -740,10 +740,10 @@ __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst) | |||
740 | __u32 cwnd = (dst ? dst_metric(dst, RTAX_INITCWND) : 0); | 740 | __u32 cwnd = (dst ? dst_metric(dst, RTAX_INITCWND) : 0); |
741 | 741 | ||
742 | if (!cwnd) { | 742 | if (!cwnd) { |
743 | if (tp->mss_cache_std > 1460) | 743 | if (tp->mss_cache > 1460) |
744 | cwnd = 2; | 744 | cwnd = 2; |
745 | else | 745 | else |
746 | cwnd = (tp->mss_cache_std > 1095) ? 3 : 4; | 746 | cwnd = (tp->mss_cache > 1095) ? 3 : 4; |
747 | } | 747 | } |
748 | return min_t(__u32, cwnd, tp->snd_cwnd_clamp); | 748 | return min_t(__u32, cwnd, tp->snd_cwnd_clamp); |
749 | } | 749 | } |
@@ -914,7 +914,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
914 | if (sk->sk_route_caps & NETIF_F_TSO) { | 914 | if (sk->sk_route_caps & NETIF_F_TSO) { |
915 | sk->sk_route_caps &= ~NETIF_F_TSO; | 915 | sk->sk_route_caps &= ~NETIF_F_TSO; |
916 | sock_set_flag(sk, SOCK_NO_LARGESEND); | 916 | sock_set_flag(sk, SOCK_NO_LARGESEND); |
917 | tp->mss_cache = tp->mss_cache_std; | 917 | tp->mss_cache = tp->mss_cache; |
918 | } | 918 | } |
919 | 919 | ||
920 | if (!tp->sacked_out) | 920 | if (!tp->sacked_out) |
@@ -1077,7 +1077,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
1077 | (IsFack(tp) || | 1077 | (IsFack(tp) || |
1078 | !before(lost_retrans, | 1078 | !before(lost_retrans, |
1079 | TCP_SKB_CB(skb)->ack_seq + tp->reordering * | 1079 | TCP_SKB_CB(skb)->ack_seq + tp->reordering * |
1080 | tp->mss_cache_std))) { | 1080 | tp->mss_cache))) { |
1081 | TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS; | 1081 | TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS; |
1082 | tp->retrans_out -= tcp_skb_pcount(skb); | 1082 | tp->retrans_out -= tcp_skb_pcount(skb); |
1083 | 1083 | ||
@@ -1957,15 +1957,6 @@ static inline void tcp_ack_packets_out(struct sock *sk, struct tcp_sock *tp) | |||
1957 | } | 1957 | } |
1958 | } | 1958 | } |
1959 | 1959 | ||
1960 | /* There is one downside to this scheme. Although we keep the | ||
1961 | * ACK clock ticking, adjusting packet counters and advancing | ||
1962 | * congestion window, we do not liberate socket send buffer | ||
1963 | * space. | ||
1964 | * | ||
1965 | * Mucking with skb->truesize and sk->sk_wmem_alloc et al. | ||
1966 | * then making a write space wakeup callback is a possible | ||
1967 | * future enhancement. WARNING: it is not trivial to make. | ||
1968 | */ | ||
1969 | static int tcp_tso_acked(struct sock *sk, struct sk_buff *skb, | 1960 | static int tcp_tso_acked(struct sock *sk, struct sk_buff *skb, |
1970 | __u32 now, __s32 *seq_rtt) | 1961 | __u32 now, __s32 *seq_rtt) |
1971 | { | 1962 | { |
@@ -2047,7 +2038,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p, s32 *seq_usrtt | |||
2047 | * the other end. | 2038 | * the other end. |
2048 | */ | 2039 | */ |
2049 | if (after(scb->end_seq, tp->snd_una)) { | 2040 | if (after(scb->end_seq, tp->snd_una)) { |
2050 | if (tcp_skb_pcount(skb) > 1) | 2041 | if (tcp_skb_pcount(skb) > 1 && |
2042 | after(tp->snd_una, scb->seq)) | ||
2051 | acked |= tcp_tso_acked(sk, skb, | 2043 | acked |= tcp_tso_acked(sk, skb, |
2052 | now, &seq_rtt); | 2044 | now, &seq_rtt); |
2053 | break; | 2045 | break; |
@@ -3308,6 +3300,28 @@ void tcp_cwnd_application_limited(struct sock *sk) | |||
3308 | tp->snd_cwnd_stamp = tcp_time_stamp; | 3300 | tp->snd_cwnd_stamp = tcp_time_stamp; |
3309 | } | 3301 | } |
3310 | 3302 | ||
3303 | static inline int tcp_should_expand_sndbuf(struct sock *sk, struct tcp_sock *tp) | ||
3304 | { | ||
3305 | /* If the user specified a specific send buffer setting, do | ||
3306 | * not modify it. | ||
3307 | */ | ||
3308 | if (sk->sk_userlocks & SOCK_SNDBUF_LOCK) | ||
3309 | return 0; | ||
3310 | |||
3311 | /* If we are under global TCP memory pressure, do not expand. */ | ||
3312 | if (tcp_memory_pressure) | ||
3313 | return 0; | ||
3314 | |||
3315 | /* If we are under soft global TCP memory pressure, do not expand. */ | ||
3316 | if (atomic_read(&tcp_memory_allocated) >= sysctl_tcp_mem[0]) | ||
3317 | return 0; | ||
3318 | |||
3319 | /* If we filled the congestion window, do not expand. */ | ||
3320 | if (tp->packets_out >= tp->snd_cwnd) | ||
3321 | return 0; | ||
3322 | |||
3323 | return 1; | ||
3324 | } | ||
3311 | 3325 | ||
3312 | /* When incoming ACK allowed to free some skb from write_queue, | 3326 | /* When incoming ACK allowed to free some skb from write_queue, |
3313 | * we remember this event in flag SOCK_QUEUE_SHRUNK and wake up socket | 3327 | * we remember this event in flag SOCK_QUEUE_SHRUNK and wake up socket |
@@ -3319,11 +3333,8 @@ static void tcp_new_space(struct sock *sk) | |||
3319 | { | 3333 | { |
3320 | struct tcp_sock *tp = tcp_sk(sk); | 3334 | struct tcp_sock *tp = tcp_sk(sk); |
3321 | 3335 | ||
3322 | if (tp->packets_out < tp->snd_cwnd && | 3336 | if (tcp_should_expand_sndbuf(sk, tp)) { |
3323 | !(sk->sk_userlocks & SOCK_SNDBUF_LOCK) && | 3337 | int sndmem = max_t(u32, tp->rx_opt.mss_clamp, tp->mss_cache) + |
3324 | !tcp_memory_pressure && | ||
3325 | atomic_read(&tcp_memory_allocated) < sysctl_tcp_mem[0]) { | ||
3326 | int sndmem = max_t(u32, tp->rx_opt.mss_clamp, tp->mss_cache_std) + | ||
3327 | MAX_TCP_HEADER + 16 + sizeof(struct sk_buff), | 3338 | MAX_TCP_HEADER + 16 + sizeof(struct sk_buff), |
3328 | demanded = max_t(unsigned int, tp->snd_cwnd, | 3339 | demanded = max_t(unsigned int, tp->snd_cwnd, |
3329 | tp->reordering + 1); | 3340 | tp->reordering + 1); |
@@ -3346,22 +3357,9 @@ static inline void tcp_check_space(struct sock *sk) | |||
3346 | } | 3357 | } |
3347 | } | 3358 | } |
3348 | 3359 | ||
3349 | static void __tcp_data_snd_check(struct sock *sk, struct sk_buff *skb) | 3360 | static __inline__ void tcp_data_snd_check(struct sock *sk, struct tcp_sock *tp) |
3350 | { | ||
3351 | struct tcp_sock *tp = tcp_sk(sk); | ||
3352 | |||
3353 | if (after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd) || | ||
3354 | tcp_packets_in_flight(tp) >= tp->snd_cwnd || | ||
3355 | tcp_write_xmit(sk, tp->nonagle)) | ||
3356 | tcp_check_probe_timer(sk, tp); | ||
3357 | } | ||
3358 | |||
3359 | static __inline__ void tcp_data_snd_check(struct sock *sk) | ||
3360 | { | 3361 | { |
3361 | struct sk_buff *skb = sk->sk_send_head; | 3362 | tcp_push_pending_frames(sk, tp); |
3362 | |||
3363 | if (skb != NULL) | ||
3364 | __tcp_data_snd_check(sk, skb); | ||
3365 | tcp_check_space(sk); | 3363 | tcp_check_space(sk); |
3366 | } | 3364 | } |
3367 | 3365 | ||
@@ -3655,7 +3653,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, | |||
3655 | */ | 3653 | */ |
3656 | tcp_ack(sk, skb, 0); | 3654 | tcp_ack(sk, skb, 0); |
3657 | __kfree_skb(skb); | 3655 | __kfree_skb(skb); |
3658 | tcp_data_snd_check(sk); | 3656 | tcp_data_snd_check(sk, tp); |
3659 | return 0; | 3657 | return 0; |
3660 | } else { /* Header too small */ | 3658 | } else { /* Header too small */ |
3661 | TCP_INC_STATS_BH(TCP_MIB_INERRS); | 3659 | TCP_INC_STATS_BH(TCP_MIB_INERRS); |
@@ -3721,7 +3719,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, | |||
3721 | if (TCP_SKB_CB(skb)->ack_seq != tp->snd_una) { | 3719 | if (TCP_SKB_CB(skb)->ack_seq != tp->snd_una) { |
3722 | /* Well, only one small jumplet in fast path... */ | 3720 | /* Well, only one small jumplet in fast path... */ |
3723 | tcp_ack(sk, skb, FLAG_DATA); | 3721 | tcp_ack(sk, skb, FLAG_DATA); |
3724 | tcp_data_snd_check(sk); | 3722 | tcp_data_snd_check(sk, tp); |
3725 | if (!tcp_ack_scheduled(tp)) | 3723 | if (!tcp_ack_scheduled(tp)) |
3726 | goto no_ack; | 3724 | goto no_ack; |
3727 | } | 3725 | } |
@@ -3799,7 +3797,7 @@ step5: | |||
3799 | /* step 7: process the segment text */ | 3797 | /* step 7: process the segment text */ |
3800 | tcp_data_queue(sk, skb); | 3798 | tcp_data_queue(sk, skb); |
3801 | 3799 | ||
3802 | tcp_data_snd_check(sk); | 3800 | tcp_data_snd_check(sk, tp); |
3803 | tcp_ack_snd_check(sk); | 3801 | tcp_ack_snd_check(sk); |
3804 | return 0; | 3802 | return 0; |
3805 | 3803 | ||
@@ -4109,7 +4107,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
4109 | /* Do step6 onward by hand. */ | 4107 | /* Do step6 onward by hand. */ |
4110 | tcp_urg(sk, skb, th); | 4108 | tcp_urg(sk, skb, th); |
4111 | __kfree_skb(skb); | 4109 | __kfree_skb(skb); |
4112 | tcp_data_snd_check(sk); | 4110 | tcp_data_snd_check(sk, tp); |
4113 | return 0; | 4111 | return 0; |
4114 | } | 4112 | } |
4115 | 4113 | ||
@@ -4300,7 +4298,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
4300 | 4298 | ||
4301 | /* tcp_data could move socket to TIME-WAIT */ | 4299 | /* tcp_data could move socket to TIME-WAIT */ |
4302 | if (sk->sk_state != TCP_CLOSE) { | 4300 | if (sk->sk_state != TCP_CLOSE) { |
4303 | tcp_data_snd_check(sk); | 4301 | tcp_data_snd_check(sk, tp); |
4304 | tcp_ack_snd_check(sk); | 4302 | tcp_ack_snd_check(sk); |
4305 | } | 4303 | } |
4306 | 4304 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index ebf112347a97..62f62bb05c2a 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -2045,7 +2045,7 @@ static int tcp_v4_init_sock(struct sock *sk) | |||
2045 | */ | 2045 | */ |
2046 | tp->snd_ssthresh = 0x7fffffff; /* Infinity */ | 2046 | tp->snd_ssthresh = 0x7fffffff; /* Infinity */ |
2047 | tp->snd_cwnd_clamp = ~0; | 2047 | tp->snd_cwnd_clamp = ~0; |
2048 | tp->mss_cache_std = tp->mss_cache = 536; | 2048 | tp->mss_cache = 536; |
2049 | 2049 | ||
2050 | tp->reordering = sysctl_tcp_reordering; | 2050 | tp->reordering = sysctl_tcp_reordering; |
2051 | tp->ca_ops = &tcp_init_congestion_ops; | 2051 | tp->ca_ops = &tcp_init_congestion_ops; |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 0e17c244875c..e041d057ec86 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -49,7 +49,7 @@ int sysctl_tcp_retrans_collapse = 1; | |||
49 | * will allow a single TSO frame to consume. Building TSO frames | 49 | * will allow a single TSO frame to consume. Building TSO frames |
50 | * which are too large can cause TCP streams to be bursty. | 50 | * which are too large can cause TCP streams to be bursty. |
51 | */ | 51 | */ |
52 | int sysctl_tcp_tso_win_divisor = 8; | 52 | int sysctl_tcp_tso_win_divisor = 3; |
53 | 53 | ||
54 | static inline void update_send_head(struct sock *sk, struct tcp_sock *tp, | 54 | static inline void update_send_head(struct sock *sk, struct tcp_sock *tp, |
55 | struct sk_buff *skb) | 55 | struct sk_buff *skb) |
@@ -140,11 +140,11 @@ static inline void tcp_event_data_sent(struct tcp_sock *tp, | |||
140 | tp->ack.pingpong = 1; | 140 | tp->ack.pingpong = 1; |
141 | } | 141 | } |
142 | 142 | ||
143 | static __inline__ void tcp_event_ack_sent(struct sock *sk) | 143 | static __inline__ void tcp_event_ack_sent(struct sock *sk, unsigned int pkts) |
144 | { | 144 | { |
145 | struct tcp_sock *tp = tcp_sk(sk); | 145 | struct tcp_sock *tp = tcp_sk(sk); |
146 | 146 | ||
147 | tcp_dec_quickack_mode(tp); | 147 | tcp_dec_quickack_mode(tp, pkts); |
148 | tcp_clear_xmit_timer(sk, TCP_TIME_DACK); | 148 | tcp_clear_xmit_timer(sk, TCP_TIME_DACK); |
149 | } | 149 | } |
150 | 150 | ||
@@ -355,7 +355,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb) | |||
355 | tp->af_specific->send_check(sk, th, skb->len, skb); | 355 | tp->af_specific->send_check(sk, th, skb->len, skb); |
356 | 356 | ||
357 | if (tcb->flags & TCPCB_FLAG_ACK) | 357 | if (tcb->flags & TCPCB_FLAG_ACK) |
358 | tcp_event_ack_sent(sk); | 358 | tcp_event_ack_sent(sk, tcp_skb_pcount(skb)); |
359 | 359 | ||
360 | if (skb->len != tcp_header_size) | 360 | if (skb->len != tcp_header_size) |
361 | tcp_event_data_sent(tp, skb, sk); | 361 | tcp_event_data_sent(tp, skb, sk); |
@@ -403,42 +403,11 @@ static void tcp_queue_skb(struct sock *sk, struct sk_buff *skb) | |||
403 | sk->sk_send_head = skb; | 403 | sk->sk_send_head = skb; |
404 | } | 404 | } |
405 | 405 | ||
406 | static inline void tcp_tso_set_push(struct sk_buff *skb) | 406 | static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb) |
407 | { | ||
408 | /* Force push to be on for any TSO frames to workaround | ||
409 | * problems with busted implementations like Mac OS-X that | ||
410 | * hold off socket receive wakeups until push is seen. | ||
411 | */ | ||
412 | if (tcp_skb_pcount(skb) > 1) | ||
413 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; | ||
414 | } | ||
415 | |||
416 | /* Send _single_ skb sitting at the send head. This function requires | ||
417 | * true push pending frames to setup probe timer etc. | ||
418 | */ | ||
419 | void tcp_push_one(struct sock *sk, unsigned cur_mss) | ||
420 | { | 407 | { |
421 | struct tcp_sock *tp = tcp_sk(sk); | 408 | struct tcp_sock *tp = tcp_sk(sk); |
422 | struct sk_buff *skb = sk->sk_send_head; | ||
423 | 409 | ||
424 | if (tcp_snd_test(sk, skb, cur_mss, TCP_NAGLE_PUSH)) { | 410 | if (skb->len <= tp->mss_cache || |
425 | /* Send it out now. */ | ||
426 | TCP_SKB_CB(skb)->when = tcp_time_stamp; | ||
427 | tcp_tso_set_push(skb); | ||
428 | if (!tcp_transmit_skb(sk, skb_clone(skb, sk->sk_allocation))) { | ||
429 | sk->sk_send_head = NULL; | ||
430 | tp->snd_nxt = TCP_SKB_CB(skb)->end_seq; | ||
431 | tcp_packets_out_inc(sk, tp, skb); | ||
432 | return; | ||
433 | } | ||
434 | } | ||
435 | } | ||
436 | |||
437 | void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb) | ||
438 | { | ||
439 | struct tcp_sock *tp = tcp_sk(sk); | ||
440 | |||
441 | if (skb->len <= tp->mss_cache_std || | ||
442 | !(sk->sk_route_caps & NETIF_F_TSO)) { | 411 | !(sk->sk_route_caps & NETIF_F_TSO)) { |
443 | /* Avoid the costly divide in the normal | 412 | /* Avoid the costly divide in the normal |
444 | * non-TSO case. | 413 | * non-TSO case. |
@@ -448,10 +417,10 @@ void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb) | |||
448 | } else { | 417 | } else { |
449 | unsigned int factor; | 418 | unsigned int factor; |
450 | 419 | ||
451 | factor = skb->len + (tp->mss_cache_std - 1); | 420 | factor = skb->len + (tp->mss_cache - 1); |
452 | factor /= tp->mss_cache_std; | 421 | factor /= tp->mss_cache; |
453 | skb_shinfo(skb)->tso_segs = factor; | 422 | skb_shinfo(skb)->tso_segs = factor; |
454 | skb_shinfo(skb)->tso_size = tp->mss_cache_std; | 423 | skb_shinfo(skb)->tso_size = tp->mss_cache; |
455 | } | 424 | } |
456 | } | 425 | } |
457 | 426 | ||
@@ -537,6 +506,7 @@ static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len) | |||
537 | } | 506 | } |
538 | 507 | ||
539 | /* Link BUFF into the send queue. */ | 508 | /* Link BUFF into the send queue. */ |
509 | skb_header_release(buff); | ||
540 | __skb_append(skb, buff); | 510 | __skb_append(skb, buff); |
541 | 511 | ||
542 | return 0; | 512 | return 0; |
@@ -657,7 +627,7 @@ unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu) | |||
657 | 627 | ||
658 | /* And store cached results */ | 628 | /* And store cached results */ |
659 | tp->pmtu_cookie = pmtu; | 629 | tp->pmtu_cookie = pmtu; |
660 | tp->mss_cache = tp->mss_cache_std = mss_now; | 630 | tp->mss_cache = mss_now; |
661 | 631 | ||
662 | return mss_now; | 632 | return mss_now; |
663 | } | 633 | } |
@@ -669,57 +639,316 @@ unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu) | |||
669 | * cannot be large. However, taking into account rare use of URG, this | 639 | * cannot be large. However, taking into account rare use of URG, this |
670 | * is not a big flaw. | 640 | * is not a big flaw. |
671 | */ | 641 | */ |
672 | 642 | unsigned int tcp_current_mss(struct sock *sk, int large_allowed) | |
673 | unsigned int tcp_current_mss(struct sock *sk, int large) | ||
674 | { | 643 | { |
675 | struct tcp_sock *tp = tcp_sk(sk); | 644 | struct tcp_sock *tp = tcp_sk(sk); |
676 | struct dst_entry *dst = __sk_dst_get(sk); | 645 | struct dst_entry *dst = __sk_dst_get(sk); |
677 | unsigned int do_large, mss_now; | 646 | u32 mss_now; |
647 | u16 xmit_size_goal; | ||
648 | int doing_tso = 0; | ||
649 | |||
650 | mss_now = tp->mss_cache; | ||
651 | |||
652 | if (large_allowed && | ||
653 | (sk->sk_route_caps & NETIF_F_TSO) && | ||
654 | !tp->urg_mode) | ||
655 | doing_tso = 1; | ||
678 | 656 | ||
679 | mss_now = tp->mss_cache_std; | ||
680 | if (dst) { | 657 | if (dst) { |
681 | u32 mtu = dst_mtu(dst); | 658 | u32 mtu = dst_mtu(dst); |
682 | if (mtu != tp->pmtu_cookie) | 659 | if (mtu != tp->pmtu_cookie) |
683 | mss_now = tcp_sync_mss(sk, mtu); | 660 | mss_now = tcp_sync_mss(sk, mtu); |
684 | } | 661 | } |
685 | 662 | ||
686 | do_large = (large && | 663 | if (tp->rx_opt.eff_sacks) |
687 | (sk->sk_route_caps & NETIF_F_TSO) && | 664 | mss_now -= (TCPOLEN_SACK_BASE_ALIGNED + |
688 | !tp->urg_mode); | 665 | (tp->rx_opt.eff_sacks * TCPOLEN_SACK_PERBLOCK)); |
689 | 666 | ||
690 | if (do_large) { | 667 | xmit_size_goal = mss_now; |
691 | unsigned int large_mss, factor, limit; | ||
692 | 668 | ||
693 | large_mss = 65535 - tp->af_specific->net_header_len - | 669 | if (doing_tso) { |
670 | xmit_size_goal = 65535 - | ||
671 | tp->af_specific->net_header_len - | ||
694 | tp->ext_header_len - tp->tcp_header_len; | 672 | tp->ext_header_len - tp->tcp_header_len; |
695 | 673 | ||
696 | if (tp->max_window && large_mss > (tp->max_window>>1)) | 674 | if (tp->max_window && |
697 | large_mss = max((tp->max_window>>1), | 675 | (xmit_size_goal > (tp->max_window >> 1))) |
698 | 68U - tp->tcp_header_len); | 676 | xmit_size_goal = max((tp->max_window >> 1), |
677 | 68U - tp->tcp_header_len); | ||
678 | |||
679 | xmit_size_goal -= (xmit_size_goal % mss_now); | ||
680 | } | ||
681 | tp->xmit_size_goal = xmit_size_goal; | ||
699 | 682 | ||
700 | factor = large_mss / mss_now; | 683 | return mss_now; |
684 | } | ||
701 | 685 | ||
702 | /* Always keep large mss multiple of real mss, but | 686 | /* Congestion window validation. (RFC2861) */ |
703 | * do not exceed 1/tso_win_divisor of the congestion window | ||
704 | * so we can keep the ACK clock ticking and minimize | ||
705 | * bursting. | ||
706 | */ | ||
707 | limit = tp->snd_cwnd; | ||
708 | if (sysctl_tcp_tso_win_divisor) | ||
709 | limit /= sysctl_tcp_tso_win_divisor; | ||
710 | limit = max(1U, limit); | ||
711 | if (factor > limit) | ||
712 | factor = limit; | ||
713 | 687 | ||
714 | tp->mss_cache = mss_now * factor; | 688 | static inline void tcp_cwnd_validate(struct sock *sk, struct tcp_sock *tp) |
689 | { | ||
690 | __u32 packets_out = tp->packets_out; | ||
691 | |||
692 | if (packets_out >= tp->snd_cwnd) { | ||
693 | /* Network is feed fully. */ | ||
694 | tp->snd_cwnd_used = 0; | ||
695 | tp->snd_cwnd_stamp = tcp_time_stamp; | ||
696 | } else { | ||
697 | /* Network starves. */ | ||
698 | if (tp->packets_out > tp->snd_cwnd_used) | ||
699 | tp->snd_cwnd_used = tp->packets_out; | ||
715 | 700 | ||
716 | mss_now = tp->mss_cache; | 701 | if ((s32)(tcp_time_stamp - tp->snd_cwnd_stamp) >= tp->rto) |
702 | tcp_cwnd_application_limited(sk); | ||
717 | } | 703 | } |
704 | } | ||
718 | 705 | ||
719 | if (tp->rx_opt.eff_sacks) | 706 | static unsigned int tcp_window_allows(struct tcp_sock *tp, struct sk_buff *skb, unsigned int mss_now, unsigned int cwnd) |
720 | mss_now -= (TCPOLEN_SACK_BASE_ALIGNED + | 707 | { |
721 | (tp->rx_opt.eff_sacks * TCPOLEN_SACK_PERBLOCK)); | 708 | u32 window, cwnd_len; |
722 | return mss_now; | 709 | |
710 | window = (tp->snd_una + tp->snd_wnd - TCP_SKB_CB(skb)->seq); | ||
711 | cwnd_len = mss_now * cwnd; | ||
712 | return min(window, cwnd_len); | ||
713 | } | ||
714 | |||
715 | /* Can at least one segment of SKB be sent right now, according to the | ||
716 | * congestion window rules? If so, return how many segments are allowed. | ||
717 | */ | ||
718 | static inline unsigned int tcp_cwnd_test(struct tcp_sock *tp, struct sk_buff *skb) | ||
719 | { | ||
720 | u32 in_flight, cwnd; | ||
721 | |||
722 | /* Don't be strict about the congestion window for the final FIN. */ | ||
723 | if (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN) | ||
724 | return 1; | ||
725 | |||
726 | in_flight = tcp_packets_in_flight(tp); | ||
727 | cwnd = tp->snd_cwnd; | ||
728 | if (in_flight < cwnd) | ||
729 | return (cwnd - in_flight); | ||
730 | |||
731 | return 0; | ||
732 | } | ||
733 | |||
734 | /* This must be invoked the first time we consider transmitting | ||
735 | * SKB onto the wire. | ||
736 | */ | ||
737 | static inline int tcp_init_tso_segs(struct sock *sk, struct sk_buff *skb) | ||
738 | { | ||
739 | int tso_segs = tcp_skb_pcount(skb); | ||
740 | |||
741 | if (!tso_segs) { | ||
742 | tcp_set_skb_tso_segs(sk, skb); | ||
743 | tso_segs = tcp_skb_pcount(skb); | ||
744 | } | ||
745 | return tso_segs; | ||
746 | } | ||
747 | |||
748 | static inline int tcp_minshall_check(const struct tcp_sock *tp) | ||
749 | { | ||
750 | return after(tp->snd_sml,tp->snd_una) && | ||
751 | !after(tp->snd_sml, tp->snd_nxt); | ||
752 | } | ||
753 | |||
754 | /* Return 0, if packet can be sent now without violation Nagle's rules: | ||
755 | * 1. It is full sized. | ||
756 | * 2. Or it contains FIN. (already checked by caller) | ||
757 | * 3. Or TCP_NODELAY was set. | ||
758 | * 4. Or TCP_CORK is not set, and all sent packets are ACKed. | ||
759 | * With Minshall's modification: all sent small packets are ACKed. | ||
760 | */ | ||
761 | |||
762 | static inline int tcp_nagle_check(const struct tcp_sock *tp, | ||
763 | const struct sk_buff *skb, | ||
764 | unsigned mss_now, int nonagle) | ||
765 | { | ||
766 | return (skb->len < mss_now && | ||
767 | ((nonagle&TCP_NAGLE_CORK) || | ||
768 | (!nonagle && | ||
769 | tp->packets_out && | ||
770 | tcp_minshall_check(tp)))); | ||
771 | } | ||
772 | |||
773 | /* Return non-zero if the Nagle test allows this packet to be | ||
774 | * sent now. | ||
775 | */ | ||
776 | static inline int tcp_nagle_test(struct tcp_sock *tp, struct sk_buff *skb, | ||
777 | unsigned int cur_mss, int nonagle) | ||
778 | { | ||
779 | /* Nagle rule does not apply to frames, which sit in the middle of the | ||
780 | * write_queue (they have no chances to get new data). | ||
781 | * | ||
782 | * This is implemented in the callers, where they modify the 'nonagle' | ||
783 | * argument based upon the location of SKB in the send queue. | ||
784 | */ | ||
785 | if (nonagle & TCP_NAGLE_PUSH) | ||
786 | return 1; | ||
787 | |||
788 | /* Don't use the nagle rule for urgent data (or for the final FIN). */ | ||
789 | if (tp->urg_mode || | ||
790 | (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN)) | ||
791 | return 1; | ||
792 | |||
793 | if (!tcp_nagle_check(tp, skb, cur_mss, nonagle)) | ||
794 | return 1; | ||
795 | |||
796 | return 0; | ||
797 | } | ||
798 | |||
799 | /* Does at least the first segment of SKB fit into the send window? */ | ||
800 | static inline int tcp_snd_wnd_test(struct tcp_sock *tp, struct sk_buff *skb, unsigned int cur_mss) | ||
801 | { | ||
802 | u32 end_seq = TCP_SKB_CB(skb)->end_seq; | ||
803 | |||
804 | if (skb->len > cur_mss) | ||
805 | end_seq = TCP_SKB_CB(skb)->seq + cur_mss; | ||
806 | |||
807 | return !after(end_seq, tp->snd_una + tp->snd_wnd); | ||
808 | } | ||
809 | |||
810 | /* This checks if the data bearing packet SKB (usually sk->sk_send_head) | ||
811 | * should be put on the wire right now. If so, it returns the number of | ||
812 | * packets allowed by the congestion window. | ||
813 | */ | ||
814 | static unsigned int tcp_snd_test(struct sock *sk, struct sk_buff *skb, | ||
815 | unsigned int cur_mss, int nonagle) | ||
816 | { | ||
817 | struct tcp_sock *tp = tcp_sk(sk); | ||
818 | unsigned int cwnd_quota; | ||
819 | |||
820 | tcp_init_tso_segs(sk, skb); | ||
821 | |||
822 | if (!tcp_nagle_test(tp, skb, cur_mss, nonagle)) | ||
823 | return 0; | ||
824 | |||
825 | cwnd_quota = tcp_cwnd_test(tp, skb); | ||
826 | if (cwnd_quota && | ||
827 | !tcp_snd_wnd_test(tp, skb, cur_mss)) | ||
828 | cwnd_quota = 0; | ||
829 | |||
830 | return cwnd_quota; | ||
831 | } | ||
832 | |||
833 | static inline int tcp_skb_is_last(const struct sock *sk, | ||
834 | const struct sk_buff *skb) | ||
835 | { | ||
836 | return skb->next == (struct sk_buff *)&sk->sk_write_queue; | ||
837 | } | ||
838 | |||
839 | int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp) | ||
840 | { | ||
841 | struct sk_buff *skb = sk->sk_send_head; | ||
842 | |||
843 | return (skb && | ||
844 | tcp_snd_test(sk, skb, tcp_current_mss(sk, 1), | ||
845 | (tcp_skb_is_last(sk, skb) ? | ||
846 | TCP_NAGLE_PUSH : | ||
847 | tp->nonagle))); | ||
848 | } | ||
849 | |||
850 | /* Trim TSO SKB to LEN bytes, put the remaining data into a new packet | ||
851 | * which is put after SKB on the list. It is very much like | ||
852 | * tcp_fragment() except that it may make several kinds of assumptions | ||
853 | * in order to speed up the splitting operation. In particular, we | ||
854 | * know that all the data is in scatter-gather pages, and that the | ||
855 | * packet has never been sent out before (and thus is not cloned). | ||
856 | */ | ||
857 | static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len) | ||
858 | { | ||
859 | struct sk_buff *buff; | ||
860 | int nlen = skb->len - len; | ||
861 | u16 flags; | ||
862 | |||
863 | /* All of a TSO frame must be composed of paged data. */ | ||
864 | BUG_ON(skb->len != skb->data_len); | ||
865 | |||
866 | buff = sk_stream_alloc_pskb(sk, 0, 0, GFP_ATOMIC); | ||
867 | if (unlikely(buff == NULL)) | ||
868 | return -ENOMEM; | ||
869 | |||
870 | buff->truesize = nlen; | ||
871 | skb->truesize -= nlen; | ||
872 | |||
873 | /* Correct the sequence numbers. */ | ||
874 | TCP_SKB_CB(buff)->seq = TCP_SKB_CB(skb)->seq + len; | ||
875 | TCP_SKB_CB(buff)->end_seq = TCP_SKB_CB(skb)->end_seq; | ||
876 | TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(buff)->seq; | ||
877 | |||
878 | /* PSH and FIN should only be set in the second packet. */ | ||
879 | flags = TCP_SKB_CB(skb)->flags; | ||
880 | TCP_SKB_CB(skb)->flags = flags & ~(TCPCB_FLAG_FIN|TCPCB_FLAG_PSH); | ||
881 | TCP_SKB_CB(buff)->flags = flags; | ||
882 | |||
883 | /* This packet was never sent out yet, so no SACK bits. */ | ||
884 | TCP_SKB_CB(buff)->sacked = 0; | ||
885 | |||
886 | buff->ip_summed = skb->ip_summed = CHECKSUM_HW; | ||
887 | skb_split(skb, buff, len); | ||
888 | |||
889 | /* Fix up tso_factor for both original and new SKB. */ | ||
890 | tcp_set_skb_tso_segs(sk, skb); | ||
891 | tcp_set_skb_tso_segs(sk, buff); | ||
892 | |||
893 | /* Link BUFF into the send queue. */ | ||
894 | skb_header_release(buff); | ||
895 | __skb_append(skb, buff); | ||
896 | |||
897 | return 0; | ||
898 | } | ||
899 | |||
900 | /* Try to defer sending, if possible, in order to minimize the amount | ||
901 | * of TSO splitting we do. View it as a kind of TSO Nagle test. | ||
902 | * | ||
903 | * This algorithm is from John Heffner. | ||
904 | */ | ||
905 | static int tcp_tso_should_defer(struct sock *sk, struct tcp_sock *tp, struct sk_buff *skb) | ||
906 | { | ||
907 | u32 send_win, cong_win, limit, in_flight; | ||
908 | |||
909 | if (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN) | ||
910 | return 0; | ||
911 | |||
912 | if (tp->ca_state != TCP_CA_Open) | ||
913 | return 0; | ||
914 | |||
915 | in_flight = tcp_packets_in_flight(tp); | ||
916 | |||
917 | BUG_ON(tcp_skb_pcount(skb) <= 1 || | ||
918 | (tp->snd_cwnd <= in_flight)); | ||
919 | |||
920 | send_win = (tp->snd_una + tp->snd_wnd) - TCP_SKB_CB(skb)->seq; | ||
921 | |||
922 | /* From in_flight test above, we know that cwnd > in_flight. */ | ||
923 | cong_win = (tp->snd_cwnd - in_flight) * tp->mss_cache; | ||
924 | |||
925 | limit = min(send_win, cong_win); | ||
926 | |||
927 | /* If sk_send_head can be sent fully now, just do it. */ | ||
928 | if (skb->len <= limit) | ||
929 | return 0; | ||
930 | |||
931 | if (sysctl_tcp_tso_win_divisor) { | ||
932 | u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache); | ||
933 | |||
934 | /* If at least some fraction of a window is available, | ||
935 | * just use it. | ||
936 | */ | ||
937 | chunk /= sysctl_tcp_tso_win_divisor; | ||
938 | if (limit >= chunk) | ||
939 | return 0; | ||
940 | } else { | ||
941 | /* Different approach, try not to defer past a single | ||
942 | * ACK. Receiver should ACK every other full sized | ||
943 | * frame, so if we have space for more than 3 frames | ||
944 | * then send now. | ||
945 | */ | ||
946 | if (limit > tcp_max_burst(tp) * tp->mss_cache) | ||
947 | return 0; | ||
948 | } | ||
949 | |||
950 | /* Ok, it looks like it is advisable to defer. */ | ||
951 | return 1; | ||
723 | } | 952 | } |
724 | 953 | ||
725 | /* This routine writes packets to the network. It advances the | 954 | /* This routine writes packets to the network. It advances the |
@@ -729,57 +958,158 @@ unsigned int tcp_current_mss(struct sock *sk, int large) | |||
729 | * Returns 1, if no segments are in flight and we have queued segments, but | 958 | * Returns 1, if no segments are in flight and we have queued segments, but |
730 | * cannot send anything now because of SWS or another problem. | 959 | * cannot send anything now because of SWS or another problem. |
731 | */ | 960 | */ |
732 | int tcp_write_xmit(struct sock *sk, int nonagle) | 961 | static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle) |
733 | { | 962 | { |
734 | struct tcp_sock *tp = tcp_sk(sk); | 963 | struct tcp_sock *tp = tcp_sk(sk); |
735 | unsigned int mss_now; | 964 | struct sk_buff *skb; |
965 | unsigned int tso_segs, sent_pkts; | ||
966 | int cwnd_quota; | ||
736 | 967 | ||
737 | /* If we are closed, the bytes will have to remain here. | 968 | /* If we are closed, the bytes will have to remain here. |
738 | * In time closedown will finish, we empty the write queue and all | 969 | * In time closedown will finish, we empty the write queue and all |
739 | * will be happy. | 970 | * will be happy. |
740 | */ | 971 | */ |
741 | if (sk->sk_state != TCP_CLOSE) { | 972 | if (unlikely(sk->sk_state == TCP_CLOSE)) |
742 | struct sk_buff *skb; | 973 | return 0; |
743 | int sent_pkts = 0; | 974 | |
975 | skb = sk->sk_send_head; | ||
976 | if (unlikely(!skb)) | ||
977 | return 0; | ||
978 | |||
979 | tso_segs = tcp_init_tso_segs(sk, skb); | ||
980 | cwnd_quota = tcp_cwnd_test(tp, skb); | ||
981 | if (unlikely(!cwnd_quota)) | ||
982 | goto out; | ||
983 | |||
984 | sent_pkts = 0; | ||
985 | while (likely(tcp_snd_wnd_test(tp, skb, mss_now))) { | ||
986 | BUG_ON(!tso_segs); | ||
987 | |||
988 | if (tso_segs == 1) { | ||
989 | if (unlikely(!tcp_nagle_test(tp, skb, mss_now, | ||
990 | (tcp_skb_is_last(sk, skb) ? | ||
991 | nonagle : TCP_NAGLE_PUSH)))) | ||
992 | break; | ||
993 | } else { | ||
994 | if (tcp_tso_should_defer(sk, tp, skb)) | ||
995 | break; | ||
996 | } | ||
744 | 997 | ||
745 | /* Account for SACKS, we may need to fragment due to this. | 998 | if (tso_segs > 1) { |
746 | * It is just like the real MSS changing on us midstream. | 999 | u32 limit = tcp_window_allows(tp, skb, |
747 | * We also handle things correctly when the user adds some | 1000 | mss_now, cwnd_quota); |
748 | * IP options mid-stream. Silly to do, but cover it. | 1001 | |
749 | */ | 1002 | if (skb->len < limit) { |
750 | mss_now = tcp_current_mss(sk, 1); | 1003 | unsigned int trim = skb->len % mss_now; |
751 | 1004 | ||
752 | while ((skb = sk->sk_send_head) && | 1005 | if (trim) |
753 | tcp_snd_test(sk, skb, mss_now, | 1006 | limit = skb->len - trim; |
754 | tcp_skb_is_last(sk, skb) ? nonagle : | 1007 | } |
755 | TCP_NAGLE_PUSH)) { | 1008 | if (skb->len > limit) { |
756 | if (skb->len > mss_now) { | 1009 | if (tso_fragment(sk, skb, limit)) |
757 | if (tcp_fragment(sk, skb, mss_now)) | ||
758 | break; | 1010 | break; |
759 | } | 1011 | } |
760 | 1012 | } else if (unlikely(skb->len > mss_now)) { | |
761 | TCP_SKB_CB(skb)->when = tcp_time_stamp; | 1013 | if (unlikely(tcp_fragment(sk, skb, mss_now))) |
762 | tcp_tso_set_push(skb); | ||
763 | if (tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC))) | ||
764 | break; | 1014 | break; |
1015 | } | ||
765 | 1016 | ||
766 | /* Advance the send_head. This one is sent out. | 1017 | TCP_SKB_CB(skb)->when = tcp_time_stamp; |
767 | * This call will increment packets_out. | 1018 | |
768 | */ | 1019 | if (unlikely(tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC)))) |
769 | update_send_head(sk, tp, skb); | 1020 | break; |
1021 | |||
1022 | /* Advance the send_head. This one is sent out. | ||
1023 | * This call will increment packets_out. | ||
1024 | */ | ||
1025 | update_send_head(sk, tp, skb); | ||
1026 | |||
1027 | tcp_minshall_update(tp, mss_now, skb); | ||
1028 | sent_pkts++; | ||
1029 | |||
1030 | /* Do not optimize this to use tso_segs. If we chopped up | ||
1031 | * the packet above, tso_segs will no longer be valid. | ||
1032 | */ | ||
1033 | cwnd_quota -= tcp_skb_pcount(skb); | ||
1034 | |||
1035 | BUG_ON(cwnd_quota < 0); | ||
1036 | if (!cwnd_quota) | ||
1037 | break; | ||
1038 | |||
1039 | skb = sk->sk_send_head; | ||
1040 | if (!skb) | ||
1041 | break; | ||
1042 | tso_segs = tcp_init_tso_segs(sk, skb); | ||
1043 | } | ||
1044 | |||
1045 | if (likely(sent_pkts)) { | ||
1046 | tcp_cwnd_validate(sk, tp); | ||
1047 | return 0; | ||
1048 | } | ||
1049 | out: | ||
1050 | return !tp->packets_out && sk->sk_send_head; | ||
1051 | } | ||
1052 | |||
1053 | /* Push out any pending frames which were held back due to | ||
1054 | * TCP_CORK or attempt at coalescing tiny packets. | ||
1055 | * The socket must be locked by the caller. | ||
1056 | */ | ||
1057 | void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp, | ||
1058 | unsigned int cur_mss, int nonagle) | ||
1059 | { | ||
1060 | struct sk_buff *skb = sk->sk_send_head; | ||
770 | 1061 | ||
771 | tcp_minshall_update(tp, mss_now, skb); | 1062 | if (skb) { |
772 | sent_pkts = 1; | 1063 | if (tcp_write_xmit(sk, cur_mss, nonagle)) |
1064 | tcp_check_probe_timer(sk, tp); | ||
1065 | } | ||
1066 | } | ||
1067 | |||
1068 | /* Send _single_ skb sitting at the send head. This function requires | ||
1069 | * true push pending frames to setup probe timer etc. | ||
1070 | */ | ||
1071 | void tcp_push_one(struct sock *sk, unsigned int mss_now) | ||
1072 | { | ||
1073 | struct tcp_sock *tp = tcp_sk(sk); | ||
1074 | struct sk_buff *skb = sk->sk_send_head; | ||
1075 | unsigned int tso_segs, cwnd_quota; | ||
1076 | |||
1077 | BUG_ON(!skb || skb->len < mss_now); | ||
1078 | |||
1079 | tso_segs = tcp_init_tso_segs(sk, skb); | ||
1080 | cwnd_quota = tcp_snd_test(sk, skb, mss_now, TCP_NAGLE_PUSH); | ||
1081 | |||
1082 | if (likely(cwnd_quota)) { | ||
1083 | BUG_ON(!tso_segs); | ||
1084 | |||
1085 | if (tso_segs > 1) { | ||
1086 | u32 limit = tcp_window_allows(tp, skb, | ||
1087 | mss_now, cwnd_quota); | ||
1088 | |||
1089 | if (skb->len < limit) { | ||
1090 | unsigned int trim = skb->len % mss_now; | ||
1091 | |||
1092 | if (trim) | ||
1093 | limit = skb->len - trim; | ||
1094 | } | ||
1095 | if (skb->len > limit) { | ||
1096 | if (unlikely(tso_fragment(sk, skb, limit))) | ||
1097 | return; | ||
1098 | } | ||
1099 | } else if (unlikely(skb->len > mss_now)) { | ||
1100 | if (unlikely(tcp_fragment(sk, skb, mss_now))) | ||
1101 | return; | ||
773 | } | 1102 | } |
774 | 1103 | ||
775 | if (sent_pkts) { | 1104 | /* Send it out now. */ |
1105 | TCP_SKB_CB(skb)->when = tcp_time_stamp; | ||
1106 | |||
1107 | if (likely(!tcp_transmit_skb(sk, skb_clone(skb, sk->sk_allocation)))) { | ||
1108 | update_send_head(sk, tp, skb); | ||
776 | tcp_cwnd_validate(sk, tp); | 1109 | tcp_cwnd_validate(sk, tp); |
777 | return 0; | 1110 | return; |
778 | } | 1111 | } |
779 | |||
780 | return !tp->packets_out && sk->sk_send_head; | ||
781 | } | 1112 | } |
782 | return 0; | ||
783 | } | 1113 | } |
784 | 1114 | ||
785 | /* This function returns the amount that we can raise the | 1115 | /* This function returns the amount that we can raise the |
@@ -1039,7 +1369,6 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
1039 | if (sk->sk_route_caps & NETIF_F_TSO) { | 1369 | if (sk->sk_route_caps & NETIF_F_TSO) { |
1040 | sk->sk_route_caps &= ~NETIF_F_TSO; | 1370 | sk->sk_route_caps &= ~NETIF_F_TSO; |
1041 | sock_set_flag(sk, SOCK_NO_LARGESEND); | 1371 | sock_set_flag(sk, SOCK_NO_LARGESEND); |
1042 | tp->mss_cache = tp->mss_cache_std; | ||
1043 | } | 1372 | } |
1044 | 1373 | ||
1045 | if (tcp_trim_head(sk, skb, tp->snd_una - TCP_SKB_CB(skb)->seq)) | 1374 | if (tcp_trim_head(sk, skb, tp->snd_una - TCP_SKB_CB(skb)->seq)) |
@@ -1101,7 +1430,6 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
1101 | * is still in somebody's hands, else make a clone. | 1430 | * is still in somebody's hands, else make a clone. |
1102 | */ | 1431 | */ |
1103 | TCP_SKB_CB(skb)->when = tcp_time_stamp; | 1432 | TCP_SKB_CB(skb)->when = tcp_time_stamp; |
1104 | tcp_tso_set_push(skb); | ||
1105 | 1433 | ||
1106 | err = tcp_transmit_skb(sk, (skb_cloned(skb) ? | 1434 | err = tcp_transmit_skb(sk, (skb_cloned(skb) ? |
1107 | pskb_copy(skb, GFP_ATOMIC): | 1435 | pskb_copy(skb, GFP_ATOMIC): |
@@ -1670,14 +1998,12 @@ int tcp_write_wakeup(struct sock *sk) | |||
1670 | if (sk->sk_route_caps & NETIF_F_TSO) { | 1998 | if (sk->sk_route_caps & NETIF_F_TSO) { |
1671 | sock_set_flag(sk, SOCK_NO_LARGESEND); | 1999 | sock_set_flag(sk, SOCK_NO_LARGESEND); |
1672 | sk->sk_route_caps &= ~NETIF_F_TSO; | 2000 | sk->sk_route_caps &= ~NETIF_F_TSO; |
1673 | tp->mss_cache = tp->mss_cache_std; | ||
1674 | } | 2001 | } |
1675 | } else if (!tcp_skb_pcount(skb)) | 2002 | } else if (!tcp_skb_pcount(skb)) |
1676 | tcp_set_skb_tso_segs(sk, skb); | 2003 | tcp_set_skb_tso_segs(sk, skb); |
1677 | 2004 | ||
1678 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; | 2005 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; |
1679 | TCP_SKB_CB(skb)->when = tcp_time_stamp; | 2006 | TCP_SKB_CB(skb)->when = tcp_time_stamp; |
1680 | tcp_tso_set_push(skb); | ||
1681 | err = tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC)); | 2007 | err = tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC)); |
1682 | if (!err) { | 2008 | if (!err) { |
1683 | update_send_head(sk, tp, skb); | 2009 | update_send_head(sk, tp, skb); |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index a54d4ef3fd35..77004b9456c0 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -2777,7 +2777,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, | |||
2777 | read_lock_bh(&idev->lock); | 2777 | read_lock_bh(&idev->lock); |
2778 | switch (type) { | 2778 | switch (type) { |
2779 | case UNICAST_ADDR: | 2779 | case UNICAST_ADDR: |
2780 | /* unicast address */ | 2780 | /* unicast address incl. temp addr */ |
2781 | for (ifa = idev->addr_list; ifa; | 2781 | for (ifa = idev->addr_list; ifa; |
2782 | ifa = ifa->if_next, ip_idx++) { | 2782 | ifa = ifa->if_next, ip_idx++) { |
2783 | if (ip_idx < s_ip_idx) | 2783 | if (ip_idx < s_ip_idx) |
@@ -2788,19 +2788,6 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, | |||
2788 | NLM_F_MULTI)) <= 0) | 2788 | NLM_F_MULTI)) <= 0) |
2789 | goto done; | 2789 | goto done; |
2790 | } | 2790 | } |
2791 | /* temp addr */ | ||
2792 | #ifdef CONFIG_IPV6_PRIVACY | ||
2793 | for (ifa = idev->tempaddr_list; ifa; | ||
2794 | ifa = ifa->tmp_next, ip_idx++) { | ||
2795 | if (ip_idx < s_ip_idx) | ||
2796 | continue; | ||
2797 | if ((err = inet6_fill_ifaddr(skb, ifa, | ||
2798 | NETLINK_CB(cb->skb).pid, | ||
2799 | cb->nlh->nlmsg_seq, RTM_NEWADDR, | ||
2800 | NLM_F_MULTI)) <= 0) | ||
2801 | goto done; | ||
2802 | } | ||
2803 | #endif | ||
2804 | break; | 2791 | break; |
2805 | case MULTICAST_ADDR: | 2792 | case MULTICAST_ADDR: |
2806 | /* multicast address */ | 2793 | /* multicast address */ |
@@ -2923,6 +2910,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, | |||
2923 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags); | 2910 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags); |
2924 | r = NLMSG_DATA(nlh); | 2911 | r = NLMSG_DATA(nlh); |
2925 | r->ifi_family = AF_INET6; | 2912 | r->ifi_family = AF_INET6; |
2913 | r->__ifi_pad = 0; | ||
2926 | r->ifi_type = dev->type; | 2914 | r->ifi_type = dev->type; |
2927 | r->ifi_index = dev->ifindex; | 2915 | r->ifi_index = dev->ifindex; |
2928 | r->ifi_flags = dev_get_flags(dev); | 2916 | r->ifi_flags = dev_get_flags(dev); |
@@ -3030,9 +3018,12 @@ static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev, | |||
3030 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*pmsg), flags); | 3018 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*pmsg), flags); |
3031 | pmsg = NLMSG_DATA(nlh); | 3019 | pmsg = NLMSG_DATA(nlh); |
3032 | pmsg->prefix_family = AF_INET6; | 3020 | pmsg->prefix_family = AF_INET6; |
3021 | pmsg->prefix_pad1 = 0; | ||
3022 | pmsg->prefix_pad2 = 0; | ||
3033 | pmsg->prefix_ifindex = idev->dev->ifindex; | 3023 | pmsg->prefix_ifindex = idev->dev->ifindex; |
3034 | pmsg->prefix_len = pinfo->prefix_len; | 3024 | pmsg->prefix_len = pinfo->prefix_len; |
3035 | pmsg->prefix_type = pinfo->type; | 3025 | pmsg->prefix_type = pinfo->type; |
3026 | pmsg->prefix_pad3 = 0; | ||
3036 | 3027 | ||
3037 | pmsg->prefix_flags = 0; | 3028 | pmsg->prefix_flags = 0; |
3038 | if (pinfo->onlink) | 3029 | if (pinfo->onlink) |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 2b193e3df49a..28d9bcab0970 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -774,7 +774,6 @@ static int __init inet6_init(void) | |||
774 | if (if6_proc_init()) | 774 | if (if6_proc_init()) |
775 | goto proc_if6_fail; | 775 | goto proc_if6_fail; |
776 | #endif | 776 | #endif |
777 | ipv6_packet_init(); | ||
778 | ip6_route_init(); | 777 | ip6_route_init(); |
779 | ip6_flowlabel_init(); | 778 | ip6_flowlabel_init(); |
780 | err = addrconf_init(); | 779 | err = addrconf_init(); |
@@ -791,6 +790,8 @@ static int __init inet6_init(void) | |||
791 | /* Init v6 transport protocols. */ | 790 | /* Init v6 transport protocols. */ |
792 | udpv6_init(); | 791 | udpv6_init(); |
793 | tcpv6_init(); | 792 | tcpv6_init(); |
793 | |||
794 | ipv6_packet_init(); | ||
794 | err = 0; | 795 | err = 0; |
795 | out: | 796 | out: |
796 | return err; | 797 | return err; |
@@ -798,7 +799,6 @@ out: | |||
798 | addrconf_fail: | 799 | addrconf_fail: |
799 | ip6_flowlabel_cleanup(); | 800 | ip6_flowlabel_cleanup(); |
800 | ip6_route_cleanup(); | 801 | ip6_route_cleanup(); |
801 | ipv6_packet_cleanup(); | ||
802 | #ifdef CONFIG_PROC_FS | 802 | #ifdef CONFIG_PROC_FS |
803 | if6_proc_exit(); | 803 | if6_proc_exit(); |
804 | proc_if6_fail: | 804 | proc_if6_fail: |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 0e5f7499debb..b6c73da5ff35 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -244,7 +244,6 @@ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space, | |||
244 | opt_space->opt_nflen = 0; | 244 | opt_space->opt_nflen = 0; |
245 | } | 245 | } |
246 | opt_space->dst1opt = fopt->dst1opt; | 246 | opt_space->dst1opt = fopt->dst1opt; |
247 | opt_space->auth = fopt->auth; | ||
248 | opt_space->opt_flen = fopt->opt_flen; | 247 | opt_space->opt_flen = fopt->opt_flen; |
249 | return opt_space; | 248 | return opt_space; |
250 | } | 249 | } |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 06e7cdaeedc5..1f2c2f9e353f 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -465,7 +465,6 @@ static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from) | |||
465 | to->pkt_type = from->pkt_type; | 465 | to->pkt_type = from->pkt_type; |
466 | to->priority = from->priority; | 466 | to->priority = from->priority; |
467 | to->protocol = from->protocol; | 467 | to->protocol = from->protocol; |
468 | to->security = from->security; | ||
469 | dst_release(to->dst); | 468 | dst_release(to->dst); |
470 | to->dst = dst_clone(from->dst); | 469 | to->dst = dst_clone(from->dst); |
471 | to->dev = from->dev; | 470 | to->dev = from->dev; |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 9dac7fdf4726..f6e288dc116e 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -2018,7 +2018,7 @@ static int tcp_v6_init_sock(struct sock *sk) | |||
2018 | */ | 2018 | */ |
2019 | tp->snd_ssthresh = 0x7fffffff; | 2019 | tp->snd_ssthresh = 0x7fffffff; |
2020 | tp->snd_cwnd_clamp = ~0; | 2020 | tp->snd_cwnd_clamp = ~0; |
2021 | tp->mss_cache_std = tp->mss_cache = 536; | 2021 | tp->mss_cache = 536; |
2022 | 2022 | ||
2023 | tp->reordering = sysctl_tcp_reordering; | 2023 | tp->reordering = sysctl_tcp_reordering; |
2024 | 2024 | ||
diff --git a/net/sched/Makefile b/net/sched/Makefile index 8f58cecd6266..e48d0d456b3e 100644 --- a/net/sched/Makefile +++ b/net/sched/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | obj-y := sch_generic.o | 5 | obj-y := sch_generic.o |
6 | 6 | ||
7 | obj-$(CONFIG_NET_SCHED) += sch_api.o sch_fifo.o | 7 | obj-$(CONFIG_NET_SCHED) += sch_api.o sch_fifo.o sch_blackhole.o |
8 | obj-$(CONFIG_NET_CLS) += cls_api.o | 8 | obj-$(CONFIG_NET_CLS) += cls_api.o |
9 | obj-$(CONFIG_NET_CLS_ACT) += act_api.o | 9 | obj-$(CONFIG_NET_CLS_ACT) += act_api.o |
10 | obj-$(CONFIG_NET_ACT_POLICE) += police.o | 10 | obj-$(CONFIG_NET_ACT_POLICE) += police.o |
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 9594206e6035..249c61936ea0 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -439,6 +439,8 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq, | |||
439 | 439 | ||
440 | t = NLMSG_DATA(nlh); | 440 | t = NLMSG_DATA(nlh); |
441 | t->tca_family = AF_UNSPEC; | 441 | t->tca_family = AF_UNSPEC; |
442 | t->tca__pad1 = 0; | ||
443 | t->tca__pad2 = 0; | ||
442 | 444 | ||
443 | x = (struct rtattr*) skb->tail; | 445 | x = (struct rtattr*) skb->tail; |
444 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | 446 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); |
@@ -580,6 +582,8 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid) | |||
580 | nlh = NLMSG_PUT(skb, pid, n->nlmsg_seq, RTM_DELACTION, sizeof(*t)); | 582 | nlh = NLMSG_PUT(skb, pid, n->nlmsg_seq, RTM_DELACTION, sizeof(*t)); |
581 | t = NLMSG_DATA(nlh); | 583 | t = NLMSG_DATA(nlh); |
582 | t->tca_family = AF_UNSPEC; | 584 | t->tca_family = AF_UNSPEC; |
585 | t->tca__pad1 = 0; | ||
586 | t->tca__pad2 = 0; | ||
583 | 587 | ||
584 | x = (struct rtattr *) skb->tail; | 588 | x = (struct rtattr *) skb->tail; |
585 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | 589 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); |
@@ -687,7 +691,9 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event, | |||
687 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags); | 691 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags); |
688 | t = NLMSG_DATA(nlh); | 692 | t = NLMSG_DATA(nlh); |
689 | t->tca_family = AF_UNSPEC; | 693 | t->tca_family = AF_UNSPEC; |
690 | 694 | t->tca__pad1 = 0; | |
695 | t->tca__pad2 = 0; | ||
696 | |||
691 | x = (struct rtattr*) skb->tail; | 697 | x = (struct rtattr*) skb->tail; |
692 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | 698 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); |
693 | 699 | ||
@@ -842,6 +848,8 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | |||
842 | cb->nlh->nlmsg_type, sizeof(*t)); | 848 | cb->nlh->nlmsg_type, sizeof(*t)); |
843 | t = NLMSG_DATA(nlh); | 849 | t = NLMSG_DATA(nlh); |
844 | t->tca_family = AF_UNSPEC; | 850 | t->tca_family = AF_UNSPEC; |
851 | t->tca__pad1 = 0; | ||
852 | t->tca__pad2 = 0; | ||
845 | 853 | ||
846 | x = (struct rtattr *) skb->tail; | 854 | x = (struct rtattr *) skb->tail; |
847 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | 855 | RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 1616bf5c9627..3b5714ef4d1a 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -331,6 +331,8 @@ tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh, | |||
331 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); | 331 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); |
332 | tcm = NLMSG_DATA(nlh); | 332 | tcm = NLMSG_DATA(nlh); |
333 | tcm->tcm_family = AF_UNSPEC; | 333 | tcm->tcm_family = AF_UNSPEC; |
334 | tcm->tcm__pad1 = 0; | ||
335 | tcm->tcm__pad1 = 0; | ||
334 | tcm->tcm_ifindex = tp->q->dev->ifindex; | 336 | tcm->tcm_ifindex = tp->q->dev->ifindex; |
335 | tcm->tcm_parent = tp->classid; | 337 | tcm->tcm_parent = tp->classid; |
336 | tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol); | 338 | tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol); |
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index 232fb9196810..006168d69376 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h | |||
@@ -618,6 +618,7 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh, | |||
618 | pinfo.protocol = s->protocol; | 618 | pinfo.protocol = s->protocol; |
619 | pinfo.tunnelid = s->tunnelid; | 619 | pinfo.tunnelid = s->tunnelid; |
620 | pinfo.tunnelhdr = f->tunnelhdr; | 620 | pinfo.tunnelhdr = f->tunnelhdr; |
621 | pinfo.pad = 0; | ||
621 | RTA_PUT(skb, TCA_RSVP_PINFO, sizeof(pinfo), &pinfo); | 622 | RTA_PUT(skb, TCA_RSVP_PINFO, sizeof(pinfo), &pinfo); |
622 | if (f->res.classid) | 623 | if (f->res.classid) |
623 | RTA_PUT(skb, TCA_RSVP_CLASSID, 4, &f->res.classid); | 624 | RTA_PUT(skb, TCA_RSVP_CLASSID, 4, &f->res.classid); |
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index 48bb23c2a35a..53d98f8d3d80 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c | |||
@@ -205,11 +205,6 @@ META_COLLECTOR(int_protocol) | |||
205 | dst->value = skb->protocol; | 205 | dst->value = skb->protocol; |
206 | } | 206 | } |
207 | 207 | ||
208 | META_COLLECTOR(int_security) | ||
209 | { | ||
210 | dst->value = skb->security; | ||
211 | } | ||
212 | |||
213 | META_COLLECTOR(int_pkttype) | 208 | META_COLLECTOR(int_pkttype) |
214 | { | 209 | { |
215 | dst->value = skb->pkt_type; | 210 | dst->value = skb->pkt_type; |
@@ -524,7 +519,6 @@ static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = { | |||
524 | [META_ID(REALDEV)] = META_FUNC(int_realdev), | 519 | [META_ID(REALDEV)] = META_FUNC(int_realdev), |
525 | [META_ID(PRIORITY)] = META_FUNC(int_priority), | 520 | [META_ID(PRIORITY)] = META_FUNC(int_priority), |
526 | [META_ID(PROTOCOL)] = META_FUNC(int_protocol), | 521 | [META_ID(PROTOCOL)] = META_FUNC(int_protocol), |
527 | [META_ID(SECURITY)] = META_FUNC(int_security), | ||
528 | [META_ID(PKTTYPE)] = META_FUNC(int_pkttype), | 522 | [META_ID(PKTTYPE)] = META_FUNC(int_pkttype), |
529 | [META_ID(PKTLEN)] = META_FUNC(int_pktlen), | 523 | [META_ID(PKTLEN)] = META_FUNC(int_pktlen), |
530 | [META_ID(DATALEN)] = META_FUNC(int_datalen), | 524 | [META_ID(DATALEN)] = META_FUNC(int_datalen), |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 97c1c75d5c78..b9a069af4a02 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -399,10 +399,8 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp) | |||
399 | { | 399 | { |
400 | int err; | 400 | int err; |
401 | struct rtattr *kind = tca[TCA_KIND-1]; | 401 | struct rtattr *kind = tca[TCA_KIND-1]; |
402 | void *p = NULL; | ||
403 | struct Qdisc *sch; | 402 | struct Qdisc *sch; |
404 | struct Qdisc_ops *ops; | 403 | struct Qdisc_ops *ops; |
405 | int size; | ||
406 | 404 | ||
407 | ops = qdisc_lookup_ops(kind); | 405 | ops = qdisc_lookup_ops(kind); |
408 | #ifdef CONFIG_KMOD | 406 | #ifdef CONFIG_KMOD |
@@ -437,64 +435,55 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp) | |||
437 | if (ops == NULL) | 435 | if (ops == NULL) |
438 | goto err_out; | 436 | goto err_out; |
439 | 437 | ||
440 | /* ensure that the Qdisc and the private data are 32-byte aligned */ | 438 | sch = qdisc_alloc(dev, ops); |
441 | size = ((sizeof(*sch) + QDISC_ALIGN_CONST) & ~QDISC_ALIGN_CONST); | 439 | if (IS_ERR(sch)) { |
442 | size += ops->priv_size + QDISC_ALIGN_CONST; | 440 | err = PTR_ERR(sch); |
443 | |||
444 | p = kmalloc(size, GFP_KERNEL); | ||
445 | err = -ENOBUFS; | ||
446 | if (!p) | ||
447 | goto err_out2; | 441 | goto err_out2; |
448 | memset(p, 0, size); | 442 | } |
449 | sch = (struct Qdisc *)(((unsigned long)p + QDISC_ALIGN_CONST) | ||
450 | & ~QDISC_ALIGN_CONST); | ||
451 | sch->padded = (char *)sch - (char *)p; | ||
452 | |||
453 | INIT_LIST_HEAD(&sch->list); | ||
454 | skb_queue_head_init(&sch->q); | ||
455 | 443 | ||
456 | if (handle == TC_H_INGRESS) | 444 | if (handle == TC_H_INGRESS) { |
457 | sch->flags |= TCQ_F_INGRESS; | 445 | sch->flags |= TCQ_F_INGRESS; |
458 | 446 | handle = TC_H_MAKE(TC_H_INGRESS, 0); | |
459 | sch->ops = ops; | 447 | } else if (handle == 0) { |
460 | sch->enqueue = ops->enqueue; | ||
461 | sch->dequeue = ops->dequeue; | ||
462 | sch->dev = dev; | ||
463 | dev_hold(dev); | ||
464 | atomic_set(&sch->refcnt, 1); | ||
465 | sch->stats_lock = &dev->queue_lock; | ||
466 | if (handle == 0) { | ||
467 | handle = qdisc_alloc_handle(dev); | 448 | handle = qdisc_alloc_handle(dev); |
468 | err = -ENOMEM; | 449 | err = -ENOMEM; |
469 | if (handle == 0) | 450 | if (handle == 0) |
470 | goto err_out3; | 451 | goto err_out3; |
471 | } | 452 | } |
472 | 453 | ||
473 | if (handle == TC_H_INGRESS) | 454 | sch->handle = handle; |
474 | sch->handle =TC_H_MAKE(TC_H_INGRESS, 0); | ||
475 | else | ||
476 | sch->handle = handle; | ||
477 | 455 | ||
478 | if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS-1])) == 0) { | 456 | if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS-1])) == 0) { |
457 | #ifdef CONFIG_NET_ESTIMATOR | ||
458 | if (tca[TCA_RATE-1]) { | ||
459 | err = gen_new_estimator(&sch->bstats, &sch->rate_est, | ||
460 | sch->stats_lock, | ||
461 | tca[TCA_RATE-1]); | ||
462 | if (err) { | ||
463 | /* | ||
464 | * Any broken qdiscs that would require | ||
465 | * a ops->reset() here? The qdisc was never | ||
466 | * in action so it shouldn't be necessary. | ||
467 | */ | ||
468 | if (ops->destroy) | ||
469 | ops->destroy(sch); | ||
470 | goto err_out3; | ||
471 | } | ||
472 | } | ||
473 | #endif | ||
479 | qdisc_lock_tree(dev); | 474 | qdisc_lock_tree(dev); |
480 | list_add_tail(&sch->list, &dev->qdisc_list); | 475 | list_add_tail(&sch->list, &dev->qdisc_list); |
481 | qdisc_unlock_tree(dev); | 476 | qdisc_unlock_tree(dev); |
482 | 477 | ||
483 | #ifdef CONFIG_NET_ESTIMATOR | ||
484 | if (tca[TCA_RATE-1]) | ||
485 | gen_new_estimator(&sch->bstats, &sch->rate_est, | ||
486 | sch->stats_lock, tca[TCA_RATE-1]); | ||
487 | #endif | ||
488 | return sch; | 478 | return sch; |
489 | } | 479 | } |
490 | err_out3: | 480 | err_out3: |
491 | dev_put(dev); | 481 | dev_put(dev); |
482 | kfree((char *) sch - sch->padded); | ||
492 | err_out2: | 483 | err_out2: |
493 | module_put(ops->owner); | 484 | module_put(ops->owner); |
494 | err_out: | 485 | err_out: |
495 | *errp = err; | 486 | *errp = err; |
496 | if (p) | ||
497 | kfree(p); | ||
498 | return NULL; | 487 | return NULL; |
499 | } | 488 | } |
500 | 489 | ||
@@ -770,6 +759,8 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, | |||
770 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); | 759 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); |
771 | tcm = NLMSG_DATA(nlh); | 760 | tcm = NLMSG_DATA(nlh); |
772 | tcm->tcm_family = AF_UNSPEC; | 761 | tcm->tcm_family = AF_UNSPEC; |
762 | tcm->tcm__pad1 = 0; | ||
763 | tcm->tcm__pad2 = 0; | ||
773 | tcm->tcm_ifindex = q->dev->ifindex; | 764 | tcm->tcm_ifindex = q->dev->ifindex; |
774 | tcm->tcm_parent = clid; | 765 | tcm->tcm_parent = clid; |
775 | tcm->tcm_handle = q->handle; | 766 | tcm->tcm_handle = q->handle; |
diff --git a/net/sched/sch_blackhole.c b/net/sched/sch_blackhole.c new file mode 100644 index 000000000000..81f0b8346d17 --- /dev/null +++ b/net/sched/sch_blackhole.c | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * net/sched/sch_blackhole.c Black hole queue | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * Authors: Thomas Graf <tgraf@suug.ch> | ||
10 | * | ||
11 | * Note: Quantum tunneling is not supported. | ||
12 | */ | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/netdevice.h> | ||
19 | #include <linux/skbuff.h> | ||
20 | #include <net/pkt_sched.h> | ||
21 | |||
22 | static int blackhole_enqueue(struct sk_buff *skb, struct Qdisc *sch) | ||
23 | { | ||
24 | qdisc_drop(skb, sch); | ||
25 | return NET_XMIT_SUCCESS; | ||
26 | } | ||
27 | |||
28 | static struct sk_buff *blackhole_dequeue(struct Qdisc *sch) | ||
29 | { | ||
30 | return NULL; | ||
31 | } | ||
32 | |||
33 | static struct Qdisc_ops blackhole_qdisc_ops = { | ||
34 | .id = "blackhole", | ||
35 | .priv_size = 0, | ||
36 | .enqueue = blackhole_enqueue, | ||
37 | .dequeue = blackhole_dequeue, | ||
38 | .owner = THIS_MODULE, | ||
39 | }; | ||
40 | |||
41 | static int __init blackhole_module_init(void) | ||
42 | { | ||
43 | return register_qdisc(&blackhole_qdisc_ops); | ||
44 | } | ||
45 | |||
46 | static void __exit blackhole_module_exit(void) | ||
47 | { | ||
48 | unregister_qdisc(&blackhole_qdisc_ops); | ||
49 | } | ||
50 | |||
51 | module_init(blackhole_module_init) | ||
52 | module_exit(blackhole_module_exit) | ||
53 | |||
54 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index d43e3b8cbf6a..09453f997d8c 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -1528,6 +1528,7 @@ static __inline__ int cbq_dump_ovl(struct sk_buff *skb, struct cbq_class *cl) | |||
1528 | 1528 | ||
1529 | opt.strategy = cl->ovl_strategy; | 1529 | opt.strategy = cl->ovl_strategy; |
1530 | opt.priority2 = cl->priority2+1; | 1530 | opt.priority2 = cl->priority2+1; |
1531 | opt.pad = 0; | ||
1531 | opt.penalty = (cl->penalty*1000)/HZ; | 1532 | opt.penalty = (cl->penalty*1000)/HZ; |
1532 | RTA_PUT(skb, TCA_CBQ_OVL_STRATEGY, sizeof(opt), &opt); | 1533 | RTA_PUT(skb, TCA_CBQ_OVL_STRATEGY, sizeof(opt), &opt); |
1533 | return skb->len; | 1534 | return skb->len; |
@@ -1563,6 +1564,8 @@ static __inline__ int cbq_dump_police(struct sk_buff *skb, struct cbq_class *cl) | |||
1563 | 1564 | ||
1564 | if (cl->police) { | 1565 | if (cl->police) { |
1565 | opt.police = cl->police; | 1566 | opt.police = cl->police; |
1567 | opt.__res1 = 0; | ||
1568 | opt.__res2 = 0; | ||
1566 | RTA_PUT(skb, TCA_CBQ_POLICE, sizeof(opt), &opt); | 1569 | RTA_PUT(skb, TCA_CBQ_POLICE, sizeof(opt), &opt); |
1567 | } | 1570 | } |
1568 | return skb->len; | 1571 | return skb->len; |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 7683b34dc6a9..73e218e646ac 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -395,24 +395,23 @@ static struct Qdisc_ops pfifo_fast_ops = { | |||
395 | .owner = THIS_MODULE, | 395 | .owner = THIS_MODULE, |
396 | }; | 396 | }; |
397 | 397 | ||
398 | struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops) | 398 | struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops) |
399 | { | 399 | { |
400 | void *p; | 400 | void *p; |
401 | struct Qdisc *sch; | 401 | struct Qdisc *sch; |
402 | int size; | 402 | unsigned int size; |
403 | int err = -ENOBUFS; | ||
403 | 404 | ||
404 | /* ensure that the Qdisc and the private data are 32-byte aligned */ | 405 | /* ensure that the Qdisc and the private data are 32-byte aligned */ |
405 | size = ((sizeof(*sch) + QDISC_ALIGN_CONST) & ~QDISC_ALIGN_CONST); | 406 | size = QDISC_ALIGN(sizeof(*sch)); |
406 | size += ops->priv_size + QDISC_ALIGN_CONST; | 407 | size += ops->priv_size + (QDISC_ALIGNTO - 1); |
407 | 408 | ||
408 | p = kmalloc(size, GFP_KERNEL); | 409 | p = kmalloc(size, GFP_KERNEL); |
409 | if (!p) | 410 | if (!p) |
410 | return NULL; | 411 | goto errout; |
411 | memset(p, 0, size); | 412 | memset(p, 0, size); |
412 | 413 | sch = (struct Qdisc *) QDISC_ALIGN((unsigned long) p); | |
413 | sch = (struct Qdisc *)(((unsigned long)p + QDISC_ALIGN_CONST) | 414 | sch->padded = (char *) sch - (char *) p; |
414 | & ~QDISC_ALIGN_CONST); | ||
415 | sch->padded = (char *)sch - (char *)p; | ||
416 | 415 | ||
417 | INIT_LIST_HEAD(&sch->list); | 416 | INIT_LIST_HEAD(&sch->list); |
418 | skb_queue_head_init(&sch->q); | 417 | skb_queue_head_init(&sch->q); |
@@ -423,11 +422,24 @@ struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops) | |||
423 | dev_hold(dev); | 422 | dev_hold(dev); |
424 | sch->stats_lock = &dev->queue_lock; | 423 | sch->stats_lock = &dev->queue_lock; |
425 | atomic_set(&sch->refcnt, 1); | 424 | atomic_set(&sch->refcnt, 1); |
425 | |||
426 | return sch; | ||
427 | errout: | ||
428 | return ERR_PTR(-err); | ||
429 | } | ||
430 | |||
431 | struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops) | ||
432 | { | ||
433 | struct Qdisc *sch; | ||
434 | |||
435 | sch = qdisc_alloc(dev, ops); | ||
436 | if (IS_ERR(sch)) | ||
437 | goto errout; | ||
438 | |||
426 | if (!ops->init || ops->init(sch, NULL) == 0) | 439 | if (!ops->init || ops->init(sch, NULL) == 0) |
427 | return sch; | 440 | return sch; |
428 | 441 | ||
429 | dev_put(dev); | 442 | errout: |
430 | kfree(p); | ||
431 | return NULL; | 443 | return NULL; |
432 | } | 444 | } |
433 | 445 | ||
@@ -591,6 +603,7 @@ EXPORT_SYMBOL(__netdev_watchdog_up); | |||
591 | EXPORT_SYMBOL(noop_qdisc); | 603 | EXPORT_SYMBOL(noop_qdisc); |
592 | EXPORT_SYMBOL(noop_qdisc_ops); | 604 | EXPORT_SYMBOL(noop_qdisc_ops); |
593 | EXPORT_SYMBOL(qdisc_create_dflt); | 605 | EXPORT_SYMBOL(qdisc_create_dflt); |
606 | EXPORT_SYMBOL(qdisc_alloc); | ||
594 | EXPORT_SYMBOL(qdisc_destroy); | 607 | EXPORT_SYMBOL(qdisc_destroy); |
595 | EXPORT_SYMBOL(qdisc_reset); | 608 | EXPORT_SYMBOL(qdisc_reset); |
596 | EXPORT_SYMBOL(qdisc_restart); | 609 | EXPORT_SYMBOL(qdisc_restart); |
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 2ec0320fac3b..c44bf4165c6e 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c | |||
@@ -102,9 +102,9 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, | |||
102 | /* Set up the base timeout information. */ | 102 | /* Set up the base timeout information. */ |
103 | ep->timeouts[SCTP_EVENT_TIMEOUT_NONE] = 0; | 103 | ep->timeouts[SCTP_EVENT_TIMEOUT_NONE] = 0; |
104 | ep->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] = | 104 | ep->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] = |
105 | SCTP_DEFAULT_TIMEOUT_T1_COOKIE; | 105 | msecs_to_jiffies(sp->rtoinfo.srto_initial); |
106 | ep->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] = | 106 | ep->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] = |
107 | SCTP_DEFAULT_TIMEOUT_T1_INIT; | 107 | msecs_to_jiffies(sp->rtoinfo.srto_initial); |
108 | ep->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] = | 108 | ep->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] = |
109 | msecs_to_jiffies(sp->rtoinfo.srto_initial); | 109 | msecs_to_jiffies(sp->rtoinfo.srto_initial); |
110 | ep->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX] = 0; | 110 | ep->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX] = 0; |
@@ -117,12 +117,9 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, | |||
117 | ep->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD] | 117 | ep->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD] |
118 | = 5 * msecs_to_jiffies(sp->rtoinfo.srto_max); | 118 | = 5 * msecs_to_jiffies(sp->rtoinfo.srto_max); |
119 | 119 | ||
120 | ep->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = | 120 | ep->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0; |
121 | SCTP_DEFAULT_TIMEOUT_HEARTBEAT; | 121 | ep->timeouts[SCTP_EVENT_TIMEOUT_SACK] = sctp_sack_timeout; |
122 | ep->timeouts[SCTP_EVENT_TIMEOUT_SACK] = | 122 | ep->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = sp->autoclose * HZ; |
123 | SCTP_DEFAULT_TIMEOUT_SACK; | ||
124 | ep->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = | ||
125 | sp->autoclose * HZ; | ||
126 | 123 | ||
127 | /* Use SCTP specific send buffer space queues. */ | 124 | /* Use SCTP specific send buffer space queues. */ |
128 | ep->sndbuf_policy = sctp_sndbuf_policy; | 125 | ep->sndbuf_policy = sctp_sndbuf_policy; |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 5135e1a25d25..e7f37faba7c0 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -1050,7 +1050,10 @@ SCTP_STATIC __init int sctp_init(void) | |||
1050 | sctp_sndbuf_policy = 0; | 1050 | sctp_sndbuf_policy = 0; |
1051 | 1051 | ||
1052 | /* HB.interval - 30 seconds */ | 1052 | /* HB.interval - 30 seconds */ |
1053 | sctp_hb_interval = 30 * HZ; | 1053 | sctp_hb_interval = SCTP_DEFAULT_TIMEOUT_HEARTBEAT; |
1054 | |||
1055 | /* delayed SACK timeout */ | ||
1056 | sctp_sack_timeout = SCTP_DEFAULT_TIMEOUT_SACK; | ||
1054 | 1057 | ||
1055 | /* Implementation specific variables. */ | 1058 | /* Implementation specific variables. */ |
1056 | 1059 | ||
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index 7fc31849312b..dc4893474f18 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c | |||
@@ -47,6 +47,8 @@ | |||
47 | static ctl_handler sctp_sysctl_jiffies_ms; | 47 | static ctl_handler sctp_sysctl_jiffies_ms; |
48 | static long rto_timer_min = 1; | 48 | static long rto_timer_min = 1; |
49 | static long rto_timer_max = 86400000; /* One day */ | 49 | static long rto_timer_max = 86400000; /* One day */ |
50 | static long sack_timer_min = 1; | ||
51 | static long sack_timer_max = 500; | ||
50 | 52 | ||
51 | static ctl_table sctp_table[] = { | 53 | static ctl_table sctp_table[] = { |
52 | { | 54 | { |
@@ -187,6 +189,17 @@ static ctl_table sctp_table[] = { | |||
187 | .mode = 0644, | 189 | .mode = 0644, |
188 | .proc_handler = &proc_dointvec | 190 | .proc_handler = &proc_dointvec |
189 | }, | 191 | }, |
192 | { | ||
193 | .ctl_name = NET_SCTP_SACK_TIMEOUT, | ||
194 | .procname = "sack_timeout", | ||
195 | .data = &sctp_sack_timeout, | ||
196 | .maxlen = sizeof(long), | ||
197 | .mode = 0644, | ||
198 | .proc_handler = &proc_doulongvec_ms_jiffies_minmax, | ||
199 | .strategy = &sctp_sysctl_jiffies_ms, | ||
200 | .extra1 = &sack_timer_min, | ||
201 | .extra2 = &sack_timer_max, | ||
202 | }, | ||
190 | { .ctl_name = 0 } | 203 | { .ctl_name = 0 } |
191 | }; | 204 | }; |
192 | 205 | ||
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index 0ec0fde6e6c5..a63b69179607 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
@@ -103,7 +103,6 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, | |||
103 | 103 | ||
104 | /* Set up the heartbeat timer. */ | 104 | /* Set up the heartbeat timer. */ |
105 | init_timer(&peer->hb_timer); | 105 | init_timer(&peer->hb_timer); |
106 | peer->hb_interval = SCTP_DEFAULT_TIMEOUT_HEARTBEAT; | ||
107 | peer->hb_timer.function = sctp_generate_heartbeat_event; | 106 | peer->hb_timer.function = sctp_generate_heartbeat_event; |
108 | peer->hb_timer.data = (unsigned long)peer; | 107 | peer->hb_timer.data = (unsigned long)peer; |
109 | 108 | ||
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 908bff6d1eef..5180405c1a84 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -25,6 +25,8 @@ typedef Elf64_Addr kernel_ulong_t; | |||
25 | #include <stdint.h> | 25 | #include <stdint.h> |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include <ctype.h> | ||
29 | |||
28 | typedef uint32_t __u32; | 30 | typedef uint32_t __u32; |
29 | typedef uint16_t __u16; | 31 | typedef uint16_t __u16; |
30 | typedef unsigned char __u8; | 32 | typedef unsigned char __u8; |
@@ -323,6 +325,22 @@ static int do_pcmcia_entry(const char *filename, | |||
323 | 325 | ||
324 | 326 | ||
325 | 327 | ||
328 | static int do_of_entry (const char *filename, struct of_device_id *of, char *alias) | ||
329 | { | ||
330 | char *tmp; | ||
331 | sprintf (alias, "of:N%sT%sC%s", | ||
332 | of->name[0] ? of->name : "*", | ||
333 | of->type[0] ? of->type : "*", | ||
334 | of->compatible[0] ? of->compatible : "*"); | ||
335 | |||
336 | /* Replace all whitespace with underscores */ | ||
337 | for (tmp = alias; tmp && *tmp; tmp++) | ||
338 | if (isspace (*tmp)) | ||
339 | *tmp = '_'; | ||
340 | |||
341 | return 1; | ||
342 | } | ||
343 | |||
326 | /* Ignore any prefix, eg. v850 prepends _ */ | 344 | /* Ignore any prefix, eg. v850 prepends _ */ |
327 | static inline int sym_is(const char *symbol, const char *name) | 345 | static inline int sym_is(const char *symbol, const char *name) |
328 | { | 346 | { |
@@ -401,6 +419,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
401 | else if (sym_is(symname, "__mod_pcmcia_device_table")) | 419 | else if (sym_is(symname, "__mod_pcmcia_device_table")) |
402 | do_table(symval, sym->st_size, sizeof(struct pcmcia_device_id), | 420 | do_table(symval, sym->st_size, sizeof(struct pcmcia_device_id), |
403 | do_pcmcia_entry, mod); | 421 | do_pcmcia_entry, mod); |
422 | else if (sym_is(symname, "__mod_of_device_table")) | ||
423 | do_table(symval, sym->st_size, sizeof(struct of_device_id), | ||
424 | do_of_entry, mod); | ||
425 | |||
404 | } | 426 | } |
405 | 427 | ||
406 | /* Now add out buffered information to the generated C source */ | 428 | /* Now add out buffered information to the generated C source */ |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 17a1189f1ff8..6be273851144 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -68,6 +68,7 @@ | |||
68 | #include <linux/personality.h> | 68 | #include <linux/personality.h> |
69 | #include <linux/sysctl.h> | 69 | #include <linux/sysctl.h> |
70 | #include <linux/audit.h> | 70 | #include <linux/audit.h> |
71 | #include <linux/string.h> | ||
71 | 72 | ||
72 | #include "avc.h" | 73 | #include "avc.h" |
73 | #include "objsec.h" | 74 | #include "objsec.h" |
@@ -1943,7 +1944,7 @@ static int selinux_sb_copy_data(struct file_system_type *type, void *orig, void | |||
1943 | } | 1944 | } |
1944 | } while (*in_end++); | 1945 | } while (*in_end++); |
1945 | 1946 | ||
1946 | copy_page(in_save, nosec_save); | 1947 | strcpy(in_save, nosec_save); |
1947 | free_page((unsigned long)nosec_save); | 1948 | free_page((unsigned long)nosec_save); |
1948 | out: | 1949 | out: |
1949 | return rc; | 1950 | return rc; |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index defdc5a459f0..c5557eaf3e2e 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
@@ -798,13 +798,15 @@ static struct { | |||
798 | {0x270f, 0xfc00}, /* Chaintech Digitop DST-1000 DVB-S */ | 798 | {0x270f, 0xfc00}, /* Chaintech Digitop DST-1000 DVB-S */ |
799 | }; | 799 | }; |
800 | 800 | ||
801 | static struct pci_driver driver; | ||
802 | |||
801 | /* return the rate of the card, or a negative value if it's blacklisted */ | 803 | /* return the rate of the card, or a negative value if it's blacklisted */ |
802 | static int __devinit snd_bt87x_detect_card(struct pci_dev *pci) | 804 | static int __devinit snd_bt87x_detect_card(struct pci_dev *pci) |
803 | { | 805 | { |
804 | int i; | 806 | int i; |
805 | const struct pci_device_id *supported; | 807 | const struct pci_device_id *supported; |
806 | 808 | ||
807 | supported = pci_match_device(snd_bt87x_ids, pci); | 809 | supported = pci_match_device(&driver, pci); |
808 | if (supported) | 810 | if (supported) |
809 | return supported->driver_data; | 811 | return supported->driver_data; |
810 | 812 | ||