add usb and mtd driver
[openwrt.git] / target / linux / linux-2.6 / patches / brcm / 001-bcm947xx.patch
1 diff -Nur linux-2.6.12.5/arch/mips/Kconfig linux-2.6.12.5-brcm/arch/mips/Kconfig
2 --- linux-2.6.12.5/arch/mips/Kconfig    2005-08-15 02:20:18.000000000 +0200
3 +++ linux-2.6.12.5-brcm/arch/mips/Kconfig       2005-08-28 16:21:04.700803432 +0200
4 @@ -40,6 +40,15 @@
5          Members include the Acer PICA, MIPS Magnum 4000, MIPS Millenium and
6          Olivetti M700-10 workstations.
7  
8 +config BCM947XX
9 +       bool "Support for BCM947xx based boards"
10 +       select DMA_NONCOHERENT
11 +       select HW_HAS_PCI
12 +       select IRQ_CPU
13 +       select CPU_LITTLE_ENDIAN
14 +       help
15 +        Support for BCM947xx based boards
16 +        
17  config ACER_PICA_61
18         bool "Support for Acer PICA 1 chipset (EXPERIMENTAL)"
19         depends on MACH_JAZZ && EXPERIMENTAL
20 @@ -974,7 +983,7 @@
21  
22  config CPU_LITTLE_ENDIAN
23         bool "Generate little endian code"
24 -       default y if ACER_PICA_61 || CASIO_E55 || DDB5074 || DDB5476 || DDB5477 || MACH_DECSTATION || IBM_WORKPAD || LASAT || MIPS_COBALT || MIPS_ITE8172 || MIPS_IVR || SOC_AU1X00 || NEC_OSPREY || OLIVETTI_M700 || SNI_RM200_PCI || VICTOR_MPC30X || ZAO_CAPCELLA
25 +       default y if ACER_PICA_61 || CASIO_E55 || DDB5074 || DDB5476 || DDB5477 || MACH_DECSTATION || IBM_WORKPAD || LASAT || MIPS_COBALT || MIPS_ITE8172 || MIPS_IVR || SOC_AU1X00 || NEC_OSPREY || OLIVETTI_M700 || SNI_RM200_PCI || VICTOR_MPC30X || ZAO_CAPCELLA || BCM47XX
26         default n if MIPS_EV64120 || MIPS_EV96100 || MOMENCO_OCELOT || MOMENCO_OCELOT_G || SGI_IP22 || SGI_IP27 || SGI_IP32 || TOSHIBA_JMR3927
27         help
28           Some MIPS machines can be configured for either little or big endian
29 diff -Nur linux-2.6.12.5/arch/mips/Kconfig.orig linux-2.6.12.5-brcm/arch/mips/Kconfig.orig
30 --- linux-2.6.12.5/arch/mips/Kconfig.orig       1970-01-01 01:00:00.000000000 +0100
31 +++ linux-2.6.12.5-brcm/arch/mips/Kconfig.orig  2005-08-15 02:20:18.000000000 +0200
32 @@ -0,0 +1,1662 @@
33 +config MIPS
34 +       bool
35 +       default y
36 +       # Horrible source of confusion.  Die, die, die ...
37 +       select EMBEDDED
38 +
39 +config MIPS64
40 +       bool "64-bit kernel"
41 +       help
42 +         Select this option if you want to build a 64-bit kernel.  You should
43 +         only select this option if you have hardware that actually has a
44 +         64-bit processor and if your application will actually benefit from
45 +         64-bit processing, otherwise say N.  You must say Y for kernels for
46 +         SGI IP27 (Origin 200 and 2000) and SGI IP32 (O2).  If in doubt say N.
47 +
48 +config 64BIT
49 +       def_bool MIPS64
50 +
51 +config MIPS32
52 +       bool
53 +       depends on MIPS64 = 'n'
54 +       default y
55 +
56 +mainmenu "Linux/MIPS Kernel Configuration"
57 +
58 +source "init/Kconfig"
59 +
60 +menu "Machine selection"
61 +
62 +config MACH_JAZZ
63 +       bool "Support for the Jazz family of machines"
64 +       select ARC
65 +       select ARC32
66 +       select GENERIC_ISA_DMA
67 +       select I8259
68 +       select ISA
69 +       help
70 +        This a family of machines based on the MIPS R4030 chipset which was
71 +        used by several vendors to build RISC/os and Windows NT workstations.
72 +        Members include the Acer PICA, MIPS Magnum 4000, MIPS Millenium and
73 +        Olivetti M700-10 workstations.
74 +
75 +config ACER_PICA_61
76 +       bool "Support for Acer PICA 1 chipset (EXPERIMENTAL)"
77 +       depends on MACH_JAZZ && EXPERIMENTAL
78 +       select DMA_NONCOHERENT
79 +       help
80 +         This is a machine with a R4400 133/150 MHz CPU. To compile a Linux
81 +         kernel that runs on these, say Y here. For details about Linux on
82 +         the MIPS architecture, check out the Linux/MIPS FAQ on the WWW at
83 +         <http://www.linux-mips.org/>.
84 +
85 +config MIPS_MAGNUM_4000
86 +       bool "Support for MIPS Magnum 4000"
87 +       depends on MACH_JAZZ
88 +       select DMA_NONCOHERENT
89 +       help
90 +         This is a machine with a R4000 100 MHz CPU. To compile a Linux
91 +         kernel that runs on these, say Y here. For details about Linux on
92 +         the MIPS architecture, check out the Linux/MIPS FAQ on the WWW at
93 +         <http://www.linux-mips.org/>.
94 +
95 +config OLIVETTI_M700
96 +       bool "Support for Olivetti M700-10"
97 +       depends on MACH_JAZZ
98 +       select DMA_NONCOHERENT
99 +       help
100 +         This is a machine with a R4000 100 MHz CPU. To compile a Linux
101 +         kernel that runs on these, say Y here. For details about Linux on
102 +         the MIPS architecture, check out the Linux/MIPS FAQ on the WWW at
103 +         <http://www.linux-mips.org/>.
104 +
105 +config MACH_VR41XX
106 +       bool "Support for NEC VR41XX-based machines"
107 +
108 +config NEC_CMBVR4133
109 +       bool "Support for NEC CMB-VR4133"
110 +       depends on MACH_VR41XX
111 +       select CPU_VR41XX
112 +       select DMA_NONCOHERENT
113 +       select IRQ_CPU
114 +       select HW_HAS_PCI
115 +       select PCI_VR41XX
116 +
117 +config ROCKHOPPER
118 +       bool "Support for Rockhopper baseboard"
119 +       depends on NEC_CMBVR4133
120 +       select I8259
121 +       select HAVE_STD_PC_SERIAL_PORT
122 +
123 +config CASIO_E55
124 +       bool "Support for CASIO CASSIOPEIA E-10/15/55/65"
125 +       depends on MACH_VR41XX
126 +       select DMA_NONCOHERENT
127 +       select IRQ_CPU
128 +       select ISA
129 +
130 +config IBM_WORKPAD
131 +       bool "Support for IBM WorkPad z50"
132 +       depends on MACH_VR41XX
133 +       select DMA_NONCOHERENT
134 +       select IRQ_CPU
135 +       select ISA
136 +
137 +config TANBAC_TB0226
138 +       bool "Support for TANBAC TB0226 (Mbase)"
139 +       depends on MACH_VR41XX
140 +       select DMA_NONCOHERENT
141 +       select HW_HAS_PCI
142 +       select IRQ_CPU
143 +       help
144 +         The TANBAC TB0226 (Mbase) is a MIPS-based platform manufactured by TANBAC.
145 +         Please refer to <http://www.tanbac.co.jp/> about Mbase.
146 +
147 +config TANBAC_TB0229
148 +       bool "Support for TANBAC TB0229 (VR4131DIMM)"
149 +       depends on MACH_VR41XX
150 +       select DMA_NONCOHERENT
151 +       select HW_HAS_PCI
152 +       select IRQ_CPU
153 +       help
154 +         The TANBAC TB0229 (VR4131DIMM) is a MIPS-based platform manufactured by TANBAC.
155 +         Please refer to <http://www.tanbac.co.jp/> about VR4131DIMM.
156 +
157 +config VICTOR_MPC30X
158 +       bool "Support for Victor MP-C303/304"
159 +       select DMA_NONCOHERENT
160 +       select HW_HAS_PCI
161 +       select IRQ_CPU
162 +       depends on MACH_VR41XX
163 +
164 +config ZAO_CAPCELLA
165 +       bool "Support for ZAO Networks Capcella"
166 +       depends on MACH_VR41XX
167 +       select DMA_NONCOHERENT
168 +       select HW_HAS_PCI
169 +       select IRQ_CPU
170 +
171 +config PCI_VR41XX
172 +       bool "Add PCI control unit support of NEC VR4100 series"
173 +       depends on MACH_VR41XX && PCI
174 +
175 +config VRC4171
176 +       tristate "Add NEC VRC4171 companion chip support"
177 +       depends on MACH_VR41XX && ISA
178 +       ---help---
179 +         The NEC VRC4171/4171A is a companion chip for NEC VR4111/VR4121.
180 +
181 +config VRC4173
182 +       tristate "Add NEC VRC4173 companion chip support"
183 +       depends on MACH_VR41XX && PCI_VR41XX
184 +       ---help---
185 +         The NEC VRC4173 is a companion chip for NEC VR4122/VR4131.
186 +
187 +config TOSHIBA_JMR3927
188 +       bool "Support for Toshiba JMR-TX3927 board"
189 +       depends on MIPS32
190 +       select DMA_NONCOHERENT
191 +       select HW_HAS_PCI
192 +       select SWAP_IO_SPACE
193 +
194 +config MIPS_COBALT
195 +       bool "Support for Cobalt Server (EXPERIMENTAL)"
196 +       depends on EXPERIMENTAL
197 +       select DMA_NONCOHERENT
198 +       select HW_HAS_PCI
199 +       select I8259
200 +       select IRQ_CPU
201 +
202 +config MACH_DECSTATION
203 +       bool "Support for DECstations"
204 +       select BOOT_ELF32
205 +       select DMA_NONCOHERENT
206 +       select IRQ_CPU
207 +       depends on MIPS32 || EXPERIMENTAL
208 +       ---help---
209 +         This enables support for DEC's MIPS based workstations.  For details
210 +         see the Linux/MIPS FAQ on <http://www.linux-mips.org/> and the
211 +         DECstation porting pages on <http://decstation.unix-ag.org/>.
212 +
213 +         If you have one of the following DECstation Models you definitely
214 +         want to choose R4xx0 for the CPU Type:
215 +
216 +               DECstation 5000/50
217 +               DECstation 5000/150
218 +               DECstation 5000/260
219 +               DECsystem 5900/260
220 +
221 +         otherwise choose R3000.
222 +
223 +config MIPS_EV64120
224 +       bool "Support for Galileo EV64120 Evaluation board (EXPERIMENTAL)"
225 +       depends on EXPERIMENTAL
226 +       select DMA_NONCOHERENT
227 +       select HW_HAS_PCI
228 +       select MIPS_GT64120
229 +       help
230 +         This is an evaluation board based on the Galileo GT-64120
231 +         single-chip system controller that contains a MIPS R5000 compatible
232 +         core running at 75/100MHz.  Their website is located at
233 +         <http://www.marvell.com/>.  Say Y here if you wish to build a
234 +         kernel for this platform.
235 +
236 +config EVB_PCI1
237 +       bool "Enable Second PCI (PCI1)"
238 +       depends on MIPS_EV64120
239 +
240 +config MIPS_EV96100
241 +       bool "Support for Galileo EV96100 Evaluation board (EXPERIMENTAL)"
242 +       depends on EXPERIMENTAL
243 +       select DMA_NONCOHERENT
244 +       select HW_HAS_PCI
245 +       select IRQ_CPU
246 +       select MIPS_GT96100
247 +       select RM7000_CPU_SCACHE
248 +       select SWAP_IO_SPACE
249 +       help
250 +         This is an evaluation board based on the Galileo GT-96100 LAN/WAN
251 +         communications controllers containing a MIPS R5000 compatible core
252 +         running at 83MHz. Their website is <http://www.marvell.com/>. Say Y
253 +         here if you wish to build a kernel for this platform.
254 +
255 +config MIPS_IVR
256 +       bool "Support for Globespan IVR board"
257 +       select DMA_NONCOHERENT
258 +       select HW_HAS_PCI
259 +       help
260 +         This is an evaluation board built by Globespan to showcase thir
261 +         iVR (Internet Video Recorder) design. It utilizes a QED RM5231
262 +         R5000 MIPS core. More information can be found out their website
263 +         located at <http://www.globespan.net/>. Say Y here if you wish to
264 +         build a kernel for this platform.
265 +
266 +config LASAT
267 +       bool "Support for LASAT Networks platforms"
268 +       select DMA_NONCOHERENT
269 +       select HW_HAS_PCI
270 +       select MIPS_GT64120
271 +       select R5000_CPU_SCACHE
272 +
273 +config PICVUE
274 +       tristate "PICVUE LCD display driver"
275 +       depends on LASAT
276 +
277 +config PICVUE_PROC
278 +       tristate "PICVUE LCD display driver /proc interface"
279 +       depends on PICVUE
280 +
281 +config DS1603
282 +       bool "DS1603 RTC driver"
283 +       depends on LASAT
284 +
285 +config LASAT_SYSCTL
286 +       bool "LASAT sysctl interface"
287 +       depends on LASAT
288 +
289 +config MIPS_ITE8172
290 +       bool "Support for ITE 8172G board"
291 +       select DMA_NONCOHERENT
292 +       select HW_HAS_PCI
293 +       help
294 +         Ths is an evaluation board made by ITE <http://www.ite.com.tw/>
295 +         with ATX form factor that utilizes a MIPS R5000 to work with its
296 +         ITE8172G companion internet appliance chip. The MIPS core can be
297 +         either a NEC Vr5432 or QED RM5231. Say Y here if you wish to build
298 +         a kernel for this platform.
299 +
300 +config IT8172_REVC
301 +       bool "Support for older IT8172 (Rev C)"
302 +       depends on MIPS_ITE8172
303 +       help
304 +         Say Y here to support the older, Revision C version of the Integrated
305 +         Technology Express, Inc. ITE8172 SBC.  Vendor page at
306 +         <http://www.ite.com.tw/ia/brief_it8172bsp.htm>; picture of the
307 +         board at <http://www.mvista.com/partners/semiconductor/ite.html>.
308 +
309 +config MIPS_ATLAS
310 +       bool "Support for MIPS Atlas board"
311 +       select BOOT_ELF32
312 +       select DMA_NONCOHERENT
313 +       select HW_HAS_PCI
314 +       select MIPS_GT64120
315 +       select SWAP_IO_SPACE
316 +       help
317 +         This enables support for the QED R5231-based MIPS Atlas evaluation
318 +         board.
319 +
320 +config MIPS_MALTA
321 +       bool "Support for MIPS Malta board"
322 +       select BOOT_ELF32
323 +       select HAVE_STD_PC_SERIAL_PORT
324 +       select DMA_NONCOHERENT
325 +       select GENERIC_ISA_DMA
326 +       select HW_HAS_PCI
327 +       select I8259
328 +       select MIPS_GT64120
329 +       select SWAP_IO_SPACE
330 +       help
331 +         This enables support for the VR5000-based MIPS Malta evaluation
332 +         board.
333 +
334 +config MIPS_SEAD
335 +       bool "Support for MIPS SEAD board (EXPERIMENTAL)"
336 +       depends on EXPERIMENTAL
337 +       select IRQ_CPU
338 +       select DMA_NONCOHERENT
339 +
340 +config MOMENCO_OCELOT
341 +       bool "Support for Momentum Ocelot board"
342 +       select DMA_NONCOHERENT
343 +       select HW_HAS_PCI
344 +       select IRQ_CPU
345 +       select IRQ_CPU_RM7K
346 +       select MIPS_GT64120
347 +       select RM7000_CPU_SCACHE
348 +       select SWAP_IO_SPACE
349 +       help
350 +         The Ocelot is a MIPS-based Single Board Computer (SBC) made by
351 +         Momentum Computer <http://www.momenco.com/>.
352 +
353 +config MOMENCO_OCELOT_G
354 +       bool "Support for Momentum Ocelot-G board"
355 +       select DMA_NONCOHERENT
356 +       select HW_HAS_PCI
357 +       select IRQ_CPU
358 +       select IRQ_CPU_RM7K
359 +       select PCI_MARVELL
360 +       select RM7000_CPU_SCACHE
361 +       select SWAP_IO_SPACE
362 +       help
363 +         The Ocelot is a MIPS-based Single Board Computer (SBC) made by
364 +         Momentum Computer <http://www.momenco.com/>.
365 +
366 +config MOMENCO_OCELOT_C
367 +       bool "Support for Momentum Ocelot-C board"
368 +       select DMA_NONCOHERENT
369 +       select HW_HAS_PCI
370 +       select IRQ_CPU
371 +       select IRQ_MV64340
372 +       select PCI_MARVELL
373 +       select RM7000_CPU_SCACHE
374 +       select SWAP_IO_SPACE
375 +       help
376 +         The Ocelot is a MIPS-based Single Board Computer (SBC) made by
377 +         Momentum Computer <http://www.momenco.com/>.
378 +
379 +config MOMENCO_OCELOT_3
380 +       bool "Support for Momentum Ocelot-3 board"
381 +       select BOOT_ELF32
382 +       select DMA_NONCOHERENT
383 +       select HW_HAS_PCI
384 +       select IRQ_CPU
385 +       select IRQ_CPU_RM7K
386 +       select IRQ_MV64340
387 +       select PCI_MARVELL
388 +       select RM7000_CPU_SCACHE
389 +       select SWAP_IO_SPACE
390 +       help
391 +         The Ocelot-3 is based off Discovery III System Controller and
392 +         PMC-Sierra Rm79000 core.
393 +
394 +config MOMENCO_JAGUAR_ATX
395 +       bool "Support for Momentum Jaguar board"
396 +       select BOOT_ELF32
397 +       select DMA_NONCOHERENT
398 +       select HW_HAS_PCI
399 +       select IRQ_CPU
400 +       select IRQ_CPU_RM7K
401 +       select IRQ_MV64340
402 +       select LIMITED_DMA
403 +       select PCI_MARVELL
404 +       select RM7000_CPU_SCACHE
405 +       select SWAP_IO_SPACE
406 +       help
407 +         The Jaguar ATX is a MIPS-based Single Board Computer (SBC) made by
408 +         Momentum Computer <http://www.momenco.com/>.
409 +
410 +config JAGUAR_DMALOW
411 +       bool "Low DMA Mode"
412 +       depends on MOMENCO_JAGUAR_ATX
413 +       help
414 +         Select to Y if jump JP5 is set on your board, N otherwise.  Normally
415 +         the jumper is set, so if you feel unsafe, just say Y.
416 +
417 +config PMC_YOSEMITE
418 +       bool "Support for PMC-Sierra Yosemite eval board"
419 +       select DMA_COHERENT
420 +       select HW_HAS_PCI
421 +       select IRQ_CPU
422 +       select IRQ_CPU_RM7K
423 +       select IRQ_CPU_RM9K
424 +       select SWAP_IO_SPACE
425 +       help
426 +         Yosemite is an evaluation board for the RM9000x2 processor
427 +         manufactured by PMC-Sierra
428 +
429 +config HYPERTRANSPORT
430 +       bool "Hypertransport Support for PMC-Sierra Yosemite"
431 +       depends on PMC_YOSEMITE
432 +
433 +config DDB5074
434 +       bool "Support for NEC DDB Vrc-5074 (EXPERIMENTAL)"
435 +       depends on EXPERIMENTAL
436 +       select DMA_NONCOHERENT
437 +       select HAVE_STD_PC_SERIAL_PORT
438 +       select HW_HAS_PCI
439 +       select IRQ_CPU
440 +       select I8259
441 +       select ISA
442 +       help
443 +         This enables support for the VR5000-based NEC DDB Vrc-5074
444 +         evaluation board.
445 +
446 +config DDB5476
447 +       bool "Support for NEC DDB Vrc-5476"
448 +       select DMA_NONCOHERENT
449 +       select HAVE_STD_PC_SERIAL_PORT
450 +       select HW_HAS_PCI
451 +       select IRQ_CPU
452 +       select I8259
453 +       select ISA
454 +       help
455 +         This enables support for the R5432-based NEC DDB Vrc-5476
456 +         evaluation board.
457 +
458 +         Features : kernel debugging, serial terminal, NFS root fs, on-board
459 +         ether port USB, AC97, PCI, PCI VGA card & framebuffer console,
460 +         IDE controller, PS2 keyboard, PS2 mouse, etc.
461 +
462 +config DDB5477
463 +       bool "Support for NEC DDB Vrc-5477"
464 +       select DMA_NONCOHERENT
465 +       select HW_HAS_PCI
466 +       select I8259
467 +       select IRQ_CPU
468 +       help
469 +         This enables support for the R5432-based NEC DDB Vrc-5477,
470 +         or Rockhopper/SolutionGear boards with R5432/R5500 CPUs.
471 +
472 +         Features : kernel debugging, serial terminal, NFS root fs, on-board
473 +         ether port USB, AC97, PCI, etc.
474 +
475 +config DDB5477_BUS_FREQUENCY
476 +       int "bus frequency (in kHZ, 0 for auto-detect)"
477 +       depends on DDB5477
478 +       default 0
479 +
480 +config NEC_OSPREY
481 +       bool "Support for NEC Osprey board"
482 +       select DMA_NONCOHERENT
483 +       select IRQ_CPU
484 +
485 +config SGI_IP22
486 +       bool "Support for SGI IP22 (Indy/Indigo2)"
487 +       select ARC
488 +       select ARC32
489 +       select BOOT_ELF32
490 +       select DMA_NONCOHERENT
491 +       select IP22_CPU_SCACHE
492 +       select IRQ_CPU
493 +       select SWAP_IO_SPACE
494 +       help
495 +         This are the SGI Indy, Challenge S and Indigo2, as well as certain
496 +         OEM variants like the Tandem CMN B006S. To compile a Linux kernel
497 +         that runs on these, say Y here.
498 +
499 +config SGI_IP27
500 +       bool "Support for SGI IP27 (Origin200/2000)"
501 +       depends on MIPS64
502 +       select ARC
503 +       select ARC64
504 +       select DMA_IP27
505 +       select HW_HAS_PCI
506 +       select PCI_DOMAINS
507 +       help
508 +         This are the SGI Origin 200, Origin 2000 and Onyx 2 Graphics
509 +         workstations.  To compile a Linux kernel that runs on these, say Y
510 +         here.
511 +
512 +#config SGI_SN0_XXL
513 +#      bool "IP27 XXL"
514 +#      depends on SGI_IP27
515 +#        This options adds support for userspace processes upto 16TB size.
516 +#        Normally the limit is just .5TB.
517 +
518 +config SGI_SN0_N_MODE
519 +       bool "IP27 N-Mode"
520 +       depends on SGI_IP27
521 +       help
522 +         The nodes of Origin 200, Origin 2000 and Onyx 2 systems can be
523 +         configured in either N-Modes which allows for more nodes or M-Mode
524 +         which allows for more memory.  Your system is most probably
525 +         running in M-Mode, so you should say N here.
526 +
527 +config DISCONTIGMEM
528 +       bool
529 +       default y if SGI_IP27
530 +       help
531 +         Say Y to upport efficient handling of discontiguous physical memory,
532 +         for architectures which are either NUMA (Non-Uniform Memory Access)
533 +         or have huge holes in the physical address space for other reasons.
534 +         See <file:Documentation/vm/numa> for more.
535 +
536 +config NUMA
537 +       bool "NUMA Support"
538 +       depends on SGI_IP27
539 +       help
540 +         Say Y to compile the kernel to support NUMA (Non-Uniform Memory
541 +         Access).  This option is for configuring high-end multiprocessor
542 +         server machines.  If in doubt, say N.
543 +
544 +config MAPPED_KERNEL
545 +       bool "Mapped kernel support"
546 +       depends on SGI_IP27
547 +       help
548 +         Change the way a Linux kernel is loaded into memory on a MIPS64
549 +         machine.  This is required in order to support text replication and
550 +         NUMA.  If you need to understand it, read the source code.
551 +
552 +config REPLICATE_KTEXT
553 +       bool "Kernel text replication support"
554 +       depends on SGI_IP27
555 +       help
556 +         Say Y here to enable replicating the kernel text across multiple
557 +         nodes in a NUMA cluster.  This trades memory for speed.
558 +
559 +config REPLICATE_EXHANDLERS
560 +       bool "Exception handler replication support"
561 +       depends on SGI_IP27
562 +       help
563 +         Say Y here to enable replicating the kernel exception handlers
564 +         across multiple nodes in a NUMA cluster. This trades memory for
565 +         speed.
566 +
567 +config SGI_IP32
568 +       bool "Support for SGI IP32 (O2) (EXPERIMENTAL)"
569 +       depends on MIPS64 && EXPERIMENTAL
570 +       select ARC
571 +       select ARC32
572 +       select BOOT_ELF32
573 +       select OWN_DMA
574 +       select DMA_IP32
575 +       select DMA_NONCOHERENT
576 +       select HW_HAS_PCI
577 +       select R5000_CPU_SCACHE
578 +       select RM7000_CPU_SCACHE
579 +       help
580 +         If you want this kernel to run on SGI O2 workstation, say Y here.
581 +
582 +config SOC_AU1X00
583 +       depends on MIPS32
584 +       bool "Support for AMD/Alchemy Au1X00 SOCs"
585 +
586 +choice
587 +       prompt "Au1X00 SOC Type"
588 +       depends on SOC_AU1X00
589 +       help
590 +         Say Y here to enable support for one of three AMD/Alchemy
591 +         SOCs. For additional documentation see www.amd.com.
592 +
593 +config SOC_AU1000
594 +       bool "SOC_AU1000"
595 +config SOC_AU1100
596 +       bool "SOC_AU1100"
597 +config SOC_AU1500
598 +       bool "SOC_AU1500"
599 +config SOC_AU1550
600 +       bool "SOC_AU1550"
601 +
602 +endchoice
603 +
604 +choice
605 +       prompt "AMD/Alchemy Au1x00 board support"
606 +       depends on SOC_AU1X00
607 +       help
608 +         These are evaluation boards built by AMD/Alchemy to
609 +         showcase their Au1X00 Internet Edge Processors. The SOC design
610 +         is based on the MIPS32 architecture running at 266/400/500MHz
611 +         with many integrated peripherals. Further information can be
612 +         found at their website, <http://www.amd.com/>. Say Y here if you
613 +         wish to build a kernel for this platform.
614 +
615 +config MIPS_PB1000
616 +       bool "PB1000 board"
617 +       depends on SOC_AU1000
618 +       select DMA_NONCOHERENT
619 +       select HW_HAS_PCI
620 +       select SWAP_IO_SPACE
621 +
622 +config MIPS_PB1100
623 +       bool "PB1100 board"
624 +       depends on SOC_AU1100
625 +       select DMA_NONCOHERENT
626 +       select HW_HAS_PCI
627 +       select SWAP_IO_SPACE
628 +
629 +config MIPS_PB1500
630 +       bool "PB1500 board"
631 +       depends on SOC_AU1500
632 +       select DMA_COHERENT
633 +       select HW_HAS_PCI
634 +
635 +config MIPS_PB1550
636 +       bool "PB1550 board"
637 +       depends on SOC_AU1550
638 +       select DMA_COHERENT
639 +       select HW_HAS_PCI
640 +       select MIPS_DISABLE_OBSOLETE_IDE
641 +
642 +config MIPS_DB1000
643 +       bool "DB1000 board"
644 +       depends on SOC_AU1000
645 +       select DMA_NONCOHERENT
646 +       select HW_HAS_PCI
647 +
648 +config MIPS_DB1100
649 +       bool "DB1100 board"
650 +       depends on SOC_AU1100
651 +       select DMA_NONCOHERENT
652 +
653 +config MIPS_DB1500
654 +       bool "DB1500 board"
655 +       depends on SOC_AU1500
656 +       select DMA_COHERENT
657 +       select HW_HAS_PCI
658 +       select MIPS_DISABLE_OBSOLETE_IDE
659 +
660 +config MIPS_DB1550
661 +       bool "DB1550 board"
662 +       depends on SOC_AU1550
663 +       select HW_HAS_PCI
664 +       select DMA_COHERENT
665 +       select MIPS_DISABLE_OBSOLETE_IDE
666 +
667 +config MIPS_BOSPORUS
668 +       bool "Bosporus board"
669 +       depends on SOC_AU1500
670 +       select DMA_NONCOHERENT
671 +
672 +config MIPS_MIRAGE
673 +       bool "Mirage board"
674 +       depends on SOC_AU1500
675 +       select DMA_NONCOHERENT
676 +
677 +config MIPS_XXS1500
678 +       bool "MyCable XXS1500 board"
679 +       depends on SOC_AU1500
680 +       select DMA_NONCOHERENT
681 +
682 +config MIPS_MTX1
683 +       bool "4G Systems MTX-1 board"
684 +       depends on SOC_AU1500
685 +       select HW_HAS_PCI
686 +       select DMA_NONCOHERENT
687 +
688 +endchoice
689 +
690 +config SIBYTE_SB1xxx_SOC
691 +       bool "Support for Broadcom BCM1xxx SOCs (EXPERIMENTAL)"
692 +       depends on EXPERIMENTAL
693 +       select BOOT_ELF32
694 +       select DMA_COHERENT
695 +       select SWAP_IO_SPACE
696 +
697 +choice
698 +       prompt "BCM1xxx SOC-based board"
699 +       depends on SIBYTE_SB1xxx_SOC
700 +       default SIBYTE_SWARM
701 +       help
702 +         Enable support for boards based on the SiByte line of SOCs
703 +         from Broadcom.  There are configurations for the known
704 +         evaluation boards, or you can choose "Other" and add your
705 +         own board support code.
706 +
707 +config SIBYTE_SWARM
708 +       bool "BCM91250A-SWARM"
709 +       select SIBYTE_SB1250
710 +
711 +config SIBYTE_SENTOSA
712 +       bool "BCM91250E-Sentosa"
713 +       select SIBYTE_SB1250
714 +
715 +config SIBYTE_RHONE
716 +       bool "BCM91125E-Rhone"
717 +       select SIBYTE_BCM1125H
718 +
719 +config SIBYTE_CARMEL
720 +       bool "BCM91120x-Carmel"
721 +       select SIBYTE_BCM1120
722 +
723 +config SIBYTE_PTSWARM
724 +       bool "BCM91250PT-PTSWARM"
725 +       select SIBYTE_SB1250
726 +
727 +config SIBYTE_LITTLESUR
728 +       bool "BCM91250C2-LittleSur"
729 +       select SIBYTE_SB1250
730 +
731 +config SIBYTE_CRHINE
732 +       bool "BCM91120C-CRhine"
733 +       select SIBYTE_BCM1120
734 +
735 +config SIBYTE_CRHONE
736 +       bool "BCM91125C-CRhone"
737 +       select SIBYTE_BCM1125
738 +
739 +config SIBYTE_UNKNOWN
740 +       bool "Other"
741 +
742 +endchoice
743 +
744 +config SIBYTE_BOARD
745 +       bool
746 +       depends on SIBYTE_SB1xxx_SOC && !SIBYTE_UNKNOWN
747 +       default y
748 +
749 +choice
750 +       prompt "BCM1xxx SOC Type"
751 +       depends on SIBYTE_UNKNOWN
752 +       default SIBYTE_UNK_BCM1250
753 +       help
754 +         Since you haven't chosen a known evaluation board from
755 +         Broadcom, you must explicitly pick the SOC this kernel is
756 +         targetted for.
757 +
758 +config SIBYTE_UNK_BCM1250
759 +       bool "BCM1250"
760 +       select SIBYTE_SB1250
761 +
762 +config SIBYTE_UNK_BCM1120
763 +       bool "BCM1120"
764 +       select SIBYTE_BCM1120
765 +
766 +config SIBYTE_UNK_BCM1125
767 +       bool "BCM1125"
768 +       select SIBYTE_BCM1125
769 +
770 +config SIBYTE_UNK_BCM1125H
771 +       bool "BCM1125H"
772 +       select SIBYTE_BCM1125H
773 +
774 +endchoice
775 +
776 +config SIBYTE_SB1250
777 +       bool
778 +       select HW_HAS_PCI
779 +
780 +config SIBYTE_BCM1120
781 +       bool
782 +       select SIBYTE_BCM112X
783 +
784 +config SIBYTE_BCM1125
785 +       bool
786 +       select HW_HAS_PCI
787 +       select SIBYTE_BCM112X
788 +
789 +config SIBYTE_BCM1125H
790 +       bool
791 +       select HW_HAS_PCI
792 +       select SIBYTE_BCM112X
793 +
794 +config SIBYTE_BCM112X
795 +       bool
796 +
797 +choice
798 +       prompt "SiByte SOC Stepping"
799 +       depends on SIBYTE_SB1xxx_SOC
800 +
801 +config CPU_SB1_PASS_1
802 +       bool "1250 Pass1"
803 +       depends on SIBYTE_SB1250
804 +       select CPU_HAS_PREFETCH
805 +
806 +config CPU_SB1_PASS_2_1250
807 +       bool "1250 An"
808 +       depends on SIBYTE_SB1250
809 +       select CPU_SB1_PASS_2
810 +       help
811 +         Also called BCM1250 Pass 2
812 +
813 +config CPU_SB1_PASS_2_2
814 +       bool "1250 Bn"
815 +       depends on SIBYTE_SB1250
816 +       select CPU_HAS_PREFETCH
817 +       help
818 +         Also called BCM1250 Pass 2.2
819 +
820 +config CPU_SB1_PASS_4
821 +       bool "1250 Cn"
822 +       depends on SIBYTE_SB1250
823 +       select CPU_HAS_PREFETCH
824 +       help
825 +         Also called BCM1250 Pass 3
826 +
827 +config CPU_SB1_PASS_2_112x
828 +       bool "112x Hybrid"
829 +       depends on SIBYTE_BCM112X
830 +       select CPU_SB1_PASS_2
831 +
832 +config CPU_SB1_PASS_3
833 +       bool "112x An"
834 +       depends on SIBYTE_BCM112X
835 +       select CPU_HAS_PREFETCH
836 +
837 +endchoice
838 +
839 +config CPU_SB1_PASS_2
840 +       bool
841 +
842 +config SIBYTE_HAS_LDT
843 +       bool
844 +       depends on PCI && (SIBYTE_SB1250 || SIBYTE_BCM1125H)
845 +       default y
846 +
847 +config SIMULATION
848 +       bool "Running under simulation"
849 +       depends on SIBYTE_SB1xxx_SOC
850 +       help
851 +         Build a kernel suitable for running under the GDB simulator.
852 +         Primarily adjusts the kernel's notion of time.
853 +
854 +config SIBYTE_CFE
855 +       bool "Booting from CFE"
856 +       depends on SIBYTE_SB1xxx_SOC
857 +       help
858 +         Make use of the CFE API for enumerating available memory,
859 +         controlling secondary CPUs, and possibly console output.
860 +
861 +config SIBYTE_CFE_CONSOLE
862 +       bool "Use firmware console"
863 +       depends on SIBYTE_CFE
864 +       help
865 +         Use the CFE API's console write routines during boot.  Other console
866 +         options (VT console, sb1250 duart console, etc.) should not be
867 +         configured.
868 +
869 +config SIBYTE_STANDALONE
870 +       bool
871 +       depends on SIBYTE_SB1xxx_SOC && !SIBYTE_CFE
872 +       default y
873 +
874 +config SIBYTE_STANDALONE_RAM_SIZE
875 +       int "Memory size (in megabytes)"
876 +       depends on SIBYTE_STANDALONE
877 +       default "32"
878 +
879 +config SIBYTE_BUS_WATCHER
880 +       bool "Support for Bus Watcher statistics"
881 +       depends on SIBYTE_SB1xxx_SOC
882 +       help
883 +         Handle and keep statistics on the bus error interrupts (COR_ECC,
884 +         BAD_ECC, IO_BUS).
885 +
886 +config SIBYTE_BW_TRACE
887 +       bool "Capture bus trace before bus error"
888 +       depends on SIBYTE_BUS_WATCHER
889 +       help
890 +         Run a continuous bus trace, dumping the raw data as soon as
891 +         a ZBbus error is detected.  Cannot work if ZBbus profiling
892 +         is turned on, and also will interfere with JTAG-based trace
893 +         buffer activity.  Raw buffer data is dumped to console, and
894 +         must be processed off-line.
895 +
896 +config SIBYTE_SB1250_PROF
897 +       bool "Support for SB1/SOC profiling - SB1/SCD perf counters"
898 +       depends on SIBYTE_SB1xxx_SOC
899 +
900 +config SIBYTE_TBPROF
901 +       bool "Support for ZBbus profiling"
902 +       depends on SIBYTE_SB1xxx_SOC
903 +
904 +config SNI_RM200_PCI
905 +       bool "Support for SNI RM200 PCI"
906 +       select ARC
907 +       select ARC32
908 +       select BOOT_ELF32
909 +       select DMA_NONCOHERENT
910 +       select GENERIC_ISA_DMA
911 +       select HAVE_STD_PC_SERIAL_PORT
912 +       select HW_HAS_PCI
913 +       select I8259
914 +       select ISA
915 +       help
916 +         The SNI RM200 PCI was a MIPS-based platform manufactured by Siemens
917 +         Nixdorf Informationssysteme (SNI), parent company of Pyramid
918 +         Technology and now in turn merged with Fujitsu.  Say Y here to
919 +         support this machine type.
920 +
921 +config TOSHIBA_RBTX4927
922 +       bool "Support for Toshiba TBTX49[23]7 board"
923 +       depends on MIPS32
924 +       select DMA_NONCOHERENT
925 +       select HAS_TXX9_SERIAL
926 +       select HW_HAS_PCI
927 +       select I8259
928 +       select ISA
929 +       select SWAP_IO_SPACE
930 +       help
931 +         This Toshiba board is based on the TX4927 processor. Say Y here to
932 +         support this machine type
933 +
934 +config TOSHIBA_FPCIB0
935 +       bool "FPCIB0 Backplane Support"
936 +       depends on TOSHIBA_RBTX4927
937 +
938 +config RWSEM_GENERIC_SPINLOCK
939 +       bool
940 +       default y
941 +
942 +config RWSEM_XCHGADD_ALGORITHM
943 +       bool
944 +
945 +config GENERIC_CALIBRATE_DELAY
946 +       bool
947 +       default y
948 +
949 +config HAVE_DEC_LOCK
950 +       bool
951 +       default y
952 +
953 +#
954 +# Select some configuration options automatically based on user selections.
955 +#
956 +config ARC
957 +       bool
958 +       depends on SNI_RM200_PCI || SGI_IP32 || SGI_IP27 || SGI_IP22 || MIPS_MAGNUM_4000 || OLIVETTI_M700 || ACER_PICA_61
959 +       default y
960 +
961 +config DMA_COHERENT
962 +       bool
963 +
964 +config DMA_IP27
965 +       bool
966 +
967 +config DMA_NONCOHERENT
968 +       bool
969 +
970 +config EARLY_PRINTK
971 +       bool
972 +       depends on MACH_DECSTATION
973 +       default y
974 +
975 +config GENERIC_ISA_DMA
976 +       bool
977 +       depends on SNI_RM200_PCI || MIPS_MAGNUM_4000 || OLIVETTI_M700 || ACER_PICA_61 || MIPS_MALTA
978 +       default y
979 +
980 +config I8259
981 +       bool
982 +       depends on SNI_RM200_PCI || DDB5477 || DDB5476 || DDB5074 || MACH_JAZZ || MIPS_MALTA || MIPS_COBALT
983 +       default y
984 +
985 +config LIMITED_DMA
986 +       bool
987 +       select HIGHMEM
988 +
989 +config MIPS_BONITO64
990 +       bool
991 +       depends on MIPS_ATLAS || MIPS_MALTA
992 +       default y
993 +
994 +config MIPS_MSC
995 +       bool
996 +       depends on MIPS_ATLAS || MIPS_MALTA
997 +       default y
998 +
999 +config MIPS_NILE4
1000 +       bool
1001 +       depends on LASAT
1002 +       default y
1003 +
1004 +config MIPS_DISABLE_OBSOLETE_IDE
1005 +       bool
1006 +
1007 +config CPU_LITTLE_ENDIAN
1008 +       bool "Generate little endian code"
1009 +       default y if ACER_PICA_61 || CASIO_E55 || DDB5074 || DDB5476 || DDB5477 || MACH_DECSTATION || IBM_WORKPAD || LASAT || MIPS_COBALT || MIPS_ITE8172 || MIPS_IVR || SOC_AU1X00 || NEC_OSPREY || OLIVETTI_M700 || SNI_RM200_PCI || VICTOR_MPC30X || ZAO_CAPCELLA
1010 +       default n if MIPS_EV64120 || MIPS_EV96100 || MOMENCO_OCELOT || MOMENCO_OCELOT_G || SGI_IP22 || SGI_IP27 || SGI_IP32 || TOSHIBA_JMR3927
1011 +       help
1012 +         Some MIPS machines can be configured for either little or big endian
1013 +         byte order. These modes require different kernels. Say Y if your
1014 +         machine is little endian, N if it's a big endian machine.
1015 +
1016 +config IRQ_CPU
1017 +       bool
1018 +
1019 +config IRQ_CPU_RM7K
1020 +       bool
1021 +
1022 +config IRQ_MV64340
1023 +       bool
1024 +
1025 +config DDB5XXX_COMMON
1026 +       bool
1027 +       depends on DDB5074 || DDB5476 || DDB5477
1028 +       default y
1029 +
1030 +config MIPS_BOARDS_GEN
1031 +       bool
1032 +       depends on MIPS_ATLAS || MIPS_MALTA || MIPS_SEAD
1033 +       default y
1034 +
1035 +config MIPS_GT64111
1036 +       bool
1037 +       depends on MIPS_COBALT
1038 +       default y
1039 +
1040 +config MIPS_GT64120
1041 +       bool
1042 +       depends on MIPS_EV64120 || MIPS_EV96100 || LASAT || MIPS_ATLAS || MIPS_MALTA || MOMENCO_OCELOT
1043 +       default y
1044 +
1045 +config MIPS_TX3927
1046 +       bool
1047 +       depends on TOSHIBA_JMR3927
1048 +       select HAS_TXX9_SERIAL
1049 +       default y
1050 +
1051 +config PCI_MARVELL
1052 +       bool
1053 +
1054 +config ITE_BOARD_GEN
1055 +       bool
1056 +       depends on MIPS_IVR || MIPS_ITE8172
1057 +       default y
1058 +
1059 +config SWAP_IO_SPACE
1060 +       bool
1061 +
1062 +#
1063 +# Unfortunately not all GT64120 systems run the chip at the same clock.
1064 +# As the user for the clock rate and try to minimize the available options.
1065 +#
1066 +choice
1067 +       prompt "Galileo Chip Clock"
1068 +       #default SYSCLK_83 if MIPS_EV64120
1069 +       depends on MIPS_EV64120 || MOMENCO_OCELOT || MOMENCO_OCELOT_G
1070 +       default SYSCLK_83 if MIPS_EV64120
1071 +       default SYSCLK_100 if MOMENCO_OCELOT || MOMENCO_OCELOT_G
1072 +
1073 +config SYSCLK_75
1074 +       bool "75" if MIPS_EV64120
1075 +
1076 +config SYSCLK_83
1077 +       bool "83.3" if MIPS_EV64120
1078 +
1079 +config SYSCLK_100
1080 +       bool "100" if MIPS_EV64120 || MOMENCO_OCELOT || MOMENCO_OCELOT_G
1081 +
1082 +endchoice
1083 +
1084 +config AU1X00_USB_DEVICE
1085 +       bool
1086 +       depends on MIPS_PB1500 || MIPS_PB1100 || MIPS_PB1000
1087 +       default n
1088 +
1089 +config MIPS_GT96100
1090 +       bool
1091 +       depends on MIPS_EV96100
1092 +       default y
1093 +       help
1094 +         Say Y here to support the Galileo Technology GT96100 communications
1095 +         controller card.  There is a web page at <http://www.galileot.com/>.
1096 +
1097 +config IT8172_CIR
1098 +       bool
1099 +       depends on MIPS_ITE8172 || MIPS_IVR
1100 +       default y
1101 +
1102 +config IT8712
1103 +       bool
1104 +       depends on MIPS_ITE8172
1105 +       default y
1106 +
1107 +config BOOT_ELF32
1108 +       bool
1109 +       depends on MACH_DECSTATION || MIPS_ATLAS || MIPS_MALTA || MOMENCO_JAGUAR_ATX || MOMENCO_OCELOT_3 || SIBYTE_SB1xxx_SOC || SGI_IP32 || SGI_IP22 || SNI_RM200_PCI
1110 +       default y
1111 +
1112 +config MIPS_L1_CACHE_SHIFT
1113 +       int
1114 +       default "4" if MACH_DECSTATION
1115 +       default "7" if SGI_IP27
1116 +       default "5"
1117 +
1118 +config ARC32
1119 +       bool
1120 +       depends on MACH_JAZZ || SNI_RM200_PCI || SGI_IP22 || SGI_IP32
1121 +       default y
1122 +
1123 +config FB
1124 +       bool
1125 +       depends on MIPS_MAGNUM_4000 || OLIVETTI_M700
1126 +       default y
1127 +       ---help---
1128 +         The frame buffer device provides an abstraction for the graphics
1129 +         hardware. It represents the frame buffer of some video hardware and
1130 +         allows application software to access the graphics hardware through
1131 +         a well-defined interface, so the software doesn't need to know
1132 +         anything about the low-level (hardware register) stuff.
1133 +
1134 +         Frame buffer devices work identically across the different
1135 +         architectures supported by Linux and make the implementation of
1136 +         application programs easier and more portable; at this point, an X
1137 +         server exists which uses the frame buffer device exclusively.
1138 +         On several non-X86 architectures, the frame buffer device is the
1139 +         only way to use the graphics hardware.
1140 +
1141 +         The device is accessed through special device nodes, usually located
1142 +         in the /dev directory, i.e. /dev/fb*.
1143 +
1144 +         You need an utility program called fbset to make full use of frame
1145 +         buffer devices. Please read <file:Documentation/fb/framebuffer.txt>
1146 +         and the Framebuffer-HOWTO at <http://www.tldp.org/docs.html#howto>
1147 +         for more information.
1148 +
1149 +         Say Y here and to the driver for your graphics board below if you
1150 +         are compiling a kernel for a non-x86 architecture.
1151 +
1152 +         If you are compiling for the x86 architecture, you can say Y if you
1153 +         want to play with it, but it is not essential. Please note that
1154 +         running graphical applications that directly touch the hardware
1155 +         (e.g. an accelerated X server) and that are not frame buffer
1156 +         device-aware may cause unexpected results. If unsure, say N.
1157 +
1158 +config HAVE_STD_PC_SERIAL_PORT
1159 +       bool
1160 +
1161 +config VR4181
1162 +       bool
1163 +       depends on NEC_OSPREY
1164 +       default y
1165 +
1166 +config ARC_CONSOLE
1167 +       bool "ARC console support"
1168 +       depends on SGI_IP22 || SNI_RM200_PCI
1169 +
1170 +config ARC_MEMORY
1171 +       bool
1172 +       depends on MACH_JAZZ || SNI_RM200_PCI || SGI_IP32
1173 +       default y
1174 +
1175 +config ARC_PROMLIB
1176 +       bool
1177 +       depends on MACH_JAZZ || SNI_RM200_PCI || SGI_IP22 || SGI_IP32
1178 +       default y
1179 +
1180 +config ARC64
1181 +       bool
1182 +       depends on SGI_IP27
1183 +       default y
1184 +
1185 +config BOOT_ELF64
1186 +       bool
1187 +       depends on SGI_IP27
1188 +       default y
1189 +
1190 +#config MAPPED_PCI_IO y
1191 +#      bool
1192 +#      depends on SGI_IP27
1193 +#      default y
1194 +
1195 +config QL_ISP_A64
1196 +       bool
1197 +       depends on SGI_IP27
1198 +       default y
1199 +
1200 +config TOSHIBA_BOARDS
1201 +       bool
1202 +       depends on TOSHIBA_JMR3927 || TOSHIBA_RBTX4927
1203 +       default y
1204 +
1205 +endmenu
1206 +
1207 +menu "CPU selection"
1208 +
1209 +choice
1210 +       prompt "CPU type"
1211 +       default CPU_R4X00
1212 +
1213 +config CPU_MIPS32
1214 +       bool "MIPS32"
1215 +
1216 +config CPU_MIPS64
1217 +       bool "MIPS64"
1218 +
1219 +config CPU_R3000
1220 +       bool "R3000"
1221 +       depends on MIPS32
1222 +       help
1223 +         Please make sure to pick the right CPU type. Linux/MIPS is not
1224 +         designed to be generic, i.e. Kernels compiled for R3000 CPUs will
1225 +         *not* work on R4000 machines and vice versa.  However, since most
1226 +         of the supported machines have an R4000 (or similar) CPU, R4x00
1227 +         might be a safe bet.  If the resulting kernel does not work,
1228 +         try to recompile with R3000.
1229 +
1230 +config CPU_TX39XX
1231 +       bool "R39XX"
1232 +       depends on MIPS32
1233 +
1234 +config CPU_VR41XX
1235 +       bool "R41xx"
1236 +       help
1237 +         The options selects support for the NEC VR41xx series of processors.
1238 +         Only choose this option if you have one of these processors as a
1239 +         kernel built with this option will not run on any other type of
1240 +         processor or vice versa.
1241 +
1242 +config CPU_R4300
1243 +       bool "R4300"
1244 +       help
1245 +         MIPS Technologies R4300-series processors.
1246 +
1247 +config CPU_R4X00
1248 +       bool "R4x00"
1249 +       help
1250 +         MIPS Technologies R4000-series processors other than 4300, including
1251 +         the R4000, R4400, R4600, and 4700.
1252 +
1253 +config CPU_TX49XX
1254 +       bool "R49XX"
1255 +
1256 +config CPU_R5000
1257 +       bool "R5000"
1258 +       help
1259 +         MIPS Technologies R5000-series processors other than the Nevada.
1260 +
1261 +config CPU_R5432
1262 +       bool "R5432"
1263 +
1264 +config CPU_R6000
1265 +       bool "R6000"
1266 +       depends on MIPS32 && EXPERIMENTAL
1267 +       help
1268 +         MIPS Technologies R6000 and R6000A series processors.  Note these
1269 +         processors are extremly rare and the support for them is incomplete.
1270 +
1271 +config CPU_NEVADA
1272 +       bool "RM52xx"
1273 +       help
1274 +         QED / PMC-Sierra RM52xx-series ("Nevada") processors.
1275 +
1276 +config CPU_R8000
1277 +       bool "R8000"
1278 +       depends on MIPS64 && EXPERIMENTAL
1279 +       help
1280 +         MIPS Technologies R8000 processors.  Note these processors are
1281 +         uncommon and the support for them is incomplete.
1282 +
1283 +config CPU_R10000
1284 +       bool "R10000"
1285 +       help
1286 +         MIPS Technologies R10000-series processors.
1287 +
1288 +config CPU_RM7000
1289 +       bool "RM7000"
1290 +
1291 +config CPU_RM9000
1292 +       bool "RM9000"
1293 +
1294 +config CPU_SB1
1295 +       bool "SB1"
1296 +
1297 +endchoice
1298 +
1299 +choice
1300 +       prompt "Kernel page size"
1301 +       default PAGE_SIZE_4KB
1302 +
1303 +config PAGE_SIZE_4KB
1304 +       bool "4kB"
1305 +       help
1306 +        This option select the standard 4kB Linux page size.  On some
1307 +        R3000-family processors this is the only available page size.  Using
1308 +        4kB page size will minimize memory consumption and is therefore
1309 +        recommended for low memory systems.
1310 +
1311 +config PAGE_SIZE_8KB
1312 +       bool "8kB"
1313 +       depends on EXPERIMENTAL && CPU_R8000
1314 +       help
1315 +         Using 8kB page size will result in higher performance kernel at
1316 +         the price of higher memory consumption.  This option is available
1317 +         only on the R8000 processor.  Not that at the time of this writing
1318 +         this option is still high experimental; there are also issues with
1319 +         compatibility of user applications.
1320 +
1321 +config PAGE_SIZE_16KB
1322 +       bool "16kB"
1323 +       depends on EXPERIMENTAL && !CPU_R3000 && !CPU_TX39XX
1324 +       help
1325 +         Using 16kB page size will result in higher performance kernel at
1326 +         the price of higher memory consumption.  This option is available on
1327 +         all non-R3000 family processor.  Not that at the time of this
1328 +         writing this option is still high experimental; there are also
1329 +         issues with compatibility of user applications.
1330 +
1331 +config PAGE_SIZE_64KB
1332 +       bool "64kB"
1333 +       depends on EXPERIMENTAL && !CPU_R3000 && !CPU_TX39XX
1334 +       help
1335 +         Using 64kB page size will result in higher performance kernel at
1336 +         the price of higher memory consumption.  This option is available on
1337 +         all non-R3000 family processor.  Not that at the time of this
1338 +         writing this option is still high experimental; there are also
1339 +         issues with compatibility of user applications.
1340 +
1341 +endchoice
1342 +
1343 +config BOARD_SCACHE
1344 +       bool
1345 +
1346 +config IP22_CPU_SCACHE
1347 +       bool
1348 +       select BOARD_SCACHE
1349 +
1350 +config R5000_CPU_SCACHE
1351 +       bool
1352 +       select BOARD_SCACHE
1353 +
1354 +config RM7000_CPU_SCACHE
1355 +       bool
1356 +       select BOARD_SCACHE
1357 +
1358 +config SIBYTE_DMA_PAGEOPS
1359 +       bool "Use DMA to clear/copy pages"
1360 +       depends on CPU_SB1
1361 +       help
1362 +         Instead of using the CPU to zero and copy pages, use a Data Mover
1363 +         channel.  These DMA channels are otherwise unused by the standard
1364 +         SiByte Linux port.  Seems to give a small performance benefit.
1365 +
1366 +config CPU_HAS_PREFETCH
1367 +       bool "Enable prefetches" if CPU_SB1 && !CPU_SB1_PASS_2
1368 +       default y if CPU_MIPS32 || CPU_MIPS64 || CPU_RM7000 || CPU_RM9000 || CPU_R10000
1369 +
1370 +config VTAG_ICACHE
1371 +       bool "Support for Virtual Tagged I-cache" if CPU_MIPS64 || CPU_MIPS32
1372 +       default y if CPU_SB1
1373 +
1374 +config SB1_PASS_1_WORKAROUNDS
1375 +       bool
1376 +       depends on CPU_SB1_PASS_1
1377 +       default y
1378 +
1379 +config SB1_PASS_2_WORKAROUNDS
1380 +       bool
1381 +       depends on CPU_SB1 && (CPU_SB1_PASS_2_2 || CPU_SB1_PASS_2)
1382 +       default y
1383 +
1384 +config SB1_PASS_2_1_WORKAROUNDS
1385 +       bool
1386 +       depends on CPU_SB1 && CPU_SB1_PASS_2
1387 +       default y
1388 +
1389 +config 64BIT_PHYS_ADDR
1390 +       bool "Support for 64-bit physical address space"
1391 +       depends on (CPU_R4X00 || CPU_R5000 || CPU_RM7000 || CPU_RM9000 || CPU_R10000 || CPU_SB1 || CPU_MIPS32 || CPU_MIPS64) && MIPS32
1392 +
1393 +config CPU_ADVANCED
1394 +       bool "Override CPU Options"
1395 +       depends on MIPS32
1396 +       help
1397 +         Saying yes here allows you to select support for various features
1398 +         your CPU may or may not have.  Most people should say N here.
1399 +
1400 +config CPU_HAS_LLSC
1401 +       bool "ll/sc Instructions available" if CPU_ADVANCED
1402 +       default y if !CPU_ADVANCED && !CPU_R3000 && !CPU_VR41XX && !CPU_TX39XX
1403 +       help
1404 +         MIPS R4000 series and later provide the Load Linked (ll)
1405 +         and Store Conditional (sc) instructions. More information is
1406 +         available at <http://www.go-ecs.com/mips/miptek1.htm>.
1407 +
1408 +         Say Y here if your CPU has the ll and sc instructions.  Say Y here
1409 +         for better performance, N if you don't know.  You must say Y here
1410 +         for multiprocessor machines.
1411 +
1412 +config CPU_HAS_LLDSCD
1413 +       bool "lld/scd Instructions available" if CPU_ADVANCED
1414 +       default y if !CPU_ADVANCED && !CPU_R3000 && !CPU_VR41XX && !CPU_TX39XX && !CPU_MIPS32
1415 +       help
1416 +         Say Y here if your CPU has the lld and scd instructions, the 64-bit
1417 +         equivalents of ll and sc.  Say Y here for better performance, N if
1418 +         you don't know.  You must say Y here for multiprocessor machines.
1419 +
1420 +config CPU_HAS_WB
1421 +       bool "Writeback Buffer available" if CPU_ADVANCED
1422 +       default y if !CPU_ADVANCED && CPU_R3000 && MACH_DECSTATION
1423 +       help
1424 +         Say N here for slightly better performance.  You must say Y here for
1425 +         machines which require flushing of write buffers in software.  Saying
1426 +         Y is the safe option; N may result in kernel malfunction and crashes.
1427 +
1428 +config CPU_HAS_SYNC
1429 +       bool
1430 +       depends on !CPU_R3000
1431 +       default y
1432 +
1433 +#
1434 +# - Highmem only makes sense for the 32-bit kernel.
1435 +# - The current highmem code will only work properly on physically indexed
1436 +#   caches such as R3000, SB1, R7000 or those that look like they're virtually
1437 +#   indexed such as R4000/R4400 SC and MC versions or R10000.  So for the
1438 +#   moment we protect the user and offer the highmem option only on machines
1439 +#   where it's known to be safe.  This will not offer highmem on a few systems
1440 +#   such as MIPS32 and MIPS64 CPUs which may have virtual and physically
1441 +#   indexed CPUs but we're playing safe.
1442 +# - We should not offer highmem for system of which we already know that they
1443 +#   don't have memory configurations that could gain from highmem support in
1444 +#   the kernel because they don't support configurations with RAM at physical
1445 +#   addresses > 0x20000000.
1446 +#
1447 +config HIGHMEM
1448 +       bool "High Memory Support"
1449 +       depends on MIPS32 && (CPU_R3000 || CPU_SB1 || CPU_R7000 || CPU_RM9000 || CPU_R10000) && !(MACH_DECSTATION || MOMENCO_JAGUAR_ATX)
1450 +
1451 +config SMP
1452 +       bool "Multi-Processing support"
1453 +       depends on CPU_RM9000 || (SIBYTE_SB1250 && !SIBYTE_STANDALONE) || SGI_IP27
1454 +       ---help---
1455 +         This enables support for systems with more than one CPU. If you have
1456 +         a system with only one CPU, like most personal computers, say N. If
1457 +         you have a system with more than one CPU, say Y.
1458 +
1459 +         If you say N here, the kernel will run on single and multiprocessor
1460 +         machines, but will use only one CPU of a multiprocessor machine. If
1461 +         you say Y here, the kernel will run on many, but not all,
1462 +         singleprocessor machines. On a singleprocessor machine, the kernel
1463 +         will run faster if you say N here.
1464 +
1465 +         People using multiprocessor machines who say Y here should also say
1466 +         Y to "Enhanced Real Time Clock Support", below.
1467 +
1468 +         See also the <file:Documentation/smp.txt> and the SMP-HOWTO
1469 +         available at <http://www.tldp.org/docs.html#howto>.
1470 +
1471 +         If you don't know what to do here, say N.
1472 +
1473 +config NR_CPUS
1474 +       int "Maximum number of CPUs (2-64)"
1475 +       range 2 64
1476 +       depends on SMP
1477 +       default "64" if SGI_IP27
1478 +       default "2"
1479 +       help
1480 +         This allows you to specify the maximum number of CPUs which this
1481 +         kernel will support.  The maximum supported value is 32 for 32-bit
1482 +         kernel and 64 for 64-bit kernels; the minimum value which makes
1483 +         sense is 2.
1484 +
1485 +         This is purely to save memory - each supported CPU adds
1486 +         approximately eight kilobytes to the kernel image.
1487 +
1488 +config PREEMPT
1489 +       bool "Preemptible Kernel"
1490 +       help
1491 +         This option reduces the latency of the kernel when reacting to
1492 +         real-time or interactive events by allowing a low priority process to
1493 +         be preempted even if it is in kernel mode executing a system call.
1494 +         This allows applications to run more reliably even when the system is
1495 +         under load.
1496 +
1497 +config RTC_DS1742
1498 +       bool "DS1742 BRAM/RTC support"
1499 +       depends on TOSHIBA_JMR3927 || TOSHIBA_RBTX4927
1500 +
1501 +config MIPS_INSANE_LARGE
1502 +       bool "Support for large 64-bit configurations"
1503 +       depends on CPU_R10000 && MIPS64
1504 +       help
1505 +         MIPS R10000 does support a 44 bit / 16TB address space as opposed to
1506 +         previous 64-bit processors which only supported 40 bit / 1TB. If you
1507 +         need processes of more than 1TB virtual address space, say Y here.
1508 +         This will result in additional memory usage, so it is not
1509 +         recommended for normal users.
1510 +
1511 +config RWSEM_GENERIC_SPINLOCK
1512 +       bool
1513 +       default y
1514 +
1515 +endmenu
1516 +
1517 +menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)"
1518 +
1519 +config HW_HAS_PCI
1520 +       bool
1521 +
1522 +config PCI
1523 +       bool "Support for PCI controller"
1524 +       depends on HW_HAS_PCI
1525 +       help
1526 +         Find out whether you have a PCI motherboard. PCI is the name of a
1527 +         bus system, i.e. the way the CPU talks to the other stuff inside
1528 +         your box. Other bus systems are ISA, EISA, or VESA. If you have PCI,
1529 +         say Y, otherwise N.
1530 +
1531 +         The PCI-HOWTO, available from
1532 +         <http://www.tldp.org/docs.html#howto>, contains valuable
1533 +         information about which PCI hardware does work under Linux and which
1534 +         doesn't.
1535 +
1536 +config PCI_DOMAINS
1537 +       bool
1538 +       depends on PCI
1539 +
1540 +source "drivers/pci/Kconfig"
1541 +
1542 +#
1543 +# ISA support is now enabled via select.  Too many systems still have the one
1544 +# or other ISA chip on the board that users don't know about so don't expect
1545 +# users to choose the right thing ...
1546 +#
1547 +config ISA
1548 +       bool
1549 +
1550 +config EISA
1551 +       bool "EISA support"
1552 +       depends on SGI_IP22 || SNI_RM200_PCI
1553 +       select ISA
1554 +       ---help---
1555 +         The Extended Industry Standard Architecture (EISA) bus was
1556 +         developed as an open alternative to the IBM MicroChannel bus.
1557 +
1558 +         The EISA bus provided some of the features of the IBM MicroChannel
1559 +         bus while maintaining backward compatibility with cards made for
1560 +         the older ISA bus.  The EISA bus saw limited use between 1988 and
1561 +         1995 when it was made obsolete by the PCI bus.
1562 +
1563 +         Say Y here if you are building a kernel for an EISA-based machine.
1564 +
1565 +         Otherwise, say N.
1566 +
1567 +source "drivers/eisa/Kconfig"
1568 +
1569 +config TC
1570 +       bool "TURBOchannel support"
1571 +       depends on MACH_DECSTATION
1572 +       help
1573 +         TurboChannel is a DEC (now Compaq (now HP)) bus for Alpha and MIPS
1574 +         processors.  Documentation on writing device drivers for TurboChannel
1575 +         is available at:
1576 +         <http://www.cs.arizona.edu/computer.help/policy/DIGITAL_unix/AA-PS3HD-TET1_html/TITLE.html>.
1577 +
1578 +#config ACCESSBUS
1579 +#      bool "Access.Bus support"
1580 +#      depends on TC
1581 +
1582 +config MMU
1583 +       bool
1584 +       default y
1585 +
1586 +config MCA
1587 +       bool
1588 +
1589 +config SBUS
1590 +       bool
1591 +
1592 +source "drivers/pcmcia/Kconfig"
1593 +
1594 +source "drivers/pci/hotplug/Kconfig"
1595 +
1596 +endmenu
1597 +
1598 +menu "Executable file formats"
1599 +
1600 +source "fs/Kconfig.binfmt"
1601 +
1602 +config TRAD_SIGNALS
1603 +       bool
1604 +       default y if MIPS32
1605 +
1606 +config BUILD_ELF64
1607 +       bool "Use 64-bit ELF format for building"
1608 +       depends on MIPS64
1609 +       help
1610 +         A 64-bit kernel is usually built using the 64-bit ELF binary object
1611 +         format as it's one that allows arbitrary 64-bit constructs.  For
1612 +         kernels that are loaded within the KSEG compatibility segments the
1613 +         32-bit ELF format can optionally be used resulting in a somewhat
1614 +         smaller binary, but this option is not explicitly supported by the
1615 +         toolchain and since binutils 2.14 it does not even work at all.
1616 +
1617 +         Say Y to use the 64-bit format or N to use the 32-bit one.
1618 +
1619 +         If unsure say Y.
1620 +
1621 +config BINFMT_IRIX
1622 +       bool "Include IRIX binary compatibility"
1623 +       depends on !CPU_LITTLE_ENDIAN && MIPS32 && BROKEN
1624 +
1625 +config MIPS32_COMPAT
1626 +       bool "Kernel support for Linux/MIPS 32-bit binary compatibility"
1627 +       depends on MIPS64
1628 +       help
1629 +         Select this option if you want Linux/MIPS 32-bit binary
1630 +         compatibility. Since all software available for Linux/MIPS is
1631 +         currently 32-bit you should say Y here.
1632 +
1633 +config COMPAT
1634 +       bool
1635 +       depends on MIPS32_COMPAT
1636 +       default y
1637 +
1638 +config MIPS32_O32
1639 +       bool "Kernel support for o32 binaries"
1640 +       depends on MIPS32_COMPAT
1641 +       help
1642 +         Select this option if you want to run o32 binaries.  These are pure
1643 +         32-bit binaries as used by the 32-bit Linux/MIPS port.  Most of
1644 +         existing binaries are in this format.
1645 +
1646 +         If unsure, say Y.
1647 +
1648 +config MIPS32_N32
1649 +       bool "Kernel support for n32 binaries"
1650 +       depends on MIPS32_COMPAT
1651 +       help
1652 +         Select this option if you want to run n32 binaries.  These are
1653 +         64-bit binaries using 32-bit quantities for addressing and certain
1654 +         data that would normally be 64-bit.  They are used in special
1655 +         cases.
1656 +
1657 +         If unsure, say N.
1658 +
1659 +config BINFMT_ELF32
1660 +       bool
1661 +       default y if MIPS32_O32 || MIPS32_N32
1662 +
1663 +config PM
1664 +       bool "Power Management support (EXPERIMENTAL)"
1665 +       depends on EXPERIMENTAL && MACH_AU1X00
1666 +
1667 +endmenu
1668 +
1669 +source "drivers/Kconfig"
1670 +
1671 +source "fs/Kconfig"
1672 +
1673 +source "arch/mips/Kconfig.debug"
1674 +
1675 +source "security/Kconfig"
1676 +
1677 +source "crypto/Kconfig"
1678 +
1679 +source "lib/Kconfig"
1680 +
1681 +#
1682 +# Use the generic interrupt handling code in kernel/irq/:
1683 +#
1684 +config GENERIC_HARDIRQS
1685 +       bool
1686 +       default y
1687 +
1688 +config GENERIC_IRQ_PROBE
1689 +       bool
1690 +       default y
1691 +
1692 +config ISA_DMA_API
1693 +       bool
1694 +       default y
1695 diff -Nur linux-2.6.12.5/arch/mips/Makefile linux-2.6.12.5-brcm/arch/mips/Makefile
1696 --- linux-2.6.12.5/arch/mips/Makefile   2005-08-15 02:20:18.000000000 +0200
1697 +++ linux-2.6.12.5-brcm/arch/mips/Makefile      2005-08-28 16:39:59.077334424 +0200
1698 @@ -79,7 +79,7 @@
1699  cflags-y                       += -I $(TOPDIR)/include/asm/gcc
1700  cflags-y                       += -G 0 -mno-abicalls -fno-pic -pipe
1701  cflags-y                       += $(call cc-option, -finline-limit=100000)
1702 -LDFLAGS_vmlinux                        += -G 0 -static -n
1703 +LDFLAGS_vmlinux                        += -G 0 -static -n -nostdlib
1704  MODFLAGS                       += -mlong-calls
1705  
1706  cflags-$(CONFIG_SB1XXX_CORELIS)        += -mno-sched-prolog -fno-omit-frame-pointer
1707 @@ -167,9 +167,10 @@
1708                         $(call set_gccflags,r4600,mips3,r4600,mips3,mips2)  \
1709                         -Wa,--trap
1710  
1711 -cflags-$(CONFIG_CPU_MIPS32)    += \
1712 -                       $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \
1713 -                       -Wa,--trap
1714 +#cflags-$(CONFIG_CPU_MIPS32)   += \
1715 +#                      $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \
1716 +#                      -Wa,--trap
1717 +cflags-$(CONFIG_CPU_MIPS32)    += -mips2 -Wa,--trap
1718  
1719  cflags-$(CONFIG_CPU_MIPS64)    += \
1720                         $(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \
1721 @@ -618,6 +619,14 @@
1722  load-$(CONFIG_SIBYTE_SWARM)    := 0xffffffff80100000
1723  
1724  #
1725 +# Broadcom BCM47XX boards
1726 +#
1727 +core-$(CONFIG_BCM947XX)                += arch/mips/bcm947xx/ arch/mips/bcm947xx/broadcom/
1728 +cflags-$(CONFIG_BCM947XX)      += -Iarch/mips/bcm947xx/include
1729 +load-$(CONFIG_BCM947XX)                := 0xffffffff80001000
1730 +
1731 +
1732 +#
1733  # SNI RM200 PCI
1734  #
1735  core-$(CONFIG_SNI_RM200_PCI)   += arch/mips/sni/
1736 @@ -729,6 +738,7 @@
1737  archclean:
1738         @$(MAKE) $(clean)=arch/mips/boot
1739         @$(MAKE) $(clean)=arch/mips/lasat
1740 +       @$(MAKE) -C arch/mips/bcm47xx/compressed clean
1741  
1742  # Generate <asm/offset.h 
1743  #
1744 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/Makefile linux-2.6.12.5-brcm/arch/mips/bcm947xx/Makefile
1745 --- linux-2.6.12.5/arch/mips/bcm947xx/Makefile  1970-01-01 01:00:00.000000000 +0100
1746 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/Makefile     2005-08-28 11:12:20.406862800 +0200
1747 @@ -0,0 +1,6 @@
1748 +#
1749 +# Makefile for the BCM47xx specific kernel interface routines
1750 +# under Linux.
1751 +#
1752 +
1753 +obj-y := irq.o int-handler.o prom.o setup.o time.o
1754 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/Makefile linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/Makefile
1755 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/Makefile 1970-01-01 01:00:00.000000000 +0100
1756 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/Makefile    2005-08-28 11:12:20.407862648 +0200
1757 @@ -0,0 +1,6 @@
1758 +#
1759 +# Makefile for the BCM47xx specific kernel interface routines
1760 +# under Linux.
1761 +#
1762 +
1763 +obj-y   := sbutils.o linux_osl.o bcmsrom.o bcmutils.o sbmips.o sbpci.o hnddma.o
1764 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/bcmsrom.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/bcmsrom.c
1765 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/bcmsrom.c        1970-01-01 01:00:00.000000000 +0100
1766 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/bcmsrom.c   2005-08-28 11:12:20.408862496 +0200
1767 @@ -0,0 +1,685 @@
1768 +/*
1769 + *  Misc useful routines to access NIC SROM
1770 + *
1771 + * Copyright 2001-2003, Broadcom Corporation
1772 + * All Rights Reserved.
1773 + * 
1774 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
1775 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
1776 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
1777 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
1778 + * $Id: bcmsrom.c,v 1.1 2005/02/28 13:33:32 jolt Exp $
1779 + */
1780 +
1781 +#include <typedefs.h>
1782 +#include <osl.h>
1783 +#include <bcmutils.h>
1784 +#include <bcmsrom.h>
1785 +#include <bcmdevs.h>
1786 +#include <bcmendian.h>
1787 +#include <sbpcmcia.h>
1788 +#include <pcicfg.h>
1789 +
1790 +#include <proto/ethernet.h>    /* for sprom content groking */
1791 +
1792 +#define        VARS_MAX        4096    /* should be reduced */
1793 +
1794 +static int initvars_srom_pci(void *curmap, char **vars, int *count);
1795 +static int initvars_cis_pcmcia(void *osh, char **vars, int *count);
1796 +static int sprom_cmd_pcmcia(void *osh, uint8 cmd);
1797 +static int sprom_read_pcmcia(void *osh, uint16 addr, uint16 *data);
1798 +static int sprom_write_pcmcia(void *osh, uint16 addr, uint16 data);
1799 +static int sprom_read_pci(uint16 *sprom, uint byteoff, uint16 *buf, uint nbytes, bool check_crc);
1800 +
1801 +/*
1802 + * Initialize the vars from the right source for this platform.
1803 + * Return 0 on success, nonzero on error.
1804 + */
1805 +int
1806 +srom_var_init(uint bus, void *curmap, void *osh, char **vars, int *count)
1807 +{
1808 +       if (vars == NULL)
1809 +               return (0);
1810 +
1811 +       switch (bus) {
1812 +       case SB_BUS:
1813 +               /* These two could be asserts ... */
1814 +               *vars = NULL;
1815 +               *count = 0;
1816 +               return(0);
1817 +
1818 +       case PCI_BUS:
1819 +               ASSERT(curmap); /* can not be NULL */
1820 +               return(initvars_srom_pci(curmap, vars, count));
1821 +
1822 +       case PCMCIA_BUS:
1823 +               return(initvars_cis_pcmcia(osh, vars, count));
1824 +
1825 +
1826 +       default:
1827 +               ASSERT(0);
1828 +       }
1829 +       return (-1);
1830 +}
1831 +
1832 +
1833 +/* support only 16-bit word read from srom */
1834 +int
1835 +srom_read(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf)
1836 +{
1837 +       void *srom;
1838 +       uint i, off, nw;
1839 +
1840 +       /* check input - 16-bit access only */
1841 +       if (byteoff & 1 || nbytes & 1 || (byteoff + nbytes) > (SPROM_SIZE * 2))
1842 +               return 1;
1843 +
1844 +       if (bus == PCI_BUS) {
1845 +               if (!curmap)
1846 +                       return 1;
1847 +               srom = (void *)((uint)curmap + PCI_BAR0_SPROM_OFFSET);
1848 +               if (sprom_read_pci(srom, byteoff, buf, nbytes, FALSE))
1849 +                       return 1;
1850 +       } else if (bus == PCMCIA_BUS) {
1851 +               off = byteoff / 2;
1852 +               nw = nbytes / 2;
1853 +               for (i = 0; i < nw; i++) {
1854 +                       if (sprom_read_pcmcia(osh, (uint16)(off + i), (uint16*)(buf + i)))
1855 +                               return 1;
1856 +               }
1857 +       } else {
1858 +               return 1;
1859 +       }
1860 +
1861 +       return 0;
1862 +}
1863 +
1864 +/* support only 16-bit word write into srom */
1865 +int
1866 +srom_write(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf)
1867 +{
1868 +       uint16 *srom;
1869 +       uint i, off, nw, crc_range;
1870 +       uint16 image[SPROM_SIZE], *p;
1871 +       uint8 crc;
1872 +       volatile uint32 val32;
1873 +
1874 +       /* check input - 16-bit access only */
1875 +       if (byteoff & 1 || nbytes & 1 || (byteoff + nbytes) > (SPROM_SIZE * 2))
1876 +               return 1;
1877 +
1878 +       crc_range = ((bus == PCMCIA_BUS) ? SPROM_SIZE : SPROM_CRC_RANGE) * 2;
1879 +
1880 +       /* if changes made inside crc cover range */
1881 +       if (byteoff < crc_range) {
1882 +               nw = (((byteoff + nbytes) > crc_range) ? byteoff + nbytes : crc_range) / 2;
1883 +               /* read data including entire first 64 words from srom */
1884 +               if (srom_read(bus, curmap, osh, 0, nw * 2, image))
1885 +                       return 1;
1886 +               /* make changes */
1887 +               bcopy((void*)buf, (void*)&image[byteoff / 2], nbytes);
1888 +               /* calculate crc */
1889 +               htol16_buf(image, crc_range);
1890 +               crc = ~crc8((uint8 *)image, crc_range - 1, CRC8_INIT_VALUE);
1891 +               ltoh16_buf(image, crc_range);
1892 +               image[(crc_range / 2) - 1] = (crc << 8) | (image[(crc_range / 2) - 1] & 0xff);
1893 +               p = image;
1894 +               off = 0;
1895 +       } else {
1896 +               p = buf;
1897 +               off = byteoff / 2;
1898 +               nw = nbytes / 2;
1899 +       }
1900 +
1901 +       if (bus == PCI_BUS) {
1902 +               srom = (uint16*)((uint)curmap + PCI_BAR0_SPROM_OFFSET);
1903 +               /* enable writes to the SPROM */
1904 +               val32 = OSL_PCI_READ_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32));
1905 +               val32 |= SPROM_WRITEEN;
1906 +               OSL_PCI_WRITE_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32), val32);
1907 +               bcm_mdelay(500);
1908 +               /* write srom */
1909 +               for (i = 0; i < nw; i++) {
1910 +                       W_REG(&srom[off + i], p[i]);
1911 +                       bcm_mdelay(20);
1912 +               }
1913 +               /* disable writes to the SPROM */
1914 +               OSL_PCI_WRITE_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32), val32 & ~SPROM_WRITEEN);
1915 +       } else if (bus == PCMCIA_BUS) {
1916 +               /* enable writes to the SPROM */
1917 +               if (sprom_cmd_pcmcia(osh, SROM_WEN))
1918 +                       return 1;
1919 +               bcm_mdelay(500);
1920 +               /* write srom */
1921 +               for (i = 0; i < nw; i++) {
1922 +                       sprom_write_pcmcia(osh, (uint16)(off + i), p[i]);
1923 +                       bcm_mdelay(20);
1924 +               }
1925 +               /* disable writes to the SPROM */
1926 +               if (sprom_cmd_pcmcia(osh, SROM_WDS))
1927 +                       return 1;
1928 +       } else {
1929 +               return 1;
1930 +       }
1931 +
1932 +       bcm_mdelay(500);
1933 +       return 0;
1934 +}
1935 +
1936 +
1937 +int
1938 +srom_parsecis(uint8 *cis, char **vars, int *count)
1939 +{
1940 +       char eabuf[32];
1941 +       char *vp, *base;
1942 +       uint8 tup, tlen, sromrev = 1;
1943 +       int i, j;
1944 +       uint varsize;
1945 +       bool ag_init = FALSE;
1946 +       uint16 w;
1947 +
1948 +       ASSERT(vars);
1949 +       ASSERT(count);
1950 +
1951 +       base = vp = MALLOC(VARS_MAX);
1952 +       ASSERT(vp);
1953 +
1954 +       i = 0;
1955 +       do {
1956 +               tup = cis[i++];
1957 +               tlen = cis[i++];
1958 +
1959 +               switch (tup) {
1960 +               case CISTPL_MANFID:
1961 +                       vp += sprintf(vp, "manfid=%d", (cis[i + 1] << 8) + cis[i]);
1962 +                       vp++;
1963 +                       vp += sprintf(vp, "prodid=%d", (cis[i + 3] << 8) + cis[i + 2]);
1964 +                       vp++;
1965 +                       break;
1966 +
1967 +               case CISTPL_FUNCE:
1968 +                       if (cis[i] == LAN_NID) {
1969 +                               ASSERT(cis[i + 1] == ETHER_ADDR_LEN);
1970 +                               bcm_ether_ntoa((uchar*)&cis[i + 2], eabuf);
1971 +                               vp += sprintf(vp, "il0macaddr=%s", eabuf);
1972 +                               vp++;
1973 +                       }
1974 +                       break;
1975 +
1976 +               case CISTPL_CFTABLE:
1977 +                       vp += sprintf(vp, "regwindowsz=%d", (cis[i + 7] << 8) | cis[i + 6]);
1978 +                       vp++;
1979 +                       break;
1980 +
1981 +               case CISTPL_BRCM_HNBU:
1982 +                       switch (cis[i]) {
1983 +                       case HNBU_CHIPID:
1984 +                               vp += sprintf(vp, "vendid=%d", (cis[i + 2] << 8) + cis[i + 1]);
1985 +                               vp++;
1986 +                               vp += sprintf(vp, "devid=%d", (cis[i + 4] << 8) + cis[i + 3]);
1987 +                               vp++;
1988 +                               if (tlen == 7) {
1989 +                                       vp += sprintf(vp, "chiprev=%d", (cis[i + 6] << 8) + cis[i + 5]);
1990 +                                       vp++;
1991 +                               }
1992 +                               break;
1993 +
1994 +                       case HNBU_BOARDREV:
1995 +                               vp += sprintf(vp, "boardrev=%d", cis[i + 1]);
1996 +                               vp++;
1997 +                               break;
1998 +
1999 +                       case HNBU_AA:
2000 +                               vp += sprintf(vp, "aa0=%d", cis[i + 1]);
2001 +                               vp++;
2002 +                               break;
2003 +
2004 +                       case HNBU_AG:
2005 +                               vp += sprintf(vp, "ag0=%d", cis[i + 1]);
2006 +                               vp++;
2007 +                               ag_init = TRUE;
2008 +                               break;
2009 +
2010 +                       case HNBU_CC:
2011 +                               vp += sprintf(vp, "cc=%d", cis[i + 1]);
2012 +                               vp++;
2013 +                               break;
2014 +
2015 +                       case HNBU_PAPARMS:
2016 +                               vp += sprintf(vp, "pa0maxpwr=%d", cis[i + tlen - 1]);
2017 +                               vp++;
2018 +                               if (tlen == 9) {
2019 +                                       /* New version */
2020 +                                       for (j = 0; j < 3; j++) {
2021 +                                               vp += sprintf(vp, "pa0b%d=%d", j,
2022 +                                                             (cis[i + (j * 2) + 2] << 8) + cis[i + (j * 2) + 1]);
2023 +                                               vp++;
2024 +                                       }
2025 +                                       vp += sprintf(vp, "pa0itssit=%d", cis[i + 7]);
2026 +                                       vp++;
2027 +                               }
2028 +                               break;
2029 +
2030 +                       case HNBU_OEM:
2031 +                               vp += sprintf(vp, "oem=%02x%02x%02x%02x%02x%02x%02x%02x",
2032 +                                       cis[i + 1], cis[i + 2], cis[i + 3], cis[i + 4],
2033 +                                       cis[i + 5], cis[i + 6], cis[i + 7], cis[i + 8]);
2034 +                               vp++;
2035 +                               break;
2036 +                       case HNBU_BOARDFLAGS:
2037 +                               w = (cis[i + 2] << 8) + cis[i + 1];
2038 +                               if (w == 0xffff) w = 0;
2039 +                               vp += sprintf(vp, "boardflags=%d", w);
2040 +                               vp++;
2041 +                               break;
2042 +                       case HNBU_LED:
2043 +                               if (cis[i + 1] != 0xff) {
2044 +                                       vp += sprintf(vp, "wl0gpio0=%d", cis[i + 1]);
2045 +                                       vp++;
2046 +                               }
2047 +                               if (cis[i + 2] != 0xff) {
2048 +                                       vp += sprintf(vp, "wl0gpio1=%d", cis[i + 2]);
2049 +                                       vp++;
2050 +                               }
2051 +                               if (cis[i + 3] != 0xff) {
2052 +                                       vp += sprintf(vp, "wl0gpio2=%d", cis[i + 3]);
2053 +                                       vp++;
2054 +                               }
2055 +                               if (cis[i + 4] != 0xff) {
2056 +                                       vp += sprintf(vp, "wl0gpio3=%d", cis[i + 4]);
2057 +                                       vp++;
2058 +                               }
2059 +                               break;
2060 +                       }
2061 +                       break;
2062 +
2063 +               }
2064 +               i += tlen;
2065 +       } while (tup != 0xff);
2066 +
2067 +       /* Set the srom version */
2068 +       vp += sprintf(vp, "sromrev=%d", sromrev);
2069 +       vp++;
2070 +
2071 +       /* For now just set boardflags2 to zero */
2072 +       vp += sprintf(vp, "boardflags2=0");
2073 +       vp++;
2074 +
2075 +       /* if there is no antenna gain field, set default */
2076 +       if (ag_init == FALSE) {
2077 +               vp += sprintf(vp, "ag0=%d", 0xff);
2078 +               vp++;
2079 +       }
2080 +
2081 +       /* final nullbyte terminator */
2082 +       *vp++ = '\0';
2083 +       varsize = (uint)vp - (uint)base;
2084 +
2085 +       ASSERT(varsize < VARS_MAX);
2086 +
2087 +       if (varsize == VARS_MAX) {
2088 +               *vars = base;
2089 +       } else {
2090 +               vp = MALLOC(varsize);
2091 +               ASSERT(vp);
2092 +               bcopy(base, vp, varsize);
2093 +               MFREE(base, VARS_MAX);
2094 +               *vars = vp;
2095 +       }
2096 +       *count = varsize;
2097 +
2098 +       return (0);
2099 +}
2100 +
2101 +
2102 +/* set PCMCIA sprom command register */
2103 +static int
2104 +sprom_cmd_pcmcia(void *osh, uint8 cmd)
2105 +{
2106 +       uint8 status;
2107 +       uint wait_cnt = 1000;
2108 +
2109 +       /* write sprom command register */
2110 +       OSL_PCMCIA_WRITE_ATTR(osh, SROM_CS, &cmd, 1);
2111 +
2112 +       /* wait status */
2113 +       while (wait_cnt--) {
2114 +               OSL_PCMCIA_READ_ATTR(osh, SROM_CS, &status, 1);
2115 +               if (status & SROM_DONE)
2116 +                       return 0;
2117 +       }
2118 +       return 1;
2119 +}
2120 +
2121 +/* read a word from the PCMCIA srom */
2122 +static int
2123 +sprom_read_pcmcia(void *osh, uint16 addr, uint16 *data)
2124 +{
2125 +       uint8 addr_l, addr_h, data_l, data_h;
2126 +
2127 +       addr_l = (uint8)((addr * 2) & 0xff);
2128 +       addr_h = (uint8)(((addr * 2) >> 8) & 0xff);
2129 +
2130 +       /* set address */
2131 +       OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRH, &addr_h, 1);
2132 +       OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRL, &addr_l, 1);
2133 +
2134 +       /* do read */
2135 +       if (sprom_cmd_pcmcia(osh, SROM_READ))
2136 +               return 1;
2137 +
2138 +       /* read data */
2139 +       OSL_PCMCIA_READ_ATTR(osh, SROM_DATAH, &data_h, 1);
2140 +       OSL_PCMCIA_READ_ATTR(osh, SROM_DATAL, &data_l, 1);
2141 +
2142 +       *data = (data_h << 8) | data_l;
2143 +       return 0;
2144 +}
2145 +
2146 +/* write a word to the PCMCIA srom */
2147 +static int
2148 +sprom_write_pcmcia(void *osh, uint16 addr, uint16 data)
2149 +{
2150 +       uint8 addr_l, addr_h, data_l, data_h;
2151 +
2152 +       addr_l = (uint8)((addr * 2) & 0xff);
2153 +       addr_h = (uint8)(((addr * 2) >> 8) & 0xff);
2154 +       data_l = (uint8)(data & 0xff);
2155 +       data_h = (uint8)((data >> 8) & 0xff);
2156 +
2157 +       /* set address */
2158 +       OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRH, &addr_h, 1);
2159 +       OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRL, &addr_l, 1);
2160 +
2161 +       /* write data */
2162 +       OSL_PCMCIA_WRITE_ATTR(osh, SROM_DATAH, &data_h, 1);
2163 +       OSL_PCMCIA_WRITE_ATTR(osh, SROM_DATAL, &data_l, 1);
2164 +
2165 +       /* do write */
2166 +       return sprom_cmd_pcmcia(osh, SROM_WRITE);
2167 +}
2168 +
2169 +/*
2170 + * Read in and validate sprom.
2171 + * Return 0 on success, nonzero on error.
2172 + */
2173 +static int
2174 +sprom_read_pci(uint16 *sprom, uint byteoff, uint16 *buf, uint nbytes, bool check_crc)
2175 +{
2176 +       int off, nw;
2177 +       uint8 chk8;
2178 +       int i;
2179 +
2180 +       off = byteoff / 2;
2181 +       nw = ROUNDUP(nbytes, 2) / 2;
2182 +
2183 +       /* read the sprom */
2184 +       for (i = 0; i < nw; i++)
2185 +               buf[i] = R_REG(&sprom[off + i]);
2186 +
2187 +       if (check_crc) {
2188 +               /* fixup the endianness so crc8 will pass */
2189 +               htol16_buf(buf, nw * 2);
2190 +               if ((chk8 = crc8((uchar*)buf, nbytes, CRC8_INIT_VALUE)) != CRC8_GOOD_VALUE)
2191 +                       return (1);
2192 +               /* now correct the endianness of the byte array */
2193 +               ltoh16_buf(buf, nw * 2);
2194 +       }
2195 +
2196 +       return (0);
2197 +}
2198 +
2199 +/*
2200 + * Initialize nonvolatile variable table from sprom.
2201 + * Return 0 on success, nonzero on error.
2202 + */
2203 +
2204 +static int
2205 +initvars_srom_pci(void *curmap, char **vars, int *count)
2206 +{
2207 +       uint16 w, b[64];
2208 +       uint8 sromrev;
2209 +       struct ether_addr ea;
2210 +       char eabuf[32];              
2211 +       int c, woff, i;
2212 +       char *vp, *base;
2213 +
2214 +       if (sprom_read_pci((void *)((uint)curmap + PCI_BAR0_SPROM_OFFSET), 0, b, sizeof (b), TRUE))
2215 +               return (-1);
2216 +
2217 +       /* top word of sprom contains version and crc8 */
2218 +       sromrev = b[63] & 0xff;
2219 +       if ((sromrev != 1) && (sromrev != 2)) {
2220 +               return (-2);
2221 +       }
2222 +
2223 +       ASSERT(vars);
2224 +       ASSERT(count);
2225 +
2226 +       base = vp = MALLOC(VARS_MAX);
2227 +       ASSERT(vp);
2228 +
2229 +       vp += sprintf(vp, "sromrev=%d", sromrev);
2230 +       vp++;
2231 +
2232 +       if (sromrev >= 2) {
2233 +               /* New section takes over the 4th hardware function space */
2234 +
2235 +               /* Word 28 is boardflags2 */
2236 +               vp += sprintf(vp, "boardflags2=%d", b[28]);
2237 +               vp++;
2238 +
2239 +               /* Word 29 is max power 11a high/low */
2240 +               w = b[29];
2241 +               vp += sprintf(vp, "pa1himaxpwr=%d", w & 0xff);
2242 +               vp++;
2243 +               vp += sprintf(vp, "pa1lomaxpwr=%d", (w >> 8) & 0xff);
2244 +               vp++;
2245 +
2246 +               /* Words 30-32 set the 11alow pa settings,
2247 +                * 33-35 are the 11ahigh ones.
2248 +                */
2249 +               for (i = 0; i < 3; i++) {
2250 +                       vp += sprintf(vp, "pa1lob%d=%d", i, b[30 + i]);
2251 +                       vp++;
2252 +                       vp += sprintf(vp, "pa1hib%d=%d", i, b[33 + i]);
2253 +                       vp++;
2254 +               }
2255 +               w = b[59];
2256 +               if (w == 0)
2257 +                       vp += sprintf(vp, "ccode=");
2258 +               else
2259 +                       vp += sprintf(vp, "ccode=%c%c", (w >> 8), (w & 0xff));
2260 +               vp++;
2261 +
2262 +       }
2263 +
2264 +       /* parameter section of sprom starts at byte offset 72 */
2265 +       woff = 72/2;
2266 +
2267 +       /* first 6 bytes are il0macaddr */
2268 +       ea.octet[0] = (b[woff] >> 8) & 0xff;
2269 +       ea.octet[1] = b[woff] & 0xff;
2270 +       ea.octet[2] = (b[woff+1] >> 8) & 0xff;
2271 +       ea.octet[3] = b[woff+1] & 0xff;
2272 +       ea.octet[4] = (b[woff+2] >> 8) & 0xff;
2273 +       ea.octet[5] = b[woff+2] & 0xff;
2274 +       woff += ETHER_ADDR_LEN/2 ;
2275 +       bcm_ether_ntoa((uchar*)&ea, eabuf);
2276 +       vp += sprintf(vp, "il0macaddr=%s", eabuf);
2277 +       vp++;
2278 +
2279 +       /* next 6 bytes are et0macaddr */
2280 +       ea.octet[0] = (b[woff] >> 8) & 0xff;
2281 +       ea.octet[1] = b[woff] & 0xff;
2282 +       ea.octet[2] = (b[woff+1] >> 8) & 0xff;
2283 +       ea.octet[3] = b[woff+1] & 0xff;
2284 +       ea.octet[4] = (b[woff+2] >> 8) & 0xff;
2285 +       ea.octet[5] = b[woff+2] & 0xff;
2286 +       woff += ETHER_ADDR_LEN/2 ;
2287 +       bcm_ether_ntoa((uchar*)&ea, eabuf);
2288 +       vp += sprintf(vp, "et0macaddr=%s", eabuf);
2289 +       vp++;
2290 +
2291 +       /* next 6 bytes are et1macaddr */
2292 +       ea.octet[0] = (b[woff] >> 8) & 0xff;
2293 +       ea.octet[1] = b[woff] & 0xff;
2294 +       ea.octet[2] = (b[woff+1] >> 8) & 0xff;
2295 +       ea.octet[3] = b[woff+1] & 0xff;
2296 +       ea.octet[4] = (b[woff+2] >> 8) & 0xff;
2297 +       ea.octet[5] = b[woff+2] & 0xff;
2298 +       woff += ETHER_ADDR_LEN/2 ;
2299 +       bcm_ether_ntoa((uchar*)&ea, eabuf);
2300 +       vp += sprintf(vp, "et1macaddr=%s", eabuf);
2301 +       vp++;
2302 +
2303 +       /*
2304 +        * Enet phy settings one or two singles or a dual
2305 +        * Bits 4-0 : MII address for enet0 (0x1f for not there)
2306 +        * Bits 9-5 : MII address for enet1 (0x1f for not there)
2307 +        * Bit 14   : Mdio for enet0
2308 +        * Bit 15   : Mdio for enet1
2309 +        */
2310 +       w = b[woff];
2311 +       vp += sprintf(vp, "et0phyaddr=%d", (w & 0x1f));
2312 +       vp++;
2313 +       vp += sprintf(vp, "et1phyaddr=%d", ((w >> 5) & 0x1f));
2314 +       vp++;
2315 +       vp += sprintf(vp, "et0mdcport=%d", ((w >> 14) & 0x1));
2316 +       vp++;
2317 +       vp += sprintf(vp, "et1mdcport=%d", ((w >> 15) & 0x1));
2318 +       vp++;
2319 +
2320 +       /* Word 46 has board rev, antennas 0/1 & Country code/control */
2321 +       w = b[46];
2322 +       vp += sprintf(vp, "boardrev=%d", w & 0xff);
2323 +       vp++;
2324 +
2325 +       if (sromrev > 1)
2326 +               vp += sprintf(vp, "cctl=%d", (w >> 8) & 0xf);
2327 +       else
2328 +               vp += sprintf(vp, "cc=%d", (w >> 8) & 0xf);
2329 +       vp++;
2330 +
2331 +       vp += sprintf(vp, "aa0=%d", (w >> 12) & 0x3);
2332 +       vp++;
2333 +
2334 +       vp += sprintf(vp, "aa1=%d", (w >> 14) & 0x3);
2335 +       vp++;
2336 +
2337 +       /* Words 47-49 set the (wl) pa settings */
2338 +       woff = 47;
2339 +
2340 +       for (i = 0; i < 3; i++) {
2341 +               vp += sprintf(vp, "pa0b%d=%d", i, b[woff+i]);
2342 +               vp++;
2343 +               vp += sprintf(vp, "pa1b%d=%d", i, b[woff+i+6]);
2344 +               vp++;
2345 +       }
2346 +
2347 +       /*
2348 +        * Words 50-51 set the customer-configured wl led behavior.
2349 +        * 8 bits/gpio pin.  High bit:  activehi=0, activelo=1;
2350 +        * LED behavior values defined in wlioctl.h .
2351 +        */
2352 +       w = b[50];
2353 +       if ((w != 0) && (w != 0xffff)) {
2354 +               /* gpio0 */
2355 +               vp += sprintf(vp, "wl0gpio0=%d", (w & 0xff));
2356 +               vp++;
2357 +
2358 +               /* gpio1 */
2359 +               vp += sprintf(vp, "wl0gpio1=%d", (w >> 8) & 0xff);
2360 +               vp++;
2361 +       }
2362 +       w = b[51];
2363 +       if ((w != 0) && (w != 0xffff)) {
2364 +               /* gpio2 */
2365 +               vp += sprintf(vp, "wl0gpio2=%d", w & 0xff);
2366 +               vp++;
2367 +
2368 +               /* gpio3 */
2369 +               vp += sprintf(vp, "wl0gpio3=%d", (w >> 8) & 0xff);
2370 +               vp++;
2371 +       }
2372 +       
2373 +       /* Word 52 is max power 0/1 */
2374 +       w = b[52];
2375 +       vp += sprintf(vp, "pa0maxpwr=%d", w & 0xff);
2376 +       vp++;
2377 +       vp += sprintf(vp, "pa1maxpwr=%d", (w >> 8) & 0xff);
2378 +       vp++;
2379 +
2380 +       /* Word 56 is idle tssi target 0/1 */
2381 +       w = b[56];
2382 +       vp += sprintf(vp, "pa0itssit=%d", w & 0xff);
2383 +       vp++;
2384 +       vp += sprintf(vp, "pa1itssit=%d", (w >> 8) & 0xff);
2385 +       vp++;
2386 +
2387 +       /* Word 57 is boardflags, if not programmed make it zero */
2388 +       w = b[57];
2389 +       if (w == 0xffff) w = 0;
2390 +       vp += sprintf(vp, "boardflags=%d", w);
2391 +       vp++;
2392 +
2393 +       /* Word 58 is antenna gain 0/1 */
2394 +       w = b[58];
2395 +       vp += sprintf(vp, "ag0=%d", w & 0xff);
2396 +       vp++;
2397 +
2398 +       vp += sprintf(vp, "ag1=%d", (w >> 8) & 0xff);
2399 +       vp++;
2400 +
2401 +       if (sromrev == 1) {
2402 +               /* set the oem string */
2403 +               vp += sprintf(vp, "oem=%02x%02x%02x%02x%02x%02x%02x%02x",
2404 +                             ((b[59] >> 8) & 0xff), (b[59] & 0xff),
2405 +                             ((b[60] >> 8) & 0xff), (b[60] & 0xff),
2406 +                             ((b[61] >> 8) & 0xff), (b[61] & 0xff),
2407 +                             ((b[62] >> 8) & 0xff), (b[62] & 0xff));
2408 +               vp++;
2409 +       }
2410 +
2411 +       /* final nullbyte terminator */
2412 +       *vp++ = '\0';
2413 +
2414 +       c = vp - base;
2415 +       ASSERT(c <= VARS_MAX);
2416 +
2417 +       if (c == VARS_MAX) {
2418 +               *vars = base;
2419 +       } else {
2420 +               vp = MALLOC(c);
2421 +               ASSERT(vp);
2422 +               bcopy(base, vp, c);
2423 +               MFREE(base, VARS_MAX);
2424 +               *vars = vp;
2425 +       }
2426 +       *count = c;
2427 +
2428 +       return (0);
2429 +}
2430 +
2431 +/*
2432 + * Read the cis and call parsecis to initialize the vars.
2433 + * Return 0 on success, nonzero on error.
2434 + */
2435 +static int
2436 +initvars_cis_pcmcia(void *osh, char **vars, int *count)
2437 +{
2438 +       uint8 *cis = NULL;
2439 +       int rc;
2440 +
2441 +       if ((cis = MALLOC(CIS_SIZE)) == NULL)
2442 +               return (-1);
2443 +
2444 +       OSL_PCMCIA_READ_ATTR(osh, 0, cis, CIS_SIZE);
2445 +
2446 +       rc = srom_parsecis(cis, vars, count);
2447 +
2448 +       MFREE(cis, CIS_SIZE);
2449 +
2450 +       return (rc);
2451 +}
2452 +
2453 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/bcmutils.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/bcmutils.c
2454 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/bcmutils.c       1970-01-01 01:00:00.000000000 +0100
2455 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/bcmutils.c  2005-08-28 11:12:20.428859456 +0200
2456 @@ -0,0 +1,691 @@
2457 +/*
2458 + * Misc useful OS-independent routines.
2459 + *
2460 + * Copyright 2001-2003, Broadcom Corporation   
2461 + * All Rights Reserved.   
2462 + *    
2463 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
2464 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
2465 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
2466 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
2467 + * $Id: bcmutils.c,v 1.1 2005/02/28 13:33:32 jolt Exp $
2468 + */
2469 +
2470 +#include <typedefs.h>
2471 +#include <osl.h>
2472 +#include <bcmutils.h>
2473 +#include <bcmendian.h>
2474 +#include <bcmnvram.h>
2475 +
2476 +unsigned char bcm_ctype[] = {
2477 +       _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,                        /* 0-7 */
2478 +       _BCM_C,_BCM_C|_BCM_S,_BCM_C|_BCM_S,_BCM_C|_BCM_S,_BCM_C|_BCM_S,_BCM_C|_BCM_S,_BCM_C,_BCM_C,             /* 8-15 */
2479 +       _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,                        /* 16-23 */
2480 +       _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,                        /* 24-31 */
2481 +       _BCM_S|_BCM_SP,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,                        /* 32-39 */
2482 +       _BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,                        /* 40-47 */
2483 +       _BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,                        /* 48-55 */
2484 +       _BCM_D,_BCM_D,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,                        /* 56-63 */
2485 +       _BCM_P,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U,      /* 64-71 */
2486 +       _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,                        /* 72-79 */
2487 +       _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,                        /* 80-87 */
2488 +       _BCM_U,_BCM_U,_BCM_U,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,                        /* 88-95 */
2489 +       _BCM_P,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L,      /* 96-103 */
2490 +       _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,                        /* 104-111 */
2491 +       _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,                        /* 112-119 */
2492 +       _BCM_L,_BCM_L,_BCM_L,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_C,                        /* 120-127 */
2493 +       0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 128-143 */
2494 +       0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 144-159 */
2495 +       _BCM_S|_BCM_SP,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,   /* 160-175 */
2496 +       _BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,       /* 176-191 */
2497 +       _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,       /* 192-207 */
2498 +       _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_P,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_L,       /* 208-223 */
2499 +       _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,       /* 224-239 */
2500 +       _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_P,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L        /* 240-255 */
2501 +};
2502 +
2503 +uchar
2504 +bcm_toupper(uchar c)
2505 +{
2506 +       if (bcm_islower(c))
2507 +               c -= 'a'-'A';
2508 +       return (c);
2509 +}
2510 +
2511 +ulong
2512 +bcm_strtoul(char *cp, char **endp, uint base)
2513 +{
2514 +       ulong result, value;
2515 +       bool minus;
2516 +       
2517 +       minus = FALSE;
2518 +
2519 +       while (bcm_isspace(*cp))
2520 +               cp++;
2521 +       
2522 +       if (cp[0] == '+')
2523 +               cp++;
2524 +       else if (cp[0] == '-') {
2525 +               minus = TRUE;
2526 +               cp++;
2527 +       }
2528 +       
2529 +       if (base == 0) {
2530 +               if (cp[0] == '0') {
2531 +                       if ((cp[1] == 'x') || (cp[1] == 'X')) {
2532 +                               base = 16;
2533 +                               cp = &cp[2];
2534 +                       } else {
2535 +                               base = 8;
2536 +                               cp = &cp[1];
2537 +                       }
2538 +               } else
2539 +                       base = 10;
2540 +       } else if (base == 16 && (cp[0] == '0') && ((cp[1] == 'x') || (cp[1] == 'X'))) {
2541 +               cp = &cp[2];
2542 +       }
2543 +                  
2544 +       result = 0;
2545 +
2546 +       while (bcm_isxdigit(*cp) &&
2547 +              (value = bcm_isdigit(*cp) ? *cp-'0' : bcm_toupper(*cp)-'A'+10) < base) {
2548 +               result = result*base + value;
2549 +               cp++;
2550 +       }
2551 +
2552 +       if (minus)
2553 +               result = (ulong)(result * -1);
2554 +
2555 +       if (endp)
2556 +               *endp = (char *)cp;
2557 +
2558 +       return (result);
2559 +}
2560 +
2561 +uint
2562 +bcm_atoi(char *s)
2563 +{
2564 +       uint n;
2565 +
2566 +       n = 0;
2567 +
2568 +       while (bcm_isdigit(*s))
2569 +               n = (n * 10) + *s++ - '0';
2570 +       return (n);
2571 +}
2572 +
2573 +void
2574 +deadbeef(char *p, uint len)
2575 +{
2576 +       static uchar meat[] = { 0xde, 0xad, 0xbe, 0xef };
2577 +
2578 +       while (len-- > 0) {
2579 +               *p = meat[((uint)p) & 3];
2580 +               p++;
2581 +       }
2582 +}
2583 +
2584 +/* pretty hex print a contiguous buffer */
2585 +void
2586 +prhex(char *msg, uchar *buf, uint nbytes)
2587 +{
2588 +       char line[256];
2589 +       char* p;
2590 +       uint i;
2591 +
2592 +       if (msg && (msg[0] != '\0'))
2593 +               printf("%s: ", msg);
2594 +
2595 +       p = line;
2596 +       for (i = 0; i < nbytes; i++) {
2597 +               if (i % 16 == 0) {
2598 +                       p += sprintf(p, "%04d: ", i);   /* line prefix */
2599 +               }
2600 +               p += sprintf(p, "%02x ", buf[i]);
2601 +               if (i % 16 == 15) {
2602 +                       printf("%s\n", line);           /* flush line */
2603 +                       p = line;
2604 +               }
2605 +       }
2606 +
2607 +       /* flush last partial line */
2608 +       if (p != line)
2609 +               printf("%s\n", line);
2610 +}
2611 +
2612 +/* pretty hex print a pkt buffer chain */
2613 +void
2614 +prpkt(char *msg, void *drv, void *p0)
2615 +{
2616 +       void *p;
2617 +
2618 +       if (msg && (msg[0] != '\0'))
2619 +               printf("%s: ", msg);
2620 +
2621 +       for (p = p0; p; p = PKTNEXT(drv, p))
2622 +               prhex(NULL, PKTDATA(drv, p), PKTLEN(drv, p));
2623 +}
2624 +
2625 +/* copy a pkt buffer chain into a buffer */
2626 +uint
2627 +pktcopy(void *drv, void *p, uint offset, int len, uchar *buf)
2628 +{
2629 +       uint n, ret = 0;
2630 +
2631 +       if (len < 0)
2632 +               len = 4096;     /* "infinite" */
2633 +
2634 +       /* skip 'offset' bytes */
2635 +       for (; p && offset; p = PKTNEXT(drv, p)) {
2636 +               if (offset < (uint)PKTLEN(drv, p))
2637 +                       break;
2638 +               offset -= PKTLEN(drv, p);
2639 +       }
2640 +
2641 +       if (!p)
2642 +               return 0;
2643 +
2644 +       /* copy the data */
2645 +       for (; p && len; p = PKTNEXT(drv, p)) {
2646 +               n = MIN((uint)PKTLEN(drv, p) - offset, (uint)len);
2647 +               bcopy(PKTDATA(drv, p) + offset, buf, n);
2648 +               buf += n;
2649 +               len -= n;
2650 +               ret += n;
2651 +               offset = 0;
2652 +       }
2653 +
2654 +       return ret;
2655 +}
2656 +
2657 +/* return total length of buffer chain */
2658 +uint
2659 +pkttotlen(void *drv, void *p)
2660 +{
2661 +       uint total;
2662 +
2663 +       total = 0;
2664 +       for (; p; p = PKTNEXT(drv, p))
2665 +               total += PKTLEN(drv, p);
2666 +       return (total);
2667 +}
2668 +
2669 +
2670 +uchar*
2671 +bcm_ether_ntoa(char *ea, char *buf)
2672 +{
2673 +       sprintf(buf,"%02x:%02x:%02x:%02x:%02x:%02x",
2674 +               (uchar)ea[0]&0xff, (uchar)ea[1]&0xff, (uchar)ea[2]&0xff,
2675 +               (uchar)ea[3]&0xff, (uchar)ea[4]&0xff, (uchar)ea[5]&0xff);
2676 +       return (buf);
2677 +}
2678 +
2679 +/* parse a xx:xx:xx:xx:xx:xx format ethernet address */
2680 +int
2681 +bcm_ether_atoe(char *p, char *ea)
2682 +{
2683 +       int i = 0;
2684 +
2685 +       for (;;) {
2686 +               ea[i++] = (char) bcm_strtoul(p, &p, 16);
2687 +               if (!*p++ || i == 6)
2688 +                       break;
2689 +       }
2690 +
2691 +       return (i == 6);
2692 +}
2693 +
2694 +/* 
2695 + * Traverse a string of 1-byte tag/1-byte length/variable-length value 
2696 + * triples, returning a pointer to the substring whose first element 
2697 + * matches tag.  Stop parsing when we see an element whose ID is greater
2698 + * than the target key. 
2699 + */
2700 +bcm_tlv_t *
2701 +bcm_parse_ordered_tlvs(void *buf, int buflen, uint key)
2702 +{
2703 +       bcm_tlv_t *elt;
2704 +       int totlen;
2705 +
2706 +       elt = (bcm_tlv_t*)buf;
2707 +       totlen = buflen;
2708 +
2709 +       /* find tagged parameter */
2710 +       while (totlen >= 2) {
2711 +               uint id = elt->id;
2712 +               int len = elt->len;
2713 +               
2714 +               /* Punt if we start seeing IDs > than target key */
2715 +               if (id > key)
2716 +                       return(NULL);
2717 +
2718 +               /* validate remaining totlen */
2719 +               if ((id == key) && (totlen >= (len + 2)))
2720 +                       return (elt);
2721 +
2722 +               elt = (bcm_tlv_t*)((uint8*)elt + (len + 2));
2723 +               totlen -= (len + 2);
2724 +       }
2725 +       return NULL;
2726 +}
2727 +
2728 +
2729 +/* 
2730 + * Traverse a string of 1-byte tag/1-byte length/variable-length value 
2731 + * triples, returning a pointer to the substring whose first element 
2732 + * matches tag
2733 + */
2734 +bcm_tlv_t *
2735 +bcm_parse_tlvs(void *buf, int buflen, uint key)
2736 +{
2737 +       bcm_tlv_t *elt;
2738 +       int totlen;
2739 +
2740 +       elt = (bcm_tlv_t*)buf;
2741 +       totlen = buflen;
2742 +
2743 +       /* find tagged parameter */
2744 +       while (totlen >= 2) {
2745 +               int len = elt->len;
2746 +
2747 +               /* validate remaining totlen */
2748 +               if ((elt->id == key) && (totlen >= (len + 2)))
2749 +                       return (elt);
2750 +
2751 +               elt = (bcm_tlv_t*)((uint8*)elt + (len + 2));
2752 +               totlen -= (len + 2);
2753 +       }
2754 +       
2755 +       return NULL;
2756 +}
2757 +
2758 +void
2759 +pktqinit(struct pktq *q, int maxlen)
2760 +{
2761 +       q->head = q->tail = NULL;
2762 +       q->maxlen = maxlen;
2763 +       q->len = 0;
2764 +}
2765 +
2766 +void
2767 +pktenq(struct pktq *q, void *p, bool lifo)
2768 +{
2769 +       ASSERT(PKTLINK(p) == NULL);
2770 +
2771 +       PKTSETLINK(p, NULL);
2772 +
2773 +       if (q->tail == NULL) {
2774 +               ASSERT(q->head == NULL);
2775 +               q->head = q->tail = p;
2776 +       }
2777 +       else {
2778 +               ASSERT(q->head);
2779 +               ASSERT(PKTLINK(q->tail) == NULL);
2780 +               if (lifo) {
2781 +                       PKTSETLINK(p, q->head);
2782 +                       q->head = p;
2783 +               } else {
2784 +                       PKTSETLINK(q->tail, p);
2785 +                       q->tail = p;
2786 +               }
2787 +       }
2788 +       q->len++;
2789 +}
2790 +
2791 +void*
2792 +pktdeq(struct pktq *q)
2793 +{
2794 +       void *p;
2795 +
2796 +       if ((p = q->head)) {
2797 +               ASSERT(q->tail);
2798 +               q->head = PKTLINK(p);
2799 +               PKTSETLINK(p, NULL);
2800 +               q->len--;
2801 +               if (q->head == NULL)
2802 +                       q->tail = NULL;
2803 +       }
2804 +       else {
2805 +               ASSERT(q->tail == NULL);
2806 +       }
2807 +
2808 +       return (p);
2809 +}
2810 +
2811 +/*******************************************************************************
2812 + * crc8
2813 + *
2814 + * Computes a crc8 over the input data using the polynomial:
2815 + *
2816 + *       x^8 + x^7 +x^6 + x^4 + x^2 + 1
2817 + *
2818 + * The caller provides the initial value (either CRC8_INIT_VALUE
2819 + * or the previous returned value) to allow for processing of 
2820 + * discontiguous blocks of data.  When generating the CRC the
2821 + * caller is responsible for complementing the final return value
2822 + * and inserting it into the byte stream.  When checking, a final
2823 + * return value of CRC8_GOOD_VALUE indicates a valid CRC.
2824 + *
2825 + * Reference: Dallas Semiconductor Application Note 27
2826 + *   Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", 
2827 + *     ver 3, Aug 1993, ross@guest.adelaide.edu.au, Rocksoft Pty Ltd.,
2828 + *     ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
2829 + *
2830 + ******************************************************************************/
2831 +
2832 +static uint8 crc8_table[256] = {
2833 +    0x00, 0xF7, 0xB9, 0x4E, 0x25, 0xD2, 0x9C, 0x6B,
2834 +    0x4A, 0xBD, 0xF3, 0x04, 0x6F, 0x98, 0xD6, 0x21,
2835 +    0x94, 0x63, 0x2D, 0xDA, 0xB1, 0x46, 0x08, 0xFF,
2836 +    0xDE, 0x29, 0x67, 0x90, 0xFB, 0x0C, 0x42, 0xB5,
2837 +    0x7F, 0x88, 0xC6, 0x31, 0x5A, 0xAD, 0xE3, 0x14,
2838 +    0x35, 0xC2, 0x8C, 0x7B, 0x10, 0xE7, 0xA9, 0x5E,
2839 +    0xEB, 0x1C, 0x52, 0xA5, 0xCE, 0x39, 0x77, 0x80,
2840 +    0xA1, 0x56, 0x18, 0xEF, 0x84, 0x73, 0x3D, 0xCA,
2841 +    0xFE, 0x09, 0x47, 0xB0, 0xDB, 0x2C, 0x62, 0x95,
2842 +    0xB4, 0x43, 0x0D, 0xFA, 0x91, 0x66, 0x28, 0xDF,
2843 +    0x6A, 0x9D, 0xD3, 0x24, 0x4F, 0xB8, 0xF6, 0x01,
2844 +    0x20, 0xD7, 0x99, 0x6E, 0x05, 0xF2, 0xBC, 0x4B,
2845 +    0x81, 0x76, 0x38, 0xCF, 0xA4, 0x53, 0x1D, 0xEA,
2846 +    0xCB, 0x3C, 0x72, 0x85, 0xEE, 0x19, 0x57, 0xA0,
2847 +    0x15, 0xE2, 0xAC, 0x5B, 0x30, 0xC7, 0x89, 0x7E,
2848 +    0x5F, 0xA8, 0xE6, 0x11, 0x7A, 0x8D, 0xC3, 0x34,
2849 +    0xAB, 0x5C, 0x12, 0xE5, 0x8E, 0x79, 0x37, 0xC0,
2850 +    0xE1, 0x16, 0x58, 0xAF, 0xC4, 0x33, 0x7D, 0x8A,
2851 +    0x3F, 0xC8, 0x86, 0x71, 0x1A, 0xED, 0xA3, 0x54,
2852 +    0x75, 0x82, 0xCC, 0x3B, 0x50, 0xA7, 0xE9, 0x1E,
2853 +    0xD4, 0x23, 0x6D, 0x9A, 0xF1, 0x06, 0x48, 0xBF,
2854 +    0x9E, 0x69, 0x27, 0xD0, 0xBB, 0x4C, 0x02, 0xF5,
2855 +    0x40, 0xB7, 0xF9, 0x0E, 0x65, 0x92, 0xDC, 0x2B,
2856 +    0x0A, 0xFD, 0xB3, 0x44, 0x2F, 0xD8, 0x96, 0x61,
2857 +    0x55, 0xA2, 0xEC, 0x1B, 0x70, 0x87, 0xC9, 0x3E,
2858 +    0x1F, 0xE8, 0xA6, 0x51, 0x3A, 0xCD, 0x83, 0x74,
2859 +    0xC1, 0x36, 0x78, 0x8F, 0xE4, 0x13, 0x5D, 0xAA,
2860 +    0x8B, 0x7C, 0x32, 0xC5, 0xAE, 0x59, 0x17, 0xE0,
2861 +    0x2A, 0xDD, 0x93, 0x64, 0x0F, 0xF8, 0xB6, 0x41,
2862 +    0x60, 0x97, 0xD9, 0x2E, 0x45, 0xB2, 0xFC, 0x0B,
2863 +    0xBE, 0x49, 0x07, 0xF0, 0x9B, 0x6C, 0x22, 0xD5,
2864 +    0xF4, 0x03, 0x4D, 0xBA, 0xD1, 0x26, 0x68, 0x9F
2865 +};
2866 +
2867 +/*
2868 + * Search the name=value vars for a specific one and return its value.
2869 + * Returns NULL if not found.
2870 + */
2871 +char*
2872 +getvar(char *vars, char *name)
2873 +{
2874 +       char *s;
2875 +       int len;
2876 +
2877 +       len = strlen(name);
2878 +
2879 +       /* first look in vars[] */
2880 +       for (s = vars; s && *s; ) {
2881 +               if ((bcmp(s, name, len) == 0) && (s[len] == '='))
2882 +                       return (&s[len+1]);
2883 +
2884 +               while (*s++)
2885 +                       ;
2886 +       }
2887 +
2888 +       /* then query nvram */
2889 +       return (nvram_get(name));
2890 +}
2891 +
2892 +/*
2893 + * Search the vars for a specific one and return its value as
2894 + * an integer. Returns 0 if not found.
2895 + */
2896 +int
2897 +getintvar(char *vars, char *name)
2898 +{
2899 +       char *val;
2900 +
2901 +       if ((val = getvar(vars, name)) == NULL)
2902 +               return (0);
2903 +
2904 +       return (bcm_strtoul(val, NULL, 0));
2905 +}
2906 +
2907 +void
2908 +bcm_mdelay(uint ms)
2909 +{
2910 +       uint i;
2911 +
2912 +       for (i = 0; i < ms; i++) {
2913 +               OSL_DELAY(1000);
2914 +       }
2915 +}
2916 +
2917 +#define CRC_INNER_LOOP(n, c, x) \
2918 +    (c) = ((c) >> 8) ^ crc##n##_table[((c) ^ (x)) & 0xff]
2919 +
2920 +uint8
2921 +crc8(
2922 +       uint8 *pdata,   /* pointer to array of data to process */
2923 +       uint  nbytes,   /* number of input data bytes to process */
2924 +       uint8 crc       /* either CRC8_INIT_VALUE or previous return value */
2925 +)
2926 +{
2927 +       /* hard code the crc loop instead of using CRC_INNER_LOOP macro
2928 +        * to avoid the undefined and unnecessary (uint8 >> 8) operation. */
2929 +       while (nbytes-- > 0)
2930 +               crc = crc8_table[(crc ^ *pdata++) & 0xff];
2931 +
2932 +       return crc;
2933 +}
2934 +
2935 +/*******************************************************************************
2936 + * crc16
2937 + *
2938 + * Computes a crc16 over the input data using the polynomial:
2939 + *
2940 + *       x^16 + x^12 +x^5 + 1
2941 + *
2942 + * The caller provides the initial value (either CRC16_INIT_VALUE
2943 + * or the previous returned value) to allow for processing of 
2944 + * discontiguous blocks of data.  When generating the CRC the
2945 + * caller is responsible for complementing the final return value
2946 + * and inserting it into the byte stream.  When checking, a final
2947 + * return value of CRC16_GOOD_VALUE indicates a valid CRC.
2948 + *
2949 + * Reference: Dallas Semiconductor Application Note 27
2950 + *   Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", 
2951 + *     ver 3, Aug 1993, ross@guest.adelaide.edu.au, Rocksoft Pty Ltd.,
2952 + *     ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
2953 + *
2954 + ******************************************************************************/
2955 +
2956 +static uint16 crc16_table[256] = {
2957 +    0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
2958 +    0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7,
2959 +    0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E,
2960 +    0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876,
2961 +    0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD,
2962 +    0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5,
2963 +    0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C,
2964 +    0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974,
2965 +    0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB,
2966 +    0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3,
2967 +    0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A,
2968 +    0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72,
2969 +    0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9,
2970 +    0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1,
2971 +    0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738,
2972 +    0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70,
2973 +    0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7,
2974 +    0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF,
2975 +    0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036,
2976 +    0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E,
2977 +    0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5,
2978 +    0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD,
2979 +    0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134,
2980 +    0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C,
2981 +    0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3,
2982 +    0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB,
2983 +    0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232,
2984 +    0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A,
2985 +    0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1,
2986 +    0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9,
2987 +    0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330,
2988 +    0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78
2989 +};
2990 +
2991 +uint16
2992 +crc16(
2993 +    uint8 *pdata,  /* pointer to array of data to process */
2994 +    uint nbytes, /* number of input data bytes to process */
2995 +    uint16 crc     /* either CRC16_INIT_VALUE or previous return value */
2996 +)
2997 +{
2998 +    while (nbytes-- > 0)
2999 +        CRC_INNER_LOOP(16, crc, *pdata++);
3000 +    return crc;
3001 +}
3002 +
3003 +static uint32 crc32_table[256] = {
3004 +    0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
3005 +    0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
3006 +    0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
3007 +    0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
3008 +    0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
3009 +    0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
3010 +    0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
3011 +    0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
3012 +    0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
3013 +    0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
3014 +    0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
3015 +    0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
3016 +    0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
3017 +    0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
3018 +    0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
3019 +    0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
3020 +    0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
3021 +    0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
3022 +    0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
3023 +    0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
3024 +    0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
3025 +    0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
3026 +    0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
3027 +    0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
3028 +    0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
3029 +    0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
3030 +    0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
3031 +    0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
3032 +    0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
3033 +    0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
3034 +    0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
3035 +    0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
3036 +    0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
3037 +    0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
3038 +    0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
3039 +    0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
3040 +    0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
3041 +    0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
3042 +    0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
3043 +    0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
3044 +    0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
3045 +    0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
3046 +    0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
3047 +    0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
3048 +    0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
3049 +    0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
3050 +    0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
3051 +    0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
3052 +    0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
3053 +    0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
3054 +    0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
3055 +    0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
3056 +    0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
3057 +    0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
3058 +    0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
3059 +    0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
3060 +    0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
3061 +    0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
3062 +    0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
3063 +    0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
3064 +    0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
3065 +    0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
3066 +    0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
3067 +    0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
3068 +};
3069 +
3070 +uint32
3071 +crc32(
3072 +    uint8 *pdata,  /* pointer to array of data to process */
3073 +    uint   nbytes, /* number of input data bytes to process */
3074 +    uint32 crc     /* either CRC32_INIT_VALUE or previous return value */
3075 +)
3076 +{
3077 +    uint8 *pend;
3078 +#ifdef __mips__
3079 +    uint8 tmp[4];
3080 +    ulong *tptr = (ulong *)tmp;
3081 +
3082 +       /* in case the beginning of the buffer isn't aligned */
3083 +       pend = (uint8 *)((uint)(pdata + 3) & 0xfffffffc);
3084 +       nbytes -= (pend - pdata);
3085 +       while (pdata < pend)
3086 +               CRC_INNER_LOOP(32, crc, *pdata++);
3087 +
3088 +    /* handle bulk of data as 32-bit words */
3089 +    pend = pdata + (nbytes & 0xfffffffc);
3090 +    while (pdata < pend) {
3091 +       *tptr = *((ulong *)pdata)++;
3092 +        CRC_INNER_LOOP(32, crc, tmp[0]);
3093 +        CRC_INNER_LOOP(32, crc, tmp[1]);
3094 +        CRC_INNER_LOOP(32, crc, tmp[2]);
3095 +        CRC_INNER_LOOP(32, crc, tmp[3]);
3096 +    }
3097 +
3098 +    /* 1-3 bytes at end of buffer */
3099 +    pend = pdata + (nbytes & 0x03);
3100 +    while (pdata < pend)
3101 +        CRC_INNER_LOOP(32, crc, *pdata++);
3102 +#else
3103 +    pend = pdata + nbytes;
3104 +    while (pdata < pend)
3105 +        CRC_INNER_LOOP(32, crc, *pdata++);
3106 +#endif
3107 +       
3108 +    return crc;
3109 +}
3110 +
3111 +#ifdef notdef
3112 +#define CLEN   1499
3113 +#define CBUFSIZ        (CLEN+4)
3114 +#define CNBUFS         5
3115 +
3116 +void testcrc32(void)
3117 +{
3118 +       uint j,k,l;
3119 +       uint8 *buf;
3120 +       uint len[CNBUFS];
3121 +       uint32 crcr;
3122 +       uint32 crc32tv[CNBUFS] =
3123 +               {0xd2cb1faa, 0xd385c8fa, 0xf5b4f3f3, 0x55789e20, 0x00343110};
3124 +
3125 +       ASSERT((buf = MALLOC(CBUFSIZ*CNBUFS)) != NULL);
3126 +
3127 +       /* step through all possible alignments */
3128 +       for (l=0;l<=4;l++) {
3129 +               for (j=0; j<CNBUFS; j++) {
3130 +                       len[j] = CLEN;
3131 +                       for (k=0; k<len[j]; k++)
3132 +                               *(buf + j*CBUFSIZ + (k+l)) = (j+k) & 0xff;
3133 +               }
3134 +
3135 +               for (j=0; j<CNBUFS; j++) {
3136 +                       crcr = crc32(buf + j*CBUFSIZ + l, len[j], CRC32_INIT_VALUE);
3137 +                       ASSERT(crcr == crc32tv[j]);
3138 +               }
3139 +       }
3140 +
3141 +       MFREE(buf, CBUFSIZ*CNBUFS);
3142 +       return;
3143 +}
3144 +#endif
3145 +
3146 +
3147 +
3148 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/hnddma.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/hnddma.c
3149 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/hnddma.c 1970-01-01 01:00:00.000000000 +0100
3150 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/hnddma.c    2005-08-28 11:12:20.430859152 +0200
3151 @@ -0,0 +1,763 @@
3152 +/*
3153 + * Generic Broadcom Home Networking Division (HND) DMA module.
3154 + * This supports the following chips: BCM42xx, 44xx, 47xx .
3155 + *
3156 + * Copyright 2001-2003, Broadcom Corporation
3157 + * All Rights Reserved.
3158 + * 
3159 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
3160 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
3161 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
3162 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
3163 + *
3164 + * $Id: hnddma.c,v 1.1 2005/02/28 13:33:32 jolt Exp $
3165 + */
3166 +
3167 +#include <typedefs.h>
3168 +#include <osl.h>
3169 +#include <bcmendian.h>
3170 +#include <bcmutils.h>
3171 +
3172 +struct dma_info;       /* forward declaration */
3173 +#define di_t struct dma_info
3174 +#include <hnddma.h>
3175 +
3176 +/* debug/trace */
3177 +#define        DMA_ERROR(args)
3178 +#define        DMA_TRACE(args)
3179 +
3180 +/* default dma message level(if input msg_level pointer is null in dma_attach()) */
3181 +static uint dma_msg_level = 0;
3182 +
3183 +#define        MAXNAMEL        8
3184 +#define        MAXDD           (DMAMAXRINGSZ / sizeof (dmadd_t))
3185 +
3186 +/* dma engine software state */
3187 +typedef struct dma_info {
3188 +       hnddma_t        hnddma;         /* exported structure */
3189 +       uint            *msg_level;     /* message level pointer */
3190 +
3191 +       char            name[MAXNAMEL]; /* callers name for diag msgs */
3192 +       void            *drv;           /* driver handle */
3193 +       void            *dev;           /* device handle */
3194 +       dmaregs_t       *regs;          /* dma engine registers */
3195 +
3196 +       dmadd_t         *txd;           /* pointer to chip-specific tx descriptor ring */
3197 +       uint            txin;           /* index of next descriptor to reclaim */
3198 +       uint            txout;          /* index of next descriptor to post */
3199 +       uint            txavail;        /* # free tx descriptors */
3200 +       void            *txp[MAXDD];    /* parallel array of pointers to packets */
3201 +       ulong           txdpa;          /* physical address of descriptor ring */
3202 +       uint            txdalign;       /* #bytes added to alloc'd mem to align txd */
3203 +
3204 +       dmadd_t         *rxd;           /* pointer to chip-specific rx descriptor ring */
3205 +       uint            rxin;           /* index of next descriptor to reclaim */
3206 +       uint            rxout;          /* index of next descriptor to post */
3207 +       void            *rxp[MAXDD];    /* parallel array of pointers to packets */
3208 +       ulong           rxdpa;          /* physical address of descriptor ring */
3209 +       uint            rxdalign;       /* #bytes added to alloc'd mem to align rxd */
3210 +
3211 +       /* tunables */
3212 +       uint            ntxd;           /* # tx descriptors */
3213 +       uint            nrxd;           /* # rx descriptors */
3214 +       uint            rxbufsize;      /* rx buffer size in bytes */
3215 +       uint            nrxpost;        /* # rx buffers to keep posted */
3216 +       uint            rxoffset;       /* rxcontrol offset */
3217 +       uint            ddoffset;       /* add to get dma address of descriptor ring */
3218 +       uint            dataoffset;     /* add to get dma address of data buffer */
3219 +} dma_info_t;
3220 +
3221 +/* descriptor bumping macros */
3222 +#define        NEXTTXD(i)      ((i + 1) & (di->ntxd - 1))
3223 +#define        PREVTXD(i)      ((i - 1) & (di->ntxd - 1))
3224 +#define        NEXTRXD(i)      ((i + 1) & (di->nrxd - 1))
3225 +#define        NTXDACTIVE(h, t)        ((t - h) & (di->ntxd - 1))
3226 +#define        NRXDACTIVE(h, t)        ((t - h) & (di->nrxd - 1))
3227 +
3228 +/* macros to convert between byte offsets and indexes */
3229 +#define        B2I(bytes)      ((bytes) / sizeof (dmadd_t))
3230 +#define        I2B(index)      ((index) * sizeof (dmadd_t))
3231 +
3232 +void*
3233 +dma_attach(void *drv, void *dev, char *name, dmaregs_t *regs, uint ntxd, uint nrxd,
3234 +       uint rxbufsize, uint nrxpost, uint rxoffset, uint ddoffset, uint dataoffset, uint *msg_level)
3235 +{
3236 +       dma_info_t *di;
3237 +       void *va;
3238 +
3239 +       ASSERT(ntxd <= MAXDD);
3240 +       ASSERT(nrxd <= MAXDD);
3241 +
3242 +       /* allocate private info structure */
3243 +       if ((di = MALLOC(sizeof (dma_info_t))) == NULL)
3244 +               return (NULL);
3245 +       bzero((char*)di, sizeof (dma_info_t));
3246 +
3247 +       /* set message level */
3248 +       di->msg_level = msg_level ? msg_level : &dma_msg_level;
3249 +
3250 +       DMA_TRACE(("%s: dma_attach: drv 0x%x dev 0x%x regs 0x%x ntxd %d nrxd %d rxbufsize %d nrxpost %d rxoffset %d ddoffset 0x%x dataoffset 0x%x\n", name, (uint)drv, (uint)dev, (uint)regs, ntxd, nrxd, rxbufsize, nrxpost, rxoffset, ddoffset, dataoffset));
3251 +
3252 +       /* make a private copy of our callers name */
3253 +       strncpy(di->name, name, MAXNAMEL);
3254 +       di->name[MAXNAMEL-1] = '\0';
3255 +
3256 +       di->drv = drv;
3257 +       di->dev = dev;
3258 +       di->regs = regs;
3259 +
3260 +       /* allocate transmit descriptor ring */
3261 +       if (ntxd) {
3262 +               if ((va = DMA_ALLOC_CONSISTENT(dev, (DMAMAXRINGSZ + DMARINGALIGN), &di->txdpa)) == NULL)
3263 +                       goto fail;
3264 +               di->txd = (dmadd_t*) ROUNDUP(va, DMARINGALIGN);
3265 +               di->txdalign = ((uint)di->txd - (uint)va);
3266 +               di->txdpa = di->txdpa + di->txdalign;
3267 +               ASSERT(ISALIGNED(di->txd, DMARINGALIGN));
3268 +       }
3269 +
3270 +       /* allocate receive descriptor ring */
3271 +       if (nrxd) {
3272 +               if ((va = DMA_ALLOC_CONSISTENT(dev, (DMAMAXRINGSZ + DMARINGALIGN), &di->rxdpa)) == NULL)
3273 +                       goto fail;
3274 +               di->rxd = (dmadd_t*) ROUNDUP(va, DMARINGALIGN);
3275 +               di->rxdalign = ((uint)di->rxd - (uint)va);
3276 +               di->rxdpa = di->rxdpa + di->rxdalign;
3277 +               ASSERT(ISALIGNED(di->rxd, DMARINGALIGN));
3278 +       }
3279 +
3280 +       /* save tunables */
3281 +       di->ntxd = ntxd;
3282 +       di->nrxd = nrxd;
3283 +       di->rxbufsize = rxbufsize;
3284 +       di->nrxpost = nrxpost;
3285 +       di->rxoffset = rxoffset;
3286 +       di->ddoffset = ddoffset;
3287 +       di->dataoffset = dataoffset;
3288 +
3289 +       return ((void*)di);
3290 +
3291 +fail:
3292 +       dma_detach((void*)di);
3293 +       return (NULL);
3294 +}
3295 +
3296 +/* may be called with core in reset */
3297 +void
3298 +dma_detach(dma_info_t *di)
3299 +{
3300 +       if (di == NULL)
3301 +               return;
3302 +
3303 +       DMA_TRACE(("%s: dma_detach\n", di->name));
3304 +
3305 +       /* shouldn't be here if descriptors are unreclaimed */
3306 +       ASSERT(di->txin == di->txout);
3307 +       ASSERT(di->rxin == di->rxout);
3308 +
3309 +       /* free dma descriptor rings */
3310 +       if (di->txd)
3311 +               DMA_FREE_CONSISTENT(di->dev, (void *)((uint)di->txd - di->txdalign), (DMAMAXRINGSZ + DMARINGALIGN), di->txdpa);
3312 +       if (di->rxd)
3313 +               DMA_FREE_CONSISTENT(di->dev, (void *)((uint)di->rxd - di->rxdalign), (DMAMAXRINGSZ + DMARINGALIGN), di->rxdpa);
3314 +
3315 +       /* free our private info structure */
3316 +       MFREE((void*)di, sizeof (dma_info_t));
3317 +}
3318 +
3319 +
3320 +void
3321 +dma_txreset(dma_info_t *di)
3322 +{
3323 +       uint32 status;
3324 +
3325 +       DMA_TRACE(("%s: dma_txreset\n", di->name));
3326 +
3327 +       /* suspend tx DMA first */
3328 +       W_REG(&di->regs->xmtcontrol, XC_SE);
3329 +       SPINWAIT((status = (R_REG(&di->regs->xmtstatus) & XS_XS_MASK)) != XS_XS_DISABLED &&
3330 +                status != XS_XS_IDLE &&
3331 +                status != XS_XS_STOPPED,
3332 +                10000);
3333 +
3334 +       W_REG(&di->regs->xmtcontrol, 0);
3335 +       SPINWAIT((status = (R_REG(&di->regs->xmtstatus) & XS_XS_MASK)) != XS_XS_DISABLED,
3336 +                10000);
3337 +
3338 +       if (status != XS_XS_DISABLED) {
3339 +               DMA_ERROR(("%s: dma_txreset: dma cannot be stopped\n", di->name));
3340 +       }
3341 +
3342 +       /* wait for the last transaction to complete */
3343 +       OSL_DELAY(300);
3344 +}
3345 +
3346 +void
3347 +dma_rxreset(dma_info_t *di)
3348 +{
3349 +       uint32 status;
3350 +
3351 +       DMA_TRACE(("%s: dma_rxreset\n", di->name));
3352 +
3353 +       W_REG(&di->regs->rcvcontrol, 0);
3354 +       SPINWAIT((status = (R_REG(&di->regs->rcvstatus) & RS_RS_MASK)) != RS_RS_DISABLED,
3355 +                10000);
3356 +
3357 +       if (status != RS_RS_DISABLED) {
3358 +               DMA_ERROR(("%s: dma_rxreset: dma cannot be stopped\n", di->name));
3359 +       }
3360 +}
3361 +
3362 +void
3363 +dma_txinit(dma_info_t *di)
3364 +{
3365 +       DMA_TRACE(("%s: dma_txinit\n", di->name));
3366 +
3367 +       di->txin = di->txout = 0;
3368 +       di->txavail = di->ntxd - 1;
3369 +
3370 +       /* clear tx descriptor ring */
3371 +       BZERO_SM((void*)di->txd, (di->ntxd * sizeof (dmadd_t)));
3372 +
3373 +       W_REG(&di->regs->xmtcontrol, XC_XE);
3374 +       W_REG(&di->regs->xmtaddr, (di->txdpa + di->ddoffset));
3375 +}
3376 +
3377 +bool
3378 +dma_txenabled(dma_info_t *di)
3379 +{
3380 +       uint32 xc;
3381 +
3382 +       /* If the chip is dead, it is not enabled :-) */
3383 +       xc = R_REG(&di->regs->xmtcontrol);
3384 +       return ((xc != 0xffffffff) && (xc & XC_XE));
3385 +}
3386 +
3387 +void
3388 +dma_txsuspend(dma_info_t *di)
3389 +{
3390 +       DMA_TRACE(("%s: dma_txsuspend\n", di->name));
3391 +       OR_REG(&di->regs->xmtcontrol, XC_SE);
3392 +}
3393 +
3394 +void
3395 +dma_txresume(dma_info_t *di)
3396 +{
3397 +       DMA_TRACE(("%s: dma_txresume\n", di->name));
3398 +       AND_REG(&di->regs->xmtcontrol, ~XC_SE);
3399 +}
3400 +
3401 +bool
3402 +dma_txsuspended(dma_info_t *di)
3403 +{
3404 +       uint32 xc;
3405 +       uint32 xs;
3406 +
3407 +       xc = R_REG(&di->regs->xmtcontrol);
3408 +       if (xc & XC_SE) {
3409 +               xs = R_REG(&di->regs->xmtstatus);
3410 +               return ((xs & XS_XS_MASK) == XS_XS_IDLE);
3411 +       }
3412 +       return 0;
3413 +}
3414 +
3415 +bool
3416 +dma_txstopped(dma_info_t *di)
3417 +{
3418 +       return ((R_REG(&di->regs->xmtstatus) & XS_XS_MASK) == XS_XS_STOPPED);
3419 +}
3420 +
3421 +bool
3422 +dma_rxstopped(dma_info_t *di)
3423 +{
3424 +       return ((R_REG(&di->regs->rcvstatus) & RS_RS_MASK) == RS_RS_STOPPED);
3425 +}
3426 +
3427 +void
3428 +dma_fifoloopbackenable(dma_info_t *di)
3429 +{
3430 +       DMA_TRACE(("%s: dma_fifoloopbackenable\n", di->name));
3431 +       OR_REG(&di->regs->xmtcontrol, XC_LE);
3432 +}
3433 +
3434 +void
3435 +dma_rxinit(dma_info_t *di)
3436 +{
3437 +       DMA_TRACE(("%s: dma_rxinit\n", di->name));
3438 +
3439 +       di->rxin = di->rxout = 0;
3440 +
3441 +       /* clear rx descriptor ring */
3442 +       BZERO_SM((void*)di->rxd, (di->nrxd * sizeof (dmadd_t)));
3443 +
3444 +       dma_rxenable(di);
3445 +       W_REG(&di->regs->rcvaddr, (di->rxdpa + di->ddoffset));
3446 +}
3447 +
3448 +void
3449 +dma_rxenable(dma_info_t *di)
3450 +{
3451 +       DMA_TRACE(("%s: dma_rxenable\n", di->name));
3452 +       W_REG(&di->regs->rcvcontrol, ((di->rxoffset << RC_RO_SHIFT) | RC_RE));
3453 +}
3454 +
3455 +bool
3456 +dma_rxenabled(dma_info_t *di)
3457 +{
3458 +       uint32 rc;
3459 +
3460 +       rc = R_REG(&di->regs->rcvcontrol);
3461 +       return ((rc != 0xffffffff) && (rc & RC_RE));
3462 +}
3463 +
3464 +/*
3465 + * The BCM47XX family supports full 32bit dma engine buffer addressing so
3466 + * dma buffers can cross 4 Kbyte page boundaries.
3467 + */
3468 +int
3469 +dma_txfast(dma_info_t *di, void *p0, uint32 coreflags)
3470 +{
3471 +       void *p, *next;
3472 +       uchar *data;
3473 +       uint len;
3474 +       uint txout;
3475 +       uint32 ctrl;
3476 +       uint32 pa;
3477 +
3478 +       DMA_TRACE(("%s: dma_txfast\n", di->name));
3479 +
3480 +       txout = di->txout;
3481 +       ctrl = 0;
3482 +
3483 +       /*
3484 +        * Walk the chain of packet buffers
3485 +        * allocating and initializing transmit descriptor entries.
3486 +        */
3487 +       for (p = p0; p; p = next) {
3488 +               data = PKTDATA(di->drv, p);
3489 +               len = PKTLEN(di->drv, p);
3490 +               next = PKTNEXT(di->drv, p);
3491 +
3492 +               /* return nonzero if out of tx descriptors */
3493 +               if (NEXTTXD(txout) == di->txin)
3494 +                       goto outoftxd;
3495 +
3496 +               if (len == 0)
3497 +                       continue;
3498 +
3499 +               /* get physical address of buffer start */
3500 +               pa = (uint32) DMA_MAP(di->dev, data, len, DMA_TX, p);
3501 +
3502 +               /* build the descriptor control value */
3503 +               ctrl = len & CTRL_BC_MASK;
3504 +
3505 +               ctrl |= coreflags;
3506 +               
3507 +               if (p == p0)
3508 +                       ctrl |= CTRL_SOF;
3509 +               if (next == NULL)
3510 +                       ctrl |= (CTRL_IOC | CTRL_EOF);
3511 +               if (txout == (di->ntxd - 1))
3512 +                       ctrl |= CTRL_EOT;
3513 +
3514 +               /* init the tx descriptor */
3515 +               W_SM(&di->txd[txout].ctrl, BUS_SWAP32(ctrl));
3516 +               W_SM(&di->txd[txout].addr, BUS_SWAP32(pa + di->dataoffset));
3517 +
3518 +               ASSERT(di->txp[txout] == NULL);
3519 +
3520 +               txout = NEXTTXD(txout);
3521 +       }
3522 +
3523 +       /* if last txd eof not set, fix it */
3524 +       if (!(ctrl & CTRL_EOF))
3525 +               W_SM(&di->txd[PREVTXD(txout)].ctrl, BUS_SWAP32(ctrl | CTRL_IOC | CTRL_EOF));
3526 +
3527 +       /* save the packet */
3528 +       di->txp[PREVTXD(txout)] = p0;
3529 +
3530 +       /* bump the tx descriptor index */
3531 +       di->txout = txout;
3532 +
3533 +       /* kick the chip */
3534 +       W_REG(&di->regs->xmtptr, I2B(txout));
3535 +
3536 +       /* tx flow control */
3537 +       di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
3538 +
3539 +       return (0);
3540 +
3541 +outoftxd:
3542 +       DMA_ERROR(("%s: dma_txfast: out of txds\n", di->name));
3543 +       PKTFREE(di->drv, p0, TRUE);
3544 +       di->txavail = 0;
3545 +       di->hnddma.txnobuf++;
3546 +       return (-1);
3547 +}
3548 +
3549 +#define        PAGESZ          4096
3550 +#define        PAGEBASE(x)     ((uint)(x) & ~4095)
3551 +
3552 +/*
3553 + * Just like above except go through the extra effort of splitting
3554 + * buffers that cross 4Kbyte boundaries into multiple tx descriptors.
3555 + */
3556 +int
3557 +dma_tx(dma_info_t *di, void *p0, uint32 coreflags)
3558 +{
3559 +       void *p, *next;
3560 +       uchar *data;
3561 +       uint plen, len;
3562 +       uchar *page, *start, *end;
3563 +       uint txout;
3564 +       uint32 ctrl;
3565 +       uint32 pa;
3566 +
3567 +       DMA_TRACE(("%s: dma_tx\n", di->name));
3568 +
3569 +       txout = di->txout;
3570 +       ctrl = 0;
3571 +
3572 +       /*
3573 +        * Walk the chain of packet buffers
3574 +        * splitting those that cross 4 Kbyte boundaries
3575 +        * allocating and initializing transmit descriptor entries.
3576 +        */
3577 +       for (p = p0; p; p = next) {
3578 +               data = PKTDATA(di->drv, p);
3579 +               plen = PKTLEN(di->drv, p);
3580 +               next = PKTNEXT(di->drv, p);
3581 +
3582 +               if (plen == 0)
3583 +                       continue;
3584 +
3585 +               for (page = (uchar*)PAGEBASE(data);
3586 +                       page <= (uchar*)PAGEBASE(data + plen - 1);
3587 +                       page += PAGESZ) {
3588 +
3589 +                       /* return nonzero if out of tx descriptors */
3590 +                       if (NEXTTXD(txout) == di->txin)
3591 +                               goto outoftxd;
3592 +
3593 +                       start = (page == (uchar*)PAGEBASE(data))?  data: page;
3594 +                       end = (page == (uchar*)PAGEBASE(data + plen))?
3595 +                               (data + plen): (page + PAGESZ);
3596 +                       len = end - start;
3597 +
3598 +                       /* build the descriptor control value */
3599 +                       ctrl = len & CTRL_BC_MASK;
3600 +
3601 +                       ctrl |= coreflags;
3602 +
3603 +                       if ((p == p0) && (start == data))
3604 +                               ctrl |= CTRL_SOF;
3605 +                       if ((next == NULL) && (end == (data + plen)))
3606 +                               ctrl |= (CTRL_IOC | CTRL_EOF);
3607 +                       if (txout == (di->ntxd - 1))
3608 +                               ctrl |= CTRL_EOT;
3609 +
3610 +                       /* get physical address of buffer start */
3611 +                       pa = (uint32) DMA_MAP(di->dev, start, len, DMA_TX, p);
3612 +
3613 +                       /* init the tx descriptor */
3614 +                       W_SM(&di->txd[txout].ctrl, BUS_SWAP32(ctrl));
3615 +                       W_SM(&di->txd[txout].addr, BUS_SWAP32(pa + di->dataoffset));
3616 +
3617 +                       ASSERT(di->txp[txout] == NULL);
3618 +
3619 +                       txout = NEXTTXD(txout);
3620 +               }
3621 +       }
3622 +
3623 +       /* if last txd eof not set, fix it */
3624 +       if (!(ctrl & CTRL_EOF))
3625 +               W_SM(&di->txd[PREVTXD(txout)].ctrl, BUS_SWAP32(ctrl | CTRL_IOC | CTRL_EOF));
3626 +
3627 +       /* save the packet */
3628 +       di->txp[PREVTXD(txout)] = p0;
3629 +
3630 +       /* bump the tx descriptor index */
3631 +       di->txout = txout;
3632 +
3633 +       /* kick the chip */
3634 +       W_REG(&di->regs->xmtptr, I2B(txout));
3635 +
3636 +       /* tx flow control */
3637 +       di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
3638 +
3639 +       return (0);
3640 +
3641 +outoftxd:
3642 +       DMA_ERROR(("%s: dma_tx: out of txds\n", di->name));
3643 +       PKTFREE(di->drv, p0, TRUE);
3644 +       di->txavail = 0;
3645 +       di->hnddma.txnobuf++;
3646 +       return (-1);
3647 +}
3648 +
3649 +/* returns a pointer to the next frame received, or NULL if there are no more */
3650 +void*
3651 +dma_rx(dma_info_t *di)
3652 +{
3653 +       void *p;
3654 +       uint len;
3655 +       int skiplen = 0;
3656 +
3657 +       while ((p = dma_getnextrxp(di, FALSE))) {
3658 +               /* skip giant packets which span multiple rx descriptors */
3659 +               if (skiplen > 0) {
3660 +                       skiplen -= di->rxbufsize;
3661 +                       if (skiplen < 0)
3662 +                               skiplen = 0;
3663 +                       PKTFREE(di->drv, p, FALSE);
3664 +                       continue;
3665 +               }
3666 +
3667 +               len = ltoh16(*(uint16*)(PKTDATA(di->drv, p)));
3668 +               DMA_TRACE(("%s: dma_rx len %d\n", di->name, len));
3669 +
3670 +               /* bad frame length check */
3671 +               if (len > (di->rxbufsize - di->rxoffset)) {
3672 +                       DMA_ERROR(("%s: dma_rx: bad frame length (%d)\n", di->name, len));
3673 +                       if (len > 0)
3674 +                               skiplen = len - (di->rxbufsize - di->rxoffset);
3675 +                       PKTFREE(di->drv, p, FALSE);
3676 +                       di->hnddma.rxgiants++;
3677 +                       continue;
3678 +               }
3679 +
3680 +               /* set actual length */
3681 +               PKTSETLEN(di->drv, p, (di->rxoffset + len));
3682 +
3683 +               break;
3684 +       }
3685 +
3686 +       return (p);
3687 +}
3688 +
3689 +/* post receive buffers */
3690 +void
3691 +dma_rxfill(dma_info_t *di)
3692 +{
3693 +       void *p;
3694 +       uint rxin, rxout;
3695 +       uint ctrl;
3696 +       uint n;
3697 +       uint i;
3698 +       uint32 pa;
3699 +       uint rxbufsize;
3700 +
3701 +       /*
3702 +        * Determine how many receive buffers we're lacking
3703 +        * from the full complement, allocate, initialize,
3704 +        * and post them, then update the chip rx lastdscr.
3705 +        */
3706 +
3707 +       rxin = di->rxin;
3708 +       rxout = di->rxout;
3709 +       rxbufsize = di->rxbufsize;
3710 +
3711 +       n = di->nrxpost - NRXDACTIVE(rxin, rxout);
3712 +
3713 +       DMA_TRACE(("%s: dma_rxfill: post %d\n", di->name, n));
3714 +
3715 +       for (i = 0; i < n; i++) {
3716 +               if ((p = PKTGET(di->drv, rxbufsize, FALSE)) == NULL) {
3717 +                       DMA_ERROR(("%s: dma_rxfill: out of rxbufs\n", di->name));
3718 +                       di->hnddma.rxnobuf++;
3719 +                       break;
3720 +               }
3721 +
3722 +               *(uint32*)(OSL_UNCACHED(PKTDATA(di->drv, p))) = 0;
3723 +
3724 +               pa = (uint32) DMA_MAP(di->dev, PKTDATA(di->drv, p), rxbufsize, DMA_RX, p);
3725 +               ASSERT(ISALIGNED(pa, 4));
3726 +
3727 +               /* save the free packet pointer */
3728 +               ASSERT(di->rxp[rxout] == NULL);
3729 +               di->rxp[rxout] = p;
3730 +
3731 +               /* prep the descriptor control value */
3732 +               ctrl = rxbufsize;
3733 +               if (rxout == (di->nrxd - 1))
3734 +                       ctrl |= CTRL_EOT;
3735 +
3736 +               /* init the rx descriptor */
3737 +               W_SM(&di->rxd[rxout].ctrl, BUS_SWAP32(ctrl));
3738 +               W_SM(&di->rxd[rxout].addr, BUS_SWAP32(pa + di->dataoffset));
3739 +
3740 +               rxout = NEXTRXD(rxout);
3741 +       }
3742 +
3743 +       di->rxout = rxout;
3744 +
3745 +       /* update the chip lastdscr pointer */
3746 +       W_REG(&di->regs->rcvptr, I2B(rxout));
3747 +}
3748 +
3749 +void
3750 +dma_txreclaim(dma_info_t *di, bool forceall)
3751 +{
3752 +       void *p;
3753 +
3754 +       DMA_TRACE(("%s: dma_txreclaim %s\n", di->name, forceall ? "all" : ""));
3755 +
3756 +       while ((p = dma_getnexttxp(di, forceall)))
3757 +               PKTFREE(di->drv, p, TRUE);
3758 +}
3759 +
3760 +/*
3761 + * Reclaim next completed txd (txds if using chained buffers) and
3762 + * return associated packet.
3763 + * If 'force' is true, reclaim txd(s) and return associated packet
3764 + * regardless of the value of the hardware "curr" pointer.
3765 + */
3766 +void*
3767 +dma_getnexttxp(dma_info_t *di, bool forceall)
3768 +{
3769 +       uint start, end, i;
3770 +       void *txp;
3771 +
3772 +       DMA_TRACE(("%s: dma_getnexttxp %s\n", di->name, forceall ? "all" : ""));
3773 +
3774 +       txp = NULL;
3775 +
3776 +       start = di->txin;
3777 +       if (forceall)
3778 +               end = di->txout;
3779 +       else
3780 +               end = B2I(R_REG(&di->regs->xmtstatus) & XS_CD_MASK);
3781 +
3782 +       if ((start == 0) && (end > di->txout))
3783 +               goto bogus;
3784 +
3785 +       for (i = start; i != end && !txp; i = NEXTTXD(i)) {
3786 +               DMA_UNMAP(di->dev, (BUS_SWAP32(R_SM(&di->txd[i].addr)) - di->dataoffset),
3787 +                         (BUS_SWAP32(R_SM(&di->txd[i].ctrl)) & CTRL_BC_MASK), DMA_TX, di->txp[i]);
3788 +               W_SM(&di->txd[i].addr, 0xdeadbeef);
3789 +               txp = di->txp[i];
3790 +               di->txp[i] = NULL;
3791 +       }
3792 +
3793 +       di->txin = i;
3794 +
3795 +       /* tx flow control */
3796 +       di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
3797 +
3798 +       return (txp);
3799 +
3800 +bogus:
3801 +/*
3802 +       DMA_ERROR(("dma_getnexttxp: bogus curr: start %d end %d txout %d force %d\n",
3803 +               start, end, di->txout, forceall));
3804 +*/
3805 +       return (NULL);
3806 +}
3807 +
3808 +void
3809 +dma_rxreclaim(dma_info_t *di)
3810 +{
3811 +       void *p;
3812 +
3813 +       DMA_TRACE(("%s: dma_rxreclaim\n", di->name));
3814 +
3815 +       while ((p = dma_getnextrxp(di, TRUE)))
3816 +               PKTFREE(di->drv, p, FALSE);
3817 +}
3818 +
3819 +void *
3820 +dma_getnextrxp(dma_info_t *di, bool forceall)
3821 +{
3822 +       uint i;
3823 +       void *rxp;
3824 +
3825 +       /* if forcing, dma engine must be disabled */
3826 +       ASSERT(!forceall || !dma_rxenabled(di));
3827 +
3828 +       i = di->rxin;
3829 +
3830 +       /* return if no packets posted */
3831 +       if (i == di->rxout)
3832 +               return (NULL);
3833 +
3834 +       /* ignore curr if forceall */
3835 +       if (!forceall && (i == B2I(R_REG(&di->regs->rcvstatus) & RS_CD_MASK)))
3836 +               return (NULL);
3837 +
3838 +       /* get the packet pointer that corresponds to the rx descriptor */
3839 +       rxp = di->rxp[i];
3840 +       ASSERT(rxp);
3841 +       di->rxp[i] = NULL;
3842 +
3843 +       /* clear this packet from the descriptor ring */
3844 +       DMA_UNMAP(di->dev, (BUS_SWAP32(R_SM(&di->rxd[i].addr)) - di->dataoffset),
3845 +                 di->rxbufsize, DMA_RX, rxp);
3846 +       W_SM(&di->rxd[i].addr, 0xdeadbeef);
3847 +
3848 +       di->rxin = NEXTRXD(i);
3849 +
3850 +       return (rxp);
3851 +}
3852 +
3853 +char*
3854 +dma_dumptx(dma_info_t *di, char *buf)
3855 +{
3856 +       buf += sprintf(buf, "txd 0x%lx txdpa 0x%lx txp 0x%lx txin %d txout %d txavail %d\n",
3857 +               (ulong)di->txd, di->txdpa, (ulong)di->txp, di->txin, di->txout, di->txavail);
3858 +       buf += sprintf(buf, "xmtcontrol 0x%x xmtaddr 0x%x xmtptr 0x%x xmtstatus 0x%x\n",
3859 +               R_REG(&di->regs->xmtcontrol),
3860 +               R_REG(&di->regs->xmtaddr),
3861 +               R_REG(&di->regs->xmtptr),
3862 +               R_REG(&di->regs->xmtstatus));
3863 +       return (buf);
3864 +}
3865 +
3866 +char*
3867 +dma_dumprx(dma_info_t *di, char *buf)
3868 +{
3869 +       buf += sprintf(buf, "rxd 0x%lx rxdpa 0x%lx rxp 0x%lx rxin %d rxout %d\n",
3870 +               (ulong)di->rxd, di->rxdpa, (ulong)di->rxp, di->rxin, di->rxout);
3871 +       buf += sprintf(buf, "rcvcontrol 0x%x rcvaddr 0x%x rcvptr 0x%x rcvstatus 0x%x\n",
3872 +               R_REG(&di->regs->rcvcontrol),
3873 +               R_REG(&di->regs->rcvaddr),
3874 +               R_REG(&di->regs->rcvptr),
3875 +               R_REG(&di->regs->rcvstatus));
3876 +       return (buf);
3877 +}
3878 +
3879 +char*
3880 +dma_dump(dma_info_t *di, char *buf)
3881 +{
3882 +       buf = dma_dumptx(di, buf);
3883 +       buf = dma_dumprx(di, buf);
3884 +       return (buf);
3885 +}
3886 +
3887 +uint
3888 +dma_getvar(dma_info_t *di, char *name)
3889 +{
3890 +       if (!strcmp(name, "&txavail"))
3891 +               return ((uint) &di->txavail);
3892 +       else {
3893 +               ASSERT(0);
3894 +       }
3895 +       return (0);
3896 +}
3897 +
3898 +void
3899 +dma_txblock(dma_info_t *di)
3900 +{
3901 +       di->txavail = 0;
3902 +}
3903 +
3904 +void
3905 +dma_txunblock(dma_info_t *di)
3906 +{
3907 +       di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
3908 +}
3909 +
3910 +uint
3911 +dma_txactive(dma_info_t *di)
3912 +{
3913 +       return (NTXDACTIVE(di->txin, di->txout));
3914 +}
3915 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/linux_osl.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/linux_osl.c
3916 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/linux_osl.c      1970-01-01 01:00:00.000000000 +0100
3917 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/linux_osl.c 2005-08-28 11:12:20.476852160 +0200
3918 @@ -0,0 +1,420 @@
3919 +/*
3920 + * Linux OS Independent Layer
3921 + *
3922 + * Copyright 2001-2003, Broadcom Corporation
3923 + * All Rights Reserved.
3924 + * 
3925 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
3926 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
3927 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
3928 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
3929 + *
3930 + * $Id: linux_osl.c,v 1.2 2005/02/28 13:34:25 jolt Exp $
3931 + */
3932 +
3933 +#define LINUX_OSL
3934 +
3935 +#include <typedefs.h>
3936 +#include <bcmendian.h>
3937 +#include <linuxver.h>
3938 +#include <linux_osl.h>
3939 +#include <bcmutils.h>
3940 +#include <linux/delay.h>
3941 +#ifdef mips
3942 +#include <asm/paccess.h>
3943 +#endif
3944 +#include <pcicfg.h>
3945 +
3946 +#define PCI_CFG_RETRY 10       
3947 +
3948 +void*
3949 +osl_pktget(void *drv, uint len, bool send)
3950 +{
3951 +       struct sk_buff *skb;
3952 +
3953 +       if ((skb = dev_alloc_skb(len)) == NULL)
3954 +               return (NULL);
3955 +
3956 +       skb_put(skb, len);
3957 +
3958 +       /* ensure the cookie field is cleared */ 
3959 +       PKTSETCOOKIE(skb, NULL);
3960 +
3961 +       return ((void*) skb);
3962 +}
3963 +
3964 +void
3965 +osl_pktfree(void *p)
3966 +{
3967 +       struct sk_buff *skb, *nskb;
3968 +
3969 +       skb = (struct sk_buff*) p;
3970 +
3971 +       /* perversion: we use skb->next to chain multi-skb packets */
3972 +       while (skb) {
3973 +               nskb = skb->next;
3974 +               skb->next = NULL;
3975 +               if (skb->destructor) {
3976 +                       /* cannot kfree_skb() on hard IRQ (net/core/skbuff.c) if destructor exists */
3977 +                       dev_kfree_skb_any(skb);
3978 +               } else {
3979 +                       /* can free immediately (even in_irq()) if destructor does not exist */
3980 +                       dev_kfree_skb(skb);
3981 +               }
3982 +               skb = nskb;
3983 +       }
3984 +}
3985 +
3986 +uint32
3987 +osl_pci_read_config(void *loc, uint offset, uint size)
3988 +{
3989 +       struct pci_dev *pdev;
3990 +       uint val;
3991 +       uint retry=PCI_CFG_RETRY;        
3992 +
3993 +       /* only 4byte access supported */
3994 +       ASSERT(size == 4);
3995 +
3996 +       pdev = (struct pci_dev*)loc;
3997 +       do {
3998 +               pci_read_config_dword(pdev, offset, &val);
3999 +               if (val != 0xffffffff)
4000 +                       break;
4001 +       } while (retry--);
4002 +
4003 +
4004 +       return (val);
4005 +}
4006 +
4007 +void
4008 +osl_pci_write_config(void *loc, uint offset, uint size, uint val)
4009 +{
4010 +       struct pci_dev *pdev;
4011 +       uint retry=PCI_CFG_RETRY;        
4012 +
4013 +       /* only 4byte access supported */
4014 +       ASSERT(size == 4);
4015 +
4016 +       pdev = (struct pci_dev*)loc;
4017 +
4018 +       do {
4019 +               pci_write_config_dword(pdev, offset, val);
4020 +               if (offset!=PCI_BAR0_WIN)
4021 +                       break;
4022 +               if (osl_pci_read_config(loc,offset,size) == val) 
4023 +                       break;
4024 +       } while (retry--);
4025 +
4026 +}
4027 +
4028 +void
4029 +osl_pcmcia_read_attr(void *osh, uint offset, void *buf, int size)
4030 +{
4031 +       ASSERT(0);
4032 +}
4033 +
4034 +void
4035 +osl_pcmcia_write_attr(void *osh, uint offset, void *buf, int size)
4036 +{
4037 +       ASSERT(0);
4038 +}
4039 +
4040 +void
4041 +osl_assert(char *exp, char *file, int line)
4042 +{
4043 +       char tempbuf[255];
4044 +
4045 +       sprintf(tempbuf, "assertion \"%s\" failed: file \"%s\", line %d\n", exp, file, line);
4046 +       panic(tempbuf);
4047 +}
4048 +
4049 +/*
4050 + * BINOSL selects the slightly slower function-call-based binary compatible osl.
4051 + */
4052 +#ifdef BINOSL
4053 +
4054 +int
4055 +osl_printf(const char *format, ...)
4056 +{
4057 +       va_list args;
4058 +       char buf[1024];
4059 +       int len;
4060 +
4061 +       /* sprintf into a local buffer because there *is* no "vprintk()".. */
4062 +       va_start(args, format);
4063 +       len = vsprintf(buf, format, args);
4064 +       va_end(args);
4065 +
4066 +       if (len > sizeof (buf)) {
4067 +               printk("osl_printf: buffer overrun\n");
4068 +               return (0);
4069 +       }
4070 +
4071 +       return (printk(buf));
4072 +}
4073 +
4074 +int
4075 +osl_sprintf(char *buf, const char *format, ...)
4076 +{
4077 +       va_list args;
4078 +       int rc;
4079 +
4080 +       va_start(args, format);
4081 +       rc = vsprintf(buf, format, args);
4082 +       va_end(args);
4083 +       return (rc);
4084 +}
4085 +
4086 +int
4087 +osl_strcmp(const char *s1, const char *s2)
4088 +{
4089 +       return (strcmp(s1, s2));
4090 +}
4091 +
4092 +int
4093 +osl_strncmp(const char *s1, const char *s2, uint n)
4094 +{
4095 +       return (strncmp(s1, s2, n));
4096 +}
4097 +
4098 +int
4099 +osl_strlen(char *s)
4100 +{
4101 +       return (strlen(s));
4102 +}
4103 +
4104 +char*
4105 +osl_strcpy(char *d, const char *s)
4106 +{
4107 +       return (strcpy(d, s));
4108 +}
4109 +
4110 +char*
4111 +osl_strncpy(char *d, const char *s, uint n)
4112 +{
4113 +       return (strncpy(d, s, n));
4114 +}
4115 +
4116 +void
4117 +bcopy(const void *src, void *dst, int len)
4118 +{
4119 +       memcpy(dst, src, len);
4120 +}
4121 +
4122 +int
4123 +bcmp(const void *b1, const void *b2, int len)
4124 +{
4125 +       return (memcmp(b1, b2, len));
4126 +}
4127 +
4128 +void
4129 +bzero(void *b, int len)
4130 +{
4131 +       memset(b, '\0', len);
4132 +}
4133 +
4134 +void*
4135 +osl_malloc(uint size)
4136 +{
4137 +       return (kmalloc(size, GFP_ATOMIC));
4138 +}
4139 +
4140 +void
4141 +osl_mfree(void *addr, uint size)
4142 +{
4143 +       kfree(addr);
4144 +}
4145 +
4146 +uint32
4147 +osl_readl(volatile uint32 *r)
4148 +{
4149 +       return (readl(r));
4150 +}
4151 +
4152 +uint16
4153 +osl_readw(volatile uint16 *r)
4154 +{
4155 +       return (readw(r));
4156 +}
4157 +
4158 +uint8
4159 +osl_readb(volatile uint8 *r)
4160 +{
4161 +       return (readb(r));
4162 +}
4163 +
4164 +void
4165 +osl_writel(uint32 v, volatile uint32 *r)
4166 +{
4167 +       writel(v, r);
4168 +}
4169 +
4170 +void
4171 +osl_writew(uint16 v, volatile uint16 *r)
4172 +{
4173 +       writew(v, r);
4174 +}
4175 +
4176 +void
4177 +osl_writeb(uint8 v, volatile uint8 *r)
4178 +{
4179 +       writeb(v, r);
4180 +}
4181 +
4182 +void *
4183 +osl_uncached(void *va)
4184 +{
4185 +#ifdef mips
4186 +       return ((void*)KSEG1ADDR(va));
4187 +#else
4188 +       return ((void*)va);
4189 +#endif
4190 +}
4191 +
4192 +uint
4193 +osl_getcycles(void)
4194 +{
4195 +       uint cycles;
4196 +
4197 +#if defined(mips)
4198 +       cycles = read_c0_count() * 2;
4199 +#elif defined(__i386__)
4200 +       rdtscl(cycles);
4201 +#else
4202 +       cycles = 0;
4203 +#endif
4204 +       return cycles;
4205 +}
4206 +
4207 +void *
4208 +osl_reg_map(uint32 pa, uint size)
4209 +{
4210 +       return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
4211 +}
4212 +
4213 +void
4214 +osl_reg_unmap(void *va)
4215 +{
4216 +       iounmap(va);
4217 +}
4218 +
4219 +int
4220 +osl_busprobe(uint32 *val, uint32 addr)
4221 +{
4222 +#ifdef mips
4223 +       return get_dbe(*val, (uint32*)addr);
4224 +#else
4225 +       *val = readl(addr);
4226 +       return 0;
4227 +#endif
4228 +}
4229 +
4230 +void*
4231 +osl_dma_alloc_consistent(void *dev, uint size, ulong *pap)
4232 +{
4233 +       return (pci_alloc_consistent((struct pci_dev*)dev, size, (dma_addr_t*)pap));
4234 +}
4235 +
4236 +void
4237 +osl_dma_free_consistent(void *dev, void *va, uint size, ulong pa)
4238 +{
4239 +       pci_free_consistent((struct pci_dev*)dev, size, va, (dma_addr_t)pa);
4240 +}
4241 +
4242 +uint
4243 +osl_dma_map(void *dev, void *va, uint size, int direction)
4244 +{
4245 +       int dir;
4246 +
4247 +       dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
4248 +       return (pci_map_single(dev, va, size, dir));
4249 +}
4250 +
4251 +void
4252 +osl_dma_unmap(void *dev, uint pa, uint size, int direction)
4253 +{
4254 +       int dir;
4255 +
4256 +       dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
4257 +       pci_unmap_single(dev, (uint32)pa, size, dir);
4258 +}
4259 +
4260 +void
4261 +osl_delay(uint usec)
4262 +{
4263 +       udelay(usec);
4264 +}
4265 +
4266 +uchar*
4267 +osl_pktdata(void *drv, void *skb)
4268 +{
4269 +       return (((struct sk_buff*)skb)->data);
4270 +}
4271 +
4272 +uint
4273 +osl_pktlen(void *drv, void *skb)
4274 +{
4275 +       return (((struct sk_buff*)skb)->len);
4276 +}
4277 +
4278 +void*
4279 +osl_pktnext(void *drv, void *skb)
4280 +{
4281 +       return (((struct sk_buff*)skb)->next);
4282 +}
4283 +
4284 +void
4285 +osl_pktsetnext(void *skb, void *x)
4286 +{
4287 +       ((struct sk_buff*)skb)->next = (struct sk_buff*)x;
4288 +}
4289 +
4290 +void
4291 +osl_pktsetlen(void *drv, void *skb, uint len)
4292 +{
4293 +       __skb_trim((struct sk_buff*)skb, len);
4294 +}
4295 +
4296 +uchar*
4297 +osl_pktpush(void *drv, void *skb, int bytes)
4298 +{
4299 +       return (skb_push((struct sk_buff*)skb, bytes));
4300 +}
4301 +
4302 +uchar*
4303 +osl_pktpull(void *drv, void *skb, int bytes)
4304 +{
4305 +       return (skb_pull((struct sk_buff*)skb, bytes));
4306 +}
4307 +
4308 +void*
4309 +osl_pktdup(void *drv, void *skb)
4310 +{
4311 +       return (skb_clone((struct sk_buff*)skb, GFP_ATOMIC));
4312 +}
4313 +
4314 +void*
4315 +osl_pktcookie(void *skb)
4316 +{
4317 +       return ((void*)((struct sk_buff*)skb)->csum);
4318 +}
4319 +
4320 +void
4321 +osl_pktsetcookie(void *skb, void *x)
4322 +{
4323 +       ((struct sk_buff*)skb)->csum = (uint)x;
4324 +}
4325 +
4326 +void*
4327 +osl_pktlink(void *skb)
4328 +{
4329 +       return (((struct sk_buff*)skb)->prev);
4330 +}
4331 +
4332 +void
4333 +osl_pktsetlink(void *skb, void *x)
4334 +{
4335 +       ((struct sk_buff*)skb)->prev = (struct sk_buff*)x;
4336 +}
4337 +
4338 +#endif
4339 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/sbmips.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/sbmips.c
4340 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/sbmips.c 1970-01-01 01:00:00.000000000 +0100
4341 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/sbmips.c    2005-08-28 11:12:20.478851856 +0200
4342 @@ -0,0 +1,950 @@
4343 +/*
4344 + * BCM47XX Sonics SiliconBackplane MIPS core routines
4345 + *
4346 + * Copyright 2001-2003, Broadcom Corporation
4347 + * All Rights Reserved.
4348 + * 
4349 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
4350 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
4351 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
4352 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
4353 + *
4354 + * $Id: sbmips.c,v 1.1 2005/02/28 13:33:32 jolt Exp $
4355 + */
4356 +
4357 +#include <typedefs.h>
4358 +#include <osl.h>
4359 +#include <sbutils.h>
4360 +#include <bcmdevs.h>
4361 +#include <bcmnvram.h>
4362 +#include <bcmutils.h>
4363 +#include <hndmips.h>
4364 +#include <sbconfig.h>
4365 +#include <sbextif.h>
4366 +#include <sbchipc.h>
4367 +#include <sbmemc.h>
4368 +
4369 +/*
4370 + * Memory segments (32bit kernel mode addresses)
4371 + */
4372 +#undef KUSEG
4373 +#undef KSEG0
4374 +#undef KSEG1
4375 +#undef KSEG2
4376 +#undef KSEG3
4377 +#define KUSEG          0x00000000
4378 +#define KSEG0          0x80000000
4379 +#define KSEG1          0xa0000000
4380 +#define KSEG2          0xc0000000
4381 +#define KSEG3          0xe0000000
4382 +
4383 +/*
4384 + * Map an address to a certain kernel segment
4385 + */
4386 +#undef KSEG0ADDR
4387 +#undef KSEG1ADDR
4388 +#undef KSEG2ADDR
4389 +#undef KSEG3ADDR
4390 +#define KSEG0ADDR(a)           (((a) & 0x1fffffff) | KSEG0)
4391 +#define KSEG1ADDR(a)           (((a) & 0x1fffffff) | KSEG1)
4392 +#define KSEG2ADDR(a)           (((a) & 0x1fffffff) | KSEG2)
4393 +#define KSEG3ADDR(a)           (((a) & 0x1fffffff) | KSEG3)
4394 +
4395 +/*
4396 + * The following macros are especially useful for __asm__
4397 + * inline assembler.
4398 + */
4399 +#ifndef __STR
4400 +#define __STR(x) #x
4401 +#endif
4402 +#ifndef STR
4403 +#define STR(x) __STR(x)
4404 +#endif
4405 +
4406 +/*  *********************************************************************
4407 +    *  CP0 Registers 
4408 +    ********************************************************************* */
4409 +
4410 +#define C0_INX         0               /* CP0: TLB Index */
4411 +#define C0_RAND                1               /* CP0: TLB Random */
4412 +#define C0_TLBLO0      2               /* CP0: TLB EntryLo0 */
4413 +#define C0_TLBLO       C0_TLBLO0       /* CP0: TLB EntryLo0 */
4414 +#define C0_TLBLO1      3               /* CP0: TLB EntryLo1 */
4415 +#define C0_CTEXT       4               /* CP0: Context */
4416 +#define C0_PGMASK      5               /* CP0: TLB PageMask */
4417 +#define C0_WIRED       6               /* CP0: TLB Wired */
4418 +#define C0_BADVADDR    8               /* CP0: Bad Virtual Address */
4419 +#define C0_COUNT       9               /* CP0: Count */
4420 +#define C0_TLBHI       10              /* CP0: TLB EntryHi */
4421 +#define C0_COMPARE     11              /* CP0: Compare */
4422 +#define C0_SR          12              /* CP0: Processor Status */
4423 +#define C0_STATUS      C0_SR           /* CP0: Processor Status */
4424 +#define C0_CAUSE       13              /* CP0: Exception Cause */
4425 +#define C0_EPC         14              /* CP0: Exception PC */
4426 +#define C0_PRID                15              /* CP0: Processor Revision Indentifier */
4427 +#define C0_CONFIG      16              /* CP0: Config */
4428 +#define C0_LLADDR      17              /* CP0: LLAddr */
4429 +#define C0_WATCHLO     18              /* CP0: WatchpointLo */
4430 +#define C0_WATCHHI     19              /* CP0: WatchpointHi */
4431 +#define C0_XCTEXT      20              /* CP0: XContext */
4432 +#define C0_DIAGNOSTIC  22              /* CP0: Diagnostic */
4433 +#define C0_BROADCOM    C0_DIAGNOSTIC   /* CP0: Broadcom Register */
4434 +#define C0_ECC         26              /* CP0: ECC */
4435 +#define C0_CACHEERR    27              /* CP0: CacheErr */
4436 +#define C0_TAGLO       28              /* CP0: TagLo */
4437 +#define C0_TAGHI       29              /* CP0: TagHi */
4438 +#define C0_ERREPC      30              /* CP0: ErrorEPC */
4439 +
4440 +/*
4441 + * Macros to access the system control coprocessor
4442 + */
4443 +
4444 +#define MFC0(source, sel)                                      \
4445 +({                                                             \
4446 +       int __res;                                              \
4447 +       __asm__ __volatile__(                                   \
4448 +       ".set\tnoreorder\n\t"                                   \
4449 +       ".set\tnoat\n\t"                                        \
4450 +       ".word\t"STR(0x40010000 | ((source)<<11) | (sel))"\n\t" \
4451 +       "move\t%0,$1\n\t"                                       \
4452 +       ".set\tat\n\t"                                          \
4453 +       ".set\treorder"                                         \
4454 +       :"=r" (__res)                                           \
4455 +       :                                                       \
4456 +       :"$1");                                                 \
4457 +       __res;                                                  \
4458 +})
4459 +
4460 +#define MTC0(source, sel, value)                               \
4461 +do {                                                           \
4462 +       __asm__ __volatile__(                                   \
4463 +       ".set\tnoreorder\n\t"                                   \
4464 +       ".set\tnoat\n\t"                                        \
4465 +       "move\t$1,%z0\n\t"                                      \
4466 +       ".word\t"STR(0x40810000 | ((source)<<11) | (sel))"\n\t" \
4467 +       ".set\tat\n\t"                                          \
4468 +       ".set\treorder"                                         \
4469 +       :                                                       \
4470 +       :"Jr" (value)                                           \
4471 +       :"$1");                                                 \
4472 +} while (0)
4473 +
4474 +/*
4475 + * R4x00 interrupt enable / cause bits
4476 + */
4477 +#undef IE_SW0
4478 +#undef IE_SW1
4479 +#undef IE_IRQ0
4480 +#undef IE_IRQ1
4481 +#undef IE_IRQ2
4482 +#undef IE_IRQ3
4483 +#undef IE_IRQ4
4484 +#undef IE_IRQ5
4485 +#define IE_SW0         (1<< 8)
4486 +#define IE_SW1         (1<< 9)
4487 +#define IE_IRQ0                (1<<10)
4488 +#define IE_IRQ1                (1<<11)
4489 +#define IE_IRQ2                (1<<12)
4490 +#define IE_IRQ3                (1<<13)
4491 +#define IE_IRQ4                (1<<14)
4492 +#define IE_IRQ5                (1<<15)
4493 +
4494 +/*
4495 + * Bitfields in the R4xx0 cp0 status register
4496 + */
4497 +#define ST0_IE                 0x00000001
4498 +#define ST0_EXL                        0x00000002
4499 +#define ST0_ERL                        0x00000004
4500 +#define ST0_KSU                        0x00000018
4501 +#  define KSU_USER             0x00000010
4502 +#  define KSU_SUPERVISOR       0x00000008
4503 +#  define KSU_KERNEL           0x00000000
4504 +#define ST0_UX                 0x00000020
4505 +#define ST0_SX                 0x00000040
4506 +#define ST0_KX                         0x00000080
4507 +#define ST0_DE                 0x00010000
4508 +#define ST0_CE                 0x00020000
4509 +
4510 +/*
4511 + * Status register bits available in all MIPS CPUs.
4512 + */
4513 +#define ST0_IM                 0x0000ff00
4514 +#define ST0_CH                 0x00040000
4515 +#define ST0_SR                 0x00100000
4516 +#define ST0_TS                 0x00200000
4517 +#define ST0_BEV                        0x00400000
4518 +#define ST0_RE                 0x02000000
4519 +#define ST0_FR                 0x04000000
4520 +#define ST0_CU                 0xf0000000
4521 +#define ST0_CU0                        0x10000000
4522 +#define ST0_CU1                        0x20000000
4523 +#define ST0_CU2                        0x40000000
4524 +#define ST0_CU3                        0x80000000
4525 +#define ST0_XX                 0x80000000      /* MIPS IV naming */
4526 +
4527 +/*
4528 + * Cache Operations
4529 + */
4530 +
4531 +#ifndef Fill_I
4532 +#define Fill_I                 0x14
4533 +#endif
4534 +
4535 +#define cache_unroll(base,op)                  \
4536 +       __asm__ __volatile__("                  \
4537 +               .set noreorder;                 \
4538 +               .set mips3;                     \
4539 +               cache %1, (%0);                 \
4540 +               .set mips0;                     \
4541 +               .set reorder"                   \
4542 +               :                               \
4543 +               : "r" (base),                   \
4544 +                 "i" (op));
4545 +
4546 +/* 
4547 + * These are the UART port assignments, expressed as offsets from the base
4548 + * register.  These assignments should hold for any serial port based on
4549 + * a 8250, 16450, or 16550(A).
4550 + */
4551 +
4552 +#define UART_MCR       4       /* Out: Modem Control Register */
4553 +#define UART_MSR       6       /* In:  Modem Status Register */
4554 +#define UART_MCR_LOOP  0x10    /* Enable loopback test mode */
4555 +
4556 +/* 
4557 + * Returns TRUE if an external UART exists at the given base
4558 + * register.
4559 + */
4560 +static bool
4561 +serial_exists(uint8 *regs)
4562 +{
4563 +       uint8 save_mcr, status1;
4564 +
4565 +       save_mcr = R_REG(&regs[UART_MCR]);
4566 +       W_REG(&regs[UART_MCR], UART_MCR_LOOP | 0x0a);
4567 +       status1 = R_REG(&regs[UART_MSR]) & 0xf0;
4568 +       W_REG(&regs[UART_MCR], save_mcr);
4569 +
4570 +       return (status1 == 0x90);
4571 +}
4572 +
4573 +/* 
4574 + * Initializes UART access. The callback function will be called once
4575 + * per found UART.
4576 +*/
4577 +void
4578 +sb_serial_init(void *sbh, void (*add)(void *regs, uint irq, uint baud_base, uint reg_shift))
4579 +{
4580 +       void *regs;
4581 +       ulong base;
4582 +       uint irq;
4583 +       int i, n;
4584 +
4585 +       if ((regs = sb_setcore(sbh, SB_EXTIF, 0))) {
4586 +               extifregs_t *eir = (extifregs_t *) regs;
4587 +               sbconfig_t *sb;
4588 +
4589 +               /* Determine external UART register base */
4590 +               sb = (sbconfig_t *)((ulong) eir + SBCONFIGOFF);
4591 +               base = EXTIF_CFGIF_BASE(sb_base(R_REG(&sb->sbadmatch1)));
4592 +
4593 +               /* Determine IRQ */
4594 +               irq = sb_irq(sbh);
4595 +
4596 +               /* Disable GPIO interrupt initially */
4597 +               W_REG(&eir->gpiointpolarity, 0);
4598 +               W_REG(&eir->gpiointmask, 0);
4599 +
4600 +               /* Search for external UARTs */
4601 +               n = 2;
4602 +               for (i = 0; i < 2; i++) {
4603 +                       regs = (void *) REG_MAP(base + (i * 8), 8);
4604 +                       if (serial_exists(regs)) {
4605 +                               /* Set GPIO 1 to be the external UART IRQ */
4606 +                               W_REG(&eir->gpiointmask, 2);
4607 +                               if (add)
4608 +                                       add(regs, irq, 13500000, 0);
4609 +                       }
4610 +               }
4611 +
4612 +               /* Add internal UART if enabled */
4613 +               if (R_REG(&eir->corecontrol) & CC_UE)
4614 +                       if (add)
4615 +                               add((void *) &eir->uartdata, irq, sb_clock(sbh), 2);
4616 +       } else if ((regs = sb_setcore(sbh, SB_CC, 0))) {
4617 +               chipcregs_t *cc = (chipcregs_t *) regs;
4618 +               uint32 rev, cap, pll, baud_base, div;
4619 +
4620 +               /* Determine core revision and capabilities */
4621 +               rev = sb_corerev(sbh);
4622 +               cap = R_REG(&cc->capabilities);
4623 +               pll = cap & CAP_PLL_MASK;
4624 +
4625 +               /* Determine IRQ */
4626 +               irq = sb_irq(sbh);
4627 +
4628 +               if (pll == PLL_TYPE1) {
4629 +                       /* PLL clock */
4630 +                       baud_base = sb_clock_rate(pll,
4631 +                                                 R_REG(&cc->clockcontrol_n),
4632 +                                                 R_REG(&cc->clockcontrol_m2));
4633 +                       div = 1;
4634 +               } else if (rev >= 3) {
4635 +                       /* Internal backplane clock */
4636 +                       baud_base = sb_clock_rate(pll,
4637 +                                                 R_REG(&cc->clockcontrol_n),
4638 +                                                 R_REG(&cc->clockcontrol_sb));
4639 +                       div = 2;        /* Minimum divisor */
4640 +                       W_REG(&cc->uart_clkdiv, div);
4641 +               } else {
4642 +                       /* Fixed internal backplane clock */
4643 +                       baud_base = 88000000;
4644 +                       div = 48;
4645 +               }
4646 +
4647 +               /* Clock source depends on strapping if UartClkOverride is unset */
4648 +               if ((rev > 0) && ((R_REG(&cc->corecontrol) & CC_UARTCLKO) == 0)) {
4649 +                       if ((cap & CAP_UCLKSEL) == CAP_UINTCLK) {
4650 +                               /* Internal divided backplane clock */
4651 +                               baud_base /= div;
4652 +                       } else {
4653 +                               /* Assume external clock of 1.8432 MHz */
4654 +                               baud_base = 1843200;
4655 +                       }
4656 +               }
4657 +
4658 +               /* Add internal UARTs */
4659 +               n = cap & CAP_UARTS_MASK;
4660 +               for (i = 0; i < n; i++) {
4661 +                       /* Register offset changed after revision 0 */
4662 +                       if (rev)
4663 +                               regs = (void *)((ulong) &cc->uart0data + (i * 256));
4664 +                       else
4665 +                               regs = (void *)((ulong) &cc->uart0data + (i * 8));
4666 +
4667 +                       if (add)
4668 +                               add(regs, irq, baud_base, 0);
4669 +               }
4670 +       }
4671 +}
4672 +
4673 +/* Returns the SB interrupt flag of the current core. */
4674 +uint32
4675 +sb_flag(void *sbh)
4676 +{
4677 +       void *regs;
4678 +       sbconfig_t *sb;
4679 +
4680 +       regs = sb_coreregs(sbh);
4681 +       sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
4682 +
4683 +       return (R_REG(&sb->sbtpsflag) & SBTPS_NUM0_MASK);
4684 +}
4685 +
4686 +static const uint32 sbips_int_mask[] = {
4687 +       0,
4688 +       SBIPS_INT1_MASK,
4689 +       SBIPS_INT2_MASK,
4690 +       SBIPS_INT3_MASK,
4691 +       SBIPS_INT4_MASK
4692 +};
4693 +
4694 +static const uint32 sbips_int_shift[] = {
4695 +       0,
4696 +       0,
4697 +       SBIPS_INT2_SHIFT,
4698 +       SBIPS_INT3_SHIFT,
4699 +       SBIPS_INT4_SHIFT
4700 +};
4701 +
4702 +/* 
4703 + * Returns the MIPS IRQ assignment of the current core. If unassigned,
4704 + * 0 is returned.
4705 + */
4706 +uint
4707 +sb_irq(void *sbh)
4708 +{
4709 +       uint idx;
4710 +       void *regs;
4711 +       sbconfig_t *sb;
4712 +       uint32 flag, sbipsflag;
4713 +       uint irq = 0;
4714 +
4715 +       flag = sb_flag(sbh);
4716 +
4717 +       idx = sb_coreidx(sbh);
4718 +
4719 +       if ((regs = sb_setcore(sbh, SB_MIPS, 0)) ||
4720 +           (regs = sb_setcore(sbh, SB_MIPS33, 0))) {
4721 +               sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
4722 +
4723 +               /* sbipsflag specifies which core is routed to interrupts 1 to 4 */
4724 +               sbipsflag = R_REG(&sb->sbipsflag);
4725 +               for (irq = 1; irq <= 4; irq++) {
4726 +                       if (((sbipsflag & sbips_int_mask[irq]) >> sbips_int_shift[irq]) == flag)
4727 +                               break;
4728 +               }
4729 +               if (irq == 5)
4730 +                       irq = 0;
4731 +       }
4732 +
4733 +       sb_setcoreidx(sbh, idx);
4734 +
4735 +       return irq;
4736 +}
4737 +
4738 +/* Clears the specified MIPS IRQ. */
4739 +static void
4740 +sb_clearirq(void *sbh, uint irq)
4741 +{
4742 +       void *regs;
4743 +       sbconfig_t *sb;
4744 +
4745 +       if (!(regs = sb_setcore(sbh, SB_MIPS, 0)) &&
4746 +           !(regs = sb_setcore(sbh, SB_MIPS33, 0)))
4747 +               ASSERT(regs);
4748 +       sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
4749 +
4750 +       if (irq == 0)
4751 +               W_REG(&sb->sbintvec, 0);
4752 +       else
4753 +               OR_REG(&sb->sbipsflag, sbips_int_mask[irq]);
4754 +}
4755 +
4756 +/* 
4757 + * Assigns the specified MIPS IRQ to the specified core. Shared MIPS
4758 + * IRQ 0 may be assigned more than once.
4759 + */
4760 +static void
4761 +sb_setirq(void *sbh, uint irq, uint coreid, uint coreunit)
4762 +{
4763 +       void *regs;
4764 +       sbconfig_t *sb;
4765 +       uint32 flag;
4766 +
4767 +       regs = sb_setcore(sbh, coreid, coreunit);
4768 +       ASSERT(regs);
4769 +       flag = sb_flag(sbh);
4770 +
4771 +       if (!(regs = sb_setcore(sbh, SB_MIPS, 0)) &&
4772 +           !(regs = sb_setcore(sbh, SB_MIPS33, 0)))
4773 +               ASSERT(regs);
4774 +       sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
4775 +
4776 +       if (irq == 0)
4777 +               OR_REG(&sb->sbintvec, 1 << flag);
4778 +       else {
4779 +               flag <<= sbips_int_shift[irq];
4780 +               ASSERT(!(flag & ~sbips_int_mask[irq]));
4781 +               flag |= R_REG(&sb->sbipsflag) & ~sbips_int_mask[irq];
4782 +               W_REG(&sb->sbipsflag, flag);
4783 +       }
4784 +}      
4785 +
4786 +/* 
4787 + * Initializes clocks and interrupts. SB and NVRAM access must be
4788 + * initialized prior to calling.
4789 + */
4790 +void
4791 +sb_mips_init(void *sbh)
4792 +{
4793 +       ulong hz, ns, tmp;
4794 +       extifregs_t *eir;
4795 +       chipcregs_t *cc;
4796 +       char *value;
4797 +       uint irq;
4798 +
4799 +       /* Figure out current SB clock speed */
4800 +       if ((hz = sb_clock(sbh)) == 0)
4801 +               hz = 100000000;
4802 +       ns = 1000000000 / hz;
4803 +
4804 +       /* Setup external interface timing */
4805 +       if ((eir = sb_setcore(sbh, SB_EXTIF, 0))) {
4806 +               /* Initialize extif so we can get to the LEDs and external UART */
4807 +               W_REG(&eir->prog_config, CF_EN);
4808 +
4809 +               /* Set timing for the flash */
4810 +               tmp = CEIL(10, ns) << FW_W3_SHIFT;      /* W3 = 10nS */
4811 +               tmp = tmp | (CEIL(40, ns) << FW_W1_SHIFT); /* W1 = 40nS */
4812 +               tmp = tmp | CEIL(120, ns);              /* W0 = 120nS */
4813 +               W_REG(&eir->prog_waitcount, tmp);       /* 0x01020a0c for a 100Mhz clock */
4814 +
4815 +               /* Set programmable interface timing for external uart */
4816 +               tmp = CEIL(10, ns) << FW_W3_SHIFT;      /* W3 = 10nS */
4817 +               tmp = tmp | (CEIL(20, ns) << FW_W2_SHIFT); /* W2 = 20nS */
4818 +               tmp = tmp | (CEIL(100, ns) << FW_W1_SHIFT); /* W1 = 100nS */
4819 +               tmp = tmp | CEIL(120, ns);              /* W0 = 120nS */
4820 +               W_REG(&eir->prog_waitcount, tmp);       /* 0x01020a0c for a 100Mhz clock */
4821 +       } else if ((cc = sb_setcore(sbh, SB_CC, 0))) {
4822 +               /* Set timing for the flash */
4823 +               tmp = CEIL(10, ns) << FW_W3_SHIFT;      /* W3 = 10nS */
4824 +               tmp |= CEIL(10, ns) << FW_W1_SHIFT;     /* W1 = 10nS */
4825 +               tmp |= CEIL(120, ns);                   /* W0 = 120nS */
4826 +               W_REG(&cc->parallelflashwaitcnt, tmp);
4827 +
4828 +               W_REG(&cc->cs01memwaitcnt, tmp);
4829 +       }
4830 +
4831 +       /* Chip specific initialization */
4832 +       switch (sb_chip(sbh)) {
4833 +       case BCM4710_DEVICE_ID:
4834 +               /* Clear interrupt map */
4835 +               for (irq = 0; irq <= 4; irq++)
4836 +                       sb_clearirq(sbh, irq);
4837 +               sb_setirq(sbh, 0, SB_CODEC, 0);
4838 +               sb_setirq(sbh, 0, SB_EXTIF, 0);
4839 +               sb_setirq(sbh, 2, SB_ENET, 1);
4840 +               sb_setirq(sbh, 3, SB_ILINE20, 0);
4841 +               sb_setirq(sbh, 4, SB_PCI, 0);
4842 +               ASSERT(eir);
4843 +               value = nvram_get("et0phyaddr");
4844 +               if (value && !strcmp(value, "31")) {
4845 +                       /* Enable internal UART */
4846 +                       W_REG(&eir->corecontrol, CC_UE);
4847 +                       /* Give USB its own interrupt */
4848 +                       sb_setirq(sbh, 1, SB_USB, 0);
4849 +               } else {
4850 +                       /* Disable internal UART */
4851 +                       W_REG(&eir->corecontrol, 0);
4852 +                       /* Give Ethernet its own interrupt */
4853 +                       sb_setirq(sbh, 1, SB_ENET, 0);
4854 +                       sb_setirq(sbh, 0, SB_USB, 0);
4855 +               }
4856 +               break;
4857 +       case BCM4310_DEVICE_ID:
4858 +               MTC0(C0_BROADCOM, 0, MFC0(C0_BROADCOM, 0) & ~(1 << 22));
4859 +               break;
4860 +       }
4861 +}
4862 +
4863 +uint32
4864 +sb_mips_clock(void *sbh)
4865 +{
4866 +       extifregs_t *eir;
4867 +       chipcregs_t *cc;
4868 +       uint32 n, m;
4869 +       uint idx;
4870 +       uint32 pll_type, rate = 0;
4871 +
4872 +       /* get index of the current core */
4873 +       idx = sb_coreidx(sbh);
4874 +       pll_type = PLL_TYPE1;
4875 +
4876 +       /* switch to extif or chipc core */
4877 +       if ((eir = (extifregs_t *) sb_setcore(sbh, SB_EXTIF, 0))) {
4878 +               n = R_REG(&eir->clockcontrol_n);
4879 +               m = R_REG(&eir->clockcontrol_sb);
4880 +       } else if ((cc = (chipcregs_t *) sb_setcore(sbh, SB_CC, 0))) {
4881 +               pll_type = R_REG(&cc->capabilities) & CAP_PLL_MASK;
4882 +               n = R_REG(&cc->clockcontrol_n);
4883 +               if ((pll_type == PLL_TYPE2) || (pll_type == PLL_TYPE4))
4884 +                       m = R_REG(&cc->clockcontrol_mips);
4885 +               else if (pll_type == PLL_TYPE3) {
4886 +                       rate = 200000000;
4887 +                       goto out;
4888 +               } else
4889 +                       m = R_REG(&cc->clockcontrol_sb);
4890 +       } else
4891 +               goto out;
4892 +
4893 +       /* calculate rate */
4894 +       rate = sb_clock_rate(pll_type, n, m);
4895 +
4896 +out:
4897 +       /* switch back to previous core */
4898 +       sb_setcoreidx(sbh, idx);
4899 +
4900 +       return rate;
4901 +}
4902 +
4903 +static void
4904 +icache_probe(int *size, int *lsize)
4905 +{
4906 +       uint32 config1;
4907 +       uint sets, ways;
4908 +
4909 +       config1 = MFC0(C0_CONFIG, 1);
4910 +
4911 +       /* Instruction Cache Size = Associativity * Line Size * Sets Per Way */
4912 +       if ((*lsize = ((config1 >> 19) & 7)))
4913 +               *lsize = 2 << *lsize;
4914 +       sets = 64 << ((config1 >> 22) & 7);
4915 +       ways = 1 + ((config1 >> 16) & 7);
4916 +       *size = *lsize * sets * ways;
4917 +}
4918 +
4919 +#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4)
4920 +
4921 +static void
4922 +handler(void)
4923 +{
4924 +       /* Step 11 */
4925 +       __asm__ (
4926 +               ".set\tmips32\n\t"
4927 +               "ssnop\n\t"
4928 +               "ssnop\n\t"
4929 +       /* Disable interrupts */
4930 +       /*      MTC0(C0_STATUS, 0, MFC0(C0_STATUS, 0) & ~(ALLINTS | STO_IE)); */
4931 +               "mfc0 $15, $12\n\t"
4932 +               "and $15, $15, -31746\n\t"
4933 +               "mtc0 $15, $12\n\t"
4934 +               "eret\n\t"
4935 +               "nop\n\t"
4936 +               "nop\n\t"
4937 +               ".set\tmips0"
4938 +       );
4939 +}
4940 +
4941 +/* The following MUST come right after handler() */
4942 +static void
4943 +afterhandler(void)
4944 +{
4945 +}
4946 +
4947 +/*
4948 + * Set the MIPS, backplane and PCI clocks as closely as possible.
4949 + */
4950 +bool
4951 +sb_mips_setclock(void *sbh, uint32 mipsclock, uint32 sbclock, uint32 pciclock)
4952 +{
4953 +       extifregs_t *eir = NULL;
4954 +       chipcregs_t *cc = NULL;
4955 +       mipsregs_t *mipsr = NULL;
4956 +       volatile uint32 *clockcontrol_n, *clockcontrol_sb, *clockcontrol_pci;
4957 +       uint32 orig_n, orig_sb, orig_pci, orig_m2, orig_mips, orig_ratio_parm, new_ratio;
4958 +       uint32 pll_type, sync_mode;
4959 +       uint idx, i;
4960 +       struct {
4961 +               uint32 mipsclock;
4962 +               uint16 n;
4963 +               uint32 sb;
4964 +               uint32 pci33;
4965 +               uint32 pci25;
4966 +       } type1_table[] = {
4967 +               {  96000000, 0x0303, 0x04020011, 0x11030011, 0x11050011 }, /*  96.000 32.000 24.000 */
4968 +               { 100000000, 0x0009, 0x04020011, 0x11030011, 0x11050011 }, /* 100.000 33.333 25.000 */
4969 +               { 104000000, 0x0802, 0x04020011, 0x11050009, 0x11090009 }, /* 104.000 31.200 24.960 */
4970 +               { 108000000, 0x0403, 0x04020011, 0x11050009, 0x02000802 }, /* 108.000 32.400 24.923 */
4971 +               { 112000000, 0x0205, 0x04020011, 0x11030021, 0x02000403 }, /* 112.000 32.000 24.889 */
4972 +               { 115200000, 0x0303, 0x04020009, 0x11030011, 0x11050011 }, /* 115.200 32.000 24.000 */
4973 +               { 120000000, 0x0011, 0x04020011, 0x11050011, 0x11090011 }, /* 120.000 30.000 24.000 */
4974 +               { 124800000, 0x0802, 0x04020009, 0x11050009, 0x11090009 }, /* 124.800 31.200 24.960 */
4975 +               { 128000000, 0x0305, 0x04020011, 0x11050011, 0x02000305 }, /* 128.000 32.000 24.000 */
4976 +               { 132000000, 0x0603, 0x04020011, 0x11050011, 0x02000305 }, /* 132.000 33.000 24.750 */
4977 +               { 136000000, 0x0c02, 0x04020011, 0x11090009, 0x02000603 }, /* 136.000 32.640 24.727 */
4978 +               { 140000000, 0x0021, 0x04020011, 0x11050021, 0x02000c02 }, /* 140.000 30.000 24.706 */
4979 +               { 144000000, 0x0405, 0x04020011, 0x01020202, 0x11090021 }, /* 144.000 30.857 24.686 */
4980 +               { 150857142, 0x0605, 0x04020021, 0x02000305, 0x02000605 }, /* 150.857 33.000 24.000 */
4981 +               { 152000000, 0x0e02, 0x04020011, 0x11050021, 0x02000e02 }, /* 152.000 32.571 24.000 */
4982 +               { 156000000, 0x0802, 0x04020005, 0x11050009, 0x11090009 }, /* 156.000 31.200 24.960 */
4983 +               { 160000000, 0x0309, 0x04020011, 0x11090011, 0x02000309 }, /* 160.000 32.000 24.000 */
4984 +               { 163200000, 0x0c02, 0x04020009, 0x11090009, 0x02000603 }, /* 163.200 32.640 24.727 */
4985 +               { 168000000, 0x0205, 0x04020005, 0x11030021, 0x02000403 }, /* 168.000 32.000 24.889 */
4986 +               { 176000000, 0x0602, 0x04020003, 0x11050005, 0x02000602 }, /* 176.000 33.000 24.000 */
4987 +       };
4988 +       typedef struct {
4989 +               uint32 mipsclock;
4990 +               uint32 sbclock;
4991 +               uint16 n;
4992 +               uint32 sb;
4993 +               uint32 pci33;
4994 +               uint32 m2;
4995 +               uint32 m3;
4996 +               uint32 ratio;
4997 +               uint32 ratio_parm;
4998 +       } n4m_table_t;
4999 +
5000 +       n4m_table_t type2_table[] = {
5001 +               { 180000000,  80000000, 0x0403, 0x01010000, 0x01020300, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
5002 +               { 180000000,  90000000, 0x0403, 0x01000100, 0x01020300, 0x01000100, 0x05000100, 0x21, 0x0aaa0555 },
5003 +               { 200000000, 100000000, 0x0303, 0x01000000, 0x01000600, 0x01000000, 0x05000000, 0x21, 0x0aaa0555 },
5004 +               { 211200000, 105600000, 0x0902, 0x01000200, 0x01030400, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
5005 +               { 220800000, 110400000, 0x1500, 0x01000200, 0x01030400, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
5006 +               { 230400000, 115200000, 0x0604, 0x01000200, 0x01020600, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
5007 +               { 234000000, 104000000, 0x0b01, 0x01010000, 0x01010700, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
5008 +               { 240000000, 120000000, 0x0803, 0x01000200, 0x01020600, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
5009 +               { 252000000, 126000000, 0x0504, 0x01000100, 0x01020500, 0x01000100, 0x05000100, 0x21, 0x0aaa0555 },
5010 +               { 264000000, 132000000, 0x0903, 0x01000200, 0x01020700, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
5011 +               { 270000000, 120000000, 0x0703, 0x01010000, 0x01030400, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
5012 +               { 276000000, 122666666, 0x1500, 0x01010000, 0x01030400, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
5013 +               { 280000000, 140000000, 0x0503, 0x01000000, 0x01010600, 0x01000000, 0x05000000, 0x21, 0x0aaa0555 },
5014 +               { 288000000, 128000000, 0x0604, 0x01010000, 0x01030400, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
5015 +               { 288000000, 144000000, 0x0404, 0x01000000, 0x01010600, 0x01000000, 0x05000000, 0x21, 0x0aaa0555 },
5016 +               { 300000000, 133333333, 0x0803, 0x01010000, 0x01020600, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
5017 +               { 300000000, 150000000, 0x0803, 0x01000100, 0x01020600, 0x01000100, 0x05000100, 0x21, 0x0aaa0555 }
5018 +       };
5019 +
5020 +       n4m_table_t type4_table[] = {
5021 +               { 192000000,  96000000, 0x0702, 0x04020011, 0x11030011, 0x04020011, 0x04020003, 0x21, 0x0aaa0555 },
5022 +               { 200000000, 100000000, 0x0009, 0x04020011, 0x11030011, 0x04020011, 0x04020003, 0x21, 0x0aaa0555 },
5023 +               { 216000000, 108000000, 0x0211, 0x11020005, 0x11030303, 0x11020005, 0x04000005, 0x21, 0x0aaa0555 },
5024 +               { 228000000, 101333333, 0x0e02, 0x11030003, 0x11210005, 0x11030305, 0x04000005, 0x94, 0x012a00a9 },
5025 +               { 228000000, 114000000, 0x0e02, 0x11020005, 0x11210005, 0x11020005, 0x04000005, 0x21, 0x0aaa0555 },
5026 +               { 240000000, 120000000, 0x0109, 0x11030002, 0x01050203, 0x11030002, 0x04000003, 0x21, 0x0aaa0555 },
5027 +               { 252000000, 126000000, 0x0203, 0x04000005, 0x11050005, 0x04000005, 0x04000002, 0x21, 0x0aaa0555 },
5028 +               { 264000000, 132000000, 0x0602, 0x04000005, 0x11050005, 0x04000005, 0x04000002, 0x21, 0x0aaa0555 },
5029 +               { 272000000, 116571428, 0x0c02, 0x04000021, 0x02000909, 0x02000221, 0x04000003, 0x73, 0x254a14a9 },
5030 +               { 280000000, 120000000, 0x0209, 0x04000021, 0x01030303, 0x02000221, 0x04000003, 0x73, 0x254a14a9 },
5031 +               { 288000000, 123428571, 0x0111, 0x04000021, 0x01030303, 0x02000221, 0x04000003, 0x73, 0x254a14a9 },
5032 +               { 300000000, 120000000, 0x0009, 0x04000009, 0x01030203, 0x02000902, 0x04000002, 0x52, 0x02520129 }
5033 +       };
5034 +       uint icache_size, ic_lsize;
5035 +       ulong start, end, dst;
5036 +       bool ret = FALSE;
5037 +
5038 +       /* get index of the current core */
5039 +       idx = sb_coreidx(sbh);
5040 +
5041 +       /* switch to extif or chipc core */
5042 +       if ((eir = (extifregs_t *) sb_setcore(sbh, SB_EXTIF, 0))) {
5043 +               pll_type = PLL_TYPE1;
5044 +               clockcontrol_n = &eir->clockcontrol_n;
5045 +               clockcontrol_sb = &eir->clockcontrol_sb;
5046 +               clockcontrol_pci = &eir->clockcontrol_pci;
5047 +       } else if ((cc = (chipcregs_t *) sb_setcore(sbh, SB_CC, 0))) {
5048 +               pll_type = R_REG(&cc->capabilities) & CAP_PLL_MASK;
5049 +               clockcontrol_n = &cc->clockcontrol_n;
5050 +               clockcontrol_sb = &cc->clockcontrol_sb;
5051 +               clockcontrol_pci = &cc->clockcontrol_pci;
5052 +       } else
5053 +               goto done;
5054 +
5055 +       /* Store the current clock register values */
5056 +       orig_n = R_REG(clockcontrol_n);
5057 +       orig_sb = R_REG(clockcontrol_sb);
5058 +       orig_pci = R_REG(clockcontrol_pci);
5059 +
5060 +       if (pll_type == PLL_TYPE1) {
5061 +               /* Keep the current PCI clock if not specified */
5062 +               if (pciclock == 0) {
5063 +                       pciclock = sb_clock_rate(pll_type, R_REG(clockcontrol_n), R_REG(clockcontrol_pci));
5064 +                       pciclock = (pciclock <= 25000000) ? 25000000 : 33000000;
5065 +               }
5066 +
5067 +               /* Search for the closest MIPS clock less than or equal to a preferred value */
5068 +               for (i = 0; i < ARRAYSIZE(type1_table); i++) {
5069 +                       ASSERT(type1_table[i].mipsclock ==
5070 +                              sb_clock_rate(pll_type, type1_table[i].n, type1_table[i].sb));
5071 +                       if (type1_table[i].mipsclock > mipsclock)
5072 +                               break;
5073 +               }
5074 +               if (i == 0) {
5075 +                       ret = FALSE;
5076 +                       goto done;
5077 +               } else {
5078 +                       ret = TRUE;
5079 +                       i--;
5080 +               }
5081 +               ASSERT(type1_table[i].mipsclock <= mipsclock);
5082 +
5083 +               /* No PLL change */
5084 +               if ((orig_n == type1_table[i].n) &&
5085 +                   (orig_sb == type1_table[i].sb) &&
5086 +                   (orig_pci == type1_table[i].pci33))
5087 +                       goto done;
5088 +
5089 +               /* Set the PLL controls */
5090 +               W_REG(clockcontrol_n, type1_table[i].n);
5091 +               W_REG(clockcontrol_sb, type1_table[i].sb);
5092 +               if (pciclock == 25000000)
5093 +                       W_REG(clockcontrol_pci, type1_table[i].pci25);
5094 +               else
5095 +                       W_REG(clockcontrol_pci, type1_table[i].pci33);
5096 +
5097 +               /* Reset */
5098 +               sb_watchdog(sbh, 1);
5099 +               while (1);
5100 +       } else if ((pll_type == PLL_TYPE2) || (pll_type == PLL_TYPE4)) {
5101 +               n4m_table_t *table = (pll_type == PLL_TYPE2) ? type2_table : type4_table;
5102 +               uint tabsz = (pll_type == PLL_TYPE2) ? ARRAYSIZE(type2_table) : ARRAYSIZE(type4_table);
5103 +
5104 +               ASSERT(cc);
5105 +
5106 +               /* Store the current clock register values */
5107 +               orig_m2 = R_REG(&cc->clockcontrol_m2);
5108 +               orig_mips = R_REG(&cc->clockcontrol_mips);
5109 +               orig_ratio_parm = 0;
5110 +
5111 +               /* Look up current ratio */
5112 +               for (i = 0; i < tabsz; i++) {
5113 +                       if ((orig_n == table[i].n) &&
5114 +                           (orig_sb == table[i].sb) &&
5115 +                           (orig_pci == table[i].pci33) &&
5116 +                           (orig_m2 == table[i].m2) &&
5117 +                           (orig_mips == table[i].m3)) {
5118 +                               orig_ratio_parm = table[i].ratio_parm;
5119 +                               break;
5120 +                       }
5121 +               }
5122 +
5123 +               /* Search for the closest MIPS clock greater or equal to a preferred value */
5124 +               for (i = 0; i < tabsz; i++) {
5125 +                       ASSERT(table[i].mipsclock ==
5126 +                              sb_clock_rate(pll_type, table[i].n, table[i].m3));
5127 +                       if ((mipsclock <= table[i].mipsclock) &&
5128 +                           ((sbclock == 0) || (sbclock <= table[i].sbclock)))
5129 +                               break;
5130 +               }
5131 +               if (i == tabsz) {
5132 +                       ret = FALSE;
5133 +                       goto done;
5134 +               } else {
5135 +                       ret = TRUE;
5136 +               }
5137 +
5138 +               /* No PLL change */
5139 +               if ((orig_n == table[i].n) &&
5140 +                   (orig_sb == table[i].sb) &&
5141 +                   (orig_pci == table[i].pci33) &&
5142 +                   (orig_m2 == table[i].m2) &&
5143 +                   (orig_mips == table[i].m3))
5144 +                       goto done;
5145 +
5146 +               /* Set the PLL controls */
5147 +               W_REG(clockcontrol_n, table[i].n);
5148 +               W_REG(clockcontrol_sb, table[i].sb);
5149 +               W_REG(clockcontrol_pci, table[i].pci33);
5150 +               W_REG(&cc->clockcontrol_m2, table[i].m2);
5151 +               W_REG(&cc->clockcontrol_mips, table[i].m3);
5152 +
5153 +               /* No ratio change */
5154 +               if (orig_ratio_parm == table[i].ratio_parm)
5155 +                       goto end_fill;
5156 +
5157 +               new_ratio = table[i].ratio_parm;
5158 +
5159 +               icache_probe(&icache_size, &ic_lsize);
5160 +
5161 +               /* Preload the code into the cache */
5162 +               start = ((ulong) &&start_fill) & ~(ic_lsize - 1);
5163 +               end = ((ulong) &&end_fill + (ic_lsize - 1)) & ~(ic_lsize - 1);
5164 +               while (start < end) {
5165 +                       cache_unroll(start, Fill_I);
5166 +                       start += ic_lsize;
5167 +               }
5168 +
5169 +               /* Copy the handler */
5170 +               start = (ulong) &handler;
5171 +               end = (ulong) &afterhandler;
5172 +               dst = KSEG1ADDR(0x180);
5173 +               for (i = 0; i < (end - start); i += 4)
5174 +                       *((ulong *)(dst + i)) = *((ulong *)(start + i));
5175 +               
5176 +               /* Preload handler into the cache one line at a time */
5177 +               for (i = 0; i < (end - start); i += 4)
5178 +                       cache_unroll(dst + i, Fill_I);
5179 +
5180 +               /* Clear BEV bit */
5181 +               MTC0(C0_STATUS, 0, MFC0(C0_STATUS, 0) & ~ST0_BEV);
5182 +
5183 +               /* Enable interrupts */
5184 +               MTC0(C0_STATUS, 0, MFC0(C0_STATUS, 0) | (ALLINTS | ST0_IE));
5185 +
5186 +               /* Enable MIPS timer interrupt */
5187 +               if (!(mipsr = sb_setcore(sbh, SB_MIPS, 0)) &&
5188 +                   !(mipsr = sb_setcore(sbh, SB_MIPS33, 0)))
5189 +                       ASSERT(mipsr);
5190 +               W_REG(&mipsr->intmask, 1);
5191 +
5192 +       start_fill:
5193 +               /* step 1, set clock ratios */
5194 +               MTC0(C0_BROADCOM, 3, new_ratio);
5195 +               MTC0(C0_BROADCOM, 1, 8);
5196 +
5197 +               /* step 2: program timer intr */
5198 +               W_REG(&mipsr->timer, 100);
5199 +               (void) R_REG(&mipsr->timer);
5200 +
5201 +               /* step 3, switch to async */
5202 +               sync_mode = MFC0(C0_BROADCOM, 4);
5203 +               MTC0(C0_BROADCOM, 4, 1 << 22);
5204 +
5205 +               /* step 4, set cfg active */
5206 +               MTC0(C0_BROADCOM, 2, 0x9);
5207 +
5208 +
5209 +               /* steps 5 & 6 */ 
5210 +               __asm__ __volatile__ (
5211 +                       ".set\tmips3\n\t"
5212 +                       "wait\n\t"
5213 +                       ".set\tmips0"
5214 +               );
5215 +
5216 +               /* step 7, clear cfg_active */
5217 +               MTC0(C0_BROADCOM, 2, 0);
5218 +               
5219 +               /* Additional Step: set back to orig sync mode */
5220 +               MTC0(C0_BROADCOM, 4, sync_mode);
5221 +
5222 +               /* step 8, fake soft reset */
5223 +               MTC0(C0_BROADCOM, 5, MFC0(C0_BROADCOM, 5) | 4);
5224 +
5225 +       end_fill:
5226 +               /* step 9 set watchdog timer */
5227 +               sb_watchdog(sbh, 20);
5228 +               (void) R_REG(&cc->chipid);
5229 +
5230 +               /* step 11 */
5231 +               __asm__ __volatile__ (
5232 +                       ".set\tmips3\n\t"
5233 +                       "sync\n\t"
5234 +                       "wait\n\t"
5235 +                       ".set\tmips0"
5236 +               );
5237 +               while (1);
5238 +       }
5239 +
5240 +done:
5241 +       /* switch back to previous core */
5242 +       sb_setcoreidx(sbh, idx);
5243 +
5244 +       return ret;
5245 +}
5246 +
5247 +
5248 +/* returns the ncdl value to be programmed into sdram_ncdl for calibration */
5249 +uint32
5250 +sb_memc_get_ncdl(void *sbh)
5251 +{
5252 +       sbmemcregs_t *memc;
5253 +       uint32 ret = 0;
5254 +       uint32 config, rd, wr, misc, dqsg, cd, sm, sd;
5255 +       uint idx, rev;
5256 +
5257 +       idx = sb_coreidx(sbh);
5258 +
5259 +       memc = (sbmemcregs_t *)sb_setcore(sbh, SB_MEMC, 0);
5260 +       if (memc == 0)
5261 +               goto out;
5262 +
5263 +       rev = sb_corerev(sbh);
5264 +
5265 +       config = R_REG(&memc->config);
5266 +       wr = R_REG(&memc->wrncdlcor);
5267 +       rd = R_REG(&memc->rdncdlcor);
5268 +       misc = R_REG(&memc->miscdlyctl);
5269 +       dqsg = R_REG(&memc->dqsgatencdl);
5270 +
5271 +       rd &= MEMC_RDNCDLCOR_RD_MASK;
5272 +       wr &= MEMC_WRNCDLCOR_WR_MASK; 
5273 +       dqsg &= MEMC_DQSGATENCDL_G_MASK;
5274 +
5275 +       if (config & MEMC_CONFIG_DDR) {
5276 +               ret = (wr << 16) | (rd << 8) | dqsg;
5277 +       } else {
5278 +               if (rev > 0)
5279 +                       cd = rd;
5280 +               else
5281 +                       cd = (rd == MEMC_CD_THRESHOLD) ? rd : (wr + MEMC_CD_THRESHOLD);
5282 +               sm = (misc & MEMC_MISC_SM_MASK) >> MEMC_MISC_SM_SHIFT;
5283 +               sd = (misc & MEMC_MISC_SD_MASK) >> MEMC_MISC_SD_SHIFT;
5284 +               ret = (sm << 16) | (sd << 8) | cd;
5285 +       }
5286 +
5287 +out:
5288 +       /* switch back to previous core */
5289 +       sb_setcoreidx(sbh, idx);
5290 +
5291 +       return ret;
5292 +}
5293 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/sbpci.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/sbpci.c
5294 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/sbpci.c  1970-01-01 01:00:00.000000000 +0100
5295 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/sbpci.c     2005-08-28 11:12:20.479851704 +0200
5296 @@ -0,0 +1,530 @@
5297 +/*
5298 + * Low-Level PCI and SB support for BCM47xx
5299 + *
5300 + * Copyright 2001-2003, Broadcom Corporation
5301 + * All Rights Reserved.
5302 + * 
5303 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
5304 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
5305 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
5306 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
5307 + *
5308 + * $Id: sbpci.c,v 1.2 2005/02/28 13:34:25 jolt Exp $
5309 + */
5310 +
5311 +#include <typedefs.h>
5312 +#include <pcicfg.h>
5313 +#include <bcmdevs.h>
5314 +#include <sbconfig.h>
5315 +#include <sbpci.h>
5316 +#include <osl.h>
5317 +#include <bcmendian.h>
5318 +#include <bcmutils.h>
5319 +#include <sbutils.h>
5320 +#include <bcmnvram.h>
5321 +#include <hndmips.h>
5322 +
5323 +/* Can free sbpci_init() memory after boot */
5324 +#ifndef linux
5325 +#define __init
5326 +#endif
5327 +
5328 +/* Emulated configuration space */
5329 +static pci_config_regs sb_config_regs[SB_MAXCORES];
5330 +
5331 +/* Banned cores */
5332 +static uint16 pci_ban[32] = { 0 };
5333 +static uint pci_banned = 0;
5334 +
5335 +/* CardBus mode */
5336 +static bool cardbus = FALSE;
5337 +
5338 +/*
5339 + * Functions for accessing external PCI configuration space
5340 + */
5341 +
5342 +/* Assume one-hot slot wiring */
5343 +#define PCI_SLOT_MAX 16
5344 +
5345 +static uint32
5346 +config_cmd(void *sbh, uint bus, uint dev, uint func, uint off)
5347 +{
5348 +       uint coreidx;
5349 +       sbpciregs_t *regs;
5350 +       uint32 addr = 0;
5351 +
5352 +       /* CardBusMode supports only one device */
5353 +       if (cardbus && dev > 1)
5354 +               return 0;
5355 +
5356 +       coreidx = sb_coreidx(sbh);
5357 +       regs = (sbpciregs_t *) sb_setcore(sbh, SB_PCI, 0);
5358 +
5359 +       /* Type 0 transaction */
5360 +       if (bus == 1) {
5361 +               /* Skip unwired slots */
5362 +               if (dev < PCI_SLOT_MAX) {
5363 +                       /* Slide the PCI window to the appropriate slot */
5364 +                       W_REG(&regs->sbtopci1, SBTOPCI_CFG0 | ((1 << (dev + 16)) & SBTOPCI1_MASK));
5365 +                       addr = SB_PCI_CFG | ((1 << (dev + 16)) & ~SBTOPCI1_MASK) |
5366 +                               (func << 8) | (off & ~3);
5367 +               }
5368 +       }
5369 +
5370 +       /* Type 1 transaction */
5371 +       else {
5372 +               W_REG(&regs->sbtopci1, SBTOPCI_CFG1);
5373 +               addr = SB_PCI_CFG | (bus << 16) | (dev << 11) | (func << 8) | (off & ~3);
5374 +       }
5375 +
5376 +       sb_setcoreidx(sbh, coreidx);
5377 +
5378 +       return addr;
5379 +}
5380 +
5381 +static int
5382 +extpci_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
5383 +{
5384 +       uint32 addr, *reg = NULL, val;
5385 +       int ret = 0;
5386 +
5387 +       if (!(addr = config_cmd(sbh, bus, dev, func, off)) ||
5388 +           !(reg = (uint32 *) REG_MAP(addr, len)) ||
5389 +           BUSPROBE(val, reg))
5390 +               val = 0xffffffff;
5391 +
5392 +       val >>= 8 * (off & 3);
5393 +       if (len == 4)
5394 +               *((uint32 *) buf) = val;
5395 +       else if (len == 2)
5396 +               *((uint16 *) buf) = (uint16) val;
5397 +       else if (len == 1)
5398 +               *((uint8 *) buf) = (uint8) val;
5399 +       else
5400 +               ret = -1;
5401 +
5402 +       if (reg)
5403 +               REG_UNMAP(reg);
5404 +
5405 +       return ret;
5406 +}
5407 +
5408 +static int
5409 +extpci_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
5410 +{
5411 +       uint32 addr, *reg = NULL, val;
5412 +       int ret = 0;
5413 +
5414 +       if (!(addr = config_cmd(sbh, bus, dev, func, off)) ||
5415 +           !(reg = (uint32 *) REG_MAP(addr, len)) ||
5416 +           BUSPROBE(val, reg))
5417 +               goto done;
5418 +
5419 +       if (len == 4)
5420 +               val = *((uint32 *) buf);
5421 +       else if (len == 2) {
5422 +               val &= ~(0xffff << (8 * (off & 3)));
5423 +               val |= *((uint16 *) buf) << (8 * (off & 3));
5424 +       } else if (len == 1) {
5425 +               val &= ~(0xff << (8 * (off & 3)));
5426 +               val |= *((uint8 *) buf) << (8 * (off & 3));
5427 +       } else
5428 +               ret = -1;
5429 +
5430 +       W_REG(reg, val);
5431 +
5432 + done:
5433 +       if (reg)
5434 +               REG_UNMAP(reg);
5435 +
5436 +       return ret;
5437 +}
5438 +
5439 +/*
5440 + * Functions for accessing translated SB configuration space
5441 + */
5442 +
5443 +static int
5444 +sb_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
5445 +{
5446 +       pci_config_regs *cfg;
5447 +
5448 +       if (dev >= SB_MAXCORES || (off + len) > sizeof(pci_config_regs))
5449 +               return -1;
5450 +       cfg = &sb_config_regs[dev];
5451 +
5452 +       ASSERT(ISALIGNED(off, len));
5453 +       ASSERT(ISALIGNED(buf, len));
5454 +
5455 +       if (len == 4)
5456 +               *((uint32 *) buf) = ltoh32(*((uint32 *)((ulong) cfg + off)));
5457 +       else if (len == 2)
5458 +               *((uint16 *) buf) = ltoh16(*((uint16 *)((ulong) cfg + off)));
5459 +       else if (len == 1)
5460 +               *((uint8 *) buf) = *((uint8 *)((ulong) cfg + off));
5461 +       else
5462 +               return -1;
5463 +
5464 +       return 0;
5465 +}
5466 +
5467 +static int
5468 +sb_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
5469 +{
5470 +       uint coreidx, n;
5471 +       void *regs;
5472 +       sbconfig_t *sb;
5473 +       pci_config_regs *cfg;
5474 +
5475 +       if (dev >= SB_MAXCORES || (off + len) > sizeof(pci_config_regs))
5476 +               return -1;
5477 +       cfg = &sb_config_regs[dev];
5478 +
5479 +       ASSERT(ISALIGNED(off, len));
5480 +       ASSERT(ISALIGNED(buf, len));
5481 +
5482 +       /* Emulate BAR sizing */
5483 +       if (off >= OFFSETOF(pci_config_regs, base[0]) && off <= OFFSETOF(pci_config_regs, base[3]) &&
5484 +           len == 4 && *((uint32 *) buf) == ~0) {
5485 +               coreidx = sb_coreidx(sbh);
5486 +               if ((regs = sb_setcoreidx(sbh, dev))) {
5487 +                       sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
5488 +                       /* Highest numbered address match register */
5489 +                       n = (R_REG(&sb->sbidlow) & SBIDL_AR_MASK) >> SBIDL_AR_SHIFT;
5490 +                       if (off == OFFSETOF(pci_config_regs, base[0]))
5491 +                               cfg->base[0] = ~(sb_size(R_REG(&sb->sbadmatch0)) - 1);
5492 +                       /*else if (off == OFFSETOF(pci_config_regs, base[1]) && n >= 1)
5493 +                               cfg->base[1] = ~(sb_size(R_REG(&sb->sbadmatch1)) - 1);
5494 +                       else if (off == OFFSETOF(pci_config_regs, base[2]) && n >= 2)
5495 +                               cfg->base[2] = ~(sb_size(R_REG(&sb->sbadmatch2)) - 1);
5496 +                       else if (off == OFFSETOF(pci_config_regs, base[3]) && n >= 3)
5497 +                               cfg->base[3] = ~(sb_size(R_REG(&sb->sbadmatch3)) - 1);*/
5498 +               }
5499 +               sb_setcoreidx(sbh, coreidx);
5500 +               return 0;
5501 +       }
5502 +
5503 +       if (len == 4)
5504 +               *((uint32 *)((ulong) cfg + off)) = htol32(*((uint32 *) buf));
5505 +       else if (len == 2)
5506 +               *((uint16 *)((ulong) cfg + off)) = htol16(*((uint16 *) buf));
5507 +       else if (len == 1)
5508 +               *((uint8 *)((ulong) cfg + off)) = *((uint8 *) buf);
5509 +       else
5510 +               return -1;
5511 +
5512 +       return 0;
5513 +}
5514 +
5515 +int
5516 +sbpci_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
5517 +{
5518 +       if (bus == 0)
5519 +               return sb_read_config(sbh, bus, dev, func, off, buf, len);
5520 +       else
5521 +               return extpci_read_config(sbh, bus, dev, func, off, buf, len);
5522 +}
5523 +
5524 +int
5525 +sbpci_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
5526 +{
5527 +       if (bus == 0)
5528 +               return sb_write_config(sbh, bus, dev, func, off, buf, len);
5529 +       else
5530 +               return extpci_write_config(sbh, bus, dev, func, off, buf, len);
5531 +}
5532 +
5533 +void
5534 +sbpci_ban(uint16 core)
5535 +{
5536 +       if (pci_banned < ARRAYSIZE(pci_ban))
5537 +               pci_ban[pci_banned++] = core;
5538 +}
5539 +
5540 +int __init
5541 +sbpci_init(void *sbh)
5542 +{
5543 +       uint chip, chiprev, chippkg, coreidx, host, i;
5544 +       sbpciregs_t *pci;
5545 +       sbconfig_t *sb;
5546 +       pci_config_regs *cfg;
5547 +       void *regs;
5548 +       char varname[8];
5549 +       uint wlidx = 0;
5550 +       uint16 vendor, core;
5551 +       uint8 class, subclass, progif;
5552 +       uint32 val;
5553 +       uint32 sbips_int_mask[] = { 0, SBIPS_INT1_MASK, SBIPS_INT2_MASK, SBIPS_INT3_MASK, SBIPS_INT4_MASK };
5554 +       uint32 sbips_int_shift[] = { 0, 0, SBIPS_INT2_SHIFT, SBIPS_INT3_SHIFT, SBIPS_INT4_SHIFT };
5555 +
5556 +       chip = sb_chip(sbh);
5557 +       chiprev = sb_chiprev(sbh);
5558 +       chippkg = sb_chippkg(sbh);
5559 +       coreidx = sb_coreidx(sbh);
5560 +
5561 +       if (!(pci = (sbpciregs_t *) sb_setcore(sbh, SB_PCI, 0)))
5562 +               return -1;
5563 +       sb_core_reset(sbh, 0);
5564 +
5565 +       if (((chip == BCM4310_DEVICE_ID) && (chiprev == 0)) ||
5566 +           ((chip == BCM4712_DEVICE_ID) && (chippkg == BCM4712SMALL_PKG_ID)))
5567 +               host = 0;
5568 +       else
5569 +               host = !BUSPROBE(val, &pci->control);
5570 +
5571 +       if (!host) {
5572 +               /* Disable PCI interrupts in client mode */
5573 +               sb = (sbconfig_t *)((ulong) pci + SBCONFIGOFF);
5574 +               W_REG(&sb->sbintvec, 0);
5575 +
5576 +               /* Disable the PCI bridge in client mode */
5577 +               sbpci_ban(SB_PCI);
5578 +               printf("PCI: Disabled\n");
5579 +       } else {
5580 +               /* Reset the external PCI bus and enable the clock */
5581 +               W_REG(&pci->control, 0x5);              /* enable the tristate drivers */
5582 +               W_REG(&pci->control, 0xd);              /* enable the PCI clock */
5583 +               OSL_DELAY(100);                         /* delay 100 us */
5584 +               W_REG(&pci->control, 0xf);              /* deassert PCI reset */
5585 +               W_REG(&pci->arbcontrol, PCI_INT_ARB);   /* use internal arbiter */
5586 +               OSL_DELAY(1);                           /* delay 1 us */
5587 +
5588 +               /* Enable CardBusMode */
5589 +               cardbus = nvram_match("cardbus", "1");
5590 +               if (cardbus) {
5591 +                       printf("PCI: Enabling CardBus\n");
5592 +                       /* GPIO 1 resets the CardBus device on bcm94710ap */
5593 +                       sb_gpioout(sbh, 1, 1);
5594 +                       sb_gpioouten(sbh, 1, 1);
5595 +                       W_REG(&pci->sprom[0], R_REG(&pci->sprom[0]) | 0x400);
5596 +               }
5597 +
5598 +               /* 64 MB I/O access window */
5599 +               W_REG(&pci->sbtopci0, SBTOPCI_IO);
5600 +               /* 64 MB configuration access window */
5601 +               W_REG(&pci->sbtopci1, SBTOPCI_CFG0);
5602 +               /* 1 GB memory access window */
5603 +               W_REG(&pci->sbtopci2, SBTOPCI_MEM | SB_PCI_DMA);
5604 +
5605 +               /* Enable PCI bridge BAR0 prefetch and burst */
5606 +               val = 6;
5607 +               sbpci_write_config(sbh, 1, 0, 0, PCI_CFG_CMD, &val, sizeof(val));
5608 +
5609 +               /* Enable PCI interrupts */
5610 +               W_REG(&pci->intmask, PCI_INTA);
5611 +       }
5612 +
5613 +       /* Scan the SB bus */
5614 +       bzero(sb_config_regs, sizeof(sb_config_regs));
5615 +       for (cfg = sb_config_regs; cfg < &sb_config_regs[SB_MAXCORES]; cfg++) {
5616 +               cfg->vendor = 0xffff;
5617 +               if (!(regs = sb_setcoreidx(sbh, cfg - sb_config_regs)))
5618 +                       continue;
5619 +               sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
5620 +
5621 +               /* Read ID register and parse vendor and core */
5622 +               val = R_REG(&sb->sbidhigh);
5623 +               vendor = (val & SBIDH_VC_MASK) >> SBIDH_VC_SHIFT;
5624 +               core = (val & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT;
5625 +               progif = 0;
5626 +
5627 +               /* Check if this core is banned */
5628 +               for (i = 0; i < pci_banned; i++)
5629 +                       if (core == pci_ban[i])
5630 +                               break;
5631 +               if (i < pci_banned)
5632 +                       continue;
5633 +
5634 +               /* Known vendor translations */
5635 +               switch (vendor) {
5636 +               case SB_VEND_BCM:
5637 +                       vendor = VENDOR_BROADCOM;
5638 +                       break;
5639 +               }
5640 +
5641 +               /* Determine class based on known core codes */
5642 +               switch (core) {
5643 +               case SB_ILINE20:
5644 +                       class = PCI_CLASS_NET;
5645 +                       subclass = PCI_NET_ETHER;
5646 +                       core = BCM47XX_ILINE_ID;
5647 +                       break;
5648 +               case SB_ILINE100:
5649 +                       class = PCI_CLASS_NET;
5650 +                       subclass = PCI_NET_ETHER;
5651 +                       core = BCM4610_ILINE_ID;
5652 +                       break;
5653 +               case SB_ENET:
5654 +                       class = PCI_CLASS_NET;
5655 +                       subclass = PCI_NET_ETHER;
5656 +                       core = BCM47XX_ENET_ID;
5657 +                       break;
5658 +               case SB_SDRAM:
5659 +               case SB_MEMC:
5660 +                       class = PCI_CLASS_MEMORY;
5661 +                       subclass = PCI_MEMORY_RAM;
5662 +                       break;
5663 +               case SB_PCI:
5664 +                       class = PCI_CLASS_BRIDGE;
5665 +                       subclass = PCI_BRIDGE_PCI;
5666 +                       //break;
5667 +               case SB_MIPS:
5668 +               case SB_MIPS33:
5669 +                       class = PCI_CLASS_CPU;
5670 +                       subclass = PCI_CPU_MIPS;
5671 +                       break;
5672 +               case SB_CODEC:
5673 +                       class = PCI_CLASS_COMM;
5674 +                       subclass = PCI_COMM_MODEM;
5675 +                       core = BCM47XX_V90_ID;
5676 +                       break;
5677 +               case SB_USB:
5678 +                       class = PCI_CLASS_SERIAL;
5679 +                       subclass = PCI_SERIAL_USB;
5680 +                       progif = 0x10; /* OHCI */
5681 +                       core = BCM47XX_USB_ID;
5682 +                       break;
5683 +               case SB_USB11H:
5684 +                       class = PCI_CLASS_SERIAL;
5685 +                       subclass = PCI_SERIAL_USB;
5686 +                       progif = 0x10; /* OHCI */
5687 +                       core = BCM47XX_USBH_ID;
5688 +                       break;
5689 +               case SB_USB11D:
5690 +                       class = PCI_CLASS_SERIAL;
5691 +                       subclass = PCI_SERIAL_USB;
5692 +                       core = BCM47XX_USBD_ID;
5693 +                       break;
5694 +               case SB_IPSEC:
5695 +                       class = PCI_CLASS_CRYPT;
5696 +                       subclass = PCI_CRYPT_NETWORK;
5697 +                       core = BCM47XX_IPSEC_ID;
5698 +                       break;
5699 +               case SB_EXTIF:
5700 +               case SB_CC:
5701 +                       class = PCI_CLASS_MEMORY;
5702 +                       subclass = PCI_MEMORY_FLASH;
5703 +                       break;
5704 +               case SB_D11:
5705 +                       class = PCI_CLASS_NET;
5706 +                       subclass = PCI_NET_OTHER;
5707 +                       /* Let an nvram variable override this */
5708 +                       sprintf(varname, "wl%did", wlidx);
5709 +                       wlidx++;
5710 +                       if ((core = getintvar(NULL, varname)) == 0) {
5711 +                               if (chip == BCM4712_DEVICE_ID) {
5712 +                                       if (chippkg == BCM4712SMALL_PKG_ID)
5713 +                                               core = BCM4306_D11G_ID;
5714 +                                       else
5715 +                                               core = BCM4306_D11DUAL_ID;
5716 +                               } else {
5717 +                                       /* 4310 */
5718 +                                       core = BCM4310_D11B_ID;
5719 +                               }
5720 +                       }
5721 +                       break;
5722 +
5723 +               default:
5724 +                       class = subclass = progif = 0xff;
5725 +                       break;
5726 +               }
5727 +
5728 +               /* Supported translations */
5729 +               cfg->vendor = htol16(vendor);
5730 +               cfg->device = htol16(core);
5731 +               cfg->rev_id = chiprev;
5732 +               cfg->prog_if = progif;
5733 +               cfg->sub_class = subclass;
5734 +               cfg->base_class = class;
5735 +               cfg->base[0] = htol32(sb_base(R_REG(&sb->sbadmatch0)));
5736 +               cfg->base[1] = 0/*htol32(sb_base(R_REG(&sb->sbadmatch1)))*/;
5737 +               cfg->base[2] = 0/*htol32(sb_base(R_REG(&sb->sbadmatch2)))*/;
5738 +               cfg->base[3] = 0/*htol32(sb_base(R_REG(&sb->sbadmatch3)))*/;
5739 +               cfg->base[4] = 0;
5740 +               cfg->base[5] = 0;
5741 +               if (class == PCI_CLASS_BRIDGE && subclass == PCI_BRIDGE_PCI)
5742 +                       cfg->header_type = PCI_HEADER_BRIDGE;
5743 +               else
5744 +                       cfg->header_type = PCI_HEADER_NORMAL;
5745 +               /* Save core interrupt flag */
5746 +               cfg->int_pin = R_REG(&sb->sbtpsflag) & SBTPS_NUM0_MASK;
5747 +               /* Default to MIPS shared interrupt 0 */
5748 +               cfg->int_line = 0;
5749 +               /* MIPS sbipsflag maps core interrupt flags to interrupts 1 through 4 */
5750 +               if ((regs = sb_setcore(sbh, SB_MIPS, 0)) ||
5751 +                   (regs = sb_setcore(sbh, SB_MIPS33, 0))) {
5752 +                       sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
5753 +                       val = R_REG(&sb->sbipsflag);
5754 +                       for (cfg->int_line = 1; cfg->int_line <= 4; cfg->int_line++) {
5755 +                               if (((val & sbips_int_mask[cfg->int_line]) >> sbips_int_shift[cfg->int_line]) == cfg->int_pin)
5756 +                                       break;
5757 +                       }
5758 +                       if (cfg->int_line > 4)
5759 +                               cfg->int_line = 0;
5760 +               }
5761 +               /* Emulated core */
5762 +               *((uint32 *) &cfg->sprom_control) = 0xffffffff;
5763 +       }
5764 +
5765 +       sb_setcoreidx(sbh, coreidx);
5766 +       return 0;
5767 +}
5768 +
5769 +void
5770 +sbpci_check(void *sbh)
5771 +{
5772 +       uint coreidx;
5773 +       sbpciregs_t *pci;
5774 +       uint32 sbtopci1;
5775 +       uint32 buf[64], *ptr, i;
5776 +       ulong pa;
5777 +       volatile uint j;
5778 +
5779 +       coreidx = sb_coreidx(sbh);
5780 +       pci = (sbpciregs_t *) sb_setcore(sbh, SB_PCI, 0);
5781 +
5782 +       /* Clear the test array */
5783 +       pa = (ulong) DMA_MAP(NULL, buf, sizeof(buf), DMA_RX, NULL);
5784 +       ptr = (uint32 *) OSL_UNCACHED(&buf[0]);
5785 +       memset(ptr, 0, sizeof(buf));
5786 +
5787 +       /* Point PCI window 1 to memory */
5788 +       sbtopci1 = R_REG(&pci->sbtopci1);
5789 +       W_REG(&pci->sbtopci1, SBTOPCI_MEM | (pa & SBTOPCI1_MASK));
5790 +
5791 +       /* Fill the test array via PCI window 1 */
5792 +       ptr = (uint32 *) REG_MAP(SB_PCI_CFG + (pa & ~SBTOPCI1_MASK), sizeof(buf));
5793 +       for (i = 0; i < ARRAYSIZE(buf); i++) {
5794 +               for (j = 0; j < 2; j++);
5795 +               W_REG(&ptr[i], i);
5796 +       }
5797 +       REG_UNMAP(ptr);
5798 +
5799 +       /* Restore PCI window 1 */
5800 +       W_REG(&pci->sbtopci1, sbtopci1);
5801 +
5802 +       /* Check the test array */
5803 +       DMA_UNMAP(NULL, pa, sizeof(buf), DMA_RX, NULL);
5804 +       ptr = (uint32 *) OSL_UNCACHED(&buf[0]);
5805 +       for (i = 0; i < ARRAYSIZE(buf); i++) {
5806 +               if (ptr[i] != i)
5807 +                       break;
5808 +       }
5809 +
5810 +       /* Change the clock if the test fails */
5811 +       if (i < ARRAYSIZE(buf)) {
5812 +               uint32 req, cur;
5813 +
5814 +               cur = sb_clock(sbh);
5815 +               printf("PCI: Test failed at %d MHz\n", (cur + 500000) / 1000000);
5816 +               for (req = 104000000; req < 176000000; req += 4000000) {
5817 +                       printf("PCI: Resetting to %d MHz\n", (req + 500000) / 1000000);
5818 +                       /* This will only reset if the clocks are valid and have changed */
5819 +                       sb_mips_setclock(sbh, req, 0, 0);
5820 +               }
5821 +               /* Should not reach here */
5822 +               ASSERT(0);
5823 +       }
5824 +
5825 +       sb_setcoreidx(sbh, coreidx);
5826 +}
5827 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/sbutils.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/sbutils.c
5828 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/sbutils.c        1970-01-01 01:00:00.000000000 +0100
5829 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/sbutils.c   2005-08-28 11:12:20.482851248 +0200
5830 @@ -0,0 +1,1895 @@
5831 +/*
5832 + * Misc utility routines for accessing chip-specific features
5833 + * of the SiliconBackplane-based Broadcom chips.
5834 + *
5835 + * Copyright 2001-2003, Broadcom Corporation
5836 + * All Rights Reserved.
5837 + * 
5838 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
5839 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
5840 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
5841 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
5842 + *
5843 + * $Id: sbutils.c,v 1.1 2005/02/28 13:33:32 jolt Exp $
5844 + */
5845 +
5846 +#include <typedefs.h>
5847 +#include <osl.h>
5848 +#include <bcmutils.h>
5849 +#include <bcmdevs.h>
5850 +#include <sbconfig.h>
5851 +#include <sbchipc.h>
5852 +#include <sbpci.h>
5853 +#include <pcicfg.h>
5854 +#include <sbpcmcia.h>
5855 +#include <sbextif.h>
5856 +#include <sbutils.h>
5857 +#include <bcmsrom.h>
5858 +
5859 +/* debug/trace */
5860 +#define        SB_ERROR(args)
5861 +
5862 +typedef uint32 (*sb_intrsoff_t)(void *intr_arg);
5863 +typedef void (*sb_intrsrestore_t)(void *intr_arg, uint32 arg);
5864 +
5865 +/* misc sb info needed by some of the routines */
5866 +typedef struct sb_info {
5867 +       uint    chip;                   /* chip number */
5868 +       uint    chiprev;                /* chip revision */
5869 +       uint    chippkg;                /* chip package option */
5870 +       uint    boardtype;              /* board type */
5871 +       uint    boardvendor;            /* board vendor id */
5872 +       uint    bus;                    /* what bus type we are going through */
5873 +
5874 +       void    *osh;                   /* osl os handle */
5875 +       void    *sdh;                   /* bcmsdh handle */
5876 +
5877 +       void    *curmap;                /* current regs va */
5878 +       void    *regs[SB_MAXCORES];     /* other regs va */
5879 +
5880 +       uint    curidx;                 /* current core index */
5881 +       uint    dev_coreid;             /* the core provides driver functions */
5882 +       uint    pciidx;                 /* pci core index */
5883 +       uint    pcirev;                 /* pci core rev */
5884 +
5885 +       uint    pcmciaidx;              /* pcmcia core index */
5886 +       uint    pcmciarev;              /* pcmcia core rev */
5887 +       bool    memseg;                 /* flag to toggle MEM_SEG register */
5888 +
5889 +       uint    ccrev;                  /* chipc core rev */
5890 +
5891 +       uint    gpioidx;                /* gpio control core index */
5892 +       uint    gpioid;                 /* gpio control coretype */
5893 +
5894 +       uint    numcores;               /* # discovered cores */
5895 +       uint    coreid[SB_MAXCORES];    /* id of each core */
5896 +
5897 +       void    *intr_arg;              /* interrupt callback function arg */
5898 +       sb_intrsoff_t           intrsoff_fn;            /* function turns chip interrupts off */
5899 +       sb_intrsrestore_t       intrsrestore_fn;        /* function restore chip interrupts */
5900 +} sb_info_t;
5901 +
5902 +/* local prototypes */
5903 +static void* sb_doattach(sb_info_t *si, uint devid, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz);
5904 +static void sb_scan(sb_info_t *si);
5905 +static uint sb_corereg(void *sbh, uint coreidx, uint regoff, uint mask, uint val);
5906 +static uint _sb_coreidx(void *sbh);
5907 +static uint sb_findcoreidx(void *sbh, uint coreid, uint coreunit);
5908 +static uint sb_pcidev2chip(uint pcidev);
5909 +static uint sb_chip2numcores(uint chip);
5910 +
5911 +#define        SB_INFO(sbh)    (sb_info_t*)sbh
5912 +#define        SET_SBREG(sbh, r, mask, val)    W_SBREG((sbh), (r), ((R_SBREG((sbh), (r)) & ~(mask)) | (val)))
5913 +#define        GOODCOREADDR(x) (((x) >= SB_ENUM_BASE) && ((x) <= SB_ENUM_LIM) \
5914 +                               && ISALIGNED((x), SB_CORE_SIZE))
5915 +#define        GOODREGS(regs)  (regs && ISALIGNED(regs, SB_CORE_SIZE))
5916 +#define        REGS2SB(va)     (sbconfig_t*) ((uint)(va) + SBCONFIGOFF)
5917 +#define        GOODIDX(idx)    (((uint)idx) < SB_MAXCORES)
5918 +#define        BADIDX          (SB_MAXCORES+1)
5919 +
5920 +#define        R_SBREG(sbh, sbr)       sb_read_sbreg((sbh), (sbr))
5921 +#define        W_SBREG(sbh, sbr, v)    sb_write_sbreg((sbh), (sbr), (v))
5922 +#define        AND_SBREG(sbh, sbr, v)  W_SBREG((sbh), (sbr), (R_SBREG((sbh), (sbr)) & (v)))
5923 +#define        OR_SBREG(sbh, sbr, v)   W_SBREG((sbh), (sbr), (R_SBREG((sbh), (sbr)) | (v)))
5924 +
5925 +/* 
5926 + * Macros to disable/restore function core(D11, ENET, ILINE20, etc) interrupts before/
5927 + * after core switching to avoid invalid register accesss inside ISR.
5928 + */
5929 +#define INTR_OFF(si, intr_val) \
5930 +       if ((si)->intrsoff_fn && (si)->coreid[(si)->curidx] == (si)->dev_coreid) {      \
5931 +               intr_val = (*(si)->intrsoff_fn)((si)->intr_arg); }
5932 +#define INTR_RESTORE(si, intr_val) \
5933 +       if ((si)->intrsrestore_fn && (si)->coreid[(si)->curidx] == (si)->dev_coreid) {  \
5934 +               (*(si)->intrsrestore_fn)((si)->intr_arg, intr_val); }
5935 +
5936 +/* power control defines */
5937 +#define        PLL_DELAY       150                     /* 150us pll on delay */
5938 +#define        FREF_DELAY      15                      /* 15us fref change delay */
5939 +#define        LPOMINFREQ      25000                   /* low power oscillator min */
5940 +#define        LPOMAXFREQ      43000                   /* low power oscillator max */
5941 +#define        XTALMINFREQ     19800000                /* 20mhz - 1% */
5942 +#define        XTALMAXFREQ     20200000                /* 20mhz + 1% */
5943 +#define        PCIMINFREQ      25000000                /* 25mhz */
5944 +#define        PCIMAXFREQ      34000000                /* 33mhz + fudge */
5945 +
5946 +#define SCC_LOW2FAST_LIMIT     5000    /* turn on fast clock time, in unit of ms */
5947 +
5948 +
5949 +static uint32
5950 +sb_read_sbreg(void *sbh, volatile uint32 *sbr)
5951 +{
5952 +       sb_info_t *si;
5953 +       uint8 tmp;
5954 +       uint32 val, intr_val = 0;
5955 +
5956 +       si = SB_INFO(sbh);
5957 +
5958 +       /* 
5959 +        * compact flash only has 11 bits address, while we needs 12 bits address.
5960 +        * MEM_SEG will be OR'd with other 11 bits address in hardware, 
5961 +        * so we program MEM_SEG with 12th bit when necessary(access sb regsiters).
5962 +        * For normal PCMCIA bus(CFTable_regwinsz > 2k), do nothing special
5963 +        */
5964 +       if(si->memseg) {
5965 +               INTR_OFF(si, intr_val);
5966 +               tmp = 1;
5967 +               OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1);
5968 +               (uint32)sbr &= ~(1 << 11);      /* mask out bit 11*/
5969 +       }
5970 +
5971 +       val = R_REG(sbr);
5972 +       
5973 +       if(si->memseg) {
5974 +               tmp = 0;
5975 +               OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1);
5976 +               INTR_RESTORE(si, intr_val);
5977 +       }
5978 +
5979 +       return (val);
5980 +}
5981 +
5982 +static void
5983 +sb_write_sbreg(void *sbh, volatile uint32 *sbr, uint32 v)
5984 +{
5985 +       sb_info_t *si;
5986 +       uint8 tmp;
5987 +       volatile uint32 dummy;
5988 +       uint32 intr_val = 0;
5989 +
5990 +       si = SB_INFO(sbh);
5991 +
5992 +       /* 
5993 +        * compact flash only has 11 bits address, while we needs 12 bits address.
5994 +        * MEM_SEG will be OR'd with other 11 bits address in hardware, 
5995 +        * so we program MEM_SEG with 12th bit when necessary(access sb regsiters).
5996 +        * For normal PCMCIA bus(CFTable_regwinsz > 2k), do nothing special 
5997 +        */
5998 +       if(si->memseg) {
5999 +               INTR_OFF(si, intr_val);
6000 +               tmp = 1;
6001 +               OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1);
6002 +               (uint32)sbr &= ~(1 << 11);      /* mask out bit 11 */
6003 +       }
6004 +
6005 +       if ((si->bus == PCMCIA_BUS) || (si->bus == PCI_BUS)) {
6006 +#ifdef IL_BIGENDIAN
6007 +               dummy = R_REG(sbr);
6008 +               W_REG((volatile uint16 *)((uint32)sbr + 2), (uint16)((v >> 16) & 0xffff));
6009 +               dummy = R_REG(sbr);
6010 +               W_REG((volatile uint16 *)sbr, (uint16)(v & 0xffff));
6011 +#else
6012 +               dummy = R_REG(sbr);
6013 +               W_REG((volatile uint16 *)sbr, (uint16)(v & 0xffff));
6014 +               dummy = R_REG(sbr);
6015 +               W_REG((volatile uint16 *)((uint32)sbr + 2), (uint16)((v >> 16) & 0xffff));
6016 +#endif
6017 +       } else
6018 +               W_REG(sbr, v);
6019 +
6020 +       if(si->memseg) {
6021 +               tmp = 0;
6022 +               OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1);
6023 +               INTR_RESTORE(si, intr_val);
6024 +       }
6025 +}
6026 +
6027 +/*
6028 + * Allocate a sb handle.
6029 + * devid - pci device id (used to determine chip#)
6030 + * osh - opaque OS handle
6031 + * regs - virtual address of initial core registers
6032 + * bustype - pci/pcmcia/sb/sdio/etc
6033 + * vars - pointer to a pointer area for "environment" variables
6034 + * varsz - pointer to int to return the size of the vars
6035 + */
6036 +void*
6037 +sb_attach(uint devid, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz)
6038 +{
6039 +       sb_info_t *si;
6040 +
6041 +       /* alloc sb_info_t */
6042 +       if ((si = MALLOC(sizeof (sb_info_t))) == NULL) {
6043 +               SB_ERROR(("sb_attach: malloc failed!\n"));
6044 +               return (NULL);
6045 +       }
6046 +
6047 +       return (sb_doattach(si, devid, osh, regs, bustype, sdh, vars, varsz));
6048 +}
6049 +
6050 +/* global kernel resource */
6051 +static sb_info_t ksi;
6052 +
6053 +/* generic kernel variant of sb_attach() */
6054 +void*
6055 +sb_kattach()
6056 +{
6057 +       uint32 *regs;
6058 +       char *unused;
6059 +       int varsz;
6060 +
6061 +       if (ksi.curmap == NULL) {
6062 +               uint32 cid;
6063 +               regs = (uint32 *)REG_MAP(SB_ENUM_BASE, SB_CORE_SIZE);
6064 +               cid = R_REG((uint32 *)regs);
6065 +               if ((cid == 0x08104712) || (cid == 0x08114712)) {
6066 +                       uint32 *scc, val;
6067 +
6068 +                       scc = (uint32 *)((uint32)regs + OFFSETOF(chipcregs_t, slow_clk_ctl));
6069 +                       val = R_REG(scc);
6070 +                       SB_ERROR(("    initial scc = 0x%x\n", val));
6071 +                       val |= SCC_SS_XTAL;
6072 +                       W_REG(scc, val);
6073 +               }
6074 +
6075 +               sb_doattach(&ksi, BCM4710_DEVICE_ID, NULL, (void*)regs,
6076 +                           SB_BUS, NULL, &unused, &varsz);
6077 +       }
6078 +
6079 +       return &ksi;
6080 +}
6081 +
6082 +static void*
6083 +sb_doattach(sb_info_t *si, uint devid, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz)
6084 +{
6085 +       uint origidx;
6086 +       chipcregs_t *cc;
6087 +       uint32 w;
6088 +
6089 +       ASSERT(GOODREGS(regs));
6090 +
6091 +       bzero((uchar*)si, sizeof (sb_info_t));
6092 +
6093 +       si->pciidx = si->gpioidx = BADIDX;
6094 +
6095 +       si->osh = osh;
6096 +       si->curmap = regs;
6097 +       si->sdh = sdh;
6098 +
6099 +       /* 4317A0 PCMCIA is no longer supported */ 
6100 +       if ((bustype == PCMCIA_BUS) && (R_REG((uint32 *)regs) == 0x04104317))
6101 +               return NULL;
6102 +
6103 +       /* check to see if we are a sb core mimic'ing a pci core */
6104 +       if (bustype == PCI_BUS) {
6105 +               if (OSL_PCI_READ_CONFIG(osh, PCI_SPROM_CONTROL, sizeof (uint32)) == 0xffffffff)
6106 +                       bustype = SB_BUS;
6107 +               else
6108 +                       bustype = PCI_BUS;
6109 +       }
6110 +
6111 +       si->bus = bustype;
6112 +
6113 +       /* kludge to enable the clock on the 4306 which lacks a slowclock */
6114 +       if (si->bus == PCI_BUS)
6115 +               sb_pwrctl_xtal((void*)si, XTAL|PLL, ON);
6116 +
6117 +       /* clear any previous epidiag-induced target abort */
6118 +       sb_taclear((void*)si);
6119 +
6120 +       /* initialize current core index value */
6121 +       si->curidx = _sb_coreidx((void*)si);
6122 +
6123 +       /* keep and reuse the initial register mapping */
6124 +       origidx = si->curidx;
6125 +       if (si->bus == SB_BUS)
6126 +               si->regs[origidx] = regs;
6127 +
6128 +       /* initialize the vars */
6129 +       if (srom_var_init(si->bus, si->curmap, osh, vars, varsz)) {
6130 +               SB_ERROR(("sb_attach: srom_var_init failed\n"));
6131 +               goto bad;
6132 +       }
6133 +       
6134 +       if (si->bus == PCMCIA_BUS) {
6135 +               w = getintvar(*vars, "regwindowsz");
6136 +               si->memseg = (w <= CFTABLE_REGWIN_2K) ? TRUE : FALSE;
6137 +       }
6138 +
6139 +       /* is core-0 a chipcommon core? */
6140 +       si->numcores = 1;
6141 +       cc = (chipcregs_t*) sb_setcoreidx((void*)si, 0);
6142 +       if (sb_coreid((void*)si) != SB_CC)
6143 +               cc = NULL;
6144 +
6145 +       /* determine chip id and rev */
6146 +       if (cc) {
6147 +               /* chip common core found! */
6148 +               si->chip = R_REG(&cc->chipid) & CID_ID_MASK;
6149 +               si->chiprev = (R_REG(&cc->chipid) & CID_REV_MASK) >> CID_REV_SHIFT;
6150 +               si->chippkg = (R_REG(&cc->chipid) & CID_PKG_MASK) >> CID_PKG_SHIFT;
6151 +       } else {
6152 +               /* without chip common core, get devid for PCMCIA */
6153 +               if (si->bus == PCMCIA_BUS)
6154 +                       devid = getintvar(*vars, "devid");
6155 +
6156 +               /* no chip common core -- must convert device id to chip id */
6157 +               if ((si->chip = sb_pcidev2chip(devid)) == 0) {
6158 +                       SB_ERROR(("sb_attach: unrecognized device id 0x%04x\n", devid));
6159 +                       goto bad;
6160 +               }
6161 +
6162 +               /*
6163 +                * The chip revision number is hardwired into all
6164 +                * of the pci function config rev fields and is
6165 +                * independent from the individual core revision numbers.
6166 +                * For example, the "A0" silicon of each chip is chip rev 0.
6167 +                * For PCMCIA we get it from the CIS instead.
6168 +                */
6169 +               if (si->bus == PCMCIA_BUS) {
6170 +                       ASSERT(vars);
6171 +                       si->chiprev = getintvar(*vars, "chiprev");
6172 +               } else if (si->bus == PCI_BUS) {
6173 +                       w = OSL_PCI_READ_CONFIG(osh, PCI_CFG_REV, sizeof (uint32));
6174 +                       si->chiprev = w & 0xff;
6175 +               } else
6176 +                       si->chiprev = 0;
6177 +       }
6178 +
6179 +       /* get chipcommon rev */
6180 +       si->ccrev = cc? sb_corerev((void*)si) : 0;
6181 +       
6182 +       /* determine numcores */
6183 +       if ((si->ccrev == 4) || (si->ccrev >= 6))
6184 +               si->numcores = (R_REG(&cc->chipid) & CID_CC_MASK) >> CID_CC_SHIFT;
6185 +       else
6186 +               si->numcores = sb_chip2numcores(si->chip);
6187 +
6188 +       /* return to original core */
6189 +       sb_setcoreidx((void*)si, origidx);
6190 +
6191 +       /* sanity checks */
6192 +       ASSERT(si->chip);
6193 +       /* 4704A1 is chiprev 8 :-( */
6194 +       ASSERT((si->chiprev < 8) ||
6195 +              ((si->chip == BCM4704_DEVICE_ID) && ((si->chiprev == 8))));
6196 +
6197 +       /* scan for cores */
6198 +       sb_scan(si);
6199 +
6200 +       /* pci core is required */
6201 +       if (!GOODIDX(si->pciidx)) {
6202 +               SB_ERROR(("sb_attach: pci core not found\n"));
6203 +               goto bad;
6204 +       }
6205 +
6206 +       /* gpio control core is required */
6207 +       if (!GOODIDX(si->gpioidx)) {
6208 +               SB_ERROR(("sb_attach: gpio control core not found\n"));
6209 +               goto bad;
6210 +       }
6211 +
6212 +       /* get boardtype and boardrev */
6213 +       switch (si->bus) {
6214 +       case PCI_BUS:
6215 +               /* do a pci config read to get subsystem id and subvendor id */
6216 +               w = OSL_PCI_READ_CONFIG(osh, PCI_CFG_SVID, sizeof (uint32));
6217 +               si->boardvendor = w & 0xffff;
6218 +               si->boardtype = (w >> 16) & 0xffff;
6219 +               break;
6220 +
6221 +       case PCMCIA_BUS:
6222 +       case SDIO_BUS:
6223 +               si->boardvendor = getintvar(*vars, "manfid");
6224 +               si->boardtype = getintvar(*vars, "prodid");
6225 +               break;
6226 +
6227 +       case SB_BUS:
6228 +               si->boardvendor = VENDOR_BROADCOM;
6229 +               si->boardtype = 0xffff;
6230 +               break;
6231 +       }
6232 +
6233 +       if (si->boardtype == 0) {
6234 +               SB_ERROR(("sb_attach: unknown board type\n"));
6235 +               ASSERT(si->boardtype);
6236 +       }
6237 +
6238 +       return ((void*)si);
6239 +
6240 +bad:
6241 +       MFREE(si, sizeof (sb_info_t));
6242 +       return (NULL);
6243 +}
6244 +
6245 +uint
6246 +sb_coreid(void *sbh)
6247 +{
6248 +       sb_info_t *si;
6249 +       sbconfig_t *sb;
6250 +
6251 +       si = SB_INFO(sbh);
6252 +       sb = REGS2SB(si->curmap);
6253 +
6254 +       return ((R_SBREG(sbh, &(sb)->sbidhigh) & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT);
6255 +}
6256 +
6257 +uint
6258 +sb_coreidx(void *sbh)
6259 +{
6260 +       sb_info_t *si;
6261 +
6262 +       si = SB_INFO(sbh);
6263 +       return (si->curidx);
6264 +}
6265 +
6266 +/* return current index of core */
6267 +static uint
6268 +_sb_coreidx(void *sbh)
6269 +{
6270 +       sb_info_t *si;
6271 +       sbconfig_t *sb;
6272 +       uint32 sbaddr = 0;
6273 +
6274 +       si = SB_INFO(sbh);
6275 +       ASSERT(si);
6276 +
6277 +       switch (si->bus) {
6278 +       case SB_BUS:
6279 +               sb = REGS2SB(si->curmap);
6280 +               sbaddr = sb_base(R_SBREG(sbh, &sb->sbadmatch0));
6281 +               break;
6282 +
6283 +       case PCI_BUS:
6284 +               sbaddr = OSL_PCI_READ_CONFIG(si->osh, PCI_BAR0_WIN, sizeof (uint32));
6285 +               break;
6286 +
6287 +       case PCMCIA_BUS: {
6288 +               uint8 tmp;
6289 +
6290 +               OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_ADDR0, &tmp, 1);
6291 +               sbaddr  = (uint)tmp << 12;
6292 +               OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_ADDR1, &tmp, 1);
6293 +               sbaddr |= (uint)tmp << 16;
6294 +               OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_ADDR2, &tmp, 1);
6295 +               sbaddr |= (uint)tmp << 24;
6296 +               break;
6297 +       }
6298 +       default:
6299 +               ASSERT(0);
6300 +       }
6301 +
6302 +       ASSERT(GOODCOREADDR(sbaddr));
6303 +       return ((sbaddr - SB_ENUM_BASE)/SB_CORE_SIZE);
6304 +}
6305 +
6306 +uint
6307 +sb_corevendor(void *sbh)
6308 +{
6309 +       sb_info_t *si;
6310 +       sbconfig_t *sb;
6311 +
6312 +       si = SB_INFO(sbh);
6313 +       sb = REGS2SB(si->curmap);
6314 +
6315 +       return ((R_SBREG(sbh, &(sb)->sbidhigh) & SBIDH_VC_MASK) >> SBIDH_VC_SHIFT);
6316 +}
6317 +
6318 +uint
6319 +sb_corerev(void *sbh)
6320 +{
6321 +       sb_info_t *si;
6322 +       sbconfig_t *sb;
6323 +
6324 +       si = SB_INFO(sbh);
6325 +       sb = REGS2SB(si->curmap);
6326 +
6327 +       return (R_SBREG(sbh, &(sb)->sbidhigh) & SBIDH_RC_MASK);
6328 +}
6329 +
6330 +#define        SBTML_ALLOW     (SBTML_PE | SBTML_FGC | SBTML_FL_MASK)
6331 +
6332 +/* set/clear sbtmstatelow core-specific flags */
6333 +uint32
6334 +sb_coreflags(void *sbh, uint32 mask, uint32 val)
6335 +{
6336 +       sb_info_t *si;
6337 +       sbconfig_t *sb;
6338 +       uint32 w;
6339 +
6340 +       si = SB_INFO(sbh);
6341 +       sb = REGS2SB(si->curmap);
6342 +
6343 +       ASSERT((val & ~mask) == 0);
6344 +       ASSERT((mask & ~SBTML_ALLOW) == 0);
6345 +
6346 +       /* mask and set */
6347 +       if (mask || val) {
6348 +               w = (R_SBREG(sbh, &sb->sbtmstatelow) & ~mask) | val;
6349 +               W_SBREG(sbh, &sb->sbtmstatelow, w);
6350 +       }
6351 +
6352 +       /* return the new value */
6353 +       return (R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_ALLOW);
6354 +}
6355 +
6356 +/* set/clear sbtmstatehigh core-specific flags */
6357 +uint32
6358 +sb_coreflagshi(void *sbh, uint32 mask, uint32 val)
6359 +{
6360 +       sb_info_t *si;
6361 +       sbconfig_t *sb;
6362 +       uint32 w;
6363 +
6364 +       si = SB_INFO(sbh);
6365 +       sb = REGS2SB(si->curmap);
6366 +
6367 +       ASSERT((val & ~mask) == 0);
6368 +       ASSERT((mask & ~SBTMH_FL_MASK) == 0);
6369 +
6370 +       /* mask and set */
6371 +       if (mask || val) {
6372 +               w = (R_SBREG(sbh, &sb->sbtmstatehigh) & ~mask) | val;
6373 +               W_SBREG(sbh, &sb->sbtmstatehigh, w);
6374 +       }
6375 +
6376 +       /* return the new value */
6377 +       return (R_SBREG(sbh, &sb->sbtmstatehigh) & SBTMH_FL_MASK);
6378 +}
6379 +
6380 +bool
6381 +sb_iscoreup(void *sbh)
6382 +{
6383 +       sb_info_t *si;
6384 +       sbconfig_t *sb;
6385 +
6386 +       si = SB_INFO(sbh);
6387 +       sb = REGS2SB(si->curmap);
6388 +
6389 +       return ((R_SBREG(sbh, &(sb)->sbtmstatelow) & (SBTML_RESET | SBTML_REJ | SBTML_CLK)) == SBTML_CLK);
6390 +}
6391 +
6392 +/*
6393 + * Switch to 'coreidx', issue a single arbitrary 32bit register mask&set operation,
6394 + * switch back to the original core, and return the new value.
6395 + */
6396 +static uint
6397 +sb_corereg(void *sbh, uint coreidx, uint regoff, uint mask, uint val)
6398 +{
6399 +       sb_info_t *si;
6400 +       uint origidx;
6401 +       uint32 *r;
6402 +       uint w;
6403 +       uint intr_val = 0;
6404 +
6405 +       ASSERT(GOODIDX(coreidx));
6406 +       ASSERT(regoff < SB_CORE_SIZE);
6407 +       ASSERT((val & ~mask) == 0);
6408 +
6409 +       si = SB_INFO(sbh);
6410 +
6411 +       /* save current core index */
6412 +       origidx = sb_coreidx(sbh);
6413 +
6414 +       /* switch core */
6415 +       INTR_OFF(si, intr_val);
6416 +       r = (uint32*) ((uint) sb_setcoreidx(sbh, coreidx) + regoff);
6417 +
6418 +       /* mask and set */
6419 +       if (mask || val) {
6420 +               if (regoff >= SBCONFIGOFF) {
6421 +                       w = (R_SBREG(sbh, r) & ~mask) | val;
6422 +                       W_SBREG(sbh, r, w);
6423 +               } else {
6424 +                       w = (R_REG(r) & ~mask) | val;
6425 +                       W_REG(r, w);
6426 +               }
6427 +       }
6428 +
6429 +       /* readback */
6430 +       w = R_SBREG(sbh, r);
6431 +
6432 +       /* restore core index */
6433 +       if (origidx != coreidx)
6434 +               sb_setcoreidx(sbh, origidx);
6435 +
6436 +       INTR_RESTORE(si, intr_val);
6437 +       return (w);
6438 +}
6439 +
6440 +/* scan the sb enumerated space to identify all cores */
6441 +static void
6442 +sb_scan(sb_info_t *si)
6443 +{
6444 +       void *sbh;
6445 +       uint origidx;
6446 +       uint i;
6447 +
6448 +       sbh = (void*) si;
6449 +
6450 +       /* numcores should already be set */
6451 +       ASSERT((si->numcores > 0) && (si->numcores <= SB_MAXCORES));
6452 +
6453 +       /* save current core index */
6454 +       origidx = sb_coreidx(sbh);
6455 +
6456 +       si->pciidx = si->gpioidx = BADIDX;
6457 +
6458 +       for (i = 0; i < si->numcores; i++) {
6459 +               sb_setcoreidx(sbh, i);
6460 +               si->coreid[i] = sb_coreid(sbh);
6461 +
6462 +               if (si->coreid[i] == SB_CC)
6463 +                       si->ccrev = sb_corerev(sbh);
6464 +
6465 +               else if (si->coreid[i] == SB_PCI) {
6466 +                       si->pciidx = i;
6467 +                       si->pcirev = sb_corerev(sbh);
6468 +
6469 +               }else if (si->coreid[i] == SB_PCMCIA){
6470 +                       si->pcmciaidx = i;
6471 +                       si->pcmciarev = sb_corerev(sbh);
6472 +               }
6473 +       }
6474 +
6475 +       /*
6476 +        * Find the gpio "controlling core" type and index.
6477 +        * Precedence:
6478 +        * - if there's a chip common core - use that
6479 +        * - else if there's a pci core (rev >= 2) - use that
6480 +        * - else there had better be an extif core (4710 only)
6481 +        */
6482 +       if (GOODIDX(sb_findcoreidx(sbh, SB_CC, 0))) {
6483 +               si->gpioidx = sb_findcoreidx(sbh, SB_CC, 0);
6484 +               si->gpioid = SB_CC;
6485 +       } else if (GOODIDX(si->pciidx) && (si->pcirev >= 2)) {
6486 +               si->gpioidx = si->pciidx;
6487 +               si->gpioid = SB_PCI;
6488 +       } else if (sb_findcoreidx(sbh, SB_EXTIF, 0)) {
6489 +               si->gpioidx = sb_findcoreidx(sbh, SB_EXTIF, 0);
6490 +               si->gpioid = SB_EXTIF;
6491 +       }
6492 +
6493 +       /* return to original core index */
6494 +       sb_setcoreidx(sbh, origidx);
6495 +}
6496 +
6497 +/* may be called with core in reset */
6498 +void
6499 +sb_detach(void *sbh)
6500 +{
6501 +       sb_info_t *si;
6502 +       uint idx;
6503 +
6504 +       si = SB_INFO(sbh);
6505 +
6506 +       if (si == NULL)
6507 +               return;
6508 +
6509 +       if (si->bus == SB_BUS)
6510 +               for (idx = 0; idx < SB_MAXCORES; idx++)
6511 +                       if (si->regs[idx]) {
6512 +                               REG_UNMAP(si->regs[idx]);
6513 +                               si->regs[idx] = NULL;
6514 +                       }
6515 +
6516 +       MFREE(si, sizeof (sb_info_t));
6517 +}
6518 +
6519 +/* use pci dev id to determine chip id for chips not having a chipcommon core */
6520 +static uint
6521 +sb_pcidev2chip(uint pcidev)
6522 +{
6523 +       if ((pcidev >= BCM4710_DEVICE_ID) && (pcidev <= BCM47XX_USB_ID))
6524 +               return (BCM4710_DEVICE_ID);
6525 +       if ((pcidev >= BCM4610_DEVICE_ID) && (pcidev <= BCM4610_USB_ID))
6526 +               return (BCM4610_DEVICE_ID);
6527 +       if ((pcidev >= BCM4402_DEVICE_ID) && (pcidev <= BCM4402_V90_ID))
6528 +               return (BCM4402_DEVICE_ID);
6529 +       if ((pcidev >= BCM4307_V90_ID) && (pcidev <= BCM4307_D11B_ID))
6530 +               return (BCM4307_DEVICE_ID);
6531 +       if (pcidev == BCM4301_DEVICE_ID)
6532 +               return (BCM4301_DEVICE_ID);
6533 +
6534 +       return (0);
6535 +}
6536 +
6537 +/* convert chip number to number of i/o cores */
6538 +static uint
6539 +sb_chip2numcores(uint chip)
6540 +{
6541 +       if (chip == 0x4710)
6542 +               return (9);
6543 +       if (chip == 0x4610)
6544 +               return (9);
6545 +       if (chip == 0x4402)
6546 +               return (3);
6547 +       if ((chip == 0x4307) || (chip == 0x4301))
6548 +               return (5);
6549 +       if (chip == 0x4310)
6550 +               return (8);
6551 +       if (chip == 0x4306)     /* < 4306c0 */
6552 +               return (6);
6553 +       if (chip == 0x4704)
6554 +               return (9);
6555 +       if (chip == 0x5365)
6556 +               return (7);
6557 +
6558 +       SB_ERROR(("sb_chip2numcores: unsupported chip 0x%x\n", chip));
6559 +       ASSERT(0);
6560 +       return (1);
6561 +}
6562 +
6563 +/* return index of coreid or BADIDX if not found */
6564 +static uint
6565 +sb_findcoreidx(void *sbh, uint coreid, uint coreunit)
6566 +{
6567 +       sb_info_t *si;
6568 +       uint found;
6569 +       uint i;
6570 +
6571 +       si = SB_INFO(sbh);
6572 +       found = 0;
6573 +
6574 +       for (i = 0; i < si->numcores; i++)
6575 +               if (si->coreid[i] == coreid) {
6576 +                       if (found == coreunit)
6577 +                               return (i);
6578 +                       found++;
6579 +               }
6580 +
6581 +       return (BADIDX);
6582 +}
6583 +
6584 +/* change logical "focus" to the indiciated core */
6585 +void*
6586 +sb_setcoreidx(void *sbh, uint coreidx)
6587 +{
6588 +       sb_info_t *si;
6589 +       uint32 sbaddr;
6590 +       uint8 tmp;
6591 +
6592 +       si = SB_INFO(sbh);
6593 +
6594 +       if (coreidx >= si->numcores)
6595 +               return (NULL);
6596 +
6597 +       /*
6598 +        * If the user has provided an interrupt mask enabled function,
6599 +        * then assert interrupts are disabled before switching the core.
6600 +        */
6601 +       ASSERT((si->imf == NULL) || !(*si->imf)(si->imfarg));
6602 +
6603 +       sbaddr = SB_ENUM_BASE + (coreidx * SB_CORE_SIZE);
6604 +
6605 +       switch (si->bus) {
6606 +       case SB_BUS:
6607 +               /* map new one */
6608 +               if (!si->regs[coreidx]) {
6609 +                       si->regs[coreidx] = (void*)REG_MAP(sbaddr, SB_CORE_SIZE);
6610 +                       ASSERT(GOODREGS(si->regs[coreidx]));
6611 +               }
6612 +               si->curmap = si->regs[coreidx];
6613 +               break;
6614 +
6615 +       case PCI_BUS:
6616 +               /* point bar0 window */
6617 +               OSL_PCI_WRITE_CONFIG(si->osh, PCI_BAR0_WIN, 4, sbaddr);
6618 +               break;
6619 +
6620 +       case PCMCIA_BUS:
6621 +               tmp = (sbaddr >> 12) & 0x0f;
6622 +               OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_ADDR0, &tmp, 1);
6623 +               tmp = (sbaddr >> 16) & 0xff;
6624 +               OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_ADDR1, &tmp, 1);
6625 +               tmp = (sbaddr >> 24) & 0xff;
6626 +               OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_ADDR2, &tmp, 1);
6627 +               break;
6628 +       }
6629 +
6630 +       si->curidx = coreidx;
6631 +
6632 +       return (si->curmap);
6633 +}
6634 +
6635 +/* change logical "focus" to the indicated core */
6636 +void*
6637 +sb_setcore(void *sbh, uint coreid, uint coreunit)
6638 +{
6639 +       sb_info_t *si;
6640 +       uint idx;
6641 +
6642 +       si = SB_INFO(sbh);
6643 +
6644 +       idx = sb_findcoreidx(sbh, coreid, coreunit);
6645 +       if (!GOODIDX(idx))
6646 +               return (NULL);
6647 +
6648 +       return (sb_setcoreidx(sbh, idx));
6649 +}
6650 +
6651 +/* return chip number */
6652 +uint
6653 +sb_chip(void *sbh)
6654 +{
6655 +       sb_info_t *si;
6656 +
6657 +       si = SB_INFO(sbh);
6658 +       return (si->chip);
6659 +}
6660 +
6661 +/* return chip revision number */
6662 +uint
6663 +sb_chiprev(void *sbh)
6664 +{
6665 +       sb_info_t *si;
6666 +
6667 +       si = SB_INFO(sbh);
6668 +       return (si->chiprev);
6669 +}
6670 +
6671 +/* return chip package option */
6672 +uint
6673 +sb_chippkg(void *sbh)
6674 +{
6675 +       sb_info_t *si;
6676 +
6677 +       si = SB_INFO(sbh);
6678 +       return (si->chippkg);
6679 +}
6680 +
6681 +/* return board vendor id */
6682 +uint
6683 +sb_boardvendor(void *sbh)
6684 +{
6685 +       sb_info_t *si;
6686 +
6687 +       si = SB_INFO(sbh);
6688 +       return (si->boardvendor);
6689 +}
6690 +
6691 +/* return boardtype */
6692 +uint
6693 +sb_boardtype(void *sbh)
6694 +{
6695 +       sb_info_t *si;
6696 +       char *var;
6697 +
6698 +       si = SB_INFO(sbh);
6699 +
6700 +       if (si->bus == SB_BUS && si->boardtype == 0xffff) {
6701 +               /* boardtype format is a hex string */
6702 +               si->boardtype = getintvar(NULL, "boardtype");
6703 +
6704 +               /* backward compatibility for older boardtype string format */
6705 +               if ((si->boardtype == 0) && (var = getvar(NULL, "boardtype"))) {
6706 +                       if (!strcmp(var, "bcm94710dev"))
6707 +                               si->boardtype = BCM94710D_BOARD;
6708 +                       else if (!strcmp(var, "bcm94710ap"))
6709 +                               si->boardtype = BCM94710AP_BOARD;
6710 +                       else if (!strcmp(var, "bcm94310u"))
6711 +                               si->boardtype = BCM94310U_BOARD;
6712 +                       else if (!strcmp(var, "bu4711"))
6713 +                               si->boardtype = BU4711_BOARD;
6714 +                       else if (!strcmp(var, "bu4710"))
6715 +                               si->boardtype = BU4710_BOARD;
6716 +                       else if (!strcmp(var, "bcm94702mn"))
6717 +                               si->boardtype = BCM94702MN_BOARD;
6718 +                       else if (!strcmp(var, "bcm94710r1"))
6719 +                               si->boardtype = BCM94710R1_BOARD;
6720 +                       else if (!strcmp(var, "bcm94710r4"))
6721 +                               si->boardtype = BCM94710R4_BOARD;
6722 +                       else if (!strcmp(var, "bcm94702cpci"))
6723 +                               si->boardtype = BCM94702CPCI_BOARD;
6724 +                       else if (!strcmp(var, "bcm95380_rr"))
6725 +                               si->boardtype = BCM95380RR_BOARD; 
6726 +               }
6727 +       }
6728 +
6729 +       return (si->boardtype);
6730 +}
6731 +
6732 +/* return board bus style */
6733 +uint
6734 +sb_boardstyle(void *sbh)
6735 +{
6736 +       sb_info_t *si;
6737 +       uint16 w;
6738 +
6739 +       si = SB_INFO(sbh);
6740 +
6741 +       if (si->bus == PCMCIA_BUS)
6742 +               return (BOARDSTYLE_PCMCIA);
6743 +
6744 +       if (si->bus == SB_BUS)
6745 +               return (BOARDSTYLE_SOC);
6746 +
6747 +       /* bus is PCI */
6748 +
6749 +       if (OSL_PCI_READ_CONFIG(si->osh, PCI_CFG_CIS, sizeof (uint32)) != 0)
6750 +               return (BOARDSTYLE_CARDBUS);
6751 +
6752 +       if ((srom_read(si->bus, si->curmap, si->osh, (SPROM_SIZE - 1) * 2, 2, &w) == 0) &&
6753 +           (w == 0x0313))
6754 +               return (BOARDSTYLE_CARDBUS);
6755 +
6756 +       return (BOARDSTYLE_PCI);
6757 +}
6758 +
6759 +/* return boolean if sbh device is in pci hostmode or client mode */
6760 +uint
6761 +sb_bus(void *sbh)
6762 +{
6763 +       sb_info_t *si;
6764 +
6765 +       si = SB_INFO(sbh);
6766 +       return (si->bus);
6767 +}
6768 +
6769 +/* return list of found cores */
6770 +uint
6771 +sb_corelist(void *sbh, uint coreid[])
6772 +{
6773 +       sb_info_t *si;
6774 +
6775 +       si = SB_INFO(sbh);
6776 +
6777 +       bcopy((uchar*)si->coreid, (uchar*)coreid, (si->numcores * sizeof (uint)));
6778 +       return (si->numcores);
6779 +}
6780 +
6781 +/* return current register mapping */
6782 +void *
6783 +sb_coreregs(void *sbh)
6784 +{
6785 +       sb_info_t *si;
6786 +
6787 +       si = SB_INFO(sbh);
6788 +       ASSERT(GOODREGS(si->curmap));
6789 +
6790 +       return (si->curmap);
6791 +}
6792 +
6793 +/* Check if a target abort has happened and clear it */
6794 +bool
6795 +sb_taclear(void *sbh)
6796 +{
6797 +       sb_info_t *si;
6798 +       bool rc = FALSE;
6799 +       sbconfig_t *sb;
6800 +
6801 +       si = SB_INFO(sbh);
6802 +       sb = REGS2SB(si->curmap);
6803 +
6804 +       if (si->bus == PCI_BUS) {
6805 +               uint32 stcmd;
6806 +
6807 +               stcmd = OSL_PCI_READ_CONFIG(si->osh, PCI_CFG_CMD, sizeof(stcmd));
6808 +               rc = (stcmd & 0x08000000) != 0;
6809 +
6810 +               if (rc) {
6811 +                       /* Target abort bit is set, clear it */
6812 +                       OSL_PCI_WRITE_CONFIG(si->osh, PCI_CFG_CMD, sizeof(stcmd), stcmd);
6813 +               }
6814 +       } else if (si->bus == PCMCIA_BUS) {
6815 +               rc = FALSE;
6816 +       }
6817 +       else if (si->bus == SDIO_BUS) {
6818 +               /* due to 4317 A0 HW bug, sdio core wedged on target abort, 
6819 +                  just clear SBSErr bit blindly */
6820 +               if (0x0 != R_SBREG(sbh, &sb->sbtmerrlog)) {
6821 +                       SB_ERROR(("SDIO target abort, clean it"));
6822 +                       W_SBREG(sbh, &sb->sbtmstatehigh, 0);
6823 +               }
6824 +               rc = FALSE;
6825 +       }
6826 +
6827 +       return (rc);
6828 +}
6829 +
6830 +/* do buffered registers update */
6831 +void
6832 +sb_commit(void *sbh)
6833 +{
6834 +       sb_info_t *si;
6835 +       sbpciregs_t *pciregs;
6836 +       uint origidx;
6837 +       uint intr_val = 0;
6838 +
6839 +       si = SB_INFO(sbh);
6840 +
6841 +       origidx = si->curidx;
6842 +       ASSERT(GOODIDX(origidx));
6843 +
6844 +       INTR_OFF(si, intr_val);
6845 +       /* switch over to pci core */
6846 +       pciregs = (sbpciregs_t*) sb_setcore(sbh, SB_PCI, 0);
6847 +
6848 +       /* do the buffer registers update */
6849 +       W_REG(&pciregs->bcastaddr, SB_COMMIT);
6850 +       W_REG(&pciregs->bcastdata, 0x0);
6851 +
6852 +       /* restore core index */
6853 +       sb_setcoreidx(sbh, origidx);
6854 +       INTR_RESTORE(si, intr_val);
6855 +}
6856 +
6857 +/* reset and re-enable a core */
6858 +void
6859 +sb_core_reset(void *sbh, uint32 bits)
6860 +{
6861 +       sb_info_t *si;
6862 +       sbconfig_t *sb;
6863 +       volatile uint32 dummy;
6864 +
6865 +       si = SB_INFO(sbh);
6866 +       ASSERT(GOODREGS(si->curmap));
6867 +       sb = REGS2SB(si->curmap);
6868 +
6869 +       /*
6870 +        * Must do the disable sequence first to work for arbitrary current core state.
6871 +        */
6872 +       sb_core_disable(sbh, bits);
6873 +
6874 +       /*
6875 +        * Now do the initialization sequence.
6876 +        */
6877 +
6878 +       /* set reset while enabling the clock and forcing them on throughout the core */
6879 +       W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_FGC | SBTML_CLK | SBTML_RESET | bits));
6880 +       dummy = R_SBREG(sbh, &sb->sbtmstatelow);
6881 +
6882 +       if (sb_coreid(sbh) == SB_ILINE100) {
6883 +               bcm_mdelay(50);
6884 +       } else {
6885 +               OSL_DELAY(1);
6886 +       }
6887 +
6888 +       if (R_SBREG(sbh, &sb->sbtmstatehigh) & SBTMH_SERR) {
6889 +               W_SBREG(sbh, &sb->sbtmstatehigh, 0);
6890 +       }
6891 +       if ((dummy = R_SBREG(sbh, &sb->sbimstate)) & (SBIM_IBE | SBIM_TO)) {
6892 +               AND_SBREG(sbh, &sb->sbimstate, ~(SBIM_IBE | SBIM_TO));
6893 +       }
6894 +
6895 +       /* clear reset and allow it to propagate throughout the core */
6896 +       W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_FGC | SBTML_CLK | bits));
6897 +       dummy = R_SBREG(sbh, &sb->sbtmstatelow);
6898 +       OSL_DELAY(1);
6899 +
6900 +       /* leave clock enabled */
6901 +       W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_CLK | bits));
6902 +       dummy = R_SBREG(sbh, &sb->sbtmstatelow);
6903 +       OSL_DELAY(1);
6904 +}
6905 +
6906 +void
6907 +sb_core_tofixup(void *sbh)
6908 +{
6909 +       sb_info_t *si;
6910 +       sbconfig_t *sb;
6911 +
6912 +       si = SB_INFO(sbh);
6913 +
6914 +       if (si->pcirev >= 5)
6915 +               return;
6916 +
6917 +       ASSERT(GOODREGS(si->curmap));
6918 +       sb = REGS2SB(si->curmap);
6919 +
6920 +       if (si->bus == SB_BUS) {
6921 +               SET_SBREG(sbh, &sb->sbimconfiglow,
6922 +                         SBIMCL_RTO_MASK | SBIMCL_STO_MASK,
6923 +                         (0x5 << SBIMCL_RTO_SHIFT) | 0x3);
6924 +       } else {
6925 +               if (sb_coreid(sbh) == SB_PCI) {
6926 +                       SET_SBREG(sbh, &sb->sbimconfiglow,
6927 +                                 SBIMCL_RTO_MASK | SBIMCL_STO_MASK,
6928 +                                 (0x3 << SBIMCL_RTO_SHIFT) | 0x2);
6929 +               } else {
6930 +                       SET_SBREG(sbh, &sb->sbimconfiglow, (SBIMCL_RTO_MASK | SBIMCL_STO_MASK), 0);
6931 +               }
6932 +       }
6933 +
6934 +       sb_commit(sbh);
6935 +}
6936 +
6937 +void
6938 +sb_core_disable(void *sbh, uint32 bits)
6939 +{
6940 +       sb_info_t *si;
6941 +       volatile uint32 dummy;
6942 +       sbconfig_t *sb;
6943 +
6944 +       si = SB_INFO(sbh);
6945 +
6946 +       ASSERT(GOODREGS(si->curmap));
6947 +       sb = REGS2SB(si->curmap);
6948 +
6949 +       /* must return if core is already in reset */
6950 +       if (R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_RESET)
6951 +               return;
6952 +
6953 +       /* put into reset and return if clocks are not enabled */
6954 +       if ((R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_CLK) == 0)
6955 +               goto disable;
6956 +
6957 +       /* set the reject bit */
6958 +       W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_CLK | SBTML_REJ));
6959 +
6960 +       /* spin until reject is set */
6961 +       while ((R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_REJ) == 0)
6962 +               OSL_DELAY(1);
6963 +
6964 +       /* spin until sbtmstatehigh.busy is clear */
6965 +       while (R_SBREG(sbh, &sb->sbtmstatehigh) & SBTMH_BUSY)
6966 +               OSL_DELAY(1);
6967 +
6968 +       /* set reset and reject while enabling the clocks */
6969 +       W_SBREG(sbh, &sb->sbtmstatelow, (bits | SBTML_FGC | SBTML_CLK | SBTML_REJ | SBTML_RESET));
6970 +       dummy = R_SBREG(sbh, &sb->sbtmstatelow);
6971 +       OSL_DELAY(10);
6972 +
6973 + disable:
6974 +       /* leave reset and reject asserted */
6975 +       W_SBREG(sbh, &sb->sbtmstatelow, (bits | SBTML_REJ | SBTML_RESET));
6976 +       OSL_DELAY(1);
6977 +}
6978 +
6979 +void
6980 +sb_watchdog(void *sbh, uint ticks)
6981 +{
6982 +       sb_info_t *si = SB_INFO(sbh);
6983 +
6984 +       /* instant NMI */
6985 +       switch (si->gpioid) {
6986 +       case SB_CC:
6987 +               sb_corereg(sbh, si->gpioidx, OFFSETOF(chipcregs_t, watchdog), ~0, ticks);
6988 +               break;
6989 +       case SB_EXTIF:
6990 +               sb_corereg(sbh, si->gpioidx, OFFSETOF(extifregs_t, watchdog), ~0, ticks);
6991 +               break;
6992 +       }
6993 +}
6994 +
6995 +/* initialize the pcmcia core */
6996 +void
6997 +sb_pcmcia_init(void *sbh)
6998 +{
6999 +       sb_info_t *si;
7000 +       uint8 cor;
7001 +
7002 +       si = SB_INFO(sbh);
7003 +
7004 +       /* enable d11 mac interrupts */
7005 +       if (si->chip == BCM4301_DEVICE_ID) {
7006 +               /* Have to use FCR2 in 4301 */
7007 +               OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_FCR2 + PCMCIA_COR, &cor, 1);
7008 +               cor |= COR_IRQEN | COR_FUNEN;
7009 +               OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_FCR2 + PCMCIA_COR, &cor, 1);
7010 +       } else {
7011 +               OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_FCR0 + PCMCIA_COR, &cor, 1);
7012 +               cor |= COR_IRQEN | COR_FUNEN;
7013 +               OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_FCR0 + PCMCIA_COR, &cor, 1);
7014 +       }
7015 +
7016 +}
7017 +
7018 +
7019 +/*
7020 + * Configure the pci core for pci client (NIC) action
7021 + * and get appropriate dma offset value.
7022 + * coremask is the bitvec of cores by index to be enabled.
7023 + */
7024 +void
7025 +sb_pci_setup(void *sbh, uint32 *dmaoffset, uint coremask)
7026 +{
7027 +       sb_info_t *si;
7028 +       sbconfig_t *sb;
7029 +       sbpciregs_t *pciregs;
7030 +       uint32 sbflag;
7031 +       uint32 w;
7032 +       uint idx;
7033 +
7034 +       si = SB_INFO(sbh);
7035 +
7036 +       if (dmaoffset)
7037 +               *dmaoffset = 0;
7038 +
7039 +       /* if not pci bus, we're done */
7040 +       if (si->bus != PCI_BUS)
7041 +               return;
7042 +
7043 +       ASSERT(si->pciidx);
7044 +
7045 +       /* get current core index */
7046 +       idx = si->curidx;
7047 +
7048 +       /* we interrupt on this backplane flag number */
7049 +       ASSERT(GOODREGS(si->curmap));
7050 +       sb = REGS2SB(si->curmap);
7051 +       sbflag = R_SBREG(sbh, &sb->sbtpsflag) & SBTPS_NUM0_MASK;
7052 +
7053 +       /* switch over to pci core */
7054 +       pciregs = (sbpciregs_t*) sb_setcoreidx(sbh, si->pciidx);
7055 +       sb = REGS2SB(pciregs);
7056 +
7057 +       /*
7058 +        * Enable sb->pci interrupts.  Assume
7059 +        * PCI rev 2.3 support was added in pci core rev 6 and things changed..
7060 +        */
7061 +       if (si->pcirev < 6) {
7062 +               /* set sbintvec bit for our flag number */
7063 +               OR_SBREG(sbh, &sb->sbintvec, (1 << sbflag));
7064 +       } else {
7065 +               /* pci config write to set this core bit in PCIIntMask */
7066 +               w = OSL_PCI_READ_CONFIG(si->osh, PCI_INT_MASK, sizeof(uint32));
7067 +               w |= (coremask << PCI_SBIM_SHIFT);
7068 +               OSL_PCI_WRITE_CONFIG(si->osh, PCI_INT_MASK, sizeof(uint32), w);
7069 +       }
7070 +
7071 +       /* enable prefetch and bursts for sonics-to-pci translation 2 */
7072 +       OR_REG(&pciregs->sbtopci2, (SBTOPCI_PREF|SBTOPCI_BURST));
7073 +
7074 +       if (si->pcirev < 5) {
7075 +               SET_SBREG(sbh, &sb->sbimconfiglow, SBIMCL_RTO_MASK | SBIMCL_STO_MASK,
7076 +                       (0x3 << SBIMCL_RTO_SHIFT) | 0x2);
7077 +               sb_commit(sbh);
7078 +       }
7079 +
7080 +       /* switch back to previous core */
7081 +       sb_setcoreidx(sbh, idx);
7082 +
7083 +       /* use large sb pci dma window */
7084 +       if (dmaoffset)
7085 +               *dmaoffset = SB_PCI_DMA;
7086 +}
7087 +
7088 +uint32
7089 +sb_base(uint32 admatch)
7090 +{
7091 +       uint32 base;
7092 +       uint type;
7093 +
7094 +       type = admatch & SBAM_TYPE_MASK;
7095 +       ASSERT(type < 3);
7096 +
7097 +       base = 0;
7098 +
7099 +       if (type == 0) {
7100 +               base = admatch & SBAM_BASE0_MASK;
7101 +       } else if (type == 1) {
7102 +               ASSERT(!(admatch & SBAM_ADNEG));        /* neg not supported */
7103 +               base = admatch & SBAM_BASE1_MASK;
7104 +       } else if (type == 2) {
7105 +               ASSERT(!(admatch & SBAM_ADNEG));        /* neg not supported */
7106 +               base = admatch & SBAM_BASE2_MASK;
7107 +       }
7108 +
7109 +       return (base);
7110 +}
7111 +
7112 +uint32
7113 +sb_size(uint32 admatch)
7114 +{
7115 +       uint32 size;
7116 +       uint type;
7117 +
7118 +       type = admatch & SBAM_TYPE_MASK;
7119 +       ASSERT(type < 3);
7120 +
7121 +       size = 0;
7122 +
7123 +       if (type == 0) {
7124 +               size = 1 << (((admatch & SBAM_ADINT0_MASK) >> SBAM_ADINT0_SHIFT) + 1);
7125 +       } else if (type == 1) {
7126 +               ASSERT(!(admatch & SBAM_ADNEG));        /* neg not supported */
7127 +               size = 1 << (((admatch & SBAM_ADINT1_MASK) >> SBAM_ADINT1_SHIFT) + 1);
7128 +       } else if (type == 2) {
7129 +               ASSERT(!(admatch & SBAM_ADNEG));        /* neg not supported */
7130 +               size = 1 << (((admatch & SBAM_ADINT2_MASK) >> SBAM_ADINT2_SHIFT) + 1);
7131 +       }
7132 +
7133 +       return (size);
7134 +}
7135 +
7136 +/* return the core-type instantiation # of the current core */
7137 +uint
7138 +sb_coreunit(void *sbh)
7139 +{
7140 +       sb_info_t *si;
7141 +       uint idx;
7142 +       uint coreid;
7143 +       uint coreunit;
7144 +       uint i;
7145 +
7146 +       si = SB_INFO(sbh);
7147 +       coreunit = 0;
7148 +
7149 +       idx = si->curidx;
7150 +
7151 +       ASSERT(GOODREGS(si->curmap));
7152 +       coreid = sb_coreid(sbh);
7153 +
7154 +       /* count the cores of our type */
7155 +       for (i = 0; i < idx; i++)
7156 +               if (si->coreid[i] == coreid)
7157 +                       coreunit++;
7158 +
7159 +       return (coreunit);
7160 +}
7161 +
7162 +static INLINE uint32
7163 +factor6(uint32 x)
7164 +{
7165 +       switch (x) {
7166 +       case CC_F6_2:   return 2;
7167 +       case CC_F6_3:   return 3;
7168 +       case CC_F6_4:   return 4;
7169 +       case CC_F6_5:   return 5;
7170 +       case CC_F6_6:   return 6;
7171 +       case CC_F6_7:   return 7;
7172 +       default:        return 0;
7173 +       }
7174 +}
7175 +
7176 +/* calculate the speed the SB would run at given a set of clockcontrol values */
7177 +uint32
7178 +sb_clock_rate(uint32 pll_type, uint32 n, uint32 m)
7179 +{
7180 +       uint32 n1, n2, clock, m1, m2, m3, mc;
7181 +
7182 +       n1 = n & CN_N1_MASK;
7183 +       n2 = (n & CN_N2_MASK) >> CN_N2_SHIFT;
7184 +
7185 +       if ((pll_type == PLL_TYPE1) || (pll_type == PLL_TYPE4)) {
7186 +               n1 = factor6(n1);
7187 +               n2 += CC_F5_BIAS;
7188 +       } else if (pll_type == PLL_TYPE2) {
7189 +               n1 += CC_T2_BIAS;
7190 +               n2 += CC_T2_BIAS;
7191 +               ASSERT((n1 >= 2) && (n1 <= 7));
7192 +               ASSERT((n2 >= 5) && (n2 <= 23));
7193 +       } else if (pll_type == PLL_TYPE3) {
7194 +               return (100000000);
7195 +       } else
7196 +               ASSERT((pll_type >= PLL_TYPE1) && (pll_type <= PLL_TYPE4));
7197 +
7198 +       clock = CC_CLOCK_BASE * n1 * n2;
7199 +
7200 +       if (clock == 0)
7201 +               return 0;
7202 +
7203 +       m1 = m & CC_M1_MASK;
7204 +       m2 = (m & CC_M2_MASK) >> CC_M2_SHIFT;
7205 +       m3 = (m & CC_M3_MASK) >> CC_M3_SHIFT;
7206 +       mc = (m & CC_MC_MASK) >> CC_MC_SHIFT;
7207 +
7208 +       if ((pll_type == PLL_TYPE1) || (pll_type == PLL_TYPE4)) {
7209 +               m1 = factor6(m1);
7210 +               if (pll_type == PLL_TYPE1)
7211 +                       m2 += CC_F5_BIAS;
7212 +               else
7213 +                       m2 = factor6(m2);
7214 +               m3 = factor6(m3);
7215 +
7216 +               switch (mc) {
7217 +               case CC_MC_BYPASS:      return (clock);
7218 +               case CC_MC_M1:          return (clock / m1);
7219 +               case CC_MC_M1M2:        return (clock / (m1 * m2));
7220 +               case CC_MC_M1M2M3:      return (clock / (m1 * m2 * m3));
7221 +               case CC_MC_M1M3:        return (clock / (m1 * m3));
7222 +               default:                return (0);
7223 +               }
7224 +       } else {
7225 +               ASSERT(pll_type == PLL_TYPE2);
7226 +
7227 +               m1 += CC_T2_BIAS;
7228 +               m2 += CC_T2M2_BIAS;
7229 +               m3 += CC_T2_BIAS;
7230 +               ASSERT((m1 >= 2) && (m1 <= 7));
7231 +               ASSERT((m2 >= 3) && (m2 <= 10));
7232 +               ASSERT((m3 >= 2) && (m3 <= 7));
7233 +
7234 +               if ((mc & CC_T2MC_M1BYP) == 0)
7235 +                       clock /= m1;
7236 +               if ((mc & CC_T2MC_M2BYP) == 0)
7237 +                       clock /= m2;
7238 +               if ((mc & CC_T2MC_M3BYP) == 0)
7239 +                       clock /= m3;
7240 +
7241 +               return(clock);
7242 +       }
7243 +}
7244 +
7245 +/* returns the current speed the SB is running at */
7246 +uint32
7247 +sb_clock(void *sbh)
7248 +{
7249 +       sb_info_t *si;
7250 +       extifregs_t *eir;
7251 +       chipcregs_t *cc;
7252 +       uint32 n, m;
7253 +       uint idx;
7254 +       uint32 pll_type, rate;
7255 +       uint intr_val = 0;
7256 +
7257 +       si = SB_INFO(sbh);
7258 +       idx = si->curidx;
7259 +       pll_type = PLL_TYPE1;
7260 +
7261 +       INTR_OFF(si, intr_val);
7262 +
7263 +       /* switch to extif or chipc core */
7264 +       if ((eir = (extifregs_t *) sb_setcore(sbh, SB_EXTIF, 0))) {
7265 +               n = R_REG(&eir->clockcontrol_n);
7266 +               m = R_REG(&eir->clockcontrol_sb);
7267 +       } else if ((cc = (chipcregs_t *) sb_setcore(sbh, SB_CC, 0))) {
7268 +               pll_type = R_REG(&cc->capabilities) & CAP_PLL_MASK;
7269 +               n = R_REG(&cc->clockcontrol_n);
7270 +               m = R_REG(&cc->clockcontrol_sb);
7271 +       } else {
7272 +               INTR_RESTORE(si, intr_val);
7273 +               return 0;
7274 +       }
7275 +
7276 +       /* calculate rate */
7277 +       rate = sb_clock_rate(pll_type, n, m);
7278 +
7279 +       /* switch back to previous core */
7280 +       sb_setcoreidx(sbh, idx);
7281 +
7282 +       INTR_RESTORE(si, intr_val);
7283 +
7284 +       return rate;
7285 +}
7286 +
7287 +/* change logical "focus" to the gpio core for optimized access */
7288 +void*
7289 +sb_gpiosetcore(void *sbh)
7290 +{
7291 +       sb_info_t *si;
7292 +
7293 +       si = SB_INFO(sbh);
7294 +
7295 +       return (sb_setcoreidx(sbh, si->gpioidx));
7296 +}
7297 +
7298 +/* mask&set gpiocontrol bits */
7299 +uint32
7300 +sb_gpiocontrol(void *sbh, uint32 mask, uint32 val)
7301 +{
7302 +       sb_info_t *si;
7303 +       uint regoff;
7304 +
7305 +       si = SB_INFO(sbh);
7306 +       regoff = 0;
7307 +
7308 +       switch (si->gpioid) {
7309 +       case SB_CC:
7310 +               regoff = OFFSETOF(chipcregs_t, gpiocontrol);
7311 +               break;
7312 +
7313 +       case SB_PCI:
7314 +               regoff = OFFSETOF(sbpciregs_t, gpiocontrol);
7315 +               break;
7316 +
7317 +       case SB_EXTIF:
7318 +               return (0);
7319 +       }
7320 +
7321 +       return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
7322 +}
7323 +
7324 +/* mask&set gpio output enable bits */
7325 +uint32
7326 +sb_gpioouten(void *sbh, uint32 mask, uint32 val)
7327 +{
7328 +       sb_info_t *si;
7329 +       uint regoff;
7330 +
7331 +       si = SB_INFO(sbh);
7332 +       regoff = 0;
7333 +
7334 +       switch (si->gpioid) {
7335 +       case SB_CC:
7336 +               regoff = OFFSETOF(chipcregs_t, gpioouten);
7337 +               break;
7338 +
7339 +       case SB_PCI:
7340 +               regoff = OFFSETOF(sbpciregs_t, gpioouten);
7341 +               break;
7342 +
7343 +       case SB_EXTIF:
7344 +               regoff = OFFSETOF(extifregs_t, gpio[0].outen);
7345 +               break;
7346 +       }
7347 +
7348 +       return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
7349 +}
7350 +
7351 +/* mask&set gpio output bits */
7352 +uint32
7353 +sb_gpioout(void *sbh, uint32 mask, uint32 val)
7354 +{
7355 +       sb_info_t *si;
7356 +       uint regoff;
7357 +
7358 +       si = SB_INFO(sbh);
7359 +       regoff = 0;
7360 +
7361 +       switch (si->gpioid) {
7362 +       case SB_CC:
7363 +               regoff = OFFSETOF(chipcregs_t, gpioout);
7364 +               break;
7365 +
7366 +       case SB_PCI:
7367 +               regoff = OFFSETOF(sbpciregs_t, gpioout);
7368 +               break;
7369 +
7370 +       case SB_EXTIF:
7371 +               regoff = OFFSETOF(extifregs_t, gpio[0].out);
7372 +               break;
7373 +       }
7374 +
7375 +       return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
7376 +}
7377 +
7378 +/* return the current gpioin register value */
7379 +uint32
7380 +sb_gpioin(void *sbh)
7381 +{
7382 +       sb_info_t *si;
7383 +       uint regoff;
7384 +
7385 +       si = SB_INFO(sbh);
7386 +       regoff = 0;
7387 +
7388 +       switch (si->gpioid) {
7389 +       case SB_CC:
7390 +               regoff = OFFSETOF(chipcregs_t, gpioin);
7391 +               break;
7392 +
7393 +       case SB_PCI:
7394 +               regoff = OFFSETOF(sbpciregs_t, gpioin);
7395 +               break;
7396 +
7397 +       case SB_EXTIF:
7398 +               regoff = OFFSETOF(extifregs_t, gpioin);
7399 +               break;
7400 +       }
7401 +
7402 +       return (sb_corereg(sbh, si->gpioidx, regoff, 0, 0));
7403 +}
7404 +
7405 +/* mask&set gpio interrupt polarity bits */
7406 +uint32
7407 +sb_gpiointpolarity(void *sbh, uint32 mask, uint32 val)
7408 +{
7409 +       sb_info_t *si;
7410 +       uint regoff;
7411 +
7412 +       si = SB_INFO(sbh);
7413 +       regoff = 0;
7414 +
7415 +       switch (si->gpioid) {
7416 +       case SB_CC:
7417 +               regoff = OFFSETOF(chipcregs_t, gpiointpolarity);
7418 +               break;
7419 +
7420 +       case SB_PCI:
7421 +               /* pci gpio implementation does not support interrupt polarity */
7422 +               ASSERT(0);
7423 +               break;
7424 +
7425 +       case SB_EXTIF:
7426 +               regoff = OFFSETOF(extifregs_t, gpiointpolarity);
7427 +               break;
7428 +       }
7429 +
7430 +       return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
7431 +}
7432 +
7433 +/* mask&set gpio interrupt mask bits */
7434 +uint32
7435 +sb_gpiointmask(void *sbh, uint32 mask, uint32 val)
7436 +{
7437 +       sb_info_t *si;
7438 +       uint regoff;
7439 +
7440 +       si = SB_INFO(sbh);
7441 +       regoff = 0;
7442 +
7443 +       switch (si->gpioid) {
7444 +       case SB_CC:
7445 +               regoff = OFFSETOF(chipcregs_t, gpiointmask);
7446 +               break;
7447 +
7448 +       case SB_PCI:
7449 +               /* pci gpio implementation does not support interrupt mask */
7450 +               ASSERT(0);
7451 +               break;
7452 +
7453 +       case SB_EXTIF:
7454 +               regoff = OFFSETOF(extifregs_t, gpiointmask);
7455 +               break;
7456 +       }
7457 +
7458 +       return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
7459 +}
7460 +
7461 +
7462 +/*
7463 + * Return the slowclock min or max frequency.
7464 + * Three sources of SLOW CLOCK:
7465 + *     1. On Chip LPO         -     32khz or 160khz
7466 + *     2. On Chip Xtal OSC    -     20mhz/4*(divider+1) 
7467 + *     3. External PCI clock  -     66mhz/4*(divider+1)
7468 + */
7469 +static uint
7470 +slowfreq(void *sbh, bool max)
7471 +{
7472 +       sb_info_t *si;
7473 +       chipcregs_t *cc;
7474 +       uint32 v;
7475 +       uint div;
7476 +
7477 +       si = SB_INFO(sbh);
7478 +
7479 +       ASSERT(sb_coreid(sbh) == SB_CC);
7480 +
7481 +       cc = (chipcregs_t*) sb_setcoreidx(sbh, si->curidx);
7482 +
7483 +       /* shouldn't be here unless we've established the chip has dynamic power control */
7484 +       ASSERT(R_REG(&cc->capabilities) & CAP_PWR_CTL);
7485 +
7486 +       if (si->ccrev < 6) {
7487 +               v = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32));
7488 +
7489 +               if (v & PCI_CFG_GPIO_SCS)
7490 +                       return (max? (PCIMAXFREQ/64) : (PCIMINFREQ/64));
7491 +               else
7492 +                       return (max? (XTALMAXFREQ/32) : (XTALMINFREQ/32));
7493 +       } else {
7494 +               v = R_REG(&cc->slow_clk_ctl) & SCC_SS_MASK;
7495 +               div = 4 * (((R_REG(&cc->slow_clk_ctl) & SCC_CD_MASK) >> SCC_CD_SHF) + 1);
7496 +               if (v == SCC_SS_LPO)
7497 +                       return (max? LPOMAXFREQ : LPOMINFREQ);
7498 +               else if (v == SCC_SS_XTAL)
7499 +                       return (max? (XTALMAXFREQ/div) : (XTALMINFREQ/div));
7500 +               else if (v == SCC_SS_PCI)
7501 +                       return (max? (PCIMAXFREQ/div) : (PCIMINFREQ/div));
7502 +               else
7503 +                       ASSERT(0);
7504 +       }
7505 +       return (0);
7506 +}
7507 +
7508 +/* initialize power control delay registers */
7509 +void
7510 +sb_pwrctl_init(void *sbh)
7511 +{
7512 +       sb_info_t *si;
7513 +       uint origidx;
7514 +       chipcregs_t *cc;
7515 +       uint slowmaxfreq;
7516 +       uint pll_on_delay, fref_sel_delay;
7517 +
7518 +       si = SB_INFO(sbh);
7519 +
7520 +       if (si->bus == SB_BUS)
7521 +               return;
7522 +
7523 +       origidx = si->curidx;
7524 +
7525 +       if ((cc = (chipcregs_t*) sb_setcore(sbh, SB_CC, 0)) == NULL)
7526 +               return;
7527 +
7528 +       if (!(R_REG(&cc->capabilities) & CAP_PWR_CTL))
7529 +               goto done;
7530 +
7531 +       slowmaxfreq = slowfreq(sbh, TRUE);
7532 +       pll_on_delay = ((slowmaxfreq * PLL_DELAY) + 999999) / 1000000;
7533 +       fref_sel_delay = ((slowmaxfreq * FREF_DELAY) + 999999) / 1000000;
7534 +
7535 +       W_REG(&cc->pll_on_delay, pll_on_delay);
7536 +       W_REG(&cc->fref_sel_delay, fref_sel_delay);
7537 +
7538 +       /* 4317pc does not work with SlowClock less than 5Mhz */
7539 +       if (si->bus == PCMCIA_BUS)
7540 +               SET_REG(&cc->slow_clk_ctl, SCC_CD_MASK, (0 << SCC_CD_SHF));
7541 +
7542 +done:
7543 +       sb_setcoreidx(sbh, origidx);
7544 +}
7545 +
7546 +/* return the value suitable for writing to the dot11 core FAST_PWRUP_DELAY register */
7547 +uint16
7548 +sb_pwrctl_fast_pwrup_delay(void *sbh)
7549 +{
7550 +       sb_info_t *si;
7551 +       uint origidx;
7552 +       chipcregs_t *cc;
7553 +       uint slowminfreq;
7554 +       uint16 fpdelay;
7555 +       uint intr_val = 0;
7556 +
7557 +       si = SB_INFO(sbh);
7558 +       fpdelay = 0;
7559 +       origidx = si->curidx;
7560 +
7561 +       if (si->bus == SB_BUS)
7562 +               goto done;
7563 +
7564 +       INTR_OFF(si, intr_val);
7565 +
7566 +       if ((cc = (chipcregs_t*) sb_setcore(sbh, SB_CC, 0)) == NULL)
7567 +               goto done;
7568 +
7569 +       if (!(R_REG(&cc->capabilities) & CAP_PWR_CTL))
7570 +               goto done;
7571 +
7572 +       slowminfreq = slowfreq(sbh, FALSE);
7573 +       fpdelay = (((R_REG(&cc->pll_on_delay) + 2) * 1000000) + (slowminfreq - 1)) / slowminfreq;
7574 +
7575 +done:
7576 +       sb_setcoreidx(sbh, origidx);
7577 +       INTR_RESTORE(si, intr_val);
7578 +       return (fpdelay);
7579 +}
7580 +
7581 +/* turn primary xtal and/or pll off/on */
7582 +int
7583 +sb_pwrctl_xtal(void *sbh, uint what, bool on)
7584 +{
7585 +       sb_info_t *si;
7586 +       uint32 in, out, outen;
7587 +
7588 +       si = SB_INFO(sbh);
7589 +
7590 +
7591 +       if (si->bus == PCMCIA_BUS) {
7592 +               return (0);
7593 +       }
7594 +
7595 +       if (si->bus != PCI_BUS) 
7596 +               return (-1);
7597 +
7598 +       in = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_IN, sizeof (uint32));
7599 +       out = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32));
7600 +       outen = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_OUTEN, sizeof (uint32));
7601 +
7602 +       /*
7603 +        * We can't actually read the state of the PLLPD so we infer it
7604 +        * by the value of XTAL_PU which *is* readable via gpioin.
7605 +        */
7606 +       if (on && (in & PCI_CFG_GPIO_XTAL))
7607 +               return (0);
7608 +
7609 +       if (what & XTAL)
7610 +               outen |= PCI_CFG_GPIO_XTAL;
7611 +       if (what & PLL)
7612 +               outen |= PCI_CFG_GPIO_PLL;
7613 +
7614 +       if (on) {
7615 +               /* turn primary xtal on */
7616 +               if (what & XTAL) {
7617 +                       out |= PCI_CFG_GPIO_XTAL;
7618 +                       if (what & PLL)
7619 +                               out |= PCI_CFG_GPIO_PLL;
7620 +                       OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32), out);
7621 +                       OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUTEN, sizeof (uint32), outen);
7622 +                       OSL_DELAY(200);
7623 +               }
7624 +
7625 +               /* turn pll on */
7626 +               if (what & PLL) {
7627 +                       out &= ~PCI_CFG_GPIO_PLL;
7628 +                       OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32), out);
7629 +                       OSL_DELAY(2000);
7630 +               }
7631 +       } else {
7632 +               if (what & XTAL)
7633 +                       out &= ~PCI_CFG_GPIO_XTAL;
7634 +               if (what & PLL)
7635 +                       out |= PCI_CFG_GPIO_PLL;
7636 +               OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32), out);
7637 +               OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUTEN, sizeof (uint32), outen);
7638 +       }
7639 +
7640 +       return (0);
7641 +}
7642 +
7643 +/* set dynamic power control mode (forceslow, forcefast, dynamic) */
7644 +/*   returns true if ignore pll off is set and false if it is not */
7645 +bool
7646 +sb_pwrctl_clk(void *sbh, uint mode)
7647 +{
7648 +       sb_info_t *si;
7649 +       uint origidx;
7650 +       chipcregs_t *cc;
7651 +       uint32 scc;
7652 +       bool forcefastclk=FALSE;
7653 +       uint intr_val = 0;
7654 +
7655 +       si = SB_INFO(sbh);
7656 +
7657 +       /* chipcommon cores prior to rev6 don't support slowclkcontrol */
7658 +       if (si->ccrev < 6)
7659 +               return (FALSE);
7660 +
7661 +       INTR_OFF(si, intr_val);
7662 +
7663 +       origidx = si->curidx;
7664 +
7665 +       cc = (chipcregs_t*) sb_setcore(sbh, SB_CC, 0);
7666 +       ASSERT(cc != NULL);
7667 +
7668 +       if (!(R_REG(&cc->capabilities) & CAP_PWR_CTL))
7669 +               goto done;
7670 +
7671 +       switch (mode) {
7672 +       case CLK_FAST:  /* force fast (pll) clock */
7673 +               /* don't forget to force xtal back on before we clear SCC_DYN_XTAL.. */
7674 +               sb_pwrctl_xtal(sbh, XTAL, ON);
7675 +
7676 +               SET_REG(&cc->slow_clk_ctl, (SCC_XC | SCC_FS | SCC_IP), SCC_IP);
7677 +               break;
7678 +
7679 +       case CLK_SLOW:  /* force slow clock */
7680 +               if ((si->bus == SDIO_BUS) || (si->bus == PCMCIA_BUS))
7681 +                       return (-1);
7682 +
7683 +               if (si->ccrev >= 6)
7684 +                       OR_REG(&cc->slow_clk_ctl, SCC_FS);
7685 +               break;
7686 +
7687 +       case CLK_DYNAMIC:       /* enable dynamic power control */
7688 +               scc = R_REG(&cc->slow_clk_ctl);
7689 +               scc &= ~(SCC_FS | SCC_IP | SCC_XC);
7690 +               if ((scc & SCC_SS_MASK) != SCC_SS_XTAL)
7691 +                       scc |= SCC_XC;
7692 +               W_REG(&cc->slow_clk_ctl, scc);
7693 +
7694 +               /* for dynamic control, we have to release our xtal_pu "force on" */
7695 +               if (scc & SCC_XC)
7696 +                       sb_pwrctl_xtal(sbh, XTAL, OFF);
7697 +               break;
7698 +       }
7699 +       
7700 +       /* Is the h/w forcing the use of the fast clk */
7701 +       forcefastclk = (bool)((R_REG(&cc->slow_clk_ctl) & SCC_IP) == SCC_IP);
7702 +
7703 +done:
7704 +       sb_setcoreidx(sbh, origidx);
7705 +       INTR_RESTORE(si, intr_val);
7706 +       return (forcefastclk);
7707 +}
7708 +
7709 +/* register driver interrupt disabling and restoring callback functions */
7710 +void
7711 +sb_register_intr_callback(void *sbh, void *intrsoff_fn, void *intrsrestore_fn, void *intr_arg)
7712 +{
7713 +       sb_info_t *si;
7714 +
7715 +       si = SB_INFO(sbh);
7716 +       si->intr_arg = intr_arg;
7717 +       si->intrsoff_fn = (sb_intrsoff_t)intrsoff_fn;
7718 +       si->intrsrestore_fn = (sb_intrsrestore_t)intrsrestore_fn;
7719 +       /* save current core id.  when this function called, the current core
7720 +        * must be the core which provides driver functions(il, et, wl, etc.)
7721 +        */
7722 +       si->dev_coreid = si->coreid[si->curidx];
7723 +}
7724 +
7725 +
7726 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcm4710.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcm4710.h
7727 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcm4710.h 1970-01-01 01:00:00.000000000 +0100
7728 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcm4710.h    2005-08-28 11:12:20.430859152 +0200
7729 @@ -0,0 +1,90 @@
7730 +/*
7731 + * BCM4710 address space map and definitions
7732 + * Think twice before adding to this file, this is not the kitchen sink
7733 + * These definitions are not guaranteed for all 47xx chips, only the 4710
7734 + *
7735 + * Copyright 2001-2003, Broadcom Corporation   
7736 + * All Rights Reserved.   
7737 + *    
7738 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
7739 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
7740 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
7741 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
7742 + * $Id$
7743 + */
7744 +
7745 +#ifndef _bcm4710_h_
7746 +#define _bcm4710_h_
7747 +
7748 +/* Address map */
7749 +#define BCM4710_SDRAM          0x00000000      /* Physical SDRAM */
7750 +#define BCM4710_PCI_MEM                0x08000000      /* Host Mode PCI memory access space (64 MB) */
7751 +#define BCM4710_PCI_CFG                0x0c000000      /* Host Mode PCI configuration space (64 MB) */
7752 +#define BCM4710_PCI_DMA                0x40000000      /* Client Mode PCI memory access space (1 GB) */
7753 +#define        BCM4710_SDRAM_SWAPPED   0x10000000      /* Byteswapped Physical SDRAM */
7754 +#define BCM4710_ENUM           0x18000000      /* Beginning of core enumeration space */
7755 +
7756 +/* Core register space */
7757 +#define BCM4710_REG_SDRAM      0x18000000      /* SDRAM core registers */
7758 +#define BCM4710_REG_ILINE20    0x18001000      /* InsideLine20 core registers */
7759 +#define BCM4710_REG_EMAC0      0x18002000      /* Ethernet MAC 0 core registers */
7760 +#define BCM4710_REG_CODEC      0x18003000      /* Codec core registers */
7761 +#define BCM4710_REG_USB                0x18004000      /* USB core registers */
7762 +#define BCM4710_REG_PCI                0x18005000      /* PCI core registers */
7763 +#define BCM4710_REG_MIPS       0x18006000      /* MIPS core registers */
7764 +#define BCM4710_REG_EXTIF      0x18007000      /* External Interface core registers */
7765 +#define BCM4710_REG_EMAC1      0x18008000      /* Ethernet MAC 1 core registers */
7766 +
7767 +#define        BCM4710_EXTIF           0x1f000000      /* External Interface base address */
7768 +#define BCM4710_PCMCIA_MEM     0x1f000000      /* External Interface PCMCIA memory access */
7769 +#define BCM4710_PCMCIA_IO      0x1f100000      /* PCMCIA I/O access */
7770 +#define BCM4710_PCMCIA_CONF    0x1f200000      /* PCMCIA configuration */
7771 +#define BCM4710_PROG           0x1f800000      /* Programable interface */
7772 +#define BCM4710_FLASH          0x1fc00000      /* Flash */
7773 +
7774 +#define        BCM4710_EJTAG           0xff200000      /* MIPS EJTAG space (2M) */
7775 +
7776 +#define        BCM4710_UART            (BCM4710_REG_EXTIF + 0x00000300)
7777 +
7778 +#define        BCM4710_EUART           (BCM4710_EXTIF + 0x00800000)
7779 +#define        BCM4710_LED             (BCM4710_EXTIF + 0x00900000)
7780 +
7781 +#define        SBFLAG_PCI      0
7782 +#define        SBFLAG_ENET0    1
7783 +#define        SBFLAG_ILINE20  2
7784 +#define        SBFLAG_CODEC    3
7785 +#define        SBFLAG_USB      4
7786 +#define        SBFLAG_EXTIF    5
7787 +#define        SBFLAG_ENET1    6
7788 +
7789 +#ifdef CONFIG_HWSIM
7790 +#define        BCM4710_TRACE(trval)        do { *((int *)0xa0000f18) = (trval); } while (0)
7791 +#else
7792 +#define        BCM4710_TRACE(trval)
7793 +#endif
7794 +
7795 +
7796 +/* BCM94702 CPCI -ExtIF used for LocalBus devs */
7797 +
7798 +#define BCM94702_CPCI_RESET_ADDR        BCM4710_EXTIF
7799 +#define BCM94702_CPCI_BOARDID_ADDR     (BCM4710_EXTIF | 0x4000)
7800 +#define BCM94702_CPCI_DOC_ADDR         (BCM4710_EXTIF | 0x6000)
7801 +#define BCM94702_DOC_ADDR                BCM94702_CPCI_DOC_ADDR
7802 +#define BCM94702_CPCI_LED_ADDR         (BCM4710_EXTIF | 0xc000)
7803 +#define BCM94702_CPCI_NVRAM_ADDR       (BCM4710_EXTIF | 0xe000)
7804 +#define BCM94702_CPCI_NVRAM_SIZE         0x1ff0 /* 8K NVRAM : DS1743/STM48txx*/
7805 +#define BCM94702_CPCI_TOD_REG_BASE       (BCM94702_CPCI_NVRAM_ADDR | 0x1ff0)
7806 +
7807 +#define LED_REG(x)      \
7808 + (*(volatile unsigned char *) (KSEG1ADDR(BCM94702_CPCI_LED_ADDR) + (x)))
7809 +
7810 +/* 
7811 + * Reset function implemented in PLD.  Read or write should trigger hard reset 
7812 + */
7813 +#define SYS_HARD_RESET()   \
7814 +    { for (;;) \
7815 +     *( (volatile unsigned char *)\
7816 +      KSEG1ADDR(BCM94702_CPCI_RESET_ADDR) ) = 0x80; \
7817 +    }
7818 +
7819 +#endif /* _bcm4710_h_ */
7820 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmdevs.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmdevs.h
7821 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmdevs.h 1970-01-01 01:00:00.000000000 +0100
7822 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmdevs.h    2005-08-28 11:12:20.431859000 +0200
7823 @@ -0,0 +1,238 @@
7824 +/*
7825 + * Broadcom device-specific manifest constants.
7826 + *
7827 + * $Id$
7828 + * Copyright 2001-2003, Broadcom Corporation   
7829 + * All Rights Reserved.   
7830 + *    
7831 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
7832 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
7833 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
7834 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
7835 + */
7836 +
7837 +#ifndef        _BCMDEVS_H
7838 +#define        _BCMDEVS_H
7839 +
7840 +
7841 +/* Known PCI vendor Id's */
7842 +#define        VENDOR_EPIGRAM          0xfeda
7843 +#define        VENDOR_BROADCOM         0x14e4
7844 +#define        VENDOR_3COM             0x10b7
7845 +#define        VENDOR_NETGEAR          0x1385
7846 +#define        VENDOR_DIAMOND          0x1092
7847 +#define        VENDOR_DELL             0x1028
7848 +#define        VENDOR_HP               0x0e11
7849 +#define        VENDOR_APPLE            0x106b
7850 +
7851 +/* PCI Device Id's */
7852 +#define        BCM4210_DEVICE_ID       0x1072          /* never used */
7853 +#define        BCM4211_DEVICE_ID       0x4211
7854 +#define        BCM4230_DEVICE_ID       0x1086          /* never used */
7855 +#define        BCM4231_DEVICE_ID       0x4231
7856 +
7857 +#define        BCM4410_DEVICE_ID       0x4410          /* bcm44xx family pci iline */
7858 +#define        BCM4430_DEVICE_ID       0x4430          /* bcm44xx family cardbus iline */
7859 +#define        BCM4412_DEVICE_ID       0x4412          /* bcm44xx family pci enet */
7860 +#define        BCM4432_DEVICE_ID       0x4432          /* bcm44xx family cardbus enet */
7861 +
7862 +#define        BCM3352_DEVICE_ID       0x3352          /* bcm3352 device id */
7863 +#define        BCM3360_DEVICE_ID       0x3360          /* bcm3360 device id */
7864 +
7865 +#define        EPI41210_DEVICE_ID      0xa0fa          /* bcm4210 */
7866 +#define        EPI41230_DEVICE_ID      0xa10e          /* bcm4230 */
7867 +
7868 +#define        BCM47XX_ILINE_ID        0x4711          /* 47xx iline20 */
7869 +#define        BCM47XX_V90_ID          0x4712          /* 47xx v90 codec */
7870 +#define        BCM47XX_ENET_ID         0x4713          /* 47xx enet */
7871 +#define        BCM47XX_EXT_ID          0x4714          /* 47xx external i/f */
7872 +#define        BCM47XX_USB_ID          0x4715          /* 47xx usb */
7873 +#define        BCM47XX_USBH_ID         0x4716          /* 47xx usb host */
7874 +#define        BCM47XX_USBD_ID         0x4717          /* 47xx usb device */
7875 +#define        BCM47XX_IPSEC_ID        0x4718          /* 47xx ipsec */
7876 +
7877 +#define        BCM4710_DEVICE_ID       0x4710          /* 4710 primary function 0 */
7878 +
7879 +#define        BCM4610_DEVICE_ID       0x4610          /* 4610 primary function 0 */
7880 +#define        BCM4610_ILINE_ID        0x4611          /* 4610 iline100 */
7881 +#define        BCM4610_V90_ID          0x4612          /* 4610 v90 codec */
7882 +#define        BCM4610_ENET_ID         0x4613          /* 4610 enet */
7883 +#define        BCM4610_EXT_ID          0x4614          /* 4610 external i/f */
7884 +#define        BCM4610_USB_ID          0x4615          /* 4610 usb */
7885 +
7886 +#define        BCM4402_DEVICE_ID       0x4402          /* 4402 primary function 0 */
7887 +#define        BCM4402_ENET_ID         0x4402          /* 4402 enet */
7888 +#define        BCM4402_V90_ID          0x4403          /* 4402 v90 codec */
7889 +
7890 +#define        BCM4301_DEVICE_ID       0x4301          /* 4301 primary function 0 */
7891 +#define        BCM4301_D11B_ID         0x4301          /* 4301 802.11b */
7892 +
7893 +#define        BCM4307_DEVICE_ID       0x4307          /* 4307 primary function 0 */
7894 +#define        BCM4307_V90_ID          0x4305          /* 4307 v90 codec */
7895 +#define        BCM4307_ENET_ID         0x4306          /* 4307 enet */
7896 +#define        BCM4307_D11B_ID         0x4307          /* 4307 802.11b */
7897 +
7898 +#define        BCM4306_DEVICE_ID       0x4306          /* 4306 chipcommon chipid */
7899 +#define        BCM4306_D11G_ID         0x4320          /* 4306 802.11g */
7900 +#define        BCM4306_D11G_ID2        0x4325          
7901 +#define        BCM4306_D11A_ID         0x4321          /* 4306 802.11a */
7902 +#define        BCM4306_UART_ID         0x4322          /* 4306 uart */
7903 +#define        BCM4306_V90_ID          0x4323          /* 4306 v90 codec */
7904 +#define        BCM4306_D11DUAL_ID      0x4324          /* 4306 dual A+B */
7905 +
7906 +#define        BCM4309_PKG_ID          1               /* 4309 package id */
7907 +
7908 +#define        BCM4303_D11B_ID         0x4303          /* 4303 802.11b */
7909 +#define        BCM4303_PKG_ID          2               /* 4303 package id */
7910 +
7911 +#define        BCM4310_DEVICE_ID       0x4310          /* 4310 chipcommon chipid */
7912 +#define        BCM4310_D11B_ID         0x4311          /* 4310 802.11b */
7913 +#define        BCM4310_UART_ID         0x4312          /* 4310 uart */
7914 +#define        BCM4310_ENET_ID         0x4313          /* 4310 enet */
7915 +#define        BCM4310_USB_ID          0x4315          /* 4310 usb */
7916 +
7917 +#define        BCM4704_DEVICE_ID       0x4704          /* 4704 chipcommon chipid */
7918 +#define        BCM4704_ENET_ID         0x4706          /* 4704 enet (Use 47XX_ENET_ID instead!) */
7919 +
7920 +#define        BCM4317_DEVICE_ID       0x4317          /* 4317 chip common chipid */
7921 +
7922 +#define        BCM4712_DEVICE_ID       0x4712          /* 4712 chipcommon chipid */
7923 +#define        BCM4712_MIPS_ID         0x4720          /* 4712 base devid */
7924 +#define        BCM4712SMALL_PKG_ID     1               /* 200pin 4712 package id */
7925 +
7926 +#define        SDIOH_FPGA_ID           0x4380          /* sdio host fpga */
7927 +
7928 +#define BCM5365_DEVICE_ID       0x5365          /* 5365 chipcommon chipid */
7929 +
7930 +
7931 +/* PCMCIA vendor Id's */
7932 +
7933 +#define        VENDOR_BROADCOM_PCMCIA  0x02d0
7934 +
7935 +/* SDIO vendor Id's */
7936 +#define        VENDOR_BROADCOM_SDIO    0x00BF
7937 +
7938 +
7939 +/* boardflags */
7940 +#define        BFL_BTCOEXIST           0x0001  /* This board implements Bluetooth coexistance */
7941 +#define        BFL_PACTRL              0x0002  /* This board has gpio 9 controlling the PA */
7942 +#define        BFL_AIRLINEMODE         0x0004  /* This board implements gpio13 radio disable indication */
7943 +#define        BFL_ENETSPI             0x0010  /* This board has ephy roboswitch spi */
7944 +#define        BFL_CCKHIPWR            0x0040  /* Can do high-power CCK transmission */
7945 +#define        BFL_ENETADM             0x0080  /* This board has ADMtek switch */
7946 +#define        BFL_ENETVLAN            0x0100  /* This board can do vlan */
7947 +
7948 +/* board specific GPIO assignment, gpio 0-3 are also customer-configurable led */
7949 +#define BOARD_GPIO_HWRAD_B     0x010   /* bit 4 is HWRAD input on 4301 */
7950 +#define        BOARD_GPIO_BTC_IN       0x080   /* bit 7 is BT Coexistance Input */
7951 +#define        BOARD_GPIO_BTC_OUT      0x100   /* bit 8 is BT Coexistance Out */
7952 +#define        BOARD_GPIO_PACTRL       0x200   /* bit 9 controls the PA on new 4306 boards */
7953 +#define        PCI_CFG_GPIO_SCS        0x10    /* PCI config space bit 4 for 4306c0 slow clock source */
7954 +#define PCI_CFG_GPIO_HWRAD     0x20    /* PCI config space GPIO 13 for hw radio disable */
7955 +#define PCI_CFG_GPIO_XTAL      0x40    /* PCI config space GPIO 14 for Xtal powerup */
7956 +#define PCI_CFG_GPIO_PLL       0x80    /* PCI config space GPIO 15 for PLL powerdown */
7957 +
7958 +/* Bus types */
7959 +#define        SB_BUS                  0       /* Silicon Backplane */
7960 +#define        PCI_BUS                 1       /* PCI target */
7961 +#define        PCMCIA_BUS              2       /* PCMCIA target */
7962 +#define SDIO_BUS               3       /* SDIO target */
7963 +
7964 +/* Reference Board Types */
7965 +
7966 +#define        BU4710_BOARD            0x0400
7967 +#define        VSIM4710_BOARD          0x0401
7968 +#define        QT4710_BOARD            0x0402
7969 +
7970 +#define        BU4610_BOARD            0x0403
7971 +#define        VSIM4610_BOARD          0x0404
7972 +
7973 +#define        BU4307_BOARD            0x0405
7974 +#define        BCM94301CB_BOARD        0x0406
7975 +#define        BCM94301PC_BOARD        0x0406          /* Pcmcia 5v card */
7976 +#define        BCM94301MP_BOARD        0x0407
7977 +#define        BCM94307MP_BOARD        0x0408
7978 +#define        BCMAP4307_BOARD         0x0409
7979 +
7980 +#define        BU4309_BOARD            0x040a
7981 +#define        BCM94309CB_BOARD        0x040b
7982 +#define        BCM94309MP_BOARD        0x040c
7983 +#define        BCM4309AP_BOARD         0x040d
7984 +
7985 +#define        BCM94302MP_BOARD        0x040e
7986 +
7987 +#define        VSIM4310_BOARD          0x040f
7988 +#define        BU4711_BOARD            0x0410
7989 +#define        BCM94310U_BOARD         0x0411
7990 +#define        BCM94310AP_BOARD        0x0412
7991 +#define        BCM94310MP_BOARD        0x0414
7992 +
7993 +#define        BU4306_BOARD            0x0416
7994 +#define        BCM94306CB_BOARD        0x0417
7995 +#define        BCM94306MP_BOARD        0x0418
7996 +
7997 +#define        BCM94710D_BOARD         0x041a
7998 +#define        BCM94710R1_BOARD        0x041b
7999 +#define        BCM94710R4_BOARD        0x041c
8000 +#define        BCM94710AP_BOARD        0x041d
8001 +
8002 +
8003 +#define        BU2050_BOARD            0x041f
8004 +
8005 +
8006 +#define        BCM94309G_BOARD         0x0421
8007 +
8008 +#define        BCM94301PC3_BOARD       0x0422          /* Pcmcia 3.3v card */
8009 +
8010 +#define        BU4704_BOARD            0x0423
8011 +#define        BU4702_BOARD            0x0424
8012 +
8013 +#define        BCM94306PC_BOARD        0x0425          /* pcmcia 3.3v 4306 card */
8014 +
8015 +#define        BU4317_BOARD            0x0426
8016 +
8017 +
8018 +#define        BCM94702MN_BOARD        0x0428
8019 +
8020 +/* BCM4702 1U CompactPCI Board */
8021 +#define        BCM94702CPCI_BOARD      0x0429
8022 +
8023 +/* BCM4702 with BCM95380 VLAN Router */
8024 +#define        BCM95380RR_BOARD        0x042a
8025 +
8026 +/* cb4306 with SiGe PA */
8027 +#define        BCM94306CBSG_BOARD      0x042b
8028 +
8029 +/* mp4301 with 2050 radio */
8030 +#define        BCM94301MPL_BOARD       0x042c
8031 +
8032 +/* cb4306 with SiGe PA */
8033 +#define        PCSG94306_BOARD         0x042d
8034 +
8035 +/* bu4704 with sdram */
8036 +#define        BU4704SD_BOARD          0x042e
8037 +
8038 +/* Dual 11a/11g Router */
8039 +#define        BCM94704AGR_BOARD       0x042f
8040 +
8041 +/* 11a-only minipci */
8042 +#define        BCM94308MP_BOARD        0x0430
8043 +
8044 +
8045 +
8046 +/* BCM94317 boards */
8047 +#define BCM94317CB_BOARD       0x0440
8048 +#define BCM94317MP_BOARD       0x0441
8049 +#define BCM94317PCMCIA_BOARD   0x0442
8050 +#define BCM94317SDIO_BOARD     0x0443
8051 +
8052 +#define BU4712_BOARD           0x0444
8053 +
8054 +/* BCM4712 boards */
8055 +#define BCM94712AGR_BOARD      0x0445
8056 +#define BCM94712AP_BOARD       0x0446
8057 +
8058 +/* BCM4702 boards */
8059 +#define CT4702AP_BOARD         0x0447
8060 +
8061 +#endif /* _BCMDEVS_H */
8062 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmendian.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmendian.h
8063 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmendian.h       1970-01-01 01:00:00.000000000 +0100
8064 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmendian.h  2005-08-28 11:12:20.431859000 +0200
8065 @@ -0,0 +1,125 @@
8066 +/*******************************************************************************
8067 + * $Id$
8068 + * Copyright 2001-2003, Broadcom Corporation   
8069 + * All Rights Reserved.   
8070 + *    
8071 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
8072 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
8073 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
8074 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
8075 + * local version of endian.h - byte order defines
8076 + ******************************************************************************/
8077 +
8078 +#ifndef _BCMENDIAN_H_
8079 +#define _BCMENDIAN_H_
8080 +
8081 +#include <typedefs.h>
8082 +
8083 +/* Byte swap a 16 bit value */
8084 +#define BCMSWAP16(val) \
8085 +       ((uint16)( \
8086 +               (((uint16)(val) & (uint16)0x00ffU) << 8) | \
8087 +               (((uint16)(val) & (uint16)0xff00U) >> 8) ))
8088 +       
8089 +/* Byte swap a 32 bit value */
8090 +#define BCMSWAP32(val) \
8091 +       ((uint32)( \
8092 +               (((uint32)(val) & (uint32)0x000000ffUL) << 24) | \
8093 +               (((uint32)(val) & (uint32)0x0000ff00UL) <<  8) | \
8094 +               (((uint32)(val) & (uint32)0x00ff0000UL) >>  8) | \
8095 +               (((uint32)(val) & (uint32)0xff000000UL) >> 24) ))
8096 +
8097 +static INLINE uint16
8098 +bcmswap16(uint16 val)
8099 +{
8100 +       return BCMSWAP16(val);
8101 +}
8102 +
8103 +static INLINE uint32
8104 +bcmswap32(uint32 val)
8105 +{
8106 +       return BCMSWAP32(val);
8107 +}
8108 +
8109 +/* buf - start of buffer of shorts to swap */
8110 +/* len  - byte length of buffer */
8111 +static INLINE void
8112 +bcmswap16_buf(uint16 *buf, uint len)
8113 +{
8114 +       len = len/2;
8115 +
8116 +       while(len--){
8117 +               *buf = bcmswap16(*buf);
8118 +               buf++;
8119 +       }
8120 +}
8121 +
8122 +#ifndef hton16
8123 +#ifndef IL_BIGENDIAN
8124 +#define HTON16(i) BCMSWAP16(i)
8125 +#define        hton16(i) bcmswap16(i)
8126 +#define        hton32(i) bcmswap32(i)
8127 +#define        ntoh16(i) bcmswap16(i)
8128 +#define        ntoh32(i) bcmswap32(i)
8129 +#define ltoh16(i) (i)
8130 +#define ltoh32(i) (i)
8131 +#define htol16(i) (i)
8132 +#define htol32(i) (i)
8133 +#else
8134 +#define HTON16(i) (i)
8135 +#define        hton16(i) (i)
8136 +#define        hton32(i) (i)
8137 +#define        ntoh16(i) (i)
8138 +#define        ntoh32(i) (i)
8139 +#define        ltoh16(i) bcmswap16(i)
8140 +#define        ltoh32(i) bcmswap32(i)
8141 +#define htol16(i) bcmswap16(i)
8142 +#define htol32(i) bcmswap32(i)
8143 +#endif
8144 +#endif
8145 +
8146 +#ifndef IL_BIGENDIAN
8147 +#define ltoh16_buf(buf, i)
8148 +#define htol16_buf(buf, i)
8149 +#else
8150 +#define ltoh16_buf(buf, i) bcmswap16_buf((uint16*)buf, i)
8151 +#define htol16_buf(buf, i) bcmswap16_buf((uint16*)buf, i)
8152 +#endif
8153 +
8154 +/*
8155 +* load 16-bit value from unaligned little endian byte array.
8156 +*/
8157 +static INLINE uint16
8158 +ltoh16_ua(uint8 *bytes)
8159 +{
8160 +       return (bytes[1]<<8)+bytes[0];
8161 +}
8162 +
8163 +/*
8164 +* load 32-bit value from unaligned little endian byte array.
8165 +*/
8166 +static INLINE uint32
8167 +ltoh32_ua(uint8 *bytes)
8168 +{
8169 +       return (bytes[3]<<24)+(bytes[2]<<16)+(bytes[1]<<8)+bytes[0];
8170 +}
8171 +
8172 +/*
8173 +* load 16-bit value from unaligned big(network) endian byte array.
8174 +*/
8175 +static INLINE uint16
8176 +ntoh16_ua(uint8 *bytes)
8177 +{
8178 +       return (bytes[0]<<8)+bytes[1];
8179 +}
8180 +
8181 +/*
8182 +* load 32-bit value from unaligned big(network) endian byte array.
8183 +*/
8184 +static INLINE uint32
8185 +ntoh32_ua(uint8 *bytes)
8186 +{
8187 +       return (bytes[0]<<24)+(bytes[1]<<16)+(bytes[2]<<8)+bytes[3];
8188 +}
8189 +
8190 +#endif /* _BCMENDIAN_H_ */
8191 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmenet47xx.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmenet47xx.h
8192 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmenet47xx.h     1970-01-01 01:00:00.000000000 +0100
8193 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmenet47xx.h        2005-08-28 11:12:20.432858848 +0200
8194 @@ -0,0 +1,229 @@
8195 +/*
8196 + * Hardware-specific definitions for
8197 + * Broadcom BCM47XX 10/100 Mbps Ethernet cores.
8198 + *
8199 + * Copyright 2001-2003, Broadcom Corporation   
8200 + * All Rights Reserved.   
8201 + *    
8202 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
8203 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
8204 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
8205 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
8206 + * $Id$
8207 + */
8208 +
8209 +#ifndef        _bcmenet_47xx_h_
8210 +#define        _bcmenet_47xx_h_
8211 +
8212 +#include <bcmdevs.h>
8213 +#include <hnddma.h>
8214 +
8215 +#define        BCMENET_NFILTERS        64              /* # ethernet address filter entries */
8216 +#define        BCMENET_MCHASHBASE      0x200           /* multicast hash filter base address */
8217 +#define        BCMENET_MCHASHSIZE      256             /* multicast hash filter size in bytes */
8218 +#define        BCMENET_MAX_DMA         4096            /* chip has 12 bits of DMA addressing */
8219 +
8220 +/* power management event wakeup pattern constants */
8221 +#define        BCMENET_NPMP            4               /* chip supports 4 wakeup patterns */
8222 +#define        BCMENET_PMPBASE         0x400           /* wakeup pattern base address */
8223 +#define        BCMENET_PMPSIZE         0x80            /* 128bytes each pattern */
8224 +#define        BCMENET_PMMBASE         0x600           /* wakeup mask base address */
8225 +#define        BCMENET_PMMSIZE         0x10            /* 128bits each mask */
8226 +
8227 +/* cpp contortions to concatenate w/arg prescan */
8228 +#ifndef PAD
8229 +#define        _PADLINE(line)  pad ## line
8230 +#define        _XSTR(line)     _PADLINE(line)
8231 +#define        PAD             _XSTR(__LINE__)
8232 +#endif /* PAD */
8233 +
8234 +/* sometimes you just need the enet mib definitions */
8235 +#include <bcmenetmib.h>
8236 +
8237 +/*
8238 + * Host Interface Registers
8239 + */
8240 +typedef volatile struct _bcmenettregs {
8241 +       /* Device and Power Control */
8242 +       uint32  devcontrol;
8243 +       uint32  PAD[2];
8244 +       uint32  biststatus;
8245 +       uint32  wakeuplength;
8246 +       uint32  PAD[3];
8247 +       
8248 +       /* Interrupt Control */
8249 +       uint32  intstatus;
8250 +       uint32  intmask;
8251 +       uint32  gptimer;
8252 +       uint32  PAD[23];
8253 +
8254 +       /* Ethernet MAC Address Filtering Control */
8255 +       uint32  PAD[2];
8256 +       uint32  enetftaddr;
8257 +       uint32  enetftdata;
8258 +       uint32  PAD[2];
8259 +
8260 +       /* Ethernet MAC Control */
8261 +       uint32  emactxmaxburstlen;
8262 +       uint32  emacrxmaxburstlen;
8263 +       uint32  emaccontrol;
8264 +       uint32  emacflowcontrol;
8265 +
8266 +       uint32  PAD[20];
8267 +
8268 +       /* DMA Lazy Interrupt Control */
8269 +       uint32  intrecvlazy;
8270 +       uint32  PAD[63];
8271 +
8272 +       /* DMA engine */
8273 +       dmaregs_t       dmaregs;
8274 +       dmafifo_t       dmafifo;
8275 +       uint32  PAD[116];
8276 +
8277 +       /* EMAC Registers */
8278 +       uint32 rxconfig;
8279 +       uint32 rxmaxlength;
8280 +       uint32 txmaxlength;
8281 +       uint32 PAD;
8282 +       uint32 mdiocontrol;
8283 +       uint32 mdiodata;
8284 +       uint32 emacintmask;
8285 +       uint32 emacintstatus;
8286 +       uint32 camdatalo;
8287 +       uint32 camdatahi;
8288 +       uint32 camcontrol;
8289 +       uint32 enetcontrol;
8290 +       uint32 txcontrol;
8291 +       uint32 txwatermark;
8292 +       uint32 mibcontrol;
8293 +       uint32 PAD[49];
8294 +
8295 +       /* EMAC MIB counters */
8296 +       bcmenetmib_t    mib;
8297 +
8298 +       uint32  PAD[585];
8299 +
8300 +       /* Sonics SiliconBackplane config registers */
8301 +       sbconfig_t      sbconfig;
8302 +} bcmenetregs_t;
8303 +
8304 +/* device control */
8305 +#define        DC_PM           ((uint32)1 << 7)        /* pattern filtering enable */
8306 +#define        DC_IP           ((uint32)1 << 10)       /* internal ephy present (rev >= 1) */
8307 +#define        DC_ER           ((uint32)1 << 15)       /* ephy reset */
8308 +#define        DC_MP           ((uint32)1 << 16)       /* mii phy mode enable */
8309 +#define        DC_CO           ((uint32)1 << 17)       /* mii phy mode: enable clocks */
8310 +#define        DC_PA_MASK      0x7c0000                /* mii phy mode: mdc/mdio phy address */
8311 +#define        DC_PA_SHIFT     18
8312 +
8313 +/* wakeup length */
8314 +#define        WL_P0_MASK      0x7f                    /* pattern 0 */
8315 +#define        WL_D0           ((uint32)1 << 7)
8316 +#define        WL_P1_MASK      0x7f00                  /* pattern 1 */
8317 +#define        WL_P1_SHIFT     8
8318 +#define        WL_D1           ((uint32)1 << 15)
8319 +#define        WL_P2_MASK      0x7f0000                /* pattern 2 */
8320 +#define        WL_P2_SHIFT     16
8321 +#define        WL_D2           ((uint32)1 << 23)
8322 +#define        WL_P3_MASK      0x7f000000              /* pattern 3 */
8323 +#define        WL_P3_SHIFT     24
8324 +#define        WL_D3           ((uint32)1 << 31)
8325 +
8326 +/* intstatus and intmask */
8327 +#define        I_PME           ((uint32)1 << 6)        /* power management event */
8328 +#define        I_TO            ((uint32)1 << 7)        /* general purpose timeout */
8329 +#define        I_PC            ((uint32)1 << 10)       /* descriptor error */
8330 +#define        I_PD            ((uint32)1 << 11)       /* data error */
8331 +#define        I_DE            ((uint32)1 << 12)       /* descriptor protocol error */
8332 +#define        I_RU            ((uint32)1 << 13)       /* receive descriptor underflow */
8333 +#define        I_RO            ((uint32)1 << 14)       /* receive fifo overflow */
8334 +#define        I_XU            ((uint32)1 << 15)       /* transmit fifo underflow */
8335 +#define        I_RI            ((uint32)1 << 16)       /* receive interrupt */
8336 +#define        I_XI            ((uint32)1 << 24)       /* transmit interrupt */
8337 +#define        I_EM            ((uint32)1 << 26)       /* emac interrupt */
8338 +#define        I_MW            ((uint32)1 << 27)       /* mii write */
8339 +#define        I_MR            ((uint32)1 << 28)       /* mii read */
8340 +
8341 +/* emaccontrol */
8342 +#define        EMC_CG          ((uint32)1 << 0)        /* crc32 generation enable */
8343 +#define        EMC_EP          ((uint32)1 << 2)        /* onchip ephy: powerdown (rev >= 1) */
8344 +#define        EMC_ED          ((uint32)1 << 3)        /* onchip ephy: energy detected (rev >= 1) */
8345 +#define        EMC_LC_MASK     0xe0                    /* onchip ephy: led control (rev >= 1) */
8346 +#define        EMC_LC_SHIFT    5
8347 +
8348 +/* emacflowcontrol */
8349 +#define        EMF_RFH_MASK    0xff                    /* rx fifo hi water mark */
8350 +#define        EMF_PG          ((uint32)1 << 15)       /* enable pause frame generation */
8351 +
8352 +/* interrupt receive lazy */
8353 +#define        IRL_TO_MASK     0x00ffffff              /* timeout */
8354 +#define        IRL_FC_MASK     0xff000000              /* frame count */
8355 +#define        IRL_FC_SHIFT    24                      /* frame count */
8356 +
8357 +/* emac receive config */
8358 +#define        ERC_DB          ((uint32)1 << 0)        /* disable broadcast */
8359 +#define        ERC_AM          ((uint32)1 << 1)        /* accept all multicast */
8360 +#define        ERC_RDT         ((uint32)1 << 2)        /* receive disable while transmitting */
8361 +#define        ERC_PE          ((uint32)1 << 3)        /* promiscuous enable */
8362 +#define        ERC_LE          ((uint32)1 << 4)        /* loopback enable */
8363 +#define        ERC_FE          ((uint32)1 << 5)        /* enable flow control */
8364 +#define        ERC_UF          ((uint32)1 << 6)        /* accept unicast flow control frame */
8365 +#define        ERC_RF          ((uint32)1 << 7)        /* reject filter */
8366 +
8367 +/* emac mdio control */
8368 +#define        MC_MF_MASK      0x7f                    /* mdc frequency */
8369 +#define        MC_PE           ((uint32)1 << 7)        /* mii preamble enable */
8370 +
8371 +/* emac mdio data */
8372 +#define        MD_DATA_MASK    0xffff                  /* r/w data */
8373 +#define        MD_TA_MASK      0x30000                 /* turnaround value */
8374 +#define        MD_TA_SHIFT     16
8375 +#define        MD_TA_VALID     (2 << MD_TA_SHIFT)      /* valid ta */
8376 +#define        MD_RA_MASK      0x7c0000                /* register address */
8377 +#define        MD_RA_SHIFT     18
8378 +#define        MD_PMD_MASK     0xf800000               /* physical media device */
8379 +#define        MD_PMD_SHIFT    23
8380 +#define        MD_OP_MASK      0x30000000              /* opcode */
8381 +#define        MD_OP_SHIFT     28
8382 +#define        MD_OP_WRITE     (1 << MD_OP_SHIFT)      /* write op */
8383 +#define        MD_OP_READ      (2 << MD_OP_SHIFT)      /* read op */
8384 +#define        MD_SB_MASK      0xc0000000              /* start bits */
8385 +#define        MD_SB_SHIFT     30
8386 +#define        MD_SB_START     (0x1 << MD_SB_SHIFT)    /* start of frame */
8387 +
8388 +/* emac intstatus and intmask */
8389 +#define        EI_MII          ((uint32)1 << 0)        /* mii mdio interrupt */
8390 +#define        EI_MIB          ((uint32)1 << 1)        /* mib interrupt */
8391 +#define        EI_FLOW         ((uint32)1 << 2)        /* flow control interrupt */
8392 +
8393 +/* emac cam data high */
8394 +#define        CD_V            ((uint32)1 << 16)       /* valid bit */
8395 +
8396 +/* emac cam control */
8397 +#define        CC_CE           ((uint32)1 << 0)        /* cam enable */
8398 +#define        CC_MS           ((uint32)1 << 1)        /* mask select */
8399 +#define        CC_RD           ((uint32)1 << 2)        /* read */
8400 +#define        CC_WR           ((uint32)1 << 3)        /* write */
8401 +#define        CC_INDEX_MASK   0x3f0000                /* index */
8402 +#define        CC_INDEX_SHIFT  16
8403 +#define        CC_CB           ((uint32)1 << 31)       /* cam busy */
8404 +
8405 +/* emac ethernet control */
8406 +#define        EC_EE           ((uint32)1 << 0)        /* emac enable */
8407 +#define        EC_ED           ((uint32)1 << 1)        /* emac disable */
8408 +#define        EC_ES           ((uint32)1 << 2)        /* emac soft reset */
8409 +#define        EC_EP           ((uint32)1 << 3)        /* external phy select */
8410 +
8411 +/* emac transmit control */
8412 +#define        EXC_FD          ((uint32)1 << 0)        /* full duplex */
8413 +#define        EXC_FM          ((uint32)1 << 1)        /* flowmode */
8414 +#define        EXC_SB          ((uint32)1 << 2)        /* single backoff enable */
8415 +#define        EXC_SS          ((uint32)1 << 3)        /* small slottime */
8416 +
8417 +/* emac mib control */
8418 +#define        EMC_RZ          ((uint32)1 << 0)        /* autoclear on read */
8419 +
8420 +/* sometimes you just need the enet rxheader definitions */
8421 +#include <bcmenetrxh.h>
8422 +
8423 +#endif /* _bcmenet_47xx_h_ */
8424 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmenetmib.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmenetmib.h
8425 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmenetmib.h      1970-01-01 01:00:00.000000000 +0100
8426 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmenetmib.h 2005-08-28 11:12:20.432858848 +0200
8427 @@ -0,0 +1,81 @@
8428 +/*
8429 + * Hardware-specific MIB definition for
8430 + * Broadcom Home Networking Division
8431 + * BCM44XX and BCM47XX 10/100 Mbps Ethernet cores.
8432 + * 
8433 + * Copyright 2001-2003, Broadcom Corporation   
8434 + * All Rights Reserved.   
8435 + *    
8436 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
8437 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
8438 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
8439 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
8440 + * $Id$
8441 + */
8442 +
8443 +#ifndef _bcmenetmib_h_
8444 +#define _bcmenetmib_h_
8445 +
8446 +/* cpp contortions to concatenate w/arg prescan */
8447 +#ifndef PAD
8448 +#define        _PADLINE(line)  pad ## line
8449 +#define        _XSTR(line)     _PADLINE(line)
8450 +#define        PAD             _XSTR(__LINE__)
8451 +#endif /* PAD */
8452 +
8453 +/*
8454 + * EMAC MIB Registers
8455 + */
8456 +typedef volatile struct {
8457 +       uint32 tx_good_octets;
8458 +       uint32 tx_good_pkts;
8459 +       uint32 tx_octets;
8460 +       uint32 tx_pkts;
8461 +       uint32 tx_broadcast_pkts;
8462 +       uint32 tx_multicast_pkts;
8463 +       uint32 tx_len_64;
8464 +       uint32 tx_len_65_to_127;
8465 +       uint32 tx_len_128_to_255;
8466 +       uint32 tx_len_256_to_511;
8467 +       uint32 tx_len_512_to_1023;
8468 +       uint32 tx_len_1024_to_max;
8469 +       uint32 tx_jabber_pkts;
8470 +       uint32 tx_oversize_pkts;
8471 +       uint32 tx_fragment_pkts;
8472 +       uint32 tx_underruns;
8473 +       uint32 tx_total_cols;
8474 +       uint32 tx_single_cols;
8475 +       uint32 tx_multiple_cols;
8476 +       uint32 tx_excessive_cols;
8477 +       uint32 tx_late_cols;
8478 +       uint32 tx_defered;
8479 +       uint32 tx_carrier_lost;
8480 +       uint32 tx_pause_pkts;
8481 +       uint32 PAD[8];
8482 +
8483 +       uint32 rx_good_octets;
8484 +       uint32 rx_good_pkts;
8485 +       uint32 rx_octets;
8486 +       uint32 rx_pkts;
8487 +       uint32 rx_broadcast_pkts;
8488 +       uint32 rx_multicast_pkts;
8489 +       uint32 rx_len_64;
8490 +       uint32 rx_len_65_to_127;
8491 +       uint32 rx_len_128_to_255;
8492 +       uint32 rx_len_256_to_511;
8493 +       uint32 rx_len_512_to_1023;
8494 +       uint32 rx_len_1024_to_max;
8495 +       uint32 rx_jabber_pkts;
8496 +       uint32 rx_oversize_pkts;
8497 +       uint32 rx_fragment_pkts;
8498 +       uint32 rx_missed_pkts;
8499 +       uint32 rx_crc_align_errs;
8500 +       uint32 rx_undersize;
8501 +       uint32 rx_crc_errs;
8502 +       uint32 rx_align_errs;
8503 +       uint32 rx_symbol_errs;
8504 +       uint32 rx_pause_pkts;
8505 +       uint32 rx_nonpause_pkts;
8506 +} bcmenetmib_t;
8507 +
8508 +#endif /* _bcmenetmib_h_ */
8509 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmenetrxh.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmenetrxh.h
8510 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmenetrxh.h      1970-01-01 01:00:00.000000000 +0100
8511 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmenetrxh.h 2005-08-28 11:12:20.433858696 +0200
8512 @@ -0,0 +1,43 @@
8513 +/*
8514 + * Hardware-specific Receive Data Header for the
8515 + * Broadcom Home Networking Division
8516 + * BCM44XX and BCM47XX 10/100 Mbps Ethernet cores.
8517 + *
8518 + * Copyright 2001-2003, Broadcom Corporation   
8519 + * All Rights Reserved.   
8520 + *    
8521 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
8522 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
8523 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
8524 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
8525 + * $Id$
8526 + */
8527 +
8528 +#ifndef _bcmenetrxh_h_
8529 +#define        _bcmenetrxh_h_
8530 +
8531 +/*
8532 + * The Ethernet MAC core returns an 8-byte Receive Frame Data Header
8533 + * with every frame consisting of
8534 + * 16bits of frame length, followed by
8535 + * 16bits of EMAC rx descriptor info, followed by 32bits of undefined.
8536 + */
8537 +typedef volatile struct {
8538 +       uint16  len;
8539 +       uint16  flags;
8540 +       uint16  pad[12];
8541 +} bcmenetrxh_t;
8542 +
8543 +#define        RXHDR_LEN       28
8544 +
8545 +#define        RXF_L           ((uint16)1 << 11)       /* last buffer in a frame */
8546 +#define        RXF_MISS        ((uint16)1 << 7)        /* received due to promisc mode */
8547 +#define        RXF_BRDCAST     ((uint16)1 << 6)        /* dest is broadcast address */
8548 +#define        RXF_MULT        ((uint16)1 << 5)        /* dest is multicast address */
8549 +#define        RXF_LG          ((uint16)1 << 4)        /* frame length > rxmaxlength */
8550 +#define        RXF_NO          ((uint16)1 << 3)        /* odd number of nibbles */
8551 +#define        RXF_RXER        ((uint16)1 << 2)        /* receive symbol error */
8552 +#define        RXF_CRC         ((uint16)1 << 1)        /* crc error */
8553 +#define        RXF_OV          ((uint16)1 << 0)        /* fifo overflow */
8554 +
8555 +#endif /* _bcmenetrxh_h_ */
8556 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmnvram.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmnvram.h
8557 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmnvram.h        1970-01-01 01:00:00.000000000 +0100
8558 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmnvram.h   2005-08-28 11:12:20.433858696 +0200
8559 @@ -0,0 +1,131 @@
8560 +/*
8561 + * NVRAM variable manipulation
8562 + *
8563 + * $Copyright Open Broadcom Corporation$
8564 + *
8565 + * $Id: bcmnvram.h,v 1.1.1.1 2004/01/21 03:50:44 gigis Exp $
8566 + */
8567 +
8568 +#ifndef _bcmnvram_h_
8569 +#define _bcmnvram_h_
8570 +
8571 +#ifndef _LANGUAGE_ASSEMBLY
8572 +
8573 +#include <typedefs.h>
8574 +
8575 +struct nvram_header {
8576 +       uint32 magic;
8577 +       uint32 len;
8578 +       uint32 crc_ver_init;    /* 0:7 crc, 8:15 ver, 16:27 init, mem. test 28, 29-31 reserved */
8579 +       uint32 config_refresh;  /* 0:15 config, 16:31 refresh */
8580 +       uint32 config_ncdl;     /* ncdl values for memc */
8581 +};
8582 +
8583 +struct nvram_tuple {
8584 +       char *name;
8585 +       char *value;
8586 +       struct nvram_tuple *next;
8587 +};
8588 +
8589 +/*
8590 + * Initialize NVRAM access. May be unnecessary or undefined on certain
8591 + * platforms.
8592 + */
8593 +extern int nvram_init(void *sbh);
8594 +
8595 +/*
8596 + * Disable NVRAM access. May be unnecessary or undefined on certain
8597 + * platforms.
8598 + */
8599 +extern void nvram_exit(void);
8600 +
8601 +/*
8602 + * Get the value of an NVRAM variable. The pointer returned may be
8603 + * invalid after a set.
8604 + * @param      name    name of variable to get
8605 + * @return     value of variable or NULL if undefined
8606 + */
8607 +extern char * nvram_get(const char *name);
8608 +
8609 +/* 
8610 + * Get the value of an NVRAM variable.
8611 + * @param      name    name of variable to get
8612 + * @return     value of variable or NUL if undefined
8613 + */
8614 +#define nvram_safe_get(name) (nvram_get(name) ? : "")
8615 +
8616 +/*
8617 + * Match an NVRAM variable.
8618 + * @param      name    name of variable to match
8619 + * @param      match   value to compare against value of variable
8620 + * @return     TRUE if variable is defined and its value is string equal
8621 + *             to match or FALSE otherwise
8622 + */
8623 +static INLINE int
8624 +nvram_match(char *name, char *match) {
8625 +       const char *value = nvram_get(name);
8626 +       return (value && !strcmp(value, match));
8627 +}
8628 +
8629 +/*
8630 + * Inversely match an NVRAM variable.
8631 + * @param      name    name of variable to match
8632 + * @param      match   value to compare against value of variable
8633 + * @return     TRUE if variable is defined and its value is not string
8634 + *             equal to invmatch or FALSE otherwise
8635 + */
8636 +static INLINE int
8637 +nvram_invmatch(char *name, char *invmatch) {
8638 +       const char *value = nvram_get(name);
8639 +       return (value && strcmp(value, invmatch));
8640 +}
8641 +
8642 +/*
8643 + * Set the value of an NVRAM variable. The name and value strings are
8644 + * copied into private storage. Pointers to previously set values
8645 + * may become invalid. The new value may be immediately
8646 + * retrieved but will not be permanently stored until a commit.
8647 + * @param      name    name of variable to set
8648 + * @param      value   value of variable
8649 + * @return     0 on success and errno on failure
8650 + */
8651 +extern int nvram_set(const char *name, const char *value);
8652 +
8653 +/*
8654 + * Unset an NVRAM variable. Pointers to previously set values
8655 + * remain valid until a set.
8656 + * @param      name    name of variable to unset
8657 + * @return     0 on success and errno on failure
8658 + * NOTE: use nvram_commit to commit this change to flash.
8659 + */
8660 +extern int nvram_unset(const char *name);
8661 +
8662 +/*
8663 + * Commit NVRAM variables to permanent storage. All pointers to values
8664 + * may be invalid after a commit.
8665 + * NVRAM values are undefined after a commit.
8666 + * @return     0 on success and errno on failure
8667 + */
8668 +extern int nvram_commit(void);
8669 +
8670 +/*
8671 + * Get all NVRAM variables (format name=value\0 ... \0\0).
8672 + * @param      buf     buffer to store variables
8673 + * @param      count   size of buffer in bytes
8674 + * @return     0 on success and errno on failure
8675 + */
8676 +extern int nvram_getall(char *buf, int count);
8677 +
8678 +extern int kernel_write(unsigned char *buffer, int offset, int length);
8679 +
8680 +#endif /* _LANGUAGE_ASSEMBLY */
8681 +
8682 +#define NVRAM_MAGIC            0x48534C46      /* 'FLSH' */
8683 +#define NVRAM_VERSION          1
8684 +#define NVRAM_HEADER_SIZE      20
8685 +#define NVRAM_LOC_GAP          0x100000
8686 +#define NVRAM_SPACE            0x2000
8687 +#define NVRAM_FIRST_LOC                (0xbfd00000 - NVRAM_SPACE)
8688 +#define NVRAM_LAST_LOC         (0xc0000000 - NVRAM_SPACE)
8689 +
8690 +#endif /* _bcmnvram_h_ */
8691 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmsrom.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmsrom.h
8692 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmsrom.h 1970-01-01 01:00:00.000000000 +0100
8693 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmsrom.h    2005-08-28 11:12:20.433858696 +0200
8694 @@ -0,0 +1,24 @@
8695 +/*
8696 + * Misc useful routines to access NIC srom
8697 + *
8698 + * Copyright 2001-2003, Broadcom Corporation
8699 + * All Rights Reserved.
8700 + * 
8701 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8702 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
8703 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8704 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
8705 + *
8706 + * $Id$
8707 + */
8708 +
8709 +#ifndef        _bcmsrom_h_
8710 +#define        _bcmsrom_h_
8711 +
8712 +extern int srom_var_init(uint bus, void *curmap, void *osh, char **vars, int *count);
8713 +
8714 +extern int srom_read(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf);
8715 +extern int srom_write(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf);
8716 +extern int srom_parsecis(uint8 *cis, char **vars, int *count);
8717 +          
8718 +#endif /* _bcmsrom_h_ */
8719 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmutils.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmutils.h
8720 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmutils.h        1970-01-01 01:00:00.000000000 +0100
8721 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmutils.h   2005-08-28 11:12:20.435858392 +0200
8722 @@ -0,0 +1,136 @@
8723 +/*
8724 + * Misc useful os-independent macros and functions.
8725 + *
8726 + * Copyright 2001-2003, Broadcom Corporation   
8727 + * All Rights Reserved.   
8728 + *    
8729 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
8730 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
8731 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
8732 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
8733 + * $Id$
8734 + */
8735 +
8736 +#ifndef        _bcmutils_h_
8737 +#define        _bcmutils_h_
8738 +
8739 +#ifndef MIN
8740 +#define        MIN(a, b)               (((a)<(b))?(a):(b))
8741 +#endif
8742 +
8743 +#ifndef MAX
8744 +#define        MAX(a, b)               (((a)>(b))?(a):(b))
8745 +#endif
8746 +
8747 +#define CEIL(x, y)             (((x) + ((y)-1)) / (y))
8748 +#define        ROUNDUP(x, y)           ((((ulong)(x)+((y)-1))/(y))*(y))
8749 +#define        ISALIGNED(a, x)         (((uint)(a) & ((x)-1)) == 0)
8750 +#define        ISPOWEROF2(x)           ((((x)-1)&(x))==0)
8751 +#define        OFFSETOF(type, member)  ((uint) &((type *)0)->member)
8752 +#define ARRAYSIZE(a)           (sizeof(a)/sizeof(a[0]))
8753 +
8754 +/* bit map related macros */
8755 +#ifndef setbit
8756 +#define        NBBY    8       /* 8 bits per byte */
8757 +#define        setbit(a,i)     ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
8758 +#define        clrbit(a,i)     ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
8759 +#define        isset(a,i)      ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
8760 +#define        isclr(a,i)      (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
8761 +#endif
8762 +
8763 +#define        NBITS(type)     (sizeof (type) * 8)
8764 +
8765 +#define _BCM_U 0x01    /* upper */
8766 +#define _BCM_L 0x02    /* lower */
8767 +#define _BCM_D 0x04    /* digit */
8768 +#define _BCM_C 0x08    /* cntrl */
8769 +#define _BCM_P 0x10    /* punct */
8770 +#define _BCM_S 0x20    /* white space (space/lf/tab) */
8771 +#define _BCM_X 0x40    /* hex digit */
8772 +#define _BCM_SP        0x80    /* hard space (0x20) */
8773 +
8774 +extern unsigned char bcm_ctype[];
8775 +#define bcm_ismask(x) (bcm_ctype[(int)(unsigned char)(x)])
8776 +
8777 +#define bcm_isalnum(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L|_BCM_D)) != 0)
8778 +#define bcm_isalpha(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L)) != 0)
8779 +#define bcm_iscntrl(c) ((bcm_ismask(c)&(_BCM_C)) != 0)
8780 +#define bcm_isdigit(c) ((bcm_ismask(c)&(_BCM_D)) != 0)
8781 +#define bcm_isgraph(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D)) != 0)
8782 +#define bcm_islower(c) ((bcm_ismask(c)&(_BCM_L)) != 0)
8783 +#define bcm_isprint(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D|_BCM_SP)) != 0)
8784 +#define bcm_ispunct(c) ((bcm_ismask(c)&(_BCM_P)) != 0)
8785 +#define bcm_isspace(c) ((bcm_ismask(c)&(_BCM_S)) != 0)
8786 +#define bcm_isupper(c) ((bcm_ismask(c)&(_BCM_U)) != 0)
8787 +#define bcm_isxdigit(c)        ((bcm_ismask(c)&(_BCM_D|_BCM_X)) != 0)
8788 +
8789 +/*
8790 + * Spin at most 'us' microseconds while 'exp' is true.
8791 + * Caller should explicitly test 'exp' when this completes
8792 + * and take appropriate error action if 'exp' is still true.
8793 + */
8794 +#define SPINWAIT(exp, us) { \
8795 +       uint countdown = (us) + 9; \
8796 +       while ((exp) && (countdown >= 10)) {\
8797 +               OSL_DELAY(10); \
8798 +               countdown -= 10; \
8799 +       } \
8800 +}
8801 +
8802 +/* generic osl packet queue */
8803 +struct pktq {
8804 +       void *head;
8805 +       void *tail;
8806 +       uint  len;
8807 +       uint  maxlen; 
8808 +};
8809 +#define DEFAULT_QLEN   128
8810 +
8811 +#define        pktq_len(q)             ((q)->len)
8812 +#define        pktq_avail(q)   ((q)->maxlen - (q)->len)
8813 +#define        pktq_head(q)    ((q)->head)
8814 +#define        pktq_full(q)    ((q)->len >= (q)->maxlen)
8815 +
8816 +/* crc defines */
8817 +#define CRC8_INIT_VALUE  0xff          /* Initial CRC8 checksum value */
8818 +#define CRC8_GOOD_VALUE  0x9f          /* Good final CRC8 checksum value */
8819 +#define CRC16_INIT_VALUE 0xffff                /* Initial CRC16 checksum value */
8820 +#define CRC16_GOOD_VALUE 0xf0b8                /* Good final CRC16 checksum value */
8821 +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
8822 +#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */
8823 +
8824 +/* tag_ID/length/value_buffer tuple */
8825 +typedef struct bcm_tlv {
8826 +       uint8   id;
8827 +       uint8   len;
8828 +       uint8   data[1];
8829 +} bcm_tlv_t;
8830 +
8831 +/* externs */
8832 +extern uint bcm_atoi(char *s);
8833 +extern uchar bcm_toupper(uchar c);
8834 +extern ulong bcm_strtoul(char *cp, char **endp, uint base);
8835 +extern void deadbeef(char *p, uint len);
8836 +extern void prhex(char *msg, uchar *buf, uint len);
8837 +extern void prpkt(char *msg, void *drv, void *p0);
8838 +extern uint pktcopy(void *drv, void *p, uint offset, int len, uchar *buf);
8839 +extern uint pkttotlen(void *drv, void *);
8840 +extern uchar *bcm_ether_ntoa(char *ea, char *buf);
8841 +extern int bcm_ether_atoe(char *p, char *ea);
8842 +extern void bcm_mdelay(uint ms);
8843 +extern char *getvar(char *vars, char *name);
8844 +extern int getintvar(char *vars, char *name);
8845 +
8846 +extern uint8 crc8(uint8 *p, uint nbytes, uint8 crc);
8847 +extern uint16 crc16(uint8 *p, uint nbytes, uint16 crc);
8848 +extern uint32 crc32(uint8 *p, uint nbytes, uint32 crc);
8849 +extern bcm_tlv_t *bcm_parse_tlvs(void *buf, int buflen, uint key);
8850 +extern bcm_tlv_t *bcm_parse_ordered_tlvs(void *buf, int buflen, uint key);
8851 +extern void pktqinit(struct pktq *q, int maxlen);
8852 +extern void pktenq(struct pktq *q, void *p, bool lifo);
8853 +extern void *pktdeq(struct pktq *q);
8854 +
8855 +#define        bcmlog(fmt, a1, a2)
8856 +#define        bcmdumplog(buf, size)   *buf = '\0'
8857 +
8858 +#endif /* _bcmutils_h_ */
8859 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bitfuncs.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bitfuncs.h
8860 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bitfuncs.h        1970-01-01 01:00:00.000000000 +0100
8861 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bitfuncs.h   2005-08-28 11:12:20.435858392 +0200
8862 @@ -0,0 +1,85 @@
8863 +/*
8864 + * bit manipulation utility functions
8865 + *
8866 + * Copyright 2001-2003, Broadcom Corporation   
8867 + * All Rights Reserved.   
8868 + *    
8869 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
8870 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
8871 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
8872 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
8873 + * $Id$
8874 + */
8875 +
8876 +#ifndef _BITFUNCS_H
8877 +#define _BITFUNCS_H
8878 +
8879 +#include <typedefs.h>
8880 +
8881 +/* local prototypes */
8882 +static INLINE uint32 find_msbit(uint32 x);
8883 +
8884 +
8885 +/*
8886 + * find_msbit: returns index of most significant set bit in x, with index
8887 + *   range defined as 0-31.  NOTE: returns zero if input is zero.
8888 + */
8889 +
8890 +#if defined(USE_PENTIUM_BSR) && defined(__GNUC__)
8891 +
8892 +/*
8893 + * Implementation for Pentium processors and gcc.  Note that this
8894 + * instruction is actually very slow on some processors (e.g., family 5,
8895 + * model 2, stepping 12, "Pentium 75 - 200"), so we use the generic
8896 + * implementation instead.
8897 + */
8898 +static INLINE uint32 find_msbit(uint32 x)
8899 +{
8900 +       uint msbit;
8901 +        __asm__("bsrl %1,%0"
8902 +                :"=r" (msbit)
8903 +                :"r" (x));
8904 +        return msbit;
8905 +}
8906 +
8907 +#else
8908 +
8909 +/*
8910 + * Generic Implementation
8911 + */
8912 +
8913 +#define DB_POW_MASK16  0xffff0000
8914 +#define DB_POW_MASK8   0x0000ff00
8915 +#define DB_POW_MASK4   0x000000f0
8916 +#define DB_POW_MASK2   0x0000000c
8917 +#define DB_POW_MASK1   0x00000002
8918 +
8919 +static INLINE uint32 find_msbit(uint32 x)
8920 +{
8921 +       uint32 temp_x = x;
8922 +       uint msbit = 0;
8923 +       if (temp_x & DB_POW_MASK16) {
8924 +               temp_x >>= 16;
8925 +               msbit = 16;
8926 +       }
8927 +       if (temp_x & DB_POW_MASK8) {
8928 +               temp_x >>= 8;
8929 +               msbit += 8;
8930 +       }
8931 +       if (temp_x & DB_POW_MASK4) {
8932 +               temp_x >>= 4;
8933 +               msbit += 4;
8934 +       }
8935 +       if (temp_x & DB_POW_MASK2) {
8936 +               temp_x >>= 2;
8937 +               msbit += 2;
8938 +       }
8939 +       if (temp_x & DB_POW_MASK1) {
8940 +               msbit += 1;
8941 +       }
8942 +       return(msbit);
8943 +}
8944 +
8945 +#endif
8946 +
8947 +#endif /* _BITFUNCS_H */
8948 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/epivers.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/epivers.h
8949 --- linux-2.6.12.5/arch/mips/bcm947xx/include/epivers.h 1970-01-01 01:00:00.000000000 +0100
8950 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/epivers.h    2005-08-28 11:12:20.435858392 +0200
8951 @@ -0,0 +1,69 @@
8952 +/*
8953 + * Copyright 2001-2003, Broadcom Corporation
8954 + * All Rights Reserved.
8955 + * 
8956 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8957 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
8958 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8959 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
8960 + *
8961 + * $Id$
8962 + *
8963 +*/
8964 +
8965 +#ifndef _epivers_h_
8966 +#define _epivers_h_
8967 +
8968 +#ifdef linux
8969 +#include <linux/config.h>
8970 +#endif
8971 +
8972 +/* Vendor Name, ASCII, 32 chars max */
8973 +#ifdef COMPANYNAME
8974 +#define        HPNA_VENDOR             COMPANYNAME
8975 +#else
8976 +#define        HPNA_VENDOR             "Broadcom Corporation"
8977 +#endif
8978 +
8979 +/* Driver Date, ASCII, 32 chars max */
8980 +#define HPNA_DRV_BUILD_DATE    __DATE__
8981 +
8982 +/* Hardware Manufacture Date, ASCII, 32 chars max */
8983 +#define HPNA_HW_MFG_DATE       "Not Specified"
8984 +
8985 +/* See documentation for Device Type values, 32 values max */
8986 +#ifndef        HPNA_DEV_TYPE
8987 +
8988 +#if    defined(CONFIG_BRCM_VJ)
8989 +#define HPNA_DEV_TYPE          { CDCF_V0_DEVICE_DISPLAY }
8990 +
8991 +#elif  defined(CONFIG_BCRM_93725)
8992 +#define HPNA_DEV_TYPE          { CDCF_V0_DEVICE_CM_BRIDGE, CDCF_V0_DEVICE_DISPLAY }
8993 +
8994 +#else
8995 +#define HPNA_DEV_TYPE          { CDCF_V0_DEVICE_PCINIC }
8996 +
8997 +#endif
8998 +
8999 +#endif /* !HPNA_DEV_TYPE */
9000 +
9001 +
9002 +#define        EPI_MAJOR_VERSION       1
9003 +
9004 +#define        EPI_MINOR_VERSION       1
9005 +
9006 +#define        EPI_RC_NUMBER           2
9007 +
9008 +#define        EPI_INCREMENTAL_NUMBER  0
9009 +
9010 +#define        EPI_BUILD_NUMBER        0
9011 +
9012 +#define        EPI_VERSION             1,1,2,0
9013 +
9014 +#define        EPI_VERSION_NUM         0x01010200
9015 +
9016 +/* Driver Version String, ASCII, 32 chars max */
9017 +#define        EPI_VERSION_STR         "1.1.2.0"
9018 +#define        EPI_ROUTER_VERSION_STR  "1.1.2.0"
9019 +
9020 +#endif /* _epivers_h_ */
9021 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/epivers.h.in linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/epivers.h.in
9022 --- linux-2.6.12.5/arch/mips/bcm947xx/include/epivers.h.in      1970-01-01 01:00:00.000000000 +0100
9023 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/epivers.h.in 2005-08-28 11:12:20.436858240 +0200
9024 @@ -0,0 +1,69 @@
9025 +/*
9026 + * Copyright 2001-2003, Broadcom Corporation
9027 + * All Rights Reserved.
9028 + * 
9029 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9030 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9031 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9032 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9033 + *
9034 + * $Id$
9035 + *
9036 +*/
9037 +
9038 +#ifndef _epivers_h_
9039 +#define _epivers_h_
9040 +
9041 +#ifdef linux
9042 +#include <linux/config.h>
9043 +#endif
9044 +
9045 +/* Vendor Name, ASCII, 32 chars max */
9046 +#ifdef COMPANYNAME
9047 +#define        HPNA_VENDOR             COMPANYNAME
9048 +#else
9049 +#define        HPNA_VENDOR             "Broadcom Corporation"
9050 +#endif
9051 +
9052 +/* Driver Date, ASCII, 32 chars max */
9053 +#define HPNA_DRV_BUILD_DATE    __DATE__
9054 +
9055 +/* Hardware Manufacture Date, ASCII, 32 chars max */
9056 +#define HPNA_HW_MFG_DATE       "Not Specified"
9057 +
9058 +/* See documentation for Device Type values, 32 values max */
9059 +#ifndef        HPNA_DEV_TYPE
9060 +
9061 +#if    defined(CONFIG_BRCM_VJ)
9062 +#define HPNA_DEV_TYPE          { CDCF_V0_DEVICE_DISPLAY }
9063 +
9064 +#elif  defined(CONFIG_BCRM_93725)
9065 +#define HPNA_DEV_TYPE          { CDCF_V0_DEVICE_CM_BRIDGE, CDCF_V0_DEVICE_DISPLAY }
9066 +
9067 +#else
9068 +#define HPNA_DEV_TYPE          { CDCF_V0_DEVICE_PCINIC }
9069 +
9070 +#endif
9071 +
9072 +#endif /* !HPNA_DEV_TYPE */
9073 +
9074 +
9075 +#define        EPI_MAJOR_VERSION       @EPI_MAJOR_VERSION@
9076 +
9077 +#define        EPI_MINOR_VERSION       @EPI_MINOR_VERSION@
9078 +
9079 +#define        EPI_RC_NUMBER           @EPI_RC_NUMBER@
9080 +
9081 +#define        EPI_INCREMENTAL_NUMBER  @EPI_INCREMENTAL_NUMBER@
9082 +
9083 +#define        EPI_BUILD_NUMBER        @EPI_BUILD_NUMBER@
9084 +
9085 +#define        EPI_VERSION             @EPI_VERSION@
9086 +
9087 +#define        EPI_VERSION_NUM         @EPI_VERSION_NUM@
9088 +
9089 +/* Driver Version String, ASCII, 32 chars max */
9090 +#define        EPI_VERSION_STR         "@EPI_VERSION_STR@"
9091 +#define        EPI_ROUTER_VERSION_STR  "@EPI_ROUTER_VERSION_STR@"
9092 +
9093 +#endif /* _epivers_h_ */
9094 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/etsockio.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/etsockio.h
9095 --- linux-2.6.12.5/arch/mips/bcm947xx/include/etsockio.h        1970-01-01 01:00:00.000000000 +0100
9096 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/etsockio.h   2005-08-28 11:12:20.436858240 +0200
9097 @@ -0,0 +1,60 @@
9098 +/*
9099 + * Driver-specific socket ioctls
9100 + * used by BSD, Linux, and PSOS
9101 + * Broadcom BCM44XX 10/100Mbps Ethernet Device Driver
9102 + *
9103 + * Copyright 2001-2003, Broadcom Corporation   
9104 + * All Rights Reserved.   
9105 + *    
9106 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
9107 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
9108 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
9109 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
9110 + *
9111 + * $Id$
9112 + */
9113 +
9114 +#ifndef _etsockio_h_
9115 +#define _etsockio_h_
9116 +
9117 +/* THESE MUST BE CONTIGUOUS AND CONSISTENT WITH VALUES IN ETC.H */
9118 +
9119 +
9120 +#if defined(linux)
9121 +#define SIOCSETCUP             (SIOCDEVPRIVATE + 0)
9122 +#define SIOCSETCDOWN           (SIOCDEVPRIVATE + 1)
9123 +#define SIOCSETCLOOP           (SIOCDEVPRIVATE + 2)
9124 +#define SIOCGETCDUMP           (SIOCDEVPRIVATE + 3)
9125 +#define SIOCSETCSETMSGLEVEL    (SIOCDEVPRIVATE + 4)
9126 +#define SIOCSETCPROMISC                (SIOCDEVPRIVATE + 5)
9127 +#define SIOCSETCTXDOWN         (SIOCDEVPRIVATE + 6)    /* obsolete */
9128 +#define SIOCSETCSPEED          (SIOCDEVPRIVATE + 7)
9129 +#define SIOCTXGEN              (SIOCDEVPRIVATE + 8)
9130 +#define SIOCGETCPHYRD          (SIOCDEVPRIVATE + 9)
9131 +#define SIOCSETCPHYWR          (SIOCDEVPRIVATE + 10)
9132 +#define SIOCPERF                   (SIOCDEVPRIVATE + 11)
9133 +#define SIOCPERFDMA                (SIOCDEVPRIVATE + 12)
9134 +
9135 +#else  /* !linux */
9136 +
9137 +#define SIOCSETCUP             _IOWR('e', 130 + 0, struct ifreq)
9138 +#define SIOCSETCDOWN           _IOWR('e', 130 + 1, struct ifreq)
9139 +#define SIOCSETCLOOP           _IOWR('e', 130 + 2, struct ifreq)
9140 +#define SIOCGETCDUMP           _IOWR('e', 130 + 3, struct ifreq)
9141 +#define SIOCSETCSETMSGLEVEL    _IOWR('e', 130 + 4, struct ifreq)
9142 +#define SIOCSETCPROMISC                _IOWR('e', 130 + 5, struct ifreq)
9143 +#define SIOCSETCTXDOWN         _IOWR('e', 130 + 6, struct ifreq)       /* obsolete */
9144 +#define SIOCSETCSPEED          _IOWR('e', 130 + 7, struct ifreq)
9145 +#define SIOCTXGEN              _IOWR('e', 130 + 8, struct ifreq)
9146 +
9147 +#endif
9148 +
9149 +/* arg to SIOCTXGEN */
9150 +struct txg {
9151 +       uint32 num;             /* number of frames to send */
9152 +       uint32 delay;           /* delay in microseconds between sending each */
9153 +       uint32 size;            /* size of ether frame to send */
9154 +       uchar buf[1514];        /* starting ether frame data */
9155 +};
9156 +
9157 +#endif
9158 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/flash.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/flash.h
9159 --- linux-2.6.12.5/arch/mips/bcm947xx/include/flash.h   1970-01-01 01:00:00.000000000 +0100
9160 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/flash.h      2005-08-28 11:12:20.437858088 +0200
9161 @@ -0,0 +1,184 @@
9162 +/*
9163 + * flash.h: Common definitions for flash access.
9164 + *
9165 + * Copyright 2001-2003, Broadcom Corporation   
9166 + * All Rights Reserved.   
9167 + *    
9168 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
9169 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
9170 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
9171 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
9172 + *
9173 + * $Id$
9174 + */
9175 +
9176 +/* Types of flashes we know about */
9177 +typedef enum _flash_type {OLD, BSC, SCS, AMD, SST} flash_type_t;
9178 +
9179 +/* Commands to write/erase the flases */
9180 +typedef struct _flash_cmds{
9181 +       flash_type_t    type;
9182 +       bool            need_unlock;
9183 +       uint16          pre_erase;
9184 +       uint16          erase_block;
9185 +       uint16          erase_chip;
9186 +       uint16          write_word;
9187 +       uint16          write_buf;
9188 +       uint16          clear_csr;
9189 +       uint16          read_csr;
9190 +       uint16          read_id;
9191 +       uint16          confirm;
9192 +       uint16          read_array;
9193 +} flash_cmds_t;
9194 +
9195 +#define        UNLOCK_CMD_WORDS        2
9196 +
9197 +typedef struct _unlock_cmd {
9198 +  uint         addr[UNLOCK_CMD_WORDS];
9199 +  uint16       cmd[UNLOCK_CMD_WORDS];
9200 +} unlock_cmd_t;
9201 +
9202 +/* Flash descriptors */
9203 +typedef struct _flash_desc {
9204 +       uint16          mfgid;          /* Manufacturer Id */
9205 +       uint16          devid;          /* Device Id */
9206 +       uint            size;           /* Total size in bytes */
9207 +       uint            width;          /* Device width in bytes */
9208 +       flash_type_t    type;           /* Device type old, S, J */
9209 +       uint            bsize;          /* Block size */
9210 +       uint            nb;             /* Number of blocks */
9211 +       uint            ff;             /* First full block */
9212 +       uint            lf;             /* Last full block */
9213 +       uint            nsub;           /* Number of subblocks */
9214 +       uint            *subblocks;     /* Offsets for subblocks */
9215 +       char            *desc;          /* Description */
9216 +} flash_desc_t;
9217 +
9218 +
9219 +#ifdef DECLARE_FLASHES
9220 +
9221 +flash_cmds_t flash_cmds[] = {
9222 +/*       type  needu   preera  eraseb  erasech write   wbuf    clcsr   rdcsr   rdid    confrm  read */
9223 +       { BSC,  0,      0x00,   0x20,   0x00,   0x40,   0x00,   0x50,   0x70,   0x90,   0xd0,   0xff },
9224 +       { SCS,  0,      0x00,   0x20,   0x00,   0x40,   0xe8,   0x50,   0x70,   0x90,   0xd0,   0xff },
9225 +       { AMD,  1,      0x80,   0x30,   0x10,   0xa0,   0x00,   0x00,   0x00,   0x90,   0x00,   0xf0 },
9226 +       { SST,  1,      0x80,   0x50,   0x10,   0xa0,   0x00,   0x00,   0x00,   0x90,   0x00,   0xf0 },
9227 +       { 0 }
9228 +};
9229 +
9230 +unlock_cmd_t unlock_cmd_amd = {
9231 +#ifdef MIPSEB
9232 +/* addr: */    { 0x0aa8,       0x0556},
9233 +#else
9234 +/* addr: */    { 0x0aaa,       0x0554},
9235 +#endif
9236 +/* data: */    { 0xaa,         0x55}
9237 +};
9238 +
9239 +unlock_cmd_t unlock_cmd_sst = {
9240 +#ifdef MIPSEB
9241 +/* addr: */    { 0xaaa8,       0x5556},
9242 +#else
9243 +/* addr: */    { 0xaaaa,       0x5554},
9244 +#endif
9245 +/* data: */    { 0xaa,         0x55}
9246 +};
9247 +
9248 +#define AMD_CMD 0xaaa
9249 +#define SST_CMD 0xaaaa
9250 +
9251 +/* intel unlock block cmds */
9252 +#define INTEL_UNLOCK1  0x60
9253 +#define INTEL_UNLOCK2  0xD0
9254 +
9255 +/* Just eight blocks of 8KB byte each */
9256 +
9257 +uint blk8x8k[] = { 0x00000000,
9258 +                  0x00002000,
9259 +                  0x00004000,
9260 +                  0x00006000,
9261 +                  0x00008000,
9262 +                  0x0000a000,
9263 +                  0x0000c000,
9264 +                  0x0000e000,
9265 +                  0x00010000
9266 +};
9267 +
9268 +/* Funky AMD arrangement for 29xx800's */
9269 +uint amd800[] = { 0x00000000,          /* 16KB */
9270 +                 0x00004000,           /* 32KB */
9271 +                 0x0000c000,           /* 8KB */
9272 +                 0x0000e000,           /* 8KB */
9273 +                 0x00010000,           /* 8KB */
9274 +                 0x00012000,           /* 8KB */
9275 +                 0x00014000,           /* 32KB */
9276 +                 0x0001c000,           /* 16KB */
9277 +                 0x00020000
9278 +};
9279 +
9280 +/* AMD arrangement for 29xx160's */
9281 +uint amd4112[] = { 0x00000000,         /* 32KB */
9282 +                  0x00008000,          /* 8KB */
9283 +                  0x0000a000,          /* 8KB */
9284 +                  0x0000c000,          /* 16KB */
9285 +                  0x00010000
9286 +};
9287 +uint amd2114[] = { 0x00000000,         /* 16KB */
9288 +                  0x00004000,          /* 8KB */
9289 +                  0x00006000,          /* 8KB */
9290 +                  0x00008000,          /* 32KB */
9291 +                  0x00010000
9292 +};
9293 +
9294 +
9295 +
9296 +flash_desc_t flashes[] = {
9297 +       { 0x00b0, 0x00d0, 0x0200000, 2, SCS, 0x10000, 32,  0, 31,  0, NULL,    "Intel 28F160S3/5 1Mx16" },
9298 +       { 0x00b0, 0x00d4, 0x0400000, 2, SCS, 0x10000, 64,  0, 63,  0, NULL,    "Intel 28F320S3/5 2Mx16" },
9299 +       { 0x0089, 0x8890, 0x0200000, 2, BSC, 0x10000, 32,  0, 30,  8, blk8x8k, "Intel 28F160B3 1Mx16 TopB" },
9300 +       { 0x0089, 0x8891, 0x0200000, 2, BSC, 0x10000, 32,  1, 31,  8, blk8x8k, "Intel 28F160B3 1Mx16 BotB" },
9301 +       { 0x0089, 0x8896, 0x0400000, 2, BSC, 0x10000, 64,  0, 62,  8, blk8x8k, "Intel 28F320B3 2Mx16 TopB" },
9302 +       { 0x0089, 0x8897, 0x0400000, 2, BSC, 0x10000, 64,  1, 63,  8, blk8x8k, "Intel 28F320B3 2Mx16 BotB" },
9303 +       { 0x0089, 0x8898, 0x0800000, 2, BSC, 0x10000, 128, 0, 126, 8, blk8x8k, "Intel 28F640B3 4Mx16 TopB" },
9304 +       { 0x0089, 0x8899, 0x0800000, 2, BSC, 0x10000, 128, 1, 127, 8, blk8x8k, "Intel 28F640B3 4Mx16 BotB" },
9305 +       { 0x0089, 0x88C2, 0x0200000, 2, BSC, 0x10000, 32,  0, 30,  8, blk8x8k, "Intel 28F160C3 1Mx16 TopB" },
9306 +       { 0x0089, 0x88C3, 0x0200000, 2, BSC, 0x10000, 32,  1, 31,  8, blk8x8k, "Intel 28F160C3 1Mx16 BotB" },
9307 +       { 0x0089, 0x88C4, 0x0400000, 2, BSC, 0x10000, 64,  0, 62,  8, blk8x8k, "Intel 28F320C3 2Mx16 TopB" },
9308 +       { 0x0089, 0x88C5, 0x0400000, 2, BSC, 0x10000, 64,  1, 63,  8, blk8x8k, "Intel 28F320C3 2Mx16 BotB" },
9309 +       { 0x0089, 0x88CC, 0x0800000, 2, BSC, 0x10000, 128, 0, 126, 8, blk8x8k, "Intel 28F640C3 4Mx16 TopB" },
9310 +       { 0x0089, 0x88CD, 0x0800000, 2, BSC, 0x10000, 128, 1, 127, 8, blk8x8k, "Intel 28F640C3 4Mx16 BotB" },
9311 +       { 0x0089, 0x0014, 0x0400000, 2, SCS, 0x20000, 32,  0, 31,  0, NULL,    "Intel 28F320J5 2Mx16" },
9312 +       { 0x0089, 0x0015, 0x0800000, 2, SCS, 0x20000, 64,  0, 63,  0, NULL,    "Intel 28F640J5 4Mx16" },
9313 +       { 0x0089, 0x0016, 0x0400000, 2, SCS, 0x20000, 32,  0, 31,  0, NULL,    "Intel 28F320J3 2Mx16" },
9314 +       { 0x0089, 0x0017, 0x0800000, 2, SCS, 0x20000, 64,  0, 63,  0, NULL,    "Intel 28F640J3 4Mx16" },
9315 +       { 0x0089, 0x0018, 0x1000000, 2, SCS, 0x20000, 128, 0, 127, 0, NULL,    "Intel 28F128J3 8Mx16" },
9316 +       { 0x00b0, 0x00e3, 0x0400000, 2, BSC, 0x10000, 64,  1, 63,  8, blk8x8k, "Sharp 28F320BJE 2Mx16 BotB" },
9317 +       { 0x0001, 0x224a, 0x0100000, 2, AMD, 0x10000, 16,  0, 13,  8, amd800,  "AMD 29DL800BT 512Kx16 TopB" },
9318 +       { 0x0001, 0x22cb, 0x0100000, 2, AMD, 0x10000, 16,  2, 15,  8, amd800,  "AMD 29DL800BB 512Kx16 BotB" },
9319 +       { 0x0001, 0x22c4, 0x0200000, 2, AMD, 0x10000, 32,  0, 30,  4, amd2114, "AMD 29lv160DT 1Mx16 TopB" },
9320 +       { 0x0001, 0x2249, 0x0200000, 2, AMD, 0x10000, 32,  1, 31,  4, amd4112, "AMD 29lv160DB 1Mx16 BotB" },
9321 +       { 0x0001, 0x22f6, 0x0400000, 2, AMD, 0x10000, 64,  0, 62,  8, blk8x8k, "AMD 29lv320DT 2Mx16 TopB" },
9322 +       { 0x0001, 0x22f9, 0x0400000, 2, AMD, 0x10000, 64,  1, 63,  8, blk8x8k, "AMD 29lv320DB 2Mx16 BotB" },
9323 +       { 0x0001, 0x2201, 0x0400000, 2, AMD, 0x10000, 64,  0, 62,  8, blk8x8k, "AMD 29lv320MT 2Mx16 TopB" },
9324 +       { 0x0001, 0x2200, 0x0400000, 2, AMD, 0x10000, 64,  1, 63,  8, blk8x8k, "AMD 29lv320MB 2Mx16 BotB" },
9325 +       { 0x0020, 0x22CA, 0x0400000, 2, AMD, 0x10000, 64,  0, 62,  4, amd4112, "ST 29w320DT 2Mx16 TopB" },
9326 +       { 0x0020, 0x22CB, 0x0400000, 2, AMD, 0x10000, 64,  1, 63,  4, amd2114, "ST 29w320DB 2Mx16 BotB" },
9327 +       { 0x00C2, 0x00A7, 0x0400000, 2, AMD, 0x10000, 64,  0, 62,  4, amd4112, "MX29LV320T 2Mx16 TopB" },
9328 +       { 0x00C2, 0x00A8, 0x0400000, 2, AMD, 0x10000, 64,  1, 63,  4, amd2114, "MX29LV320B 2Mx16 BotB" },
9329 +       { 0x0004, 0x22F6, 0x0400000, 2, AMD, 0x10000, 64,  0, 62,  4, amd4112, "MBM29LV320TE 2Mx16 TopB" },
9330 +       { 0x0004, 0x22F9, 0x0400000, 2, AMD, 0x10000, 64,  1, 63,  4, amd2114, "MBM29LV320BE 2Mx16 BotB" },
9331 +       { 0x0098, 0x009A, 0x0400000, 2, AMD, 0x10000, 64,  0, 62,  4, amd4112, "TC58FVT321 2Mx16 TopB" },
9332 +       { 0x0098, 0x009C, 0x0400000, 2, AMD, 0x10000, 64,  1, 63,  4, amd2114, "TC58FVB321 2Mx16 BotB" }, 
9333 +       { 0x00C2, 0x22A7, 0x0400000, 2, AMD, 0x10000, 64,  0, 62,  4, amd4112, "MX29LV320T 2Mx16 TopB" },
9334 +       { 0x00C2, 0x22A8, 0x0400000, 2, AMD, 0x10000, 64,  1, 63,  4, amd2114, "MX29LV320B 2Mx16 BotB" },
9335 +       { 0x00BF, 0x2783, 0x0400000, 2, SST, 0x10000, 64,  0, 63,  0, NULL,    "SST39VF320 2Mx16" },
9336 +       { 0,      0,      0,         0, OLD, 0,       0,   0, 0,   0, NULL,    NULL },
9337 +};
9338 +
9339 +#else
9340 +
9341 +extern flash_cmds_t flash_cmds[];
9342 +extern unlock_cmd_t unlock_cmd;
9343 +extern flash_desc_t flashes[];
9344 +
9345 +#endif
9346 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/flashutl.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/flashutl.h
9347 --- linux-2.6.12.5/arch/mips/bcm947xx/include/flashutl.h        1970-01-01 01:00:00.000000000 +0100
9348 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/flashutl.h   2005-08-28 11:12:20.437858088 +0200
9349 @@ -0,0 +1,34 @@
9350 +/*
9351 + * BCM47XX FLASH driver interface
9352 + *
9353 + * Copyright 2001-2003, Broadcom Corporation   
9354 + * All Rights Reserved.   
9355 + *    
9356 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
9357 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
9358 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
9359 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
9360 + * $Id$
9361 + */
9362 +
9363 +#ifndef _flashutl_h_
9364 +#define _flashutl_h_
9365 +
9366 +#define FLASH_BASE      0xbfc00000             /* BCM4710 */
9367 +
9368 +int    flash_init(void* base_addr, char *flash_str);
9369 +int    flash_erase(void);
9370 +int    flash_eraseblk(unsigned long off);
9371 +int    flash_write(unsigned long off, uint16 *src, uint nbytes);
9372 +unsigned long  flash_block_base(unsigned long off);
9373 +unsigned long  flash_block_lim(unsigned long off);
9374 +int FlashWriteRange(unsigned short* dst, unsigned short* src, unsigned int numbytes);
9375 +
9376 +void nvWrite(unsigned short *data, unsigned int len);
9377 +
9378 +/* Global vars */
9379 +extern char*           flashutl_base;
9380 +extern flash_desc_t*   flashutl_desc;
9381 +extern flash_cmds_t*   flashutl_cmd;
9382 +
9383 +#endif /* _flashutl_h_ */
9384 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/hnddma.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/hnddma.h
9385 --- linux-2.6.12.5/arch/mips/bcm947xx/include/hnddma.h  1970-01-01 01:00:00.000000000 +0100
9386 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/hnddma.h     2005-08-28 11:12:20.438857936 +0200
9387 @@ -0,0 +1,181 @@
9388 +/*
9389 + * Generic Broadcom Home Networking Division (HND) DMA engine definitions.
9390 + * This supports the following chips: BCM42xx, 44xx, 47xx .
9391 + *
9392 + * $Id$
9393 + * Copyright 2001-2003, Broadcom Corporation   
9394 + * All Rights Reserved.   
9395 + *    
9396 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
9397 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
9398 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
9399 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
9400 + */
9401 +
9402 +#ifndef        _hnddma_h_
9403 +#define        _hnddma_h_
9404 +
9405 +/*
9406 + * Each DMA processor consists of a transmit channel and a receive channel.
9407 + */
9408 +typedef volatile struct {
9409 +       /* transmit channel */
9410 +       uint32  xmtcontrol;                     /* enable, et al */
9411 +       uint32  xmtaddr;                        /* descriptor ring base address (4K aligned) */
9412 +       uint32  xmtptr;                         /* last descriptor posted to chip */
9413 +       uint32  xmtstatus;                      /* current active descriptor, et al */
9414 +
9415 +       /* receive channel */
9416 +       uint32  rcvcontrol;                     /* enable, et al */
9417 +       uint32  rcvaddr;                        /* descriptor ring base address (4K aligned) */
9418 +       uint32  rcvptr;                         /* last descriptor posted to chip */
9419 +       uint32  rcvstatus;                      /* current active descriptor, et al */
9420 +} dmaregs_t;
9421 +
9422 +typedef volatile struct {
9423 +       /* diag access */
9424 +       uint32  fifoaddr;                       /* diag address */
9425 +       uint32  fifodatalow;                    /* low 32bits of data */
9426 +       uint32  fifodatahigh;                   /* high 32bits of data */
9427 +       uint32  pad;                            /* reserved */
9428 +} dmafifo_t;
9429 +
9430 +/* transmit channel control */
9431 +#define        XC_XE           ((uint32)1 << 0)        /* transmit enable */
9432 +#define        XC_SE           ((uint32)1 << 1)        /* transmit suspend request */
9433 +#define        XC_LE           ((uint32)1 << 2)        /* loopback enable */
9434 +#define        XC_FL           ((uint32)1 << 4)        /* flush request */
9435 +
9436 +/* transmit descriptor table pointer */
9437 +#define        XP_LD_MASK      0xfff                   /* last valid descriptor */
9438 +
9439 +/* transmit channel status */
9440 +#define        XS_CD_MASK      0x0fff                  /* current descriptor pointer */
9441 +#define        XS_XS_MASK      0xf000                  /* transmit state */
9442 +#define        XS_XS_SHIFT     12
9443 +#define        XS_XS_DISABLED  0x0000                  /* disabled */
9444 +#define        XS_XS_ACTIVE    0x1000                  /* active */
9445 +#define        XS_XS_IDLE      0x2000                  /* idle wait */
9446 +#define        XS_XS_STOPPED   0x3000                  /* stopped */
9447 +#define        XS_XS_SUSP      0x4000                  /* suspend pending */
9448 +#define        XS_XE_MASK      0xf0000                 /* transmit errors */
9449 +#define        XS_XE_SHIFT     16
9450 +#define        XS_XE_NOERR     0x00000                 /* no error */
9451 +#define        XS_XE_DPE       0x10000                 /* descriptor protocol error */
9452 +#define        XS_XE_DFU       0x20000                 /* data fifo underrun */
9453 +#define        XS_XE_BEBR      0x30000                 /* bus error on buffer read */
9454 +#define        XS_XE_BEDA      0x40000                 /* bus error on descriptor access */
9455 +#define        XS_FL           ((uint32)1 << 20)       /* flushed */
9456 +
9457 +/* receive channel control */
9458 +#define        RC_RE           ((uint32)1 << 0)        /* receive enable */
9459 +#define        RC_RO_MASK      0xfe                    /* receive frame offset */
9460 +#define        RC_RO_SHIFT     1
9461 +#define        RC_FM           ((uint32)1 << 8)        /* direct fifo receive (pio) mode */
9462 +
9463 +/* receive descriptor table pointer */
9464 +#define        RP_LD_MASK      0xfff                   /* last valid descriptor */
9465 +
9466 +/* receive channel status */
9467 +#define        RS_CD_MASK      0x0fff                  /* current descriptor pointer */
9468 +#define        RS_RS_MASK      0xf000                  /* receive state */
9469 +#define        RS_RS_SHIFT     12
9470 +#define        RS_RS_DISABLED  0x0000                  /* disabled */
9471 +#define        RS_RS_ACTIVE    0x1000                  /* active */
9472 +#define        RS_RS_IDLE      0x2000                  /* idle wait */
9473 +#define        RS_RS_STOPPED   0x3000                  /* reserved */
9474 +#define        RS_RE_MASK      0xf0000                 /* receive errors */
9475 +#define        RS_RE_SHIFT     16
9476 +#define        RS_RE_NOERR     0x00000                 /* no error */
9477 +#define        RS_RE_DPE       0x10000                 /* descriptor protocol error */
9478 +#define        RS_RE_DFO       0x20000                 /* data fifo overflow */
9479 +#define        RS_RE_BEBW      0x30000                 /* bus error on buffer write */
9480 +#define        RS_RE_BEDA      0x40000                 /* bus error on descriptor access */
9481 +
9482 +/* fifoaddr */
9483 +#define        FA_OFF_MASK     0xffff                  /* offset */
9484 +#define        FA_SEL_MASK     0xf0000                 /* select */
9485 +#define        FA_SEL_SHIFT    16
9486 +#define        FA_SEL_XDD      0x00000                 /* transmit dma data */
9487 +#define        FA_SEL_XDP      0x10000                 /* transmit dma pointers */
9488 +#define        FA_SEL_RDD      0x40000                 /* receive dma data */
9489 +#define        FA_SEL_RDP      0x50000                 /* receive dma pointers */
9490 +#define        FA_SEL_XFD      0x80000                 /* transmit fifo data */
9491 +#define        FA_SEL_XFP      0x90000                 /* transmit fifo pointers */
9492 +#define        FA_SEL_RFD      0xc0000                 /* receive fifo data */
9493 +#define        FA_SEL_RFP      0xd0000                 /* receive fifo pointers */
9494 +
9495 +/*
9496 + * DMA Descriptor
9497 + * Descriptors are only read by the hardware, never written back.
9498 + */
9499 +typedef volatile struct {
9500 +       uint32  ctrl;           /* misc control bits & bufcount */
9501 +       uint32  addr;           /* data buffer address */
9502 +} dmadd_t;
9503 +
9504 +/*
9505 + * Each descriptor ring must be 4096byte aligned
9506 + * and fit within a single 4096byte page.
9507 + */
9508 +#define        DMAMAXRINGSZ    4096
9509 +#define        DMARINGALIGN    4096
9510 +
9511 +/* control flags */
9512 +#define        CTRL_BC_MASK    0x1fff                  /* buffer byte count */
9513 +#define        CTRL_EOT        ((uint32)1 << 28)       /* end of descriptor table */
9514 +#define        CTRL_IOC        ((uint32)1 << 29)       /* interrupt on completion */
9515 +#define        CTRL_EOF        ((uint32)1 << 30)       /* end of frame */
9516 +#define        CTRL_SOF        ((uint32)1 << 31)       /* start of frame */
9517 +
9518 +/* control flags in the range [27:20] are core-specific and not defined here */
9519 +#define        CTRL_CORE_MASK  0x0ff00000
9520 +
9521 +/* export structure */
9522 +typedef volatile struct {
9523 +       /* rx error counters */
9524 +       uint            rxgiants;       /* rx giant frames */
9525 +       uint            rxnobuf;        /* rx out of dma descriptors */
9526 +       /* tx error counters */
9527 +       uint            txnobuf;        /* tx out of dma descriptors */
9528 +} hnddma_t;
9529 +
9530 +#ifndef di_t
9531 +#define        di_t    void
9532 +#endif
9533 +
9534 +/* externs */
9535 +extern void *dma_attach(void *drv, void *dev, char *name, dmaregs_t *dmaregs,
9536 +       uint ntxd, uint nrxd, uint rxbufsize, uint nrxpost, uint rxoffset,
9537 +       uint ddoffset, uint dataoffset, uint *msg_level);
9538 +extern void dma_detach(di_t *di);
9539 +extern void dma_txreset(di_t *di);
9540 +extern void dma_rxreset(di_t *di);
9541 +extern void dma_txinit(di_t *di);
9542 +extern bool dma_txenabled(di_t *di);
9543 +extern void dma_rxinit(di_t *di);
9544 +extern void dma_rxenable(di_t *di);
9545 +extern bool dma_rxenabled(di_t *di);
9546 +extern void dma_txsuspend(di_t *di);
9547 +extern void dma_txresume(di_t *di);
9548 +extern bool dma_txsuspended(di_t *di);
9549 +extern bool dma_txstopped(di_t *di);
9550 +extern bool dma_rxstopped(di_t *di);
9551 +extern int dma_txfast(di_t *di, void *p, uint32 coreflags);
9552 +extern int dma_tx(di_t *di, void *p, uint32 coreflags);
9553 +extern void dma_fifoloopbackenable(di_t *di);
9554 +extern void *dma_rx(di_t *di);
9555 +extern void dma_rxfill(di_t *di);
9556 +extern void dma_txreclaim(di_t *di, bool forceall);
9557 +extern void dma_rxreclaim(di_t *di);
9558 +extern char *dma_dump(di_t *di, char *buf);
9559 +extern char *dma_dumptx(di_t *di, char *buf);
9560 +extern char *dma_dumprx(di_t *di, char *buf);
9561 +extern uint dma_getvar(di_t *di, char *name);
9562 +extern void *dma_getnexttxp(di_t *di, bool forceall);
9563 +extern void *dma_getnextrxp(di_t *di, bool forceall);
9564 +extern void dma_txblock(di_t *di);
9565 +extern void dma_txunblock(di_t *di);
9566 +extern uint dma_txactive(di_t *di);
9567 +
9568 +#endif /* _hnddma_h_ */
9569 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/hndmips.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/hndmips.h
9570 --- linux-2.6.12.5/arch/mips/bcm947xx/include/hndmips.h 1970-01-01 01:00:00.000000000 +0100
9571 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/hndmips.h    2005-08-28 11:12:20.439857784 +0200
9572 @@ -0,0 +1,16 @@
9573 +/*
9574 + * Alternate include file for HND sbmips.h since CFE also ships with
9575 + * a sbmips.h.
9576 + *
9577 + * Copyright 2001-2003, Broadcom Corporation
9578 + * All Rights Reserved.
9579 + * 
9580 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9581 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9582 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9583 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9584 + *
9585 + * $Id$
9586 + */
9587 +
9588 +#include "sbmips.h"
9589 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/linux_osl.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/linux_osl.h
9590 --- linux-2.6.12.5/arch/mips/bcm947xx/include/linux_osl.h       1970-01-01 01:00:00.000000000 +0100
9591 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/linux_osl.h  2005-08-28 11:12:20.440857632 +0200
9592 @@ -0,0 +1,313 @@
9593 +/*
9594 + * Linux OS Independent Layer
9595 + *
9596 + * Copyright 2001-2003, Broadcom Corporation
9597 + * All Rights Reserved.
9598 + * 
9599 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9600 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9601 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9602 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9603 + *
9604 + * $Id$
9605 + */
9606 +
9607 +#ifndef _linux_osl_h_
9608 +#define _linux_osl_h_
9609 +
9610 +#include <typedefs.h>
9611 +
9612 +/* use current 2.4.x calling conventions */
9613 +#include <linuxver.h>
9614 +
9615 +/* assert and panic */
9616 +#define        ASSERT(exp)             do {} while (0)
9617 +
9618 +/* PCMCIA attribute space access macros */
9619 +#define        OSL_PCMCIA_READ_ATTR(osh, offset, buf, size) \
9620 +       osl_pcmcia_read_attr((osh), (offset), (buf), (size))
9621 +#define        OSL_PCMCIA_WRITE_ATTR(osh, offset, buf, size) \
9622 +       osl_pcmcia_write_attr((osh), (offset), (buf), (size))
9623 +extern void osl_pcmcia_read_attr(void *osh, uint offset, void *buf, int size);
9624 +extern void osl_pcmcia_write_attr(void *osh, uint offset, void *buf, int size);
9625 +
9626 +/* PCI configuration space access macros */
9627 +#define        OSL_PCI_READ_CONFIG(loc, offset, size) \
9628 +       osl_pci_read_config((loc), (offset), (size))
9629 +#define        OSL_PCI_WRITE_CONFIG(loc, offset, size, val) \
9630 +       osl_pci_write_config((loc), (offset), (size), (val))
9631 +extern uint32 osl_pci_read_config(void *loc, uint size, uint offset);
9632 +extern void osl_pci_write_config(void *loc, uint offset, uint size, uint val);
9633 +
9634 +/* OSL initialization */
9635 +#define osl_init()             do {} while (0)
9636 +
9637 +/* host/bus architecture-specific byte swap */
9638 +#define BUS_SWAP32(v)          (v)
9639 +
9640 +/*
9641 + * BINOSL selects the slightly slower function-call-based binary compatible osl.
9642 + * Macros expand to calls to functions defined in linux_osl.c .
9643 + */
9644 +#ifndef BINOSL
9645 +
9646 +/* string library, kernel mode */
9647 +#define        printf(fmt, args...)    printk(fmt, ## args)
9648 +#include <linux/kernel.h>
9649 +#include <linux/string.h>
9650 +
9651 +/* register access macros */
9652 +#define R_REG(r) ({ \
9653 +       __typeof(*(r)) __osl_v; \
9654 +       switch (sizeof(*(r))) { \
9655 +       case sizeof(uint8):     __osl_v = readb((volatile uint8*)(r)); break; \
9656 +       case sizeof(uint16):    __osl_v = readw((volatile uint16*)(r)); break; \
9657 +       case sizeof(uint32):    __osl_v = readl((volatile uint32*)(r)); break; \
9658 +       } \
9659 +       __osl_v; \
9660 +})
9661 +#define W_REG(r, v) do { \
9662 +       switch (sizeof(*(r))) { \
9663 +       case sizeof(uint8):     writeb((uint8)(v), (volatile uint8*)(r)); break; \
9664 +       case sizeof(uint16):    writew((uint16)(v), (volatile uint16*)(r)); break; \
9665 +       case sizeof(uint32):    writel((uint32)(v), (volatile uint32*)(r)); break; \
9666 +       } \
9667 +} while (0)
9668 +
9669 +#define        AND_REG(r, v)           W_REG((r), R_REG(r) & (v))
9670 +#define        OR_REG(r, v)            W_REG((r), R_REG(r) | (v))
9671 +
9672 +/* bcopy, bcmp, and bzero */
9673 +#define        bcopy(src, dst, len)    memcpy((dst), (src), (len))
9674 +#define        bcmp(b1, b2, len)       memcmp((b1), (b2), (len))
9675 +#define        bzero(b, len)           memset((b), '\0', (len))
9676 +
9677 +/* general purpose memory allocation */
9678 +#define        MALLOC(size)            kmalloc((size), GFP_ATOMIC)
9679 +#define        MFREE(addr, size)       kfree((addr))
9680 +
9681 +/* uncached virtual address */
9682 +#ifdef mips
9683 +#define OSL_UNCACHED(va)       KSEG1ADDR((va))
9684 +#include <asm/addrspace.h>
9685 +#else
9686 +#define OSL_UNCACHED(va)       (va)
9687 +#endif
9688 +
9689 +/* get processor cycle count */
9690 +#if defined(mips)
9691 +#define        OSL_GETCYCLES(x)        ((x) = read_c0_count() * 2)
9692 +#elif defined(__i386__)
9693 +#define        OSL_GETCYCLES(x)        rdtscl((x))
9694 +#else
9695 +#define OSL_GETCYCLES(x)       ((x) = 0)
9696 +#endif
9697 +
9698 +/* dereference an address that may cause a bus exception */
9699 +#ifdef mips
9700 +#if defined(MODULE) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,17))
9701 +#define BUSPROBE(val, addr)    panic("get_dbe() will not fixup a bus exception when compiled into a module")
9702 +#else
9703 +#define        BUSPROBE(val, addr)     get_dbe((val), (addr))
9704 +#include <asm/paccess.h>
9705 +#endif
9706 +#else
9707 +#define        BUSPROBE(val, addr)     ({ (val) = R_REG((addr)); 0; })
9708 +#endif
9709 +
9710 +/* map/unmap physical to virtual I/O */
9711 +#define        REG_MAP(pa, size)       ioremap_nocache((unsigned long)(pa), (unsigned long)(size))
9712 +#define        REG_UNMAP(va)           iounmap((void *)(va))
9713 +
9714 +/* allocate/free shared (dma-able) consistent (uncached) memory */
9715 +#define        DMA_ALLOC_CONSISTENT(dev, size, pap) \
9716 +       pci_alloc_consistent((dev), (size), (dma_addr_t*)(pap))
9717 +#define        DMA_FREE_CONSISTENT(dev, va, size, pa) \
9718 +       pci_free_consistent((dev), (size), (va), (dma_addr_t)(pa))
9719 +
9720 +/* map/unmap direction */
9721 +#define        DMA_TX                  PCI_DMA_TODEVICE
9722 +#define        DMA_RX                  PCI_DMA_FROMDEVICE
9723 +
9724 +/* map/unmap shared (dma-able) memory */
9725 +#define        DMA_MAP(dev, va, size, direction, p) \
9726 +       pci_map_single((dev), (va), (size), (direction))
9727 +#define        DMA_UNMAP(dev, pa, size, direction, p) \
9728 +       pci_unmap_single((dev), (dma_addr_t)(pa), (size), (direction))
9729 +
9730 +/* microsecond delay */
9731 +#define        OSL_DELAY(usec)         udelay(usec)
9732 +#include <linux/delay.h>
9733 +#define OSL_SLEEP(usec) set_current_state(TASK_INTERRUPTIBLE); \
9734 +                        schedule_timeout((usec*HZ)/1000000);
9735 +#define OSL_IN_INTERRUPT() in_interrupt()
9736 +
9737 +/* shared (dma-able) memory access macros */
9738 +#define        R_SM(r)                 *(r)
9739 +#define        W_SM(r, v)              (*(r) = (v))
9740 +#define        BZERO_SM(r, len)        memset((r), '\0', (len))
9741 +
9742 +/* packet primitives */
9743 +#define        PKTGET(drv, len, send)          osl_pktget((drv), (len), (send))
9744 +#define        PKTFREE(drv, skb, send)         osl_pktfree((skb))
9745 +#define        PKTDATA(drv, skb)               (((struct sk_buff*)(skb))->data)
9746 +#define        PKTLEN(drv, skb)                (((struct sk_buff*)(skb))->len)
9747 +#define PKTHEADROOM(drv, skb)          (PKTDATA(drv,skb)-(((struct sk_buff*)(skb))->head))
9748 +#define PKTTAILROOM(drv, skb)          ((((struct sk_buff*)(skb))->end)-(((struct sk_buff*)(skb))->tail))
9749 +#define        PKTNEXT(drv, skb)               (((struct sk_buff*)(skb))->next)
9750 +#define        PKTSETNEXT(skb, x)              (((struct sk_buff*)(skb))->next = (struct sk_buff*)(x))
9751 +#define        PKTSETLEN(drv, skb, len)        __skb_trim((struct sk_buff*)(skb), (len))
9752 +#define        PKTPUSH(drv, skb, bytes)        skb_push((struct sk_buff*)(skb), (bytes))
9753 +#define        PKTPULL(drv, skb, bytes)        skb_pull((struct sk_buff*)(skb), (bytes))
9754 +#define        PKTDUP(drv, skb)                skb_clone((struct sk_buff*)(skb), GFP_ATOMIC)
9755 +#define        PKTCOOKIE(skb)                  ((void*)((struct sk_buff*)(skb))->csum)
9756 +#define        PKTSETCOOKIE(skb, x)            (((struct sk_buff*)(skb))->csum = (uint)(x))
9757 +#define        PKTLINK(skb)                    (((struct sk_buff*)(skb))->prev)
9758 +#define        PKTSETLINK(skb, x)              (((struct sk_buff*)(skb))->prev = (struct sk_buff*)(x))
9759 +extern void *osl_pktget(void *drv, uint len, bool send);
9760 +extern void osl_pktfree(void *skb);
9761 +
9762 +#else  /* BINOSL */                                    
9763 +
9764 +/* string library */
9765 +#ifndef LINUX_OSL
9766 +#undef printf
9767 +#define        printf(fmt, args...)            osl_printf((fmt), ## args)
9768 +#undef sprintf
9769 +#define sprintf(buf, fmt, args...)     osl_sprintf((buf), (fmt), ## args)
9770 +#undef strcmp
9771 +#define        strcmp(s1, s2)                  osl_strcmp((s1), (s2))
9772 +#undef strncmp
9773 +#define        strncmp(s1, s2, n)              osl_strncmp((s1), (s2), (n))
9774 +#undef strlen
9775 +#define strlen(s)                      osl_strlen((s))
9776 +#undef strcpy
9777 +#define        strcpy(d, s)                    osl_strcpy((d), (s))
9778 +#undef strncpy
9779 +#define        strncpy(d, s, n)                osl_strncpy((d), (s), (n))
9780 +#endif
9781 +extern int osl_printf(const char *format, ...);
9782 +extern int osl_sprintf(char *buf, const char *format, ...);
9783 +extern int osl_strcmp(const char *s1, const char *s2);
9784 +extern int osl_strncmp(const char *s1, const char *s2, uint n);
9785 +extern int osl_strlen(char *s);
9786 +extern char* osl_strcpy(char *d, const char *s);
9787 +extern char* osl_strncpy(char *d, const char *s, uint n);
9788 +
9789 +/* register access macros */
9790 +#define R_REG(r) ({ \
9791 +       __typeof(*(r)) __osl_v; \
9792 +       switch (sizeof(*(r))) { \
9793 +       case sizeof(uint8):     __osl_v = osl_readb((volatile uint8*)(r)); break; \
9794 +       case sizeof(uint16):    __osl_v = osl_readw((volatile uint16*)(r)); break; \
9795 +       case sizeof(uint32):    __osl_v = osl_readl((volatile uint32*)(r)); break; \
9796 +       } \
9797 +       __osl_v; \
9798 +})
9799 +#define W_REG(r, v) do { \
9800 +       switch (sizeof(*(r))) { \
9801 +       case sizeof(uint8):     osl_writeb((uint8)(v), (volatile uint8*)(r)); break; \
9802 +       case sizeof(uint16):    osl_writew((uint16)(v), (volatile uint16*)(r)); break; \
9803 +       case sizeof(uint32):    osl_writel((uint32)(v), (volatile uint32*)(r)); break; \
9804 +       } \
9805 +} while (0)
9806 +#define        AND_REG(r, v)           W_REG((r), R_REG(r) & (v))
9807 +#define        OR_REG(r, v)            W_REG((r), R_REG(r) | (v))
9808 +extern uint8 osl_readb(volatile uint8 *r);
9809 +extern uint16 osl_readw(volatile uint16 *r);
9810 +extern uint32 osl_readl(volatile uint32 *r);
9811 +extern void osl_writeb(uint8 v, volatile uint8 *r);
9812 +extern void osl_writew(uint16 v, volatile uint16 *r);
9813 +extern void osl_writel(uint32 v, volatile uint32 *r);
9814 +
9815 +/* bcopy, bcmp, and bzero */
9816 +extern void bcopy(const void *src, void *dst, int len);
9817 +extern int bcmp(const void *b1, const void *b2, int len);
9818 +extern void bzero(void *b, int len);
9819 +
9820 +/* general purpose memory allocation */
9821 +#define        MALLOC(size)            osl_malloc((size))
9822 +#define        MFREE(addr, size)       osl_mfree((char*)(addr), (size))
9823 +extern void *osl_malloc(uint size);
9824 +extern void osl_mfree(void *addr, uint size);
9825 +
9826 +/* uncached virtual address */
9827 +#define OSL_UNCACHED(va)       osl_uncached((va))
9828 +extern void *osl_uncached(void *va);
9829 +
9830 +/* get processor cycle count */
9831 +#define OSL_GETCYCLES(x)       ((x) = osl_getcycles())
9832 +extern uint osl_getcycles(void);
9833 +
9834 +/* dereference an address that may target abort */
9835 +#define        BUSPROBE(val, addr)     osl_busprobe(&(val), (addr))
9836 +extern int osl_busprobe(uint32 *val, uint32 addr);
9837 +
9838 +/* map/unmap physical to virtual */
9839 +#define        REG_MAP(pa, size)       osl_reg_map((pa), (size))
9840 +#define        REG_UNMAP(va)           osl_reg_unmap((va))
9841 +extern void *osl_reg_map(uint32 pa, uint size);
9842 +extern void osl_reg_unmap(void *va);
9843 +
9844 +/* allocate/free shared (dma-able) consistent (uncached) memory */
9845 +#define        DMA_ALLOC_CONSISTENT(dev, size, pap) \
9846 +       osl_dma_alloc_consistent((dev), (size), (pap))
9847 +#define        DMA_FREE_CONSISTENT(dev, va, size, pa) \
9848 +       osl_dma_free_consistent((dev), (void*)(va), (size), (pa))
9849 +extern void *osl_dma_alloc_consistent(void *dev, uint size, ulong *pap);
9850 +extern void osl_dma_free_consistent(void *dev, void *va, uint size, ulong pa);
9851 +
9852 +/* map/unmap direction */
9853 +#define        DMA_TX  1
9854 +#define        DMA_RX  2
9855 +
9856 +/* map/unmap shared (dma-able) memory */
9857 +#define        DMA_MAP(dev, va, size, direction, p) \
9858 +       osl_dma_map((dev), (va), (size), (direction))
9859 +#define        DMA_UNMAP(dev, pa, size, direction, p) \
9860 +       osl_dma_unmap((dev), (pa), (size), (direction))
9861 +extern uint osl_dma_map(void *dev, void *va, uint size, int direction);
9862 +extern void osl_dma_unmap(void *dev, uint pa, uint size, int direction);
9863 +
9864 +/* microsecond delay */
9865 +#define        OSL_DELAY(usec)         osl_delay((usec))
9866 +extern void osl_delay(uint usec);
9867 +
9868 +/* shared (dma-able) memory access macros */
9869 +#define        R_SM(r)                 *(r)
9870 +#define        W_SM(r, v)              (*(r) = (v))
9871 +#define        BZERO_SM(r, len)        bzero((r), (len))
9872 +
9873 +/* packet primitives */
9874 +#define        PKTGET(drv, len, send)          osl_pktget((drv), (len), (send))
9875 +#define        PKTFREE(drv, skb, send)         osl_pktfree((skb))
9876 +#define        PKTDATA(drv, skb)               osl_pktdata((drv), (skb))
9877 +#define        PKTLEN(drv, skb)                osl_pktlen((drv), (skb))
9878 +#define        PKTNEXT(drv, skb)               osl_pktnext((drv), (skb))
9879 +#define        PKTSETNEXT(skb, x)              osl_pktsetnext((skb), (x))
9880 +#define        PKTSETLEN(drv, skb, len)        osl_pktsetlen((drv), (skb), (len))
9881 +#define        PKTPUSH(drv, skb, bytes)        osl_pktpush((drv), (skb), (bytes))
9882 +#define        PKTPULL(drv, skb, bytes)        osl_pktpull((drv), (skb), (bytes))
9883 +#define        PKTDUP(drv, skb)                osl_pktdup((drv), (skb))
9884 +#define        PKTCOOKIE(skb)                  osl_pktcookie((skb))
9885 +#define        PKTSETCOOKIE(skb, x)            osl_pktsetcookie((skb), (x))
9886 +#define        PKTLINK(skb)                    osl_pktlink((skb))
9887 +#define        PKTSETLINK(skb, x)              osl_pktsetlink((skb), (x))
9888 +extern void *osl_pktget(void *drv, uint len, bool send);
9889 +extern void osl_pktfree(void *skb);
9890 +extern uchar *osl_pktdata(void *drv, void *skb);
9891 +extern uint osl_pktlen(void *drv, void *skb);
9892 +extern void *osl_pktnext(void *drv, void *skb);
9893 +extern void osl_pktsetnext(void *skb, void *x);
9894 +extern void osl_pktsetlen(void *drv, void *skb, uint len);
9895 +extern uchar *osl_pktpush(void *drv, void *skb, int bytes);
9896 +extern uchar *osl_pktpull(void *drv, void *skb, int bytes);
9897 +extern void *osl_pktdup(void *drv, void *skb);
9898 +extern void *osl_pktcookie(void *skb);
9899 +extern void osl_pktsetcookie(void *skb, void *x);
9900 +extern void *osl_pktlink(void *skb);
9901 +extern void osl_pktsetlink(void *skb, void *x);
9902 +
9903 +#endif /* BINOSL */
9904 +
9905 +#endif /* _linux_osl_h_ */
9906 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/linuxver.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/linuxver.h
9907 --- linux-2.6.12.5/arch/mips/bcm947xx/include/linuxver.h        1970-01-01 01:00:00.000000000 +0100
9908 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/linuxver.h   2005-08-28 11:12:20.441857480 +0200
9909 @@ -0,0 +1,326 @@
9910 +/*
9911 + * Linux-specific abstractions to gain some independence from linux kernel versions.
9912 + * Pave over some 2.2 versus 2.4 kernel differences.
9913 + *
9914 + * Copyright 2001-2003, Broadcom Corporation   
9915 + * All Rights Reserved.   
9916 + *    
9917 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
9918 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
9919 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
9920 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
9921 + * $Id$
9922 + */
9923 +
9924 +#ifndef _linuxver_h_
9925 +#define _linuxver_h_
9926 +
9927 +#include <linux/config.h>
9928 +#include <linux/version.h>
9929 +
9930 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0))
9931 +/* __NO_VERSION__ must be defined for all linkables except one in 2.2 */
9932 +#ifdef __UNDEF_NO_VERSION__
9933 +#undef __NO_VERSION__
9934 +#else
9935 +#define __NO_VERSION__
9936 +#endif
9937 +#endif
9938 +
9939 +#if defined(MODULE) && defined(MODVERSIONS)
9940 +#include <linux/modversions.h>
9941 +#endif
9942 +
9943 +/* linux/malloc.h is deprecated, use linux/slab.h instead. */
9944 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,9))
9945 +#include <linux/malloc.h>
9946 +#else
9947 +#include <linux/slab.h>
9948 +#endif
9949 +
9950 +#include <linux/types.h>
9951 +#include <linux/init.h>
9952 +#include <linux/module.h>
9953 +#include <linux/mm.h>
9954 +#include <linux/string.h>
9955 +#include <linux/pci.h>
9956 +#include <linux/interrupt.h>
9957 +#include <linux/netdevice.h>
9958 +#include <asm/io.h>
9959 +
9960 +#ifndef __exit
9961 +#define __exit
9962 +#endif
9963 +#ifndef __devexit
9964 +#define __devexit
9965 +#endif
9966 +#ifndef __devinit
9967 +#define __devinit      __init
9968 +#endif
9969 +#ifndef __devinitdata
9970 +#define __devinitdata
9971 +#endif
9972 +#ifndef __devexit_p
9973 +#define __devexit_p(x) x
9974 +#endif
9975 +
9976 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
9977 +
9978 +#define pci_get_drvdata(dev)           (dev)->sysdata
9979 +#define pci_set_drvdata(dev, value)    (dev)->sysdata=(value)
9980 +
9981 +/*
9982 + * New-style (2.4.x) PCI/hot-pluggable PCI/CardBus registration
9983 + */
9984 +
9985 +struct pci_device_id {
9986 +       unsigned int vendor, device;            /* Vendor and device ID or PCI_ANY_ID */
9987 +       unsigned int subvendor, subdevice;      /* Subsystem ID's or PCI_ANY_ID */
9988 +       unsigned int class, class_mask;         /* (class,subclass,prog-if) triplet */
9989 +       unsigned long driver_data;              /* Data private to the driver */
9990 +};
9991 +
9992 +struct pci_driver {
9993 +       struct list_head node;
9994 +       char *name;
9995 +       const struct pci_device_id *id_table;   /* NULL if wants all devices */
9996 +       int (*probe)(struct pci_dev *dev, const struct pci_device_id *id);      /* New device inserted */
9997 +       void (*remove)(struct pci_dev *dev);    /* Device removed (NULL if not a hot-plug capable driver) */
9998 +       void (*suspend)(struct pci_dev *dev);   /* Device suspended */
9999 +       void (*resume)(struct pci_dev *dev);    /* Device woken up */
10000 +};
10001 +
10002 +#define MODULE_DEVICE_TABLE(type, name)
10003 +#define PCI_ANY_ID (~0)
10004 +
10005 +/* compatpci.c */
10006 +#define pci_module_init pci_register_driver
10007 +extern int pci_register_driver(struct pci_driver *drv);
10008 +extern void pci_unregister_driver(struct pci_driver *drv);
10009 +
10010 +#endif /* PCI registration */
10011 +
10012 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18))
10013 +#ifdef MODULE
10014 +#define module_init(x) int init_module(void) { return x(); }
10015 +#define module_exit(x) void cleanup_module(void) { x(); }
10016 +#else
10017 +#define module_init(x) __initcall(x);
10018 +#define module_exit(x) __exitcall(x);
10019 +#endif
10020 +#endif
10021 +
10022 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,48))
10023 +#define list_for_each(pos, head) \
10024 +       for (pos = (head)->next; pos != (head); pos = pos->next)
10025 +#endif
10026 +
10027 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13))
10028 +#define pci_resource_start(dev, bar)   ((dev)->base_address[(bar)])
10029 +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,44))
10030 +#define pci_resource_start(dev, bar)   ((dev)->resource[(bar)].start)
10031 +#endif
10032 +
10033 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,23))
10034 +#define pci_enable_device(dev) do { } while (0)
10035 +#endif
10036 +
10037 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,14))
10038 +#define net_device device
10039 +#endif
10040 +
10041 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,42))
10042 +
10043 +/*
10044 + * DMA mapping
10045 + *
10046 + * See linux/Documentation/DMA-mapping.txt
10047 + */
10048 +
10049 +#ifndef PCI_DMA_TODEVICE
10050 +#define        PCI_DMA_TODEVICE        1
10051 +#define        PCI_DMA_FROMDEVICE      2
10052 +#endif
10053 +
10054 +typedef u32 dma_addr_t;
10055 +
10056 +/* Pure 2^n version of get_order */
10057 +static inline int get_order(unsigned long size)
10058 +{
10059 +       int order;
10060 +
10061 +       size = (size-1) >> (PAGE_SHIFT-1);
10062 +       order = -1;
10063 +       do {
10064 +               size >>= 1;
10065 +               order++;
10066 +       } while (size);
10067 +       return order;
10068 +}
10069 +
10070 +static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
10071 +                                        dma_addr_t *dma_handle)
10072 +{
10073 +       void *ret;
10074 +       int gfp = GFP_ATOMIC | GFP_DMA;
10075 +
10076 +       ret = (void *)__get_free_pages(gfp, get_order(size));
10077 +
10078 +       if (ret != NULL) {
10079 +               memset(ret, 0, size);
10080 +               *dma_handle = virt_to_bus(ret);
10081 +       }
10082 +       return ret;
10083 +}
10084 +static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size,
10085 +                                      void *vaddr, dma_addr_t dma_handle)
10086 +{
10087 +       free_pages((unsigned long)vaddr, get_order(size));
10088 +}
10089 +#ifdef ILSIM
10090 +extern uint pci_map_single(void *dev, void *va, uint size, int direction);
10091 +extern void pci_unmap_single(void *dev, uint pa, uint size, int direction);
10092 +#else
10093 +#define pci_map_single(cookie, address, size, dir)     virt_to_bus(address)
10094 +#define pci_unmap_single(cookie, address, size, dir)
10095 +#endif
10096 +
10097 +#endif /* DMA mapping */
10098 +
10099 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,43))
10100 +
10101 +#define dev_kfree_skb_any(a)           dev_kfree_skb(a)
10102 +#define netif_down(dev)                        do { (dev)->start = 0; } while(0)
10103 +
10104 +/* pcmcia-cs provides its own netdevice compatibility layer */
10105 +#ifndef _COMPAT_NETDEVICE_H
10106 +
10107 +/*
10108 + * SoftNet
10109 + *
10110 + * For pre-softnet kernels we need to tell the upper layer not to
10111 + * re-enter start_xmit() while we are in there. However softnet
10112 + * guarantees not to enter while we are in there so there is no need
10113 + * to do the netif_stop_queue() dance unless the transmit queue really
10114 + * gets stuck. This should also improve performance according to tests
10115 + * done by Aman Singla.
10116 + */
10117 +
10118 +#define dev_kfree_skb_irq(a)           dev_kfree_skb(a)
10119 +#define netif_wake_queue(dev)          do { clear_bit(0, &(dev)->tbusy); mark_bh(NET_BH); } while(0)
10120 +#define netif_stop_queue(dev)          set_bit(0, &(dev)->tbusy)
10121 +
10122 +static inline void netif_start_queue(struct net_device *dev)
10123 +{
10124 +       dev->tbusy = 0;
10125 +       dev->interrupt = 0;
10126 +       dev->start = 1;
10127 +}
10128 +
10129 +#define netif_queue_stopped(dev)       (dev)->tbusy
10130 +#define netif_running(dev)             (dev)->start
10131 +
10132 +#endif /* _COMPAT_NETDEVICE_H */
10133 +
10134 +#define netif_device_attach(dev)       netif_start_queue(dev)
10135 +#define netif_device_detach(dev)       netif_stop_queue(dev)
10136 +
10137 +/* 2.4.x renamed bottom halves to tasklets */
10138 +#define tasklet_struct                         tq_struct
10139 +static inline void tasklet_schedule(struct tasklet_struct *tasklet)
10140 +{
10141 +       queue_task(tasklet, &tq_immediate);
10142 +       mark_bh(IMMEDIATE_BH);
10143 +}
10144 +
10145 +static inline void tasklet_init(struct tasklet_struct *tasklet,
10146 +                               void (*func)(unsigned long),
10147 +                               unsigned long data)
10148 +{
10149 +       tasklet->next = NULL;
10150 +       tasklet->sync = 0;
10151 +       tasklet->routine = (void (*)(void *))func;
10152 +       tasklet->data = (void *)data;
10153 +}
10154 +#define tasklet_kill(tasklet)                  {do{} while(0);}
10155 +
10156 +/* 2.4.x introduced del_timer_sync() */
10157 +#define del_timer_sync(timer) del_timer(timer)
10158 +
10159 +#else
10160 +
10161 +#define netif_down(dev)
10162 +
10163 +#endif /* SoftNet */
10164 +
10165 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3))
10166 +
10167 +/*
10168 + * Emit code to initialise a tq_struct's routine and data pointers
10169 + */
10170 +#define PREPARE_TQUEUE(_tq, _routine, _data)                   \
10171 +       do {                                                    \
10172 +               (_tq)->routine = _routine;                      \
10173 +               (_tq)->data = _data;                            \
10174 +       } while (0)
10175 +
10176 +/*
10177 + * Emit code to initialise all of a tq_struct
10178 + */
10179 +#define INIT_TQUEUE(_tq, _routine, _data)                      \
10180 +       do {                                                    \
10181 +               INIT_LIST_HEAD(&(_tq)->list);                   \
10182 +               (_tq)->sync = 0;                                \
10183 +               PREPARE_TQUEUE((_tq), (_routine), (_data));     \
10184 +       } while (0)
10185 +
10186 +#endif
10187 +
10188 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,6))
10189 +
10190 +/* Power management related routines */
10191 +
10192 +static inline int
10193 +pci_save_state(struct pci_dev *dev, u32 *buffer)
10194 +{
10195 +       int i;
10196 +       if (buffer) {
10197 +               for (i = 0; i < 16; i++)
10198 +                       pci_read_config_dword(dev, i * 4,&buffer[i]);
10199 +       }
10200 +       return 0;
10201 +}
10202 +
10203 +static inline int 
10204 +pci_restore_state(struct pci_dev *dev, u32 *buffer)
10205 +{
10206 +       int i;
10207 +
10208 +       if (buffer) {
10209 +               for (i = 0; i < 16; i++)
10210 +                       pci_write_config_dword(dev,i * 4, buffer[i]);
10211 +       }
10212 +       /*
10213 +        * otherwise, write the context information we know from bootup.
10214 +        * This works around a problem where warm-booting from Windows
10215 +        * combined with a D3(hot)->D0 transition causes PCI config
10216 +        * header data to be forgotten.
10217 +        */     
10218 +       else {
10219 +               for (i = 0; i < 6; i ++)
10220 +                       pci_write_config_dword(dev,
10221 +                                              PCI_BASE_ADDRESS_0 + (i * 4),
10222 +                                              pci_resource_start(dev, i));
10223 +               pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
10224 +       }
10225 +       return 0;
10226 +}
10227 +
10228 +#endif /* PCI power management */
10229 +
10230 +/* Old cp0 access macros deprecated in 2.4.19 */
10231 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19))
10232 +#define read_c0_count() read_32bit_cp0_register(CP0_COUNT)
10233 +#endif
10234 +
10235 +#endif /* _linuxver_h_ */
10236 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/nvports.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/nvports.h
10237 --- linux-2.6.12.5/arch/mips/bcm947xx/include/nvports.h 1970-01-01 01:00:00.000000000 +0100
10238 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/nvports.h    2005-08-28 11:12:20.441857480 +0200
10239 @@ -0,0 +1,62 @@
10240 +/*
10241 + * Broadcom Home Gateway Reference Design
10242 + * Ports Web Page Configuration Support Routines
10243 + *
10244 + * Copyright 2001-2003, Broadcom Corporation
10245 + * All Rights Reserved.
10246 + * 
10247 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
10248 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
10249 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10250 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
10251 + * $Id$
10252 + */
10253 +
10254 +#ifndef _nvports_h_
10255 +#define _nvports_h_
10256 +
10257 +#define uint32 unsigned long
10258 +#define uint16 unsigned short
10259 +#define uint unsigned int
10260 +#define uint8 unsigned char
10261 +#define uint64 unsigned long long
10262 +
10263 +enum FORCE_PORT {
10264 +       FORCE_OFF,
10265 +       FORCE_10H,
10266 +       FORCE_10F,
10267 +       FORCE_100H,
10268 +       FORCE_100F,
10269 +       FORCE_DOWN,
10270 +       POWER_OFF
10271 +};
10272 +
10273 +typedef struct _PORT_ATTRIBS
10274 +{
10275 +       uint    autoneg;
10276 +       uint    force;
10277 +       uint    native; 
10278 +} PORT_ATTRIBS;
10279 +
10280 +extern uint
10281 +nvExistsPortAttrib(char *attrib, uint portno);
10282 +
10283 +extern int
10284 +nvExistsAnyForcePortAttrib(uint portno);
10285 +
10286 +extern void
10287 +nvSetPortAttrib(char *attrib, uint portno);
10288 +
10289 +extern void
10290 +nvUnsetPortAttrib(char *attrib, uint portno);
10291 +
10292 +extern void
10293 +nvUnsetAllForcePortAttrib(uint portno);
10294 +
10295 +extern PORT_ATTRIBS
10296 +nvGetSwitchPortAttribs(uint portno);
10297 +
10298 +#endif /* _nvports_h_ */
10299 +
10300 +
10301 +
10302 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/osl.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/osl.h
10303 --- linux-2.6.12.5/arch/mips/bcm947xx/include/osl.h     1970-01-01 01:00:00.000000000 +0100
10304 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/osl.h        2005-08-28 11:12:20.441857480 +0200
10305 @@ -0,0 +1,38 @@
10306 +/*
10307 + * OS Independent Layer
10308 + * 
10309 + * Copyright 2001-2003, Broadcom Corporation   
10310 + * All Rights Reserved.   
10311 + *    
10312 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
10313 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
10314 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
10315 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
10316 + * $Id$
10317 + */
10318 +
10319 +#ifndef _osl_h_
10320 +#define _osl_h_
10321 +
10322 +#ifdef V2_HAL
10323 +#include <v2hal_osl.h>
10324 +#elif defined(linux)
10325 +#include <linux_osl.h>
10326 +#elif PMON
10327 +#include <pmon_osl.h>
10328 +#elif defined(NDIS)
10329 +#include <ndis_osl.h>
10330 +#elif defined(_CFE_)
10331 +#include <cfe_osl.h>
10332 +#elif defined(MACOS9)
10333 +#include <macos9_osl.h>
10334 +#elif defined(MACOSX)
10335 +#include <macosx_osl.h>
10336 +#else
10337 +#error "Unsupported OSL requested"
10338 +#endif
10339 +
10340 +/* handy */
10341 +#define        SET_REG(r, mask, val)   W_REG((r), ((R_REG(r) & ~(mask)) | (val)))
10342 +
10343 +#endif /* _osl_h_ */
10344 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/pcicfg.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/pcicfg.h
10345 --- linux-2.6.12.5/arch/mips/bcm947xx/include/pcicfg.h  1970-01-01 01:00:00.000000000 +0100
10346 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/pcicfg.h     2005-08-28 11:12:20.442857328 +0200
10347 @@ -0,0 +1,362 @@
10348 +/*
10349 + * pcicfg.h: PCI configuration  constants and structures.
10350 + *
10351 + * Copyright 2001-2003, Broadcom Corporation
10352 + * All Rights Reserved.
10353 + * 
10354 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
10355 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
10356 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10357 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
10358 + *
10359 + * $Id$
10360 + */
10361 +
10362 +#ifndef        _h_pci_
10363 +#define        _h_pci_
10364 +
10365 +/* The following inside ifndef's so we don't collide with NTDDK.H */
10366 +#ifndef PCI_MAX_BUS
10367 +#define PCI_MAX_BUS            0x100
10368 +#endif
10369 +#ifndef PCI_MAX_DEVICES
10370 +#define PCI_MAX_DEVICES                0x20
10371 +#endif
10372 +#ifndef PCI_MAX_FUNCTION
10373 +#define PCI_MAX_FUNCTION       0x8
10374 +#endif
10375 +
10376 +#ifndef PCI_INVALID_VENDORID
10377 +#define PCI_INVALID_VENDORID   0xffff
10378 +#endif
10379 +#ifndef PCI_INVALID_DEVICEID
10380 +#define PCI_INVALID_DEVICEID   0xffff
10381 +#endif
10382 +
10383 +
10384 +/* Convert between bus-slot-function-register and config addresses */
10385 +
10386 +#define        PCICFG_BUS_SHIFT        16      /* Bus shift */
10387 +#define        PCICFG_SLOT_SHIFT       11      /* Slot shift */
10388 +#define        PCICFG_FUN_SHIFT        8       /* Function shift */
10389 +#define        PCICFG_OFF_SHIFT        0       /* Bus shift */
10390 +
10391 +#define        PCICFG_BUS_MASK         0xff    /* Bus mask */
10392 +#define        PCICFG_SLOT_MASK        0x1f    /* Slot mask */
10393 +#define        PCICFG_FUN_MASK         7       /* Function mask */
10394 +#define        PCICFG_OFF_MASK         0xff    /* Bus mask */
10395 +
10396 +#define        PCI_CONFIG_ADDR(b, s, f, o)                                     \
10397 +               ((((b) & PCICFG_BUS_MASK) << PCICFG_BUS_SHIFT)          \
10398 +                | (((s) & PCICFG_SLOT_MASK) << PCICFG_SLOT_SHIFT)      \
10399 +                | (((f) & PCICFG_FUN_MASK) << PCICFG_FUN_SHIFT)        \
10400 +                | (((o) & PCICFG_OFF_MASK) << PCICFG_OFF_SHIFT))
10401 +
10402 +#define        PCI_CONFIG_BUS(a)       (((a) >> PCICFG_BUS_SHIFT) & PCICFG_BUS_MASK)
10403 +#define        PCI_CONFIG_SLOT(a)      (((a) >> PCICFG_SLOT_SHIFT) & PCICFG_SLOT_MASK)
10404 +#define        PCI_CONFIG_FUN(a)       (((a) >> PCICFG_FUN_SHIFT) & PCICFG_FUN_MASK)
10405 +#define        PCI_CONFIG_OFF(a)       (((a) >> PCICFG_OFF_SHIFT) & PCICFG_OFF_MASK)
10406 +
10407 +
10408 +/* The actual config space */
10409 +
10410 +#define        PCI_BAR_MAX             6
10411 +
10412 +#define        PCI_ROM_BAR             8
10413 +
10414 +#define        PCR_RSVDA_MAX           2
10415 +
10416 +typedef struct _pci_config_regs {
10417 +    unsigned short     vendor;
10418 +    unsigned short     device;
10419 +    unsigned short     command;
10420 +    unsigned short     status;
10421 +    unsigned char      rev_id;
10422 +    unsigned char      prog_if;
10423 +    unsigned char      sub_class;
10424 +    unsigned char      base_class;
10425 +    unsigned char      cache_line_size;
10426 +    unsigned char      latency_timer;
10427 +    unsigned char      header_type;
10428 +    unsigned char      bist;
10429 +    unsigned long      base[PCI_BAR_MAX];
10430 +    unsigned long      cardbus_cis;
10431 +    unsigned short     subsys_vendor;
10432 +    unsigned short     subsys_id;
10433 +    unsigned long      baserom;
10434 +    unsigned long      rsvd_a[PCR_RSVDA_MAX];
10435 +    unsigned char      int_line;
10436 +    unsigned char      int_pin;
10437 +    unsigned char      min_gnt;
10438 +    unsigned char      max_lat;
10439 +    unsigned char      dev_dep[192];
10440 +} pci_config_regs;
10441 +
10442 +#define        SZPCR           (sizeof (pci_config_regs))
10443 +#define        MINSZPCR        64              /* offsetof (dev_dep[0] */
10444 +
10445 +/* A structure for the config registers is nice, but in most
10446 + * systems the config space is not memory mapped, so we need
10447 + * filed offsetts. :-(
10448 + */
10449 +#define        PCI_CFG_VID             0
10450 +#define        PCI_CFG_DID             2
10451 +#define        PCI_CFG_CMD             4
10452 +#define        PCI_CFG_STAT            6
10453 +#define        PCI_CFG_REV             8
10454 +#define        PCI_CFG_PROGIF          9
10455 +#define        PCI_CFG_SUBCL           0xa
10456 +#define        PCI_CFG_BASECL          0xb
10457 +#define        PCI_CFG_CLSZ            0xc
10458 +#define        PCI_CFG_LATTIM          0xd
10459 +#define        PCI_CFG_HDR             0xe
10460 +#define        PCI_CFG_BIST            0xf
10461 +#define        PCI_CFG_BAR0            0x10
10462 +#define        PCI_CFG_BAR1            0x14
10463 +#define        PCI_CFG_BAR2            0x18
10464 +#define        PCI_CFG_BAR3            0x1c
10465 +#define        PCI_CFG_BAR4            0x20
10466 +#define        PCI_CFG_BAR5            0x24
10467 +#define        PCI_CFG_CIS             0x28
10468 +#define        PCI_CFG_SVID            0x2c
10469 +#define        PCI_CFG_SSID            0x2e
10470 +#define        PCI_CFG_ROMBAR          0x30
10471 +#define        PCI_CFG_INT             0x3c
10472 +#define        PCI_CFG_PIN             0x3d
10473 +#define        PCI_CFG_MINGNT          0x3e
10474 +#define        PCI_CFG_MAXLAT          0x3f
10475 +
10476 +/* Classes and subclasses */
10477 +
10478 +typedef enum {
10479 +    PCI_CLASS_OLD = 0,
10480 +    PCI_CLASS_DASDI,
10481 +    PCI_CLASS_NET,
10482 +    PCI_CLASS_DISPLAY,
10483 +    PCI_CLASS_MMEDIA,
10484 +    PCI_CLASS_MEMORY,
10485 +    PCI_CLASS_BRIDGE,
10486 +    PCI_CLASS_COMM,
10487 +    PCI_CLASS_BASE,
10488 +    PCI_CLASS_INPUT,
10489 +    PCI_CLASS_DOCK,
10490 +    PCI_CLASS_CPU,
10491 +    PCI_CLASS_SERIAL,
10492 +    PCI_CLASS_INTELLIGENT = 0xe,
10493 +    PCI_CLASS_SATELLITE,
10494 +    PCI_CLASS_CRYPT,
10495 +    PCI_CLASS_DSP,
10496 +    PCI_CLASS_MAX
10497 +} pci_classes;
10498 +
10499 +typedef enum {
10500 +    PCI_DASDI_SCSI,
10501 +    PCI_DASDI_IDE,
10502 +    PCI_DASDI_FLOPPY,
10503 +    PCI_DASDI_IPI,
10504 +    PCI_DASDI_RAID,
10505 +    PCI_DASDI_OTHER = 0x80
10506 +} pci_dasdi_subclasses;
10507 +
10508 +typedef enum {
10509 +    PCI_NET_ETHER,
10510 +    PCI_NET_TOKEN,
10511 +    PCI_NET_FDDI,
10512 +    PCI_NET_ATM,
10513 +    PCI_NET_OTHER = 0x80
10514 +} pci_net_subclasses;
10515 +
10516 +typedef enum {
10517 +    PCI_DISPLAY_VGA,
10518 +    PCI_DISPLAY_XGA,
10519 +    PCI_DISPLAY_3D,
10520 +    PCI_DISPLAY_OTHER = 0x80
10521 +} pci_display_subclasses;
10522 +
10523 +typedef enum {
10524 +    PCI_MMEDIA_VIDEO,
10525 +    PCI_MMEDIA_AUDIO,
10526 +    PCI_MMEDIA_PHONE,
10527 +    PCI_MEDIA_OTHER = 0x80
10528 +} pci_mmedia_subclasses;
10529 +
10530 +typedef enum {
10531 +    PCI_MEMORY_RAM,
10532 +    PCI_MEMORY_FLASH,
10533 +    PCI_MEMORY_OTHER = 0x80
10534 +} pci_memory_subclasses;
10535 +
10536 +typedef enum {
10537 +    PCI_BRIDGE_HOST,
10538 +    PCI_BRIDGE_ISA,
10539 +    PCI_BRIDGE_EISA,
10540 +    PCI_BRIDGE_MC,
10541 +    PCI_BRIDGE_PCI,
10542 +    PCI_BRIDGE_PCMCIA,
10543 +    PCI_BRIDGE_NUBUS,
10544 +    PCI_BRIDGE_CARDBUS,
10545 +    PCI_BRIDGE_RACEWAY,
10546 +    PCI_BRIDGE_OTHER = 0x80
10547 +} pci_bridge_subclasses;
10548 +
10549 +typedef enum {
10550 +    PCI_COMM_UART,
10551 +    PCI_COMM_PARALLEL,
10552 +    PCI_COMM_MULTIUART,
10553 +    PCI_COMM_MODEM,
10554 +    PCI_COMM_OTHER = 0x80
10555 +} pci_comm_subclasses;
10556 +
10557 +typedef enum {
10558 +    PCI_BASE_PIC,
10559 +    PCI_BASE_DMA,
10560 +    PCI_BASE_TIMER,
10561 +    PCI_BASE_RTC,
10562 +    PCI_BASE_PCI_HOTPLUG,
10563 +    PCI_BASE_OTHER = 0x80
10564 +} pci_base_subclasses;
10565 +
10566 +typedef enum {
10567 +    PCI_INPUT_KBD,
10568 +    PCI_INPUT_PEN,
10569 +    PCI_INPUT_MOUSE,
10570 +    PCI_INPUT_SCANNER,
10571 +    PCI_INPUT_GAMEPORT,
10572 +    PCI_INPUT_OTHER = 0x80
10573 +} pci_input_subclasses;
10574 +
10575 +typedef enum {
10576 +    PCI_DOCK_GENERIC,
10577 +    PCI_DOCK_OTHER = 0x80
10578 +} pci_dock_subclasses;
10579 +
10580 +typedef enum {
10581 +    PCI_CPU_386,
10582 +    PCI_CPU_486,
10583 +    PCI_CPU_PENTIUM,
10584 +    PCI_CPU_ALPHA = 0x10,
10585 +    PCI_CPU_POWERPC = 0x20,
10586 +    PCI_CPU_MIPS = 0x30,
10587 +    PCI_CPU_COPROC = 0x40,
10588 +    PCI_CPU_OTHER = 0x80
10589 +} pci_cpu_subclasses;
10590 +
10591 +typedef enum {
10592 +    PCI_SERIAL_IEEE1394,
10593 +    PCI_SERIAL_ACCESS,
10594 +    PCI_SERIAL_SSA,
10595 +    PCI_SERIAL_USB,
10596 +    PCI_SERIAL_FIBER,
10597 +    PCI_SERIAL_SMBUS,
10598 +    PCI_SERIAL_OTHER = 0x80
10599 +} pci_serial_subclasses;
10600 +
10601 +typedef enum {
10602 +    PCI_INTELLIGENT_I2O,
10603 +} pci_intelligent_subclasses;
10604 +
10605 +typedef enum {
10606 +    PCI_SATELLITE_TV,
10607 +    PCI_SATELLITE_AUDIO,
10608 +    PCI_SATELLITE_VOICE,
10609 +    PCI_SATELLITE_DATA,
10610 +    PCI_SATELLITE_OTHER = 0x80
10611 +} pci_satellite_subclasses;
10612 +
10613 +typedef enum {
10614 +    PCI_CRYPT_NETWORK,
10615 +    PCI_CRYPT_ENTERTAINMENT,
10616 +    PCI_CRYPT_OTHER = 0x80
10617 +} pci_crypt_subclasses;
10618 +
10619 +typedef enum {
10620 +    PCI_DSP_DPIO,
10621 +    PCI_DSP_OTHER = 0x80
10622 +} pci_dsp_subclasses;
10623 +
10624 +/* Header types */
10625 +typedef enum {
10626 +       PCI_HEADER_NORMAL,
10627 +       PCI_HEADER_BRIDGE,
10628 +       PCI_HEADER_CARDBUS
10629 +} pci_header_types;
10630 +
10631 +
10632 +/* Overlay for a PCI-to-PCI bridge */
10633 +
10634 +#define        PPB_RSVDA_MAX           2
10635 +#define        PPB_RSVDD_MAX           8
10636 +
10637 +typedef struct _ppb_config_regs {
10638 +    unsigned short     vendor;
10639 +    unsigned short     device;
10640 +    unsigned short     command;
10641 +    unsigned short     status;
10642 +    unsigned char      rev_id;
10643 +    unsigned char      prog_if;
10644 +    unsigned char      sub_class;
10645 +    unsigned char      base_class;
10646 +    unsigned char      cache_line_size;
10647 +    unsigned char      latency_timer;
10648 +    unsigned char      header_type;
10649 +    unsigned char      bist;
10650 +    unsigned long      rsvd_a[PPB_RSVDA_MAX];
10651 +    unsigned char      prim_bus;
10652 +    unsigned char      sec_bus;
10653 +    unsigned char      sub_bus;
10654 +    unsigned char      sec_lat;
10655 +    unsigned char      io_base;
10656 +    unsigned char      io_lim;
10657 +    unsigned short     sec_status;
10658 +    unsigned short     mem_base;
10659 +    unsigned short     mem_lim;
10660 +    unsigned short     pf_mem_base;
10661 +    unsigned short     pf_mem_lim;
10662 +    unsigned long      pf_mem_base_hi;
10663 +    unsigned long      pf_mem_lim_hi;
10664 +    unsigned short     io_base_hi;
10665 +    unsigned short     io_lim_hi;
10666 +    unsigned short     subsys_vendor;
10667 +    unsigned short     subsys_id;
10668 +    unsigned long      rsvd_b;
10669 +    unsigned char      rsvd_c;
10670 +    unsigned char      int_pin;
10671 +    unsigned short     bridge_ctrl;
10672 +    unsigned char      chip_ctrl;
10673 +    unsigned char      diag_ctrl;
10674 +    unsigned short     arb_ctrl;
10675 +    unsigned long      rsvd_d[PPB_RSVDD_MAX];
10676 +    unsigned char      dev_dep[192];
10677 +} ppb_config_regs;
10678 +
10679 +/* Eveything below is BRCM HND proprietary */
10680 +
10681 +#define        PCI_BAR0_WIN            0x80    /* backplane addres space accessed by BAR0 */
10682 +#define        PCI_BAR1_WIN            0x84    /* backplane addres space accessed by BAR1 */
10683 +#define        PCI_SPROM_CONTROL       0x88    /* sprom property control */
10684 +#define        PCI_BAR1_CONTROL        0x8c    /* BAR1 region burst control */
10685 +#define        PCI_INT_STATUS          0x90    /* PCI and other cores interrupts */
10686 +#define        PCI_INT_MASK            0x94    /* mask of PCI and other cores interrupts */
10687 +#define PCI_TO_SB_MB           0x98    /* signal backplane interrupts */
10688 +#define PCI_BACKPLANE_ADDR     0xA0    /* address an arbitrary location on the system backplane */
10689 +#define PCI_BACKPLANE_DATA     0xA4    /* data at the location specified by above address register */
10690 +#define        PCI_GPIO_IN             0xb0    /* pci config space gpio input (>=rev3) */
10691 +#define        PCI_GPIO_OUT            0xb4    /* pci config space gpio output (>=rev3) */
10692 +#define        PCI_GPIO_OUTEN          0xb8    /* pci config space gpio output enable (>=rev3) */
10693 +
10694 +#define        PCI_BAR0_SPROM_OFFSET   (4 * 1024)      /* bar0 + 4K accesses external sprom */
10695 +#define        PCI_BAR0_PCIREGS_OFFSET (6 * 1024)      /* bar0 + 6K accesses pci core registers */
10696 +
10697 +/* PCI_INT_MASK */
10698 +#define        PCI_SBIM_SHIFT          8       /* backplane core interrupt mask bits offset */
10699 +#define        PCI_SBIM_MASK           0xff00  /* backplane core interrupt mask */
10700 +
10701 +/* PCI_SPROM_CONTROL */
10702 +#define        SPROM_BLANK             0x04    /* indicating a blank sprom */
10703 +#define SPROM_WRITEEN          0x10    /* sprom write enable */
10704 +#define SPROM_BOOTROM_WE       0x20    /* external bootrom write enable */
10705 +
10706 +#define        SPROM_SIZE              256     /* sprom size in 16-bit */
10707 +#define SPROM_CRC_RANGE                64      /* crc cover range in 16-bit */
10708 +
10709 +#endif
10710 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/proto/802.11.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/proto/802.11.h
10711 --- linux-2.6.12.5/arch/mips/bcm947xx/include/proto/802.11.h    1970-01-01 01:00:00.000000000 +0100
10712 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/proto/802.11.h       2005-08-28 11:12:20.450856112 +0200
10713 @@ -0,0 +1,679 @@
10714 +/*
10715 + * Copyright 2001-2003, Broadcom Corporation   
10716 + * All Rights Reserved.   
10717 + *    
10718 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
10719 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
10720 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
10721 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
10722 + *
10723 + * Fundamental types and constants relating to 802.11 
10724 + *
10725 + * $Id$
10726 + */
10727 +
10728 +#ifndef _802_11_H_
10729 +#define _802_11_H_
10730 +
10731 +#ifndef _TYPEDEFS_H_
10732 +#include <typedefs.h>
10733 +#endif
10734 +
10735 +#ifndef _NET_ETHERNET_H_
10736 +#include <proto/ethernet.h>
10737 +#endif
10738 +
10739 +/* enable structure packing */
10740 +#if !defined(__GNUC__)
10741 +#pragma pack(1)
10742 +#endif
10743 +
10744 +/* some platforms require stronger medicine */
10745 +#if defined(__GNUC__)
10746 +#define        PACKED  __attribute__((packed))
10747 +#else
10748 +#define        PACKED
10749 +#endif
10750 +
10751 +
10752 +#define DOT11_TU_TO_US                 1024    /* 802.11 Time Unit is 1024 microseconds */
10753 +
10754 +/* Generic 802.11 frame constants */
10755 +#define DOT11_A3_HDR_LEN               24
10756 +#define DOT11_A4_HDR_LEN               30
10757 +#define DOT11_MAC_HDR_LEN              DOT11_A3_HDR_LEN
10758 +#define DOT11_FCS_LEN                  4
10759 +#define DOT11_ICV_LEN                  4
10760 +#define DOT11_ICV_AES_LEN              8
10761 +
10762 +
10763 +#define DOT11_KEY_INDEX_SHIFT          6
10764 +#define DOT11_IV_LEN                   4
10765 +#define DOT11_IV_TKIP_LEN              8
10766 +#define DOT11_IV_AES_OCB_LEN           4
10767 +#define DOT11_IV_AES_CCM_LEN           8
10768 +
10769 +#define DOT11_MAX_MPDU_BODY_LEN                2312
10770 +#define DOT11_MAX_MPDU_LEN             2346    /* body len + A4 hdr + FCS */
10771 +#define DOT11_MAX_SSID_LEN             32
10772 +
10773 +/* dot11RTSThreshold */
10774 +#define DOT11_DEFAULT_RTS_LEN          2347
10775 +#define DOT11_MAX_RTS_LEN              2347
10776 +
10777 +/* dot11FragmentationThreshold */
10778 +#define DOT11_MIN_FRAG_LEN             256
10779 +#define DOT11_MAX_FRAG_LEN             2346    /* Max frag is also limited by aMPDUMaxLength of the attached PHY */
10780 +#define DOT11_DEFAULT_FRAG_LEN         2346
10781 +
10782 +/* dot11BeaconPeriod */
10783 +#define DOT11_MIN_BEACON_PERIOD                1
10784 +#define DOT11_MAX_BEACON_PERIOD                0xFFFF
10785 +
10786 +/* dot11DTIMPeriod */
10787 +#define DOT11_MIN_DTIM_PERIOD          1
10788 +#define DOT11_MAX_DTIM_PERIOD          0xFF
10789 +
10790 +/* 802.2 LLC/SNAP header used by 802.11 per 802.1H */
10791 +#define DOT11_LLC_SNAP_HDR_LEN 8
10792 +#define DOT11_OUI_LEN                  3
10793 +struct dot11_llc_snap_header {
10794 +       uint8   dsap;                           /* always 0xAA */
10795 +       uint8   ssap;                           /* always 0xAA */
10796 +       uint8   ctl;                            /* always 0x03 */
10797 +       uint8   oui[DOT11_OUI_LEN];             /* RFC1042: 0x00 0x00 0x00
10798 +                                                  Bridge-Tunnel: 0x00 0x00 0xF8 */
10799 +       uint16  type;                           /* ethertype */
10800 +} PACKED;
10801 +
10802 +/* RFC1042 header used by 802.11 per 802.1H */
10803 +#define RFC1042_HDR_LEN                        (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN)
10804 +
10805 +/* Generic 802.11 MAC header */
10806 +/*
10807 + * N.B.: This struct reflects the full 4 address 802.11 MAC header.
10808 + *              The fields are defined such that the shorter 1, 2, and 3
10809 + *              address headers just use the first k fields.
10810 + */
10811 +struct dot11_header {
10812 +       uint16                  fc;             /* frame control */
10813 +       uint16                  durid;          /* duration/ID */
10814 +       struct ether_addr       a1;             /* address 1 */
10815 +       struct ether_addr       a2;             /* address 2 */
10816 +       struct ether_addr       a3;             /* address 3 */
10817 +       uint16                  seq;            /* sequence control */
10818 +       struct ether_addr       a4;             /* address 4 */
10819 +} PACKED;
10820 +
10821 +/* Control frames */
10822 +
10823 +struct dot11_rts_frame {
10824 +       uint16                  fc;             /* frame control */
10825 +       uint16                  durid;          /* duration/ID */
10826 +       struct ether_addr       ra;             /* receiver address */
10827 +       struct ether_addr       ta;             /* transmitter address */
10828 +} PACKED;
10829 +#define        DOT11_RTS_LEN           16
10830 +
10831 +struct dot11_cts_frame {
10832 +       uint16                  fc;             /* frame control */
10833 +       uint16                  durid;          /* duration/ID */
10834 +       struct ether_addr       ra;             /* receiver address */
10835 +} PACKED;
10836 +#define        DOT11_CTS_LEN           10
10837 +
10838 +struct dot11_ack_frame {
10839 +       uint16                  fc;             /* frame control */
10840 +       uint16                  durid;          /* duration/ID */
10841 +       struct ether_addr       ra;             /* receiver address */
10842 +} PACKED;
10843 +#define        DOT11_ACK_LEN           10
10844 +
10845 +struct dot11_ps_poll_frame {
10846 +       uint16                  fc;             /* frame control */
10847 +       uint16                  durid;          /* AID */
10848 +       struct ether_addr       bssid;          /* receiver address, STA in AP */
10849 +       struct ether_addr       ta;             /* transmitter address */
10850 +} PACKED;
10851 +#define        DOT11_PS_POLL_LEN       16
10852 +
10853 +struct dot11_cf_end_frame {
10854 +       uint16                  fc;             /* frame control */
10855 +       uint16                  durid;          /* duration/ID */
10856 +       struct ether_addr       ra;             /* receiver address */
10857 +       struct ether_addr       bssid;          /* transmitter address, STA in AP */
10858 +} PACKED;
10859 +#define        DOT11_CS_END_LEN        16
10860 +
10861 +/* Management frame header */
10862 +struct dot11_management_header {
10863 +       uint16                  fc;             /* frame control */
10864 +       uint16                  durid;          /* duration/ID */
10865 +       struct ether_addr       da;             /* receiver address */
10866 +       struct ether_addr       sa;             /* transmitter address */
10867 +       struct ether_addr       bssid;          /* BSS ID */
10868 +       uint16                  seq;            /* sequence control */
10869 +} PACKED;
10870 +#define        DOT11_MGMT_HDR_LEN      24
10871 +
10872 +/* Management frame payloads */
10873 +
10874 +struct dot11_bcn_prb {
10875 +       uint32                  timestamp[2];
10876 +       uint16                  beacon_interval;
10877 +       uint16                  capability;
10878 +} PACKED;
10879 +#define        DOT11_BCN_PRB_LEN       12
10880 +
10881 +struct dot11_auth {
10882 +       uint16                  alg;            /* algorithm */
10883 +       uint16                  seq;            /* sequence control */
10884 +       uint16                  status;         /* status code */
10885 +} PACKED;
10886 +#define DOT11_AUTH_FIXED_LEN   6               /* length of auth frame without challenge info elt */
10887 +
10888 +struct dot11_assoc_req {
10889 +       uint16                  capability;     /* capability information */
10890 +       uint16                  listen;         /* listen interval */
10891 +} PACKED;
10892 +
10893 +struct dot11_assoc_resp {
10894 +       uint16                  capability;     /* capability information */
10895 +       uint16                  status;         /* status code */
10896 +       uint16                  aid;            /* association ID */
10897 +} PACKED;
10898 +
10899 +struct dot11_action_measure {
10900 +       uint8   category;
10901 +       uint8   action;
10902 +       uint8   token;
10903 +       uint8   data[1];
10904 +} PACKED;
10905 +#define DOT11_ACTION_MEASURE_LEN       3
10906 +
10907 +/**************
10908 +  802.11h related definitions.
10909 +**************/
10910 +typedef struct {
10911 +       uint8 id;
10912 +       uint8 len;
10913 +       uint8 power;
10914 +} dot11_power_cnst_t;
10915 +
10916 +typedef struct {
10917 +       uint8 min;
10918 +       uint8 max;
10919 +} dot11_power_cap_t;
10920 +
10921 +typedef struct {
10922 +       uint8 id;
10923 +       uint8 len;
10924 +       uint8 tx_pwr;
10925 +       uint8 margin;
10926 +} dot11_tpc_rep_t;
10927 +#define DOT11_MNG_IE_TPC_REPORT_LEN    2       /* length of IE data, not including 2 byte header */
10928 +
10929 +typedef struct {
10930 +       uint8 id;
10931 +       uint8 len;
10932 +       uint8 first_channel;
10933 +       uint8 num_channels;
10934 +} dot11_supp_channels_t;
10935 +
10936 +struct dot11_channel_switch {
10937 +       uint8 id;
10938 +       uint8 len;
10939 +       uint8 mode;
10940 +       uint8 channel;
10941 +       uint8 count;
10942 +}  PACKED;
10943 +typedef struct dot11_channel_switch dot11_channel_switch_t;
10944 +
10945 +/* 802.11h Measurement Request/Report IEs */
10946 +/* Measurement Type field */
10947 +#define DOT11_MEASURE_TYPE_BASIC       0
10948 +#define DOT11_MEASURE_TYPE_CCA                 1
10949 +#define DOT11_MEASURE_TYPE_RPI         2
10950 +
10951 +/* Measurement Mode field */
10952 +
10953 +/* Measurement Request Modes */
10954 +#define DOT11_MEASURE_MODE_ENABLE      (1<<1)
10955 +#define DOT11_MEASURE_MODE_REQUEST     (1<<2)
10956 +#define DOT11_MEASURE_MODE_REPORT      (1<<3)
10957 +/* Measurement Report Modes */
10958 +#define DOT11_MEASURE_MODE_LATE        (1<<0)
10959 +#define DOT11_MEASURE_MODE_INCAPABLE   (1<<1)
10960 +#define DOT11_MEASURE_MODE_REFUSED     (1<<2)
10961 +/* Basic Measurement Map bits */
10962 +#define DOT11_MEASURE_BASIC_MAP_BSS    ((uint8)(1<<0))
10963 +#define DOT11_MEASURE_BASIC_MAP_OFDM   ((uint8)(1<<1))
10964 +#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2))
10965 +#define DOT11_MEASURE_BASIC_MAP_RADAR  ((uint8)(1<<3))
10966 +#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4))
10967 +
10968 +typedef struct {
10969 +       uint8 id;
10970 +       uint8 len;
10971 +       uint8 token;
10972 +       uint8 mode;
10973 +       uint8 type;
10974 +       uint8 channel;
10975 +       uint8 start_time[8];
10976 +       uint16 duration;
10977 +} dot11_meas_req_t;
10978 +#define DOT11_MNG_IE_MREQ_LEN 14
10979 +/* length of Measure Request IE data not including variable len */
10980 +#define DOT11_MNG_IE_MREQ_FIXED_LEN 3
10981 +
10982 +struct dot11_meas_rep {
10983 +       uint8 id;
10984 +       uint8 len;
10985 +       uint8 token;
10986 +       uint8 mode;
10987 +       uint8 type;
10988 +       union 
10989 +       {
10990 +               struct {
10991 +                       uint8 channel;
10992 +                       uint8 start_time[8];
10993 +                       uint16 duration;
10994 +                       uint8 map;
10995 +               } PACKED basic;
10996 +               uint8 data[1];
10997 +       } PACKED rep;
10998 +} PACKED;
10999 +typedef struct dot11_meas_rep dot11_meas_rep_t;
11000 +
11001 +/* length of Measure Report IE data not including variable len */
11002 +#define DOT11_MNG_IE_MREP_FIXED_LEN    3
11003 +
11004 +struct dot11_meas_rep_basic {
11005 +       uint8 channel;
11006 +       uint8 start_time[8];
11007 +       uint16 duration;
11008 +       uint8 map;
11009 +} PACKED;
11010 +typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t;
11011 +#define DOT11_MEASURE_BASIC_REP_LEN    12
11012 +
11013 +struct dot11_quiet {
11014 +       uint8 id;
11015 +       uint8 len;
11016 +       uint8 count;    /* TBTTs until beacon interval in quiet starts */
11017 +       uint8 period;   /* Beacon intervals between periodic quiet periods ? */
11018 +       uint16 duration;/* Length of quiet period, in TU's */
11019 +       uint16 offset;  /* TU's offset from TBTT in Count field */
11020 +} PACKED;
11021 +typedef struct dot11_quiet dot11_quiet_t;
11022 +
11023 +typedef struct {
11024 +       uint8 channel;
11025 +       uint8 map;
11026 +} chan_map_tuple_t;
11027 +
11028 +typedef struct {
11029 +       uint8 id;
11030 +       uint8 len;
11031 +       uint8 eaddr[ETHER_ADDR_LEN];
11032 +       uint8 interval;
11033 +       chan_map_tuple_t map[1];
11034 +} dot11_ibss_dfs_t;
11035 +
11036 +
11037 +/* Macro to take a pointer to a beacon or probe response
11038 + * header and return the char* pointer to the SSID info element
11039 + */
11040 +#define BCN_PRB_SSID(hdr) ((char*)(hdr) + DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_LEN)
11041 +
11042 +/* Authentication frame payload constants */
11043 +#define DOT11_OPEN_SYSTEM      0
11044 +#define DOT11_SHARED_KEY       1
11045 +#define DOT11_CHALLENGE_LEN    128
11046 +
11047 +/* Frame control macros */
11048 +#define FC_PVER_MASK           0x3
11049 +#define FC_PVER_SHIFT          0
11050 +#define FC_TYPE_MASK           0xC
11051 +#define FC_TYPE_SHIFT          2
11052 +#define FC_SUBTYPE_MASK                0xF0
11053 +#define FC_SUBTYPE_SHIFT       4
11054 +#define FC_TODS                        0x100
11055 +#define FC_TODS_SHIFT          8
11056 +#define FC_FROMDS              0x200
11057 +#define FC_FROMDS_SHIFT                9
11058 +#define FC_MOREFRAG            0x400
11059 +#define FC_MOREFRAG_SHIFT      10
11060 +#define FC_RETRY               0x800
11061 +#define FC_RETRY_SHIFT         11
11062 +#define FC_PM                  0x1000
11063 +#define FC_PM_SHIFT            12
11064 +#define FC_MOREDATA            0x2000
11065 +#define FC_MOREDATA_SHIFT      13
11066 +#define FC_WEP                 0x4000
11067 +#define FC_WEP_SHIFT           14
11068 +#define FC_ORDER               0x8000
11069 +#define FC_ORDER_SHIFT         15
11070 +
11071 +/* sequence control macros */
11072 +#define SEQNUM_SHIFT           4
11073 +#define FRAGNUM_MASK           0xF
11074 +
11075 +/* Frame Control type/subtype defs */
11076 +
11077 +/* FC Types */
11078 +#define FC_TYPE_MNG            0
11079 +#define FC_TYPE_CTL            1
11080 +#define FC_TYPE_DATA           2
11081 +
11082 +/* Management Subtypes */
11083 +#define FC_SUBTYPE_ASSOC_REQ           0
11084 +#define FC_SUBTYPE_ASSOC_RESP          1
11085 +#define FC_SUBTYPE_REASSOC_REQ         2
11086 +#define FC_SUBTYPE_REASSOC_RESP                3
11087 +#define FC_SUBTYPE_PROBE_REQ           4
11088 +#define FC_SUBTYPE_PROBE_RESP          5
11089 +#define FC_SUBTYPE_BEACON              8
11090 +#define FC_SUBTYPE_ATIM                        9
11091 +#define FC_SUBTYPE_DISASSOC            10
11092 +#define FC_SUBTYPE_AUTH                        11
11093 +#define FC_SUBTYPE_DEAUTH              12
11094 +#define FC_SUBTYPE_ACTION              13
11095 +
11096 +/* Control Subtypes */
11097 +#define FC_SUBTYPE_PS_POLL             10
11098 +#define FC_SUBTYPE_RTS                 11
11099 +#define FC_SUBTYPE_CTS                 12
11100 +#define FC_SUBTYPE_ACK                 13
11101 +#define FC_SUBTYPE_CF_END              14
11102 +#define FC_SUBTYPE_CF_END_ACK          15
11103 +
11104 +/* Data Subtypes */
11105 +#define FC_SUBTYPE_DATA                        0
11106 +#define FC_SUBTYPE_DATA_CF_ACK         1
11107 +#define FC_SUBTYPE_DATA_CF_POLL                2
11108 +#define FC_SUBTYPE_DATA_CF_ACK_POLL    3
11109 +#define FC_SUBTYPE_NULL                        4
11110 +#define FC_SUBTYPE_CF_ACK              5
11111 +#define FC_SUBTYPE_CF_POLL             6
11112 +#define FC_SUBTYPE_CF_ACK_POLL         7
11113 +
11114 +/* type-subtype combos */
11115 +#define FC_KIND_MASK           (FC_TYPE_MASK | FC_SUBTYPE_MASK)
11116 +
11117 +#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT))
11118 +
11119 +#define FC_ASSOC_REQ   FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ)
11120 +#define FC_ASSOC_RESP  FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP)
11121 +#define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ)
11122 +#define FC_REASSOC_RESP        FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP)
11123 +#define FC_PROBE_REQ   FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ)
11124 +#define FC_PROBE_RESP  FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP)
11125 +#define FC_BEACON      FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON)
11126 +#define FC_DISASSOC    FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC)
11127 +#define FC_AUTH                FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH)
11128 +#define FC_DEAUTH      FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH)
11129 +#define FC_ACTION      FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION)
11130 +
11131 +#define FC_PS_POLL     FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL)
11132 +#define FC_RTS         FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS)
11133 +#define FC_CTS         FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS)
11134 +#define FC_ACK         FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK)
11135 +#define FC_CF_END      FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END)
11136 +#define FC_CF_END_ACK  FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK)
11137 +
11138 +#define FC_DATA                FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA)
11139 +#define FC_NULL_DATA   FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL)
11140 +#define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK)
11141 +
11142 +/* Management Frames */
11143 +
11144 +/* Management Frame Constants */
11145 +
11146 +/* Fixed fields */
11147 +#define DOT11_MNG_AUTH_ALGO_LEN                2
11148 +#define DOT11_MNG_AUTH_SEQ_LEN         2
11149 +#define DOT11_MNG_BEACON_INT_LEN       2
11150 +#define DOT11_MNG_CAP_LEN              2
11151 +#define DOT11_MNG_AP_ADDR_LEN          6
11152 +#define DOT11_MNG_LISTEN_INT_LEN       2
11153 +#define DOT11_MNG_REASON_LEN           2
11154 +#define DOT11_MNG_AID_LEN              2
11155 +#define DOT11_MNG_STATUS_LEN           2
11156 +#define DOT11_MNG_TIMESTAMP_LEN                8
11157 +
11158 +/* DUR/ID field in assoc resp is 0xc000 | AID */
11159 +#define DOT11_AID_MASK                 0x3fff
11160 +
11161 +/* Reason Codes */
11162 +#define DOT11_RC_RESERVED                      0
11163 +#define DOT11_RC_UNSPECIFIED                   1       /* Unspecified reason */
11164 +#define DOT11_RC_AUTH_INVAL                    2       /* Previous authentication no longer valid */
11165 +#define DOT11_RC_DEAUTH_LEAVING                        3       /* Deauthenticated because sending station is
11166 +                                                          leaving (or has left) IBSS or ESS */
11167 +#define DOT11_RC_INACTIVITY                    4       /* Disassociated due to inactivity */
11168 +#define DOT11_RC_BUSY                          5       /* Disassociated because AP is unable to handle
11169 +                                                          all currently associated stations */
11170 +#define DOT11_RC_INVAL_CLASS_2                 6       /* Class 2 frame received from
11171 +                                                          nonauthenticated station */
11172 +#define DOT11_RC_INVAL_CLASS_3                 7       /* Class 3 frame received from
11173 +                                                          nonassociated station */
11174 +#define DOT11_RC_DISASSOC_LEAVING              8       /* Disassociated because sending station is
11175 +                                                          leaving (or has left) BSS */
11176 +#define DOT11_RC_NOT_AUTH                      9       /* Station requesting (re)association is
11177 +                                                          not authenticated with responding station */
11178 +#define DOT11_RC_MAX                           23      /* Reason codes > 23 are reserved */
11179 +
11180 +/* Status Codes */
11181 +#define DOT11_STATUS_SUCCESS                   0       /* Successful */
11182 +#define DOT11_STATUS_FAILURE                   1       /* Unspecified failure */
11183 +#define DOT11_STATUS_CAP_MISMATCH              10      /* Cannot support all requested capabilities
11184 +                                                          in the Capability Information field */
11185 +#define DOT11_STATUS_REASSOC_FAIL              11      /* Reassociation denied due to inability to
11186 +                                                          confirm that association exists */
11187 +#define DOT11_STATUS_ASSOC_FAIL                        12      /* Association denied due to reason outside
11188 +                                                          the scope of this standard */
11189 +#define DOT11_STATUS_AUTH_MISMATCH             13      /* Responding station does not support the
11190 +                                                          specified authentication algorithm */
11191 +#define DOT11_STATUS_AUTH_SEQ                  14      /* Received an Authentication frame with
11192 +                                                          authentication transaction sequence number
11193 +                                                          out of expected sequence */
11194 +#define DOT11_STATUS_AUTH_CHALLENGE_FAIL       15      /* Authentication rejected because of challenge failure */
11195 +#define DOT11_STATUS_AUTH_TIMEOUT              16      /* Authentication rejected due to timeout waiting
11196 +                                                          for next frame in sequence */
11197 +#define DOT11_STATUS_ASSOC_BUSY_FAIL           17      /* Association denied because AP is unable to
11198 +                                                          handle additional associated stations */
11199 +#define DOT11_STATUS_ASSOC_RATE_MISMATCH       18      /* Association denied due to requesting station
11200 +                                                          not supporting all of the data rates in the
11201 +                                                          BSSBasicRateSet parameter */
11202 +#define DOT11_STATUS_ASSOC_SHORT_REQUIRED      19      /* Association denied due to requesting station
11203 +                                                          not supporting the Short Preamble option */
11204 +#define DOT11_STATUS_ASSOC_PBCC_REQUIRED       20      /* Association denied due to requesting station
11205 +                                                          not supporting the PBCC Modulation option */
11206 +#define DOT11_STATUS_ASSOC_AGILITY_REQUIRED    21      /* Association denied due to requesting station
11207 +                                                          not supporting the Channel Agility option */
11208 +#define DOT11_STATUS_ASSOC_SPECTRUM_REQUIRED   22      /* Association denied because Spectrum Management 
11209 +                                                          capability is required. */
11210 +#define DOT11_STATUS_ASSOC_BAD_POWER_CAP       23      /* Association denied because the info in the 
11211 +                                                          Power Cap element is unacceptable. */
11212 +#define DOT11_STATUS_ASSOC_BAD_SUP_CHANNELS    24      /* Association denied because the info in the 
11213 +                                                          Supported Channel element is unacceptable */
11214 +#define DOT11_STATUS_ASSOC_SHORTSLOT_REQUIRED  25      /* Association denied due to requesting station
11215 +                                                          not supporting the Short Slot Time option */
11216 +#define DOT11_STATUS_ASSOC_ERPBCC_REQUIRED     26      /* Association denied due to requesting station
11217 +                                                          not supporting the ER-PBCC Modulation option */
11218 +#define DOT11_STATUS_ASSOC_DSSOFDM_REQUIRED    27      /* Association denied due to requesting station
11219 +                                                          not supporting the DSS-OFDM option */
11220 +
11221 +/* Info Elts, length of INFORMATION portion of Info Elts */
11222 +#define DOT11_MNG_DS_PARAM_LEN                 1
11223 +#define DOT11_MNG_IBSS_PARAM_LEN               2
11224 +
11225 +/* TIM Info element has 3 bytes fixed info in INFORMATION field,
11226 + * followed by 1 to 251 bytes of Partial Virtual Bitmap */
11227 +#define DOT11_MNG_TIM_FIXED_LEN                        3
11228 +#define DOT11_MNG_TIM_DTIM_COUNT               0
11229 +#define DOT11_MNG_TIM_DTIM_PERIOD              1
11230 +#define DOT11_MNG_TIM_BITMAP_CTL               2
11231 +#define DOT11_MNG_TIM_PVB                      3
11232 +
11233 +/* TLV defines */
11234 +#define TLV_TAG_OFF            0
11235 +#define TLV_LEN_OFF            1
11236 +#define TLV_HDR_LEN            2
11237 +#define TLV_BODY_OFF           2
11238 +
11239 +/* Management Frame Information Element IDs */
11240 +#define DOT11_MNG_SSID_ID                      0
11241 +#define DOT11_MNG_RATES_ID                     1
11242 +#define DOT11_MNG_FH_PARMS_ID                  2
11243 +#define DOT11_MNG_DS_PARMS_ID                  3
11244 +#define DOT11_MNG_CF_PARMS_ID                  4
11245 +#define DOT11_MNG_TIM_ID                       5
11246 +#define DOT11_MNG_IBSS_PARMS_ID                        6
11247 +#define DOT11_MNG_COUNTRY_ID                   7
11248 +#define DOT11_MNG_HOPPING_PARMS_ID             8
11249 +#define DOT11_MNG_HOPPING_TABLE_ID             9
11250 +#define DOT11_MNG_REQUEST_ID                   10
11251 +#define DOT11_MNG_CHALLENGE_ID                 16
11252 +#define DOT11_MNG_PWR_CONSTRAINT_ID            32    /* 11H PowerConstraint    */
11253 +#define DOT11_MNG_PWR_CAP_ID                   33    /* 11H PowerCapability    */
11254 +#define DOT11_MNG_TPC_REQUEST_ID               34    /* 11H TPC Request        */
11255 +#define DOT11_MNG_TPC_REPORT_ID                        35    /* 11H TPC Report         */
11256 +#define DOT11_MNG_SUPP_CHANNELS_ID             36    /* 11H Supported Channels */
11257 +#define DOT11_MNG_CHANNEL_SWITCH_ID            37    /* 11H ChannelSwitch Announcement*/
11258 +#define DOT11_MNG_MEASURE_REQUEST_ID           38    /* 11H MeasurementRequest */
11259 +#define DOT11_MNG_MEASURE_REPORT_ID            39    /* 11H MeasurementReport  */
11260 +#define DOT11_MNG_QUIET_ID                     40    /* 11H Quiet              */
11261 +#define DOT11_MNG_IBSS_DFS_ID                  41    /* 11H IBSS_DFS           */
11262 +#define DOT11_MNG_ERP_ID                       42
11263 +#define DOT11_MNG_NONERP_ID                    47
11264 +#define DOT11_MNG_EXT_RATES_ID                 50
11265 +#define DOT11_MNG_WPA_ID                       221
11266 +#define DOT11_MNG_PROPR_ID                     221
11267 +
11268 +/* ERP info element bit values */
11269 +#define DOT11_MNG_ERP_LEN                      1       /* ERP is currently 1 byte long */
11270 +#define DOT11_MNG_NONERP_PRESENT               0x01    /* NonERP (802.11b) STAs are present in the BSS */
11271 +#define DOT11_MNG_USE_PROTECTION               0x02    /* Use protection mechanisms for ERP-OFDM frames */
11272 +#define DOT11_MNG_BARKER_PREAMBLE              0x04    /* Short Preambles: 0 == allowed, 1 == not allowed */
11273 +
11274 +/* Capability Information Field */
11275 +#define DOT11_CAP_ESS                          0x0001
11276 +#define DOT11_CAP_IBSS                         0x0002
11277 +#define DOT11_CAP_POLLABLE                     0x0004
11278 +#define DOT11_CAP_POLL_RQ                      0x0008
11279 +#define DOT11_CAP_PRIVACY                      0x0010
11280 +#define DOT11_CAP_SHORT                                0x0020
11281 +#define DOT11_CAP_PBCC                         0x0040
11282 +#define DOT11_CAP_AGILITY                      0x0080
11283 +#define DOT11_CAP_SPECTRUM                     0x0100
11284 +#define DOT11_CAP_SHORTSLOT                    0x0400
11285 +#define DOT11_CAP_CCK_OFDM                     0x2000
11286 +
11287 +/* Action Frame Constants */
11288 +#define DOT11_ACTION_CAT_ERR_MASK      0x10
11289 +#define DOT11_ACTION_CAT_SPECT_MNG     0x00
11290 +
11291 +#define DOT11_ACTION_ID_M_REQ          0
11292 +#define DOT11_ACTION_ID_M_REP          1
11293 +#define DOT11_ACTION_ID_TPC_REQ                2
11294 +#define DOT11_ACTION_ID_TPC_REP                3
11295 +#define DOT11_ACTION_ID_CHANNEL_SWITCH 4
11296 +
11297 +/* MLME Enumerations */
11298 +#define DOT11_BSSTYPE_INFRASTRUCTURE           0
11299 +#define DOT11_BSSTYPE_INDEPENDENT              1
11300 +#define DOT11_BSSTYPE_ANY                      2
11301 +#define DOT11_SCANTYPE_ACTIVE                  0
11302 +#define DOT11_SCANTYPE_PASSIVE                 1
11303 +
11304 +/* 802.11 A PHY constants */
11305 +#define APHY_SLOT_TIME         9
11306 +#define APHY_SIFS_TIME         16
11307 +#define APHY_DIFS_TIME         (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME))
11308 +#define APHY_PREAMBLE_TIME     16
11309 +#define APHY_SIGNAL_TIME       4
11310 +#define APHY_SYMBOL_TIME       4
11311 +#define APHY_SERVICE_NBITS     16
11312 +#define APHY_TAIL_NBITS                6
11313 +#define        APHY_CWMIN              15
11314 +
11315 +/* 802.11 B PHY constants */
11316 +#define BPHY_SLOT_TIME         20
11317 +#define BPHY_SIFS_TIME         10
11318 +#define BPHY_DIFS_TIME         50
11319 +#define BPHY_PLCP_TIME         192
11320 +#define BPHY_PLCP_SHORT_TIME   96
11321 +#define        BPHY_CWMIN              31
11322 +
11323 +/* 802.11 G constants */
11324 +#define DOT11_OFDM_SIGNAL_EXTENSION    6
11325 +
11326 +#define PHY_CWMAX              1023
11327 +
11328 +#define        DOT11_MAXNUMFRAGS       16      /* max # fragments per MSDU */
11329 +
11330 +/* dot11Counters Table - 802.11 spec., Annex D */
11331 +typedef struct d11cnt {
11332 +       uint32          txfrag;         /* dot11TransmittedFragmentCount */
11333 +       uint32          txmulti;        /* dot11MulticastTransmittedFrameCount */
11334 +       uint32          txfail;         /* dot11FailedCount */
11335 +       uint32          txretry;        /* dot11RetryCount */
11336 +       uint32          txretrie;       /* dot11MultipleRetryCount */
11337 +       uint32          rxdup;          /* dot11FrameduplicateCount */
11338 +       uint32          txrts;          /* dot11RTSSuccessCount */
11339 +       uint32          txnocts;        /* dot11RTSFailureCount */
11340 +       uint32          txnoack;        /* dot11ACKFailureCount */
11341 +       uint32          rxfrag;         /* dot11ReceivedFragmentCount */
11342 +       uint32          rxmulti;        /* dot11MulticastReceivedFrameCount */
11343 +       uint32          rxcrc;          /* dot11FCSErrorCount */
11344 +       uint32          txfrmsnt;       /* dot11TransmittedFrameCount */
11345 +       uint32          rxundec;        /* dot11WEPUndecryptableCount */
11346 +} d11cnt_t;
11347 +
11348 +/* BRCM OUI */
11349 +#define BRCM_OUI               "\x00\x10\x18"
11350 +
11351 +/* WPA definitions */
11352 +#define WPA_VERSION            1
11353 +#define WPA_OUI                        "\x00\x50\xF2"
11354 +
11355 +#define WPA_OUI_LEN    3
11356 +
11357 +/* WPA authentication modes */
11358 +#define WPA_AUTH_NONE          0       /* None */
11359 +#define WPA_AUTH_UNSPECIFIED   1       /* Unspecified authentication over 802.1X: default for WPA */
11360 +#define WPA_AUTH_PSK           2       /* Pre-shared Key over 802.1X */
11361 +#define WPA_AUTH_DISABLED      255     /* Legacy (i.e., non-WPA) */
11362 +                                
11363 +#define IS_WPA_AUTH(auth)      ((auth) == WPA_AUTH_NONE || \
11364 +                                (auth) == WPA_AUTH_UNSPECIFIED || \
11365 +                                (auth) == WPA_AUTH_PSK)
11366 +
11367 +
11368 +/* Key related defines */
11369 +#define DOT11_MAX_KEY_SIZE     32      /* max size of any key */
11370 +#define DOT11_MAX_IV_SIZE      16      /* max size of any IV */
11371 +#define DOT11_EXT_IV_FLAG      (1<<5)  /* flag to indicate IV is > 4 bytes */
11372 +
11373 +#define WEP1_KEY_SIZE          5       /* max size of any WEP key */
11374 +#define WEP1_KEY_HEX_SIZE      10      /* size of WEP key in hex. */
11375 +#define WEP128_KEY_SIZE                13      /* max size of any WEP key */
11376 +#define WEP128_KEY_HEX_SIZE    26      /* size of WEP key in hex. */
11377 +#define TKIP_MIC_SIZE          8       /* size of TKIP MIC */
11378 +#define TKIP_EOM_SIZE          7       /* max size of TKIP EOM */
11379 +#define TKIP_EOM_FLAG          0x5a    /* TKIP EOM flag byte */
11380 +#define TKIP_KEY_SIZE          32      /* size of any TKIP key */
11381 +#define TKIP_MIC_AUTH_TX       16      /* offset to Authenticator MIC TX key */
11382 +#define TKIP_MIC_AUTH_RX       24      /* offset to Authenticator MIC RX key */
11383 +#define TKIP_MIC_SUP_RX                16      /* offset to Supplicant MIC RX key */
11384 +#define TKIP_MIC_SUP_TX                24      /* offset to Supplicant MIC TX key */
11385 +#define AES_KEY_SIZE           16      /* size of AES key */
11386 +
11387 +#undef PACKED
11388 +#if !defined(__GNUC__)
11389 +#pragma pack()
11390 +#endif
11391 +
11392 +#endif /* _802_11_H_ */
11393 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/proto/ethernet.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/proto/ethernet.h
11394 --- linux-2.6.12.5/arch/mips/bcm947xx/include/proto/ethernet.h  1970-01-01 01:00:00.000000000 +0100
11395 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/proto/ethernet.h     2005-08-28 11:12:20.450856112 +0200
11396 @@ -0,0 +1,145 @@
11397 +/*******************************************************************************
11398 + * $Id$
11399 + * Copyright 2001-2003, Broadcom Corporation   
11400 + * All Rights Reserved.   
11401 + *    
11402 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
11403 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
11404 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
11405 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
11406 + * From FreeBSD 2.2.7: Fundamental constants relating to ethernet.
11407 + ******************************************************************************/
11408 +
11409 +#ifndef _NET_ETHERNET_H_           /* use native BSD ethernet.h when available */
11410 +#define _NET_ETHERNET_H_
11411 +
11412 +#ifndef _TYPEDEFS_H_
11413 +#include "typedefs.h"
11414 +#endif
11415 +
11416 +#if defined(__GNUC__)
11417 +#define        PACKED  __attribute__((packed))
11418 +#else
11419 +#define        PACKED
11420 +#endif
11421 +
11422 +/*
11423 + * The number of bytes in an ethernet (MAC) address.
11424 + */
11425 +#define        ETHER_ADDR_LEN          6
11426 +
11427 +/*
11428 + * The number of bytes in the type field.
11429 + */
11430 +#define        ETHER_TYPE_LEN          2
11431 +
11432 +/*
11433 + * The number of bytes in the trailing CRC field.
11434 + */
11435 +#define        ETHER_CRC_LEN           4
11436 +
11437 +/*
11438 + * The length of the combined header.
11439 + */
11440 +#define        ETHER_HDR_LEN           (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN)
11441 +
11442 +/*
11443 + * The minimum packet length.
11444 + */
11445 +#define        ETHER_MIN_LEN           64
11446 +
11447 +/*
11448 + * The minimum packet user data length.
11449 + */
11450 +#define        ETHER_MIN_DATA          46
11451 +
11452 +/*
11453 + * The maximum packet length.
11454 + */
11455 +#define        ETHER_MAX_LEN           1518
11456 +
11457 +/*
11458 + * The maximum packet user data length.
11459 + */
11460 +#define        ETHER_MAX_DATA          1500
11461 +
11462 +/*
11463 + * Used to uniquely identify a 802.1q VLAN-tagged header.
11464 + */
11465 +#define        VLAN_TAG                        0x8100
11466 +
11467 +/*
11468 + * Located after dest & src address in ether header.
11469 + */
11470 +#define VLAN_FIELDS_OFFSET             (ETHER_ADDR_LEN * 2)
11471 +
11472 +/*
11473 + * 4 bytes of vlan field info.
11474 + */
11475 +#define VLAN_FIELDS_SIZE               4
11476 +
11477 +/* location of pri bits in 16-bit vlan fields */
11478 +#define VLAN_PRI_SHIFT                 13
11479 +
11480 +/* 3 bits of priority */
11481 +#define VLAN_PRI_MASK                  7
11482 +
11483 +/* 802.1X ethertype */
11484 +#define ETHER_TYPE_802_1X      0x888e
11485 +
11486 +/*
11487 + * A macro to validate a length with
11488 + */
11489 +#define        ETHER_IS_VALID_LEN(foo) \
11490 +       ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
11491 +
11492 +
11493 +#ifndef __INCif_etherh     /* Quick and ugly hack for VxWorks */
11494 +/*
11495 + * Structure of a 10Mb/s Ethernet header.
11496 + */
11497 +struct ether_header {
11498 +       uint8   ether_dhost[ETHER_ADDR_LEN];
11499 +       uint8   ether_shost[ETHER_ADDR_LEN];
11500 +       uint16  ether_type;
11501 +} PACKED ;
11502 +
11503 +/*
11504 + * Structure of a 48-bit Ethernet address.
11505 + */
11506 +struct ether_addr {
11507 +       uint8 octet[ETHER_ADDR_LEN];
11508 +} PACKED ;
11509 +#endif
11510 +
11511 +/*
11512 + * Takes a pointer, returns true if a 48-bit multicast address
11513 + * (including broadcast, since it is all ones)
11514 + */
11515 +#define ETHER_ISMULTI(ea) (((uint8 *)(ea))[0] & 1)
11516 +
11517 +/*
11518 + * Takes a pointer, returns true if a 48-bit broadcast (all ones)
11519 + */
11520 +#define ETHER_ISBCAST(ea) ((((uint8 *)(ea))[0] &               \
11521 +                           ((uint8 *)(ea))[1] &                \
11522 +                           ((uint8 *)(ea))[2] &                \
11523 +                           ((uint8 *)(ea))[3] &                \
11524 +                           ((uint8 *)(ea))[4] &                \
11525 +                           ((uint8 *)(ea))[5]) == 0xff)
11526 +
11527 +static const struct ether_addr ether_bcast = {{255, 255, 255, 255, 255, 255}};
11528 +
11529 +/*
11530 + * Takes a pointer, returns true if a 48-bit null address (all zeros)
11531 + */
11532 +#define ETHER_ISNULLADDR(ea) ((((uint8 *)(ea))[0] |            \
11533 +                           ((uint8 *)(ea))[1] |                \
11534 +                           ((uint8 *)(ea))[2] |                \
11535 +                           ((uint8 *)(ea))[3] |                \
11536 +                           ((uint8 *)(ea))[4] |                \
11537 +                           ((uint8 *)(ea))[5]) == 0)
11538 +
11539 +#undef PACKED
11540 +
11541 +#endif /* _NET_ETHERNET_H_ */
11542 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/rts/crc.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/rts/crc.h
11543 --- linux-2.6.12.5/arch/mips/bcm947xx/include/rts/crc.h 1970-01-01 01:00:00.000000000 +0100
11544 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/rts/crc.h    2005-08-28 11:12:20.451855960 +0200
11545 @@ -0,0 +1,69 @@
11546 +/*******************************************************************************
11547 + * $Id$
11548 + * Copyright 2001-2003, Broadcom Corporation   
11549 + * All Rights Reserved.   
11550 + *    
11551 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
11552 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
11553 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
11554 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
11555 + * crc.h - a function to compute crc for iLine10 headers
11556 + ******************************************************************************/
11557 +
11558 +#ifndef _RTS_CRC_H_
11559 +#define _RTS_CRC_H_ 1
11560 +
11561 +#include "typedefs.h"
11562 +
11563 +#ifdef __cplusplus
11564 +extern "C" {
11565 +#endif
11566 +
11567 +
11568 +#define CRC8_INIT_VALUE  0xff       /* Initial CRC8 checksum value */
11569 +#define CRC8_GOOD_VALUE  0x9f       /* Good final CRC8 checksum value */
11570 +#define HCS_GOOD_VALUE   0x39       /* Good final header checksum value */
11571 +
11572 +#define CRC16_INIT_VALUE 0xffff     /* Initial CRC16 checksum value */
11573 +#define CRC16_GOOD_VALUE 0xf0b8     /* Good final CRC16 checksum value */
11574 +
11575 +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
11576 +#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */
11577 +
11578 +void   hcs(uint8 *, uint);
11579 +uint8  crc8(uint8 *, uint, uint8);
11580 +uint16 crc16(uint8 *, uint, uint16);
11581 +uint32 crc32(uint8 *, uint, uint32);
11582 +
11583 +/* macros for common usage */
11584 +
11585 +#define APPEND_CRC8(pbytes, nbytes)                           \
11586 +do {                                                          \
11587 +    uint8 tmp = crc8(pbytes, nbytes, CRC8_INIT_VALUE) ^ 0xff; \
11588 +    (pbytes)[(nbytes)] = tmp;                                 \
11589 +    (nbytes) += 1;                                            \
11590 +} while (0)
11591 +
11592 +#define APPEND_CRC16(pbytes, nbytes)                               \
11593 +do {                                                               \
11594 +    uint16 tmp = crc16(pbytes, nbytes, CRC16_INIT_VALUE) ^ 0xffff; \
11595 +    (pbytes)[(nbytes) + 0] = (tmp >> 0) & 0xff;                    \
11596 +    (pbytes)[(nbytes) + 1] = (tmp >> 8) & 0xff;                    \
11597 +    (nbytes) += 2;                                                 \
11598 +} while (0)
11599 +
11600 +#define APPEND_CRC32(pbytes, nbytes)                                   \
11601 +do {                                                                   \
11602 +    uint32 tmp = crc32(pbytes, nbytes, CRC32_INIT_VALUE) ^ 0xffffffff; \
11603 +    (pbytes)[(nbytes) + 0] = (tmp >>  0) & 0xff;                       \
11604 +    (pbytes)[(nbytes) + 1] = (tmp >>  8) & 0xff;                       \
11605 +    (pbytes)[(nbytes) + 2] = (tmp >> 16) & 0xff;                       \
11606 +    (pbytes)[(nbytes) + 3] = (tmp >> 24) & 0xff;                       \
11607 +    (nbytes) += 4;                                                     \
11608 +} while (0)
11609 +
11610 +#ifdef __cplusplus
11611 +}
11612 +#endif
11613 +
11614 +#endif /* _RTS_CRC_H_ */
11615 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/s5.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/s5.h
11616 --- linux-2.6.12.5/arch/mips/bcm947xx/include/s5.h      1970-01-01 01:00:00.000000000 +0100
11617 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/s5.h 2005-08-28 11:12:20.451855960 +0200
11618 @@ -0,0 +1,103 @@
11619 +#ifndef _S5_H_
11620 +#define _S5_H_
11621 +/*
11622 + *   Copyright 2003, Broadcom Corporation
11623 + *   All Rights Reserved.
11624 + * 
11625 + *   Broadcom Sentry5 (S5) BCM5365, 53xx, BCM58xx SOC Internal Core
11626 + *   and MIPS3301 (R4K) System Address Space
11627 + *
11628 + *   This program is free software; you can redistribute it and/or
11629 + *   modify it under the terms of the GNU General Public License as
11630 + *   published by the Free Software Foundation, located in the file
11631 + *   LICENSE.
11632 + *
11633 + *   $Id: s5.h,v 1.3 2003/06/10 18:54:51 jfd Exp $
11634 + * 
11635 + */
11636 +
11637 +/* BCM5365 Address map */
11638 +#define KSEG1ADDR(x)    ( (x) | 0xa0000000)
11639 +#define BCM5365_SDRAM          0x00000000 /* 0-128MB Physical SDRAM */
11640 +#define BCM5365_PCI_MEM                0x08000000 /* Host Mode PCI mem space (64MB) */
11641 +#define BCM5365_PCI_CFG                0x0c000000 /* Host Mode PCI cfg space (64MB) */
11642 +#define BCM5365_PCI_DMA                0x40000000 /* Client Mode PCI mem space (1GB)*/
11643 +#define        BCM5365_SDRAM_SWAPPED   0x10000000 /* Byteswapped Physical SDRAM */
11644 +#define BCM5365_ENUM           0x18000000 /* Beginning of core enum space */
11645 +
11646 +/* BCM5365 Core register space */
11647 +#define BCM5365_REG_CHIPC      0x18000000 /* Chipcommon  registers */
11648 +#define BCM5365_REG_EMAC0      0x18001000 /* Ethernet MAC0 core registers */
11649 +#define BCM5365_REG_IPSEC      0x18002000 /* BCM582x CryptoCore registers */
11650 +#define BCM5365_REG_USB                0x18003000 /* USB core registers */
11651 +#define BCM5365_REG_PCI                0x18004000 /* PCI core registers */
11652 +#define BCM5365_REG_MIPS33     0x18005000 /* MIPS core registers */
11653 +#define BCM5365_REG_MEMC       0x18006000 /* MEMC core registers */
11654 +#define BCM5365_REG_UARTS       (BCM5365_REG_CHIPC + 0x300) /* UART regs */
11655 +#define        BCM5365_EJTAG           0xff200000 /* MIPS EJTAG space (2M) */
11656 +
11657 +/* COM Ports 1/2 */
11658 +#define        BCM5365_UART            (BCM5365_REG_UARTS)
11659 +#define BCM5365_UART_COM2      (BCM5365_REG_UARTS + 0x00000100)
11660 +
11661 +/* Registers common to MIPS33 Core used in 5365 */
11662 +#define MIPS33_FLASH_REGION           0x1fc00000 /* Boot FLASH Region  */
11663 +#define MIPS33_EXTIF_REGION           0x1a000000 /* Chipcommon EXTIF region*/
11664 +#define BCM5365_EXTIF                 0x1b000000 /* MISC_CS */
11665 +#define MIPS33_FLASH_REGION_AUX       0x1c000000 /* FLASH Region 2*/
11666 +
11667 +/* Internal Core Sonics Backplane Devices */
11668 +#define INTERNAL_UART_COM1            BCM5365_UART
11669 +#define INTERNAL_UART_COM2            BCM5365_UART_COM2
11670 +#define SB_REG_CHIPC                  BCM5365_REG_CHIPC
11671 +#define SB_REG_ENET0                  BCM5365_REG_EMAC0
11672 +#define SB_REG_IPSEC                  BCM5365_REG_IPSEC
11673 +#define SB_REG_USB                    BCM5365_REG_USB
11674 +#define SB_REG_PCI                    BCM5365_REG_PCI
11675 +#define SB_REG_MIPS                   BCM5365_REG_MIPS33
11676 +#define SB_REG_MEMC                   BCM5365_REG_MEMC
11677 +#define SB_REG_MEMC_OFF               0x6000
11678 +#define SB_EXTIF_SPACE                MIPS33_EXTIF_REGION
11679 +#define SB_FLASH_SPACE                MIPS33_FLASH_REGION
11680 +
11681 +/*
11682 + * XXX
11683 + * 5365-specific backplane interrupt flag numbers.  This should be done
11684 + * dynamically instead.
11685 + */
11686 +#define        SBFLAG_PCI      0
11687 +#define        SBFLAG_ENET0    1
11688 +#define        SBFLAG_ILINE20  2
11689 +#define        SBFLAG_CODEC    3
11690 +#define        SBFLAG_USB      4
11691 +#define        SBFLAG_EXTIF    5
11692 +#define        SBFLAG_ENET1    6
11693 +
11694 +/* BCM95365 Local Bus devices */
11695 +#define BCM95365K_RESET_ADDR            BCM5365_EXTIF
11696 +#define BCM95365K_BOARDID_ADDR         (BCM5365_EXTIF | 0x4000)
11697 +#define BCM95365K_DOC_ADDR             (BCM5365_EXTIF | 0x6000)
11698 +#define BCM95365K_LED_ADDR             (BCM5365_EXTIF | 0xc000)
11699 +#define BCM95365K_TOD_REG_BASE          (BCM95365K_NVRAM_ADDR | 0x1ff0)
11700 +#define BCM95365K_NVRAM_ADDR           (BCM5365_EXTIF | 0xe000)
11701 +#define BCM95365K_NVRAM_SIZE             0x1ff0 /* 8K NVRAM : DS1743/STM48txx*/
11702 +
11703 +/* Write to DLR2416 VFD Display character RAM */
11704 +#define LED_REG(x)      \
11705 + (*(volatile unsigned char *) (KSEG1ADDR(BCM95365K_LED_ADDR) + (x)))
11706 +
11707 +#ifdef CONFIG_VSIM
11708 +#define        BCM5365_TRACE(trval)        do { *((int *)0xa0002ff8) = (trval); \
11709 +                                       } while (0)
11710 +#else
11711 +#define        BCM5365_TRACE(trval)        do { *((unsigned char *)\
11712 +                                         KSEG1ADDR(BCM5365K_LED_ADDR)) = (trval); \
11713 +                                   *((int *)0xa0002ff8) = (trval); } while (0)
11714 +#endif
11715 +
11716 +/* BCM9536R Local Bus devices */
11717 +#define BCM95365R_DOC_ADDR             BCM5365_EXTIF
11718 +
11719 +
11720 +
11721 +#endif /*!_S5_H_ */
11722 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbchipc.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbchipc.h
11723 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbchipc.h 1970-01-01 01:00:00.000000000 +0100
11724 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbchipc.h    2005-08-28 11:12:20.468853376 +0200
11725 @@ -0,0 +1,281 @@
11726 +/*
11727 + * SiliconBackplane Chipcommon core hardware definitions.
11728 + *
11729 + * The chipcommon core provides chip identification, SB control,
11730 + * jtag, 0/1/2 uarts, clock frequency control, a watchdog interrupt timer,
11731 + * gpio interface, extbus, and support for serial and parallel flashes.
11732 + *
11733 + * Copyright 2001-2003, Broadcom Corporation
11734 + * All Rights Reserved.
11735 + * 
11736 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
11737 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
11738 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
11739 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11740 + *
11741 + * $Id$
11742 + */
11743 +
11744 +#ifndef        _SBCHIPC_H
11745 +#define        _SBCHIPC_H
11746 +
11747 +
11748 +/* cpp contortions to concatenate w/arg prescan */
11749 +#ifndef PAD
11750 +#define        _PADLINE(line)  pad ## line
11751 +#define        _XSTR(line)     _PADLINE(line)
11752 +#define        PAD             _XSTR(__LINE__)
11753 +#endif /* PAD */
11754 +
11755 +typedef volatile struct {
11756 +       uint32  chipid;                 /* 0x0 */
11757 +       uint32  capabilities;
11758 +       uint32  corecontrol;            /* corerev >= 1 */
11759 +       uint32  PAD[5];
11760 +
11761 +       /* Interrupt control */
11762 +       uint32  intstatus;              /* 0x20 */
11763 +       uint32  intmask;
11764 +       uint32  PAD[6];
11765 +
11766 +       /* serial flash interface registers */
11767 +       uint32  flashcontrol;           /* 0x40 */
11768 +       uint32  flashaddress;
11769 +       uint32  flashdata;
11770 +       uint32  PAD[1];
11771 +
11772 +       /* Silicon backplane configuration broadcast control */
11773 +       uint32  broadcastaddress;
11774 +       uint32  broadcastdata;
11775 +       uint32  PAD[2];
11776 +
11777 +       /* gpio - cleared only by power-on-reset */
11778 +       uint32  gpioin;                 /* 0x60 */
11779 +       uint32  gpioout;
11780 +       uint32  gpioouten;
11781 +       uint32  gpiocontrol;
11782 +       uint32  gpiointpolarity;
11783 +       uint32  gpiointmask;
11784 +       uint32  PAD[2];
11785 +
11786 +       /* Watchdog timer */
11787 +       uint32  watchdog;               /* 0x80 */
11788 +       uint32  PAD[3];
11789 +
11790 +       /* clock control */
11791 +       uint32  clockcontrol_n;         /* 0x90 */
11792 +       uint32  clockcontrol_sb;        /* aka m0 */
11793 +       uint32  clockcontrol_pci;       /* aka m1 */
11794 +       uint32  clockcontrol_m2;        /* mii/uart/mipsref */
11795 +       uint32  clockcontrol_mips;      /* aka m3 */
11796 +       uint32  uart_clkdiv;            /* corerev >= 3 */
11797 +       uint32  PAD[2];
11798 +
11799 +       /* pll delay registers (corerev >= 4) */
11800 +       uint32  pll_on_delay;           /* 0xb0 */
11801 +       uint32  fref_sel_delay;
11802 +       uint32  slow_clk_ctl;
11803 +       uint32  PAD[17];
11804 +
11805 +       /* ExtBus control registers (corerev >= 3) */
11806 +       uint32  cs01config;             /* 0x100 */
11807 +       uint32  cs01memwaitcnt;
11808 +       uint32  cs01attrwaitcnt;
11809 +       uint32  cs01iowaitcnt;
11810 +       uint32  cs23config;
11811 +       uint32  cs23memwaitcnt;
11812 +       uint32  cs23attrwaitcnt;
11813 +       uint32  cs23iowaitcnt;
11814 +       uint32  cs4config;
11815 +       uint32  cs4waitcnt;
11816 +       uint32  parallelflashconfig;
11817 +       uint32  parallelflashwaitcnt;
11818 +       uint32  PAD[116];
11819 +
11820 +       /* uarts */
11821 +       uint8   uart0data;              /* 0x300 */
11822 +       uint8   uart0imr;
11823 +       uint8   uart0fcr;
11824 +       uint8   uart0lcr;
11825 +       uint8   uart0mcr;
11826 +       uint8   uart0lsr;
11827 +       uint8   uart0msr;
11828 +       uint8   uart0scratch;
11829 +       uint8   PAD[248];               /* corerev >= 1 */
11830 +
11831 +       uint8   uart1data;              /* 0x400 */
11832 +       uint8   uart1imr;
11833 +       uint8   uart1fcr;
11834 +       uint8   uart1lcr;
11835 +       uint8   uart1mcr;
11836 +       uint8   uart1lsr;
11837 +       uint8   uart1msr;
11838 +       uint8   uart1scratch;
11839 +} chipcregs_t;
11840 +
11841 +/* chipid */
11842 +#define        CID_ID_MASK             0x0000ffff              /* Chip Id mask */
11843 +#define        CID_REV_MASK            0x000f0000              /* Chip Revision mask */
11844 +#define        CID_REV_SHIFT           16                      /* Chip Revision shift */
11845 +#define        CID_PKG_MASK            0x00f00000              /* Package Option mask */
11846 +#define        CID_PKG_SHIFT           20                      /* Package Option shift */
11847 +#define        CID_CC_MASK             0x0f000000              /* CoreCount (corerev >= 4) */
11848 +#define CID_CC_SHIFT           24
11849 +
11850 +/* capabilities */
11851 +#define        CAP_UARTS_MASK          0x00000003              /* Number of uarts */
11852 +#define CAP_MIPSEB             0x00000004              /* MIPS is in big-endian mode */
11853 +#define CAP_UCLKSEL            0x00000018              /* UARTs clock select */
11854 +#define CAP_UINTCLK            0x00000008              /* UARTs are driven by internal divided clock */
11855 +#define CAP_UARTGPIO           0x00000020              /* UARTs own Gpio's 15:12 */
11856 +#define CAP_EXTBUS             0x00000040              /* External bus present */
11857 +#define        CAP_FLASH_MASK          0x00000700              /* Type of flash */
11858 +#define        CAP_PLL_MASK            0x00038000              /* Type of PLL */
11859 +#define CAP_PWR_CTL            0x00040000              /* Power control */
11860 +
11861 +/* PLL type */
11862 +#define PLL_NONE               0x00000000
11863 +#define PLL_TYPE1              0x00010000              /* 48Mhz base, 3 dividers */
11864 +#define PLL_TYPE2              0x00020000              /* 48Mhz, 4 dividers */
11865 +#define PLL_TYPE3              0x00030000              /* 25Mhz, 2 dividers */
11866 +#define PLL_TYPE4              0x00008000              /* 48Mhz, 4 dividers */
11867 +
11868 +/* corecontrol */
11869 +#define CC_UARTCLKO            0x00000001              /* Drive UART with internal clock */
11870 +#define        CC_SE                   0x00000002              /* sync clk out enable (corerev >= 3) */
11871 +
11872 +/* intstatus/intmask */
11873 +#define        CI_EI                   0x00000002              /* ro: ext intr pin (corerev >= 3) */
11874 +
11875 +/* slow_clk_ctl */
11876 +#define SCC_SS_MASK            0x00000007              /* slow clock source mask */
11877 +#define        SCC_SS_LPO              0x00000000              /* source of slow clock is LPO */
11878 +#define        SCC_SS_XTAL             0x00000001              /* source of slow clock is crystal */
11879 +#define        SCC_SS_PCI              0x00000002              /* source of slow clock is PCI */
11880 +#define SCC_LF                 0x00000200              /* LPOFreqSel, 1: 160Khz, 0: 32KHz */
11881 +#define SCC_LP                 0x00000400              /* LPOPowerDown, 1: LPO is disabled, 0: LPO is enabled */
11882 +#define SCC_FS                 0x00000800              /* ForceSlowClk, 1: sb/cores running on slow clock, 0: power logic control */
11883 +#define SCC_IP                 0x00001000              /* IgnorePllOffReq, 1/0: power logic ignores/honors PLL clock disable requests from core */
11884 +#define SCC_XC                 0x00002000              /* XtalControlEn, 1/0: power logic does/doesn't disable crystal when appropriate */
11885 +#define SCC_XP                 0x00004000              /* XtalPU (RO), 1/0: crystal running/disabled */
11886 +#define SCC_CD_MASK            0xffff0000              /* ClockDivider mask, SlowClk = 1/(4+divisor) * crystal/PCI clock */
11887 +#define SCC_CD_SHF             16                      /* CLockDivider shift */
11888 +
11889 +/* clockcontrol_n */
11890 +#define        CN_N1_MASK              0x3f                    /* n1 control */
11891 +#define        CN_N2_MASK              0x3f00                  /* n2 control */
11892 +#define        CN_N2_SHIFT             8
11893 +
11894 +/* clockcontrol_sb/pci/uart */
11895 +#define        CC_M1_MASK              0x3f                    /* m1 control */
11896 +#define        CC_M2_MASK              0x3f00                  /* m2 control */
11897 +#define        CC_M2_SHIFT             8
11898 +#define        CC_M3_MASK              0x3f0000                /* m3 control */
11899 +#define        CC_M3_SHIFT             16
11900 +#define        CC_MC_MASK              0x1f000000              /* mux control */
11901 +#define        CC_MC_SHIFT             24
11902 +
11903 +/* N3M Clock control values for 125Mhz */
11904 +#define        CC_125_N                0x0802                  /* Default values for bcm4310 */
11905 +#define        CC_125_M                0x04020009
11906 +#define        CC_125_M25              0x11090009
11907 +#define        CC_125_M33              0x11090005
11908 +
11909 +/* N3M Clock control magic field values */
11910 +#define        CC_F6_2                 0x02                    /* A factor of 2 in */
11911 +#define        CC_F6_3                 0x03                    /* 6-bit fields like */
11912 +#define        CC_F6_4                 0x05                    /* N1, M1 or M3 */
11913 +#define        CC_F6_5                 0x09
11914 +#define        CC_F6_6                 0x11
11915 +#define        CC_F6_7                 0x21
11916 +
11917 +#define        CC_F5_BIAS              5                       /* 5-bit fields get this added */
11918 +
11919 +#define        CC_MC_BYPASS            0x08
11920 +#define        CC_MC_M1                0x04
11921 +#define        CC_MC_M1M2              0x02
11922 +#define        CC_MC_M1M2M3            0x01
11923 +#define        CC_MC_M1M3              0x11
11924 +
11925 +/* Type 2 Clock control magic field values */
11926 +#define        CC_T2_BIAS              2                       /* n1, n2, m1 & m3 bias */
11927 +#define        CC_T2M2_BIAS            3                       /* m2 bias */
11928 +
11929 +#define        CC_T2MC_M1BYP           1
11930 +#define        CC_T2MC_M2BYP           2
11931 +#define        CC_T2MC_M3BYP           4
11932 +
11933 +/* Common clock base */
11934 +#define        CC_CLOCK_BASE           24000000                /* Half the clock freq */
11935 +
11936 +/* Flash types in the chipcommon capabilities register */
11937 +#define FLASH_NONE             0x000           /* No flash */
11938 +#define SFLASH_ST              0x100           /* ST serial flash */
11939 +#define SFLASH_AT              0x200           /* Atmel serial flash */
11940 +#define        PFLASH                  0x700           /* Parallel flash */
11941 +
11942 +/* Bits in the config registers */
11943 +#define        CC_CFG_EN               0x0001          /* Enable */
11944 +#define        CC_CFG_EM_MASK          0x000e          /* Extif Mode */
11945 +#define        CC_CFG_EM_ASYNC         0x0002          /*   Async/Parallel flash */
11946 +#define        CC_CFG_EM_SYNC          0x0004          /*   Synchronous */
11947 +#define        CC_CFG_EM_PCMCIA        0x0008          /*   PCMCIA */
11948 +#define        CC_CFG_EM_IDE           0x000a          /*   IDE */
11949 +#define        CC_CFG_DS               0x0010          /* Data size, 0=8bit, 1=16bit */
11950 +#define        CC_CFG_CD_MASK          0x0060          /* Sync: Clock divisor */
11951 +#define        CC_CFG_CE               0x0080          /* Sync: Clock enable */
11952 +#define        CC_CFG_SB               0x0100          /* Sync: Size/Bytestrobe */
11953 +
11954 +/* Start/busy bit in flashcontrol */
11955 +#define SFLASH_START           0x80000000
11956 +#define SFLASH_BUSY            SFLASH_START
11957 +
11958 +/* flashcontrol opcodes for ST flashes */
11959 +#define SFLASH_ST_WREN         0x0006          /* Write Enable */
11960 +#define SFLASH_ST_WRDIS                0x0004          /* Write Disable */
11961 +#define SFLASH_ST_RDSR         0x0105          /* Read Status Register */
11962 +#define SFLASH_ST_WRSR         0x0101          /* Write Status Register */
11963 +#define SFLASH_ST_READ         0x0303          /* Read Data Bytes */
11964 +#define SFLASH_ST_PP           0x0302          /* Page Program */
11965 +#define SFLASH_ST_SE           0x02d8          /* Sector Erase */
11966 +#define SFLASH_ST_BE           0x00c7          /* Bulk Erase */
11967 +#define SFLASH_ST_DP           0x00b9          /* Deep Power-down */
11968 +#define SFLASH_ST_RES          0x03ab          /* Read Electronic Signature */
11969 +
11970 +/* Status register bits for ST flashes */
11971 +#define SFLASH_ST_WIP          0x01            /* Write In Progress */
11972 +#define SFLASH_ST_WEL          0x02            /* Write Enable Latch */
11973 +#define SFLASH_ST_BP_MASK      0x1c            /* Block Protect */
11974 +#define SFLASH_ST_BP_SHIFT     2
11975 +#define SFLASH_ST_SRWD         0x80            /* Status Register Write Disable */
11976 +
11977 +/* flashcontrol opcodes for Atmel flashes */
11978 +#define SFLASH_AT_READ                         0x07e8
11979 +#define SFLASH_AT_PAGE_READ                    0x07d2
11980 +#define SFLASH_AT_BUF1_READ
11981 +#define SFLASH_AT_BUF2_READ
11982 +#define SFLASH_AT_STATUS                       0x01d7
11983 +#define SFLASH_AT_BUF1_WRITE                   0x0384
11984 +#define SFLASH_AT_BUF2_WRITE                   0x0387
11985 +#define SFLASH_AT_BUF1_ERASE_PROGRAM           0x0283
11986 +#define SFLASH_AT_BUF2_ERASE_PROGRAM           0x0286
11987 +#define SFLASH_AT_BUF1_PROGRAM                 0x0288
11988 +#define SFLASH_AT_BUF2_PROGRAM                 0x0289
11989 +#define SFLASH_AT_PAGE_ERASE                   0x0281
11990 +#define SFLASH_AT_BLOCK_ERASE                  0x0250
11991 +#define SFLASH_AT_BUF1_WRITE_ERASE_PROGRAM     0x0382
11992 +#define SFLASH_AT_BUF2_WRITE_ERASE_PROGRAM     0x0385
11993 +#define SFLASH_AT_BUF1_LOAD                    0x0253
11994 +#define SFLASH_AT_BUF2_LOAD                    0x0255
11995 +#define SFLASH_AT_BUF1_COMPARE                 0x0260
11996 +#define SFLASH_AT_BUF2_COMPARE                 0x0261
11997 +#define SFLASH_AT_BUF1_REPROGRAM               0x0258
11998 +#define SFLASH_AT_BUF2_REPROGRAM               0x0259
11999 +
12000 +/* Status register bits for Atmel flashes */
12001 +#define SFLASH_AT_READY                                0x80
12002 +#define SFLASH_AT_MISMATCH                     0x40
12003 +#define SFLASH_AT_ID_MASK                      0x38
12004 +#define SFLASH_AT_ID_SHIFT                     3
12005 +
12006 +#endif /* _SBCHIPC_H */
12007 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbconfig.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbconfig.h
12008 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbconfig.h        1970-01-01 01:00:00.000000000 +0100
12009 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbconfig.h   2005-08-28 11:12:20.469853224 +0200
12010 @@ -0,0 +1,296 @@
12011 +/*
12012 + * Broadcom SiliconBackplane hardware register definitions.
12013 + *
12014 + * Copyright 2001-2003, Broadcom Corporation   
12015 + * All Rights Reserved.   
12016 + *    
12017 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
12018 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
12019 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
12020 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
12021 + * $Id$
12022 + */
12023 +
12024 +#ifndef        _SBCONFIG_H
12025 +#define        _SBCONFIG_H
12026 +
12027 +/* cpp contortions to concatenate w/arg prescan */
12028 +#ifndef PAD
12029 +#define        _PADLINE(line)  pad ## line
12030 +#define        _XSTR(line)     _PADLINE(line)
12031 +#define        PAD             _XSTR(__LINE__)
12032 +#endif
12033 +
12034 +/*
12035 + * SiliconBackplane Address Map.
12036 + * All regions may not exist on all chips.
12037 + */
12038 +#define SB_SDRAM_BASE          0x00000000      /* Physical SDRAM */
12039 +#define SB_PCI_MEM             0x08000000      /* Host Mode PCI memory access space (64 MB) */
12040 +#define SB_PCI_CFG             0x0c000000      /* Host Mode PCI configuration space (64 MB) */
12041 +#define        SB_SDRAM_SWAPPED        0x10000000      /* Byteswapped Physical SDRAM */
12042 +#define SB_ENUM_BASE           0x18000000      /* Enumeration space base */
12043 +#define        SB_ENUM_LIM             0x18010000      /* Enumeration space limit */
12044 +#define        SB_EXTIF_BASE           0x1f000000      /* External Interface region base address */
12045 +#define SB_PCI_DMA             0x40000000      /* Client Mode PCI memory access space (1 GB) */
12046 +#define        SB_EUART                (SB_EXTIF_BASE + 0x00800000)
12047 +#define        SB_LED                  (SB_EXTIF_BASE + 0x00900000)
12048 +
12049 +/* enumeration space related defs */
12050 +#define SB_CORE_SIZE           0x1000          /* each core gets 4Kbytes for registers */
12051 +#define        SB_MAXCORES             ((SB_ENUM_LIM - SB_ENUM_BASE)/SB_CORE_SIZE)
12052 +#define        SBCONFIGOFF             0xf00           /* core sbconfig regs are top 256bytes of regs */
12053 +#define        SBCONFIGSIZE            256             /* sizeof (sbconfig_t) */
12054 +
12055 +/* mips address */
12056 +#define        SB_EJTAG                0xff200000      /* MIPS EJTAG space (2M) */
12057 +
12058 +/*
12059 + * Sonics Configuration Space Registers.
12060 + */
12061 +#ifdef _LANGUAGE_ASSEMBLY
12062 +
12063 +#define SBIPSFLAG              0x08
12064 +#define SBTPSFLAG              0x18
12065 +#define        SBTMERRLOGA             0x48            /* sonics >= 2.3 */
12066 +#define        SBTMERRLOG              0x50            /* sonics >= 2.3 */
12067 +#define SBADMATCH3             0x60
12068 +#define SBADMATCH2             0x68
12069 +#define SBADMATCH1             0x70
12070 +#define SBIMSTATE              0x90
12071 +#define SBINTVEC               0x94
12072 +#define SBTMSTATELOW           0x98
12073 +#define SBTMSTATEHIGH          0x9c
12074 +#define SBBWA0                 0xa0
12075 +#define SBIMCONFIGLOW          0xa8
12076 +#define SBIMCONFIGHIGH         0xac
12077 +#define SBADMATCH0             0xb0
12078 +#define SBTMCONFIGLOW          0xb8
12079 +#define SBTMCONFIGHIGH         0xbc
12080 +#define SBBCONFIG              0xc0
12081 +#define SBBSTATE               0xc8
12082 +#define SBACTCNFG              0xd8
12083 +#define        SBFLAGST                0xe8
12084 +#define SBIDLOW                        0xf8
12085 +#define SBIDHIGH               0xfc
12086 +
12087 +
12088 +#else
12089 +
12090 +typedef volatile struct _sbconfig {
12091 +       uint32  PAD[2];
12092 +       uint32  sbipsflag;              /* initiator port ocp slave flag */
12093 +       uint32  PAD[3];
12094 +       uint32  sbtpsflag;              /* target port ocp slave flag */
12095 +       uint32  PAD[11];
12096 +       uint32  sbtmerrloga;            /* (sonics >= 2.3) */
12097 +       uint32  PAD;
12098 +       uint32  sbtmerrlog;             /* (sonics >= 2.3) */
12099 +       uint32  PAD[3];
12100 +       uint32  sbadmatch3;             /* address match3 */
12101 +       uint32  PAD;
12102 +       uint32  sbadmatch2;             /* address match2 */
12103 +       uint32  PAD;
12104 +       uint32  sbadmatch1;             /* address match1 */
12105 +       uint32  PAD[7];
12106 +       uint32  sbimstate;              /* initiator agent state */
12107 +       uint32  sbintvec;               /* interrupt mask */
12108 +       uint32  sbtmstatelow;           /* target state */
12109 +       uint32  sbtmstatehigh;          /* target state */
12110 +       uint32  sbbwa0;                 /* bandwidth allocation table0 */
12111 +       uint32  PAD;
12112 +       uint32  sbimconfiglow;          /* initiator configuration */
12113 +       uint32  sbimconfighigh;         /* initiator configuration */
12114 +       uint32  sbadmatch0;             /* address match0 */
12115 +       uint32  PAD;
12116 +       uint32  sbtmconfiglow;          /* target configuration */
12117 +       uint32  sbtmconfighigh;         /* target configuration */
12118 +       uint32  sbbconfig;              /* broadcast configuration */
12119 +       uint32  PAD;
12120 +       uint32  sbbstate;               /* broadcast state */
12121 +       uint32  PAD[3];
12122 +       uint32  sbactcnfg;              /* activate configuration */
12123 +       uint32  PAD[3];
12124 +       uint32  sbflagst;               /* current sbflags */
12125 +       uint32  PAD[3];
12126 +       uint32  sbidlow;                /* identification */
12127 +       uint32  sbidhigh;               /* identification */
12128 +} sbconfig_t;
12129 +
12130 +#endif /* _LANGUAGE_ASSEMBLY */
12131 +
12132 +/* sbipsflag */
12133 +#define        SBIPS_INT1_MASK         0x3f            /* which sbflags get routed to mips interrupt 1 */
12134 +#define        SBIPS_INT1_SHIFT        0
12135 +#define        SBIPS_INT2_MASK         0x3f00          /* which sbflags get routed to mips interrupt 2 */
12136 +#define        SBIPS_INT2_SHIFT        8
12137 +#define        SBIPS_INT3_MASK         0x3f0000        /* which sbflags get routed to mips interrupt 3 */
12138 +#define        SBIPS_INT3_SHIFT        16
12139 +#define        SBIPS_INT4_MASK         0x3f000000      /* which sbflags get routed to mips interrupt 4 */
12140 +#define        SBIPS_INT4_SHIFT        24
12141 +
12142 +/* sbtpsflag */
12143 +#define        SBTPS_NUM0_MASK         0x3f            /* interrupt sbFlag # generated by this core */
12144 +#define        SBTPS_F0EN0             0x40            /* interrupt is always sent on the backplane */
12145 +
12146 +/* sbtmerrlog */
12147 +#define        SBTMEL_CM               0x00000007      /* command */
12148 +#define        SBTMEL_CI               0x0000ff00      /* connection id */
12149 +#define        SBTMEL_EC               0x0f000000      /* error code */
12150 +#define        SBTMEL_ME               0x80000000      /* multiple error */
12151 +
12152 +/* sbimstate */
12153 +#define        SBIM_PC                 0xf             /* pipecount */
12154 +#define        SBIM_AP_MASK            0x30            /* arbitration policy */
12155 +#define        SBIM_AP_BOTH            0x00            /* use both timeslaces and token */
12156 +#define        SBIM_AP_TS              0x10            /* use timesliaces only */
12157 +#define        SBIM_AP_TK              0x20            /* use token only */
12158 +#define        SBIM_AP_RSV             0x30            /* reserved */
12159 +#define        SBIM_IBE                0x20000         /* inbanderror */
12160 +#define        SBIM_TO                 0x40000         /* timeout */
12161 +#define        SBIM_BY                 0x01800000      /* busy (sonics >= 2.3) */
12162 +#define        SBIM_RJ                 0x02000000      /* reject (sonics >= 2.3) */
12163 +
12164 +/* sbtmstatelow */
12165 +#define        SBTML_RESET             0x1             /* reset */
12166 +#define        SBTML_REJ               0x2             /* reject */
12167 +#define        SBTML_CLK               0x10000         /* clock enable */
12168 +#define        SBTML_FGC               0x20000         /* force gated clocks on */
12169 +#define        SBTML_FL_MASK           0x3ffc0000      /* core-specific flags */
12170 +#define        SBTML_PE                0x40000000      /* pme enable */
12171 +#define        SBTML_BE                0x80000000      /* bist enable */
12172 +
12173 +/* sbtmstatehigh */
12174 +#define        SBTMH_SERR              0x1             /* serror */
12175 +#define        SBTMH_INT               0x2             /* interrupt */
12176 +#define        SBTMH_BUSY              0x4             /* busy */
12177 +#define        SBTMH_TO                0x00000020      /* timeout (sonics >= 2.3) */
12178 +#define        SBTMH_FL_MASK           0x1fff0000      /* core-specific flags */
12179 +#define        SBTMH_GCR               0x20000000      /* gated clock request */
12180 +#define        SBTMH_BISTF             0x40000000      /* bist failed */
12181 +#define        SBTMH_BISTD             0x80000000      /* bist done */
12182 +
12183 +/* sbbwa0 */
12184 +#define        SBBWA_TAB0_MASK         0xffff          /* lookup table 0 */
12185 +#define        SBBWA_TAB1_MASK         0xffff          /* lookup table 1 */
12186 +#define        SBBWA_TAB1_SHIFT        16
12187 +
12188 +/* sbimconfiglow */
12189 +#define        SBIMCL_STO_MASK         0x7             /* service timeout */
12190 +#define        SBIMCL_RTO_MASK         0x70            /* request timeout */
12191 +#define        SBIMCL_RTO_SHIFT        4
12192 +#define        SBIMCL_CID_MASK         0xff0000        /* connection id */
12193 +#define        SBIMCL_CID_SHIFT        16
12194 +
12195 +/* sbimconfighigh */
12196 +#define        SBIMCH_IEM_MASK         0xc             /* inband error mode */
12197 +#define        SBIMCH_TEM_MASK         0x30            /* timeout error mode */
12198 +#define        SBIMCH_TEM_SHIFT        4
12199 +#define        SBIMCH_BEM_MASK         0xc0            /* bus error mode */
12200 +#define        SBIMCH_BEM_SHIFT        6
12201 +
12202 +/* sbadmatch0 */
12203 +#define        SBAM_TYPE_MASK          0x3             /* address type */
12204 +#define        SBAM_AD64               0x4             /* reserved */
12205 +#define        SBAM_ADINT0_MASK        0xf8            /* type0 size */
12206 +#define        SBAM_ADINT0_SHIFT       3
12207 +#define        SBAM_ADINT1_MASK        0x1f8           /* type1 size */
12208 +#define        SBAM_ADINT1_SHIFT       3
12209 +#define        SBAM_ADINT2_MASK        0x1f8           /* type2 size */
12210 +#define        SBAM_ADINT2_SHIFT       3
12211 +#define        SBAM_ADEN               0x400           /* enable */
12212 +#define        SBAM_ADNEG              0x800           /* negative decode */
12213 +#define        SBAM_BASE0_MASK         0xffffff00      /* type0 base address */
12214 +#define        SBAM_BASE0_SHIFT        8
12215 +#define        SBAM_BASE1_MASK         0xfffff000      /* type1 base address for the core */
12216 +#define        SBAM_BASE1_SHIFT        12
12217 +#define        SBAM_BASE2_MASK         0xffff0000      /* type2 base address for the core */
12218 +#define        SBAM_BASE2_SHIFT        16
12219 +
12220 +/* sbtmconfiglow */
12221 +#define        SBTMCL_CD_MASK          0xff            /* clock divide */
12222 +#define        SBTMCL_CO_MASK          0xf800          /* clock offset */
12223 +#define        SBTMCL_CO_SHIFT         11
12224 +#define        SBTMCL_IF_MASK          0xfc0000        /* interrupt flags */
12225 +#define        SBTMCL_IF_SHIFT         18
12226 +#define        SBTMCL_IM_MASK          0x3000000       /* interrupt mode */
12227 +#define        SBTMCL_IM_SHIFT         24
12228 +
12229 +/* sbtmconfighigh */
12230 +#define        SBTMCH_BM_MASK          0x3             /* busy mode */
12231 +#define        SBTMCH_RM_MASK          0x3             /* retry mode */
12232 +#define        SBTMCH_RM_SHIFT         2
12233 +#define        SBTMCH_SM_MASK          0x30            /* stop mode */
12234 +#define        SBTMCH_SM_SHIFT         4
12235 +#define        SBTMCH_EM_MASK          0x300           /* sb error mode */
12236 +#define        SBTMCH_EM_SHIFT         8
12237 +#define        SBTMCH_IM_MASK          0xc00           /* int mode */
12238 +#define        SBTMCH_IM_SHIFT         10
12239 +
12240 +/* sbbconfig */
12241 +#define        SBBC_LAT_MASK           0x3             /* sb latency */
12242 +#define        SBBC_MAX0_MASK          0xf0000         /* maxccntr0 */
12243 +#define        SBBC_MAX0_SHIFT         16
12244 +#define        SBBC_MAX1_MASK          0xf00000        /* maxccntr1 */
12245 +#define        SBBC_MAX1_SHIFT         20
12246 +
12247 +/* sbbstate */
12248 +#define        SBBS_SRD                0x1             /* st reg disable */
12249 +#define        SBBS_HRD                0x2             /* hold reg disable */
12250 +
12251 +/* sbidlow */
12252 +#define        SBIDL_CS_MASK           0x3             /* config space */
12253 +#define        SBIDL_AR_MASK           0x38            /* # address ranges supported */
12254 +#define        SBIDL_AR_SHIFT          3
12255 +#define        SBIDL_SYNCH             0x40            /* sync */
12256 +#define        SBIDL_INIT              0x80            /* initiator */
12257 +#define        SBIDL_MINLAT_MASK       0xf00           /* minimum backplane latency */
12258 +#define        SBIDL_MINLAT_SHIFT      8
12259 +#define        SBIDL_MAXLAT            0xf000          /* maximum backplane latency */
12260 +#define        SBIDL_MAXLAT_SHIFT      12
12261 +#define        SBIDL_FIRST             0x10000         /* this initiator is first */
12262 +#define        SBIDL_CW_MASK           0xc0000         /* cycle counter width */
12263 +#define        SBIDL_CW_SHIFT          18
12264 +#define        SBIDL_TP_MASK           0xf00000        /* target ports */
12265 +#define        SBIDL_TP_SHIFT          20
12266 +#define        SBIDL_IP_MASK           0xf000000       /* initiator ports */
12267 +#define        SBIDL_IP_SHIFT          24
12268 +#define        SBIDL_RV_MASK           0xf0000000      /* sonics backplane revision code */
12269 +#define        SBIDL_RV_SHIFT          28
12270 +
12271 +/* sbidhigh */
12272 +#define        SBIDH_RC_MASK           0xf             /* revision code*/
12273 +#define        SBIDH_CC_MASK           0xfff0          /* core code */
12274 +#define        SBIDH_CC_SHIFT          4
12275 +#define        SBIDH_VC_MASK           0xffff0000      /* vendor code */
12276 +#define        SBIDH_VC_SHIFT          16
12277 +
12278 +#define        SB_COMMIT               0xfd8           /* update buffered registers value */
12279 +
12280 +/* vendor codes */
12281 +#define        SB_VEND_BCM             0x4243          /* Broadcom's SB vendor code */
12282 +
12283 +/* core codes */
12284 +#define        SB_CC                   0x800           /* chipcommon core */
12285 +#define        SB_ILINE20              0x801           /* iline20 core */
12286 +#define        SB_SDRAM                0x803           /* sdram core */
12287 +#define        SB_PCI                  0x804           /* pci core */
12288 +#define        SB_MIPS                 0x805           /* mips core */
12289 +#define        SB_ENET                 0x806           /* enet mac core */
12290 +#define        SB_CODEC                0x807           /* v90 codec core */
12291 +#define        SB_USB                  0x808           /* usb 1.1 host/device core */
12292 +#define        SB_ILINE100             0x80a           /* iline100 core */
12293 +#define        SB_IPSEC                0x80b           /* ipsec core */
12294 +#define        SB_PCMCIA               0x80d           /* pcmcia core */
12295 +#define        SB_MEMC                 0x80f           /* memc sdram core */
12296 +#define        SB_EXTIF                0x811           /* external interface core */
12297 +#define        SB_D11                  0x812           /* 802.11 MAC core */
12298 +#define        SB_MIPS33               0x816           /* mips3302 core */
12299 +#define        SB_USB11H               0x817           /* usb 1.1 host core */
12300 +#define        SB_USB11D               0x818           /* usb 1.1 device core */
12301 +#define        SB_USB20H               0x819           /* usb 2.0 host core */
12302 +#define        SB_USB20D               0x81A           /* usb 2.0 device core */
12303 +#define        SB_SDIOH                0x81B           /* sdio host core */
12304 +#define SB_ROBO                 0x81C           /* robo switch core */
12305 +
12306 +#endif /* _SBCONFIG_H */
12307 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbextif.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbextif.h
12308 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbextif.h 1970-01-01 01:00:00.000000000 +0100
12309 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbextif.h    2005-08-28 11:12:20.470853072 +0200
12310 @@ -0,0 +1,242 @@
12311 +/*
12312 + * Hardware-specific External Interface I/O core definitions
12313 + * for the BCM47xx family of SiliconBackplane-based chips.
12314 + *
12315 + * The External Interface core supports a total of three external chip selects
12316 + * supporting external interfaces. One of the external chip selects is
12317 + * used for Flash, one is used for PCMCIA, and the other may be
12318 + * programmed to support either a synchronous interface or an
12319 + * asynchronous interface. The asynchronous interface can be used to
12320 + * support external devices such as UARTs and the BCM2019 Bluetooth
12321 + * baseband processor.
12322 + * The external interface core also contains 2 on-chip 16550 UARTs, clock
12323 + * frequency control, a watchdog interrupt timer, and a GPIO interface.
12324 + *
12325 + * Copyright 2001-2003, Broadcom Corporation   
12326 + * All Rights Reserved.   
12327 + *    
12328 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
12329 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
12330 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
12331 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
12332 + * $Id$
12333 + */
12334 +
12335 +#ifndef        _SBEXTIF_H
12336 +#define        _SBEXTIF_H
12337 +
12338 +/* external interface address space */
12339 +#define        EXTIF_PCMCIA_MEMBASE(x) (x)
12340 +#define        EXTIF_PCMCIA_IOBASE(x)  ((x) + 0x100000)
12341 +#define        EXTIF_PCMCIA_CFGBASE(x) ((x) + 0x200000)
12342 +#define        EXTIF_CFGIF_BASE(x)     ((x) + 0x800000)
12343 +#define        EXTIF_FLASH_BASE(x)     ((x) + 0xc00000)
12344 +
12345 +/* cpp contortions to concatenate w/arg prescan */
12346 +#ifndef PAD
12347 +#define        _PADLINE(line)  pad ## line
12348 +#define        _XSTR(line)     _PADLINE(line)
12349 +#define        PAD             _XSTR(__LINE__)
12350 +#endif /* PAD */
12351 +
12352 +/*
12353 + * The multiple instances of output and output enable registers
12354 + * are present to allow driver software for multiple cores to control
12355 + * gpio outputs without needing to share a single register pair.
12356 + */
12357 +struct gpiouser {
12358 +       uint32  out;
12359 +       uint32  outen;
12360 +};
12361 +#define        NGPIOUSER       5
12362 +
12363 +typedef volatile struct {
12364 +       uint32  corecontrol;
12365 +       uint32  extstatus;
12366 +       uint32  PAD[2];
12367 +
12368 +       /* pcmcia control registers */
12369 +       uint32  pcmcia_config;
12370 +       uint32  pcmcia_memwait;
12371 +       uint32  pcmcia_attrwait;
12372 +       uint32  pcmcia_iowait;
12373 +
12374 +       /* programmable interface control registers */
12375 +       uint32  prog_config;
12376 +       uint32  prog_waitcount;
12377 +
12378 +       /* flash control registers */
12379 +       uint32  flash_config;
12380 +       uint32  flash_waitcount;
12381 +       uint32  PAD[4];
12382 +
12383 +       uint32  watchdog;
12384 +
12385 +       /* clock control */
12386 +       uint32  clockcontrol_n;
12387 +       uint32  clockcontrol_sb;
12388 +       uint32  clockcontrol_pci;
12389 +       uint32  clockcontrol_mii;
12390 +       uint32  PAD[3];
12391 +
12392 +       /* gpio */
12393 +       uint32  gpioin;
12394 +       struct gpiouser gpio[NGPIOUSER];
12395 +       uint32  PAD;
12396 +       uint32  ejtagouten;
12397 +       uint32  gpiointpolarity;
12398 +       uint32  gpiointmask;
12399 +       uint32  PAD[153];
12400 +
12401 +       uint8   uartdata;
12402 +       uint8   PAD[3];
12403 +       uint8   uartimer;
12404 +       uint8   PAD[3];
12405 +       uint8   uartfcr;
12406 +       uint8   PAD[3];
12407 +       uint8   uartlcr;
12408 +       uint8   PAD[3];
12409 +       uint8   uartmcr;
12410 +       uint8   PAD[3];
12411 +       uint8   uartlsr;
12412 +       uint8   PAD[3];
12413 +       uint8   uartmsr;
12414 +       uint8   PAD[3];
12415 +       uint8   uartscratch;
12416 +       uint8   PAD[3];
12417 +} extifregs_t;
12418 +
12419 +/* corecontrol */
12420 +#define        CC_UE           (1 << 0)                /* uart enable */
12421 +
12422 +/* extstatus */
12423 +#define        ES_EM           (1 << 0)                /* endian mode (ro) */
12424 +#define        ES_EI           (1 << 1)                /* external interrupt pin (ro) */
12425 +#define        ES_GI           (1 << 2)                /* gpio interrupt pin (ro) */
12426 +
12427 +/* gpio bit mask */
12428 +#define GPIO_BIT0      (1 << 0)
12429 +#define GPIO_BIT1      (1 << 1)
12430 +#define GPIO_BIT2      (1 << 2)
12431 +#define GPIO_BIT3      (1 << 3)
12432 +#define GPIO_BIT4      (1 << 4)
12433 +#define GPIO_BIT5      (1 << 5)
12434 +#define GPIO_BIT6      (1 << 6)
12435 +#define GPIO_BIT7      (1 << 7)
12436 +
12437 +
12438 +/* pcmcia/prog/flash_config */
12439 +#define        CF_EN           (1 << 0)                /* enable */
12440 +#define        CF_EM_MASK      0xe                     /* mode */
12441 +#define        CF_EM_SHIFT     1
12442 +#define        CF_EM_FLASH     0x0                     /* flash/asynchronous mode */
12443 +#define        CF_EM_SYNC      0x2                     /* synchronous mode */
12444 +#define        CF_EM_PCMCIA    0x4                     /* pcmcia mode */
12445 +#define        CF_DS           (1 << 4)                /* destsize:  0=8bit, 1=16bit */
12446 +#define        CF_BS           (1 << 5)                /* byteswap */
12447 +#define        CF_CD_MASK      0xc0                    /* clock divider */
12448 +#define        CF_CD_SHIFT     6
12449 +#define        CF_CD_DIV2      0x0                     /* backplane/2 */
12450 +#define        CF_CD_DIV3      0x40                    /* backplane/3 */
12451 +#define        CF_CD_DIV4      0x80                    /* backplane/4 */
12452 +#define        CF_CE           (1 << 8)                /* clock enable */
12453 +#define        CF_SB           (1 << 9)                /* size/bytestrobe (synch only) */
12454 +
12455 +/* pcmcia_memwait */
12456 +#define        PM_W0_MASK      0x3f                    /* waitcount0 */
12457 +#define        PM_W1_MASK      0x1f00                  /* waitcount1 */
12458 +#define        PM_W1_SHIFT     8
12459 +#define        PM_W2_MASK      0x1f0000                /* waitcount2 */
12460 +#define        PM_W2_SHIFT     16
12461 +#define        PM_W3_MASK      0x1f000000              /* waitcount3 */
12462 +#define        PM_W3_SHIFT     24
12463 +
12464 +/* pcmcia_attrwait */
12465 +#define        PA_W0_MASK      0x3f                    /* waitcount0 */
12466 +#define        PA_W1_MASK      0x1f00                  /* waitcount1 */
12467 +#define        PA_W1_SHIFT     8
12468 +#define        PA_W2_MASK      0x1f0000                /* waitcount2 */
12469 +#define        PA_W2_SHIFT     16
12470 +#define        PA_W3_MASK      0x1f000000              /* waitcount3 */
12471 +#define        PA_W3_SHIFT     24
12472 +
12473 +/* pcmcia_iowait */
12474 +#define        PI_W0_MASK      0x3f                    /* waitcount0 */
12475 +#define        PI_W1_MASK      0x1f00                  /* waitcount1 */
12476 +#define        PI_W1_SHIFT     8
12477 +#define        PI_W2_MASK      0x1f0000                /* waitcount2 */
12478 +#define        PI_W2_SHIFT     16
12479 +#define        PI_W3_MASK      0x1f000000              /* waitcount3 */
12480 +#define        PI_W3_SHIFT     24
12481 +
12482 +/* prog_waitcount */
12483 +#define        PW_W0_MASK      0x0000001f                      /* waitcount0 */
12484 +#define        PW_W1_MASK      0x00001f00                      /* waitcount1 */
12485 +#define        PW_W1_SHIFT     8
12486 +#define        PW_W2_MASK      0x001f0000              /* waitcount2 */
12487 +#define        PW_W2_SHIFT     16
12488 +#define        PW_W3_MASK      0x1f000000              /* waitcount3 */
12489 +#define        PW_W3_SHIFT     24
12490 +
12491 +#define PW_W0       0x0000000c
12492 +#define PW_W1       0x00000a00
12493 +#define PW_W2       0x00020000
12494 +#define PW_W3       0x01000000
12495 +
12496 +/* flash_waitcount */
12497 +#define        FW_W0_MASK      0x1f                    /* waitcount0 */
12498 +#define        FW_W1_MASK      0x1f00                  /* waitcount1 */
12499 +#define        FW_W1_SHIFT     8
12500 +#define        FW_W2_MASK      0x1f0000                /* waitcount2 */
12501 +#define        FW_W2_SHIFT     16
12502 +#define        FW_W3_MASK      0x1f000000              /* waitcount3 */
12503 +#define        FW_W3_SHIFT     24
12504 +
12505 +/* watchdog */
12506 +#define WATCHDOG_CLOCK 48000000                /* Hz */
12507 +
12508 +/* clockcontrol_n */
12509 +#define        CN_N1_MASK      0x3f                    /* n1 control */
12510 +#define        CN_N2_MASK      0x3f00                  /* n2 control */
12511 +#define        CN_N2_SHIFT     8
12512 +
12513 +/* clockcontrol_sb/pci/mii */
12514 +#define        CC_M1_MASK      0x3f                    /* m1 control */
12515 +#define        CC_M2_MASK      0x3f00                  /* m2 control */
12516 +#define        CC_M2_SHIFT     8
12517 +#define        CC_M3_MASK      0x3f0000                /* m3 control */
12518 +#define        CC_M3_SHIFT     16
12519 +#define        CC_MC_MASK      0x1f000000              /* mux control */
12520 +#define        CC_MC_SHIFT     24
12521 +
12522 +/* Clock control default values */
12523 +#define CC_DEF_N       0x0009                  /* Default values for bcm4710 */
12524 +#define CC_DEF_100     0x04020011
12525 +#define CC_DEF_33      0x11030011
12526 +#define CC_DEF_25      0x11050011
12527 +
12528 +/* Clock control values for 125Mhz */
12529 +#define        CC_125_N        0x0802
12530 +#define        CC_125_M        0x04020009
12531 +#define        CC_125_M25      0x11090009
12532 +#define        CC_125_M33      0x11090005
12533 +
12534 +/* Clock control magic field values */
12535 +#define        CC_F6_2         0x02                    /* A factor of 2 in */
12536 +#define        CC_F6_3         0x03                    /*  6-bit fields like */
12537 +#define        CC_F6_4         0x05                    /*  N1, M1 or M3 */
12538 +#define        CC_F6_5         0x09
12539 +#define        CC_F6_6         0x11
12540 +#define        CC_F6_7         0x21
12541 +
12542 +#define        CC_F5_BIAS      5                       /* 5-bit fields get this added */
12543 +
12544 +#define        CC_MC_BYPASS    0x08
12545 +#define        CC_MC_M1        0x04
12546 +#define        CC_MC_M1M2      0x02
12547 +#define        CC_MC_M1M2M3    0x01
12548 +#define        CC_MC_M1M3      0x11
12549 +
12550 +#define        CC_CLOCK_BASE   24000000        /* Half the clock freq. in the 4710 */
12551 +
12552 +#endif /* _SBEXTIF_H */
12553 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbmemc.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbmemc.h
12554 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbmemc.h  1970-01-01 01:00:00.000000000 +0100
12555 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbmemc.h     2005-08-28 11:12:20.471852920 +0200
12556 @@ -0,0 +1,144 @@
12557 +/*
12558 + * BCM47XX Sonics SiliconBackplane DDR/SDRAM controller core hardware definitions.
12559 + *
12560 + * Copyright 2001-2003, Broadcom Corporation   
12561 + * All Rights Reserved.   
12562 + *    
12563 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
12564 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
12565 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
12566 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
12567 + * $Id$
12568 + */
12569 +
12570 +#ifndef        _SBMEMC_H
12571 +#define        _SBMEMC_H
12572 +
12573 +#ifdef _LANGUAGE_ASSEMBLY
12574 +
12575 +#define        MEMC_CONTROL            0x00
12576 +#define        MEMC_CONFIG             0x04
12577 +#define        MEMC_REFRESH            0x08
12578 +#define        MEMC_BISTSTAT           0x0c
12579 +#define        MEMC_MODEBUF            0x10
12580 +#define        MEMC_BKCLS              0x14
12581 +#define        MEMC_PRIORINV           0x18
12582 +#define        MEMC_DRAMTIM            0x1c
12583 +#define        MEMC_INTSTAT            0x20
12584 +#define        MEMC_INTMASK            0x24
12585 +#define        MEMC_INTINFO            0x28
12586 +#define        MEMC_NCDLCTL            0x30
12587 +#define        MEMC_RDNCDLCOR          0x34
12588 +#define        MEMC_WRNCDLCOR          0x38
12589 +#define        MEMC_MISCDLYCTL         0x3c
12590 +#define        MEMC_DQSGATENCDL        0x40
12591 +#define        MEMC_SPARE              0x44
12592 +#define        MEMC_TPADDR             0x48
12593 +#define        MEMC_TPDATA             0x4c
12594 +#define        MEMC_BARRIER            0x50
12595 +#define        MEMC_CORE               0x54
12596 +
12597 +
12598 +#else
12599 +
12600 +/* Sonics side: MEMC core registers */
12601 +typedef volatile struct sbmemcregs {
12602 +       uint32  control;
12603 +       uint32  config;
12604 +       uint32  refresh;
12605 +       uint32  biststat;
12606 +       uint32  modebuf;
12607 +       uint32  bkcls;
12608 +       uint32  priorinv;
12609 +       uint32  dramtim;
12610 +       uint32  intstat;
12611 +       uint32  intmask;
12612 +       uint32  intinfo;
12613 +       uint32  reserved1;
12614 +       uint32  ncdlctl;
12615 +       uint32  rdncdlcor;
12616 +       uint32  wrncdlcor;
12617 +       uint32  miscdlyctl;
12618 +       uint32  dqsgatencdl;
12619 +       uint32  spare;
12620 +       uint32  tpaddr;
12621 +       uint32  tpdata;
12622 +       uint32  barrier;
12623 +       uint32  core;
12624 +} sbmemcregs_t;
12625 +
12626 +#endif
12627 +
12628 +/* MEMC Core Init values (OCP ID 0x80f) */
12629 +
12630 +/* For sdr: */
12631 +#define MEMC_SD_CONFIG_INIT    0x00048000
12632 +#define MEMC_SD_DRAMTIM_INIT   0x000754da
12633 +#define MEMC_SD_RDNCDLCOR_INIT 0x00000000
12634 +#define MEMC_SD_WRNCDLCOR_INIT 0x49351200
12635 +#define MEMC_SD1_WRNCDLCOR_INIT        0x14500200      /* For corerev 1 (4712) */
12636 +#define MEMC_SD_MISCDLYCTL_INIT        0x00061c1b
12637 +#define MEMC_SD1_MISCDLYCTL_INIT 0x00021416    /* For corerev 1 (4712) */
12638 +#define MEMC_SD_CONTROL_INIT0  0x00000002
12639 +#define MEMC_SD_CONTROL_INIT1  0x00000008
12640 +#define MEMC_SD_CONTROL_INIT2  0x00000004
12641 +#define MEMC_SD_CONTROL_INIT3  0x00000010
12642 +#define MEMC_SD_CONTROL_INIT4  0x00000001
12643 +#define MEMC_SD_MODEBUF_INIT   0x00000000
12644 +#define MEMC_SD_REFRESH_INIT   0x0000840f
12645 +
12646 +
12647 +/* This is for SDRM8X8X4 */
12648 +#define        MEMC_SDR_INIT           0x0008
12649 +#define        MEMC_SDR_MODE           0x32
12650 +#define        MEMC_SDR_NCDL           0x00020032
12651 +#define        MEMC_SDR1_NCDL          0x0002020f      /* For corerev 1 (4712) */
12652 +
12653 +/* For ddr: */
12654 +#define MEMC_CONFIG_INIT       0x00048000
12655 +#define MEMC_DRAMTIM_INIT      0x000754d9
12656 +#define MEMC_RDNCDLCOR_INIT    0x00000000
12657 +#define MEMC_WRNCDLCOR_INIT    0x49351200
12658 +#define MEMC_1_WRNCDLCOR_INIT  0x14500200
12659 +#define MEMC_DQSGATENCDL_INIT  0x00030000
12660 +#define MEMC_MISCDLYCTL_INIT   0x21061c1b
12661 +#define MEMC_1_MISCDLYCTL_INIT 0x21021400
12662 +#define MEMC_NCDLCTL_INIT      0x00002001
12663 +#define MEMC_CONTROL_INIT0     0x00000002
12664 +#define MEMC_CONTROL_INIT1     0x00000008
12665 +#define MEMC_MODEBUF_INIT0     0x00004000
12666 +#define MEMC_CONTROL_INIT2     0x00000010
12667 +#define MEMC_MODEBUF_INIT1     0x00000100
12668 +#define MEMC_CONTROL_INIT3     0x00000010
12669 +#define MEMC_CONTROL_INIT4     0x00000008
12670 +#define MEMC_REFRESH_INIT      0x0000840f
12671 +#define MEMC_CONTROL_INIT5     0x00000004
12672 +#define MEMC_MODEBUF_INIT2     0x00000000
12673 +#define MEMC_CONTROL_INIT6     0x00000010
12674 +#define MEMC_CONTROL_INIT7     0x00000001
12675 +
12676 +
12677 +/* This is for DDRM16X16X2 */
12678 +#define        MEMC_DDR_INIT           0x0009
12679 +#define        MEMC_DDR_MODE           0x62
12680 +#define        MEMC_DDR_NCDL           0x0005050a
12681 +#define        MEMC_DDR1_NCDL          0x00000a0a      /* For corerev 1 (4712) */
12682 +
12683 +/* mask for sdr/ddr calibration registers */
12684 +#define MEMC_RDNCDLCOR_RD_MASK 0x000000ff
12685 +#define MEMC_WRNCDLCOR_WR_MASK 0x000000ff
12686 +#define MEMC_DQSGATENCDL_G_MASK        0x000000ff
12687 +
12688 +/* masks for miscdlyctl registers */
12689 +#define MEMC_MISC_SM_MASK      0x30000000
12690 +#define MEMC_MISC_SM_SHIFT     28
12691 +#define MEMC_MISC_SD_MASK      0x0f000000
12692 +#define MEMC_MISC_SD_SHIFT     24
12693 +
12694 +/* hw threshhold for calculating wr/rd for sdr memc */
12695 +#define MEMC_CD_THRESHOLD      128
12696 +
12697 +/* Low bit of init register says if memc is ddr or sdr */
12698 +#define MEMC_CONFIG_DDR                0x00000001
12699 +
12700 +#endif /* _SBMEMC_H */
12701 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbmips.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbmips.h
12702 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbmips.h  1970-01-01 01:00:00.000000000 +0100
12703 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbmips.h     2005-08-28 11:12:20.471852920 +0200
12704 @@ -0,0 +1,56 @@
12705 +/*
12706 + * Broadcom SiliconBackplane MIPS definitions
12707 + *
12708 + * SB MIPS cores are custom MIPS32 processors with SiliconBackplane
12709 + * OCP interfaces. The CP0 processor ID is 0x00024000, where bits
12710 + * 23:16 mean Broadcom and bits 15:8 mean a MIPS core with an OCP
12711 + * interface. The core revision is stored in the SB ID register in SB
12712 + * configuration space.
12713 + *
12714 + * Copyright 2001-2003, Broadcom Corporation
12715 + * All Rights Reserved.
12716 + * 
12717 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
12718 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
12719 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
12720 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
12721 + *
12722 + * $Id$
12723 + */
12724 +
12725 +#ifndef        _SBMIPS_H
12726 +#define        _SBMIPS_H
12727 +
12728 +#ifndef _LANGUAGE_ASSEMBLY
12729 +
12730 +/* cpp contortions to concatenate w/arg prescan */
12731 +#ifndef PAD
12732 +#define        _PADLINE(line)  pad ## line
12733 +#define        _XSTR(line)     _PADLINE(line)
12734 +#define        PAD             _XSTR(__LINE__)
12735 +#endif /* PAD */
12736 +
12737 +typedef volatile struct {
12738 +       uint32  corecontrol;
12739 +       uint32  PAD[2];
12740 +       uint32  biststatus;
12741 +       uint32  PAD[4];
12742 +       uint32  intstatus;
12743 +       uint32  intmask;
12744 +       uint32  timer;
12745 +} mipsregs_t;
12746 +
12747 +extern uint32 sb_flag(void *sbh);
12748 +extern uint sb_irq(void *sbh);
12749 +
12750 +extern void sb_serial_init(void *sbh, void (*add)(void *regs, uint irq, uint baud_base, uint reg_shift));
12751 +
12752 +extern void sb_mips_init(void *sbh);
12753 +extern uint32 sb_mips_clock(void *sbh);
12754 +extern bool sb_mips_setclock(void *sbh, uint32 mipsclock, uint32 sbclock, uint32 pciclock);
12755 +
12756 +extern uint32 sb_memc_get_ncdl(void *sbh);
12757 +
12758 +#endif /* _LANGUAGE_ASSEMBLY */
12759 +
12760 +#endif /* _SBMIPS_H */
12761 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbpci.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbpci.h
12762 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbpci.h   1970-01-01 01:00:00.000000000 +0100
12763 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbpci.h      2005-08-28 11:12:20.471852920 +0200
12764 @@ -0,0 +1,113 @@
12765 +/*
12766 + * BCM47XX Sonics SiliconBackplane PCI core hardware definitions.
12767 + *
12768 + * $Id$
12769 + * Copyright 2001-2003, Broadcom Corporation   
12770 + * All Rights Reserved.   
12771 + *    
12772 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
12773 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
12774 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
12775 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
12776 + */
12777 +
12778 +#ifndef        _SBPCI_H
12779 +#define        _SBPCI_H
12780 +
12781 +/* cpp contortions to concatenate w/arg prescan */
12782 +#ifndef PAD
12783 +#define        _PADLINE(line)  pad ## line
12784 +#define        _XSTR(line)     _PADLINE(line)
12785 +#define        PAD             _XSTR(__LINE__)
12786 +#endif
12787 +
12788 +/* Sonics side: PCI core and host control registers */
12789 +typedef struct sbpciregs {
12790 +       uint32 control;         /* PCI control */
12791 +       uint32 PAD[3];
12792 +       uint32 arbcontrol;      /* PCI arbiter control */
12793 +       uint32 PAD[3];
12794 +       uint32 intstatus;       /* Interrupt status */
12795 +       uint32 intmask;         /* Interrupt mask */
12796 +       uint32 sbtopcimailbox;  /* Sonics to PCI mailbox */
12797 +       uint32 PAD[9];
12798 +       uint32 bcastaddr;       /* Sonics broadcast address */
12799 +       uint32 bcastdata;       /* Sonics broadcast data */
12800 +       uint32 PAD[2];
12801 +       uint32 gpioin;          /* ro: gpio input (>=rev2) */
12802 +       uint32 gpioout;         /* rw: gpio output (>=rev2) */
12803 +       uint32 gpioouten;       /* rw: gpio output enable (>= rev2) */
12804 +       uint32 gpiocontrol;     /* rw: gpio control (>= rev2) */
12805 +       uint32 PAD[36];
12806 +       uint32 sbtopci0;        /* Sonics to PCI translation 0 */
12807 +       uint32 sbtopci1;        /* Sonics to PCI translation 1 */
12808 +       uint32 sbtopci2;        /* Sonics to PCI translation 2 */
12809 +       uint32 PAD[445];
12810 +       uint16 sprom[36];       /* SPROM shadow Area */
12811 +       uint32 PAD[46];
12812 +} sbpciregs_t;
12813 +
12814 +/* PCI control */
12815 +#define PCI_RST_OE     0x01    /* When set, drives PCI_RESET out to pin */
12816 +#define PCI_RST                0x02    /* Value driven out to pin */
12817 +#define PCI_CLK_OE     0x04    /* When set, drives clock as gated by PCI_CLK out to pin */
12818 +#define PCI_CLK                0x08    /* Gate for clock driven out to pin */  
12819 +
12820 +/* PCI arbiter control */
12821 +#define PCI_INT_ARB    0x01    /* When set, use an internal arbiter */
12822 +#define PCI_EXT_ARB    0x02    /* When set, use an external arbiter */
12823 +#define PCI_PARKID_MASK        0x06    /* Selects which agent is parked on an idle bus */
12824 +#define PCI_PARKID_SHIFT   1
12825 +#define PCI_PARKID_LAST           0    /* Last requestor */
12826 +#define PCI_PARKID_4710           1    /* 4710 */
12827 +#define PCI_PARKID_EXTREQ0 2   /* External requestor 0 */
12828 +#define PCI_PARKID_EXTREQ1 3   /* External requestor 1 */
12829 +
12830 +/* Interrupt status/mask */
12831 +#define PCI_INTA       0x01    /* PCI INTA# is asserted */
12832 +#define PCI_INTB       0x02    /* PCI INTB# is asserted */
12833 +#define PCI_SERR       0x04    /* PCI SERR# has been asserted (write one to clear) */
12834 +#define PCI_PERR       0x08    /* PCI PERR# has been asserted (write one to clear) */
12835 +#define PCI_PME                0x10    /* PCI PME# is asserted */
12836 +
12837 +/* (General) PCI/SB mailbox interrupts, two bits per pci function */
12838 +#define        MAILBOX_F0_0    0x100   /* function 0, int 0 */
12839 +#define        MAILBOX_F0_1    0x200   /* function 0, int 1 */
12840 +#define        MAILBOX_F1_0    0x400   /* function 1, int 0 */
12841 +#define        MAILBOX_F1_1    0x800   /* function 1, int 1 */
12842 +#define        MAILBOX_F2_0    0x1000  /* function 2, int 0 */
12843 +#define        MAILBOX_F2_1    0x2000  /* function 2, int 1 */
12844 +#define        MAILBOX_F3_0    0x4000  /* function 3, int 0 */
12845 +#define        MAILBOX_F3_1    0x8000  /* function 3, int 1 */
12846 +
12847 +/* Sonics broadcast address */
12848 +#define BCAST_ADDR_MASK        0xff    /* Broadcast register address */
12849 +
12850 +/* Sonics to PCI translation types */
12851 +#define SBTOPCI0_MASK  0xfc000000
12852 +#define SBTOPCI1_MASK  0xfc000000
12853 +#define SBTOPCI2_MASK  0xc0000000
12854 +#define SBTOPCI_MEM    0
12855 +#define SBTOPCI_IO     1
12856 +#define SBTOPCI_CFG0   2
12857 +#define SBTOPCI_CFG1   3
12858 +#define        SBTOPCI_PREF    0x4     /* prefetch enable */
12859 +#define        SBTOPCI_BURST   0x8     /* burst enable */
12860 +
12861 +/* PCI side: Reserved PCI configuration registers (see pcicfg.h) */
12862 +#define cap_list       rsvd_a[0]
12863 +#define bar0_window    dev_dep[0x80 - 0x40]
12864 +#define bar1_window    dev_dep[0x84 - 0x40]
12865 +#define sprom_control  dev_dep[0x88 - 0x40]
12866 +
12867 +#ifndef _LANGUAGE_ASSEMBLY
12868 +
12869 +extern int sbpci_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len);
12870 +extern int sbpci_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len);
12871 +extern void sbpci_ban(uint16 core);
12872 +extern int sbpci_init(void *sbh);
12873 +extern void sbpci_check(void *sbh);
12874 +
12875 +#endif /* !_LANGUAGE_ASSEMBLY */
12876 +
12877 +#endif /* _SBPCI_H */
12878 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbpcmcia.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbpcmcia.h
12879 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbpcmcia.h        1970-01-01 01:00:00.000000000 +0100
12880 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbpcmcia.h   2005-08-28 11:12:20.472852768 +0200
12881 @@ -0,0 +1,131 @@
12882 +/*
12883 + * BCM43XX Sonics SiliconBackplane PCMCIA core hardware definitions.
12884 + *
12885 + * $Id$
12886 + * Copyright 2001-2003, Broadcom Corporation   
12887 + * All Rights Reserved.   
12888 + *    
12889 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
12890 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
12891 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
12892 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
12893 + */
12894 +
12895 +#ifndef        _SBPCMCIA_H
12896 +#define        _SBPCMCIA_H
12897 +
12898 +
12899 +/* All the addresses that are offsets in attribute space are divided
12900 + * by two to account for the fact that odd bytes are invalid in
12901 + * attribute space and our read/write routines make the space appear
12902 + * as if they didn't exist. Still we want to show the original numbers
12903 + * as documented in the hnd_pcmcia core manual.
12904 + */
12905 +
12906 +/* PCMCIA Function Configuration Registers */
12907 +#define        PCMCIA_FCR              (0x700 / 2)
12908 +
12909 +#define        FCR0_OFF                0
12910 +#define        FCR1_OFF                (0x40 / 2)
12911 +#define        FCR2_OFF                (0x80 / 2)
12912 +#define        FCR3_OFF                (0xc0 / 2)
12913 +
12914 +#define        PCMCIA_FCR0             (0x700 / 2)
12915 +#define        PCMCIA_FCR1             (0x740 / 2)
12916 +#define        PCMCIA_FCR2             (0x780 / 2)
12917 +#define        PCMCIA_FCR3             (0x7c0 / 2)
12918 +
12919 +/* Standard PCMCIA FCR registers */
12920 +
12921 +#define        PCMCIA_COR              0
12922 +
12923 +#define        COR_RST                 0x80
12924 +#define        COR_LEV                 0x40
12925 +#define        COR_IRQEN               0x04
12926 +#define        COR_BLREN               0x01
12927 +#define        COR_FUNEN               0x01
12928 +
12929 +
12930 +#define        PCICIA_FCSR             (2 / 2)
12931 +#define        PCICIA_PRR              (4 / 2)
12932 +#define        PCICIA_SCR              (6 / 2)
12933 +#define        PCICIA_ESR              (8 / 2)
12934 +
12935 +
12936 +#define PCM_MEMOFF             0x0000
12937 +#define F0_MEMOFF              0x1000
12938 +#define F1_MEMOFF              0x2000
12939 +#define F2_MEMOFF              0x3000
12940 +#define F3_MEMOFF              0x4000
12941 +
12942 +/* Memory base in the function fcr's */
12943 +#define MEM_ADDR0              (0x728 / 2)
12944 +#define MEM_ADDR1              (0x72a / 2)
12945 +#define MEM_ADDR2              (0x72c / 2)
12946 +
12947 +/* PCMCIA base plus Srom access in fcr0: */
12948 +#define PCMCIA_ADDR0           (0x072e / 2)
12949 +#define PCMCIA_ADDR1           (0x0730 / 2)
12950 +#define PCMCIA_ADDR2           (0x0732 / 2)
12951 +
12952 +#define MEM_SEG                        (0x0734 / 2)
12953 +#define SROM_CS                        (0x0736 / 2)
12954 +#define SROM_DATAL             (0x0738 / 2)
12955 +#define SROM_DATAH             (0x073a / 2)
12956 +#define SROM_ADDRL             (0x073c / 2)
12957 +#define SROM_ADDRH             (0x073e / 2)
12958 +
12959 +/*  Values for srom_cs: */
12960 +#define SROM_IDLE              0
12961 +#define SROM_WRITE             1
12962 +#define SROM_READ              2
12963 +#define SROM_WEN               4
12964 +#define SROM_WDS               7
12965 +#define SROM_DONE              8
12966 +
12967 +/* CIS stuff */
12968 +
12969 +/* The CIS stops where the FCRs start */
12970 +#define        CIS_SIZE                PCMCIA_FCR
12971 +
12972 +/* Standard tuples we know about */
12973 +
12974 +#define        CISTPL_MANFID           0x20            /* Manufacturer and device id */
12975 +#define        CISTPL_FUNCE            0x22            /* Function extensions */
12976 +#define        CISTPL_CFTABLE          0x1b            /* Config table entry */
12977 +
12978 +/* Function extensions for LANs */
12979 +
12980 +#define        LAN_TECH                1               /* Technology type */
12981 +#define        LAN_SPEED               2               /* Raw bit rate */
12982 +#define        LAN_MEDIA               3               /* Transmission media */
12983 +#define        LAN_NID                 4               /* Node identification (aka MAC addr) */
12984 +#define        LAN_CONN                5               /* Connector standard */
12985 +
12986 +
12987 +/* CFTable */
12988 +#define CFTABLE_REGWIN_2K      0x08            /* 2k reg windows size */
12989 +#define CFTABLE_REGWIN_4K      0x10            /* 4k reg windows size */
12990 +#define CFTABLE_REGWIN_8K      0x20            /* 8k reg windows size */
12991 +
12992 +/* Vendor unique tuples are 0x80-0x8f. Within Broadcom we'll
12993 + * take one for HNBU, and use "extensions" (a la FUNCE) within it.
12994 + */
12995 +
12996 +#define        CISTPL_BRCM_HNBU        0x80
12997 +
12998 +/* Subtypes of BRCM_HNBU: */
12999 +
13000 +#define        HNBU_CHIPID             0x01            /* Six bytes with PCI vendor &
13001 +                                                * device id and chiprev
13002 +                                                */
13003 +#define        HNBU_BOARDREV           0x02            /* Two bytes board revision */
13004 +#define        HNBU_PAPARMS            0x03            /* Eleven bytes PA parameters */
13005 +#define        HNBU_OEM                0x04            /* Eight bytes OEM data */
13006 +#define        HNBU_CC                 0x05            /* Default country code */
13007 +#define        HNBU_AA                 0x06            /* Antennas available */
13008 +#define        HNBU_AG                 0x07            /* Antenna gain */
13009 +#define HNBU_BOARDFLAGS                0x08            /* board flags */
13010 +#define HNBU_LED               0x09            /* LED set */
13011 +
13012 +#endif /* _SBPCMCIA_H */
13013 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbsdram.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbsdram.h
13014 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbsdram.h 1970-01-01 01:00:00.000000000 +0100
13015 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbsdram.h    2005-08-28 11:12:20.472852768 +0200
13016 @@ -0,0 +1,75 @@
13017 +/*
13018 + * BCM47XX Sonics SiliconBackplane SDRAM controller core hardware definitions.
13019 + *
13020 + * Copyright 2001-2003, Broadcom Corporation   
13021 + * All Rights Reserved.   
13022 + *    
13023 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
13024 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
13025 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
13026 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
13027 + * $Id$
13028 + */
13029 +
13030 +#ifndef        _SBSDRAM_H
13031 +#define        _SBSDRAM_H
13032 +
13033 +#ifndef _LANGUAGE_ASSEMBLY
13034 +
13035 +/* Sonics side: SDRAM core registers */
13036 +typedef volatile struct sbsdramregs {
13037 +       uint32  initcontrol;    /* Generates external SDRAM initialization sequence */
13038 +       uint32  config;         /* Initializes external SDRAM mode register */
13039 +       uint32  refresh;        /* Controls external SDRAM refresh rate */
13040 +       uint32  pad1;
13041 +       uint32  pad2;
13042 +} sbsdramregs_t;
13043 +
13044 +#endif
13045 +
13046 +/* SDRAM initialization control (initcontrol) register bits */
13047 +#define SDRAM_CBR      0x0001  /* Writing 1 generates refresh cycle and toggles bit */
13048 +#define SDRAM_PRE      0x0002  /* Writing 1 generates precharge cycle and toggles bit */
13049 +#define SDRAM_MRS      0x0004  /* Writing 1 generates mode register select cycle and toggles bit */
13050 +#define SDRAM_EN       0x0008  /* When set, enables access to SDRAM */
13051 +#define SDRAM_16Mb     0x0000  /* Use 16 Megabit SDRAM */
13052 +#define SDRAM_64Mb     0x0010  /* Use 64 Megabit SDRAM */
13053 +#define SDRAM_128Mb    0x0020  /* Use 128 Megabit SDRAM */
13054 +#define SDRAM_RSVMb    0x0030  /* Use special SDRAM */
13055 +#define SDRAM_RST      0x0080  /* Writing 1 causes soft reset of controller */
13056 +#define SDRAM_SELFREF  0x0100  /* Writing 1 enables self refresh mode */
13057 +#define SDRAM_PWRDOWN  0x0200  /* Writing 1 causes controller to power down */
13058 +#define SDRAM_32BIT    0x0400  /* When set, indicates 32 bit SDRAM interface */
13059 +#define SDRAM_9BITCOL  0x0800  /* When set, indicates 9 bit column */
13060 +
13061 +/* SDRAM configuration (config) register bits */
13062 +#define SDRAM_BURSTFULL        0x0000  /* Use full page bursts */
13063 +#define SDRAM_BURST8   0x0001  /* Use burst of 8 */
13064 +#define SDRAM_BURST4   0x0002  /* Use burst of 4 */
13065 +#define SDRAM_BURST2   0x0003  /* Use burst of 2 */
13066 +#define SDRAM_CAS3     0x0000  /* Use CAS latency of 3 */
13067 +#define SDRAM_CAS2     0x0004  /* Use CAS latency of 2 */
13068 +
13069 +/* SDRAM refresh control (refresh) register bits */
13070 +#define SDRAM_REF(p)   (((p)&0xff) | SDRAM_REF_EN)     /* Refresh period */
13071 +#define SDRAM_REF_EN   0x8000          /* Writing 1 enables periodic refresh */
13072 +
13073 +/* SDRAM Core default Init values (OCP ID 0x803) */
13074 +#define SDRAM_INIT     MEM4MX16X2
13075 +#define SDRAM_CONFIG    SDRAM_BURSTFULL
13076 +#define SDRAM_REFRESH   SDRAM_REF(0x40)
13077 +
13078 +#define MEM1MX16       0x009   /* 2 MB */
13079 +#define MEM1MX16X2     0x409   /* 4 MB */
13080 +#define MEM2MX8X2      0x809   /* 4 MB */
13081 +#define MEM2MX8X4      0xc09   /* 8 MB */
13082 +#define MEM2MX32       0x439   /* 8 MB */
13083 +#define MEM4MX16       0x019   /* 8 MB */
13084 +#define MEM4MX16X2     0x419   /* 16 MB */
13085 +#define MEM8MX8X2      0x819   /* 16 MB */
13086 +#define MEM8MX16       0x829   /* 16 MB */
13087 +#define MEM4MX32       0x429   /* 16 MB */
13088 +#define MEM8MX8X4      0xc19   /* 32 MB */
13089 +#define MEM8MX16X2     0xc29   /* 32 MB */
13090 +
13091 +#endif /* _SBSDRAM_H */
13092 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbutils.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbutils.h
13093 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbutils.h 1970-01-01 01:00:00.000000000 +0100
13094 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbutils.h    2005-08-28 11:12:20.473852616 +0200
13095 @@ -0,0 +1,90 @@
13096 +/*
13097 + * Misc utility routines for accessing chip-specific features
13098 + * of Broadcom HNBU SiliconBackplane-based chips.
13099 + *
13100 + * Copyright 2001-2003, Broadcom Corporation
13101 + * All Rights Reserved.
13102 + * 
13103 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
13104 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
13105 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
13106 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
13107 + *
13108 + * $Id$
13109 + */
13110 +
13111 +#ifndef        _sbutils_h_
13112 +#define        _sbutils_h_
13113 +
13114 +/* Board styles (bustype) */
13115 +#define        BOARDSTYLE_SOC          0               /* Silicon Backplane */
13116 +#define        BOARDSTYLE_PCI          1               /* PCI/MiniPCI board */
13117 +#define        BOARDSTYLE_PCMCIA       2               /* PCMCIA board */
13118 +#define        BOARDSTYLE_CARDBUS      3               /* Cardbus board */
13119 +
13120 +/*
13121 + * Many of the routines below take an 'sbh' handle as their first arg.
13122 + * Allocate this by calling sb_attach().  Free it by calling sb_detach().
13123 + * At any one time, the sbh is logically focused on one particular sb core
13124 + * (the "current core").
13125 + * Use sb_setcore() or sb_setcoreidx() to change the association to another core.
13126 + */
13127 +
13128 +/* exported externs */
13129 +extern void *sb_attach(uint pcidev, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz);
13130 +extern void *sb_kattach(void);
13131 +extern void sb_detach(void *sbh);
13132 +extern uint sb_chip(void *sbh);
13133 +extern uint sb_chiprev(void *sbh);
13134 +extern uint sb_chippkg(void *sbh);
13135 +extern uint sb_boardvendor(void *sbh);
13136 +extern uint sb_boardtype(void *sbh);
13137 +extern uint sb_boardstyle(void *sbh);
13138 +extern uint sb_bus(void *sbh);
13139 +extern uint sb_corelist(void *sbh, uint coreid[]);
13140 +extern uint sb_coreid(void *sbh);
13141 +extern uint sb_coreidx(void *sbh);
13142 +extern uint sb_coreunit(void *sbh);
13143 +extern uint sb_corevendor(void *sbh);
13144 +extern uint sb_corerev(void *sbh);
13145 +extern void *sb_coreregs(void *sbh);
13146 +extern uint32 sb_coreflags(void *sbh, uint32 mask, uint32 val);
13147 +extern uint32 sb_coreflagshi(void *sbh, uint32 mask, uint32 val);
13148 +extern bool sb_iscoreup(void *sbh);
13149 +extern void *sb_setcoreidx(void *sbh, uint coreidx);
13150 +extern void *sb_setcore(void *sbh, uint coreid, uint coreunit);
13151 +extern void sb_commit(void *sbh);
13152 +extern uint32 sb_base(uint32 admatch);
13153 +extern uint32 sb_size(uint32 admatch);
13154 +extern void sb_core_reset(void *sbh, uint32 bits);
13155 +extern void sb_core_tofixup(void *sbh);
13156 +extern void sb_core_disable(void *sbh, uint32 bits);
13157 +extern uint32 sb_clock_rate(uint32 pll_type, uint32 n, uint32 m);
13158 +extern uint32 sb_clock(void *sbh);
13159 +extern void sb_pci_setup(void *sbh, uint32 *dmaoffset, uint coremask);
13160 +extern void sb_pcmcia_init(void *sbh);
13161 +extern void sb_watchdog(void *sbh, uint ticks);
13162 +extern void *sb_gpiosetcore(void *sbh);
13163 +extern uint32 sb_gpiocontrol(void *sbh, uint32 mask, uint32 val);
13164 +extern uint32 sb_gpioouten(void *sbh, uint32 mask, uint32 val);
13165 +extern uint32 sb_gpioout(void *sbh, uint32 mask, uint32 val);
13166 +extern uint32 sb_gpioin(void *sbh);
13167 +extern uint32 sb_gpiointpolarity(void *sbh, uint32 mask, uint32 val);
13168 +extern uint32 sb_gpiointmask(void *sbh, uint32 mask, uint32 val);
13169 +extern bool sb_taclear(void *sbh);
13170 +extern void sb_pwrctl_init(void *sbh);
13171 +extern uint16 sb_pwrctl_fast_pwrup_delay(void *sbh);
13172 +extern bool sb_pwrctl_clk(void *sbh, uint mode);
13173 +extern int sb_pwrctl_xtal(void *sbh, uint what, bool on);
13174 +extern void sb_register_intr_callback(void *sbh, void *intrsoff_fn, void *intrsrestore_fn, void *intr_arg);
13175 +
13176 +/* pwrctl xtal what flags */
13177 +#define        XTAL            0x1                     /* primary crystal oscillator (2050) */
13178 +#define        PLL             0x2                     /* main chip pll */
13179 +
13180 +/* pwrctl clk mode */
13181 +#define        CLK_FAST        0                       /* force fast (pll) clock */
13182 +#define        CLK_SLOW        1                       /* force slow clock */
13183 +#define        CLK_DYNAMIC     2                       /* enable dynamic power control */
13184 +
13185 +#endif /* _sbutils_h_ */
13186 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sflash.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sflash.h
13187 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sflash.h  1970-01-01 01:00:00.000000000 +0100
13188 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sflash.h     2005-08-28 11:12:20.473852616 +0200
13189 @@ -0,0 +1,46 @@
13190 +/*
13191 + * Broadcom SiliconBackplane chipcommon serial flash interface
13192 + *
13193 + * Copyright 2001-2003, Broadcom Corporation   
13194 + * All Rights Reserved.   
13195 + *    
13196 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
13197 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
13198 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
13199 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
13200 + *
13201 + * $Id$
13202 + */
13203 +
13204 +#ifndef _sflash_h_
13205 +#define _sflash_h_
13206 +
13207 +#include <typedefs.h>
13208 +#include <sbchipc.h>
13209 +
13210 +/* GPIO based bank selection (1 GPIO bit) */
13211 +#define SFLASH_MAX_BANKS       1
13212 +#define SFLASH_GPIO_SHIFT      2
13213 +#define SFLASH_GPIO_MASK       ((SFLASH_MAX_BANKS - 1) << SFLASH_GPIO_SHIFT)
13214 +
13215 +struct sflash_bank {
13216 +       uint offset;                                    /* Byte offset */
13217 +       uint erasesize;                                 /* Block size */
13218 +       uint numblocks;                                 /* Number of blocks */
13219 +       uint size;                                      /* Total bank size in bytes */
13220 +};
13221 +
13222 +struct sflash {
13223 +       struct sflash_bank banks[SFLASH_MAX_BANKS];     /* GPIO selectable banks */
13224 +       uint32 type;                                    /* Type */
13225 +       uint size;                                      /* Total array size in bytes */
13226 +};
13227 +
13228 +/* Utility functions */
13229 +extern int sflash_poll(chipcregs_t *cc, uint offset);
13230 +extern int sflash_read(chipcregs_t *cc, uint offset, uint len, uchar *buf);
13231 +extern int sflash_write(chipcregs_t *cc, uint offset, uint len, const uchar *buf);
13232 +extern int sflash_erase(chipcregs_t *cc, uint offset);
13233 +extern struct sflash * sflash_init(chipcregs_t *cc);
13234 +
13235 +#endif /* _sflash_h_ */
13236 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/trxhdr.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/trxhdr.h
13237 --- linux-2.6.12.5/arch/mips/bcm947xx/include/trxhdr.h  1970-01-01 01:00:00.000000000 +0100
13238 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/trxhdr.h     2005-08-28 11:12:20.474852464 +0200
13239 @@ -0,0 +1,31 @@
13240 +/*
13241 + * TRX image file header format.
13242 + *
13243 + * Copyright 2001-2003, Broadcom Corporation
13244 + * All Rights Reserved.
13245 + * 
13246 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
13247 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
13248 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
13249 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
13250 + *
13251 + * $Id$
13252 + */ 
13253 +
13254 +#include <typedefs.h>
13255 +
13256 +#define TRX_MAGIC      0x30524448      /* "HDR0" */
13257 +#define TRX_VERSION    1
13258 +#define TRX_MAX_LEN    0x3A0000
13259 +#define TRX_NO_HEADER  1               /* Do not write TRX header */   
13260 +
13261 +struct trx_header {
13262 +       uint32 magic;           /* "HDR0" */
13263 +       uint32 len;             /* Length of file including header */
13264 +       uint32 crc32;           /* 32-bit CRC from flag_version to end of file */
13265 +       uint32 flag_version;    /* 0:15 flags, 16:31 version */
13266 +       uint32 offsets[3];      /* Offsets of partitions from start of header */
13267 +};
13268 +
13269 +/* Compatibility */
13270 +typedef struct trx_header TRXHDR, *PTRXHDR;
13271 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/typedefs.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/typedefs.h
13272 --- linux-2.6.12.5/arch/mips/bcm947xx/include/typedefs.h        1970-01-01 01:00:00.000000000 +0100
13273 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/typedefs.h   2005-08-28 11:12:20.474852464 +0200
13274 @@ -0,0 +1,162 @@
13275 +/*
13276 + * Copyright 2001-2003, Broadcom Corporation   
13277 + * All Rights Reserved.   
13278 + *    
13279 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY   
13280 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM   
13281 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS   
13282 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.   
13283 + * $Id$
13284 + */
13285 +
13286 +#ifndef _TYPEDEFS_H_
13287 +#define _TYPEDEFS_H_
13288 +
13289 +/*----------------------- define TRUE, FALSE, NULL, bool ----------------*/
13290 +#ifdef __cplusplus
13291 +
13292 +#ifndef FALSE
13293 +#define FALSE  false
13294 +#endif
13295 +#ifndef TRUE
13296 +#define TRUE   true
13297 +#endif
13298 +
13299 +#else /* !__cplusplus */
13300 +
13301 +#if defined(_WIN32)
13302 +
13303 +typedef        unsigned char   bool;
13304 +
13305 +#else
13306 +
13307 +#if defined(MACOSX) && defined(KERNEL)
13308 +#include <IOKit/IOTypes.h>
13309 +#else
13310 +typedef        int     bool;
13311 +#endif
13312 +
13313 +#endif
13314 +
13315 +#ifndef FALSE
13316 +#define FALSE  0
13317 +#endif
13318 +#ifndef TRUE
13319 +#define TRUE   1
13320 +
13321 +#ifndef NULL
13322 +#define        NULL 0
13323 +#endif
13324 +
13325 +#endif
13326 +
13327 +#endif /* __cplusplus */
13328 +
13329 +#ifndef OFF
13330 +#define        OFF     0
13331 +#endif
13332 +
13333 +#ifndef ON
13334 +#define        ON      1
13335 +#endif
13336 +
13337 +/*----------------------- define uchar, ushort, uint, ulong ----------------*/
13338 +
13339 +typedef unsigned char uchar;
13340 +
13341 +#if defined(_WIN32) || defined(PMON) || defined(__MRC__) || defined(V2_HAL) || defined(_CFE_)
13342 +
13343 +#ifndef V2_HAL
13344 +typedef unsigned short ushort;
13345 +#endif
13346 +
13347 +typedef unsigned int   uint;
13348 +typedef unsigned long  ulong;
13349 +
13350 +#else
13351 +
13352 +/* pick up ushort & uint from standard types.h */
13353 +#if defined(linux) && defined(__KERNEL__)
13354 +#include <linux/types.h>       /* sys/types.h and linux/types.h are oil and water */
13355 +#else
13356 +#include <sys/types.h> 
13357 +#if !defined(TARGETENV_sun4) && !defined(linux)
13358 +typedef unsigned long  ulong;
13359 +#endif /* TARGETENV_sun4 */
13360 +#endif
13361 +#if defined(PMON)
13362 +typedef unsigned int   uint;
13363 +typedef unsigned long long       uint64;
13364 +#endif
13365 +
13366 +#endif /* WIN32 || PMON || .. */
13367 +
13368 +/*----------------------- define [u]int8/16/32/64 --------------------------*/
13369 +
13370 +
13371 +#ifdef V2_HAL
13372 +#include <bcmos.h>
13373 +#else
13374 +typedef signed char    int8;
13375 +typedef signed short   int16;
13376 +typedef signed int     int32;
13377 +
13378 +typedef unsigned char  uint8;
13379 +typedef unsigned short uint16;
13380 +typedef unsigned int   uint32;
13381 +#endif /* V2_HAL */
13382 +
13383 +typedef float          float32;
13384 +typedef double         float64;
13385 +
13386 +/*
13387 + * abstracted floating point type allows for compile time selection of
13388 + * single or double precision arithmetic.  Compiling with -DFLOAT32
13389 + * selects single precision; the default is double precision.
13390 + */
13391 +
13392 +#if defined(FLOAT32)
13393 +typedef float32 float_t;
13394 +#else /* default to double precision floating point */
13395 +typedef float64 float_t;
13396 +#endif /* FLOAT32 */
13397 +
13398 +#ifdef _MSC_VER            /* Microsoft C */
13399 +typedef signed __int64 int64;
13400 +typedef unsigned __int64 uint64;
13401 +
13402 +#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
13403 +/* gcc understands signed/unsigned 64 bit types, but complains in ANSI mode */
13404 +typedef signed long long int64;
13405 +typedef unsigned long long uint64;
13406 +
13407 +#elif defined(__ICL) && !defined(__STDC__)
13408 +/* ICL accepts unsigned 64 bit type only, and complains in ANSI mode */
13409 +typedef unsigned long long uint64;
13410 +
13411 +#endif /* _MSC_VER */
13412 +
13413 +
13414 +/*----------------------- define PTRSZ, INLINE --------------------------*/
13415 +
13416 +#define        PTRSZ   sizeof (char*)
13417 +
13418 +#ifndef INLINE
13419 +
13420 +#ifdef _MSC_VER
13421 +
13422 +#define INLINE __inline
13423 +
13424 +#elif __GNUC__
13425 +
13426 +#define INLINE __inline__
13427 +
13428 +#else
13429 +
13430 +#define INLINE
13431 +
13432 +#endif /* _MSC_VER */
13433 +
13434 +#endif /* INLINE */
13435 +
13436 +#endif /* _TYPEDEFS_H_ */
13437 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/wlioctl.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/wlioctl.h
13438 --- linux-2.6.12.5/arch/mips/bcm947xx/include/wlioctl.h 1970-01-01 01:00:00.000000000 +0100
13439 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/wlioctl.h    2005-08-28 11:12:20.475852312 +0200
13440 @@ -0,0 +1,690 @@
13441 +/*
13442 + * Custom OID/ioctl definitions for
13443 + * Broadcom 802.11abg Networking Device Driver
13444 + *
13445 + * Definitions subject to change without notice.
13446 + *
13447 + * Copyright 2001-2003, Broadcom Corporation
13448 + * All Rights Reserved.
13449 + * 
13450 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
13451 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
13452 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
13453 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
13454 + *
13455 + * $Id$
13456 + */
13457 +
13458 +#ifndef _wlioctl_h_
13459 +#define        _wlioctl_h_
13460 +
13461 +#include <typedefs.h>
13462 +#include <proto/ethernet.h>
13463 +#include <proto/802.11.h>
13464 +
13465 +#if defined(__GNUC__)
13466 +#define        PACKED  __attribute__((packed))
13467 +#else
13468 +#define        PACKED
13469 +#endif
13470 +
13471 +/*
13472 + * Per-bss information structure.
13473 + */
13474 +
13475 +#define WL_NUMRATES            255     /* max # of rates in a rateset */
13476 +
13477 +typedef struct wl_rateset {
13478 +       uint32  count;                  /* # rates in this set */
13479 +       uint8   rates[WL_NUMRATES];     /* rates in 500kbps units w/hi bit set if basic */
13480 +} wl_rateset_t;
13481 +
13482 +#define        WL_LEGACY_BSS_INFO_VERSION      106     /* an older supported version of wl_bss_info struct */
13483 +#define        WL_BSS_INFO_VERSION             107     /* current version of wl_bss_info struct */
13484 +
13485 +typedef struct wl_bss_info106 {
13486 +       uint            version;        /* version field */
13487 +       struct ether_addr BSSID;
13488 +       uint8           SSID_len;
13489 +       uint8           SSID[32];
13490 +       uint8           Privacy;        /* 0=No WEP, 1=Use WEP */
13491 +       int16           RSSI;           /* receive signal strength (in dBm) */
13492 +       uint16          beacon_period;  /* units are Kusec */
13493 +       uint16          atim_window;    /* units are Kusec */
13494 +       uint8           channel;        /* Channel no. */
13495 +       int8            infra;          /* 0=IBSS, 1=infrastructure, 2=unknown */
13496 +       struct {
13497 +               uint    count;          /* # rates in this set */
13498 +               uint8   rates[12];      /* rates in 500kbps units w/hi bit set if basic */
13499 +       } rateset;                      /* supported rates */
13500 +        uint8           dtim_period;    /* DTIM period */
13501 +       int8            phy_noise;      /* noise right after tx (in dBm) */
13502 +       uint16          capability;     /* Capability information */
13503 +       struct dot11_bcn_prb *prb;      /* probe response frame (ioctl na) */
13504 +       uint16          prb_len;        /* probe response frame length (ioctl na) */
13505 +       struct {
13506 +               uint8 supported;        /* wpa supported */
13507 +               uint8 multicast;        /* multicast cipher */
13508 +               uint8 ucount;           /* count of unicast ciphers */
13509 +               uint8 unicast[4];       /* unicast ciphers */
13510 +               uint8 acount;           /* count of auth modes */
13511 +               uint8 auth[4];          /* Authentication modes */
13512 +       } wpa;
13513 +} wl_bss_info106_t;
13514 +
13515 +typedef struct wl_bss_info {
13516 +       uint32          version;        /* version field */
13517 +       uint32          length;         /* byte length of data in this record, starting at version and including IEs */
13518 +       struct ether_addr BSSID;
13519 +       uint16          beacon_period;  /* units are Kusec */
13520 +       uint16          capability;     /* Capability information */
13521 +       uint8           SSID_len;
13522 +       uint8           SSID[32];
13523 +       struct {
13524 +               uint    count;          /* # rates in this set */
13525 +               uint8   rates[16];      /* rates in 500kbps units w/hi bit set if basic */
13526 +       } rateset;                      /* supported rates */
13527 +       uint8           channel;        /* Channel no. */
13528 +       uint16          atim_window;    /* units are Kusec */
13529 +        uint8           dtim_period;    /* DTIM period */
13530 +       int16           RSSI;           /* receive signal strength (in dBm) */
13531 +       int8            phy_noise;      /* noise (in dBm) */
13532 +       uint32          ie_length;      /* byte length of Information Elements */
13533 +       /* variable length Information Elements */
13534 +} wl_bss_info_t;
13535 +
13536 +typedef struct wl_scan_results {
13537 +       uint32 buflen;
13538 +       uint32 version;
13539 +       uint32 count;
13540 +       wl_bss_info_t bss_info[1];
13541 +} wl_scan_results_t;
13542 +/* size of wl_scan_results not including variable length array */
13543 +#define WL_SCAN_RESULTS_FIXED_SIZE 12
13544 +
13545 +/* uint32 list */
13546 +typedef struct wl_uint32_list {
13547 +       /* in - # of elements, out - # of entries */
13548 +       uint32 count;
13549 +       /* variable length uint32 list */
13550 +       uint32 element[1];
13551 +} wl_uint32_list_t;
13552 +
13553 +typedef struct wlc_ssid {
13554 +       uint32          SSID_len;
13555 +       uchar           SSID[32];
13556 +} wlc_ssid_t;
13557 +
13558 +#define WLC_CNTRY_BUF_SZ        4       /* Country string is 3 bytes + NULL */
13559 +
13560 +typedef struct wl_channels_in_country {
13561 +       uint32 buflen;
13562 +       uint32 band;
13563 +       char country_abbrev[WLC_CNTRY_BUF_SZ];
13564 +       uint32 count;
13565 +       uint32 channel[1];
13566 +} wl_channels_in_country_t;
13567 +
13568 +typedef struct wl_country_list {
13569 +       uint32 buflen;
13570 +       uint32 band_set;
13571 +       uint32 band;
13572 +       uint32 count;
13573 +       char country_abbrev[1];
13574 +} wl_country_list_t;
13575 +
13576 +
13577 +/*
13578 +* Maximum # of keys that wl driver supports in S/W. Keys supported 
13579 +* in H/W is less than or equal to WSEC_MAX_KEYS.
13580 +*/
13581 +#define WSEC_MAX_KEYS          54      /* Max # of keys (50 + 4 default keys) */
13582 +#define WSEC_MAX_DEFAULT_KEYS  4       /* # of default keys */
13583 +
13584 +/*
13585 +* Remove these two defines if access to crypto/tkhash.h 
13586 +* is unconditionally permitted.
13587 +*/
13588 +#define TKHASH_P1_KEY_SIZE     10      /* size of TKHash Phase1 output, in bytes */
13589 +#define TKHASH_P2_KEY_SIZE     16      /* size of TKHash Phase2 output */
13590 +
13591 +/* Enumerate crypto algorithms */
13592 +#define        CRYPTO_ALGO_OFF                 0
13593 +#define        CRYPTO_ALGO_WEP1                1
13594 +#define        CRYPTO_ALGO_TKIP                2
13595 +#define        CRYPTO_ALGO_WEP128              3
13596 +#define CRYPTO_ALGO_AES_CCM            4
13597 +#define CRYPTO_ALGO_AES_OCB_MSDU       5
13598 +#define CRYPTO_ALGO_AES_OCB_MPDU       6
13599 +#define CRYPTO_ALGO_NALG               7
13600 +
13601 +/* For use with wlc_wep_key.flags */
13602 +#define WSEC_PRIMARY_KEY       (1 << 1)        /* Indicates this key is the primary (ie tx) key */
13603 +#define WSEC_TKIP_ERROR                (1 << 2)        /* Provoke deliberate MIC error */
13604 +#define WSEC_REPLAY_ERROR      (1 << 3)        /* Provoke deliberate replay */
13605 +
13606 +#define WSEC_GEN_MIC_ERROR     0x0001
13607 +#define WSEC_GEN_REPLAY                0x0002
13608 +
13609 +typedef struct tkip_info {
13610 +       uint16          phase1[TKHASH_P1_KEY_SIZE/sizeof(uint16)];      /* tkhash phase1 result */
13611 +       uint8           phase2[TKHASH_P2_KEY_SIZE];     /* tkhash phase2 result */
13612 +       uint32          micl;
13613 +       uint32          micr;
13614 +} tkip_info_t;
13615 +
13616 +typedef struct wsec_iv {
13617 +       uint32          hi;     /* upper 32 bits of IV */
13618 +       uint16          lo;     /* lower 16 bits of IV */
13619 +} wsec_iv_t;
13620 +
13621 +typedef struct wsec_key {
13622 +       uint32          index;          /* key index */
13623 +       uint32          len;            /* key length */
13624 +       uint8           data[DOT11_MAX_KEY_SIZE];       /* key data */
13625 +       tkip_info_t     tkip_tx;        /* tkip transmit state */
13626 +       tkip_info_t     tkip_rx;        /* tkip receive state */
13627 +       uint32          algo;           /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
13628 +       uint32          flags;          /* misc flags */
13629 +       uint32          algo_hw;        /* cache for hw register*/
13630 +       uint32          aes_mode;       /* cache for hw register*/
13631 +       int             iv_len;         /* IV length */         
13632 +       int             iv_initialized; /* has IV been initialized already? */          
13633 +       int             icv_len;        /* ICV length */
13634 +       wsec_iv_t       rxiv;           /* Rx IV */
13635 +       wsec_iv_t       txiv;           /* Tx IV */
13636 +       struct ether_addr ea;           /* per station */
13637 +} wsec_key_t;
13638 +
13639 +/* wireless security bitvec */
13640 +#define WEP_ENABLED            1
13641 +#define TKIP_ENABLED           2
13642 +#define AES_ENABLED            4
13643 +#define WSEC_SWFLAG            8
13644 +
13645 +#define WSEC_SW(wsec)          ((wsec) & WSEC_SWFLAG)
13646 +#define WSEC_HW(wsec)          (!WSEC_SW(wsec))
13647 +#define WSEC_WEP_ENABLED(wsec) ((wsec) & WEP_ENABLED)
13648 +#define WSEC_TKIP_ENABLED(wsec)        ((wsec) & TKIP_ENABLED)
13649 +#define WSEC_AES_ENABLED(wsec) ((wsec) & AES_ENABLED)
13650 +#define WSEC_ENABLED(wsec)     ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))
13651 +
13652 +/* wireless authentication bit vector */
13653 +#define WPA_ENABLED    1
13654 +#define PSK_ENABLED    2
13655 +
13656 +#define WAUTH_WPA_ENABLED(wauth)       ((wauth) & WPA_ENABLED)
13657 +#define WAUTH_PSK_ENABLED(wauth)       ((wauth) & PSK_ENABLED)
13658 +#define WAUTH_ENABLED(wauth)           ((wauth) & (WPA_ENABLED | PSK_ENABLED))
13659 +
13660 +/* group/mcast cipher */
13661 +#define WPA_MCAST_CIPHER(wsec) (((wsec) & TKIP_ENABLED) ? WPA_CIPHER_TKIP : \
13662 +                               ((wsec) & AES_ENABLED) ? WPA_CIPHER_AES_CCM : \
13663 +                               WPA_CIPHER_NONE)
13664 +
13665 +typedef struct wl_led_info {
13666 +       uint32          index;          /* led index */
13667 +       uint32          behavior;
13668 +       bool            activehi;
13669 +} wl_led_info_t;
13670 +
13671 +/*
13672 + * definitions for driver messages passed from WL to NAS.
13673 + */
13674 +/* Use this to recognize wpa and 802.1x driver messages. */
13675 +static const uint8 wl_wpa_snap_template[] =
13676 +       { 0xaa, 0xaa, 0x03, 0x00, 0x90, 0x4c };
13677 +
13678 +#define WL_WPA_MSG_IFNAME_MAX  16
13679 +
13680 +/* WPA driver message */
13681 +typedef struct wl_wpa_header {
13682 +       struct ether_header eth;
13683 +       struct dot11_llc_snap_header snap;
13684 +       uint8 version;
13685 +       uint8 type;
13686 +       /* version 2 additions */
13687 +       char ifname[WL_WPA_MSG_IFNAME_MAX];
13688 +       /* version specific data */
13689 +       /* uint8 data[1]; */
13690 +} wl_wpa_header_t PACKED;
13691 +
13692 +#define WL_WPA_HEADER_LEN      (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN + 2 + WL_WPA_MSG_IFNAME_MAX)
13693 +
13694 +/* WPA driver message ethertype - private between wlc and nas */
13695 +#define WL_WPA_ETHER_TYPE      0x9999
13696 +
13697 +/* WPA driver message current version */
13698 +#define WL_WPA_MSG_VERSION     2
13699 +
13700 +/* Type field values for the 802.2 driver messages for WPA. */
13701 +#define WLC_ASSOC_MSG          1
13702 +#define WLC_DISASSOC_MSG       2
13703 +#define WLC_PTK_MIC_MSG                3
13704 +#define WLC_GTK_MIC_MSG                4
13705 +
13706 +/* 802.1x driver message */
13707 +typedef struct wl_eapol_header {
13708 +       struct ether_header eth;
13709 +       struct dot11_llc_snap_header snap;
13710 +       uint8 version;
13711 +       uint8 reserved;
13712 +       char ifname[WL_WPA_MSG_IFNAME_MAX];
13713 +       /* version specific data */
13714 +       /* uint8 802_1x_msg[1]; */
13715 +} wl_eapol_header_t PACKED;
13716 +
13717 +#define WL_EAPOL_HEADER_LEN    (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN + 2 + WL_WPA_MSG_IFNAME_MAX)
13718 +
13719 +/* 802.1x driver message ethertype - private between wlc and nas */
13720 +#define WL_EAPOL_ETHER_TYPE    0x999A
13721 +
13722 +/* 802.1x driver message current version */
13723 +#define WL_EAPOL_MSG_VERSION   1
13724 +
13725 +/* srom read/write struct passed through ioctl */
13726 +typedef struct {
13727 +       uint   byteoff;         /* byte offset */
13728 +       uint   nbytes;          /* number of bytes */
13729 +       uint16 buf[1];
13730 +} srom_rw_t;
13731 +
13732 +/* R_REG and W_REG struct passed through ioctl */
13733 +typedef struct {
13734 +       uint32  byteoff;        /* byte offset of the field in d11regs_t */
13735 +       uint32  val;            /* read/write value of the field */
13736 +       uint32  size;           /* sizeof the field */
13737 +} rw_reg_t;
13738 +
13739 +/* Structure used by GET/SET_ATTEN ioctls */
13740 +typedef struct {
13741 +       uint16  auto_ctrl;      /* 1: Automatic control, 0: overriden */
13742 +       uint16  bb;             /* Baseband attenuation */
13743 +       uint16  radio;          /* Radio attenuation */
13744 +       uint16  txctl1;         /* Radio TX_CTL1 value */
13745 +} atten_t;
13746 +
13747 +/* Used to get specific STA parameters */ 
13748 +typedef struct {
13749 +       uint32  val;
13750 +       struct ether_addr ea;
13751 +} scb_val_t;
13752 +
13753 +/* callback registration data types */
13754 +
13755 +typedef struct _mac_event_params {
13756 +       uint msg;
13757 +       struct ether_addr *addr;
13758 +       uint result;
13759 +       uint status; 
13760 +       uint auth_type;
13761 +} mac_event_params_t;
13762 +
13763 +typedef struct _mic_error_params {
13764 +       struct ether_addr *ea;
13765 +       bool group;
13766 +       bool flush_txq;
13767 +} mic_error_params_t;
13768 +
13769 +typedef enum _wl_callback {
13770 +       WL_MAC_EVENT_CALLBACK = 0,
13771 +       WL_LINK_UP_CALLBACK,
13772 +       WL_LINK_DOWN_CALLBACK,
13773 +       WL_MIC_ERROR_CALLBACK,
13774 +       WL_LAST_CALLBACK
13775 +} wl_callback_t;
13776 +
13777 +typedef struct _callback {
13778 +       void (*fn)(void *, void *);
13779 +       void *context;
13780 +} callback_t;
13781 +
13782 +typedef struct _scan_callback {
13783 +       void (*fn)(void *);
13784 +       void *context;
13785 +} scan_callback_t;
13786 +
13787 +/* used to register an arbitrary callback via the IOCTL interface */
13788 +typedef struct _set_callback {
13789 +       int index;
13790 +       callback_t callback;
13791 +} set_callback_t;
13792 +
13793 +/*
13794 + * Country locale determines which channels are available to us.
13795 + */
13796 +typedef enum _wlc_locale {
13797 +       WLC_WW = 0,     /* Worldwide */
13798 +       WLC_THA,        /* Thailand */
13799 +       WLC_ISR,        /* Israel */
13800 +       WLC_JDN,        /* Jordan */
13801 +       WLC_PRC,        /* China */
13802 +       WLC_JPN,        /* Japan */
13803 +       WLC_FCC,        /* USA */
13804 +       WLC_EUR,        /* Europe */
13805 +       WLC_USL,        /* US Low Band only */
13806 +       WLC_JPH,        /* Japan High Band only */
13807 +       WLC_ALL,        /* All the channels in this band */
13808 +       WLC_11D,        /* Represents locale recieved by 11d beacons */
13809 +       WLC_LAST_LOCALE,
13810 +       WLC_UNDEFINED_LOCALE = 0xf
13811 +} wlc_locale_t;
13812 +
13813 +/* channel encoding */
13814 +typedef struct channel_info {
13815 +       int hw_channel;
13816 +       int target_channel;
13817 +       int scan_channel;
13818 +} channel_info_t;
13819 +
13820 +/* For ioctls that take a list of MAC addresses */
13821 +struct maclist {
13822 +       uint count;                     /* number of MAC addresses */
13823 +       struct ether_addr ea[1];        /* variable length array of MAC addresses */
13824 +};
13825 +
13826 +/* get pkt count struct passed through ioctl */
13827 +typedef struct get_pktcnt {
13828 +       uint rx_good_pkt;
13829 +       uint rx_bad_pkt;
13830 +       uint tx_good_pkt;
13831 +       uint tx_bad_pkt;
13832 +} get_pktcnt_t;
13833 +
13834 +/* Linux network driver ioctl encoding */
13835 +typedef struct wl_ioctl {
13836 +       int cmd;        /* common ioctl definition */
13837 +       void *buf;      /* pointer to user buffer */
13838 +       int len;        /* length of user buffer */
13839 +} wl_ioctl_t;
13840 +
13841 +/* 
13842 + * Structure for passing hardware and software 
13843 + * revision info up from the driver. 
13844 + */
13845 +typedef struct wlc_rev_info {
13846 +       uint            vendorid;       /* PCI vendor id */
13847 +       uint            deviceid;       /* device id of chip */
13848 +       uint            radiorev;       /* radio revision */
13849 +       uint            chiprev;        /* chip revision */
13850 +       uint            corerev;        /* core revision */
13851 +       uint            boardid;        /* board identifier (usu. PCI sub-device id) */
13852 +       uint            boardvendor;    /* board vendor (usu. PCI sub-vendor id) */
13853 +       uint            boardrev;       /* board revision */
13854 +       uint            driverrev;      /* driver version */
13855 +       uint            ucoderev;       /* microcode version */
13856 +       uint            bus;            /* bus type */
13857 +       uint        chipnum;    /* chip number */
13858 +} wlc_rev_info_t;
13859 +
13860 +/* check this magic number */
13861 +#define WLC_IOCTL_MAGIC                0x14e46c77
13862 +
13863 +/* bump this number if you change the ioctl interface */
13864 +#define WLC_IOCTL_VERSION      1
13865 +
13866 +/* maximum length buffer required */
13867 +#define WLC_IOCTL_MAXLEN       8192
13868 +
13869 +/* common ioctl definitions */
13870 +#define WLC_GET_MAGIC                          0
13871 +#define WLC_GET_VERSION                                1
13872 +#define WLC_UP                                 2
13873 +#define WLC_DOWN                               3
13874 +#define WLC_DUMP                               6
13875 +#define WLC_GET_MSGLEVEL                       7
13876 +#define WLC_SET_MSGLEVEL                       8
13877 +#define WLC_GET_PROMISC                                9
13878 +#define WLC_SET_PROMISC                                10
13879 +#define WLC_GET_RATE                           12
13880 +#define WLC_SET_RATE                           13
13881 +#define WLC_GET_INSTANCE                       14
13882 +#define WLC_GET_FRAG                           15
13883 +#define WLC_SET_FRAG                           16
13884 +#define WLC_GET_RTS                            17
13885 +#define WLC_SET_RTS                            18
13886 +#define WLC_GET_INFRA                          19
13887 +#define WLC_SET_INFRA                          20
13888 +#define WLC_GET_AUTH                           21
13889 +#define WLC_SET_AUTH                           22
13890 +#define WLC_GET_BSSID                          23
13891 +#define WLC_SET_BSSID                          24
13892 +#define WLC_GET_SSID                           25
13893 +#define WLC_SET_SSID                           26
13894 +#define WLC_RESTART                            27
13895 +#define WLC_GET_CHANNEL                                29
13896 +#define WLC_SET_CHANNEL                                30
13897 +#define WLC_GET_SRL                            31
13898 +#define WLC_SET_SRL                            32
13899 +#define WLC_GET_LRL                            33
13900 +#define WLC_SET_LRL                            34
13901 +#define WLC_GET_PLCPHDR                                35
13902 +#define WLC_SET_PLCPHDR                                36
13903 +#define WLC_GET_RADIO                          37
13904 +#define WLC_SET_RADIO                          38
13905 +#define WLC_GET_PHYTYPE                                39
13906 +#define WLC_GET_WEP                            42
13907 +#define WLC_SET_WEP                            43
13908 +#define WLC_GET_KEY                            44
13909 +#define WLC_SET_KEY                            45
13910 +#define WLC_SCAN                               50
13911 +#define WLC_SCAN_RESULTS                       51
13912 +#define WLC_DISASSOC                           52
13913 +#define WLC_REASSOC                            53
13914 +#define WLC_GET_ROAM_TRIGGER                   54
13915 +#define WLC_SET_ROAM_TRIGGER                   55
13916 +#define WLC_GET_TXANT                          61
13917 +#define WLC_SET_TXANT                          62
13918 +#define WLC_GET_ANTDIV                         63
13919 +#define WLC_SET_ANTDIV                         64
13920 +#define WLC_GET_TXPWR                          65
13921 +#define WLC_SET_TXPWR                          66
13922 +#define WLC_GET_CLOSED                         67
13923 +#define WLC_SET_CLOSED                         68
13924 +#define WLC_GET_MACLIST                                69
13925 +#define WLC_SET_MACLIST                                70
13926 +#define WLC_GET_RATESET                                71
13927 +#define WLC_SET_RATESET                                72
13928 +#define WLC_GET_LOCALE                         73
13929 +#define WLC_SET_LOCALE                         74
13930 +#define WLC_GET_BCNPRD                         75
13931 +#define WLC_SET_BCNPRD                         76
13932 +#define WLC_GET_DTIMPRD                                77
13933 +#define WLC_SET_DTIMPRD                                78
13934 +#define WLC_GET_SROM                           79
13935 +#define WLC_SET_SROM                           80
13936 +#define WLC_GET_WEP_RESTRICT                   81
13937 +#define WLC_SET_WEP_RESTRICT                   82
13938 +#define WLC_GET_COUNTRY                                83
13939 +#define WLC_SET_COUNTRY                                84
13940 +#define WLC_GET_REVINFO                                98
13941 +#define WLC_GET_MACMODE                                105
13942 +#define WLC_SET_MACMODE                                106
13943 +#define WLC_GET_GMODE                          109
13944 +#define WLC_SET_GMODE                          110
13945 +#define WLC_GET_CURR_RATESET                   114     /* current rateset */
13946 +#define WLC_GET_SCANSUPPRESS                   115
13947 +#define WLC_SET_SCANSUPPRESS                   116
13948 +#define WLC_GET_AP                             117
13949 +#define WLC_SET_AP                             118
13950 +#define WLC_GET_EAP_RESTRICT                   119
13951 +#define WLC_SET_EAP_RESTRICT                   120
13952 +#define WLC_GET_WDSLIST                                123
13953 +#define WLC_SET_WDSLIST                                124
13954 +#define WLC_GET_RSSI                           127
13955 +#define WLC_GET_WSEC                           133
13956 +#define WLC_SET_WSEC                           134
13957 +#define WLC_GET_BSS_INFO                       136
13958 +#define WLC_GET_LAZYWDS                                138
13959 +#define WLC_SET_LAZYWDS                                139
13960 +#define WLC_GET_BANDLIST                       140
13961 +#define WLC_GET_BAND                           141
13962 +#define WLC_SET_BAND                           142
13963 +#define WLC_GET_SHORTSLOT                      144
13964 +#define WLC_GET_SHORTSLOT_OVERRIDE             145
13965 +#define WLC_SET_SHORTSLOT_OVERRIDE             146
13966 +#define WLC_GET_SHORTSLOT_RESTRICT             147
13967 +#define WLC_SET_SHORTSLOT_RESTRICT             148
13968 +#define WLC_GET_GMODE_PROTECTION               149
13969 +#define WLC_GET_GMODE_PROTECTION_OVERRIDE      150
13970 +#define WLC_SET_GMODE_PROTECTION_OVERRIDE      151
13971 +#define WLC_UPGRADE                            152
13972 +#define WLC_GET_ASSOCLIST                      159
13973 +#define WLC_GET_CLK                            160
13974 +#define WLC_SET_CLK                            161
13975 +#define WLC_GET_UP                             162
13976 +#define WLC_OUT                                        163
13977 +#define WLC_GET_WPA_AUTH                       164
13978 +#define WLC_SET_WPA_AUTH                       165
13979 +#define WLC_GET_GMODE_PROTECTION_CONTROL       178
13980 +#define WLC_SET_GMODE_PROTECTION_CONTROL       179
13981 +#define WLC_GET_PHYLIST                                180
13982 +#define WLC_GET_GMODE_PROTECTION_CTS           198
13983 +#define WLC_SET_GMODE_PROTECTION_CTS           199
13984 +#define WLC_GET_PIOMODE                                203
13985 +#define WLC_SET_PIOMODE                                204
13986 +#define WLC_SET_LED                            209
13987 +#define WLC_GET_LED                            210
13988 +#define WLC_GET_CHANNEL_SEL                    215
13989 +#define WLC_START_CHANNEL_SEL                  216
13990 +#define WLC_GET_VALID_CHANNELS                 217
13991 +#define WLC_GET_FAKEFRAG                       218
13992 +#define WLC_SET_FAKEFRAG                       219
13993 +#define WLC_GET_WET                            230
13994 +#define WLC_SET_WET                            231
13995 +#define WLC_GET_KEY_PRIMARY                    235
13996 +#define WLC_SET_KEY_PRIMARY                    236
13997 +#define WLC_SCAN_WITH_CALLBACK                 240
13998 +#define WLC_SET_CS_SCAN_TIMER                  248
13999 +#define WLC_GET_CS_SCAN_TIMER                  249
14000 +#define WLC_CURRENT_PWR                                256
14001 +#define WLC_GET_CHANNELS_IN_COUNTRY            260
14002 +#define WLC_GET_COUNTRY_LIST                   261
14003 +#define WLC_NVRAM_GET                          264
14004 +#define WLC_NVRAM_SET                          265
14005 +#define WLC_LAST                               271     /* bump after adding */
14006 +
14007 +/*
14008 + * Minor kludge alert:
14009 + * Duplicate a few definitions that irelay requires from epiioctl.h here
14010 + * so caller doesn't have to include this file and epiioctl.h .
14011 + * If this grows any more, it would be time to move these irelay-specific
14012 + * definitions out of the epiioctl.h and into a separate driver common file.
14013 + */
14014 +#ifndef EPICTRL_COOKIE
14015 +#define EPICTRL_COOKIE         0xABADCEDE
14016 +#endif
14017 +
14018 +/* vx wlc ioctl's offset */
14019 +#define CMN_IOCTL_OFF 0x180
14020 +
14021 +/*
14022 + * custom OID support
14023 + *
14024 + * 0xFF - implementation specific OID
14025 + * 0xE4 - first byte of Broadcom PCI vendor ID
14026 + * 0x14 - second byte of Broadcom PCI vendor ID
14027 + * 0xXX - the custom OID number
14028 + */
14029 +
14030 +/* begin 0x1f values beyond the start of the ET driver range. */
14031 +#define WL_OID_BASE            0xFFE41420
14032 +
14033 +/* NDIS overrides */
14034 +#define OID_WL_GETINSTANCE     (WL_OID_BASE + WLC_GET_INSTANCE)
14035 +
14036 +#define WL_DECRYPT_STATUS_SUCCESS      1
14037 +#define WL_DECRYPT_STATUS_FAILURE      2
14038 +#define WL_DECRYPT_STATUS_UNKNOWN      3
14039 +
14040 +/* allows user-mode app to poll the status of USB image upgrade */
14041 +#define WLC_UPGRADE_SUCCESS                    0
14042 +#define WLC_UPGRADE_PENDING                    1
14043 +
14044 +/* Bit masks for radio disabled status - returned by WL_GET_RADIO */
14045 +#define WL_RADIO_SW_DISABLE    (1<<0)
14046 +#define WL_RADIO_HW_DISABLE    (1<<1)
14047 +
14048 +/* Override bit for WLC_SET_TXPWR.  if set, ignore other level limits */
14049 +#define WL_TXPWR_OVERRIDE      (1<<31)
14050 +
14051 +
14052 +/* Bus types */
14053 +#define WL_SB_BUS      0       /* Silicon Backplane */
14054 +#define WL_PCI_BUS     1       /* PCI target */
14055 +#define WL_PCMCIA_BUS  2       /* PCMCIA target */
14056 +
14057 +/* band types */
14058 +#define        WLC_BAND_AUTO           0       /* auto-select */
14059 +#define        WLC_BAND_A              1       /* "a" band (5   Ghz) */
14060 +#define        WLC_BAND_B              2       /* "b" band (2.4 Ghz) */
14061 +
14062 +/* MAC list modes */
14063 +#define WLC_MACMODE_DISABLED   0       /* MAC list disabled */
14064 +#define WLC_MACMODE_DENY       1       /* Deny specified (i.e. allow unspecified) */
14065 +#define WLC_MACMODE_ALLOW      2       /* Allow specified (i.e. deny unspecified) */   
14066 +
14067 +/* 
14068 + *
14069 + */
14070 +#define GMODE_LEGACY_B         0
14071 +#define GMODE_AUTO             1
14072 +#define GMODE_ONLY             2
14073 +#define GMODE_B_DEFERRED       3
14074 +#define GMODE_PERFORMANCE      4
14075 +#define GMODE_LRS              5
14076 +#define GMODE_MAX              6
14077 +
14078 +/* values for PLCPHdr_override */
14079 +#define WLC_PLCP_AUTO  -1
14080 +#define WLC_PLCP_SHORT 0
14081 +#define WLC_PLCP_LONG  1
14082 +
14083 +/* values for g_protection_override */
14084 +#define WLC_G_PROTECTION_AUTO  -1
14085 +#define WLC_G_PROTECTION_OFF   0
14086 +#define WLC_G_PROTECTION_ON    1
14087 +
14088 +/* values for g_protection_control */
14089 +#define WLC_G_PROTECTION_CTL_OFF       0
14090 +#define WLC_G_PROTECTION_CTL_LOCAL     1
14091 +#define WLC_G_PROTECTION_CTL_OVERLAP   2
14092 +
14093 +
14094 +
14095 +
14096 +
14097 +
14098 +/* max # of leds supported by GPIO (gpio pin# == led index#) */
14099 +#define        WL_LED_NUMGPIO          16      /* gpio 0-15 */
14100 +
14101 +/* led per-pin behaviors */
14102 +#define        WL_LED_OFF              0               /* always off */
14103 +#define        WL_LED_ON               1               /* always on */
14104 +#define        WL_LED_ACTIVITY         2               /* activity */
14105 +#define        WL_LED_RADIO            3               /* radio enabled */
14106 +#define        WL_LED_ARADIO           4               /* 5  Ghz radio enabled */
14107 +#define        WL_LED_BRADIO           5               /* 2.4Ghz radio enabled */
14108 +#define        WL_LED_BGMODE           6               /* on if gmode, off if bmode */
14109 +#define        WL_LED_WI1              7               
14110 +#define        WL_LED_WI2              8               
14111 +#define        WL_LED_WI3              9               
14112 +#define        WL_LED_ASSOC            10              /* associated state indicator */
14113 +#define        WL_LED_INACTIVE         11              /* null behavior (clears default behavior) */
14114 +#define        WL_LED_NUMBEHAVIOR      12
14115 +
14116 +/* led behavior numeric value format */
14117 +#define        WL_LED_BEH_MASK         0x7f            /* behavior mask */
14118 +#define        WL_LED_AL_MASK          0x80            /* activelow (polarity) bit */
14119 +
14120 +
14121 +/* rate check */
14122 +#define WL_RATE_OFDM(r)                (((r) & 0x7f) == 12 || ((r) & 0x7f) == 18 || \
14123 +                                ((r) & 0x7f) == 24 || ((r) & 0x7f) == 36 || \
14124 +                                ((r) & 0x7f) == 48 || ((r) & 0x7f) == 72 || \
14125 +                                ((r) & 0x7f) == 96 || ((r) & 0x7f) == 108)
14126 +
14127 +
14128 +#undef PACKED
14129 +
14130 +#endif /* _wlioctl_h_ */
14131 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/int-handler.S linux-2.6.12.5-brcm/arch/mips/bcm947xx/int-handler.S
14132 --- linux-2.6.12.5/arch/mips/bcm947xx/int-handler.S     1970-01-01 01:00:00.000000000 +0100
14133 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/int-handler.S        2005-08-28 16:58:08.027788792 +0200
14134 @@ -0,0 +1,48 @@
14135 +/*
14136 + *  Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
14137 + *
14138 + *  This program is free software; you can redistribute  it and/or modify it
14139 + *  under  the terms of  the GNU General  Public License as published by the
14140 + *  Free Software Foundation;  either version 2 of the  License, or (at your
14141 + *  option) any later version.
14142 + *
14143 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
14144 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
14145 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
14146 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
14147 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
14148 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
14149 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
14150 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
14151 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
14152 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14153 + *
14154 + *  You should have received a copy of the  GNU General Public License along
14155 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
14156 + *  675 Mass Ave, Cambridge, MA 02139, USA.
14157 + */
14158 +
14159 +#include <asm/asm.h>
14160 +#include <asm/mipsregs.h>
14161 +#include <asm/regdef.h>
14162 +#include <asm/stackframe.h>
14163 +
14164 +       .text
14165 +       .set    noreorder
14166 +       .set    noat
14167 +       .align  5
14168 +
14169 +       NESTED(bcm47xx_irq_handler, PT_SIZE, sp)
14170 +       SAVE_ALL
14171 +       CLI
14172 +
14173 +       .set    at
14174 +       .set    noreorder
14175 +
14176 +       jal     bcm47xx_irq_dispatch
14177 +       move    a0, sp
14178 +
14179 +       j       ret_from_irq
14180 +       nop
14181 +               
14182 +       END(bcm47xx_irq_handler)
14183 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/irq.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/irq.c
14184 --- linux-2.6.12.5/arch/mips/bcm947xx/irq.c     1970-01-01 01:00:00.000000000 +0100
14185 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/irq.c        2005-08-28 16:58:26.178029536 +0200
14186 @@ -0,0 +1,68 @@
14187 +/*
14188 + *  Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
14189 + *
14190 + *  This program is free software; you can redistribute  it and/or modify it
14191 + *  under  the terms of  the GNU General  Public License as published by the
14192 + *  Free Software Foundation;  either version 2 of the  License, or (at your
14193 + *  option) any later version.
14194 + *
14195 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
14196 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
14197 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
14198 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
14199 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
14200 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
14201 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
14202 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
14203 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
14204 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14205 + *
14206 + *  You should have received a copy of the  GNU General Public License along
14207 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
14208 + *  675 Mass Ave, Cambridge, MA 02139, USA.
14209 + */
14210 +
14211 +#include <linux/config.h>
14212 +#include <linux/errno.h>
14213 +#include <linux/init.h>
14214 +#include <linux/interrupt.h>
14215 +#include <linux/irq.h>
14216 +#include <linux/module.h>
14217 +#include <linux/smp.h>
14218 +#include <linux/types.h>
14219 +
14220 +#include <asm/cpu.h>
14221 +#include <asm/io.h>
14222 +#include <asm/irq.h>
14223 +#include <asm/irq_cpu.h>
14224 +#include <asm/gdb-stub.h>
14225 +
14226 +extern asmlinkage void bcm47xx_irq_handler(void);
14227 +
14228 +void bcm47xx_irq_dispatch(struct pt_regs *regs)
14229 +{
14230 +       u32 cause;
14231 +
14232 +       cause = read_c0_cause() & read_c0_status() & CAUSEF_IP;
14233 +
14234 +       clear_c0_status(cause);
14235 +
14236 +       if (cause & CAUSEF_IP7)
14237 +               do_IRQ(7, regs);
14238 +       if (cause & CAUSEF_IP2)
14239 +               do_IRQ(2, regs);
14240 +       if (cause & CAUSEF_IP3)
14241 +               do_IRQ(3, regs);
14242 +       if (cause & CAUSEF_IP4)
14243 +               do_IRQ(4, regs);
14244 +       if (cause & CAUSEF_IP5)
14245 +               do_IRQ(5, regs);
14246 +       if (cause & CAUSEF_IP6)
14247 +               do_IRQ(6, regs);
14248 +}
14249 +
14250 +void __init arch_init_irq(void)
14251 +{
14252 +       set_except_vector(0, bcm47xx_irq_handler);
14253 +       mips_cpu_irq_init(0);
14254 +}
14255 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/prom.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/prom.c
14256 --- linux-2.6.12.5/arch/mips/bcm947xx/prom.c    1970-01-01 01:00:00.000000000 +0100
14257 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/prom.c       2005-08-28 16:58:41.789656208 +0200
14258 @@ -0,0 +1,59 @@
14259 +/*
14260 + *  Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
14261 + *
14262 + *  This program is free software; you can redistribute  it and/or modify it
14263 + *  under  the terms of  the GNU General  Public License as published by the
14264 + *  Free Software Foundation;  either version 2 of the  License, or (at your
14265 + *  option) any later version.
14266 + *
14267 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
14268 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
14269 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
14270 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
14271 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
14272 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
14273 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
14274 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
14275 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
14276 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14277 + *
14278 + *  You should have received a copy of the  GNU General Public License along
14279 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
14280 + *  675 Mass Ave, Cambridge, MA 02139, USA.
14281 + */
14282 +
14283 +#include <linux/init.h>
14284 +#include <linux/mm.h>
14285 +#include <linux/sched.h>
14286 +#include <linux/bootmem.h>
14287 +
14288 +#include <asm/addrspace.h>
14289 +#include <asm/bootinfo.h>
14290 +#include <asm/pmon.h>
14291 +
14292 +const char *get_system_type(void)
14293 +{
14294 +       return "Broadcom BCM47xx";
14295 +}
14296 +
14297 +void __init prom_init(void)
14298 +{
14299 +       unsigned long mem;
14300 +
14301 +        mips_machgroup = MACH_GROUP_BRCM;
14302 +        mips_machtype = MACH_BCM47XX;
14303 +
14304 +       /* Figure out memory size by finding aliases */
14305 +       for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) {
14306 +               if (*(unsigned long *)((unsigned long)(prom_init) + mem) == 
14307 +                   *(unsigned long *)(prom_init))
14308 +                       break;
14309 +       }
14310 +
14311 +       add_memory_region(0, mem, BOOT_MEM_RAM);
14312 +}
14313 +
14314 +unsigned long __init prom_free_prom_memory(void)
14315 +{
14316 +       return 0;
14317 +}
14318 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/setup.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/setup.c
14319 --- linux-2.6.12.5/arch/mips/bcm947xx/setup.c   1970-01-01 01:00:00.000000000 +0100
14320 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/setup.c      2005-08-28 16:57:28.317825624 +0200
14321 @@ -0,0 +1,127 @@
14322 +/*
14323 + *  Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
14324 + *
14325 + *  This program is free software; you can redistribute  it and/or modify it
14326 + *  under  the terms of  the GNU General  Public License as published by the
14327 + *  Free Software Foundation;  either version 2 of the  License, or (at your
14328 + *  option) any later version.
14329 + *
14330 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
14331 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
14332 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
14333 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
14334 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
14335 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
14336 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
14337 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
14338 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
14339 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14340 + *
14341 + *  You should have received a copy of the  GNU General Public License along
14342 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
14343 + *  675 Mass Ave, Cambridge, MA 02139, USA.
14344 + */
14345 +
14346 +#include <linux/init.h>
14347 +#include <linux/types.h>
14348 +#include <linux/tty.h>
14349 +#include <linux/serial.h>
14350 +#include <linux/serial_core.h>
14351 +#include <linux/serial_reg.h>
14352 +#include <asm/time.h>
14353 +#include <asm/reboot.h>
14354 +
14355 +#include <typedefs.h>
14356 +#include <sbutils.h>
14357 +#include <sbmips.h>
14358 +#include <sbpci.h>
14359 +#include <sbconfig.h>
14360 +#include <bcmdevs.h>
14361 +
14362 +#if 1
14363 +
14364 +#define SER_PORT1(reg) (*((volatile unsigned char *)(0xb8000400+reg)))
14365 +
14366 +int putDebugChar(char c)
14367 +{
14368 +       while (!(SER_PORT1(UART_LSR) & UART_LSR_THRE));
14369 +       SER_PORT1(UART_TX) = c;
14370 +       
14371 +       return 1;
14372 +}
14373 +
14374 +char getDebugChar(void)
14375 +{
14376 +       while (!(SER_PORT1(UART_LSR) & 1));
14377 +       return SER_PORT1(UART_RX);
14378 +}
14379 +
14380 +
14381 +static int ser_line = 0;
14382 +
14383 +static void
14384 +serial_add(void *regs, uint irq, uint baud_base, uint reg_shift)
14385 +{
14386 +       struct uart_port s;
14387 +
14388 +       memset(&s, 0, sizeof(s));
14389 +
14390 +       s.line = ser_line++;
14391 +       s.membase = regs;
14392 +       s.irq = irq + 2;
14393 +       s.uartclk = baud_base;
14394 +       s.flags = ASYNC_BOOT_AUTOCONF;
14395 +       s.iotype = SERIAL_IO_MEM;
14396 +       s.regshift = reg_shift;
14397 +
14398 +       if (early_serial_setup(&s) != 0) {
14399 +               printk(KERN_ERR "Serial setup failed!\n");
14400 +       }
14401 +}
14402 +#endif
14403 +
14404 +extern void bcm47xx_time_init(void);
14405 +extern void bcm47xx_timer_setup(struct irqaction *irq);
14406 +
14407 +void *nvram_get(char *foo)
14408 +{
14409 +       return NULL;
14410 +}
14411 +
14412 +void *sbh;
14413 +
14414 +static void bcm47xx_machine_restart(char *command)
14415 +{
14416 +       /* Set the watchdog timer to reset immediately */
14417 +       cli();
14418 +       sb_watchdog(sbh, 1);
14419 +       while (1);
14420 +}
14421 +
14422 +static void bcm47xx_machine_halt(void)
14423 +{
14424 +       /* Disable interrupts and watchdog and spin forever */
14425 +       cli();
14426 +       sb_watchdog(sbh, 0);
14427 +       while (1);
14428 +}
14429 +
14430 +static int __init bcm47xx_init(void)
14431 +{
14432 +
14433 +       sbh = sb_kattach();
14434 +       sb_mips_init(sbh);
14435 +       sbpci_init(sbh);
14436 +       sb_serial_init(sbh, serial_add);
14437 +
14438 +       _machine_restart = bcm47xx_machine_restart;
14439 +       _machine_halt = bcm47xx_machine_halt;
14440 +       _machine_power_off = bcm47xx_machine_halt;
14441 +       
14442 +       board_time_init = bcm47xx_time_init;
14443 +       board_timer_setup = bcm47xx_timer_setup;
14444 +       
14445 +       return 0;
14446 +}
14447 +
14448 +early_initcall(bcm47xx_init);
14449 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/time.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/time.c
14450 --- linux-2.6.12.5/arch/mips/bcm947xx/time.c    1970-01-01 01:00:00.000000000 +0100
14451 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/time.c       2005-08-28 16:57:55.440702320 +0200
14452 @@ -0,0 +1,59 @@
14453 +/*
14454 + *  Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
14455 + *
14456 + *  This program is free software; you can redistribute  it and/or modify it
14457 + *  under  the terms of  the GNU General  Public License as published by the
14458 + *  Free Software Foundation;  either version 2 of the  License, or (at your
14459 + *  option) any later version.
14460 + *
14461 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
14462 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
14463 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
14464 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
14465 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
14466 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
14467 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
14468 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
14469 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
14470 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14471 + *
14472 + *  You should have received a copy of the  GNU General Public License along
14473 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
14474 + *  675 Mass Ave, Cambridge, MA 02139, USA.
14475 + */
14476 +
14477 +#include <linux/config.h>
14478 +#include <linux/init.h>
14479 +#include <linux/kernel.h>
14480 +#include <linux/sched.h>
14481 +#include <linux/serial_reg.h>
14482 +#include <linux/interrupt.h>
14483 +#include <asm/addrspace.h>
14484 +#include <asm/io.h>
14485 +#include <asm/time.h>
14486 +
14487 +void __init
14488 +bcm47xx_time_init(void)
14489 +{
14490 +       unsigned int hz;
14491 +
14492 +       /*
14493 +        * Use deterministic values for initial counter interrupt
14494 +        * so that calibrate delay avoids encountering a counter wrap.
14495 +        */
14496 +       write_c0_count(0);
14497 +       write_c0_compare(0xffff);
14498 +
14499 +       hz = 200 * 1000 * 1000;
14500 +
14501 +       /* Set MIPS counter frequency for fixed_rate_gettimeoffset() */
14502 +       mips_hpt_frequency = hz / 2;
14503 +
14504 +}
14505 +
14506 +void __init
14507 +bcm47xx_timer_setup(struct irqaction *irq)
14508 +{
14509 +       /* Enable the timer interrupt */
14510 +       setup_irq(7, irq);
14511 +}
14512 diff -Nur linux-2.6.12.5/arch/mips/kernel/cpu-probe.c linux-2.6.12.5-brcm/arch/mips/kernel/cpu-probe.c
14513 --- linux-2.6.12.5/arch/mips/kernel/cpu-probe.c 2005-08-15 02:20:18.000000000 +0200
14514 +++ linux-2.6.12.5-brcm/arch/mips/kernel/cpu-probe.c    2005-08-28 11:12:20.538842736 +0200
14515 @@ -555,6 +555,28 @@
14516         }
14517  }
14518  
14519 +static inline void cpu_probe_broadcom(struct cpuinfo_mips *c)
14520 +{
14521 +       decode_config1(c);
14522 +       switch (c->processor_id & 0xff00) {
14523 +               case PRID_IMP_BCM3302:
14524 +                       c->cputype = CPU_BCM3302;
14525 +                       c->isa_level = MIPS_CPU_ISA_M32;
14526 +                       c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
14527 +                                       MIPS_CPU_4KTLB | MIPS_CPU_COUNTER;
14528 +               break;
14529 +               case PRID_IMP_BCM4710:
14530 +                       c->cputype = CPU_BCM4710;
14531 +                       c->isa_level = MIPS_CPU_ISA_M32;
14532 +                       c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
14533 +                                       MIPS_CPU_4KTLB | MIPS_CPU_COUNTER;
14534 +               break;
14535 +       default:
14536 +               c->cputype = CPU_UNKNOWN;
14537 +               break;
14538 +       }
14539 +}
14540 +
14541  __init void cpu_probe(void)
14542  {
14543         struct cpuinfo_mips *c = &current_cpu_data;
14544 @@ -577,7 +599,9 @@
14545         case PRID_COMP_SIBYTE:
14546                 cpu_probe_sibyte(c);
14547                 break;
14548 -
14549 +       case PRID_COMP_BROADCOM:
14550 +               cpu_probe_broadcom(c);
14551 +               break;
14552         case PRID_COMP_SANDCRAFT:
14553                 cpu_probe_sandcraft(c);
14554                 break;
14555 diff -Nur linux-2.6.12.5/arch/mips/kernel/head.S linux-2.6.12.5-brcm/arch/mips/kernel/head.S
14556 --- linux-2.6.12.5/arch/mips/kernel/head.S      2005-08-15 02:20:18.000000000 +0200
14557 +++ linux-2.6.12.5-brcm/arch/mips/kernel/head.S 2005-08-28 11:12:20.539842584 +0200
14558 @@ -122,6 +122,14 @@
14559  #endif
14560         .endm
14561  
14562 +#ifdef CONFIG_BCM4710
14563 +#undef eret
14564 +#define eret nop; nop; eret
14565 +#endif
14566 +
14567 +       j       kernel_entry
14568 +       nop
14569 +
14570         /*
14571          * Reserved space for exception handlers.
14572          * Necessary for machines which link their kernels at KSEG0.
14573 diff -Nur linux-2.6.12.5/arch/mips/kernel/proc.c linux-2.6.12.5-brcm/arch/mips/kernel/proc.c
14574 --- linux-2.6.12.5/arch/mips/kernel/proc.c      2005-08-15 02:20:18.000000000 +0200
14575 +++ linux-2.6.12.5-brcm/arch/mips/kernel/proc.c 2005-08-28 11:12:20.553840456 +0200
14576 @@ -75,7 +75,9 @@
14577         [CPU_VR4133]    "NEC VR4133",
14578         [CPU_VR4181]    "NEC VR4181",
14579         [CPU_VR4181A]   "NEC VR4181A",
14580 -       [CPU_SR71000]   "Sandcraft SR71000"
14581 +       [CPU_SR71000]   "Sandcraft SR71000",
14582 +       [CPU_BCM3302]   "Broadcom BCM3302",
14583 +       [CPU_BCM4710]   "Broadcom BCM4710"
14584  };
14585  
14586  
14587 diff -Nur linux-2.6.12.5/arch/mips/mm/tlbex.c linux-2.6.12.5-brcm/arch/mips/mm/tlbex.c
14588 --- linux-2.6.12.5/arch/mips/mm/tlbex.c 2005-08-15 02:20:18.000000000 +0200
14589 +++ linux-2.6.12.5-brcm/arch/mips/mm/tlbex.c    2005-08-28 11:12:20.587835288 +0200
14590 @@ -851,6 +851,8 @@
14591         case CPU_4KSC:
14592         case CPU_20KC:
14593         case CPU_25KF:
14594 +       case CPU_BCM3302:
14595 +       case CPU_BCM4710:
14596                 tlbw(p);
14597                 break;
14598  
14599 diff -Nur linux-2.6.12.5/arch/mips/pci/Makefile linux-2.6.12.5-brcm/arch/mips/pci/Makefile
14600 --- linux-2.6.12.5/arch/mips/pci/Makefile       2005-08-15 02:20:18.000000000 +0200
14601 +++ linux-2.6.12.5-brcm/arch/mips/pci/Makefile  2005-08-28 16:41:44.565297816 +0200
14602 @@ -18,6 +18,7 @@
14603  obj-$(CONFIG_MIPS_TX3927)      += ops-jmr3927.o
14604  obj-$(CONFIG_PCI_VR41XX)       += ops-vr41xx.o pci-vr41xx.o
14605  obj-$(CONFIG_NEC_CMBVR4133)    += fixup-vr4133.o
14606 +obj-$(CONFIG_BCM947XX)         += ops-sb.o fixup-bcm47xx.o pci-bcm47xx.o
14607  
14608  #
14609  # These are still pretty much in the old state, watch, go blind.
14610 diff -Nur linux-2.6.12.5/arch/mips/pci/fixup-bcm47xx.c linux-2.6.12.5-brcm/arch/mips/pci/fixup-bcm47xx.c
14611 --- linux-2.6.12.5/arch/mips/pci/fixup-bcm47xx.c        1970-01-01 01:00:00.000000000 +0100
14612 +++ linux-2.6.12.5-brcm/arch/mips/pci/fixup-bcm47xx.c   2005-08-28 11:12:20.611831640 +0200
14613 @@ -0,0 +1,23 @@
14614 +#include <linux/init.h>
14615 +#include <linux/pci.h>
14616 +
14617 +/* Do platform specific device initialization at pci_enable_device() time */
14618 +int pcibios_plat_dev_init(struct pci_dev *dev)
14619 +{
14620 +       return 0;
14621 +}
14622 +
14623 +int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
14624 +{
14625 +       u8 irq;
14626 +       
14627 +       if (dev->bus->number == 1)
14628 +               return 2;
14629 +
14630 +       pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
14631 +       return irq + 2;
14632 +}
14633 +
14634 +struct pci_fixup pcibios_fixups[] __initdata = {
14635 +       { 0 }
14636 +};
14637 diff -Nur linux-2.6.12.5/arch/mips/pci/ops-sb.c linux-2.6.12.5-brcm/arch/mips/pci/ops-sb.c
14638 --- linux-2.6.12.5/arch/mips/pci/ops-sb.c       1970-01-01 01:00:00.000000000 +0100
14639 +++ linux-2.6.12.5-brcm/arch/mips/pci/ops-sb.c  2005-08-28 11:12:20.612831488 +0200
14640 @@ -0,0 +1,44 @@
14641 +#include <linux/kernel.h>
14642 +#include <linux/init.h>
14643 +#include <linux/pci.h>
14644 +#include <linux/types.h>
14645 +#include <asm/pci.h>
14646 +
14647 +#include <typedefs.h>
14648 +#include <sbpci.h>
14649 +
14650 +extern void *sbh;
14651 +//extern spinlock_t bcm47xx_sbh_lock;
14652 +
14653 +static int
14654 +sb_pci_read_config(struct pci_bus *bus, unsigned int devfn,
14655 +                    int reg, int size, u32 *val)
14656 +{
14657 +       //unsigned long flags;
14658 +       int ret;
14659 +
14660 +
14661 +       //spin_lock_irqsave(&sbh_lock, flags);
14662 +       ret = sbpci_read_config(sbh, bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), reg, val, size);
14663 +       //spin_unlock_irqrestore(&sbh_lock, flags);
14664 +
14665 +       return ret ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
14666 +}
14667 +
14668 +static int
14669 +sb_pci_write_config(struct pci_bus *bus, unsigned int devfn,
14670 +                     int reg, int size, u32 val)
14671 +{
14672 +//     unsigned long flags;
14673 +       int ret;
14674 +
14675 +//     spin_lock_irqsave(&sbh_lock, flags);
14676 +       ret = sbpci_write_config(sbh, bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), reg, &val, size);
14677 +//     spin_unlock_irqrestore(&sbh_lock, flags);
14678 +       return ret ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
14679 +}
14680 +
14681 +struct pci_ops sb_pci_ops = {
14682 +       .read = sb_pci_read_config,
14683 +       .write = sb_pci_write_config,
14684 +};
14685 diff -Nur linux-2.6.12.5/arch/mips/pci/pci-bcm47xx.c linux-2.6.12.5-brcm/arch/mips/pci/pci-bcm47xx.c
14686 --- linux-2.6.12.5/arch/mips/pci/pci-bcm47xx.c  1970-01-01 01:00:00.000000000 +0100
14687 +++ linux-2.6.12.5-brcm/arch/mips/pci/pci-bcm47xx.c     2005-08-28 11:12:20.612831488 +0200
14688 @@ -0,0 +1,61 @@
14689 +#include <linux/init.h>
14690 +#include <linux/pci.h>
14691 +#include <linux/types.h>
14692 +
14693 +#include <asm/cpu.h>
14694 +#include <asm/io.h>
14695 +
14696 +#include <typedefs.h>
14697 +#include <sbconfig.h>
14698 +
14699 +extern struct pci_ops sb_pci_ops;
14700 +
14701 +static struct resource sb_pci_mem_resource = {
14702 +       .name   = "SB PCI Memory resources",
14703 +       .start  = SB_ENUM_BASE,
14704 +       .end    = SB_ENUM_LIM - 1,
14705 +       .flags  = IORESOURCE_MEM,
14706 +};
14707 +
14708 +static struct resource sb_pci_io_resource = {
14709 +       .name   = "SB PCI I/O resources",
14710 +       .start  = 0x100,
14711 +       .end    = 0x1FF,
14712 +       .flags  = IORESOURCE_IO,
14713 +};
14714 +
14715 +static struct pci_controller bcm47xx_sb_pci_controller = {
14716 +       .pci_ops        = &sb_pci_ops,
14717 +       .mem_resource   = &sb_pci_mem_resource,
14718 +       .io_resource    = &sb_pci_io_resource,
14719 +};
14720 +
14721 +static struct resource ext_pci_mem_resource = {
14722 +       .name   = "Ext PCI Memory resources",
14723 +       .start  = SB_PCI_DMA,
14724 +//     .end    = 0x7FFFFFFF,
14725 +       .end    = 0x40FFFFFF,
14726 +       .flags  = IORESOURCE_MEM,
14727 +};
14728 +
14729 +static struct resource ext_pci_io_resource = {
14730 +       .name   = "Ext PCI I/O resources",
14731 +       .start  = 0x200,
14732 +       .end    = 0x2FF,
14733 +       .flags  = IORESOURCE_IO,
14734 +};
14735 +
14736 +static struct pci_controller bcm47xx_ext_pci_controller = {
14737 +       .pci_ops        = &sb_pci_ops,
14738 +       .mem_resource   = &ext_pci_mem_resource,
14739 +       .io_resource    = &ext_pci_io_resource,
14740 +};
14741 +
14742 +static int __init bcm47xx_pci_init(void)
14743 +{
14744 +       register_pci_controller(&bcm47xx_sb_pci_controller);
14745 +       register_pci_controller(&bcm47xx_ext_pci_controller);
14746 +       return 0;
14747 +}
14748 +
14749 +early_initcall(bcm47xx_pci_init);
14750 diff -Nur linux-2.6.12.5/arch/mips/pci/pci.c linux-2.6.12.5-brcm/arch/mips/pci/pci.c
14751 --- linux-2.6.12.5/arch/mips/pci/pci.c  2005-08-15 02:20:18.000000000 +0200
14752 +++ linux-2.6.12.5-brcm/arch/mips/pci/pci.c     2005-08-28 11:12:20.629828904 +0200
14753 @@ -238,7 +238,8 @@
14754                 if (dev->resource[i].flags & IORESOURCE_IO)
14755                         offset = hose->io_offset;
14756                 else if (dev->resource[i].flags & IORESOURCE_MEM)
14757 -                       offset = hose->mem_offset;
14758 +                       offset = 0x26000000;
14759 +               //      offset = hose->mem_offset;
14760  
14761                 dev->resource[i].start += offset;
14762                 dev->resource[i].end += offset;
14763 diff -Nur linux-2.6.12.5/drivers/mtd/maps/Kconfig linux-2.6.12.5-brcm/drivers/mtd/maps/Kconfig
14764 --- linux-2.6.12.5/drivers/mtd/maps/Kconfig     2005-08-15 02:20:18.000000000 +0200
14765 +++ linux-2.6.12.5-brcm/drivers/mtd/maps/Kconfig        2005-08-28 16:21:23.595930936 +0200
14766 @@ -357,6 +357,12 @@
14767           Mapping for the Flaga digital module. If you don't have one, ignore
14768           this setting.
14769  
14770 +config MTD_BCM47XX
14771 +       tristate "BCM47xx flash device"
14772 +       depends on MIPS && MTD_CFI && BCM947XX
14773 +       help
14774 +         Support for the flash chips on the BCM947xx board.
14775 +         
14776  config MTD_BEECH
14777         tristate "CFI Flash device mapped on IBM 405LP Beech"
14778         depends on MTD_CFI && PPC32 && 40x && BEECH
14779 diff -Nur linux-2.6.12.5/drivers/mtd/maps/Makefile linux-2.6.12.5-brcm/drivers/mtd/maps/Makefile
14780 --- linux-2.6.12.5/drivers/mtd/maps/Makefile    2005-08-15 02:20:18.000000000 +0200
14781 +++ linux-2.6.12.5-brcm/drivers/mtd/maps/Makefile       2005-08-28 11:12:20.666823280 +0200
14782 @@ -31,6 +31,7 @@
14783  obj-$(CONFIG_MTD_PCMCIA)       += pcmciamtd.o
14784  obj-$(CONFIG_MTD_RPXLITE)      += rpxlite.o
14785  obj-$(CONFIG_MTD_TQM8XXL)      += tqm8xxl.o
14786 +obj-$(CONFIG_MTD_BCM47XX)      += bcm47xx-flash.o
14787  obj-$(CONFIG_MTD_SA1100)       += sa1100-flash.o
14788  obj-$(CONFIG_MTD_IPAQ)         += ipaq-flash.o
14789  obj-$(CONFIG_MTD_SBC_GXX)      += sbc_gxx.o
14790 diff -Nur linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c linux-2.6.12.5-brcm/drivers/mtd/maps/bcm47xx-flash.c
14791 --- linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c     1970-01-01 01:00:00.000000000 +0100
14792 +++ linux-2.6.12.5-brcm/drivers/mtd/maps/bcm47xx-flash.c        2005-08-28 17:01:50.948899632 +0200
14793 @@ -0,0 +1,131 @@
14794 +/*
14795 + * Flash mapping for BCM947XX boards
14796 + *
14797 + * Copyright (C) 2001 Broadcom Corporation
14798 + *
14799 + * $Id: bcm47xx-flash.c,v 1.1 2004/10/21 07:18:31 jolt Exp $
14800 + */
14801 +
14802 +#include <linux/init.h>
14803 +#include <linux/module.h>
14804 +#include <linux/types.h>
14805 +#include <linux/kernel.h>
14806 +#include <asm/io.h>
14807 +#include <linux/mtd/mtd.h>
14808 +#include <linux/mtd/map.h>
14809 +#include <linux/mtd/partitions.h>
14810 +#include <linux/config.h>
14811 +
14812 +#define WINDOW_ADDR 0x1c000000
14813 +#define WINDOW_SIZE (0x400000*2)
14814 +#define BUSWIDTH 2
14815 +
14816 +static struct mtd_info *bcm947xx_mtd;
14817 +
14818 +static void bcm947xx_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
14819 +{
14820 +#define MIPS_MEMCPY_ALIGN 4
14821 +       map_word ret;
14822 +       ssize_t transfer;
14823 +       ssize_t done = 0;
14824 +       if ((len >= MIPS_MEMCPY_ALIGN) && (!(from & (MIPS_MEMCPY_ALIGN - 1))) && (!(((unsigned int)to & (MIPS_MEMCPY_ALIGN - 1))))) {
14825 +               done = len & ~(MIPS_MEMCPY_ALIGN - 1);
14826 +               memcpy_fromio(to, map->virt + from, done);
14827 +       }
14828 +       while (done < len) {
14829 +               ret = map->read(map, from + done);
14830 +               transfer = len - done;
14831 +               if (transfer > map->bankwidth)
14832 +                       transfer = map->bankwidth;
14833 +               memcpy((void *)((unsigned long)to + done), &ret.x[0], transfer);
14834 +               done += transfer;
14835 +       }
14836 +}
14837 +
14838 +static struct map_info bcm947xx_map = {
14839 +       name: "Physically mapped flash",
14840 +       size: WINDOW_SIZE,
14841 +       bankwidth: BUSWIDTH,
14842 +       phys: WINDOW_ADDR,
14843 +};
14844 +
14845 +#define SECTORS *64*1024
14846 +
14847 +#ifdef CONFIG_MTD_PARTITIONS
14848 +#if 0
14849 +static struct mtd_partition bcm947xx_parts[] = {
14850 +// 64 - 4 - 14 - 1 = 45 = 8 + 37
14851 +       { name: "pmon", offset: 0, size: 4 SECTORS, mask_flags: MTD_WRITEABLE },
14852 +       { name: "linux", offset: MTDPART_OFS_APPEND, size: 14 SECTORS },
14853 +       { name: "rescue", offset: MTDPART_OFS_APPEND, size: 8 SECTORS },
14854 +       { name: "rootfs", offset: MTDPART_OFS_APPEND, size: 37 SECTORS },
14855 +       { name: "nvram", offset: MTDPART_OFS_APPEND, size: 1 SECTORS, mask_flags: MTD_WRITEABLE },
14856 +};
14857 +#else
14858 +static struct mtd_partition bcm947xx_parts[] = {
14859 +       { name: "cfe",
14860 +           offset:  0,
14861 +           size:  384*1024,
14862 +           mask_flags: MTD_WRITEABLE
14863 +         },
14864 +       { name: "config",
14865 +           offset:  MTDPART_OFS_APPEND,
14866 +           size:  128*1024
14867 +         },
14868 +       { name: "linux",
14869 +           offset:  MTDPART_OFS_APPEND,
14870 +           size:  10*128*1024
14871 +         },
14872 +       { name: "jffs",
14873 +           offset: MTDPART_OFS_APPEND,
14874 +           size: (8*1024*1024)-((384*1024)+(128*1024)+(10*128*1024)+(128*1024)),
14875 +         },
14876 +       { name: "nvram",
14877 +           offset: MTDPART_OFS_APPEND,
14878 +           size: 128*1024,
14879 +           mask_flags: MTD_WRITEABLE
14880 +         },
14881 +};
14882 +#endif
14883 +#endif
14884 +
14885 +int __init init_bcm947xx_map(void)
14886 +{
14887 +       bcm947xx_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
14888 +
14889 +       if (!bcm947xx_map.virt) {
14890 +               printk("Failed to ioremap\n");
14891 +               return -EIO;
14892 +       }
14893 +       simple_map_init(&bcm947xx_map);
14894 +       
14895 +       bcm947xx_map.copy_from = bcm947xx_map_copy_from;
14896 +       
14897 +       if (!(bcm947xx_mtd = do_map_probe("cfi_probe", &bcm947xx_map))) {
14898 +               printk("Failed to do_map_probe\n");
14899 +               iounmap((void *)bcm947xx_map.virt);
14900 +               return -ENXIO;
14901 +       }
14902 +
14903 +       bcm947xx_mtd->owner = THIS_MODULE;
14904 +
14905 +       printk(KERN_NOTICE "flash device: %x at %x\n", bcm947xx_mtd->size, WINDOW_ADDR);
14906 +
14907 +#ifdef CONFIG_MTD_PARTITIONS
14908 +       return add_mtd_partitions(bcm947xx_mtd, bcm947xx_parts, sizeof(bcm947xx_parts)/sizeof(bcm947xx_parts[0]));
14909 +#else
14910 +       return 0;
14911 +#endif
14912 +}
14913 +
14914 +void __exit cleanup_bcm947xx_map(void)
14915 +{
14916 +#ifdef CONFIG_MTD_PARTITIONS
14917 +       del_mtd_partitions(bcm947xx_mtd);
14918 +#endif
14919 +       map_destroy(bcm947xx_mtd);
14920 +       iounmap((void *)bcm947xx_map.virt);
14921 +}
14922 +
14923 +module_init(init_bcm947xx_map);
14924 +module_exit(cleanup_bcm947xx_map);
14925 diff -Nur linux-2.6.12.5/drivers/net/b44.c linux-2.6.12.5-brcm/drivers/net/b44.c
14926 --- linux-2.6.12.5/drivers/net/b44.c    2005-08-15 02:20:18.000000000 +0200
14927 +++ linux-2.6.12.5-brcm/drivers/net/b44.c       2005-08-28 11:12:20.691819480 +0200
14928 @@ -1,7 +1,8 @@
14929 -/* b44.c: Broadcom 4400 device driver.
14930 +/* b44.c: Broadcom 4400/47xx device driver.
14931   *
14932   * Copyright (C) 2002 David S. Miller (davem@redhat.com)
14933 - * Fixed by Pekka Pietikainen (pp@ee.oulu.fi)
14934 + * Copyright (C) 2004 Pekka Pietikainen (pp@ee.oulu.fi)
14935 + * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
14936   *
14937   * Distribute under GPL.
14938   */
14939 @@ -78,7 +79,7 @@
14940         DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
14941  
14942  MODULE_AUTHOR("Florian Schirmer, Pekka Pietikainen, David S. Miller");
14943 -MODULE_DESCRIPTION("Broadcom 4400 10/100 PCI ethernet driver");
14944 +MODULE_DESCRIPTION("Broadcom 4400/47xx 10/100 PCI ethernet driver");
14945  MODULE_LICENSE("GPL");
14946  MODULE_VERSION(DRV_MODULE_VERSION);
14947  
14948 @@ -93,6 +94,8 @@
14949           PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
14950         { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401B1,
14951           PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
14952 +       { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4713,
14953 +         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
14954         { }     /* terminate list with empty entry */
14955  };
14956  
14957 @@ -106,24 +109,13 @@
14958  static void b44_poll_controller(struct net_device *dev);
14959  #endif
14960  
14961 -static inline unsigned long br32(const struct b44 *bp, unsigned long reg)
14962 -{
14963 -       return readl(bp->regs + reg);
14964 -}
14965 -
14966 -static inline void bw32(const struct b44 *bp, 
14967 -                       unsigned long reg, unsigned long val)
14968 -{
14969 -       writel(val, bp->regs + reg);
14970 -}
14971 -
14972  static int b44_wait_bit(struct b44 *bp, unsigned long reg,
14973                         u32 bit, unsigned long timeout, const int clear)
14974  {
14975         unsigned long i;
14976  
14977         for (i = 0; i < timeout; i++) {
14978 -               u32 val = br32(bp, reg);
14979 +               u32 val = br32(reg);
14980  
14981                 if (clear && !(val & bit))
14982                         break;
14983 @@ -154,7 +146,7 @@
14984  
14985  static u32 ssb_get_core_rev(struct b44 *bp)
14986  {
14987 -       return (br32(bp, B44_SBIDHIGH) & SBIDHIGH_RC_MASK);
14988 +       return (br32(B44_SBIDHIGH) & SBIDHIGH_RC_MASK);
14989  }
14990  
14991  static u32 ssb_pci_setup(struct b44 *bp, u32 cores)
14992 @@ -165,13 +157,13 @@
14993         pci_write_config_dword(bp->pdev, SSB_BAR0_WIN, BCM4400_PCI_CORE_ADDR);
14994         pci_rev = ssb_get_core_rev(bp);
14995  
14996 -       val = br32(bp, B44_SBINTVEC);
14997 +       val = br32(B44_SBINTVEC);
14998         val |= cores;
14999 -       bw32(bp, B44_SBINTVEC, val);
15000 +       bw32(B44_SBINTVEC, val);
15001  
15002 -       val = br32(bp, SSB_PCI_TRANS_2);
15003 +       val = br32(SSB_PCI_TRANS_2);
15004         val |= SSB_PCI_PREF | SSB_PCI_BURST;
15005 -       bw32(bp, SSB_PCI_TRANS_2, val);
15006 +       bw32(SSB_PCI_TRANS_2, val);
15007  
15008         pci_write_config_dword(bp->pdev, SSB_BAR0_WIN, bar_orig);
15009  
15010 @@ -180,18 +172,18 @@
15011  
15012  static void ssb_core_disable(struct b44 *bp)
15013  {
15014 -       if (br32(bp, B44_SBTMSLOW) & SBTMSLOW_RESET)
15015 +       if (br32(B44_SBTMSLOW) & SBTMSLOW_RESET)
15016                 return;
15017  
15018 -       bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_CLOCK));
15019 +       bw32(B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_CLOCK));
15020         b44_wait_bit(bp, B44_SBTMSLOW, SBTMSLOW_REJECT, 100000, 0);
15021         b44_wait_bit(bp, B44_SBTMSHIGH, SBTMSHIGH_BUSY, 100000, 1);
15022 -       bw32(bp, B44_SBTMSLOW, (SBTMSLOW_FGC | SBTMSLOW_CLOCK |
15023 +       bw32(B44_SBTMSLOW, (SBTMSLOW_FGC | SBTMSLOW_CLOCK |
15024                             SBTMSLOW_REJECT | SBTMSLOW_RESET));
15025 -       br32(bp, B44_SBTMSLOW);
15026 +       br32(B44_SBTMSLOW);
15027         udelay(1);
15028 -       bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_RESET));
15029 -       br32(bp, B44_SBTMSLOW);
15030 +       bw32(B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_RESET));
15031 +       br32(B44_SBTMSLOW);
15032         udelay(1);
15033  }
15034  
15035 @@ -200,58 +192,65 @@
15036         u32 val;
15037  
15038         ssb_core_disable(bp);
15039 -       bw32(bp, B44_SBTMSLOW, (SBTMSLOW_RESET | SBTMSLOW_CLOCK | SBTMSLOW_FGC));
15040 -       br32(bp, B44_SBTMSLOW);
15041 +       bw32(B44_SBTMSLOW, (SBTMSLOW_RESET | SBTMSLOW_CLOCK | SBTMSLOW_FGC));
15042 +       br32(B44_SBTMSLOW);
15043         udelay(1);
15044  
15045         /* Clear SERR if set, this is a hw bug workaround.  */
15046 -       if (br32(bp, B44_SBTMSHIGH) & SBTMSHIGH_SERR)
15047 -               bw32(bp, B44_SBTMSHIGH, 0);
15048 +       if (br32(B44_SBTMSHIGH) & SBTMSHIGH_SERR)
15049 +               bw32(B44_SBTMSHIGH, 0);
15050  
15051 -       val = br32(bp, B44_SBIMSTATE);
15052 +       val = br32(B44_SBIMSTATE);
15053         if (val & (SBIMSTATE_IBE | SBIMSTATE_TO))
15054 -               bw32(bp, B44_SBIMSTATE, val & ~(SBIMSTATE_IBE | SBIMSTATE_TO));
15055 +               bw32(B44_SBIMSTATE, val & ~(SBIMSTATE_IBE | SBIMSTATE_TO));
15056  
15057 -       bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK | SBTMSLOW_FGC));
15058 -       br32(bp, B44_SBTMSLOW);
15059 +       bw32(B44_SBTMSLOW, (SBTMSLOW_CLOCK | SBTMSLOW_FGC));
15060 +       br32(B44_SBTMSLOW);
15061         udelay(1);
15062  
15063 -       bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK));
15064 -       br32(bp, B44_SBTMSLOW);
15065 +       bw32(B44_SBTMSLOW, (SBTMSLOW_CLOCK));
15066 +       br32(B44_SBTMSLOW);
15067         udelay(1);
15068  }
15069  
15070 +static int b44_4713_instance;
15071 +
15072  static int ssb_core_unit(struct b44 *bp)
15073  {
15074 -#if 0
15075 -       u32 val = br32(bp, B44_SBADMATCH0);
15076 -       u32 base;
15077 -
15078 -       type = val & SBADMATCH0_TYPE_MASK;
15079 -       switch (type) {
15080 -       case 0:
15081 -               base = val & SBADMATCH0_BS0_MASK;
15082 -               break;
15083 -
15084 -       case 1:
15085 -               base = val & SBADMATCH0_BS1_MASK;
15086 -               break;
15087 -
15088 -       case 2:
15089 -       default:
15090 -               base = val & SBADMATCH0_BS2_MASK;
15091 -               break;
15092 -       };
15093 -#endif
15094 -       return 0;
15095 +       if (bp->pdev->device == PCI_DEVICE_ID_BCM4713)
15096 +               return b44_4713_instance++;
15097 +       else
15098 +               return 0;
15099  }
15100  
15101  static int ssb_is_core_up(struct b44 *bp)
15102  {
15103 -       return ((br32(bp, B44_SBTMSLOW) & (SBTMSLOW_RESET | SBTMSLOW_REJECT | SBTMSLOW_CLOCK))
15104 +       return ((br32(B44_SBTMSLOW) & (SBTMSLOW_RESET | SBTMSLOW_REJECT | SBTMSLOW_CLOCK))
15105                 == SBTMSLOW_CLOCK);
15106  }
15107  
15108 +static void __b44_cam_read(struct b44 *bp, unsigned char *data, int index)
15109 +{
15110 +       u32 val;
15111 +
15112 +       bw32(B44_CAM_CTRL, (CAM_CTRL_READ |
15113 +                           (index << CAM_CTRL_INDEX_SHIFT)));
15114 +
15115 +       b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1);  
15116 +
15117 +       val = br32(B44_CAM_DATA_LO);
15118 +
15119 +       data[2] = (val >> 24) & 0xFF;
15120 +       data[3] = (val >> 16) & 0xFF;
15121 +       data[4] = (val >> 8) & 0xFF;
15122 +       data[5] = (val >> 0) & 0xFF;
15123 +
15124 +       val = br32(B44_CAM_DATA_HI);
15125 +       
15126 +       data[0] = (val >> 8) & 0xFF;
15127 +       data[1] = (val >> 0) & 0xFF;
15128 +}
15129 +
15130  static void __b44_cam_write(struct b44 *bp, unsigned char *data, int index)
15131  {
15132         u32 val;
15133 @@ -260,19 +259,19 @@
15134         val |= ((u32) data[3]) << 16;
15135         val |= ((u32) data[4]) <<  8;
15136         val |= ((u32) data[5]) <<  0;
15137 -       bw32(bp, B44_CAM_DATA_LO, val);
15138 +       bw32(B44_CAM_DATA_LO, val);
15139         val = (CAM_DATA_HI_VALID | 
15140                (((u32) data[0]) << 8) |
15141                (((u32) data[1]) << 0));
15142 -       bw32(bp, B44_CAM_DATA_HI, val);
15143 -       bw32(bp, B44_CAM_CTRL, (CAM_CTRL_WRITE |
15144 +       bw32(B44_CAM_DATA_HI, val);
15145 +       bw32(B44_CAM_CTRL, (CAM_CTRL_WRITE |
15146                             (index << CAM_CTRL_INDEX_SHIFT)));
15147         b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1);  
15148  }
15149  
15150  static inline void __b44_disable_ints(struct b44 *bp)
15151  {
15152 -       bw32(bp, B44_IMASK, 0);
15153 +       bw32(B44_IMASK, 0);
15154  }
15155  
15156  static void b44_disable_ints(struct b44 *bp)
15157 @@ -280,34 +279,40 @@
15158         __b44_disable_ints(bp);
15159  
15160         /* Flush posted writes. */
15161 -       br32(bp, B44_IMASK);
15162 +       br32(B44_IMASK);
15163  }
15164  
15165  static void b44_enable_ints(struct b44 *bp)
15166  {
15167 -       bw32(bp, B44_IMASK, bp->imask);
15168 +       bw32(B44_IMASK, bp->imask);
15169  }
15170  
15171  static int b44_readphy(struct b44 *bp, int reg, u32 *val)
15172  {
15173         int err;
15174  
15175 -       bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII);
15176 -       bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START |
15177 +       if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
15178 +               return 0;
15179 +
15180 +       bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
15181 +       bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
15182                              (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) |
15183                              (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
15184                              (reg << MDIO_DATA_RA_SHIFT) |
15185                              (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT)));
15186         err = b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
15187 -       *val = br32(bp, B44_MDIO_DATA) & MDIO_DATA_DATA;
15188 +       *val = br32(B44_MDIO_DATA) & MDIO_DATA_DATA;
15189  
15190         return err;
15191  }
15192  
15193  static int b44_writephy(struct b44 *bp, int reg, u32 val)
15194  {
15195 -       bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII);
15196 -       bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START |
15197 +       if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
15198 +               return 0;
15199 +
15200 +       bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
15201 +       bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
15202                              (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) |
15203                              (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
15204                              (reg << MDIO_DATA_RA_SHIFT) |
15205 @@ -344,6 +349,9 @@
15206         u32 val;
15207         int err;
15208  
15209 +       if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
15210 +               return 0;
15211 +
15212         err = b44_writephy(bp, MII_BMCR, BMCR_RESET);
15213         if (err)
15214                 return err;
15215 @@ -367,20 +375,20 @@
15216         bp->flags &= ~(B44_FLAG_TX_PAUSE | B44_FLAG_RX_PAUSE);
15217         bp->flags |= pause_flags;
15218  
15219 -       val = br32(bp, B44_RXCONFIG);
15220 +       val = br32(B44_RXCONFIG);
15221         if (pause_flags & B44_FLAG_RX_PAUSE)
15222                 val |= RXCONFIG_FLOW;
15223         else
15224                 val &= ~RXCONFIG_FLOW;
15225 -       bw32(bp, B44_RXCONFIG, val);
15226 +       bw32(B44_RXCONFIG, val);
15227  
15228 -       val = br32(bp, B44_MAC_FLOW);
15229 +       val = br32(B44_MAC_FLOW);
15230         if (pause_flags & B44_FLAG_TX_PAUSE)
15231                 val |= (MAC_FLOW_PAUSE_ENAB |
15232                         (0xc0 & MAC_FLOW_RX_HI_WATER));
15233         else
15234                 val &= ~MAC_FLOW_PAUSE_ENAB;
15235 -       bw32(bp, B44_MAC_FLOW, val);
15236 +       bw32(B44_MAC_FLOW, val);
15237  }
15238  
15239  static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote)
15240 @@ -414,6 +422,9 @@
15241         u32 val;
15242         int err;
15243  
15244 +       if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
15245 +               return 0;
15246 +
15247         if ((err = b44_readphy(bp, B44_MII_ALEDCTRL, &val)) != 0)
15248                 goto out;
15249         if ((err = b44_writephy(bp, B44_MII_ALEDCTRL,
15250 @@ -476,11 +487,11 @@
15251  
15252         val = &bp->hw_stats.tx_good_octets;
15253         for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) {
15254 -               *val++ += br32(bp, reg);
15255 +               *val++ += br32(reg);
15256         }
15257         val = &bp->hw_stats.rx_good_octets;
15258         for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) {
15259 -               *val++ += br32(bp, reg);
15260 +               *val++ += br32(reg);
15261         }
15262  }
15263  
15264 @@ -506,6 +517,19 @@
15265  {
15266         u32 bmsr, aux;
15267  
15268 +       if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) {
15269 +               bp->flags |= B44_FLAG_100_BASE_T;
15270 +               bp->flags |= B44_FLAG_FULL_DUPLEX;
15271 +               if (!netif_carrier_ok(bp->dev)) {
15272 +                       u32 val = br32(B44_TX_CTRL);
15273 +                       val |= TX_CTRL_DUPLEX;
15274 +                       bw32(B44_TX_CTRL, val);
15275 +                       netif_carrier_on(bp->dev);
15276 +                       b44_link_report(bp);
15277 +               }
15278 +               return;
15279 +       }
15280 +
15281         if (!b44_readphy(bp, MII_BMSR, &bmsr) &&
15282             !b44_readphy(bp, B44_MII_AUXCTRL, &aux) &&
15283             (bmsr != 0xffff)) {
15284 @@ -520,14 +544,14 @@
15285  
15286                 if (!netif_carrier_ok(bp->dev) &&
15287                     (bmsr & BMSR_LSTATUS)) {
15288 -                       u32 val = br32(bp, B44_TX_CTRL);
15289 +                       u32 val = br32(B44_TX_CTRL);
15290                         u32 local_adv, remote_adv;
15291  
15292                         if (bp->flags & B44_FLAG_FULL_DUPLEX)
15293                                 val |= TX_CTRL_DUPLEX;
15294                         else
15295                                 val &= ~TX_CTRL_DUPLEX;
15296 -                       bw32(bp, B44_TX_CTRL, val);
15297 +                       bw32(B44_TX_CTRL, val);
15298  
15299                         if (!(bp->flags & B44_FLAG_FORCE_LINK) &&
15300                             !b44_readphy(bp, MII_ADVERTISE, &local_adv) &&
15301 @@ -572,7 +596,7 @@
15302  {
15303         u32 cur, cons;
15304  
15305 -       cur  = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK;
15306 +       cur  = br32(B44_DMATX_STAT) & DMATX_STAT_CDMASK;
15307         cur /= sizeof(struct dma_desc);
15308  
15309         /* XXX needs updating when NETIF_F_SG is supported */
15310 @@ -596,7 +620,7 @@
15311             TX_BUFFS_AVAIL(bp) > B44_TX_WAKEUP_THRESH)
15312                 netif_wake_queue(bp->dev);
15313  
15314 -       bw32(bp, B44_GPTIMER, 0);
15315 +       bw32(B44_GPTIMER, 0);
15316  }
15317  
15318  /* Works like this.  This chip writes a 'struct rx_header" 30 bytes
15319 @@ -713,7 +737,7 @@
15320         u32 cons, prod;
15321  
15322         received = 0;
15323 -       prod  = br32(bp, B44_DMARX_STAT) & DMARX_STAT_CDMASK;
15324 +       prod  = br32(B44_DMARX_STAT) & DMARX_STAT_CDMASK;
15325         prod /= sizeof(struct dma_desc);
15326         cons = bp->rx_cons;
15327  
15328 @@ -792,7 +816,7 @@
15329         }
15330  
15331         bp->rx_cons = cons;
15332 -       bw32(bp, B44_DMARX_PTR, cons * sizeof(struct dma_desc));
15333 +       bw32(B44_DMARX_PTR, cons * sizeof(struct dma_desc));
15334  
15335         return received;
15336  }
15337 @@ -856,8 +880,8 @@
15338  
15339         spin_lock_irqsave(&bp->lock, flags);
15340  
15341 -       istat = br32(bp, B44_ISTAT);
15342 -       imask = br32(bp, B44_IMASK);
15343 +       istat = br32(B44_ISTAT);
15344 +       imask = br32(B44_IMASK);
15345  
15346         /* ??? What the fuck is the purpose of the interrupt mask
15347          * ??? register if we have to mask it out by hand anyways?
15348 @@ -877,8 +901,8 @@
15349                                dev->name);
15350                 }
15351  
15352 -               bw32(bp, B44_ISTAT, istat);
15353 -               br32(bp, B44_ISTAT);
15354 +               bw32(B44_ISTAT, istat);
15355 +               br32(B44_ISTAT);
15356         }
15357         spin_unlock_irqrestore(&bp->lock, flags);
15358         return IRQ_RETVAL(handled);
15359 @@ -965,11 +989,11 @@
15360  
15361         wmb();
15362  
15363 -       bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc));
15364 +       bw32(B44_DMATX_PTR, entry * sizeof(struct dma_desc));
15365         if (bp->flags & B44_FLAG_BUGGY_TXPTR)
15366 -               bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc));
15367 +               bw32(B44_DMATX_PTR, entry * sizeof(struct dma_desc));
15368         if (bp->flags & B44_FLAG_REORDER_BUG)
15369 -               br32(bp, B44_DMATX_PTR);
15370 +               br32(B44_DMATX_PTR);
15371  
15372         if (TX_BUFFS_AVAIL(bp) < 1)
15373                 netif_stop_queue(dev);
15374 @@ -1137,32 +1161,35 @@
15375  {
15376         unsigned long reg;
15377  
15378 -       bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
15379 +       bw32(B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
15380         for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL)
15381 -               br32(bp, reg);
15382 +               br32(reg);
15383         for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL)
15384 -               br32(bp, reg);
15385 +               br32(reg);
15386  }
15387  
15388  /* bp->lock is held. */
15389  static void b44_chip_reset(struct b44 *bp)
15390  {
15391 +       unsigned int sb_clock;
15392 +
15393         if (ssb_is_core_up(bp)) {
15394 -               bw32(bp, B44_RCV_LAZY, 0);
15395 -               bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE);
15396 +               bw32(B44_RCV_LAZY, 0);
15397 +               bw32(B44_ENET_CTRL, ENET_CTRL_DISABLE);
15398                 b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 100, 1);
15399 -               bw32(bp, B44_DMATX_CTRL, 0);
15400 +               bw32(B44_DMATX_CTRL, 0);
15401                 bp->tx_prod = bp->tx_cons = 0;
15402 -               if (br32(bp, B44_DMARX_STAT) & DMARX_STAT_EMASK) {
15403 +               if (br32(B44_DMARX_STAT) & DMARX_STAT_EMASK) {
15404                         b44_wait_bit(bp, B44_DMARX_STAT, DMARX_STAT_SIDLE,
15405                                      100, 0);
15406                 }
15407 -               bw32(bp, B44_DMARX_CTRL, 0);
15408 +               bw32(B44_DMARX_CTRL, 0);
15409                 bp->rx_prod = bp->rx_cons = 0;
15410         } else {
15411 -               ssb_pci_setup(bp, (bp->core_unit == 0 ?
15412 -                                  SBINTVEC_ENET0 :
15413 -                                  SBINTVEC_ENET1));
15414 +               if (bp->pdev->device != PCI_DEVICE_ID_BCM4713)
15415 +                       ssb_pci_setup(bp, (bp->core_unit == 0 ?
15416 +                                          SBINTVEC_ENET0 :
15417 +                                          SBINTVEC_ENET1));
15418         }
15419  
15420         ssb_core_reset(bp);
15421 @@ -1170,20 +1197,26 @@
15422         b44_clear_stats(bp);
15423  
15424         /* Make PHY accessible. */
15425 -       bw32(bp, B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
15426 -                            (0x0d & MDIO_CTRL_MAXF_MASK)));
15427 -       br32(bp, B44_MDIO_CTRL);
15428 -
15429 -       if (!(br32(bp, B44_DEVCTRL) & DEVCTRL_IPP)) {
15430 -               bw32(bp, B44_ENET_CTRL, ENET_CTRL_EPSEL);
15431 -               br32(bp, B44_ENET_CTRL);
15432 +       if (bp->pdev->device == PCI_DEVICE_ID_BCM4713)
15433 +               sb_clock = 100000000; /* 100 MHz */
15434 +       else
15435 +               sb_clock = 62500000; /* 62.5 MHz */
15436 +
15437 +       bw32(B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
15438 +                            (((sb_clock + (B44_MDC_RATIO / 2)) / B44_MDC_RATIO)
15439 +                            & MDIO_CTRL_MAXF_MASK)));
15440 +       br32(B44_MDIO_CTRL);
15441 +
15442 +       if (!(br32(B44_DEVCTRL) & DEVCTRL_IPP)) {
15443 +               bw32(B44_ENET_CTRL, ENET_CTRL_EPSEL);
15444 +               br32(B44_ENET_CTRL);
15445                 bp->flags &= ~B44_FLAG_INTERNAL_PHY;
15446         } else {
15447 -               u32 val = br32(bp, B44_DEVCTRL);
15448 +               u32 val = br32(B44_DEVCTRL);
15449  
15450                 if (val & DEVCTRL_EPR) {
15451 -                       bw32(bp, B44_DEVCTRL, (val & ~DEVCTRL_EPR));
15452 -                       br32(bp, B44_DEVCTRL);
15453 +                       bw32(B44_DEVCTRL, (val & ~DEVCTRL_EPR));
15454 +                       br32(B44_DEVCTRL);
15455                         udelay(100);
15456                 }
15457                 bp->flags |= B44_FLAG_INTERNAL_PHY;
15458 @@ -1200,13 +1233,13 @@
15459  /* bp->lock is held. */
15460  static void __b44_set_mac_addr(struct b44 *bp)
15461  {
15462 -       bw32(bp, B44_CAM_CTRL, 0);
15463 +       bw32(B44_CAM_CTRL, 0);
15464         if (!(bp->dev->flags & IFF_PROMISC)) {
15465                 u32 val;
15466  
15467                 __b44_cam_write(bp, bp->dev->dev_addr, 0);
15468 -               val = br32(bp, B44_CAM_CTRL);
15469 -               bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
15470 +               val = br32(B44_CAM_CTRL);
15471 +               bw32(B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
15472         }
15473  }
15474  
15475 @@ -1240,30 +1273,30 @@
15476         b44_setup_phy(bp);
15477  
15478         /* Enable CRC32, set proper LED modes and power on PHY */
15479 -       bw32(bp, B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL);
15480 -       bw32(bp, B44_RCV_LAZY, (1 << RCV_LAZY_FC_SHIFT));
15481 +       bw32(B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL);
15482 +       bw32(B44_RCV_LAZY, (1 << RCV_LAZY_FC_SHIFT));
15483  
15484         /* This sets the MAC address too.  */
15485         __b44_set_rx_mode(bp->dev);
15486  
15487         /* MTU + eth header + possible VLAN tag + struct rx_header */
15488 -       bw32(bp, B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
15489 -       bw32(bp, B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
15490 +       bw32(B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
15491 +       bw32(B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
15492  
15493 -       bw32(bp, B44_TX_WMARK, 56); /* XXX magic */
15494 -       bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
15495 -       bw32(bp, B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset);
15496 -       bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
15497 +       bw32(B44_TX_WMARK, 56); /* XXX magic */
15498 +       bw32(B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
15499 +       bw32(B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset);
15500 +       bw32(B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
15501                               (bp->rx_offset << DMARX_CTRL_ROSHIFT)));
15502 -       bw32(bp, B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
15503 +       bw32(B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
15504  
15505 -       bw32(bp, B44_DMARX_PTR, bp->rx_pending);
15506 +       bw32(B44_DMARX_PTR, bp->rx_pending);
15507         bp->rx_prod = bp->rx_pending;   
15508  
15509 -       bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
15510 +       bw32(B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
15511  
15512 -       val = br32(bp, B44_ENET_CTRL);
15513 -       bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
15514 +       val = br32(B44_ENET_CTRL);
15515 +       bw32(B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
15516  }
15517  
15518  static int b44_open(struct net_device *dev)
15519 @@ -1416,11 +1449,11 @@
15520         int i=0;
15521         unsigned char zero[6] = {0,0,0,0,0,0};
15522  
15523 -       val = br32(bp, B44_RXCONFIG);
15524 +       val = br32(B44_RXCONFIG);
15525         val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI);
15526         if (dev->flags & IFF_PROMISC) {
15527                 val |= RXCONFIG_PROMISC;
15528 -               bw32(bp, B44_RXCONFIG, val);
15529 +               bw32(B44_RXCONFIG, val);
15530         } else {
15531                 __b44_set_mac_addr(bp);
15532  
15533 @@ -1432,9 +1465,9 @@
15534                 for(;i<64;i++) {
15535                         __b44_cam_write(bp, zero, i);                   
15536                 }
15537 -               bw32(bp, B44_RXCONFIG, val);
15538 -               val = br32(bp, B44_CAM_CTRL);
15539 -               bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
15540 +               bw32(B44_RXCONFIG, val);
15541 +               val = br32(B44_CAM_CTRL);
15542 +               bw32(B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
15543         }
15544  }
15545  
15546 @@ -1704,19 +1737,41 @@
15547  {
15548         u8 eeprom[128];
15549         int err;
15550 +       unsigned long flags;
15551  
15552 -       err = b44_read_eeprom(bp, &eeprom[0]);
15553 -       if (err)
15554 -               goto out;
15555 -
15556 -       bp->dev->dev_addr[0] = eeprom[79];
15557 -       bp->dev->dev_addr[1] = eeprom[78];
15558 -       bp->dev->dev_addr[2] = eeprom[81];
15559 -       bp->dev->dev_addr[3] = eeprom[80];
15560 -       bp->dev->dev_addr[4] = eeprom[83];
15561 -       bp->dev->dev_addr[5] = eeprom[82];
15562 -
15563 -       bp->phy_addr = eeprom[90] & 0x1f;
15564 +       if (bp->pdev->device == PCI_DEVICE_ID_BCM4713) {
15565 +               /* 
15566 +                * BCM47xx boards don't have a EEPROM. The MAC is stored in
15567 +                * a NVRAM area somewhere in the flash memory. As we don't
15568 +                * know the location and/or the format of the NVRAM area
15569 +                * here, we simply rely on the bootloader to write the
15570 +                * MAC into the CAM.
15571 +                */
15572 +               spin_lock_irqsave(&bp->lock, flags);
15573 +               __b44_cam_read(bp, bp->dev->dev_addr, 0);
15574 +               spin_unlock_irqrestore(&bp->lock, flags);
15575 +
15576 +               /* 
15577 +                * BCM47xx boards don't have a PHY. Usually there is a switch
15578 +                * chip with multiple PHYs connected to the PHY port.
15579 +                */
15580 +               bp->phy_addr = B44_PHY_ADDR_NO_PHY;
15581 +               bp->dma_offset = 0;
15582 +       } else {
15583 +               err = b44_read_eeprom(bp, &eeprom[0]);
15584 +               if (err)
15585 +                       return err;
15586 +
15587 +               bp->dev->dev_addr[0] = eeprom[79];
15588 +               bp->dev->dev_addr[1] = eeprom[78];
15589 +               bp->dev->dev_addr[2] = eeprom[81];
15590 +               bp->dev->dev_addr[3] = eeprom[80];
15591 +               bp->dev->dev_addr[4] = eeprom[83];
15592 +               bp->dev->dev_addr[5] = eeprom[82];
15593 +
15594 +               bp->phy_addr = eeprom[90] & 0x1f;
15595 +               bp->dma_offset = SB_PCI_DMA;
15596 +       } 
15597  
15598         /* With this, plus the rx_header prepended to the data by the
15599          * hardware, we'll land the ethernet header on a 2-byte boundary.
15600 @@ -1726,13 +1781,12 @@
15601         bp->imask = IMASK_DEF;
15602  
15603         bp->core_unit = ssb_core_unit(bp);
15604 -       bp->dma_offset = SB_PCI_DMA;
15605  
15606         /* XXX - really required? 
15607            bp->flags |= B44_FLAG_BUGGY_TXPTR;
15608           */
15609 -out:
15610 -       return err;
15611 +
15612 +       return 0;
15613  }
15614  
15615  static int __devinit b44_init_one(struct pci_dev *pdev,
15616 @@ -1810,7 +1864,7 @@
15617  
15618         spin_lock_init(&bp->lock);
15619  
15620 -       bp->regs = ioremap(b44reg_base, b44reg_len);
15621 +       bp->regs = (unsigned long) ioremap(b44reg_base, b44reg_len);
15622         if (bp->regs == 0UL) {
15623                 printk(KERN_ERR PFX "Cannot map device registers, "
15624                        "aborting.\n");
15625 @@ -1871,7 +1925,8 @@
15626  
15627         pci_save_state(bp->pdev);
15628  
15629 -       printk(KERN_INFO "%s: Broadcom 4400 10/100BaseT Ethernet ", dev->name);
15630 +       printk(KERN_INFO "%s: Broadcom %s 10/100BaseT Ethernet ", dev->name,
15631 +               (pdev->device == PCI_DEVICE_ID_BCM4713) ? "47xx" : "4400");
15632         for (i = 0; i < 6; i++)
15633                 printk("%2.2x%c", dev->dev_addr[i],
15634                        i == 5 ? '\n' : ':');
15635 @@ -1879,7 +1934,7 @@
15636         return 0;
15637  
15638  err_out_iounmap:
15639 -       iounmap(bp->regs);
15640 +       iounmap((void *) bp->regs);
15641  
15642  err_out_free_dev:
15643         free_netdev(dev);
15644 @@ -1901,7 +1956,7 @@
15645                 struct b44 *bp = netdev_priv(dev);
15646  
15647                 unregister_netdev(dev);
15648 -               iounmap(bp->regs);
15649 +               iounmap((void *) bp->regs);
15650                 free_netdev(dev);
15651                 pci_release_regions(pdev);
15652                 pci_disable_device(pdev);
15653 diff -Nur linux-2.6.12.5/drivers/net/b44.c.orig linux-2.6.12.5-brcm/drivers/net/b44.c.orig
15654 --- linux-2.6.12.5/drivers/net/b44.c.orig       1970-01-01 01:00:00.000000000 +0100
15655 +++ linux-2.6.12.5-brcm/drivers/net/b44.c.orig  2005-08-15 02:20:18.000000000 +0200
15656 @@ -0,0 +1,1978 @@
15657 +/* b44.c: Broadcom 4400 device driver.
15658 + *
15659 + * Copyright (C) 2002 David S. Miller (davem@redhat.com)
15660 + * Fixed by Pekka Pietikainen (pp@ee.oulu.fi)
15661 + *
15662 + * Distribute under GPL.
15663 + */
15664 +
15665 +#include <linux/kernel.h>
15666 +#include <linux/module.h>
15667 +#include <linux/moduleparam.h>
15668 +#include <linux/types.h>
15669 +#include <linux/netdevice.h>
15670 +#include <linux/ethtool.h>
15671 +#include <linux/mii.h>
15672 +#include <linux/if_ether.h>
15673 +#include <linux/etherdevice.h>
15674 +#include <linux/pci.h>
15675 +#include <linux/delay.h>
15676 +#include <linux/init.h>
15677 +#include <linux/version.h>
15678 +
15679 +#include <asm/uaccess.h>
15680 +#include <asm/io.h>
15681 +#include <asm/irq.h>
15682 +
15683 +#include "b44.h"
15684 +
15685 +#define DRV_MODULE_NAME                "b44"
15686 +#define PFX DRV_MODULE_NAME    ": "
15687 +#define DRV_MODULE_VERSION     "0.95"
15688 +#define DRV_MODULE_RELDATE     "Aug 3, 2004"
15689 +
15690 +#define B44_DEF_MSG_ENABLE       \
15691 +       (NETIF_MSG_DRV          | \
15692 +        NETIF_MSG_PROBE        | \
15693 +        NETIF_MSG_LINK         | \
15694 +        NETIF_MSG_TIMER        | \
15695 +        NETIF_MSG_IFDOWN       | \
15696 +        NETIF_MSG_IFUP         | \
15697 +        NETIF_MSG_RX_ERR       | \
15698 +        NETIF_MSG_TX_ERR)
15699 +
15700 +/* length of time before we decide the hardware is borked,
15701 + * and dev->tx_timeout() should be called to fix the problem
15702 + */
15703 +#define B44_TX_TIMEOUT                 (5 * HZ)
15704 +
15705 +/* hardware minimum and maximum for a single frame's data payload */
15706 +#define B44_MIN_MTU                    60
15707 +#define B44_MAX_MTU                    1500
15708 +
15709 +#define B44_RX_RING_SIZE               512
15710 +#define B44_DEF_RX_RING_PENDING                200
15711 +#define B44_RX_RING_BYTES      (sizeof(struct dma_desc) * \
15712 +                                B44_RX_RING_SIZE)
15713 +#define B44_TX_RING_SIZE               512
15714 +#define B44_DEF_TX_RING_PENDING                (B44_TX_RING_SIZE - 1)
15715 +#define B44_TX_RING_BYTES      (sizeof(struct dma_desc) * \
15716 +                                B44_TX_RING_SIZE)
15717 +#define B44_DMA_MASK 0x3fffffff
15718 +
15719 +#define TX_RING_GAP(BP)        \
15720 +       (B44_TX_RING_SIZE - (BP)->tx_pending)
15721 +#define TX_BUFFS_AVAIL(BP)                                             \
15722 +       (((BP)->tx_cons <= (BP)->tx_prod) ?                             \
15723 +         (BP)->tx_cons + (BP)->tx_pending - (BP)->tx_prod :            \
15724 +         (BP)->tx_cons - (BP)->tx_prod - TX_RING_GAP(BP))
15725 +#define NEXT_TX(N)             (((N) + 1) & (B44_TX_RING_SIZE - 1))
15726 +
15727 +#define RX_PKT_BUF_SZ          (1536 + bp->rx_offset + 64)
15728 +#define TX_PKT_BUF_SZ          (B44_MAX_MTU + ETH_HLEN + 8)
15729 +
15730 +/* minimum number of free TX descriptors required to wake up TX process */
15731 +#define B44_TX_WAKEUP_THRESH           (B44_TX_RING_SIZE / 4)
15732 +
15733 +static char version[] __devinitdata =
15734 +       DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
15735 +
15736 +MODULE_AUTHOR("Florian Schirmer, Pekka Pietikainen, David S. Miller");
15737 +MODULE_DESCRIPTION("Broadcom 4400 10/100 PCI ethernet driver");
15738 +MODULE_LICENSE("GPL");
15739 +MODULE_VERSION(DRV_MODULE_VERSION);
15740 +
15741 +static int b44_debug = -1;     /* -1 == use B44_DEF_MSG_ENABLE as value */
15742 +module_param(b44_debug, int, 0);
15743 +MODULE_PARM_DESC(b44_debug, "B44 bitmapped debugging message enable value");
15744 +
15745 +static struct pci_device_id b44_pci_tbl[] = {
15746 +       { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401,
15747 +         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
15748 +       { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401B0,
15749 +         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
15750 +       { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401B1,
15751 +         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
15752 +       { }     /* terminate list with empty entry */
15753 +};
15754 +
15755 +MODULE_DEVICE_TABLE(pci, b44_pci_tbl);
15756 +
15757 +static void b44_halt(struct b44 *);
15758 +static void b44_init_rings(struct b44 *);
15759 +static void b44_init_hw(struct b44 *);
15760 +static int b44_poll(struct net_device *dev, int *budget);
15761 +#ifdef CONFIG_NET_POLL_CONTROLLER
15762 +static void b44_poll_controller(struct net_device *dev);
15763 +#endif
15764 +
15765 +static inline unsigned long br32(const struct b44 *bp, unsigned long reg)
15766 +{
15767 +       return readl(bp->regs + reg);
15768 +}
15769 +
15770 +static inline void bw32(const struct b44 *bp, 
15771 +                       unsigned long reg, unsigned long val)
15772 +{
15773 +       writel(val, bp->regs + reg);
15774 +}
15775 +
15776 +static int b44_wait_bit(struct b44 *bp, unsigned long reg,
15777 +                       u32 bit, unsigned long timeout, const int clear)
15778 +{
15779 +       unsigned long i;
15780 +
15781 +       for (i = 0; i < timeout; i++) {
15782 +               u32 val = br32(bp, reg);
15783 +
15784 +               if (clear && !(val & bit))
15785 +                       break;
15786 +               if (!clear && (val & bit))
15787 +                       break;
15788 +               udelay(10);
15789 +       }
15790 +       if (i == timeout) {
15791 +               printk(KERN_ERR PFX "%s: BUG!  Timeout waiting for bit %08x of register "
15792 +                      "%lx to %s.\n",
15793 +                      bp->dev->name,
15794 +                      bit, reg,
15795 +                      (clear ? "clear" : "set"));
15796 +               return -ENODEV;
15797 +       }
15798 +       return 0;
15799 +}
15800 +
15801 +/* Sonics SiliconBackplane support routines.  ROFL, you should see all the
15802 + * buzz words used on this company's website :-)
15803 + *
15804 + * All of these routines must be invoked with bp->lock held and
15805 + * interrupts disabled.
15806 + */
15807 +
15808 +#define SB_PCI_DMA             0x40000000      /* Client Mode PCI memory access space (1 GB) */
15809 +#define BCM4400_PCI_CORE_ADDR  0x18002000      /* Address of PCI core on BCM4400 cards */
15810 +
15811 +static u32 ssb_get_core_rev(struct b44 *bp)
15812 +{
15813 +       return (br32(bp, B44_SBIDHIGH) & SBIDHIGH_RC_MASK);
15814 +}
15815 +
15816 +static u32 ssb_pci_setup(struct b44 *bp, u32 cores)
15817 +{
15818 +       u32 bar_orig, pci_rev, val;
15819 +
15820 +       pci_read_config_dword(bp->pdev, SSB_BAR0_WIN, &bar_orig);
15821 +       pci_write_config_dword(bp->pdev, SSB_BAR0_WIN, BCM4400_PCI_CORE_ADDR);
15822 +       pci_rev = ssb_get_core_rev(bp);
15823 +
15824 +       val = br32(bp, B44_SBINTVEC);
15825 +       val |= cores;
15826 +       bw32(bp, B44_SBINTVEC, val);
15827 +
15828 +       val = br32(bp, SSB_PCI_TRANS_2);
15829 +       val |= SSB_PCI_PREF | SSB_PCI_BURST;
15830 +       bw32(bp, SSB_PCI_TRANS_2, val);
15831 +
15832 +       pci_write_config_dword(bp->pdev, SSB_BAR0_WIN, bar_orig);
15833 +
15834 +       return pci_rev;
15835 +}
15836 +
15837 +static void ssb_core_disable(struct b44 *bp)
15838 +{
15839 +       if (br32(bp, B44_SBTMSLOW) & SBTMSLOW_RESET)
15840 +               return;
15841 +
15842 +       bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_CLOCK));
15843 +       b44_wait_bit(bp, B44_SBTMSLOW, SBTMSLOW_REJECT, 100000, 0);
15844 +       b44_wait_bit(bp, B44_SBTMSHIGH, SBTMSHIGH_BUSY, 100000, 1);
15845 +       bw32(bp, B44_SBTMSLOW, (SBTMSLOW_FGC | SBTMSLOW_CLOCK |
15846 +                           SBTMSLOW_REJECT | SBTMSLOW_RESET));
15847 +       br32(bp, B44_SBTMSLOW);
15848 +       udelay(1);
15849 +       bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_RESET));
15850 +       br32(bp, B44_SBTMSLOW);
15851 +       udelay(1);
15852 +}
15853 +
15854 +static void ssb_core_reset(struct b44 *bp)
15855 +{
15856 +       u32 val;
15857 +
15858 +       ssb_core_disable(bp);
15859 +       bw32(bp, B44_SBTMSLOW, (SBTMSLOW_RESET | SBTMSLOW_CLOCK | SBTMSLOW_FGC));
15860 +       br32(bp, B44_SBTMSLOW);
15861 +       udelay(1);
15862 +
15863 +       /* Clear SERR if set, this is a hw bug workaround.  */
15864 +       if (br32(bp, B44_SBTMSHIGH) & SBTMSHIGH_SERR)
15865 +               bw32(bp, B44_SBTMSHIGH, 0);
15866 +
15867 +       val = br32(bp, B44_SBIMSTATE);
15868 +       if (val & (SBIMSTATE_IBE | SBIMSTATE_TO))
15869 +               bw32(bp, B44_SBIMSTATE, val & ~(SBIMSTATE_IBE | SBIMSTATE_TO));
15870 +
15871 +       bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK | SBTMSLOW_FGC));
15872 +       br32(bp, B44_SBTMSLOW);
15873 +       udelay(1);
15874 +
15875 +       bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK));
15876 +       br32(bp, B44_SBTMSLOW);
15877 +       udelay(1);
15878 +}
15879 +
15880 +static int ssb_core_unit(struct b44 *bp)
15881 +{
15882 +#if 0
15883 +       u32 val = br32(bp, B44_SBADMATCH0);
15884 +       u32 base;
15885 +
15886 +       type = val & SBADMATCH0_TYPE_MASK;
15887 +       switch (type) {
15888 +       case 0:
15889 +               base = val & SBADMATCH0_BS0_MASK;
15890 +               break;
15891 +
15892 +       case 1:
15893 +               base = val & SBADMATCH0_BS1_MASK;
15894 +               break;
15895 +
15896 +       case 2:
15897 +       default:
15898 +               base = val & SBADMATCH0_BS2_MASK;
15899 +               break;
15900 +       };
15901 +#endif
15902 +       return 0;
15903 +}
15904 +
15905 +static int ssb_is_core_up(struct b44 *bp)
15906 +{
15907 +       return ((br32(bp, B44_SBTMSLOW) & (SBTMSLOW_RESET | SBTMSLOW_REJECT | SBTMSLOW_CLOCK))
15908 +               == SBTMSLOW_CLOCK);
15909 +}
15910 +
15911 +static void __b44_cam_write(struct b44 *bp, unsigned char *data, int index)
15912 +{
15913 +       u32 val;
15914 +
15915 +       val  = ((u32) data[2]) << 24;
15916 +       val |= ((u32) data[3]) << 16;
15917 +       val |= ((u32) data[4]) <<  8;
15918 +       val |= ((u32) data[5]) <<  0;
15919 +       bw32(bp, B44_CAM_DATA_LO, val);
15920 +       val = (CAM_DATA_HI_VALID | 
15921 +              (((u32) data[0]) << 8) |
15922 +              (((u32) data[1]) << 0));
15923 +       bw32(bp, B44_CAM_DATA_HI, val);
15924 +       bw32(bp, B44_CAM_CTRL, (CAM_CTRL_WRITE |
15925 +                           (index << CAM_CTRL_INDEX_SHIFT)));
15926 +       b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1);  
15927 +}
15928 +
15929 +static inline void __b44_disable_ints(struct b44 *bp)
15930 +{
15931 +       bw32(bp, B44_IMASK, 0);
15932 +}
15933 +
15934 +static void b44_disable_ints(struct b44 *bp)
15935 +{
15936 +       __b44_disable_ints(bp);
15937 +
15938 +       /* Flush posted writes. */
15939 +       br32(bp, B44_IMASK);
15940 +}
15941 +
15942 +static void b44_enable_ints(struct b44 *bp)
15943 +{
15944 +       bw32(bp, B44_IMASK, bp->imask);
15945 +}
15946 +
15947 +static int b44_readphy(struct b44 *bp, int reg, u32 *val)
15948 +{
15949 +       int err;
15950 +
15951 +       bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII);
15952 +       bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START |
15953 +                            (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) |
15954 +                            (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
15955 +                            (reg << MDIO_DATA_RA_SHIFT) |
15956 +                            (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT)));
15957 +       err = b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
15958 +       *val = br32(bp, B44_MDIO_DATA) & MDIO_DATA_DATA;
15959 +
15960 +       return err;
15961 +}
15962 +
15963 +static int b44_writephy(struct b44 *bp, int reg, u32 val)
15964 +{
15965 +       bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII);
15966 +       bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START |
15967 +                            (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) |
15968 +                            (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
15969 +                            (reg << MDIO_DATA_RA_SHIFT) |
15970 +                            (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT) |
15971 +                            (val & MDIO_DATA_DATA)));
15972 +       return b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
15973 +}
15974 +
15975 +/* miilib interface */
15976 +/* FIXME FIXME: phy_id is ignored, bp->phy_addr use is unconditional
15977 + * due to code existing before miilib use was added to this driver.
15978 + * Someone should remove this artificial driver limitation in
15979 + * b44_{read,write}phy.  bp->phy_addr itself is fine (and needed).
15980 + */
15981 +static int b44_mii_read(struct net_device *dev, int phy_id, int location)
15982 +{
15983 +       u32 val;
15984 +       struct b44 *bp = netdev_priv(dev);
15985 +       int rc = b44_readphy(bp, location, &val);
15986 +       if (rc)
15987 +               return 0xffffffff;
15988 +       return val;
15989 +}
15990 +
15991 +static void b44_mii_write(struct net_device *dev, int phy_id, int location,
15992 +                        int val)
15993 +{
15994 +       struct b44 *bp = netdev_priv(dev);
15995 +       b44_writephy(bp, location, val);
15996 +}
15997 +
15998 +static int b44_phy_reset(struct b44 *bp)
15999 +{
16000 +       u32 val;
16001 +       int err;
16002 +
16003 +       err = b44_writephy(bp, MII_BMCR, BMCR_RESET);
16004 +       if (err)
16005 +               return err;
16006 +       udelay(100);
16007 +       err = b44_readphy(bp, MII_BMCR, &val);
16008 +       if (!err) {
16009 +               if (val & BMCR_RESET) {
16010 +                       printk(KERN_ERR PFX "%s: PHY Reset would not complete.\n",
16011 +                              bp->dev->name);
16012 +                       err = -ENODEV;
16013 +               }
16014 +       }
16015 +
16016 +       return 0;
16017 +}
16018 +
16019 +static void __b44_set_flow_ctrl(struct b44 *bp, u32 pause_flags)
16020 +{
16021 +       u32 val;
16022 +
16023 +       bp->flags &= ~(B44_FLAG_TX_PAUSE | B44_FLAG_RX_PAUSE);
16024 +       bp->flags |= pause_flags;
16025 +
16026 +       val = br32(bp, B44_RXCONFIG);
16027 +       if (pause_flags & B44_FLAG_RX_PAUSE)
16028 +               val |= RXCONFIG_FLOW;
16029 +       else
16030 +               val &= ~RXCONFIG_FLOW;
16031 +       bw32(bp, B44_RXCONFIG, val);
16032 +
16033 +       val = br32(bp, B44_MAC_FLOW);
16034 +       if (pause_flags & B44_FLAG_TX_PAUSE)
16035 +               val |= (MAC_FLOW_PAUSE_ENAB |
16036 +                       (0xc0 & MAC_FLOW_RX_HI_WATER));
16037 +       else
16038 +               val &= ~MAC_FLOW_PAUSE_ENAB;
16039 +       bw32(bp, B44_MAC_FLOW, val);
16040 +}
16041 +
16042 +static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote)
16043 +{
16044 +       u32 pause_enab = bp->flags & (B44_FLAG_TX_PAUSE |
16045 +                                     B44_FLAG_RX_PAUSE);
16046 +
16047 +       if (local & ADVERTISE_PAUSE_CAP) {
16048 +               if (local & ADVERTISE_PAUSE_ASYM) {
16049 +                       if (remote & LPA_PAUSE_CAP)
16050 +                               pause_enab |= (B44_FLAG_TX_PAUSE |
16051 +                                              B44_FLAG_RX_PAUSE);
16052 +                       else if (remote & LPA_PAUSE_ASYM)
16053 +                               pause_enab |= B44_FLAG_RX_PAUSE;
16054 +               } else {
16055 +                       if (remote & LPA_PAUSE_CAP)
16056 +                               pause_enab |= (B44_FLAG_TX_PAUSE |
16057 +                                              B44_FLAG_RX_PAUSE);
16058 +               }
16059 +       } else if (local & ADVERTISE_PAUSE_ASYM) {
16060 +               if ((remote & LPA_PAUSE_CAP) &&
16061 +                   (remote & LPA_PAUSE_ASYM))
16062 +                       pause_enab |= B44_FLAG_TX_PAUSE;
16063 +       }
16064 +
16065 +       __b44_set_flow_ctrl(bp, pause_enab);
16066 +}
16067 +
16068 +static int b44_setup_phy(struct b44 *bp)
16069 +{
16070 +       u32 val;
16071 +       int err;
16072 +
16073 +       if ((err = b44_readphy(bp, B44_MII_ALEDCTRL, &val)) != 0)
16074 +               goto out;
16075 +       if ((err = b44_writephy(bp, B44_MII_ALEDCTRL,
16076 +                               val & MII_ALEDCTRL_ALLMSK)) != 0)
16077 +               goto out;
16078 +       if ((err = b44_readphy(bp, B44_MII_TLEDCTRL, &val)) != 0)
16079 +               goto out;
16080 +       if ((err = b44_writephy(bp, B44_MII_TLEDCTRL,
16081 +                               val | MII_TLEDCTRL_ENABLE)) != 0)
16082 +               goto out;
16083 +
16084 +       if (!(bp->flags & B44_FLAG_FORCE_LINK)) {
16085 +               u32 adv = ADVERTISE_CSMA;
16086 +
16087 +               if (bp->flags & B44_FLAG_ADV_10HALF)
16088 +                       adv |= ADVERTISE_10HALF;
16089 +               if (bp->flags & B44_FLAG_ADV_10FULL)
16090 +                       adv |= ADVERTISE_10FULL;
16091 +               if (bp->flags & B44_FLAG_ADV_100HALF)
16092 +                       adv |= ADVERTISE_100HALF;
16093 +               if (bp->flags & B44_FLAG_ADV_100FULL)
16094 +                       adv |= ADVERTISE_100FULL;
16095 +
16096 +               if (bp->flags & B44_FLAG_PAUSE_AUTO)
16097 +                       adv |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
16098 +
16099 +               if ((err = b44_writephy(bp, MII_ADVERTISE, adv)) != 0)
16100 +                       goto out;
16101 +               if ((err = b44_writephy(bp, MII_BMCR, (BMCR_ANENABLE |
16102 +                                                      BMCR_ANRESTART))) != 0)
16103 +                       goto out;
16104 +       } else {
16105 +               u32 bmcr;
16106 +
16107 +               if ((err = b44_readphy(bp, MII_BMCR, &bmcr)) != 0)
16108 +                       goto out;
16109 +               bmcr &= ~(BMCR_FULLDPLX | BMCR_ANENABLE | BMCR_SPEED100);
16110 +               if (bp->flags & B44_FLAG_100_BASE_T)
16111 +                       bmcr |= BMCR_SPEED100;
16112 +               if (bp->flags & B44_FLAG_FULL_DUPLEX)
16113 +                       bmcr |= BMCR_FULLDPLX;
16114 +               if ((err = b44_writephy(bp, MII_BMCR, bmcr)) != 0)
16115 +                       goto out;
16116 +
16117 +               /* Since we will not be negotiating there is no safe way
16118 +                * to determine if the link partner supports flow control
16119 +                * or not.  So just disable it completely in this case.
16120 +                */
16121 +               b44_set_flow_ctrl(bp, 0, 0);
16122 +       }
16123 +
16124 +out:
16125 +       return err;
16126 +}
16127 +
16128 +static void b44_stats_update(struct b44 *bp)
16129 +{
16130 +       unsigned long reg;
16131 +       u32 *val;
16132 +
16133 +       val = &bp->hw_stats.tx_good_octets;
16134 +       for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) {
16135 +               *val++ += br32(bp, reg);
16136 +       }
16137 +       val = &bp->hw_stats.rx_good_octets;
16138 +       for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) {
16139 +               *val++ += br32(bp, reg);
16140 +       }
16141 +}
16142 +
16143 +static void b44_link_report(struct b44 *bp)
16144 +{
16145 +       if (!netif_carrier_ok(bp->dev)) {
16146 +               printk(KERN_INFO PFX "%s: Link is down.\n", bp->dev->name);
16147 +       } else {
16148 +               printk(KERN_INFO PFX "%s: Link is up at %d Mbps, %s duplex.\n",
16149 +                      bp->dev->name,
16150 +                      (bp->flags & B44_FLAG_100_BASE_T) ? 100 : 10,
16151 +                      (bp->flags & B44_FLAG_FULL_DUPLEX) ? "full" : "half");
16152 +
16153 +               printk(KERN_INFO PFX "%s: Flow control is %s for TX and "
16154 +                      "%s for RX.\n",
16155 +                      bp->dev->name,
16156 +                      (bp->flags & B44_FLAG_TX_PAUSE) ? "on" : "off",
16157 +                      (bp->flags & B44_FLAG_RX_PAUSE) ? "on" : "off");
16158 +       }
16159 +}
16160 +
16161 +static void b44_check_phy(struct b44 *bp)
16162 +{
16163 +       u32 bmsr, aux;
16164 +
16165 +       if (!b44_readphy(bp, MII_BMSR, &bmsr) &&
16166 +           !b44_readphy(bp, B44_MII_AUXCTRL, &aux) &&
16167 +           (bmsr != 0xffff)) {
16168 +               if (aux & MII_AUXCTRL_SPEED)
16169 +                       bp->flags |= B44_FLAG_100_BASE_T;
16170 +               else
16171 +                       bp->flags &= ~B44_FLAG_100_BASE_T;
16172 +               if (aux & MII_AUXCTRL_DUPLEX)
16173 +                       bp->flags |= B44_FLAG_FULL_DUPLEX;
16174 +               else
16175 +                       bp->flags &= ~B44_FLAG_FULL_DUPLEX;
16176 +
16177 +               if (!netif_carrier_ok(bp->dev) &&
16178 +                   (bmsr & BMSR_LSTATUS)) {
16179 +                       u32 val = br32(bp, B44_TX_CTRL);
16180 +                       u32 local_adv, remote_adv;
16181 +
16182 +                       if (bp->flags & B44_FLAG_FULL_DUPLEX)
16183 +                               val |= TX_CTRL_DUPLEX;
16184 +                       else
16185 +                               val &= ~TX_CTRL_DUPLEX;
16186 +                       bw32(bp, B44_TX_CTRL, val);
16187 +
16188 +                       if (!(bp->flags & B44_FLAG_FORCE_LINK) &&
16189 +                           !b44_readphy(bp, MII_ADVERTISE, &local_adv) &&
16190 +                           !b44_readphy(bp, MII_LPA, &remote_adv))
16191 +                               b44_set_flow_ctrl(bp, local_adv, remote_adv);
16192 +
16193 +                       /* Link now up */
16194 +                       netif_carrier_on(bp->dev);
16195 +                       b44_link_report(bp);
16196 +               } else if (netif_carrier_ok(bp->dev) && !(bmsr & BMSR_LSTATUS)) {
16197 +                       /* Link now down */
16198 +                       netif_carrier_off(bp->dev);
16199 +                       b44_link_report(bp);
16200 +               }
16201 +
16202 +               if (bmsr & BMSR_RFAULT)
16203 +                       printk(KERN_WARNING PFX "%s: Remote fault detected in PHY\n",
16204 +                              bp->dev->name);
16205 +               if (bmsr & BMSR_JCD)
16206 +                       printk(KERN_WARNING PFX "%s: Jabber detected in PHY\n",
16207 +                              bp->dev->name);
16208 +       }
16209 +}
16210 +
16211 +static void b44_timer(unsigned long __opaque)
16212 +{
16213 +       struct b44 *bp = (struct b44 *) __opaque;
16214 +
16215 +       spin_lock_irq(&bp->lock);
16216 +
16217 +       b44_check_phy(bp);
16218 +
16219 +       b44_stats_update(bp);
16220 +
16221 +       spin_unlock_irq(&bp->lock);
16222 +
16223 +       bp->timer.expires = jiffies + HZ;
16224 +       add_timer(&bp->timer);
16225 +}
16226 +
16227 +static void b44_tx(struct b44 *bp)
16228 +{
16229 +       u32 cur, cons;
16230 +
16231 +       cur  = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK;
16232 +       cur /= sizeof(struct dma_desc);
16233 +
16234 +       /* XXX needs updating when NETIF_F_SG is supported */
16235 +       for (cons = bp->tx_cons; cons != cur; cons = NEXT_TX(cons)) {
16236 +               struct ring_info *rp = &bp->tx_buffers[cons];
16237 +               struct sk_buff *skb = rp->skb;
16238 +
16239 +               if (unlikely(skb == NULL))
16240 +                       BUG();
16241 +
16242 +               pci_unmap_single(bp->pdev,
16243 +                                pci_unmap_addr(rp, mapping),
16244 +                                skb->len,
16245 +                                PCI_DMA_TODEVICE);
16246 +               rp->skb = NULL;
16247 +               dev_kfree_skb_irq(skb);
16248 +       }
16249 +
16250 +       bp->tx_cons = cons;
16251 +       if (netif_queue_stopped(bp->dev) &&
16252 +           TX_BUFFS_AVAIL(bp) > B44_TX_WAKEUP_THRESH)
16253 +               netif_wake_queue(bp->dev);
16254 +
16255 +       bw32(bp, B44_GPTIMER, 0);
16256 +}
16257 +
16258 +/* Works like this.  This chip writes a 'struct rx_header" 30 bytes
16259 + * before the DMA address you give it.  So we allocate 30 more bytes
16260 + * for the RX buffer, DMA map all of it, skb_reserve the 30 bytes, then
16261 + * point the chip at 30 bytes past where the rx_header will go.
16262 + */
16263 +static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
16264 +{
16265 +       struct dma_desc *dp;
16266 +       struct ring_info *src_map, *map;
16267 +       struct rx_header *rh;
16268 +       struct sk_buff *skb;
16269 +       dma_addr_t mapping;
16270 +       int dest_idx;
16271 +       u32 ctrl;
16272 +
16273 +       src_map = NULL;
16274 +       if (src_idx >= 0)
16275 +               src_map = &bp->rx_buffers[src_idx];
16276 +       dest_idx = dest_idx_unmasked & (B44_RX_RING_SIZE - 1);
16277 +       map = &bp->rx_buffers[dest_idx];
16278 +       skb = dev_alloc_skb(RX_PKT_BUF_SZ);
16279 +       if (skb == NULL)
16280 +               return -ENOMEM;
16281 +
16282 +       mapping = pci_map_single(bp->pdev, skb->data,
16283 +                                RX_PKT_BUF_SZ,
16284 +                                PCI_DMA_FROMDEVICE);
16285 +
16286 +       /* Hardware bug work-around, the chip is unable to do PCI DMA
16287 +          to/from anything above 1GB :-( */
16288 +       if(mapping+RX_PKT_BUF_SZ > B44_DMA_MASK) {
16289 +               /* Sigh... */
16290 +               pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
16291 +               dev_kfree_skb_any(skb);
16292 +               skb = __dev_alloc_skb(RX_PKT_BUF_SZ,GFP_DMA);
16293 +               if (skb == NULL)
16294 +                       return -ENOMEM;
16295 +               mapping = pci_map_single(bp->pdev, skb->data,
16296 +                                        RX_PKT_BUF_SZ,
16297 +                                        PCI_DMA_FROMDEVICE);
16298 +               if(mapping+RX_PKT_BUF_SZ > B44_DMA_MASK) {
16299 +                       pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
16300 +                       dev_kfree_skb_any(skb);
16301 +                       return -ENOMEM;
16302 +               }
16303 +       }
16304 +
16305 +       skb->dev = bp->dev;
16306 +       skb_reserve(skb, bp->rx_offset);
16307 +
16308 +       rh = (struct rx_header *)
16309 +               (skb->data - bp->rx_offset);
16310 +       rh->len = 0;
16311 +       rh->flags = 0;
16312 +
16313 +       map->skb = skb;
16314 +       pci_unmap_addr_set(map, mapping, mapping);
16315 +
16316 +       if (src_map != NULL)
16317 +               src_map->skb = NULL;
16318 +
16319 +       ctrl  = (DESC_CTRL_LEN & (RX_PKT_BUF_SZ - bp->rx_offset));
16320 +       if (dest_idx == (B44_RX_RING_SIZE - 1))
16321 +               ctrl |= DESC_CTRL_EOT;
16322 +
16323 +       dp = &bp->rx_ring[dest_idx];
16324 +       dp->ctrl = cpu_to_le32(ctrl);
16325 +       dp->addr = cpu_to_le32((u32) mapping + bp->rx_offset + bp->dma_offset);
16326 +
16327 +       return RX_PKT_BUF_SZ;
16328 +}
16329 +
16330 +static void b44_recycle_rx(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
16331 +{
16332 +       struct dma_desc *src_desc, *dest_desc;
16333 +       struct ring_info *src_map, *dest_map;
16334 +       struct rx_header *rh;
16335 +       int dest_idx;
16336 +       u32 ctrl;
16337 +
16338 +       dest_idx = dest_idx_unmasked & (B44_RX_RING_SIZE - 1);
16339 +       dest_desc = &bp->rx_ring[dest_idx];
16340 +       dest_map = &bp->rx_buffers[dest_idx];
16341 +       src_desc = &bp->rx_ring[src_idx];
16342 +       src_map = &bp->rx_buffers[src_idx];
16343 +
16344 +       dest_map->skb = src_map->skb;
16345 +       rh = (struct rx_header *) src_map->skb->data;
16346 +       rh->len = 0;
16347 +       rh->flags = 0;
16348 +       pci_unmap_addr_set(dest_map, mapping,
16349 +                          pci_unmap_addr(src_map, mapping));
16350 +
16351 +       ctrl = src_desc->ctrl;
16352 +       if (dest_idx == (B44_RX_RING_SIZE - 1))
16353 +               ctrl |= cpu_to_le32(DESC_CTRL_EOT);
16354 +       else
16355 +               ctrl &= cpu_to_le32(~DESC_CTRL_EOT);
16356 +
16357 +       dest_desc->ctrl = ctrl;
16358 +       dest_desc->addr = src_desc->addr;
16359 +       src_map->skb = NULL;
16360 +
16361 +       pci_dma_sync_single_for_device(bp->pdev, src_desc->addr,
16362 +                                      RX_PKT_BUF_SZ,
16363 +                                      PCI_DMA_FROMDEVICE);
16364 +}
16365 +
16366 +static int b44_rx(struct b44 *bp, int budget)
16367 +{
16368 +       int received;
16369 +       u32 cons, prod;
16370 +
16371 +       received = 0;
16372 +       prod  = br32(bp, B44_DMARX_STAT) & DMARX_STAT_CDMASK;
16373 +       prod /= sizeof(struct dma_desc);
16374 +       cons = bp->rx_cons;
16375 +
16376 +       while (cons != prod && budget > 0) {
16377 +               struct ring_info *rp = &bp->rx_buffers[cons];
16378 +               struct sk_buff *skb = rp->skb;
16379 +               dma_addr_t map = pci_unmap_addr(rp, mapping);
16380 +               struct rx_header *rh;
16381 +               u16 len;
16382 +
16383 +               pci_dma_sync_single_for_cpu(bp->pdev, map,
16384 +                                           RX_PKT_BUF_SZ,
16385 +                                           PCI_DMA_FROMDEVICE);
16386 +               rh = (struct rx_header *) skb->data;
16387 +               len = cpu_to_le16(rh->len);
16388 +               if ((len > (RX_PKT_BUF_SZ - bp->rx_offset)) ||
16389 +                   (rh->flags & cpu_to_le16(RX_FLAG_ERRORS))) {
16390 +               drop_it:
16391 +                       b44_recycle_rx(bp, cons, bp->rx_prod);
16392 +               drop_it_no_recycle:
16393 +                       bp->stats.rx_dropped++;
16394 +                       goto next_pkt;
16395 +               }
16396 +
16397 +               if (len == 0) {
16398 +                       int i = 0;
16399 +
16400 +                       do {
16401 +                               udelay(2);
16402 +                               barrier();
16403 +                               len = cpu_to_le16(rh->len);
16404 +                       } while (len == 0 && i++ < 5);
16405 +                       if (len == 0)
16406 +                               goto drop_it;
16407 +               }
16408 +
16409 +               /* Omit CRC. */
16410 +               len -= 4;
16411 +
16412 +               if (len > RX_COPY_THRESHOLD) {
16413 +                       int skb_size;
16414 +                       skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod);
16415 +                       if (skb_size < 0)
16416 +                               goto drop_it;
16417 +                       pci_unmap_single(bp->pdev, map,
16418 +                                        skb_size, PCI_DMA_FROMDEVICE);
16419 +                       /* Leave out rx_header */
16420 +                       skb_put(skb, len+bp->rx_offset);
16421 +                       skb_pull(skb,bp->rx_offset);
16422 +               } else {
16423 +                       struct sk_buff *copy_skb;
16424 +
16425 +                       b44_recycle_rx(bp, cons, bp->rx_prod);
16426 +                       copy_skb = dev_alloc_skb(len + 2);
16427 +                       if (copy_skb == NULL)
16428 +                               goto drop_it_no_recycle;
16429 +
16430 +                       copy_skb->dev = bp->dev;
16431 +                       skb_reserve(copy_skb, 2);
16432 +                       skb_put(copy_skb, len);
16433 +                       /* DMA sync done above, copy just the actual packet */
16434 +                       memcpy(copy_skb->data, skb->data+bp->rx_offset, len);
16435 +
16436 +                       skb = copy_skb;
16437 +               }
16438 +               skb->ip_summed = CHECKSUM_NONE;
16439 +               skb->protocol = eth_type_trans(skb, bp->dev);
16440 +               netif_receive_skb(skb);
16441 +               bp->dev->last_rx = jiffies;
16442 +               received++;
16443 +               budget--;
16444 +       next_pkt:
16445 +               bp->rx_prod = (bp->rx_prod + 1) &
16446 +                       (B44_RX_RING_SIZE - 1);
16447 +               cons = (cons + 1) & (B44_RX_RING_SIZE - 1);
16448 +       }
16449 +
16450 +       bp->rx_cons = cons;
16451 +       bw32(bp, B44_DMARX_PTR, cons * sizeof(struct dma_desc));
16452 +
16453 +       return received;
16454 +}
16455 +
16456 +static int b44_poll(struct net_device *netdev, int *budget)
16457 +{
16458 +       struct b44 *bp = netdev_priv(netdev);
16459 +       int done;
16460 +
16461 +       spin_lock_irq(&bp->lock);
16462 +
16463 +       if (bp->istat & (ISTAT_TX | ISTAT_TO)) {
16464 +               /* spin_lock(&bp->tx_lock); */
16465 +               b44_tx(bp);
16466 +               /* spin_unlock(&bp->tx_lock); */
16467 +       }
16468 +       spin_unlock_irq(&bp->lock);
16469 +
16470 +       done = 1;
16471 +       if (bp->istat & ISTAT_RX) {
16472 +               int orig_budget = *budget;
16473 +               int work_done;
16474 +
16475 +               if (orig_budget > netdev->quota)
16476 +                       orig_budget = netdev->quota;
16477 +
16478 +               work_done = b44_rx(bp, orig_budget);
16479 +
16480 +               *budget -= work_done;
16481 +               netdev->quota -= work_done;
16482 +
16483 +               if (work_done >= orig_budget)
16484 +                       done = 0;
16485 +       }
16486 +
16487 +       if (bp->istat & ISTAT_ERRORS) {
16488 +               spin_lock_irq(&bp->lock);
16489 +               b44_halt(bp);
16490 +               b44_init_rings(bp);
16491 +               b44_init_hw(bp);
16492 +               netif_wake_queue(bp->dev);
16493 +               spin_unlock_irq(&bp->lock);
16494 +               done = 1;
16495 +       }
16496 +
16497 +       if (done) {
16498 +               netif_rx_complete(netdev);
16499 +               b44_enable_ints(bp);
16500 +       }
16501 +
16502 +       return (done ? 0 : 1);
16503 +}
16504 +
16505 +static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs)
16506 +{
16507 +       struct net_device *dev = dev_id;
16508 +       struct b44 *bp = netdev_priv(dev);
16509 +       unsigned long flags;
16510 +       u32 istat, imask;
16511 +       int handled = 0;
16512 +
16513 +       spin_lock_irqsave(&bp->lock, flags);
16514 +
16515 +       istat = br32(bp, B44_ISTAT);
16516 +       imask = br32(bp, B44_IMASK);
16517 +
16518 +       /* ??? What the fuck is the purpose of the interrupt mask
16519 +        * ??? register if we have to mask it out by hand anyways?
16520 +        */
16521 +       istat &= imask;
16522 +       if (istat) {
16523 +               handled = 1;
16524 +               if (netif_rx_schedule_prep(dev)) {
16525 +                       /* NOTE: These writes are posted by the readback of
16526 +                        *       the ISTAT register below.
16527 +                        */
16528 +                       bp->istat = istat;
16529 +                       __b44_disable_ints(bp);
16530 +                       __netif_rx_schedule(dev);
16531 +               } else {
16532 +                       printk(KERN_ERR PFX "%s: Error, poll already scheduled\n",
16533 +                              dev->name);
16534 +               }
16535 +
16536 +               bw32(bp, B44_ISTAT, istat);
16537 +               br32(bp, B44_ISTAT);
16538 +       }
16539 +       spin_unlock_irqrestore(&bp->lock, flags);
16540 +       return IRQ_RETVAL(handled);
16541 +}
16542 +
16543 +static void b44_tx_timeout(struct net_device *dev)
16544 +{
16545 +       struct b44 *bp = netdev_priv(dev);
16546 +
16547 +       printk(KERN_ERR PFX "%s: transmit timed out, resetting\n",
16548 +              dev->name);
16549 +
16550 +       spin_lock_irq(&bp->lock);
16551 +
16552 +       b44_halt(bp);
16553 +       b44_init_rings(bp);
16554 +       b44_init_hw(bp);
16555 +
16556 +       spin_unlock_irq(&bp->lock);
16557 +
16558 +       b44_enable_ints(bp);
16559 +
16560 +       netif_wake_queue(dev);
16561 +}
16562 +
16563 +static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
16564 +{
16565 +       struct b44 *bp = netdev_priv(dev);
16566 +       struct sk_buff *bounce_skb;
16567 +       dma_addr_t mapping;
16568 +       u32 len, entry, ctrl;
16569 +
16570 +       len = skb->len;
16571 +       spin_lock_irq(&bp->lock);
16572 +
16573 +       /* This is a hard error, log it. */
16574 +       if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) {
16575 +               netif_stop_queue(dev);
16576 +               spin_unlock_irq(&bp->lock);
16577 +               printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n",
16578 +                      dev->name);
16579 +               return 1;
16580 +       }
16581 +
16582 +       mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE);
16583 +       if(mapping+len > B44_DMA_MASK) {
16584 +               /* Chip can't handle DMA to/from >1GB, use bounce buffer */
16585 +               pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE);
16586 +
16587 +               bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ,
16588 +                                            GFP_ATOMIC|GFP_DMA);
16589 +               if (!bounce_skb)
16590 +                       return NETDEV_TX_BUSY;
16591 +
16592 +               mapping = pci_map_single(bp->pdev, bounce_skb->data,
16593 +                                        len, PCI_DMA_TODEVICE);
16594 +               if(mapping+len > B44_DMA_MASK) {
16595 +                       pci_unmap_single(bp->pdev, mapping,
16596 +                                        len, PCI_DMA_TODEVICE);
16597 +                       dev_kfree_skb_any(bounce_skb);
16598 +                       return NETDEV_TX_BUSY;
16599 +               }
16600 +
16601 +               memcpy(skb_put(bounce_skb, len), skb->data, skb->len);
16602 +               dev_kfree_skb_any(skb);
16603 +               skb = bounce_skb;
16604 +       }
16605 +
16606 +       entry = bp->tx_prod;
16607 +       bp->tx_buffers[entry].skb = skb;
16608 +       pci_unmap_addr_set(&bp->tx_buffers[entry], mapping, mapping);
16609 +
16610 +       ctrl  = (len & DESC_CTRL_LEN);
16611 +       ctrl |= DESC_CTRL_IOC | DESC_CTRL_SOF | DESC_CTRL_EOF;
16612 +       if (entry == (B44_TX_RING_SIZE - 1))
16613 +               ctrl |= DESC_CTRL_EOT;
16614 +
16615 +       bp->tx_ring[entry].ctrl = cpu_to_le32(ctrl);
16616 +       bp->tx_ring[entry].addr = cpu_to_le32((u32) mapping+bp->dma_offset);
16617 +
16618 +       entry = NEXT_TX(entry);
16619 +
16620 +       bp->tx_prod = entry;
16621 +
16622 +       wmb();
16623 +
16624 +       bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc));
16625 +       if (bp->flags & B44_FLAG_BUGGY_TXPTR)
16626 +               bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc));
16627 +       if (bp->flags & B44_FLAG_REORDER_BUG)
16628 +               br32(bp, B44_DMATX_PTR);
16629 +
16630 +       if (TX_BUFFS_AVAIL(bp) < 1)
16631 +               netif_stop_queue(dev);
16632 +
16633 +       spin_unlock_irq(&bp->lock);
16634 +
16635 +       dev->trans_start = jiffies;
16636 +
16637 +       return 0;
16638 +}
16639 +
16640 +static int b44_change_mtu(struct net_device *dev, int new_mtu)
16641 +{
16642 +       struct b44 *bp = netdev_priv(dev);
16643 +
16644 +       if (new_mtu < B44_MIN_MTU || new_mtu > B44_MAX_MTU)
16645 +               return -EINVAL;
16646 +
16647 +       if (!netif_running(dev)) {
16648 +               /* We'll just catch it later when the
16649 +                * device is up'd.
16650 +                */
16651 +               dev->mtu = new_mtu;
16652 +               return 0;
16653 +       }
16654 +
16655 +       spin_lock_irq(&bp->lock);
16656 +       b44_halt(bp);
16657 +       dev->mtu = new_mtu;
16658 +       b44_init_rings(bp);
16659 +       b44_init_hw(bp);
16660 +       spin_unlock_irq(&bp->lock);
16661 +
16662 +       b44_enable_ints(bp);
16663 +       
16664 +       return 0;
16665 +}
16666 +
16667 +/* Free up pending packets in all rx/tx rings.
16668 + *
16669 + * The chip has been shut down and the driver detached from
16670 + * the networking, so no interrupts or new tx packets will
16671 + * end up in the driver.  bp->lock is not held and we are not
16672 + * in an interrupt context and thus may sleep.
16673 + */
16674 +static void b44_free_rings(struct b44 *bp)
16675 +{
16676 +       struct ring_info *rp;
16677 +       int i;
16678 +
16679 +       for (i = 0; i < B44_RX_RING_SIZE; i++) {
16680 +               rp = &bp->rx_buffers[i];
16681 +
16682 +               if (rp->skb == NULL)
16683 +                       continue;
16684 +               pci_unmap_single(bp->pdev,
16685 +                                pci_unmap_addr(rp, mapping),
16686 +                                RX_PKT_BUF_SZ,
16687 +                                PCI_DMA_FROMDEVICE);
16688 +               dev_kfree_skb_any(rp->skb);
16689 +               rp->skb = NULL;
16690 +       }
16691 +
16692 +       /* XXX needs changes once NETIF_F_SG is set... */
16693 +       for (i = 0; i < B44_TX_RING_SIZE; i++) {
16694 +               rp = &bp->tx_buffers[i];
16695 +
16696 +               if (rp->skb == NULL)
16697 +                       continue;
16698 +               pci_unmap_single(bp->pdev,
16699 +                                pci_unmap_addr(rp, mapping),
16700 +                                rp->skb->len,
16701 +                                PCI_DMA_TODEVICE);
16702 +               dev_kfree_skb_any(rp->skb);
16703 +               rp->skb = NULL;
16704 +       }
16705 +}
16706 +
16707 +/* Initialize tx/rx rings for packet processing.
16708 + *
16709 + * The chip has been shut down and the driver detached from
16710 + * the networking, so no interrupts or new tx packets will
16711 + * end up in the driver.  bp->lock is not held and we are not
16712 + * in an interrupt context and thus may sleep.
16713 + */
16714 +static void b44_init_rings(struct b44 *bp)
16715 +{
16716 +       int i;
16717 +
16718 +       b44_free_rings(bp);
16719 +
16720 +       memset(bp->rx_ring, 0, B44_RX_RING_BYTES);
16721 +       memset(bp->tx_ring, 0, B44_TX_RING_BYTES);
16722 +
16723 +       for (i = 0; i < bp->rx_pending; i++) {
16724 +               if (b44_alloc_rx_skb(bp, -1, i) < 0)
16725 +                       break;
16726 +       }
16727 +}
16728 +
16729 +/*
16730 + * Must not be invoked with interrupt sources disabled and
16731 + * the hardware shutdown down.
16732 + */
16733 +static void b44_free_consistent(struct b44 *bp)
16734 +{
16735 +       if (bp->rx_buffers) {
16736 +               kfree(bp->rx_buffers);
16737 +               bp->rx_buffers = NULL;
16738 +       }
16739 +       if (bp->tx_buffers) {
16740 +               kfree(bp->tx_buffers);
16741 +               bp->tx_buffers = NULL;
16742 +       }
16743 +       if (bp->rx_ring) {
16744 +               pci_free_consistent(bp->pdev, DMA_TABLE_BYTES,
16745 +                                   bp->rx_ring, bp->rx_ring_dma);
16746 +               bp->rx_ring = NULL;
16747 +       }
16748 +       if (bp->tx_ring) {
16749 +               pci_free_consistent(bp->pdev, DMA_TABLE_BYTES,
16750 +                                   bp->tx_ring, bp->tx_ring_dma);
16751 +               bp->tx_ring = NULL;
16752 +       }
16753 +}
16754 +
16755 +/*
16756 + * Must not be invoked with interrupt sources disabled and
16757 + * the hardware shutdown down.  Can sleep.
16758 + */
16759 +static int b44_alloc_consistent(struct b44 *bp)
16760 +{
16761 +       int size;
16762 +
16763 +       size  = B44_RX_RING_SIZE * sizeof(struct ring_info);
16764 +       bp->rx_buffers = kmalloc(size, GFP_KERNEL);
16765 +       if (!bp->rx_buffers)
16766 +               goto out_err;
16767 +       memset(bp->rx_buffers, 0, size);
16768 +
16769 +       size = B44_TX_RING_SIZE * sizeof(struct ring_info);
16770 +       bp->tx_buffers = kmalloc(size, GFP_KERNEL);
16771 +       if (!bp->tx_buffers)
16772 +               goto out_err;
16773 +       memset(bp->tx_buffers, 0, size);
16774 +
16775 +       size = DMA_TABLE_BYTES;
16776 +       bp->rx_ring = pci_alloc_consistent(bp->pdev, size, &bp->rx_ring_dma);
16777 +       if (!bp->rx_ring)
16778 +               goto out_err;
16779 +
16780 +       bp->tx_ring = pci_alloc_consistent(bp->pdev, size, &bp->tx_ring_dma);
16781 +       if (!bp->tx_ring)
16782 +               goto out_err;
16783 +
16784 +       return 0;
16785 +
16786 +out_err:
16787 +       b44_free_consistent(bp);
16788 +       return -ENOMEM;
16789 +}
16790 +
16791 +/* bp->lock is held. */
16792 +static void b44_clear_stats(struct b44 *bp)
16793 +{
16794 +       unsigned long reg;
16795 +
16796 +       bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
16797 +       for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL)
16798 +               br32(bp, reg);
16799 +       for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL)
16800 +               br32(bp, reg);
16801 +}
16802 +
16803 +/* bp->lock is held. */
16804 +static void b44_chip_reset(struct b44 *bp)
16805 +{
16806 +       if (ssb_is_core_up(bp)) {
16807 +               bw32(bp, B44_RCV_LAZY, 0);
16808 +               bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE);
16809 +               b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 100, 1);
16810 +               bw32(bp, B44_DMATX_CTRL, 0);
16811 +               bp->tx_prod = bp->tx_cons = 0;
16812 +               if (br32(bp, B44_DMARX_STAT) & DMARX_STAT_EMASK) {
16813 +                       b44_wait_bit(bp, B44_DMARX_STAT, DMARX_STAT_SIDLE,
16814 +                                    100, 0);
16815 +               }
16816 +               bw32(bp, B44_DMARX_CTRL, 0);
16817 +               bp->rx_prod = bp->rx_cons = 0;
16818 +       } else {
16819 +               ssb_pci_setup(bp, (bp->core_unit == 0 ?
16820 +                                  SBINTVEC_ENET0 :
16821 +                                  SBINTVEC_ENET1));
16822 +       }
16823 +
16824 +       ssb_core_reset(bp);
16825 +
16826 +       b44_clear_stats(bp);
16827 +
16828 +       /* Make PHY accessible. */
16829 +       bw32(bp, B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
16830 +                            (0x0d & MDIO_CTRL_MAXF_MASK)));
16831 +       br32(bp, B44_MDIO_CTRL);
16832 +
16833 +       if (!(br32(bp, B44_DEVCTRL) & DEVCTRL_IPP)) {
16834 +               bw32(bp, B44_ENET_CTRL, ENET_CTRL_EPSEL);
16835 +               br32(bp, B44_ENET_CTRL);
16836 +               bp->flags &= ~B44_FLAG_INTERNAL_PHY;
16837 +       } else {
16838 +               u32 val = br32(bp, B44_DEVCTRL);
16839 +
16840 +               if (val & DEVCTRL_EPR) {
16841 +                       bw32(bp, B44_DEVCTRL, (val & ~DEVCTRL_EPR));
16842 +                       br32(bp, B44_DEVCTRL);
16843 +                       udelay(100);
16844 +               }
16845 +               bp->flags |= B44_FLAG_INTERNAL_PHY;
16846 +       }
16847 +}
16848 +
16849 +/* bp->lock is held. */
16850 +static void b44_halt(struct b44 *bp)
16851 +{
16852 +       b44_disable_ints(bp);
16853 +       b44_chip_reset(bp);
16854 +}
16855 +
16856 +/* bp->lock is held. */
16857 +static void __b44_set_mac_addr(struct b44 *bp)
16858 +{
16859 +       bw32(bp, B44_CAM_CTRL, 0);
16860 +       if (!(bp->dev->flags & IFF_PROMISC)) {
16861 +               u32 val;
16862 +
16863 +               __b44_cam_write(bp, bp->dev->dev_addr, 0);
16864 +               val = br32(bp, B44_CAM_CTRL);
16865 +               bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
16866 +       }
16867 +}
16868 +
16869 +static int b44_set_mac_addr(struct net_device *dev, void *p)
16870 +{
16871 +       struct b44 *bp = netdev_priv(dev);
16872 +       struct sockaddr *addr = p;
16873 +
16874 +       if (netif_running(dev))
16875 +               return -EBUSY;
16876 +
16877 +       memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
16878 +
16879 +       spin_lock_irq(&bp->lock);
16880 +       __b44_set_mac_addr(bp);
16881 +       spin_unlock_irq(&bp->lock);
16882 +
16883 +       return 0;
16884 +}
16885 +
16886 +/* Called at device open time to get the chip ready for
16887 + * packet processing.  Invoked with bp->lock held.
16888 + */
16889 +static void __b44_set_rx_mode(struct net_device *);
16890 +static void b44_init_hw(struct b44 *bp)
16891 +{
16892 +       u32 val;
16893 +
16894 +       b44_chip_reset(bp);
16895 +       b44_phy_reset(bp);
16896 +       b44_setup_phy(bp);
16897 +
16898 +       /* Enable CRC32, set proper LED modes and power on PHY */
16899 +       bw32(bp, B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL);
16900 +       bw32(bp, B44_RCV_LAZY, (1 << RCV_LAZY_FC_SHIFT));
16901 +
16902 +       /* This sets the MAC address too.  */
16903 +       __b44_set_rx_mode(bp->dev);
16904 +
16905 +       /* MTU + eth header + possible VLAN tag + struct rx_header */
16906 +       bw32(bp, B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
16907 +       bw32(bp, B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
16908 +
16909 +       bw32(bp, B44_TX_WMARK, 56); /* XXX magic */
16910 +       bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
16911 +       bw32(bp, B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset);
16912 +       bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
16913 +                             (bp->rx_offset << DMARX_CTRL_ROSHIFT)));
16914 +       bw32(bp, B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
16915 +
16916 +       bw32(bp, B44_DMARX_PTR, bp->rx_pending);
16917 +       bp->rx_prod = bp->rx_pending;   
16918 +
16919 +       bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
16920 +
16921 +       val = br32(bp, B44_ENET_CTRL);
16922 +       bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
16923 +}
16924 +
16925 +static int b44_open(struct net_device *dev)
16926 +{
16927 +       struct b44 *bp = netdev_priv(dev);
16928 +       int err;
16929 +
16930 +       err = b44_alloc_consistent(bp);
16931 +       if (err)
16932 +               return err;
16933 +
16934 +       err = request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev);
16935 +       if (err)
16936 +               goto err_out_free;
16937 +
16938 +       spin_lock_irq(&bp->lock);
16939 +
16940 +       b44_init_rings(bp);
16941 +       b44_init_hw(bp);
16942 +       bp->flags |= B44_FLAG_INIT_COMPLETE;
16943 +
16944 +       spin_unlock_irq(&bp->lock);
16945 +
16946 +       init_timer(&bp->timer);
16947 +       bp->timer.expires = jiffies + HZ;
16948 +       bp->timer.data = (unsigned long) bp;
16949 +       bp->timer.function = b44_timer;
16950 +       add_timer(&bp->timer);
16951 +
16952 +       b44_enable_ints(bp);
16953 +
16954 +       return 0;
16955 +
16956 +err_out_free:
16957 +       b44_free_consistent(bp);
16958 +       return err;
16959 +}
16960 +
16961 +#if 0
16962 +/*static*/ void b44_dump_state(struct b44 *bp)
16963 +{
16964 +       u32 val32, val32_2, val32_3, val32_4, val32_5;
16965 +       u16 val16;
16966 +
16967 +       pci_read_config_word(bp->pdev, PCI_STATUS, &val16);
16968 +       printk("DEBUG: PCI status [%04x] \n", val16);
16969 +
16970 +}
16971 +#endif
16972 +
16973 +#ifdef CONFIG_NET_POLL_CONTROLLER
16974 +/*
16975 + * Polling receive - used by netconsole and other diagnostic tools
16976 + * to allow network i/o with interrupts disabled.
16977 + */
16978 +static void b44_poll_controller(struct net_device *dev)
16979 +{
16980 +       disable_irq(dev->irq);
16981 +       b44_interrupt(dev->irq, dev, NULL);
16982 +       enable_irq(dev->irq);
16983 +}
16984 +#endif
16985 +
16986 +static int b44_close(struct net_device *dev)
16987 +{
16988 +       struct b44 *bp = netdev_priv(dev);
16989 +
16990 +       netif_stop_queue(dev);
16991 +
16992 +       del_timer_sync(&bp->timer);
16993 +
16994 +       spin_lock_irq(&bp->lock);
16995 +
16996 +#if 0
16997 +       b44_dump_state(bp);
16998 +#endif
16999 +       b44_halt(bp);
17000 +       b44_free_rings(bp);
17001 +       bp->flags &= ~B44_FLAG_INIT_COMPLETE;
17002 +       netif_carrier_off(bp->dev);
17003 +
17004 +       spin_unlock_irq(&bp->lock);
17005 +
17006 +       free_irq(dev->irq, dev);
17007 +
17008 +       b44_free_consistent(bp);
17009 +
17010 +       return 0;
17011 +}
17012 +
17013 +static struct net_device_stats *b44_get_stats(struct net_device *dev)
17014 +{
17015 +       struct b44 *bp = netdev_priv(dev);
17016 +       struct net_device_stats *nstat = &bp->stats;
17017 +       struct b44_hw_stats *hwstat = &bp->hw_stats;
17018 +
17019 +       /* Convert HW stats into netdevice stats. */
17020 +       nstat->rx_packets = hwstat->rx_pkts;
17021 +       nstat->tx_packets = hwstat->tx_pkts;
17022 +       nstat->rx_bytes   = hwstat->rx_octets;
17023 +       nstat->tx_bytes   = hwstat->tx_octets;
17024 +       nstat->tx_errors  = (hwstat->tx_jabber_pkts +
17025 +                            hwstat->tx_oversize_pkts +
17026 +                            hwstat->tx_underruns +
17027 +                            hwstat->tx_excessive_cols +
17028 +                            hwstat->tx_late_cols);
17029 +       nstat->multicast  = hwstat->tx_multicast_pkts;
17030 +       nstat->collisions = hwstat->tx_total_cols;
17031 +
17032 +       nstat->rx_length_errors = (hwstat->rx_oversize_pkts +
17033 +                                  hwstat->rx_undersize);
17034 +       nstat->rx_over_errors   = hwstat->rx_missed_pkts;
17035 +       nstat->rx_frame_errors  = hwstat->rx_align_errs;
17036 +       nstat->rx_crc_errors    = hwstat->rx_crc_errs;
17037 +       nstat->rx_errors        = (hwstat->rx_jabber_pkts +
17038 +                                  hwstat->rx_oversize_pkts +
17039 +                                  hwstat->rx_missed_pkts +
17040 +                                  hwstat->rx_crc_align_errs +
17041 +                                  hwstat->rx_undersize +
17042 +                                  hwstat->rx_crc_errs +
17043 +                                  hwstat->rx_align_errs +
17044 +                                  hwstat->rx_symbol_errs);
17045 +
17046 +       nstat->tx_aborted_errors = hwstat->tx_underruns;
17047 +#if 0
17048 +       /* Carrier lost counter seems to be broken for some devices */
17049 +       nstat->tx_carrier_errors = hwstat->tx_carrier_lost;
17050 +#endif
17051 +
17052 +       return nstat;
17053 +}
17054 +
17055 +static int __b44_load_mcast(struct b44 *bp, struct net_device *dev)
17056 +{
17057 +       struct dev_mc_list *mclist;
17058 +       int i, num_ents;
17059 +
17060 +       num_ents = min_t(int, dev->mc_count, B44_MCAST_TABLE_SIZE);
17061 +       mclist = dev->mc_list;
17062 +       for (i = 0; mclist && i < num_ents; i++, mclist = mclist->next) {
17063 +               __b44_cam_write(bp, mclist->dmi_addr, i + 1);
17064 +       }
17065 +       return i+1;
17066 +}
17067 +
17068 +static void __b44_set_rx_mode(struct net_device *dev)
17069 +{
17070 +       struct b44 *bp = netdev_priv(dev);
17071 +       u32 val;
17072 +       int i=0;
17073 +       unsigned char zero[6] = {0,0,0,0,0,0};
17074 +
17075 +       val = br32(bp, B44_RXCONFIG);
17076 +       val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI);
17077 +       if (dev->flags & IFF_PROMISC) {
17078 +               val |= RXCONFIG_PROMISC;
17079 +               bw32(bp, B44_RXCONFIG, val);
17080 +       } else {
17081 +               __b44_set_mac_addr(bp);
17082 +
17083 +               if (dev->flags & IFF_ALLMULTI)
17084 +                       val |= RXCONFIG_ALLMULTI;
17085 +               else
17086 +                       i=__b44_load_mcast(bp, dev);
17087 +               
17088 +               for(;i<64;i++) {
17089 +                       __b44_cam_write(bp, zero, i);                   
17090 +               }
17091 +               bw32(bp, B44_RXCONFIG, val);
17092 +               val = br32(bp, B44_CAM_CTRL);
17093 +               bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
17094 +       }
17095 +}
17096 +
17097 +static void b44_set_rx_mode(struct net_device *dev)
17098 +{
17099 +       struct b44 *bp = netdev_priv(dev);
17100 +
17101 +       spin_lock_irq(&bp->lock);
17102 +       __b44_set_rx_mode(dev);
17103 +       spin_unlock_irq(&bp->lock);
17104 +}
17105 +
17106 +static u32 b44_get_msglevel(struct net_device *dev)
17107 +{
17108 +       struct b44 *bp = netdev_priv(dev);
17109 +       return bp->msg_enable;
17110 +}
17111 +
17112 +static void b44_set_msglevel(struct net_device *dev, u32 value)
17113 +{
17114 +       struct b44 *bp = netdev_priv(dev);
17115 +       bp->msg_enable = value;
17116 +}
17117 +
17118 +static void b44_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
17119 +{
17120 +       struct b44 *bp = netdev_priv(dev);
17121 +       struct pci_dev *pci_dev = bp->pdev;
17122 +
17123 +       strcpy (info->driver, DRV_MODULE_NAME);
17124 +       strcpy (info->version, DRV_MODULE_VERSION);
17125 +       strcpy (info->bus_info, pci_name(pci_dev));
17126 +}
17127 +
17128 +static int b44_nway_reset(struct net_device *dev)
17129 +{
17130 +       struct b44 *bp = netdev_priv(dev);
17131 +       u32 bmcr;
17132 +       int r;
17133 +
17134 +       spin_lock_irq(&bp->lock);
17135 +       b44_readphy(bp, MII_BMCR, &bmcr);
17136 +       b44_readphy(bp, MII_BMCR, &bmcr);
17137 +       r = -EINVAL;
17138 +       if (bmcr & BMCR_ANENABLE) {
17139 +               b44_writephy(bp, MII_BMCR,
17140 +                            bmcr | BMCR_ANRESTART);
17141 +               r = 0;
17142 +       }
17143 +       spin_unlock_irq(&bp->lock);
17144 +
17145 +       return r;
17146 +}
17147 +
17148 +static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
17149 +{
17150 +       struct b44 *bp = netdev_priv(dev);
17151 +
17152 +       if (!(bp->flags & B44_FLAG_INIT_COMPLETE))
17153 +               return -EAGAIN;
17154 +       cmd->supported = (SUPPORTED_Autoneg);
17155 +       cmd->supported |= (SUPPORTED_100baseT_Half |
17156 +                         SUPPORTED_100baseT_Full |
17157 +                         SUPPORTED_10baseT_Half |
17158 +                         SUPPORTED_10baseT_Full |
17159 +                         SUPPORTED_MII);
17160 +
17161 +       cmd->advertising = 0;
17162 +       if (bp->flags & B44_FLAG_ADV_10HALF)
17163 +               cmd->advertising |= ADVERTISE_10HALF;
17164 +       if (bp->flags & B44_FLAG_ADV_10FULL)
17165 +               cmd->advertising |= ADVERTISE_10FULL;
17166 +       if (bp->flags & B44_FLAG_ADV_100HALF)
17167 +               cmd->advertising |= ADVERTISE_100HALF;
17168 +       if (bp->flags & B44_FLAG_ADV_100FULL)
17169 +               cmd->advertising |= ADVERTISE_100FULL;
17170 +       cmd->advertising |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
17171 +       cmd->speed = (bp->flags & B44_FLAG_100_BASE_T) ?
17172 +               SPEED_100 : SPEED_10;
17173 +       cmd->duplex = (bp->flags & B44_FLAG_FULL_DUPLEX) ?
17174 +               DUPLEX_FULL : DUPLEX_HALF;
17175 +       cmd->port = 0;
17176 +       cmd->phy_address = bp->phy_addr;
17177 +       cmd->transceiver = (bp->flags & B44_FLAG_INTERNAL_PHY) ?
17178 +               XCVR_INTERNAL : XCVR_EXTERNAL;
17179 +       cmd->autoneg = (bp->flags & B44_FLAG_FORCE_LINK) ?
17180 +               AUTONEG_DISABLE : AUTONEG_ENABLE;
17181 +       cmd->maxtxpkt = 0;
17182 +       cmd->maxrxpkt = 0;
17183 +       return 0;
17184 +}
17185 +
17186 +static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
17187 +{
17188 +       struct b44 *bp = netdev_priv(dev);
17189 +
17190 +       if (!(bp->flags & B44_FLAG_INIT_COMPLETE))
17191 +               return -EAGAIN;
17192 +
17193 +       /* We do not support gigabit. */
17194 +       if (cmd->autoneg == AUTONEG_ENABLE) {
17195 +               if (cmd->advertising &
17196 +                   (ADVERTISED_1000baseT_Half |
17197 +                    ADVERTISED_1000baseT_Full))
17198 +                       return -EINVAL;
17199 +       } else if ((cmd->speed != SPEED_100 &&
17200 +                   cmd->speed != SPEED_10) ||
17201 +                  (cmd->duplex != DUPLEX_HALF &&
17202 +                   cmd->duplex != DUPLEX_FULL)) {
17203 +                       return -EINVAL;
17204 +       }
17205 +
17206 +       spin_lock_irq(&bp->lock);
17207 +
17208 +       if (cmd->autoneg == AUTONEG_ENABLE) {
17209 +               bp->flags &= ~B44_FLAG_FORCE_LINK;
17210 +               bp->flags &= ~(B44_FLAG_ADV_10HALF |
17211 +                              B44_FLAG_ADV_10FULL |
17212 +                              B44_FLAG_ADV_100HALF |
17213 +                              B44_FLAG_ADV_100FULL);
17214 +               if (cmd->advertising & ADVERTISE_10HALF)
17215 +                       bp->flags |= B44_FLAG_ADV_10HALF;
17216 +               if (cmd->advertising & ADVERTISE_10FULL)
17217 +                       bp->flags |= B44_FLAG_ADV_10FULL;
17218 +               if (cmd->advertising & ADVERTISE_100HALF)
17219 +                       bp->flags |= B44_FLAG_ADV_100HALF;
17220 +               if (cmd->advertising & ADVERTISE_100FULL)
17221 +                       bp->flags |= B44_FLAG_ADV_100FULL;
17222 +       } else {
17223 +               bp->flags |= B44_FLAG_FORCE_LINK;
17224 +               if (cmd->speed == SPEED_100)
17225 +                       bp->flags |= B44_FLAG_100_BASE_T;
17226 +               if (cmd->duplex == DUPLEX_FULL)
17227 +                       bp->flags |= B44_FLAG_FULL_DUPLEX;
17228 +       }
17229 +
17230 +       b44_setup_phy(bp);
17231 +
17232 +       spin_unlock_irq(&bp->lock);
17233 +
17234 +       return 0;
17235 +}
17236 +
17237 +static void b44_get_ringparam(struct net_device *dev,
17238 +                             struct ethtool_ringparam *ering)
17239 +{
17240 +       struct b44 *bp = netdev_priv(dev);
17241 +
17242 +       ering->rx_max_pending = B44_RX_RING_SIZE - 1;
17243 +       ering->rx_pending = bp->rx_pending;
17244 +
17245 +       /* XXX ethtool lacks a tx_max_pending, oops... */
17246 +}
17247 +
17248 +static int b44_set_ringparam(struct net_device *dev,
17249 +                            struct ethtool_ringparam *ering)
17250 +{
17251 +       struct b44 *bp = netdev_priv(dev);
17252 +
17253 +       if ((ering->rx_pending > B44_RX_RING_SIZE - 1) ||
17254 +           (ering->rx_mini_pending != 0) ||
17255 +           (ering->rx_jumbo_pending != 0) ||
17256 +           (ering->tx_pending > B44_TX_RING_SIZE - 1))
17257 +               return -EINVAL;
17258 +
17259 +       spin_lock_irq(&bp->lock);
17260 +
17261 +       bp->rx_pending = ering->rx_pending;
17262 +       bp->tx_pending = ering->tx_pending;
17263 +
17264 +       b44_halt(bp);
17265 +       b44_init_rings(bp);
17266 +       b44_init_hw(bp);
17267 +       netif_wake_queue(bp->dev);
17268 +       spin_unlock_irq(&bp->lock);
17269 +
17270 +       b44_enable_ints(bp);
17271 +       
17272 +       return 0;
17273 +}
17274 +
17275 +static void b44_get_pauseparam(struct net_device *dev,
17276 +                               struct ethtool_pauseparam *epause)
17277 +{
17278 +       struct b44 *bp = netdev_priv(dev);
17279 +
17280 +       epause->autoneg =
17281 +               (bp->flags & B44_FLAG_PAUSE_AUTO) != 0;
17282 +       epause->rx_pause =
17283 +               (bp->flags & B44_FLAG_RX_PAUSE) != 0;
17284 +       epause->tx_pause =
17285 +               (bp->flags & B44_FLAG_TX_PAUSE) != 0;
17286 +}
17287 +
17288 +static int b44_set_pauseparam(struct net_device *dev,
17289 +                               struct ethtool_pauseparam *epause)
17290 +{
17291 +       struct b44 *bp = netdev_priv(dev);
17292 +
17293 +       spin_lock_irq(&bp->lock);
17294 +       if (epause->autoneg)
17295 +               bp->flags |= B44_FLAG_PAUSE_AUTO;
17296 +       else
17297 +               bp->flags &= ~B44_FLAG_PAUSE_AUTO;
17298 +       if (epause->rx_pause)
17299 +               bp->flags |= B44_FLAG_RX_PAUSE;
17300 +       else
17301 +               bp->flags &= ~B44_FLAG_RX_PAUSE;
17302 +       if (epause->tx_pause)
17303 +               bp->flags |= B44_FLAG_TX_PAUSE;
17304 +       else
17305 +               bp->flags &= ~B44_FLAG_TX_PAUSE;
17306 +       if (bp->flags & B44_FLAG_PAUSE_AUTO) {
17307 +               b44_halt(bp);
17308 +               b44_init_rings(bp);
17309 +               b44_init_hw(bp);
17310 +       } else {
17311 +               __b44_set_flow_ctrl(bp, bp->flags);
17312 +       }
17313 +       spin_unlock_irq(&bp->lock);
17314 +
17315 +       b44_enable_ints(bp);
17316 +       
17317 +       return 0;
17318 +}
17319 +
17320 +static struct ethtool_ops b44_ethtool_ops = {
17321 +       .get_drvinfo            = b44_get_drvinfo,
17322 +       .get_settings           = b44_get_settings,
17323 +       .set_settings           = b44_set_settings,
17324 +       .nway_reset             = b44_nway_reset,
17325 +       .get_link               = ethtool_op_get_link,
17326 +       .get_ringparam          = b44_get_ringparam,
17327 +       .set_ringparam          = b44_set_ringparam,
17328 +       .get_pauseparam         = b44_get_pauseparam,
17329 +       .set_pauseparam         = b44_set_pauseparam,
17330 +       .get_msglevel           = b44_get_msglevel,
17331 +       .set_msglevel           = b44_set_msglevel,
17332 +};
17333 +
17334 +static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
17335 +{
17336 +       struct mii_ioctl_data *data = if_mii(ifr);
17337 +       struct b44 *bp = netdev_priv(dev);
17338 +       int err;
17339 +
17340 +       spin_lock_irq(&bp->lock);
17341 +       err = generic_mii_ioctl(&bp->mii_if, data, cmd, NULL);
17342 +       spin_unlock_irq(&bp->lock);
17343 +
17344 +       return err;
17345 +}
17346 +
17347 +/* Read 128-bytes of EEPROM. */
17348 +static int b44_read_eeprom(struct b44 *bp, u8 *data)
17349 +{
17350 +       long i;
17351 +       u16 *ptr = (u16 *) data;
17352 +
17353 +       for (i = 0; i < 128; i += 2)
17354 +               ptr[i / 2] = readw(bp->regs + 4096 + i);
17355 +
17356 +       return 0;
17357 +}
17358 +
17359 +static int __devinit b44_get_invariants(struct b44 *bp)
17360 +{
17361 +       u8 eeprom[128];
17362 +       int err;
17363 +
17364 +       err = b44_read_eeprom(bp, &eeprom[0]);
17365 +       if (err)
17366 +               goto out;
17367 +
17368 +       bp->dev->dev_addr[0] = eeprom[79];
17369 +       bp->dev->dev_addr[1] = eeprom[78];
17370 +       bp->dev->dev_addr[2] = eeprom[81];
17371 +       bp->dev->dev_addr[3] = eeprom[80];
17372 +       bp->dev->dev_addr[4] = eeprom[83];
17373 +       bp->dev->dev_addr[5] = eeprom[82];
17374 +
17375 +       bp->phy_addr = eeprom[90] & 0x1f;
17376 +
17377 +       /* With this, plus the rx_header prepended to the data by the
17378 +        * hardware, we'll land the ethernet header on a 2-byte boundary.
17379 +        */
17380 +       bp->rx_offset = 30;
17381 +
17382 +       bp->imask = IMASK_DEF;
17383 +
17384 +       bp->core_unit = ssb_core_unit(bp);
17385 +       bp->dma_offset = SB_PCI_DMA;
17386 +
17387 +       /* XXX - really required? 
17388 +          bp->flags |= B44_FLAG_BUGGY_TXPTR;
17389 +         */
17390 +out:
17391 +       return err;
17392 +}
17393 +
17394 +static int __devinit b44_init_one(struct pci_dev *pdev,
17395 +                                 const struct pci_device_id *ent)
17396 +{
17397 +       static int b44_version_printed = 0;
17398 +       unsigned long b44reg_base, b44reg_len;
17399 +       struct net_device *dev;
17400 +       struct b44 *bp;
17401 +       int err, i;
17402 +
17403 +       if (b44_version_printed++ == 0)
17404 +               printk(KERN_INFO "%s", version);
17405 +
17406 +       err = pci_enable_device(pdev);
17407 +       if (err) {
17408 +               printk(KERN_ERR PFX "Cannot enable PCI device, "
17409 +                      "aborting.\n");
17410 +               return err;
17411 +       }
17412 +
17413 +       if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
17414 +               printk(KERN_ERR PFX "Cannot find proper PCI device "
17415 +                      "base address, aborting.\n");
17416 +               err = -ENODEV;
17417 +               goto err_out_disable_pdev;
17418 +       }
17419 +
17420 +       err = pci_request_regions(pdev, DRV_MODULE_NAME);
17421 +       if (err) {
17422 +               printk(KERN_ERR PFX "Cannot obtain PCI resources, "
17423 +                      "aborting.\n");
17424 +               goto err_out_disable_pdev;
17425 +       }
17426 +
17427 +       pci_set_master(pdev);
17428 +
17429 +       err = pci_set_dma_mask(pdev, (u64) B44_DMA_MASK);
17430 +       if (err) {
17431 +               printk(KERN_ERR PFX "No usable DMA configuration, "
17432 +                      "aborting.\n");
17433 +               goto err_out_free_res;
17434 +       }
17435 +       
17436 +       err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK);
17437 +       if (err) {
17438 +         printk(KERN_ERR PFX "No usable DMA configuration, "
17439 +                "aborting.\n");
17440 +         goto err_out_free_res;
17441 +       }
17442 +
17443 +       b44reg_base = pci_resource_start(pdev, 0);
17444 +       b44reg_len = pci_resource_len(pdev, 0);
17445 +
17446 +       dev = alloc_etherdev(sizeof(*bp));
17447 +       if (!dev) {
17448 +               printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n");
17449 +               err = -ENOMEM;
17450 +               goto err_out_free_res;
17451 +       }
17452 +
17453 +       SET_MODULE_OWNER(dev);
17454 +       SET_NETDEV_DEV(dev,&pdev->dev);
17455 +
17456 +       /* No interesting netdevice features in this card... */
17457 +       dev->features |= 0;
17458 +
17459 +       bp = netdev_priv(dev);
17460 +       bp->pdev = pdev;
17461 +       bp->dev = dev;
17462 +       if (b44_debug >= 0)
17463 +               bp->msg_enable = (1 << b44_debug) - 1;
17464 +       else
17465 +               bp->msg_enable = B44_DEF_MSG_ENABLE;
17466 +
17467 +       spin_lock_init(&bp->lock);
17468 +
17469 +       bp->regs = ioremap(b44reg_base, b44reg_len);
17470 +       if (bp->regs == 0UL) {
17471 +               printk(KERN_ERR PFX "Cannot map device registers, "
17472 +                      "aborting.\n");
17473 +               err = -ENOMEM;
17474 +               goto err_out_free_dev;
17475 +       }
17476 +
17477 +       bp->rx_pending = B44_DEF_RX_RING_PENDING;
17478 +       bp->tx_pending = B44_DEF_TX_RING_PENDING;
17479 +
17480 +       dev->open = b44_open;
17481 +       dev->stop = b44_close;
17482 +       dev->hard_start_xmit = b44_start_xmit;
17483 +       dev->get_stats = b44_get_stats;
17484 +       dev->set_multicast_list = b44_set_rx_mode;
17485 +       dev->set_mac_address = b44_set_mac_addr;
17486 +       dev->do_ioctl = b44_ioctl;
17487 +       dev->tx_timeout = b44_tx_timeout;
17488 +       dev->poll = b44_poll;
17489 +       dev->weight = 64;
17490 +       dev->watchdog_timeo = B44_TX_TIMEOUT;
17491 +#ifdef CONFIG_NET_POLL_CONTROLLER
17492 +       dev->poll_controller = b44_poll_controller;
17493 +#endif
17494 +       dev->change_mtu = b44_change_mtu;
17495 +       dev->irq = pdev->irq;
17496 +       SET_ETHTOOL_OPS(dev, &b44_ethtool_ops);
17497 +
17498 +       err = b44_get_invariants(bp);
17499 +       if (err) {
17500 +               printk(KERN_ERR PFX "Problem fetching invariants of chip, "
17501 +                      "aborting.\n");
17502 +               goto err_out_iounmap;
17503 +       }
17504 +
17505 +       bp->mii_if.dev = dev;
17506 +       bp->mii_if.mdio_read = b44_mii_read;
17507 +       bp->mii_if.mdio_write = b44_mii_write;
17508 +       bp->mii_if.phy_id = bp->phy_addr;
17509 +       bp->mii_if.phy_id_mask = 0x1f;
17510 +       bp->mii_if.reg_num_mask = 0x1f;
17511 +
17512 +       /* By default, advertise all speed/duplex settings. */
17513 +       bp->flags |= (B44_FLAG_ADV_10HALF | B44_FLAG_ADV_10FULL |
17514 +                     B44_FLAG_ADV_100HALF | B44_FLAG_ADV_100FULL);
17515 +
17516 +       /* By default, auto-negotiate PAUSE. */
17517 +       bp->flags |= B44_FLAG_PAUSE_AUTO;
17518 +
17519 +       err = register_netdev(dev);
17520 +       if (err) {
17521 +               printk(KERN_ERR PFX "Cannot register net device, "
17522 +                      "aborting.\n");
17523 +               goto err_out_iounmap;
17524 +       }
17525 +
17526 +       pci_set_drvdata(pdev, dev);
17527 +
17528 +       pci_save_state(bp->pdev);
17529 +
17530 +       printk(KERN_INFO "%s: Broadcom 4400 10/100BaseT Ethernet ", dev->name);
17531 +       for (i = 0; i < 6; i++)
17532 +               printk("%2.2x%c", dev->dev_addr[i],
17533 +                      i == 5 ? '\n' : ':');
17534 +
17535 +       return 0;
17536 +
17537 +err_out_iounmap:
17538 +       iounmap(bp->regs);
17539 +
17540 +err_out_free_dev:
17541 +       free_netdev(dev);
17542 +
17543 +err_out_free_res:
17544 +       pci_release_regions(pdev);
17545 +
17546 +err_out_disable_pdev:
17547 +       pci_disable_device(pdev);
17548 +       pci_set_drvdata(pdev, NULL);
17549 +       return err;
17550 +}
17551 +
17552 +static void __devexit b44_remove_one(struct pci_dev *pdev)
17553 +{
17554 +       struct net_device *dev = pci_get_drvdata(pdev);
17555 +
17556 +       if (dev) {
17557 +               struct b44 *bp = netdev_priv(dev);
17558 +
17559 +               unregister_netdev(dev);
17560 +               iounmap(bp->regs);
17561 +               free_netdev(dev);
17562 +               pci_release_regions(pdev);
17563 +               pci_disable_device(pdev);
17564 +               pci_set_drvdata(pdev, NULL);
17565 +       }
17566 +}
17567 +
17568 +static int b44_suspend(struct pci_dev *pdev, pm_message_t state)
17569 +{
17570 +       struct net_device *dev = pci_get_drvdata(pdev);
17571 +       struct b44 *bp = netdev_priv(dev);
17572 +
17573 +        if (!netif_running(dev))
17574 +                 return 0;
17575 +
17576 +       del_timer_sync(&bp->timer);
17577 +
17578 +       spin_lock_irq(&bp->lock); 
17579 +
17580 +       b44_halt(bp);
17581 +       netif_carrier_off(bp->dev); 
17582 +       netif_device_detach(bp->dev);
17583 +       b44_free_rings(bp);
17584 +
17585 +       spin_unlock_irq(&bp->lock);
17586 +       return 0;
17587 +}
17588 +
17589 +static int b44_resume(struct pci_dev *pdev)
17590 +{
17591 +       struct net_device *dev = pci_get_drvdata(pdev);
17592 +       struct b44 *bp = netdev_priv(dev);
17593 +
17594 +       pci_restore_state(pdev);
17595 +
17596 +       if (!netif_running(dev))
17597 +               return 0;
17598 +
17599 +       spin_lock_irq(&bp->lock);
17600 +
17601 +       b44_init_rings(bp);
17602 +       b44_init_hw(bp);
17603 +       netif_device_attach(bp->dev);
17604 +       spin_unlock_irq(&bp->lock);
17605 +
17606 +       bp->timer.expires = jiffies + HZ;
17607 +       add_timer(&bp->timer);
17608 +
17609 +       b44_enable_ints(bp);
17610 +       return 0;
17611 +}
17612 +
17613 +static struct pci_driver b44_driver = {
17614 +       .name           = DRV_MODULE_NAME,
17615 +       .id_table       = b44_pci_tbl,
17616 +       .probe          = b44_init_one,
17617 +       .remove         = __devexit_p(b44_remove_one),
17618 +        .suspend        = b44_suspend,
17619 +        .resume         = b44_resume,
17620 +};
17621 +
17622 +static int __init b44_init(void)
17623 +{
17624 +       return pci_module_init(&b44_driver);
17625 +}
17626 +
17627 +static void __exit b44_cleanup(void)
17628 +{
17629 +       pci_unregister_driver(&b44_driver);
17630 +}
17631 +
17632 +module_init(b44_init);
17633 +module_exit(b44_cleanup);
17634 +
17635 diff -Nur linux-2.6.12.5/drivers/net/b44.h linux-2.6.12.5-brcm/drivers/net/b44.h
17636 --- linux-2.6.12.5/drivers/net/b44.h    2005-08-15 02:20:18.000000000 +0200
17637 +++ linux-2.6.12.5-brcm/drivers/net/b44.h       2005-08-28 11:12:20.694819024 +0200
17638 @@ -292,6 +292,9 @@
17639  #define SSB_PCI_MASK1          0xfc000000
17640  #define SSB_PCI_MASK2          0xc0000000
17641  
17642 +#define br32(REG)      readl(bp->regs + (REG))
17643 +#define bw32(REG,VAL)  writel((VAL), bp->regs + (REG))
17644 +
17645  /* 4400 PHY registers */
17646  #define B44_MII_AUXCTRL                24      /* Auxiliary Control */
17647  #define  MII_AUXCTRL_DUPLEX    0x0001  /* Full Duplex */
17648 @@ -345,6 +348,8 @@
17649  };
17650  
17651  #define B44_MCAST_TABLE_SIZE   32
17652 +#define B44_PHY_ADDR_NO_PHY    30
17653 +#define B44_MDC_RATIO          5000000
17654  
17655  /* SW copy of device statistics, kept up to date by periodic timer
17656   * which probes HW values.  Must have same relative layout as HW
17657 @@ -410,7 +415,7 @@
17658         struct net_device_stats stats;
17659         struct b44_hw_stats     hw_stats;
17660  
17661 -       void __iomem            *regs;
17662 +       unsigned long           regs;
17663         struct pci_dev          *pdev;
17664         struct net_device       *dev;
17665  
17666 diff -Nur linux-2.6.12.5/drivers/net/b44.h.orig linux-2.6.12.5-brcm/drivers/net/b44.h.orig
17667 --- linux-2.6.12.5/drivers/net/b44.h.orig       1970-01-01 01:00:00.000000000 +0100
17668 +++ linux-2.6.12.5-brcm/drivers/net/b44.h.orig  2005-08-15 02:20:18.000000000 +0200
17669 @@ -0,0 +1,427 @@
17670 +#ifndef _B44_H
17671 +#define _B44_H
17672 +
17673 +/* Register layout. (These correspond to struct _bcmenettregs in bcm4400.) */
17674 +#define        B44_DEVCTRL     0x0000UL /* Device Control */
17675 +#define  DEVCTRL_MPM           0x00000040 /* Magic Packet PME Enable (B0 only) */
17676 +#define  DEVCTRL_PFE           0x00000080 /* Pattern Filtering Enable */
17677 +#define  DEVCTRL_IPP           0x00000400 /* Internal EPHY Present */
17678 +#define  DEVCTRL_EPR           0x00008000 /* EPHY Reset */
17679 +#define  DEVCTRL_PME           0x00001000 /* PHY Mode Enable */
17680 +#define  DEVCTRL_PMCE          0x00002000 /* PHY Mode Clocks Enable */
17681 +#define  DEVCTRL_PADDR         0x0007c000 /* PHY Address */
17682 +#define  DEVCTRL_PADDR_SHIFT   18
17683 +#define B44_BIST_STAT  0x000CUL /* Built-In Self-Test Status */
17684 +#define B44_WKUP_LEN   0x0010UL /* Wakeup Length */
17685 +#define  WKUP_LEN_P0_MASK      0x0000007f /* Pattern 0 */
17686 +#define  WKUP_LEN_D0           0x00000080
17687 +#define  WKUP_LEN_P1_MASK      0x00007f00 /* Pattern 1 */
17688 +#define  WKUP_LEN_P1_SHIFT     8
17689 +#define  WKUP_LEN_D1           0x00008000
17690 +#define  WKUP_LEN_P2_MASK      0x007f0000 /* Pattern 2 */
17691 +#define  WKUP_LEN_P2_SHIFT     16
17692 +#define  WKUP_LEN_D2           0x00000000
17693 +#define  WKUP_LEN_P3_MASK      0x7f000000 /* Pattern 3 */
17694 +#define  WKUP_LEN_P3_SHIFT     24
17695 +#define  WKUP_LEN_D3           0x80000000
17696 +#define B44_ISTAT      0x0020UL /* Interrupt Status */
17697 +#define  ISTAT_LS              0x00000020 /* Link Change (B0 only) */
17698 +#define  ISTAT_PME             0x00000040 /* Power Management Event */
17699 +#define  ISTAT_TO              0x00000080 /* General Purpose Timeout */
17700 +#define  ISTAT_DSCE            0x00000400 /* Descriptor Error */
17701 +#define  ISTAT_DATAE           0x00000800 /* Data Error */
17702 +#define  ISTAT_DPE             0x00001000 /* Descr. Protocol Error */
17703 +#define  ISTAT_RDU             0x00002000 /* Receive Descr. Underflow */
17704 +#define  ISTAT_RFO             0x00004000 /* Receive FIFO Overflow */
17705 +#define  ISTAT_TFU             0x00008000 /* Transmit FIFO Underflow */
17706 +#define  ISTAT_RX              0x00010000 /* RX Interrupt */
17707 +#define  ISTAT_TX              0x01000000 /* TX Interrupt */
17708 +#define  ISTAT_EMAC            0x04000000 /* EMAC Interrupt */
17709 +#define  ISTAT_MII_WRITE       0x08000000 /* MII Write Interrupt */
17710 +#define  ISTAT_MII_READ                0x10000000 /* MII Read Interrupt */
17711 +#define  ISTAT_ERRORS (ISTAT_DSCE|ISTAT_DATAE|ISTAT_DPE|ISTAT_RDU|ISTAT_RFO|ISTAT_TFU)
17712 +#define B44_IMASK      0x0024UL /* Interrupt Mask */
17713 +#define  IMASK_DEF             (ISTAT_ERRORS | ISTAT_TO | ISTAT_RX | ISTAT_TX)
17714 +#define B44_GPTIMER    0x0028UL /* General Purpose Timer */
17715 +#define B44_ADDR_LO    0x0088UL /* ENET Address Lo (B0 only) */
17716 +#define B44_ADDR_HI    0x008CUL /* ENET Address Hi (B0 only) */
17717 +#define B44_FILT_ADDR  0x0090UL /* ENET Filter Address */
17718 +#define B44_FILT_DATA  0x0094UL /* ENET Filter Data */
17719 +#define B44_TXBURST    0x00A0UL /* TX Max Burst Length */
17720 +#define B44_RXBURST    0x00A4UL /* RX Max Burst Length */
17721 +#define B44_MAC_CTRL   0x00A8UL /* MAC Control */
17722 +#define  MAC_CTRL_CRC32_ENAB   0x00000001 /* CRC32 Generation Enable */
17723 +#define  MAC_CTRL_PHY_PDOWN    0x00000004 /* Onchip EPHY Powerdown */
17724 +#define  MAC_CTRL_PHY_EDET     0x00000008 /* Onchip EPHY Energy Detected */
17725 +#define  MAC_CTRL_PHY_LEDCTRL  0x000000e0 /* Onchip EPHY LED Control */
17726 +#define  MAC_CTRL_PHY_LEDCTRL_SHIFT 5
17727 +#define B44_MAC_FLOW   0x00ACUL /* MAC Flow Control */
17728 +#define  MAC_FLOW_RX_HI_WATER  0x000000ff /* Receive FIFO HI Water Mark */
17729 +#define  MAC_FLOW_PAUSE_ENAB   0x00008000 /* Enable Pause Frame Generation */
17730 +#define B44_RCV_LAZY   0x0100UL /* Lazy Interrupt Control */
17731 +#define  RCV_LAZY_TO_MASK      0x00ffffff /* Timeout */
17732 +#define  RCV_LAZY_FC_MASK      0xff000000 /* Frame Count */
17733 +#define  RCV_LAZY_FC_SHIFT     24
17734 +#define B44_DMATX_CTRL 0x0200UL /* DMA TX Control */
17735 +#define  DMATX_CTRL_ENABLE     0x00000001 /* Enable */
17736 +#define  DMATX_CTRL_SUSPEND    0x00000002 /* Suepend Request */
17737 +#define  DMATX_CTRL_LPBACK     0x00000004 /* Loopback Enable */
17738 +#define  DMATX_CTRL_FAIRPRIOR  0x00000008 /* Fair Priority */
17739 +#define  DMATX_CTRL_FLUSH      0x00000010 /* Flush Request */
17740 +#define B44_DMATX_ADDR 0x0204UL /* DMA TX Descriptor Ring Address */
17741 +#define B44_DMATX_PTR  0x0208UL /* DMA TX Last Posted Descriptor */
17742 +#define B44_DMATX_STAT 0x020CUL /* DMA TX Current Active Desc. + Status */
17743 +#define  DMATX_STAT_CDMASK     0x00000fff /* Current Descriptor Mask */
17744 +#define  DMATX_STAT_SMASK      0x0000f000 /* State Mask */
17745 +#define  DMATX_STAT_SDISABLED  0x00000000 /* State Disabled */
17746 +#define  DMATX_STAT_SACTIVE    0x00001000 /* State Active */
17747 +#define  DMATX_STAT_SIDLE      0x00002000 /* State Idle Wait */
17748 +#define  DMATX_STAT_SSTOPPED   0x00003000 /* State Stopped */
17749 +#define  DMATX_STAT_SSUSP      0x00004000 /* State Suspend Pending */
17750 +#define  DMATX_STAT_EMASK      0x000f0000 /* Error Mask */
17751 +#define  DMATX_STAT_ENONE      0x00000000 /* Error None */
17752 +#define  DMATX_STAT_EDPE       0x00010000 /* Error Desc. Protocol Error */
17753 +#define  DMATX_STAT_EDFU       0x00020000 /* Error Data FIFO Underrun */
17754 +#define  DMATX_STAT_EBEBR      0x00030000 /* Error Bus Error on Buffer Read */
17755 +#define  DMATX_STAT_EBEDA      0x00040000 /* Error Bus Error on Desc. Access */
17756 +#define  DMATX_STAT_FLUSHED    0x00100000 /* Flushed */
17757 +#define B44_DMARX_CTRL 0x0210UL /* DMA RX Control */
17758 +#define  DMARX_CTRL_ENABLE     0x00000001 /* Enable */
17759 +#define  DMARX_CTRL_ROMASK     0x000000fe /* Receive Offset Mask */
17760 +#define  DMARX_CTRL_ROSHIFT    1          /* Receive Offset Shift */
17761 +#define B44_DMARX_ADDR 0x0214UL /* DMA RX Descriptor Ring Address */
17762 +#define B44_DMARX_PTR  0x0218UL /* DMA RX Last Posted Descriptor */
17763 +#define B44_DMARX_STAT 0x021CUL /* DMA RX Current Active Desc. + Status */
17764 +#define  DMARX_STAT_CDMASK     0x00000fff /* Current Descriptor Mask */
17765 +#define  DMARX_STAT_SMASK      0x0000f000 /* State Mask */
17766 +#define  DMARX_STAT_SDISABLED  0x00000000 /* State Disbaled */
17767 +#define  DMARX_STAT_SACTIVE    0x00001000 /* State Active */
17768 +#define  DMARX_STAT_SIDLE      0x00002000 /* State Idle Wait */
17769 +#define  DMARX_STAT_SSTOPPED   0x00003000 /* State Stopped */
17770 +#define  DMARX_STAT_EMASK      0x000f0000 /* Error Mask */
17771 +#define  DMARX_STAT_ENONE      0x00000000 /* Error None */
17772 +#define  DMARX_STAT_EDPE       0x00010000 /* Error Desc. Protocol Error */
17773 +#define  DMARX_STAT_EDFO       0x00020000 /* Error Data FIFO Overflow */
17774 +#define  DMARX_STAT_EBEBW      0x00030000 /* Error Bus Error on Buffer Write */
17775 +#define  DMARX_STAT_EBEDA      0x00040000 /* Error Bus Error on Desc. Access */
17776 +#define B44_DMAFIFO_AD 0x0220UL /* DMA FIFO Diag Address */
17777 +#define  DMAFIFO_AD_OMASK      0x0000ffff /* Offset Mask */
17778 +#define  DMAFIFO_AD_SMASK      0x000f0000 /* Select Mask */
17779 +#define  DMAFIFO_AD_SXDD       0x00000000 /* Select Transmit DMA Data */
17780 +#define  DMAFIFO_AD_SXDP       0x00010000 /* Select Transmit DMA Pointers */
17781 +#define  DMAFIFO_AD_SRDD       0x00040000 /* Select Receive DMA Data */
17782 +#define  DMAFIFO_AD_SRDP       0x00050000 /* Select Receive DMA Pointers */
17783 +#define  DMAFIFO_AD_SXFD       0x00080000 /* Select Transmit FIFO Data */
17784 +#define  DMAFIFO_AD_SXFP       0x00090000 /* Select Transmit FIFO Pointers */
17785 +#define  DMAFIFO_AD_SRFD       0x000c0000 /* Select Receive FIFO Data */
17786 +#define  DMAFIFO_AD_SRFP       0x000c0000 /* Select Receive FIFO Pointers */
17787 +#define B44_DMAFIFO_LO 0x0224UL /* DMA FIFO Diag Low Data */
17788 +#define B44_DMAFIFO_HI 0x0228UL /* DMA FIFO Diag High Data */
17789 +#define B44_RXCONFIG   0x0400UL /* EMAC RX Config */
17790 +#define  RXCONFIG_DBCAST       0x00000001 /* Disable Broadcast */
17791 +#define  RXCONFIG_ALLMULTI     0x00000002 /* Accept All Multicast */
17792 +#define  RXCONFIG_NORX_WHILE_TX        0x00000004 /* Receive Disable While Transmitting */
17793 +#define  RXCONFIG_PROMISC      0x00000008 /* Promiscuous Enable */
17794 +#define  RXCONFIG_LPBACK       0x00000010 /* Loopback Enable */
17795 +#define  RXCONFIG_FLOW         0x00000020 /* Flow Control Enable */
17796 +#define  RXCONFIG_FLOW_ACCEPT  0x00000040 /* Accept Unicast Flow Control Frame */
17797 +#define  RXCONFIG_RFILT                0x00000080 /* Reject Filter */
17798 +#define B44_RXMAXLEN   0x0404UL /* EMAC RX Max Packet Length */
17799 +#define B44_TXMAXLEN   0x0408UL /* EMAC TX Max Packet Length */
17800 +#define B44_MDIO_CTRL  0x0410UL /* EMAC MDIO Control */
17801 +#define  MDIO_CTRL_MAXF_MASK   0x0000007f /* MDC Frequency */
17802 +#define  MDIO_CTRL_PREAMBLE    0x00000080 /* MII Preamble Enable */
17803 +#define B44_MDIO_DATA  0x0414UL /* EMAC MDIO Data */
17804 +#define  MDIO_DATA_DATA                0x0000ffff /* R/W Data */
17805 +#define  MDIO_DATA_TA_MASK     0x00030000 /* Turnaround Value */
17806 +#define  MDIO_DATA_TA_SHIFT    16
17807 +#define  MDIO_TA_VALID         2
17808 +#define  MDIO_DATA_RA_MASK     0x007c0000 /* Register Address */
17809 +#define  MDIO_DATA_RA_SHIFT    18
17810 +#define  MDIO_DATA_PMD_MASK    0x0f800000 /* Physical Media Device */
17811 +#define  MDIO_DATA_PMD_SHIFT   23
17812 +#define  MDIO_DATA_OP_MASK     0x30000000 /* Opcode */
17813 +#define  MDIO_DATA_OP_SHIFT    28
17814 +#define  MDIO_OP_WRITE         1
17815 +#define  MDIO_OP_READ          2
17816 +#define  MDIO_DATA_SB_MASK     0xc0000000 /* Start Bits */
17817 +#define  MDIO_DATA_SB_SHIFT    30
17818 +#define  MDIO_DATA_SB_START    0x40000000 /* Start Of Frame */
17819 +#define B44_EMAC_IMASK 0x0418UL /* EMAC Interrupt Mask */
17820 +#define B44_EMAC_ISTAT 0x041CUL /* EMAC Interrupt Status */
17821 +#define  EMAC_INT_MII          0x00000001 /* MII MDIO Interrupt */
17822 +#define  EMAC_INT_MIB          0x00000002 /* MIB Interrupt */
17823 +#define  EMAC_INT_FLOW         0x00000003 /* Flow Control Interrupt */
17824 +#define B44_CAM_DATA_LO        0x0420UL /* EMAC CAM Data Low */
17825 +#define B44_CAM_DATA_HI        0x0424UL /* EMAC CAM Data High */
17826 +#define  CAM_DATA_HI_VALID     0x00010000 /* Valid Bit */
17827 +#define B44_CAM_CTRL   0x0428UL /* EMAC CAM Control */
17828 +#define  CAM_CTRL_ENABLE       0x00000001 /* CAM Enable */
17829 +#define  CAM_CTRL_MSEL         0x00000002 /* Mask Select */
17830 +#define  CAM_CTRL_READ         0x00000004 /* Read */
17831 +#define  CAM_CTRL_WRITE                0x00000008 /* Read */
17832 +#define  CAM_CTRL_INDEX_MASK   0x003f0000 /* Index Mask */
17833 +#define  CAM_CTRL_INDEX_SHIFT  16
17834 +#define  CAM_CTRL_BUSY         0x80000000 /* CAM Busy */
17835 +#define B44_ENET_CTRL  0x042CUL /* EMAC ENET Control */
17836 +#define  ENET_CTRL_ENABLE      0x00000001 /* EMAC Enable */
17837 +#define  ENET_CTRL_DISABLE     0x00000002 /* EMAC Disable */
17838 +#define  ENET_CTRL_SRST                0x00000004 /* EMAC Soft Reset */
17839 +#define  ENET_CTRL_EPSEL       0x00000008 /* External PHY Select */
17840 +#define B44_TX_CTRL    0x0430UL /* EMAC TX Control */
17841 +#define  TX_CTRL_DUPLEX                0x00000001 /* Full Duplex */
17842 +#define  TX_CTRL_FMODE         0x00000002 /* Flow Mode */
17843 +#define  TX_CTRL_SBENAB                0x00000004 /* Single Backoff Enable */
17844 +#define  TX_CTRL_SMALL_SLOT    0x00000008 /* Small Slottime */
17845 +#define B44_TX_WMARK   0x0434UL /* EMAC TX Watermark */
17846 +#define B44_MIB_CTRL   0x0438UL /* EMAC MIB Control */
17847 +#define  MIB_CTRL_CLR_ON_READ  0x00000001 /* Autoclear on Read */
17848 +#define B44_TX_GOOD_O  0x0500UL /* MIB TX Good Octets */
17849 +#define B44_TX_GOOD_P  0x0504UL /* MIB TX Good Packets */
17850 +#define B44_TX_O       0x0508UL /* MIB TX Octets */
17851 +#define B44_TX_P       0x050CUL /* MIB TX Packets */
17852 +#define B44_TX_BCAST   0x0510UL /* MIB TX Broadcast Packets */
17853 +#define B44_TX_MCAST   0x0514UL /* MIB TX Multicast Packets */
17854 +#define B44_TX_64      0x0518UL /* MIB TX <= 64 byte Packets */
17855 +#define B44_TX_65_127  0x051CUL /* MIB TX 65 to 127 byte Packets */
17856 +#define B44_TX_128_255 0x0520UL /* MIB TX 128 to 255 byte Packets */
17857 +#define B44_TX_256_511 0x0524UL /* MIB TX 256 to 511 byte Packets */
17858 +#define B44_TX_512_1023        0x0528UL /* MIB TX 512 to 1023 byte Packets */
17859 +#define B44_TX_1024_MAX        0x052CUL /* MIB TX 1024 to max byte Packets */
17860 +#define B44_TX_JABBER  0x0530UL /* MIB TX Jabber Packets */
17861 +#define B44_TX_OSIZE   0x0534UL /* MIB TX Oversize Packets */
17862 +#define B44_TX_FRAG    0x0538UL /* MIB TX Fragment Packets */
17863 +#define B44_TX_URUNS   0x053CUL /* MIB TX Underruns */
17864 +#define B44_TX_TCOLS   0x0540UL /* MIB TX Total Collisions */
17865 +#define B44_TX_SCOLS   0x0544UL /* MIB TX Single Collisions */
17866 +#define B44_TX_MCOLS   0x0548UL /* MIB TX Multiple Collisions */
17867 +#define B44_TX_ECOLS   0x054CUL /* MIB TX Excessive Collisions */
17868 +#define B44_TX_LCOLS   0x0550UL /* MIB TX Late Collisions */
17869 +#define B44_TX_DEFERED 0x0554UL /* MIB TX Defered Packets */
17870 +#define B44_TX_CLOST   0x0558UL /* MIB TX Carrier Lost */
17871 +#define B44_TX_PAUSE   0x055CUL /* MIB TX Pause Packets */
17872 +#define B44_RX_GOOD_O  0x0580UL /* MIB RX Good Octets */
17873 +#define B44_RX_GOOD_P  0x0584UL /* MIB RX Good Packets */
17874 +#define B44_RX_O       0x0588UL /* MIB RX Octets */
17875 +#define B44_RX_P       0x058CUL /* MIB RX Packets */
17876 +#define B44_RX_BCAST   0x0590UL /* MIB RX Broadcast Packets */
17877 +#define B44_RX_MCAST   0x0594UL /* MIB RX Multicast Packets */
17878 +#define B44_RX_64      0x0598UL /* MIB RX <= 64 byte Packets */
17879 +#define B44_RX_65_127  0x059CUL /* MIB RX 65 to 127 byte Packets */
17880 +#define B44_RX_128_255 0x05A0UL /* MIB RX 128 to 255 byte Packets */
17881 +#define B44_RX_256_511 0x05A4UL /* MIB RX 256 to 511 byte Packets */
17882 +#define B44_RX_512_1023        0x05A8UL /* MIB RX 512 to 1023 byte Packets */
17883 +#define B44_RX_1024_MAX        0x05ACUL /* MIB RX 1024 to max byte Packets */
17884 +#define B44_RX_JABBER  0x05B0UL /* MIB RX Jabber Packets */
17885 +#define B44_RX_OSIZE   0x05B4UL /* MIB RX Oversize Packets */
17886 +#define B44_RX_FRAG    0x05B8UL /* MIB RX Fragment Packets */
17887 +#define B44_RX_MISS    0x05BCUL /* MIB RX Missed Packets */
17888 +#define B44_RX_CRCA    0x05C0UL /* MIB RX CRC Align Errors */
17889 +#define B44_RX_USIZE   0x05C4UL /* MIB RX Undersize Packets */
17890 +#define B44_RX_CRC     0x05C8UL /* MIB RX CRC Errors */
17891 +#define B44_RX_ALIGN   0x05CCUL /* MIB RX Align Errors */
17892 +#define B44_RX_SYM     0x05D0UL /* MIB RX Symbol Errors */
17893 +#define B44_RX_PAUSE   0x05D4UL /* MIB RX Pause Packets */
17894 +#define B44_RX_NPAUSE  0x05D8UL /* MIB RX Non-Pause Packets */
17895 +
17896 +/* Silicon backplane register definitions */
17897 +#define B44_SBIMSTATE  0x0F90UL /* SB Initiator Agent State */
17898 +#define  SBIMSTATE_PC          0x0000000f /* Pipe Count */
17899 +#define  SBIMSTATE_AP_MASK     0x00000030 /* Arbitration Priority */
17900 +#define  SBIMSTATE_AP_BOTH     0x00000000 /* Use both timeslices and token */
17901 +#define  SBIMSTATE_AP_TS       0x00000010 /* Use timeslices only */
17902 +#define  SBIMSTATE_AP_TK       0x00000020 /* Use token only */
17903 +#define  SBIMSTATE_AP_RSV      0x00000030 /* Reserved */
17904 +#define  SBIMSTATE_IBE         0x00020000 /* In Band Error */
17905 +#define  SBIMSTATE_TO          0x00040000 /* Timeout */
17906 +#define B44_SBINTVEC   0x0F94UL /* SB Interrupt Mask */
17907 +#define  SBINTVEC_PCI          0x00000001 /* Enable interrupts for PCI */
17908 +#define  SBINTVEC_ENET0                0x00000002 /* Enable interrupts for enet 0 */
17909 +#define  SBINTVEC_ILINE20      0x00000004 /* Enable interrupts for iline20 */
17910 +#define  SBINTVEC_CODEC                0x00000008 /* Enable interrupts for v90 codec */
17911 +#define  SBINTVEC_USB          0x00000010 /* Enable interrupts for usb */
17912 +#define  SBINTVEC_EXTIF                0x00000020 /* Enable interrupts for external i/f */
17913 +#define  SBINTVEC_ENET1                0x00000040 /* Enable interrupts for enet 1 */
17914 +#define B44_SBTMSLOW   0x0F98UL /* SB Target State Low */
17915 +#define  SBTMSLOW_RESET                0x00000001 /* Reset */
17916 +#define  SBTMSLOW_REJECT       0x00000002 /* Reject */
17917 +#define  SBTMSLOW_CLOCK                0x00010000 /* Clock Enable */
17918 +#define  SBTMSLOW_FGC          0x00020000 /* Force Gated Clocks On */
17919 +#define  SBTMSLOW_PE           0x40000000 /* Power Management Enable */
17920 +#define  SBTMSLOW_BE           0x80000000 /* BIST Enable */
17921 +#define B44_SBTMSHIGH  0x0F9CUL /* SB Target State High */
17922 +#define  SBTMSHIGH_SERR                0x00000001 /* S-error */
17923 +#define  SBTMSHIGH_INT         0x00000002 /* Interrupt */
17924 +#define  SBTMSHIGH_BUSY                0x00000004 /* Busy */
17925 +#define  SBTMSHIGH_GCR         0x20000000 /* Gated Clock Request */
17926 +#define  SBTMSHIGH_BISTF       0x40000000 /* BIST Failed */
17927 +#define  SBTMSHIGH_BISTD       0x80000000 /* BIST Done */
17928 +#define B44_SBIDHIGH   0x0FFCUL /* SB Identification High */
17929 +#define  SBIDHIGH_RC_MASK      0x0000000f /* Revision Code */
17930 +#define  SBIDHIGH_CC_MASK      0x0000fff0 /* Core Code */
17931 +#define  SBIDHIGH_CC_SHIFT     4
17932 +#define  SBIDHIGH_VC_MASK      0xffff0000 /* Vendor Code */
17933 +#define  SBIDHIGH_VC_SHIFT     16
17934 +
17935 +/* SSB PCI config space registers.  */
17936 +#define        SSB_BAR0_WIN            0x80
17937 +#define        SSB_BAR1_WIN            0x84
17938 +#define        SSB_SPROM_CONTROL       0x88
17939 +#define        SSB_BAR1_CONTROL        0x8c
17940 +
17941 +/* SSB core and host control registers.  */
17942 +#define SSB_CONTROL            0x0000UL
17943 +#define SSB_ARBCONTROL         0x0010UL
17944 +#define SSB_ISTAT              0x0020UL
17945 +#define SSB_IMASK              0x0024UL
17946 +#define SSB_MBOX               0x0028UL
17947 +#define SSB_BCAST_ADDR         0x0050UL
17948 +#define SSB_BCAST_DATA         0x0054UL
17949 +#define SSB_PCI_TRANS_0                0x0100UL
17950 +#define SSB_PCI_TRANS_1                0x0104UL
17951 +#define SSB_PCI_TRANS_2                0x0108UL
17952 +#define SSB_SPROM              0x0800UL
17953 +
17954 +#define SSB_PCI_MEM            0x00000000
17955 +#define SSB_PCI_IO             0x00000001
17956 +#define SSB_PCI_CFG0           0x00000002
17957 +#define SSB_PCI_CFG1           0x00000003
17958 +#define SSB_PCI_PREF           0x00000004
17959 +#define SSB_PCI_BURST          0x00000008
17960 +#define SSB_PCI_MASK0          0xfc000000
17961 +#define SSB_PCI_MASK1          0xfc000000
17962 +#define SSB_PCI_MASK2          0xc0000000
17963 +
17964 +/* 4400 PHY registers */
17965 +#define B44_MII_AUXCTRL                24      /* Auxiliary Control */
17966 +#define  MII_AUXCTRL_DUPLEX    0x0001  /* Full Duplex */
17967 +#define  MII_AUXCTRL_SPEED     0x0002  /* 1=100Mbps, 0=10Mbps */
17968 +#define  MII_AUXCTRL_FORCED    0x0004  /* Forced 10/100 */
17969 +#define B44_MII_ALEDCTRL       26      /* Activity LED */
17970 +#define  MII_ALEDCTRL_ALLMSK   0x7fff
17971 +#define B44_MII_TLEDCTRL       27      /* Traffic Meter LED */
17972 +#define  MII_TLEDCTRL_ENABLE   0x0040
17973 +
17974 +struct dma_desc {
17975 +       u32     ctrl;
17976 +       u32     addr;
17977 +};
17978 +
17979 +/* There are only 12 bits in the DMA engine for descriptor offsetting
17980 + * so the table must be aligned on a boundary of this.
17981 + */
17982 +#define DMA_TABLE_BYTES                4096
17983 +
17984 +#define DESC_CTRL_LEN  0x00001fff
17985 +#define DESC_CTRL_CMASK        0x0ff00000 /* Core specific bits */
17986 +#define DESC_CTRL_EOT  0x10000000 /* End of Table */
17987 +#define DESC_CTRL_IOC  0x20000000 /* Interrupt On Completion */
17988 +#define DESC_CTRL_EOF  0x40000000 /* End of Frame */
17989 +#define DESC_CTRL_SOF  0x80000000 /* Start of Frame */
17990 +
17991 +#define RX_COPY_THRESHOLD      256
17992 +
17993 +struct rx_header {
17994 +       u16     len;
17995 +       u16     flags;
17996 +       u16     pad[12];
17997 +};
17998 +#define RX_HEADER_LEN  28
17999 +
18000 +#define RX_FLAG_OFIFO  0x00000001 /* FIFO Overflow */
18001 +#define RX_FLAG_CRCERR 0x00000002 /* CRC Error */
18002 +#define RX_FLAG_SERR   0x00000004 /* Receive Symbol Error */
18003 +#define RX_FLAG_ODD    0x00000008 /* Frame has odd number of nibbles */
18004 +#define RX_FLAG_LARGE  0x00000010 /* Frame is > RX MAX Length */
18005 +#define RX_FLAG_MCAST  0x00000020 /* Dest is Multicast Address */
18006 +#define RX_FLAG_BCAST  0x00000040 /* Dest is Broadcast Address */
18007 +#define RX_FLAG_MISS   0x00000080 /* Received due to promisc mode */
18008 +#define RX_FLAG_LAST   0x00000800 /* Last buffer in frame */
18009 +#define RX_FLAG_ERRORS (RX_FLAG_ODD | RX_FLAG_SERR | RX_FLAG_CRCERR | RX_FLAG_OFIFO)
18010 +
18011 +struct ring_info {
18012 +       struct sk_buff          *skb;
18013 +       DECLARE_PCI_UNMAP_ADDR(mapping);
18014 +};
18015 +
18016 +#define B44_MCAST_TABLE_SIZE   32
18017 +
18018 +/* SW copy of device statistics, kept up to date by periodic timer
18019 + * which probes HW values.  Must have same relative layout as HW
18020 + * register above, because b44_stats_update depends upon this.
18021 + */
18022 +struct b44_hw_stats {
18023 +       u32 tx_good_octets, tx_good_pkts, tx_octets;
18024 +       u32 tx_pkts, tx_broadcast_pkts, tx_multicast_pkts;
18025 +       u32 tx_len_64, tx_len_65_to_127, tx_len_128_to_255;
18026 +       u32 tx_len_256_to_511, tx_len_512_to_1023, tx_len_1024_to_max;
18027 +       u32 tx_jabber_pkts, tx_oversize_pkts, tx_fragment_pkts;
18028 +       u32 tx_underruns, tx_total_cols, tx_single_cols;
18029 +       u32 tx_multiple_cols, tx_excessive_cols, tx_late_cols;
18030 +       u32 tx_defered, tx_carrier_lost, tx_pause_pkts;
18031 +       u32 __pad1[8];
18032 +
18033 +       u32 rx_good_octets, rx_good_pkts, rx_octets;
18034 +       u32 rx_pkts, rx_broadcast_pkts, rx_multicast_pkts;
18035 +       u32 rx_len_64, rx_len_65_to_127, rx_len_128_to_255;
18036 +       u32 rx_len_256_to_511, rx_len_512_to_1023, rx_len_1024_to_max;
18037 +       u32 rx_jabber_pkts, rx_oversize_pkts, rx_fragment_pkts;
18038 +       u32 rx_missed_pkts, rx_crc_align_errs, rx_undersize;
18039 +       u32 rx_crc_errs, rx_align_errs, rx_symbol_errs;
18040 +       u32 rx_pause_pkts, rx_nonpause_pkts;
18041 +};
18042 +
18043 +struct b44 {
18044 +       spinlock_t              lock;
18045 +
18046 +       u32                     imask, istat;
18047 +
18048 +       struct dma_desc         *rx_ring, *tx_ring;
18049 +
18050 +       u32                     tx_prod, tx_cons;
18051 +       u32                     rx_prod, rx_cons;
18052 +
18053 +       struct ring_info        *rx_buffers;
18054 +       struct ring_info        *tx_buffers;
18055 +
18056 +       u32                     dma_offset;
18057 +       u32                     flags;
18058 +#define B44_FLAG_INIT_COMPLETE 0x00000001
18059 +#define B44_FLAG_BUGGY_TXPTR   0x00000002
18060 +#define B44_FLAG_REORDER_BUG   0x00000004
18061 +#define B44_FLAG_PAUSE_AUTO    0x00008000
18062 +#define B44_FLAG_FULL_DUPLEX   0x00010000
18063 +#define B44_FLAG_100_BASE_T    0x00020000
18064 +#define B44_FLAG_TX_PAUSE      0x00040000
18065 +#define B44_FLAG_RX_PAUSE      0x00080000
18066 +#define B44_FLAG_FORCE_LINK    0x00100000
18067 +#define B44_FLAG_ADV_10HALF    0x01000000
18068 +#define B44_FLAG_ADV_10FULL    0x02000000
18069 +#define B44_FLAG_ADV_100HALF   0x04000000
18070 +#define B44_FLAG_ADV_100FULL   0x08000000
18071 +#define B44_FLAG_INTERNAL_PHY  0x10000000
18072 +
18073 +       u32                     rx_offset;
18074 +
18075 +       u32                     msg_enable;
18076 +
18077 +       struct timer_list       timer;
18078 +
18079 +       struct net_device_stats stats;
18080 +       struct b44_hw_stats     hw_stats;
18081 +
18082 +       void __iomem            *regs;
18083 +       struct pci_dev          *pdev;
18084 +       struct net_device       *dev;
18085 +
18086 +       dma_addr_t              rx_ring_dma, tx_ring_dma;
18087 +
18088 +       u32                     rx_pending;
18089 +       u32                     tx_pending;
18090 +       u8                      phy_addr;
18091 +       u8                      core_unit;
18092 +
18093 +       struct mii_if_info      mii_if;
18094 +};
18095 +
18096 +#endif /* _B44_H */
18097 diff -Nur linux-2.6.12.5/include/asm-mips/bootinfo.h linux-2.6.12.5-brcm/include/asm-mips/bootinfo.h
18098 --- linux-2.6.12.5/include/asm-mips/bootinfo.h  2005-08-15 02:20:18.000000000 +0200
18099 +++ linux-2.6.12.5-brcm/include/asm-mips/bootinfo.h     2005-08-28 11:12:20.695818872 +0200
18100 @@ -213,6 +213,12 @@
18101  #define MACH_GROUP_TITAN       22      /* PMC-Sierra Titan             */
18102  #define  MACH_TITAN_YOSEMITE   1       /* PMC-Sierra Yosemite          */
18103  
18104 +/*
18105 + * Valid machtype for group Broadcom
18106 + */
18107 +#define MACH_GROUP_BRCM                23      /* Broadcom                     */
18108 +#define MACH_BCM47XX           1       /* Broadcom BCM47xx             */
18109 +
18110  #define CL_SIZE                        COMMAND_LINE_SIZE
18111  
18112  const char *get_system_type(void);
18113 diff -Nur linux-2.6.12.5/include/asm-mips/cpu.h linux-2.6.12.5-brcm/include/asm-mips/cpu.h
18114 --- linux-2.6.12.5/include/asm-mips/cpu.h       2005-08-15 02:20:18.000000000 +0200
18115 +++ linux-2.6.12.5-brcm/include/asm-mips/cpu.h  2005-08-28 11:12:20.695818872 +0200
18116 @@ -87,6 +87,13 @@
18117  #define PRID_IMP_SR71000        0x0400
18118  
18119  /*
18120 + * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM
18121 + */
18122 +
18123 +#define PRID_IMP_BCM4710       0x4000
18124 +#define PRID_IMP_BCM3302       0x9000
18125 +
18126 +/*
18127   * Definitions for 7:0 on legacy processors
18128   */
18129  
18130 @@ -177,7 +184,9 @@
18131  #define CPU_VR4133             56
18132  #define CPU_AU1550             57
18133  #define CPU_24K                        58
18134 -#define CPU_LAST               58
18135 +#define CPU_BCM3302            59
18136 +#define CPU_BCM4710            60
18137 +#define CPU_LAST               60
18138  
18139  /*
18140   * ISA Level encodings
18141 diff -Nur linux-2.6.12.5/include/asm-mips/mipsregs.h linux-2.6.12.5-brcm/include/asm-mips/mipsregs.h
18142 --- linux-2.6.12.5/include/asm-mips/mipsregs.h  2005-08-15 02:20:18.000000000 +0200
18143 +++ linux-2.6.12.5-brcm/include/asm-mips/mipsregs.h     2005-08-28 11:12:20.722814768 +0200
18144 @@ -790,10 +790,18 @@
18145  #define read_c0_config1()      __read_32bit_c0_register($16, 1)
18146  #define read_c0_config2()      __read_32bit_c0_register($16, 2)
18147  #define read_c0_config3()      __read_32bit_c0_register($16, 3)
18148 +#define read_c0_config4()      __read_32bit_c0_register($16, 4)
18149 +#define read_c0_config5()      __read_32bit_c0_register($16, 5)
18150 +#define read_c0_config6()      __read_32bit_c0_register($16, 6)
18151 +#define read_c0_config7()      __read_32bit_c0_register($16, 7)
18152  #define write_c0_config(val)   __write_32bit_c0_register($16, 0, val)
18153  #define write_c0_config1(val)  __write_32bit_c0_register($16, 1, val)
18154  #define write_c0_config2(val)  __write_32bit_c0_register($16, 2, val)
18155  #define write_c0_config3(val)  __write_32bit_c0_register($16, 3, val)
18156 +#define write_c0_config4(val)  __write_32bit_c0_register($16, 4, val)
18157 +#define write_c0_config5(val)  __write_32bit_c0_register($16, 5, val)
18158 +#define write_c0_config6(val)  __write_32bit_c0_register($16, 6, val)
18159 +#define write_c0_config7(val)  __write_32bit_c0_register($16, 7, val)
18160  
18161  /*
18162   * The WatchLo register.  There may be upto 8 of them.
18163 diff -Nur linux-2.6.12.5/include/linux/init.h linux-2.6.12.5-brcm/include/linux/init.h
18164 --- linux-2.6.12.5/include/linux/init.h 2005-08-15 02:20:18.000000000 +0200
18165 +++ linux-2.6.12.5-brcm/include/linux/init.h    2005-08-28 11:12:20.723814616 +0200
18166 @@ -86,6 +86,8 @@
18167         static initcall_t __initcall_##fn __attribute_used__ \
18168         __attribute__((__section__(".initcall" level ".init"))) = fn
18169  
18170 +#define early_initcall(fn)             __define_initcall(".early1",fn)
18171 +
18172  #define core_initcall(fn)              __define_initcall("1",fn)
18173  #define postcore_initcall(fn)          __define_initcall("2",fn)
18174  #define arch_initcall(fn)              __define_initcall("3",fn)
18175 diff -Nur linux-2.6.12.5/include/linux/pci_ids.h linux-2.6.12.5-brcm/include/linux/pci_ids.h
18176 --- linux-2.6.12.5/include/linux/pci_ids.h      2005-08-15 02:20:18.000000000 +0200
18177 +++ linux-2.6.12.5-brcm/include/linux/pci_ids.h 2005-08-28 11:12:20.726814160 +0200
18178 @@ -2110,6 +2110,7 @@
18179  #define PCI_DEVICE_ID_TIGON3_5901_2    0x170e
18180  #define PCI_DEVICE_ID_BCM4401          0x4401
18181  #define PCI_DEVICE_ID_BCM4401B0                0x4402
18182 +#define PCI_DEVICE_ID_BCM4713          0x4713
18183  
18184  #define PCI_VENDOR_ID_TOPIC            0x151f
18185  #define PCI_DEVICE_ID_TOPIC_TP560      0x0000
18186 diff -Nur linux-2.6.12.5/include/linux/pci_ids.h.orig linux-2.6.12.5-brcm/include/linux/pci_ids.h.orig
18187 --- linux-2.6.12.5/include/linux/pci_ids.h.orig 1970-01-01 01:00:00.000000000 +0100
18188 +++ linux-2.6.12.5-brcm/include/linux/pci_ids.h.orig    2005-08-15 02:20:18.000000000 +0200
18189 @@ -0,0 +1,2609 @@
18190 +/*
18191 + *     PCI Class, Vendor and Device IDs
18192 + *
18193 + *     Please keep sorted.
18194 + */
18195 +
18196 +/* Device classes and subclasses */
18197 +
18198 +#define PCI_CLASS_NOT_DEFINED          0x0000
18199 +#define PCI_CLASS_NOT_DEFINED_VGA      0x0001
18200 +
18201 +#define PCI_BASE_CLASS_STORAGE         0x01
18202 +#define PCI_CLASS_STORAGE_SCSI         0x0100
18203 +#define PCI_CLASS_STORAGE_IDE          0x0101
18204 +#define PCI_CLASS_STORAGE_FLOPPY       0x0102
18205 +#define PCI_CLASS_STORAGE_IPI          0x0103
18206 +#define PCI_CLASS_STORAGE_RAID         0x0104
18207 +#define PCI_CLASS_STORAGE_OTHER                0x0180
18208 +
18209 +#define PCI_BASE_CLASS_NETWORK         0x02
18210 +#define PCI_CLASS_NETWORK_ETHERNET     0x0200
18211 +#define PCI_CLASS_NETWORK_TOKEN_RING   0x0201
18212 +#define PCI_CLASS_NETWORK_FDDI         0x0202
18213 +#define PCI_CLASS_NETWORK_ATM          0x0203
18214 +#define PCI_CLASS_NETWORK_OTHER                0x0280
18215 +
18216 +#define PCI_BASE_CLASS_DISPLAY         0x03
18217 +#define PCI_CLASS_DISPLAY_VGA          0x0300
18218 +#define PCI_CLASS_DISPLAY_XGA          0x0301
18219 +#define PCI_CLASS_DISPLAY_3D           0x0302
18220 +#define PCI_CLASS_DISPLAY_OTHER                0x0380
18221 +
18222 +#define PCI_BASE_CLASS_MULTIMEDIA      0x04
18223 +#define PCI_CLASS_MULTIMEDIA_VIDEO     0x0400
18224 +#define PCI_CLASS_MULTIMEDIA_AUDIO     0x0401
18225 +#define PCI_CLASS_MULTIMEDIA_PHONE     0x0402
18226 +#define PCI_CLASS_MULTIMEDIA_OTHER     0x0480
18227 +
18228 +#define PCI_BASE_CLASS_MEMORY          0x05
18229 +#define PCI_CLASS_MEMORY_RAM           0x0500
18230 +#define PCI_CLASS_MEMORY_FLASH         0x0501
18231 +#define PCI_CLASS_MEMORY_OTHER         0x0580
18232 +
18233 +#define PCI_BASE_CLASS_BRIDGE          0x06
18234 +#define PCI_CLASS_BRIDGE_HOST          0x0600
18235 +#define PCI_CLASS_BRIDGE_ISA           0x0601
18236 +#define PCI_CLASS_BRIDGE_EISA          0x0602
18237 +#define PCI_CLASS_BRIDGE_MC            0x0603
18238 +#define PCI_CLASS_BRIDGE_PCI           0x0604
18239 +#define PCI_CLASS_BRIDGE_PCMCIA                0x0605
18240 +#define PCI_CLASS_BRIDGE_NUBUS         0x0606
18241 +#define PCI_CLASS_BRIDGE_CARDBUS       0x0607
18242 +#define PCI_CLASS_BRIDGE_RACEWAY       0x0608
18243 +#define PCI_CLASS_BRIDGE_OTHER         0x0680
18244 +
18245 +#define PCI_BASE_CLASS_COMMUNICATION   0x07
18246 +#define PCI_CLASS_COMMUNICATION_SERIAL 0x0700
18247 +#define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701
18248 +#define PCI_CLASS_COMMUNICATION_MULTISERIAL 0x0702
18249 +#define PCI_CLASS_COMMUNICATION_MODEM  0x0703
18250 +#define PCI_CLASS_COMMUNICATION_OTHER  0x0780
18251 +
18252 +#define PCI_BASE_CLASS_SYSTEM          0x08
18253 +#define PCI_CLASS_SYSTEM_PIC           0x0800
18254 +#define PCI_CLASS_SYSTEM_DMA           0x0801
18255 +#define PCI_CLASS_SYSTEM_TIMER         0x0802
18256 +#define PCI_CLASS_SYSTEM_RTC           0x0803
18257 +#define PCI_CLASS_SYSTEM_PCI_HOTPLUG   0x0804
18258 +#define PCI_CLASS_SYSTEM_OTHER         0x0880
18259 +
18260 +#define PCI_BASE_CLASS_INPUT           0x09
18261 +#define PCI_CLASS_INPUT_KEYBOARD       0x0900
18262 +#define PCI_CLASS_INPUT_PEN            0x0901
18263 +#define PCI_CLASS_INPUT_MOUSE          0x0902
18264 +#define PCI_CLASS_INPUT_SCANNER                0x0903
18265 +#define PCI_CLASS_INPUT_GAMEPORT       0x0904
18266 +#define PCI_CLASS_INPUT_OTHER          0x0980
18267 +
18268 +#define PCI_BASE_CLASS_DOCKING         0x0a
18269 +#define PCI_CLASS_DOCKING_GENERIC      0x0a00
18270 +#define PCI_CLASS_DOCKING_OTHER                0x0a80
18271 +
18272 +#define PCI_BASE_CLASS_PROCESSOR       0x0b
18273 +#define PCI_CLASS_PROCESSOR_386                0x0b00
18274 +#define PCI_CLASS_PROCESSOR_486                0x0b01
18275 +#define PCI_CLASS_PROCESSOR_PENTIUM    0x0b02
18276 +#define PCI_CLASS_PROCESSOR_ALPHA      0x0b10
18277 +#define PCI_CLASS_PROCESSOR_POWERPC    0x0b20
18278 +#define PCI_CLASS_PROCESSOR_MIPS       0x0b30
18279 +#define PCI_CLASS_PROCESSOR_CO         0x0b40
18280 +
18281 +#define PCI_BASE_CLASS_SERIAL          0x0c
18282 +#define PCI_CLASS_SERIAL_FIREWIRE      0x0c00
18283 +#define PCI_CLASS_SERIAL_ACCESS                0x0c01
18284 +#define PCI_CLASS_SERIAL_SSA           0x0c02
18285 +#define PCI_CLASS_SERIAL_USB           0x0c03
18286 +#define PCI_CLASS_SERIAL_FIBER         0x0c04
18287 +#define PCI_CLASS_SERIAL_SMBUS         0x0c05
18288 +
18289 +#define PCI_BASE_CLASS_INTELLIGENT     0x0e
18290 +#define PCI_CLASS_INTELLIGENT_I2O      0x0e00
18291 +
18292 +#define PCI_BASE_CLASS_SATELLITE       0x0f
18293 +#define PCI_CLASS_SATELLITE_TV         0x0f00
18294 +#define PCI_CLASS_SATELLITE_AUDIO      0x0f01
18295 +#define PCI_CLASS_SATELLITE_VOICE      0x0f03
18296 +#define PCI_CLASS_SATELLITE_DATA       0x0f04
18297 +
18298 +#define PCI_BASE_CLASS_CRYPT           0x10
18299 +#define PCI_CLASS_CRYPT_NETWORK                0x1000
18300 +#define PCI_CLASS_CRYPT_ENTERTAINMENT  0x1001
18301 +#define PCI_CLASS_CRYPT_OTHER          0x1080
18302 +
18303 +#define PCI_BASE_CLASS_SIGNAL_PROCESSING 0x11
18304 +#define PCI_CLASS_SP_DPIO              0x1100
18305 +#define PCI_CLASS_SP_OTHER             0x1180
18306 +
18307 +#define PCI_CLASS_OTHERS               0xff
18308 +
18309 +/* Vendors and devices.  Sort key: vendor first, device next. */
18310 +
18311 +#define PCI_VENDOR_ID_DYNALINK         0x0675
18312 +#define PCI_DEVICE_ID_DYNALINK_IS64PH  0x1702
18313 +
18314 +#define PCI_VENDOR_ID_BERKOM                   0x0871
18315 +#define PCI_DEVICE_ID_BERKOM_A1T               0xffa1
18316 +#define PCI_DEVICE_ID_BERKOM_T_CONCEPT         0xffa2
18317 +#define PCI_DEVICE_ID_BERKOM_A4T               0xffa4
18318 +#define PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO     0xffa8
18319 +
18320 +#define PCI_VENDOR_ID_COMPAQ           0x0e11
18321 +#define PCI_DEVICE_ID_COMPAQ_TOKENRING 0x0508
18322 +#define PCI_DEVICE_ID_COMPAQ_1280      0x3033
18323 +#define PCI_DEVICE_ID_COMPAQ_TRIFLEX   0x4000
18324 +#define PCI_DEVICE_ID_COMPAQ_6010      0x6010
18325 +#define PCI_DEVICE_ID_COMPAQ_TACHYON   0xa0fc
18326 +#define PCI_DEVICE_ID_COMPAQ_SMART2P   0xae10
18327 +#define PCI_DEVICE_ID_COMPAQ_NETEL100  0xae32
18328 +#define PCI_DEVICE_ID_COMPAQ_NETEL10   0xae34
18329 +#define PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE 0xae33
18330 +#define PCI_DEVICE_ID_COMPAQ_NETFLEX3I 0xae35
18331 +#define PCI_DEVICE_ID_COMPAQ_NETEL100D 0xae40
18332 +#define PCI_DEVICE_ID_COMPAQ_NETEL100PI        0xae43
18333 +#define PCI_DEVICE_ID_COMPAQ_NETEL100I 0xb011
18334 +#define PCI_DEVICE_ID_COMPAQ_CISS      0xb060
18335 +#define PCI_DEVICE_ID_COMPAQ_CISSB     0xb178
18336 +#define PCI_DEVICE_ID_COMPAQ_CISSC     0x46
18337 +#define PCI_DEVICE_ID_COMPAQ_THUNDER   0xf130
18338 +#define PCI_DEVICE_ID_COMPAQ_NETFLEX3B 0xf150
18339 +
18340 +#define PCI_VENDOR_ID_NCR              0x1000
18341 +#define PCI_VENDOR_ID_LSI_LOGIC                0x1000
18342 +#define PCI_DEVICE_ID_NCR_53C810       0x0001
18343 +#define PCI_DEVICE_ID_NCR_53C820       0x0002
18344 +#define PCI_DEVICE_ID_NCR_53C825       0x0003
18345 +#define PCI_DEVICE_ID_NCR_53C815       0x0004
18346 +#define PCI_DEVICE_ID_LSI_53C810AP     0x0005
18347 +#define PCI_DEVICE_ID_NCR_53C860       0x0006
18348 +#define PCI_DEVICE_ID_LSI_53C1510      0x000a
18349 +#define PCI_DEVICE_ID_NCR_53C896       0x000b
18350 +#define PCI_DEVICE_ID_NCR_53C895       0x000c
18351 +#define PCI_DEVICE_ID_NCR_53C885       0x000d
18352 +#define PCI_DEVICE_ID_NCR_53C875       0x000f
18353 +#define PCI_DEVICE_ID_NCR_53C1510      0x0010
18354 +#define PCI_DEVICE_ID_LSI_53C895A      0x0012
18355 +#define PCI_DEVICE_ID_LSI_53C875A      0x0013
18356 +#define PCI_DEVICE_ID_LSI_53C1010_33   0x0020
18357 +#define PCI_DEVICE_ID_LSI_53C1010_66   0x0021
18358 +#define PCI_DEVICE_ID_LSI_53C1030      0x0030
18359 +#define PCI_DEVICE_ID_LSI_1030_53C1035 0x0032
18360 +#define PCI_DEVICE_ID_LSI_53C1035      0x0040
18361 +#define PCI_DEVICE_ID_NCR_53C875J      0x008f
18362 +#define PCI_DEVICE_ID_LSI_FC909                0x0621
18363 +#define PCI_DEVICE_ID_LSI_FC929                0x0622
18364 +#define PCI_DEVICE_ID_LSI_FC929_LAN    0x0623
18365 +#define PCI_DEVICE_ID_LSI_FC919                0x0624
18366 +#define PCI_DEVICE_ID_LSI_FC919_LAN    0x0625
18367 +#define PCI_DEVICE_ID_LSI_FC929X       0x0626
18368 +#define PCI_DEVICE_ID_LSI_FC939X       0x0642
18369 +#define PCI_DEVICE_ID_LSI_FC949X       0x0640
18370 +#define PCI_DEVICE_ID_LSI_FC919X       0x0628
18371 +#define PCI_DEVICE_ID_NCR_YELLOWFIN    0x0701
18372 +#define PCI_DEVICE_ID_LSI_61C102       0x0901
18373 +#define PCI_DEVICE_ID_LSI_63C815       0x1000
18374 +#define PCI_DEVICE_ID_LSI_SAS1064      0x0050
18375 +#define PCI_DEVICE_ID_LSI_SAS1066      0x005E
18376 +#define PCI_DEVICE_ID_LSI_SAS1068      0x0054
18377 +#define PCI_DEVICE_ID_LSI_SAS1064A     0x005C
18378 +#define PCI_DEVICE_ID_LSI_SAS1064E     0x0056
18379 +#define PCI_DEVICE_ID_LSI_SAS1066E     0x005A
18380 +#define PCI_DEVICE_ID_LSI_SAS1068E     0x0058
18381 +#define PCI_DEVICE_ID_LSI_SAS1078      0x0060
18382 +
18383 +#define PCI_VENDOR_ID_ATI              0x1002
18384 +/* Mach64 */
18385 +#define PCI_DEVICE_ID_ATI_68800                0x4158
18386 +#define PCI_DEVICE_ID_ATI_215CT222     0x4354
18387 +#define PCI_DEVICE_ID_ATI_210888CX     0x4358
18388 +#define PCI_DEVICE_ID_ATI_215ET222     0x4554
18389 +/* Mach64 / Rage */
18390 +#define PCI_DEVICE_ID_ATI_215GB                0x4742
18391 +#define PCI_DEVICE_ID_ATI_215GD                0x4744
18392 +#define PCI_DEVICE_ID_ATI_215GI                0x4749
18393 +#define PCI_DEVICE_ID_ATI_215GP                0x4750
18394 +#define PCI_DEVICE_ID_ATI_215GQ                0x4751
18395 +#define PCI_DEVICE_ID_ATI_215XL                0x4752
18396 +#define PCI_DEVICE_ID_ATI_215GT                0x4754
18397 +#define PCI_DEVICE_ID_ATI_215GTB       0x4755
18398 +#define PCI_DEVICE_ID_ATI_215_IV       0x4756
18399 +#define PCI_DEVICE_ID_ATI_215_IW       0x4757
18400 +#define PCI_DEVICE_ID_ATI_215_IZ       0x475A
18401 +#define PCI_DEVICE_ID_ATI_210888GX     0x4758
18402 +#define PCI_DEVICE_ID_ATI_215_LB       0x4c42
18403 +#define PCI_DEVICE_ID_ATI_215_LD       0x4c44
18404 +#define PCI_DEVICE_ID_ATI_215_LG       0x4c47
18405 +#define PCI_DEVICE_ID_ATI_215_LI       0x4c49
18406 +#define PCI_DEVICE_ID_ATI_215_LM       0x4c4D
18407 +#define PCI_DEVICE_ID_ATI_215_LN       0x4c4E
18408 +#define PCI_DEVICE_ID_ATI_215_LR       0x4c52
18409 +#define PCI_DEVICE_ID_ATI_215_LS       0x4c53
18410 +#define PCI_DEVICE_ID_ATI_264_LT       0x4c54
18411 +/* Mach64 VT */
18412 +#define PCI_DEVICE_ID_ATI_264VT                0x5654
18413 +#define PCI_DEVICE_ID_ATI_264VU                0x5655
18414 +#define PCI_DEVICE_ID_ATI_264VV                0x5656
18415 +/* Rage128 GL */
18416 +#define PCI_DEVICE_ID_ATI_RAGE128_RE   0x5245
18417 +#define PCI_DEVICE_ID_ATI_RAGE128_RF   0x5246
18418 +#define PCI_DEVICE_ID_ATI_RAGE128_RG   0x5247
18419 +/* Rage128 VR */
18420 +#define PCI_DEVICE_ID_ATI_RAGE128_RK   0x524b
18421 +#define PCI_DEVICE_ID_ATI_RAGE128_RL   0x524c
18422 +#define PCI_DEVICE_ID_ATI_RAGE128_SE   0x5345
18423 +#define PCI_DEVICE_ID_ATI_RAGE128_SF   0x5346
18424 +#define PCI_DEVICE_ID_ATI_RAGE128_SG   0x5347
18425 +#define PCI_DEVICE_ID_ATI_RAGE128_SH   0x5348
18426 +#define PCI_DEVICE_ID_ATI_RAGE128_SK   0x534b
18427 +#define PCI_DEVICE_ID_ATI_RAGE128_SL   0x534c
18428 +#define PCI_DEVICE_ID_ATI_RAGE128_SM   0x534d
18429 +#define PCI_DEVICE_ID_ATI_RAGE128_SN   0x534e
18430 +/* Rage128 Ultra */
18431 +#define PCI_DEVICE_ID_ATI_RAGE128_TF   0x5446
18432 +#define PCI_DEVICE_ID_ATI_RAGE128_TL   0x544c
18433 +#define PCI_DEVICE_ID_ATI_RAGE128_TR   0x5452
18434 +#define PCI_DEVICE_ID_ATI_RAGE128_TS   0x5453
18435 +#define PCI_DEVICE_ID_ATI_RAGE128_TT   0x5454
18436 +#define PCI_DEVICE_ID_ATI_RAGE128_TU   0x5455
18437 +/* Rage128 M3 */
18438 +#define PCI_DEVICE_ID_ATI_RAGE128_LE   0x4c45
18439 +#define PCI_DEVICE_ID_ATI_RAGE128_LF   0x4c46
18440 +/* Rage128 M4 */
18441 +#define PCI_DEVICE_ID_ATI_RAGE128_MF    0x4d46
18442 +#define PCI_DEVICE_ID_ATI_RAGE128_ML    0x4d4c
18443 +/* Rage128 Pro GL */
18444 +#define PCI_DEVICE_ID_ATI_RAGE128_PA   0x5041
18445 +#define PCI_DEVICE_ID_ATI_RAGE128_PB   0x5042
18446 +#define PCI_DEVICE_ID_ATI_RAGE128_PC   0x5043
18447 +#define PCI_DEVICE_ID_ATI_RAGE128_PD   0x5044
18448 +#define PCI_DEVICE_ID_ATI_RAGE128_PE   0x5045
18449 +#define PCI_DEVICE_ID_ATI_RAGE128_PF   0x5046
18450 +/* Rage128 Pro VR */
18451 +#define PCI_DEVICE_ID_ATI_RAGE128_PG   0x5047
18452 +#define PCI_DEVICE_ID_ATI_RAGE128_PH   0x5048
18453 +#define PCI_DEVICE_ID_ATI_RAGE128_PI   0x5049
18454 +#define PCI_DEVICE_ID_ATI_RAGE128_PJ   0x504A
18455 +#define PCI_DEVICE_ID_ATI_RAGE128_PK   0x504B
18456 +#define PCI_DEVICE_ID_ATI_RAGE128_PL   0x504C
18457 +#define PCI_DEVICE_ID_ATI_RAGE128_PM   0x504D
18458 +#define PCI_DEVICE_ID_ATI_RAGE128_PN   0x504E
18459 +#define PCI_DEVICE_ID_ATI_RAGE128_PO   0x504F
18460 +#define PCI_DEVICE_ID_ATI_RAGE128_PP   0x5050
18461 +#define PCI_DEVICE_ID_ATI_RAGE128_PQ   0x5051
18462 +#define PCI_DEVICE_ID_ATI_RAGE128_PR   0x5052
18463 +#define PCI_DEVICE_ID_ATI_RAGE128_TR   0x5452
18464 +#define PCI_DEVICE_ID_ATI_RAGE128_PS   0x5053
18465 +#define PCI_DEVICE_ID_ATI_RAGE128_PT   0x5054
18466 +#define PCI_DEVICE_ID_ATI_RAGE128_PU   0x5055
18467 +#define PCI_DEVICE_ID_ATI_RAGE128_PV   0x5056
18468 +#define PCI_DEVICE_ID_ATI_RAGE128_PW   0x5057
18469 +#define PCI_DEVICE_ID_ATI_RAGE128_PX   0x5058
18470 +/* Rage128 M4 */
18471 +#define PCI_DEVICE_ID_ATI_RADEON_LE    0x4d45
18472 +#define PCI_DEVICE_ID_ATI_RADEON_LF    0x4d46
18473 +/* Radeon R100 */
18474 +#define PCI_DEVICE_ID_ATI_RADEON_QD    0x5144
18475 +#define PCI_DEVICE_ID_ATI_RADEON_QE    0x5145
18476 +#define PCI_DEVICE_ID_ATI_RADEON_QF    0x5146
18477 +#define PCI_DEVICE_ID_ATI_RADEON_QG    0x5147
18478 +/* Radeon RV100 (VE) */
18479 +#define PCI_DEVICE_ID_ATI_RADEON_QY    0x5159
18480 +#define PCI_DEVICE_ID_ATI_RADEON_QZ    0x515a
18481 +/* Radeon R200 (8500) */
18482 +#define PCI_DEVICE_ID_ATI_RADEON_QL    0x514c
18483 +#define PCI_DEVICE_ID_ATI_RADEON_QN    0x514e
18484 +#define PCI_DEVICE_ID_ATI_RADEON_QO    0x514f
18485 +#define PCI_DEVICE_ID_ATI_RADEON_Ql    0x516c
18486 +#define PCI_DEVICE_ID_ATI_RADEON_BB    0x4242
18487 +/* Radeon R200 (9100) */
18488 +#define PCI_DEVICE_ID_ATI_RADEON_QM    0x514d
18489 +/* Radeon RV200 (7500) */
18490 +#define PCI_DEVICE_ID_ATI_RADEON_QW    0x5157
18491 +#define PCI_DEVICE_ID_ATI_RADEON_QX    0x5158
18492 +/* Radeon NV-100 */
18493 +#define PCI_DEVICE_ID_ATI_RADEON_N1    0x5159
18494 +#define PCI_DEVICE_ID_ATI_RADEON_N2    0x515a
18495 +/* Radeon RV250 (9000) */
18496 +#define PCI_DEVICE_ID_ATI_RADEON_Id    0x4964
18497 +#define PCI_DEVICE_ID_ATI_RADEON_Ie    0x4965
18498 +#define PCI_DEVICE_ID_ATI_RADEON_If    0x4966
18499 +#define PCI_DEVICE_ID_ATI_RADEON_Ig    0x4967
18500 +/* Radeon RV280 (9200) */
18501 +#define PCI_DEVICE_ID_ATI_RADEON_Y_    0x5960
18502 +#define PCI_DEVICE_ID_ATI_RADEON_Ya    0x5961
18503 +#define PCI_DEVICE_ID_ATI_RADEON_Yd    0x5964
18504 +/* Radeon R300 (9500) */
18505 +#define PCI_DEVICE_ID_ATI_RADEON_AD    0x4144
18506 +/* Radeon R300 (9700) */
18507 +#define PCI_DEVICE_ID_ATI_RADEON_ND    0x4e44
18508 +#define PCI_DEVICE_ID_ATI_RADEON_NE    0x4e45
18509 +#define PCI_DEVICE_ID_ATI_RADEON_NF    0x4e46
18510 +#define PCI_DEVICE_ID_ATI_RADEON_NG    0x4e47
18511 +#define PCI_DEVICE_ID_ATI_RADEON_AE    0x4145
18512 +#define PCI_DEVICE_ID_ATI_RADEON_AF    0x4146
18513 +/* Radeon R350 (9800) */
18514 +#define PCI_DEVICE_ID_ATI_RADEON_NH    0x4e48
18515 +#define PCI_DEVICE_ID_ATI_RADEON_NI    0x4e49
18516 +/* Radeon RV350 (9600) */
18517 +#define PCI_DEVICE_ID_ATI_RADEON_AP    0x4150
18518 +#define PCI_DEVICE_ID_ATI_RADEON_AR    0x4152
18519 +/* Radeon M6 */
18520 +#define PCI_DEVICE_ID_ATI_RADEON_LY    0x4c59
18521 +#define PCI_DEVICE_ID_ATI_RADEON_LZ    0x4c5a
18522 +/* Radeon M7 */
18523 +#define PCI_DEVICE_ID_ATI_RADEON_LW    0x4c57
18524 +#define PCI_DEVICE_ID_ATI_RADEON_LX    0x4c58
18525 +/* Radeon M9 */
18526 +#define PCI_DEVICE_ID_ATI_RADEON_Ld    0x4c64
18527 +#define PCI_DEVICE_ID_ATI_RADEON_Le    0x4c65
18528 +#define PCI_DEVICE_ID_ATI_RADEON_Lf    0x4c66
18529 +#define PCI_DEVICE_ID_ATI_RADEON_Lg    0x4c67
18530 +/* Radeon */
18531 +#define PCI_DEVICE_ID_ATI_RADEON_RA    0x5144
18532 +#define PCI_DEVICE_ID_ATI_RADEON_RB    0x5145
18533 +#define PCI_DEVICE_ID_ATI_RADEON_RC    0x5146
18534 +#define PCI_DEVICE_ID_ATI_RADEON_RD    0x5147
18535 +/* RadeonIGP */
18536 +#define PCI_DEVICE_ID_ATI_RS100                0xcab0
18537 +#define PCI_DEVICE_ID_ATI_RS200                0xcab2
18538 +#define PCI_DEVICE_ID_ATI_RS200_B      0xcbb2
18539 +#define PCI_DEVICE_ID_ATI_RS250                0xcab3
18540 +#define PCI_DEVICE_ID_ATI_RS300_100    0x5830
18541 +#define PCI_DEVICE_ID_ATI_RS300_133    0x5831
18542 +#define PCI_DEVICE_ID_ATI_RS300_166    0x5832
18543 +#define PCI_DEVICE_ID_ATI_RS300_200    0x5833
18544 +#define PCI_DEVICE_ID_ATI_RS350_100     0x7830
18545 +#define PCI_DEVICE_ID_ATI_RS350_133     0x7831
18546 +#define PCI_DEVICE_ID_ATI_RS350_166     0x7832
18547 +#define PCI_DEVICE_ID_ATI_RS350_200     0x7833
18548 +#define PCI_DEVICE_ID_ATI_RS400_100     0x5a30
18549 +#define PCI_DEVICE_ID_ATI_RS400_133     0x5a31
18550 +#define PCI_DEVICE_ID_ATI_RS400_166     0x5a32
18551 +#define PCI_DEVICE_ID_ATI_RS400_200     0x5a33
18552 +#define PCI_DEVICE_ID_ATI_RS480         0x5950
18553 +/* ATI IXP Chipset */
18554 +#define PCI_DEVICE_ID_ATI_IXP200_IDE   0x4349
18555 +#define PCI_DEVICE_ID_ATI_IXP300_IDE   0x4369
18556 +#define PCI_DEVICE_ID_ATI_IXP300_SATA   0x436e
18557 +#define PCI_DEVICE_ID_ATI_IXP400_IDE   0x4376
18558 +#define PCI_DEVICE_ID_ATI_IXP400_SATA   0x4379
18559 +
18560 +#define PCI_VENDOR_ID_VLSI             0x1004
18561 +#define PCI_DEVICE_ID_VLSI_82C592      0x0005
18562 +#define PCI_DEVICE_ID_VLSI_82C593      0x0006
18563 +#define PCI_DEVICE_ID_VLSI_82C594      0x0007
18564 +#define PCI_DEVICE_ID_VLSI_82C597      0x0009
18565 +#define PCI_DEVICE_ID_VLSI_82C541      0x000c
18566 +#define PCI_DEVICE_ID_VLSI_82C543      0x000d
18567 +#define PCI_DEVICE_ID_VLSI_82C532      0x0101
18568 +#define PCI_DEVICE_ID_VLSI_82C534      0x0102
18569 +#define PCI_DEVICE_ID_VLSI_82C535      0x0104
18570 +#define PCI_DEVICE_ID_VLSI_82C147      0x0105
18571 +#define PCI_DEVICE_ID_VLSI_VAS96011    0x0702
18572 +
18573 +#define PCI_VENDOR_ID_ADL              0x1005
18574 +#define PCI_DEVICE_ID_ADL_2301         0x2301
18575 +
18576 +#define PCI_VENDOR_ID_NS               0x100b
18577 +#define PCI_DEVICE_ID_NS_87415         0x0002
18578 +#define PCI_DEVICE_ID_NS_87560_LIO     0x000e
18579 +#define PCI_DEVICE_ID_NS_87560_USB     0x0012
18580 +#define PCI_DEVICE_ID_NS_83815         0x0020
18581 +#define PCI_DEVICE_ID_NS_83820         0x0022
18582 +#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500
18583 +#define PCI_DEVICE_ID_NS_SCx200_SMI    0x0501
18584 +#define PCI_DEVICE_ID_NS_SCx200_IDE    0x0502
18585 +#define PCI_DEVICE_ID_NS_SCx200_AUDIO  0x0503
18586 +#define PCI_DEVICE_ID_NS_SCx200_VIDEO  0x0504
18587 +#define PCI_DEVICE_ID_NS_SCx200_XBUS   0x0505
18588 +#define PCI_DEVICE_ID_NS_SC1100_BRIDGE 0x0510
18589 +#define PCI_DEVICE_ID_NS_SC1100_SMI    0x0511
18590 +#define PCI_DEVICE_ID_NS_SC1100_XBUS   0x0515
18591 +#define PCI_DEVICE_ID_NS_87410         0xd001
18592 +
18593 +#define PCI_VENDOR_ID_TSENG            0x100c
18594 +#define PCI_DEVICE_ID_TSENG_W32P_2     0x3202
18595 +#define PCI_DEVICE_ID_TSENG_W32P_b     0x3205
18596 +#define PCI_DEVICE_ID_TSENG_W32P_c     0x3206
18597 +#define PCI_DEVICE_ID_TSENG_W32P_d     0x3207
18598 +#define PCI_DEVICE_ID_TSENG_ET6000     0x3208
18599 +
18600 +#define PCI_VENDOR_ID_WEITEK           0x100e
18601 +#define PCI_DEVICE_ID_WEITEK_P9000     0x9001
18602 +#define PCI_DEVICE_ID_WEITEK_P9100     0x9100
18603 +
18604 +#define PCI_VENDOR_ID_DEC              0x1011
18605 +#define PCI_DEVICE_ID_DEC_BRD          0x0001
18606 +#define PCI_DEVICE_ID_DEC_TULIP                0x0002
18607 +#define PCI_DEVICE_ID_DEC_TGA          0x0004
18608 +#define PCI_DEVICE_ID_DEC_TULIP_FAST   0x0009
18609 +#define PCI_DEVICE_ID_DEC_TGA2         0x000D
18610 +#define PCI_DEVICE_ID_DEC_FDDI         0x000F
18611 +#define PCI_DEVICE_ID_DEC_TULIP_PLUS   0x0014
18612 +#define PCI_DEVICE_ID_DEC_21142                0x0019
18613 +#define PCI_DEVICE_ID_DEC_21052                0x0021
18614 +#define PCI_DEVICE_ID_DEC_21150                0x0022
18615 +#define PCI_DEVICE_ID_DEC_21152                0x0024
18616 +#define PCI_DEVICE_ID_DEC_21153                0x0025
18617 +#define PCI_DEVICE_ID_DEC_21154                0x0026
18618 +#define PCI_DEVICE_ID_DEC_21285                0x1065
18619 +#define PCI_DEVICE_ID_COMPAQ_42XX      0x0046
18620 +
18621 +#define PCI_VENDOR_ID_CIRRUS           0x1013
18622 +#define PCI_DEVICE_ID_CIRRUS_7548      0x0038
18623 +#define PCI_DEVICE_ID_CIRRUS_5430      0x00a0
18624 +#define PCI_DEVICE_ID_CIRRUS_5434_4    0x00a4
18625 +#define PCI_DEVICE_ID_CIRRUS_5434_8    0x00a8
18626 +#define PCI_DEVICE_ID_CIRRUS_5436      0x00ac
18627 +#define PCI_DEVICE_ID_CIRRUS_5446      0x00b8
18628 +#define PCI_DEVICE_ID_CIRRUS_5480      0x00bc
18629 +#define PCI_DEVICE_ID_CIRRUS_5462      0x00d0
18630 +#define PCI_DEVICE_ID_CIRRUS_5464      0x00d4
18631 +#define PCI_DEVICE_ID_CIRRUS_5465      0x00d6
18632 +#define PCI_DEVICE_ID_CIRRUS_6729      0x1100
18633 +#define PCI_DEVICE_ID_CIRRUS_6832      0x1110
18634 +#define PCI_DEVICE_ID_CIRRUS_7542      0x1200
18635 +#define PCI_DEVICE_ID_CIRRUS_7543      0x1202
18636 +#define PCI_DEVICE_ID_CIRRUS_7541      0x1204
18637 +
18638 +#define PCI_VENDOR_ID_IBM              0x1014
18639 +#define PCI_DEVICE_ID_IBM_FIRE_CORAL   0x000a
18640 +#define PCI_DEVICE_ID_IBM_TR           0x0018
18641 +#define PCI_DEVICE_ID_IBM_82G2675      0x001d
18642 +#define PCI_DEVICE_ID_IBM_MCA          0x0020
18643 +#define PCI_DEVICE_ID_IBM_82351                0x0022
18644 +#define PCI_DEVICE_ID_IBM_PYTHON       0x002d
18645 +#define PCI_DEVICE_ID_IBM_SERVERAID    0x002e
18646 +#define PCI_DEVICE_ID_IBM_TR_WAKE      0x003e
18647 +#define PCI_DEVICE_ID_IBM_MPIC         0x0046
18648 +#define PCI_DEVICE_ID_IBM_3780IDSP     0x007d
18649 +#define PCI_DEVICE_ID_IBM_CHUKAR       0x0096
18650 +#define PCI_DEVICE_ID_IBM_CPC710_PCI64 0x00fc
18651 +#define PCI_DEVICE_ID_IBM_CPC710_PCI32 0x0105
18652 +#define        PCI_DEVICE_ID_IBM_405GP         0x0156
18653 +#define PCI_DEVICE_ID_IBM_SNIPE                0x0180
18654 +#define PCI_DEVICE_ID_IBM_SERVERAIDI960        0x01bd
18655 +#define PCI_DEVICE_ID_IBM_CITRINE              0x028C
18656 +#define PCI_DEVICE_ID_IBM_GEMSTONE             0xB166
18657 +#define PCI_DEVICE_ID_IBM_MPIC_2       0xffff
18658 +#define PCI_DEVICE_ID_IBM_ICOM_DEV_ID_1        0x0031
18659 +#define PCI_DEVICE_ID_IBM_ICOM_DEV_ID_2        0x0219
18660 +#define PCI_DEVICE_ID_IBM_ICOM_V2_TWO_PORTS_RVX                0x021A
18661 +#define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM    0x0251
18662 +#define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252
18663 +
18664 +#define PCI_VENDOR_ID_COMPEX2          0x101a // pci.ids says "AT&T GIS (NCR)"
18665 +#define PCI_DEVICE_ID_COMPEX2_100VG    0x0005
18666 +
18667 +#define PCI_VENDOR_ID_WD               0x101c
18668 +#define PCI_DEVICE_ID_WD_7197          0x3296
18669 +#define PCI_DEVICE_ID_WD_90C           0xc24a
18670 +
18671 +#define PCI_VENDOR_ID_AMI              0x101e
18672 +#define PCI_DEVICE_ID_AMI_MEGARAID3    0x1960
18673 +#define PCI_DEVICE_ID_AMI_MEGARAID     0x9010
18674 +#define PCI_DEVICE_ID_AMI_MEGARAID2    0x9060
18675 +
18676 +#define PCI_VENDOR_ID_AMD              0x1022
18677 +#define PCI_DEVICE_ID_AMD_LANCE                0x2000
18678 +#define PCI_DEVICE_ID_AMD_LANCE_HOME   0x2001
18679 +#define PCI_DEVICE_ID_AMD_SCSI         0x2020
18680 +#define PCI_DEVICE_ID_AMD_SERENADE     0x36c0
18681 +#define PCI_DEVICE_ID_AMD_FE_GATE_7006 0x7006
18682 +#define PCI_DEVICE_ID_AMD_FE_GATE_7007 0x7007
18683 +#define PCI_DEVICE_ID_AMD_FE_GATE_700C 0x700C
18684 +#define PCI_DEVICE_ID_AMD_FE_GATE_700D 0x700D
18685 +#define PCI_DEVICE_ID_AMD_FE_GATE_700E 0x700E
18686 +#define PCI_DEVICE_ID_AMD_FE_GATE_700F 0x700F
18687 +#define PCI_DEVICE_ID_AMD_COBRA_7400   0x7400
18688 +#define PCI_DEVICE_ID_AMD_COBRA_7401   0x7401
18689 +#define PCI_DEVICE_ID_AMD_COBRA_7403   0x7403
18690 +#define PCI_DEVICE_ID_AMD_COBRA_7404   0x7404
18691 +#define PCI_DEVICE_ID_AMD_VIPER_7408   0x7408
18692 +#define PCI_DEVICE_ID_AMD_VIPER_7409   0x7409
18693 +#define PCI_DEVICE_ID_AMD_VIPER_740B   0x740B
18694 +#define PCI_DEVICE_ID_AMD_VIPER_740C   0x740C
18695 +#define PCI_DEVICE_ID_AMD_VIPER_7410   0x7410
18696 +#define PCI_DEVICE_ID_AMD_VIPER_7411   0x7411
18697 +#define PCI_DEVICE_ID_AMD_VIPER_7413   0x7413
18698 +#define PCI_DEVICE_ID_AMD_VIPER_7414   0x7414
18699 +#define PCI_DEVICE_ID_AMD_OPUS_7440    0x7440
18700 +#      define PCI_DEVICE_ID_AMD_VIPER_7440     PCI_DEVICE_ID_AMD_OPUS_7440
18701 +#define PCI_DEVICE_ID_AMD_OPUS_7441    0x7441
18702 +#      define PCI_DEVICE_ID_AMD_VIPER_7441     PCI_DEVICE_ID_AMD_OPUS_7441
18703 +#define PCI_DEVICE_ID_AMD_OPUS_7443    0x7443
18704 +#      define PCI_DEVICE_ID_AMD_VIPER_7443     PCI_DEVICE_ID_AMD_OPUS_7443
18705 +#define PCI_DEVICE_ID_AMD_OPUS_7445    0x7445
18706 +#define PCI_DEVICE_ID_AMD_OPUS_7448    0x7448
18707 +# define       PCI_DEVICE_ID_AMD_VIPER_7448    PCI_DEVICE_ID_AMD_OPUS_7448
18708 +#define PCI_DEVICE_ID_AMD_OPUS_7449    0x7449
18709 +#      define PCI_DEVICE_ID_AMD_VIPER_7449     PCI_DEVICE_ID_AMD_OPUS_7449
18710 +#define PCI_DEVICE_ID_AMD_8111_LAN     0x7462
18711 +#define PCI_DEVICE_ID_AMD_8111_LPC     0x7468
18712 +#define PCI_DEVICE_ID_AMD_8111_IDE     0x7469
18713 +#define PCI_DEVICE_ID_AMD_8111_SMBUS2  0x746a
18714 +#define PCI_DEVICE_ID_AMD_8111_SMBUS   0x746b
18715 +#define PCI_DEVICE_ID_AMD_8111_AUDIO   0x746d
18716 +#define PCI_DEVICE_ID_AMD_8151_0       0x7454
18717 +#define PCI_DEVICE_ID_AMD_8131_APIC     0x7450
18718 +
18719 +#define PCI_VENDOR_ID_TRIDENT          0x1023
18720 +#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX        0x2000
18721 +#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX        0x2001
18722 +#define PCI_DEVICE_ID_TRIDENT_9320     0x9320
18723 +#define PCI_DEVICE_ID_TRIDENT_9388     0x9388
18724 +#define PCI_DEVICE_ID_TRIDENT_9397     0x9397
18725 +#define PCI_DEVICE_ID_TRIDENT_939A     0x939A
18726 +#define PCI_DEVICE_ID_TRIDENT_9520     0x9520
18727 +#define PCI_DEVICE_ID_TRIDENT_9525     0x9525
18728 +#define PCI_DEVICE_ID_TRIDENT_9420     0x9420
18729 +#define PCI_DEVICE_ID_TRIDENT_9440     0x9440
18730 +#define PCI_DEVICE_ID_TRIDENT_9660     0x9660
18731 +#define PCI_DEVICE_ID_TRIDENT_9750     0x9750
18732 +#define PCI_DEVICE_ID_TRIDENT_9850     0x9850
18733 +#define PCI_DEVICE_ID_TRIDENT_9880     0x9880
18734 +#define PCI_DEVICE_ID_TRIDENT_8400     0x8400
18735 +#define PCI_DEVICE_ID_TRIDENT_8420     0x8420
18736 +#define PCI_DEVICE_ID_TRIDENT_8500     0x8500
18737 +
18738 +#define PCI_VENDOR_ID_AI               0x1025
18739 +#define PCI_DEVICE_ID_AI_M1435         0x1435
18740 +
18741 +#define PCI_VENDOR_ID_DELL             0x1028
18742 +#define PCI_DEVICE_ID_DELL_RACIII      0x0008
18743 +#define PCI_DEVICE_ID_DELL_RAC4                0x0012
18744 +
18745 +#define PCI_VENDOR_ID_MATROX           0x102B
18746 +#define PCI_DEVICE_ID_MATROX_MGA_2     0x0518
18747 +#define PCI_DEVICE_ID_MATROX_MIL       0x0519
18748 +#define PCI_DEVICE_ID_MATROX_MYS       0x051A
18749 +#define PCI_DEVICE_ID_MATROX_MIL_2     0x051b
18750 +#define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f
18751 +#define PCI_DEVICE_ID_MATROX_MGA_IMP   0x0d10
18752 +#define PCI_DEVICE_ID_MATROX_G100_MM   0x1000
18753 +#define PCI_DEVICE_ID_MATROX_G100_AGP  0x1001
18754 +#define PCI_DEVICE_ID_MATROX_G200_PCI  0x0520
18755 +#define PCI_DEVICE_ID_MATROX_G200_AGP  0x0521
18756 +#define        PCI_DEVICE_ID_MATROX_G400       0x0525
18757 +#define PCI_DEVICE_ID_MATROX_G550      0x2527
18758 +#define PCI_DEVICE_ID_MATROX_VIA       0x4536
18759 +
18760 +#define PCI_VENDOR_ID_CT               0x102c
18761 +#define PCI_DEVICE_ID_CT_69000         0x00c0
18762 +#define PCI_DEVICE_ID_CT_65545         0x00d8
18763 +#define PCI_DEVICE_ID_CT_65548         0x00dc
18764 +#define PCI_DEVICE_ID_CT_65550         0x00e0
18765 +#define PCI_DEVICE_ID_CT_65554         0x00e4
18766 +#define PCI_DEVICE_ID_CT_65555         0x00e5
18767 +
18768 +#define PCI_VENDOR_ID_MIRO             0x1031
18769 +#define PCI_DEVICE_ID_MIRO_36050       0x5601
18770 +#define PCI_DEVICE_ID_MIRO_DC10PLUS    0x7efe
18771 +#define PCI_DEVICE_ID_MIRO_DC30PLUS    0xd801
18772 +
18773 +#define PCI_VENDOR_ID_NEC              0x1033
18774 +#define PCI_DEVICE_ID_NEC_CBUS_1       0x0001 /* PCI-Cbus Bridge */
18775 +#define PCI_DEVICE_ID_NEC_LOCAL                0x0002 /* Local Bridge */
18776 +#define PCI_DEVICE_ID_NEC_ATM          0x0003 /* ATM LAN Controller */
18777 +#define PCI_DEVICE_ID_NEC_R4000                0x0004 /* R4000 Bridge */
18778 +#define PCI_DEVICE_ID_NEC_486          0x0005 /* 486 Like Peripheral Bus Bridge */
18779 +#define PCI_DEVICE_ID_NEC_ACCEL_1      0x0006 /* Graphic Accelerator */
18780 +#define PCI_DEVICE_ID_NEC_UXBUS                0x0007 /* UX-Bus Bridge */
18781 +#define PCI_DEVICE_ID_NEC_ACCEL_2      0x0008 /* Graphic Accelerator */
18782 +#define PCI_DEVICE_ID_NEC_GRAPH                0x0009 /* PCI-CoreGraph Bridge */
18783 +#define PCI_DEVICE_ID_NEC_VL           0x0016 /* PCI-VL Bridge */
18784 +#define PCI_DEVICE_ID_NEC_STARALPHA2   0x002c /* STAR ALPHA2 */
18785 +#define PCI_DEVICE_ID_NEC_CBUS_2       0x002d /* PCI-Cbus Bridge */
18786 +#define PCI_DEVICE_ID_NEC_USB          0x0035 /* PCI-USB Host */
18787 +#define PCI_DEVICE_ID_NEC_CBUS_3       0x003b
18788 +#define PCI_DEVICE_ID_NEC_NAPCCARD     0x003e
18789 +#define PCI_DEVICE_ID_NEC_PCX2         0x0046 /* PowerVR */
18790 +#define PCI_DEVICE_ID_NEC_NILE4                0x005a
18791 +#define PCI_DEVICE_ID_NEC_VRC5476       0x009b
18792 +#define PCI_DEVICE_ID_NEC_VRC4173      0x00a5
18793 +#define PCI_DEVICE_ID_NEC_VRC5477_AC97  0x00a6
18794 +#define PCI_DEVICE_ID_NEC_PC9821CS01    0x800c /* PC-9821-CS01 */
18795 +#define PCI_DEVICE_ID_NEC_PC9821NRB06   0x800d /* PC-9821NR-B06 */
18796 +
18797 +#define PCI_VENDOR_ID_FD               0x1036
18798 +#define PCI_DEVICE_ID_FD_36C70         0x0000
18799 +
18800 +#define PCI_VENDOR_ID_SI               0x1039
18801 +#define PCI_DEVICE_ID_SI_5591_AGP      0x0001
18802 +#define PCI_DEVICE_ID_SI_6202          0x0002
18803 +#define PCI_DEVICE_ID_SI_503           0x0008
18804 +#define PCI_DEVICE_ID_SI_ACPI          0x0009
18805 +#define PCI_DEVICE_ID_SI_SMBUS         0x0016
18806 +#define PCI_DEVICE_ID_SI_LPC           0x0018
18807 +#define PCI_DEVICE_ID_SI_5597_VGA      0x0200
18808 +#define PCI_DEVICE_ID_SI_6205          0x0205
18809 +#define PCI_DEVICE_ID_SI_501           0x0406
18810 +#define PCI_DEVICE_ID_SI_496           0x0496
18811 +#define PCI_DEVICE_ID_SI_300           0x0300
18812 +#define PCI_DEVICE_ID_SI_315H          0x0310
18813 +#define PCI_DEVICE_ID_SI_315           0x0315
18814 +#define PCI_DEVICE_ID_SI_315PRO                0x0325
18815 +#define PCI_DEVICE_ID_SI_530           0x0530
18816 +#define PCI_DEVICE_ID_SI_540           0x0540
18817 +#define PCI_DEVICE_ID_SI_550           0x0550
18818 +#define PCI_DEVICE_ID_SI_540_VGA       0x5300
18819 +#define PCI_DEVICE_ID_SI_550_VGA       0x5315
18820 +#define PCI_DEVICE_ID_SI_601           0x0601
18821 +#define PCI_DEVICE_ID_SI_620           0x0620
18822 +#define PCI_DEVICE_ID_SI_630           0x0630
18823 +#define PCI_DEVICE_ID_SI_633           0x0633
18824 +#define PCI_DEVICE_ID_SI_635           0x0635
18825 +#define PCI_DEVICE_ID_SI_640           0x0640
18826 +#define PCI_DEVICE_ID_SI_645           0x0645
18827 +#define PCI_DEVICE_ID_SI_646           0x0646
18828 +#define PCI_DEVICE_ID_SI_648           0x0648
18829 +#define PCI_DEVICE_ID_SI_650           0x0650
18830 +#define PCI_DEVICE_ID_SI_651           0x0651
18831 +#define PCI_DEVICE_ID_SI_652           0x0652
18832 +#define PCI_DEVICE_ID_SI_655           0x0655
18833 +#define PCI_DEVICE_ID_SI_661           0x0661
18834 +#define PCI_DEVICE_ID_SI_730           0x0730
18835 +#define PCI_DEVICE_ID_SI_733           0x0733
18836 +#define PCI_DEVICE_ID_SI_630_VGA       0x6300
18837 +#define PCI_DEVICE_ID_SI_730_VGA       0x7300
18838 +#define PCI_DEVICE_ID_SI_735           0x0735
18839 +#define PCI_DEVICE_ID_SI_740           0x0740
18840 +#define PCI_DEVICE_ID_SI_741           0x0741
18841 +#define PCI_DEVICE_ID_SI_745           0x0745
18842 +#define PCI_DEVICE_ID_SI_746           0x0746
18843 +#define PCI_DEVICE_ID_SI_748           0x0748
18844 +#define PCI_DEVICE_ID_SI_750           0x0750
18845 +#define PCI_DEVICE_ID_SI_751           0x0751
18846 +#define PCI_DEVICE_ID_SI_752           0x0752
18847 +#define PCI_DEVICE_ID_SI_755           0x0755
18848 +#define PCI_DEVICE_ID_SI_760           0x0760
18849 +#define PCI_DEVICE_ID_SI_900           0x0900
18850 +#define PCI_DEVICE_ID_SI_961           0x0961
18851 +#define PCI_DEVICE_ID_SI_962           0x0962
18852 +#define PCI_DEVICE_ID_SI_963           0x0963
18853 +#define PCI_DEVICE_ID_SI_5107          0x5107
18854 +#define PCI_DEVICE_ID_SI_5300          0x5300
18855 +#define PCI_DEVICE_ID_SI_5511          0x5511
18856 +#define PCI_DEVICE_ID_SI_5513          0x5513
18857 +#define PCI_DEVICE_ID_SI_5518          0x5518
18858 +#define PCI_DEVICE_ID_SI_5571          0x5571
18859 +#define PCI_DEVICE_ID_SI_5581          0x5581
18860 +#define PCI_DEVICE_ID_SI_5582          0x5582
18861 +#define PCI_DEVICE_ID_SI_5591          0x5591
18862 +#define PCI_DEVICE_ID_SI_5596          0x5596
18863 +#define PCI_DEVICE_ID_SI_5597          0x5597
18864 +#define PCI_DEVICE_ID_SI_5598          0x5598
18865 +#define PCI_DEVICE_ID_SI_5600          0x5600
18866 +#define PCI_DEVICE_ID_SI_6300          0x6300
18867 +#define PCI_DEVICE_ID_SI_6306          0x6306
18868 +#define PCI_DEVICE_ID_SI_6326          0x6326
18869 +#define PCI_DEVICE_ID_SI_7001          0x7001
18870 +#define PCI_DEVICE_ID_SI_7012          0x7012
18871 +#define PCI_DEVICE_ID_SI_7016          0x7016
18872 +
18873 +#define PCI_VENDOR_ID_HP               0x103c
18874 +#define PCI_DEVICE_ID_HP_VISUALIZE_EG  0x1005
18875 +#define PCI_DEVICE_ID_HP_VISUALIZE_FX6 0x1006
18876 +#define PCI_DEVICE_ID_HP_VISUALIZE_FX4 0x1008
18877 +#define PCI_DEVICE_ID_HP_VISUALIZE_FX2 0x100a
18878 +#define PCI_DEVICE_ID_HP_TACHYON       0x1028
18879 +#define PCI_DEVICE_ID_HP_TACHLITE      0x1029
18880 +#define PCI_DEVICE_ID_HP_J2585A                0x1030
18881 +#define PCI_DEVICE_ID_HP_J2585B                0x1031
18882 +#define PCI_DEVICE_ID_HP_J2973A                0x1040
18883 +#define PCI_DEVICE_ID_HP_J2970A                0x1042
18884 +#define PCI_DEVICE_ID_HP_DIVA          0x1048
18885 +#define PCI_DEVICE_ID_HP_DIVA_TOSCA1   0x1049
18886 +#define PCI_DEVICE_ID_HP_DIVA_TOSCA2   0x104A
18887 +#define PCI_DEVICE_ID_HP_DIVA_MAESTRO  0x104B
18888 +#define PCI_DEVICE_ID_HP_PCI_LBA       0x1054
18889 +#define PCI_DEVICE_ID_HP_REO_SBA       0x10f0
18890 +#define PCI_DEVICE_ID_HP_REO_IOC       0x10f1
18891 +#define PCI_DEVICE_ID_HP_VISUALIZE_FXE 0x108b
18892 +#define PCI_DEVICE_ID_HP_DIVA_HALFDOME 0x1223
18893 +#define PCI_DEVICE_ID_HP_DIVA_KEYSTONE 0x1226
18894 +#define PCI_DEVICE_ID_HP_DIVA_POWERBAR 0x1227
18895 +#define PCI_DEVICE_ID_HP_ZX1_SBA       0x1229
18896 +#define PCI_DEVICE_ID_HP_ZX1_IOC       0x122a
18897 +#define PCI_DEVICE_ID_HP_PCIX_LBA      0x122e
18898 +#define PCI_DEVICE_ID_HP_SX1000_IOC    0x127c
18899 +#define PCI_DEVICE_ID_HP_DIVA_EVEREST  0x1282
18900 +#define PCI_DEVICE_ID_HP_DIVA_AUX      0x1290
18901 +#define PCI_DEVICE_ID_HP_DIVA_RMP3     0x1301
18902 +#define PCI_DEVICE_ID_HP_CISSA         0x3220
18903 +#define PCI_DEVICE_ID_HP_CISSB         0x3230
18904 +#define PCI_DEVICE_ID_HP_ZX2_IOC       0x4031
18905 +
18906 +#define PCI_VENDOR_ID_PCTECH           0x1042
18907 +#define PCI_DEVICE_ID_PCTECH_RZ1000    0x1000
18908 +#define PCI_DEVICE_ID_PCTECH_RZ1001    0x1001
18909 +#define PCI_DEVICE_ID_PCTECH_SAMURAI_0 0x3000
18910 +#define PCI_DEVICE_ID_PCTECH_SAMURAI_1 0x3010
18911 +#define PCI_DEVICE_ID_PCTECH_SAMURAI_IDE 0x3020
18912 +
18913 +#define PCI_VENDOR_ID_ASUSTEK          0x1043
18914 +#define PCI_DEVICE_ID_ASUSTEK_0675     0x0675
18915 +
18916 +#define PCI_VENDOR_ID_DPT              0x1044
18917 +#define PCI_DEVICE_ID_DPT              0xa400
18918 +
18919 +#define PCI_VENDOR_ID_OPTI             0x1045
18920 +#define PCI_DEVICE_ID_OPTI_92C178      0xc178
18921 +#define PCI_DEVICE_ID_OPTI_82C557      0xc557
18922 +#define PCI_DEVICE_ID_OPTI_82C558      0xc558
18923 +#define PCI_DEVICE_ID_OPTI_82C621      0xc621
18924 +#define PCI_DEVICE_ID_OPTI_82C700      0xc700
18925 +#define PCI_DEVICE_ID_OPTI_82C701      0xc701
18926 +#define PCI_DEVICE_ID_OPTI_82C814      0xc814
18927 +#define PCI_DEVICE_ID_OPTI_82C822      0xc822
18928 +#define PCI_DEVICE_ID_OPTI_82C861      0xc861
18929 +#define PCI_DEVICE_ID_OPTI_82C825      0xd568
18930 +
18931 +#define PCI_VENDOR_ID_ELSA             0x1048
18932 +#define PCI_DEVICE_ID_ELSA_MICROLINK   0x1000
18933 +#define PCI_DEVICE_ID_ELSA_QS3000      0x3000
18934 +
18935 +#define PCI_VENDOR_ID_SGS              0x104a
18936 +#define PCI_DEVICE_ID_SGS_2000         0x0008
18937 +#define PCI_DEVICE_ID_SGS_1764         0x0009
18938 +
18939 +#define PCI_VENDOR_ID_BUSLOGIC               0x104B
18940 +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140
18941 +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER    0x1040
18942 +#define PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT     0x8130
18943 +
18944 +#define PCI_VENDOR_ID_TI               0x104c
18945 +#define PCI_DEVICE_ID_TI_TVP4010       0x3d04
18946 +#define PCI_DEVICE_ID_TI_TVP4020       0x3d07
18947 +#define PCI_DEVICE_ID_TI_4450          0x8011
18948 +#define PCI_DEVICE_ID_TI_1130          0xac12
18949 +#define PCI_DEVICE_ID_TI_1031          0xac13
18950 +#define PCI_DEVICE_ID_TI_1131          0xac15
18951 +#define PCI_DEVICE_ID_TI_1250          0xac16
18952 +#define PCI_DEVICE_ID_TI_1220          0xac17
18953 +#define PCI_DEVICE_ID_TI_1221          0xac19
18954 +#define PCI_DEVICE_ID_TI_1210          0xac1a
18955 +#define PCI_DEVICE_ID_TI_1450          0xac1b
18956 +#define PCI_DEVICE_ID_TI_1225          0xac1c
18957 +#define PCI_DEVICE_ID_TI_1251A         0xac1d
18958 +#define PCI_DEVICE_ID_TI_1211          0xac1e
18959 +#define PCI_DEVICE_ID_TI_1251B         0xac1f
18960 +#define PCI_DEVICE_ID_TI_4410          0xac41
18961 +#define PCI_DEVICE_ID_TI_4451          0xac42
18962 +#define PCI_DEVICE_ID_TI_4510          0xac44
18963 +#define PCI_DEVICE_ID_TI_4520          0xac46
18964 +#define PCI_DEVICE_ID_TI_1410          0xac50
18965 +#define PCI_DEVICE_ID_TI_1420          0xac51
18966 +#define PCI_DEVICE_ID_TI_1451A         0xac52
18967 +#define PCI_DEVICE_ID_TI_1620          0xac54
18968 +#define PCI_DEVICE_ID_TI_1520          0xac55
18969 +#define PCI_DEVICE_ID_TI_1510          0xac56
18970 +
18971 +#define PCI_VENDOR_ID_SONY             0x104d
18972 +#define PCI_DEVICE_ID_SONY_CXD3222     0x8039
18973 +
18974 +#define PCI_VENDOR_ID_OAK              0x104e
18975 +#define PCI_DEVICE_ID_OAK_OTI107       0x0107
18976 +
18977 +/* Winbond have two vendor IDs! See 0x10ad as well */
18978 +#define PCI_VENDOR_ID_WINBOND2         0x1050
18979 +#define PCI_DEVICE_ID_WINBOND2_89C940  0x0940
18980 +#define PCI_DEVICE_ID_WINBOND2_89C940F 0x5a5a
18981 +#define PCI_DEVICE_ID_WINBOND2_6692    0x6692
18982 +
18983 +#define PCI_VENDOR_ID_ANIGMA           0x1051
18984 +#define PCI_DEVICE_ID_ANIGMA_MC145575  0x0100
18985 +  
18986 +#define PCI_VENDOR_ID_EFAR             0x1055
18987 +#define PCI_DEVICE_ID_EFAR_SLC90E66_1  0x9130
18988 +#define PCI_DEVICE_ID_EFAR_SLC90E66_0  0x9460
18989 +#define PCI_DEVICE_ID_EFAR_SLC90E66_2  0x9462
18990 +#define PCI_DEVICE_ID_EFAR_SLC90E66_3  0x9463
18991 +
18992 +#define PCI_VENDOR_ID_MOTOROLA         0x1057
18993 +#define PCI_VENDOR_ID_MOTOROLA_OOPS    0x1507
18994 +#define PCI_DEVICE_ID_MOTOROLA_MPC105  0x0001
18995 +#define PCI_DEVICE_ID_MOTOROLA_MPC106  0x0002
18996 +#define PCI_DEVICE_ID_MOTOROLA_MPC107  0x0004
18997 +#define PCI_DEVICE_ID_MOTOROLA_RAVEN   0x4801
18998 +#define PCI_DEVICE_ID_MOTOROLA_FALCON  0x4802
18999 +#define PCI_DEVICE_ID_MOTOROLA_HAWK    0x4803
19000 +#define PCI_DEVICE_ID_MOTOROLA_CPX8216 0x4806
19001 +#define PCI_DEVICE_ID_MOTOROLA_HARRIER 0x480b
19002 +#define PCI_DEVICE_ID_MOTOROLA_MPC5200 0x5803
19003 +
19004 +#define PCI_VENDOR_ID_PROMISE          0x105a
19005 +#define PCI_DEVICE_ID_PROMISE_20265    0x0d30
19006 +#define PCI_DEVICE_ID_PROMISE_20267    0x4d30
19007 +#define PCI_DEVICE_ID_PROMISE_20246    0x4d33
19008 +#define PCI_DEVICE_ID_PROMISE_20262    0x4d38
19009 +#define PCI_DEVICE_ID_PROMISE_20263    0x0D38
19010 +#define PCI_DEVICE_ID_PROMISE_20268    0x4d68
19011 +#define PCI_DEVICE_ID_PROMISE_20268R   0x6268
19012 +#define PCI_DEVICE_ID_PROMISE_20269    0x4d69
19013 +#define PCI_DEVICE_ID_PROMISE_20270    0x6268
19014 +#define PCI_DEVICE_ID_PROMISE_20271    0x6269
19015 +#define PCI_DEVICE_ID_PROMISE_20275    0x1275
19016 +#define PCI_DEVICE_ID_PROMISE_20276    0x5275
19017 +#define PCI_DEVICE_ID_PROMISE_20277    0x7275
19018 +#define PCI_DEVICE_ID_PROMISE_5300     0x5300
19019 +
19020 +#define PCI_VENDOR_ID_N9               0x105d
19021 +#define PCI_DEVICE_ID_N9_I128          0x2309
19022 +#define PCI_DEVICE_ID_N9_I128_2                0x2339
19023 +#define PCI_DEVICE_ID_N9_I128_T2R      0x493d
19024 +
19025 +#define PCI_VENDOR_ID_UMC              0x1060
19026 +#define PCI_DEVICE_ID_UMC_UM8673F      0x0101
19027 +#define PCI_DEVICE_ID_UMC_UM8891A      0x0891
19028 +#define PCI_DEVICE_ID_UMC_UM8886BF     0x673a
19029 +#define PCI_DEVICE_ID_UMC_UM8886A      0x886a
19030 +#define PCI_DEVICE_ID_UMC_UM8881F      0x8881
19031 +#define PCI_DEVICE_ID_UMC_UM8886F      0x8886
19032 +#define PCI_DEVICE_ID_UMC_UM9017F      0x9017
19033 +#define PCI_DEVICE_ID_UMC_UM8886N      0xe886
19034 +#define PCI_DEVICE_ID_UMC_UM8891N      0xe891
19035 +
19036 +#define PCI_VENDOR_ID_X                        0x1061
19037 +#define PCI_DEVICE_ID_X_AGX016         0x0001
19038 +
19039 +#define PCI_VENDOR_ID_MYLEX            0x1069
19040 +#define PCI_DEVICE_ID_MYLEX_DAC960_P   0x0001
19041 +#define PCI_DEVICE_ID_MYLEX_DAC960_PD  0x0002
19042 +#define PCI_DEVICE_ID_MYLEX_DAC960_PG  0x0010
19043 +#define PCI_DEVICE_ID_MYLEX_DAC960_LA  0x0020
19044 +#define PCI_DEVICE_ID_MYLEX_DAC960_LP  0x0050
19045 +#define PCI_DEVICE_ID_MYLEX_DAC960_BA  0xBA56
19046 +#define PCI_DEVICE_ID_MYLEX_DAC960_GEM 0xB166
19047 +
19048 +#define PCI_VENDOR_ID_PICOP            0x1066
19049 +#define PCI_DEVICE_ID_PICOP_PT86C52X   0x0001
19050 +#define PCI_DEVICE_ID_PICOP_PT80C524   0x8002
19051 +
19052 +#define PCI_VENDOR_ID_APPLE            0x106b
19053 +#define PCI_DEVICE_ID_APPLE_BANDIT     0x0001
19054 +#define PCI_DEVICE_ID_APPLE_GC         0x0002
19055 +#define PCI_DEVICE_ID_APPLE_HYDRA      0x000e
19056 +#define PCI_DEVICE_ID_APPLE_UNI_N_FW   0x0018
19057 +#define PCI_DEVICE_ID_APPLE_KL_USB     0x0019
19058 +#define PCI_DEVICE_ID_APPLE_UNI_N_AGP  0x0020
19059 +#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC 0x0021
19060 +#define PCI_DEVICE_ID_APPLE_KEYLARGO   0x0022
19061 +#define PCI_DEVICE_ID_APPLE_UNI_N_GMACP        0x0024
19062 +#define PCI_DEVICE_ID_APPLE_KEYLARGO_P 0x0025
19063 +#define PCI_DEVICE_ID_APPLE_KL_USB_P   0x0026
19064 +#define PCI_DEVICE_ID_APPLE_UNI_N_AGP_P        0x0027
19065 +#define PCI_DEVICE_ID_APPLE_UNI_N_AGP15        0x002d
19066 +#define PCI_DEVICE_ID_APPLE_UNI_N_PCI15        0x002e
19067 +#define PCI_DEVICE_ID_APPLE_UNI_N_FW2  0x0030
19068 +#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2        0x0032
19069 +#define PCI_DEVIEC_ID_APPLE_UNI_N_ATA  0x0033
19070 +#define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034
19071 +#define PCI_DEVICE_ID_APPLE_IPID_ATA100        0x003b
19072 +#define PCI_DEVICE_ID_APPLE_KEYLARGO_I 0x003e
19073 +#define PCI_DEVICE_ID_APPLE_K2_ATA100  0x0043
19074 +#define PCI_DEVICE_ID_APPLE_U3_AGP     0x004b
19075 +#define PCI_DEVICE_ID_APPLE_K2_GMAC    0x004c
19076 +#define PCI_DEVICE_ID_APPLE_SH_ATA      0x0050
19077 +#define PCI_DEVICE_ID_APPLE_SH_SUNGEM   0x0051
19078 +#define PCI_DEVICE_ID_APPLE_SH_FW       0x0052
19079 +#define PCI_DEVICE_ID_APPLE_U3L_AGP    0x0058
19080 +#define PCI_DEVICE_ID_APPLE_U3H_AGP    0x0059
19081 +#define PCI_DEVICE_ID_APPLE_TIGON3     0x1645
19082 +
19083 +#define PCI_VENDOR_ID_YAMAHA           0x1073
19084 +#define PCI_DEVICE_ID_YAMAHA_724       0x0004
19085 +#define PCI_DEVICE_ID_YAMAHA_724F      0x000d
19086 +#define PCI_DEVICE_ID_YAMAHA_740       0x000a
19087 +#define PCI_DEVICE_ID_YAMAHA_740C      0x000c
19088 +#define PCI_DEVICE_ID_YAMAHA_744       0x0010
19089 +#define PCI_DEVICE_ID_YAMAHA_754       0x0012
19090 +
19091 +#define PCI_VENDOR_ID_NEXGEN           0x1074
19092 +#define PCI_DEVICE_ID_NEXGEN_82C501    0x4e78
19093 +
19094 +#define PCI_VENDOR_ID_QLOGIC           0x1077
19095 +#define PCI_DEVICE_ID_QLOGIC_ISP1020   0x1020
19096 +#define PCI_DEVICE_ID_QLOGIC_ISP1022   0x1022
19097 +#define PCI_DEVICE_ID_QLOGIC_ISP2100   0x2100
19098 +#define PCI_DEVICE_ID_QLOGIC_ISP2200   0x2200
19099 +
19100 +#define PCI_VENDOR_ID_CYRIX            0x1078
19101 +#define PCI_DEVICE_ID_CYRIX_5510       0x0000
19102 +#define PCI_DEVICE_ID_CYRIX_PCI_MASTER 0x0001
19103 +#define PCI_DEVICE_ID_CYRIX_5520       0x0002
19104 +#define PCI_DEVICE_ID_CYRIX_5530_LEGACY        0x0100
19105 +#define PCI_DEVICE_ID_CYRIX_5530_SMI   0x0101
19106 +#define PCI_DEVICE_ID_CYRIX_5530_IDE   0x0102
19107 +#define PCI_DEVICE_ID_CYRIX_5530_AUDIO 0x0103
19108 +#define PCI_DEVICE_ID_CYRIX_5530_VIDEO 0x0104
19109 +
19110 +#define PCI_VENDOR_ID_LEADTEK          0x107d
19111 +#define PCI_DEVICE_ID_LEADTEK_805      0x0000
19112 +
19113 +#define PCI_VENDOR_ID_INTERPHASE       0x107e
19114 +#define PCI_DEVICE_ID_INTERPHASE_5526  0x0004
19115 +#define PCI_DEVICE_ID_INTERPHASE_55x6  0x0005
19116 +#define PCI_DEVICE_ID_INTERPHASE_5575  0x0008
19117 +
19118 +#define PCI_VENDOR_ID_CONTAQ           0x1080
19119 +#define PCI_DEVICE_ID_CONTAQ_82C599    0x0600
19120 +#define PCI_DEVICE_ID_CONTAQ_82C693    0xc693
19121 +
19122 +#define PCI_VENDOR_ID_FOREX            0x1083
19123 +
19124 +#define PCI_VENDOR_ID_OLICOM           0x108d
19125 +#define PCI_DEVICE_ID_OLICOM_OC3136    0x0001
19126 +#define PCI_DEVICE_ID_OLICOM_OC2315    0x0011
19127 +#define PCI_DEVICE_ID_OLICOM_OC2325    0x0012
19128 +#define PCI_DEVICE_ID_OLICOM_OC2183    0x0013
19129 +#define PCI_DEVICE_ID_OLICOM_OC2326    0x0014
19130 +#define PCI_DEVICE_ID_OLICOM_OC6151    0x0021
19131 +
19132 +#define PCI_VENDOR_ID_SUN              0x108e
19133 +#define PCI_DEVICE_ID_SUN_EBUS         0x1000
19134 +#define PCI_DEVICE_ID_SUN_HAPPYMEAL    0x1001
19135 +#define PCI_DEVICE_ID_SUN_RIO_EBUS     0x1100
19136 +#define PCI_DEVICE_ID_SUN_RIO_GEM      0x1101
19137 +#define PCI_DEVICE_ID_SUN_RIO_1394     0x1102
19138 +#define PCI_DEVICE_ID_SUN_RIO_USB      0x1103
19139 +#define PCI_DEVICE_ID_SUN_GEM          0x2bad
19140 +#define PCI_DEVICE_ID_SUN_SIMBA                0x5000
19141 +#define PCI_DEVICE_ID_SUN_PBM          0x8000
19142 +#define PCI_DEVICE_ID_SUN_SCHIZO       0x8001
19143 +#define PCI_DEVICE_ID_SUN_SABRE                0xa000
19144 +#define PCI_DEVICE_ID_SUN_HUMMINGBIRD  0xa001
19145 +#define PCI_DEVICE_ID_SUN_TOMATILLO    0xa801
19146 +
19147 +#define PCI_VENDOR_ID_CMD              0x1095
19148 +#define PCI_DEVICE_ID_CMD_640          0x0640
19149 +#define PCI_DEVICE_ID_CMD_643          0x0643
19150 +#define PCI_DEVICE_ID_CMD_646          0x0646
19151 +#define PCI_DEVICE_ID_CMD_647          0x0647
19152 +#define PCI_DEVICE_ID_CMD_648          0x0648
19153 +#define PCI_DEVICE_ID_CMD_649          0x0649
19154 +#define PCI_DEVICE_ID_CMD_670          0x0670
19155 +#define PCI_DEVICE_ID_CMD_680          0x0680
19156 +
19157 +#define PCI_DEVICE_ID_SII_680          0x0680
19158 +#define PCI_DEVICE_ID_SII_3112         0x3112
19159 +#define PCI_DEVICE_ID_SII_1210SA       0x0240
19160 +
19161 +#define PCI_VENDOR_ID_VISION           0x1098
19162 +#define PCI_DEVICE_ID_VISION_QD8500    0x0001
19163 +#define PCI_DEVICE_ID_VISION_QD8580    0x0002
19164 +
19165 +#define PCI_VENDOR_ID_BROOKTREE                0x109e
19166 +#define PCI_DEVICE_ID_BROOKTREE_848    0x0350
19167 +#define PCI_DEVICE_ID_BROOKTREE_849A   0x0351
19168 +#define PCI_DEVICE_ID_BROOKTREE_878_1  0x036e
19169 +#define PCI_DEVICE_ID_BROOKTREE_878    0x0878
19170 +#define PCI_DEVICE_ID_BROOKTREE_8474   0x8474
19171 +
19172 +#define PCI_VENDOR_ID_SIERRA           0x10a8
19173 +#define PCI_DEVICE_ID_SIERRA_STB       0x0000
19174 +
19175 +#define PCI_VENDOR_ID_SGI              0x10a9
19176 +#define PCI_DEVICE_ID_SGI_IOC3         0x0003
19177 +#define PCI_DEVICE_ID_SGI_IOC4         0x100a
19178 +#define PCI_VENDOR_ID_SGI_LITHIUM      0x1002
19179 +
19180 +#define PCI_VENDOR_ID_ACC              0x10aa
19181 +#define PCI_DEVICE_ID_ACC_2056         0x0000
19182 +
19183 +#define PCI_VENDOR_ID_WINBOND          0x10ad
19184 +#define PCI_DEVICE_ID_WINBOND_83769    0x0001
19185 +#define PCI_DEVICE_ID_WINBOND_82C105   0x0105
19186 +#define PCI_DEVICE_ID_WINBOND_83C553   0x0565
19187 +
19188 +#define PCI_VENDOR_ID_DATABOOK         0x10b3
19189 +#define PCI_DEVICE_ID_DATABOOK_87144   0xb106
19190 +
19191 +#define PCI_VENDOR_ID_PLX              0x10b5
19192 +#define PCI_DEVICE_ID_PLX_R685         0x1030
19193 +#define PCI_DEVICE_ID_PLX_ROMULUS      0x106a
19194 +#define PCI_DEVICE_ID_PLX_SPCOM800     0x1076
19195 +#define PCI_DEVICE_ID_PLX_1077         0x1077
19196 +#define PCI_DEVICE_ID_PLX_SPCOM200     0x1103
19197 +#define PCI_DEVICE_ID_PLX_DJINN_ITOO   0x1151
19198 +#define PCI_DEVICE_ID_PLX_R753         0x1152
19199 +#define PCI_DEVICE_ID_PLX_9030         0x9030
19200 +#define PCI_DEVICE_ID_PLX_9050         0x9050
19201 +#define PCI_DEVICE_ID_PLX_9060         0x9060
19202 +#define PCI_DEVICE_ID_PLX_9060ES       0x906E
19203 +#define PCI_DEVICE_ID_PLX_9060SD       0x906D
19204 +#define PCI_DEVICE_ID_PLX_9080         0x9080
19205 +#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001
19206 +
19207 +#define PCI_VENDOR_ID_MADGE            0x10b6
19208 +#define PCI_DEVICE_ID_MADGE_MK2                0x0002
19209 +#define PCI_DEVICE_ID_MADGE_C155S      0x1001
19210 +
19211 +#define PCI_VENDOR_ID_3COM             0x10b7
19212 +#define PCI_DEVICE_ID_3COM_3C985       0x0001
19213 +#define PCI_DEVICE_ID_3COM_3C940       0x1700
19214 +#define PCI_DEVICE_ID_3COM_3C339       0x3390
19215 +#define PCI_DEVICE_ID_3COM_3C359       0x3590
19216 +#define PCI_DEVICE_ID_3COM_3C590       0x5900
19217 +#define PCI_DEVICE_ID_3COM_3C595TX     0x5950
19218 +#define PCI_DEVICE_ID_3COM_3C595T4     0x5951
19219 +#define PCI_DEVICE_ID_3COM_3C595MII    0x5952
19220 +#define PCI_DEVICE_ID_3COM_3C940B      0x80eb
19221 +#define PCI_DEVICE_ID_3COM_3C900TPO    0x9000
19222 +#define PCI_DEVICE_ID_3COM_3C900COMBO  0x9001
19223 +#define PCI_DEVICE_ID_3COM_3C905TX     0x9050
19224 +#define PCI_DEVICE_ID_3COM_3C905T4     0x9051
19225 +#define PCI_DEVICE_ID_3COM_3C905B_TX   0x9055
19226 +#define PCI_DEVICE_ID_3COM_3CR990      0x9900
19227 +#define PCI_DEVICE_ID_3COM_3CR990_TX_95        0x9902
19228 +#define PCI_DEVICE_ID_3COM_3CR990_TX_97        0x9903
19229 +#define PCI_DEVICE_ID_3COM_3CR990B     0x9904
19230 +#define PCI_DEVICE_ID_3COM_3CR990_FX   0x9905
19231 +#define PCI_DEVICE_ID_3COM_3CR990SVR95 0x9908
19232 +#define PCI_DEVICE_ID_3COM_3CR990SVR97 0x9909
19233 +#define PCI_DEVICE_ID_3COM_3CR990SVR   0x990a
19234 +
19235 +#define PCI_VENDOR_ID_SMC              0x10b8
19236 +#define PCI_DEVICE_ID_SMC_EPIC100      0x0005
19237 +
19238 +#define PCI_VENDOR_ID_AL               0x10b9
19239 +#define PCI_DEVICE_ID_AL_M1445         0x1445
19240 +#define PCI_DEVICE_ID_AL_M1449         0x1449
19241 +#define PCI_DEVICE_ID_AL_M1451         0x1451
19242 +#define PCI_DEVICE_ID_AL_M1461         0x1461
19243 +#define PCI_DEVICE_ID_AL_M1489         0x1489
19244 +#define PCI_DEVICE_ID_AL_M1511         0x1511
19245 +#define PCI_DEVICE_ID_AL_M1513         0x1513
19246 +#define PCI_DEVICE_ID_AL_M1521         0x1521
19247 +#define PCI_DEVICE_ID_AL_M1523         0x1523
19248 +#define PCI_DEVICE_ID_AL_M1531         0x1531
19249 +#define PCI_DEVICE_ID_AL_M1533         0x1533
19250 +#define PCI_DEVICE_ID_AL_M1535                 0x1535
19251 +#define PCI_DEVICE_ID_AL_M1541         0x1541
19252 +#define PCI_DEVICE_ID_AL_M1543         0x1543
19253 +#define PCI_DEVICE_ID_AL_M1563         0x1563
19254 +#define PCI_DEVICE_ID_AL_M1621         0x1621
19255 +#define PCI_DEVICE_ID_AL_M1631         0x1631
19256 +#define PCI_DEVICE_ID_AL_M1632         0x1632
19257 +#define PCI_DEVICE_ID_AL_M1641         0x1641
19258 +#define PCI_DEVICE_ID_AL_M1644         0x1644
19259 +#define PCI_DEVICE_ID_AL_M1647         0x1647
19260 +#define PCI_DEVICE_ID_AL_M1651         0x1651
19261 +#define PCI_DEVICE_ID_AL_M1671         0x1671
19262 +#define PCI_DEVICE_ID_AL_M1681         0x1681
19263 +#define PCI_DEVICE_ID_AL_M1683         0x1683
19264 +#define PCI_DEVICE_ID_AL_M1689         0x1689
19265 +#define PCI_DEVICE_ID_AL_M3307         0x3307
19266 +#define PCI_DEVICE_ID_AL_M4803         0x5215
19267 +#define PCI_DEVICE_ID_AL_M5219         0x5219
19268 +#define PCI_DEVICE_ID_AL_M5228         0x5228
19269 +#define PCI_DEVICE_ID_AL_M5229         0x5229
19270 +#define PCI_DEVICE_ID_AL_M5237         0x5237
19271 +#define PCI_DEVICE_ID_AL_M5243         0x5243
19272 +#define PCI_DEVICE_ID_AL_M5451         0x5451
19273 +#define PCI_DEVICE_ID_AL_M7101         0x7101
19274 +
19275 +#define PCI_VENDOR_ID_MITSUBISHI       0x10ba
19276 +
19277 +#define PCI_VENDOR_ID_SURECOM          0x10bd
19278 +#define PCI_DEVICE_ID_SURECOM_NE34     0x0e34
19279 +
19280 +#define PCI_VENDOR_ID_NEOMAGIC         0x10c8
19281 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2070 0x0001
19282 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128V 0x0002
19283 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZV 0x0003
19284 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2160 0x0004
19285 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICMEDIA_256AV       0x0005
19286 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZVPLUS   0x0083
19287 +
19288 +#define PCI_VENDOR_ID_ASP              0x10cd
19289 +#define PCI_DEVICE_ID_ASP_ABP940       0x1200
19290 +#define PCI_DEVICE_ID_ASP_ABP940U      0x1300
19291 +#define PCI_DEVICE_ID_ASP_ABP940UW     0x2300
19292 +
19293 +#define PCI_VENDOR_ID_MACRONIX         0x10d9
19294 +#define PCI_DEVICE_ID_MACRONIX_MX98713 0x0512
19295 +#define PCI_DEVICE_ID_MACRONIX_MX987x5 0x0531
19296 +
19297 +#define PCI_VENDOR_ID_TCONRAD          0x10da
19298 +#define PCI_DEVICE_ID_TCONRAD_TOKENRING        0x0508
19299 +
19300 +#define PCI_VENDOR_ID_CERN             0x10dc
19301 +#define PCI_DEVICE_ID_CERN_SPSB_PMC    0x0001
19302 +#define PCI_DEVICE_ID_CERN_SPSB_PCI    0x0002
19303 +#define PCI_DEVICE_ID_CERN_HIPPI_DST   0x0021
19304 +#define PCI_DEVICE_ID_CERN_HIPPI_SRC   0x0022
19305 +
19306 +#define PCI_VENDOR_ID_NVIDIA                   0x10de
19307 +#define PCI_DEVICE_ID_NVIDIA_TNT               0x0020
19308 +#define PCI_DEVICE_ID_NVIDIA_TNT2              0x0028
19309 +#define PCI_DEVICE_ID_NVIDIA_UTNT2             0x0029
19310 +#define PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN        0x002a
19311 +#define PCI_DEVICE_ID_NVIDIA_VTNT2             0x002C
19312 +#define PCI_DEVICE_ID_NVIDIA_UVTNT2            0x002D
19313 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE  0x0035
19314 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036
19315 +#define PCI_DEVICE_ID_NVIDIA_NVENET_10         0x0037
19316 +#define PCI_DEVICE_ID_NVIDIA_NVENET_11         0x0038
19317 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2        0x003e
19318 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_ULTRA 0x0040
19319 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800       0x0041
19320 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_LE    0x0042
19321 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_GT    0x0045
19322 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_4000     0x004E
19323 +#define PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS     0x0052
19324 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE  0x0053
19325 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA 0x0054
19326 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2        0x0055
19327 +#define PCI_DEVICE_ID_NVIDIA_NVENET_8          0x0056
19328 +#define PCI_DEVICE_ID_NVIDIA_NVENET_9          0x0057
19329 +#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO       0x0059
19330 +#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS     0x0064
19331 +#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE       0x0065
19332 +#define PCI_DEVICE_ID_NVIDIA_NVENET_2          0x0066
19333 +#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO                0x006a
19334 +#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS    0x0084
19335 +#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE      0x0085
19336 +#define PCI_DEVICE_ID_NVIDIA_NVENET_4          0x0086
19337 +#define PCI_DEVICE_ID_NVIDIA_NVENET_5          0x008c
19338 +#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA     0x008e
19339 +#define PCI_DEVICE_ID_NVIDIA_ITNT2             0x00A0
19340 +#define PCI_DEVICE_ID_GEFORCE_6800A             0x00c1
19341 +#define PCI_DEVICE_ID_GEFORCE_6800A_LE          0x00c2
19342 +#define PCI_DEVICE_ID_GEFORCE_GO_6800           0x00c8
19343 +#define PCI_DEVICE_ID_GEFORCE_GO_6800_ULTRA     0x00c9
19344 +#define PCI_DEVICE_ID_QUADRO_FX_GO1400          0x00cc
19345 +#define PCI_DEVICE_ID_QUADRO_FX_1400            0x00ce
19346 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3           0x00d1
19347 +#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO                0x00da
19348 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS     0x00d4
19349 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE       0x00d5
19350 +#define PCI_DEVICE_ID_NVIDIA_NVENET_3          0x00d6
19351 +#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO                0x00da
19352 +#define PCI_DEVICE_ID_NVIDIA_NVENET_7          0x00df
19353 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3S          0x00e1
19354 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA     0x00e3
19355 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS    0x00e4
19356 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE      0x00e5
19357 +#define PCI_DEVICE_ID_NVIDIA_NVENET_6          0x00e6
19358 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2    0x00ee
19359 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR       0x0100
19360 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR       0x0101
19361 +#define PCI_DEVICE_ID_NVIDIA_QUADRO            0x0103
19362 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX       0x0110
19363 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX2      0x0111
19364 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GO       0x0112
19365 +#define PCI_DEVICE_ID_NVIDIA_QUADRO2_MXR       0x0113
19366 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6600_GT   0x0140
19367 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6600      0x0141
19368 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6610_XL   0x0145
19369 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_540     0x014E
19370 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6200      0x014F
19371 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS      0x0150
19372 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS2     0x0151
19373 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_ULTRA    0x0152
19374 +#define PCI_DEVICE_ID_NVIDIA_QUADRO2_PRO       0x0153
19375 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6200_TURBOCACHE 0x0161
19376 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6200    0x0164
19377 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6250    0x0166
19378 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6200_1  0x0167
19379 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6250_1  0x0168
19380 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_460   0x0170
19381 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440   0x0171
19382 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420   0x0172
19383 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440_SE        0x0173
19384 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_440_GO   0x0174
19385 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_420_GO   0x0175
19386 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_420_GO_M32 0x0176
19387 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_460_GO    0x0177
19388 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_500XGL    0x0178
19389 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_440_GO_M64 0x0179
19390 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_200       0x017A
19391 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_550XGL    0x017B
19392 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_500_GOGL  0x017C
19393 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_410_GO_M16 0x017D
19394 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440_8X 0x0181
19395 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440SE_8X 0x0182
19396 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420_8X 0x0183
19397 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_448_GO    0x0186
19398 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_488_GO    0x0187
19399 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_580_XGL    0x0188
19400 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_MAC    0x0189
19401 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_280_NVS    0x018A
19402 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_380_XGL    0x018B
19403 +#define PCI_DEVICE_ID_NVIDIA_IGEFORCE2         0x01a0
19404 +#define PCI_DEVICE_ID_NVIDIA_NFORCE            0x01a4
19405 +#define PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO                0x01b1
19406 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS      0x01b4
19407 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE                0x01bc
19408 +#define PCI_DEVICE_ID_NVIDIA_NVENET_1          0x01c3
19409 +#define PCI_DEVICE_ID_NVIDIA_NFORCE2           0x01e0
19410 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE3          0x0200
19411 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE3_1                0x0201
19412 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE3_2                0x0202
19413 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_DDC                0x0203
19414 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B      0x0211
19415 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B_LE   0x0212
19416 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B_GT   0x0215
19417 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4600  0x0250
19418 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4400  0x0251
19419 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4200  0x0253
19420 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL    0x0258
19421 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL    0x0259
19422 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL    0x025B
19423 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE  0x0265
19424 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266
19425 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2        0x0267
19426 +#define PCI_DEVICE_ID_NVIDIA_NVENET_12         0x0268
19427 +#define PCI_DEVICE_ID_NVIDIA_NVENET_13         0x0269
19428 +#define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO       0x026B
19429 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800  0x0280
19430 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X    0x0281
19431 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE     0x0282
19432 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_4200_GO       0x0286
19433 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_980_XGL        0x0288
19434 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_780_XGL        0x0289
19435 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_700_GOGL       0x028C
19436 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5800_ULTRA  0x0301
19437 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5800        0x0302
19438 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_2000         0x0308
19439 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1000         0x0309
19440 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600_ULTRA  0x0311
19441 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600        0x0312
19442 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600SE      0x0314
19443 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5600      0x031A
19444 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5650      0x031B
19445 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO700        0x031C
19446 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200        0x0320
19447 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200_ULTRA  0x0321
19448 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200_1      0x0322
19449 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200SE      0x0323
19450 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5200      0x0324
19451 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5250      0x0325
19452 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5500        0x0326
19453 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5100        0x0327
19454 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5250_32   0x0328
19455 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO_5200            0x0329
19456 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_NVS_280_PCI     0x032A
19457 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_500          0x032B
19458 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5300      0x032C
19459 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5100      0x032D
19460 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900_ULTRA  0x0330
19461 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900        0x0331
19462 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900XT      0x0332
19463 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5950_ULTRA  0x0333
19464 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900ZT      0x0334
19465 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_3000         0x0338
19466 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_700          0x033F
19467 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700_ULTRA  0x0341
19468 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700        0x0342
19469 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700LE      0x0343
19470 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700VE      0x0344
19471 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_1    0x0347
19472 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2    0x0348
19473 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000       0x034C
19474 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100         0x034E
19475 +
19476 +#define PCI_VENDOR_ID_IMS              0x10e0
19477 +#define PCI_DEVICE_ID_IMS_8849         0x8849
19478 +#define PCI_DEVICE_ID_IMS_TT128                0x9128
19479 +#define PCI_DEVICE_ID_IMS_TT3D         0x9135
19480 +
19481 +#define PCI_VENDOR_ID_TEKRAM2          0x10e1
19482 +#define PCI_DEVICE_ID_TEKRAM2_690c     0x690c
19483 +
19484 +#define PCI_VENDOR_ID_TUNDRA           0x10e3
19485 +#define PCI_DEVICE_ID_TUNDRA_CA91C042  0x0000
19486 +
19487 +#define PCI_VENDOR_ID_AMCC             0x10e8
19488 +#define PCI_DEVICE_ID_AMCC_MYRINET     0x8043
19489 +#define PCI_DEVICE_ID_AMCC_PARASTATION 0x8062
19490 +#define PCI_DEVICE_ID_AMCC_S5933       0x807d
19491 +#define PCI_DEVICE_ID_AMCC_S5933_HEPC3 0x809c
19492 +
19493 +#define PCI_VENDOR_ID_INTERG           0x10ea
19494 +#define PCI_DEVICE_ID_INTERG_1680      0x1680
19495 +#define PCI_DEVICE_ID_INTERG_1682      0x1682
19496 +#define PCI_DEVICE_ID_INTERG_2000      0x2000
19497 +#define PCI_DEVICE_ID_INTERG_2010      0x2010
19498 +#define PCI_DEVICE_ID_INTERG_5000      0x5000
19499 +#define PCI_DEVICE_ID_INTERG_5050      0x5050
19500 +
19501 +#define PCI_VENDOR_ID_REALTEK          0x10ec
19502 +#define PCI_DEVICE_ID_REALTEK_8029     0x8029
19503 +#define PCI_DEVICE_ID_REALTEK_8129     0x8129
19504 +#define PCI_DEVICE_ID_REALTEK_8139     0x8139
19505 +#define PCI_DEVICE_ID_REALTEK_8169     0x8169
19506 +
19507 +#define PCI_VENDOR_ID_XILINX           0x10ee
19508 +#define PCI_DEVICE_ID_TURBOPAM         0x4020
19509 +
19510 +#define PCI_VENDOR_ID_TRUEVISION       0x10fa
19511 +#define PCI_DEVICE_ID_TRUEVISION_T1000 0x000c
19512 +
19513 +#define PCI_VENDOR_ID_INIT             0x1101
19514 +#define PCI_DEVICE_ID_INIT_320P                0x9100
19515 +#define PCI_DEVICE_ID_INIT_360P                0x9500
19516 +
19517 +#define PCI_VENDOR_ID_CREATIVE         0x1102 // duplicate: ECTIVA
19518 +#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002
19519 +
19520 +#define PCI_VENDOR_ID_ECTIVA           0x1102 // duplicate: CREATIVE
19521 +#define PCI_DEVICE_ID_ECTIVA_EV1938    0x8938
19522 +
19523 +#define PCI_VENDOR_ID_TTI              0x1103
19524 +#define PCI_DEVICE_ID_TTI_HPT343       0x0003
19525 +#define PCI_DEVICE_ID_TTI_HPT366       0x0004
19526 +#define PCI_DEVICE_ID_TTI_HPT372       0x0005
19527 +#define PCI_DEVICE_ID_TTI_HPT302       0x0006
19528 +#define PCI_DEVICE_ID_TTI_HPT371       0x0007
19529 +#define PCI_DEVICE_ID_TTI_HPT374       0x0008
19530 +#define PCI_DEVICE_ID_TTI_HPT372N      0x0009  // apparently a 372N variant?
19531 +
19532 +#define PCI_VENDOR_ID_VIA              0x1106
19533 +#define PCI_DEVICE_ID_VIA_8763_0       0x0198
19534 +#define PCI_DEVICE_ID_VIA_8380_0       0x0204
19535 +#define PCI_DEVICE_ID_VIA_3238_0       0x0238
19536 +#define PCI_DEVICE_ID_VIA_PT880                0x0258
19537 +#define PCI_DEVICE_ID_VIA_PX8X0_0      0x0259
19538 +#define PCI_DEVICE_ID_VIA_3269_0       0x0269
19539 +#define PCI_DEVICE_ID_VIA_K8T800PRO_0  0x0282
19540 +#define PCI_DEVICE_ID_VIA_8363_0       0x0305
19541 +#define PCI_DEVICE_ID_VIA_8371_0       0x0391
19542 +#define PCI_DEVICE_ID_VIA_8501_0       0x0501
19543 +#define PCI_DEVICE_ID_VIA_82C505       0x0505
19544 +#define PCI_DEVICE_ID_VIA_82C561       0x0561
19545 +#define PCI_DEVICE_ID_VIA_82C586_1     0x0571
19546 +#define PCI_DEVICE_ID_VIA_82C576       0x0576
19547 +#define PCI_DEVICE_ID_VIA_82C585       0x0585
19548 +#define PCI_DEVICE_ID_VIA_82C586_0     0x0586
19549 +#define PCI_DEVICE_ID_VIA_82C595       0x0595
19550 +#define PCI_DEVICE_ID_VIA_82C596       0x0596
19551 +#define PCI_DEVICE_ID_VIA_82C597_0     0x0597
19552 +#define PCI_DEVICE_ID_VIA_82C598_0     0x0598
19553 +#define PCI_DEVICE_ID_VIA_8601_0       0x0601
19554 +#define PCI_DEVICE_ID_VIA_8605_0       0x0605
19555 +#define PCI_DEVICE_ID_VIA_82C680       0x0680
19556 +#define PCI_DEVICE_ID_VIA_82C686       0x0686
19557 +#define PCI_DEVICE_ID_VIA_82C691_0     0x0691
19558 +#define PCI_DEVICE_ID_VIA_82C693       0x0693
19559 +#define PCI_DEVICE_ID_VIA_82C693_1     0x0698
19560 +#define PCI_DEVICE_ID_VIA_82C926       0x0926
19561 +#define PCI_DEVICE_ID_VIA_82C576_1     0x1571
19562 +#define PCI_DEVICE_ID_VIA_82C595_97    0x1595
19563 +#define PCI_DEVICE_ID_VIA_82C586_2     0x3038
19564 +#define PCI_DEVICE_ID_VIA_82C586_3     0x3040
19565 +#define PCI_DEVICE_ID_VIA_6305         0x3044
19566 +#define PCI_DEVICE_ID_VIA_82C596_3     0x3050
19567 +#define PCI_DEVICE_ID_VIA_82C596B_3    0x3051
19568 +#define PCI_DEVICE_ID_VIA_82C686_4     0x3057
19569 +#define PCI_DEVICE_ID_VIA_82C686_5     0x3058
19570 +#define PCI_DEVICE_ID_VIA_8233_5       0x3059
19571 +#define PCI_DEVICE_ID_VIA_8233_7       0x3065
19572 +#define PCI_DEVICE_ID_VIA_82C686_6     0x3068
19573 +#define PCI_DEVICE_ID_VIA_8233_0       0x3074
19574 +#define PCI_DEVICE_ID_VIA_8633_0       0x3091
19575 +#define PCI_DEVICE_ID_VIA_8367_0       0x3099
19576 +#define PCI_DEVICE_ID_VIA_8653_0       0x3101
19577 +#define PCI_DEVICE_ID_VIA_8622         0x3102
19578 +#define PCI_DEVICE_ID_VIA_8233C_0      0x3109
19579 +#define PCI_DEVICE_ID_VIA_8361         0x3112
19580 +#define PCI_DEVICE_ID_VIA_XM266                0x3116
19581 +#define PCI_DEVICE_ID_VIA_612X         0x3119
19582 +#define PCI_DEVICE_ID_VIA_862X_0       0x3123
19583 +#define PCI_DEVICE_ID_VIA_8753_0       0x3128
19584 +#define PCI_DEVICE_ID_VIA_8233A                0x3147
19585 +#define PCI_DEVICE_ID_VIA_8703_51_0    0x3148
19586 +#define PCI_DEVICE_ID_VIA_8237_SATA    0x3149
19587 +#define PCI_DEVICE_ID_VIA_XN266                0x3156
19588 +#define PCI_DEVICE_ID_VIA_8754C_0      0x3168
19589 +#define PCI_DEVICE_ID_VIA_8235         0x3177
19590 +#define PCI_DEVICE_ID_VIA_P4N333       0x3178
19591 +#define PCI_DEVICE_ID_VIA_8385_0       0x3188
19592 +#define PCI_DEVICE_ID_VIA_8377_0       0x3189
19593 +#define PCI_DEVICE_ID_VIA_8378_0       0x3205
19594 +#define PCI_DEVICE_ID_VIA_8783_0       0x3208
19595 +#define PCI_DEVICE_ID_VIA_P4M400       0x3209
19596 +#define PCI_DEVICE_ID_VIA_8237         0x3227
19597 +#define PCI_DEVICE_ID_VIA_3296_0       0x0296
19598 +#define PCI_DEVICE_ID_VIA_86C100A      0x6100
19599 +#define PCI_DEVICE_ID_VIA_8231         0x8231
19600 +#define PCI_DEVICE_ID_VIA_8231_4       0x8235
19601 +#define PCI_DEVICE_ID_VIA_8365_1       0x8305
19602 +#define PCI_DEVICE_ID_VIA_8371_1       0x8391
19603 +#define PCI_DEVICE_ID_VIA_8501_1       0x8501
19604 +#define PCI_DEVICE_ID_VIA_82C597_1     0x8597
19605 +#define PCI_DEVICE_ID_VIA_82C598_1     0x8598
19606 +#define PCI_DEVICE_ID_VIA_8601_1       0x8601
19607 +#define PCI_DEVICE_ID_VIA_8505_1       0x8605
19608 +#define PCI_DEVICE_ID_VIA_8633_1       0xB091
19609 +#define PCI_DEVICE_ID_VIA_8367_1       0xB099
19610 +#define PCI_DEVICE_ID_VIA_P4X266_1     0xB101
19611 +#define PCI_DEVICE_ID_VIA_8615_1       0xB103
19612 +#define PCI_DEVICE_ID_VIA_8361_1       0xB112
19613 +#define PCI_DEVICE_ID_VIA_8235_1       0xB168
19614 +#define PCI_DEVICE_ID_VIA_838X_1       0xB188
19615 +#define PCI_DEVICE_ID_VIA_83_87XX_1    0xB198
19616 +
19617 +#define PCI_VENDOR_ID_SIEMENS           0x110A
19618 +#define PCI_DEVICE_ID_SIEMENS_DSCC4     0x2102
19619 +
19620 +#define PCI_VENDOR_ID_SMC2             0x1113
19621 +#define PCI_DEVICE_ID_SMC2_1211TX      0x1211
19622 +
19623 +#define PCI_VENDOR_ID_VORTEX           0x1119
19624 +#define PCI_DEVICE_ID_VORTEX_GDT60x0   0x0000
19625 +#define PCI_DEVICE_ID_VORTEX_GDT6000B  0x0001
19626 +#define PCI_DEVICE_ID_VORTEX_GDT6x10   0x0002
19627 +#define PCI_DEVICE_ID_VORTEX_GDT6x20   0x0003
19628 +#define PCI_DEVICE_ID_VORTEX_GDT6530   0x0004
19629 +#define PCI_DEVICE_ID_VORTEX_GDT6550   0x0005
19630 +#define PCI_DEVICE_ID_VORTEX_GDT6x17   0x0006
19631 +#define PCI_DEVICE_ID_VORTEX_GDT6x27   0x0007
19632 +#define PCI_DEVICE_ID_VORTEX_GDT6537   0x0008
19633 +#define PCI_DEVICE_ID_VORTEX_GDT6557   0x0009
19634 +#define PCI_DEVICE_ID_VORTEX_GDT6x15   0x000a
19635 +#define PCI_DEVICE_ID_VORTEX_GDT6x25   0x000b
19636 +#define PCI_DEVICE_ID_VORTEX_GDT6535   0x000c
19637 +#define PCI_DEVICE_ID_VORTEX_GDT6555   0x000d
19638 +#define PCI_DEVICE_ID_VORTEX_GDT6x17RP 0x0100
19639 +#define PCI_DEVICE_ID_VORTEX_GDT6x27RP 0x0101
19640 +#define PCI_DEVICE_ID_VORTEX_GDT6537RP 0x0102
19641 +#define PCI_DEVICE_ID_VORTEX_GDT6557RP 0x0103
19642 +#define PCI_DEVICE_ID_VORTEX_GDT6x11RP 0x0104
19643 +#define PCI_DEVICE_ID_VORTEX_GDT6x21RP 0x0105
19644 +#define PCI_DEVICE_ID_VORTEX_GDT6x17RP1        0x0110
19645 +#define PCI_DEVICE_ID_VORTEX_GDT6x27RP1        0x0111
19646 +#define PCI_DEVICE_ID_VORTEX_GDT6537RP1        0x0112
19647 +#define PCI_DEVICE_ID_VORTEX_GDT6557RP1        0x0113
19648 +#define PCI_DEVICE_ID_VORTEX_GDT6x11RP1        0x0114
19649 +#define PCI_DEVICE_ID_VORTEX_GDT6x21RP1        0x0115
19650 +#define PCI_DEVICE_ID_VORTEX_GDT6x17RP2        0x0120
19651 +#define PCI_DEVICE_ID_VORTEX_GDT6x27RP2        0x0121
19652 +#define PCI_DEVICE_ID_VORTEX_GDT6537RP2        0x0122
19653 +#define PCI_DEVICE_ID_VORTEX_GDT6557RP2        0x0123
19654 +#define PCI_DEVICE_ID_VORTEX_GDT6x11RP2        0x0124
19655 +#define PCI_DEVICE_ID_VORTEX_GDT6x21RP2        0x0125
19656 +
19657 +#define PCI_VENDOR_ID_EF               0x111a
19658 +#define PCI_DEVICE_ID_EF_ATM_FPGA      0x0000
19659 +#define PCI_DEVICE_ID_EF_ATM_ASIC      0x0002
19660 +#define PCI_VENDOR_ID_EF_ATM_LANAI2    0x0003
19661 +#define PCI_VENDOR_ID_EF_ATM_LANAIHB   0x0005
19662 +
19663 +#define PCI_VENDOR_ID_IDT              0x111d
19664 +#define PCI_DEVICE_ID_IDT_IDT77201     0x0001
19665 +
19666 +#define PCI_VENDOR_ID_FORE             0x1127
19667 +#define PCI_DEVICE_ID_FORE_PCA200PC    0x0210
19668 +#define PCI_DEVICE_ID_FORE_PCA200E     0x0300
19669 +
19670 +#define PCI_VENDOR_ID_IMAGINGTECH      0x112f
19671 +#define PCI_DEVICE_ID_IMAGINGTECH_ICPCI        0x0000
19672 +
19673 +#define PCI_VENDOR_ID_PHILIPS          0x1131
19674 +#define PCI_DEVICE_ID_PHILIPS_SAA7145  0x7145
19675 +#define PCI_DEVICE_ID_PHILIPS_SAA7146  0x7146
19676 +#define PCI_DEVICE_ID_PHILIPS_SAA9730  0x9730
19677 +
19678 +#define PCI_VENDOR_ID_EICON            0x1133
19679 +#define PCI_DEVICE_ID_EICON_DIVA20PRO  0xe001
19680 +#define PCI_DEVICE_ID_EICON_DIVA20     0xe002
19681 +#define PCI_DEVICE_ID_EICON_DIVA20PRO_U        0xe003
19682 +#define PCI_DEVICE_ID_EICON_DIVA20_U   0xe004
19683 +#define PCI_DEVICE_ID_EICON_DIVA201    0xe005
19684 +#define PCI_DEVICE_ID_EICON_DIVA202    0xe00b
19685 +#define PCI_DEVICE_ID_EICON_MAESTRA    0xe010
19686 +#define PCI_DEVICE_ID_EICON_MAESTRAQ   0xe012
19687 +#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013
19688 +#define PCI_DEVICE_ID_EICON_MAESTRAP   0xe014
19689 +
19690 +#define PCI_VENDOR_ID_ZIATECH          0x1138
19691 +#define PCI_DEVICE_ID_ZIATECH_5550_HC  0x5550
19692
19693 +#define PCI_VENDOR_ID_CYCLONE          0x113c
19694 +#define PCI_DEVICE_ID_CYCLONE_SDK      0x0001
19695 +
19696 +#define PCI_VENDOR_ID_ALLIANCE         0x1142
19697 +#define PCI_DEVICE_ID_ALLIANCE_PROMOTIO        0x3210
19698 +#define PCI_DEVICE_ID_ALLIANCE_PROVIDEO        0x6422
19699 +#define PCI_DEVICE_ID_ALLIANCE_AT24    0x6424
19700 +#define PCI_DEVICE_ID_ALLIANCE_AT3D    0x643d
19701 +
19702 +#define PCI_VENDOR_ID_SYSKONNECT       0x1148
19703 +#define PCI_DEVICE_ID_SYSKONNECT_FP    0x4000
19704 +#define PCI_DEVICE_ID_SYSKONNECT_TR    0x4200
19705 +#define PCI_DEVICE_ID_SYSKONNECT_GE    0x4300
19706 +#define PCI_DEVICE_ID_SYSKONNECT_YU    0x4320
19707 +#define PCI_DEVICE_ID_SYSKONNECT_9DXX  0x4400
19708 +#define PCI_DEVICE_ID_SYSKONNECT_9MXX  0x4500
19709 +
19710 +#define PCI_VENDOR_ID_VMIC             0x114a
19711 +#define PCI_DEVICE_ID_VMIC_VME         0x7587
19712 +
19713 +#define PCI_VENDOR_ID_DIGI             0x114f
19714 +#define PCI_DEVICE_ID_DIGI_EPC         0x0002
19715 +#define PCI_DEVICE_ID_DIGI_RIGHTSWITCH 0x0003
19716 +#define PCI_DEVICE_ID_DIGI_XEM         0x0004
19717 +#define PCI_DEVICE_ID_DIGI_XR          0x0005
19718 +#define PCI_DEVICE_ID_DIGI_CX          0x0006
19719 +#define PCI_DEVICE_ID_DIGI_XRJ         0x0009
19720 +#define PCI_DEVICE_ID_DIGI_EPCJ                0x000a
19721 +#define PCI_DEVICE_ID_DIGI_XR_920      0x0027
19722 +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070
19723 +#define PCI_DEVICE_ID_DIGI_DF_M_E      0x0071
19724 +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072
19725 +#define PCI_DEVICE_ID_DIGI_DF_M_A      0x0073
19726 +#define PCI_DEVICE_ID_NEO_2DB9          0x00C8
19727 +#define PCI_DEVICE_ID_NEO_2DB9PRI       0x00C9
19728 +#define PCI_DEVICE_ID_NEO_2RJ45         0x00CA
19729 +#define PCI_DEVICE_ID_NEO_2RJ45PRI      0x00CB
19730 +
19731 +#define PCI_VENDOR_ID_MUTECH           0x1159
19732 +#define PCI_DEVICE_ID_MUTECH_MV1000    0x0001
19733 +
19734 +#define PCI_VENDOR_ID_XIRCOM           0x115d
19735 +#define PCI_DEVICE_ID_XIRCOM_X3201_ETH 0x0003
19736 +#define PCI_DEVICE_ID_XIRCOM_RBM56G    0x0101
19737 +#define PCI_DEVICE_ID_XIRCOM_X3201_MDM 0x0103
19738 +
19739 +#define PCI_VENDOR_ID_RENDITION                0x1163
19740 +#define PCI_DEVICE_ID_RENDITION_VERITE 0x0001
19741 +#define PCI_DEVICE_ID_RENDITION_VERITE2100 0x2000
19742 +
19743 +#define PCI_VENDOR_ID_SERVERWORKS        0x1166
19744 +#define PCI_DEVICE_ID_SERVERWORKS_HE     0x0008
19745 +#define PCI_DEVICE_ID_SERVERWORKS_LE     0x0009
19746 +#define PCI_DEVICE_ID_SERVERWORKS_CIOB30  0x0010
19747 +#define PCI_DEVICE_ID_SERVERWORKS_CMIC_HE 0x0011
19748 +#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017
19749 +#define PCI_DEVICE_ID_SERVERWORKS_OSB4   0x0200
19750 +#define PCI_DEVICE_ID_SERVERWORKS_CSB5   0x0201
19751 +#define PCI_DEVICE_ID_SERVERWORKS_CSB6    0x0203
19752 +#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211
19753 +#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212
19754 +#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213
19755 +#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217
19756 +#define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220
19757 +#define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB
19758 +#define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221
19759 +#define PCI_DEVICE_ID_SERVERWORKS_GCLE    0x0225
19760 +#define PCI_DEVICE_ID_SERVERWORKS_GCLE2   0x0227
19761 +#define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230
19762 +
19763 +#define PCI_VENDOR_ID_SBE              0x1176
19764 +#define PCI_DEVICE_ID_SBE_WANXL100     0x0301
19765 +#define PCI_DEVICE_ID_SBE_WANXL200     0x0302
19766 +#define PCI_DEVICE_ID_SBE_WANXL400     0x0104
19767 +
19768 +#define PCI_VENDOR_ID_TOSHIBA          0x1179
19769 +#define PCI_DEVICE_ID_TOSHIBA_PICCOLO  0x0102
19770 +#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_1        0x0103
19771 +#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_2        0x0105
19772 +#define PCI_DEVICE_ID_TOSHIBA_601      0x0601
19773 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC95  0x060a
19774 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC95_A 0x0603
19775 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC95_B 0x060a
19776 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC97  0x060f
19777 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC100 0x0617
19778 +
19779 +#define PCI_VENDOR_ID_TOSHIBA_2                0x102f
19780 +#define PCI_DEVICE_ID_TOSHIBA_TX3927   0x000a
19781 +#define PCI_DEVICE_ID_TOSHIBA_TC35815CF        0x0030
19782 +#define PCI_DEVICE_ID_TOSHIBA_TX4927   0x0180
19783 +#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC    0x0108
19784 +
19785 +#define PCI_VENDOR_ID_RICOH            0x1180
19786 +#define PCI_DEVICE_ID_RICOH_RL5C465    0x0465
19787 +#define PCI_DEVICE_ID_RICOH_RL5C466    0x0466
19788 +#define PCI_DEVICE_ID_RICOH_RL5C475    0x0475
19789 +#define PCI_DEVICE_ID_RICOH_RL5C476    0x0476
19790 +#define PCI_DEVICE_ID_RICOH_RL5C478    0x0478
19791 +
19792 +#define PCI_VENDOR_ID_DLINK            0x1186
19793 +#define PCI_DEVICE_ID_DLINK_DGE510T    0x4c00
19794 +
19795 +#define PCI_VENDOR_ID_ARTOP            0x1191
19796 +#define PCI_DEVICE_ID_ARTOP_ATP8400    0x0004
19797 +#define PCI_DEVICE_ID_ARTOP_ATP850UF   0x0005
19798 +#define PCI_DEVICE_ID_ARTOP_ATP860     0x0006
19799 +#define PCI_DEVICE_ID_ARTOP_ATP860R    0x0007
19800 +#define PCI_DEVICE_ID_ARTOP_ATP865     0x0008
19801 +#define PCI_DEVICE_ID_ARTOP_ATP865R    0x0009
19802 +#define PCI_DEVICE_ID_ARTOP_AEC7610    0x8002
19803 +#define PCI_DEVICE_ID_ARTOP_AEC7612UW  0x8010
19804 +#define PCI_DEVICE_ID_ARTOP_AEC7612U   0x8020
19805 +#define PCI_DEVICE_ID_ARTOP_AEC7612S   0x8030
19806 +#define PCI_DEVICE_ID_ARTOP_AEC7612D   0x8040
19807 +#define PCI_DEVICE_ID_ARTOP_AEC7612SUW 0x8050
19808 +#define PCI_DEVICE_ID_ARTOP_8060       0x8060
19809 +#define PCI_DEVICE_ID_ARTOP_AEC67160   0x8080
19810 +#define PCI_DEVICE_ID_ARTOP_AEC67160_2 0x8081
19811 +#define PCI_DEVICE_ID_ARTOP_AEC67162   0x808a
19812 +
19813 +#define PCI_VENDOR_ID_ZEITNET          0x1193
19814 +#define PCI_DEVICE_ID_ZEITNET_1221     0x0001
19815 +#define PCI_DEVICE_ID_ZEITNET_1225     0x0002
19816 +
19817 +#define PCI_VENDOR_ID_OMEGA            0x119b
19818 +#define PCI_DEVICE_ID_OMEGA_82C092G    0x1221
19819 +
19820 +#define PCI_VENDOR_ID_FUJITSU_ME       0x119e
19821 +#define PCI_DEVICE_ID_FUJITSU_FS155    0x0001
19822 +#define PCI_DEVICE_ID_FUJITSU_FS50     0x0003
19823 +
19824 +#define PCI_SUBVENDOR_ID_KEYSPAN       0x11a9
19825 +#define PCI_SUBDEVICE_ID_KEYSPAN_SX2   0x5334
19826 +
19827 +#define PCI_VENDOR_ID_MARVELL          0x11ab
19828 +#define PCI_DEVICE_ID_MARVELL_GT64011  0x4146
19829 +#define PCI_DEVICE_ID_MARVELL_GT64111  0x4146
19830 +#define PCI_DEVICE_ID_MARVELL_GT64260  0x6430
19831 +#define PCI_DEVICE_ID_MARVELL_MV64360  0x6460
19832 +#define PCI_DEVICE_ID_MARVELL_MV64460  0x6480
19833 +#define PCI_DEVICE_ID_MARVELL_GT96100  0x9652
19834 +#define PCI_DEVICE_ID_MARVELL_GT96100A 0x9653
19835 +
19836 +#define PCI_VENDOR_ID_LITEON           0x11ad
19837 +#define PCI_DEVICE_ID_LITEON_LNE100TX  0x0002
19838 +
19839 +#define PCI_VENDOR_ID_V3               0x11b0
19840 +#define PCI_DEVICE_ID_V3_V960          0x0001
19841 +#define PCI_DEVICE_ID_V3_V350          0x0001
19842 +#define PCI_DEVICE_ID_V3_V961          0x0002
19843 +#define PCI_DEVICE_ID_V3_V351          0x0002
19844 +
19845 +#define PCI_VENDOR_ID_NP               0x11bc
19846 +#define PCI_DEVICE_ID_NP_PCI_FDDI      0x0001
19847 +
19848 +#define PCI_VENDOR_ID_ATT              0x11c1
19849 +#define PCI_DEVICE_ID_ATT_L56XMF       0x0440
19850 +#define PCI_DEVICE_ID_ATT_VENUS_MODEM  0x480
19851 +
19852 +#define PCI_VENDOR_ID_NEC2             0x11c3 /* NEC (2nd) */
19853 +
19854 +#define PCI_VENDOR_ID_SPECIALIX                0x11cb
19855 +#define PCI_DEVICE_ID_SPECIALIX_IO8    0x2000
19856 +#define PCI_DEVICE_ID_SPECIALIX_XIO    0x4000
19857 +#define PCI_DEVICE_ID_SPECIALIX_RIO    0x8000
19858 +#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004
19859 +
19860 +#define PCI_VENDOR_ID_AURAVISION       0x11d1
19861 +#define PCI_DEVICE_ID_AURAVISION_VXP524        0x01f7
19862 +
19863 +#define PCI_VENDOR_ID_ANALOG_DEVICES   0x11d4
19864 +#define PCI_DEVICE_ID_AD1889JS         0x1889
19865 +
19866 +#define PCI_VENDOR_ID_IKON             0x11d5
19867 +#define PCI_DEVICE_ID_IKON_10115       0x0115
19868 +#define PCI_DEVICE_ID_IKON_10117       0x0117
19869 +
19870 +#define PCI_VENDOR_ID_SEGA             0x11db
19871 +#define PCI_DEVICE_ID_SEGA_BBA         0x1234
19872 +
19873 +#define PCI_VENDOR_ID_ZORAN            0x11de
19874 +#define PCI_DEVICE_ID_ZORAN_36057      0x6057
19875 +#define PCI_DEVICE_ID_ZORAN_36120      0x6120
19876 +
19877 +#define PCI_VENDOR_ID_KINETIC          0x11f4
19878 +#define PCI_DEVICE_ID_KINETIC_2915     0x2915
19879 +
19880 +#define PCI_VENDOR_ID_COMPEX           0x11f6
19881 +#define PCI_DEVICE_ID_COMPEX_ENET100VG4        0x0112
19882 +#define PCI_DEVICE_ID_COMPEX_RL2000    0x1401
19883 +
19884 +#define PCI_VENDOR_ID_RP               0x11fe
19885 +#define PCI_DEVICE_ID_RP32INTF         0x0001
19886 +#define PCI_DEVICE_ID_RP8INTF          0x0002
19887 +#define PCI_DEVICE_ID_RP16INTF         0x0003
19888 +#define PCI_DEVICE_ID_RP4QUAD          0x0004
19889 +#define PCI_DEVICE_ID_RP8OCTA          0x0005
19890 +#define PCI_DEVICE_ID_RP8J             0x0006
19891 +#define PCI_DEVICE_ID_RP4J             0x0007
19892 +#define PCI_DEVICE_ID_RP8SNI           0x0008  
19893 +#define PCI_DEVICE_ID_RP16SNI          0x0009  
19894 +#define PCI_DEVICE_ID_RPP4             0x000A
19895 +#define PCI_DEVICE_ID_RPP8             0x000B
19896 +#define PCI_DEVICE_ID_RP8M             0x000C
19897 +#define PCI_DEVICE_ID_RP4M             0x000D
19898 +#define PCI_DEVICE_ID_RP2_232          0x000E
19899 +#define PCI_DEVICE_ID_RP2_422          0x000F
19900 +#define PCI_DEVICE_ID_URP32INTF                0x0801
19901 +#define PCI_DEVICE_ID_URP8INTF         0x0802
19902 +#define PCI_DEVICE_ID_URP16INTF                0x0803
19903 +#define PCI_DEVICE_ID_URP8OCTA         0x0805
19904 +#define PCI_DEVICE_ID_UPCI_RM3_8PORT   0x080C       
19905 +#define PCI_DEVICE_ID_UPCI_RM3_4PORT   0x080D
19906 +#define PCI_DEVICE_ID_CRP16INTF                0x0903       
19907 +
19908 +#define PCI_VENDOR_ID_CYCLADES         0x120e
19909 +#define PCI_DEVICE_ID_CYCLOM_Y_Lo      0x0100
19910 +#define PCI_DEVICE_ID_CYCLOM_Y_Hi      0x0101
19911 +#define PCI_DEVICE_ID_CYCLOM_4Y_Lo     0x0102
19912 +#define PCI_DEVICE_ID_CYCLOM_4Y_Hi     0x0103
19913 +#define PCI_DEVICE_ID_CYCLOM_8Y_Lo     0x0104
19914 +#define PCI_DEVICE_ID_CYCLOM_8Y_Hi     0x0105
19915 +#define PCI_DEVICE_ID_CYCLOM_Z_Lo      0x0200
19916 +#define PCI_DEVICE_ID_CYCLOM_Z_Hi      0x0201
19917 +#define PCI_DEVICE_ID_PC300_RX_2       0x0300
19918 +#define PCI_DEVICE_ID_PC300_RX_1       0x0301
19919 +#define PCI_DEVICE_ID_PC300_TE_2       0x0310
19920 +#define PCI_DEVICE_ID_PC300_TE_1       0x0311
19921 +#define PCI_DEVICE_ID_PC300_TE_M_2     0x0320
19922 +#define PCI_DEVICE_ID_PC300_TE_M_1     0x0321
19923 +
19924 +/* Allied Telesyn */
19925 +#define PCI_VENDOR_ID_AT               0x1259
19926 +#define PCI_SUBDEVICE_ID_AT_2701FX     0x2703
19927 +
19928 +#define PCI_VENDOR_ID_ESSENTIAL                0x120f
19929 +#define PCI_DEVICE_ID_ESSENTIAL_ROADRUNNER     0x0001
19930 +
19931 +#define PCI_VENDOR_ID_O2               0x1217
19932 +#define PCI_DEVICE_ID_O2_6729          0x6729
19933 +#define PCI_DEVICE_ID_O2_6730          0x673a
19934 +#define PCI_DEVICE_ID_O2_6832          0x6832
19935 +#define PCI_DEVICE_ID_O2_6836          0x6836
19936 +
19937 +#define PCI_VENDOR_ID_3DFX             0x121a
19938 +#define PCI_DEVICE_ID_3DFX_VOODOO      0x0001
19939 +#define PCI_DEVICE_ID_3DFX_VOODOO2     0x0002
19940 +#define PCI_DEVICE_ID_3DFX_BANSHEE     0x0003
19941 +#define PCI_DEVICE_ID_3DFX_VOODOO3     0x0005
19942 +#define PCI_DEVICE_ID_3DFX_VOODOO5     0x0009
19943 +
19944 +#define PCI_VENDOR_ID_SIGMADES         0x1236
19945 +#define PCI_DEVICE_ID_SIGMADES_6425    0x6401
19946 +
19947 +#define PCI_VENDOR_ID_CCUBE            0x123f
19948 +
19949 +#define PCI_VENDOR_ID_AVM              0x1244
19950 +#define PCI_DEVICE_ID_AVM_B1           0x0700
19951 +#define PCI_DEVICE_ID_AVM_C4           0x0800
19952 +#define PCI_DEVICE_ID_AVM_A1           0x0a00
19953 +#define PCI_DEVICE_ID_AVM_A1_V2                0x0e00
19954 +#define PCI_DEVICE_ID_AVM_C2           0x1100
19955 +#define PCI_DEVICE_ID_AVM_T1           0x1200
19956 +
19957 +#define PCI_VENDOR_ID_DIPIX            0x1246
19958 +
19959 +#define PCI_VENDOR_ID_STALLION         0x124d
19960 +#define PCI_DEVICE_ID_STALLION_ECHPCI832 0x0000
19961 +#define PCI_DEVICE_ID_STALLION_ECHPCI864 0x0002
19962 +#define PCI_DEVICE_ID_STALLION_EIOPCI  0x0003
19963 +
19964 +#define PCI_VENDOR_ID_OPTIBASE         0x1255
19965 +#define PCI_DEVICE_ID_OPTIBASE_FORGE   0x1110
19966 +#define PCI_DEVICE_ID_OPTIBASE_FUSION  0x1210
19967 +#define PCI_DEVICE_ID_OPTIBASE_VPLEX   0x2110
19968 +#define PCI_DEVICE_ID_OPTIBASE_VPLEXCC 0x2120
19969 +#define PCI_DEVICE_ID_OPTIBASE_VQUEST  0x2130
19970 +
19971 +/* Allied Telesyn */
19972 +#define PCI_VENDOR_ID_AT               0x1259
19973 +#define PCI_SUBDEVICE_ID_AT_2700FX     0x2701
19974 +#define PCI_SUBDEVICE_ID_AT_2701FX     0x2703
19975 +
19976 +#define PCI_VENDOR_ID_ESS              0x125d
19977 +#define PCI_DEVICE_ID_ESS_ESS1968      0x1968
19978 +#define PCI_DEVICE_ID_ESS_AUDIOPCI     0x1969
19979 +#define PCI_DEVICE_ID_ESS_ESS1978      0x1978
19980 +
19981 +#define PCI_VENDOR_ID_SATSAGEM         0x1267
19982 +#define PCI_DEVICE_ID_SATSAGEM_NICCY   0x1016
19983 +#define PCI_DEVICE_ID_SATSAGEM_PCR2101 0x5352
19984 +#define PCI_DEVICE_ID_SATSAGEM_TELSATTURBO 0x5a4b
19985 +
19986 +#define PCI_VENDOR_ID_HUGHES           0x1273
19987 +#define PCI_DEVICE_ID_HUGHES_DIRECPC   0x0002
19988 +
19989 +#define PCI_VENDOR_ID_ENSONIQ          0x1274
19990 +#define PCI_DEVICE_ID_ENSONIQ_CT5880   0x5880
19991 +#define PCI_DEVICE_ID_ENSONIQ_ES1370   0x5000
19992 +#define PCI_DEVICE_ID_ENSONIQ_ES1371   0x1371
19993 +
19994 +#define PCI_VENDOR_ID_TRANSMETA                0x1279
19995 +#define PCI_DEVICE_ID_EFFICEON         0x0060
19996 +
19997 +#define PCI_VENDOR_ID_ROCKWELL         0x127A
19998 +
19999 +#define PCI_VENDOR_ID_ITE              0x1283
20000 +#define PCI_DEVICE_ID_ITE_IT8172G      0x8172
20001 +#define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801
20002 +#define PCI_DEVICE_ID_ITE_8872         0x8872
20003 +#define PCI_DEVICE_ID_ITE_IT8330G_0    0xe886
20004 +
20005 +/* formerly Platform Tech */
20006 +#define PCI_VENDOR_ID_ESS_OLD          0x1285
20007 +#define PCI_DEVICE_ID_ESS_ESS0100      0x0100
20008 +
20009 +#define PCI_VENDOR_ID_ALTEON           0x12ae
20010 +#define PCI_DEVICE_ID_ALTEON_ACENIC    0x0001
20011 +
20012 +#define PCI_VENDOR_ID_USR              0x12B9
20013 +
20014 +#define PCI_SUBVENDOR_ID_CONNECT_TECH                  0x12c4
20015 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232          0x0001
20016 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232          0x0002
20017 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232          0x0003
20018 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485          0x0004
20019 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4      0x0005
20020 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485          0x0006
20021 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2      0x0007
20022 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485          0x0008
20023 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6      0x0009
20024 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1       0x000A
20025 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1       0x000B
20026 +
20027 +#define PCI_VENDOR_ID_PICTUREL         0x12c5
20028 +#define PCI_DEVICE_ID_PICTUREL_PCIVST  0x0081
20029 +
20030 +#define PCI_VENDOR_ID_NVIDIA_SGS       0x12d2
20031 +#define PCI_DEVICE_ID_NVIDIA_SGS_RIVA128 0x0018
20032 +
20033 +#define PCI_SUBVENDOR_ID_CHASE_PCIFAST         0x12E0
20034 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST4                0x0031
20035 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST8                0x0021
20036 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16       0x0011
20037 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC    0x0041
20038 +#define PCI_SUBVENDOR_ID_CHASE_PCIRAS          0x124D
20039 +#define PCI_SUBDEVICE_ID_CHASE_PCIRAS4         0xF001
20040 +#define PCI_SUBDEVICE_ID_CHASE_PCIRAS8         0xF010
20041 +
20042 +#define PCI_VENDOR_ID_AUREAL           0x12eb
20043 +#define PCI_DEVICE_ID_AUREAL_VORTEX_1  0x0001
20044 +#define PCI_DEVICE_ID_AUREAL_VORTEX_2  0x0002
20045 +#define PCI_DEVICE_ID_AUREAL_ADVANTAGE 0x0003
20046 +
20047 +#define PCI_VENDOR_ID_ELECTRONICDESIGNGMBH 0x12f8
20048 +#define PCI_DEVICE_ID_LML_33R10                0x8a02
20049 +
20050 +#define PCI_VENDOR_ID_CBOARDS          0x1307
20051 +#define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001
20052 +
20053 +#define PCI_VENDOR_ID_SIIG             0x131f
20054 +#define PCI_DEVICE_ID_SIIG_1S_10x_550  0x1000
20055 +#define PCI_DEVICE_ID_SIIG_1S_10x_650  0x1001
20056 +#define PCI_DEVICE_ID_SIIG_1S_10x_850  0x1002
20057 +#define PCI_DEVICE_ID_SIIG_1S1P_10x_550        0x1010
20058 +#define PCI_DEVICE_ID_SIIG_1S1P_10x_650        0x1011
20059 +#define PCI_DEVICE_ID_SIIG_1S1P_10x_850        0x1012
20060 +#define PCI_DEVICE_ID_SIIG_1P_10x      0x1020
20061 +#define PCI_DEVICE_ID_SIIG_2P_10x      0x1021
20062 +#define PCI_DEVICE_ID_SIIG_2S_10x_550  0x1030
20063 +#define PCI_DEVICE_ID_SIIG_2S_10x_650  0x1031
20064 +#define PCI_DEVICE_ID_SIIG_2S_10x_850  0x1032
20065 +#define PCI_DEVICE_ID_SIIG_2S1P_10x_550        0x1034
20066 +#define PCI_DEVICE_ID_SIIG_2S1P_10x_650        0x1035
20067 +#define PCI_DEVICE_ID_SIIG_2S1P_10x_850        0x1036
20068 +#define PCI_DEVICE_ID_SIIG_4S_10x_550  0x1050
20069 +#define PCI_DEVICE_ID_SIIG_4S_10x_650  0x1051
20070 +#define PCI_DEVICE_ID_SIIG_4S_10x_850  0x1052
20071 +#define PCI_DEVICE_ID_SIIG_1S_20x_550  0x2000
20072 +#define PCI_DEVICE_ID_SIIG_1S_20x_650  0x2001
20073 +#define PCI_DEVICE_ID_SIIG_1S_20x_850  0x2002
20074 +#define PCI_DEVICE_ID_SIIG_1P_20x      0x2020
20075 +#define PCI_DEVICE_ID_SIIG_2P_20x      0x2021
20076 +#define PCI_DEVICE_ID_SIIG_2S_20x_550  0x2030
20077 +#define PCI_DEVICE_ID_SIIG_2S_20x_650  0x2031
20078 +#define PCI_DEVICE_ID_SIIG_2S_20x_850  0x2032
20079 +#define PCI_DEVICE_ID_SIIG_2P1S_20x_550        0x2040
20080 +#define PCI_DEVICE_ID_SIIG_2P1S_20x_650        0x2041
20081 +#define PCI_DEVICE_ID_SIIG_2P1S_20x_850        0x2042
20082 +#define PCI_DEVICE_ID_SIIG_1S1P_20x_550        0x2010
20083 +#define PCI_DEVICE_ID_SIIG_1S1P_20x_650        0x2011
20084 +#define PCI_DEVICE_ID_SIIG_1S1P_20x_850        0x2012
20085 +#define PCI_DEVICE_ID_SIIG_4S_20x_550  0x2050
20086 +#define PCI_DEVICE_ID_SIIG_4S_20x_650  0x2051
20087 +#define PCI_DEVICE_ID_SIIG_4S_20x_850  0x2052
20088 +#define PCI_DEVICE_ID_SIIG_2S1P_20x_550        0x2060
20089 +#define PCI_DEVICE_ID_SIIG_2S1P_20x_650        0x2061
20090 +#define PCI_DEVICE_ID_SIIG_2S1P_20x_850        0x2062
20091 +
20092 +#define PCI_VENDOR_ID_RADISYS          0x1331
20093 +#define PCI_DEVICE_ID_RADISYS_ENP2611  0x0030
20094 +
20095 +#define PCI_VENDOR_ID_DOMEX            0x134a
20096 +#define PCI_DEVICE_ID_DOMEX_DMX3191D   0x0001
20097 +
20098 +#define PCI_VENDOR_ID_QUATECH          0x135C
20099 +#define PCI_DEVICE_ID_QUATECH_QSC100   0x0010
20100 +#define PCI_DEVICE_ID_QUATECH_DSC100   0x0020
20101 +#define PCI_DEVICE_ID_QUATECH_DSC200   0x0030
20102 +#define PCI_DEVICE_ID_QUATECH_QSC200   0x0040
20103 +#define PCI_DEVICE_ID_QUATECH_ESC100D  0x0050
20104 +#define PCI_DEVICE_ID_QUATECH_ESC100M  0x0060
20105 +
20106 +#define PCI_VENDOR_ID_SEALEVEL         0x135e
20107 +#define PCI_DEVICE_ID_SEALEVEL_U530    0x7101
20108 +#define PCI_DEVICE_ID_SEALEVEL_UCOMM2  0x7201
20109 +#define PCI_DEVICE_ID_SEALEVEL_UCOMM422        0x7402
20110 +#define PCI_DEVICE_ID_SEALEVEL_UCOMM232        0x7202
20111 +#define PCI_DEVICE_ID_SEALEVEL_COMM4   0x7401
20112 +#define PCI_DEVICE_ID_SEALEVEL_COMM8   0x7801
20113 +#define PCI_DEVICE_ID_SEALEVEL_UCOMM8  0x7804
20114 +
20115 +#define PCI_VENDOR_ID_HYPERCOPE                0x1365
20116 +#define PCI_DEVICE_ID_HYPERCOPE_PLX    0x9050
20117 +#define PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO    0x0104
20118 +#define PCI_SUBDEVICE_ID_HYPERCOPE_ERGO                0x0106
20119 +#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO       0x0107
20120 +#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2      0x0108
20121 +#define PCI_SUBDEVICE_ID_HYPERCOPE_PLEXUS      0x0109
20122 +
20123 +#define PCI_VENDOR_ID_KAWASAKI         0x136b
20124 +#define PCI_DEVICE_ID_MCHIP_KL5A72002  0xff01
20125 +
20126 +#define PCI_VENDOR_ID_CNET             0x1371
20127 +#define PCI_DEVICE_ID_CNET_GIGACARD    0x434e
20128 +
20129 +#define PCI_VENDOR_ID_LMC              0x1376
20130 +#define PCI_DEVICE_ID_LMC_HSSI         0x0003
20131 +#define PCI_DEVICE_ID_LMC_DS3          0x0004
20132 +#define PCI_DEVICE_ID_LMC_SSI          0x0005
20133 +#define PCI_DEVICE_ID_LMC_T1           0x0006
20134 +
20135 +#define PCI_VENDOR_ID_NETGEAR          0x1385
20136 +#define PCI_DEVICE_ID_NETGEAR_GA620    0x620a
20137 +#define PCI_DEVICE_ID_NETGEAR_GA622    0x622a
20138 +
20139 +#define PCI_VENDOR_ID_APPLICOM         0x1389
20140 +#define PCI_DEVICE_ID_APPLICOM_PCIGENERIC 0x0001
20141 +#define PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN 0x0002
20142 +#define PCI_DEVICE_ID_APPLICOM_PCI2000PFB 0x0003
20143 +
20144 +#define PCI_VENDOR_ID_MOXA             0x1393
20145 +#define PCI_DEVICE_ID_MOXA_RC7000      0x0001
20146 +#define PCI_DEVICE_ID_MOXA_CP102       0x1020
20147 +#define PCI_DEVICE_ID_MOXA_CP102UL     0x1021
20148 +#define PCI_DEVICE_ID_MOXA_CP102U      0x1022
20149 +#define PCI_DEVICE_ID_MOXA_C104                0x1040
20150 +#define PCI_DEVICE_ID_MOXA_CP104U      0x1041
20151 +#define PCI_DEVICE_ID_MOXA_CP104JU     0x1042
20152 +#define PCI_DEVICE_ID_MOXA_CT114       0x1140
20153 +#define PCI_DEVICE_ID_MOXA_CP114       0x1141
20154 +#define PCI_DEVICE_ID_MOXA_CP118U      0x1180
20155 +#define PCI_DEVICE_ID_MOXA_CP132       0x1320
20156 +#define PCI_DEVICE_ID_MOXA_CP132U      0x1321
20157 +#define PCI_DEVICE_ID_MOXA_CP134U      0x1340
20158 +#define PCI_DEVICE_ID_MOXA_C168                0x1680
20159 +#define PCI_DEVICE_ID_MOXA_CP168U      0x1681
20160 +#define PCI_DEVICE_ID_MOXA_CP204J      0x2040
20161 +#define PCI_DEVICE_ID_MOXA_C218                0x2180
20162 +#define PCI_DEVICE_ID_MOXA_C320                0x3200
20163 +
20164 +#define PCI_VENDOR_ID_CCD              0x1397
20165 +#define PCI_DEVICE_ID_CCD_2BD0         0x2bd0
20166 +#define PCI_DEVICE_ID_CCD_B000         0xb000
20167 +#define PCI_DEVICE_ID_CCD_B006         0xb006
20168 +#define PCI_DEVICE_ID_CCD_B007         0xb007
20169 +#define PCI_DEVICE_ID_CCD_B008         0xb008
20170 +#define PCI_DEVICE_ID_CCD_B009         0xb009
20171 +#define PCI_DEVICE_ID_CCD_B00A         0xb00a
20172 +#define PCI_DEVICE_ID_CCD_B00B         0xb00b
20173 +#define PCI_DEVICE_ID_CCD_B00C         0xb00c
20174 +#define PCI_DEVICE_ID_CCD_B100         0xb100
20175 +
20176 +#define PCI_VENDOR_ID_EXAR             0x13a8
20177 +#define PCI_DEVICE_ID_EXAR_XR17C152    0x0152
20178 +#define PCI_DEVICE_ID_EXAR_XR17C154    0x0154
20179 +#define PCI_DEVICE_ID_EXAR_XR17C158    0x0158
20180 +
20181 +#define PCI_VENDOR_ID_MICROGATE                0x13c0
20182 +#define PCI_DEVICE_ID_MICROGATE_USC    0x0010
20183 +#define PCI_DEVICE_ID_MICROGATE_SCC    0x0020
20184 +#define PCI_DEVICE_ID_MICROGATE_SCA    0x0030
20185 +#define PCI_DEVICE_ID_MICROGATE_USC2   0x0210
20186 +
20187 +#define PCI_VENDOR_ID_3WARE            0x13C1
20188 +#define PCI_DEVICE_ID_3WARE_1000       0x1000
20189 +#define PCI_DEVICE_ID_3WARE_7000       0x1001
20190 +#define PCI_DEVICE_ID_3WARE_9000       0x1002
20191 +
20192 +#define PCI_VENDOR_ID_IOMEGA           0x13ca
20193 +#define PCI_DEVICE_ID_IOMEGA_BUZ       0x4231
20194 +
20195 +#define PCI_VENDOR_ID_ABOCOM           0x13D1
20196 +#define PCI_DEVICE_ID_ABOCOM_2BD1       0x2BD1
20197 +
20198 +#define PCI_VENDOR_ID_CMEDIA           0x13f6
20199 +#define PCI_DEVICE_ID_CMEDIA_CM8338A   0x0100
20200 +#define PCI_DEVICE_ID_CMEDIA_CM8338B   0x0101
20201 +#define PCI_DEVICE_ID_CMEDIA_CM8738    0x0111
20202 +#define PCI_DEVICE_ID_CMEDIA_CM8738B   0x0112
20203 +
20204 +#define PCI_VENDOR_ID_LAVA             0x1407
20205 +#define PCI_DEVICE_ID_LAVA_DSERIAL     0x0100 /* 2x 16550 */
20206 +#define PCI_DEVICE_ID_LAVA_QUATRO_A    0x0101 /* 2x 16550, half of 4 port */
20207 +#define PCI_DEVICE_ID_LAVA_QUATRO_B    0x0102 /* 2x 16550, half of 4 port */
20208 +#define PCI_DEVICE_ID_LAVA_OCTO_A      0x0180 /* 4x 16550A, half of 8 port */
20209 +#define PCI_DEVICE_ID_LAVA_OCTO_B      0x0181 /* 4x 16550A, half of 8 port */
20210 +#define PCI_DEVICE_ID_LAVA_PORT_PLUS   0x0200 /* 2x 16650 */
20211 +#define PCI_DEVICE_ID_LAVA_QUAD_A      0x0201 /* 2x 16650, half of 4 port */
20212 +#define PCI_DEVICE_ID_LAVA_QUAD_B      0x0202 /* 2x 16650, half of 4 port */
20213 +#define PCI_DEVICE_ID_LAVA_SSERIAL     0x0500 /* 1x 16550 */
20214 +#define PCI_DEVICE_ID_LAVA_PORT_650    0x0600 /* 1x 16650 */
20215 +#define PCI_DEVICE_ID_LAVA_PARALLEL    0x8000
20216 +#define PCI_DEVICE_ID_LAVA_DUAL_PAR_A  0x8002 /* The Lava Dual Parallel is */
20217 +#define PCI_DEVICE_ID_LAVA_DUAL_PAR_B  0x8003 /* two PCI devices on a card */
20218 +#define PCI_DEVICE_ID_LAVA_BOCA_IOPPAR 0x8800
20219 +
20220 +#define PCI_VENDOR_ID_TIMEDIA          0x1409
20221 +#define PCI_DEVICE_ID_TIMEDIA_1889     0x7168
20222 +
20223 +#define PCI_VENDOR_ID_OXSEMI           0x1415
20224 +#define PCI_DEVICE_ID_OXSEMI_12PCI840  0x8403
20225 +#define PCI_DEVICE_ID_OXSEMI_16PCI954  0x9501
20226 +#define PCI_DEVICE_ID_OXSEMI_16PCI95N  0x9511
20227 +#define PCI_DEVICE_ID_OXSEMI_16PCI954PP        0x9513
20228 +#define PCI_DEVICE_ID_OXSEMI_16PCI952  0x9521
20229 +
20230 +#define PCI_VENDOR_ID_SAMSUNG          0x144d
20231 +
20232 +#define PCI_VENDOR_ID_AIRONET          0x14b9
20233 +#define PCI_DEVICE_ID_AIRONET_4800_1   0x0001
20234 +#define PCI_DEVICE_ID_AIRONET_4800     0x4500 // values switched?  see
20235 +#define PCI_DEVICE_ID_AIRONET_4500     0x4800 // drivers/net/aironet4500_card.c
20236 +
20237 +#define PCI_VENDOR_ID_TITAN            0x14D2
20238 +#define PCI_DEVICE_ID_TITAN_010L       0x8001
20239 +#define PCI_DEVICE_ID_TITAN_100L       0x8010
20240 +#define PCI_DEVICE_ID_TITAN_110L       0x8011
20241 +#define PCI_DEVICE_ID_TITAN_200L       0x8020
20242 +#define PCI_DEVICE_ID_TITAN_210L       0x8021
20243 +#define PCI_DEVICE_ID_TITAN_400L       0x8040
20244 +#define PCI_DEVICE_ID_TITAN_800L       0x8080
20245 +#define PCI_DEVICE_ID_TITAN_100                0xA001
20246 +#define PCI_DEVICE_ID_TITAN_200                0xA005
20247 +#define PCI_DEVICE_ID_TITAN_400                0xA003
20248 +#define PCI_DEVICE_ID_TITAN_800B       0xA004
20249 +
20250 +#define PCI_VENDOR_ID_PANACOM          0x14d4
20251 +#define PCI_DEVICE_ID_PANACOM_QUADMODEM        0x0400
20252 +#define PCI_DEVICE_ID_PANACOM_DUALMODEM        0x0402
20253 +
20254 +#define PCI_VENDOR_ID_SIPACKETS                0x14d9
20255 +#define PCI_DEVICE_ID_SP_HT            0x0010
20256 +
20257 +#define PCI_VENDOR_ID_AFAVLAB          0x14db
20258 +#define PCI_DEVICE_ID_AFAVLAB_P028     0x2180
20259 +#define PCI_DEVICE_ID_AFAVLAB_P030     0x2182
20260 +
20261 +#define PCI_VENDOR_ID_BROADCOM         0x14e4
20262 +#define PCI_DEVICE_ID_TIGON3_5752      0x1600
20263 +#define PCI_DEVICE_ID_TIGON3_5752M     0x1601
20264 +#define PCI_DEVICE_ID_TIGON3_5700      0x1644
20265 +#define PCI_DEVICE_ID_TIGON3_5701      0x1645
20266 +#define PCI_DEVICE_ID_TIGON3_5702      0x1646
20267 +#define PCI_DEVICE_ID_TIGON3_5703      0x1647
20268 +#define PCI_DEVICE_ID_TIGON3_5704      0x1648
20269 +#define PCI_DEVICE_ID_TIGON3_5704S_2   0x1649
20270 +#define PCI_DEVICE_ID_NX2_5706         0x164a
20271 +#define PCI_DEVICE_ID_TIGON3_5702FE    0x164d
20272 +#define PCI_DEVICE_ID_TIGON3_5705      0x1653
20273 +#define PCI_DEVICE_ID_TIGON3_5705_2    0x1654
20274 +#define PCI_DEVICE_ID_TIGON3_5720      0x1658
20275 +#define PCI_DEVICE_ID_TIGON3_5721      0x1659
20276 +#define PCI_DEVICE_ID_TIGON3_5705M     0x165d
20277 +#define PCI_DEVICE_ID_TIGON3_5705M_2   0x165e
20278 +#define PCI_DEVICE_ID_TIGON3_5705F     0x166e
20279 +#define PCI_DEVICE_ID_TIGON3_5750      0x1676
20280 +#define PCI_DEVICE_ID_TIGON3_5751      0x1677
20281 +#define PCI_DEVICE_ID_TIGON3_5750M     0x167c
20282 +#define PCI_DEVICE_ID_TIGON3_5751M     0x167d
20283 +#define PCI_DEVICE_ID_TIGON3_5751F     0x167e
20284 +#define PCI_DEVICE_ID_TIGON3_5782      0x1696
20285 +#define PCI_DEVICE_ID_TIGON3_5788      0x169c
20286 +#define PCI_DEVICE_ID_TIGON3_5789      0x169d
20287 +#define PCI_DEVICE_ID_TIGON3_5702X     0x16a6
20288 +#define PCI_DEVICE_ID_TIGON3_5703X     0x16a7
20289 +#define PCI_DEVICE_ID_TIGON3_5704S     0x16a8
20290 +#define PCI_DEVICE_ID_NX2_5706S                0x16aa
20291 +#define PCI_DEVICE_ID_TIGON3_5702A3    0x16c6
20292 +#define PCI_DEVICE_ID_TIGON3_5703A3    0x16c7
20293 +#define PCI_DEVICE_ID_TIGON3_5781      0x16dd
20294 +#define PCI_DEVICE_ID_TIGON3_5753      0x16f7
20295 +#define PCI_DEVICE_ID_TIGON3_5753M     0x16fd
20296 +#define PCI_DEVICE_ID_TIGON3_5753F     0x16fe
20297 +#define PCI_DEVICE_ID_TIGON3_5901      0x170d
20298 +#define PCI_DEVICE_ID_BCM4401B1                0x170c
20299 +#define PCI_DEVICE_ID_TIGON3_5901_2    0x170e
20300 +#define PCI_DEVICE_ID_BCM4401          0x4401
20301 +#define PCI_DEVICE_ID_BCM4401B0                0x4402
20302 +
20303 +#define PCI_VENDOR_ID_TOPIC            0x151f
20304 +#define PCI_DEVICE_ID_TOPIC_TP560      0x0000
20305 +
20306 +#define PCI_VENDOR_ID_ENE              0x1524
20307 +#define PCI_DEVICE_ID_ENE_1211         0x1211
20308 +#define PCI_DEVICE_ID_ENE_1225         0x1225
20309 +#define PCI_DEVICE_ID_ENE_1410         0x1410
20310 +#define PCI_DEVICE_ID_ENE_1420         0x1420
20311 +
20312 +#define PCI_VENDOR_ID_SYBA             0x1592
20313 +#define PCI_DEVICE_ID_SYBA_2P_EPP      0x0782
20314 +#define PCI_DEVICE_ID_SYBA_1P_ECP      0x0783
20315 +
20316 +#define PCI_VENDOR_ID_MORETON          0x15aa
20317 +#define PCI_DEVICE_ID_RASTEL_2PORT     0x2000
20318 +
20319 +#define PCI_VENDOR_ID_ZOLTRIX          0x15b0
20320 +#define PCI_DEVICE_ID_ZOLTRIX_2BD0     0x2bd0 
20321 +
20322 +#define PCI_VENDOR_ID_MELLANOX         0x15b3
20323 +#define PCI_DEVICE_ID_MELLANOX_TAVOR   0x5a44
20324 +#define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278
20325 +#define PCI_DEVICE_ID_MELLANOX_ARBEL   0x6282
20326 +#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c
20327 +#define PCI_DEVICE_ID_MELLANOX_SINAI   0x6274
20328 +
20329 +#define PCI_VENDOR_ID_PDC              0x15e9
20330 +#define PCI_DEVICE_ID_PDC_1841         0x1841
20331 +
20332 +#define PCI_VENDOR_ID_MACROLINK                0x15ed
20333 +#define PCI_DEVICE_ID_MACROLINK_MCCS8  0x1000
20334 +#define PCI_DEVICE_ID_MACROLINK_MCCS   0x1001
20335 +#define PCI_DEVICE_ID_MACROLINK_MCCS8H 0x1002
20336 +#define PCI_DEVICE_ID_MACROLINK_MCCSH  0x1003
20337 +#define PCI_DEVICE_ID_MACROLINK_MCCR8  0x2000
20338 +#define PCI_DEVICE_ID_MACROLINK_MCCR   0x2001
20339 +
20340 +#define PCI_VENDOR_ID_FARSITE           0x1619
20341 +#define PCI_DEVICE_ID_FARSITE_T2P       0x0400
20342 +#define PCI_DEVICE_ID_FARSITE_T4P       0x0440
20343 +#define PCI_DEVICE_ID_FARSITE_T1U       0x0610
20344 +#define PCI_DEVICE_ID_FARSITE_T2U       0x0620
20345 +#define PCI_DEVICE_ID_FARSITE_T4U       0x0640
20346 +#define PCI_DEVICE_ID_FARSITE_TE1       0x1610
20347 +#define PCI_DEVICE_ID_FARSITE_TE1C      0x1612
20348 +
20349 +#define PCI_VENDOR_ID_SIBYTE           0x166d
20350 +#define PCI_DEVICE_ID_BCM1250_HT       0x0002
20351 +
20352 +#define PCI_VENDOR_ID_LINKSYS          0x1737
20353 +#define PCI_DEVICE_ID_LINKSYS_EG1032   0x1032
20354 +#define PCI_DEVICE_ID_LINKSYS_EG1064   0x1064
20355 +
20356 +#define PCI_VENDOR_ID_ALTIMA           0x173b
20357 +#define PCI_DEVICE_ID_ALTIMA_AC1000    0x03e8
20358 +#define PCI_DEVICE_ID_ALTIMA_AC1001    0x03e9
20359 +#define PCI_DEVICE_ID_ALTIMA_AC9100    0x03ea
20360 +#define PCI_DEVICE_ID_ALTIMA_AC1003    0x03eb
20361 +
20362 +#define PCI_VENDOR_ID_S2IO             0x17d5
20363 +#define        PCI_DEVICE_ID_S2IO_WIN          0x5731
20364 +#define        PCI_DEVICE_ID_S2IO_UNI          0x5831
20365 +#define PCI_DEVICE_ID_HERC_WIN         0x5732
20366 +#define PCI_DEVICE_ID_HERC_UNI         0x5832
20367 +
20368 +#define PCI_VENDOR_ID_INFINICON                0x1820
20369 +
20370 +#define PCI_VENDOR_ID_TOPSPIN          0x1867
20371 +
20372 +#define PCI_VENDOR_ID_TDI               0x192E
20373 +#define PCI_DEVICE_ID_TDI_EHCI          0x0101
20374 +
20375 +#define PCI_VENDOR_ID_SYMPHONY         0x1c1c
20376 +#define PCI_DEVICE_ID_SYMPHONY_101     0x0001
20377 +
20378 +#define PCI_VENDOR_ID_TEKRAM           0x1de1
20379 +#define PCI_DEVICE_ID_TEKRAM_DC290     0xdc29
20380 +
20381 +#define PCI_VENDOR_ID_HINT             0x3388
20382 +#define PCI_DEVICE_ID_HINT_VXPROII_IDE 0x8013
20383 +
20384 +#define PCI_VENDOR_ID_3DLABS           0x3d3d
20385 +#define PCI_DEVICE_ID_3DLABS_300SX     0x0001
20386 +#define PCI_DEVICE_ID_3DLABS_500TX     0x0002
20387 +#define PCI_DEVICE_ID_3DLABS_DELTA     0x0003
20388 +#define PCI_DEVICE_ID_3DLABS_PERMEDIA  0x0004
20389 +#define PCI_DEVICE_ID_3DLABS_MX                0x0006
20390 +#define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007
20391 +#define PCI_DEVICE_ID_3DLABS_GAMMA     0x0008
20392 +#define PCI_DEVICE_ID_3DLABS_PERMEDIA2V        0x0009
20393 +
20394 +#define PCI_VENDOR_ID_AVANCE           0x4005
20395 +#define PCI_DEVICE_ID_AVANCE_ALG2064   0x2064
20396 +#define PCI_DEVICE_ID_AVANCE_2302      0x2302
20397 +
20398 +#define PCI_VENDOR_ID_AKS              0x416c
20399 +#define PCI_DEVICE_ID_AKS_ALADDINCARD  0x0100
20400 +#define PCI_DEVICE_ID_AKS_CPC          0x0200
20401 +
20402 +#define PCI_VENDOR_ID_REDCREEK         0x4916
20403 +#define PCI_DEVICE_ID_RC45             0x1960
20404 +
20405 +#define PCI_VENDOR_ID_NETVIN           0x4a14
20406 +#define PCI_DEVICE_ID_NETVIN_NV5000SC  0x5000
20407 +
20408 +#define PCI_VENDOR_ID_S3               0x5333
20409 +#define PCI_DEVICE_ID_S3_PLATO_PXS     0x0551
20410 +#define PCI_DEVICE_ID_S3_ViRGE         0x5631
20411 +#define PCI_DEVICE_ID_S3_TRIO          0x8811
20412 +#define PCI_DEVICE_ID_S3_AURORA64VP    0x8812
20413 +#define PCI_DEVICE_ID_S3_TRIO64UVP     0x8814
20414 +#define PCI_DEVICE_ID_S3_ViRGE_VX      0x883d
20415 +#define PCI_DEVICE_ID_S3_868           0x8880
20416 +#define PCI_DEVICE_ID_S3_928           0x88b0
20417 +#define PCI_DEVICE_ID_S3_864_1         0x88c0
20418 +#define PCI_DEVICE_ID_S3_864_2         0x88c1
20419 +#define PCI_DEVICE_ID_S3_964_1         0x88d0
20420 +#define PCI_DEVICE_ID_S3_964_2         0x88d1
20421 +#define PCI_DEVICE_ID_S3_968           0x88f0
20422 +#define PCI_DEVICE_ID_S3_TRIO64V2      0x8901
20423 +#define PCI_DEVICE_ID_S3_PLATO_PXG     0x8902
20424 +#define PCI_DEVICE_ID_S3_ViRGE_DXGX    0x8a01
20425 +#define PCI_DEVICE_ID_S3_ViRGE_GX2     0x8a10
20426 +#define PCI_DEVICE_ID_S3_SAVAGE4       0x8a25
20427 +#define PCI_DEVICE_ID_S3_ViRGE_MX      0x8c01
20428 +#define PCI_DEVICE_ID_S3_ViRGE_MXP     0x8c02
20429 +#define PCI_DEVICE_ID_S3_ViRGE_MXPMV   0x8c03
20430 +#define PCI_DEVICE_ID_S3_PROSAVAGE8    0x8d04
20431 +#define PCI_DEVICE_ID_S3_SONICVIBES    0xca00
20432 +
20433 +#define PCI_VENDOR_ID_DUNORD           0x5544
20434 +#define PCI_DEVICE_ID_DUNORD_I3000     0x0001
20435 +
20436 +#define PCI_VENDOR_ID_DCI              0x6666
20437 +#define PCI_DEVICE_ID_DCI_PCCOM4       0x0001
20438 +#define PCI_DEVICE_ID_DCI_PCCOM8       0x0002
20439 +
20440 +#define PCI_VENDOR_ID_DUNORD           0x5544
20441 +#define PCI_DEVICE_ID_DUNORD_I3000     0x0001
20442 +
20443 +#define PCI_VENDOR_ID_GENROCO          0x5555
20444 +#define PCI_DEVICE_ID_GENROCO_HFP832   0x0003
20445 +
20446 +#define PCI_VENDOR_ID_INTEL            0x8086
20447 +#define PCI_DEVICE_ID_INTEL_EESSC      0x0008
20448 +#define PCI_DEVICE_ID_INTEL_21145      0x0039
20449 +#define PCI_DEVICE_ID_INTEL_82375      0x0482
20450 +#define PCI_DEVICE_ID_INTEL_82424      0x0483
20451 +#define PCI_DEVICE_ID_INTEL_82378      0x0484
20452 +#define PCI_DEVICE_ID_INTEL_82430      0x0486
20453 +#define PCI_DEVICE_ID_INTEL_82434      0x04a3
20454 +#define PCI_DEVICE_ID_INTEL_I960       0x0960
20455 +#define PCI_DEVICE_ID_INTEL_I960RM     0x0962
20456 +#define PCI_DEVICE_ID_INTEL_82562ET    0x1031
20457 +#define PCI_DEVICE_ID_INTEL_82801CAM   0x1038
20458 +#define PCI_DEVICE_ID_INTEL_82815_MC   0x1130
20459 +#define PCI_DEVICE_ID_INTEL_82815_AB   0x1131
20460 +#define PCI_DEVICE_ID_INTEL_82815_CGC  0x1132
20461 +#define PCI_DEVICE_ID_INTEL_82559ER    0x1209
20462 +#define PCI_DEVICE_ID_INTEL_82092AA_0  0x1221
20463 +#define PCI_DEVICE_ID_INTEL_82092AA_1  0x1222
20464 +#define PCI_DEVICE_ID_INTEL_7116       0x1223
20465 +#define PCI_DEVICE_ID_INTEL_7505_0     0x2550  
20466 +#define PCI_DEVICE_ID_INTEL_7505_1     0x2552  
20467 +#define PCI_DEVICE_ID_INTEL_7205_0     0x255d
20468 +#define PCI_DEVICE_ID_INTEL_82596      0x1226
20469 +#define PCI_DEVICE_ID_INTEL_82865      0x1227
20470 +#define PCI_DEVICE_ID_INTEL_82557      0x1229
20471 +#define PCI_DEVICE_ID_INTEL_82437      0x122d
20472 +#define PCI_DEVICE_ID_INTEL_82371FB_0  0x122e
20473 +#define PCI_DEVICE_ID_INTEL_82371FB_1  0x1230
20474 +#define PCI_DEVICE_ID_INTEL_82371MX    0x1234
20475 +#define PCI_DEVICE_ID_INTEL_82437MX    0x1235
20476 +#define PCI_DEVICE_ID_INTEL_82441      0x1237
20477 +#define PCI_DEVICE_ID_INTEL_82380FB    0x124b
20478 +#define PCI_DEVICE_ID_INTEL_82439      0x1250
20479 +#define PCI_DEVICE_ID_INTEL_80960_RP   0x1960
20480 +#define PCI_DEVICE_ID_INTEL_82840_HB   0x1a21
20481 +#define PCI_DEVICE_ID_INTEL_82845_HB   0x1a30
20482 +#define PCI_DEVICE_ID_INTEL_82801AA_0  0x2410
20483 +#define PCI_DEVICE_ID_INTEL_82801AA_1  0x2411
20484 +#define PCI_DEVICE_ID_INTEL_82801AA_2  0x2412
20485 +#define PCI_DEVICE_ID_INTEL_82801AA_3  0x2413
20486 +#define PCI_DEVICE_ID_INTEL_82801AA_5  0x2415
20487 +#define PCI_DEVICE_ID_INTEL_82801AA_6  0x2416
20488 +#define PCI_DEVICE_ID_INTEL_82801AA_8  0x2418
20489 +#define PCI_DEVICE_ID_INTEL_82801AB_0  0x2420
20490 +#define PCI_DEVICE_ID_INTEL_82801AB_1  0x2421
20491 +#define PCI_DEVICE_ID_INTEL_82801AB_2  0x2422
20492 +#define PCI_DEVICE_ID_INTEL_82801AB_3  0x2423
20493 +#define PCI_DEVICE_ID_INTEL_82801AB_5  0x2425
20494 +#define PCI_DEVICE_ID_INTEL_82801AB_6  0x2426
20495 +#define PCI_DEVICE_ID_INTEL_82801AB_8  0x2428
20496 +#define PCI_DEVICE_ID_INTEL_82801BA_0  0x2440
20497 +#define PCI_DEVICE_ID_INTEL_82801BA_1  0x2442
20498 +#define PCI_DEVICE_ID_INTEL_82801BA_2  0x2443
20499 +#define PCI_DEVICE_ID_INTEL_82801BA_3  0x2444
20500 +#define PCI_DEVICE_ID_INTEL_82801BA_4  0x2445
20501 +#define PCI_DEVICE_ID_INTEL_82801BA_5  0x2446
20502 +#define PCI_DEVICE_ID_INTEL_82801BA_6  0x2448
20503 +#define PCI_DEVICE_ID_INTEL_82801BA_7  0x2449
20504 +#define PCI_DEVICE_ID_INTEL_82801BA_8  0x244a
20505 +#define PCI_DEVICE_ID_INTEL_82801BA_9  0x244b
20506 +#define PCI_DEVICE_ID_INTEL_82801BA_10 0x244c
20507 +#define PCI_DEVICE_ID_INTEL_82801BA_11 0x244e
20508 +#define PCI_DEVICE_ID_INTEL_82801E_0   0x2450
20509 +#define PCI_DEVICE_ID_INTEL_82801E_2   0x2452
20510 +#define PCI_DEVICE_ID_INTEL_82801E_3   0x2453
20511 +#define PCI_DEVICE_ID_INTEL_82801E_9   0x2459
20512 +#define PCI_DEVICE_ID_INTEL_82801E_11  0x245b
20513 +#define PCI_DEVICE_ID_INTEL_82801E_13  0x245d
20514 +#define PCI_DEVICE_ID_INTEL_82801E_14  0x245e
20515 +#define PCI_DEVICE_ID_INTEL_82801CA_0  0x2480
20516 +#define PCI_DEVICE_ID_INTEL_82801CA_2  0x2482
20517 +#define PCI_DEVICE_ID_INTEL_82801CA_3  0x2483
20518 +#define PCI_DEVICE_ID_INTEL_82801CA_4  0x2484
20519 +#define PCI_DEVICE_ID_INTEL_82801CA_5  0x2485
20520 +#define PCI_DEVICE_ID_INTEL_82801CA_6  0x2486
20521 +#define PCI_DEVICE_ID_INTEL_82801CA_7  0x2487
20522 +#define PCI_DEVICE_ID_INTEL_82801CA_10 0x248a
20523 +#define PCI_DEVICE_ID_INTEL_82801CA_11 0x248b
20524 +#define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c
20525 +#define PCI_DEVICE_ID_INTEL_82801DB_0  0x24c0
20526 +#define PCI_DEVICE_ID_INTEL_82801DB_1  0x24c1
20527 +#define PCI_DEVICE_ID_INTEL_82801DB_2  0x24c2
20528 +#define PCI_DEVICE_ID_INTEL_82801DB_3  0x24c3
20529 +#define PCI_DEVICE_ID_INTEL_82801DB_4  0x24c4
20530 +#define PCI_DEVICE_ID_INTEL_82801DB_5  0x24c5
20531 +#define PCI_DEVICE_ID_INTEL_82801DB_6  0x24c6
20532 +#define PCI_DEVICE_ID_INTEL_82801DB_7  0x24c7
20533 +#define PCI_DEVICE_ID_INTEL_82801DB_9  0x24c9
20534 +#define PCI_DEVICE_ID_INTEL_82801DB_10 0x24ca
20535 +#define PCI_DEVICE_ID_INTEL_82801DB_11 0x24cb
20536 +#define PCI_DEVICE_ID_INTEL_82801DB_12  0x24cc
20537 +#define PCI_DEVICE_ID_INTEL_82801DB_13 0x24cd
20538 +#define PCI_DEVICE_ID_INTEL_82801EB_0  0x24d0
20539 +#define PCI_DEVICE_ID_INTEL_82801EB_1  0x24d1
20540 +#define PCI_DEVICE_ID_INTEL_82801EB_2  0x24d2
20541 +#define PCI_DEVICE_ID_INTEL_82801EB_3  0x24d3
20542 +#define PCI_DEVICE_ID_INTEL_82801EB_4  0x24d4
20543 +#define PCI_DEVICE_ID_INTEL_82801EB_5  0x24d5
20544 +#define PCI_DEVICE_ID_INTEL_82801EB_6  0x24d6
20545 +#define PCI_DEVICE_ID_INTEL_82801EB_7  0x24d7
20546 +#define PCI_DEVICE_ID_INTEL_82801EB_11 0x24db
20547 +#define PCI_DEVICE_ID_INTEL_82801EB_13 0x24dd
20548 +#define PCI_DEVICE_ID_INTEL_ESB_1      0x25a1
20549 +#define PCI_DEVICE_ID_INTEL_ESB_2      0x25a2
20550 +#define PCI_DEVICE_ID_INTEL_ESB_3      0x25a3
20551 +#define PCI_DEVICE_ID_INTEL_ESB_31     0x25b0
20552 +#define PCI_DEVICE_ID_INTEL_ESB_4      0x25a4
20553 +#define PCI_DEVICE_ID_INTEL_ESB_5      0x25a6
20554 +#define PCI_DEVICE_ID_INTEL_ESB_6      0x25a7
20555 +#define PCI_DEVICE_ID_INTEL_ESB_7      0x25a9
20556 +#define PCI_DEVICE_ID_INTEL_ESB_8      0x25aa
20557 +#define PCI_DEVICE_ID_INTEL_ESB_9      0x25ab
20558 +#define PCI_DEVICE_ID_INTEL_ESB_11     0x25ac
20559 +#define PCI_DEVICE_ID_INTEL_ESB_12     0x25ad
20560 +#define PCI_DEVICE_ID_INTEL_ESB_13     0x25ae
20561 +#define PCI_DEVICE_ID_INTEL_82820_HB   0x2500
20562 +#define PCI_DEVICE_ID_INTEL_82820_UP_HB        0x2501
20563 +#define PCI_DEVICE_ID_INTEL_82850_HB   0x2530
20564 +#define PCI_DEVICE_ID_INTEL_82860_HB   0x2531
20565 +#define PCI_DEVICE_ID_INTEL_82845G_HB  0x2560
20566 +#define PCI_DEVICE_ID_INTEL_82845G_IG  0x2562
20567 +#define PCI_DEVICE_ID_INTEL_82865_HB   0x2570
20568 +#define PCI_DEVICE_ID_INTEL_82865_IG   0x2572
20569 +#define PCI_DEVICE_ID_INTEL_82875_HB   0x2578
20570 +#define PCI_DEVICE_ID_INTEL_82875_IG   0x257b
20571 +#define PCI_DEVICE_ID_INTEL_82915G_HB  0x2580
20572 +#define PCI_DEVICE_ID_INTEL_82915G_IG  0x2582
20573 +#define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590
20574 +#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592
20575 +#define PCI_DEVICE_ID_INTEL_82945G_HB  0x2770
20576 +#define PCI_DEVICE_ID_INTEL_82945G_IG  0x2772
20577 +#define PCI_DEVICE_ID_INTEL_ICH6_0     0x2640
20578 +#define PCI_DEVICE_ID_INTEL_ICH6_1     0x2641
20579 +#define PCI_DEVICE_ID_INTEL_ICH6_2     0x2642
20580 +#define PCI_DEVICE_ID_INTEL_ICH6_3     0x2651
20581 +#define PCI_DEVICE_ID_INTEL_ICH6_4     0x2652
20582 +#define PCI_DEVICE_ID_INTEL_ICH6_5     0x2653
20583 +#define PCI_DEVICE_ID_INTEL_ICH6_6     0x2658
20584 +#define PCI_DEVICE_ID_INTEL_ICH6_7     0x2659
20585 +#define PCI_DEVICE_ID_INTEL_ICH6_8     0x265a
20586 +#define PCI_DEVICE_ID_INTEL_ICH6_9     0x265b
20587 +#define PCI_DEVICE_ID_INTEL_ICH6_10    0x265c
20588 +#define PCI_DEVICE_ID_INTEL_ICH6_11    0x2660
20589 +#define PCI_DEVICE_ID_INTEL_ICH6_12    0x2662
20590 +#define PCI_DEVICE_ID_INTEL_ICH6_13    0x2664
20591 +#define PCI_DEVICE_ID_INTEL_ICH6_14    0x2666
20592 +#define PCI_DEVICE_ID_INTEL_ICH6_15    0x2668
20593 +#define PCI_DEVICE_ID_INTEL_ICH6_16    0x266a
20594 +#define PCI_DEVICE_ID_INTEL_ICH6_17    0x266d
20595 +#define PCI_DEVICE_ID_INTEL_ICH6_18    0x266e
20596 +#define PCI_DEVICE_ID_INTEL_ICH6_19    0x266f
20597 +#define PCI_DEVICE_ID_INTEL_ESB2_0     0x2670
20598 +#define PCI_DEVICE_ID_INTEL_ESB2_1     0x2680
20599 +#define PCI_DEVICE_ID_INTEL_ESB2_2     0x2681
20600 +#define PCI_DEVICE_ID_INTEL_ESB2_3     0x2682
20601 +#define PCI_DEVICE_ID_INTEL_ESB2_4     0x2683
20602 +#define PCI_DEVICE_ID_INTEL_ESB2_5     0x2688
20603 +#define PCI_DEVICE_ID_INTEL_ESB2_6     0x2689
20604 +#define PCI_DEVICE_ID_INTEL_ESB2_7     0x268a
20605 +#define PCI_DEVICE_ID_INTEL_ESB2_8     0x268b
20606 +#define PCI_DEVICE_ID_INTEL_ESB2_9     0x268c
20607 +#define PCI_DEVICE_ID_INTEL_ESB2_10    0x2690
20608 +#define PCI_DEVICE_ID_INTEL_ESB2_11    0x2692
20609 +#define PCI_DEVICE_ID_INTEL_ESB2_12    0x2694
20610 +#define PCI_DEVICE_ID_INTEL_ESB2_13    0x2696
20611 +#define PCI_DEVICE_ID_INTEL_ESB2_14    0x2698
20612 +#define PCI_DEVICE_ID_INTEL_ESB2_15    0x2699
20613 +#define PCI_DEVICE_ID_INTEL_ESB2_16    0x269a
20614 +#define PCI_DEVICE_ID_INTEL_ESB2_17    0x269b
20615 +#define PCI_DEVICE_ID_INTEL_ESB2_18    0x269e
20616 +#define PCI_DEVICE_ID_INTEL_ICH7_0     0x27b8
20617 +#define PCI_DEVICE_ID_INTEL_ICH7_1     0x27b9
20618 +#define PCI_DEVICE_ID_INTEL_ICH7_2     0x27c0
20619 +#define PCI_DEVICE_ID_INTEL_ICH7_3     0x27c1
20620 +#define PCI_DEVICE_ID_INTEL_ICH7_30    0x27b0
20621 +#define PCI_DEVICE_ID_INTEL_ICH7_31    0x27bd
20622 +#define PCI_DEVICE_ID_INTEL_ICH7_5     0x27c4
20623 +#define PCI_DEVICE_ID_INTEL_ICH7_6     0x27c5
20624 +#define PCI_DEVICE_ID_INTEL_ICH7_7     0x27c8
20625 +#define PCI_DEVICE_ID_INTEL_ICH7_8     0x27c9
20626 +#define PCI_DEVICE_ID_INTEL_ICH7_9     0x27ca
20627 +#define PCI_DEVICE_ID_INTEL_ICH7_10    0x27cb
20628 +#define PCI_DEVICE_ID_INTEL_ICH7_11    0x27cc
20629 +#define PCI_DEVICE_ID_INTEL_ICH7_12    0x27d0
20630 +#define PCI_DEVICE_ID_INTEL_ICH7_13    0x27d2
20631 +#define PCI_DEVICE_ID_INTEL_ICH7_14    0x27d4
20632 +#define PCI_DEVICE_ID_INTEL_ICH7_15    0x27d6
20633 +#define PCI_DEVICE_ID_INTEL_ICH7_16    0x27d8
20634 +#define PCI_DEVICE_ID_INTEL_ICH7_17    0x27da
20635 +#define PCI_DEVICE_ID_INTEL_ICH7_18    0x27dc
20636 +#define PCI_DEVICE_ID_INTEL_ICH7_19    0x27dd
20637 +#define PCI_DEVICE_ID_INTEL_ICH7_20    0x27de
20638 +#define PCI_DEVICE_ID_INTEL_ICH7_21    0x27df
20639 +#define PCI_DEVICE_ID_INTEL_ICH7_22    0x27e0
20640 +#define PCI_DEVICE_ID_INTEL_ICH7_23    0x27e2
20641 +#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
20642 +#define PCI_DEVICE_ID_INTEL_ESB2_19    0x3500
20643 +#define PCI_DEVICE_ID_INTEL_ESB2_20    0x3501
20644 +#define PCI_DEVICE_ID_INTEL_ESB2_21    0x3504
20645 +#define PCI_DEVICE_ID_INTEL_ESB2_22    0x3505
20646 +#define PCI_DEVICE_ID_INTEL_ESB2_23    0x350c
20647 +#define PCI_DEVICE_ID_INTEL_ESB2_24    0x350d
20648 +#define PCI_DEVICE_ID_INTEL_ESB2_25    0x3510
20649 +#define PCI_DEVICE_ID_INTEL_ESB2_26    0x3511
20650 +#define PCI_DEVICE_ID_INTEL_ESB2_27    0x3514
20651 +#define PCI_DEVICE_ID_INTEL_ESB2_28    0x3515
20652 +#define PCI_DEVICE_ID_INTEL_ESB2_29    0x3518
20653 +#define PCI_DEVICE_ID_INTEL_ESB2_30    0x3519
20654 +#define PCI_DEVICE_ID_INTEL_82830_HB   0x3575
20655 +#define PCI_DEVICE_ID_INTEL_82830_CGC  0x3577
20656 +#define PCI_DEVICE_ID_INTEL_82855GM_HB 0x3580
20657 +#define PCI_DEVICE_ID_INTEL_82855GM_IG 0x3582
20658 +#define PCI_DEVICE_ID_INTEL_E7520_MCH  0x3590
20659 +#define PCI_DEVICE_ID_INTEL_E7320_MCH  0x3592
20660 +#define PCI_DEVICE_ID_INTEL_MCH_PA     0x3595
20661 +#define PCI_DEVICE_ID_INTEL_MCH_PA1    0x3596
20662 +#define PCI_DEVICE_ID_INTEL_MCH_PB     0x3597
20663 +#define PCI_DEVICE_ID_INTEL_MCH_PB1    0x3598
20664 +#define PCI_DEVICE_ID_INTEL_MCH_PC     0x3599
20665 +#define PCI_DEVICE_ID_INTEL_MCH_PC1    0x359a
20666 +#define PCI_DEVICE_ID_INTEL_E7525_MCH  0x359e
20667 +#define PCI_DEVICE_ID_INTEL_80310      0x530d
20668 +#define PCI_DEVICE_ID_INTEL_82371SB_0  0x7000
20669 +#define PCI_DEVICE_ID_INTEL_82371SB_1  0x7010
20670 +#define PCI_DEVICE_ID_INTEL_82371SB_2  0x7020
20671 +#define PCI_DEVICE_ID_INTEL_82437VX    0x7030
20672 +#define PCI_DEVICE_ID_INTEL_82439TX    0x7100
20673 +#define PCI_DEVICE_ID_INTEL_82371AB_0  0x7110
20674 +#define PCI_DEVICE_ID_INTEL_82371AB    0x7111
20675 +#define PCI_DEVICE_ID_INTEL_82371AB_2  0x7112
20676 +#define PCI_DEVICE_ID_INTEL_82371AB_3  0x7113
20677 +#define PCI_DEVICE_ID_INTEL_82810_MC1  0x7120
20678 +#define PCI_DEVICE_ID_INTEL_82810_IG1  0x7121
20679 +#define PCI_DEVICE_ID_INTEL_82810_MC3  0x7122
20680 +#define PCI_DEVICE_ID_INTEL_82810_IG3  0x7123
20681 +#define PCI_DEVICE_ID_INTEL_82810E_MC  0x7124
20682 +#define PCI_DEVICE_ID_INTEL_82810E_IG  0x7125
20683 +#define PCI_DEVICE_ID_INTEL_82443LX_0  0x7180
20684 +#define PCI_DEVICE_ID_INTEL_82443LX_1  0x7181
20685 +#define PCI_DEVICE_ID_INTEL_82443BX_0  0x7190
20686 +#define PCI_DEVICE_ID_INTEL_82443BX_1  0x7191
20687 +#define PCI_DEVICE_ID_INTEL_82443BX_2  0x7192
20688 +#define PCI_DEVICE_ID_INTEL_440MX      0x7195
20689 +#define PCI_DEVICE_ID_INTEL_82443MX_0  0x7198
20690 +#define PCI_DEVICE_ID_INTEL_82443MX_1  0x7199
20691 +#define PCI_DEVICE_ID_INTEL_82443MX_2  0x719a
20692 +#define PCI_DEVICE_ID_INTEL_82443MX_3  0x719b
20693 +#define PCI_DEVICE_ID_INTEL_82443GX_0  0x71a0
20694 +#define PCI_DEVICE_ID_INTEL_82443GX_1  0x71a1
20695 +#define PCI_DEVICE_ID_INTEL_82443GX_2  0x71a2
20696 +#define PCI_DEVICE_ID_INTEL_82372FB_0  0x7600
20697 +#define PCI_DEVICE_ID_INTEL_82372FB_1  0x7601
20698 +#define PCI_DEVICE_ID_INTEL_82372FB_2  0x7602
20699 +#define PCI_DEVICE_ID_INTEL_82372FB_3  0x7603
20700 +#define PCI_DEVICE_ID_INTEL_82454GX    0x84c4
20701 +#define PCI_DEVICE_ID_INTEL_82450GX    0x84c5
20702 +#define PCI_DEVICE_ID_INTEL_82451NX    0x84ca
20703 +#define PCI_DEVICE_ID_INTEL_82454NX     0x84cb
20704 +#define PCI_DEVICE_ID_INTEL_84460GX    0x84ea
20705 +#define PCI_DEVICE_ID_INTEL_IXP4XX     0x8500
20706 +#define PCI_DEVICE_ID_INTEL_IXP2400    0x9001
20707 +#define PCI_DEVICE_ID_INTEL_IXP2800    0x9004
20708 +#define PCI_DEVICE_ID_INTEL_S21152BB   0xb152
20709 +
20710 +#define PCI_VENDOR_ID_COMPUTONE                0x8e0e
20711 +#define PCI_DEVICE_ID_COMPUTONE_IP2EX  0x0291
20712 +#define PCI_DEVICE_ID_COMPUTONE_PG     0x0302
20713 +#define PCI_SUBVENDOR_ID_COMPUTONE     0x8e0e
20714 +#define PCI_SUBDEVICE_ID_COMPUTONE_PG4 0x0001
20715 +#define PCI_SUBDEVICE_ID_COMPUTONE_PG8 0x0002
20716 +#define PCI_SUBDEVICE_ID_COMPUTONE_PG6 0x0003
20717 +
20718 +#define PCI_VENDOR_ID_KTI              0x8e2e
20719 +#define PCI_DEVICE_ID_KTI_ET32P2       0x3000
20720 +
20721 +#define PCI_VENDOR_ID_ADAPTEC          0x9004
20722 +#define PCI_DEVICE_ID_ADAPTEC_7810     0x1078
20723 +#define PCI_DEVICE_ID_ADAPTEC_7821     0x2178
20724 +#define PCI_DEVICE_ID_ADAPTEC_38602    0x3860
20725 +#define PCI_DEVICE_ID_ADAPTEC_7850     0x5078
20726 +#define PCI_DEVICE_ID_ADAPTEC_7855     0x5578
20727 +#define PCI_DEVICE_ID_ADAPTEC_5800     0x5800
20728 +#define PCI_DEVICE_ID_ADAPTEC_3860     0x6038
20729 +#define PCI_DEVICE_ID_ADAPTEC_1480A    0x6075
20730 +#define PCI_DEVICE_ID_ADAPTEC_7860     0x6078
20731 +#define PCI_DEVICE_ID_ADAPTEC_7861     0x6178
20732 +#define PCI_DEVICE_ID_ADAPTEC_7870     0x7078
20733 +#define PCI_DEVICE_ID_ADAPTEC_7871     0x7178
20734 +#define PCI_DEVICE_ID_ADAPTEC_7872     0x7278
20735 +#define PCI_DEVICE_ID_ADAPTEC_7873     0x7378
20736 +#define PCI_DEVICE_ID_ADAPTEC_7874     0x7478
20737 +#define PCI_DEVICE_ID_ADAPTEC_7895     0x7895
20738 +#define PCI_DEVICE_ID_ADAPTEC_7880     0x8078
20739 +#define PCI_DEVICE_ID_ADAPTEC_7881     0x8178
20740 +#define PCI_DEVICE_ID_ADAPTEC_7882     0x8278
20741 +#define PCI_DEVICE_ID_ADAPTEC_7883     0x8378
20742 +#define PCI_DEVICE_ID_ADAPTEC_7884     0x8478
20743 +#define PCI_DEVICE_ID_ADAPTEC_7885     0x8578
20744 +#define PCI_DEVICE_ID_ADAPTEC_7886     0x8678
20745 +#define PCI_DEVICE_ID_ADAPTEC_7887     0x8778
20746 +#define PCI_DEVICE_ID_ADAPTEC_7888     0x8878
20747 +#define PCI_DEVICE_ID_ADAPTEC_1030     0x8b78
20748 +
20749 +#define PCI_VENDOR_ID_ADAPTEC2         0x9005
20750 +#define PCI_DEVICE_ID_ADAPTEC2_2940U2  0x0010
20751 +#define PCI_DEVICE_ID_ADAPTEC2_2930U2  0x0011
20752 +#define PCI_DEVICE_ID_ADAPTEC2_7890B   0x0013
20753 +#define PCI_DEVICE_ID_ADAPTEC2_7890    0x001f
20754 +#define PCI_DEVICE_ID_ADAPTEC2_3940U2  0x0050
20755 +#define PCI_DEVICE_ID_ADAPTEC2_3950U2D 0x0051
20756 +#define PCI_DEVICE_ID_ADAPTEC2_7896    0x005f
20757 +#define PCI_DEVICE_ID_ADAPTEC2_7892A   0x0080
20758 +#define PCI_DEVICE_ID_ADAPTEC2_7892B   0x0081
20759 +#define PCI_DEVICE_ID_ADAPTEC2_7892D   0x0083
20760 +#define PCI_DEVICE_ID_ADAPTEC2_7892P   0x008f
20761 +#define PCI_DEVICE_ID_ADAPTEC2_7899A   0x00c0
20762 +#define PCI_DEVICE_ID_ADAPTEC2_7899B   0x00c1
20763 +#define PCI_DEVICE_ID_ADAPTEC2_7899D   0x00c3
20764 +#define PCI_DEVICE_ID_ADAPTEC2_7899P   0x00cf
20765 +#define PCI_DEVICE_ID_ADAPTEC2_SCAMP   0x0503
20766 +
20767 +#define PCI_VENDOR_ID_ATRONICS         0x907f
20768 +#define PCI_DEVICE_ID_ATRONICS_2015    0x2015
20769 +
20770 +#define PCI_VENDOR_ID_HOLTEK           0x9412
20771 +#define PCI_DEVICE_ID_HOLTEK_6565      0x6565
20772 +
20773 +#define PCI_VENDOR_ID_NETMOS           0x9710
20774 +#define PCI_DEVICE_ID_NETMOS_9705      0x9705
20775 +#define PCI_DEVICE_ID_NETMOS_9715      0x9715
20776 +#define PCI_DEVICE_ID_NETMOS_9735      0x9735
20777 +#define PCI_DEVICE_ID_NETMOS_9745      0x9745
20778 +#define PCI_DEVICE_ID_NETMOS_9755      0x9755
20779 +#define PCI_DEVICE_ID_NETMOS_9805      0x9805
20780 +#define PCI_DEVICE_ID_NETMOS_9815      0x9815
20781 +#define PCI_DEVICE_ID_NETMOS_9835      0x9835
20782 +#define PCI_DEVICE_ID_NETMOS_9845      0x9845
20783 +#define PCI_DEVICE_ID_NETMOS_9855      0x9855
20784 +
20785 +#define PCI_SUBVENDOR_ID_EXSYS         0xd84d
20786 +#define PCI_SUBDEVICE_ID_EXSYS_4014    0x4014
20787 +
20788 +#define PCI_VENDOR_ID_TIGERJET         0xe159
20789 +#define PCI_DEVICE_ID_TIGERJET_300     0x0001
20790 +#define PCI_DEVICE_ID_TIGERJET_100     0x0002
20791 +
20792 +#define PCI_VENDOR_ID_TTTECH           0x0357
20793 +#define PCI_DEVICE_ID_TTTECH_MC322     0x000A
20794 +
20795 +#define PCI_VENDOR_ID_ARK              0xedd8
20796 +#define PCI_DEVICE_ID_ARK_STING                0xa091
20797 +#define PCI_DEVICE_ID_ARK_STINGARK     0xa099
20798 +#define PCI_DEVICE_ID_ARK_2000MT       0xa0a1