Makefile change to compile modules, minor change in patch
[openwrt/staging/mkresin.git] / openwrt / target / linux / linux-2.6 / patches / brcm / 001-bcm47xx.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 11:12:20.404863104 +0200
4 @@ -40,6 +40,16 @@
5 Members include the Acer PICA, MIPS Magnum 4000, MIPS Millenium and
6 Olivetti M700-10 workstations.
7
8 +config BCM47XX
9 + bool "Support for BCM47xx based boards"
10 + select DMA_NONCOHERENT
11 + select HW_HAS_PCI
12 + select IRQ_CPU
13 +# select SYS_SUPPORTS_32BIT_KERNEL
14 + select CPU_LITTLE_ENDIAN
15 + help
16 + Support for BCM47xx based boards
17 +
18 config ACER_PICA_61
19 bool "Support for Acer PICA 1 chipset (EXPERIMENTAL)"
20 depends on MACH_JAZZ && EXPERIMENTAL
21 @@ -974,7 +984,7 @@
22
23 config CPU_LITTLE_ENDIAN
24 bool "Generate little endian code"
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
26 + 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
27 default n if MIPS_EV64120 || MIPS_EV96100 || MOMENCO_OCELOT || MOMENCO_OCELOT_G || SGI_IP22 || SGI_IP27 || SGI_IP32 || TOSHIBA_JMR3927
28 help
29 Some MIPS machines can be configured for either little or big endian
30 diff -Nur linux-2.6.12.5/arch/mips/Kconfig.orig linux-2.6.12.5-brcm/arch/mips/Kconfig.orig
31 --- linux-2.6.12.5/arch/mips/Kconfig.orig 1970-01-01 01:00:00.000000000 +0100
32 +++ linux-2.6.12.5-brcm/arch/mips/Kconfig.orig 2005-08-15 02:20:18.000000000 +0200
33 @@ -0,0 +1,1662 @@
34 +config MIPS
35 + bool
36 + default y
37 + # Horrible source of confusion. Die, die, die ...
38 + select EMBEDDED
39 +
40 +config MIPS64
41 + bool "64-bit kernel"
42 + help
43 + Select this option if you want to build a 64-bit kernel. You should
44 + only select this option if you have hardware that actually has a
45 + 64-bit processor and if your application will actually benefit from
46 + 64-bit processing, otherwise say N. You must say Y for kernels for
47 + SGI IP27 (Origin 200 and 2000) and SGI IP32 (O2). If in doubt say N.
48 +
49 +config 64BIT
50 + def_bool MIPS64
51 +
52 +config MIPS32
53 + bool
54 + depends on MIPS64 = 'n'
55 + default y
56 +
57 +mainmenu "Linux/MIPS Kernel Configuration"
58 +
59 +source "init/Kconfig"
60 +
61 +menu "Machine selection"
62 +
63 +config MACH_JAZZ
64 + bool "Support for the Jazz family of machines"
65 + select ARC
66 + select ARC32
67 + select GENERIC_ISA_DMA
68 + select I8259
69 + select ISA
70 + help
71 + This a family of machines based on the MIPS R4030 chipset which was
72 + used by several vendors to build RISC/os and Windows NT workstations.
73 + Members include the Acer PICA, MIPS Magnum 4000, MIPS Millenium and
74 + Olivetti M700-10 workstations.
75 +
76 +config ACER_PICA_61
77 + bool "Support for Acer PICA 1 chipset (EXPERIMENTAL)"
78 + depends on MACH_JAZZ && EXPERIMENTAL
79 + select DMA_NONCOHERENT
80 + help
81 + This is a machine with a R4400 133/150 MHz CPU. To compile a Linux
82 + kernel that runs on these, say Y here. For details about Linux on
83 + the MIPS architecture, check out the Linux/MIPS FAQ on the WWW at
84 + <http://www.linux-mips.org/>.
85 +
86 +config MIPS_MAGNUM_4000
87 + bool "Support for MIPS Magnum 4000"
88 + depends on MACH_JAZZ
89 + select DMA_NONCOHERENT
90 + help
91 + This is a machine with a R4000 100 MHz CPU. To compile a Linux
92 + kernel that runs on these, say Y here. For details about Linux on
93 + the MIPS architecture, check out the Linux/MIPS FAQ on the WWW at
94 + <http://www.linux-mips.org/>.
95 +
96 +config OLIVETTI_M700
97 + bool "Support for Olivetti M700-10"
98 + depends on MACH_JAZZ
99 + select DMA_NONCOHERENT
100 + help
101 + This is a machine with a R4000 100 MHz CPU. To compile a Linux
102 + kernel that runs on these, say Y here. For details about Linux on
103 + the MIPS architecture, check out the Linux/MIPS FAQ on the WWW at
104 + <http://www.linux-mips.org/>.
105 +
106 +config MACH_VR41XX
107 + bool "Support for NEC VR41XX-based machines"
108 +
109 +config NEC_CMBVR4133
110 + bool "Support for NEC CMB-VR4133"
111 + depends on MACH_VR41XX
112 + select CPU_VR41XX
113 + select DMA_NONCOHERENT
114 + select IRQ_CPU
115 + select HW_HAS_PCI
116 + select PCI_VR41XX
117 +
118 +config ROCKHOPPER
119 + bool "Support for Rockhopper baseboard"
120 + depends on NEC_CMBVR4133
121 + select I8259
122 + select HAVE_STD_PC_SERIAL_PORT
123 +
124 +config CASIO_E55
125 + bool "Support for CASIO CASSIOPEIA E-10/15/55/65"
126 + depends on MACH_VR41XX
127 + select DMA_NONCOHERENT
128 + select IRQ_CPU
129 + select ISA
130 +
131 +config IBM_WORKPAD
132 + bool "Support for IBM WorkPad z50"
133 + depends on MACH_VR41XX
134 + select DMA_NONCOHERENT
135 + select IRQ_CPU
136 + select ISA
137 +
138 +config TANBAC_TB0226
139 + bool "Support for TANBAC TB0226 (Mbase)"
140 + depends on MACH_VR41XX
141 + select DMA_NONCOHERENT
142 + select HW_HAS_PCI
143 + select IRQ_CPU
144 + help
145 + The TANBAC TB0226 (Mbase) is a MIPS-based platform manufactured by TANBAC.
146 + Please refer to <http://www.tanbac.co.jp/> about Mbase.
147 +
148 +config TANBAC_TB0229
149 + bool "Support for TANBAC TB0229 (VR4131DIMM)"
150 + depends on MACH_VR41XX
151 + select DMA_NONCOHERENT
152 + select HW_HAS_PCI
153 + select IRQ_CPU
154 + help
155 + The TANBAC TB0229 (VR4131DIMM) is a MIPS-based platform manufactured by TANBAC.
156 + Please refer to <http://www.tanbac.co.jp/> about VR4131DIMM.
157 +
158 +config VICTOR_MPC30X
159 + bool "Support for Victor MP-C303/304"
160 + select DMA_NONCOHERENT
161 + select HW_HAS_PCI
162 + select IRQ_CPU
163 + depends on MACH_VR41XX
164 +
165 +config ZAO_CAPCELLA
166 + bool "Support for ZAO Networks Capcella"
167 + depends on MACH_VR41XX
168 + select DMA_NONCOHERENT
169 + select HW_HAS_PCI
170 + select IRQ_CPU
171 +
172 +config PCI_VR41XX
173 + bool "Add PCI control unit support of NEC VR4100 series"
174 + depends on MACH_VR41XX && PCI
175 +
176 +config VRC4171
177 + tristate "Add NEC VRC4171 companion chip support"
178 + depends on MACH_VR41XX && ISA
179 + ---help---
180 + The NEC VRC4171/4171A is a companion chip for NEC VR4111/VR4121.
181 +
182 +config VRC4173
183 + tristate "Add NEC VRC4173 companion chip support"
184 + depends on MACH_VR41XX && PCI_VR41XX
185 + ---help---
186 + The NEC VRC4173 is a companion chip for NEC VR4122/VR4131.
187 +
188 +config TOSHIBA_JMR3927
189 + bool "Support for Toshiba JMR-TX3927 board"
190 + depends on MIPS32
191 + select DMA_NONCOHERENT
192 + select HW_HAS_PCI
193 + select SWAP_IO_SPACE
194 +
195 +config MIPS_COBALT
196 + bool "Support for Cobalt Server (EXPERIMENTAL)"
197 + depends on EXPERIMENTAL
198 + select DMA_NONCOHERENT
199 + select HW_HAS_PCI
200 + select I8259
201 + select IRQ_CPU
202 +
203 +config MACH_DECSTATION
204 + bool "Support for DECstations"
205 + select BOOT_ELF32
206 + select DMA_NONCOHERENT
207 + select IRQ_CPU
208 + depends on MIPS32 || EXPERIMENTAL
209 + ---help---
210 + This enables support for DEC's MIPS based workstations. For details
211 + see the Linux/MIPS FAQ on <http://www.linux-mips.org/> and the
212 + DECstation porting pages on <http://decstation.unix-ag.org/>.
213 +
214 + If you have one of the following DECstation Models you definitely
215 + want to choose R4xx0 for the CPU Type:
216 +
217 + DECstation 5000/50
218 + DECstation 5000/150
219 + DECstation 5000/260
220 + DECsystem 5900/260
221 +
222 + otherwise choose R3000.
223 +
224 +config MIPS_EV64120
225 + bool "Support for Galileo EV64120 Evaluation board (EXPERIMENTAL)"
226 + depends on EXPERIMENTAL
227 + select DMA_NONCOHERENT
228 + select HW_HAS_PCI
229 + select MIPS_GT64120
230 + help
231 + This is an evaluation board based on the Galileo GT-64120
232 + single-chip system controller that contains a MIPS R5000 compatible
233 + core running at 75/100MHz. Their website is located at
234 + <http://www.marvell.com/>. Say Y here if you wish to build a
235 + kernel for this platform.
236 +
237 +config EVB_PCI1
238 + bool "Enable Second PCI (PCI1)"
239 + depends on MIPS_EV64120
240 +
241 +config MIPS_EV96100
242 + bool "Support for Galileo EV96100 Evaluation board (EXPERIMENTAL)"
243 + depends on EXPERIMENTAL
244 + select DMA_NONCOHERENT
245 + select HW_HAS_PCI
246 + select IRQ_CPU
247 + select MIPS_GT96100
248 + select RM7000_CPU_SCACHE
249 + select SWAP_IO_SPACE
250 + help
251 + This is an evaluation board based on the Galileo GT-96100 LAN/WAN
252 + communications controllers containing a MIPS R5000 compatible core
253 + running at 83MHz. Their website is <http://www.marvell.com/>. Say Y
254 + here if you wish to build a kernel for this platform.
255 +
256 +config MIPS_IVR
257 + bool "Support for Globespan IVR board"
258 + select DMA_NONCOHERENT
259 + select HW_HAS_PCI
260 + help
261 + This is an evaluation board built by Globespan to showcase thir
262 + iVR (Internet Video Recorder) design. It utilizes a QED RM5231
263 + R5000 MIPS core. More information can be found out their website
264 + located at <http://www.globespan.net/>. Say Y here if you wish to
265 + build a kernel for this platform.
266 +
267 +config LASAT
268 + bool "Support for LASAT Networks platforms"
269 + select DMA_NONCOHERENT
270 + select HW_HAS_PCI
271 + select MIPS_GT64120
272 + select R5000_CPU_SCACHE
273 +
274 +config PICVUE
275 + tristate "PICVUE LCD display driver"
276 + depends on LASAT
277 +
278 +config PICVUE_PROC
279 + tristate "PICVUE LCD display driver /proc interface"
280 + depends on PICVUE
281 +
282 +config DS1603
283 + bool "DS1603 RTC driver"
284 + depends on LASAT
285 +
286 +config LASAT_SYSCTL
287 + bool "LASAT sysctl interface"
288 + depends on LASAT
289 +
290 +config MIPS_ITE8172
291 + bool "Support for ITE 8172G board"
292 + select DMA_NONCOHERENT
293 + select HW_HAS_PCI
294 + help
295 + Ths is an evaluation board made by ITE <http://www.ite.com.tw/>
296 + with ATX form factor that utilizes a MIPS R5000 to work with its
297 + ITE8172G companion internet appliance chip. The MIPS core can be
298 + either a NEC Vr5432 or QED RM5231. Say Y here if you wish to build
299 + a kernel for this platform.
300 +
301 +config IT8172_REVC
302 + bool "Support for older IT8172 (Rev C)"
303 + depends on MIPS_ITE8172
304 + help
305 + Say Y here to support the older, Revision C version of the Integrated
306 + Technology Express, Inc. ITE8172 SBC. Vendor page at
307 + <http://www.ite.com.tw/ia/brief_it8172bsp.htm>; picture of the
308 + board at <http://www.mvista.com/partners/semiconductor/ite.html>.
309 +
310 +config MIPS_ATLAS
311 + bool "Support for MIPS Atlas board"
312 + select BOOT_ELF32
313 + select DMA_NONCOHERENT
314 + select HW_HAS_PCI
315 + select MIPS_GT64120
316 + select SWAP_IO_SPACE
317 + help
318 + This enables support for the QED R5231-based MIPS Atlas evaluation
319 + board.
320 +
321 +config MIPS_MALTA
322 + bool "Support for MIPS Malta board"
323 + select BOOT_ELF32
324 + select HAVE_STD_PC_SERIAL_PORT
325 + select DMA_NONCOHERENT
326 + select GENERIC_ISA_DMA
327 + select HW_HAS_PCI
328 + select I8259
329 + select MIPS_GT64120
330 + select SWAP_IO_SPACE
331 + help
332 + This enables support for the VR5000-based MIPS Malta evaluation
333 + board.
334 +
335 +config MIPS_SEAD
336 + bool "Support for MIPS SEAD board (EXPERIMENTAL)"
337 + depends on EXPERIMENTAL
338 + select IRQ_CPU
339 + select DMA_NONCOHERENT
340 +
341 +config MOMENCO_OCELOT
342 + bool "Support for Momentum Ocelot board"
343 + select DMA_NONCOHERENT
344 + select HW_HAS_PCI
345 + select IRQ_CPU
346 + select IRQ_CPU_RM7K
347 + select MIPS_GT64120
348 + select RM7000_CPU_SCACHE
349 + select SWAP_IO_SPACE
350 + help
351 + The Ocelot is a MIPS-based Single Board Computer (SBC) made by
352 + Momentum Computer <http://www.momenco.com/>.
353 +
354 +config MOMENCO_OCELOT_G
355 + bool "Support for Momentum Ocelot-G board"
356 + select DMA_NONCOHERENT
357 + select HW_HAS_PCI
358 + select IRQ_CPU
359 + select IRQ_CPU_RM7K
360 + select PCI_MARVELL
361 + select RM7000_CPU_SCACHE
362 + select SWAP_IO_SPACE
363 + help
364 + The Ocelot is a MIPS-based Single Board Computer (SBC) made by
365 + Momentum Computer <http://www.momenco.com/>.
366 +
367 +config MOMENCO_OCELOT_C
368 + bool "Support for Momentum Ocelot-C board"
369 + select DMA_NONCOHERENT
370 + select HW_HAS_PCI
371 + select IRQ_CPU
372 + select IRQ_MV64340
373 + select PCI_MARVELL
374 + select RM7000_CPU_SCACHE
375 + select SWAP_IO_SPACE
376 + help
377 + The Ocelot is a MIPS-based Single Board Computer (SBC) made by
378 + Momentum Computer <http://www.momenco.com/>.
379 +
380 +config MOMENCO_OCELOT_3
381 + bool "Support for Momentum Ocelot-3 board"
382 + select BOOT_ELF32
383 + select DMA_NONCOHERENT
384 + select HW_HAS_PCI
385 + select IRQ_CPU
386 + select IRQ_CPU_RM7K
387 + select IRQ_MV64340
388 + select PCI_MARVELL
389 + select RM7000_CPU_SCACHE
390 + select SWAP_IO_SPACE
391 + help
392 + The Ocelot-3 is based off Discovery III System Controller and
393 + PMC-Sierra Rm79000 core.
394 +
395 +config MOMENCO_JAGUAR_ATX
396 + bool "Support for Momentum Jaguar board"
397 + select BOOT_ELF32
398 + select DMA_NONCOHERENT
399 + select HW_HAS_PCI
400 + select IRQ_CPU
401 + select IRQ_CPU_RM7K
402 + select IRQ_MV64340
403 + select LIMITED_DMA
404 + select PCI_MARVELL
405 + select RM7000_CPU_SCACHE
406 + select SWAP_IO_SPACE
407 + help
408 + The Jaguar ATX is a MIPS-based Single Board Computer (SBC) made by
409 + Momentum Computer <http://www.momenco.com/>.
410 +
411 +config JAGUAR_DMALOW
412 + bool "Low DMA Mode"
413 + depends on MOMENCO_JAGUAR_ATX
414 + help
415 + Select to Y if jump JP5 is set on your board, N otherwise. Normally
416 + the jumper is set, so if you feel unsafe, just say Y.
417 +
418 +config PMC_YOSEMITE
419 + bool "Support for PMC-Sierra Yosemite eval board"
420 + select DMA_COHERENT
421 + select HW_HAS_PCI
422 + select IRQ_CPU
423 + select IRQ_CPU_RM7K
424 + select IRQ_CPU_RM9K
425 + select SWAP_IO_SPACE
426 + help
427 + Yosemite is an evaluation board for the RM9000x2 processor
428 + manufactured by PMC-Sierra
429 +
430 +config HYPERTRANSPORT
431 + bool "Hypertransport Support for PMC-Sierra Yosemite"
432 + depends on PMC_YOSEMITE
433 +
434 +config DDB5074
435 + bool "Support for NEC DDB Vrc-5074 (EXPERIMENTAL)"
436 + depends on EXPERIMENTAL
437 + select DMA_NONCOHERENT
438 + select HAVE_STD_PC_SERIAL_PORT
439 + select HW_HAS_PCI
440 + select IRQ_CPU
441 + select I8259
442 + select ISA
443 + help
444 + This enables support for the VR5000-based NEC DDB Vrc-5074
445 + evaluation board.
446 +
447 +config DDB5476
448 + bool "Support for NEC DDB Vrc-5476"
449 + select DMA_NONCOHERENT
450 + select HAVE_STD_PC_SERIAL_PORT
451 + select HW_HAS_PCI
452 + select IRQ_CPU
453 + select I8259
454 + select ISA
455 + help
456 + This enables support for the R5432-based NEC DDB Vrc-5476
457 + evaluation board.
458 +
459 + Features : kernel debugging, serial terminal, NFS root fs, on-board
460 + ether port USB, AC97, PCI, PCI VGA card & framebuffer console,
461 + IDE controller, PS2 keyboard, PS2 mouse, etc.
462 +
463 +config DDB5477
464 + bool "Support for NEC DDB Vrc-5477"
465 + select DMA_NONCOHERENT
466 + select HW_HAS_PCI
467 + select I8259
468 + select IRQ_CPU
469 + help
470 + This enables support for the R5432-based NEC DDB Vrc-5477,
471 + or Rockhopper/SolutionGear boards with R5432/R5500 CPUs.
472 +
473 + Features : kernel debugging, serial terminal, NFS root fs, on-board
474 + ether port USB, AC97, PCI, etc.
475 +
476 +config DDB5477_BUS_FREQUENCY
477 + int "bus frequency (in kHZ, 0 for auto-detect)"
478 + depends on DDB5477
479 + default 0
480 +
481 +config NEC_OSPREY
482 + bool "Support for NEC Osprey board"
483 + select DMA_NONCOHERENT
484 + select IRQ_CPU
485 +
486 +config SGI_IP22
487 + bool "Support for SGI IP22 (Indy/Indigo2)"
488 + select ARC
489 + select ARC32
490 + select BOOT_ELF32
491 + select DMA_NONCOHERENT
492 + select IP22_CPU_SCACHE
493 + select IRQ_CPU
494 + select SWAP_IO_SPACE
495 + help
496 + This are the SGI Indy, Challenge S and Indigo2, as well as certain
497 + OEM variants like the Tandem CMN B006S. To compile a Linux kernel
498 + that runs on these, say Y here.
499 +
500 +config SGI_IP27
501 + bool "Support for SGI IP27 (Origin200/2000)"
502 + depends on MIPS64
503 + select ARC
504 + select ARC64
505 + select DMA_IP27
506 + select HW_HAS_PCI
507 + select PCI_DOMAINS
508 + help
509 + This are the SGI Origin 200, Origin 2000 and Onyx 2 Graphics
510 + workstations. To compile a Linux kernel that runs on these, say Y
511 + here.
512 +
513 +#config SGI_SN0_XXL
514 +# bool "IP27 XXL"
515 +# depends on SGI_IP27
516 +# This options adds support for userspace processes upto 16TB size.
517 +# Normally the limit is just .5TB.
518 +
519 +config SGI_SN0_N_MODE
520 + bool "IP27 N-Mode"
521 + depends on SGI_IP27
522 + help
523 + The nodes of Origin 200, Origin 2000 and Onyx 2 systems can be
524 + configured in either N-Modes which allows for more nodes or M-Mode
525 + which allows for more memory. Your system is most probably
526 + running in M-Mode, so you should say N here.
527 +
528 +config DISCONTIGMEM
529 + bool
530 + default y if SGI_IP27
531 + help
532 + Say Y to upport efficient handling of discontiguous physical memory,
533 + for architectures which are either NUMA (Non-Uniform Memory Access)
534 + or have huge holes in the physical address space for other reasons.
535 + See <file:Documentation/vm/numa> for more.
536 +
537 +config NUMA
538 + bool "NUMA Support"
539 + depends on SGI_IP27
540 + help
541 + Say Y to compile the kernel to support NUMA (Non-Uniform Memory
542 + Access). This option is for configuring high-end multiprocessor
543 + server machines. If in doubt, say N.
544 +
545 +config MAPPED_KERNEL
546 + bool "Mapped kernel support"
547 + depends on SGI_IP27
548 + help
549 + Change the way a Linux kernel is loaded into memory on a MIPS64
550 + machine. This is required in order to support text replication and
551 + NUMA. If you need to understand it, read the source code.
552 +
553 +config REPLICATE_KTEXT
554 + bool "Kernel text replication support"
555 + depends on SGI_IP27
556 + help
557 + Say Y here to enable replicating the kernel text across multiple
558 + nodes in a NUMA cluster. This trades memory for speed.
559 +
560 +config REPLICATE_EXHANDLERS
561 + bool "Exception handler replication support"
562 + depends on SGI_IP27
563 + help
564 + Say Y here to enable replicating the kernel exception handlers
565 + across multiple nodes in a NUMA cluster. This trades memory for
566 + speed.
567 +
568 +config SGI_IP32
569 + bool "Support for SGI IP32 (O2) (EXPERIMENTAL)"
570 + depends on MIPS64 && EXPERIMENTAL
571 + select ARC
572 + select ARC32
573 + select BOOT_ELF32
574 + select OWN_DMA
575 + select DMA_IP32
576 + select DMA_NONCOHERENT
577 + select HW_HAS_PCI
578 + select R5000_CPU_SCACHE
579 + select RM7000_CPU_SCACHE
580 + help
581 + If you want this kernel to run on SGI O2 workstation, say Y here.
582 +
583 +config SOC_AU1X00
584 + depends on MIPS32
585 + bool "Support for AMD/Alchemy Au1X00 SOCs"
586 +
587 +choice
588 + prompt "Au1X00 SOC Type"
589 + depends on SOC_AU1X00
590 + help
591 + Say Y here to enable support for one of three AMD/Alchemy
592 + SOCs. For additional documentation see www.amd.com.
593 +
594 +config SOC_AU1000
595 + bool "SOC_AU1000"
596 +config SOC_AU1100
597 + bool "SOC_AU1100"
598 +config SOC_AU1500
599 + bool "SOC_AU1500"
600 +config SOC_AU1550
601 + bool "SOC_AU1550"
602 +
603 +endchoice
604 +
605 +choice
606 + prompt "AMD/Alchemy Au1x00 board support"
607 + depends on SOC_AU1X00
608 + help
609 + These are evaluation boards built by AMD/Alchemy to
610 + showcase their Au1X00 Internet Edge Processors. The SOC design
611 + is based on the MIPS32 architecture running at 266/400/500MHz
612 + with many integrated peripherals. Further information can be
613 + found at their website, <http://www.amd.com/>. Say Y here if you
614 + wish to build a kernel for this platform.
615 +
616 +config MIPS_PB1000
617 + bool "PB1000 board"
618 + depends on SOC_AU1000
619 + select DMA_NONCOHERENT
620 + select HW_HAS_PCI
621 + select SWAP_IO_SPACE
622 +
623 +config MIPS_PB1100
624 + bool "PB1100 board"
625 + depends on SOC_AU1100
626 + select DMA_NONCOHERENT
627 + select HW_HAS_PCI
628 + select SWAP_IO_SPACE
629 +
630 +config MIPS_PB1500
631 + bool "PB1500 board"
632 + depends on SOC_AU1500
633 + select DMA_COHERENT
634 + select HW_HAS_PCI
635 +
636 +config MIPS_PB1550
637 + bool "PB1550 board"
638 + depends on SOC_AU1550
639 + select DMA_COHERENT
640 + select HW_HAS_PCI
641 + select MIPS_DISABLE_OBSOLETE_IDE
642 +
643 +config MIPS_DB1000
644 + bool "DB1000 board"
645 + depends on SOC_AU1000
646 + select DMA_NONCOHERENT
647 + select HW_HAS_PCI
648 +
649 +config MIPS_DB1100
650 + bool "DB1100 board"
651 + depends on SOC_AU1100
652 + select DMA_NONCOHERENT
653 +
654 +config MIPS_DB1500
655 + bool "DB1500 board"
656 + depends on SOC_AU1500
657 + select DMA_COHERENT
658 + select HW_HAS_PCI
659 + select MIPS_DISABLE_OBSOLETE_IDE
660 +
661 +config MIPS_DB1550
662 + bool "DB1550 board"
663 + depends on SOC_AU1550
664 + select HW_HAS_PCI
665 + select DMA_COHERENT
666 + select MIPS_DISABLE_OBSOLETE_IDE
667 +
668 +config MIPS_BOSPORUS
669 + bool "Bosporus board"
670 + depends on SOC_AU1500
671 + select DMA_NONCOHERENT
672 +
673 +config MIPS_MIRAGE
674 + bool "Mirage board"
675 + depends on SOC_AU1500
676 + select DMA_NONCOHERENT
677 +
678 +config MIPS_XXS1500
679 + bool "MyCable XXS1500 board"
680 + depends on SOC_AU1500
681 + select DMA_NONCOHERENT
682 +
683 +config MIPS_MTX1
684 + bool "4G Systems MTX-1 board"
685 + depends on SOC_AU1500
686 + select HW_HAS_PCI
687 + select DMA_NONCOHERENT
688 +
689 +endchoice
690 +
691 +config SIBYTE_SB1xxx_SOC
692 + bool "Support for Broadcom BCM1xxx SOCs (EXPERIMENTAL)"
693 + depends on EXPERIMENTAL
694 + select BOOT_ELF32
695 + select DMA_COHERENT
696 + select SWAP_IO_SPACE
697 +
698 +choice
699 + prompt "BCM1xxx SOC-based board"
700 + depends on SIBYTE_SB1xxx_SOC
701 + default SIBYTE_SWARM
702 + help
703 + Enable support for boards based on the SiByte line of SOCs
704 + from Broadcom. There are configurations for the known
705 + evaluation boards, or you can choose "Other" and add your
706 + own board support code.
707 +
708 +config SIBYTE_SWARM
709 + bool "BCM91250A-SWARM"
710 + select SIBYTE_SB1250
711 +
712 +config SIBYTE_SENTOSA
713 + bool "BCM91250E-Sentosa"
714 + select SIBYTE_SB1250
715 +
716 +config SIBYTE_RHONE
717 + bool "BCM91125E-Rhone"
718 + select SIBYTE_BCM1125H
719 +
720 +config SIBYTE_CARMEL
721 + bool "BCM91120x-Carmel"
722 + select SIBYTE_BCM1120
723 +
724 +config SIBYTE_PTSWARM
725 + bool "BCM91250PT-PTSWARM"
726 + select SIBYTE_SB1250
727 +
728 +config SIBYTE_LITTLESUR
729 + bool "BCM91250C2-LittleSur"
730 + select SIBYTE_SB1250
731 +
732 +config SIBYTE_CRHINE
733 + bool "BCM91120C-CRhine"
734 + select SIBYTE_BCM1120
735 +
736 +config SIBYTE_CRHONE
737 + bool "BCM91125C-CRhone"
738 + select SIBYTE_BCM1125
739 +
740 +config SIBYTE_UNKNOWN
741 + bool "Other"
742 +
743 +endchoice
744 +
745 +config SIBYTE_BOARD
746 + bool
747 + depends on SIBYTE_SB1xxx_SOC && !SIBYTE_UNKNOWN
748 + default y
749 +
750 +choice
751 + prompt "BCM1xxx SOC Type"
752 + depends on SIBYTE_UNKNOWN
753 + default SIBYTE_UNK_BCM1250
754 + help
755 + Since you haven't chosen a known evaluation board from
756 + Broadcom, you must explicitly pick the SOC this kernel is
757 + targetted for.
758 +
759 +config SIBYTE_UNK_BCM1250
760 + bool "BCM1250"
761 + select SIBYTE_SB1250
762 +
763 +config SIBYTE_UNK_BCM1120
764 + bool "BCM1120"
765 + select SIBYTE_BCM1120
766 +
767 +config SIBYTE_UNK_BCM1125
768 + bool "BCM1125"
769 + select SIBYTE_BCM1125
770 +
771 +config SIBYTE_UNK_BCM1125H
772 + bool "BCM1125H"
773 + select SIBYTE_BCM1125H
774 +
775 +endchoice
776 +
777 +config SIBYTE_SB1250
778 + bool
779 + select HW_HAS_PCI
780 +
781 +config SIBYTE_BCM1120
782 + bool
783 + select SIBYTE_BCM112X
784 +
785 +config SIBYTE_BCM1125
786 + bool
787 + select HW_HAS_PCI
788 + select SIBYTE_BCM112X
789 +
790 +config SIBYTE_BCM1125H
791 + bool
792 + select HW_HAS_PCI
793 + select SIBYTE_BCM112X
794 +
795 +config SIBYTE_BCM112X
796 + bool
797 +
798 +choice
799 + prompt "SiByte SOC Stepping"
800 + depends on SIBYTE_SB1xxx_SOC
801 +
802 +config CPU_SB1_PASS_1
803 + bool "1250 Pass1"
804 + depends on SIBYTE_SB1250
805 + select CPU_HAS_PREFETCH
806 +
807 +config CPU_SB1_PASS_2_1250
808 + bool "1250 An"
809 + depends on SIBYTE_SB1250
810 + select CPU_SB1_PASS_2
811 + help
812 + Also called BCM1250 Pass 2
813 +
814 +config CPU_SB1_PASS_2_2
815 + bool "1250 Bn"
816 + depends on SIBYTE_SB1250
817 + select CPU_HAS_PREFETCH
818 + help
819 + Also called BCM1250 Pass 2.2
820 +
821 +config CPU_SB1_PASS_4
822 + bool "1250 Cn"
823 + depends on SIBYTE_SB1250
824 + select CPU_HAS_PREFETCH
825 + help
826 + Also called BCM1250 Pass 3
827 +
828 +config CPU_SB1_PASS_2_112x
829 + bool "112x Hybrid"
830 + depends on SIBYTE_BCM112X
831 + select CPU_SB1_PASS_2
832 +
833 +config CPU_SB1_PASS_3
834 + bool "112x An"
835 + depends on SIBYTE_BCM112X
836 + select CPU_HAS_PREFETCH
837 +
838 +endchoice
839 +
840 +config CPU_SB1_PASS_2
841 + bool
842 +
843 +config SIBYTE_HAS_LDT
844 + bool
845 + depends on PCI && (SIBYTE_SB1250 || SIBYTE_BCM1125H)
846 + default y
847 +
848 +config SIMULATION
849 + bool "Running under simulation"
850 + depends on SIBYTE_SB1xxx_SOC
851 + help
852 + Build a kernel suitable for running under the GDB simulator.
853 + Primarily adjusts the kernel's notion of time.
854 +
855 +config SIBYTE_CFE
856 + bool "Booting from CFE"
857 + depends on SIBYTE_SB1xxx_SOC
858 + help
859 + Make use of the CFE API for enumerating available memory,
860 + controlling secondary CPUs, and possibly console output.
861 +
862 +config SIBYTE_CFE_CONSOLE
863 + bool "Use firmware console"
864 + depends on SIBYTE_CFE
865 + help
866 + Use the CFE API's console write routines during boot. Other console
867 + options (VT console, sb1250 duart console, etc.) should not be
868 + configured.
869 +
870 +config SIBYTE_STANDALONE
871 + bool
872 + depends on SIBYTE_SB1xxx_SOC && !SIBYTE_CFE
873 + default y
874 +
875 +config SIBYTE_STANDALONE_RAM_SIZE
876 + int "Memory size (in megabytes)"
877 + depends on SIBYTE_STANDALONE
878 + default "32"
879 +
880 +config SIBYTE_BUS_WATCHER
881 + bool "Support for Bus Watcher statistics"
882 + depends on SIBYTE_SB1xxx_SOC
883 + help
884 + Handle and keep statistics on the bus error interrupts (COR_ECC,
885 + BAD_ECC, IO_BUS).
886 +
887 +config SIBYTE_BW_TRACE
888 + bool "Capture bus trace before bus error"
889 + depends on SIBYTE_BUS_WATCHER
890 + help
891 + Run a continuous bus trace, dumping the raw data as soon as
892 + a ZBbus error is detected. Cannot work if ZBbus profiling
893 + is turned on, and also will interfere with JTAG-based trace
894 + buffer activity. Raw buffer data is dumped to console, and
895 + must be processed off-line.
896 +
897 +config SIBYTE_SB1250_PROF
898 + bool "Support for SB1/SOC profiling - SB1/SCD perf counters"
899 + depends on SIBYTE_SB1xxx_SOC
900 +
901 +config SIBYTE_TBPROF
902 + bool "Support for ZBbus profiling"
903 + depends on SIBYTE_SB1xxx_SOC
904 +
905 +config SNI_RM200_PCI
906 + bool "Support for SNI RM200 PCI"
907 + select ARC
908 + select ARC32
909 + select BOOT_ELF32
910 + select DMA_NONCOHERENT
911 + select GENERIC_ISA_DMA
912 + select HAVE_STD_PC_SERIAL_PORT
913 + select HW_HAS_PCI
914 + select I8259
915 + select ISA
916 + help
917 + The SNI RM200 PCI was a MIPS-based platform manufactured by Siemens
918 + Nixdorf Informationssysteme (SNI), parent company of Pyramid
919 + Technology and now in turn merged with Fujitsu. Say Y here to
920 + support this machine type.
921 +
922 +config TOSHIBA_RBTX4927
923 + bool "Support for Toshiba TBTX49[23]7 board"
924 + depends on MIPS32
925 + select DMA_NONCOHERENT
926 + select HAS_TXX9_SERIAL
927 + select HW_HAS_PCI
928 + select I8259
929 + select ISA
930 + select SWAP_IO_SPACE
931 + help
932 + This Toshiba board is based on the TX4927 processor. Say Y here to
933 + support this machine type
934 +
935 +config TOSHIBA_FPCIB0
936 + bool "FPCIB0 Backplane Support"
937 + depends on TOSHIBA_RBTX4927
938 +
939 +config RWSEM_GENERIC_SPINLOCK
940 + bool
941 + default y
942 +
943 +config RWSEM_XCHGADD_ALGORITHM
944 + bool
945 +
946 +config GENERIC_CALIBRATE_DELAY
947 + bool
948 + default y
949 +
950 +config HAVE_DEC_LOCK
951 + bool
952 + default y
953 +
954 +#
955 +# Select some configuration options automatically based on user selections.
956 +#
957 +config ARC
958 + bool
959 + depends on SNI_RM200_PCI || SGI_IP32 || SGI_IP27 || SGI_IP22 || MIPS_MAGNUM_4000 || OLIVETTI_M700 || ACER_PICA_61
960 + default y
961 +
962 +config DMA_COHERENT
963 + bool
964 +
965 +config DMA_IP27
966 + bool
967 +
968 +config DMA_NONCOHERENT
969 + bool
970 +
971 +config EARLY_PRINTK
972 + bool
973 + depends on MACH_DECSTATION
974 + default y
975 +
976 +config GENERIC_ISA_DMA
977 + bool
978 + depends on SNI_RM200_PCI || MIPS_MAGNUM_4000 || OLIVETTI_M700 || ACER_PICA_61 || MIPS_MALTA
979 + default y
980 +
981 +config I8259
982 + bool
983 + depends on SNI_RM200_PCI || DDB5477 || DDB5476 || DDB5074 || MACH_JAZZ || MIPS_MALTA || MIPS_COBALT
984 + default y
985 +
986 +config LIMITED_DMA
987 + bool
988 + select HIGHMEM
989 +
990 +config MIPS_BONITO64
991 + bool
992 + depends on MIPS_ATLAS || MIPS_MALTA
993 + default y
994 +
995 +config MIPS_MSC
996 + bool
997 + depends on MIPS_ATLAS || MIPS_MALTA
998 + default y
999 +
1000 +config MIPS_NILE4
1001 + bool
1002 + depends on LASAT
1003 + default y
1004 +
1005 +config MIPS_DISABLE_OBSOLETE_IDE
1006 + bool
1007 +
1008 +config CPU_LITTLE_ENDIAN
1009 + bool "Generate little endian code"
1010 + 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
1011 + default n if MIPS_EV64120 || MIPS_EV96100 || MOMENCO_OCELOT || MOMENCO_OCELOT_G || SGI_IP22 || SGI_IP27 || SGI_IP32 || TOSHIBA_JMR3927
1012 + help
1013 + Some MIPS machines can be configured for either little or big endian
1014 + byte order. These modes require different kernels. Say Y if your
1015 + machine is little endian, N if it's a big endian machine.
1016 +
1017 +config IRQ_CPU
1018 + bool
1019 +
1020 +config IRQ_CPU_RM7K
1021 + bool
1022 +
1023 +config IRQ_MV64340
1024 + bool
1025 +
1026 +config DDB5XXX_COMMON
1027 + bool
1028 + depends on DDB5074 || DDB5476 || DDB5477
1029 + default y
1030 +
1031 +config MIPS_BOARDS_GEN
1032 + bool
1033 + depends on MIPS_ATLAS || MIPS_MALTA || MIPS_SEAD
1034 + default y
1035 +
1036 +config MIPS_GT64111
1037 + bool
1038 + depends on MIPS_COBALT
1039 + default y
1040 +
1041 +config MIPS_GT64120
1042 + bool
1043 + depends on MIPS_EV64120 || MIPS_EV96100 || LASAT || MIPS_ATLAS || MIPS_MALTA || MOMENCO_OCELOT
1044 + default y
1045 +
1046 +config MIPS_TX3927
1047 + bool
1048 + depends on TOSHIBA_JMR3927
1049 + select HAS_TXX9_SERIAL
1050 + default y
1051 +
1052 +config PCI_MARVELL
1053 + bool
1054 +
1055 +config ITE_BOARD_GEN
1056 + bool
1057 + depends on MIPS_IVR || MIPS_ITE8172
1058 + default y
1059 +
1060 +config SWAP_IO_SPACE
1061 + bool
1062 +
1063 +#
1064 +# Unfortunately not all GT64120 systems run the chip at the same clock.
1065 +# As the user for the clock rate and try to minimize the available options.
1066 +#
1067 +choice
1068 + prompt "Galileo Chip Clock"
1069 + #default SYSCLK_83 if MIPS_EV64120
1070 + depends on MIPS_EV64120 || MOMENCO_OCELOT || MOMENCO_OCELOT_G
1071 + default SYSCLK_83 if MIPS_EV64120
1072 + default SYSCLK_100 if MOMENCO_OCELOT || MOMENCO_OCELOT_G
1073 +
1074 +config SYSCLK_75
1075 + bool "75" if MIPS_EV64120
1076 +
1077 +config SYSCLK_83
1078 + bool "83.3" if MIPS_EV64120
1079 +
1080 +config SYSCLK_100
1081 + bool "100" if MIPS_EV64120 || MOMENCO_OCELOT || MOMENCO_OCELOT_G
1082 +
1083 +endchoice
1084 +
1085 +config AU1X00_USB_DEVICE
1086 + bool
1087 + depends on MIPS_PB1500 || MIPS_PB1100 || MIPS_PB1000
1088 + default n
1089 +
1090 +config MIPS_GT96100
1091 + bool
1092 + depends on MIPS_EV96100
1093 + default y
1094 + help
1095 + Say Y here to support the Galileo Technology GT96100 communications
1096 + controller card. There is a web page at <http://www.galileot.com/>.
1097 +
1098 +config IT8172_CIR
1099 + bool
1100 + depends on MIPS_ITE8172 || MIPS_IVR
1101 + default y
1102 +
1103 +config IT8712
1104 + bool
1105 + depends on MIPS_ITE8172
1106 + default y
1107 +
1108 +config BOOT_ELF32
1109 + bool
1110 + depends on MACH_DECSTATION || MIPS_ATLAS || MIPS_MALTA || MOMENCO_JAGUAR_ATX || MOMENCO_OCELOT_3 || SIBYTE_SB1xxx_SOC || SGI_IP32 || SGI_IP22 || SNI_RM200_PCI
1111 + default y
1112 +
1113 +config MIPS_L1_CACHE_SHIFT
1114 + int
1115 + default "4" if MACH_DECSTATION
1116 + default "7" if SGI_IP27
1117 + default "5"
1118 +
1119 +config ARC32
1120 + bool
1121 + depends on MACH_JAZZ || SNI_RM200_PCI || SGI_IP22 || SGI_IP32
1122 + default y
1123 +
1124 +config FB
1125 + bool
1126 + depends on MIPS_MAGNUM_4000 || OLIVETTI_M700
1127 + default y
1128 + ---help---
1129 + The frame buffer device provides an abstraction for the graphics
1130 + hardware. It represents the frame buffer of some video hardware and
1131 + allows application software to access the graphics hardware through
1132 + a well-defined interface, so the software doesn't need to know
1133 + anything about the low-level (hardware register) stuff.
1134 +
1135 + Frame buffer devices work identically across the different
1136 + architectures supported by Linux and make the implementation of
1137 + application programs easier and more portable; at this point, an X
1138 + server exists which uses the frame buffer device exclusively.
1139 + On several non-X86 architectures, the frame buffer device is the
1140 + only way to use the graphics hardware.
1141 +
1142 + The device is accessed through special device nodes, usually located
1143 + in the /dev directory, i.e. /dev/fb*.
1144 +
1145 + You need an utility program called fbset to make full use of frame
1146 + buffer devices. Please read <file:Documentation/fb/framebuffer.txt>
1147 + and the Framebuffer-HOWTO at <http://www.tldp.org/docs.html#howto>
1148 + for more information.
1149 +
1150 + Say Y here and to the driver for your graphics board below if you
1151 + are compiling a kernel for a non-x86 architecture.
1152 +
1153 + If you are compiling for the x86 architecture, you can say Y if you
1154 + want to play with it, but it is not essential. Please note that
1155 + running graphical applications that directly touch the hardware
1156 + (e.g. an accelerated X server) and that are not frame buffer
1157 + device-aware may cause unexpected results. If unsure, say N.
1158 +
1159 +config HAVE_STD_PC_SERIAL_PORT
1160 + bool
1161 +
1162 +config VR4181
1163 + bool
1164 + depends on NEC_OSPREY
1165 + default y
1166 +
1167 +config ARC_CONSOLE
1168 + bool "ARC console support"
1169 + depends on SGI_IP22 || SNI_RM200_PCI
1170 +
1171 +config ARC_MEMORY
1172 + bool
1173 + depends on MACH_JAZZ || SNI_RM200_PCI || SGI_IP32
1174 + default y
1175 +
1176 +config ARC_PROMLIB
1177 + bool
1178 + depends on MACH_JAZZ || SNI_RM200_PCI || SGI_IP22 || SGI_IP32
1179 + default y
1180 +
1181 +config ARC64
1182 + bool
1183 + depends on SGI_IP27
1184 + default y
1185 +
1186 +config BOOT_ELF64
1187 + bool
1188 + depends on SGI_IP27
1189 + default y
1190 +
1191 +#config MAPPED_PCI_IO y
1192 +# bool
1193 +# depends on SGI_IP27
1194 +# default y
1195 +
1196 +config QL_ISP_A64
1197 + bool
1198 + depends on SGI_IP27
1199 + default y
1200 +
1201 +config TOSHIBA_BOARDS
1202 + bool
1203 + depends on TOSHIBA_JMR3927 || TOSHIBA_RBTX4927
1204 + default y
1205 +
1206 +endmenu
1207 +
1208 +menu "CPU selection"
1209 +
1210 +choice
1211 + prompt "CPU type"
1212 + default CPU_R4X00
1213 +
1214 +config CPU_MIPS32
1215 + bool "MIPS32"
1216 +
1217 +config CPU_MIPS64
1218 + bool "MIPS64"
1219 +
1220 +config CPU_R3000
1221 + bool "R3000"
1222 + depends on MIPS32
1223 + help
1224 + Please make sure to pick the right CPU type. Linux/MIPS is not
1225 + designed to be generic, i.e. Kernels compiled for R3000 CPUs will
1226 + *not* work on R4000 machines and vice versa. However, since most
1227 + of the supported machines have an R4000 (or similar) CPU, R4x00
1228 + might be a safe bet. If the resulting kernel does not work,
1229 + try to recompile with R3000.
1230 +
1231 +config CPU_TX39XX
1232 + bool "R39XX"
1233 + depends on MIPS32
1234 +
1235 +config CPU_VR41XX
1236 + bool "R41xx"
1237 + help
1238 + The options selects support for the NEC VR41xx series of processors.
1239 + Only choose this option if you have one of these processors as a
1240 + kernel built with this option will not run on any other type of
1241 + processor or vice versa.
1242 +
1243 +config CPU_R4300
1244 + bool "R4300"
1245 + help
1246 + MIPS Technologies R4300-series processors.
1247 +
1248 +config CPU_R4X00
1249 + bool "R4x00"
1250 + help
1251 + MIPS Technologies R4000-series processors other than 4300, including
1252 + the R4000, R4400, R4600, and 4700.
1253 +
1254 +config CPU_TX49XX
1255 + bool "R49XX"
1256 +
1257 +config CPU_R5000
1258 + bool "R5000"
1259 + help
1260 + MIPS Technologies R5000-series processors other than the Nevada.
1261 +
1262 +config CPU_R5432
1263 + bool "R5432"
1264 +
1265 +config CPU_R6000
1266 + bool "R6000"
1267 + depends on MIPS32 && EXPERIMENTAL
1268 + help
1269 + MIPS Technologies R6000 and R6000A series processors. Note these
1270 + processors are extremly rare and the support for them is incomplete.
1271 +
1272 +config CPU_NEVADA
1273 + bool "RM52xx"
1274 + help
1275 + QED / PMC-Sierra RM52xx-series ("Nevada") processors.
1276 +
1277 +config CPU_R8000
1278 + bool "R8000"
1279 + depends on MIPS64 && EXPERIMENTAL
1280 + help
1281 + MIPS Technologies R8000 processors. Note these processors are
1282 + uncommon and the support for them is incomplete.
1283 +
1284 +config CPU_R10000
1285 + bool "R10000"
1286 + help
1287 + MIPS Technologies R10000-series processors.
1288 +
1289 +config CPU_RM7000
1290 + bool "RM7000"
1291 +
1292 +config CPU_RM9000
1293 + bool "RM9000"
1294 +
1295 +config CPU_SB1
1296 + bool "SB1"
1297 +
1298 +endchoice
1299 +
1300 +choice
1301 + prompt "Kernel page size"
1302 + default PAGE_SIZE_4KB
1303 +
1304 +config PAGE_SIZE_4KB
1305 + bool "4kB"
1306 + help
1307 + This option select the standard 4kB Linux page size. On some
1308 + R3000-family processors this is the only available page size. Using
1309 + 4kB page size will minimize memory consumption and is therefore
1310 + recommended for low memory systems.
1311 +
1312 +config PAGE_SIZE_8KB
1313 + bool "8kB"
1314 + depends on EXPERIMENTAL && CPU_R8000
1315 + help
1316 + Using 8kB page size will result in higher performance kernel at
1317 + the price of higher memory consumption. This option is available
1318 + only on the R8000 processor. Not that at the time of this writing
1319 + this option is still high experimental; there are also issues with
1320 + compatibility of user applications.
1321 +
1322 +config PAGE_SIZE_16KB
1323 + bool "16kB"
1324 + depends on EXPERIMENTAL && !CPU_R3000 && !CPU_TX39XX
1325 + help
1326 + Using 16kB page size will result in higher performance kernel at
1327 + the price of higher memory consumption. This option is available on
1328 + all non-R3000 family processor. Not that at the time of this
1329 + writing this option is still high experimental; there are also
1330 + issues with compatibility of user applications.
1331 +
1332 +config PAGE_SIZE_64KB
1333 + bool "64kB"
1334 + depends on EXPERIMENTAL && !CPU_R3000 && !CPU_TX39XX
1335 + help
1336 + Using 64kB page size will result in higher performance kernel at
1337 + the price of higher memory consumption. This option is available on
1338 + all non-R3000 family processor. Not that at the time of this
1339 + writing this option is still high experimental; there are also
1340 + issues with compatibility of user applications.
1341 +
1342 +endchoice
1343 +
1344 +config BOARD_SCACHE
1345 + bool
1346 +
1347 +config IP22_CPU_SCACHE
1348 + bool
1349 + select BOARD_SCACHE
1350 +
1351 +config R5000_CPU_SCACHE
1352 + bool
1353 + select BOARD_SCACHE
1354 +
1355 +config RM7000_CPU_SCACHE
1356 + bool
1357 + select BOARD_SCACHE
1358 +
1359 +config SIBYTE_DMA_PAGEOPS
1360 + bool "Use DMA to clear/copy pages"
1361 + depends on CPU_SB1
1362 + help
1363 + Instead of using the CPU to zero and copy pages, use a Data Mover
1364 + channel. These DMA channels are otherwise unused by the standard
1365 + SiByte Linux port. Seems to give a small performance benefit.
1366 +
1367 +config CPU_HAS_PREFETCH
1368 + bool "Enable prefetches" if CPU_SB1 && !CPU_SB1_PASS_2
1369 + default y if CPU_MIPS32 || CPU_MIPS64 || CPU_RM7000 || CPU_RM9000 || CPU_R10000
1370 +
1371 +config VTAG_ICACHE
1372 + bool "Support for Virtual Tagged I-cache" if CPU_MIPS64 || CPU_MIPS32
1373 + default y if CPU_SB1
1374 +
1375 +config SB1_PASS_1_WORKAROUNDS
1376 + bool
1377 + depends on CPU_SB1_PASS_1
1378 + default y
1379 +
1380 +config SB1_PASS_2_WORKAROUNDS
1381 + bool
1382 + depends on CPU_SB1 && (CPU_SB1_PASS_2_2 || CPU_SB1_PASS_2)
1383 + default y
1384 +
1385 +config SB1_PASS_2_1_WORKAROUNDS
1386 + bool
1387 + depends on CPU_SB1 && CPU_SB1_PASS_2
1388 + default y
1389 +
1390 +config 64BIT_PHYS_ADDR
1391 + bool "Support for 64-bit physical address space"
1392 + depends on (CPU_R4X00 || CPU_R5000 || CPU_RM7000 || CPU_RM9000 || CPU_R10000 || CPU_SB1 || CPU_MIPS32 || CPU_MIPS64) && MIPS32
1393 +
1394 +config CPU_ADVANCED
1395 + bool "Override CPU Options"
1396 + depends on MIPS32
1397 + help
1398 + Saying yes here allows you to select support for various features
1399 + your CPU may or may not have. Most people should say N here.
1400 +
1401 +config CPU_HAS_LLSC
1402 + bool "ll/sc Instructions available" if CPU_ADVANCED
1403 + default y if !CPU_ADVANCED && !CPU_R3000 && !CPU_VR41XX && !CPU_TX39XX
1404 + help
1405 + MIPS R4000 series and later provide the Load Linked (ll)
1406 + and Store Conditional (sc) instructions. More information is
1407 + available at <http://www.go-ecs.com/mips/miptek1.htm>.
1408 +
1409 + Say Y here if your CPU has the ll and sc instructions. Say Y here
1410 + for better performance, N if you don't know. You must say Y here
1411 + for multiprocessor machines.
1412 +
1413 +config CPU_HAS_LLDSCD
1414 + bool "lld/scd Instructions available" if CPU_ADVANCED
1415 + default y if !CPU_ADVANCED && !CPU_R3000 && !CPU_VR41XX && !CPU_TX39XX && !CPU_MIPS32
1416 + help
1417 + Say Y here if your CPU has the lld and scd instructions, the 64-bit
1418 + equivalents of ll and sc. Say Y here for better performance, N if
1419 + you don't know. You must say Y here for multiprocessor machines.
1420 +
1421 +config CPU_HAS_WB
1422 + bool "Writeback Buffer available" if CPU_ADVANCED
1423 + default y if !CPU_ADVANCED && CPU_R3000 && MACH_DECSTATION
1424 + help
1425 + Say N here for slightly better performance. You must say Y here for
1426 + machines which require flushing of write buffers in software. Saying
1427 + Y is the safe option; N may result in kernel malfunction and crashes.
1428 +
1429 +config CPU_HAS_SYNC
1430 + bool
1431 + depends on !CPU_R3000
1432 + default y
1433 +
1434 +#
1435 +# - Highmem only makes sense for the 32-bit kernel.
1436 +# - The current highmem code will only work properly on physically indexed
1437 +# caches such as R3000, SB1, R7000 or those that look like they're virtually
1438 +# indexed such as R4000/R4400 SC and MC versions or R10000. So for the
1439 +# moment we protect the user and offer the highmem option only on machines
1440 +# where it's known to be safe. This will not offer highmem on a few systems
1441 +# such as MIPS32 and MIPS64 CPUs which may have virtual and physically
1442 +# indexed CPUs but we're playing safe.
1443 +# - We should not offer highmem for system of which we already know that they
1444 +# don't have memory configurations that could gain from highmem support in
1445 +# the kernel because they don't support configurations with RAM at physical
1446 +# addresses > 0x20000000.
1447 +#
1448 +config HIGHMEM
1449 + bool "High Memory Support"
1450 + depends on MIPS32 && (CPU_R3000 || CPU_SB1 || CPU_R7000 || CPU_RM9000 || CPU_R10000) && !(MACH_DECSTATION || MOMENCO_JAGUAR_ATX)
1451 +
1452 +config SMP
1453 + bool "Multi-Processing support"
1454 + depends on CPU_RM9000 || (SIBYTE_SB1250 && !SIBYTE_STANDALONE) || SGI_IP27
1455 + ---help---
1456 + This enables support for systems with more than one CPU. If you have
1457 + a system with only one CPU, like most personal computers, say N. If
1458 + you have a system with more than one CPU, say Y.
1459 +
1460 + If you say N here, the kernel will run on single and multiprocessor
1461 + machines, but will use only one CPU of a multiprocessor machine. If
1462 + you say Y here, the kernel will run on many, but not all,
1463 + singleprocessor machines. On a singleprocessor machine, the kernel
1464 + will run faster if you say N here.
1465 +
1466 + People using multiprocessor machines who say Y here should also say
1467 + Y to "Enhanced Real Time Clock Support", below.
1468 +
1469 + See also the <file:Documentation/smp.txt> and the SMP-HOWTO
1470 + available at <http://www.tldp.org/docs.html#howto>.
1471 +
1472 + If you don't know what to do here, say N.
1473 +
1474 +config NR_CPUS
1475 + int "Maximum number of CPUs (2-64)"
1476 + range 2 64
1477 + depends on SMP
1478 + default "64" if SGI_IP27
1479 + default "2"
1480 + help
1481 + This allows you to specify the maximum number of CPUs which this
1482 + kernel will support. The maximum supported value is 32 for 32-bit
1483 + kernel and 64 for 64-bit kernels; the minimum value which makes
1484 + sense is 2.
1485 +
1486 + This is purely to save memory - each supported CPU adds
1487 + approximately eight kilobytes to the kernel image.
1488 +
1489 +config PREEMPT
1490 + bool "Preemptible Kernel"
1491 + help
1492 + This option reduces the latency of the kernel when reacting to
1493 + real-time or interactive events by allowing a low priority process to
1494 + be preempted even if it is in kernel mode executing a system call.
1495 + This allows applications to run more reliably even when the system is
1496 + under load.
1497 +
1498 +config RTC_DS1742
1499 + bool "DS1742 BRAM/RTC support"
1500 + depends on TOSHIBA_JMR3927 || TOSHIBA_RBTX4927
1501 +
1502 +config MIPS_INSANE_LARGE
1503 + bool "Support for large 64-bit configurations"
1504 + depends on CPU_R10000 && MIPS64
1505 + help
1506 + MIPS R10000 does support a 44 bit / 16TB address space as opposed to
1507 + previous 64-bit processors which only supported 40 bit / 1TB. If you
1508 + need processes of more than 1TB virtual address space, say Y here.
1509 + This will result in additional memory usage, so it is not
1510 + recommended for normal users.
1511 +
1512 +config RWSEM_GENERIC_SPINLOCK
1513 + bool
1514 + default y
1515 +
1516 +endmenu
1517 +
1518 +menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)"
1519 +
1520 +config HW_HAS_PCI
1521 + bool
1522 +
1523 +config PCI
1524 + bool "Support for PCI controller"
1525 + depends on HW_HAS_PCI
1526 + help
1527 + Find out whether you have a PCI motherboard. PCI is the name of a
1528 + bus system, i.e. the way the CPU talks to the other stuff inside
1529 + your box. Other bus systems are ISA, EISA, or VESA. If you have PCI,
1530 + say Y, otherwise N.
1531 +
1532 + The PCI-HOWTO, available from
1533 + <http://www.tldp.org/docs.html#howto>, contains valuable
1534 + information about which PCI hardware does work under Linux and which
1535 + doesn't.
1536 +
1537 +config PCI_DOMAINS
1538 + bool
1539 + depends on PCI
1540 +
1541 +source "drivers/pci/Kconfig"
1542 +
1543 +#
1544 +# ISA support is now enabled via select. Too many systems still have the one
1545 +# or other ISA chip on the board that users don't know about so don't expect
1546 +# users to choose the right thing ...
1547 +#
1548 +config ISA
1549 + bool
1550 +
1551 +config EISA
1552 + bool "EISA support"
1553 + depends on SGI_IP22 || SNI_RM200_PCI
1554 + select ISA
1555 + ---help---
1556 + The Extended Industry Standard Architecture (EISA) bus was
1557 + developed as an open alternative to the IBM MicroChannel bus.
1558 +
1559 + The EISA bus provided some of the features of the IBM MicroChannel
1560 + bus while maintaining backward compatibility with cards made for
1561 + the older ISA bus. The EISA bus saw limited use between 1988 and
1562 + 1995 when it was made obsolete by the PCI bus.
1563 +
1564 + Say Y here if you are building a kernel for an EISA-based machine.
1565 +
1566 + Otherwise, say N.
1567 +
1568 +source "drivers/eisa/Kconfig"
1569 +
1570 +config TC
1571 + bool "TURBOchannel support"
1572 + depends on MACH_DECSTATION
1573 + help
1574 + TurboChannel is a DEC (now Compaq (now HP)) bus for Alpha and MIPS
1575 + processors. Documentation on writing device drivers for TurboChannel
1576 + is available at:
1577 + <http://www.cs.arizona.edu/computer.help/policy/DIGITAL_unix/AA-PS3HD-TET1_html/TITLE.html>.
1578 +
1579 +#config ACCESSBUS
1580 +# bool "Access.Bus support"
1581 +# depends on TC
1582 +
1583 +config MMU
1584 + bool
1585 + default y
1586 +
1587 +config MCA
1588 + bool
1589 +
1590 +config SBUS
1591 + bool
1592 +
1593 +source "drivers/pcmcia/Kconfig"
1594 +
1595 +source "drivers/pci/hotplug/Kconfig"
1596 +
1597 +endmenu
1598 +
1599 +menu "Executable file formats"
1600 +
1601 +source "fs/Kconfig.binfmt"
1602 +
1603 +config TRAD_SIGNALS
1604 + bool
1605 + default y if MIPS32
1606 +
1607 +config BUILD_ELF64
1608 + bool "Use 64-bit ELF format for building"
1609 + depends on MIPS64
1610 + help
1611 + A 64-bit kernel is usually built using the 64-bit ELF binary object
1612 + format as it's one that allows arbitrary 64-bit constructs. For
1613 + kernels that are loaded within the KSEG compatibility segments the
1614 + 32-bit ELF format can optionally be used resulting in a somewhat
1615 + smaller binary, but this option is not explicitly supported by the
1616 + toolchain and since binutils 2.14 it does not even work at all.
1617 +
1618 + Say Y to use the 64-bit format or N to use the 32-bit one.
1619 +
1620 + If unsure say Y.
1621 +
1622 +config BINFMT_IRIX
1623 + bool "Include IRIX binary compatibility"
1624 + depends on !CPU_LITTLE_ENDIAN && MIPS32 && BROKEN
1625 +
1626 +config MIPS32_COMPAT
1627 + bool "Kernel support for Linux/MIPS 32-bit binary compatibility"
1628 + depends on MIPS64
1629 + help
1630 + Select this option if you want Linux/MIPS 32-bit binary
1631 + compatibility. Since all software available for Linux/MIPS is
1632 + currently 32-bit you should say Y here.
1633 +
1634 +config COMPAT
1635 + bool
1636 + depends on MIPS32_COMPAT
1637 + default y
1638 +
1639 +config MIPS32_O32
1640 + bool "Kernel support for o32 binaries"
1641 + depends on MIPS32_COMPAT
1642 + help
1643 + Select this option if you want to run o32 binaries. These are pure
1644 + 32-bit binaries as used by the 32-bit Linux/MIPS port. Most of
1645 + existing binaries are in this format.
1646 +
1647 + If unsure, say Y.
1648 +
1649 +config MIPS32_N32
1650 + bool "Kernel support for n32 binaries"
1651 + depends on MIPS32_COMPAT
1652 + help
1653 + Select this option if you want to run n32 binaries. These are
1654 + 64-bit binaries using 32-bit quantities for addressing and certain
1655 + data that would normally be 64-bit. They are used in special
1656 + cases.
1657 +
1658 + If unsure, say N.
1659 +
1660 +config BINFMT_ELF32
1661 + bool
1662 + default y if MIPS32_O32 || MIPS32_N32
1663 +
1664 +config PM
1665 + bool "Power Management support (EXPERIMENTAL)"
1666 + depends on EXPERIMENTAL && MACH_AU1X00
1667 +
1668 +endmenu
1669 +
1670 +source "drivers/Kconfig"
1671 +
1672 +source "fs/Kconfig"
1673 +
1674 +source "arch/mips/Kconfig.debug"
1675 +
1676 +source "security/Kconfig"
1677 +
1678 +source "crypto/Kconfig"
1679 +
1680 +source "lib/Kconfig"
1681 +
1682 +#
1683 +# Use the generic interrupt handling code in kernel/irq/:
1684 +#
1685 +config GENERIC_HARDIRQS
1686 + bool
1687 + default y
1688 +
1689 +config GENERIC_IRQ_PROBE
1690 + bool
1691 + default y
1692 +
1693 +config ISA_DMA_API
1694 + bool
1695 + default y
1696 diff -Nur linux-2.6.12.5/arch/mips/Makefile linux-2.6.12.5-brcm/arch/mips/Makefile
1697 --- linux-2.6.12.5/arch/mips/Makefile 2005-08-15 02:20:18.000000000 +0200
1698 +++ linux-2.6.12.5-brcm/arch/mips/Makefile 2005-08-28 11:35:08.381898984 +0200
1699 @@ -79,7 +79,7 @@
1700 cflags-y += -I $(TOPDIR)/include/asm/gcc
1701 cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
1702 cflags-y += $(call cc-option, -finline-limit=100000)
1703 -LDFLAGS_vmlinux += -G 0 -static -n
1704 +LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
1705 MODFLAGS += -mlong-calls
1706
1707 cflags-$(CONFIG_SB1XXX_CORELIS) += -mno-sched-prolog -fno-omit-frame-pointer
1708 @@ -167,9 +167,10 @@
1709 $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \
1710 -Wa,--trap
1711
1712 -cflags-$(CONFIG_CPU_MIPS32) += \
1713 - $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \
1714 - -Wa,--trap
1715 +#cflags-$(CONFIG_CPU_MIPS32) += \
1716 +# $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \
1717 +# -Wa,--trap
1718 +cflags-$(CONFIG_CPU_MIPS32) += -mips2 -Wa,--trap
1719
1720 cflags-$(CONFIG_CPU_MIPS64) += \
1721 $(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \
1722 @@ -618,6 +619,14 @@
1723 load-$(CONFIG_SIBYTE_SWARM) := 0xffffffff80100000
1724
1725 #
1726 +# Broadcom BCM47XX boards
1727 +#
1728 +core-$(CONFIG_BCM47XX) += arch/mips/bcm47xx/ arch/mips/bcm47xx/broadcom/
1729 +cflags-$(CONFIG_BCM47XX) += -Iarch/mips/bcm47xx/broadcom/include
1730 +load-$(CONFIG_BCM47XX) := 0xffffffff80001000
1731 +
1732 +
1733 +#
1734 # SNI RM200 PCI
1735 #
1736 core-$(CONFIG_SNI_RM200_PCI) += arch/mips/sni/
1737 @@ -715,6 +724,14 @@
1738 all: vmlinux.ecoff
1739 endif
1740
1741 +ifdef CONFIG_BCM47XX
1742 +all: bzImage
1743 +
1744 +zImage bzImage: vmlinux
1745 + @$(MAKE) -C arch/mips/bcm47xx/compressed vmlinux
1746 +
1747 +endif
1748 +
1749 vmlinux.ecoff vmlinux.rm200: $(vmlinux-32)
1750 +@$(call makeboot,$@)
1751
1752 @@ -729,6 +746,7 @@
1753 archclean:
1754 @$(MAKE) $(clean)=arch/mips/boot
1755 @$(MAKE) $(clean)=arch/mips/lasat
1756 + @$(MAKE) -C arch/mips/bcm47xx/compressed clean
1757
1758 # Generate <asm/offset.h
1759 #
1760 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/Makefile linux-2.6.12.5-brcm/arch/mips/bcm47xx/Makefile
1761 --- linux-2.6.12.5/arch/mips/bcm47xx/Makefile 1970-01-01 01:00:00.000000000 +0100
1762 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/Makefile 2005-08-28 11:12:20.406862800 +0200
1763 @@ -0,0 +1,6 @@
1764 +#
1765 +# Makefile for the BCM47xx specific kernel interface routines
1766 +# under Linux.
1767 +#
1768 +
1769 +obj-y := irq.o int-handler.o prom.o setup.o time.o
1770 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/Makefile linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/Makefile
1771 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/Makefile 1970-01-01 01:00:00.000000000 +0100
1772 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/Makefile 2005-08-28 11:12:20.407862648 +0200
1773 @@ -0,0 +1,6 @@
1774 +#
1775 +# Makefile for the BCM47xx specific kernel interface routines
1776 +# under Linux.
1777 +#
1778 +
1779 +obj-y := sbutils.o linux_osl.o bcmsrom.o bcmutils.o sbmips.o sbpci.o hnddma.o
1780 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/bcmsrom.c linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/bcmsrom.c
1781 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/bcmsrom.c 1970-01-01 01:00:00.000000000 +0100
1782 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/bcmsrom.c 2005-08-28 11:12:20.408862496 +0200
1783 @@ -0,0 +1,685 @@
1784 +/*
1785 + * Misc useful routines to access NIC SROM
1786 + *
1787 + * Copyright 2001-2003, Broadcom Corporation
1788 + * All Rights Reserved.
1789 + *
1790 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
1791 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
1792 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
1793 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
1794 + * $Id$
1795 + */
1796 +
1797 +#include <typedefs.h>
1798 +#include <osl.h>
1799 +#include <bcmutils.h>
1800 +#include <bcmsrom.h>
1801 +#include <bcmdevs.h>
1802 +#include <bcmendian.h>
1803 +#include <sbpcmcia.h>
1804 +#include <pcicfg.h>
1805 +
1806 +#include <proto/ethernet.h> /* for sprom content groking */
1807 +
1808 +#define VARS_MAX 4096 /* should be reduced */
1809 +
1810 +static int initvars_srom_pci(void *curmap, char **vars, int *count);
1811 +static int initvars_cis_pcmcia(void *osh, char **vars, int *count);
1812 +static int sprom_cmd_pcmcia(void *osh, uint8 cmd);
1813 +static int sprom_read_pcmcia(void *osh, uint16 addr, uint16 *data);
1814 +static int sprom_write_pcmcia(void *osh, uint16 addr, uint16 data);
1815 +static int sprom_read_pci(uint16 *sprom, uint byteoff, uint16 *buf, uint nbytes, bool check_crc);
1816 +
1817 +/*
1818 + * Initialize the vars from the right source for this platform.
1819 + * Return 0 on success, nonzero on error.
1820 + */
1821 +int
1822 +srom_var_init(uint bus, void *curmap, void *osh, char **vars, int *count)
1823 +{
1824 + if (vars == NULL)
1825 + return (0);
1826 +
1827 + switch (bus) {
1828 + case SB_BUS:
1829 + /* These two could be asserts ... */
1830 + *vars = NULL;
1831 + *count = 0;
1832 + return(0);
1833 +
1834 + case PCI_BUS:
1835 + ASSERT(curmap); /* can not be NULL */
1836 + return(initvars_srom_pci(curmap, vars, count));
1837 +
1838 + case PCMCIA_BUS:
1839 + return(initvars_cis_pcmcia(osh, vars, count));
1840 +
1841 +
1842 + default:
1843 + ASSERT(0);
1844 + }
1845 + return (-1);
1846 +}
1847 +
1848 +
1849 +/* support only 16-bit word read from srom */
1850 +int
1851 +srom_read(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf)
1852 +{
1853 + void *srom;
1854 + uint i, off, nw;
1855 +
1856 + /* check input - 16-bit access only */
1857 + if (byteoff & 1 || nbytes & 1 || (byteoff + nbytes) > (SPROM_SIZE * 2))
1858 + return 1;
1859 +
1860 + if (bus == PCI_BUS) {
1861 + if (!curmap)
1862 + return 1;
1863 + srom = (void *)((uint)curmap + PCI_BAR0_SPROM_OFFSET);
1864 + if (sprom_read_pci(srom, byteoff, buf, nbytes, FALSE))
1865 + return 1;
1866 + } else if (bus == PCMCIA_BUS) {
1867 + off = byteoff / 2;
1868 + nw = nbytes / 2;
1869 + for (i = 0; i < nw; i++) {
1870 + if (sprom_read_pcmcia(osh, (uint16)(off + i), (uint16*)(buf + i)))
1871 + return 1;
1872 + }
1873 + } else {
1874 + return 1;
1875 + }
1876 +
1877 + return 0;
1878 +}
1879 +
1880 +/* support only 16-bit word write into srom */
1881 +int
1882 +srom_write(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf)
1883 +{
1884 + uint16 *srom;
1885 + uint i, off, nw, crc_range;
1886 + uint16 image[SPROM_SIZE], *p;
1887 + uint8 crc;
1888 + volatile uint32 val32;
1889 +
1890 + /* check input - 16-bit access only */
1891 + if (byteoff & 1 || nbytes & 1 || (byteoff + nbytes) > (SPROM_SIZE * 2))
1892 + return 1;
1893 +
1894 + crc_range = ((bus == PCMCIA_BUS) ? SPROM_SIZE : SPROM_CRC_RANGE) * 2;
1895 +
1896 + /* if changes made inside crc cover range */
1897 + if (byteoff < crc_range) {
1898 + nw = (((byteoff + nbytes) > crc_range) ? byteoff + nbytes : crc_range) / 2;
1899 + /* read data including entire first 64 words from srom */
1900 + if (srom_read(bus, curmap, osh, 0, nw * 2, image))
1901 + return 1;
1902 + /* make changes */
1903 + bcopy((void*)buf, (void*)&image[byteoff / 2], nbytes);
1904 + /* calculate crc */
1905 + htol16_buf(image, crc_range);
1906 + crc = ~crc8((uint8 *)image, crc_range - 1, CRC8_INIT_VALUE);
1907 + ltoh16_buf(image, crc_range);
1908 + image[(crc_range / 2) - 1] = (crc << 8) | (image[(crc_range / 2) - 1] & 0xff);
1909 + p = image;
1910 + off = 0;
1911 + } else {
1912 + p = buf;
1913 + off = byteoff / 2;
1914 + nw = nbytes / 2;
1915 + }
1916 +
1917 + if (bus == PCI_BUS) {
1918 + srom = (uint16*)((uint)curmap + PCI_BAR0_SPROM_OFFSET);
1919 + /* enable writes to the SPROM */
1920 + val32 = OSL_PCI_READ_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32));
1921 + val32 |= SPROM_WRITEEN;
1922 + OSL_PCI_WRITE_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32), val32);
1923 + bcm_mdelay(500);
1924 + /* write srom */
1925 + for (i = 0; i < nw; i++) {
1926 + W_REG(&srom[off + i], p[i]);
1927 + bcm_mdelay(20);
1928 + }
1929 + /* disable writes to the SPROM */
1930 + OSL_PCI_WRITE_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32), val32 & ~SPROM_WRITEEN);
1931 + } else if (bus == PCMCIA_BUS) {
1932 + /* enable writes to the SPROM */
1933 + if (sprom_cmd_pcmcia(osh, SROM_WEN))
1934 + return 1;
1935 + bcm_mdelay(500);
1936 + /* write srom */
1937 + for (i = 0; i < nw; i++) {
1938 + sprom_write_pcmcia(osh, (uint16)(off + i), p[i]);
1939 + bcm_mdelay(20);
1940 + }
1941 + /* disable writes to the SPROM */
1942 + if (sprom_cmd_pcmcia(osh, SROM_WDS))
1943 + return 1;
1944 + } else {
1945 + return 1;
1946 + }
1947 +
1948 + bcm_mdelay(500);
1949 + return 0;
1950 +}
1951 +
1952 +
1953 +int
1954 +srom_parsecis(uint8 *cis, char **vars, int *count)
1955 +{
1956 + char eabuf[32];
1957 + char *vp, *base;
1958 + uint8 tup, tlen, sromrev = 1;
1959 + int i, j;
1960 + uint varsize;
1961 + bool ag_init = FALSE;
1962 + uint16 w;
1963 +
1964 + ASSERT(vars);
1965 + ASSERT(count);
1966 +
1967 + base = vp = MALLOC(VARS_MAX);
1968 + ASSERT(vp);
1969 +
1970 + i = 0;
1971 + do {
1972 + tup = cis[i++];
1973 + tlen = cis[i++];
1974 +
1975 + switch (tup) {
1976 + case CISTPL_MANFID:
1977 + vp += sprintf(vp, "manfid=%d", (cis[i + 1] << 8) + cis[i]);
1978 + vp++;
1979 + vp += sprintf(vp, "prodid=%d", (cis[i + 3] << 8) + cis[i + 2]);
1980 + vp++;
1981 + break;
1982 +
1983 + case CISTPL_FUNCE:
1984 + if (cis[i] == LAN_NID) {
1985 + ASSERT(cis[i + 1] == ETHER_ADDR_LEN);
1986 + bcm_ether_ntoa((uchar*)&cis[i + 2], eabuf);
1987 + vp += sprintf(vp, "il0macaddr=%s", eabuf);
1988 + vp++;
1989 + }
1990 + break;
1991 +
1992 + case CISTPL_CFTABLE:
1993 + vp += sprintf(vp, "regwindowsz=%d", (cis[i + 7] << 8) | cis[i + 6]);
1994 + vp++;
1995 + break;
1996 +
1997 + case CISTPL_BRCM_HNBU:
1998 + switch (cis[i]) {
1999 + case HNBU_CHIPID:
2000 + vp += sprintf(vp, "vendid=%d", (cis[i + 2] << 8) + cis[i + 1]);
2001 + vp++;
2002 + vp += sprintf(vp, "devid=%d", (cis[i + 4] << 8) + cis[i + 3]);
2003 + vp++;
2004 + if (tlen == 7) {
2005 + vp += sprintf(vp, "chiprev=%d", (cis[i + 6] << 8) + cis[i + 5]);
2006 + vp++;
2007 + }
2008 + break;
2009 +
2010 + case HNBU_BOARDREV:
2011 + vp += sprintf(vp, "boardrev=%d", cis[i + 1]);
2012 + vp++;
2013 + break;
2014 +
2015 + case HNBU_AA:
2016 + vp += sprintf(vp, "aa0=%d", cis[i + 1]);
2017 + vp++;
2018 + break;
2019 +
2020 + case HNBU_AG:
2021 + vp += sprintf(vp, "ag0=%d", cis[i + 1]);
2022 + vp++;
2023 + ag_init = TRUE;
2024 + break;
2025 +
2026 + case HNBU_CC:
2027 + vp += sprintf(vp, "cc=%d", cis[i + 1]);
2028 + vp++;
2029 + break;
2030 +
2031 + case HNBU_PAPARMS:
2032 + vp += sprintf(vp, "pa0maxpwr=%d", cis[i + tlen - 1]);
2033 + vp++;
2034 + if (tlen == 9) {
2035 + /* New version */
2036 + for (j = 0; j < 3; j++) {
2037 + vp += sprintf(vp, "pa0b%d=%d", j,
2038 + (cis[i + (j * 2) + 2] << 8) + cis[i + (j * 2) + 1]);
2039 + vp++;
2040 + }
2041 + vp += sprintf(vp, "pa0itssit=%d", cis[i + 7]);
2042 + vp++;
2043 + }
2044 + break;
2045 +
2046 + case HNBU_OEM:
2047 + vp += sprintf(vp, "oem=%02x%02x%02x%02x%02x%02x%02x%02x",
2048 + cis[i + 1], cis[i + 2], cis[i + 3], cis[i + 4],
2049 + cis[i + 5], cis[i + 6], cis[i + 7], cis[i + 8]);
2050 + vp++;
2051 + break;
2052 + case HNBU_BOARDFLAGS:
2053 + w = (cis[i + 2] << 8) + cis[i + 1];
2054 + if (w == 0xffff) w = 0;
2055 + vp += sprintf(vp, "boardflags=%d", w);
2056 + vp++;
2057 + break;
2058 + case HNBU_LED:
2059 + if (cis[i + 1] != 0xff) {
2060 + vp += sprintf(vp, "wl0gpio0=%d", cis[i + 1]);
2061 + vp++;
2062 + }
2063 + if (cis[i + 2] != 0xff) {
2064 + vp += sprintf(vp, "wl0gpio1=%d", cis[i + 2]);
2065 + vp++;
2066 + }
2067 + if (cis[i + 3] != 0xff) {
2068 + vp += sprintf(vp, "wl0gpio2=%d", cis[i + 3]);
2069 + vp++;
2070 + }
2071 + if (cis[i + 4] != 0xff) {
2072 + vp += sprintf(vp, "wl0gpio3=%d", cis[i + 4]);
2073 + vp++;
2074 + }
2075 + break;
2076 + }
2077 + break;
2078 +
2079 + }
2080 + i += tlen;
2081 + } while (tup != 0xff);
2082 +
2083 + /* Set the srom version */
2084 + vp += sprintf(vp, "sromrev=%d", sromrev);
2085 + vp++;
2086 +
2087 + /* For now just set boardflags2 to zero */
2088 + vp += sprintf(vp, "boardflags2=0");
2089 + vp++;
2090 +
2091 + /* if there is no antenna gain field, set default */
2092 + if (ag_init == FALSE) {
2093 + vp += sprintf(vp, "ag0=%d", 0xff);
2094 + vp++;
2095 + }
2096 +
2097 + /* final nullbyte terminator */
2098 + *vp++ = '\0';
2099 + varsize = (uint)vp - (uint)base;
2100 +
2101 + ASSERT(varsize < VARS_MAX);
2102 +
2103 + if (varsize == VARS_MAX) {
2104 + *vars = base;
2105 + } else {
2106 + vp = MALLOC(varsize);
2107 + ASSERT(vp);
2108 + bcopy(base, vp, varsize);
2109 + MFREE(base, VARS_MAX);
2110 + *vars = vp;
2111 + }
2112 + *count = varsize;
2113 +
2114 + return (0);
2115 +}
2116 +
2117 +
2118 +/* set PCMCIA sprom command register */
2119 +static int
2120 +sprom_cmd_pcmcia(void *osh, uint8 cmd)
2121 +{
2122 + uint8 status;
2123 + uint wait_cnt = 1000;
2124 +
2125 + /* write sprom command register */
2126 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_CS, &cmd, 1);
2127 +
2128 + /* wait status */
2129 + while (wait_cnt--) {
2130 + OSL_PCMCIA_READ_ATTR(osh, SROM_CS, &status, 1);
2131 + if (status & SROM_DONE)
2132 + return 0;
2133 + }
2134 + return 1;
2135 +}
2136 +
2137 +/* read a word from the PCMCIA srom */
2138 +static int
2139 +sprom_read_pcmcia(void *osh, uint16 addr, uint16 *data)
2140 +{
2141 + uint8 addr_l, addr_h, data_l, data_h;
2142 +
2143 + addr_l = (uint8)((addr * 2) & 0xff);
2144 + addr_h = (uint8)(((addr * 2) >> 8) & 0xff);
2145 +
2146 + /* set address */
2147 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRH, &addr_h, 1);
2148 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRL, &addr_l, 1);
2149 +
2150 + /* do read */
2151 + if (sprom_cmd_pcmcia(osh, SROM_READ))
2152 + return 1;
2153 +
2154 + /* read data */
2155 + OSL_PCMCIA_READ_ATTR(osh, SROM_DATAH, &data_h, 1);
2156 + OSL_PCMCIA_READ_ATTR(osh, SROM_DATAL, &data_l, 1);
2157 +
2158 + *data = (data_h << 8) | data_l;
2159 + return 0;
2160 +}
2161 +
2162 +/* write a word to the PCMCIA srom */
2163 +static int
2164 +sprom_write_pcmcia(void *osh, uint16 addr, uint16 data)
2165 +{
2166 + uint8 addr_l, addr_h, data_l, data_h;
2167 +
2168 + addr_l = (uint8)((addr * 2) & 0xff);
2169 + addr_h = (uint8)(((addr * 2) >> 8) & 0xff);
2170 + data_l = (uint8)(data & 0xff);
2171 + data_h = (uint8)((data >> 8) & 0xff);
2172 +
2173 + /* set address */
2174 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRH, &addr_h, 1);
2175 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRL, &addr_l, 1);
2176 +
2177 + /* write data */
2178 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_DATAH, &data_h, 1);
2179 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_DATAL, &data_l, 1);
2180 +
2181 + /* do write */
2182 + return sprom_cmd_pcmcia(osh, SROM_WRITE);
2183 +}
2184 +
2185 +/*
2186 + * Read in and validate sprom.
2187 + * Return 0 on success, nonzero on error.
2188 + */
2189 +static int
2190 +sprom_read_pci(uint16 *sprom, uint byteoff, uint16 *buf, uint nbytes, bool check_crc)
2191 +{
2192 + int off, nw;
2193 + uint8 chk8;
2194 + int i;
2195 +
2196 + off = byteoff / 2;
2197 + nw = ROUNDUP(nbytes, 2) / 2;
2198 +
2199 + /* read the sprom */
2200 + for (i = 0; i < nw; i++)
2201 + buf[i] = R_REG(&sprom[off + i]);
2202 +
2203 + if (check_crc) {
2204 + /* fixup the endianness so crc8 will pass */
2205 + htol16_buf(buf, nw * 2);
2206 + if ((chk8 = crc8((uchar*)buf, nbytes, CRC8_INIT_VALUE)) != CRC8_GOOD_VALUE)
2207 + return (1);
2208 + /* now correct the endianness of the byte array */
2209 + ltoh16_buf(buf, nw * 2);
2210 + }
2211 +
2212 + return (0);
2213 +}
2214 +
2215 +/*
2216 + * Initialize nonvolatile variable table from sprom.
2217 + * Return 0 on success, nonzero on error.
2218 + */
2219 +
2220 +static int
2221 +initvars_srom_pci(void *curmap, char **vars, int *count)
2222 +{
2223 + uint16 w, b[64];
2224 + uint8 sromrev;
2225 + struct ether_addr ea;
2226 + char eabuf[32];
2227 + int c, woff, i;
2228 + char *vp, *base;
2229 +
2230 + if (sprom_read_pci((void *)((uint)curmap + PCI_BAR0_SPROM_OFFSET), 0, b, sizeof (b), TRUE))
2231 + return (-1);
2232 +
2233 + /* top word of sprom contains version and crc8 */
2234 + sromrev = b[63] & 0xff;
2235 + if ((sromrev != 1) && (sromrev != 2)) {
2236 + return (-2);
2237 + }
2238 +
2239 + ASSERT(vars);
2240 + ASSERT(count);
2241 +
2242 + base = vp = MALLOC(VARS_MAX);
2243 + ASSERT(vp);
2244 +
2245 + vp += sprintf(vp, "sromrev=%d", sromrev);
2246 + vp++;
2247 +
2248 + if (sromrev >= 2) {
2249 + /* New section takes over the 4th hardware function space */
2250 +
2251 + /* Word 28 is boardflags2 */
2252 + vp += sprintf(vp, "boardflags2=%d", b[28]);
2253 + vp++;
2254 +
2255 + /* Word 29 is max power 11a high/low */
2256 + w = b[29];
2257 + vp += sprintf(vp, "pa1himaxpwr=%d", w & 0xff);
2258 + vp++;
2259 + vp += sprintf(vp, "pa1lomaxpwr=%d", (w >> 8) & 0xff);
2260 + vp++;
2261 +
2262 + /* Words 30-32 set the 11alow pa settings,
2263 + * 33-35 are the 11ahigh ones.
2264 + */
2265 + for (i = 0; i < 3; i++) {
2266 + vp += sprintf(vp, "pa1lob%d=%d", i, b[30 + i]);
2267 + vp++;
2268 + vp += sprintf(vp, "pa1hib%d=%d", i, b[33 + i]);
2269 + vp++;
2270 + }
2271 + w = b[59];
2272 + if (w == 0)
2273 + vp += sprintf(vp, "ccode=");
2274 + else
2275 + vp += sprintf(vp, "ccode=%c%c", (w >> 8), (w & 0xff));
2276 + vp++;
2277 +
2278 + }
2279 +
2280 + /* parameter section of sprom starts at byte offset 72 */
2281 + woff = 72/2;
2282 +
2283 + /* first 6 bytes are il0macaddr */
2284 + ea.octet[0] = (b[woff] >> 8) & 0xff;
2285 + ea.octet[1] = b[woff] & 0xff;
2286 + ea.octet[2] = (b[woff+1] >> 8) & 0xff;
2287 + ea.octet[3] = b[woff+1] & 0xff;
2288 + ea.octet[4] = (b[woff+2] >> 8) & 0xff;
2289 + ea.octet[5] = b[woff+2] & 0xff;
2290 + woff += ETHER_ADDR_LEN/2 ;
2291 + bcm_ether_ntoa((uchar*)&ea, eabuf);
2292 + vp += sprintf(vp, "il0macaddr=%s", eabuf);
2293 + vp++;
2294 +
2295 + /* next 6 bytes are et0macaddr */
2296 + ea.octet[0] = (b[woff] >> 8) & 0xff;
2297 + ea.octet[1] = b[woff] & 0xff;
2298 + ea.octet[2] = (b[woff+1] >> 8) & 0xff;
2299 + ea.octet[3] = b[woff+1] & 0xff;
2300 + ea.octet[4] = (b[woff+2] >> 8) & 0xff;
2301 + ea.octet[5] = b[woff+2] & 0xff;
2302 + woff += ETHER_ADDR_LEN/2 ;
2303 + bcm_ether_ntoa((uchar*)&ea, eabuf);
2304 + vp += sprintf(vp, "et0macaddr=%s", eabuf);
2305 + vp++;
2306 +
2307 + /* next 6 bytes are et1macaddr */
2308 + ea.octet[0] = (b[woff] >> 8) & 0xff;
2309 + ea.octet[1] = b[woff] & 0xff;
2310 + ea.octet[2] = (b[woff+1] >> 8) & 0xff;
2311 + ea.octet[3] = b[woff+1] & 0xff;
2312 + ea.octet[4] = (b[woff+2] >> 8) & 0xff;
2313 + ea.octet[5] = b[woff+2] & 0xff;
2314 + woff += ETHER_ADDR_LEN/2 ;
2315 + bcm_ether_ntoa((uchar*)&ea, eabuf);
2316 + vp += sprintf(vp, "et1macaddr=%s", eabuf);
2317 + vp++;
2318 +
2319 + /*
2320 + * Enet phy settings one or two singles or a dual
2321 + * Bits 4-0 : MII address for enet0 (0x1f for not there)
2322 + * Bits 9-5 : MII address for enet1 (0x1f for not there)
2323 + * Bit 14 : Mdio for enet0
2324 + * Bit 15 : Mdio for enet1
2325 + */
2326 + w = b[woff];
2327 + vp += sprintf(vp, "et0phyaddr=%d", (w & 0x1f));
2328 + vp++;
2329 + vp += sprintf(vp, "et1phyaddr=%d", ((w >> 5) & 0x1f));
2330 + vp++;
2331 + vp += sprintf(vp, "et0mdcport=%d", ((w >> 14) & 0x1));
2332 + vp++;
2333 + vp += sprintf(vp, "et1mdcport=%d", ((w >> 15) & 0x1));
2334 + vp++;
2335 +
2336 + /* Word 46 has board rev, antennas 0/1 & Country code/control */
2337 + w = b[46];
2338 + vp += sprintf(vp, "boardrev=%d", w & 0xff);
2339 + vp++;
2340 +
2341 + if (sromrev > 1)
2342 + vp += sprintf(vp, "cctl=%d", (w >> 8) & 0xf);
2343 + else
2344 + vp += sprintf(vp, "cc=%d", (w >> 8) & 0xf);
2345 + vp++;
2346 +
2347 + vp += sprintf(vp, "aa0=%d", (w >> 12) & 0x3);
2348 + vp++;
2349 +
2350 + vp += sprintf(vp, "aa1=%d", (w >> 14) & 0x3);
2351 + vp++;
2352 +
2353 + /* Words 47-49 set the (wl) pa settings */
2354 + woff = 47;
2355 +
2356 + for (i = 0; i < 3; i++) {
2357 + vp += sprintf(vp, "pa0b%d=%d", i, b[woff+i]);
2358 + vp++;
2359 + vp += sprintf(vp, "pa1b%d=%d", i, b[woff+i+6]);
2360 + vp++;
2361 + }
2362 +
2363 + /*
2364 + * Words 50-51 set the customer-configured wl led behavior.
2365 + * 8 bits/gpio pin. High bit: activehi=0, activelo=1;
2366 + * LED behavior values defined in wlioctl.h .
2367 + */
2368 + w = b[50];
2369 + if ((w != 0) && (w != 0xffff)) {
2370 + /* gpio0 */
2371 + vp += sprintf(vp, "wl0gpio0=%d", (w & 0xff));
2372 + vp++;
2373 +
2374 + /* gpio1 */
2375 + vp += sprintf(vp, "wl0gpio1=%d", (w >> 8) & 0xff);
2376 + vp++;
2377 + }
2378 + w = b[51];
2379 + if ((w != 0) && (w != 0xffff)) {
2380 + /* gpio2 */
2381 + vp += sprintf(vp, "wl0gpio2=%d", w & 0xff);
2382 + vp++;
2383 +
2384 + /* gpio3 */
2385 + vp += sprintf(vp, "wl0gpio3=%d", (w >> 8) & 0xff);
2386 + vp++;
2387 + }
2388 +
2389 + /* Word 52 is max power 0/1 */
2390 + w = b[52];
2391 + vp += sprintf(vp, "pa0maxpwr=%d", w & 0xff);
2392 + vp++;
2393 + vp += sprintf(vp, "pa1maxpwr=%d", (w >> 8) & 0xff);
2394 + vp++;
2395 +
2396 + /* Word 56 is idle tssi target 0/1 */
2397 + w = b[56];
2398 + vp += sprintf(vp, "pa0itssit=%d", w & 0xff);
2399 + vp++;
2400 + vp += sprintf(vp, "pa1itssit=%d", (w >> 8) & 0xff);
2401 + vp++;
2402 +
2403 + /* Word 57 is boardflags, if not programmed make it zero */
2404 + w = b[57];
2405 + if (w == 0xffff) w = 0;
2406 + vp += sprintf(vp, "boardflags=%d", w);
2407 + vp++;
2408 +
2409 + /* Word 58 is antenna gain 0/1 */
2410 + w = b[58];
2411 + vp += sprintf(vp, "ag0=%d", w & 0xff);
2412 + vp++;
2413 +
2414 + vp += sprintf(vp, "ag1=%d", (w >> 8) & 0xff);
2415 + vp++;
2416 +
2417 + if (sromrev == 1) {
2418 + /* set the oem string */
2419 + vp += sprintf(vp, "oem=%02x%02x%02x%02x%02x%02x%02x%02x",
2420 + ((b[59] >> 8) & 0xff), (b[59] & 0xff),
2421 + ((b[60] >> 8) & 0xff), (b[60] & 0xff),
2422 + ((b[61] >> 8) & 0xff), (b[61] & 0xff),
2423 + ((b[62] >> 8) & 0xff), (b[62] & 0xff));
2424 + vp++;
2425 + }
2426 +
2427 + /* final nullbyte terminator */
2428 + *vp++ = '\0';
2429 +
2430 + c = vp - base;
2431 + ASSERT(c <= VARS_MAX);
2432 +
2433 + if (c == VARS_MAX) {
2434 + *vars = base;
2435 + } else {
2436 + vp = MALLOC(c);
2437 + ASSERT(vp);
2438 + bcopy(base, vp, c);
2439 + MFREE(base, VARS_MAX);
2440 + *vars = vp;
2441 + }
2442 + *count = c;
2443 +
2444 + return (0);
2445 +}
2446 +
2447 +/*
2448 + * Read the cis and call parsecis to initialize the vars.
2449 + * Return 0 on success, nonzero on error.
2450 + */
2451 +static int
2452 +initvars_cis_pcmcia(void *osh, char **vars, int *count)
2453 +{
2454 + uint8 *cis = NULL;
2455 + int rc;
2456 +
2457 + if ((cis = MALLOC(CIS_SIZE)) == NULL)
2458 + return (-1);
2459 +
2460 + OSL_PCMCIA_READ_ATTR(osh, 0, cis, CIS_SIZE);
2461 +
2462 + rc = srom_parsecis(cis, vars, count);
2463 +
2464 + MFREE(cis, CIS_SIZE);
2465 +
2466 + return (rc);
2467 +}
2468 +
2469 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/bcmutils.c linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/bcmutils.c
2470 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/bcmutils.c 1970-01-01 01:00:00.000000000 +0100
2471 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/bcmutils.c 2005-08-28 11:12:20.428859456 +0200
2472 @@ -0,0 +1,691 @@
2473 +/*
2474 + * Misc useful OS-independent routines.
2475 + *
2476 + * Copyright 2001-2003, Broadcom Corporation
2477 + * All Rights Reserved.
2478 + *
2479 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
2480 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
2481 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
2482 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
2483 + * $Id$
2484 + */
2485 +
2486 +#include <typedefs.h>
2487 +#include <osl.h>
2488 +#include <bcmutils.h>
2489 +#include <bcmendian.h>
2490 +#include <bcmnvram.h>
2491 +
2492 +unsigned char bcm_ctype[] = {
2493 + _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 0-7 */
2494 + _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 */
2495 + _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 16-23 */
2496 + _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 24-31 */
2497 + _BCM_S|_BCM_SP,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 32-39 */
2498 + _BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 40-47 */
2499 + _BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D, /* 48-55 */
2500 + _BCM_D,_BCM_D,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 56-63 */
2501 + _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 */
2502 + _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U, /* 72-79 */
2503 + _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U, /* 80-87 */
2504 + _BCM_U,_BCM_U,_BCM_U,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 88-95 */
2505 + _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 */
2506 + _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L, /* 104-111 */
2507 + _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L, /* 112-119 */
2508 + _BCM_L,_BCM_L,_BCM_L,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_C, /* 120-127 */
2509 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */
2510 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */
2511 + _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 */
2512 + _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 */
2513 + _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 */
2514 + _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 */
2515 + _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 */
2516 + _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 */
2517 +};
2518 +
2519 +uchar
2520 +bcm_toupper(uchar c)
2521 +{
2522 + if (bcm_islower(c))
2523 + c -= 'a'-'A';
2524 + return (c);
2525 +}
2526 +
2527 +ulong
2528 +bcm_strtoul(char *cp, char **endp, uint base)
2529 +{
2530 + ulong result, value;
2531 + bool minus;
2532 +
2533 + minus = FALSE;
2534 +
2535 + while (bcm_isspace(*cp))
2536 + cp++;
2537 +
2538 + if (cp[0] == '+')
2539 + cp++;
2540 + else if (cp[0] == '-') {
2541 + minus = TRUE;
2542 + cp++;
2543 + }
2544 +
2545 + if (base == 0) {
2546 + if (cp[0] == '0') {
2547 + if ((cp[1] == 'x') || (cp[1] == 'X')) {
2548 + base = 16;
2549 + cp = &cp[2];
2550 + } else {
2551 + base = 8;
2552 + cp = &cp[1];
2553 + }
2554 + } else
2555 + base = 10;
2556 + } else if (base == 16 && (cp[0] == '0') && ((cp[1] == 'x') || (cp[1] == 'X'))) {
2557 + cp = &cp[2];
2558 + }
2559 +
2560 + result = 0;
2561 +
2562 + while (bcm_isxdigit(*cp) &&
2563 + (value = bcm_isdigit(*cp) ? *cp-'0' : bcm_toupper(*cp)-'A'+10) < base) {
2564 + result = result*base + value;
2565 + cp++;
2566 + }
2567 +
2568 + if (minus)
2569 + result = (ulong)(result * -1);
2570 +
2571 + if (endp)
2572 + *endp = (char *)cp;
2573 +
2574 + return (result);
2575 +}
2576 +
2577 +uint
2578 +bcm_atoi(char *s)
2579 +{
2580 + uint n;
2581 +
2582 + n = 0;
2583 +
2584 + while (bcm_isdigit(*s))
2585 + n = (n * 10) + *s++ - '0';
2586 + return (n);
2587 +}
2588 +
2589 +void
2590 +deadbeef(char *p, uint len)
2591 +{
2592 + static uchar meat[] = { 0xde, 0xad, 0xbe, 0xef };
2593 +
2594 + while (len-- > 0) {
2595 + *p = meat[((uint)p) & 3];
2596 + p++;
2597 + }
2598 +}
2599 +
2600 +/* pretty hex print a contiguous buffer */
2601 +void
2602 +prhex(char *msg, uchar *buf, uint nbytes)
2603 +{
2604 + char line[256];
2605 + char* p;
2606 + uint i;
2607 +
2608 + if (msg && (msg[0] != '\0'))
2609 + printf("%s: ", msg);
2610 +
2611 + p = line;
2612 + for (i = 0; i < nbytes; i++) {
2613 + if (i % 16 == 0) {
2614 + p += sprintf(p, "%04d: ", i); /* line prefix */
2615 + }
2616 + p += sprintf(p, "%02x ", buf[i]);
2617 + if (i % 16 == 15) {
2618 + printf("%s\n", line); /* flush line */
2619 + p = line;
2620 + }
2621 + }
2622 +
2623 + /* flush last partial line */
2624 + if (p != line)
2625 + printf("%s\n", line);
2626 +}
2627 +
2628 +/* pretty hex print a pkt buffer chain */
2629 +void
2630 +prpkt(char *msg, void *drv, void *p0)
2631 +{
2632 + void *p;
2633 +
2634 + if (msg && (msg[0] != '\0'))
2635 + printf("%s: ", msg);
2636 +
2637 + for (p = p0; p; p = PKTNEXT(drv, p))
2638 + prhex(NULL, PKTDATA(drv, p), PKTLEN(drv, p));
2639 +}
2640 +
2641 +/* copy a pkt buffer chain into a buffer */
2642 +uint
2643 +pktcopy(void *drv, void *p, uint offset, int len, uchar *buf)
2644 +{
2645 + uint n, ret = 0;
2646 +
2647 + if (len < 0)
2648 + len = 4096; /* "infinite" */
2649 +
2650 + /* skip 'offset' bytes */
2651 + for (; p && offset; p = PKTNEXT(drv, p)) {
2652 + if (offset < (uint)PKTLEN(drv, p))
2653 + break;
2654 + offset -= PKTLEN(drv, p);
2655 + }
2656 +
2657 + if (!p)
2658 + return 0;
2659 +
2660 + /* copy the data */
2661 + for (; p && len; p = PKTNEXT(drv, p)) {
2662 + n = MIN((uint)PKTLEN(drv, p) - offset, (uint)len);
2663 + bcopy(PKTDATA(drv, p) + offset, buf, n);
2664 + buf += n;
2665 + len -= n;
2666 + ret += n;
2667 + offset = 0;
2668 + }
2669 +
2670 + return ret;
2671 +}
2672 +
2673 +/* return total length of buffer chain */
2674 +uint
2675 +pkttotlen(void *drv, void *p)
2676 +{
2677 + uint total;
2678 +
2679 + total = 0;
2680 + for (; p; p = PKTNEXT(drv, p))
2681 + total += PKTLEN(drv, p);
2682 + return (total);
2683 +}
2684 +
2685 +
2686 +uchar*
2687 +bcm_ether_ntoa(char *ea, char *buf)
2688 +{
2689 + sprintf(buf,"%02x:%02x:%02x:%02x:%02x:%02x",
2690 + (uchar)ea[0]&0xff, (uchar)ea[1]&0xff, (uchar)ea[2]&0xff,
2691 + (uchar)ea[3]&0xff, (uchar)ea[4]&0xff, (uchar)ea[5]&0xff);
2692 + return (buf);
2693 +}
2694 +
2695 +/* parse a xx:xx:xx:xx:xx:xx format ethernet address */
2696 +int
2697 +bcm_ether_atoe(char *p, char *ea)
2698 +{
2699 + int i = 0;
2700 +
2701 + for (;;) {
2702 + ea[i++] = (char) bcm_strtoul(p, &p, 16);
2703 + if (!*p++ || i == 6)
2704 + break;
2705 + }
2706 +
2707 + return (i == 6);
2708 +}
2709 +
2710 +/*
2711 + * Traverse a string of 1-byte tag/1-byte length/variable-length value
2712 + * triples, returning a pointer to the substring whose first element
2713 + * matches tag. Stop parsing when we see an element whose ID is greater
2714 + * than the target key.
2715 + */
2716 +bcm_tlv_t *
2717 +bcm_parse_ordered_tlvs(void *buf, int buflen, uint key)
2718 +{
2719 + bcm_tlv_t *elt;
2720 + int totlen;
2721 +
2722 + elt = (bcm_tlv_t*)buf;
2723 + totlen = buflen;
2724 +
2725 + /* find tagged parameter */
2726 + while (totlen >= 2) {
2727 + uint id = elt->id;
2728 + int len = elt->len;
2729 +
2730 + /* Punt if we start seeing IDs > than target key */
2731 + if (id > key)
2732 + return(NULL);
2733 +
2734 + /* validate remaining totlen */
2735 + if ((id == key) && (totlen >= (len + 2)))
2736 + return (elt);
2737 +
2738 + elt = (bcm_tlv_t*)((uint8*)elt + (len + 2));
2739 + totlen -= (len + 2);
2740 + }
2741 + return NULL;
2742 +}
2743 +
2744 +
2745 +/*
2746 + * Traverse a string of 1-byte tag/1-byte length/variable-length value
2747 + * triples, returning a pointer to the substring whose first element
2748 + * matches tag
2749 + */
2750 +bcm_tlv_t *
2751 +bcm_parse_tlvs(void *buf, int buflen, uint key)
2752 +{
2753 + bcm_tlv_t *elt;
2754 + int totlen;
2755 +
2756 + elt = (bcm_tlv_t*)buf;
2757 + totlen = buflen;
2758 +
2759 + /* find tagged parameter */
2760 + while (totlen >= 2) {
2761 + int len = elt->len;
2762 +
2763 + /* validate remaining totlen */
2764 + if ((elt->id == key) && (totlen >= (len + 2)))
2765 + return (elt);
2766 +
2767 + elt = (bcm_tlv_t*)((uint8*)elt + (len + 2));
2768 + totlen -= (len + 2);
2769 + }
2770 +
2771 + return NULL;
2772 +}
2773 +
2774 +void
2775 +pktqinit(struct pktq *q, int maxlen)
2776 +{
2777 + q->head = q->tail = NULL;
2778 + q->maxlen = maxlen;
2779 + q->len = 0;
2780 +}
2781 +
2782 +void
2783 +pktenq(struct pktq *q, void *p, bool lifo)
2784 +{
2785 + ASSERT(PKTLINK(p) == NULL);
2786 +
2787 + PKTSETLINK(p, NULL);
2788 +
2789 + if (q->tail == NULL) {
2790 + ASSERT(q->head == NULL);
2791 + q->head = q->tail = p;
2792 + }
2793 + else {
2794 + ASSERT(q->head);
2795 + ASSERT(PKTLINK(q->tail) == NULL);
2796 + if (lifo) {
2797 + PKTSETLINK(p, q->head);
2798 + q->head = p;
2799 + } else {
2800 + PKTSETLINK(q->tail, p);
2801 + q->tail = p;
2802 + }
2803 + }
2804 + q->len++;
2805 +}
2806 +
2807 +void*
2808 +pktdeq(struct pktq *q)
2809 +{
2810 + void *p;
2811 +
2812 + if ((p = q->head)) {
2813 + ASSERT(q->tail);
2814 + q->head = PKTLINK(p);
2815 + PKTSETLINK(p, NULL);
2816 + q->len--;
2817 + if (q->head == NULL)
2818 + q->tail = NULL;
2819 + }
2820 + else {
2821 + ASSERT(q->tail == NULL);
2822 + }
2823 +
2824 + return (p);
2825 +}
2826 +
2827 +/*******************************************************************************
2828 + * crc8
2829 + *
2830 + * Computes a crc8 over the input data using the polynomial:
2831 + *
2832 + * x^8 + x^7 +x^6 + x^4 + x^2 + 1
2833 + *
2834 + * The caller provides the initial value (either CRC8_INIT_VALUE
2835 + * or the previous returned value) to allow for processing of
2836 + * discontiguous blocks of data. When generating the CRC the
2837 + * caller is responsible for complementing the final return value
2838 + * and inserting it into the byte stream. When checking, a final
2839 + * return value of CRC8_GOOD_VALUE indicates a valid CRC.
2840 + *
2841 + * Reference: Dallas Semiconductor Application Note 27
2842 + * Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms",
2843 + * ver 3, Aug 1993, ross@guest.adelaide.edu.au, Rocksoft Pty Ltd.,
2844 + * ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
2845 + *
2846 + ******************************************************************************/
2847 +
2848 +static uint8 crc8_table[256] = {
2849 + 0x00, 0xF7, 0xB9, 0x4E, 0x25, 0xD2, 0x9C, 0x6B,
2850 + 0x4A, 0xBD, 0xF3, 0x04, 0x6F, 0x98, 0xD6, 0x21,
2851 + 0x94, 0x63, 0x2D, 0xDA, 0xB1, 0x46, 0x08, 0xFF,
2852 + 0xDE, 0x29, 0x67, 0x90, 0xFB, 0x0C, 0x42, 0xB5,
2853 + 0x7F, 0x88, 0xC6, 0x31, 0x5A, 0xAD, 0xE3, 0x14,
2854 + 0x35, 0xC2, 0x8C, 0x7B, 0x10, 0xE7, 0xA9, 0x5E,
2855 + 0xEB, 0x1C, 0x52, 0xA5, 0xCE, 0x39, 0x77, 0x80,
2856 + 0xA1, 0x56, 0x18, 0xEF, 0x84, 0x73, 0x3D, 0xCA,
2857 + 0xFE, 0x09, 0x47, 0xB0, 0xDB, 0x2C, 0x62, 0x95,
2858 + 0xB4, 0x43, 0x0D, 0xFA, 0x91, 0x66, 0x28, 0xDF,
2859 + 0x6A, 0x9D, 0xD3, 0x24, 0x4F, 0xB8, 0xF6, 0x01,
2860 + 0x20, 0xD7, 0x99, 0x6E, 0x05, 0xF2, 0xBC, 0x4B,
2861 + 0x81, 0x76, 0x38, 0xCF, 0xA4, 0x53, 0x1D, 0xEA,
2862 + 0xCB, 0x3C, 0x72, 0x85, 0xEE, 0x19, 0x57, 0xA0,
2863 + 0x15, 0xE2, 0xAC, 0x5B, 0x30, 0xC7, 0x89, 0x7E,
2864 + 0x5F, 0xA8, 0xE6, 0x11, 0x7A, 0x8D, 0xC3, 0x34,
2865 + 0xAB, 0x5C, 0x12, 0xE5, 0x8E, 0x79, 0x37, 0xC0,
2866 + 0xE1, 0x16, 0x58, 0xAF, 0xC4, 0x33, 0x7D, 0x8A,
2867 + 0x3F, 0xC8, 0x86, 0x71, 0x1A, 0xED, 0xA3, 0x54,
2868 + 0x75, 0x82, 0xCC, 0x3B, 0x50, 0xA7, 0xE9, 0x1E,
2869 + 0xD4, 0x23, 0x6D, 0x9A, 0xF1, 0x06, 0x48, 0xBF,
2870 + 0x9E, 0x69, 0x27, 0xD0, 0xBB, 0x4C, 0x02, 0xF5,
2871 + 0x40, 0xB7, 0xF9, 0x0E, 0x65, 0x92, 0xDC, 0x2B,
2872 + 0x0A, 0xFD, 0xB3, 0x44, 0x2F, 0xD8, 0x96, 0x61,
2873 + 0x55, 0xA2, 0xEC, 0x1B, 0x70, 0x87, 0xC9, 0x3E,
2874 + 0x1F, 0xE8, 0xA6, 0x51, 0x3A, 0xCD, 0x83, 0x74,
2875 + 0xC1, 0x36, 0x78, 0x8F, 0xE4, 0x13, 0x5D, 0xAA,
2876 + 0x8B, 0x7C, 0x32, 0xC5, 0xAE, 0x59, 0x17, 0xE0,
2877 + 0x2A, 0xDD, 0x93, 0x64, 0x0F, 0xF8, 0xB6, 0x41,
2878 + 0x60, 0x97, 0xD9, 0x2E, 0x45, 0xB2, 0xFC, 0x0B,
2879 + 0xBE, 0x49, 0x07, 0xF0, 0x9B, 0x6C, 0x22, 0xD5,
2880 + 0xF4, 0x03, 0x4D, 0xBA, 0xD1, 0x26, 0x68, 0x9F
2881 +};
2882 +
2883 +/*
2884 + * Search the name=value vars for a specific one and return its value.
2885 + * Returns NULL if not found.
2886 + */
2887 +char*
2888 +getvar(char *vars, char *name)
2889 +{
2890 + char *s;
2891 + int len;
2892 +
2893 + len = strlen(name);
2894 +
2895 + /* first look in vars[] */
2896 + for (s = vars; s && *s; ) {
2897 + if ((bcmp(s, name, len) == 0) && (s[len] == '='))
2898 + return (&s[len+1]);
2899 +
2900 + while (*s++)
2901 + ;
2902 + }
2903 +
2904 + /* then query nvram */
2905 + return (nvram_get(name));
2906 +}
2907 +
2908 +/*
2909 + * Search the vars for a specific one and return its value as
2910 + * an integer. Returns 0 if not found.
2911 + */
2912 +int
2913 +getintvar(char *vars, char *name)
2914 +{
2915 + char *val;
2916 +
2917 + if ((val = getvar(vars, name)) == NULL)
2918 + return (0);
2919 +
2920 + return (bcm_strtoul(val, NULL, 0));
2921 +}
2922 +
2923 +void
2924 +bcm_mdelay(uint ms)
2925 +{
2926 + uint i;
2927 +
2928 + for (i = 0; i < ms; i++) {
2929 + OSL_DELAY(1000);
2930 + }
2931 +}
2932 +
2933 +#define CRC_INNER_LOOP(n, c, x) \
2934 + (c) = ((c) >> 8) ^ crc##n##_table[((c) ^ (x)) & 0xff]
2935 +
2936 +uint8
2937 +crc8(
2938 + uint8 *pdata, /* pointer to array of data to process */
2939 + uint nbytes, /* number of input data bytes to process */
2940 + uint8 crc /* either CRC8_INIT_VALUE or previous return value */
2941 +)
2942 +{
2943 + /* hard code the crc loop instead of using CRC_INNER_LOOP macro
2944 + * to avoid the undefined and unnecessary (uint8 >> 8) operation. */
2945 + while (nbytes-- > 0)
2946 + crc = crc8_table[(crc ^ *pdata++) & 0xff];
2947 +
2948 + return crc;
2949 +}
2950 +
2951 +/*******************************************************************************
2952 + * crc16
2953 + *
2954 + * Computes a crc16 over the input data using the polynomial:
2955 + *
2956 + * x^16 + x^12 +x^5 + 1
2957 + *
2958 + * The caller provides the initial value (either CRC16_INIT_VALUE
2959 + * or the previous returned value) to allow for processing of
2960 + * discontiguous blocks of data. When generating the CRC the
2961 + * caller is responsible for complementing the final return value
2962 + * and inserting it into the byte stream. When checking, a final
2963 + * return value of CRC16_GOOD_VALUE indicates a valid CRC.
2964 + *
2965 + * Reference: Dallas Semiconductor Application Note 27
2966 + * Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms",
2967 + * ver 3, Aug 1993, ross@guest.adelaide.edu.au, Rocksoft Pty Ltd.,
2968 + * ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
2969 + *
2970 + ******************************************************************************/
2971 +
2972 +static uint16 crc16_table[256] = {
2973 + 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
2974 + 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7,
2975 + 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E,
2976 + 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876,
2977 + 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD,
2978 + 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5,
2979 + 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C,
2980 + 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974,
2981 + 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB,
2982 + 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3,
2983 + 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A,
2984 + 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72,
2985 + 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9,
2986 + 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1,
2987 + 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738,
2988 + 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70,
2989 + 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7,
2990 + 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF,
2991 + 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036,
2992 + 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E,
2993 + 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5,
2994 + 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD,
2995 + 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134,
2996 + 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C,
2997 + 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3,
2998 + 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB,
2999 + 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232,
3000 + 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A,
3001 + 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1,
3002 + 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9,
3003 + 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330,
3004 + 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78
3005 +};
3006 +
3007 +uint16
3008 +crc16(
3009 + uint8 *pdata, /* pointer to array of data to process */
3010 + uint nbytes, /* number of input data bytes to process */
3011 + uint16 crc /* either CRC16_INIT_VALUE or previous return value */
3012 +)
3013 +{
3014 + while (nbytes-- > 0)
3015 + CRC_INNER_LOOP(16, crc, *pdata++);
3016 + return crc;
3017 +}
3018 +
3019 +static uint32 crc32_table[256] = {
3020 + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
3021 + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
3022 + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
3023 + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
3024 + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
3025 + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
3026 + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
3027 + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
3028 + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
3029 + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
3030 + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
3031 + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
3032 + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
3033 + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
3034 + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
3035 + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
3036 + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
3037 + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
3038 + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
3039 + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
3040 + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
3041 + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
3042 + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
3043 + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
3044 + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
3045 + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
3046 + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
3047 + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
3048 + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
3049 + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
3050 + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
3051 + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
3052 + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
3053 + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
3054 + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
3055 + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
3056 + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
3057 + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
3058 + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
3059 + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
3060 + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
3061 + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
3062 + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
3063 + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
3064 + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
3065 + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
3066 + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
3067 + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
3068 + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
3069 + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
3070 + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
3071 + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
3072 + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
3073 + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
3074 + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
3075 + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
3076 + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
3077 + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
3078 + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
3079 + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
3080 + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
3081 + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
3082 + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
3083 + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
3084 +};
3085 +
3086 +uint32
3087 +crc32(
3088 + uint8 *pdata, /* pointer to array of data to process */
3089 + uint nbytes, /* number of input data bytes to process */
3090 + uint32 crc /* either CRC32_INIT_VALUE or previous return value */
3091 +)
3092 +{
3093 + uint8 *pend;
3094 +#ifdef __mips__
3095 + uint8 tmp[4];
3096 + ulong *tptr = (ulong *)tmp;
3097 +
3098 + /* in case the beginning of the buffer isn't aligned */
3099 + pend = (uint8 *)((uint)(pdata + 3) & 0xfffffffc);
3100 + nbytes -= (pend - pdata);
3101 + while (pdata < pend)
3102 + CRC_INNER_LOOP(32, crc, *pdata++);
3103 +
3104 + /* handle bulk of data as 32-bit words */
3105 + pend = pdata + (nbytes & 0xfffffffc);
3106 + while (pdata < pend) {
3107 + *tptr = *((ulong *)pdata)++;
3108 + CRC_INNER_LOOP(32, crc, tmp[0]);
3109 + CRC_INNER_LOOP(32, crc, tmp[1]);
3110 + CRC_INNER_LOOP(32, crc, tmp[2]);
3111 + CRC_INNER_LOOP(32, crc, tmp[3]);
3112 + }
3113 +
3114 + /* 1-3 bytes at end of buffer */
3115 + pend = pdata + (nbytes & 0x03);
3116 + while (pdata < pend)
3117 + CRC_INNER_LOOP(32, crc, *pdata++);
3118 +#else
3119 + pend = pdata + nbytes;
3120 + while (pdata < pend)
3121 + CRC_INNER_LOOP(32, crc, *pdata++);
3122 +#endif
3123 +
3124 + return crc;
3125 +}
3126 +
3127 +#ifdef notdef
3128 +#define CLEN 1499
3129 +#define CBUFSIZ (CLEN+4)
3130 +#define CNBUFS 5
3131 +
3132 +void testcrc32(void)
3133 +{
3134 + uint j,k,l;
3135 + uint8 *buf;
3136 + uint len[CNBUFS];
3137 + uint32 crcr;
3138 + uint32 crc32tv[CNBUFS] =
3139 + {0xd2cb1faa, 0xd385c8fa, 0xf5b4f3f3, 0x55789e20, 0x00343110};
3140 +
3141 + ASSERT((buf = MALLOC(CBUFSIZ*CNBUFS)) != NULL);
3142 +
3143 + /* step through all possible alignments */
3144 + for (l=0;l<=4;l++) {
3145 + for (j=0; j<CNBUFS; j++) {
3146 + len[j] = CLEN;
3147 + for (k=0; k<len[j]; k++)
3148 + *(buf + j*CBUFSIZ + (k+l)) = (j+k) & 0xff;
3149 + }
3150 +
3151 + for (j=0; j<CNBUFS; j++) {
3152 + crcr = crc32(buf + j*CBUFSIZ + l, len[j], CRC32_INIT_VALUE);
3153 + ASSERT(crcr == crc32tv[j]);
3154 + }
3155 + }
3156 +
3157 + MFREE(buf, CBUFSIZ*CNBUFS);
3158 + return;
3159 +}
3160 +#endif
3161 +
3162 +
3163 +
3164 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/hnddma.c linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/hnddma.c
3165 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/hnddma.c 1970-01-01 01:00:00.000000000 +0100
3166 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/hnddma.c 2005-08-28 11:12:20.430859152 +0200
3167 @@ -0,0 +1,763 @@
3168 +/*
3169 + * Generic Broadcom Home Networking Division (HND) DMA module.
3170 + * This supports the following chips: BCM42xx, 44xx, 47xx .
3171 + *
3172 + * Copyright 2001-2003, Broadcom Corporation
3173 + * All Rights Reserved.
3174 + *
3175 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
3176 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
3177 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
3178 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
3179 + *
3180 + * $Id$
3181 + */
3182 +
3183 +#include <typedefs.h>
3184 +#include <osl.h>
3185 +#include <bcmendian.h>
3186 +#include <bcmutils.h>
3187 +
3188 +struct dma_info; /* forward declaration */
3189 +#define di_t struct dma_info
3190 +#include <hnddma.h>
3191 +
3192 +/* debug/trace */
3193 +#define DMA_ERROR(args)
3194 +#define DMA_TRACE(args)
3195 +
3196 +/* default dma message level(if input msg_level pointer is null in dma_attach()) */
3197 +static uint dma_msg_level = 0;
3198 +
3199 +#define MAXNAMEL 8
3200 +#define MAXDD (DMAMAXRINGSZ / sizeof (dmadd_t))
3201 +
3202 +/* dma engine software state */
3203 +typedef struct dma_info {
3204 + hnddma_t hnddma; /* exported structure */
3205 + uint *msg_level; /* message level pointer */
3206 +
3207 + char name[MAXNAMEL]; /* callers name for diag msgs */
3208 + void *drv; /* driver handle */
3209 + void *dev; /* device handle */
3210 + dmaregs_t *regs; /* dma engine registers */
3211 +
3212 + dmadd_t *txd; /* pointer to chip-specific tx descriptor ring */
3213 + uint txin; /* index of next descriptor to reclaim */
3214 + uint txout; /* index of next descriptor to post */
3215 + uint txavail; /* # free tx descriptors */
3216 + void *txp[MAXDD]; /* parallel array of pointers to packets */
3217 + ulong txdpa; /* physical address of descriptor ring */
3218 + uint txdalign; /* #bytes added to alloc'd mem to align txd */
3219 +
3220 + dmadd_t *rxd; /* pointer to chip-specific rx descriptor ring */
3221 + uint rxin; /* index of next descriptor to reclaim */
3222 + uint rxout; /* index of next descriptor to post */
3223 + void *rxp[MAXDD]; /* parallel array of pointers to packets */
3224 + ulong rxdpa; /* physical address of descriptor ring */
3225 + uint rxdalign; /* #bytes added to alloc'd mem to align rxd */
3226 +
3227 + /* tunables */
3228 + uint ntxd; /* # tx descriptors */
3229 + uint nrxd; /* # rx descriptors */
3230 + uint rxbufsize; /* rx buffer size in bytes */
3231 + uint nrxpost; /* # rx buffers to keep posted */
3232 + uint rxoffset; /* rxcontrol offset */
3233 + uint ddoffset; /* add to get dma address of descriptor ring */
3234 + uint dataoffset; /* add to get dma address of data buffer */
3235 +} dma_info_t;
3236 +
3237 +/* descriptor bumping macros */
3238 +#define NEXTTXD(i) ((i + 1) & (di->ntxd - 1))
3239 +#define PREVTXD(i) ((i - 1) & (di->ntxd - 1))
3240 +#define NEXTRXD(i) ((i + 1) & (di->nrxd - 1))
3241 +#define NTXDACTIVE(h, t) ((t - h) & (di->ntxd - 1))
3242 +#define NRXDACTIVE(h, t) ((t - h) & (di->nrxd - 1))
3243 +
3244 +/* macros to convert between byte offsets and indexes */
3245 +#define B2I(bytes) ((bytes) / sizeof (dmadd_t))
3246 +#define I2B(index) ((index) * sizeof (dmadd_t))
3247 +
3248 +void*
3249 +dma_attach(void *drv, void *dev, char *name, dmaregs_t *regs, uint ntxd, uint nrxd,
3250 + uint rxbufsize, uint nrxpost, uint rxoffset, uint ddoffset, uint dataoffset, uint *msg_level)
3251 +{
3252 + dma_info_t *di;
3253 + void *va;
3254 +
3255 + ASSERT(ntxd <= MAXDD);
3256 + ASSERT(nrxd <= MAXDD);
3257 +
3258 + /* allocate private info structure */
3259 + if ((di = MALLOC(sizeof (dma_info_t))) == NULL)
3260 + return (NULL);
3261 + bzero((char*)di, sizeof (dma_info_t));
3262 +
3263 + /* set message level */
3264 + di->msg_level = msg_level ? msg_level : &dma_msg_level;
3265 +
3266 + 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));
3267 +
3268 + /* make a private copy of our callers name */
3269 + strncpy(di->name, name, MAXNAMEL);
3270 + di->name[MAXNAMEL-1] = '\0';
3271 +
3272 + di->drv = drv;
3273 + di->dev = dev;
3274 + di->regs = regs;
3275 +
3276 + /* allocate transmit descriptor ring */
3277 + if (ntxd) {
3278 + if ((va = DMA_ALLOC_CONSISTENT(dev, (DMAMAXRINGSZ + DMARINGALIGN), &di->txdpa)) == NULL)
3279 + goto fail;
3280 + di->txd = (dmadd_t*) ROUNDUP(va, DMARINGALIGN);
3281 + di->txdalign = ((uint)di->txd - (uint)va);
3282 + di->txdpa = di->txdpa + di->txdalign;
3283 + ASSERT(ISALIGNED(di->txd, DMARINGALIGN));
3284 + }
3285 +
3286 + /* allocate receive descriptor ring */
3287 + if (nrxd) {
3288 + if ((va = DMA_ALLOC_CONSISTENT(dev, (DMAMAXRINGSZ + DMARINGALIGN), &di->rxdpa)) == NULL)
3289 + goto fail;
3290 + di->rxd = (dmadd_t*) ROUNDUP(va, DMARINGALIGN);
3291 + di->rxdalign = ((uint)di->rxd - (uint)va);
3292 + di->rxdpa = di->rxdpa + di->rxdalign;
3293 + ASSERT(ISALIGNED(di->rxd, DMARINGALIGN));
3294 + }
3295 +
3296 + /* save tunables */
3297 + di->ntxd = ntxd;
3298 + di->nrxd = nrxd;
3299 + di->rxbufsize = rxbufsize;
3300 + di->nrxpost = nrxpost;
3301 + di->rxoffset = rxoffset;
3302 + di->ddoffset = ddoffset;
3303 + di->dataoffset = dataoffset;
3304 +
3305 + return ((void*)di);
3306 +
3307 +fail:
3308 + dma_detach((void*)di);
3309 + return (NULL);
3310 +}
3311 +
3312 +/* may be called with core in reset */
3313 +void
3314 +dma_detach(dma_info_t *di)
3315 +{
3316 + if (di == NULL)
3317 + return;
3318 +
3319 + DMA_TRACE(("%s: dma_detach\n", di->name));
3320 +
3321 + /* shouldn't be here if descriptors are unreclaimed */
3322 + ASSERT(di->txin == di->txout);
3323 + ASSERT(di->rxin == di->rxout);
3324 +
3325 + /* free dma descriptor rings */
3326 + if (di->txd)
3327 + DMA_FREE_CONSISTENT(di->dev, (void *)((uint)di->txd - di->txdalign), (DMAMAXRINGSZ + DMARINGALIGN), di->txdpa);
3328 + if (di->rxd)
3329 + DMA_FREE_CONSISTENT(di->dev, (void *)((uint)di->rxd - di->rxdalign), (DMAMAXRINGSZ + DMARINGALIGN), di->rxdpa);
3330 +
3331 + /* free our private info structure */
3332 + MFREE((void*)di, sizeof (dma_info_t));
3333 +}
3334 +
3335 +
3336 +void
3337 +dma_txreset(dma_info_t *di)
3338 +{
3339 + uint32 status;
3340 +
3341 + DMA_TRACE(("%s: dma_txreset\n", di->name));
3342 +
3343 + /* suspend tx DMA first */
3344 + W_REG(&di->regs->xmtcontrol, XC_SE);
3345 + SPINWAIT((status = (R_REG(&di->regs->xmtstatus) & XS_XS_MASK)) != XS_XS_DISABLED &&
3346 + status != XS_XS_IDLE &&
3347 + status != XS_XS_STOPPED,
3348 + 10000);
3349 +
3350 + W_REG(&di->regs->xmtcontrol, 0);
3351 + SPINWAIT((status = (R_REG(&di->regs->xmtstatus) & XS_XS_MASK)) != XS_XS_DISABLED,
3352 + 10000);
3353 +
3354 + if (status != XS_XS_DISABLED) {
3355 + DMA_ERROR(("%s: dma_txreset: dma cannot be stopped\n", di->name));
3356 + }
3357 +
3358 + /* wait for the last transaction to complete */
3359 + OSL_DELAY(300);
3360 +}
3361 +
3362 +void
3363 +dma_rxreset(dma_info_t *di)
3364 +{
3365 + uint32 status;
3366 +
3367 + DMA_TRACE(("%s: dma_rxreset\n", di->name));
3368 +
3369 + W_REG(&di->regs->rcvcontrol, 0);
3370 + SPINWAIT((status = (R_REG(&di->regs->rcvstatus) & RS_RS_MASK)) != RS_RS_DISABLED,
3371 + 10000);
3372 +
3373 + if (status != RS_RS_DISABLED) {
3374 + DMA_ERROR(("%s: dma_rxreset: dma cannot be stopped\n", di->name));
3375 + }
3376 +}
3377 +
3378 +void
3379 +dma_txinit(dma_info_t *di)
3380 +{
3381 + DMA_TRACE(("%s: dma_txinit\n", di->name));
3382 +
3383 + di->txin = di->txout = 0;
3384 + di->txavail = di->ntxd - 1;
3385 +
3386 + /* clear tx descriptor ring */
3387 + BZERO_SM((void*)di->txd, (di->ntxd * sizeof (dmadd_t)));
3388 +
3389 + W_REG(&di->regs->xmtcontrol, XC_XE);
3390 + W_REG(&di->regs->xmtaddr, (di->txdpa + di->ddoffset));
3391 +}
3392 +
3393 +bool
3394 +dma_txenabled(dma_info_t *di)
3395 +{
3396 + uint32 xc;
3397 +
3398 + /* If the chip is dead, it is not enabled :-) */
3399 + xc = R_REG(&di->regs->xmtcontrol);
3400 + return ((xc != 0xffffffff) && (xc & XC_XE));
3401 +}
3402 +
3403 +void
3404 +dma_txsuspend(dma_info_t *di)
3405 +{
3406 + DMA_TRACE(("%s: dma_txsuspend\n", di->name));
3407 + OR_REG(&di->regs->xmtcontrol, XC_SE);
3408 +}
3409 +
3410 +void
3411 +dma_txresume(dma_info_t *di)
3412 +{
3413 + DMA_TRACE(("%s: dma_txresume\n", di->name));
3414 + AND_REG(&di->regs->xmtcontrol, ~XC_SE);
3415 +}
3416 +
3417 +bool
3418 +dma_txsuspended(dma_info_t *di)
3419 +{
3420 + uint32 xc;
3421 + uint32 xs;
3422 +
3423 + xc = R_REG(&di->regs->xmtcontrol);
3424 + if (xc & XC_SE) {
3425 + xs = R_REG(&di->regs->xmtstatus);
3426 + return ((xs & XS_XS_MASK) == XS_XS_IDLE);
3427 + }
3428 + return 0;
3429 +}
3430 +
3431 +bool
3432 +dma_txstopped(dma_info_t *di)
3433 +{
3434 + return ((R_REG(&di->regs->xmtstatus) & XS_XS_MASK) == XS_XS_STOPPED);
3435 +}
3436 +
3437 +bool
3438 +dma_rxstopped(dma_info_t *di)
3439 +{
3440 + return ((R_REG(&di->regs->rcvstatus) & RS_RS_MASK) == RS_RS_STOPPED);
3441 +}
3442 +
3443 +void
3444 +dma_fifoloopbackenable(dma_info_t *di)
3445 +{
3446 + DMA_TRACE(("%s: dma_fifoloopbackenable\n", di->name));
3447 + OR_REG(&di->regs->xmtcontrol, XC_LE);
3448 +}
3449 +
3450 +void
3451 +dma_rxinit(dma_info_t *di)
3452 +{
3453 + DMA_TRACE(("%s: dma_rxinit\n", di->name));
3454 +
3455 + di->rxin = di->rxout = 0;
3456 +
3457 + /* clear rx descriptor ring */
3458 + BZERO_SM((void*)di->rxd, (di->nrxd * sizeof (dmadd_t)));
3459 +
3460 + dma_rxenable(di);
3461 + W_REG(&di->regs->rcvaddr, (di->rxdpa + di->ddoffset));
3462 +}
3463 +
3464 +void
3465 +dma_rxenable(dma_info_t *di)
3466 +{
3467 + DMA_TRACE(("%s: dma_rxenable\n", di->name));
3468 + W_REG(&di->regs->rcvcontrol, ((di->rxoffset << RC_RO_SHIFT) | RC_RE));
3469 +}
3470 +
3471 +bool
3472 +dma_rxenabled(dma_info_t *di)
3473 +{
3474 + uint32 rc;
3475 +
3476 + rc = R_REG(&di->regs->rcvcontrol);
3477 + return ((rc != 0xffffffff) && (rc & RC_RE));
3478 +}
3479 +
3480 +/*
3481 + * The BCM47XX family supports full 32bit dma engine buffer addressing so
3482 + * dma buffers can cross 4 Kbyte page boundaries.
3483 + */
3484 +int
3485 +dma_txfast(dma_info_t *di, void *p0, uint32 coreflags)
3486 +{
3487 + void *p, *next;
3488 + uchar *data;
3489 + uint len;
3490 + uint txout;
3491 + uint32 ctrl;
3492 + uint32 pa;
3493 +
3494 + DMA_TRACE(("%s: dma_txfast\n", di->name));
3495 +
3496 + txout = di->txout;
3497 + ctrl = 0;
3498 +
3499 + /*
3500 + * Walk the chain of packet buffers
3501 + * allocating and initializing transmit descriptor entries.
3502 + */
3503 + for (p = p0; p; p = next) {
3504 + data = PKTDATA(di->drv, p);
3505 + len = PKTLEN(di->drv, p);
3506 + next = PKTNEXT(di->drv, p);
3507 +
3508 + /* return nonzero if out of tx descriptors */
3509 + if (NEXTTXD(txout) == di->txin)
3510 + goto outoftxd;
3511 +
3512 + if (len == 0)
3513 + continue;
3514 +
3515 + /* get physical address of buffer start */
3516 + pa = (uint32) DMA_MAP(di->dev, data, len, DMA_TX, p);
3517 +
3518 + /* build the descriptor control value */
3519 + ctrl = len & CTRL_BC_MASK;
3520 +
3521 + ctrl |= coreflags;
3522 +
3523 + if (p == p0)
3524 + ctrl |= CTRL_SOF;
3525 + if (next == NULL)
3526 + ctrl |= (CTRL_IOC | CTRL_EOF);
3527 + if (txout == (di->ntxd - 1))
3528 + ctrl |= CTRL_EOT;
3529 +
3530 + /* init the tx descriptor */
3531 + W_SM(&di->txd[txout].ctrl, BUS_SWAP32(ctrl));
3532 + W_SM(&di->txd[txout].addr, BUS_SWAP32(pa + di->dataoffset));
3533 +
3534 + ASSERT(di->txp[txout] == NULL);
3535 +
3536 + txout = NEXTTXD(txout);
3537 + }
3538 +
3539 + /* if last txd eof not set, fix it */
3540 + if (!(ctrl & CTRL_EOF))
3541 + W_SM(&di->txd[PREVTXD(txout)].ctrl, BUS_SWAP32(ctrl | CTRL_IOC | CTRL_EOF));
3542 +
3543 + /* save the packet */
3544 + di->txp[PREVTXD(txout)] = p0;
3545 +
3546 + /* bump the tx descriptor index */
3547 + di->txout = txout;
3548 +
3549 + /* kick the chip */
3550 + W_REG(&di->regs->xmtptr, I2B(txout));
3551 +
3552 + /* tx flow control */
3553 + di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
3554 +
3555 + return (0);
3556 +
3557 +outoftxd:
3558 + DMA_ERROR(("%s: dma_txfast: out of txds\n", di->name));
3559 + PKTFREE(di->drv, p0, TRUE);
3560 + di->txavail = 0;
3561 + di->hnddma.txnobuf++;
3562 + return (-1);
3563 +}
3564 +
3565 +#define PAGESZ 4096
3566 +#define PAGEBASE(x) ((uint)(x) & ~4095)
3567 +
3568 +/*
3569 + * Just like above except go through the extra effort of splitting
3570 + * buffers that cross 4Kbyte boundaries into multiple tx descriptors.
3571 + */
3572 +int
3573 +dma_tx(dma_info_t *di, void *p0, uint32 coreflags)
3574 +{
3575 + void *p, *next;
3576 + uchar *data;
3577 + uint plen, len;
3578 + uchar *page, *start, *end;
3579 + uint txout;
3580 + uint32 ctrl;
3581 + uint32 pa;
3582 +
3583 + DMA_TRACE(("%s: dma_tx\n", di->name));
3584 +
3585 + txout = di->txout;
3586 + ctrl = 0;
3587 +
3588 + /*
3589 + * Walk the chain of packet buffers
3590 + * splitting those that cross 4 Kbyte boundaries
3591 + * allocating and initializing transmit descriptor entries.
3592 + */
3593 + for (p = p0; p; p = next) {
3594 + data = PKTDATA(di->drv, p);
3595 + plen = PKTLEN(di->drv, p);
3596 + next = PKTNEXT(di->drv, p);
3597 +
3598 + if (plen == 0)
3599 + continue;
3600 +
3601 + for (page = (uchar*)PAGEBASE(data);
3602 + page <= (uchar*)PAGEBASE(data + plen - 1);
3603 + page += PAGESZ) {
3604 +
3605 + /* return nonzero if out of tx descriptors */
3606 + if (NEXTTXD(txout) == di->txin)
3607 + goto outoftxd;
3608 +
3609 + start = (page == (uchar*)PAGEBASE(data))? data: page;
3610 + end = (page == (uchar*)PAGEBASE(data + plen))?
3611 + (data + plen): (page + PAGESZ);
3612 + len = end - start;
3613 +
3614 + /* build the descriptor control value */
3615 + ctrl = len & CTRL_BC_MASK;
3616 +
3617 + ctrl |= coreflags;
3618 +
3619 + if ((p == p0) && (start == data))
3620 + ctrl |= CTRL_SOF;
3621 + if ((next == NULL) && (end == (data + plen)))
3622 + ctrl |= (CTRL_IOC | CTRL_EOF);
3623 + if (txout == (di->ntxd - 1))
3624 + ctrl |= CTRL_EOT;
3625 +
3626 + /* get physical address of buffer start */
3627 + pa = (uint32) DMA_MAP(di->dev, start, len, DMA_TX, p);
3628 +
3629 + /* init the tx descriptor */
3630 + W_SM(&di->txd[txout].ctrl, BUS_SWAP32(ctrl));
3631 + W_SM(&di->txd[txout].addr, BUS_SWAP32(pa + di->dataoffset));
3632 +
3633 + ASSERT(di->txp[txout] == NULL);
3634 +
3635 + txout = NEXTTXD(txout);
3636 + }
3637 + }
3638 +
3639 + /* if last txd eof not set, fix it */
3640 + if (!(ctrl & CTRL_EOF))
3641 + W_SM(&di->txd[PREVTXD(txout)].ctrl, BUS_SWAP32(ctrl | CTRL_IOC | CTRL_EOF));
3642 +
3643 + /* save the packet */
3644 + di->txp[PREVTXD(txout)] = p0;
3645 +
3646 + /* bump the tx descriptor index */
3647 + di->txout = txout;
3648 +
3649 + /* kick the chip */
3650 + W_REG(&di->regs->xmtptr, I2B(txout));
3651 +
3652 + /* tx flow control */
3653 + di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
3654 +
3655 + return (0);
3656 +
3657 +outoftxd:
3658 + DMA_ERROR(("%s: dma_tx: out of txds\n", di->name));
3659 + PKTFREE(di->drv, p0, TRUE);
3660 + di->txavail = 0;
3661 + di->hnddma.txnobuf++;
3662 + return (-1);
3663 +}
3664 +
3665 +/* returns a pointer to the next frame received, or NULL if there are no more */
3666 +void*
3667 +dma_rx(dma_info_t *di)
3668 +{
3669 + void *p;
3670 + uint len;
3671 + int skiplen = 0;
3672 +
3673 + while ((p = dma_getnextrxp(di, FALSE))) {
3674 + /* skip giant packets which span multiple rx descriptors */
3675 + if (skiplen > 0) {
3676 + skiplen -= di->rxbufsize;
3677 + if (skiplen < 0)
3678 + skiplen = 0;
3679 + PKTFREE(di->drv, p, FALSE);
3680 + continue;
3681 + }
3682 +
3683 + len = ltoh16(*(uint16*)(PKTDATA(di->drv, p)));
3684 + DMA_TRACE(("%s: dma_rx len %d\n", di->name, len));
3685 +
3686 + /* bad frame length check */
3687 + if (len > (di->rxbufsize - di->rxoffset)) {
3688 + DMA_ERROR(("%s: dma_rx: bad frame length (%d)\n", di->name, len));
3689 + if (len > 0)
3690 + skiplen = len - (di->rxbufsize - di->rxoffset);
3691 + PKTFREE(di->drv, p, FALSE);
3692 + di->hnddma.rxgiants++;
3693 + continue;
3694 + }
3695 +
3696 + /* set actual length */
3697 + PKTSETLEN(di->drv, p, (di->rxoffset + len));
3698 +
3699 + break;
3700 + }
3701 +
3702 + return (p);
3703 +}
3704 +
3705 +/* post receive buffers */
3706 +void
3707 +dma_rxfill(dma_info_t *di)
3708 +{
3709 + void *p;
3710 + uint rxin, rxout;
3711 + uint ctrl;
3712 + uint n;
3713 + uint i;
3714 + uint32 pa;
3715 + uint rxbufsize;
3716 +
3717 + /*
3718 + * Determine how many receive buffers we're lacking
3719 + * from the full complement, allocate, initialize,
3720 + * and post them, then update the chip rx lastdscr.
3721 + */
3722 +
3723 + rxin = di->rxin;
3724 + rxout = di->rxout;
3725 + rxbufsize = di->rxbufsize;
3726 +
3727 + n = di->nrxpost - NRXDACTIVE(rxin, rxout);
3728 +
3729 + DMA_TRACE(("%s: dma_rxfill: post %d\n", di->name, n));
3730 +
3731 + for (i = 0; i < n; i++) {
3732 + if ((p = PKTGET(di->drv, rxbufsize, FALSE)) == NULL) {
3733 + DMA_ERROR(("%s: dma_rxfill: out of rxbufs\n", di->name));
3734 + di->hnddma.rxnobuf++;
3735 + break;
3736 + }
3737 +
3738 + *(uint32*)(OSL_UNCACHED(PKTDATA(di->drv, p))) = 0;
3739 +
3740 + pa = (uint32) DMA_MAP(di->dev, PKTDATA(di->drv, p), rxbufsize, DMA_RX, p);
3741 + ASSERT(ISALIGNED(pa, 4));
3742 +
3743 + /* save the free packet pointer */
3744 + ASSERT(di->rxp[rxout] == NULL);
3745 + di->rxp[rxout] = p;
3746 +
3747 + /* prep the descriptor control value */
3748 + ctrl = rxbufsize;
3749 + if (rxout == (di->nrxd - 1))
3750 + ctrl |= CTRL_EOT;
3751 +
3752 + /* init the rx descriptor */
3753 + W_SM(&di->rxd[rxout].ctrl, BUS_SWAP32(ctrl));
3754 + W_SM(&di->rxd[rxout].addr, BUS_SWAP32(pa + di->dataoffset));
3755 +
3756 + rxout = NEXTRXD(rxout);
3757 + }
3758 +
3759 + di->rxout = rxout;
3760 +
3761 + /* update the chip lastdscr pointer */
3762 + W_REG(&di->regs->rcvptr, I2B(rxout));
3763 +}
3764 +
3765 +void
3766 +dma_txreclaim(dma_info_t *di, bool forceall)
3767 +{
3768 + void *p;
3769 +
3770 + DMA_TRACE(("%s: dma_txreclaim %s\n", di->name, forceall ? "all" : ""));
3771 +
3772 + while ((p = dma_getnexttxp(di, forceall)))
3773 + PKTFREE(di->drv, p, TRUE);
3774 +}
3775 +
3776 +/*
3777 + * Reclaim next completed txd (txds if using chained buffers) and
3778 + * return associated packet.
3779 + * If 'force' is true, reclaim txd(s) and return associated packet
3780 + * regardless of the value of the hardware "curr" pointer.
3781 + */
3782 +void*
3783 +dma_getnexttxp(dma_info_t *di, bool forceall)
3784 +{
3785 + uint start, end, i;
3786 + void *txp;
3787 +
3788 + DMA_TRACE(("%s: dma_getnexttxp %s\n", di->name, forceall ? "all" : ""));
3789 +
3790 + txp = NULL;
3791 +
3792 + start = di->txin;
3793 + if (forceall)
3794 + end = di->txout;
3795 + else
3796 + end = B2I(R_REG(&di->regs->xmtstatus) & XS_CD_MASK);
3797 +
3798 + if ((start == 0) && (end > di->txout))
3799 + goto bogus;
3800 +
3801 + for (i = start; i != end && !txp; i = NEXTTXD(i)) {
3802 + DMA_UNMAP(di->dev, (BUS_SWAP32(R_SM(&di->txd[i].addr)) - di->dataoffset),
3803 + (BUS_SWAP32(R_SM(&di->txd[i].ctrl)) & CTRL_BC_MASK), DMA_TX, di->txp[i]);
3804 + W_SM(&di->txd[i].addr, 0xdeadbeef);
3805 + txp = di->txp[i];
3806 + di->txp[i] = NULL;
3807 + }
3808 +
3809 + di->txin = i;
3810 +
3811 + /* tx flow control */
3812 + di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
3813 +
3814 + return (txp);
3815 +
3816 +bogus:
3817 +/*
3818 + DMA_ERROR(("dma_getnexttxp: bogus curr: start %d end %d txout %d force %d\n",
3819 + start, end, di->txout, forceall));
3820 +*/
3821 + return (NULL);
3822 +}
3823 +
3824 +void
3825 +dma_rxreclaim(dma_info_t *di)
3826 +{
3827 + void *p;
3828 +
3829 + DMA_TRACE(("%s: dma_rxreclaim\n", di->name));
3830 +
3831 + while ((p = dma_getnextrxp(di, TRUE)))
3832 + PKTFREE(di->drv, p, FALSE);
3833 +}
3834 +
3835 +void *
3836 +dma_getnextrxp(dma_info_t *di, bool forceall)
3837 +{
3838 + uint i;
3839 + void *rxp;
3840 +
3841 + /* if forcing, dma engine must be disabled */
3842 + ASSERT(!forceall || !dma_rxenabled(di));
3843 +
3844 + i = di->rxin;
3845 +
3846 + /* return if no packets posted */
3847 + if (i == di->rxout)
3848 + return (NULL);
3849 +
3850 + /* ignore curr if forceall */
3851 + if (!forceall && (i == B2I(R_REG(&di->regs->rcvstatus) & RS_CD_MASK)))
3852 + return (NULL);
3853 +
3854 + /* get the packet pointer that corresponds to the rx descriptor */
3855 + rxp = di->rxp[i];
3856 + ASSERT(rxp);
3857 + di->rxp[i] = NULL;
3858 +
3859 + /* clear this packet from the descriptor ring */
3860 + DMA_UNMAP(di->dev, (BUS_SWAP32(R_SM(&di->rxd[i].addr)) - di->dataoffset),
3861 + di->rxbufsize, DMA_RX, rxp);
3862 + W_SM(&di->rxd[i].addr, 0xdeadbeef);
3863 +
3864 + di->rxin = NEXTRXD(i);
3865 +
3866 + return (rxp);
3867 +}
3868 +
3869 +char*
3870 +dma_dumptx(dma_info_t *di, char *buf)
3871 +{
3872 + buf += sprintf(buf, "txd 0x%lx txdpa 0x%lx txp 0x%lx txin %d txout %d txavail %d\n",
3873 + (ulong)di->txd, di->txdpa, (ulong)di->txp, di->txin, di->txout, di->txavail);
3874 + buf += sprintf(buf, "xmtcontrol 0x%x xmtaddr 0x%x xmtptr 0x%x xmtstatus 0x%x\n",
3875 + R_REG(&di->regs->xmtcontrol),
3876 + R_REG(&di->regs->xmtaddr),
3877 + R_REG(&di->regs->xmtptr),
3878 + R_REG(&di->regs->xmtstatus));
3879 + return (buf);
3880 +}
3881 +
3882 +char*
3883 +dma_dumprx(dma_info_t *di, char *buf)
3884 +{
3885 + buf += sprintf(buf, "rxd 0x%lx rxdpa 0x%lx rxp 0x%lx rxin %d rxout %d\n",
3886 + (ulong)di->rxd, di->rxdpa, (ulong)di->rxp, di->rxin, di->rxout);
3887 + buf += sprintf(buf, "rcvcontrol 0x%x rcvaddr 0x%x rcvptr 0x%x rcvstatus 0x%x\n",
3888 + R_REG(&di->regs->rcvcontrol),
3889 + R_REG(&di->regs->rcvaddr),
3890 + R_REG(&di->regs->rcvptr),
3891 + R_REG(&di->regs->rcvstatus));
3892 + return (buf);
3893 +}
3894 +
3895 +char*
3896 +dma_dump(dma_info_t *di, char *buf)
3897 +{
3898 + buf = dma_dumptx(di, buf);
3899 + buf = dma_dumprx(di, buf);
3900 + return (buf);
3901 +}
3902 +
3903 +uint
3904 +dma_getvar(dma_info_t *di, char *name)
3905 +{
3906 + if (!strcmp(name, "&txavail"))
3907 + return ((uint) &di->txavail);
3908 + else {
3909 + ASSERT(0);
3910 + }
3911 + return (0);
3912 +}
3913 +
3914 +void
3915 +dma_txblock(dma_info_t *di)
3916 +{
3917 + di->txavail = 0;
3918 +}
3919 +
3920 +void
3921 +dma_txunblock(dma_info_t *di)
3922 +{
3923 + di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
3924 +}
3925 +
3926 +uint
3927 +dma_txactive(dma_info_t *di)
3928 +{
3929 + return (NTXDACTIVE(di->txin, di->txout));
3930 +}
3931 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcm4710.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcm4710.h
3932 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcm4710.h 1970-01-01 01:00:00.000000000 +0100
3933 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcm4710.h 2005-08-28 11:12:20.430859152 +0200
3934 @@ -0,0 +1,90 @@
3935 +/*
3936 + * BCM4710 address space map and definitions
3937 + * Think twice before adding to this file, this is not the kitchen sink
3938 + * These definitions are not guaranteed for all 47xx chips, only the 4710
3939 + *
3940 + * Copyright 2001-2003, Broadcom Corporation
3941 + * All Rights Reserved.
3942 + *
3943 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
3944 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
3945 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
3946 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
3947 + * $Id$
3948 + */
3949 +
3950 +#ifndef _bcm4710_h_
3951 +#define _bcm4710_h_
3952 +
3953 +/* Address map */
3954 +#define BCM4710_SDRAM 0x00000000 /* Physical SDRAM */
3955 +#define BCM4710_PCI_MEM 0x08000000 /* Host Mode PCI memory access space (64 MB) */
3956 +#define BCM4710_PCI_CFG 0x0c000000 /* Host Mode PCI configuration space (64 MB) */
3957 +#define BCM4710_PCI_DMA 0x40000000 /* Client Mode PCI memory access space (1 GB) */
3958 +#define BCM4710_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */
3959 +#define BCM4710_ENUM 0x18000000 /* Beginning of core enumeration space */
3960 +
3961 +/* Core register space */
3962 +#define BCM4710_REG_SDRAM 0x18000000 /* SDRAM core registers */
3963 +#define BCM4710_REG_ILINE20 0x18001000 /* InsideLine20 core registers */
3964 +#define BCM4710_REG_EMAC0 0x18002000 /* Ethernet MAC 0 core registers */
3965 +#define BCM4710_REG_CODEC 0x18003000 /* Codec core registers */
3966 +#define BCM4710_REG_USB 0x18004000 /* USB core registers */
3967 +#define BCM4710_REG_PCI 0x18005000 /* PCI core registers */
3968 +#define BCM4710_REG_MIPS 0x18006000 /* MIPS core registers */
3969 +#define BCM4710_REG_EXTIF 0x18007000 /* External Interface core registers */
3970 +#define BCM4710_REG_EMAC1 0x18008000 /* Ethernet MAC 1 core registers */
3971 +
3972 +#define BCM4710_EXTIF 0x1f000000 /* External Interface base address */
3973 +#define BCM4710_PCMCIA_MEM 0x1f000000 /* External Interface PCMCIA memory access */
3974 +#define BCM4710_PCMCIA_IO 0x1f100000 /* PCMCIA I/O access */
3975 +#define BCM4710_PCMCIA_CONF 0x1f200000 /* PCMCIA configuration */
3976 +#define BCM4710_PROG 0x1f800000 /* Programable interface */
3977 +#define BCM4710_FLASH 0x1fc00000 /* Flash */
3978 +
3979 +#define BCM4710_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */
3980 +
3981 +#define BCM4710_UART (BCM4710_REG_EXTIF + 0x00000300)
3982 +
3983 +#define BCM4710_EUART (BCM4710_EXTIF + 0x00800000)
3984 +#define BCM4710_LED (BCM4710_EXTIF + 0x00900000)
3985 +
3986 +#define SBFLAG_PCI 0
3987 +#define SBFLAG_ENET0 1
3988 +#define SBFLAG_ILINE20 2
3989 +#define SBFLAG_CODEC 3
3990 +#define SBFLAG_USB 4
3991 +#define SBFLAG_EXTIF 5
3992 +#define SBFLAG_ENET1 6
3993 +
3994 +#ifdef CONFIG_HWSIM
3995 +#define BCM4710_TRACE(trval) do { *((int *)0xa0000f18) = (trval); } while (0)
3996 +#else
3997 +#define BCM4710_TRACE(trval)
3998 +#endif
3999 +
4000 +
4001 +/* BCM94702 CPCI -ExtIF used for LocalBus devs */
4002 +
4003 +#define BCM94702_CPCI_RESET_ADDR BCM4710_EXTIF
4004 +#define BCM94702_CPCI_BOARDID_ADDR (BCM4710_EXTIF | 0x4000)
4005 +#define BCM94702_CPCI_DOC_ADDR (BCM4710_EXTIF | 0x6000)
4006 +#define BCM94702_DOC_ADDR BCM94702_CPCI_DOC_ADDR
4007 +#define BCM94702_CPCI_LED_ADDR (BCM4710_EXTIF | 0xc000)
4008 +#define BCM94702_CPCI_NVRAM_ADDR (BCM4710_EXTIF | 0xe000)
4009 +#define BCM94702_CPCI_NVRAM_SIZE 0x1ff0 /* 8K NVRAM : DS1743/STM48txx*/
4010 +#define BCM94702_CPCI_TOD_REG_BASE (BCM94702_CPCI_NVRAM_ADDR | 0x1ff0)
4011 +
4012 +#define LED_REG(x) \
4013 + (*(volatile unsigned char *) (KSEG1ADDR(BCM94702_CPCI_LED_ADDR) + (x)))
4014 +
4015 +/*
4016 + * Reset function implemented in PLD. Read or write should trigger hard reset
4017 + */
4018 +#define SYS_HARD_RESET() \
4019 + { for (;;) \
4020 + *( (volatile unsigned char *)\
4021 + KSEG1ADDR(BCM94702_CPCI_RESET_ADDR) ) = 0x80; \
4022 + }
4023 +
4024 +#endif /* _bcm4710_h_ */
4025 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmdevs.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmdevs.h
4026 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmdevs.h 1970-01-01 01:00:00.000000000 +0100
4027 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmdevs.h 2005-08-28 11:12:20.431859000 +0200
4028 @@ -0,0 +1,238 @@
4029 +/*
4030 + * Broadcom device-specific manifest constants.
4031 + *
4032 + * $Id$
4033 + * Copyright 2001-2003, Broadcom Corporation
4034 + * All Rights Reserved.
4035 + *
4036 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
4037 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
4038 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
4039 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
4040 + */
4041 +
4042 +#ifndef _BCMDEVS_H
4043 +#define _BCMDEVS_H
4044 +
4045 +
4046 +/* Known PCI vendor Id's */
4047 +#define VENDOR_EPIGRAM 0xfeda
4048 +#define VENDOR_BROADCOM 0x14e4
4049 +#define VENDOR_3COM 0x10b7
4050 +#define VENDOR_NETGEAR 0x1385
4051 +#define VENDOR_DIAMOND 0x1092
4052 +#define VENDOR_DELL 0x1028
4053 +#define VENDOR_HP 0x0e11
4054 +#define VENDOR_APPLE 0x106b
4055 +
4056 +/* PCI Device Id's */
4057 +#define BCM4210_DEVICE_ID 0x1072 /* never used */
4058 +#define BCM4211_DEVICE_ID 0x4211
4059 +#define BCM4230_DEVICE_ID 0x1086 /* never used */
4060 +#define BCM4231_DEVICE_ID 0x4231
4061 +
4062 +#define BCM4410_DEVICE_ID 0x4410 /* bcm44xx family pci iline */
4063 +#define BCM4430_DEVICE_ID 0x4430 /* bcm44xx family cardbus iline */
4064 +#define BCM4412_DEVICE_ID 0x4412 /* bcm44xx family pci enet */
4065 +#define BCM4432_DEVICE_ID 0x4432 /* bcm44xx family cardbus enet */
4066 +
4067 +#define BCM3352_DEVICE_ID 0x3352 /* bcm3352 device id */
4068 +#define BCM3360_DEVICE_ID 0x3360 /* bcm3360 device id */
4069 +
4070 +#define EPI41210_DEVICE_ID 0xa0fa /* bcm4210 */
4071 +#define EPI41230_DEVICE_ID 0xa10e /* bcm4230 */
4072 +
4073 +#define BCM47XX_ILINE_ID 0x4711 /* 47xx iline20 */
4074 +#define BCM47XX_V90_ID 0x4712 /* 47xx v90 codec */
4075 +#define BCM47XX_ENET_ID 0x4713 /* 47xx enet */
4076 +#define BCM47XX_EXT_ID 0x4714 /* 47xx external i/f */
4077 +#define BCM47XX_USB_ID 0x4715 /* 47xx usb */
4078 +#define BCM47XX_USBH_ID 0x4716 /* 47xx usb host */
4079 +#define BCM47XX_USBD_ID 0x4717 /* 47xx usb device */
4080 +#define BCM47XX_IPSEC_ID 0x4718 /* 47xx ipsec */
4081 +
4082 +#define BCM4710_DEVICE_ID 0x4710 /* 4710 primary function 0 */
4083 +
4084 +#define BCM4610_DEVICE_ID 0x4610 /* 4610 primary function 0 */
4085 +#define BCM4610_ILINE_ID 0x4611 /* 4610 iline100 */
4086 +#define BCM4610_V90_ID 0x4612 /* 4610 v90 codec */
4087 +#define BCM4610_ENET_ID 0x4613 /* 4610 enet */
4088 +#define BCM4610_EXT_ID 0x4614 /* 4610 external i/f */
4089 +#define BCM4610_USB_ID 0x4615 /* 4610 usb */
4090 +
4091 +#define BCM4402_DEVICE_ID 0x4402 /* 4402 primary function 0 */
4092 +#define BCM4402_ENET_ID 0x4402 /* 4402 enet */
4093 +#define BCM4402_V90_ID 0x4403 /* 4402 v90 codec */
4094 +
4095 +#define BCM4301_DEVICE_ID 0x4301 /* 4301 primary function 0 */
4096 +#define BCM4301_D11B_ID 0x4301 /* 4301 802.11b */
4097 +
4098 +#define BCM4307_DEVICE_ID 0x4307 /* 4307 primary function 0 */
4099 +#define BCM4307_V90_ID 0x4305 /* 4307 v90 codec */
4100 +#define BCM4307_ENET_ID 0x4306 /* 4307 enet */
4101 +#define BCM4307_D11B_ID 0x4307 /* 4307 802.11b */
4102 +
4103 +#define BCM4306_DEVICE_ID 0x4306 /* 4306 chipcommon chipid */
4104 +#define BCM4306_D11G_ID 0x4320 /* 4306 802.11g */
4105 +#define BCM4306_D11G_ID2 0x4325
4106 +#define BCM4306_D11A_ID 0x4321 /* 4306 802.11a */
4107 +#define BCM4306_UART_ID 0x4322 /* 4306 uart */
4108 +#define BCM4306_V90_ID 0x4323 /* 4306 v90 codec */
4109 +#define BCM4306_D11DUAL_ID 0x4324 /* 4306 dual A+B */
4110 +
4111 +#define BCM4309_PKG_ID 1 /* 4309 package id */
4112 +
4113 +#define BCM4303_D11B_ID 0x4303 /* 4303 802.11b */
4114 +#define BCM4303_PKG_ID 2 /* 4303 package id */
4115 +
4116 +#define BCM4310_DEVICE_ID 0x4310 /* 4310 chipcommon chipid */
4117 +#define BCM4310_D11B_ID 0x4311 /* 4310 802.11b */
4118 +#define BCM4310_UART_ID 0x4312 /* 4310 uart */
4119 +#define BCM4310_ENET_ID 0x4313 /* 4310 enet */
4120 +#define BCM4310_USB_ID 0x4315 /* 4310 usb */
4121 +
4122 +#define BCM4704_DEVICE_ID 0x4704 /* 4704 chipcommon chipid */
4123 +#define BCM4704_ENET_ID 0x4706 /* 4704 enet (Use 47XX_ENET_ID instead!) */
4124 +
4125 +#define BCM4317_DEVICE_ID 0x4317 /* 4317 chip common chipid */
4126 +
4127 +#define BCM4712_DEVICE_ID 0x4712 /* 4712 chipcommon chipid */
4128 +#define BCM4712_MIPS_ID 0x4720 /* 4712 base devid */
4129 +#define BCM4712SMALL_PKG_ID 1 /* 200pin 4712 package id */
4130 +
4131 +#define SDIOH_FPGA_ID 0x4380 /* sdio host fpga */
4132 +
4133 +#define BCM5365_DEVICE_ID 0x5365 /* 5365 chipcommon chipid */
4134 +
4135 +
4136 +/* PCMCIA vendor Id's */
4137 +
4138 +#define VENDOR_BROADCOM_PCMCIA 0x02d0
4139 +
4140 +/* SDIO vendor Id's */
4141 +#define VENDOR_BROADCOM_SDIO 0x00BF
4142 +
4143 +
4144 +/* boardflags */
4145 +#define BFL_BTCOEXIST 0x0001 /* This board implements Bluetooth coexistance */
4146 +#define BFL_PACTRL 0x0002 /* This board has gpio 9 controlling the PA */
4147 +#define BFL_AIRLINEMODE 0x0004 /* This board implements gpio13 radio disable indication */
4148 +#define BFL_ENETSPI 0x0010 /* This board has ephy roboswitch spi */
4149 +#define BFL_CCKHIPWR 0x0040 /* Can do high-power CCK transmission */
4150 +#define BFL_ENETADM 0x0080 /* This board has ADMtek switch */
4151 +#define BFL_ENETVLAN 0x0100 /* This board can do vlan */
4152 +
4153 +/* board specific GPIO assignment, gpio 0-3 are also customer-configurable led */
4154 +#define BOARD_GPIO_HWRAD_B 0x010 /* bit 4 is HWRAD input on 4301 */
4155 +#define BOARD_GPIO_BTC_IN 0x080 /* bit 7 is BT Coexistance Input */
4156 +#define BOARD_GPIO_BTC_OUT 0x100 /* bit 8 is BT Coexistance Out */
4157 +#define BOARD_GPIO_PACTRL 0x200 /* bit 9 controls the PA on new 4306 boards */
4158 +#define PCI_CFG_GPIO_SCS 0x10 /* PCI config space bit 4 for 4306c0 slow clock source */
4159 +#define PCI_CFG_GPIO_HWRAD 0x20 /* PCI config space GPIO 13 for hw radio disable */
4160 +#define PCI_CFG_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */
4161 +#define PCI_CFG_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */
4162 +
4163 +/* Bus types */
4164 +#define SB_BUS 0 /* Silicon Backplane */
4165 +#define PCI_BUS 1 /* PCI target */
4166 +#define PCMCIA_BUS 2 /* PCMCIA target */
4167 +#define SDIO_BUS 3 /* SDIO target */
4168 +
4169 +/* Reference Board Types */
4170 +
4171 +#define BU4710_BOARD 0x0400
4172 +#define VSIM4710_BOARD 0x0401
4173 +#define QT4710_BOARD 0x0402
4174 +
4175 +#define BU4610_BOARD 0x0403
4176 +#define VSIM4610_BOARD 0x0404
4177 +
4178 +#define BU4307_BOARD 0x0405
4179 +#define BCM94301CB_BOARD 0x0406
4180 +#define BCM94301PC_BOARD 0x0406 /* Pcmcia 5v card */
4181 +#define BCM94301MP_BOARD 0x0407
4182 +#define BCM94307MP_BOARD 0x0408
4183 +#define BCMAP4307_BOARD 0x0409
4184 +
4185 +#define BU4309_BOARD 0x040a
4186 +#define BCM94309CB_BOARD 0x040b
4187 +#define BCM94309MP_BOARD 0x040c
4188 +#define BCM4309AP_BOARD 0x040d
4189 +
4190 +#define BCM94302MP_BOARD 0x040e
4191 +
4192 +#define VSIM4310_BOARD 0x040f
4193 +#define BU4711_BOARD 0x0410
4194 +#define BCM94310U_BOARD 0x0411
4195 +#define BCM94310AP_BOARD 0x0412
4196 +#define BCM94310MP_BOARD 0x0414
4197 +
4198 +#define BU4306_BOARD 0x0416
4199 +#define BCM94306CB_BOARD 0x0417
4200 +#define BCM94306MP_BOARD 0x0418
4201 +
4202 +#define BCM94710D_BOARD 0x041a
4203 +#define BCM94710R1_BOARD 0x041b
4204 +#define BCM94710R4_BOARD 0x041c
4205 +#define BCM94710AP_BOARD 0x041d
4206 +
4207 +
4208 +#define BU2050_BOARD 0x041f
4209 +
4210 +
4211 +#define BCM94309G_BOARD 0x0421
4212 +
4213 +#define BCM94301PC3_BOARD 0x0422 /* Pcmcia 3.3v card */
4214 +
4215 +#define BU4704_BOARD 0x0423
4216 +#define BU4702_BOARD 0x0424
4217 +
4218 +#define BCM94306PC_BOARD 0x0425 /* pcmcia 3.3v 4306 card */
4219 +
4220 +#define BU4317_BOARD 0x0426
4221 +
4222 +
4223 +#define BCM94702MN_BOARD 0x0428
4224 +
4225 +/* BCM4702 1U CompactPCI Board */
4226 +#define BCM94702CPCI_BOARD 0x0429
4227 +
4228 +/* BCM4702 with BCM95380 VLAN Router */
4229 +#define BCM95380RR_BOARD 0x042a
4230 +
4231 +/* cb4306 with SiGe PA */
4232 +#define BCM94306CBSG_BOARD 0x042b
4233 +
4234 +/* mp4301 with 2050 radio */
4235 +#define BCM94301MPL_BOARD 0x042c
4236 +
4237 +/* cb4306 with SiGe PA */
4238 +#define PCSG94306_BOARD 0x042d
4239 +
4240 +/* bu4704 with sdram */
4241 +#define BU4704SD_BOARD 0x042e
4242 +
4243 +/* Dual 11a/11g Router */
4244 +#define BCM94704AGR_BOARD 0x042f
4245 +
4246 +/* 11a-only minipci */
4247 +#define BCM94308MP_BOARD 0x0430
4248 +
4249 +
4250 +
4251 +/* BCM94317 boards */
4252 +#define BCM94317CB_BOARD 0x0440
4253 +#define BCM94317MP_BOARD 0x0441
4254 +#define BCM94317PCMCIA_BOARD 0x0442
4255 +#define BCM94317SDIO_BOARD 0x0443
4256 +
4257 +#define BU4712_BOARD 0x0444
4258 +
4259 +/* BCM4712 boards */
4260 +#define BCM94712AGR_BOARD 0x0445
4261 +#define BCM94712AP_BOARD 0x0446
4262 +
4263 +/* BCM4702 boards */
4264 +#define CT4702AP_BOARD 0x0447
4265 +
4266 +#endif /* _BCMDEVS_H */
4267 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmendian.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmendian.h
4268 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmendian.h 1970-01-01 01:00:00.000000000 +0100
4269 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmendian.h 2005-08-28 11:12:20.431859000 +0200
4270 @@ -0,0 +1,125 @@
4271 +/*******************************************************************************
4272 + * $Id$
4273 + * Copyright 2001-2003, Broadcom Corporation
4274 + * All Rights Reserved.
4275 + *
4276 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
4277 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
4278 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
4279 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
4280 + * local version of endian.h - byte order defines
4281 + ******************************************************************************/
4282 +
4283 +#ifndef _BCMENDIAN_H_
4284 +#define _BCMENDIAN_H_
4285 +
4286 +#include <typedefs.h>
4287 +
4288 +/* Byte swap a 16 bit value */
4289 +#define BCMSWAP16(val) \
4290 + ((uint16)( \
4291 + (((uint16)(val) & (uint16)0x00ffU) << 8) | \
4292 + (((uint16)(val) & (uint16)0xff00U) >> 8) ))
4293 +
4294 +/* Byte swap a 32 bit value */
4295 +#define BCMSWAP32(val) \
4296 + ((uint32)( \
4297 + (((uint32)(val) & (uint32)0x000000ffUL) << 24) | \
4298 + (((uint32)(val) & (uint32)0x0000ff00UL) << 8) | \
4299 + (((uint32)(val) & (uint32)0x00ff0000UL) >> 8) | \
4300 + (((uint32)(val) & (uint32)0xff000000UL) >> 24) ))
4301 +
4302 +static INLINE uint16
4303 +bcmswap16(uint16 val)
4304 +{
4305 + return BCMSWAP16(val);
4306 +}
4307 +
4308 +static INLINE uint32
4309 +bcmswap32(uint32 val)
4310 +{
4311 + return BCMSWAP32(val);
4312 +}
4313 +
4314 +/* buf - start of buffer of shorts to swap */
4315 +/* len - byte length of buffer */
4316 +static INLINE void
4317 +bcmswap16_buf(uint16 *buf, uint len)
4318 +{
4319 + len = len/2;
4320 +
4321 + while(len--){
4322 + *buf = bcmswap16(*buf);
4323 + buf++;
4324 + }
4325 +}
4326 +
4327 +#ifndef hton16
4328 +#ifndef IL_BIGENDIAN
4329 +#define HTON16(i) BCMSWAP16(i)
4330 +#define hton16(i) bcmswap16(i)
4331 +#define hton32(i) bcmswap32(i)
4332 +#define ntoh16(i) bcmswap16(i)
4333 +#define ntoh32(i) bcmswap32(i)
4334 +#define ltoh16(i) (i)
4335 +#define ltoh32(i) (i)
4336 +#define htol16(i) (i)
4337 +#define htol32(i) (i)
4338 +#else
4339 +#define HTON16(i) (i)
4340 +#define hton16(i) (i)
4341 +#define hton32(i) (i)
4342 +#define ntoh16(i) (i)
4343 +#define ntoh32(i) (i)
4344 +#define ltoh16(i) bcmswap16(i)
4345 +#define ltoh32(i) bcmswap32(i)
4346 +#define htol16(i) bcmswap16(i)
4347 +#define htol32(i) bcmswap32(i)
4348 +#endif
4349 +#endif
4350 +
4351 +#ifndef IL_BIGENDIAN
4352 +#define ltoh16_buf(buf, i)
4353 +#define htol16_buf(buf, i)
4354 +#else
4355 +#define ltoh16_buf(buf, i) bcmswap16_buf((uint16*)buf, i)
4356 +#define htol16_buf(buf, i) bcmswap16_buf((uint16*)buf, i)
4357 +#endif
4358 +
4359 +/*
4360 +* load 16-bit value from unaligned little endian byte array.
4361 +*/
4362 +static INLINE uint16
4363 +ltoh16_ua(uint8 *bytes)
4364 +{
4365 + return (bytes[1]<<8)+bytes[0];
4366 +}
4367 +
4368 +/*
4369 +* load 32-bit value from unaligned little endian byte array.
4370 +*/
4371 +static INLINE uint32
4372 +ltoh32_ua(uint8 *bytes)
4373 +{
4374 + return (bytes[3]<<24)+(bytes[2]<<16)+(bytes[1]<<8)+bytes[0];
4375 +}
4376 +
4377 +/*
4378 +* load 16-bit value from unaligned big(network) endian byte array.
4379 +*/
4380 +static INLINE uint16
4381 +ntoh16_ua(uint8 *bytes)
4382 +{
4383 + return (bytes[0]<<8)+bytes[1];
4384 +}
4385 +
4386 +/*
4387 +* load 32-bit value from unaligned big(network) endian byte array.
4388 +*/
4389 +static INLINE uint32
4390 +ntoh32_ua(uint8 *bytes)
4391 +{
4392 + return (bytes[0]<<24)+(bytes[1]<<16)+(bytes[2]<<8)+bytes[3];
4393 +}
4394 +
4395 +#endif /* _BCMENDIAN_H_ */
4396 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmenet47xx.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmenet47xx.h
4397 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmenet47xx.h 1970-01-01 01:00:00.000000000 +0100
4398 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmenet47xx.h 2005-08-28 11:12:20.432858848 +0200
4399 @@ -0,0 +1,229 @@
4400 +/*
4401 + * Hardware-specific definitions for
4402 + * Broadcom BCM47XX 10/100 Mbps Ethernet cores.
4403 + *
4404 + * Copyright 2001-2003, Broadcom Corporation
4405 + * All Rights Reserved.
4406 + *
4407 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
4408 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
4409 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
4410 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
4411 + * $Id$
4412 + */
4413 +
4414 +#ifndef _bcmenet_47xx_h_
4415 +#define _bcmenet_47xx_h_
4416 +
4417 +#include <bcmdevs.h>
4418 +#include <hnddma.h>
4419 +
4420 +#define BCMENET_NFILTERS 64 /* # ethernet address filter entries */
4421 +#define BCMENET_MCHASHBASE 0x200 /* multicast hash filter base address */
4422 +#define BCMENET_MCHASHSIZE 256 /* multicast hash filter size in bytes */
4423 +#define BCMENET_MAX_DMA 4096 /* chip has 12 bits of DMA addressing */
4424 +
4425 +/* power management event wakeup pattern constants */
4426 +#define BCMENET_NPMP 4 /* chip supports 4 wakeup patterns */
4427 +#define BCMENET_PMPBASE 0x400 /* wakeup pattern base address */
4428 +#define BCMENET_PMPSIZE 0x80 /* 128bytes each pattern */
4429 +#define BCMENET_PMMBASE 0x600 /* wakeup mask base address */
4430 +#define BCMENET_PMMSIZE 0x10 /* 128bits each mask */
4431 +
4432 +/* cpp contortions to concatenate w/arg prescan */
4433 +#ifndef PAD
4434 +#define _PADLINE(line) pad ## line
4435 +#define _XSTR(line) _PADLINE(line)
4436 +#define PAD _XSTR(__LINE__)
4437 +#endif /* PAD */
4438 +
4439 +/* sometimes you just need the enet mib definitions */
4440 +#include <bcmenetmib.h>
4441 +
4442 +/*
4443 + * Host Interface Registers
4444 + */
4445 +typedef volatile struct _bcmenettregs {
4446 + /* Device and Power Control */
4447 + uint32 devcontrol;
4448 + uint32 PAD[2];
4449 + uint32 biststatus;
4450 + uint32 wakeuplength;
4451 + uint32 PAD[3];
4452 +
4453 + /* Interrupt Control */
4454 + uint32 intstatus;
4455 + uint32 intmask;
4456 + uint32 gptimer;
4457 + uint32 PAD[23];
4458 +
4459 + /* Ethernet MAC Address Filtering Control */
4460 + uint32 PAD[2];
4461 + uint32 enetftaddr;
4462 + uint32 enetftdata;
4463 + uint32 PAD[2];
4464 +
4465 + /* Ethernet MAC Control */
4466 + uint32 emactxmaxburstlen;
4467 + uint32 emacrxmaxburstlen;
4468 + uint32 emaccontrol;
4469 + uint32 emacflowcontrol;
4470 +
4471 + uint32 PAD[20];
4472 +
4473 + /* DMA Lazy Interrupt Control */
4474 + uint32 intrecvlazy;
4475 + uint32 PAD[63];
4476 +
4477 + /* DMA engine */
4478 + dmaregs_t dmaregs;
4479 + dmafifo_t dmafifo;
4480 + uint32 PAD[116];
4481 +
4482 + /* EMAC Registers */
4483 + uint32 rxconfig;
4484 + uint32 rxmaxlength;
4485 + uint32 txmaxlength;
4486 + uint32 PAD;
4487 + uint32 mdiocontrol;
4488 + uint32 mdiodata;
4489 + uint32 emacintmask;
4490 + uint32 emacintstatus;
4491 + uint32 camdatalo;
4492 + uint32 camdatahi;
4493 + uint32 camcontrol;
4494 + uint32 enetcontrol;
4495 + uint32 txcontrol;
4496 + uint32 txwatermark;
4497 + uint32 mibcontrol;
4498 + uint32 PAD[49];
4499 +
4500 + /* EMAC MIB counters */
4501 + bcmenetmib_t mib;
4502 +
4503 + uint32 PAD[585];
4504 +
4505 + /* Sonics SiliconBackplane config registers */
4506 + sbconfig_t sbconfig;
4507 +} bcmenetregs_t;
4508 +
4509 +/* device control */
4510 +#define DC_PM ((uint32)1 << 7) /* pattern filtering enable */
4511 +#define DC_IP ((uint32)1 << 10) /* internal ephy present (rev >= 1) */
4512 +#define DC_ER ((uint32)1 << 15) /* ephy reset */
4513 +#define DC_MP ((uint32)1 << 16) /* mii phy mode enable */
4514 +#define DC_CO ((uint32)1 << 17) /* mii phy mode: enable clocks */
4515 +#define DC_PA_MASK 0x7c0000 /* mii phy mode: mdc/mdio phy address */
4516 +#define DC_PA_SHIFT 18
4517 +
4518 +/* wakeup length */
4519 +#define WL_P0_MASK 0x7f /* pattern 0 */
4520 +#define WL_D0 ((uint32)1 << 7)
4521 +#define WL_P1_MASK 0x7f00 /* pattern 1 */
4522 +#define WL_P1_SHIFT 8
4523 +#define WL_D1 ((uint32)1 << 15)
4524 +#define WL_P2_MASK 0x7f0000 /* pattern 2 */
4525 +#define WL_P2_SHIFT 16
4526 +#define WL_D2 ((uint32)1 << 23)
4527 +#define WL_P3_MASK 0x7f000000 /* pattern 3 */
4528 +#define WL_P3_SHIFT 24
4529 +#define WL_D3 ((uint32)1 << 31)
4530 +
4531 +/* intstatus and intmask */
4532 +#define I_PME ((uint32)1 << 6) /* power management event */
4533 +#define I_TO ((uint32)1 << 7) /* general purpose timeout */
4534 +#define I_PC ((uint32)1 << 10) /* descriptor error */
4535 +#define I_PD ((uint32)1 << 11) /* data error */
4536 +#define I_DE ((uint32)1 << 12) /* descriptor protocol error */
4537 +#define I_RU ((uint32)1 << 13) /* receive descriptor underflow */
4538 +#define I_RO ((uint32)1 << 14) /* receive fifo overflow */
4539 +#define I_XU ((uint32)1 << 15) /* transmit fifo underflow */
4540 +#define I_RI ((uint32)1 << 16) /* receive interrupt */
4541 +#define I_XI ((uint32)1 << 24) /* transmit interrupt */
4542 +#define I_EM ((uint32)1 << 26) /* emac interrupt */
4543 +#define I_MW ((uint32)1 << 27) /* mii write */
4544 +#define I_MR ((uint32)1 << 28) /* mii read */
4545 +
4546 +/* emaccontrol */
4547 +#define EMC_CG ((uint32)1 << 0) /* crc32 generation enable */
4548 +#define EMC_EP ((uint32)1 << 2) /* onchip ephy: powerdown (rev >= 1) */
4549 +#define EMC_ED ((uint32)1 << 3) /* onchip ephy: energy detected (rev >= 1) */
4550 +#define EMC_LC_MASK 0xe0 /* onchip ephy: led control (rev >= 1) */
4551 +#define EMC_LC_SHIFT 5
4552 +
4553 +/* emacflowcontrol */
4554 +#define EMF_RFH_MASK 0xff /* rx fifo hi water mark */
4555 +#define EMF_PG ((uint32)1 << 15) /* enable pause frame generation */
4556 +
4557 +/* interrupt receive lazy */
4558 +#define IRL_TO_MASK 0x00ffffff /* timeout */
4559 +#define IRL_FC_MASK 0xff000000 /* frame count */
4560 +#define IRL_FC_SHIFT 24 /* frame count */
4561 +
4562 +/* emac receive config */
4563 +#define ERC_DB ((uint32)1 << 0) /* disable broadcast */
4564 +#define ERC_AM ((uint32)1 << 1) /* accept all multicast */
4565 +#define ERC_RDT ((uint32)1 << 2) /* receive disable while transmitting */
4566 +#define ERC_PE ((uint32)1 << 3) /* promiscuous enable */
4567 +#define ERC_LE ((uint32)1 << 4) /* loopback enable */
4568 +#define ERC_FE ((uint32)1 << 5) /* enable flow control */
4569 +#define ERC_UF ((uint32)1 << 6) /* accept unicast flow control frame */
4570 +#define ERC_RF ((uint32)1 << 7) /* reject filter */
4571 +
4572 +/* emac mdio control */
4573 +#define MC_MF_MASK 0x7f /* mdc frequency */
4574 +#define MC_PE ((uint32)1 << 7) /* mii preamble enable */
4575 +
4576 +/* emac mdio data */
4577 +#define MD_DATA_MASK 0xffff /* r/w data */
4578 +#define MD_TA_MASK 0x30000 /* turnaround value */
4579 +#define MD_TA_SHIFT 16
4580 +#define MD_TA_VALID (2 << MD_TA_SHIFT) /* valid ta */
4581 +#define MD_RA_MASK 0x7c0000 /* register address */
4582 +#define MD_RA_SHIFT 18
4583 +#define MD_PMD_MASK 0xf800000 /* physical media device */
4584 +#define MD_PMD_SHIFT 23
4585 +#define MD_OP_MASK 0x30000000 /* opcode */
4586 +#define MD_OP_SHIFT 28
4587 +#define MD_OP_WRITE (1 << MD_OP_SHIFT) /* write op */
4588 +#define MD_OP_READ (2 << MD_OP_SHIFT) /* read op */
4589 +#define MD_SB_MASK 0xc0000000 /* start bits */
4590 +#define MD_SB_SHIFT 30
4591 +#define MD_SB_START (0x1 << MD_SB_SHIFT) /* start of frame */
4592 +
4593 +/* emac intstatus and intmask */
4594 +#define EI_MII ((uint32)1 << 0) /* mii mdio interrupt */
4595 +#define EI_MIB ((uint32)1 << 1) /* mib interrupt */
4596 +#define EI_FLOW ((uint32)1 << 2) /* flow control interrupt */
4597 +
4598 +/* emac cam data high */
4599 +#define CD_V ((uint32)1 << 16) /* valid bit */
4600 +
4601 +/* emac cam control */
4602 +#define CC_CE ((uint32)1 << 0) /* cam enable */
4603 +#define CC_MS ((uint32)1 << 1) /* mask select */
4604 +#define CC_RD ((uint32)1 << 2) /* read */
4605 +#define CC_WR ((uint32)1 << 3) /* write */
4606 +#define CC_INDEX_MASK 0x3f0000 /* index */
4607 +#define CC_INDEX_SHIFT 16
4608 +#define CC_CB ((uint32)1 << 31) /* cam busy */
4609 +
4610 +/* emac ethernet control */
4611 +#define EC_EE ((uint32)1 << 0) /* emac enable */
4612 +#define EC_ED ((uint32)1 << 1) /* emac disable */
4613 +#define EC_ES ((uint32)1 << 2) /* emac soft reset */
4614 +#define EC_EP ((uint32)1 << 3) /* external phy select */
4615 +
4616 +/* emac transmit control */
4617 +#define EXC_FD ((uint32)1 << 0) /* full duplex */
4618 +#define EXC_FM ((uint32)1 << 1) /* flowmode */
4619 +#define EXC_SB ((uint32)1 << 2) /* single backoff enable */
4620 +#define EXC_SS ((uint32)1 << 3) /* small slottime */
4621 +
4622 +/* emac mib control */
4623 +#define EMC_RZ ((uint32)1 << 0) /* autoclear on read */
4624 +
4625 +/* sometimes you just need the enet rxheader definitions */
4626 +#include <bcmenetrxh.h>
4627 +
4628 +#endif /* _bcmenet_47xx_h_ */
4629 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmenetmib.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmenetmib.h
4630 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmenetmib.h 1970-01-01 01:00:00.000000000 +0100
4631 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmenetmib.h 2005-08-28 11:12:20.432858848 +0200
4632 @@ -0,0 +1,81 @@
4633 +/*
4634 + * Hardware-specific MIB definition for
4635 + * Broadcom Home Networking Division
4636 + * BCM44XX and BCM47XX 10/100 Mbps Ethernet cores.
4637 + *
4638 + * Copyright 2001-2003, Broadcom Corporation
4639 + * All Rights Reserved.
4640 + *
4641 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
4642 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
4643 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
4644 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
4645 + * $Id$
4646 + */
4647 +
4648 +#ifndef _bcmenetmib_h_
4649 +#define _bcmenetmib_h_
4650 +
4651 +/* cpp contortions to concatenate w/arg prescan */
4652 +#ifndef PAD
4653 +#define _PADLINE(line) pad ## line
4654 +#define _XSTR(line) _PADLINE(line)
4655 +#define PAD _XSTR(__LINE__)
4656 +#endif /* PAD */
4657 +
4658 +/*
4659 + * EMAC MIB Registers
4660 + */
4661 +typedef volatile struct {
4662 + uint32 tx_good_octets;
4663 + uint32 tx_good_pkts;
4664 + uint32 tx_octets;
4665 + uint32 tx_pkts;
4666 + uint32 tx_broadcast_pkts;
4667 + uint32 tx_multicast_pkts;
4668 + uint32 tx_len_64;
4669 + uint32 tx_len_65_to_127;
4670 + uint32 tx_len_128_to_255;
4671 + uint32 tx_len_256_to_511;
4672 + uint32 tx_len_512_to_1023;
4673 + uint32 tx_len_1024_to_max;
4674 + uint32 tx_jabber_pkts;
4675 + uint32 tx_oversize_pkts;
4676 + uint32 tx_fragment_pkts;
4677 + uint32 tx_underruns;
4678 + uint32 tx_total_cols;
4679 + uint32 tx_single_cols;
4680 + uint32 tx_multiple_cols;
4681 + uint32 tx_excessive_cols;
4682 + uint32 tx_late_cols;
4683 + uint32 tx_defered;
4684 + uint32 tx_carrier_lost;
4685 + uint32 tx_pause_pkts;
4686 + uint32 PAD[8];
4687 +
4688 + uint32 rx_good_octets;
4689 + uint32 rx_good_pkts;
4690 + uint32 rx_octets;
4691 + uint32 rx_pkts;
4692 + uint32 rx_broadcast_pkts;
4693 + uint32 rx_multicast_pkts;
4694 + uint32 rx_len_64;
4695 + uint32 rx_len_65_to_127;
4696 + uint32 rx_len_128_to_255;
4697 + uint32 rx_len_256_to_511;
4698 + uint32 rx_len_512_to_1023;
4699 + uint32 rx_len_1024_to_max;
4700 + uint32 rx_jabber_pkts;
4701 + uint32 rx_oversize_pkts;
4702 + uint32 rx_fragment_pkts;
4703 + uint32 rx_missed_pkts;
4704 + uint32 rx_crc_align_errs;
4705 + uint32 rx_undersize;
4706 + uint32 rx_crc_errs;
4707 + uint32 rx_align_errs;
4708 + uint32 rx_symbol_errs;
4709 + uint32 rx_pause_pkts;
4710 + uint32 rx_nonpause_pkts;
4711 +} bcmenetmib_t;
4712 +
4713 +#endif /* _bcmenetmib_h_ */
4714 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmenetrxh.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmenetrxh.h
4715 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmenetrxh.h 1970-01-01 01:00:00.000000000 +0100
4716 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmenetrxh.h 2005-08-28 11:12:20.433858696 +0200
4717 @@ -0,0 +1,43 @@
4718 +/*
4719 + * Hardware-specific Receive Data Header for the
4720 + * Broadcom Home Networking Division
4721 + * BCM44XX and BCM47XX 10/100 Mbps Ethernet cores.
4722 + *
4723 + * Copyright 2001-2003, Broadcom Corporation
4724 + * All Rights Reserved.
4725 + *
4726 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
4727 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
4728 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
4729 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
4730 + * $Id$
4731 + */
4732 +
4733 +#ifndef _bcmenetrxh_h_
4734 +#define _bcmenetrxh_h_
4735 +
4736 +/*
4737 + * The Ethernet MAC core returns an 8-byte Receive Frame Data Header
4738 + * with every frame consisting of
4739 + * 16bits of frame length, followed by
4740 + * 16bits of EMAC rx descriptor info, followed by 32bits of undefined.
4741 + */
4742 +typedef volatile struct {
4743 + uint16 len;
4744 + uint16 flags;
4745 + uint16 pad[12];
4746 +} bcmenetrxh_t;
4747 +
4748 +#define RXHDR_LEN 28
4749 +
4750 +#define RXF_L ((uint16)1 << 11) /* last buffer in a frame */
4751 +#define RXF_MISS ((uint16)1 << 7) /* received due to promisc mode */
4752 +#define RXF_BRDCAST ((uint16)1 << 6) /* dest is broadcast address */
4753 +#define RXF_MULT ((uint16)1 << 5) /* dest is multicast address */
4754 +#define RXF_LG ((uint16)1 << 4) /* frame length > rxmaxlength */
4755 +#define RXF_NO ((uint16)1 << 3) /* odd number of nibbles */
4756 +#define RXF_RXER ((uint16)1 << 2) /* receive symbol error */
4757 +#define RXF_CRC ((uint16)1 << 1) /* crc error */
4758 +#define RXF_OV ((uint16)1 << 0) /* fifo overflow */
4759 +
4760 +#endif /* _bcmenetrxh_h_ */
4761 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmnvram.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmnvram.h
4762 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmnvram.h 1970-01-01 01:00:00.000000000 +0100
4763 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmnvram.h 2005-08-28 11:12:20.433858696 +0200
4764 @@ -0,0 +1,131 @@
4765 +/*
4766 + * NVRAM variable manipulation
4767 + *
4768 + * $Copyright Open Broadcom Corporation$
4769 + *
4770 + * $Id$
4771 + */
4772 +
4773 +#ifndef _bcmnvram_h_
4774 +#define _bcmnvram_h_
4775 +
4776 +#ifndef _LANGUAGE_ASSEMBLY
4777 +
4778 +#include <typedefs.h>
4779 +
4780 +struct nvram_header {
4781 + uint32 magic;
4782 + uint32 len;
4783 + uint32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:27 init, mem. test 28, 29-31 reserved */
4784 + uint32 config_refresh; /* 0:15 config, 16:31 refresh */
4785 + uint32 config_ncdl; /* ncdl values for memc */
4786 +};
4787 +
4788 +struct nvram_tuple {
4789 + char *name;
4790 + char *value;
4791 + struct nvram_tuple *next;
4792 +};
4793 +
4794 +/*
4795 + * Initialize NVRAM access. May be unnecessary or undefined on certain
4796 + * platforms.
4797 + */
4798 +extern int nvram_init(void *sbh);
4799 +
4800 +/*
4801 + * Disable NVRAM access. May be unnecessary or undefined on certain
4802 + * platforms.
4803 + */
4804 +extern void nvram_exit(void);
4805 +
4806 +/*
4807 + * Get the value of an NVRAM variable. The pointer returned may be
4808 + * invalid after a set.
4809 + * @param name name of variable to get
4810 + * @return value of variable or NULL if undefined
4811 + */
4812 +extern char * nvram_get(const char *name);
4813 +
4814 +/*
4815 + * Get the value of an NVRAM variable.
4816 + * @param name name of variable to get
4817 + * @return value of variable or NUL if undefined
4818 + */
4819 +#define nvram_safe_get(name) (nvram_get(name) ? : "")
4820 +
4821 +/*
4822 + * Match an NVRAM variable.
4823 + * @param name name of variable to match
4824 + * @param match value to compare against value of variable
4825 + * @return TRUE if variable is defined and its value is string equal
4826 + * to match or FALSE otherwise
4827 + */
4828 +static INLINE int
4829 +nvram_match(char *name, char *match) {
4830 + const char *value = nvram_get(name);
4831 + return (value && !strcmp(value, match));
4832 +}
4833 +
4834 +/*
4835 + * Inversely match an NVRAM variable.
4836 + * @param name name of variable to match
4837 + * @param match value to compare against value of variable
4838 + * @return TRUE if variable is defined and its value is not string
4839 + * equal to invmatch or FALSE otherwise
4840 + */
4841 +static INLINE int
4842 +nvram_invmatch(char *name, char *invmatch) {
4843 + const char *value = nvram_get(name);
4844 + return (value && strcmp(value, invmatch));
4845 +}
4846 +
4847 +/*
4848 + * Set the value of an NVRAM variable. The name and value strings are
4849 + * copied into private storage. Pointers to previously set values
4850 + * may become invalid. The new value may be immediately
4851 + * retrieved but will not be permanently stored until a commit.
4852 + * @param name name of variable to set
4853 + * @param value value of variable
4854 + * @return 0 on success and errno on failure
4855 + */
4856 +extern int nvram_set(const char *name, const char *value);
4857 +
4858 +/*
4859 + * Unset an NVRAM variable. Pointers to previously set values
4860 + * remain valid until a set.
4861 + * @param name name of variable to unset
4862 + * @return 0 on success and errno on failure
4863 + * NOTE: use nvram_commit to commit this change to flash.
4864 + */
4865 +extern int nvram_unset(const char *name);
4866 +
4867 +/*
4868 + * Commit NVRAM variables to permanent storage. All pointers to values
4869 + * may be invalid after a commit.
4870 + * NVRAM values are undefined after a commit.
4871 + * @return 0 on success and errno on failure
4872 + */
4873 +extern int nvram_commit(void);
4874 +
4875 +/*
4876 + * Get all NVRAM variables (format name=value\0 ... \0\0).
4877 + * @param buf buffer to store variables
4878 + * @param count size of buffer in bytes
4879 + * @return 0 on success and errno on failure
4880 + */
4881 +extern int nvram_getall(char *buf, int count);
4882 +
4883 +extern int kernel_write(unsigned char *buffer, int offset, int length);
4884 +
4885 +#endif /* _LANGUAGE_ASSEMBLY */
4886 +
4887 +#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
4888 +#define NVRAM_VERSION 1
4889 +#define NVRAM_HEADER_SIZE 20
4890 +#define NVRAM_LOC_GAP 0x100000
4891 +#define NVRAM_SPACE 0x2000
4892 +#define NVRAM_FIRST_LOC (0xbfd00000 - NVRAM_SPACE)
4893 +#define NVRAM_LAST_LOC (0xc0000000 - NVRAM_SPACE)
4894 +
4895 +#endif /* _bcmnvram_h_ */
4896 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmsrom.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmsrom.h
4897 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmsrom.h 1970-01-01 01:00:00.000000000 +0100
4898 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmsrom.h 2005-08-28 11:12:20.433858696 +0200
4899 @@ -0,0 +1,24 @@
4900 +/*
4901 + * Misc useful routines to access NIC srom
4902 + *
4903 + * Copyright 2001-2003, Broadcom Corporation
4904 + * All Rights Reserved.
4905 + *
4906 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
4907 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
4908 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
4909 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
4910 + *
4911 + * $Id$
4912 + */
4913 +
4914 +#ifndef _bcmsrom_h_
4915 +#define _bcmsrom_h_
4916 +
4917 +extern int srom_var_init(uint bus, void *curmap, void *osh, char **vars, int *count);
4918 +
4919 +extern int srom_read(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf);
4920 +extern int srom_write(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf);
4921 +extern int srom_parsecis(uint8 *cis, char **vars, int *count);
4922 +
4923 +#endif /* _bcmsrom_h_ */
4924 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmutils.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmutils.h
4925 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bcmutils.h 1970-01-01 01:00:00.000000000 +0100
4926 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bcmutils.h 2005-08-28 11:12:20.435858392 +0200
4927 @@ -0,0 +1,136 @@
4928 +/*
4929 + * Misc useful os-independent macros and functions.
4930 + *
4931 + * Copyright 2001-2003, Broadcom Corporation
4932 + * All Rights Reserved.
4933 + *
4934 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
4935 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
4936 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
4937 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
4938 + * $Id$
4939 + */
4940 +
4941 +#ifndef _bcmutils_h_
4942 +#define _bcmutils_h_
4943 +
4944 +#ifndef MIN
4945 +#define MIN(a, b) (((a)<(b))?(a):(b))
4946 +#endif
4947 +
4948 +#ifndef MAX
4949 +#define MAX(a, b) (((a)>(b))?(a):(b))
4950 +#endif
4951 +
4952 +#define CEIL(x, y) (((x) + ((y)-1)) / (y))
4953 +#define ROUNDUP(x, y) ((((ulong)(x)+((y)-1))/(y))*(y))
4954 +#define ISALIGNED(a, x) (((uint)(a) & ((x)-1)) == 0)
4955 +#define ISPOWEROF2(x) ((((x)-1)&(x))==0)
4956 +#define OFFSETOF(type, member) ((uint) &((type *)0)->member)
4957 +#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
4958 +
4959 +/* bit map related macros */
4960 +#ifndef setbit
4961 +#define NBBY 8 /* 8 bits per byte */
4962 +#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
4963 +#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
4964 +#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
4965 +#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
4966 +#endif
4967 +
4968 +#define NBITS(type) (sizeof (type) * 8)
4969 +
4970 +#define _BCM_U 0x01 /* upper */
4971 +#define _BCM_L 0x02 /* lower */
4972 +#define _BCM_D 0x04 /* digit */
4973 +#define _BCM_C 0x08 /* cntrl */
4974 +#define _BCM_P 0x10 /* punct */
4975 +#define _BCM_S 0x20 /* white space (space/lf/tab) */
4976 +#define _BCM_X 0x40 /* hex digit */
4977 +#define _BCM_SP 0x80 /* hard space (0x20) */
4978 +
4979 +extern unsigned char bcm_ctype[];
4980 +#define bcm_ismask(x) (bcm_ctype[(int)(unsigned char)(x)])
4981 +
4982 +#define bcm_isalnum(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L|_BCM_D)) != 0)
4983 +#define bcm_isalpha(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L)) != 0)
4984 +#define bcm_iscntrl(c) ((bcm_ismask(c)&(_BCM_C)) != 0)
4985 +#define bcm_isdigit(c) ((bcm_ismask(c)&(_BCM_D)) != 0)
4986 +#define bcm_isgraph(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D)) != 0)
4987 +#define bcm_islower(c) ((bcm_ismask(c)&(_BCM_L)) != 0)
4988 +#define bcm_isprint(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D|_BCM_SP)) != 0)
4989 +#define bcm_ispunct(c) ((bcm_ismask(c)&(_BCM_P)) != 0)
4990 +#define bcm_isspace(c) ((bcm_ismask(c)&(_BCM_S)) != 0)
4991 +#define bcm_isupper(c) ((bcm_ismask(c)&(_BCM_U)) != 0)
4992 +#define bcm_isxdigit(c) ((bcm_ismask(c)&(_BCM_D|_BCM_X)) != 0)
4993 +
4994 +/*
4995 + * Spin at most 'us' microseconds while 'exp' is true.
4996 + * Caller should explicitly test 'exp' when this completes
4997 + * and take appropriate error action if 'exp' is still true.
4998 + */
4999 +#define SPINWAIT(exp, us) { \
5000 + uint countdown = (us) + 9; \
5001 + while ((exp) && (countdown >= 10)) {\
5002 + OSL_DELAY(10); \
5003 + countdown -= 10; \
5004 + } \
5005 +}
5006 +
5007 +/* generic osl packet queue */
5008 +struct pktq {
5009 + void *head;
5010 + void *tail;
5011 + uint len;
5012 + uint maxlen;
5013 +};
5014 +#define DEFAULT_QLEN 128
5015 +
5016 +#define pktq_len(q) ((q)->len)
5017 +#define pktq_avail(q) ((q)->maxlen - (q)->len)
5018 +#define pktq_head(q) ((q)->head)
5019 +#define pktq_full(q) ((q)->len >= (q)->maxlen)
5020 +
5021 +/* crc defines */
5022 +#define CRC8_INIT_VALUE 0xff /* Initial CRC8 checksum value */
5023 +#define CRC8_GOOD_VALUE 0x9f /* Good final CRC8 checksum value */
5024 +#define CRC16_INIT_VALUE 0xffff /* Initial CRC16 checksum value */
5025 +#define CRC16_GOOD_VALUE 0xf0b8 /* Good final CRC16 checksum value */
5026 +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
5027 +#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */
5028 +
5029 +/* tag_ID/length/value_buffer tuple */
5030 +typedef struct bcm_tlv {
5031 + uint8 id;
5032 + uint8 len;
5033 + uint8 data[1];
5034 +} bcm_tlv_t;
5035 +
5036 +/* externs */
5037 +extern uint bcm_atoi(char *s);
5038 +extern uchar bcm_toupper(uchar c);
5039 +extern ulong bcm_strtoul(char *cp, char **endp, uint base);
5040 +extern void deadbeef(char *p, uint len);
5041 +extern void prhex(char *msg, uchar *buf, uint len);
5042 +extern void prpkt(char *msg, void *drv, void *p0);
5043 +extern uint pktcopy(void *drv, void *p, uint offset, int len, uchar *buf);
5044 +extern uint pkttotlen(void *drv, void *);
5045 +extern uchar *bcm_ether_ntoa(char *ea, char *buf);
5046 +extern int bcm_ether_atoe(char *p, char *ea);
5047 +extern void bcm_mdelay(uint ms);
5048 +extern char *getvar(char *vars, char *name);
5049 +extern int getintvar(char *vars, char *name);
5050 +
5051 +extern uint8 crc8(uint8 *p, uint nbytes, uint8 crc);
5052 +extern uint16 crc16(uint8 *p, uint nbytes, uint16 crc);
5053 +extern uint32 crc32(uint8 *p, uint nbytes, uint32 crc);
5054 +extern bcm_tlv_t *bcm_parse_tlvs(void *buf, int buflen, uint key);
5055 +extern bcm_tlv_t *bcm_parse_ordered_tlvs(void *buf, int buflen, uint key);
5056 +extern void pktqinit(struct pktq *q, int maxlen);
5057 +extern void pktenq(struct pktq *q, void *p, bool lifo);
5058 +extern void *pktdeq(struct pktq *q);
5059 +
5060 +#define bcmlog(fmt, a1, a2)
5061 +#define bcmdumplog(buf, size) *buf = '\0'
5062 +
5063 +#endif /* _bcmutils_h_ */
5064 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bitfuncs.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bitfuncs.h
5065 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/bitfuncs.h 1970-01-01 01:00:00.000000000 +0100
5066 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/bitfuncs.h 2005-08-28 11:12:20.435858392 +0200
5067 @@ -0,0 +1,85 @@
5068 +/*
5069 + * bit manipulation utility functions
5070 + *
5071 + * Copyright 2001-2003, Broadcom Corporation
5072 + * All Rights Reserved.
5073 + *
5074 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
5075 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
5076 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
5077 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
5078 + * $Id$
5079 + */
5080 +
5081 +#ifndef _BITFUNCS_H
5082 +#define _BITFUNCS_H
5083 +
5084 +#include <typedefs.h>
5085 +
5086 +/* local prototypes */
5087 +static INLINE uint32 find_msbit(uint32 x);
5088 +
5089 +
5090 +/*
5091 + * find_msbit: returns index of most significant set bit in x, with index
5092 + * range defined as 0-31. NOTE: returns zero if input is zero.
5093 + */
5094 +
5095 +#if defined(USE_PENTIUM_BSR) && defined(__GNUC__)
5096 +
5097 +/*
5098 + * Implementation for Pentium processors and gcc. Note that this
5099 + * instruction is actually very slow on some processors (e.g., family 5,
5100 + * model 2, stepping 12, "Pentium 75 - 200"), so we use the generic
5101 + * implementation instead.
5102 + */
5103 +static INLINE uint32 find_msbit(uint32 x)
5104 +{
5105 + uint msbit;
5106 + __asm__("bsrl %1,%0"
5107 + :"=r" (msbit)
5108 + :"r" (x));
5109 + return msbit;
5110 +}
5111 +
5112 +#else
5113 +
5114 +/*
5115 + * Generic Implementation
5116 + */
5117 +
5118 +#define DB_POW_MASK16 0xffff0000
5119 +#define DB_POW_MASK8 0x0000ff00
5120 +#define DB_POW_MASK4 0x000000f0
5121 +#define DB_POW_MASK2 0x0000000c
5122 +#define DB_POW_MASK1 0x00000002
5123 +
5124 +static INLINE uint32 find_msbit(uint32 x)
5125 +{
5126 + uint32 temp_x = x;
5127 + uint msbit = 0;
5128 + if (temp_x & DB_POW_MASK16) {
5129 + temp_x >>= 16;
5130 + msbit = 16;
5131 + }
5132 + if (temp_x & DB_POW_MASK8) {
5133 + temp_x >>= 8;
5134 + msbit += 8;
5135 + }
5136 + if (temp_x & DB_POW_MASK4) {
5137 + temp_x >>= 4;
5138 + msbit += 4;
5139 + }
5140 + if (temp_x & DB_POW_MASK2) {
5141 + temp_x >>= 2;
5142 + msbit += 2;
5143 + }
5144 + if (temp_x & DB_POW_MASK1) {
5145 + msbit += 1;
5146 + }
5147 + return(msbit);
5148 +}
5149 +
5150 +#endif
5151 +
5152 +#endif /* _BITFUNCS_H */
5153 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/epivers.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/epivers.h
5154 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/epivers.h 1970-01-01 01:00:00.000000000 +0100
5155 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/epivers.h 2005-08-28 11:12:20.435858392 +0200
5156 @@ -0,0 +1,69 @@
5157 +/*
5158 + * Copyright 2001-2003, Broadcom Corporation
5159 + * All Rights Reserved.
5160 + *
5161 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
5162 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
5163 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
5164 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
5165 + *
5166 + * $Id$
5167 + *
5168 +*/
5169 +
5170 +#ifndef _epivers_h_
5171 +#define _epivers_h_
5172 +
5173 +#ifdef linux
5174 +#include <linux/config.h>
5175 +#endif
5176 +
5177 +/* Vendor Name, ASCII, 32 chars max */
5178 +#ifdef COMPANYNAME
5179 +#define HPNA_VENDOR COMPANYNAME
5180 +#else
5181 +#define HPNA_VENDOR "Broadcom Corporation"
5182 +#endif
5183 +
5184 +/* Driver Date, ASCII, 32 chars max */
5185 +#define HPNA_DRV_BUILD_DATE __DATE__
5186 +
5187 +/* Hardware Manufacture Date, ASCII, 32 chars max */
5188 +#define HPNA_HW_MFG_DATE "Not Specified"
5189 +
5190 +/* See documentation for Device Type values, 32 values max */
5191 +#ifndef HPNA_DEV_TYPE
5192 +
5193 +#if defined(CONFIG_BRCM_VJ)
5194 +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_DISPLAY }
5195 +
5196 +#elif defined(CONFIG_BCRM_93725)
5197 +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_CM_BRIDGE, CDCF_V0_DEVICE_DISPLAY }
5198 +
5199 +#else
5200 +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_PCINIC }
5201 +
5202 +#endif
5203 +
5204 +#endif /* !HPNA_DEV_TYPE */
5205 +
5206 +
5207 +#define EPI_MAJOR_VERSION 1
5208 +
5209 +#define EPI_MINOR_VERSION 1
5210 +
5211 +#define EPI_RC_NUMBER 2
5212 +
5213 +#define EPI_INCREMENTAL_NUMBER 0
5214 +
5215 +#define EPI_BUILD_NUMBER 0
5216 +
5217 +#define EPI_VERSION 1,1,2,0
5218 +
5219 +#define EPI_VERSION_NUM 0x01010200
5220 +
5221 +/* Driver Version String, ASCII, 32 chars max */
5222 +#define EPI_VERSION_STR "1.1.2.0"
5223 +#define EPI_ROUTER_VERSION_STR "1.1.2.0"
5224 +
5225 +#endif /* _epivers_h_ */
5226 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/epivers.h.in linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/epivers.h.in
5227 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/epivers.h.in 1970-01-01 01:00:00.000000000 +0100
5228 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/epivers.h.in 2005-08-28 11:12:20.436858240 +0200
5229 @@ -0,0 +1,69 @@
5230 +/*
5231 + * Copyright 2001-2003, Broadcom Corporation
5232 + * All Rights Reserved.
5233 + *
5234 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
5235 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
5236 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
5237 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
5238 + *
5239 + * $Id$
5240 + *
5241 +*/
5242 +
5243 +#ifndef _epivers_h_
5244 +#define _epivers_h_
5245 +
5246 +#ifdef linux
5247 +#include <linux/config.h>
5248 +#endif
5249 +
5250 +/* Vendor Name, ASCII, 32 chars max */
5251 +#ifdef COMPANYNAME
5252 +#define HPNA_VENDOR COMPANYNAME
5253 +#else
5254 +#define HPNA_VENDOR "Broadcom Corporation"
5255 +#endif
5256 +
5257 +/* Driver Date, ASCII, 32 chars max */
5258 +#define HPNA_DRV_BUILD_DATE __DATE__
5259 +
5260 +/* Hardware Manufacture Date, ASCII, 32 chars max */
5261 +#define HPNA_HW_MFG_DATE "Not Specified"
5262 +
5263 +/* See documentation for Device Type values, 32 values max */
5264 +#ifndef HPNA_DEV_TYPE
5265 +
5266 +#if defined(CONFIG_BRCM_VJ)
5267 +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_DISPLAY }
5268 +
5269 +#elif defined(CONFIG_BCRM_93725)
5270 +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_CM_BRIDGE, CDCF_V0_DEVICE_DISPLAY }
5271 +
5272 +#else
5273 +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_PCINIC }
5274 +
5275 +#endif
5276 +
5277 +#endif /* !HPNA_DEV_TYPE */
5278 +
5279 +
5280 +#define EPI_MAJOR_VERSION @EPI_MAJOR_VERSION@
5281 +
5282 +#define EPI_MINOR_VERSION @EPI_MINOR_VERSION@
5283 +
5284 +#define EPI_RC_NUMBER @EPI_RC_NUMBER@
5285 +
5286 +#define EPI_INCREMENTAL_NUMBER @EPI_INCREMENTAL_NUMBER@
5287 +
5288 +#define EPI_BUILD_NUMBER @EPI_BUILD_NUMBER@
5289 +
5290 +#define EPI_VERSION @EPI_VERSION@
5291 +
5292 +#define EPI_VERSION_NUM @EPI_VERSION_NUM@
5293 +
5294 +/* Driver Version String, ASCII, 32 chars max */
5295 +#define EPI_VERSION_STR "@EPI_VERSION_STR@"
5296 +#define EPI_ROUTER_VERSION_STR "@EPI_ROUTER_VERSION_STR@"
5297 +
5298 +#endif /* _epivers_h_ */
5299 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/etsockio.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/etsockio.h
5300 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/etsockio.h 1970-01-01 01:00:00.000000000 +0100
5301 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/etsockio.h 2005-08-28 11:12:20.436858240 +0200
5302 @@ -0,0 +1,60 @@
5303 +/*
5304 + * Driver-specific socket ioctls
5305 + * used by BSD, Linux, and PSOS
5306 + * Broadcom BCM44XX 10/100Mbps Ethernet Device Driver
5307 + *
5308 + * Copyright 2001-2003, Broadcom Corporation
5309 + * All Rights Reserved.
5310 + *
5311 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
5312 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
5313 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
5314 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
5315 + *
5316 + * $Id$
5317 + */
5318 +
5319 +#ifndef _etsockio_h_
5320 +#define _etsockio_h_
5321 +
5322 +/* THESE MUST BE CONTIGUOUS AND CONSISTENT WITH VALUES IN ETC.H */
5323 +
5324 +
5325 +#if defined(linux)
5326 +#define SIOCSETCUP (SIOCDEVPRIVATE + 0)
5327 +#define SIOCSETCDOWN (SIOCDEVPRIVATE + 1)
5328 +#define SIOCSETCLOOP (SIOCDEVPRIVATE + 2)
5329 +#define SIOCGETCDUMP (SIOCDEVPRIVATE + 3)
5330 +#define SIOCSETCSETMSGLEVEL (SIOCDEVPRIVATE + 4)
5331 +#define SIOCSETCPROMISC (SIOCDEVPRIVATE + 5)
5332 +#define SIOCSETCTXDOWN (SIOCDEVPRIVATE + 6) /* obsolete */
5333 +#define SIOCSETCSPEED (SIOCDEVPRIVATE + 7)
5334 +#define SIOCTXGEN (SIOCDEVPRIVATE + 8)
5335 +#define SIOCGETCPHYRD (SIOCDEVPRIVATE + 9)
5336 +#define SIOCSETCPHYWR (SIOCDEVPRIVATE + 10)
5337 +#define SIOCPERF (SIOCDEVPRIVATE + 11)
5338 +#define SIOCPERFDMA (SIOCDEVPRIVATE + 12)
5339 +
5340 +#else /* !linux */
5341 +
5342 +#define SIOCSETCUP _IOWR('e', 130 + 0, struct ifreq)
5343 +#define SIOCSETCDOWN _IOWR('e', 130 + 1, struct ifreq)
5344 +#define SIOCSETCLOOP _IOWR('e', 130 + 2, struct ifreq)
5345 +#define SIOCGETCDUMP _IOWR('e', 130 + 3, struct ifreq)
5346 +#define SIOCSETCSETMSGLEVEL _IOWR('e', 130 + 4, struct ifreq)
5347 +#define SIOCSETCPROMISC _IOWR('e', 130 + 5, struct ifreq)
5348 +#define SIOCSETCTXDOWN _IOWR('e', 130 + 6, struct ifreq) /* obsolete */
5349 +#define SIOCSETCSPEED _IOWR('e', 130 + 7, struct ifreq)
5350 +#define SIOCTXGEN _IOWR('e', 130 + 8, struct ifreq)
5351 +
5352 +#endif
5353 +
5354 +/* arg to SIOCTXGEN */
5355 +struct txg {
5356 + uint32 num; /* number of frames to send */
5357 + uint32 delay; /* delay in microseconds between sending each */
5358 + uint32 size; /* size of ether frame to send */
5359 + uchar buf[1514]; /* starting ether frame data */
5360 +};
5361 +
5362 +#endif
5363 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/flash.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/flash.h
5364 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/flash.h 1970-01-01 01:00:00.000000000 +0100
5365 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/flash.h 2005-08-28 11:12:20.437858088 +0200
5366 @@ -0,0 +1,184 @@
5367 +/*
5368 + * flash.h: Common definitions for flash access.
5369 + *
5370 + * Copyright 2001-2003, Broadcom Corporation
5371 + * All Rights Reserved.
5372 + *
5373 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
5374 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
5375 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
5376 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
5377 + *
5378 + * $Id$
5379 + */
5380 +
5381 +/* Types of flashes we know about */
5382 +typedef enum _flash_type {OLD, BSC, SCS, AMD, SST} flash_type_t;
5383 +
5384 +/* Commands to write/erase the flases */
5385 +typedef struct _flash_cmds{
5386 + flash_type_t type;
5387 + bool need_unlock;
5388 + uint16 pre_erase;
5389 + uint16 erase_block;
5390 + uint16 erase_chip;
5391 + uint16 write_word;
5392 + uint16 write_buf;
5393 + uint16 clear_csr;
5394 + uint16 read_csr;
5395 + uint16 read_id;
5396 + uint16 confirm;
5397 + uint16 read_array;
5398 +} flash_cmds_t;
5399 +
5400 +#define UNLOCK_CMD_WORDS 2
5401 +
5402 +typedef struct _unlock_cmd {
5403 + uint addr[UNLOCK_CMD_WORDS];
5404 + uint16 cmd[UNLOCK_CMD_WORDS];
5405 +} unlock_cmd_t;
5406 +
5407 +/* Flash descriptors */
5408 +typedef struct _flash_desc {
5409 + uint16 mfgid; /* Manufacturer Id */
5410 + uint16 devid; /* Device Id */
5411 + uint size; /* Total size in bytes */
5412 + uint width; /* Device width in bytes */
5413 + flash_type_t type; /* Device type old, S, J */
5414 + uint bsize; /* Block size */
5415 + uint nb; /* Number of blocks */
5416 + uint ff; /* First full block */
5417 + uint lf; /* Last full block */
5418 + uint nsub; /* Number of subblocks */
5419 + uint *subblocks; /* Offsets for subblocks */
5420 + char *desc; /* Description */
5421 +} flash_desc_t;
5422 +
5423 +
5424 +#ifdef DECLARE_FLASHES
5425 +
5426 +flash_cmds_t flash_cmds[] = {
5427 +/* type needu preera eraseb erasech write wbuf clcsr rdcsr rdid confrm read */
5428 + { BSC, 0, 0x00, 0x20, 0x00, 0x40, 0x00, 0x50, 0x70, 0x90, 0xd0, 0xff },
5429 + { SCS, 0, 0x00, 0x20, 0x00, 0x40, 0xe8, 0x50, 0x70, 0x90, 0xd0, 0xff },
5430 + { AMD, 1, 0x80, 0x30, 0x10, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0xf0 },
5431 + { SST, 1, 0x80, 0x50, 0x10, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0xf0 },
5432 + { 0 }
5433 +};
5434 +
5435 +unlock_cmd_t unlock_cmd_amd = {
5436 +#ifdef MIPSEB
5437 +/* addr: */ { 0x0aa8, 0x0556},
5438 +#else
5439 +/* addr: */ { 0x0aaa, 0x0554},
5440 +#endif
5441 +/* data: */ { 0xaa, 0x55}
5442 +};
5443 +
5444 +unlock_cmd_t unlock_cmd_sst = {
5445 +#ifdef MIPSEB
5446 +/* addr: */ { 0xaaa8, 0x5556},
5447 +#else
5448 +/* addr: */ { 0xaaaa, 0x5554},
5449 +#endif
5450 +/* data: */ { 0xaa, 0x55}
5451 +};
5452 +
5453 +#define AMD_CMD 0xaaa
5454 +#define SST_CMD 0xaaaa
5455 +
5456 +/* intel unlock block cmds */
5457 +#define INTEL_UNLOCK1 0x60
5458 +#define INTEL_UNLOCK2 0xD0
5459 +
5460 +/* Just eight blocks of 8KB byte each */
5461 +
5462 +uint blk8x8k[] = { 0x00000000,
5463 + 0x00002000,
5464 + 0x00004000,
5465 + 0x00006000,
5466 + 0x00008000,
5467 + 0x0000a000,
5468 + 0x0000c000,
5469 + 0x0000e000,
5470 + 0x00010000
5471 +};
5472 +
5473 +/* Funky AMD arrangement for 29xx800's */
5474 +uint amd800[] = { 0x00000000, /* 16KB */
5475 + 0x00004000, /* 32KB */
5476 + 0x0000c000, /* 8KB */
5477 + 0x0000e000, /* 8KB */
5478 + 0x00010000, /* 8KB */
5479 + 0x00012000, /* 8KB */
5480 + 0x00014000, /* 32KB */
5481 + 0x0001c000, /* 16KB */
5482 + 0x00020000
5483 +};
5484 +
5485 +/* AMD arrangement for 29xx160's */
5486 +uint amd4112[] = { 0x00000000, /* 32KB */
5487 + 0x00008000, /* 8KB */
5488 + 0x0000a000, /* 8KB */
5489 + 0x0000c000, /* 16KB */
5490 + 0x00010000
5491 +};
5492 +uint amd2114[] = { 0x00000000, /* 16KB */
5493 + 0x00004000, /* 8KB */
5494 + 0x00006000, /* 8KB */
5495 + 0x00008000, /* 32KB */
5496 + 0x00010000
5497 +};
5498 +
5499 +
5500 +
5501 +flash_desc_t flashes[] = {
5502 + { 0x00b0, 0x00d0, 0x0200000, 2, SCS, 0x10000, 32, 0, 31, 0, NULL, "Intel 28F160S3/5 1Mx16" },
5503 + { 0x00b0, 0x00d4, 0x0400000, 2, SCS, 0x10000, 64, 0, 63, 0, NULL, "Intel 28F320S3/5 2Mx16" },
5504 + { 0x0089, 0x8890, 0x0200000, 2, BSC, 0x10000, 32, 0, 30, 8, blk8x8k, "Intel 28F160B3 1Mx16 TopB" },
5505 + { 0x0089, 0x8891, 0x0200000, 2, BSC, 0x10000, 32, 1, 31, 8, blk8x8k, "Intel 28F160B3 1Mx16 BotB" },
5506 + { 0x0089, 0x8896, 0x0400000, 2, BSC, 0x10000, 64, 0, 62, 8, blk8x8k, "Intel 28F320B3 2Mx16 TopB" },
5507 + { 0x0089, 0x8897, 0x0400000, 2, BSC, 0x10000, 64, 1, 63, 8, blk8x8k, "Intel 28F320B3 2Mx16 BotB" },
5508 + { 0x0089, 0x8898, 0x0800000, 2, BSC, 0x10000, 128, 0, 126, 8, blk8x8k, "Intel 28F640B3 4Mx16 TopB" },
5509 + { 0x0089, 0x8899, 0x0800000, 2, BSC, 0x10000, 128, 1, 127, 8, blk8x8k, "Intel 28F640B3 4Mx16 BotB" },
5510 + { 0x0089, 0x88C2, 0x0200000, 2, BSC, 0x10000, 32, 0, 30, 8, blk8x8k, "Intel 28F160C3 1Mx16 TopB" },
5511 + { 0x0089, 0x88C3, 0x0200000, 2, BSC, 0x10000, 32, 1, 31, 8, blk8x8k, "Intel 28F160C3 1Mx16 BotB" },
5512 + { 0x0089, 0x88C4, 0x0400000, 2, BSC, 0x10000, 64, 0, 62, 8, blk8x8k, "Intel 28F320C3 2Mx16 TopB" },
5513 + { 0x0089, 0x88C5, 0x0400000, 2, BSC, 0x10000, 64, 1, 63, 8, blk8x8k, "Intel 28F320C3 2Mx16 BotB" },
5514 + { 0x0089, 0x88CC, 0x0800000, 2, BSC, 0x10000, 128, 0, 126, 8, blk8x8k, "Intel 28F640C3 4Mx16 TopB" },
5515 + { 0x0089, 0x88CD, 0x0800000, 2, BSC, 0x10000, 128, 1, 127, 8, blk8x8k, "Intel 28F640C3 4Mx16 BotB" },
5516 + { 0x0089, 0x0014, 0x0400000, 2, SCS, 0x20000, 32, 0, 31, 0, NULL, "Intel 28F320J5 2Mx16" },
5517 + { 0x0089, 0x0015, 0x0800000, 2, SCS, 0x20000, 64, 0, 63, 0, NULL, "Intel 28F640J5 4Mx16" },
5518 + { 0x0089, 0x0016, 0x0400000, 2, SCS, 0x20000, 32, 0, 31, 0, NULL, "Intel 28F320J3 2Mx16" },
5519 + { 0x0089, 0x0017, 0x0800000, 2, SCS, 0x20000, 64, 0, 63, 0, NULL, "Intel 28F640J3 4Mx16" },
5520 + { 0x0089, 0x0018, 0x1000000, 2, SCS, 0x20000, 128, 0, 127, 0, NULL, "Intel 28F128J3 8Mx16" },
5521 + { 0x00b0, 0x00e3, 0x0400000, 2, BSC, 0x10000, 64, 1, 63, 8, blk8x8k, "Sharp 28F320BJE 2Mx16 BotB" },
5522 + { 0x0001, 0x224a, 0x0100000, 2, AMD, 0x10000, 16, 0, 13, 8, amd800, "AMD 29DL800BT 512Kx16 TopB" },
5523 + { 0x0001, 0x22cb, 0x0100000, 2, AMD, 0x10000, 16, 2, 15, 8, amd800, "AMD 29DL800BB 512Kx16 BotB" },
5524 + { 0x0001, 0x22c4, 0x0200000, 2, AMD, 0x10000, 32, 0, 30, 4, amd2114, "AMD 29lv160DT 1Mx16 TopB" },
5525 + { 0x0001, 0x2249, 0x0200000, 2, AMD, 0x10000, 32, 1, 31, 4, amd4112, "AMD 29lv160DB 1Mx16 BotB" },
5526 + { 0x0001, 0x22f6, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 8, blk8x8k, "AMD 29lv320DT 2Mx16 TopB" },
5527 + { 0x0001, 0x22f9, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 8, blk8x8k, "AMD 29lv320DB 2Mx16 BotB" },
5528 + { 0x0001, 0x2201, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 8, blk8x8k, "AMD 29lv320MT 2Mx16 TopB" },
5529 + { 0x0001, 0x2200, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 8, blk8x8k, "AMD 29lv320MB 2Mx16 BotB" },
5530 + { 0x0020, 0x22CA, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 4, amd4112, "ST 29w320DT 2Mx16 TopB" },
5531 + { 0x0020, 0x22CB, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 4, amd2114, "ST 29w320DB 2Mx16 BotB" },
5532 + { 0x00C2, 0x00A7, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 4, amd4112, "MX29LV320T 2Mx16 TopB" },
5533 + { 0x00C2, 0x00A8, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 4, amd2114, "MX29LV320B 2Mx16 BotB" },
5534 + { 0x0004, 0x22F6, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 4, amd4112, "MBM29LV320TE 2Mx16 TopB" },
5535 + { 0x0004, 0x22F9, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 4, amd2114, "MBM29LV320BE 2Mx16 BotB" },
5536 + { 0x0098, 0x009A, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 4, amd4112, "TC58FVT321 2Mx16 TopB" },
5537 + { 0x0098, 0x009C, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 4, amd2114, "TC58FVB321 2Mx16 BotB" },
5538 + { 0x00C2, 0x22A7, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 4, amd4112, "MX29LV320T 2Mx16 TopB" },
5539 + { 0x00C2, 0x22A8, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 4, amd2114, "MX29LV320B 2Mx16 BotB" },
5540 + { 0x00BF, 0x2783, 0x0400000, 2, SST, 0x10000, 64, 0, 63, 0, NULL, "SST39VF320 2Mx16" },
5541 + { 0, 0, 0, 0, OLD, 0, 0, 0, 0, 0, NULL, NULL },
5542 +};
5543 +
5544 +#else
5545 +
5546 +extern flash_cmds_t flash_cmds[];
5547 +extern unlock_cmd_t unlock_cmd;
5548 +extern flash_desc_t flashes[];
5549 +
5550 +#endif
5551 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/flashutl.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/flashutl.h
5552 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/flashutl.h 1970-01-01 01:00:00.000000000 +0100
5553 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/flashutl.h 2005-08-28 11:12:20.437858088 +0200
5554 @@ -0,0 +1,34 @@
5555 +/*
5556 + * BCM47XX FLASH driver interface
5557 + *
5558 + * Copyright 2001-2003, Broadcom Corporation
5559 + * All Rights Reserved.
5560 + *
5561 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
5562 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
5563 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
5564 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
5565 + * $Id$
5566 + */
5567 +
5568 +#ifndef _flashutl_h_
5569 +#define _flashutl_h_
5570 +
5571 +#define FLASH_BASE 0xbfc00000 /* BCM4710 */
5572 +
5573 +int flash_init(void* base_addr, char *flash_str);
5574 +int flash_erase(void);
5575 +int flash_eraseblk(unsigned long off);
5576 +int flash_write(unsigned long off, uint16 *src, uint nbytes);
5577 +unsigned long flash_block_base(unsigned long off);
5578 +unsigned long flash_block_lim(unsigned long off);
5579 +int FlashWriteRange(unsigned short* dst, unsigned short* src, unsigned int numbytes);
5580 +
5581 +void nvWrite(unsigned short *data, unsigned int len);
5582 +
5583 +/* Global vars */
5584 +extern char* flashutl_base;
5585 +extern flash_desc_t* flashutl_desc;
5586 +extern flash_cmds_t* flashutl_cmd;
5587 +
5588 +#endif /* _flashutl_h_ */
5589 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/hnddma.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/hnddma.h
5590 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/hnddma.h 1970-01-01 01:00:00.000000000 +0100
5591 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/hnddma.h 2005-08-28 11:12:20.438857936 +0200
5592 @@ -0,0 +1,181 @@
5593 +/*
5594 + * Generic Broadcom Home Networking Division (HND) DMA engine definitions.
5595 + * This supports the following chips: BCM42xx, 44xx, 47xx .
5596 + *
5597 + * $Id$
5598 + * Copyright 2001-2003, Broadcom Corporation
5599 + * All Rights Reserved.
5600 + *
5601 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
5602 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
5603 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
5604 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
5605 + */
5606 +
5607 +#ifndef _hnddma_h_
5608 +#define _hnddma_h_
5609 +
5610 +/*
5611 + * Each DMA processor consists of a transmit channel and a receive channel.
5612 + */
5613 +typedef volatile struct {
5614 + /* transmit channel */
5615 + uint32 xmtcontrol; /* enable, et al */
5616 + uint32 xmtaddr; /* descriptor ring base address (4K aligned) */
5617 + uint32 xmtptr; /* last descriptor posted to chip */
5618 + uint32 xmtstatus; /* current active descriptor, et al */
5619 +
5620 + /* receive channel */
5621 + uint32 rcvcontrol; /* enable, et al */
5622 + uint32 rcvaddr; /* descriptor ring base address (4K aligned) */
5623 + uint32 rcvptr; /* last descriptor posted to chip */
5624 + uint32 rcvstatus; /* current active descriptor, et al */
5625 +} dmaregs_t;
5626 +
5627 +typedef volatile struct {
5628 + /* diag access */
5629 + uint32 fifoaddr; /* diag address */
5630 + uint32 fifodatalow; /* low 32bits of data */
5631 + uint32 fifodatahigh; /* high 32bits of data */
5632 + uint32 pad; /* reserved */
5633 +} dmafifo_t;
5634 +
5635 +/* transmit channel control */
5636 +#define XC_XE ((uint32)1 << 0) /* transmit enable */
5637 +#define XC_SE ((uint32)1 << 1) /* transmit suspend request */
5638 +#define XC_LE ((uint32)1 << 2) /* loopback enable */
5639 +#define XC_FL ((uint32)1 << 4) /* flush request */
5640 +
5641 +/* transmit descriptor table pointer */
5642 +#define XP_LD_MASK 0xfff /* last valid descriptor */
5643 +
5644 +/* transmit channel status */
5645 +#define XS_CD_MASK 0x0fff /* current descriptor pointer */
5646 +#define XS_XS_MASK 0xf000 /* transmit state */
5647 +#define XS_XS_SHIFT 12
5648 +#define XS_XS_DISABLED 0x0000 /* disabled */
5649 +#define XS_XS_ACTIVE 0x1000 /* active */
5650 +#define XS_XS_IDLE 0x2000 /* idle wait */
5651 +#define XS_XS_STOPPED 0x3000 /* stopped */
5652 +#define XS_XS_SUSP 0x4000 /* suspend pending */
5653 +#define XS_XE_MASK 0xf0000 /* transmit errors */
5654 +#define XS_XE_SHIFT 16
5655 +#define XS_XE_NOERR 0x00000 /* no error */
5656 +#define XS_XE_DPE 0x10000 /* descriptor protocol error */
5657 +#define XS_XE_DFU 0x20000 /* data fifo underrun */
5658 +#define XS_XE_BEBR 0x30000 /* bus error on buffer read */
5659 +#define XS_XE_BEDA 0x40000 /* bus error on descriptor access */
5660 +#define XS_FL ((uint32)1 << 20) /* flushed */
5661 +
5662 +/* receive channel control */
5663 +#define RC_RE ((uint32)1 << 0) /* receive enable */
5664 +#define RC_RO_MASK 0xfe /* receive frame offset */
5665 +#define RC_RO_SHIFT 1
5666 +#define RC_FM ((uint32)1 << 8) /* direct fifo receive (pio) mode */
5667 +
5668 +/* receive descriptor table pointer */
5669 +#define RP_LD_MASK 0xfff /* last valid descriptor */
5670 +
5671 +/* receive channel status */
5672 +#define RS_CD_MASK 0x0fff /* current descriptor pointer */
5673 +#define RS_RS_MASK 0xf000 /* receive state */
5674 +#define RS_RS_SHIFT 12
5675 +#define RS_RS_DISABLED 0x0000 /* disabled */
5676 +#define RS_RS_ACTIVE 0x1000 /* active */
5677 +#define RS_RS_IDLE 0x2000 /* idle wait */
5678 +#define RS_RS_STOPPED 0x3000 /* reserved */
5679 +#define RS_RE_MASK 0xf0000 /* receive errors */
5680 +#define RS_RE_SHIFT 16
5681 +#define RS_RE_NOERR 0x00000 /* no error */
5682 +#define RS_RE_DPE 0x10000 /* descriptor protocol error */
5683 +#define RS_RE_DFO 0x20000 /* data fifo overflow */
5684 +#define RS_RE_BEBW 0x30000 /* bus error on buffer write */
5685 +#define RS_RE_BEDA 0x40000 /* bus error on descriptor access */
5686 +
5687 +/* fifoaddr */
5688 +#define FA_OFF_MASK 0xffff /* offset */
5689 +#define FA_SEL_MASK 0xf0000 /* select */
5690 +#define FA_SEL_SHIFT 16
5691 +#define FA_SEL_XDD 0x00000 /* transmit dma data */
5692 +#define FA_SEL_XDP 0x10000 /* transmit dma pointers */
5693 +#define FA_SEL_RDD 0x40000 /* receive dma data */
5694 +#define FA_SEL_RDP 0x50000 /* receive dma pointers */
5695 +#define FA_SEL_XFD 0x80000 /* transmit fifo data */
5696 +#define FA_SEL_XFP 0x90000 /* transmit fifo pointers */
5697 +#define FA_SEL_RFD 0xc0000 /* receive fifo data */
5698 +#define FA_SEL_RFP 0xd0000 /* receive fifo pointers */
5699 +
5700 +/*
5701 + * DMA Descriptor
5702 + * Descriptors are only read by the hardware, never written back.
5703 + */
5704 +typedef volatile struct {
5705 + uint32 ctrl; /* misc control bits & bufcount */
5706 + uint32 addr; /* data buffer address */
5707 +} dmadd_t;
5708 +
5709 +/*
5710 + * Each descriptor ring must be 4096byte aligned
5711 + * and fit within a single 4096byte page.
5712 + */
5713 +#define DMAMAXRINGSZ 4096
5714 +#define DMARINGALIGN 4096
5715 +
5716 +/* control flags */
5717 +#define CTRL_BC_MASK 0x1fff /* buffer byte count */
5718 +#define CTRL_EOT ((uint32)1 << 28) /* end of descriptor table */
5719 +#define CTRL_IOC ((uint32)1 << 29) /* interrupt on completion */
5720 +#define CTRL_EOF ((uint32)1 << 30) /* end of frame */
5721 +#define CTRL_SOF ((uint32)1 << 31) /* start of frame */
5722 +
5723 +/* control flags in the range [27:20] are core-specific and not defined here */
5724 +#define CTRL_CORE_MASK 0x0ff00000
5725 +
5726 +/* export structure */
5727 +typedef volatile struct {
5728 + /* rx error counters */
5729 + uint rxgiants; /* rx giant frames */
5730 + uint rxnobuf; /* rx out of dma descriptors */
5731 + /* tx error counters */
5732 + uint txnobuf; /* tx out of dma descriptors */
5733 +} hnddma_t;
5734 +
5735 +#ifndef di_t
5736 +#define di_t void
5737 +#endif
5738 +
5739 +/* externs */
5740 +extern void *dma_attach(void *drv, void *dev, char *name, dmaregs_t *dmaregs,
5741 + uint ntxd, uint nrxd, uint rxbufsize, uint nrxpost, uint rxoffset,
5742 + uint ddoffset, uint dataoffset, uint *msg_level);
5743 +extern void dma_detach(di_t *di);
5744 +extern void dma_txreset(di_t *di);
5745 +extern void dma_rxreset(di_t *di);
5746 +extern void dma_txinit(di_t *di);
5747 +extern bool dma_txenabled(di_t *di);
5748 +extern void dma_rxinit(di_t *di);
5749 +extern void dma_rxenable(di_t *di);
5750 +extern bool dma_rxenabled(di_t *di);
5751 +extern void dma_txsuspend(di_t *di);
5752 +extern void dma_txresume(di_t *di);
5753 +extern bool dma_txsuspended(di_t *di);
5754 +extern bool dma_txstopped(di_t *di);
5755 +extern bool dma_rxstopped(di_t *di);
5756 +extern int dma_txfast(di_t *di, void *p, uint32 coreflags);
5757 +extern int dma_tx(di_t *di, void *p, uint32 coreflags);
5758 +extern void dma_fifoloopbackenable(di_t *di);
5759 +extern void *dma_rx(di_t *di);
5760 +extern void dma_rxfill(di_t *di);
5761 +extern void dma_txreclaim(di_t *di, bool forceall);
5762 +extern void dma_rxreclaim(di_t *di);
5763 +extern char *dma_dump(di_t *di, char *buf);
5764 +extern char *dma_dumptx(di_t *di, char *buf);
5765 +extern char *dma_dumprx(di_t *di, char *buf);
5766 +extern uint dma_getvar(di_t *di, char *name);
5767 +extern void *dma_getnexttxp(di_t *di, bool forceall);
5768 +extern void *dma_getnextrxp(di_t *di, bool forceall);
5769 +extern void dma_txblock(di_t *di);
5770 +extern void dma_txunblock(di_t *di);
5771 +extern uint dma_txactive(di_t *di);
5772 +
5773 +#endif /* _hnddma_h_ */
5774 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/hndmips.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/hndmips.h
5775 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/hndmips.h 1970-01-01 01:00:00.000000000 +0100
5776 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/hndmips.h 2005-08-28 11:12:20.439857784 +0200
5777 @@ -0,0 +1,16 @@
5778 +/*
5779 + * Alternate include file for HND sbmips.h since CFE also ships with
5780 + * a sbmips.h.
5781 + *
5782 + * Copyright 2001-2003, Broadcom Corporation
5783 + * All Rights Reserved.
5784 + *
5785 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
5786 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
5787 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
5788 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
5789 + *
5790 + * $Id$
5791 + */
5792 +
5793 +#include "sbmips.h"
5794 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/linux_osl.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/linux_osl.h
5795 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/linux_osl.h 1970-01-01 01:00:00.000000000 +0100
5796 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/linux_osl.h 2005-08-28 11:12:20.440857632 +0200
5797 @@ -0,0 +1,313 @@
5798 +/*
5799 + * Linux OS Independent Layer
5800 + *
5801 + * Copyright 2001-2003, Broadcom Corporation
5802 + * All Rights Reserved.
5803 + *
5804 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
5805 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
5806 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
5807 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
5808 + *
5809 + * $Id$
5810 + */
5811 +
5812 +#ifndef _linux_osl_h_
5813 +#define _linux_osl_h_
5814 +
5815 +#include <typedefs.h>
5816 +
5817 +/* use current 2.4.x calling conventions */
5818 +#include <linuxver.h>
5819 +
5820 +/* assert and panic */
5821 +#define ASSERT(exp) do {} while (0)
5822 +
5823 +/* PCMCIA attribute space access macros */
5824 +#define OSL_PCMCIA_READ_ATTR(osh, offset, buf, size) \
5825 + osl_pcmcia_read_attr((osh), (offset), (buf), (size))
5826 +#define OSL_PCMCIA_WRITE_ATTR(osh, offset, buf, size) \
5827 + osl_pcmcia_write_attr((osh), (offset), (buf), (size))
5828 +extern void osl_pcmcia_read_attr(void *osh, uint offset, void *buf, int size);
5829 +extern void osl_pcmcia_write_attr(void *osh, uint offset, void *buf, int size);
5830 +
5831 +/* PCI configuration space access macros */
5832 +#define OSL_PCI_READ_CONFIG(loc, offset, size) \
5833 + osl_pci_read_config((loc), (offset), (size))
5834 +#define OSL_PCI_WRITE_CONFIG(loc, offset, size, val) \
5835 + osl_pci_write_config((loc), (offset), (size), (val))
5836 +extern uint32 osl_pci_read_config(void *loc, uint size, uint offset);
5837 +extern void osl_pci_write_config(void *loc, uint offset, uint size, uint val);
5838 +
5839 +/* OSL initialization */
5840 +#define osl_init() do {} while (0)
5841 +
5842 +/* host/bus architecture-specific byte swap */
5843 +#define BUS_SWAP32(v) (v)
5844 +
5845 +/*
5846 + * BINOSL selects the slightly slower function-call-based binary compatible osl.
5847 + * Macros expand to calls to functions defined in linux_osl.c .
5848 + */
5849 +#ifndef BINOSL
5850 +
5851 +/* string library, kernel mode */
5852 +#define printf(fmt, args...) printk(fmt, ## args)
5853 +#include <linux/kernel.h>
5854 +#include <linux/string.h>
5855 +
5856 +/* register access macros */
5857 +#define R_REG(r) ({ \
5858 + __typeof(*(r)) __osl_v; \
5859 + switch (sizeof(*(r))) { \
5860 + case sizeof(uint8): __osl_v = readb((volatile uint8*)(r)); break; \
5861 + case sizeof(uint16): __osl_v = readw((volatile uint16*)(r)); break; \
5862 + case sizeof(uint32): __osl_v = readl((volatile uint32*)(r)); break; \
5863 + } \
5864 + __osl_v; \
5865 +})
5866 +#define W_REG(r, v) do { \
5867 + switch (sizeof(*(r))) { \
5868 + case sizeof(uint8): writeb((uint8)(v), (volatile uint8*)(r)); break; \
5869 + case sizeof(uint16): writew((uint16)(v), (volatile uint16*)(r)); break; \
5870 + case sizeof(uint32): writel((uint32)(v), (volatile uint32*)(r)); break; \
5871 + } \
5872 +} while (0)
5873 +
5874 +#define AND_REG(r, v) W_REG((r), R_REG(r) & (v))
5875 +#define OR_REG(r, v) W_REG((r), R_REG(r) | (v))
5876 +
5877 +/* bcopy, bcmp, and bzero */
5878 +#define bcopy(src, dst, len) memcpy((dst), (src), (len))
5879 +#define bcmp(b1, b2, len) memcmp((b1), (b2), (len))
5880 +#define bzero(b, len) memset((b), '\0', (len))
5881 +
5882 +/* general purpose memory allocation */
5883 +#define MALLOC(size) kmalloc((size), GFP_ATOMIC)
5884 +#define MFREE(addr, size) kfree((addr))
5885 +
5886 +/* uncached virtual address */
5887 +#ifdef mips
5888 +#define OSL_UNCACHED(va) KSEG1ADDR((va))
5889 +#include <asm/addrspace.h>
5890 +#else
5891 +#define OSL_UNCACHED(va) (va)
5892 +#endif
5893 +
5894 +/* get processor cycle count */
5895 +#if defined(mips)
5896 +#define OSL_GETCYCLES(x) ((x) = read_c0_count() * 2)
5897 +#elif defined(__i386__)
5898 +#define OSL_GETCYCLES(x) rdtscl((x))
5899 +#else
5900 +#define OSL_GETCYCLES(x) ((x) = 0)
5901 +#endif
5902 +
5903 +/* dereference an address that may cause a bus exception */
5904 +#ifdef mips
5905 +#if defined(MODULE) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,17))
5906 +#define BUSPROBE(val, addr) panic("get_dbe() will not fixup a bus exception when compiled into a module")
5907 +#else
5908 +#define BUSPROBE(val, addr) get_dbe((val), (addr))
5909 +#include <asm/paccess.h>
5910 +#endif
5911 +#else
5912 +#define BUSPROBE(val, addr) ({ (val) = R_REG((addr)); 0; })
5913 +#endif
5914 +
5915 +/* map/unmap physical to virtual I/O */
5916 +#define REG_MAP(pa, size) ioremap_nocache((unsigned long)(pa), (unsigned long)(size))
5917 +#define REG_UNMAP(va) iounmap((void *)(va))
5918 +
5919 +/* allocate/free shared (dma-able) consistent (uncached) memory */
5920 +#define DMA_ALLOC_CONSISTENT(dev, size, pap) \
5921 + pci_alloc_consistent((dev), (size), (dma_addr_t*)(pap))
5922 +#define DMA_FREE_CONSISTENT(dev, va, size, pa) \
5923 + pci_free_consistent((dev), (size), (va), (dma_addr_t)(pa))
5924 +
5925 +/* map/unmap direction */
5926 +#define DMA_TX PCI_DMA_TODEVICE
5927 +#define DMA_RX PCI_DMA_FROMDEVICE
5928 +
5929 +/* map/unmap shared (dma-able) memory */
5930 +#define DMA_MAP(dev, va, size, direction, p) \
5931 + pci_map_single((dev), (va), (size), (direction))
5932 +#define DMA_UNMAP(dev, pa, size, direction, p) \
5933 + pci_unmap_single((dev), (dma_addr_t)(pa), (size), (direction))
5934 +
5935 +/* microsecond delay */
5936 +#define OSL_DELAY(usec) udelay(usec)
5937 +#include <linux/delay.h>
5938 +#define OSL_SLEEP(usec) set_current_state(TASK_INTERRUPTIBLE); \
5939 + schedule_timeout((usec*HZ)/1000000);
5940 +#define OSL_IN_INTERRUPT() in_interrupt()
5941 +
5942 +/* shared (dma-able) memory access macros */
5943 +#define R_SM(r) *(r)
5944 +#define W_SM(r, v) (*(r) = (v))
5945 +#define BZERO_SM(r, len) memset((r), '\0', (len))
5946 +
5947 +/* packet primitives */
5948 +#define PKTGET(drv, len, send) osl_pktget((drv), (len), (send))
5949 +#define PKTFREE(drv, skb, send) osl_pktfree((skb))
5950 +#define PKTDATA(drv, skb) (((struct sk_buff*)(skb))->data)
5951 +#define PKTLEN(drv, skb) (((struct sk_buff*)(skb))->len)
5952 +#define PKTHEADROOM(drv, skb) (PKTDATA(drv,skb)-(((struct sk_buff*)(skb))->head))
5953 +#define PKTTAILROOM(drv, skb) ((((struct sk_buff*)(skb))->end)-(((struct sk_buff*)(skb))->tail))
5954 +#define PKTNEXT(drv, skb) (((struct sk_buff*)(skb))->next)
5955 +#define PKTSETNEXT(skb, x) (((struct sk_buff*)(skb))->next = (struct sk_buff*)(x))
5956 +#define PKTSETLEN(drv, skb, len) __skb_trim((struct sk_buff*)(skb), (len))
5957 +#define PKTPUSH(drv, skb, bytes) skb_push((struct sk_buff*)(skb), (bytes))
5958 +#define PKTPULL(drv, skb, bytes) skb_pull((struct sk_buff*)(skb), (bytes))
5959 +#define PKTDUP(drv, skb) skb_clone((struct sk_buff*)(skb), GFP_ATOMIC)
5960 +#define PKTCOOKIE(skb) ((void*)((struct sk_buff*)(skb))->csum)
5961 +#define PKTSETCOOKIE(skb, x) (((struct sk_buff*)(skb))->csum = (uint)(x))
5962 +#define PKTLINK(skb) (((struct sk_buff*)(skb))->prev)
5963 +#define PKTSETLINK(skb, x) (((struct sk_buff*)(skb))->prev = (struct sk_buff*)(x))
5964 +extern void *osl_pktget(void *drv, uint len, bool send);
5965 +extern void osl_pktfree(void *skb);
5966 +
5967 +#else /* BINOSL */
5968 +
5969 +/* string library */
5970 +#ifndef LINUX_OSL
5971 +#undef printf
5972 +#define printf(fmt, args...) osl_printf((fmt), ## args)
5973 +#undef sprintf
5974 +#define sprintf(buf, fmt, args...) osl_sprintf((buf), (fmt), ## args)
5975 +#undef strcmp
5976 +#define strcmp(s1, s2) osl_strcmp((s1), (s2))
5977 +#undef strncmp
5978 +#define strncmp(s1, s2, n) osl_strncmp((s1), (s2), (n))
5979 +#undef strlen
5980 +#define strlen(s) osl_strlen((s))
5981 +#undef strcpy
5982 +#define strcpy(d, s) osl_strcpy((d), (s))
5983 +#undef strncpy
5984 +#define strncpy(d, s, n) osl_strncpy((d), (s), (n))
5985 +#endif
5986 +extern int osl_printf(const char *format, ...);
5987 +extern int osl_sprintf(char *buf, const char *format, ...);
5988 +extern int osl_strcmp(const char *s1, const char *s2);
5989 +extern int osl_strncmp(const char *s1, const char *s2, uint n);
5990 +extern int osl_strlen(char *s);
5991 +extern char* osl_strcpy(char *d, const char *s);
5992 +extern char* osl_strncpy(char *d, const char *s, uint n);
5993 +
5994 +/* register access macros */
5995 +#define R_REG(r) ({ \
5996 + __typeof(*(r)) __osl_v; \
5997 + switch (sizeof(*(r))) { \
5998 + case sizeof(uint8): __osl_v = osl_readb((volatile uint8*)(r)); break; \
5999 + case sizeof(uint16): __osl_v = osl_readw((volatile uint16*)(r)); break; \
6000 + case sizeof(uint32): __osl_v = osl_readl((volatile uint32*)(r)); break; \
6001 + } \
6002 + __osl_v; \
6003 +})
6004 +#define W_REG(r, v) do { \
6005 + switch (sizeof(*(r))) { \
6006 + case sizeof(uint8): osl_writeb((uint8)(v), (volatile uint8*)(r)); break; \
6007 + case sizeof(uint16): osl_writew((uint16)(v), (volatile uint16*)(r)); break; \
6008 + case sizeof(uint32): osl_writel((uint32)(v), (volatile uint32*)(r)); break; \
6009 + } \
6010 +} while (0)
6011 +#define AND_REG(r, v) W_REG((r), R_REG(r) & (v))
6012 +#define OR_REG(r, v) W_REG((r), R_REG(r) | (v))
6013 +extern uint8 osl_readb(volatile uint8 *r);
6014 +extern uint16 osl_readw(volatile uint16 *r);
6015 +extern uint32 osl_readl(volatile uint32 *r);
6016 +extern void osl_writeb(uint8 v, volatile uint8 *r);
6017 +extern void osl_writew(uint16 v, volatile uint16 *r);
6018 +extern void osl_writel(uint32 v, volatile uint32 *r);
6019 +
6020 +/* bcopy, bcmp, and bzero */
6021 +extern void bcopy(const void *src, void *dst, int len);
6022 +extern int bcmp(const void *b1, const void *b2, int len);
6023 +extern void bzero(void *b, int len);
6024 +
6025 +/* general purpose memory allocation */
6026 +#define MALLOC(size) osl_malloc((size))
6027 +#define MFREE(addr, size) osl_mfree((char*)(addr), (size))
6028 +extern void *osl_malloc(uint size);
6029 +extern void osl_mfree(void *addr, uint size);
6030 +
6031 +/* uncached virtual address */
6032 +#define OSL_UNCACHED(va) osl_uncached((va))
6033 +extern void *osl_uncached(void *va);
6034 +
6035 +/* get processor cycle count */
6036 +#define OSL_GETCYCLES(x) ((x) = osl_getcycles())
6037 +extern uint osl_getcycles(void);
6038 +
6039 +/* dereference an address that may target abort */
6040 +#define BUSPROBE(val, addr) osl_busprobe(&(val), (addr))
6041 +extern int osl_busprobe(uint32 *val, uint32 addr);
6042 +
6043 +/* map/unmap physical to virtual */
6044 +#define REG_MAP(pa, size) osl_reg_map((pa), (size))
6045 +#define REG_UNMAP(va) osl_reg_unmap((va))
6046 +extern void *osl_reg_map(uint32 pa, uint size);
6047 +extern void osl_reg_unmap(void *va);
6048 +
6049 +/* allocate/free shared (dma-able) consistent (uncached) memory */
6050 +#define DMA_ALLOC_CONSISTENT(dev, size, pap) \
6051 + osl_dma_alloc_consistent((dev), (size), (pap))
6052 +#define DMA_FREE_CONSISTENT(dev, va, size, pa) \
6053 + osl_dma_free_consistent((dev), (void*)(va), (size), (pa))
6054 +extern void *osl_dma_alloc_consistent(void *dev, uint size, ulong *pap);
6055 +extern void osl_dma_free_consistent(void *dev, void *va, uint size, ulong pa);
6056 +
6057 +/* map/unmap direction */
6058 +#define DMA_TX 1
6059 +#define DMA_RX 2
6060 +
6061 +/* map/unmap shared (dma-able) memory */
6062 +#define DMA_MAP(dev, va, size, direction, p) \
6063 + osl_dma_map((dev), (va), (size), (direction))
6064 +#define DMA_UNMAP(dev, pa, size, direction, p) \
6065 + osl_dma_unmap((dev), (pa), (size), (direction))
6066 +extern uint osl_dma_map(void *dev, void *va, uint size, int direction);
6067 +extern void osl_dma_unmap(void *dev, uint pa, uint size, int direction);
6068 +
6069 +/* microsecond delay */
6070 +#define OSL_DELAY(usec) osl_delay((usec))
6071 +extern void osl_delay(uint usec);
6072 +
6073 +/* shared (dma-able) memory access macros */
6074 +#define R_SM(r) *(r)
6075 +#define W_SM(r, v) (*(r) = (v))
6076 +#define BZERO_SM(r, len) bzero((r), (len))
6077 +
6078 +/* packet primitives */
6079 +#define PKTGET(drv, len, send) osl_pktget((drv), (len), (send))
6080 +#define PKTFREE(drv, skb, send) osl_pktfree((skb))
6081 +#define PKTDATA(drv, skb) osl_pktdata((drv), (skb))
6082 +#define PKTLEN(drv, skb) osl_pktlen((drv), (skb))
6083 +#define PKTNEXT(drv, skb) osl_pktnext((drv), (skb))
6084 +#define PKTSETNEXT(skb, x) osl_pktsetnext((skb), (x))
6085 +#define PKTSETLEN(drv, skb, len) osl_pktsetlen((drv), (skb), (len))
6086 +#define PKTPUSH(drv, skb, bytes) osl_pktpush((drv), (skb), (bytes))
6087 +#define PKTPULL(drv, skb, bytes) osl_pktpull((drv), (skb), (bytes))
6088 +#define PKTDUP(drv, skb) osl_pktdup((drv), (skb))
6089 +#define PKTCOOKIE(skb) osl_pktcookie((skb))
6090 +#define PKTSETCOOKIE(skb, x) osl_pktsetcookie((skb), (x))
6091 +#define PKTLINK(skb) osl_pktlink((skb))
6092 +#define PKTSETLINK(skb, x) osl_pktsetlink((skb), (x))
6093 +extern void *osl_pktget(void *drv, uint len, bool send);
6094 +extern void osl_pktfree(void *skb);
6095 +extern uchar *osl_pktdata(void *drv, void *skb);
6096 +extern uint osl_pktlen(void *drv, void *skb);
6097 +extern void *osl_pktnext(void *drv, void *skb);
6098 +extern void osl_pktsetnext(void *skb, void *x);
6099 +extern void osl_pktsetlen(void *drv, void *skb, uint len);
6100 +extern uchar *osl_pktpush(void *drv, void *skb, int bytes);
6101 +extern uchar *osl_pktpull(void *drv, void *skb, int bytes);
6102 +extern void *osl_pktdup(void *drv, void *skb);
6103 +extern void *osl_pktcookie(void *skb);
6104 +extern void osl_pktsetcookie(void *skb, void *x);
6105 +extern void *osl_pktlink(void *skb);
6106 +extern void osl_pktsetlink(void *skb, void *x);
6107 +
6108 +#endif /* BINOSL */
6109 +
6110 +#endif /* _linux_osl_h_ */
6111 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/linuxver.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/linuxver.h
6112 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/linuxver.h 1970-01-01 01:00:00.000000000 +0100
6113 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/linuxver.h 2005-08-28 11:12:20.441857480 +0200
6114 @@ -0,0 +1,326 @@
6115 +/*
6116 + * Linux-specific abstractions to gain some independence from linux kernel versions.
6117 + * Pave over some 2.2 versus 2.4 kernel differences.
6118 + *
6119 + * Copyright 2001-2003, Broadcom Corporation
6120 + * All Rights Reserved.
6121 + *
6122 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
6123 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
6124 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
6125 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
6126 + * $Id$
6127 + */
6128 +
6129 +#ifndef _linuxver_h_
6130 +#define _linuxver_h_
6131 +
6132 +#include <linux/config.h>
6133 +#include <linux/version.h>
6134 +
6135 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0))
6136 +/* __NO_VERSION__ must be defined for all linkables except one in 2.2 */
6137 +#ifdef __UNDEF_NO_VERSION__
6138 +#undef __NO_VERSION__
6139 +#else
6140 +#define __NO_VERSION__
6141 +#endif
6142 +#endif
6143 +
6144 +#if defined(MODULE) && defined(MODVERSIONS)
6145 +#include <linux/modversions.h>
6146 +#endif
6147 +
6148 +/* linux/malloc.h is deprecated, use linux/slab.h instead. */
6149 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,9))
6150 +#include <linux/malloc.h>
6151 +#else
6152 +#include <linux/slab.h>
6153 +#endif
6154 +
6155 +#include <linux/types.h>
6156 +#include <linux/init.h>
6157 +#include <linux/module.h>
6158 +#include <linux/mm.h>
6159 +#include <linux/string.h>
6160 +#include <linux/pci.h>
6161 +#include <linux/interrupt.h>
6162 +#include <linux/netdevice.h>
6163 +#include <asm/io.h>
6164 +
6165 +#ifndef __exit
6166 +#define __exit
6167 +#endif
6168 +#ifndef __devexit
6169 +#define __devexit
6170 +#endif
6171 +#ifndef __devinit
6172 +#define __devinit __init
6173 +#endif
6174 +#ifndef __devinitdata
6175 +#define __devinitdata
6176 +#endif
6177 +#ifndef __devexit_p
6178 +#define __devexit_p(x) x
6179 +#endif
6180 +
6181 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
6182 +
6183 +#define pci_get_drvdata(dev) (dev)->sysdata
6184 +#define pci_set_drvdata(dev, value) (dev)->sysdata=(value)
6185 +
6186 +/*
6187 + * New-style (2.4.x) PCI/hot-pluggable PCI/CardBus registration
6188 + */
6189 +
6190 +struct pci_device_id {
6191 + unsigned int vendor, device; /* Vendor and device ID or PCI_ANY_ID */
6192 + unsigned int subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
6193 + unsigned int class, class_mask; /* (class,subclass,prog-if) triplet */
6194 + unsigned long driver_data; /* Data private to the driver */
6195 +};
6196 +
6197 +struct pci_driver {
6198 + struct list_head node;
6199 + char *name;
6200 + const struct pci_device_id *id_table; /* NULL if wants all devices */
6201 + int (*probe)(struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
6202 + void (*remove)(struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
6203 + void (*suspend)(struct pci_dev *dev); /* Device suspended */
6204 + void (*resume)(struct pci_dev *dev); /* Device woken up */
6205 +};
6206 +
6207 +#define MODULE_DEVICE_TABLE(type, name)
6208 +#define PCI_ANY_ID (~0)
6209 +
6210 +/* compatpci.c */
6211 +#define pci_module_init pci_register_driver
6212 +extern int pci_register_driver(struct pci_driver *drv);
6213 +extern void pci_unregister_driver(struct pci_driver *drv);
6214 +
6215 +#endif /* PCI registration */
6216 +
6217 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18))
6218 +#ifdef MODULE
6219 +#define module_init(x) int init_module(void) { return x(); }
6220 +#define module_exit(x) void cleanup_module(void) { x(); }
6221 +#else
6222 +#define module_init(x) __initcall(x);
6223 +#define module_exit(x) __exitcall(x);
6224 +#endif
6225 +#endif
6226 +
6227 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,48))
6228 +#define list_for_each(pos, head) \
6229 + for (pos = (head)->next; pos != (head); pos = pos->next)
6230 +#endif
6231 +
6232 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13))
6233 +#define pci_resource_start(dev, bar) ((dev)->base_address[(bar)])
6234 +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,44))
6235 +#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
6236 +#endif
6237 +
6238 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,23))
6239 +#define pci_enable_device(dev) do { } while (0)
6240 +#endif
6241 +
6242 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,14))
6243 +#define net_device device
6244 +#endif
6245 +
6246 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,42))
6247 +
6248 +/*
6249 + * DMA mapping
6250 + *
6251 + * See linux/Documentation/DMA-mapping.txt
6252 + */
6253 +
6254 +#ifndef PCI_DMA_TODEVICE
6255 +#define PCI_DMA_TODEVICE 1
6256 +#define PCI_DMA_FROMDEVICE 2
6257 +#endif
6258 +
6259 +typedef u32 dma_addr_t;
6260 +
6261 +/* Pure 2^n version of get_order */
6262 +static inline int get_order(unsigned long size)
6263 +{
6264 + int order;
6265 +
6266 + size = (size-1) >> (PAGE_SHIFT-1);
6267 + order = -1;
6268 + do {
6269 + size >>= 1;
6270 + order++;
6271 + } while (size);
6272 + return order;
6273 +}
6274 +
6275 +static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
6276 + dma_addr_t *dma_handle)
6277 +{
6278 + void *ret;
6279 + int gfp = GFP_ATOMIC | GFP_DMA;
6280 +
6281 + ret = (void *)__get_free_pages(gfp, get_order(size));
6282 +
6283 + if (ret != NULL) {
6284 + memset(ret, 0, size);
6285 + *dma_handle = virt_to_bus(ret);
6286 + }
6287 + return ret;
6288 +}
6289 +static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size,
6290 + void *vaddr, dma_addr_t dma_handle)
6291 +{
6292 + free_pages((unsigned long)vaddr, get_order(size));
6293 +}
6294 +#ifdef ILSIM
6295 +extern uint pci_map_single(void *dev, void *va, uint size, int direction);
6296 +extern void pci_unmap_single(void *dev, uint pa, uint size, int direction);
6297 +#else
6298 +#define pci_map_single(cookie, address, size, dir) virt_to_bus(address)
6299 +#define pci_unmap_single(cookie, address, size, dir)
6300 +#endif
6301 +
6302 +#endif /* DMA mapping */
6303 +
6304 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,43))
6305 +
6306 +#define dev_kfree_skb_any(a) dev_kfree_skb(a)
6307 +#define netif_down(dev) do { (dev)->start = 0; } while(0)
6308 +
6309 +/* pcmcia-cs provides its own netdevice compatibility layer */
6310 +#ifndef _COMPAT_NETDEVICE_H
6311 +
6312 +/*
6313 + * SoftNet
6314 + *
6315 + * For pre-softnet kernels we need to tell the upper layer not to
6316 + * re-enter start_xmit() while we are in there. However softnet
6317 + * guarantees not to enter while we are in there so there is no need
6318 + * to do the netif_stop_queue() dance unless the transmit queue really
6319 + * gets stuck. This should also improve performance according to tests
6320 + * done by Aman Singla.
6321 + */
6322 +
6323 +#define dev_kfree_skb_irq(a) dev_kfree_skb(a)
6324 +#define netif_wake_queue(dev) do { clear_bit(0, &(dev)->tbusy); mark_bh(NET_BH); } while(0)
6325 +#define netif_stop_queue(dev) set_bit(0, &(dev)->tbusy)
6326 +
6327 +static inline void netif_start_queue(struct net_device *dev)
6328 +{
6329 + dev->tbusy = 0;
6330 + dev->interrupt = 0;
6331 + dev->start = 1;
6332 +}
6333 +
6334 +#define netif_queue_stopped(dev) (dev)->tbusy
6335 +#define netif_running(dev) (dev)->start
6336 +
6337 +#endif /* _COMPAT_NETDEVICE_H */
6338 +
6339 +#define netif_device_attach(dev) netif_start_queue(dev)
6340 +#define netif_device_detach(dev) netif_stop_queue(dev)
6341 +
6342 +/* 2.4.x renamed bottom halves to tasklets */
6343 +#define tasklet_struct tq_struct
6344 +static inline void tasklet_schedule(struct tasklet_struct *tasklet)
6345 +{
6346 + queue_task(tasklet, &tq_immediate);
6347 + mark_bh(IMMEDIATE_BH);
6348 +}
6349 +
6350 +static inline void tasklet_init(struct tasklet_struct *tasklet,
6351 + void (*func)(unsigned long),
6352 + unsigned long data)
6353 +{
6354 + tasklet->next = NULL;
6355 + tasklet->sync = 0;
6356 + tasklet->routine = (void (*)(void *))func;
6357 + tasklet->data = (void *)data;
6358 +}
6359 +#define tasklet_kill(tasklet) {do{} while(0);}
6360 +
6361 +/* 2.4.x introduced del_timer_sync() */
6362 +#define del_timer_sync(timer) del_timer(timer)
6363 +
6364 +#else
6365 +
6366 +#define netif_down(dev)
6367 +
6368 +#endif /* SoftNet */
6369 +
6370 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3))
6371 +
6372 +/*
6373 + * Emit code to initialise a tq_struct's routine and data pointers
6374 + */
6375 +#define PREPARE_TQUEUE(_tq, _routine, _data) \
6376 + do { \
6377 + (_tq)->routine = _routine; \
6378 + (_tq)->data = _data; \
6379 + } while (0)
6380 +
6381 +/*
6382 + * Emit code to initialise all of a tq_struct
6383 + */
6384 +#define INIT_TQUEUE(_tq, _routine, _data) \
6385 + do { \
6386 + INIT_LIST_HEAD(&(_tq)->list); \
6387 + (_tq)->sync = 0; \
6388 + PREPARE_TQUEUE((_tq), (_routine), (_data)); \
6389 + } while (0)
6390 +
6391 +#endif
6392 +
6393 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,6))
6394 +
6395 +/* Power management related routines */
6396 +
6397 +static inline int
6398 +pci_save_state(struct pci_dev *dev, u32 *buffer)
6399 +{
6400 + int i;
6401 + if (buffer) {
6402 + for (i = 0; i < 16; i++)
6403 + pci_read_config_dword(dev, i * 4,&buffer[i]);
6404 + }
6405 + return 0;
6406 +}
6407 +
6408 +static inline int
6409 +pci_restore_state(struct pci_dev *dev, u32 *buffer)
6410 +{
6411 + int i;
6412 +
6413 + if (buffer) {
6414 + for (i = 0; i < 16; i++)
6415 + pci_write_config_dword(dev,i * 4, buffer[i]);
6416 + }
6417 + /*
6418 + * otherwise, write the context information we know from bootup.
6419 + * This works around a problem where warm-booting from Windows
6420 + * combined with a D3(hot)->D0 transition causes PCI config
6421 + * header data to be forgotten.
6422 + */
6423 + else {
6424 + for (i = 0; i < 6; i ++)
6425 + pci_write_config_dword(dev,
6426 + PCI_BASE_ADDRESS_0 + (i * 4),
6427 + pci_resource_start(dev, i));
6428 + pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
6429 + }
6430 + return 0;
6431 +}
6432 +
6433 +#endif /* PCI power management */
6434 +
6435 +/* Old cp0 access macros deprecated in 2.4.19 */
6436 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19))
6437 +#define read_c0_count() read_32bit_cp0_register(CP0_COUNT)
6438 +#endif
6439 +
6440 +#endif /* _linuxver_h_ */
6441 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/nvports.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/nvports.h
6442 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/nvports.h 1970-01-01 01:00:00.000000000 +0100
6443 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/nvports.h 2005-08-28 11:12:20.441857480 +0200
6444 @@ -0,0 +1,62 @@
6445 +/*
6446 + * Broadcom Home Gateway Reference Design
6447 + * Ports Web Page Configuration Support Routines
6448 + *
6449 + * Copyright 2001-2003, Broadcom Corporation
6450 + * All Rights Reserved.
6451 + *
6452 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
6453 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
6454 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
6455 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
6456 + * $Id$
6457 + */
6458 +
6459 +#ifndef _nvports_h_
6460 +#define _nvports_h_
6461 +
6462 +#define uint32 unsigned long
6463 +#define uint16 unsigned short
6464 +#define uint unsigned int
6465 +#define uint8 unsigned char
6466 +#define uint64 unsigned long long
6467 +
6468 +enum FORCE_PORT {
6469 + FORCE_OFF,
6470 + FORCE_10H,
6471 + FORCE_10F,
6472 + FORCE_100H,
6473 + FORCE_100F,
6474 + FORCE_DOWN,
6475 + POWER_OFF
6476 +};
6477 +
6478 +typedef struct _PORT_ATTRIBS
6479 +{
6480 + uint autoneg;
6481 + uint force;
6482 + uint native;
6483 +} PORT_ATTRIBS;
6484 +
6485 +extern uint
6486 +nvExistsPortAttrib(char *attrib, uint portno);
6487 +
6488 +extern int
6489 +nvExistsAnyForcePortAttrib(uint portno);
6490 +
6491 +extern void
6492 +nvSetPortAttrib(char *attrib, uint portno);
6493 +
6494 +extern void
6495 +nvUnsetPortAttrib(char *attrib, uint portno);
6496 +
6497 +extern void
6498 +nvUnsetAllForcePortAttrib(uint portno);
6499 +
6500 +extern PORT_ATTRIBS
6501 +nvGetSwitchPortAttribs(uint portno);
6502 +
6503 +#endif /* _nvports_h_ */
6504 +
6505 +
6506 +
6507 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/osl.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/osl.h
6508 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/osl.h 1970-01-01 01:00:00.000000000 +0100
6509 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/osl.h 2005-08-28 11:12:20.441857480 +0200
6510 @@ -0,0 +1,38 @@
6511 +/*
6512 + * OS Independent Layer
6513 + *
6514 + * Copyright 2001-2003, Broadcom Corporation
6515 + * All Rights Reserved.
6516 + *
6517 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
6518 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
6519 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
6520 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
6521 + * $Id$
6522 + */
6523 +
6524 +#ifndef _osl_h_
6525 +#define _osl_h_
6526 +
6527 +#ifdef V2_HAL
6528 +#include <v2hal_osl.h>
6529 +#elif defined(linux)
6530 +#include <linux_osl.h>
6531 +#elif PMON
6532 +#include <pmon_osl.h>
6533 +#elif defined(NDIS)
6534 +#include <ndis_osl.h>
6535 +#elif defined(_CFE_)
6536 +#include <cfe_osl.h>
6537 +#elif defined(MACOS9)
6538 +#include <macos9_osl.h>
6539 +#elif defined(MACOSX)
6540 +#include <macosx_osl.h>
6541 +#else
6542 +#error "Unsupported OSL requested"
6543 +#endif
6544 +
6545 +/* handy */
6546 +#define SET_REG(r, mask, val) W_REG((r), ((R_REG(r) & ~(mask)) | (val)))
6547 +
6548 +#endif /* _osl_h_ */
6549 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/pcicfg.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/pcicfg.h
6550 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/pcicfg.h 1970-01-01 01:00:00.000000000 +0100
6551 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/pcicfg.h 2005-08-28 11:12:20.442857328 +0200
6552 @@ -0,0 +1,362 @@
6553 +/*
6554 + * pcicfg.h: PCI configuration constants and structures.
6555 + *
6556 + * Copyright 2001-2003, Broadcom Corporation
6557 + * All Rights Reserved.
6558 + *
6559 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
6560 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
6561 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
6562 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
6563 + *
6564 + * $Id$
6565 + */
6566 +
6567 +#ifndef _h_pci_
6568 +#define _h_pci_
6569 +
6570 +/* The following inside ifndef's so we don't collide with NTDDK.H */
6571 +#ifndef PCI_MAX_BUS
6572 +#define PCI_MAX_BUS 0x100
6573 +#endif
6574 +#ifndef PCI_MAX_DEVICES
6575 +#define PCI_MAX_DEVICES 0x20
6576 +#endif
6577 +#ifndef PCI_MAX_FUNCTION
6578 +#define PCI_MAX_FUNCTION 0x8
6579 +#endif
6580 +
6581 +#ifndef PCI_INVALID_VENDORID
6582 +#define PCI_INVALID_VENDORID 0xffff
6583 +#endif
6584 +#ifndef PCI_INVALID_DEVICEID
6585 +#define PCI_INVALID_DEVICEID 0xffff
6586 +#endif
6587 +
6588 +
6589 +/* Convert between bus-slot-function-register and config addresses */
6590 +
6591 +#define PCICFG_BUS_SHIFT 16 /* Bus shift */
6592 +#define PCICFG_SLOT_SHIFT 11 /* Slot shift */
6593 +#define PCICFG_FUN_SHIFT 8 /* Function shift */
6594 +#define PCICFG_OFF_SHIFT 0 /* Bus shift */
6595 +
6596 +#define PCICFG_BUS_MASK 0xff /* Bus mask */
6597 +#define PCICFG_SLOT_MASK 0x1f /* Slot mask */
6598 +#define PCICFG_FUN_MASK 7 /* Function mask */
6599 +#define PCICFG_OFF_MASK 0xff /* Bus mask */
6600 +
6601 +#define PCI_CONFIG_ADDR(b, s, f, o) \
6602 + ((((b) & PCICFG_BUS_MASK) << PCICFG_BUS_SHIFT) \
6603 + | (((s) & PCICFG_SLOT_MASK) << PCICFG_SLOT_SHIFT) \
6604 + | (((f) & PCICFG_FUN_MASK) << PCICFG_FUN_SHIFT) \
6605 + | (((o) & PCICFG_OFF_MASK) << PCICFG_OFF_SHIFT))
6606 +
6607 +#define PCI_CONFIG_BUS(a) (((a) >> PCICFG_BUS_SHIFT) & PCICFG_BUS_MASK)
6608 +#define PCI_CONFIG_SLOT(a) (((a) >> PCICFG_SLOT_SHIFT) & PCICFG_SLOT_MASK)
6609 +#define PCI_CONFIG_FUN(a) (((a) >> PCICFG_FUN_SHIFT) & PCICFG_FUN_MASK)
6610 +#define PCI_CONFIG_OFF(a) (((a) >> PCICFG_OFF_SHIFT) & PCICFG_OFF_MASK)
6611 +
6612 +
6613 +/* The actual config space */
6614 +
6615 +#define PCI_BAR_MAX 6
6616 +
6617 +#define PCI_ROM_BAR 8
6618 +
6619 +#define PCR_RSVDA_MAX 2
6620 +
6621 +typedef struct _pci_config_regs {
6622 + unsigned short vendor;
6623 + unsigned short device;
6624 + unsigned short command;
6625 + unsigned short status;
6626 + unsigned char rev_id;
6627 + unsigned char prog_if;
6628 + unsigned char sub_class;
6629 + unsigned char base_class;
6630 + unsigned char cache_line_size;
6631 + unsigned char latency_timer;
6632 + unsigned char header_type;
6633 + unsigned char bist;
6634 + unsigned long base[PCI_BAR_MAX];
6635 + unsigned long cardbus_cis;
6636 + unsigned short subsys_vendor;
6637 + unsigned short subsys_id;
6638 + unsigned long baserom;
6639 + unsigned long rsvd_a[PCR_RSVDA_MAX];
6640 + unsigned char int_line;
6641 + unsigned char int_pin;
6642 + unsigned char min_gnt;
6643 + unsigned char max_lat;
6644 + unsigned char dev_dep[192];
6645 +} pci_config_regs;
6646 +
6647 +#define SZPCR (sizeof (pci_config_regs))
6648 +#define MINSZPCR 64 /* offsetof (dev_dep[0] */
6649 +
6650 +/* A structure for the config registers is nice, but in most
6651 + * systems the config space is not memory mapped, so we need
6652 + * filed offsetts. :-(
6653 + */
6654 +#define PCI_CFG_VID 0
6655 +#define PCI_CFG_DID 2
6656 +#define PCI_CFG_CMD 4
6657 +#define PCI_CFG_STAT 6
6658 +#define PCI_CFG_REV 8
6659 +#define PCI_CFG_PROGIF 9
6660 +#define PCI_CFG_SUBCL 0xa
6661 +#define PCI_CFG_BASECL 0xb
6662 +#define PCI_CFG_CLSZ 0xc
6663 +#define PCI_CFG_LATTIM 0xd
6664 +#define PCI_CFG_HDR 0xe
6665 +#define PCI_CFG_BIST 0xf
6666 +#define PCI_CFG_BAR0 0x10
6667 +#define PCI_CFG_BAR1 0x14
6668 +#define PCI_CFG_BAR2 0x18
6669 +#define PCI_CFG_BAR3 0x1c
6670 +#define PCI_CFG_BAR4 0x20
6671 +#define PCI_CFG_BAR5 0x24
6672 +#define PCI_CFG_CIS 0x28
6673 +#define PCI_CFG_SVID 0x2c
6674 +#define PCI_CFG_SSID 0x2e
6675 +#define PCI_CFG_ROMBAR 0x30
6676 +#define PCI_CFG_INT 0x3c
6677 +#define PCI_CFG_PIN 0x3d
6678 +#define PCI_CFG_MINGNT 0x3e
6679 +#define PCI_CFG_MAXLAT 0x3f
6680 +
6681 +/* Classes and subclasses */
6682 +
6683 +typedef enum {
6684 + PCI_CLASS_OLD = 0,
6685 + PCI_CLASS_DASDI,
6686 + PCI_CLASS_NET,
6687 + PCI_CLASS_DISPLAY,
6688 + PCI_CLASS_MMEDIA,
6689 + PCI_CLASS_MEMORY,
6690 + PCI_CLASS_BRIDGE,
6691 + PCI_CLASS_COMM,
6692 + PCI_CLASS_BASE,
6693 + PCI_CLASS_INPUT,
6694 + PCI_CLASS_DOCK,
6695 + PCI_CLASS_CPU,
6696 + PCI_CLASS_SERIAL,
6697 + PCI_CLASS_INTELLIGENT = 0xe,
6698 + PCI_CLASS_SATELLITE,
6699 + PCI_CLASS_CRYPT,
6700 + PCI_CLASS_DSP,
6701 + PCI_CLASS_MAX
6702 +} pci_classes;
6703 +
6704 +typedef enum {
6705 + PCI_DASDI_SCSI,
6706 + PCI_DASDI_IDE,
6707 + PCI_DASDI_FLOPPY,
6708 + PCI_DASDI_IPI,
6709 + PCI_DASDI_RAID,
6710 + PCI_DASDI_OTHER = 0x80
6711 +} pci_dasdi_subclasses;
6712 +
6713 +typedef enum {
6714 + PCI_NET_ETHER,
6715 + PCI_NET_TOKEN,
6716 + PCI_NET_FDDI,
6717 + PCI_NET_ATM,
6718 + PCI_NET_OTHER = 0x80
6719 +} pci_net_subclasses;
6720 +
6721 +typedef enum {
6722 + PCI_DISPLAY_VGA,
6723 + PCI_DISPLAY_XGA,
6724 + PCI_DISPLAY_3D,
6725 + PCI_DISPLAY_OTHER = 0x80
6726 +} pci_display_subclasses;
6727 +
6728 +typedef enum {
6729 + PCI_MMEDIA_VIDEO,
6730 + PCI_MMEDIA_AUDIO,
6731 + PCI_MMEDIA_PHONE,
6732 + PCI_MEDIA_OTHER = 0x80
6733 +} pci_mmedia_subclasses;
6734 +
6735 +typedef enum {
6736 + PCI_MEMORY_RAM,
6737 + PCI_MEMORY_FLASH,
6738 + PCI_MEMORY_OTHER = 0x80
6739 +} pci_memory_subclasses;
6740 +
6741 +typedef enum {
6742 + PCI_BRIDGE_HOST,
6743 + PCI_BRIDGE_ISA,
6744 + PCI_BRIDGE_EISA,
6745 + PCI_BRIDGE_MC,
6746 + PCI_BRIDGE_PCI,
6747 + PCI_BRIDGE_PCMCIA,
6748 + PCI_BRIDGE_NUBUS,
6749 + PCI_BRIDGE_CARDBUS,
6750 + PCI_BRIDGE_RACEWAY,
6751 + PCI_BRIDGE_OTHER = 0x80
6752 +} pci_bridge_subclasses;
6753 +
6754 +typedef enum {
6755 + PCI_COMM_UART,
6756 + PCI_COMM_PARALLEL,
6757 + PCI_COMM_MULTIUART,
6758 + PCI_COMM_MODEM,
6759 + PCI_COMM_OTHER = 0x80
6760 +} pci_comm_subclasses;
6761 +
6762 +typedef enum {
6763 + PCI_BASE_PIC,
6764 + PCI_BASE_DMA,
6765 + PCI_BASE_TIMER,
6766 + PCI_BASE_RTC,
6767 + PCI_BASE_PCI_HOTPLUG,
6768 + PCI_BASE_OTHER = 0x80
6769 +} pci_base_subclasses;
6770 +
6771 +typedef enum {
6772 + PCI_INPUT_KBD,
6773 + PCI_INPUT_PEN,
6774 + PCI_INPUT_MOUSE,
6775 + PCI_INPUT_SCANNER,
6776 + PCI_INPUT_GAMEPORT,
6777 + PCI_INPUT_OTHER = 0x80
6778 +} pci_input_subclasses;
6779 +
6780 +typedef enum {
6781 + PCI_DOCK_GENERIC,
6782 + PCI_DOCK_OTHER = 0x80
6783 +} pci_dock_subclasses;
6784 +
6785 +typedef enum {
6786 + PCI_CPU_386,
6787 + PCI_CPU_486,
6788 + PCI_CPU_PENTIUM,
6789 + PCI_CPU_ALPHA = 0x10,
6790 + PCI_CPU_POWERPC = 0x20,
6791 + PCI_CPU_MIPS = 0x30,
6792 + PCI_CPU_COPROC = 0x40,
6793 + PCI_CPU_OTHER = 0x80
6794 +} pci_cpu_subclasses;
6795 +
6796 +typedef enum {
6797 + PCI_SERIAL_IEEE1394,
6798 + PCI_SERIAL_ACCESS,
6799 + PCI_SERIAL_SSA,
6800 + PCI_SERIAL_USB,
6801 + PCI_SERIAL_FIBER,
6802 + PCI_SERIAL_SMBUS,
6803 + PCI_SERIAL_OTHER = 0x80
6804 +} pci_serial_subclasses;
6805 +
6806 +typedef enum {
6807 + PCI_INTELLIGENT_I2O,
6808 +} pci_intelligent_subclasses;
6809 +
6810 +typedef enum {
6811 + PCI_SATELLITE_TV,
6812 + PCI_SATELLITE_AUDIO,
6813 + PCI_SATELLITE_VOICE,
6814 + PCI_SATELLITE_DATA,
6815 + PCI_SATELLITE_OTHER = 0x80
6816 +} pci_satellite_subclasses;
6817 +
6818 +typedef enum {
6819 + PCI_CRYPT_NETWORK,
6820 + PCI_CRYPT_ENTERTAINMENT,
6821 + PCI_CRYPT_OTHER = 0x80
6822 +} pci_crypt_subclasses;
6823 +
6824 +typedef enum {
6825 + PCI_DSP_DPIO,
6826 + PCI_DSP_OTHER = 0x80
6827 +} pci_dsp_subclasses;
6828 +
6829 +/* Header types */
6830 +typedef enum {
6831 + PCI_HEADER_NORMAL,
6832 + PCI_HEADER_BRIDGE,
6833 + PCI_HEADER_CARDBUS
6834 +} pci_header_types;
6835 +
6836 +
6837 +/* Overlay for a PCI-to-PCI bridge */
6838 +
6839 +#define PPB_RSVDA_MAX 2
6840 +#define PPB_RSVDD_MAX 8
6841 +
6842 +typedef struct _ppb_config_regs {
6843 + unsigned short vendor;
6844 + unsigned short device;
6845 + unsigned short command;
6846 + unsigned short status;
6847 + unsigned char rev_id;
6848 + unsigned char prog_if;
6849 + unsigned char sub_class;
6850 + unsigned char base_class;
6851 + unsigned char cache_line_size;
6852 + unsigned char latency_timer;
6853 + unsigned char header_type;
6854 + unsigned char bist;
6855 + unsigned long rsvd_a[PPB_RSVDA_MAX];
6856 + unsigned char prim_bus;
6857 + unsigned char sec_bus;
6858 + unsigned char sub_bus;
6859 + unsigned char sec_lat;
6860 + unsigned char io_base;
6861 + unsigned char io_lim;
6862 + unsigned short sec_status;
6863 + unsigned short mem_base;
6864 + unsigned short mem_lim;
6865 + unsigned short pf_mem_base;
6866 + unsigned short pf_mem_lim;
6867 + unsigned long pf_mem_base_hi;
6868 + unsigned long pf_mem_lim_hi;
6869 + unsigned short io_base_hi;
6870 + unsigned short io_lim_hi;
6871 + unsigned short subsys_vendor;
6872 + unsigned short subsys_id;
6873 + unsigned long rsvd_b;
6874 + unsigned char rsvd_c;
6875 + unsigned char int_pin;
6876 + unsigned short bridge_ctrl;
6877 + unsigned char chip_ctrl;
6878 + unsigned char diag_ctrl;
6879 + unsigned short arb_ctrl;
6880 + unsigned long rsvd_d[PPB_RSVDD_MAX];
6881 + unsigned char dev_dep[192];
6882 +} ppb_config_regs;
6883 +
6884 +/* Eveything below is BRCM HND proprietary */
6885 +
6886 +#define PCI_BAR0_WIN 0x80 /* backplane addres space accessed by BAR0 */
6887 +#define PCI_BAR1_WIN 0x84 /* backplane addres space accessed by BAR1 */
6888 +#define PCI_SPROM_CONTROL 0x88 /* sprom property control */
6889 +#define PCI_BAR1_CONTROL 0x8c /* BAR1 region burst control */
6890 +#define PCI_INT_STATUS 0x90 /* PCI and other cores interrupts */
6891 +#define PCI_INT_MASK 0x94 /* mask of PCI and other cores interrupts */
6892 +#define PCI_TO_SB_MB 0x98 /* signal backplane interrupts */
6893 +#define PCI_BACKPLANE_ADDR 0xA0 /* address an arbitrary location on the system backplane */
6894 +#define PCI_BACKPLANE_DATA 0xA4 /* data at the location specified by above address register */
6895 +#define PCI_GPIO_IN 0xb0 /* pci config space gpio input (>=rev3) */
6896 +#define PCI_GPIO_OUT 0xb4 /* pci config space gpio output (>=rev3) */
6897 +#define PCI_GPIO_OUTEN 0xb8 /* pci config space gpio output enable (>=rev3) */
6898 +
6899 +#define PCI_BAR0_SPROM_OFFSET (4 * 1024) /* bar0 + 4K accesses external sprom */
6900 +#define PCI_BAR0_PCIREGS_OFFSET (6 * 1024) /* bar0 + 6K accesses pci core registers */
6901 +
6902 +/* PCI_INT_MASK */
6903 +#define PCI_SBIM_SHIFT 8 /* backplane core interrupt mask bits offset */
6904 +#define PCI_SBIM_MASK 0xff00 /* backplane core interrupt mask */
6905 +
6906 +/* PCI_SPROM_CONTROL */
6907 +#define SPROM_BLANK 0x04 /* indicating a blank sprom */
6908 +#define SPROM_WRITEEN 0x10 /* sprom write enable */
6909 +#define SPROM_BOOTROM_WE 0x20 /* external bootrom write enable */
6910 +
6911 +#define SPROM_SIZE 256 /* sprom size in 16-bit */
6912 +#define SPROM_CRC_RANGE 64 /* crc cover range in 16-bit */
6913 +
6914 +#endif
6915 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/proto/802.11.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/proto/802.11.h
6916 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/proto/802.11.h 1970-01-01 01:00:00.000000000 +0100
6917 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/proto/802.11.h 2005-08-28 11:12:20.450856112 +0200
6918 @@ -0,0 +1,679 @@
6919 +/*
6920 + * Copyright 2001-2003, Broadcom Corporation
6921 + * All Rights Reserved.
6922 + *
6923 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
6924 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
6925 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
6926 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
6927 + *
6928 + * Fundamental types and constants relating to 802.11
6929 + *
6930 + * $Id$
6931 + */
6932 +
6933 +#ifndef _802_11_H_
6934 +#define _802_11_H_
6935 +
6936 +#ifndef _TYPEDEFS_H_
6937 +#include <typedefs.h>
6938 +#endif
6939 +
6940 +#ifndef _NET_ETHERNET_H_
6941 +#include <proto/ethernet.h>
6942 +#endif
6943 +
6944 +/* enable structure packing */
6945 +#if !defined(__GNUC__)
6946 +#pragma pack(1)
6947 +#endif
6948 +
6949 +/* some platforms require stronger medicine */
6950 +#if defined(__GNUC__)
6951 +#define PACKED __attribute__((packed))
6952 +#else
6953 +#define PACKED
6954 +#endif
6955 +
6956 +
6957 +#define DOT11_TU_TO_US 1024 /* 802.11 Time Unit is 1024 microseconds */
6958 +
6959 +/* Generic 802.11 frame constants */
6960 +#define DOT11_A3_HDR_LEN 24
6961 +#define DOT11_A4_HDR_LEN 30
6962 +#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN
6963 +#define DOT11_FCS_LEN 4
6964 +#define DOT11_ICV_LEN 4
6965 +#define DOT11_ICV_AES_LEN 8
6966 +
6967 +
6968 +#define DOT11_KEY_INDEX_SHIFT 6
6969 +#define DOT11_IV_LEN 4
6970 +#define DOT11_IV_TKIP_LEN 8
6971 +#define DOT11_IV_AES_OCB_LEN 4
6972 +#define DOT11_IV_AES_CCM_LEN 8
6973 +
6974 +#define DOT11_MAX_MPDU_BODY_LEN 2312
6975 +#define DOT11_MAX_MPDU_LEN 2346 /* body len + A4 hdr + FCS */
6976 +#define DOT11_MAX_SSID_LEN 32
6977 +
6978 +/* dot11RTSThreshold */
6979 +#define DOT11_DEFAULT_RTS_LEN 2347
6980 +#define DOT11_MAX_RTS_LEN 2347
6981 +
6982 +/* dot11FragmentationThreshold */
6983 +#define DOT11_MIN_FRAG_LEN 256
6984 +#define DOT11_MAX_FRAG_LEN 2346 /* Max frag is also limited by aMPDUMaxLength of the attached PHY */
6985 +#define DOT11_DEFAULT_FRAG_LEN 2346
6986 +
6987 +/* dot11BeaconPeriod */
6988 +#define DOT11_MIN_BEACON_PERIOD 1
6989 +#define DOT11_MAX_BEACON_PERIOD 0xFFFF
6990 +
6991 +/* dot11DTIMPeriod */
6992 +#define DOT11_MIN_DTIM_PERIOD 1
6993 +#define DOT11_MAX_DTIM_PERIOD 0xFF
6994 +
6995 +/* 802.2 LLC/SNAP header used by 802.11 per 802.1H */
6996 +#define DOT11_LLC_SNAP_HDR_LEN 8
6997 +#define DOT11_OUI_LEN 3
6998 +struct dot11_llc_snap_header {
6999 + uint8 dsap; /* always 0xAA */
7000 + uint8 ssap; /* always 0xAA */
7001 + uint8 ctl; /* always 0x03 */
7002 + uint8 oui[DOT11_OUI_LEN]; /* RFC1042: 0x00 0x00 0x00
7003 + Bridge-Tunnel: 0x00 0x00 0xF8 */
7004 + uint16 type; /* ethertype */
7005 +} PACKED;
7006 +
7007 +/* RFC1042 header used by 802.11 per 802.1H */
7008 +#define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN)
7009 +
7010 +/* Generic 802.11 MAC header */
7011 +/*
7012 + * N.B.: This struct reflects the full 4 address 802.11 MAC header.
7013 + * The fields are defined such that the shorter 1, 2, and 3
7014 + * address headers just use the first k fields.
7015 + */
7016 +struct dot11_header {
7017 + uint16 fc; /* frame control */
7018 + uint16 durid; /* duration/ID */
7019 + struct ether_addr a1; /* address 1 */
7020 + struct ether_addr a2; /* address 2 */
7021 + struct ether_addr a3; /* address 3 */
7022 + uint16 seq; /* sequence control */
7023 + struct ether_addr a4; /* address 4 */
7024 +} PACKED;
7025 +
7026 +/* Control frames */
7027 +
7028 +struct dot11_rts_frame {
7029 + uint16 fc; /* frame control */
7030 + uint16 durid; /* duration/ID */
7031 + struct ether_addr ra; /* receiver address */
7032 + struct ether_addr ta; /* transmitter address */
7033 +} PACKED;
7034 +#define DOT11_RTS_LEN 16
7035 +
7036 +struct dot11_cts_frame {
7037 + uint16 fc; /* frame control */
7038 + uint16 durid; /* duration/ID */
7039 + struct ether_addr ra; /* receiver address */
7040 +} PACKED;
7041 +#define DOT11_CTS_LEN 10
7042 +
7043 +struct dot11_ack_frame {
7044 + uint16 fc; /* frame control */
7045 + uint16 durid; /* duration/ID */
7046 + struct ether_addr ra; /* receiver address */
7047 +} PACKED;
7048 +#define DOT11_ACK_LEN 10
7049 +
7050 +struct dot11_ps_poll_frame {
7051 + uint16 fc; /* frame control */
7052 + uint16 durid; /* AID */
7053 + struct ether_addr bssid; /* receiver address, STA in AP */
7054 + struct ether_addr ta; /* transmitter address */
7055 +} PACKED;
7056 +#define DOT11_PS_POLL_LEN 16
7057 +
7058 +struct dot11_cf_end_frame {
7059 + uint16 fc; /* frame control */
7060 + uint16 durid; /* duration/ID */
7061 + struct ether_addr ra; /* receiver address */
7062 + struct ether_addr bssid; /* transmitter address, STA in AP */
7063 +} PACKED;
7064 +#define DOT11_CS_END_LEN 16
7065 +
7066 +/* Management frame header */
7067 +struct dot11_management_header {
7068 + uint16 fc; /* frame control */
7069 + uint16 durid; /* duration/ID */
7070 + struct ether_addr da; /* receiver address */
7071 + struct ether_addr sa; /* transmitter address */
7072 + struct ether_addr bssid; /* BSS ID */
7073 + uint16 seq; /* sequence control */
7074 +} PACKED;
7075 +#define DOT11_MGMT_HDR_LEN 24
7076 +
7077 +/* Management frame payloads */
7078 +
7079 +struct dot11_bcn_prb {
7080 + uint32 timestamp[2];
7081 + uint16 beacon_interval;
7082 + uint16 capability;
7083 +} PACKED;
7084 +#define DOT11_BCN_PRB_LEN 12
7085 +
7086 +struct dot11_auth {
7087 + uint16 alg; /* algorithm */
7088 + uint16 seq; /* sequence control */
7089 + uint16 status; /* status code */
7090 +} PACKED;
7091 +#define DOT11_AUTH_FIXED_LEN 6 /* length of auth frame without challenge info elt */
7092 +
7093 +struct dot11_assoc_req {
7094 + uint16 capability; /* capability information */
7095 + uint16 listen; /* listen interval */
7096 +} PACKED;
7097 +
7098 +struct dot11_assoc_resp {
7099 + uint16 capability; /* capability information */
7100 + uint16 status; /* status code */
7101 + uint16 aid; /* association ID */
7102 +} PACKED;
7103 +
7104 +struct dot11_action_measure {
7105 + uint8 category;
7106 + uint8 action;
7107 + uint8 token;
7108 + uint8 data[1];
7109 +} PACKED;
7110 +#define DOT11_ACTION_MEASURE_LEN 3
7111 +
7112 +/**************
7113 + 802.11h related definitions.
7114 +**************/
7115 +typedef struct {
7116 + uint8 id;
7117 + uint8 len;
7118 + uint8 power;
7119 +} dot11_power_cnst_t;
7120 +
7121 +typedef struct {
7122 + uint8 min;
7123 + uint8 max;
7124 +} dot11_power_cap_t;
7125 +
7126 +typedef struct {
7127 + uint8 id;
7128 + uint8 len;
7129 + uint8 tx_pwr;
7130 + uint8 margin;
7131 +} dot11_tpc_rep_t;
7132 +#define DOT11_MNG_IE_TPC_REPORT_LEN 2 /* length of IE data, not including 2 byte header */
7133 +
7134 +typedef struct {
7135 + uint8 id;
7136 + uint8 len;
7137 + uint8 first_channel;
7138 + uint8 num_channels;
7139 +} dot11_supp_channels_t;
7140 +
7141 +struct dot11_channel_switch {
7142 + uint8 id;
7143 + uint8 len;
7144 + uint8 mode;
7145 + uint8 channel;
7146 + uint8 count;
7147 +} PACKED;
7148 +typedef struct dot11_channel_switch dot11_channel_switch_t;
7149 +
7150 +/* 802.11h Measurement Request/Report IEs */
7151 +/* Measurement Type field */
7152 +#define DOT11_MEASURE_TYPE_BASIC 0
7153 +#define DOT11_MEASURE_TYPE_CCA 1
7154 +#define DOT11_MEASURE_TYPE_RPI 2
7155 +
7156 +/* Measurement Mode field */
7157 +
7158 +/* Measurement Request Modes */
7159 +#define DOT11_MEASURE_MODE_ENABLE (1<<1)
7160 +#define DOT11_MEASURE_MODE_REQUEST (1<<2)
7161 +#define DOT11_MEASURE_MODE_REPORT (1<<3)
7162 +/* Measurement Report Modes */
7163 +#define DOT11_MEASURE_MODE_LATE (1<<0)
7164 +#define DOT11_MEASURE_MODE_INCAPABLE (1<<1)
7165 +#define DOT11_MEASURE_MODE_REFUSED (1<<2)
7166 +/* Basic Measurement Map bits */
7167 +#define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0))
7168 +#define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1))
7169 +#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2))
7170 +#define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3))
7171 +#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4))
7172 +
7173 +typedef struct {
7174 + uint8 id;
7175 + uint8 len;
7176 + uint8 token;
7177 + uint8 mode;
7178 + uint8 type;
7179 + uint8 channel;
7180 + uint8 start_time[8];
7181 + uint16 duration;
7182 +} dot11_meas_req_t;
7183 +#define DOT11_MNG_IE_MREQ_LEN 14
7184 +/* length of Measure Request IE data not including variable len */
7185 +#define DOT11_MNG_IE_MREQ_FIXED_LEN 3
7186 +
7187 +struct dot11_meas_rep {
7188 + uint8 id;
7189 + uint8 len;
7190 + uint8 token;
7191 + uint8 mode;
7192 + uint8 type;
7193 + union
7194 + {
7195 + struct {
7196 + uint8 channel;
7197 + uint8 start_time[8];
7198 + uint16 duration;
7199 + uint8 map;
7200 + } PACKED basic;
7201 + uint8 data[1];
7202 + } PACKED rep;
7203 +} PACKED;
7204 +typedef struct dot11_meas_rep dot11_meas_rep_t;
7205 +
7206 +/* length of Measure Report IE data not including variable len */
7207 +#define DOT11_MNG_IE_MREP_FIXED_LEN 3
7208 +
7209 +struct dot11_meas_rep_basic {
7210 + uint8 channel;
7211 + uint8 start_time[8];
7212 + uint16 duration;
7213 + uint8 map;
7214 +} PACKED;
7215 +typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t;
7216 +#define DOT11_MEASURE_BASIC_REP_LEN 12
7217 +
7218 +struct dot11_quiet {
7219 + uint8 id;
7220 + uint8 len;
7221 + uint8 count; /* TBTTs until beacon interval in quiet starts */
7222 + uint8 period; /* Beacon intervals between periodic quiet periods ? */
7223 + uint16 duration;/* Length of quiet period, in TU's */
7224 + uint16 offset; /* TU's offset from TBTT in Count field */
7225 +} PACKED;
7226 +typedef struct dot11_quiet dot11_quiet_t;
7227 +
7228 +typedef struct {
7229 + uint8 channel;
7230 + uint8 map;
7231 +} chan_map_tuple_t;
7232 +
7233 +typedef struct {
7234 + uint8 id;
7235 + uint8 len;
7236 + uint8 eaddr[ETHER_ADDR_LEN];
7237 + uint8 interval;
7238 + chan_map_tuple_t map[1];
7239 +} dot11_ibss_dfs_t;
7240 +
7241 +
7242 +/* Macro to take a pointer to a beacon or probe response
7243 + * header and return the char* pointer to the SSID info element
7244 + */
7245 +#define BCN_PRB_SSID(hdr) ((char*)(hdr) + DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_LEN)
7246 +
7247 +/* Authentication frame payload constants */
7248 +#define DOT11_OPEN_SYSTEM 0
7249 +#define DOT11_SHARED_KEY 1
7250 +#define DOT11_CHALLENGE_LEN 128
7251 +
7252 +/* Frame control macros */
7253 +#define FC_PVER_MASK 0x3
7254 +#define FC_PVER_SHIFT 0
7255 +#define FC_TYPE_MASK 0xC
7256 +#define FC_TYPE_SHIFT 2
7257 +#define FC_SUBTYPE_MASK 0xF0
7258 +#define FC_SUBTYPE_SHIFT 4
7259 +#define FC_TODS 0x100
7260 +#define FC_TODS_SHIFT 8
7261 +#define FC_FROMDS 0x200
7262 +#define FC_FROMDS_SHIFT 9
7263 +#define FC_MOREFRAG 0x400
7264 +#define FC_MOREFRAG_SHIFT 10
7265 +#define FC_RETRY 0x800
7266 +#define FC_RETRY_SHIFT 11
7267 +#define FC_PM 0x1000
7268 +#define FC_PM_SHIFT 12
7269 +#define FC_MOREDATA 0x2000
7270 +#define FC_MOREDATA_SHIFT 13
7271 +#define FC_WEP 0x4000
7272 +#define FC_WEP_SHIFT 14
7273 +#define FC_ORDER 0x8000
7274 +#define FC_ORDER_SHIFT 15
7275 +
7276 +/* sequence control macros */
7277 +#define SEQNUM_SHIFT 4
7278 +#define FRAGNUM_MASK 0xF
7279 +
7280 +/* Frame Control type/subtype defs */
7281 +
7282 +/* FC Types */
7283 +#define FC_TYPE_MNG 0
7284 +#define FC_TYPE_CTL 1
7285 +#define FC_TYPE_DATA 2
7286 +
7287 +/* Management Subtypes */
7288 +#define FC_SUBTYPE_ASSOC_REQ 0
7289 +#define FC_SUBTYPE_ASSOC_RESP 1
7290 +#define FC_SUBTYPE_REASSOC_REQ 2
7291 +#define FC_SUBTYPE_REASSOC_RESP 3
7292 +#define FC_SUBTYPE_PROBE_REQ 4
7293 +#define FC_SUBTYPE_PROBE_RESP 5
7294 +#define FC_SUBTYPE_BEACON 8
7295 +#define FC_SUBTYPE_ATIM 9
7296 +#define FC_SUBTYPE_DISASSOC 10
7297 +#define FC_SUBTYPE_AUTH 11
7298 +#define FC_SUBTYPE_DEAUTH 12
7299 +#define FC_SUBTYPE_ACTION 13
7300 +
7301 +/* Control Subtypes */
7302 +#define FC_SUBTYPE_PS_POLL 10
7303 +#define FC_SUBTYPE_RTS 11
7304 +#define FC_SUBTYPE_CTS 12
7305 +#define FC_SUBTYPE_ACK 13
7306 +#define FC_SUBTYPE_CF_END 14
7307 +#define FC_SUBTYPE_CF_END_ACK 15
7308 +
7309 +/* Data Subtypes */
7310 +#define FC_SUBTYPE_DATA 0
7311 +#define FC_SUBTYPE_DATA_CF_ACK 1
7312 +#define FC_SUBTYPE_DATA_CF_POLL 2
7313 +#define FC_SUBTYPE_DATA_CF_ACK_POLL 3
7314 +#define FC_SUBTYPE_NULL 4
7315 +#define FC_SUBTYPE_CF_ACK 5
7316 +#define FC_SUBTYPE_CF_POLL 6
7317 +#define FC_SUBTYPE_CF_ACK_POLL 7
7318 +
7319 +/* type-subtype combos */
7320 +#define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK)
7321 +
7322 +#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT))
7323 +
7324 +#define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ)
7325 +#define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP)
7326 +#define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ)
7327 +#define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP)
7328 +#define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ)
7329 +#define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP)
7330 +#define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON)
7331 +#define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC)
7332 +#define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH)
7333 +#define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH)
7334 +#define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION)
7335 +
7336 +#define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL)
7337 +#define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS)
7338 +#define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS)
7339 +#define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK)
7340 +#define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END)
7341 +#define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK)
7342 +
7343 +#define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA)
7344 +#define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL)
7345 +#define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK)
7346 +
7347 +/* Management Frames */
7348 +
7349 +/* Management Frame Constants */
7350 +
7351 +/* Fixed fields */
7352 +#define DOT11_MNG_AUTH_ALGO_LEN 2
7353 +#define DOT11_MNG_AUTH_SEQ_LEN 2
7354 +#define DOT11_MNG_BEACON_INT_LEN 2
7355 +#define DOT11_MNG_CAP_LEN 2
7356 +#define DOT11_MNG_AP_ADDR_LEN 6
7357 +#define DOT11_MNG_LISTEN_INT_LEN 2
7358 +#define DOT11_MNG_REASON_LEN 2
7359 +#define DOT11_MNG_AID_LEN 2
7360 +#define DOT11_MNG_STATUS_LEN 2
7361 +#define DOT11_MNG_TIMESTAMP_LEN 8
7362 +
7363 +/* DUR/ID field in assoc resp is 0xc000 | AID */
7364 +#define DOT11_AID_MASK 0x3fff
7365 +
7366 +/* Reason Codes */
7367 +#define DOT11_RC_RESERVED 0
7368 +#define DOT11_RC_UNSPECIFIED 1 /* Unspecified reason */
7369 +#define DOT11_RC_AUTH_INVAL 2 /* Previous authentication no longer valid */
7370 +#define DOT11_RC_DEAUTH_LEAVING 3 /* Deauthenticated because sending station is
7371 + leaving (or has left) IBSS or ESS */
7372 +#define DOT11_RC_INACTIVITY 4 /* Disassociated due to inactivity */
7373 +#define DOT11_RC_BUSY 5 /* Disassociated because AP is unable to handle
7374 + all currently associated stations */
7375 +#define DOT11_RC_INVAL_CLASS_2 6 /* Class 2 frame received from
7376 + nonauthenticated station */
7377 +#define DOT11_RC_INVAL_CLASS_3 7 /* Class 3 frame received from
7378 + nonassociated station */
7379 +#define DOT11_RC_DISASSOC_LEAVING 8 /* Disassociated because sending station is
7380 + leaving (or has left) BSS */
7381 +#define DOT11_RC_NOT_AUTH 9 /* Station requesting (re)association is
7382 + not authenticated with responding station */
7383 +#define DOT11_RC_MAX 23 /* Reason codes > 23 are reserved */
7384 +
7385 +/* Status Codes */
7386 +#define DOT11_STATUS_SUCCESS 0 /* Successful */
7387 +#define DOT11_STATUS_FAILURE 1 /* Unspecified failure */
7388 +#define DOT11_STATUS_CAP_MISMATCH 10 /* Cannot support all requested capabilities
7389 + in the Capability Information field */
7390 +#define DOT11_STATUS_REASSOC_FAIL 11 /* Reassociation denied due to inability to
7391 + confirm that association exists */
7392 +#define DOT11_STATUS_ASSOC_FAIL 12 /* Association denied due to reason outside
7393 + the scope of this standard */
7394 +#define DOT11_STATUS_AUTH_MISMATCH 13 /* Responding station does not support the
7395 + specified authentication algorithm */
7396 +#define DOT11_STATUS_AUTH_SEQ 14 /* Received an Authentication frame with
7397 + authentication transaction sequence number
7398 + out of expected sequence */
7399 +#define DOT11_STATUS_AUTH_CHALLENGE_FAIL 15 /* Authentication rejected because of challenge failure */
7400 +#define DOT11_STATUS_AUTH_TIMEOUT 16 /* Authentication rejected due to timeout waiting
7401 + for next frame in sequence */
7402 +#define DOT11_STATUS_ASSOC_BUSY_FAIL 17 /* Association denied because AP is unable to
7403 + handle additional associated stations */
7404 +#define DOT11_STATUS_ASSOC_RATE_MISMATCH 18 /* Association denied due to requesting station
7405 + not supporting all of the data rates in the
7406 + BSSBasicRateSet parameter */
7407 +#define DOT11_STATUS_ASSOC_SHORT_REQUIRED 19 /* Association denied due to requesting station
7408 + not supporting the Short Preamble option */
7409 +#define DOT11_STATUS_ASSOC_PBCC_REQUIRED 20 /* Association denied due to requesting station
7410 + not supporting the PBCC Modulation option */
7411 +#define DOT11_STATUS_ASSOC_AGILITY_REQUIRED 21 /* Association denied due to requesting station
7412 + not supporting the Channel Agility option */
7413 +#define DOT11_STATUS_ASSOC_SPECTRUM_REQUIRED 22 /* Association denied because Spectrum Management
7414 + capability is required. */
7415 +#define DOT11_STATUS_ASSOC_BAD_POWER_CAP 23 /* Association denied because the info in the
7416 + Power Cap element is unacceptable. */
7417 +#define DOT11_STATUS_ASSOC_BAD_SUP_CHANNELS 24 /* Association denied because the info in the
7418 + Supported Channel element is unacceptable */
7419 +#define DOT11_STATUS_ASSOC_SHORTSLOT_REQUIRED 25 /* Association denied due to requesting station
7420 + not supporting the Short Slot Time option */
7421 +#define DOT11_STATUS_ASSOC_ERPBCC_REQUIRED 26 /* Association denied due to requesting station
7422 + not supporting the ER-PBCC Modulation option */
7423 +#define DOT11_STATUS_ASSOC_DSSOFDM_REQUIRED 27 /* Association denied due to requesting station
7424 + not supporting the DSS-OFDM option */
7425 +
7426 +/* Info Elts, length of INFORMATION portion of Info Elts */
7427 +#define DOT11_MNG_DS_PARAM_LEN 1
7428 +#define DOT11_MNG_IBSS_PARAM_LEN 2
7429 +
7430 +/* TIM Info element has 3 bytes fixed info in INFORMATION field,
7431 + * followed by 1 to 251 bytes of Partial Virtual Bitmap */
7432 +#define DOT11_MNG_TIM_FIXED_LEN 3
7433 +#define DOT11_MNG_TIM_DTIM_COUNT 0
7434 +#define DOT11_MNG_TIM_DTIM_PERIOD 1
7435 +#define DOT11_MNG_TIM_BITMAP_CTL 2
7436 +#define DOT11_MNG_TIM_PVB 3
7437 +
7438 +/* TLV defines */
7439 +#define TLV_TAG_OFF 0
7440 +#define TLV_LEN_OFF 1
7441 +#define TLV_HDR_LEN 2
7442 +#define TLV_BODY_OFF 2
7443 +
7444 +/* Management Frame Information Element IDs */
7445 +#define DOT11_MNG_SSID_ID 0
7446 +#define DOT11_MNG_RATES_ID 1
7447 +#define DOT11_MNG_FH_PARMS_ID 2
7448 +#define DOT11_MNG_DS_PARMS_ID 3
7449 +#define DOT11_MNG_CF_PARMS_ID 4
7450 +#define DOT11_MNG_TIM_ID 5
7451 +#define DOT11_MNG_IBSS_PARMS_ID 6
7452 +#define DOT11_MNG_COUNTRY_ID 7
7453 +#define DOT11_MNG_HOPPING_PARMS_ID 8
7454 +#define DOT11_MNG_HOPPING_TABLE_ID 9
7455 +#define DOT11_MNG_REQUEST_ID 10
7456 +#define DOT11_MNG_CHALLENGE_ID 16
7457 +#define DOT11_MNG_PWR_CONSTRAINT_ID 32 /* 11H PowerConstraint */
7458 +#define DOT11_MNG_PWR_CAP_ID 33 /* 11H PowerCapability */
7459 +#define DOT11_MNG_TPC_REQUEST_ID 34 /* 11H TPC Request */
7460 +#define DOT11_MNG_TPC_REPORT_ID 35 /* 11H TPC Report */
7461 +#define DOT11_MNG_SUPP_CHANNELS_ID 36 /* 11H Supported Channels */
7462 +#define DOT11_MNG_CHANNEL_SWITCH_ID 37 /* 11H ChannelSwitch Announcement*/
7463 +#define DOT11_MNG_MEASURE_REQUEST_ID 38 /* 11H MeasurementRequest */
7464 +#define DOT11_MNG_MEASURE_REPORT_ID 39 /* 11H MeasurementReport */
7465 +#define DOT11_MNG_QUIET_ID 40 /* 11H Quiet */
7466 +#define DOT11_MNG_IBSS_DFS_ID 41 /* 11H IBSS_DFS */
7467 +#define DOT11_MNG_ERP_ID 42
7468 +#define DOT11_MNG_NONERP_ID 47
7469 +#define DOT11_MNG_EXT_RATES_ID 50
7470 +#define DOT11_MNG_WPA_ID 221
7471 +#define DOT11_MNG_PROPR_ID 221
7472 +
7473 +/* ERP info element bit values */
7474 +#define DOT11_MNG_ERP_LEN 1 /* ERP is currently 1 byte long */
7475 +#define DOT11_MNG_NONERP_PRESENT 0x01 /* NonERP (802.11b) STAs are present in the BSS */
7476 +#define DOT11_MNG_USE_PROTECTION 0x02 /* Use protection mechanisms for ERP-OFDM frames */
7477 +#define DOT11_MNG_BARKER_PREAMBLE 0x04 /* Short Preambles: 0 == allowed, 1 == not allowed */
7478 +
7479 +/* Capability Information Field */
7480 +#define DOT11_CAP_ESS 0x0001
7481 +#define DOT11_CAP_IBSS 0x0002
7482 +#define DOT11_CAP_POLLABLE 0x0004
7483 +#define DOT11_CAP_POLL_RQ 0x0008
7484 +#define DOT11_CAP_PRIVACY 0x0010
7485 +#define DOT11_CAP_SHORT 0x0020
7486 +#define DOT11_CAP_PBCC 0x0040
7487 +#define DOT11_CAP_AGILITY 0x0080
7488 +#define DOT11_CAP_SPECTRUM 0x0100
7489 +#define DOT11_CAP_SHORTSLOT 0x0400
7490 +#define DOT11_CAP_CCK_OFDM 0x2000
7491 +
7492 +/* Action Frame Constants */
7493 +#define DOT11_ACTION_CAT_ERR_MASK 0x10
7494 +#define DOT11_ACTION_CAT_SPECT_MNG 0x00
7495 +
7496 +#define DOT11_ACTION_ID_M_REQ 0
7497 +#define DOT11_ACTION_ID_M_REP 1
7498 +#define DOT11_ACTION_ID_TPC_REQ 2
7499 +#define DOT11_ACTION_ID_TPC_REP 3
7500 +#define DOT11_ACTION_ID_CHANNEL_SWITCH 4
7501 +
7502 +/* MLME Enumerations */
7503 +#define DOT11_BSSTYPE_INFRASTRUCTURE 0
7504 +#define DOT11_BSSTYPE_INDEPENDENT 1
7505 +#define DOT11_BSSTYPE_ANY 2
7506 +#define DOT11_SCANTYPE_ACTIVE 0
7507 +#define DOT11_SCANTYPE_PASSIVE 1
7508 +
7509 +/* 802.11 A PHY constants */
7510 +#define APHY_SLOT_TIME 9
7511 +#define APHY_SIFS_TIME 16
7512 +#define APHY_DIFS_TIME (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME))
7513 +#define APHY_PREAMBLE_TIME 16
7514 +#define APHY_SIGNAL_TIME 4
7515 +#define APHY_SYMBOL_TIME 4
7516 +#define APHY_SERVICE_NBITS 16
7517 +#define APHY_TAIL_NBITS 6
7518 +#define APHY_CWMIN 15
7519 +
7520 +/* 802.11 B PHY constants */
7521 +#define BPHY_SLOT_TIME 20
7522 +#define BPHY_SIFS_TIME 10
7523 +#define BPHY_DIFS_TIME 50
7524 +#define BPHY_PLCP_TIME 192
7525 +#define BPHY_PLCP_SHORT_TIME 96
7526 +#define BPHY_CWMIN 31
7527 +
7528 +/* 802.11 G constants */
7529 +#define DOT11_OFDM_SIGNAL_EXTENSION 6
7530 +
7531 +#define PHY_CWMAX 1023
7532 +
7533 +#define DOT11_MAXNUMFRAGS 16 /* max # fragments per MSDU */
7534 +
7535 +/* dot11Counters Table - 802.11 spec., Annex D */
7536 +typedef struct d11cnt {
7537 + uint32 txfrag; /* dot11TransmittedFragmentCount */
7538 + uint32 txmulti; /* dot11MulticastTransmittedFrameCount */
7539 + uint32 txfail; /* dot11FailedCount */
7540 + uint32 txretry; /* dot11RetryCount */
7541 + uint32 txretrie; /* dot11MultipleRetryCount */
7542 + uint32 rxdup; /* dot11FrameduplicateCount */
7543 + uint32 txrts; /* dot11RTSSuccessCount */
7544 + uint32 txnocts; /* dot11RTSFailureCount */
7545 + uint32 txnoack; /* dot11ACKFailureCount */
7546 + uint32 rxfrag; /* dot11ReceivedFragmentCount */
7547 + uint32 rxmulti; /* dot11MulticastReceivedFrameCount */
7548 + uint32 rxcrc; /* dot11FCSErrorCount */
7549 + uint32 txfrmsnt; /* dot11TransmittedFrameCount */
7550 + uint32 rxundec; /* dot11WEPUndecryptableCount */
7551 +} d11cnt_t;
7552 +
7553 +/* BRCM OUI */
7554 +#define BRCM_OUI "\x00\x10\x18"
7555 +
7556 +/* WPA definitions */
7557 +#define WPA_VERSION 1
7558 +#define WPA_OUI "\x00\x50\xF2"
7559 +
7560 +#define WPA_OUI_LEN 3
7561 +
7562 +/* WPA authentication modes */
7563 +#define WPA_AUTH_NONE 0 /* None */
7564 +#define WPA_AUTH_UNSPECIFIED 1 /* Unspecified authentication over 802.1X: default for WPA */
7565 +#define WPA_AUTH_PSK 2 /* Pre-shared Key over 802.1X */
7566 +#define WPA_AUTH_DISABLED 255 /* Legacy (i.e., non-WPA) */
7567 +
7568 +#define IS_WPA_AUTH(auth) ((auth) == WPA_AUTH_NONE || \
7569 + (auth) == WPA_AUTH_UNSPECIFIED || \
7570 + (auth) == WPA_AUTH_PSK)
7571 +
7572 +
7573 +/* Key related defines */
7574 +#define DOT11_MAX_KEY_SIZE 32 /* max size of any key */
7575 +#define DOT11_MAX_IV_SIZE 16 /* max size of any IV */
7576 +#define DOT11_EXT_IV_FLAG (1<<5) /* flag to indicate IV is > 4 bytes */
7577 +
7578 +#define WEP1_KEY_SIZE 5 /* max size of any WEP key */
7579 +#define WEP1_KEY_HEX_SIZE 10 /* size of WEP key in hex. */
7580 +#define WEP128_KEY_SIZE 13 /* max size of any WEP key */
7581 +#define WEP128_KEY_HEX_SIZE 26 /* size of WEP key in hex. */
7582 +#define TKIP_MIC_SIZE 8 /* size of TKIP MIC */
7583 +#define TKIP_EOM_SIZE 7 /* max size of TKIP EOM */
7584 +#define TKIP_EOM_FLAG 0x5a /* TKIP EOM flag byte */
7585 +#define TKIP_KEY_SIZE 32 /* size of any TKIP key */
7586 +#define TKIP_MIC_AUTH_TX 16 /* offset to Authenticator MIC TX key */
7587 +#define TKIP_MIC_AUTH_RX 24 /* offset to Authenticator MIC RX key */
7588 +#define TKIP_MIC_SUP_RX 16 /* offset to Supplicant MIC RX key */
7589 +#define TKIP_MIC_SUP_TX 24 /* offset to Supplicant MIC TX key */
7590 +#define AES_KEY_SIZE 16 /* size of AES key */
7591 +
7592 +#undef PACKED
7593 +#if !defined(__GNUC__)
7594 +#pragma pack()
7595 +#endif
7596 +
7597 +#endif /* _802_11_H_ */
7598 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/proto/ethernet.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/proto/ethernet.h
7599 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/proto/ethernet.h 1970-01-01 01:00:00.000000000 +0100
7600 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/proto/ethernet.h 2005-08-28 11:12:20.450856112 +0200
7601 @@ -0,0 +1,145 @@
7602 +/*******************************************************************************
7603 + * $Id$
7604 + * Copyright 2001-2003, Broadcom Corporation
7605 + * All Rights Reserved.
7606 + *
7607 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7608 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7609 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7610 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7611 + * From FreeBSD 2.2.7: Fundamental constants relating to ethernet.
7612 + ******************************************************************************/
7613 +
7614 +#ifndef _NET_ETHERNET_H_ /* use native BSD ethernet.h when available */
7615 +#define _NET_ETHERNET_H_
7616 +
7617 +#ifndef _TYPEDEFS_H_
7618 +#include "typedefs.h"
7619 +#endif
7620 +
7621 +#if defined(__GNUC__)
7622 +#define PACKED __attribute__((packed))
7623 +#else
7624 +#define PACKED
7625 +#endif
7626 +
7627 +/*
7628 + * The number of bytes in an ethernet (MAC) address.
7629 + */
7630 +#define ETHER_ADDR_LEN 6
7631 +
7632 +/*
7633 + * The number of bytes in the type field.
7634 + */
7635 +#define ETHER_TYPE_LEN 2
7636 +
7637 +/*
7638 + * The number of bytes in the trailing CRC field.
7639 + */
7640 +#define ETHER_CRC_LEN 4
7641 +
7642 +/*
7643 + * The length of the combined header.
7644 + */
7645 +#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN)
7646 +
7647 +/*
7648 + * The minimum packet length.
7649 + */
7650 +#define ETHER_MIN_LEN 64
7651 +
7652 +/*
7653 + * The minimum packet user data length.
7654 + */
7655 +#define ETHER_MIN_DATA 46
7656 +
7657 +/*
7658 + * The maximum packet length.
7659 + */
7660 +#define ETHER_MAX_LEN 1518
7661 +
7662 +/*
7663 + * The maximum packet user data length.
7664 + */
7665 +#define ETHER_MAX_DATA 1500
7666 +
7667 +/*
7668 + * Used to uniquely identify a 802.1q VLAN-tagged header.
7669 + */
7670 +#define VLAN_TAG 0x8100
7671 +
7672 +/*
7673 + * Located after dest & src address in ether header.
7674 + */
7675 +#define VLAN_FIELDS_OFFSET (ETHER_ADDR_LEN * 2)
7676 +
7677 +/*
7678 + * 4 bytes of vlan field info.
7679 + */
7680 +#define VLAN_FIELDS_SIZE 4
7681 +
7682 +/* location of pri bits in 16-bit vlan fields */
7683 +#define VLAN_PRI_SHIFT 13
7684 +
7685 +/* 3 bits of priority */
7686 +#define VLAN_PRI_MASK 7
7687 +
7688 +/* 802.1X ethertype */
7689 +#define ETHER_TYPE_802_1X 0x888e
7690 +
7691 +/*
7692 + * A macro to validate a length with
7693 + */
7694 +#define ETHER_IS_VALID_LEN(foo) \
7695 + ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
7696 +
7697 +
7698 +#ifndef __INCif_etherh /* Quick and ugly hack for VxWorks */
7699 +/*
7700 + * Structure of a 10Mb/s Ethernet header.
7701 + */
7702 +struct ether_header {
7703 + uint8 ether_dhost[ETHER_ADDR_LEN];
7704 + uint8 ether_shost[ETHER_ADDR_LEN];
7705 + uint16 ether_type;
7706 +} PACKED ;
7707 +
7708 +/*
7709 + * Structure of a 48-bit Ethernet address.
7710 + */
7711 +struct ether_addr {
7712 + uint8 octet[ETHER_ADDR_LEN];
7713 +} PACKED ;
7714 +#endif
7715 +
7716 +/*
7717 + * Takes a pointer, returns true if a 48-bit multicast address
7718 + * (including broadcast, since it is all ones)
7719 + */
7720 +#define ETHER_ISMULTI(ea) (((uint8 *)(ea))[0] & 1)
7721 +
7722 +/*
7723 + * Takes a pointer, returns true if a 48-bit broadcast (all ones)
7724 + */
7725 +#define ETHER_ISBCAST(ea) ((((uint8 *)(ea))[0] & \
7726 + ((uint8 *)(ea))[1] & \
7727 + ((uint8 *)(ea))[2] & \
7728 + ((uint8 *)(ea))[3] & \
7729 + ((uint8 *)(ea))[4] & \
7730 + ((uint8 *)(ea))[5]) == 0xff)
7731 +
7732 +static const struct ether_addr ether_bcast = {{255, 255, 255, 255, 255, 255}};
7733 +
7734 +/*
7735 + * Takes a pointer, returns true if a 48-bit null address (all zeros)
7736 + */
7737 +#define ETHER_ISNULLADDR(ea) ((((uint8 *)(ea))[0] | \
7738 + ((uint8 *)(ea))[1] | \
7739 + ((uint8 *)(ea))[2] | \
7740 + ((uint8 *)(ea))[3] | \
7741 + ((uint8 *)(ea))[4] | \
7742 + ((uint8 *)(ea))[5]) == 0)
7743 +
7744 +#undef PACKED
7745 +
7746 +#endif /* _NET_ETHERNET_H_ */
7747 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/rts/crc.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/rts/crc.h
7748 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/rts/crc.h 1970-01-01 01:00:00.000000000 +0100
7749 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/rts/crc.h 2005-08-28 11:12:20.451855960 +0200
7750 @@ -0,0 +1,69 @@
7751 +/*******************************************************************************
7752 + * $Id$
7753 + * Copyright 2001-2003, Broadcom Corporation
7754 + * All Rights Reserved.
7755 + *
7756 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7757 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7758 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7759 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7760 + * crc.h - a function to compute crc for iLine10 headers
7761 + ******************************************************************************/
7762 +
7763 +#ifndef _RTS_CRC_H_
7764 +#define _RTS_CRC_H_ 1
7765 +
7766 +#include "typedefs.h"
7767 +
7768 +#ifdef __cplusplus
7769 +extern "C" {
7770 +#endif
7771 +
7772 +
7773 +#define CRC8_INIT_VALUE 0xff /* Initial CRC8 checksum value */
7774 +#define CRC8_GOOD_VALUE 0x9f /* Good final CRC8 checksum value */
7775 +#define HCS_GOOD_VALUE 0x39 /* Good final header checksum value */
7776 +
7777 +#define CRC16_INIT_VALUE 0xffff /* Initial CRC16 checksum value */
7778 +#define CRC16_GOOD_VALUE 0xf0b8 /* Good final CRC16 checksum value */
7779 +
7780 +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
7781 +#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */
7782 +
7783 +void hcs(uint8 *, uint);
7784 +uint8 crc8(uint8 *, uint, uint8);
7785 +uint16 crc16(uint8 *, uint, uint16);
7786 +uint32 crc32(uint8 *, uint, uint32);
7787 +
7788 +/* macros for common usage */
7789 +
7790 +#define APPEND_CRC8(pbytes, nbytes) \
7791 +do { \
7792 + uint8 tmp = crc8(pbytes, nbytes, CRC8_INIT_VALUE) ^ 0xff; \
7793 + (pbytes)[(nbytes)] = tmp; \
7794 + (nbytes) += 1; \
7795 +} while (0)
7796 +
7797 +#define APPEND_CRC16(pbytes, nbytes) \
7798 +do { \
7799 + uint16 tmp = crc16(pbytes, nbytes, CRC16_INIT_VALUE) ^ 0xffff; \
7800 + (pbytes)[(nbytes) + 0] = (tmp >> 0) & 0xff; \
7801 + (pbytes)[(nbytes) + 1] = (tmp >> 8) & 0xff; \
7802 + (nbytes) += 2; \
7803 +} while (0)
7804 +
7805 +#define APPEND_CRC32(pbytes, nbytes) \
7806 +do { \
7807 + uint32 tmp = crc32(pbytes, nbytes, CRC32_INIT_VALUE) ^ 0xffffffff; \
7808 + (pbytes)[(nbytes) + 0] = (tmp >> 0) & 0xff; \
7809 + (pbytes)[(nbytes) + 1] = (tmp >> 8) & 0xff; \
7810 + (pbytes)[(nbytes) + 2] = (tmp >> 16) & 0xff; \
7811 + (pbytes)[(nbytes) + 3] = (tmp >> 24) & 0xff; \
7812 + (nbytes) += 4; \
7813 +} while (0)
7814 +
7815 +#ifdef __cplusplus
7816 +}
7817 +#endif
7818 +
7819 +#endif /* _RTS_CRC_H_ */
7820 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/s5.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/s5.h
7821 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/s5.h 1970-01-01 01:00:00.000000000 +0100
7822 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/s5.h 2005-08-28 11:12:20.451855960 +0200
7823 @@ -0,0 +1,103 @@
7824 +#ifndef _S5_H_
7825 +#define _S5_H_
7826 +/*
7827 + * Copyright 2003, Broadcom Corporation
7828 + * All Rights Reserved.
7829 + *
7830 + * Broadcom Sentry5 (S5) BCM5365, 53xx, BCM58xx SOC Internal Core
7831 + * and MIPS3301 (R4K) System Address Space
7832 + *
7833 + * This program is free software; you can redistribute it and/or
7834 + * modify it under the terms of the GNU General Public License as
7835 + * published by the Free Software Foundation, located in the file
7836 + * LICENSE.
7837 + *
7838 + * $Id$
7839 + *
7840 + */
7841 +
7842 +/* BCM5365 Address map */
7843 +#define KSEG1ADDR(x) ( (x) | 0xa0000000)
7844 +#define BCM5365_SDRAM 0x00000000 /* 0-128MB Physical SDRAM */
7845 +#define BCM5365_PCI_MEM 0x08000000 /* Host Mode PCI mem space (64MB) */
7846 +#define BCM5365_PCI_CFG 0x0c000000 /* Host Mode PCI cfg space (64MB) */
7847 +#define BCM5365_PCI_DMA 0x40000000 /* Client Mode PCI mem space (1GB)*/
7848 +#define BCM5365_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */
7849 +#define BCM5365_ENUM 0x18000000 /* Beginning of core enum space */
7850 +
7851 +/* BCM5365 Core register space */
7852 +#define BCM5365_REG_CHIPC 0x18000000 /* Chipcommon registers */
7853 +#define BCM5365_REG_EMAC0 0x18001000 /* Ethernet MAC0 core registers */
7854 +#define BCM5365_REG_IPSEC 0x18002000 /* BCM582x CryptoCore registers */
7855 +#define BCM5365_REG_USB 0x18003000 /* USB core registers */
7856 +#define BCM5365_REG_PCI 0x18004000 /* PCI core registers */
7857 +#define BCM5365_REG_MIPS33 0x18005000 /* MIPS core registers */
7858 +#define BCM5365_REG_MEMC 0x18006000 /* MEMC core registers */
7859 +#define BCM5365_REG_UARTS (BCM5365_REG_CHIPC + 0x300) /* UART regs */
7860 +#define BCM5365_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */
7861 +
7862 +/* COM Ports 1/2 */
7863 +#define BCM5365_UART (BCM5365_REG_UARTS)
7864 +#define BCM5365_UART_COM2 (BCM5365_REG_UARTS + 0x00000100)
7865 +
7866 +/* Registers common to MIPS33 Core used in 5365 */
7867 +#define MIPS33_FLASH_REGION 0x1fc00000 /* Boot FLASH Region */
7868 +#define MIPS33_EXTIF_REGION 0x1a000000 /* Chipcommon EXTIF region*/
7869 +#define BCM5365_EXTIF 0x1b000000 /* MISC_CS */
7870 +#define MIPS33_FLASH_REGION_AUX 0x1c000000 /* FLASH Region 2*/
7871 +
7872 +/* Internal Core Sonics Backplane Devices */
7873 +#define INTERNAL_UART_COM1 BCM5365_UART
7874 +#define INTERNAL_UART_COM2 BCM5365_UART_COM2
7875 +#define SB_REG_CHIPC BCM5365_REG_CHIPC
7876 +#define SB_REG_ENET0 BCM5365_REG_EMAC0
7877 +#define SB_REG_IPSEC BCM5365_REG_IPSEC
7878 +#define SB_REG_USB BCM5365_REG_USB
7879 +#define SB_REG_PCI BCM5365_REG_PCI
7880 +#define SB_REG_MIPS BCM5365_REG_MIPS33
7881 +#define SB_REG_MEMC BCM5365_REG_MEMC
7882 +#define SB_REG_MEMC_OFF 0x6000
7883 +#define SB_EXTIF_SPACE MIPS33_EXTIF_REGION
7884 +#define SB_FLASH_SPACE MIPS33_FLASH_REGION
7885 +
7886 +/*
7887 + * XXX
7888 + * 5365-specific backplane interrupt flag numbers. This should be done
7889 + * dynamically instead.
7890 + */
7891 +#define SBFLAG_PCI 0
7892 +#define SBFLAG_ENET0 1
7893 +#define SBFLAG_ILINE20 2
7894 +#define SBFLAG_CODEC 3
7895 +#define SBFLAG_USB 4
7896 +#define SBFLAG_EXTIF 5
7897 +#define SBFLAG_ENET1 6
7898 +
7899 +/* BCM95365 Local Bus devices */
7900 +#define BCM95365K_RESET_ADDR BCM5365_EXTIF
7901 +#define BCM95365K_BOARDID_ADDR (BCM5365_EXTIF | 0x4000)
7902 +#define BCM95365K_DOC_ADDR (BCM5365_EXTIF | 0x6000)
7903 +#define BCM95365K_LED_ADDR (BCM5365_EXTIF | 0xc000)
7904 +#define BCM95365K_TOD_REG_BASE (BCM95365K_NVRAM_ADDR | 0x1ff0)
7905 +#define BCM95365K_NVRAM_ADDR (BCM5365_EXTIF | 0xe000)
7906 +#define BCM95365K_NVRAM_SIZE 0x1ff0 /* 8K NVRAM : DS1743/STM48txx*/
7907 +
7908 +/* Write to DLR2416 VFD Display character RAM */
7909 +#define LED_REG(x) \
7910 + (*(volatile unsigned char *) (KSEG1ADDR(BCM95365K_LED_ADDR) + (x)))
7911 +
7912 +#ifdef CONFIG_VSIM
7913 +#define BCM5365_TRACE(trval) do { *((int *)0xa0002ff8) = (trval); \
7914 + } while (0)
7915 +#else
7916 +#define BCM5365_TRACE(trval) do { *((unsigned char *)\
7917 + KSEG1ADDR(BCM5365K_LED_ADDR)) = (trval); \
7918 + *((int *)0xa0002ff8) = (trval); } while (0)
7919 +#endif
7920 +
7921 +/* BCM9536R Local Bus devices */
7922 +#define BCM95365R_DOC_ADDR BCM5365_EXTIF
7923 +
7924 +
7925 +
7926 +#endif /*!_S5_H_ */
7927 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbchipc.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbchipc.h
7928 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbchipc.h 1970-01-01 01:00:00.000000000 +0100
7929 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbchipc.h 2005-08-28 11:12:20.468853376 +0200
7930 @@ -0,0 +1,281 @@
7931 +/*
7932 + * SiliconBackplane Chipcommon core hardware definitions.
7933 + *
7934 + * The chipcommon core provides chip identification, SB control,
7935 + * jtag, 0/1/2 uarts, clock frequency control, a watchdog interrupt timer,
7936 + * gpio interface, extbus, and support for serial and parallel flashes.
7937 + *
7938 + * Copyright 2001-2003, Broadcom Corporation
7939 + * All Rights Reserved.
7940 + *
7941 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7942 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7943 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7944 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7945 + *
7946 + * $Id$
7947 + */
7948 +
7949 +#ifndef _SBCHIPC_H
7950 +#define _SBCHIPC_H
7951 +
7952 +
7953 +/* cpp contortions to concatenate w/arg prescan */
7954 +#ifndef PAD
7955 +#define _PADLINE(line) pad ## line
7956 +#define _XSTR(line) _PADLINE(line)
7957 +#define PAD _XSTR(__LINE__)
7958 +#endif /* PAD */
7959 +
7960 +typedef volatile struct {
7961 + uint32 chipid; /* 0x0 */
7962 + uint32 capabilities;
7963 + uint32 corecontrol; /* corerev >= 1 */
7964 + uint32 PAD[5];
7965 +
7966 + /* Interrupt control */
7967 + uint32 intstatus; /* 0x20 */
7968 + uint32 intmask;
7969 + uint32 PAD[6];
7970 +
7971 + /* serial flash interface registers */
7972 + uint32 flashcontrol; /* 0x40 */
7973 + uint32 flashaddress;
7974 + uint32 flashdata;
7975 + uint32 PAD[1];
7976 +
7977 + /* Silicon backplane configuration broadcast control */
7978 + uint32 broadcastaddress;
7979 + uint32 broadcastdata;
7980 + uint32 PAD[2];
7981 +
7982 + /* gpio - cleared only by power-on-reset */
7983 + uint32 gpioin; /* 0x60 */
7984 + uint32 gpioout;
7985 + uint32 gpioouten;
7986 + uint32 gpiocontrol;
7987 + uint32 gpiointpolarity;
7988 + uint32 gpiointmask;
7989 + uint32 PAD[2];
7990 +
7991 + /* Watchdog timer */
7992 + uint32 watchdog; /* 0x80 */
7993 + uint32 PAD[3];
7994 +
7995 + /* clock control */
7996 + uint32 clockcontrol_n; /* 0x90 */
7997 + uint32 clockcontrol_sb; /* aka m0 */
7998 + uint32 clockcontrol_pci; /* aka m1 */
7999 + uint32 clockcontrol_m2; /* mii/uart/mipsref */
8000 + uint32 clockcontrol_mips; /* aka m3 */
8001 + uint32 uart_clkdiv; /* corerev >= 3 */
8002 + uint32 PAD[2];
8003 +
8004 + /* pll delay registers (corerev >= 4) */
8005 + uint32 pll_on_delay; /* 0xb0 */
8006 + uint32 fref_sel_delay;
8007 + uint32 slow_clk_ctl;
8008 + uint32 PAD[17];
8009 +
8010 + /* ExtBus control registers (corerev >= 3) */
8011 + uint32 cs01config; /* 0x100 */
8012 + uint32 cs01memwaitcnt;
8013 + uint32 cs01attrwaitcnt;
8014 + uint32 cs01iowaitcnt;
8015 + uint32 cs23config;
8016 + uint32 cs23memwaitcnt;
8017 + uint32 cs23attrwaitcnt;
8018 + uint32 cs23iowaitcnt;
8019 + uint32 cs4config;
8020 + uint32 cs4waitcnt;
8021 + uint32 parallelflashconfig;
8022 + uint32 parallelflashwaitcnt;
8023 + uint32 PAD[116];
8024 +
8025 + /* uarts */
8026 + uint8 uart0data; /* 0x300 */
8027 + uint8 uart0imr;
8028 + uint8 uart0fcr;
8029 + uint8 uart0lcr;
8030 + uint8 uart0mcr;
8031 + uint8 uart0lsr;
8032 + uint8 uart0msr;
8033 + uint8 uart0scratch;
8034 + uint8 PAD[248]; /* corerev >= 1 */
8035 +
8036 + uint8 uart1data; /* 0x400 */
8037 + uint8 uart1imr;
8038 + uint8 uart1fcr;
8039 + uint8 uart1lcr;
8040 + uint8 uart1mcr;
8041 + uint8 uart1lsr;
8042 + uint8 uart1msr;
8043 + uint8 uart1scratch;
8044 +} chipcregs_t;
8045 +
8046 +/* chipid */
8047 +#define CID_ID_MASK 0x0000ffff /* Chip Id mask */
8048 +#define CID_REV_MASK 0x000f0000 /* Chip Revision mask */
8049 +#define CID_REV_SHIFT 16 /* Chip Revision shift */
8050 +#define CID_PKG_MASK 0x00f00000 /* Package Option mask */
8051 +#define CID_PKG_SHIFT 20 /* Package Option shift */
8052 +#define CID_CC_MASK 0x0f000000 /* CoreCount (corerev >= 4) */
8053 +#define CID_CC_SHIFT 24
8054 +
8055 +/* capabilities */
8056 +#define CAP_UARTS_MASK 0x00000003 /* Number of uarts */
8057 +#define CAP_MIPSEB 0x00000004 /* MIPS is in big-endian mode */
8058 +#define CAP_UCLKSEL 0x00000018 /* UARTs clock select */
8059 +#define CAP_UINTCLK 0x00000008 /* UARTs are driven by internal divided clock */
8060 +#define CAP_UARTGPIO 0x00000020 /* UARTs own Gpio's 15:12 */
8061 +#define CAP_EXTBUS 0x00000040 /* External bus present */
8062 +#define CAP_FLASH_MASK 0x00000700 /* Type of flash */
8063 +#define CAP_PLL_MASK 0x00038000 /* Type of PLL */
8064 +#define CAP_PWR_CTL 0x00040000 /* Power control */
8065 +
8066 +/* PLL type */
8067 +#define PLL_NONE 0x00000000
8068 +#define PLL_TYPE1 0x00010000 /* 48Mhz base, 3 dividers */
8069 +#define PLL_TYPE2 0x00020000 /* 48Mhz, 4 dividers */
8070 +#define PLL_TYPE3 0x00030000 /* 25Mhz, 2 dividers */
8071 +#define PLL_TYPE4 0x00008000 /* 48Mhz, 4 dividers */
8072 +
8073 +/* corecontrol */
8074 +#define CC_UARTCLKO 0x00000001 /* Drive UART with internal clock */
8075 +#define CC_SE 0x00000002 /* sync clk out enable (corerev >= 3) */
8076 +
8077 +/* intstatus/intmask */
8078 +#define CI_EI 0x00000002 /* ro: ext intr pin (corerev >= 3) */
8079 +
8080 +/* slow_clk_ctl */
8081 +#define SCC_SS_MASK 0x00000007 /* slow clock source mask */
8082 +#define SCC_SS_LPO 0x00000000 /* source of slow clock is LPO */
8083 +#define SCC_SS_XTAL 0x00000001 /* source of slow clock is crystal */
8084 +#define SCC_SS_PCI 0x00000002 /* source of slow clock is PCI */
8085 +#define SCC_LF 0x00000200 /* LPOFreqSel, 1: 160Khz, 0: 32KHz */
8086 +#define SCC_LP 0x00000400 /* LPOPowerDown, 1: LPO is disabled, 0: LPO is enabled */
8087 +#define SCC_FS 0x00000800 /* ForceSlowClk, 1: sb/cores running on slow clock, 0: power logic control */
8088 +#define SCC_IP 0x00001000 /* IgnorePllOffReq, 1/0: power logic ignores/honors PLL clock disable requests from core */
8089 +#define SCC_XC 0x00002000 /* XtalControlEn, 1/0: power logic does/doesn't disable crystal when appropriate */
8090 +#define SCC_XP 0x00004000 /* XtalPU (RO), 1/0: crystal running/disabled */
8091 +#define SCC_CD_MASK 0xffff0000 /* ClockDivider mask, SlowClk = 1/(4+divisor) * crystal/PCI clock */
8092 +#define SCC_CD_SHF 16 /* CLockDivider shift */
8093 +
8094 +/* clockcontrol_n */
8095 +#define CN_N1_MASK 0x3f /* n1 control */
8096 +#define CN_N2_MASK 0x3f00 /* n2 control */
8097 +#define CN_N2_SHIFT 8
8098 +
8099 +/* clockcontrol_sb/pci/uart */
8100 +#define CC_M1_MASK 0x3f /* m1 control */
8101 +#define CC_M2_MASK 0x3f00 /* m2 control */
8102 +#define CC_M2_SHIFT 8
8103 +#define CC_M3_MASK 0x3f0000 /* m3 control */
8104 +#define CC_M3_SHIFT 16
8105 +#define CC_MC_MASK 0x1f000000 /* mux control */
8106 +#define CC_MC_SHIFT 24
8107 +
8108 +/* N3M Clock control values for 125Mhz */
8109 +#define CC_125_N 0x0802 /* Default values for bcm4310 */
8110 +#define CC_125_M 0x04020009
8111 +#define CC_125_M25 0x11090009
8112 +#define CC_125_M33 0x11090005
8113 +
8114 +/* N3M Clock control magic field values */
8115 +#define CC_F6_2 0x02 /* A factor of 2 in */
8116 +#define CC_F6_3 0x03 /* 6-bit fields like */
8117 +#define CC_F6_4 0x05 /* N1, M1 or M3 */
8118 +#define CC_F6_5 0x09
8119 +#define CC_F6_6 0x11
8120 +#define CC_F6_7 0x21
8121 +
8122 +#define CC_F5_BIAS 5 /* 5-bit fields get this added */
8123 +
8124 +#define CC_MC_BYPASS 0x08
8125 +#define CC_MC_M1 0x04
8126 +#define CC_MC_M1M2 0x02
8127 +#define CC_MC_M1M2M3 0x01
8128 +#define CC_MC_M1M3 0x11
8129 +
8130 +/* Type 2 Clock control magic field values */
8131 +#define CC_T2_BIAS 2 /* n1, n2, m1 & m3 bias */
8132 +#define CC_T2M2_BIAS 3 /* m2 bias */
8133 +
8134 +#define CC_T2MC_M1BYP 1
8135 +#define CC_T2MC_M2BYP 2
8136 +#define CC_T2MC_M3BYP 4
8137 +
8138 +/* Common clock base */
8139 +#define CC_CLOCK_BASE 24000000 /* Half the clock freq */
8140 +
8141 +/* Flash types in the chipcommon capabilities register */
8142 +#define FLASH_NONE 0x000 /* No flash */
8143 +#define SFLASH_ST 0x100 /* ST serial flash */
8144 +#define SFLASH_AT 0x200 /* Atmel serial flash */
8145 +#define PFLASH 0x700 /* Parallel flash */
8146 +
8147 +/* Bits in the config registers */
8148 +#define CC_CFG_EN 0x0001 /* Enable */
8149 +#define CC_CFG_EM_MASK 0x000e /* Extif Mode */
8150 +#define CC_CFG_EM_ASYNC 0x0002 /* Async/Parallel flash */
8151 +#define CC_CFG_EM_SYNC 0x0004 /* Synchronous */
8152 +#define CC_CFG_EM_PCMCIA 0x0008 /* PCMCIA */
8153 +#define CC_CFG_EM_IDE 0x000a /* IDE */
8154 +#define CC_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */
8155 +#define CC_CFG_CD_MASK 0x0060 /* Sync: Clock divisor */
8156 +#define CC_CFG_CE 0x0080 /* Sync: Clock enable */
8157 +#define CC_CFG_SB 0x0100 /* Sync: Size/Bytestrobe */
8158 +
8159 +/* Start/busy bit in flashcontrol */
8160 +#define SFLASH_START 0x80000000
8161 +#define SFLASH_BUSY SFLASH_START
8162 +
8163 +/* flashcontrol opcodes for ST flashes */
8164 +#define SFLASH_ST_WREN 0x0006 /* Write Enable */
8165 +#define SFLASH_ST_WRDIS 0x0004 /* Write Disable */
8166 +#define SFLASH_ST_RDSR 0x0105 /* Read Status Register */
8167 +#define SFLASH_ST_WRSR 0x0101 /* Write Status Register */
8168 +#define SFLASH_ST_READ 0x0303 /* Read Data Bytes */
8169 +#define SFLASH_ST_PP 0x0302 /* Page Program */
8170 +#define SFLASH_ST_SE 0x02d8 /* Sector Erase */
8171 +#define SFLASH_ST_BE 0x00c7 /* Bulk Erase */
8172 +#define SFLASH_ST_DP 0x00b9 /* Deep Power-down */
8173 +#define SFLASH_ST_RES 0x03ab /* Read Electronic Signature */
8174 +
8175 +/* Status register bits for ST flashes */
8176 +#define SFLASH_ST_WIP 0x01 /* Write In Progress */
8177 +#define SFLASH_ST_WEL 0x02 /* Write Enable Latch */
8178 +#define SFLASH_ST_BP_MASK 0x1c /* Block Protect */
8179 +#define SFLASH_ST_BP_SHIFT 2
8180 +#define SFLASH_ST_SRWD 0x80 /* Status Register Write Disable */
8181 +
8182 +/* flashcontrol opcodes for Atmel flashes */
8183 +#define SFLASH_AT_READ 0x07e8
8184 +#define SFLASH_AT_PAGE_READ 0x07d2
8185 +#define SFLASH_AT_BUF1_READ
8186 +#define SFLASH_AT_BUF2_READ
8187 +#define SFLASH_AT_STATUS 0x01d7
8188 +#define SFLASH_AT_BUF1_WRITE 0x0384
8189 +#define SFLASH_AT_BUF2_WRITE 0x0387
8190 +#define SFLASH_AT_BUF1_ERASE_PROGRAM 0x0283
8191 +#define SFLASH_AT_BUF2_ERASE_PROGRAM 0x0286
8192 +#define SFLASH_AT_BUF1_PROGRAM 0x0288
8193 +#define SFLASH_AT_BUF2_PROGRAM 0x0289
8194 +#define SFLASH_AT_PAGE_ERASE 0x0281
8195 +#define SFLASH_AT_BLOCK_ERASE 0x0250
8196 +#define SFLASH_AT_BUF1_WRITE_ERASE_PROGRAM 0x0382
8197 +#define SFLASH_AT_BUF2_WRITE_ERASE_PROGRAM 0x0385
8198 +#define SFLASH_AT_BUF1_LOAD 0x0253
8199 +#define SFLASH_AT_BUF2_LOAD 0x0255
8200 +#define SFLASH_AT_BUF1_COMPARE 0x0260
8201 +#define SFLASH_AT_BUF2_COMPARE 0x0261
8202 +#define SFLASH_AT_BUF1_REPROGRAM 0x0258
8203 +#define SFLASH_AT_BUF2_REPROGRAM 0x0259
8204 +
8205 +/* Status register bits for Atmel flashes */
8206 +#define SFLASH_AT_READY 0x80
8207 +#define SFLASH_AT_MISMATCH 0x40
8208 +#define SFLASH_AT_ID_MASK 0x38
8209 +#define SFLASH_AT_ID_SHIFT 3
8210 +
8211 +#endif /* _SBCHIPC_H */
8212 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbconfig.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbconfig.h
8213 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbconfig.h 1970-01-01 01:00:00.000000000 +0100
8214 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbconfig.h 2005-08-28 11:12:20.469853224 +0200
8215 @@ -0,0 +1,296 @@
8216 +/*
8217 + * Broadcom SiliconBackplane hardware register definitions.
8218 + *
8219 + * Copyright 2001-2003, Broadcom Corporation
8220 + * All Rights Reserved.
8221 + *
8222 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8223 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
8224 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8225 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
8226 + * $Id$
8227 + */
8228 +
8229 +#ifndef _SBCONFIG_H
8230 +#define _SBCONFIG_H
8231 +
8232 +/* cpp contortions to concatenate w/arg prescan */
8233 +#ifndef PAD
8234 +#define _PADLINE(line) pad ## line
8235 +#define _XSTR(line) _PADLINE(line)
8236 +#define PAD _XSTR(__LINE__)
8237 +#endif
8238 +
8239 +/*
8240 + * SiliconBackplane Address Map.
8241 + * All regions may not exist on all chips.
8242 + */
8243 +#define SB_SDRAM_BASE 0x00000000 /* Physical SDRAM */
8244 +#define SB_PCI_MEM 0x08000000 /* Host Mode PCI memory access space (64 MB) */
8245 +#define SB_PCI_CFG 0x0c000000 /* Host Mode PCI configuration space (64 MB) */
8246 +#define SB_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */
8247 +#define SB_ENUM_BASE 0x18000000 /* Enumeration space base */
8248 +#define SB_ENUM_LIM 0x18010000 /* Enumeration space limit */
8249 +#define SB_EXTIF_BASE 0x1f000000 /* External Interface region base address */
8250 +#define SB_PCI_DMA 0x40000000 /* Client Mode PCI memory access space (1 GB) */
8251 +#define SB_EUART (SB_EXTIF_BASE + 0x00800000)
8252 +#define SB_LED (SB_EXTIF_BASE + 0x00900000)
8253 +
8254 +/* enumeration space related defs */
8255 +#define SB_CORE_SIZE 0x1000 /* each core gets 4Kbytes for registers */
8256 +#define SB_MAXCORES ((SB_ENUM_LIM - SB_ENUM_BASE)/SB_CORE_SIZE)
8257 +#define SBCONFIGOFF 0xf00 /* core sbconfig regs are top 256bytes of regs */
8258 +#define SBCONFIGSIZE 256 /* sizeof (sbconfig_t) */
8259 +
8260 +/* mips address */
8261 +#define SB_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */
8262 +
8263 +/*
8264 + * Sonics Configuration Space Registers.
8265 + */
8266 +#ifdef _LANGUAGE_ASSEMBLY
8267 +
8268 +#define SBIPSFLAG 0x08
8269 +#define SBTPSFLAG 0x18
8270 +#define SBTMERRLOGA 0x48 /* sonics >= 2.3 */
8271 +#define SBTMERRLOG 0x50 /* sonics >= 2.3 */
8272 +#define SBADMATCH3 0x60
8273 +#define SBADMATCH2 0x68
8274 +#define SBADMATCH1 0x70
8275 +#define SBIMSTATE 0x90
8276 +#define SBINTVEC 0x94
8277 +#define SBTMSTATELOW 0x98
8278 +#define SBTMSTATEHIGH 0x9c
8279 +#define SBBWA0 0xa0
8280 +#define SBIMCONFIGLOW 0xa8
8281 +#define SBIMCONFIGHIGH 0xac
8282 +#define SBADMATCH0 0xb0
8283 +#define SBTMCONFIGLOW 0xb8
8284 +#define SBTMCONFIGHIGH 0xbc
8285 +#define SBBCONFIG 0xc0
8286 +#define SBBSTATE 0xc8
8287 +#define SBACTCNFG 0xd8
8288 +#define SBFLAGST 0xe8
8289 +#define SBIDLOW 0xf8
8290 +#define SBIDHIGH 0xfc
8291 +
8292 +
8293 +#else
8294 +
8295 +typedef volatile struct _sbconfig {
8296 + uint32 PAD[2];
8297 + uint32 sbipsflag; /* initiator port ocp slave flag */
8298 + uint32 PAD[3];
8299 + uint32 sbtpsflag; /* target port ocp slave flag */
8300 + uint32 PAD[11];
8301 + uint32 sbtmerrloga; /* (sonics >= 2.3) */
8302 + uint32 PAD;
8303 + uint32 sbtmerrlog; /* (sonics >= 2.3) */
8304 + uint32 PAD[3];
8305 + uint32 sbadmatch3; /* address match3 */
8306 + uint32 PAD;
8307 + uint32 sbadmatch2; /* address match2 */
8308 + uint32 PAD;
8309 + uint32 sbadmatch1; /* address match1 */
8310 + uint32 PAD[7];
8311 + uint32 sbimstate; /* initiator agent state */
8312 + uint32 sbintvec; /* interrupt mask */
8313 + uint32 sbtmstatelow; /* target state */
8314 + uint32 sbtmstatehigh; /* target state */
8315 + uint32 sbbwa0; /* bandwidth allocation table0 */
8316 + uint32 PAD;
8317 + uint32 sbimconfiglow; /* initiator configuration */
8318 + uint32 sbimconfighigh; /* initiator configuration */
8319 + uint32 sbadmatch0; /* address match0 */
8320 + uint32 PAD;
8321 + uint32 sbtmconfiglow; /* target configuration */
8322 + uint32 sbtmconfighigh; /* target configuration */
8323 + uint32 sbbconfig; /* broadcast configuration */
8324 + uint32 PAD;
8325 + uint32 sbbstate; /* broadcast state */
8326 + uint32 PAD[3];
8327 + uint32 sbactcnfg; /* activate configuration */
8328 + uint32 PAD[3];
8329 + uint32 sbflagst; /* current sbflags */
8330 + uint32 PAD[3];
8331 + uint32 sbidlow; /* identification */
8332 + uint32 sbidhigh; /* identification */
8333 +} sbconfig_t;
8334 +
8335 +#endif /* _LANGUAGE_ASSEMBLY */
8336 +
8337 +/* sbipsflag */
8338 +#define SBIPS_INT1_MASK 0x3f /* which sbflags get routed to mips interrupt 1 */
8339 +#define SBIPS_INT1_SHIFT 0
8340 +#define SBIPS_INT2_MASK 0x3f00 /* which sbflags get routed to mips interrupt 2 */
8341 +#define SBIPS_INT2_SHIFT 8
8342 +#define SBIPS_INT3_MASK 0x3f0000 /* which sbflags get routed to mips interrupt 3 */
8343 +#define SBIPS_INT3_SHIFT 16
8344 +#define SBIPS_INT4_MASK 0x3f000000 /* which sbflags get routed to mips interrupt 4 */
8345 +#define SBIPS_INT4_SHIFT 24
8346 +
8347 +/* sbtpsflag */
8348 +#define SBTPS_NUM0_MASK 0x3f /* interrupt sbFlag # generated by this core */
8349 +#define SBTPS_F0EN0 0x40 /* interrupt is always sent on the backplane */
8350 +
8351 +/* sbtmerrlog */
8352 +#define SBTMEL_CM 0x00000007 /* command */
8353 +#define SBTMEL_CI 0x0000ff00 /* connection id */
8354 +#define SBTMEL_EC 0x0f000000 /* error code */
8355 +#define SBTMEL_ME 0x80000000 /* multiple error */
8356 +
8357 +/* sbimstate */
8358 +#define SBIM_PC 0xf /* pipecount */
8359 +#define SBIM_AP_MASK 0x30 /* arbitration policy */
8360 +#define SBIM_AP_BOTH 0x00 /* use both timeslaces and token */
8361 +#define SBIM_AP_TS 0x10 /* use timesliaces only */
8362 +#define SBIM_AP_TK 0x20 /* use token only */
8363 +#define SBIM_AP_RSV 0x30 /* reserved */
8364 +#define SBIM_IBE 0x20000 /* inbanderror */
8365 +#define SBIM_TO 0x40000 /* timeout */
8366 +#define SBIM_BY 0x01800000 /* busy (sonics >= 2.3) */
8367 +#define SBIM_RJ 0x02000000 /* reject (sonics >= 2.3) */
8368 +
8369 +/* sbtmstatelow */
8370 +#define SBTML_RESET 0x1 /* reset */
8371 +#define SBTML_REJ 0x2 /* reject */
8372 +#define SBTML_CLK 0x10000 /* clock enable */
8373 +#define SBTML_FGC 0x20000 /* force gated clocks on */
8374 +#define SBTML_FL_MASK 0x3ffc0000 /* core-specific flags */
8375 +#define SBTML_PE 0x40000000 /* pme enable */
8376 +#define SBTML_BE 0x80000000 /* bist enable */
8377 +
8378 +/* sbtmstatehigh */
8379 +#define SBTMH_SERR 0x1 /* serror */
8380 +#define SBTMH_INT 0x2 /* interrupt */
8381 +#define SBTMH_BUSY 0x4 /* busy */
8382 +#define SBTMH_TO 0x00000020 /* timeout (sonics >= 2.3) */
8383 +#define SBTMH_FL_MASK 0x1fff0000 /* core-specific flags */
8384 +#define SBTMH_GCR 0x20000000 /* gated clock request */
8385 +#define SBTMH_BISTF 0x40000000 /* bist failed */
8386 +#define SBTMH_BISTD 0x80000000 /* bist done */
8387 +
8388 +/* sbbwa0 */
8389 +#define SBBWA_TAB0_MASK 0xffff /* lookup table 0 */
8390 +#define SBBWA_TAB1_MASK 0xffff /* lookup table 1 */
8391 +#define SBBWA_TAB1_SHIFT 16
8392 +
8393 +/* sbimconfiglow */
8394 +#define SBIMCL_STO_MASK 0x7 /* service timeout */
8395 +#define SBIMCL_RTO_MASK 0x70 /* request timeout */
8396 +#define SBIMCL_RTO_SHIFT 4
8397 +#define SBIMCL_CID_MASK 0xff0000 /* connection id */
8398 +#define SBIMCL_CID_SHIFT 16
8399 +
8400 +/* sbimconfighigh */
8401 +#define SBIMCH_IEM_MASK 0xc /* inband error mode */
8402 +#define SBIMCH_TEM_MASK 0x30 /* timeout error mode */
8403 +#define SBIMCH_TEM_SHIFT 4
8404 +#define SBIMCH_BEM_MASK 0xc0 /* bus error mode */
8405 +#define SBIMCH_BEM_SHIFT 6
8406 +
8407 +/* sbadmatch0 */
8408 +#define SBAM_TYPE_MASK 0x3 /* address type */
8409 +#define SBAM_AD64 0x4 /* reserved */
8410 +#define SBAM_ADINT0_MASK 0xf8 /* type0 size */
8411 +#define SBAM_ADINT0_SHIFT 3
8412 +#define SBAM_ADINT1_MASK 0x1f8 /* type1 size */
8413 +#define SBAM_ADINT1_SHIFT 3
8414 +#define SBAM_ADINT2_MASK 0x1f8 /* type2 size */
8415 +#define SBAM_ADINT2_SHIFT 3
8416 +#define SBAM_ADEN 0x400 /* enable */
8417 +#define SBAM_ADNEG 0x800 /* negative decode */
8418 +#define SBAM_BASE0_MASK 0xffffff00 /* type0 base address */
8419 +#define SBAM_BASE0_SHIFT 8
8420 +#define SBAM_BASE1_MASK 0xfffff000 /* type1 base address for the core */
8421 +#define SBAM_BASE1_SHIFT 12
8422 +#define SBAM_BASE2_MASK 0xffff0000 /* type2 base address for the core */
8423 +#define SBAM_BASE2_SHIFT 16
8424 +
8425 +/* sbtmconfiglow */
8426 +#define SBTMCL_CD_MASK 0xff /* clock divide */
8427 +#define SBTMCL_CO_MASK 0xf800 /* clock offset */
8428 +#define SBTMCL_CO_SHIFT 11
8429 +#define SBTMCL_IF_MASK 0xfc0000 /* interrupt flags */
8430 +#define SBTMCL_IF_SHIFT 18
8431 +#define SBTMCL_IM_MASK 0x3000000 /* interrupt mode */
8432 +#define SBTMCL_IM_SHIFT 24
8433 +
8434 +/* sbtmconfighigh */
8435 +#define SBTMCH_BM_MASK 0x3 /* busy mode */
8436 +#define SBTMCH_RM_MASK 0x3 /* retry mode */
8437 +#define SBTMCH_RM_SHIFT 2
8438 +#define SBTMCH_SM_MASK 0x30 /* stop mode */
8439 +#define SBTMCH_SM_SHIFT 4
8440 +#define SBTMCH_EM_MASK 0x300 /* sb error mode */
8441 +#define SBTMCH_EM_SHIFT 8
8442 +#define SBTMCH_IM_MASK 0xc00 /* int mode */
8443 +#define SBTMCH_IM_SHIFT 10
8444 +
8445 +/* sbbconfig */
8446 +#define SBBC_LAT_MASK 0x3 /* sb latency */
8447 +#define SBBC_MAX0_MASK 0xf0000 /* maxccntr0 */
8448 +#define SBBC_MAX0_SHIFT 16
8449 +#define SBBC_MAX1_MASK 0xf00000 /* maxccntr1 */
8450 +#define SBBC_MAX1_SHIFT 20
8451 +
8452 +/* sbbstate */
8453 +#define SBBS_SRD 0x1 /* st reg disable */
8454 +#define SBBS_HRD 0x2 /* hold reg disable */
8455 +
8456 +/* sbidlow */
8457 +#define SBIDL_CS_MASK 0x3 /* config space */
8458 +#define SBIDL_AR_MASK 0x38 /* # address ranges supported */
8459 +#define SBIDL_AR_SHIFT 3
8460 +#define SBIDL_SYNCH 0x40 /* sync */
8461 +#define SBIDL_INIT 0x80 /* initiator */
8462 +#define SBIDL_MINLAT_MASK 0xf00 /* minimum backplane latency */
8463 +#define SBIDL_MINLAT_SHIFT 8
8464 +#define SBIDL_MAXLAT 0xf000 /* maximum backplane latency */
8465 +#define SBIDL_MAXLAT_SHIFT 12
8466 +#define SBIDL_FIRST 0x10000 /* this initiator is first */
8467 +#define SBIDL_CW_MASK 0xc0000 /* cycle counter width */
8468 +#define SBIDL_CW_SHIFT 18
8469 +#define SBIDL_TP_MASK 0xf00000 /* target ports */
8470 +#define SBIDL_TP_SHIFT 20
8471 +#define SBIDL_IP_MASK 0xf000000 /* initiator ports */
8472 +#define SBIDL_IP_SHIFT 24
8473 +#define SBIDL_RV_MASK 0xf0000000 /* sonics backplane revision code */
8474 +#define SBIDL_RV_SHIFT 28
8475 +
8476 +/* sbidhigh */
8477 +#define SBIDH_RC_MASK 0xf /* revision code*/
8478 +#define SBIDH_CC_MASK 0xfff0 /* core code */
8479 +#define SBIDH_CC_SHIFT 4
8480 +#define SBIDH_VC_MASK 0xffff0000 /* vendor code */
8481 +#define SBIDH_VC_SHIFT 16
8482 +
8483 +#define SB_COMMIT 0xfd8 /* update buffered registers value */
8484 +
8485 +/* vendor codes */
8486 +#define SB_VEND_BCM 0x4243 /* Broadcom's SB vendor code */
8487 +
8488 +/* core codes */
8489 +#define SB_CC 0x800 /* chipcommon core */
8490 +#define SB_ILINE20 0x801 /* iline20 core */
8491 +#define SB_SDRAM 0x803 /* sdram core */
8492 +#define SB_PCI 0x804 /* pci core */
8493 +#define SB_MIPS 0x805 /* mips core */
8494 +#define SB_ENET 0x806 /* enet mac core */
8495 +#define SB_CODEC 0x807 /* v90 codec core */
8496 +#define SB_USB 0x808 /* usb 1.1 host/device core */
8497 +#define SB_ILINE100 0x80a /* iline100 core */
8498 +#define SB_IPSEC 0x80b /* ipsec core */
8499 +#define SB_PCMCIA 0x80d /* pcmcia core */
8500 +#define SB_MEMC 0x80f /* memc sdram core */
8501 +#define SB_EXTIF 0x811 /* external interface core */
8502 +#define SB_D11 0x812 /* 802.11 MAC core */
8503 +#define SB_MIPS33 0x816 /* mips3302 core */
8504 +#define SB_USB11H 0x817 /* usb 1.1 host core */
8505 +#define SB_USB11D 0x818 /* usb 1.1 device core */
8506 +#define SB_USB20H 0x819 /* usb 2.0 host core */
8507 +#define SB_USB20D 0x81A /* usb 2.0 device core */
8508 +#define SB_SDIOH 0x81B /* sdio host core */
8509 +#define SB_ROBO 0x81C /* robo switch core */
8510 +
8511 +#endif /* _SBCONFIG_H */
8512 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbextif.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbextif.h
8513 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbextif.h 1970-01-01 01:00:00.000000000 +0100
8514 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbextif.h 2005-08-28 11:12:20.470853072 +0200
8515 @@ -0,0 +1,242 @@
8516 +/*
8517 + * Hardware-specific External Interface I/O core definitions
8518 + * for the BCM47xx family of SiliconBackplane-based chips.
8519 + *
8520 + * The External Interface core supports a total of three external chip selects
8521 + * supporting external interfaces. One of the external chip selects is
8522 + * used for Flash, one is used for PCMCIA, and the other may be
8523 + * programmed to support either a synchronous interface or an
8524 + * asynchronous interface. The asynchronous interface can be used to
8525 + * support external devices such as UARTs and the BCM2019 Bluetooth
8526 + * baseband processor.
8527 + * The external interface core also contains 2 on-chip 16550 UARTs, clock
8528 + * frequency control, a watchdog interrupt timer, and a GPIO interface.
8529 + *
8530 + * Copyright 2001-2003, Broadcom Corporation
8531 + * All Rights Reserved.
8532 + *
8533 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8534 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
8535 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8536 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
8537 + * $Id$
8538 + */
8539 +
8540 +#ifndef _SBEXTIF_H
8541 +#define _SBEXTIF_H
8542 +
8543 +/* external interface address space */
8544 +#define EXTIF_PCMCIA_MEMBASE(x) (x)
8545 +#define EXTIF_PCMCIA_IOBASE(x) ((x) + 0x100000)
8546 +#define EXTIF_PCMCIA_CFGBASE(x) ((x) + 0x200000)
8547 +#define EXTIF_CFGIF_BASE(x) ((x) + 0x800000)
8548 +#define EXTIF_FLASH_BASE(x) ((x) + 0xc00000)
8549 +
8550 +/* cpp contortions to concatenate w/arg prescan */
8551 +#ifndef PAD
8552 +#define _PADLINE(line) pad ## line
8553 +#define _XSTR(line) _PADLINE(line)
8554 +#define PAD _XSTR(__LINE__)
8555 +#endif /* PAD */
8556 +
8557 +/*
8558 + * The multiple instances of output and output enable registers
8559 + * are present to allow driver software for multiple cores to control
8560 + * gpio outputs without needing to share a single register pair.
8561 + */
8562 +struct gpiouser {
8563 + uint32 out;
8564 + uint32 outen;
8565 +};
8566 +#define NGPIOUSER 5
8567 +
8568 +typedef volatile struct {
8569 + uint32 corecontrol;
8570 + uint32 extstatus;
8571 + uint32 PAD[2];
8572 +
8573 + /* pcmcia control registers */
8574 + uint32 pcmcia_config;
8575 + uint32 pcmcia_memwait;
8576 + uint32 pcmcia_attrwait;
8577 + uint32 pcmcia_iowait;
8578 +
8579 + /* programmable interface control registers */
8580 + uint32 prog_config;
8581 + uint32 prog_waitcount;
8582 +
8583 + /* flash control registers */
8584 + uint32 flash_config;
8585 + uint32 flash_waitcount;
8586 + uint32 PAD[4];
8587 +
8588 + uint32 watchdog;
8589 +
8590 + /* clock control */
8591 + uint32 clockcontrol_n;
8592 + uint32 clockcontrol_sb;
8593 + uint32 clockcontrol_pci;
8594 + uint32 clockcontrol_mii;
8595 + uint32 PAD[3];
8596 +
8597 + /* gpio */
8598 + uint32 gpioin;
8599 + struct gpiouser gpio[NGPIOUSER];
8600 + uint32 PAD;
8601 + uint32 ejtagouten;
8602 + uint32 gpiointpolarity;
8603 + uint32 gpiointmask;
8604 + uint32 PAD[153];
8605 +
8606 + uint8 uartdata;
8607 + uint8 PAD[3];
8608 + uint8 uartimer;
8609 + uint8 PAD[3];
8610 + uint8 uartfcr;
8611 + uint8 PAD[3];
8612 + uint8 uartlcr;
8613 + uint8 PAD[3];
8614 + uint8 uartmcr;
8615 + uint8 PAD[3];
8616 + uint8 uartlsr;
8617 + uint8 PAD[3];
8618 + uint8 uartmsr;
8619 + uint8 PAD[3];
8620 + uint8 uartscratch;
8621 + uint8 PAD[3];
8622 +} extifregs_t;
8623 +
8624 +/* corecontrol */
8625 +#define CC_UE (1 << 0) /* uart enable */
8626 +
8627 +/* extstatus */
8628 +#define ES_EM (1 << 0) /* endian mode (ro) */
8629 +#define ES_EI (1 << 1) /* external interrupt pin (ro) */
8630 +#define ES_GI (1 << 2) /* gpio interrupt pin (ro) */
8631 +
8632 +/* gpio bit mask */
8633 +#define GPIO_BIT0 (1 << 0)
8634 +#define GPIO_BIT1 (1 << 1)
8635 +#define GPIO_BIT2 (1 << 2)
8636 +#define GPIO_BIT3 (1 << 3)
8637 +#define GPIO_BIT4 (1 << 4)
8638 +#define GPIO_BIT5 (1 << 5)
8639 +#define GPIO_BIT6 (1 << 6)
8640 +#define GPIO_BIT7 (1 << 7)
8641 +
8642 +
8643 +/* pcmcia/prog/flash_config */
8644 +#define CF_EN (1 << 0) /* enable */
8645 +#define CF_EM_MASK 0xe /* mode */
8646 +#define CF_EM_SHIFT 1
8647 +#define CF_EM_FLASH 0x0 /* flash/asynchronous mode */
8648 +#define CF_EM_SYNC 0x2 /* synchronous mode */
8649 +#define CF_EM_PCMCIA 0x4 /* pcmcia mode */
8650 +#define CF_DS (1 << 4) /* destsize: 0=8bit, 1=16bit */
8651 +#define CF_BS (1 << 5) /* byteswap */
8652 +#define CF_CD_MASK 0xc0 /* clock divider */
8653 +#define CF_CD_SHIFT 6
8654 +#define CF_CD_DIV2 0x0 /* backplane/2 */
8655 +#define CF_CD_DIV3 0x40 /* backplane/3 */
8656 +#define CF_CD_DIV4 0x80 /* backplane/4 */
8657 +#define CF_CE (1 << 8) /* clock enable */
8658 +#define CF_SB (1 << 9) /* size/bytestrobe (synch only) */
8659 +
8660 +/* pcmcia_memwait */
8661 +#define PM_W0_MASK 0x3f /* waitcount0 */
8662 +#define PM_W1_MASK 0x1f00 /* waitcount1 */
8663 +#define PM_W1_SHIFT 8
8664 +#define PM_W2_MASK 0x1f0000 /* waitcount2 */
8665 +#define PM_W2_SHIFT 16
8666 +#define PM_W3_MASK 0x1f000000 /* waitcount3 */
8667 +#define PM_W3_SHIFT 24
8668 +
8669 +/* pcmcia_attrwait */
8670 +#define PA_W0_MASK 0x3f /* waitcount0 */
8671 +#define PA_W1_MASK 0x1f00 /* waitcount1 */
8672 +#define PA_W1_SHIFT 8
8673 +#define PA_W2_MASK 0x1f0000 /* waitcount2 */
8674 +#define PA_W2_SHIFT 16
8675 +#define PA_W3_MASK 0x1f000000 /* waitcount3 */
8676 +#define PA_W3_SHIFT 24
8677 +
8678 +/* pcmcia_iowait */
8679 +#define PI_W0_MASK 0x3f /* waitcount0 */
8680 +#define PI_W1_MASK 0x1f00 /* waitcount1 */
8681 +#define PI_W1_SHIFT 8
8682 +#define PI_W2_MASK 0x1f0000 /* waitcount2 */
8683 +#define PI_W2_SHIFT 16
8684 +#define PI_W3_MASK 0x1f000000 /* waitcount3 */
8685 +#define PI_W3_SHIFT 24
8686 +
8687 +/* prog_waitcount */
8688 +#define PW_W0_MASK 0x0000001f /* waitcount0 */
8689 +#define PW_W1_MASK 0x00001f00 /* waitcount1 */
8690 +#define PW_W1_SHIFT 8
8691 +#define PW_W2_MASK 0x001f0000 /* waitcount2 */
8692 +#define PW_W2_SHIFT 16
8693 +#define PW_W3_MASK 0x1f000000 /* waitcount3 */
8694 +#define PW_W3_SHIFT 24
8695 +
8696 +#define PW_W0 0x0000000c
8697 +#define PW_W1 0x00000a00
8698 +#define PW_W2 0x00020000
8699 +#define PW_W3 0x01000000
8700 +
8701 +/* flash_waitcount */
8702 +#define FW_W0_MASK 0x1f /* waitcount0 */
8703 +#define FW_W1_MASK 0x1f00 /* waitcount1 */
8704 +#define FW_W1_SHIFT 8
8705 +#define FW_W2_MASK 0x1f0000 /* waitcount2 */
8706 +#define FW_W2_SHIFT 16
8707 +#define FW_W3_MASK 0x1f000000 /* waitcount3 */
8708 +#define FW_W3_SHIFT 24
8709 +
8710 +/* watchdog */
8711 +#define WATCHDOG_CLOCK 48000000 /* Hz */
8712 +
8713 +/* clockcontrol_n */
8714 +#define CN_N1_MASK 0x3f /* n1 control */
8715 +#define CN_N2_MASK 0x3f00 /* n2 control */
8716 +#define CN_N2_SHIFT 8
8717 +
8718 +/* clockcontrol_sb/pci/mii */
8719 +#define CC_M1_MASK 0x3f /* m1 control */
8720 +#define CC_M2_MASK 0x3f00 /* m2 control */
8721 +#define CC_M2_SHIFT 8
8722 +#define CC_M3_MASK 0x3f0000 /* m3 control */
8723 +#define CC_M3_SHIFT 16
8724 +#define CC_MC_MASK 0x1f000000 /* mux control */
8725 +#define CC_MC_SHIFT 24
8726 +
8727 +/* Clock control default values */
8728 +#define CC_DEF_N 0x0009 /* Default values for bcm4710 */
8729 +#define CC_DEF_100 0x04020011
8730 +#define CC_DEF_33 0x11030011
8731 +#define CC_DEF_25 0x11050011
8732 +
8733 +/* Clock control values for 125Mhz */
8734 +#define CC_125_N 0x0802
8735 +#define CC_125_M 0x04020009
8736 +#define CC_125_M25 0x11090009
8737 +#define CC_125_M33 0x11090005
8738 +
8739 +/* Clock control magic field values */
8740 +#define CC_F6_2 0x02 /* A factor of 2 in */
8741 +#define CC_F6_3 0x03 /* 6-bit fields like */
8742 +#define CC_F6_4 0x05 /* N1, M1 or M3 */
8743 +#define CC_F6_5 0x09
8744 +#define CC_F6_6 0x11
8745 +#define CC_F6_7 0x21
8746 +
8747 +#define CC_F5_BIAS 5 /* 5-bit fields get this added */
8748 +
8749 +#define CC_MC_BYPASS 0x08
8750 +#define CC_MC_M1 0x04
8751 +#define CC_MC_M1M2 0x02
8752 +#define CC_MC_M1M2M3 0x01
8753 +#define CC_MC_M1M3 0x11
8754 +
8755 +#define CC_CLOCK_BASE 24000000 /* Half the clock freq. in the 4710 */
8756 +
8757 +#endif /* _SBEXTIF_H */
8758 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbmemc.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbmemc.h
8759 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbmemc.h 1970-01-01 01:00:00.000000000 +0100
8760 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbmemc.h 2005-08-28 11:12:20.471852920 +0200
8761 @@ -0,0 +1,144 @@
8762 +/*
8763 + * BCM47XX Sonics SiliconBackplane DDR/SDRAM controller core hardware definitions.
8764 + *
8765 + * Copyright 2001-2003, Broadcom Corporation
8766 + * All Rights Reserved.
8767 + *
8768 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8769 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
8770 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8771 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
8772 + * $Id$
8773 + */
8774 +
8775 +#ifndef _SBMEMC_H
8776 +#define _SBMEMC_H
8777 +
8778 +#ifdef _LANGUAGE_ASSEMBLY
8779 +
8780 +#define MEMC_CONTROL 0x00
8781 +#define MEMC_CONFIG 0x04
8782 +#define MEMC_REFRESH 0x08
8783 +#define MEMC_BISTSTAT 0x0c
8784 +#define MEMC_MODEBUF 0x10
8785 +#define MEMC_BKCLS 0x14
8786 +#define MEMC_PRIORINV 0x18
8787 +#define MEMC_DRAMTIM 0x1c
8788 +#define MEMC_INTSTAT 0x20
8789 +#define MEMC_INTMASK 0x24
8790 +#define MEMC_INTINFO 0x28
8791 +#define MEMC_NCDLCTL 0x30
8792 +#define MEMC_RDNCDLCOR 0x34
8793 +#define MEMC_WRNCDLCOR 0x38
8794 +#define MEMC_MISCDLYCTL 0x3c
8795 +#define MEMC_DQSGATENCDL 0x40
8796 +#define MEMC_SPARE 0x44
8797 +#define MEMC_TPADDR 0x48
8798 +#define MEMC_TPDATA 0x4c
8799 +#define MEMC_BARRIER 0x50
8800 +#define MEMC_CORE 0x54
8801 +
8802 +
8803 +#else
8804 +
8805 +/* Sonics side: MEMC core registers */
8806 +typedef volatile struct sbmemcregs {
8807 + uint32 control;
8808 + uint32 config;
8809 + uint32 refresh;
8810 + uint32 biststat;
8811 + uint32 modebuf;
8812 + uint32 bkcls;
8813 + uint32 priorinv;
8814 + uint32 dramtim;
8815 + uint32 intstat;
8816 + uint32 intmask;
8817 + uint32 intinfo;
8818 + uint32 reserved1;
8819 + uint32 ncdlctl;
8820 + uint32 rdncdlcor;
8821 + uint32 wrncdlcor;
8822 + uint32 miscdlyctl;
8823 + uint32 dqsgatencdl;
8824 + uint32 spare;
8825 + uint32 tpaddr;
8826 + uint32 tpdata;
8827 + uint32 barrier;
8828 + uint32 core;
8829 +} sbmemcregs_t;
8830 +
8831 +#endif
8832 +
8833 +/* MEMC Core Init values (OCP ID 0x80f) */
8834 +
8835 +/* For sdr: */
8836 +#define MEMC_SD_CONFIG_INIT 0x00048000
8837 +#define MEMC_SD_DRAMTIM_INIT 0x000754da
8838 +#define MEMC_SD_RDNCDLCOR_INIT 0x00000000
8839 +#define MEMC_SD_WRNCDLCOR_INIT 0x49351200
8840 +#define MEMC_SD1_WRNCDLCOR_INIT 0x14500200 /* For corerev 1 (4712) */
8841 +#define MEMC_SD_MISCDLYCTL_INIT 0x00061c1b
8842 +#define MEMC_SD1_MISCDLYCTL_INIT 0x00021416 /* For corerev 1 (4712) */
8843 +#define MEMC_SD_CONTROL_INIT0 0x00000002
8844 +#define MEMC_SD_CONTROL_INIT1 0x00000008
8845 +#define MEMC_SD_CONTROL_INIT2 0x00000004
8846 +#define MEMC_SD_CONTROL_INIT3 0x00000010
8847 +#define MEMC_SD_CONTROL_INIT4 0x00000001
8848 +#define MEMC_SD_MODEBUF_INIT 0x00000000
8849 +#define MEMC_SD_REFRESH_INIT 0x0000840f
8850 +
8851 +
8852 +/* This is for SDRM8X8X4 */
8853 +#define MEMC_SDR_INIT 0x0008
8854 +#define MEMC_SDR_MODE 0x32
8855 +#define MEMC_SDR_NCDL 0x00020032
8856 +#define MEMC_SDR1_NCDL 0x0002020f /* For corerev 1 (4712) */
8857 +
8858 +/* For ddr: */
8859 +#define MEMC_CONFIG_INIT 0x00048000
8860 +#define MEMC_DRAMTIM_INIT 0x000754d9
8861 +#define MEMC_RDNCDLCOR_INIT 0x00000000
8862 +#define MEMC_WRNCDLCOR_INIT 0x49351200
8863 +#define MEMC_1_WRNCDLCOR_INIT 0x14500200
8864 +#define MEMC_DQSGATENCDL_INIT 0x00030000
8865 +#define MEMC_MISCDLYCTL_INIT 0x21061c1b
8866 +#define MEMC_1_MISCDLYCTL_INIT 0x21021400
8867 +#define MEMC_NCDLCTL_INIT 0x00002001
8868 +#define MEMC_CONTROL_INIT0 0x00000002
8869 +#define MEMC_CONTROL_INIT1 0x00000008
8870 +#define MEMC_MODEBUF_INIT0 0x00004000
8871 +#define MEMC_CONTROL_INIT2 0x00000010
8872 +#define MEMC_MODEBUF_INIT1 0x00000100
8873 +#define MEMC_CONTROL_INIT3 0x00000010
8874 +#define MEMC_CONTROL_INIT4 0x00000008
8875 +#define MEMC_REFRESH_INIT 0x0000840f
8876 +#define MEMC_CONTROL_INIT5 0x00000004
8877 +#define MEMC_MODEBUF_INIT2 0x00000000
8878 +#define MEMC_CONTROL_INIT6 0x00000010
8879 +#define MEMC_CONTROL_INIT7 0x00000001
8880 +
8881 +
8882 +/* This is for DDRM16X16X2 */
8883 +#define MEMC_DDR_INIT 0x0009
8884 +#define MEMC_DDR_MODE 0x62
8885 +#define MEMC_DDR_NCDL 0x0005050a
8886 +#define MEMC_DDR1_NCDL 0x00000a0a /* For corerev 1 (4712) */
8887 +
8888 +/* mask for sdr/ddr calibration registers */
8889 +#define MEMC_RDNCDLCOR_RD_MASK 0x000000ff
8890 +#define MEMC_WRNCDLCOR_WR_MASK 0x000000ff
8891 +#define MEMC_DQSGATENCDL_G_MASK 0x000000ff
8892 +
8893 +/* masks for miscdlyctl registers */
8894 +#define MEMC_MISC_SM_MASK 0x30000000
8895 +#define MEMC_MISC_SM_SHIFT 28
8896 +#define MEMC_MISC_SD_MASK 0x0f000000
8897 +#define MEMC_MISC_SD_SHIFT 24
8898 +
8899 +/* hw threshhold for calculating wr/rd for sdr memc */
8900 +#define MEMC_CD_THRESHOLD 128
8901 +
8902 +/* Low bit of init register says if memc is ddr or sdr */
8903 +#define MEMC_CONFIG_DDR 0x00000001
8904 +
8905 +#endif /* _SBMEMC_H */
8906 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbmips.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbmips.h
8907 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbmips.h 1970-01-01 01:00:00.000000000 +0100
8908 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbmips.h 2005-08-28 11:12:20.471852920 +0200
8909 @@ -0,0 +1,56 @@
8910 +/*
8911 + * Broadcom SiliconBackplane MIPS definitions
8912 + *
8913 + * SB MIPS cores are custom MIPS32 processors with SiliconBackplane
8914 + * OCP interfaces. The CP0 processor ID is 0x00024000, where bits
8915 + * 23:16 mean Broadcom and bits 15:8 mean a MIPS core with an OCP
8916 + * interface. The core revision is stored in the SB ID register in SB
8917 + * configuration space.
8918 + *
8919 + * Copyright 2001-2003, Broadcom Corporation
8920 + * All Rights Reserved.
8921 + *
8922 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8923 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
8924 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8925 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
8926 + *
8927 + * $Id$
8928 + */
8929 +
8930 +#ifndef _SBMIPS_H
8931 +#define _SBMIPS_H
8932 +
8933 +#ifndef _LANGUAGE_ASSEMBLY
8934 +
8935 +/* cpp contortions to concatenate w/arg prescan */
8936 +#ifndef PAD
8937 +#define _PADLINE(line) pad ## line
8938 +#define _XSTR(line) _PADLINE(line)
8939 +#define PAD _XSTR(__LINE__)
8940 +#endif /* PAD */
8941 +
8942 +typedef volatile struct {
8943 + uint32 corecontrol;
8944 + uint32 PAD[2];
8945 + uint32 biststatus;
8946 + uint32 PAD[4];
8947 + uint32 intstatus;
8948 + uint32 intmask;
8949 + uint32 timer;
8950 +} mipsregs_t;
8951 +
8952 +extern uint32 sb_flag(void *sbh);
8953 +extern uint sb_irq(void *sbh);
8954 +
8955 +extern void sb_serial_init(void *sbh, void (*add)(void *regs, uint irq, uint baud_base, uint reg_shift));
8956 +
8957 +extern void sb_mips_init(void *sbh);
8958 +extern uint32 sb_mips_clock(void *sbh);
8959 +extern bool sb_mips_setclock(void *sbh, uint32 mipsclock, uint32 sbclock, uint32 pciclock);
8960 +
8961 +extern uint32 sb_memc_get_ncdl(void *sbh);
8962 +
8963 +#endif /* _LANGUAGE_ASSEMBLY */
8964 +
8965 +#endif /* _SBMIPS_H */
8966 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbpci.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbpci.h
8967 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbpci.h 1970-01-01 01:00:00.000000000 +0100
8968 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbpci.h 2005-08-28 11:12:20.471852920 +0200
8969 @@ -0,0 +1,113 @@
8970 +/*
8971 + * BCM47XX Sonics SiliconBackplane PCI core hardware definitions.
8972 + *
8973 + * $Id$
8974 + * Copyright 2001-2003, Broadcom Corporation
8975 + * All Rights Reserved.
8976 + *
8977 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8978 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
8979 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8980 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
8981 + */
8982 +
8983 +#ifndef _SBPCI_H
8984 +#define _SBPCI_H
8985 +
8986 +/* cpp contortions to concatenate w/arg prescan */
8987 +#ifndef PAD
8988 +#define _PADLINE(line) pad ## line
8989 +#define _XSTR(line) _PADLINE(line)
8990 +#define PAD _XSTR(__LINE__)
8991 +#endif
8992 +
8993 +/* Sonics side: PCI core and host control registers */
8994 +typedef struct sbpciregs {
8995 + uint32 control; /* PCI control */
8996 + uint32 PAD[3];
8997 + uint32 arbcontrol; /* PCI arbiter control */
8998 + uint32 PAD[3];
8999 + uint32 intstatus; /* Interrupt status */
9000 + uint32 intmask; /* Interrupt mask */
9001 + uint32 sbtopcimailbox; /* Sonics to PCI mailbox */
9002 + uint32 PAD[9];
9003 + uint32 bcastaddr; /* Sonics broadcast address */
9004 + uint32 bcastdata; /* Sonics broadcast data */
9005 + uint32 PAD[2];
9006 + uint32 gpioin; /* ro: gpio input (>=rev2) */
9007 + uint32 gpioout; /* rw: gpio output (>=rev2) */
9008 + uint32 gpioouten; /* rw: gpio output enable (>= rev2) */
9009 + uint32 gpiocontrol; /* rw: gpio control (>= rev2) */
9010 + uint32 PAD[36];
9011 + uint32 sbtopci0; /* Sonics to PCI translation 0 */
9012 + uint32 sbtopci1; /* Sonics to PCI translation 1 */
9013 + uint32 sbtopci2; /* Sonics to PCI translation 2 */
9014 + uint32 PAD[445];
9015 + uint16 sprom[36]; /* SPROM shadow Area */
9016 + uint32 PAD[46];
9017 +} sbpciregs_t;
9018 +
9019 +/* PCI control */
9020 +#define PCI_RST_OE 0x01 /* When set, drives PCI_RESET out to pin */
9021 +#define PCI_RST 0x02 /* Value driven out to pin */
9022 +#define PCI_CLK_OE 0x04 /* When set, drives clock as gated by PCI_CLK out to pin */
9023 +#define PCI_CLK 0x08 /* Gate for clock driven out to pin */
9024 +
9025 +/* PCI arbiter control */
9026 +#define PCI_INT_ARB 0x01 /* When set, use an internal arbiter */
9027 +#define PCI_EXT_ARB 0x02 /* When set, use an external arbiter */
9028 +#define PCI_PARKID_MASK 0x06 /* Selects which agent is parked on an idle bus */
9029 +#define PCI_PARKID_SHIFT 1
9030 +#define PCI_PARKID_LAST 0 /* Last requestor */
9031 +#define PCI_PARKID_4710 1 /* 4710 */
9032 +#define PCI_PARKID_EXTREQ0 2 /* External requestor 0 */
9033 +#define PCI_PARKID_EXTREQ1 3 /* External requestor 1 */
9034 +
9035 +/* Interrupt status/mask */
9036 +#define PCI_INTA 0x01 /* PCI INTA# is asserted */
9037 +#define PCI_INTB 0x02 /* PCI INTB# is asserted */
9038 +#define PCI_SERR 0x04 /* PCI SERR# has been asserted (write one to clear) */
9039 +#define PCI_PERR 0x08 /* PCI PERR# has been asserted (write one to clear) */
9040 +#define PCI_PME 0x10 /* PCI PME# is asserted */
9041 +
9042 +/* (General) PCI/SB mailbox interrupts, two bits per pci function */
9043 +#define MAILBOX_F0_0 0x100 /* function 0, int 0 */
9044 +#define MAILBOX_F0_1 0x200 /* function 0, int 1 */
9045 +#define MAILBOX_F1_0 0x400 /* function 1, int 0 */
9046 +#define MAILBOX_F1_1 0x800 /* function 1, int 1 */
9047 +#define MAILBOX_F2_0 0x1000 /* function 2, int 0 */
9048 +#define MAILBOX_F2_1 0x2000 /* function 2, int 1 */
9049 +#define MAILBOX_F3_0 0x4000 /* function 3, int 0 */
9050 +#define MAILBOX_F3_1 0x8000 /* function 3, int 1 */
9051 +
9052 +/* Sonics broadcast address */
9053 +#define BCAST_ADDR_MASK 0xff /* Broadcast register address */
9054 +
9055 +/* Sonics to PCI translation types */
9056 +#define SBTOPCI0_MASK 0xfc000000
9057 +#define SBTOPCI1_MASK 0xfc000000
9058 +#define SBTOPCI2_MASK 0xc0000000
9059 +#define SBTOPCI_MEM 0
9060 +#define SBTOPCI_IO 1
9061 +#define SBTOPCI_CFG0 2
9062 +#define SBTOPCI_CFG1 3
9063 +#define SBTOPCI_PREF 0x4 /* prefetch enable */
9064 +#define SBTOPCI_BURST 0x8 /* burst enable */
9065 +
9066 +/* PCI side: Reserved PCI configuration registers (see pcicfg.h) */
9067 +#define cap_list rsvd_a[0]
9068 +#define bar0_window dev_dep[0x80 - 0x40]
9069 +#define bar1_window dev_dep[0x84 - 0x40]
9070 +#define sprom_control dev_dep[0x88 - 0x40]
9071 +
9072 +#ifndef _LANGUAGE_ASSEMBLY
9073 +
9074 +extern int sbpci_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len);
9075 +extern int sbpci_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len);
9076 +extern void sbpci_ban(uint16 core);
9077 +extern int sbpci_init(void *sbh);
9078 +extern void sbpci_check(void *sbh);
9079 +
9080 +#endif /* !_LANGUAGE_ASSEMBLY */
9081 +
9082 +#endif /* _SBPCI_H */
9083 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbpcmcia.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbpcmcia.h
9084 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbpcmcia.h 1970-01-01 01:00:00.000000000 +0100
9085 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbpcmcia.h 2005-08-28 11:12:20.472852768 +0200
9086 @@ -0,0 +1,131 @@
9087 +/*
9088 + * BCM43XX Sonics SiliconBackplane PCMCIA core hardware definitions.
9089 + *
9090 + * $Id$
9091 + * Copyright 2001-2003, Broadcom Corporation
9092 + * All Rights Reserved.
9093 + *
9094 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9095 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9096 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9097 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9098 + */
9099 +
9100 +#ifndef _SBPCMCIA_H
9101 +#define _SBPCMCIA_H
9102 +
9103 +
9104 +/* All the addresses that are offsets in attribute space are divided
9105 + * by two to account for the fact that odd bytes are invalid in
9106 + * attribute space and our read/write routines make the space appear
9107 + * as if they didn't exist. Still we want to show the original numbers
9108 + * as documented in the hnd_pcmcia core manual.
9109 + */
9110 +
9111 +/* PCMCIA Function Configuration Registers */
9112 +#define PCMCIA_FCR (0x700 / 2)
9113 +
9114 +#define FCR0_OFF 0
9115 +#define FCR1_OFF (0x40 / 2)
9116 +#define FCR2_OFF (0x80 / 2)
9117 +#define FCR3_OFF (0xc0 / 2)
9118 +
9119 +#define PCMCIA_FCR0 (0x700 / 2)
9120 +#define PCMCIA_FCR1 (0x740 / 2)
9121 +#define PCMCIA_FCR2 (0x780 / 2)
9122 +#define PCMCIA_FCR3 (0x7c0 / 2)
9123 +
9124 +/* Standard PCMCIA FCR registers */
9125 +
9126 +#define PCMCIA_COR 0
9127 +
9128 +#define COR_RST 0x80
9129 +#define COR_LEV 0x40
9130 +#define COR_IRQEN 0x04
9131 +#define COR_BLREN 0x01
9132 +#define COR_FUNEN 0x01
9133 +
9134 +
9135 +#define PCICIA_FCSR (2 / 2)
9136 +#define PCICIA_PRR (4 / 2)
9137 +#define PCICIA_SCR (6 / 2)
9138 +#define PCICIA_ESR (8 / 2)
9139 +
9140 +
9141 +#define PCM_MEMOFF 0x0000
9142 +#define F0_MEMOFF 0x1000
9143 +#define F1_MEMOFF 0x2000
9144 +#define F2_MEMOFF 0x3000
9145 +#define F3_MEMOFF 0x4000
9146 +
9147 +/* Memory base in the function fcr's */
9148 +#define MEM_ADDR0 (0x728 / 2)
9149 +#define MEM_ADDR1 (0x72a / 2)
9150 +#define MEM_ADDR2 (0x72c / 2)
9151 +
9152 +/* PCMCIA base plus Srom access in fcr0: */
9153 +#define PCMCIA_ADDR0 (0x072e / 2)
9154 +#define PCMCIA_ADDR1 (0x0730 / 2)
9155 +#define PCMCIA_ADDR2 (0x0732 / 2)
9156 +
9157 +#define MEM_SEG (0x0734 / 2)
9158 +#define SROM_CS (0x0736 / 2)
9159 +#define SROM_DATAL (0x0738 / 2)
9160 +#define SROM_DATAH (0x073a / 2)
9161 +#define SROM_ADDRL (0x073c / 2)
9162 +#define SROM_ADDRH (0x073e / 2)
9163 +
9164 +/* Values for srom_cs: */
9165 +#define SROM_IDLE 0
9166 +#define SROM_WRITE 1
9167 +#define SROM_READ 2
9168 +#define SROM_WEN 4
9169 +#define SROM_WDS 7
9170 +#define SROM_DONE 8
9171 +
9172 +/* CIS stuff */
9173 +
9174 +/* The CIS stops where the FCRs start */
9175 +#define CIS_SIZE PCMCIA_FCR
9176 +
9177 +/* Standard tuples we know about */
9178 +
9179 +#define CISTPL_MANFID 0x20 /* Manufacturer and device id */
9180 +#define CISTPL_FUNCE 0x22 /* Function extensions */
9181 +#define CISTPL_CFTABLE 0x1b /* Config table entry */
9182 +
9183 +/* Function extensions for LANs */
9184 +
9185 +#define LAN_TECH 1 /* Technology type */
9186 +#define LAN_SPEED 2 /* Raw bit rate */
9187 +#define LAN_MEDIA 3 /* Transmission media */
9188 +#define LAN_NID 4 /* Node identification (aka MAC addr) */
9189 +#define LAN_CONN 5 /* Connector standard */
9190 +
9191 +
9192 +/* CFTable */
9193 +#define CFTABLE_REGWIN_2K 0x08 /* 2k reg windows size */
9194 +#define CFTABLE_REGWIN_4K 0x10 /* 4k reg windows size */
9195 +#define CFTABLE_REGWIN_8K 0x20 /* 8k reg windows size */
9196 +
9197 +/* Vendor unique tuples are 0x80-0x8f. Within Broadcom we'll
9198 + * take one for HNBU, and use "extensions" (a la FUNCE) within it.
9199 + */
9200 +
9201 +#define CISTPL_BRCM_HNBU 0x80
9202 +
9203 +/* Subtypes of BRCM_HNBU: */
9204 +
9205 +#define HNBU_CHIPID 0x01 /* Six bytes with PCI vendor &
9206 + * device id and chiprev
9207 + */
9208 +#define HNBU_BOARDREV 0x02 /* Two bytes board revision */
9209 +#define HNBU_PAPARMS 0x03 /* Eleven bytes PA parameters */
9210 +#define HNBU_OEM 0x04 /* Eight bytes OEM data */
9211 +#define HNBU_CC 0x05 /* Default country code */
9212 +#define HNBU_AA 0x06 /* Antennas available */
9213 +#define HNBU_AG 0x07 /* Antenna gain */
9214 +#define HNBU_BOARDFLAGS 0x08 /* board flags */
9215 +#define HNBU_LED 0x09 /* LED set */
9216 +
9217 +#endif /* _SBPCMCIA_H */
9218 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbsdram.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbsdram.h
9219 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbsdram.h 1970-01-01 01:00:00.000000000 +0100
9220 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbsdram.h 2005-08-28 11:12:20.472852768 +0200
9221 @@ -0,0 +1,75 @@
9222 +/*
9223 + * BCM47XX Sonics SiliconBackplane SDRAM controller core hardware definitions.
9224 + *
9225 + * Copyright 2001-2003, Broadcom Corporation
9226 + * All Rights Reserved.
9227 + *
9228 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9229 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9230 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9231 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9232 + * $Id$
9233 + */
9234 +
9235 +#ifndef _SBSDRAM_H
9236 +#define _SBSDRAM_H
9237 +
9238 +#ifndef _LANGUAGE_ASSEMBLY
9239 +
9240 +/* Sonics side: SDRAM core registers */
9241 +typedef volatile struct sbsdramregs {
9242 + uint32 initcontrol; /* Generates external SDRAM initialization sequence */
9243 + uint32 config; /* Initializes external SDRAM mode register */
9244 + uint32 refresh; /* Controls external SDRAM refresh rate */
9245 + uint32 pad1;
9246 + uint32 pad2;
9247 +} sbsdramregs_t;
9248 +
9249 +#endif
9250 +
9251 +/* SDRAM initialization control (initcontrol) register bits */
9252 +#define SDRAM_CBR 0x0001 /* Writing 1 generates refresh cycle and toggles bit */
9253 +#define SDRAM_PRE 0x0002 /* Writing 1 generates precharge cycle and toggles bit */
9254 +#define SDRAM_MRS 0x0004 /* Writing 1 generates mode register select cycle and toggles bit */
9255 +#define SDRAM_EN 0x0008 /* When set, enables access to SDRAM */
9256 +#define SDRAM_16Mb 0x0000 /* Use 16 Megabit SDRAM */
9257 +#define SDRAM_64Mb 0x0010 /* Use 64 Megabit SDRAM */
9258 +#define SDRAM_128Mb 0x0020 /* Use 128 Megabit SDRAM */
9259 +#define SDRAM_RSVMb 0x0030 /* Use special SDRAM */
9260 +#define SDRAM_RST 0x0080 /* Writing 1 causes soft reset of controller */
9261 +#define SDRAM_SELFREF 0x0100 /* Writing 1 enables self refresh mode */
9262 +#define SDRAM_PWRDOWN 0x0200 /* Writing 1 causes controller to power down */
9263 +#define SDRAM_32BIT 0x0400 /* When set, indicates 32 bit SDRAM interface */
9264 +#define SDRAM_9BITCOL 0x0800 /* When set, indicates 9 bit column */
9265 +
9266 +/* SDRAM configuration (config) register bits */
9267 +#define SDRAM_BURSTFULL 0x0000 /* Use full page bursts */
9268 +#define SDRAM_BURST8 0x0001 /* Use burst of 8 */
9269 +#define SDRAM_BURST4 0x0002 /* Use burst of 4 */
9270 +#define SDRAM_BURST2 0x0003 /* Use burst of 2 */
9271 +#define SDRAM_CAS3 0x0000 /* Use CAS latency of 3 */
9272 +#define SDRAM_CAS2 0x0004 /* Use CAS latency of 2 */
9273 +
9274 +/* SDRAM refresh control (refresh) register bits */
9275 +#define SDRAM_REF(p) (((p)&0xff) | SDRAM_REF_EN) /* Refresh period */
9276 +#define SDRAM_REF_EN 0x8000 /* Writing 1 enables periodic refresh */
9277 +
9278 +/* SDRAM Core default Init values (OCP ID 0x803) */
9279 +#define SDRAM_INIT MEM4MX16X2
9280 +#define SDRAM_CONFIG SDRAM_BURSTFULL
9281 +#define SDRAM_REFRESH SDRAM_REF(0x40)
9282 +
9283 +#define MEM1MX16 0x009 /* 2 MB */
9284 +#define MEM1MX16X2 0x409 /* 4 MB */
9285 +#define MEM2MX8X2 0x809 /* 4 MB */
9286 +#define MEM2MX8X4 0xc09 /* 8 MB */
9287 +#define MEM2MX32 0x439 /* 8 MB */
9288 +#define MEM4MX16 0x019 /* 8 MB */
9289 +#define MEM4MX16X2 0x419 /* 16 MB */
9290 +#define MEM8MX8X2 0x819 /* 16 MB */
9291 +#define MEM8MX16 0x829 /* 16 MB */
9292 +#define MEM4MX32 0x429 /* 16 MB */
9293 +#define MEM8MX8X4 0xc19 /* 32 MB */
9294 +#define MEM8MX16X2 0xc29 /* 32 MB */
9295 +
9296 +#endif /* _SBSDRAM_H */
9297 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbutils.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbutils.h
9298 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sbutils.h 1970-01-01 01:00:00.000000000 +0100
9299 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sbutils.h 2005-08-28 11:12:20.473852616 +0200
9300 @@ -0,0 +1,90 @@
9301 +/*
9302 + * Misc utility routines for accessing chip-specific features
9303 + * of Broadcom HNBU SiliconBackplane-based chips.
9304 + *
9305 + * Copyright 2001-2003, Broadcom Corporation
9306 + * All Rights Reserved.
9307 + *
9308 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9309 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9310 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9311 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9312 + *
9313 + * $Id$
9314 + */
9315 +
9316 +#ifndef _sbutils_h_
9317 +#define _sbutils_h_
9318 +
9319 +/* Board styles (bustype) */
9320 +#define BOARDSTYLE_SOC 0 /* Silicon Backplane */
9321 +#define BOARDSTYLE_PCI 1 /* PCI/MiniPCI board */
9322 +#define BOARDSTYLE_PCMCIA 2 /* PCMCIA board */
9323 +#define BOARDSTYLE_CARDBUS 3 /* Cardbus board */
9324 +
9325 +/*
9326 + * Many of the routines below take an 'sbh' handle as their first arg.
9327 + * Allocate this by calling sb_attach(). Free it by calling sb_detach().
9328 + * At any one time, the sbh is logically focused on one particular sb core
9329 + * (the "current core").
9330 + * Use sb_setcore() or sb_setcoreidx() to change the association to another core.
9331 + */
9332 +
9333 +/* exported externs */
9334 +extern void *sb_attach(uint pcidev, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz);
9335 +extern void *sb_kattach(void);
9336 +extern void sb_detach(void *sbh);
9337 +extern uint sb_chip(void *sbh);
9338 +extern uint sb_chiprev(void *sbh);
9339 +extern uint sb_chippkg(void *sbh);
9340 +extern uint sb_boardvendor(void *sbh);
9341 +extern uint sb_boardtype(void *sbh);
9342 +extern uint sb_boardstyle(void *sbh);
9343 +extern uint sb_bus(void *sbh);
9344 +extern uint sb_corelist(void *sbh, uint coreid[]);
9345 +extern uint sb_coreid(void *sbh);
9346 +extern uint sb_coreidx(void *sbh);
9347 +extern uint sb_coreunit(void *sbh);
9348 +extern uint sb_corevendor(void *sbh);
9349 +extern uint sb_corerev(void *sbh);
9350 +extern void *sb_coreregs(void *sbh);
9351 +extern uint32 sb_coreflags(void *sbh, uint32 mask, uint32 val);
9352 +extern uint32 sb_coreflagshi(void *sbh, uint32 mask, uint32 val);
9353 +extern bool sb_iscoreup(void *sbh);
9354 +extern void *sb_setcoreidx(void *sbh, uint coreidx);
9355 +extern void *sb_setcore(void *sbh, uint coreid, uint coreunit);
9356 +extern void sb_commit(void *sbh);
9357 +extern uint32 sb_base(uint32 admatch);
9358 +extern uint32 sb_size(uint32 admatch);
9359 +extern void sb_core_reset(void *sbh, uint32 bits);
9360 +extern void sb_core_tofixup(void *sbh);
9361 +extern void sb_core_disable(void *sbh, uint32 bits);
9362 +extern uint32 sb_clock_rate(uint32 pll_type, uint32 n, uint32 m);
9363 +extern uint32 sb_clock(void *sbh);
9364 +extern void sb_pci_setup(void *sbh, uint32 *dmaoffset, uint coremask);
9365 +extern void sb_pcmcia_init(void *sbh);
9366 +extern void sb_watchdog(void *sbh, uint ticks);
9367 +extern void *sb_gpiosetcore(void *sbh);
9368 +extern uint32 sb_gpiocontrol(void *sbh, uint32 mask, uint32 val);
9369 +extern uint32 sb_gpioouten(void *sbh, uint32 mask, uint32 val);
9370 +extern uint32 sb_gpioout(void *sbh, uint32 mask, uint32 val);
9371 +extern uint32 sb_gpioin(void *sbh);
9372 +extern uint32 sb_gpiointpolarity(void *sbh, uint32 mask, uint32 val);
9373 +extern uint32 sb_gpiointmask(void *sbh, uint32 mask, uint32 val);
9374 +extern bool sb_taclear(void *sbh);
9375 +extern void sb_pwrctl_init(void *sbh);
9376 +extern uint16 sb_pwrctl_fast_pwrup_delay(void *sbh);
9377 +extern bool sb_pwrctl_clk(void *sbh, uint mode);
9378 +extern int sb_pwrctl_xtal(void *sbh, uint what, bool on);
9379 +extern void sb_register_intr_callback(void *sbh, void *intrsoff_fn, void *intrsrestore_fn, void *intr_arg);
9380 +
9381 +/* pwrctl xtal what flags */
9382 +#define XTAL 0x1 /* primary crystal oscillator (2050) */
9383 +#define PLL 0x2 /* main chip pll */
9384 +
9385 +/* pwrctl clk mode */
9386 +#define CLK_FAST 0 /* force fast (pll) clock */
9387 +#define CLK_SLOW 1 /* force slow clock */
9388 +#define CLK_DYNAMIC 2 /* enable dynamic power control */
9389 +
9390 +#endif /* _sbutils_h_ */
9391 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sflash.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sflash.h
9392 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/sflash.h 1970-01-01 01:00:00.000000000 +0100
9393 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/sflash.h 2005-08-28 11:12:20.473852616 +0200
9394 @@ -0,0 +1,46 @@
9395 +/*
9396 + * Broadcom SiliconBackplane chipcommon serial flash interface
9397 + *
9398 + * Copyright 2001-2003, Broadcom Corporation
9399 + * All Rights Reserved.
9400 + *
9401 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9402 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9403 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9404 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9405 + *
9406 + * $Id$
9407 + */
9408 +
9409 +#ifndef _sflash_h_
9410 +#define _sflash_h_
9411 +
9412 +#include <typedefs.h>
9413 +#include <sbchipc.h>
9414 +
9415 +/* GPIO based bank selection (1 GPIO bit) */
9416 +#define SFLASH_MAX_BANKS 1
9417 +#define SFLASH_GPIO_SHIFT 2
9418 +#define SFLASH_GPIO_MASK ((SFLASH_MAX_BANKS - 1) << SFLASH_GPIO_SHIFT)
9419 +
9420 +struct sflash_bank {
9421 + uint offset; /* Byte offset */
9422 + uint erasesize; /* Block size */
9423 + uint numblocks; /* Number of blocks */
9424 + uint size; /* Total bank size in bytes */
9425 +};
9426 +
9427 +struct sflash {
9428 + struct sflash_bank banks[SFLASH_MAX_BANKS]; /* GPIO selectable banks */
9429 + uint32 type; /* Type */
9430 + uint size; /* Total array size in bytes */
9431 +};
9432 +
9433 +/* Utility functions */
9434 +extern int sflash_poll(chipcregs_t *cc, uint offset);
9435 +extern int sflash_read(chipcregs_t *cc, uint offset, uint len, uchar *buf);
9436 +extern int sflash_write(chipcregs_t *cc, uint offset, uint len, const uchar *buf);
9437 +extern int sflash_erase(chipcregs_t *cc, uint offset);
9438 +extern struct sflash * sflash_init(chipcregs_t *cc);
9439 +
9440 +#endif /* _sflash_h_ */
9441 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/trxhdr.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/trxhdr.h
9442 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/trxhdr.h 1970-01-01 01:00:00.000000000 +0100
9443 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/trxhdr.h 2005-08-28 11:12:20.474852464 +0200
9444 @@ -0,0 +1,31 @@
9445 +/*
9446 + * TRX image file header format.
9447 + *
9448 + * Copyright 2001-2003, Broadcom Corporation
9449 + * All Rights Reserved.
9450 + *
9451 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9452 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9453 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9454 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9455 + *
9456 + * $Id$
9457 + */
9458 +
9459 +#include <typedefs.h>
9460 +
9461 +#define TRX_MAGIC 0x30524448 /* "HDR0" */
9462 +#define TRX_VERSION 1
9463 +#define TRX_MAX_LEN 0x3A0000
9464 +#define TRX_NO_HEADER 1 /* Do not write TRX header */
9465 +
9466 +struct trx_header {
9467 + uint32 magic; /* "HDR0" */
9468 + uint32 len; /* Length of file including header */
9469 + uint32 crc32; /* 32-bit CRC from flag_version to end of file */
9470 + uint32 flag_version; /* 0:15 flags, 16:31 version */
9471 + uint32 offsets[3]; /* Offsets of partitions from start of header */
9472 +};
9473 +
9474 +/* Compatibility */
9475 +typedef struct trx_header TRXHDR, *PTRXHDR;
9476 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/typedefs.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/typedefs.h
9477 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/typedefs.h 1970-01-01 01:00:00.000000000 +0100
9478 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/typedefs.h 2005-08-28 11:12:20.474852464 +0200
9479 @@ -0,0 +1,162 @@
9480 +/*
9481 + * Copyright 2001-2003, Broadcom Corporation
9482 + * All Rights Reserved.
9483 + *
9484 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9485 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9486 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9487 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9488 + * $Id$
9489 + */
9490 +
9491 +#ifndef _TYPEDEFS_H_
9492 +#define _TYPEDEFS_H_
9493 +
9494 +/*----------------------- define TRUE, FALSE, NULL, bool ----------------*/
9495 +#ifdef __cplusplus
9496 +
9497 +#ifndef FALSE
9498 +#define FALSE false
9499 +#endif
9500 +#ifndef TRUE
9501 +#define TRUE true
9502 +#endif
9503 +
9504 +#else /* !__cplusplus */
9505 +
9506 +#if defined(_WIN32)
9507 +
9508 +typedef unsigned char bool;
9509 +
9510 +#else
9511 +
9512 +#if defined(MACOSX) && defined(KERNEL)
9513 +#include <IOKit/IOTypes.h>
9514 +#else
9515 +typedef int bool;
9516 +#endif
9517 +
9518 +#endif
9519 +
9520 +#ifndef FALSE
9521 +#define FALSE 0
9522 +#endif
9523 +#ifndef TRUE
9524 +#define TRUE 1
9525 +
9526 +#ifndef NULL
9527 +#define NULL 0
9528 +#endif
9529 +
9530 +#endif
9531 +
9532 +#endif /* __cplusplus */
9533 +
9534 +#ifndef OFF
9535 +#define OFF 0
9536 +#endif
9537 +
9538 +#ifndef ON
9539 +#define ON 1
9540 +#endif
9541 +
9542 +/*----------------------- define uchar, ushort, uint, ulong ----------------*/
9543 +
9544 +typedef unsigned char uchar;
9545 +
9546 +#if defined(_WIN32) || defined(PMON) || defined(__MRC__) || defined(V2_HAL) || defined(_CFE_)
9547 +
9548 +#ifndef V2_HAL
9549 +typedef unsigned short ushort;
9550 +#endif
9551 +
9552 +typedef unsigned int uint;
9553 +typedef unsigned long ulong;
9554 +
9555 +#else
9556 +
9557 +/* pick up ushort & uint from standard types.h */
9558 +#if defined(linux) && defined(__KERNEL__)
9559 +#include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */
9560 +#else
9561 +#include <sys/types.h>
9562 +#if !defined(TARGETENV_sun4) && !defined(linux)
9563 +typedef unsigned long ulong;
9564 +#endif /* TARGETENV_sun4 */
9565 +#endif
9566 +#if defined(PMON)
9567 +typedef unsigned int uint;
9568 +typedef unsigned long long uint64;
9569 +#endif
9570 +
9571 +#endif /* WIN32 || PMON || .. */
9572 +
9573 +/*----------------------- define [u]int8/16/32/64 --------------------------*/
9574 +
9575 +
9576 +#ifdef V2_HAL
9577 +#include <bcmos.h>
9578 +#else
9579 +typedef signed char int8;
9580 +typedef signed short int16;
9581 +typedef signed int int32;
9582 +
9583 +typedef unsigned char uint8;
9584 +typedef unsigned short uint16;
9585 +typedef unsigned int uint32;
9586 +#endif /* V2_HAL */
9587 +
9588 +typedef float float32;
9589 +typedef double float64;
9590 +
9591 +/*
9592 + * abstracted floating point type allows for compile time selection of
9593 + * single or double precision arithmetic. Compiling with -DFLOAT32
9594 + * selects single precision; the default is double precision.
9595 + */
9596 +
9597 +#if defined(FLOAT32)
9598 +typedef float32 float_t;
9599 +#else /* default to double precision floating point */
9600 +typedef float64 float_t;
9601 +#endif /* FLOAT32 */
9602 +
9603 +#ifdef _MSC_VER /* Microsoft C */
9604 +typedef signed __int64 int64;
9605 +typedef unsigned __int64 uint64;
9606 +
9607 +#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
9608 +/* gcc understands signed/unsigned 64 bit types, but complains in ANSI mode */
9609 +typedef signed long long int64;
9610 +typedef unsigned long long uint64;
9611 +
9612 +#elif defined(__ICL) && !defined(__STDC__)
9613 +/* ICL accepts unsigned 64 bit type only, and complains in ANSI mode */
9614 +typedef unsigned long long uint64;
9615 +
9616 +#endif /* _MSC_VER */
9617 +
9618 +
9619 +/*----------------------- define PTRSZ, INLINE --------------------------*/
9620 +
9621 +#define PTRSZ sizeof (char*)
9622 +
9623 +#ifndef INLINE
9624 +
9625 +#ifdef _MSC_VER
9626 +
9627 +#define INLINE __inline
9628 +
9629 +#elif __GNUC__
9630 +
9631 +#define INLINE __inline__
9632 +
9633 +#else
9634 +
9635 +#define INLINE
9636 +
9637 +#endif /* _MSC_VER */
9638 +
9639 +#endif /* INLINE */
9640 +
9641 +#endif /* _TYPEDEFS_H_ */
9642 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/wlioctl.h linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/wlioctl.h
9643 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/include/wlioctl.h 1970-01-01 01:00:00.000000000 +0100
9644 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/include/wlioctl.h 2005-08-28 11:12:20.475852312 +0200
9645 @@ -0,0 +1,690 @@
9646 +/*
9647 + * Custom OID/ioctl definitions for
9648 + * Broadcom 802.11abg Networking Device Driver
9649 + *
9650 + * Definitions subject to change without notice.
9651 + *
9652 + * Copyright 2001-2003, Broadcom Corporation
9653 + * All Rights Reserved.
9654 + *
9655 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9656 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9657 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9658 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9659 + *
9660 + * $Id$
9661 + */
9662 +
9663 +#ifndef _wlioctl_h_
9664 +#define _wlioctl_h_
9665 +
9666 +#include <typedefs.h>
9667 +#include <proto/ethernet.h>
9668 +#include <proto/802.11.h>
9669 +
9670 +#if defined(__GNUC__)
9671 +#define PACKED __attribute__((packed))
9672 +#else
9673 +#define PACKED
9674 +#endif
9675 +
9676 +/*
9677 + * Per-bss information structure.
9678 + */
9679 +
9680 +#define WL_NUMRATES 255 /* max # of rates in a rateset */
9681 +
9682 +typedef struct wl_rateset {
9683 + uint32 count; /* # rates in this set */
9684 + uint8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */
9685 +} wl_rateset_t;
9686 +
9687 +#define WL_LEGACY_BSS_INFO_VERSION 106 /* an older supported version of wl_bss_info struct */
9688 +#define WL_BSS_INFO_VERSION 107 /* current version of wl_bss_info struct */
9689 +
9690 +typedef struct wl_bss_info106 {
9691 + uint version; /* version field */
9692 + struct ether_addr BSSID;
9693 + uint8 SSID_len;
9694 + uint8 SSID[32];
9695 + uint8 Privacy; /* 0=No WEP, 1=Use WEP */
9696 + int16 RSSI; /* receive signal strength (in dBm) */
9697 + uint16 beacon_period; /* units are Kusec */
9698 + uint16 atim_window; /* units are Kusec */
9699 + uint8 channel; /* Channel no. */
9700 + int8 infra; /* 0=IBSS, 1=infrastructure, 2=unknown */
9701 + struct {
9702 + uint count; /* # rates in this set */
9703 + uint8 rates[12]; /* rates in 500kbps units w/hi bit set if basic */
9704 + } rateset; /* supported rates */
9705 + uint8 dtim_period; /* DTIM period */
9706 + int8 phy_noise; /* noise right after tx (in dBm) */
9707 + uint16 capability; /* Capability information */
9708 + struct dot11_bcn_prb *prb; /* probe response frame (ioctl na) */
9709 + uint16 prb_len; /* probe response frame length (ioctl na) */
9710 + struct {
9711 + uint8 supported; /* wpa supported */
9712 + uint8 multicast; /* multicast cipher */
9713 + uint8 ucount; /* count of unicast ciphers */
9714 + uint8 unicast[4]; /* unicast ciphers */
9715 + uint8 acount; /* count of auth modes */
9716 + uint8 auth[4]; /* Authentication modes */
9717 + } wpa;
9718 +} wl_bss_info106_t;
9719 +
9720 +typedef struct wl_bss_info {
9721 + uint32 version; /* version field */
9722 + uint32 length; /* byte length of data in this record, starting at version and including IEs */
9723 + struct ether_addr BSSID;
9724 + uint16 beacon_period; /* units are Kusec */
9725 + uint16 capability; /* Capability information */
9726 + uint8 SSID_len;
9727 + uint8 SSID[32];
9728 + struct {
9729 + uint count; /* # rates in this set */
9730 + uint8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
9731 + } rateset; /* supported rates */
9732 + uint8 channel; /* Channel no. */
9733 + uint16 atim_window; /* units are Kusec */
9734 + uint8 dtim_period; /* DTIM period */
9735 + int16 RSSI; /* receive signal strength (in dBm) */
9736 + int8 phy_noise; /* noise (in dBm) */
9737 + uint32 ie_length; /* byte length of Information Elements */
9738 + /* variable length Information Elements */
9739 +} wl_bss_info_t;
9740 +
9741 +typedef struct wl_scan_results {
9742 + uint32 buflen;
9743 + uint32 version;
9744 + uint32 count;
9745 + wl_bss_info_t bss_info[1];
9746 +} wl_scan_results_t;
9747 +/* size of wl_scan_results not including variable length array */
9748 +#define WL_SCAN_RESULTS_FIXED_SIZE 12
9749 +
9750 +/* uint32 list */
9751 +typedef struct wl_uint32_list {
9752 + /* in - # of elements, out - # of entries */
9753 + uint32 count;
9754 + /* variable length uint32 list */
9755 + uint32 element[1];
9756 +} wl_uint32_list_t;
9757 +
9758 +typedef struct wlc_ssid {
9759 + uint32 SSID_len;
9760 + uchar SSID[32];
9761 +} wlc_ssid_t;
9762 +
9763 +#define WLC_CNTRY_BUF_SZ 4 /* Country string is 3 bytes + NULL */
9764 +
9765 +typedef struct wl_channels_in_country {
9766 + uint32 buflen;
9767 + uint32 band;
9768 + char country_abbrev[WLC_CNTRY_BUF_SZ];
9769 + uint32 count;
9770 + uint32 channel[1];
9771 +} wl_channels_in_country_t;
9772 +
9773 +typedef struct wl_country_list {
9774 + uint32 buflen;
9775 + uint32 band_set;
9776 + uint32 band;
9777 + uint32 count;
9778 + char country_abbrev[1];
9779 +} wl_country_list_t;
9780 +
9781 +
9782 +/*
9783 +* Maximum # of keys that wl driver supports in S/W. Keys supported
9784 +* in H/W is less than or equal to WSEC_MAX_KEYS.
9785 +*/
9786 +#define WSEC_MAX_KEYS 54 /* Max # of keys (50 + 4 default keys) */
9787 +#define WSEC_MAX_DEFAULT_KEYS 4 /* # of default keys */
9788 +
9789 +/*
9790 +* Remove these two defines if access to crypto/tkhash.h
9791 +* is unconditionally permitted.
9792 +*/
9793 +#define TKHASH_P1_KEY_SIZE 10 /* size of TKHash Phase1 output, in bytes */
9794 +#define TKHASH_P2_KEY_SIZE 16 /* size of TKHash Phase2 output */
9795 +
9796 +/* Enumerate crypto algorithms */
9797 +#define CRYPTO_ALGO_OFF 0
9798 +#define CRYPTO_ALGO_WEP1 1
9799 +#define CRYPTO_ALGO_TKIP 2
9800 +#define CRYPTO_ALGO_WEP128 3
9801 +#define CRYPTO_ALGO_AES_CCM 4
9802 +#define CRYPTO_ALGO_AES_OCB_MSDU 5
9803 +#define CRYPTO_ALGO_AES_OCB_MPDU 6
9804 +#define CRYPTO_ALGO_NALG 7
9805 +
9806 +/* For use with wlc_wep_key.flags */
9807 +#define WSEC_PRIMARY_KEY (1 << 1) /* Indicates this key is the primary (ie tx) key */
9808 +#define WSEC_TKIP_ERROR (1 << 2) /* Provoke deliberate MIC error */
9809 +#define WSEC_REPLAY_ERROR (1 << 3) /* Provoke deliberate replay */
9810 +
9811 +#define WSEC_GEN_MIC_ERROR 0x0001
9812 +#define WSEC_GEN_REPLAY 0x0002
9813 +
9814 +typedef struct tkip_info {
9815 + uint16 phase1[TKHASH_P1_KEY_SIZE/sizeof(uint16)]; /* tkhash phase1 result */
9816 + uint8 phase2[TKHASH_P2_KEY_SIZE]; /* tkhash phase2 result */
9817 + uint32 micl;
9818 + uint32 micr;
9819 +} tkip_info_t;
9820 +
9821 +typedef struct wsec_iv {
9822 + uint32 hi; /* upper 32 bits of IV */
9823 + uint16 lo; /* lower 16 bits of IV */
9824 +} wsec_iv_t;
9825 +
9826 +typedef struct wsec_key {
9827 + uint32 index; /* key index */
9828 + uint32 len; /* key length */
9829 + uint8 data[DOT11_MAX_KEY_SIZE]; /* key data */
9830 + tkip_info_t tkip_tx; /* tkip transmit state */
9831 + tkip_info_t tkip_rx; /* tkip receive state */
9832 + uint32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
9833 + uint32 flags; /* misc flags */
9834 + uint32 algo_hw; /* cache for hw register*/
9835 + uint32 aes_mode; /* cache for hw register*/
9836 + int iv_len; /* IV length */
9837 + int iv_initialized; /* has IV been initialized already? */
9838 + int icv_len; /* ICV length */
9839 + wsec_iv_t rxiv; /* Rx IV */
9840 + wsec_iv_t txiv; /* Tx IV */
9841 + struct ether_addr ea; /* per station */
9842 +} wsec_key_t;
9843 +
9844 +/* wireless security bitvec */
9845 +#define WEP_ENABLED 1
9846 +#define TKIP_ENABLED 2
9847 +#define AES_ENABLED 4
9848 +#define WSEC_SWFLAG 8
9849 +
9850 +#define WSEC_SW(wsec) ((wsec) & WSEC_SWFLAG)
9851 +#define WSEC_HW(wsec) (!WSEC_SW(wsec))
9852 +#define WSEC_WEP_ENABLED(wsec) ((wsec) & WEP_ENABLED)
9853 +#define WSEC_TKIP_ENABLED(wsec) ((wsec) & TKIP_ENABLED)
9854 +#define WSEC_AES_ENABLED(wsec) ((wsec) & AES_ENABLED)
9855 +#define WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))
9856 +
9857 +/* wireless authentication bit vector */
9858 +#define WPA_ENABLED 1
9859 +#define PSK_ENABLED 2
9860 +
9861 +#define WAUTH_WPA_ENABLED(wauth) ((wauth) & WPA_ENABLED)
9862 +#define WAUTH_PSK_ENABLED(wauth) ((wauth) & PSK_ENABLED)
9863 +#define WAUTH_ENABLED(wauth) ((wauth) & (WPA_ENABLED | PSK_ENABLED))
9864 +
9865 +/* group/mcast cipher */
9866 +#define WPA_MCAST_CIPHER(wsec) (((wsec) & TKIP_ENABLED) ? WPA_CIPHER_TKIP : \
9867 + ((wsec) & AES_ENABLED) ? WPA_CIPHER_AES_CCM : \
9868 + WPA_CIPHER_NONE)
9869 +
9870 +typedef struct wl_led_info {
9871 + uint32 index; /* led index */
9872 + uint32 behavior;
9873 + bool activehi;
9874 +} wl_led_info_t;
9875 +
9876 +/*
9877 + * definitions for driver messages passed from WL to NAS.
9878 + */
9879 +/* Use this to recognize wpa and 802.1x driver messages. */
9880 +static const uint8 wl_wpa_snap_template[] =
9881 + { 0xaa, 0xaa, 0x03, 0x00, 0x90, 0x4c };
9882 +
9883 +#define WL_WPA_MSG_IFNAME_MAX 16
9884 +
9885 +/* WPA driver message */
9886 +typedef struct wl_wpa_header {
9887 + struct ether_header eth;
9888 + struct dot11_llc_snap_header snap;
9889 + uint8 version;
9890 + uint8 type;
9891 + /* version 2 additions */
9892 + char ifname[WL_WPA_MSG_IFNAME_MAX];
9893 + /* version specific data */
9894 + /* uint8 data[1]; */
9895 +} wl_wpa_header_t PACKED;
9896 +
9897 +#define WL_WPA_HEADER_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN + 2 + WL_WPA_MSG_IFNAME_MAX)
9898 +
9899 +/* WPA driver message ethertype - private between wlc and nas */
9900 +#define WL_WPA_ETHER_TYPE 0x9999
9901 +
9902 +/* WPA driver message current version */
9903 +#define WL_WPA_MSG_VERSION 2
9904 +
9905 +/* Type field values for the 802.2 driver messages for WPA. */
9906 +#define WLC_ASSOC_MSG 1
9907 +#define WLC_DISASSOC_MSG 2
9908 +#define WLC_PTK_MIC_MSG 3
9909 +#define WLC_GTK_MIC_MSG 4
9910 +
9911 +/* 802.1x driver message */
9912 +typedef struct wl_eapol_header {
9913 + struct ether_header eth;
9914 + struct dot11_llc_snap_header snap;
9915 + uint8 version;
9916 + uint8 reserved;
9917 + char ifname[WL_WPA_MSG_IFNAME_MAX];
9918 + /* version specific data */
9919 + /* uint8 802_1x_msg[1]; */
9920 +} wl_eapol_header_t PACKED;
9921 +
9922 +#define WL_EAPOL_HEADER_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN + 2 + WL_WPA_MSG_IFNAME_MAX)
9923 +
9924 +/* 802.1x driver message ethertype - private between wlc and nas */
9925 +#define WL_EAPOL_ETHER_TYPE 0x999A
9926 +
9927 +/* 802.1x driver message current version */
9928 +#define WL_EAPOL_MSG_VERSION 1
9929 +
9930 +/* srom read/write struct passed through ioctl */
9931 +typedef struct {
9932 + uint byteoff; /* byte offset */
9933 + uint nbytes; /* number of bytes */
9934 + uint16 buf[1];
9935 +} srom_rw_t;
9936 +
9937 +/* R_REG and W_REG struct passed through ioctl */
9938 +typedef struct {
9939 + uint32 byteoff; /* byte offset of the field in d11regs_t */
9940 + uint32 val; /* read/write value of the field */
9941 + uint32 size; /* sizeof the field */
9942 +} rw_reg_t;
9943 +
9944 +/* Structure used by GET/SET_ATTEN ioctls */
9945 +typedef struct {
9946 + uint16 auto_ctrl; /* 1: Automatic control, 0: overriden */
9947 + uint16 bb; /* Baseband attenuation */
9948 + uint16 radio; /* Radio attenuation */
9949 + uint16 txctl1; /* Radio TX_CTL1 value */
9950 +} atten_t;
9951 +
9952 +/* Used to get specific STA parameters */
9953 +typedef struct {
9954 + uint32 val;
9955 + struct ether_addr ea;
9956 +} scb_val_t;
9957 +
9958 +/* callback registration data types */
9959 +
9960 +typedef struct _mac_event_params {
9961 + uint msg;
9962 + struct ether_addr *addr;
9963 + uint result;
9964 + uint status;
9965 + uint auth_type;
9966 +} mac_event_params_t;
9967 +
9968 +typedef struct _mic_error_params {
9969 + struct ether_addr *ea;
9970 + bool group;
9971 + bool flush_txq;
9972 +} mic_error_params_t;
9973 +
9974 +typedef enum _wl_callback {
9975 + WL_MAC_EVENT_CALLBACK = 0,
9976 + WL_LINK_UP_CALLBACK,
9977 + WL_LINK_DOWN_CALLBACK,
9978 + WL_MIC_ERROR_CALLBACK,
9979 + WL_LAST_CALLBACK
9980 +} wl_callback_t;
9981 +
9982 +typedef struct _callback {
9983 + void (*fn)(void *, void *);
9984 + void *context;
9985 +} callback_t;
9986 +
9987 +typedef struct _scan_callback {
9988 + void (*fn)(void *);
9989 + void *context;
9990 +} scan_callback_t;
9991 +
9992 +/* used to register an arbitrary callback via the IOCTL interface */
9993 +typedef struct _set_callback {
9994 + int index;
9995 + callback_t callback;
9996 +} set_callback_t;
9997 +
9998 +/*
9999 + * Country locale determines which channels are available to us.
10000 + */
10001 +typedef enum _wlc_locale {
10002 + WLC_WW = 0, /* Worldwide */
10003 + WLC_THA, /* Thailand */
10004 + WLC_ISR, /* Israel */
10005 + WLC_JDN, /* Jordan */
10006 + WLC_PRC, /* China */
10007 + WLC_JPN, /* Japan */
10008 + WLC_FCC, /* USA */
10009 + WLC_EUR, /* Europe */
10010 + WLC_USL, /* US Low Band only */
10011 + WLC_JPH, /* Japan High Band only */
10012 + WLC_ALL, /* All the channels in this band */
10013 + WLC_11D, /* Represents locale recieved by 11d beacons */
10014 + WLC_LAST_LOCALE,
10015 + WLC_UNDEFINED_LOCALE = 0xf
10016 +} wlc_locale_t;
10017 +
10018 +/* channel encoding */
10019 +typedef struct channel_info {
10020 + int hw_channel;
10021 + int target_channel;
10022 + int scan_channel;
10023 +} channel_info_t;
10024 +
10025 +/* For ioctls that take a list of MAC addresses */
10026 +struct maclist {
10027 + uint count; /* number of MAC addresses */
10028 + struct ether_addr ea[1]; /* variable length array of MAC addresses */
10029 +};
10030 +
10031 +/* get pkt count struct passed through ioctl */
10032 +typedef struct get_pktcnt {
10033 + uint rx_good_pkt;
10034 + uint rx_bad_pkt;
10035 + uint tx_good_pkt;
10036 + uint tx_bad_pkt;
10037 +} get_pktcnt_t;
10038 +
10039 +/* Linux network driver ioctl encoding */
10040 +typedef struct wl_ioctl {
10041 + int cmd; /* common ioctl definition */
10042 + void *buf; /* pointer to user buffer */
10043 + int len; /* length of user buffer */
10044 +} wl_ioctl_t;
10045 +
10046 +/*
10047 + * Structure for passing hardware and software
10048 + * revision info up from the driver.
10049 + */
10050 +typedef struct wlc_rev_info {
10051 + uint vendorid; /* PCI vendor id */
10052 + uint deviceid; /* device id of chip */
10053 + uint radiorev; /* radio revision */
10054 + uint chiprev; /* chip revision */
10055 + uint corerev; /* core revision */
10056 + uint boardid; /* board identifier (usu. PCI sub-device id) */
10057 + uint boardvendor; /* board vendor (usu. PCI sub-vendor id) */
10058 + uint boardrev; /* board revision */
10059 + uint driverrev; /* driver version */
10060 + uint ucoderev; /* microcode version */
10061 + uint bus; /* bus type */
10062 + uint chipnum; /* chip number */
10063 +} wlc_rev_info_t;
10064 +
10065 +/* check this magic number */
10066 +#define WLC_IOCTL_MAGIC 0x14e46c77
10067 +
10068 +/* bump this number if you change the ioctl interface */
10069 +#define WLC_IOCTL_VERSION 1
10070 +
10071 +/* maximum length buffer required */
10072 +#define WLC_IOCTL_MAXLEN 8192
10073 +
10074 +/* common ioctl definitions */
10075 +#define WLC_GET_MAGIC 0
10076 +#define WLC_GET_VERSION 1
10077 +#define WLC_UP 2
10078 +#define WLC_DOWN 3
10079 +#define WLC_DUMP 6
10080 +#define WLC_GET_MSGLEVEL 7
10081 +#define WLC_SET_MSGLEVEL 8
10082 +#define WLC_GET_PROMISC 9
10083 +#define WLC_SET_PROMISC 10
10084 +#define WLC_GET_RATE 12
10085 +#define WLC_SET_RATE 13
10086 +#define WLC_GET_INSTANCE 14
10087 +#define WLC_GET_FRAG 15
10088 +#define WLC_SET_FRAG 16
10089 +#define WLC_GET_RTS 17
10090 +#define WLC_SET_RTS 18
10091 +#define WLC_GET_INFRA 19
10092 +#define WLC_SET_INFRA 20
10093 +#define WLC_GET_AUTH 21
10094 +#define WLC_SET_AUTH 22
10095 +#define WLC_GET_BSSID 23
10096 +#define WLC_SET_BSSID 24
10097 +#define WLC_GET_SSID 25
10098 +#define WLC_SET_SSID 26
10099 +#define WLC_RESTART 27
10100 +#define WLC_GET_CHANNEL 29
10101 +#define WLC_SET_CHANNEL 30
10102 +#define WLC_GET_SRL 31
10103 +#define WLC_SET_SRL 32
10104 +#define WLC_GET_LRL 33
10105 +#define WLC_SET_LRL 34
10106 +#define WLC_GET_PLCPHDR 35
10107 +#define WLC_SET_PLCPHDR 36
10108 +#define WLC_GET_RADIO 37
10109 +#define WLC_SET_RADIO 38
10110 +#define WLC_GET_PHYTYPE 39
10111 +#define WLC_GET_WEP 42
10112 +#define WLC_SET_WEP 43
10113 +#define WLC_GET_KEY 44
10114 +#define WLC_SET_KEY 45
10115 +#define WLC_SCAN 50
10116 +#define WLC_SCAN_RESULTS 51
10117 +#define WLC_DISASSOC 52
10118 +#define WLC_REASSOC 53
10119 +#define WLC_GET_ROAM_TRIGGER 54
10120 +#define WLC_SET_ROAM_TRIGGER 55
10121 +#define WLC_GET_TXANT 61
10122 +#define WLC_SET_TXANT 62
10123 +#define WLC_GET_ANTDIV 63
10124 +#define WLC_SET_ANTDIV 64
10125 +#define WLC_GET_TXPWR 65
10126 +#define WLC_SET_TXPWR 66
10127 +#define WLC_GET_CLOSED 67
10128 +#define WLC_SET_CLOSED 68
10129 +#define WLC_GET_MACLIST 69
10130 +#define WLC_SET_MACLIST 70
10131 +#define WLC_GET_RATESET 71
10132 +#define WLC_SET_RATESET 72
10133 +#define WLC_GET_LOCALE 73
10134 +#define WLC_SET_LOCALE 74
10135 +#define WLC_GET_BCNPRD 75
10136 +#define WLC_SET_BCNPRD 76
10137 +#define WLC_GET_DTIMPRD 77
10138 +#define WLC_SET_DTIMPRD 78
10139 +#define WLC_GET_SROM 79
10140 +#define WLC_SET_SROM 80
10141 +#define WLC_GET_WEP_RESTRICT 81
10142 +#define WLC_SET_WEP_RESTRICT 82
10143 +#define WLC_GET_COUNTRY 83
10144 +#define WLC_SET_COUNTRY 84
10145 +#define WLC_GET_REVINFO 98
10146 +#define WLC_GET_MACMODE 105
10147 +#define WLC_SET_MACMODE 106
10148 +#define WLC_GET_GMODE 109
10149 +#define WLC_SET_GMODE 110
10150 +#define WLC_GET_CURR_RATESET 114 /* current rateset */
10151 +#define WLC_GET_SCANSUPPRESS 115
10152 +#define WLC_SET_SCANSUPPRESS 116
10153 +#define WLC_GET_AP 117
10154 +#define WLC_SET_AP 118
10155 +#define WLC_GET_EAP_RESTRICT 119
10156 +#define WLC_SET_EAP_RESTRICT 120
10157 +#define WLC_GET_WDSLIST 123
10158 +#define WLC_SET_WDSLIST 124
10159 +#define WLC_GET_RSSI 127
10160 +#define WLC_GET_WSEC 133
10161 +#define WLC_SET_WSEC 134
10162 +#define WLC_GET_BSS_INFO 136
10163 +#define WLC_GET_LAZYWDS 138
10164 +#define WLC_SET_LAZYWDS 139
10165 +#define WLC_GET_BANDLIST 140
10166 +#define WLC_GET_BAND 141
10167 +#define WLC_SET_BAND 142
10168 +#define WLC_GET_SHORTSLOT 144
10169 +#define WLC_GET_SHORTSLOT_OVERRIDE 145
10170 +#define WLC_SET_SHORTSLOT_OVERRIDE 146
10171 +#define WLC_GET_SHORTSLOT_RESTRICT 147
10172 +#define WLC_SET_SHORTSLOT_RESTRICT 148
10173 +#define WLC_GET_GMODE_PROTECTION 149
10174 +#define WLC_GET_GMODE_PROTECTION_OVERRIDE 150
10175 +#define WLC_SET_GMODE_PROTECTION_OVERRIDE 151
10176 +#define WLC_UPGRADE 152
10177 +#define WLC_GET_ASSOCLIST 159
10178 +#define WLC_GET_CLK 160
10179 +#define WLC_SET_CLK 161
10180 +#define WLC_GET_UP 162
10181 +#define WLC_OUT 163
10182 +#define WLC_GET_WPA_AUTH 164
10183 +#define WLC_SET_WPA_AUTH 165
10184 +#define WLC_GET_GMODE_PROTECTION_CONTROL 178
10185 +#define WLC_SET_GMODE_PROTECTION_CONTROL 179
10186 +#define WLC_GET_PHYLIST 180
10187 +#define WLC_GET_GMODE_PROTECTION_CTS 198
10188 +#define WLC_SET_GMODE_PROTECTION_CTS 199
10189 +#define WLC_GET_PIOMODE 203
10190 +#define WLC_SET_PIOMODE 204
10191 +#define WLC_SET_LED 209
10192 +#define WLC_GET_LED 210
10193 +#define WLC_GET_CHANNEL_SEL 215
10194 +#define WLC_START_CHANNEL_SEL 216
10195 +#define WLC_GET_VALID_CHANNELS 217
10196 +#define WLC_GET_FAKEFRAG 218
10197 +#define WLC_SET_FAKEFRAG 219
10198 +#define WLC_GET_WET 230
10199 +#define WLC_SET_WET 231
10200 +#define WLC_GET_KEY_PRIMARY 235
10201 +#define WLC_SET_KEY_PRIMARY 236
10202 +#define WLC_SCAN_WITH_CALLBACK 240
10203 +#define WLC_SET_CS_SCAN_TIMER 248
10204 +#define WLC_GET_CS_SCAN_TIMER 249
10205 +#define WLC_CURRENT_PWR 256
10206 +#define WLC_GET_CHANNELS_IN_COUNTRY 260
10207 +#define WLC_GET_COUNTRY_LIST 261
10208 +#define WLC_NVRAM_GET 264
10209 +#define WLC_NVRAM_SET 265
10210 +#define WLC_LAST 271 /* bump after adding */
10211 +
10212 +/*
10213 + * Minor kludge alert:
10214 + * Duplicate a few definitions that irelay requires from epiioctl.h here
10215 + * so caller doesn't have to include this file and epiioctl.h .
10216 + * If this grows any more, it would be time to move these irelay-specific
10217 + * definitions out of the epiioctl.h and into a separate driver common file.
10218 + */
10219 +#ifndef EPICTRL_COOKIE
10220 +#define EPICTRL_COOKIE 0xABADCEDE
10221 +#endif
10222 +
10223 +/* vx wlc ioctl's offset */
10224 +#define CMN_IOCTL_OFF 0x180
10225 +
10226 +/*
10227 + * custom OID support
10228 + *
10229 + * 0xFF - implementation specific OID
10230 + * 0xE4 - first byte of Broadcom PCI vendor ID
10231 + * 0x14 - second byte of Broadcom PCI vendor ID
10232 + * 0xXX - the custom OID number
10233 + */
10234 +
10235 +/* begin 0x1f values beyond the start of the ET driver range. */
10236 +#define WL_OID_BASE 0xFFE41420
10237 +
10238 +/* NDIS overrides */
10239 +#define OID_WL_GETINSTANCE (WL_OID_BASE + WLC_GET_INSTANCE)
10240 +
10241 +#define WL_DECRYPT_STATUS_SUCCESS 1
10242 +#define WL_DECRYPT_STATUS_FAILURE 2
10243 +#define WL_DECRYPT_STATUS_UNKNOWN 3
10244 +
10245 +/* allows user-mode app to poll the status of USB image upgrade */
10246 +#define WLC_UPGRADE_SUCCESS 0
10247 +#define WLC_UPGRADE_PENDING 1
10248 +
10249 +/* Bit masks for radio disabled status - returned by WL_GET_RADIO */
10250 +#define WL_RADIO_SW_DISABLE (1<<0)
10251 +#define WL_RADIO_HW_DISABLE (1<<1)
10252 +
10253 +/* Override bit for WLC_SET_TXPWR. if set, ignore other level limits */
10254 +#define WL_TXPWR_OVERRIDE (1<<31)
10255 +
10256 +
10257 +/* Bus types */
10258 +#define WL_SB_BUS 0 /* Silicon Backplane */
10259 +#define WL_PCI_BUS 1 /* PCI target */
10260 +#define WL_PCMCIA_BUS 2 /* PCMCIA target */
10261 +
10262 +/* band types */
10263 +#define WLC_BAND_AUTO 0 /* auto-select */
10264 +#define WLC_BAND_A 1 /* "a" band (5 Ghz) */
10265 +#define WLC_BAND_B 2 /* "b" band (2.4 Ghz) */
10266 +
10267 +/* MAC list modes */
10268 +#define WLC_MACMODE_DISABLED 0 /* MAC list disabled */
10269 +#define WLC_MACMODE_DENY 1 /* Deny specified (i.e. allow unspecified) */
10270 +#define WLC_MACMODE_ALLOW 2 /* Allow specified (i.e. deny unspecified) */
10271 +
10272 +/*
10273 + *
10274 + */
10275 +#define GMODE_LEGACY_B 0
10276 +#define GMODE_AUTO 1
10277 +#define GMODE_ONLY 2
10278 +#define GMODE_B_DEFERRED 3
10279 +#define GMODE_PERFORMANCE 4
10280 +#define GMODE_LRS 5
10281 +#define GMODE_MAX 6
10282 +
10283 +/* values for PLCPHdr_override */
10284 +#define WLC_PLCP_AUTO -1
10285 +#define WLC_PLCP_SHORT 0
10286 +#define WLC_PLCP_LONG 1
10287 +
10288 +/* values for g_protection_override */
10289 +#define WLC_G_PROTECTION_AUTO -1
10290 +#define WLC_G_PROTECTION_OFF 0
10291 +#define WLC_G_PROTECTION_ON 1
10292 +
10293 +/* values for g_protection_control */
10294 +#define WLC_G_PROTECTION_CTL_OFF 0
10295 +#define WLC_G_PROTECTION_CTL_LOCAL 1
10296 +#define WLC_G_PROTECTION_CTL_OVERLAP 2
10297 +
10298 +
10299 +
10300 +
10301 +
10302 +
10303 +/* max # of leds supported by GPIO (gpio pin# == led index#) */
10304 +#define WL_LED_NUMGPIO 16 /* gpio 0-15 */
10305 +
10306 +/* led per-pin behaviors */
10307 +#define WL_LED_OFF 0 /* always off */
10308 +#define WL_LED_ON 1 /* always on */
10309 +#define WL_LED_ACTIVITY 2 /* activity */
10310 +#define WL_LED_RADIO 3 /* radio enabled */
10311 +#define WL_LED_ARADIO 4 /* 5 Ghz radio enabled */
10312 +#define WL_LED_BRADIO 5 /* 2.4Ghz radio enabled */
10313 +#define WL_LED_BGMODE 6 /* on if gmode, off if bmode */
10314 +#define WL_LED_WI1 7
10315 +#define WL_LED_WI2 8
10316 +#define WL_LED_WI3 9
10317 +#define WL_LED_ASSOC 10 /* associated state indicator */
10318 +#define WL_LED_INACTIVE 11 /* null behavior (clears default behavior) */
10319 +#define WL_LED_NUMBEHAVIOR 12
10320 +
10321 +/* led behavior numeric value format */
10322 +#define WL_LED_BEH_MASK 0x7f /* behavior mask */
10323 +#define WL_LED_AL_MASK 0x80 /* activelow (polarity) bit */
10324 +
10325 +
10326 +/* rate check */
10327 +#define WL_RATE_OFDM(r) (((r) & 0x7f) == 12 || ((r) & 0x7f) == 18 || \
10328 + ((r) & 0x7f) == 24 || ((r) & 0x7f) == 36 || \
10329 + ((r) & 0x7f) == 48 || ((r) & 0x7f) == 72 || \
10330 + ((r) & 0x7f) == 96 || ((r) & 0x7f) == 108)
10331 +
10332 +
10333 +#undef PACKED
10334 +
10335 +#endif /* _wlioctl_h_ */
10336 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/linux_osl.c linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/linux_osl.c
10337 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/linux_osl.c 1970-01-01 01:00:00.000000000 +0100
10338 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/linux_osl.c 2005-08-28 11:12:20.476852160 +0200
10339 @@ -0,0 +1,420 @@
10340 +/*
10341 + * Linux OS Independent Layer
10342 + *
10343 + * Copyright 2001-2003, Broadcom Corporation
10344 + * All Rights Reserved.
10345 + *
10346 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
10347 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
10348 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10349 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
10350 + *
10351 + * $Id$
10352 + */
10353 +
10354 +#define LINUX_OSL
10355 +
10356 +#include <typedefs.h>
10357 +#include <bcmendian.h>
10358 +#include <linuxver.h>
10359 +#include <linux_osl.h>
10360 +#include <bcmutils.h>
10361 +#include <linux/delay.h>
10362 +#ifdef mips
10363 +#include <asm/paccess.h>
10364 +#endif
10365 +#include <pcicfg.h>
10366 +
10367 +#define PCI_CFG_RETRY 10
10368 +
10369 +void*
10370 +osl_pktget(void *drv, uint len, bool send)
10371 +{
10372 + struct sk_buff *skb;
10373 +
10374 + if ((skb = dev_alloc_skb(len)) == NULL)
10375 + return (NULL);
10376 +
10377 + skb_put(skb, len);
10378 +
10379 + /* ensure the cookie field is cleared */
10380 + PKTSETCOOKIE(skb, NULL);
10381 +
10382 + return ((void*) skb);
10383 +}
10384 +
10385 +void
10386 +osl_pktfree(void *p)
10387 +{
10388 + struct sk_buff *skb, *nskb;
10389 +
10390 + skb = (struct sk_buff*) p;
10391 +
10392 + /* perversion: we use skb->next to chain multi-skb packets */
10393 + while (skb) {
10394 + nskb = skb->next;
10395 + skb->next = NULL;
10396 + if (skb->destructor) {
10397 + /* cannot kfree_skb() on hard IRQ (net/core/skbuff.c) if destructor exists */
10398 + dev_kfree_skb_any(skb);
10399 + } else {
10400 + /* can free immediately (even in_irq()) if destructor does not exist */
10401 + dev_kfree_skb(skb);
10402 + }
10403 + skb = nskb;
10404 + }
10405 +}
10406 +
10407 +uint32
10408 +osl_pci_read_config(void *loc, uint offset, uint size)
10409 +{
10410 + struct pci_dev *pdev;
10411 + uint val;
10412 + uint retry=PCI_CFG_RETRY;
10413 +
10414 + /* only 4byte access supported */
10415 + ASSERT(size == 4);
10416 +
10417 + pdev = (struct pci_dev*)loc;
10418 + do {
10419 + pci_read_config_dword(pdev, offset, &val);
10420 + if (val != 0xffffffff)
10421 + break;
10422 + } while (retry--);
10423 +
10424 +
10425 + return (val);
10426 +}
10427 +
10428 +void
10429 +osl_pci_write_config(void *loc, uint offset, uint size, uint val)
10430 +{
10431 + struct pci_dev *pdev;
10432 + uint retry=PCI_CFG_RETRY;
10433 +
10434 + /* only 4byte access supported */
10435 + ASSERT(size == 4);
10436 +
10437 + pdev = (struct pci_dev*)loc;
10438 +
10439 + do {
10440 + pci_write_config_dword(pdev, offset, val);
10441 + if (offset!=PCI_BAR0_WIN)
10442 + break;
10443 + if (osl_pci_read_config(loc,offset,size) == val)
10444 + break;
10445 + } while (retry--);
10446 +
10447 +}
10448 +
10449 +void
10450 +osl_pcmcia_read_attr(void *osh, uint offset, void *buf, int size)
10451 +{
10452 + ASSERT(0);
10453 +}
10454 +
10455 +void
10456 +osl_pcmcia_write_attr(void *osh, uint offset, void *buf, int size)
10457 +{
10458 + ASSERT(0);
10459 +}
10460 +
10461 +void
10462 +osl_assert(char *exp, char *file, int line)
10463 +{
10464 + char tempbuf[255];
10465 +
10466 + sprintf(tempbuf, "assertion \"%s\" failed: file \"%s\", line %d\n", exp, file, line);
10467 + panic(tempbuf);
10468 +}
10469 +
10470 +/*
10471 + * BINOSL selects the slightly slower function-call-based binary compatible osl.
10472 + */
10473 +#ifdef BINOSL
10474 +
10475 +int
10476 +osl_printf(const char *format, ...)
10477 +{
10478 + va_list args;
10479 + char buf[1024];
10480 + int len;
10481 +
10482 + /* sprintf into a local buffer because there *is* no "vprintk()".. */
10483 + va_start(args, format);
10484 + len = vsprintf(buf, format, args);
10485 + va_end(args);
10486 +
10487 + if (len > sizeof (buf)) {
10488 + printk("osl_printf: buffer overrun\n");
10489 + return (0);
10490 + }
10491 +
10492 + return (printk(buf));
10493 +}
10494 +
10495 +int
10496 +osl_sprintf(char *buf, const char *format, ...)
10497 +{
10498 + va_list args;
10499 + int rc;
10500 +
10501 + va_start(args, format);
10502 + rc = vsprintf(buf, format, args);
10503 + va_end(args);
10504 + return (rc);
10505 +}
10506 +
10507 +int
10508 +osl_strcmp(const char *s1, const char *s2)
10509 +{
10510 + return (strcmp(s1, s2));
10511 +}
10512 +
10513 +int
10514 +osl_strncmp(const char *s1, const char *s2, uint n)
10515 +{
10516 + return (strncmp(s1, s2, n));
10517 +}
10518 +
10519 +int
10520 +osl_strlen(char *s)
10521 +{
10522 + return (strlen(s));
10523 +}
10524 +
10525 +char*
10526 +osl_strcpy(char *d, const char *s)
10527 +{
10528 + return (strcpy(d, s));
10529 +}
10530 +
10531 +char*
10532 +osl_strncpy(char *d, const char *s, uint n)
10533 +{
10534 + return (strncpy(d, s, n));
10535 +}
10536 +
10537 +void
10538 +bcopy(const void *src, void *dst, int len)
10539 +{
10540 + memcpy(dst, src, len);
10541 +}
10542 +
10543 +int
10544 +bcmp(const void *b1, const void *b2, int len)
10545 +{
10546 + return (memcmp(b1, b2, len));
10547 +}
10548 +
10549 +void
10550 +bzero(void *b, int len)
10551 +{
10552 + memset(b, '\0', len);
10553 +}
10554 +
10555 +void*
10556 +osl_malloc(uint size)
10557 +{
10558 + return (kmalloc(size, GFP_ATOMIC));
10559 +}
10560 +
10561 +void
10562 +osl_mfree(void *addr, uint size)
10563 +{
10564 + kfree(addr);
10565 +}
10566 +
10567 +uint32
10568 +osl_readl(volatile uint32 *r)
10569 +{
10570 + return (readl(r));
10571 +}
10572 +
10573 +uint16
10574 +osl_readw(volatile uint16 *r)
10575 +{
10576 + return (readw(r));
10577 +}
10578 +
10579 +uint8
10580 +osl_readb(volatile uint8 *r)
10581 +{
10582 + return (readb(r));
10583 +}
10584 +
10585 +void
10586 +osl_writel(uint32 v, volatile uint32 *r)
10587 +{
10588 + writel(v, r);
10589 +}
10590 +
10591 +void
10592 +osl_writew(uint16 v, volatile uint16 *r)
10593 +{
10594 + writew(v, r);
10595 +}
10596 +
10597 +void
10598 +osl_writeb(uint8 v, volatile uint8 *r)
10599 +{
10600 + writeb(v, r);
10601 +}
10602 +
10603 +void *
10604 +osl_uncached(void *va)
10605 +{
10606 +#ifdef mips
10607 + return ((void*)KSEG1ADDR(va));
10608 +#else
10609 + return ((void*)va);
10610 +#endif
10611 +}
10612 +
10613 +uint
10614 +osl_getcycles(void)
10615 +{
10616 + uint cycles;
10617 +
10618 +#if defined(mips)
10619 + cycles = read_c0_count() * 2;
10620 +#elif defined(__i386__)
10621 + rdtscl(cycles);
10622 +#else
10623 + cycles = 0;
10624 +#endif
10625 + return cycles;
10626 +}
10627 +
10628 +void *
10629 +osl_reg_map(uint32 pa, uint size)
10630 +{
10631 + return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
10632 +}
10633 +
10634 +void
10635 +osl_reg_unmap(void *va)
10636 +{
10637 + iounmap(va);
10638 +}
10639 +
10640 +int
10641 +osl_busprobe(uint32 *val, uint32 addr)
10642 +{
10643 +#ifdef mips
10644 + return get_dbe(*val, (uint32*)addr);
10645 +#else
10646 + *val = readl(addr);
10647 + return 0;
10648 +#endif
10649 +}
10650 +
10651 +void*
10652 +osl_dma_alloc_consistent(void *dev, uint size, ulong *pap)
10653 +{
10654 + return (pci_alloc_consistent((struct pci_dev*)dev, size, (dma_addr_t*)pap));
10655 +}
10656 +
10657 +void
10658 +osl_dma_free_consistent(void *dev, void *va, uint size, ulong pa)
10659 +{
10660 + pci_free_consistent((struct pci_dev*)dev, size, va, (dma_addr_t)pa);
10661 +}
10662 +
10663 +uint
10664 +osl_dma_map(void *dev, void *va, uint size, int direction)
10665 +{
10666 + int dir;
10667 +
10668 + dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
10669 + return (pci_map_single(dev, va, size, dir));
10670 +}
10671 +
10672 +void
10673 +osl_dma_unmap(void *dev, uint pa, uint size, int direction)
10674 +{
10675 + int dir;
10676 +
10677 + dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
10678 + pci_unmap_single(dev, (uint32)pa, size, dir);
10679 +}
10680 +
10681 +void
10682 +osl_delay(uint usec)
10683 +{
10684 + udelay(usec);
10685 +}
10686 +
10687 +uchar*
10688 +osl_pktdata(void *drv, void *skb)
10689 +{
10690 + return (((struct sk_buff*)skb)->data);
10691 +}
10692 +
10693 +uint
10694 +osl_pktlen(void *drv, void *skb)
10695 +{
10696 + return (((struct sk_buff*)skb)->len);
10697 +}
10698 +
10699 +void*
10700 +osl_pktnext(void *drv, void *skb)
10701 +{
10702 + return (((struct sk_buff*)skb)->next);
10703 +}
10704 +
10705 +void
10706 +osl_pktsetnext(void *skb, void *x)
10707 +{
10708 + ((struct sk_buff*)skb)->next = (struct sk_buff*)x;
10709 +}
10710 +
10711 +void
10712 +osl_pktsetlen(void *drv, void *skb, uint len)
10713 +{
10714 + __skb_trim((struct sk_buff*)skb, len);
10715 +}
10716 +
10717 +uchar*
10718 +osl_pktpush(void *drv, void *skb, int bytes)
10719 +{
10720 + return (skb_push((struct sk_buff*)skb, bytes));
10721 +}
10722 +
10723 +uchar*
10724 +osl_pktpull(void *drv, void *skb, int bytes)
10725 +{
10726 + return (skb_pull((struct sk_buff*)skb, bytes));
10727 +}
10728 +
10729 +void*
10730 +osl_pktdup(void *drv, void *skb)
10731 +{
10732 + return (skb_clone((struct sk_buff*)skb, GFP_ATOMIC));
10733 +}
10734 +
10735 +void*
10736 +osl_pktcookie(void *skb)
10737 +{
10738 + return ((void*)((struct sk_buff*)skb)->csum);
10739 +}
10740 +
10741 +void
10742 +osl_pktsetcookie(void *skb, void *x)
10743 +{
10744 + ((struct sk_buff*)skb)->csum = (uint)x;
10745 +}
10746 +
10747 +void*
10748 +osl_pktlink(void *skb)
10749 +{
10750 + return (((struct sk_buff*)skb)->prev);
10751 +}
10752 +
10753 +void
10754 +osl_pktsetlink(void *skb, void *x)
10755 +{
10756 + ((struct sk_buff*)skb)->prev = (struct sk_buff*)x;
10757 +}
10758 +
10759 +#endif
10760 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/sbmips.c linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/sbmips.c
10761 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/sbmips.c 1970-01-01 01:00:00.000000000 +0100
10762 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/sbmips.c 2005-08-28 11:12:20.478851856 +0200
10763 @@ -0,0 +1,950 @@
10764 +/*
10765 + * BCM47XX Sonics SiliconBackplane MIPS core routines
10766 + *
10767 + * Copyright 2001-2003, Broadcom Corporation
10768 + * All Rights Reserved.
10769 + *
10770 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
10771 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
10772 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10773 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
10774 + *
10775 + * $Id$
10776 + */
10777 +
10778 +#include <typedefs.h>
10779 +#include <osl.h>
10780 +#include <sbutils.h>
10781 +#include <bcmdevs.h>
10782 +#include <bcmnvram.h>
10783 +#include <bcmutils.h>
10784 +#include <hndmips.h>
10785 +#include <sbconfig.h>
10786 +#include <sbextif.h>
10787 +#include <sbchipc.h>
10788 +#include <sbmemc.h>
10789 +
10790 +/*
10791 + * Memory segments (32bit kernel mode addresses)
10792 + */
10793 +#undef KUSEG
10794 +#undef KSEG0
10795 +#undef KSEG1
10796 +#undef KSEG2
10797 +#undef KSEG3
10798 +#define KUSEG 0x00000000
10799 +#define KSEG0 0x80000000
10800 +#define KSEG1 0xa0000000
10801 +#define KSEG2 0xc0000000
10802 +#define KSEG3 0xe0000000
10803 +
10804 +/*
10805 + * Map an address to a certain kernel segment
10806 + */
10807 +#undef KSEG0ADDR
10808 +#undef KSEG1ADDR
10809 +#undef KSEG2ADDR
10810 +#undef KSEG3ADDR
10811 +#define KSEG0ADDR(a) (((a) & 0x1fffffff) | KSEG0)
10812 +#define KSEG1ADDR(a) (((a) & 0x1fffffff) | KSEG1)
10813 +#define KSEG2ADDR(a) (((a) & 0x1fffffff) | KSEG2)
10814 +#define KSEG3ADDR(a) (((a) & 0x1fffffff) | KSEG3)
10815 +
10816 +/*
10817 + * The following macros are especially useful for __asm__
10818 + * inline assembler.
10819 + */
10820 +#ifndef __STR
10821 +#define __STR(x) #x
10822 +#endif
10823 +#ifndef STR
10824 +#define STR(x) __STR(x)
10825 +#endif
10826 +
10827 +/* *********************************************************************
10828 + * CP0 Registers
10829 + ********************************************************************* */
10830 +
10831 +#define C0_INX 0 /* CP0: TLB Index */
10832 +#define C0_RAND 1 /* CP0: TLB Random */
10833 +#define C0_TLBLO0 2 /* CP0: TLB EntryLo0 */
10834 +#define C0_TLBLO C0_TLBLO0 /* CP0: TLB EntryLo0 */
10835 +#define C0_TLBLO1 3 /* CP0: TLB EntryLo1 */
10836 +#define C0_CTEXT 4 /* CP0: Context */
10837 +#define C0_PGMASK 5 /* CP0: TLB PageMask */
10838 +#define C0_WIRED 6 /* CP0: TLB Wired */
10839 +#define C0_BADVADDR 8 /* CP0: Bad Virtual Address */
10840 +#define C0_COUNT 9 /* CP0: Count */
10841 +#define C0_TLBHI 10 /* CP0: TLB EntryHi */
10842 +#define C0_COMPARE 11 /* CP0: Compare */
10843 +#define C0_SR 12 /* CP0: Processor Status */
10844 +#define C0_STATUS C0_SR /* CP0: Processor Status */
10845 +#define C0_CAUSE 13 /* CP0: Exception Cause */
10846 +#define C0_EPC 14 /* CP0: Exception PC */
10847 +#define C0_PRID 15 /* CP0: Processor Revision Indentifier */
10848 +#define C0_CONFIG 16 /* CP0: Config */
10849 +#define C0_LLADDR 17 /* CP0: LLAddr */
10850 +#define C0_WATCHLO 18 /* CP0: WatchpointLo */
10851 +#define C0_WATCHHI 19 /* CP0: WatchpointHi */
10852 +#define C0_XCTEXT 20 /* CP0: XContext */
10853 +#define C0_DIAGNOSTIC 22 /* CP0: Diagnostic */
10854 +#define C0_BROADCOM C0_DIAGNOSTIC /* CP0: Broadcom Register */
10855 +#define C0_ECC 26 /* CP0: ECC */
10856 +#define C0_CACHEERR 27 /* CP0: CacheErr */
10857 +#define C0_TAGLO 28 /* CP0: TagLo */
10858 +#define C0_TAGHI 29 /* CP0: TagHi */
10859 +#define C0_ERREPC 30 /* CP0: ErrorEPC */
10860 +
10861 +/*
10862 + * Macros to access the system control coprocessor
10863 + */
10864 +
10865 +#define MFC0(source, sel) \
10866 +({ \
10867 + int __res; \
10868 + __asm__ __volatile__( \
10869 + ".set\tnoreorder\n\t" \
10870 + ".set\tnoat\n\t" \
10871 + ".word\t"STR(0x40010000 | ((source)<<11) | (sel))"\n\t" \
10872 + "move\t%0,$1\n\t" \
10873 + ".set\tat\n\t" \
10874 + ".set\treorder" \
10875 + :"=r" (__res) \
10876 + : \
10877 + :"$1"); \
10878 + __res; \
10879 +})
10880 +
10881 +#define MTC0(source, sel, value) \
10882 +do { \
10883 + __asm__ __volatile__( \
10884 + ".set\tnoreorder\n\t" \
10885 + ".set\tnoat\n\t" \
10886 + "move\t$1,%z0\n\t" \
10887 + ".word\t"STR(0x40810000 | ((source)<<11) | (sel))"\n\t" \
10888 + ".set\tat\n\t" \
10889 + ".set\treorder" \
10890 + : \
10891 + :"Jr" (value) \
10892 + :"$1"); \
10893 +} while (0)
10894 +
10895 +/*
10896 + * R4x00 interrupt enable / cause bits
10897 + */
10898 +#undef IE_SW0
10899 +#undef IE_SW1
10900 +#undef IE_IRQ0
10901 +#undef IE_IRQ1
10902 +#undef IE_IRQ2
10903 +#undef IE_IRQ3
10904 +#undef IE_IRQ4
10905 +#undef IE_IRQ5
10906 +#define IE_SW0 (1<< 8)
10907 +#define IE_SW1 (1<< 9)
10908 +#define IE_IRQ0 (1<<10)
10909 +#define IE_IRQ1 (1<<11)
10910 +#define IE_IRQ2 (1<<12)
10911 +#define IE_IRQ3 (1<<13)
10912 +#define IE_IRQ4 (1<<14)
10913 +#define IE_IRQ5 (1<<15)
10914 +
10915 +/*
10916 + * Bitfields in the R4xx0 cp0 status register
10917 + */
10918 +#define ST0_IE 0x00000001
10919 +#define ST0_EXL 0x00000002
10920 +#define ST0_ERL 0x00000004
10921 +#define ST0_KSU 0x00000018
10922 +# define KSU_USER 0x00000010
10923 +# define KSU_SUPERVISOR 0x00000008
10924 +# define KSU_KERNEL 0x00000000
10925 +#define ST0_UX 0x00000020
10926 +#define ST0_SX 0x00000040
10927 +#define ST0_KX 0x00000080
10928 +#define ST0_DE 0x00010000
10929 +#define ST0_CE 0x00020000
10930 +
10931 +/*
10932 + * Status register bits available in all MIPS CPUs.
10933 + */
10934 +#define ST0_IM 0x0000ff00
10935 +#define ST0_CH 0x00040000
10936 +#define ST0_SR 0x00100000
10937 +#define ST0_TS 0x00200000
10938 +#define ST0_BEV 0x00400000
10939 +#define ST0_RE 0x02000000
10940 +#define ST0_FR 0x04000000
10941 +#define ST0_CU 0xf0000000
10942 +#define ST0_CU0 0x10000000
10943 +#define ST0_CU1 0x20000000
10944 +#define ST0_CU2 0x40000000
10945 +#define ST0_CU3 0x80000000
10946 +#define ST0_XX 0x80000000 /* MIPS IV naming */
10947 +
10948 +/*
10949 + * Cache Operations
10950 + */
10951 +
10952 +#ifndef Fill_I
10953 +#define Fill_I 0x14
10954 +#endif
10955 +
10956 +#define cache_unroll(base,op) \
10957 + __asm__ __volatile__(" \
10958 + .set noreorder; \
10959 + .set mips3; \
10960 + cache %1, (%0); \
10961 + .set mips0; \
10962 + .set reorder" \
10963 + : \
10964 + : "r" (base), \
10965 + "i" (op));
10966 +
10967 +/*
10968 + * These are the UART port assignments, expressed as offsets from the base
10969 + * register. These assignments should hold for any serial port based on
10970 + * a 8250, 16450, or 16550(A).
10971 + */
10972 +
10973 +#define UART_MCR 4 /* Out: Modem Control Register */
10974 +#define UART_MSR 6 /* In: Modem Status Register */
10975 +#define UART_MCR_LOOP 0x10 /* Enable loopback test mode */
10976 +
10977 +/*
10978 + * Returns TRUE if an external UART exists at the given base
10979 + * register.
10980 + */
10981 +static bool
10982 +serial_exists(uint8 *regs)
10983 +{
10984 + uint8 save_mcr, status1;
10985 +
10986 + save_mcr = R_REG(&regs[UART_MCR]);
10987 + W_REG(&regs[UART_MCR], UART_MCR_LOOP | 0x0a);
10988 + status1 = R_REG(&regs[UART_MSR]) & 0xf0;
10989 + W_REG(&regs[UART_MCR], save_mcr);
10990 +
10991 + return (status1 == 0x90);
10992 +}
10993 +
10994 +/*
10995 + * Initializes UART access. The callback function will be called once
10996 + * per found UART.
10997 +*/
10998 +void
10999 +sb_serial_init(void *sbh, void (*add)(void *regs, uint irq, uint baud_base, uint reg_shift))
11000 +{
11001 + void *regs;
11002 + ulong base;
11003 + uint irq;
11004 + int i, n;
11005 +
11006 + if ((regs = sb_setcore(sbh, SB_EXTIF, 0))) {
11007 + extifregs_t *eir = (extifregs_t *) regs;
11008 + sbconfig_t *sb;
11009 +
11010 + /* Determine external UART register base */
11011 + sb = (sbconfig_t *)((ulong) eir + SBCONFIGOFF);
11012 + base = EXTIF_CFGIF_BASE(sb_base(R_REG(&sb->sbadmatch1)));
11013 +
11014 + /* Determine IRQ */
11015 + irq = sb_irq(sbh);
11016 +
11017 + /* Disable GPIO interrupt initially */
11018 + W_REG(&eir->gpiointpolarity, 0);
11019 + W_REG(&eir->gpiointmask, 0);
11020 +
11021 + /* Search for external UARTs */
11022 + n = 2;
11023 + for (i = 0; i < 2; i++) {
11024 + regs = (void *) REG_MAP(base + (i * 8), 8);
11025 + if (serial_exists(regs)) {
11026 + /* Set GPIO 1 to be the external UART IRQ */
11027 + W_REG(&eir->gpiointmask, 2);
11028 + if (add)
11029 + add(regs, irq, 13500000, 0);
11030 + }
11031 + }
11032 +
11033 + /* Add internal UART if enabled */
11034 + if (R_REG(&eir->corecontrol) & CC_UE)
11035 + if (add)
11036 + add((void *) &eir->uartdata, irq, sb_clock(sbh), 2);
11037 + } else if ((regs = sb_setcore(sbh, SB_CC, 0))) {
11038 + chipcregs_t *cc = (chipcregs_t *) regs;
11039 + uint32 rev, cap, pll, baud_base, div;
11040 +
11041 + /* Determine core revision and capabilities */
11042 + rev = sb_corerev(sbh);
11043 + cap = R_REG(&cc->capabilities);
11044 + pll = cap & CAP_PLL_MASK;
11045 +
11046 + /* Determine IRQ */
11047 + irq = sb_irq(sbh);
11048 +
11049 + if (pll == PLL_TYPE1) {
11050 + /* PLL clock */
11051 + baud_base = sb_clock_rate(pll,
11052 + R_REG(&cc->clockcontrol_n),
11053 + R_REG(&cc->clockcontrol_m2));
11054 + div = 1;
11055 + } else if (rev >= 3) {
11056 + /* Internal backplane clock */
11057 + baud_base = sb_clock_rate(pll,
11058 + R_REG(&cc->clockcontrol_n),
11059 + R_REG(&cc->clockcontrol_sb));
11060 + div = 2; /* Minimum divisor */
11061 + W_REG(&cc->uart_clkdiv, div);
11062 + } else {
11063 + /* Fixed internal backplane clock */
11064 + baud_base = 88000000;
11065 + div = 48;
11066 + }
11067 +
11068 + /* Clock source depends on strapping if UartClkOverride is unset */
11069 + if ((rev > 0) && ((R_REG(&cc->corecontrol) & CC_UARTCLKO) == 0)) {
11070 + if ((cap & CAP_UCLKSEL) == CAP_UINTCLK) {
11071 + /* Internal divided backplane clock */
11072 + baud_base /= div;
11073 + } else {
11074 + /* Assume external clock of 1.8432 MHz */
11075 + baud_base = 1843200;
11076 + }
11077 + }
11078 +
11079 + /* Add internal UARTs */
11080 + n = cap & CAP_UARTS_MASK;
11081 + for (i = 0; i < n; i++) {
11082 + /* Register offset changed after revision 0 */
11083 + if (rev)
11084 + regs = (void *)((ulong) &cc->uart0data + (i * 256));
11085 + else
11086 + regs = (void *)((ulong) &cc->uart0data + (i * 8));
11087 +
11088 + if (add)
11089 + add(regs, irq, baud_base, 0);
11090 + }
11091 + }
11092 +}
11093 +
11094 +/* Returns the SB interrupt flag of the current core. */
11095 +uint32
11096 +sb_flag(void *sbh)
11097 +{
11098 + void *regs;
11099 + sbconfig_t *sb;
11100 +
11101 + regs = sb_coreregs(sbh);
11102 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
11103 +
11104 + return (R_REG(&sb->sbtpsflag) & SBTPS_NUM0_MASK);
11105 +}
11106 +
11107 +static const uint32 sbips_int_mask[] = {
11108 + 0,
11109 + SBIPS_INT1_MASK,
11110 + SBIPS_INT2_MASK,
11111 + SBIPS_INT3_MASK,
11112 + SBIPS_INT4_MASK
11113 +};
11114 +
11115 +static const uint32 sbips_int_shift[] = {
11116 + 0,
11117 + 0,
11118 + SBIPS_INT2_SHIFT,
11119 + SBIPS_INT3_SHIFT,
11120 + SBIPS_INT4_SHIFT
11121 +};
11122 +
11123 +/*
11124 + * Returns the MIPS IRQ assignment of the current core. If unassigned,
11125 + * 0 is returned.
11126 + */
11127 +uint
11128 +sb_irq(void *sbh)
11129 +{
11130 + uint idx;
11131 + void *regs;
11132 + sbconfig_t *sb;
11133 + uint32 flag, sbipsflag;
11134 + uint irq = 0;
11135 +
11136 + flag = sb_flag(sbh);
11137 +
11138 + idx = sb_coreidx(sbh);
11139 +
11140 + if ((regs = sb_setcore(sbh, SB_MIPS, 0)) ||
11141 + (regs = sb_setcore(sbh, SB_MIPS33, 0))) {
11142 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
11143 +
11144 + /* sbipsflag specifies which core is routed to interrupts 1 to 4 */
11145 + sbipsflag = R_REG(&sb->sbipsflag);
11146 + for (irq = 1; irq <= 4; irq++) {
11147 + if (((sbipsflag & sbips_int_mask[irq]) >> sbips_int_shift[irq]) == flag)
11148 + break;
11149 + }
11150 + if (irq == 5)
11151 + irq = 0;
11152 + }
11153 +
11154 + sb_setcoreidx(sbh, idx);
11155 +
11156 + return irq;
11157 +}
11158 +
11159 +/* Clears the specified MIPS IRQ. */
11160 +static void
11161 +sb_clearirq(void *sbh, uint irq)
11162 +{
11163 + void *regs;
11164 + sbconfig_t *sb;
11165 +
11166 + if (!(regs = sb_setcore(sbh, SB_MIPS, 0)) &&
11167 + !(regs = sb_setcore(sbh, SB_MIPS33, 0)))
11168 + ASSERT(regs);
11169 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
11170 +
11171 + if (irq == 0)
11172 + W_REG(&sb->sbintvec, 0);
11173 + else
11174 + OR_REG(&sb->sbipsflag, sbips_int_mask[irq]);
11175 +}
11176 +
11177 +/*
11178 + * Assigns the specified MIPS IRQ to the specified core. Shared MIPS
11179 + * IRQ 0 may be assigned more than once.
11180 + */
11181 +static void
11182 +sb_setirq(void *sbh, uint irq, uint coreid, uint coreunit)
11183 +{
11184 + void *regs;
11185 + sbconfig_t *sb;
11186 + uint32 flag;
11187 +
11188 + regs = sb_setcore(sbh, coreid, coreunit);
11189 + ASSERT(regs);
11190 + flag = sb_flag(sbh);
11191 +
11192 + if (!(regs = sb_setcore(sbh, SB_MIPS, 0)) &&
11193 + !(regs = sb_setcore(sbh, SB_MIPS33, 0)))
11194 + ASSERT(regs);
11195 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
11196 +
11197 + if (irq == 0)
11198 + OR_REG(&sb->sbintvec, 1 << flag);
11199 + else {
11200 + flag <<= sbips_int_shift[irq];
11201 + ASSERT(!(flag & ~sbips_int_mask[irq]));
11202 + flag |= R_REG(&sb->sbipsflag) & ~sbips_int_mask[irq];
11203 + W_REG(&sb->sbipsflag, flag);
11204 + }
11205 +}
11206 +
11207 +/*
11208 + * Initializes clocks and interrupts. SB and NVRAM access must be
11209 + * initialized prior to calling.
11210 + */
11211 +void
11212 +sb_mips_init(void *sbh)
11213 +{
11214 + ulong hz, ns, tmp;
11215 + extifregs_t *eir;
11216 + chipcregs_t *cc;
11217 + char *value;
11218 + uint irq;
11219 +
11220 + /* Figure out current SB clock speed */
11221 + if ((hz = sb_clock(sbh)) == 0)
11222 + hz = 100000000;
11223 + ns = 1000000000 / hz;
11224 +
11225 + /* Setup external interface timing */
11226 + if ((eir = sb_setcore(sbh, SB_EXTIF, 0))) {
11227 + /* Initialize extif so we can get to the LEDs and external UART */
11228 + W_REG(&eir->prog_config, CF_EN);
11229 +
11230 + /* Set timing for the flash */
11231 + tmp = CEIL(10, ns) << FW_W3_SHIFT; /* W3 = 10nS */
11232 + tmp = tmp | (CEIL(40, ns) << FW_W1_SHIFT); /* W1 = 40nS */
11233 + tmp = tmp | CEIL(120, ns); /* W0 = 120nS */
11234 + W_REG(&eir->prog_waitcount, tmp); /* 0x01020a0c for a 100Mhz clock */
11235 +
11236 + /* Set programmable interface timing for external uart */
11237 + tmp = CEIL(10, ns) << FW_W3_SHIFT; /* W3 = 10nS */
11238 + tmp = tmp | (CEIL(20, ns) << FW_W2_SHIFT); /* W2 = 20nS */
11239 + tmp = tmp | (CEIL(100, ns) << FW_W1_SHIFT); /* W1 = 100nS */
11240 + tmp = tmp | CEIL(120, ns); /* W0 = 120nS */
11241 + W_REG(&eir->prog_waitcount, tmp); /* 0x01020a0c for a 100Mhz clock */
11242 + } else if ((cc = sb_setcore(sbh, SB_CC, 0))) {
11243 + /* Set timing for the flash */
11244 + tmp = CEIL(10, ns) << FW_W3_SHIFT; /* W3 = 10nS */
11245 + tmp |= CEIL(10, ns) << FW_W1_SHIFT; /* W1 = 10nS */
11246 + tmp |= CEIL(120, ns); /* W0 = 120nS */
11247 + W_REG(&cc->parallelflashwaitcnt, tmp);
11248 +
11249 + W_REG(&cc->cs01memwaitcnt, tmp);
11250 + }
11251 +
11252 + /* Chip specific initialization */
11253 + switch (sb_chip(sbh)) {
11254 + case BCM4710_DEVICE_ID:
11255 + /* Clear interrupt map */
11256 + for (irq = 0; irq <= 4; irq++)
11257 + sb_clearirq(sbh, irq);
11258 + sb_setirq(sbh, 0, SB_CODEC, 0);
11259 + sb_setirq(sbh, 0, SB_EXTIF, 0);
11260 + sb_setirq(sbh, 2, SB_ENET, 1);
11261 + sb_setirq(sbh, 3, SB_ILINE20, 0);
11262 + sb_setirq(sbh, 4, SB_PCI, 0);
11263 + ASSERT(eir);
11264 + value = nvram_get("et0phyaddr");
11265 + if (value && !strcmp(value, "31")) {
11266 + /* Enable internal UART */
11267 + W_REG(&eir->corecontrol, CC_UE);
11268 + /* Give USB its own interrupt */
11269 + sb_setirq(sbh, 1, SB_USB, 0);
11270 + } else {
11271 + /* Disable internal UART */
11272 + W_REG(&eir->corecontrol, 0);
11273 + /* Give Ethernet its own interrupt */
11274 + sb_setirq(sbh, 1, SB_ENET, 0);
11275 + sb_setirq(sbh, 0, SB_USB, 0);
11276 + }
11277 + break;
11278 + case BCM4310_DEVICE_ID:
11279 + MTC0(C0_BROADCOM, 0, MFC0(C0_BROADCOM, 0) & ~(1 << 22));
11280 + break;
11281 + }
11282 +}
11283 +
11284 +uint32
11285 +sb_mips_clock(void *sbh)
11286 +{
11287 + extifregs_t *eir;
11288 + chipcregs_t *cc;
11289 + uint32 n, m;
11290 + uint idx;
11291 + uint32 pll_type, rate = 0;
11292 +
11293 + /* get index of the current core */
11294 + idx = sb_coreidx(sbh);
11295 + pll_type = PLL_TYPE1;
11296 +
11297 + /* switch to extif or chipc core */
11298 + if ((eir = (extifregs_t *) sb_setcore(sbh, SB_EXTIF, 0))) {
11299 + n = R_REG(&eir->clockcontrol_n);
11300 + m = R_REG(&eir->clockcontrol_sb);
11301 + } else if ((cc = (chipcregs_t *) sb_setcore(sbh, SB_CC, 0))) {
11302 + pll_type = R_REG(&cc->capabilities) & CAP_PLL_MASK;
11303 + n = R_REG(&cc->clockcontrol_n);
11304 + if ((pll_type == PLL_TYPE2) || (pll_type == PLL_TYPE4))
11305 + m = R_REG(&cc->clockcontrol_mips);
11306 + else if (pll_type == PLL_TYPE3) {
11307 + rate = 200000000;
11308 + goto out;
11309 + } else
11310 + m = R_REG(&cc->clockcontrol_sb);
11311 + } else
11312 + goto out;
11313 +
11314 + /* calculate rate */
11315 + rate = sb_clock_rate(pll_type, n, m);
11316 +
11317 +out:
11318 + /* switch back to previous core */
11319 + sb_setcoreidx(sbh, idx);
11320 +
11321 + return rate;
11322 +}
11323 +
11324 +static void
11325 +icache_probe(int *size, int *lsize)
11326 +{
11327 + uint32 config1;
11328 + uint sets, ways;
11329 +
11330 + config1 = MFC0(C0_CONFIG, 1);
11331 +
11332 + /* Instruction Cache Size = Associativity * Line Size * Sets Per Way */
11333 + if ((*lsize = ((config1 >> 19) & 7)))
11334 + *lsize = 2 << *lsize;
11335 + sets = 64 << ((config1 >> 22) & 7);
11336 + ways = 1 + ((config1 >> 16) & 7);
11337 + *size = *lsize * sets * ways;
11338 +}
11339 +
11340 +#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4)
11341 +
11342 +static void
11343 +handler(void)
11344 +{
11345 + /* Step 11 */
11346 + __asm__ (
11347 + ".set\tmips32\n\t"
11348 + "ssnop\n\t"
11349 + "ssnop\n\t"
11350 + /* Disable interrupts */
11351 + /* MTC0(C0_STATUS, 0, MFC0(C0_STATUS, 0) & ~(ALLINTS | STO_IE)); */
11352 + "mfc0 $15, $12\n\t"
11353 + "and $15, $15, -31746\n\t"
11354 + "mtc0 $15, $12\n\t"
11355 + "eret\n\t"
11356 + "nop\n\t"
11357 + "nop\n\t"
11358 + ".set\tmips0"
11359 + );
11360 +}
11361 +
11362 +/* The following MUST come right after handler() */
11363 +static void
11364 +afterhandler(void)
11365 +{
11366 +}
11367 +
11368 +/*
11369 + * Set the MIPS, backplane and PCI clocks as closely as possible.
11370 + */
11371 +bool
11372 +sb_mips_setclock(void *sbh, uint32 mipsclock, uint32 sbclock, uint32 pciclock)
11373 +{
11374 + extifregs_t *eir = NULL;
11375 + chipcregs_t *cc = NULL;
11376 + mipsregs_t *mipsr = NULL;
11377 + volatile uint32 *clockcontrol_n, *clockcontrol_sb, *clockcontrol_pci;
11378 + uint32 orig_n, orig_sb, orig_pci, orig_m2, orig_mips, orig_ratio_parm, new_ratio;
11379 + uint32 pll_type, sync_mode;
11380 + uint idx, i;
11381 + struct {
11382 + uint32 mipsclock;
11383 + uint16 n;
11384 + uint32 sb;
11385 + uint32 pci33;
11386 + uint32 pci25;
11387 + } type1_table[] = {
11388 + { 96000000, 0x0303, 0x04020011, 0x11030011, 0x11050011 }, /* 96.000 32.000 24.000 */
11389 + { 100000000, 0x0009, 0x04020011, 0x11030011, 0x11050011 }, /* 100.000 33.333 25.000 */
11390 + { 104000000, 0x0802, 0x04020011, 0x11050009, 0x11090009 }, /* 104.000 31.200 24.960 */
11391 + { 108000000, 0x0403, 0x04020011, 0x11050009, 0x02000802 }, /* 108.000 32.400 24.923 */
11392 + { 112000000, 0x0205, 0x04020011, 0x11030021, 0x02000403 }, /* 112.000 32.000 24.889 */
11393 + { 115200000, 0x0303, 0x04020009, 0x11030011, 0x11050011 }, /* 115.200 32.000 24.000 */
11394 + { 120000000, 0x0011, 0x04020011, 0x11050011, 0x11090011 }, /* 120.000 30.000 24.000 */
11395 + { 124800000, 0x0802, 0x04020009, 0x11050009, 0x11090009 }, /* 124.800 31.200 24.960 */
11396 + { 128000000, 0x0305, 0x04020011, 0x11050011, 0x02000305 }, /* 128.000 32.000 24.000 */
11397 + { 132000000, 0x0603, 0x04020011, 0x11050011, 0x02000305 }, /* 132.000 33.000 24.750 */
11398 + { 136000000, 0x0c02, 0x04020011, 0x11090009, 0x02000603 }, /* 136.000 32.640 24.727 */
11399 + { 140000000, 0x0021, 0x04020011, 0x11050021, 0x02000c02 }, /* 140.000 30.000 24.706 */
11400 + { 144000000, 0x0405, 0x04020011, 0x01020202, 0x11090021 }, /* 144.000 30.857 24.686 */
11401 + { 150857142, 0x0605, 0x04020021, 0x02000305, 0x02000605 }, /* 150.857 33.000 24.000 */
11402 + { 152000000, 0x0e02, 0x04020011, 0x11050021, 0x02000e02 }, /* 152.000 32.571 24.000 */
11403 + { 156000000, 0x0802, 0x04020005, 0x11050009, 0x11090009 }, /* 156.000 31.200 24.960 */
11404 + { 160000000, 0x0309, 0x04020011, 0x11090011, 0x02000309 }, /* 160.000 32.000 24.000 */
11405 + { 163200000, 0x0c02, 0x04020009, 0x11090009, 0x02000603 }, /* 163.200 32.640 24.727 */
11406 + { 168000000, 0x0205, 0x04020005, 0x11030021, 0x02000403 }, /* 168.000 32.000 24.889 */
11407 + { 176000000, 0x0602, 0x04020003, 0x11050005, 0x02000602 }, /* 176.000 33.000 24.000 */
11408 + };
11409 + typedef struct {
11410 + uint32 mipsclock;
11411 + uint32 sbclock;
11412 + uint16 n;
11413 + uint32 sb;
11414 + uint32 pci33;
11415 + uint32 m2;
11416 + uint32 m3;
11417 + uint32 ratio;
11418 + uint32 ratio_parm;
11419 + } n4m_table_t;
11420 +
11421 + n4m_table_t type2_table[] = {
11422 + { 180000000, 80000000, 0x0403, 0x01010000, 0x01020300, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
11423 + { 180000000, 90000000, 0x0403, 0x01000100, 0x01020300, 0x01000100, 0x05000100, 0x21, 0x0aaa0555 },
11424 + { 200000000, 100000000, 0x0303, 0x01000000, 0x01000600, 0x01000000, 0x05000000, 0x21, 0x0aaa0555 },
11425 + { 211200000, 105600000, 0x0902, 0x01000200, 0x01030400, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
11426 + { 220800000, 110400000, 0x1500, 0x01000200, 0x01030400, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
11427 + { 230400000, 115200000, 0x0604, 0x01000200, 0x01020600, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
11428 + { 234000000, 104000000, 0x0b01, 0x01010000, 0x01010700, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
11429 + { 240000000, 120000000, 0x0803, 0x01000200, 0x01020600, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
11430 + { 252000000, 126000000, 0x0504, 0x01000100, 0x01020500, 0x01000100, 0x05000100, 0x21, 0x0aaa0555 },
11431 + { 264000000, 132000000, 0x0903, 0x01000200, 0x01020700, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
11432 + { 270000000, 120000000, 0x0703, 0x01010000, 0x01030400, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
11433 + { 276000000, 122666666, 0x1500, 0x01010000, 0x01030400, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
11434 + { 280000000, 140000000, 0x0503, 0x01000000, 0x01010600, 0x01000000, 0x05000000, 0x21, 0x0aaa0555 },
11435 + { 288000000, 128000000, 0x0604, 0x01010000, 0x01030400, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
11436 + { 288000000, 144000000, 0x0404, 0x01000000, 0x01010600, 0x01000000, 0x05000000, 0x21, 0x0aaa0555 },
11437 + { 300000000, 133333333, 0x0803, 0x01010000, 0x01020600, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
11438 + { 300000000, 150000000, 0x0803, 0x01000100, 0x01020600, 0x01000100, 0x05000100, 0x21, 0x0aaa0555 }
11439 + };
11440 +
11441 + n4m_table_t type4_table[] = {
11442 + { 192000000, 96000000, 0x0702, 0x04020011, 0x11030011, 0x04020011, 0x04020003, 0x21, 0x0aaa0555 },
11443 + { 200000000, 100000000, 0x0009, 0x04020011, 0x11030011, 0x04020011, 0x04020003, 0x21, 0x0aaa0555 },
11444 + { 216000000, 108000000, 0x0211, 0x11020005, 0x11030303, 0x11020005, 0x04000005, 0x21, 0x0aaa0555 },
11445 + { 228000000, 101333333, 0x0e02, 0x11030003, 0x11210005, 0x11030305, 0x04000005, 0x94, 0x012a00a9 },
11446 + { 228000000, 114000000, 0x0e02, 0x11020005, 0x11210005, 0x11020005, 0x04000005, 0x21, 0x0aaa0555 },
11447 + { 240000000, 120000000, 0x0109, 0x11030002, 0x01050203, 0x11030002, 0x04000003, 0x21, 0x0aaa0555 },
11448 + { 252000000, 126000000, 0x0203, 0x04000005, 0x11050005, 0x04000005, 0x04000002, 0x21, 0x0aaa0555 },
11449 + { 264000000, 132000000, 0x0602, 0x04000005, 0x11050005, 0x04000005, 0x04000002, 0x21, 0x0aaa0555 },
11450 + { 272000000, 116571428, 0x0c02, 0x04000021, 0x02000909, 0x02000221, 0x04000003, 0x73, 0x254a14a9 },
11451 + { 280000000, 120000000, 0x0209, 0x04000021, 0x01030303, 0x02000221, 0x04000003, 0x73, 0x254a14a9 },
11452 + { 288000000, 123428571, 0x0111, 0x04000021, 0x01030303, 0x02000221, 0x04000003, 0x73, 0x254a14a9 },
11453 + { 300000000, 120000000, 0x0009, 0x04000009, 0x01030203, 0x02000902, 0x04000002, 0x52, 0x02520129 }
11454 + };
11455 + uint icache_size, ic_lsize;
11456 + ulong start, end, dst;
11457 + bool ret = FALSE;
11458 +
11459 + /* get index of the current core */
11460 + idx = sb_coreidx(sbh);
11461 +
11462 + /* switch to extif or chipc core */
11463 + if ((eir = (extifregs_t *) sb_setcore(sbh, SB_EXTIF, 0))) {
11464 + pll_type = PLL_TYPE1;
11465 + clockcontrol_n = &eir->clockcontrol_n;
11466 + clockcontrol_sb = &eir->clockcontrol_sb;
11467 + clockcontrol_pci = &eir->clockcontrol_pci;
11468 + } else if ((cc = (chipcregs_t *) sb_setcore(sbh, SB_CC, 0))) {
11469 + pll_type = R_REG(&cc->capabilities) & CAP_PLL_MASK;
11470 + clockcontrol_n = &cc->clockcontrol_n;
11471 + clockcontrol_sb = &cc->clockcontrol_sb;
11472 + clockcontrol_pci = &cc->clockcontrol_pci;
11473 + } else
11474 + goto done;
11475 +
11476 + /* Store the current clock register values */
11477 + orig_n = R_REG(clockcontrol_n);
11478 + orig_sb = R_REG(clockcontrol_sb);
11479 + orig_pci = R_REG(clockcontrol_pci);
11480 +
11481 + if (pll_type == PLL_TYPE1) {
11482 + /* Keep the current PCI clock if not specified */
11483 + if (pciclock == 0) {
11484 + pciclock = sb_clock_rate(pll_type, R_REG(clockcontrol_n), R_REG(clockcontrol_pci));
11485 + pciclock = (pciclock <= 25000000) ? 25000000 : 33000000;
11486 + }
11487 +
11488 + /* Search for the closest MIPS clock less than or equal to a preferred value */
11489 + for (i = 0; i < ARRAYSIZE(type1_table); i++) {
11490 + ASSERT(type1_table[i].mipsclock ==
11491 + sb_clock_rate(pll_type, type1_table[i].n, type1_table[i].sb));
11492 + if (type1_table[i].mipsclock > mipsclock)
11493 + break;
11494 + }
11495 + if (i == 0) {
11496 + ret = FALSE;
11497 + goto done;
11498 + } else {
11499 + ret = TRUE;
11500 + i--;
11501 + }
11502 + ASSERT(type1_table[i].mipsclock <= mipsclock);
11503 +
11504 + /* No PLL change */
11505 + if ((orig_n == type1_table[i].n) &&
11506 + (orig_sb == type1_table[i].sb) &&
11507 + (orig_pci == type1_table[i].pci33))
11508 + goto done;
11509 +
11510 + /* Set the PLL controls */
11511 + W_REG(clockcontrol_n, type1_table[i].n);
11512 + W_REG(clockcontrol_sb, type1_table[i].sb);
11513 + if (pciclock == 25000000)
11514 + W_REG(clockcontrol_pci, type1_table[i].pci25);
11515 + else
11516 + W_REG(clockcontrol_pci, type1_table[i].pci33);
11517 +
11518 + /* Reset */
11519 + sb_watchdog(sbh, 1);
11520 + while (1);
11521 + } else if ((pll_type == PLL_TYPE2) || (pll_type == PLL_TYPE4)) {
11522 + n4m_table_t *table = (pll_type == PLL_TYPE2) ? type2_table : type4_table;
11523 + uint tabsz = (pll_type == PLL_TYPE2) ? ARRAYSIZE(type2_table) : ARRAYSIZE(type4_table);
11524 +
11525 + ASSERT(cc);
11526 +
11527 + /* Store the current clock register values */
11528 + orig_m2 = R_REG(&cc->clockcontrol_m2);
11529 + orig_mips = R_REG(&cc->clockcontrol_mips);
11530 + orig_ratio_parm = 0;
11531 +
11532 + /* Look up current ratio */
11533 + for (i = 0; i < tabsz; i++) {
11534 + if ((orig_n == table[i].n) &&
11535 + (orig_sb == table[i].sb) &&
11536 + (orig_pci == table[i].pci33) &&
11537 + (orig_m2 == table[i].m2) &&
11538 + (orig_mips == table[i].m3)) {
11539 + orig_ratio_parm = table[i].ratio_parm;
11540 + break;
11541 + }
11542 + }
11543 +
11544 + /* Search for the closest MIPS clock greater or equal to a preferred value */
11545 + for (i = 0; i < tabsz; i++) {
11546 + ASSERT(table[i].mipsclock ==
11547 + sb_clock_rate(pll_type, table[i].n, table[i].m3));
11548 + if ((mipsclock <= table[i].mipsclock) &&
11549 + ((sbclock == 0) || (sbclock <= table[i].sbclock)))
11550 + break;
11551 + }
11552 + if (i == tabsz) {
11553 + ret = FALSE;
11554 + goto done;
11555 + } else {
11556 + ret = TRUE;
11557 + }
11558 +
11559 + /* No PLL change */
11560 + if ((orig_n == table[i].n) &&
11561 + (orig_sb == table[i].sb) &&
11562 + (orig_pci == table[i].pci33) &&
11563 + (orig_m2 == table[i].m2) &&
11564 + (orig_mips == table[i].m3))
11565 + goto done;
11566 +
11567 + /* Set the PLL controls */
11568 + W_REG(clockcontrol_n, table[i].n);
11569 + W_REG(clockcontrol_sb, table[i].sb);
11570 + W_REG(clockcontrol_pci, table[i].pci33);
11571 + W_REG(&cc->clockcontrol_m2, table[i].m2);
11572 + W_REG(&cc->clockcontrol_mips, table[i].m3);
11573 +
11574 + /* No ratio change */
11575 + if (orig_ratio_parm == table[i].ratio_parm)
11576 + goto end_fill;
11577 +
11578 + new_ratio = table[i].ratio_parm;
11579 +
11580 + icache_probe(&icache_size, &ic_lsize);
11581 +
11582 + /* Preload the code into the cache */
11583 + start = ((ulong) &&start_fill) & ~(ic_lsize - 1);
11584 + end = ((ulong) &&end_fill + (ic_lsize - 1)) & ~(ic_lsize - 1);
11585 + while (start < end) {
11586 + cache_unroll(start, Fill_I);
11587 + start += ic_lsize;
11588 + }
11589 +
11590 + /* Copy the handler */
11591 + start = (ulong) &handler;
11592 + end = (ulong) &afterhandler;
11593 + dst = KSEG1ADDR(0x180);
11594 + for (i = 0; i < (end - start); i += 4)
11595 + *((ulong *)(dst + i)) = *((ulong *)(start + i));
11596 +
11597 + /* Preload handler into the cache one line at a time */
11598 + for (i = 0; i < (end - start); i += 4)
11599 + cache_unroll(dst + i, Fill_I);
11600 +
11601 + /* Clear BEV bit */
11602 + MTC0(C0_STATUS, 0, MFC0(C0_STATUS, 0) & ~ST0_BEV);
11603 +
11604 + /* Enable interrupts */
11605 + MTC0(C0_STATUS, 0, MFC0(C0_STATUS, 0) | (ALLINTS | ST0_IE));
11606 +
11607 + /* Enable MIPS timer interrupt */
11608 + if (!(mipsr = sb_setcore(sbh, SB_MIPS, 0)) &&
11609 + !(mipsr = sb_setcore(sbh, SB_MIPS33, 0)))
11610 + ASSERT(mipsr);
11611 + W_REG(&mipsr->intmask, 1);
11612 +
11613 + start_fill:
11614 + /* step 1, set clock ratios */
11615 + MTC0(C0_BROADCOM, 3, new_ratio);
11616 + MTC0(C0_BROADCOM, 1, 8);
11617 +
11618 + /* step 2: program timer intr */
11619 + W_REG(&mipsr->timer, 100);
11620 + (void) R_REG(&mipsr->timer);
11621 +
11622 + /* step 3, switch to async */
11623 + sync_mode = MFC0(C0_BROADCOM, 4);
11624 + MTC0(C0_BROADCOM, 4, 1 << 22);
11625 +
11626 + /* step 4, set cfg active */
11627 + MTC0(C0_BROADCOM, 2, 0x9);
11628 +
11629 +
11630 + /* steps 5 & 6 */
11631 + __asm__ __volatile__ (
11632 + ".set\tmips3\n\t"
11633 + "wait\n\t"
11634 + ".set\tmips0"
11635 + );
11636 +
11637 + /* step 7, clear cfg_active */
11638 + MTC0(C0_BROADCOM, 2, 0);
11639 +
11640 + /* Additional Step: set back to orig sync mode */
11641 + MTC0(C0_BROADCOM, 4, sync_mode);
11642 +
11643 + /* step 8, fake soft reset */
11644 + MTC0(C0_BROADCOM, 5, MFC0(C0_BROADCOM, 5) | 4);
11645 +
11646 + end_fill:
11647 + /* step 9 set watchdog timer */
11648 + sb_watchdog(sbh, 20);
11649 + (void) R_REG(&cc->chipid);
11650 +
11651 + /* step 11 */
11652 + __asm__ __volatile__ (
11653 + ".set\tmips3\n\t"
11654 + "sync\n\t"
11655 + "wait\n\t"
11656 + ".set\tmips0"
11657 + );
11658 + while (1);
11659 + }
11660 +
11661 +done:
11662 + /* switch back to previous core */
11663 + sb_setcoreidx(sbh, idx);
11664 +
11665 + return ret;
11666 +}
11667 +
11668 +
11669 +/* returns the ncdl value to be programmed into sdram_ncdl for calibration */
11670 +uint32
11671 +sb_memc_get_ncdl(void *sbh)
11672 +{
11673 + sbmemcregs_t *memc;
11674 + uint32 ret = 0;
11675 + uint32 config, rd, wr, misc, dqsg, cd, sm, sd;
11676 + uint idx, rev;
11677 +
11678 + idx = sb_coreidx(sbh);
11679 +
11680 + memc = (sbmemcregs_t *)sb_setcore(sbh, SB_MEMC, 0);
11681 + if (memc == 0)
11682 + goto out;
11683 +
11684 + rev = sb_corerev(sbh);
11685 +
11686 + config = R_REG(&memc->config);
11687 + wr = R_REG(&memc->wrncdlcor);
11688 + rd = R_REG(&memc->rdncdlcor);
11689 + misc = R_REG(&memc->miscdlyctl);
11690 + dqsg = R_REG(&memc->dqsgatencdl);
11691 +
11692 + rd &= MEMC_RDNCDLCOR_RD_MASK;
11693 + wr &= MEMC_WRNCDLCOR_WR_MASK;
11694 + dqsg &= MEMC_DQSGATENCDL_G_MASK;
11695 +
11696 + if (config & MEMC_CONFIG_DDR) {
11697 + ret = (wr << 16) | (rd << 8) | dqsg;
11698 + } else {
11699 + if (rev > 0)
11700 + cd = rd;
11701 + else
11702 + cd = (rd == MEMC_CD_THRESHOLD) ? rd : (wr + MEMC_CD_THRESHOLD);
11703 + sm = (misc & MEMC_MISC_SM_MASK) >> MEMC_MISC_SM_SHIFT;
11704 + sd = (misc & MEMC_MISC_SD_MASK) >> MEMC_MISC_SD_SHIFT;
11705 + ret = (sm << 16) | (sd << 8) | cd;
11706 + }
11707 +
11708 +out:
11709 + /* switch back to previous core */
11710 + sb_setcoreidx(sbh, idx);
11711 +
11712 + return ret;
11713 +}
11714 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/sbpci.c linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/sbpci.c
11715 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/sbpci.c 1970-01-01 01:00:00.000000000 +0100
11716 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/sbpci.c 2005-08-28 11:12:20.479851704 +0200
11717 @@ -0,0 +1,530 @@
11718 +/*
11719 + * Low-Level PCI and SB support for BCM47xx
11720 + *
11721 + * Copyright 2001-2003, Broadcom Corporation
11722 + * All Rights Reserved.
11723 + *
11724 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
11725 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
11726 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
11727 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11728 + *
11729 + * $Id$
11730 + */
11731 +
11732 +#include <typedefs.h>
11733 +#include <pcicfg.h>
11734 +#include <bcmdevs.h>
11735 +#include <sbconfig.h>
11736 +#include <sbpci.h>
11737 +#include <osl.h>
11738 +#include <bcmendian.h>
11739 +#include <bcmutils.h>
11740 +#include <sbutils.h>
11741 +#include <bcmnvram.h>
11742 +#include <hndmips.h>
11743 +
11744 +/* Can free sbpci_init() memory after boot */
11745 +#ifndef linux
11746 +#define __init
11747 +#endif
11748 +
11749 +/* Emulated configuration space */
11750 +static pci_config_regs sb_config_regs[SB_MAXCORES];
11751 +
11752 +/* Banned cores */
11753 +static uint16 pci_ban[32] = { 0 };
11754 +static uint pci_banned = 0;
11755 +
11756 +/* CardBus mode */
11757 +static bool cardbus = FALSE;
11758 +
11759 +/*
11760 + * Functions for accessing external PCI configuration space
11761 + */
11762 +
11763 +/* Assume one-hot slot wiring */
11764 +#define PCI_SLOT_MAX 16
11765 +
11766 +static uint32
11767 +config_cmd(void *sbh, uint bus, uint dev, uint func, uint off)
11768 +{
11769 + uint coreidx;
11770 + sbpciregs_t *regs;
11771 + uint32 addr = 0;
11772 +
11773 + /* CardBusMode supports only one device */
11774 + if (cardbus && dev > 1)
11775 + return 0;
11776 +
11777 + coreidx = sb_coreidx(sbh);
11778 + regs = (sbpciregs_t *) sb_setcore(sbh, SB_PCI, 0);
11779 +
11780 + /* Type 0 transaction */
11781 + if (bus == 1) {
11782 + /* Skip unwired slots */
11783 + if (dev < PCI_SLOT_MAX) {
11784 + /* Slide the PCI window to the appropriate slot */
11785 + W_REG(&regs->sbtopci1, SBTOPCI_CFG0 | ((1 << (dev + 16)) & SBTOPCI1_MASK));
11786 + addr = SB_PCI_CFG | ((1 << (dev + 16)) & ~SBTOPCI1_MASK) |
11787 + (func << 8) | (off & ~3);
11788 + }
11789 + }
11790 +
11791 + /* Type 1 transaction */
11792 + else {
11793 + W_REG(&regs->sbtopci1, SBTOPCI_CFG1);
11794 + addr = SB_PCI_CFG | (bus << 16) | (dev << 11) | (func << 8) | (off & ~3);
11795 + }
11796 +
11797 + sb_setcoreidx(sbh, coreidx);
11798 +
11799 + return addr;
11800 +}
11801 +
11802 +static int
11803 +extpci_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
11804 +{
11805 + uint32 addr, *reg = NULL, val;
11806 + int ret = 0;
11807 +
11808 + if (!(addr = config_cmd(sbh, bus, dev, func, off)) ||
11809 + !(reg = (uint32 *) REG_MAP(addr, len)) ||
11810 + BUSPROBE(val, reg))
11811 + val = 0xffffffff;
11812 +
11813 + val >>= 8 * (off & 3);
11814 + if (len == 4)
11815 + *((uint32 *) buf) = val;
11816 + else if (len == 2)
11817 + *((uint16 *) buf) = (uint16) val;
11818 + else if (len == 1)
11819 + *((uint8 *) buf) = (uint8) val;
11820 + else
11821 + ret = -1;
11822 +
11823 + if (reg)
11824 + REG_UNMAP(reg);
11825 +
11826 + return ret;
11827 +}
11828 +
11829 +static int
11830 +extpci_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
11831 +{
11832 + uint32 addr, *reg = NULL, val;
11833 + int ret = 0;
11834 +
11835 + if (!(addr = config_cmd(sbh, bus, dev, func, off)) ||
11836 + !(reg = (uint32 *) REG_MAP(addr, len)) ||
11837 + BUSPROBE(val, reg))
11838 + goto done;
11839 +
11840 + if (len == 4)
11841 + val = *((uint32 *) buf);
11842 + else if (len == 2) {
11843 + val &= ~(0xffff << (8 * (off & 3)));
11844 + val |= *((uint16 *) buf) << (8 * (off & 3));
11845 + } else if (len == 1) {
11846 + val &= ~(0xff << (8 * (off & 3)));
11847 + val |= *((uint8 *) buf) << (8 * (off & 3));
11848 + } else
11849 + ret = -1;
11850 +
11851 + W_REG(reg, val);
11852 +
11853 + done:
11854 + if (reg)
11855 + REG_UNMAP(reg);
11856 +
11857 + return ret;
11858 +}
11859 +
11860 +/*
11861 + * Functions for accessing translated SB configuration space
11862 + */
11863 +
11864 +static int
11865 +sb_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
11866 +{
11867 + pci_config_regs *cfg;
11868 +
11869 + if (dev >= SB_MAXCORES || (off + len) > sizeof(pci_config_regs))
11870 + return -1;
11871 + cfg = &sb_config_regs[dev];
11872 +
11873 + ASSERT(ISALIGNED(off, len));
11874 + ASSERT(ISALIGNED(buf, len));
11875 +
11876 + if (len == 4)
11877 + *((uint32 *) buf) = ltoh32(*((uint32 *)((ulong) cfg + off)));
11878 + else if (len == 2)
11879 + *((uint16 *) buf) = ltoh16(*((uint16 *)((ulong) cfg + off)));
11880 + else if (len == 1)
11881 + *((uint8 *) buf) = *((uint8 *)((ulong) cfg + off));
11882 + else
11883 + return -1;
11884 +
11885 + return 0;
11886 +}
11887 +
11888 +static int
11889 +sb_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
11890 +{
11891 + uint coreidx, n;
11892 + void *regs;
11893 + sbconfig_t *sb;
11894 + pci_config_regs *cfg;
11895 +
11896 + if (dev >= SB_MAXCORES || (off + len) > sizeof(pci_config_regs))
11897 + return -1;
11898 + cfg = &sb_config_regs[dev];
11899 +
11900 + ASSERT(ISALIGNED(off, len));
11901 + ASSERT(ISALIGNED(buf, len));
11902 +
11903 + /* Emulate BAR sizing */
11904 + if (off >= OFFSETOF(pci_config_regs, base[0]) && off <= OFFSETOF(pci_config_regs, base[3]) &&
11905 + len == 4 && *((uint32 *) buf) == ~0) {
11906 + coreidx = sb_coreidx(sbh);
11907 + if ((regs = sb_setcoreidx(sbh, dev))) {
11908 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
11909 + /* Highest numbered address match register */
11910 + n = (R_REG(&sb->sbidlow) & SBIDL_AR_MASK) >> SBIDL_AR_SHIFT;
11911 + if (off == OFFSETOF(pci_config_regs, base[0]))
11912 + cfg->base[0] = ~(sb_size(R_REG(&sb->sbadmatch0)) - 1);
11913 + /*else if (off == OFFSETOF(pci_config_regs, base[1]) && n >= 1)
11914 + cfg->base[1] = ~(sb_size(R_REG(&sb->sbadmatch1)) - 1);
11915 + else if (off == OFFSETOF(pci_config_regs, base[2]) && n >= 2)
11916 + cfg->base[2] = ~(sb_size(R_REG(&sb->sbadmatch2)) - 1);
11917 + else if (off == OFFSETOF(pci_config_regs, base[3]) && n >= 3)
11918 + cfg->base[3] = ~(sb_size(R_REG(&sb->sbadmatch3)) - 1);*/
11919 + }
11920 + sb_setcoreidx(sbh, coreidx);
11921 + return 0;
11922 + }
11923 +
11924 + if (len == 4)
11925 + *((uint32 *)((ulong) cfg + off)) = htol32(*((uint32 *) buf));
11926 + else if (len == 2)
11927 + *((uint16 *)((ulong) cfg + off)) = htol16(*((uint16 *) buf));
11928 + else if (len == 1)
11929 + *((uint8 *)((ulong) cfg + off)) = *((uint8 *) buf);
11930 + else
11931 + return -1;
11932 +
11933 + return 0;
11934 +}
11935 +
11936 +int
11937 +sbpci_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
11938 +{
11939 + if (bus == 0)
11940 + return sb_read_config(sbh, bus, dev, func, off, buf, len);
11941 + else
11942 + return extpci_read_config(sbh, bus, dev, func, off, buf, len);
11943 +}
11944 +
11945 +int
11946 +sbpci_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
11947 +{
11948 + if (bus == 0)
11949 + return sb_write_config(sbh, bus, dev, func, off, buf, len);
11950 + else
11951 + return extpci_write_config(sbh, bus, dev, func, off, buf, len);
11952 +}
11953 +
11954 +void
11955 +sbpci_ban(uint16 core)
11956 +{
11957 + if (pci_banned < ARRAYSIZE(pci_ban))
11958 + pci_ban[pci_banned++] = core;
11959 +}
11960 +
11961 +int __init
11962 +sbpci_init(void *sbh)
11963 +{
11964 + uint chip, chiprev, chippkg, coreidx, host, i;
11965 + sbpciregs_t *pci;
11966 + sbconfig_t *sb;
11967 + pci_config_regs *cfg;
11968 + void *regs;
11969 + char varname[8];
11970 + uint wlidx = 0;
11971 + uint16 vendor, core;
11972 + uint8 class, subclass, progif;
11973 + uint32 val;
11974 + uint32 sbips_int_mask[] = { 0, SBIPS_INT1_MASK, SBIPS_INT2_MASK, SBIPS_INT3_MASK, SBIPS_INT4_MASK };
11975 + uint32 sbips_int_shift[] = { 0, 0, SBIPS_INT2_SHIFT, SBIPS_INT3_SHIFT, SBIPS_INT4_SHIFT };
11976 +
11977 + chip = sb_chip(sbh);
11978 + chiprev = sb_chiprev(sbh);
11979 + chippkg = sb_chippkg(sbh);
11980 + coreidx = sb_coreidx(sbh);
11981 +
11982 + if (!(pci = (sbpciregs_t *) sb_setcore(sbh, SB_PCI, 0)))
11983 + return -1;
11984 + sb_core_reset(sbh, 0);
11985 +
11986 + if (((chip == BCM4310_DEVICE_ID) && (chiprev == 0)) ||
11987 + ((chip == BCM4712_DEVICE_ID) && (chippkg == BCM4712SMALL_PKG_ID)))
11988 + host = 0;
11989 + else
11990 + host = !BUSPROBE(val, &pci->control);
11991 +
11992 + if (!host) {
11993 + /* Disable PCI interrupts in client mode */
11994 + sb = (sbconfig_t *)((ulong) pci + SBCONFIGOFF);
11995 + W_REG(&sb->sbintvec, 0);
11996 +
11997 + /* Disable the PCI bridge in client mode */
11998 + sbpci_ban(SB_PCI);
11999 + printf("PCI: Disabled\n");
12000 + } else {
12001 + /* Reset the external PCI bus and enable the clock */
12002 + W_REG(&pci->control, 0x5); /* enable the tristate drivers */
12003 + W_REG(&pci->control, 0xd); /* enable the PCI clock */
12004 + OSL_DELAY(100); /* delay 100 us */
12005 + W_REG(&pci->control, 0xf); /* deassert PCI reset */
12006 + W_REG(&pci->arbcontrol, PCI_INT_ARB); /* use internal arbiter */
12007 + OSL_DELAY(1); /* delay 1 us */
12008 +
12009 + /* Enable CardBusMode */
12010 + cardbus = nvram_match("cardbus", "1");
12011 + if (cardbus) {
12012 + printf("PCI: Enabling CardBus\n");
12013 + /* GPIO 1 resets the CardBus device on bcm94710ap */
12014 + sb_gpioout(sbh, 1, 1);
12015 + sb_gpioouten(sbh, 1, 1);
12016 + W_REG(&pci->sprom[0], R_REG(&pci->sprom[0]) | 0x400);
12017 + }
12018 +
12019 + /* 64 MB I/O access window */
12020 + W_REG(&pci->sbtopci0, SBTOPCI_IO);
12021 + /* 64 MB configuration access window */
12022 + W_REG(&pci->sbtopci1, SBTOPCI_CFG0);
12023 + /* 1 GB memory access window */
12024 + W_REG(&pci->sbtopci2, SBTOPCI_MEM | SB_PCI_DMA);
12025 +
12026 + /* Enable PCI bridge BAR0 prefetch and burst */
12027 + val = 6;
12028 + sbpci_write_config(sbh, 1, 0, 0, PCI_CFG_CMD, &val, sizeof(val));
12029 +
12030 + /* Enable PCI interrupts */
12031 + W_REG(&pci->intmask, PCI_INTA);
12032 + }
12033 +
12034 + /* Scan the SB bus */
12035 + bzero(sb_config_regs, sizeof(sb_config_regs));
12036 + for (cfg = sb_config_regs; cfg < &sb_config_regs[SB_MAXCORES]; cfg++) {
12037 + cfg->vendor = 0xffff;
12038 + if (!(regs = sb_setcoreidx(sbh, cfg - sb_config_regs)))
12039 + continue;
12040 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
12041 +
12042 + /* Read ID register and parse vendor and core */
12043 + val = R_REG(&sb->sbidhigh);
12044 + vendor = (val & SBIDH_VC_MASK) >> SBIDH_VC_SHIFT;
12045 + core = (val & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT;
12046 + progif = 0;
12047 +
12048 + /* Check if this core is banned */
12049 + for (i = 0; i < pci_banned; i++)
12050 + if (core == pci_ban[i])
12051 + break;
12052 + if (i < pci_banned)
12053 + continue;
12054 +
12055 + /* Known vendor translations */
12056 + switch (vendor) {
12057 + case SB_VEND_BCM:
12058 + vendor = VENDOR_BROADCOM;
12059 + break;
12060 + }
12061 +
12062 + /* Determine class based on known core codes */
12063 + switch (core) {
12064 + case SB_ILINE20:
12065 + class = PCI_CLASS_NET;
12066 + subclass = PCI_NET_ETHER;
12067 + core = BCM47XX_ILINE_ID;
12068 + break;
12069 + case SB_ILINE100:
12070 + class = PCI_CLASS_NET;
12071 + subclass = PCI_NET_ETHER;
12072 + core = BCM4610_ILINE_ID;
12073 + break;
12074 + case SB_ENET:
12075 + class = PCI_CLASS_NET;
12076 + subclass = PCI_NET_ETHER;
12077 + core = BCM47XX_ENET_ID;
12078 + break;
12079 + case SB_SDRAM:
12080 + case SB_MEMC:
12081 + class = PCI_CLASS_MEMORY;
12082 + subclass = PCI_MEMORY_RAM;
12083 + break;
12084 + case SB_PCI:
12085 + class = PCI_CLASS_BRIDGE;
12086 + subclass = PCI_BRIDGE_PCI;
12087 + //break;
12088 + case SB_MIPS:
12089 + case SB_MIPS33:
12090 + class = PCI_CLASS_CPU;
12091 + subclass = PCI_CPU_MIPS;
12092 + break;
12093 + case SB_CODEC:
12094 + class = PCI_CLASS_COMM;
12095 + subclass = PCI_COMM_MODEM;
12096 + core = BCM47XX_V90_ID;
12097 + break;
12098 + case SB_USB:
12099 + class = PCI_CLASS_SERIAL;
12100 + subclass = PCI_SERIAL_USB;
12101 + progif = 0x10; /* OHCI */
12102 + core = BCM47XX_USB_ID;
12103 + break;
12104 + case SB_USB11H:
12105 + class = PCI_CLASS_SERIAL;
12106 + subclass = PCI_SERIAL_USB;
12107 + progif = 0x10; /* OHCI */
12108 + core = BCM47XX_USBH_ID;
12109 + break;
12110 + case SB_USB11D:
12111 + class = PCI_CLASS_SERIAL;
12112 + subclass = PCI_SERIAL_USB;
12113 + core = BCM47XX_USBD_ID;
12114 + break;
12115 + case SB_IPSEC:
12116 + class = PCI_CLASS_CRYPT;
12117 + subclass = PCI_CRYPT_NETWORK;
12118 + core = BCM47XX_IPSEC_ID;
12119 + break;
12120 + case SB_EXTIF:
12121 + case SB_CC:
12122 + class = PCI_CLASS_MEMORY;
12123 + subclass = PCI_MEMORY_FLASH;
12124 + break;
12125 + case SB_D11:
12126 + class = PCI_CLASS_NET;
12127 + subclass = PCI_NET_OTHER;
12128 + /* Let an nvram variable override this */
12129 + sprintf(varname, "wl%did", wlidx);
12130 + wlidx++;
12131 + if ((core = getintvar(NULL, varname)) == 0) {
12132 + if (chip == BCM4712_DEVICE_ID) {
12133 + if (chippkg == BCM4712SMALL_PKG_ID)
12134 + core = BCM4306_D11G_ID;
12135 + else
12136 + core = BCM4306_D11DUAL_ID;
12137 + } else {
12138 + /* 4310 */
12139 + core = BCM4310_D11B_ID;
12140 + }
12141 + }
12142 + break;
12143 +
12144 + default:
12145 + class = subclass = progif = 0xff;
12146 + break;
12147 + }
12148 +
12149 + /* Supported translations */
12150 + cfg->vendor = htol16(vendor);
12151 + cfg->device = htol16(core);
12152 + cfg->rev_id = chiprev;
12153 + cfg->prog_if = progif;
12154 + cfg->sub_class = subclass;
12155 + cfg->base_class = class;
12156 + cfg->base[0] = htol32(sb_base(R_REG(&sb->sbadmatch0)));
12157 + cfg->base[1] = 0/*htol32(sb_base(R_REG(&sb->sbadmatch1)))*/;
12158 + cfg->base[2] = 0/*htol32(sb_base(R_REG(&sb->sbadmatch2)))*/;
12159 + cfg->base[3] = 0/*htol32(sb_base(R_REG(&sb->sbadmatch3)))*/;
12160 + cfg->base[4] = 0;
12161 + cfg->base[5] = 0;
12162 + if (class == PCI_CLASS_BRIDGE && subclass == PCI_BRIDGE_PCI)
12163 + cfg->header_type = PCI_HEADER_BRIDGE;
12164 + else
12165 + cfg->header_type = PCI_HEADER_NORMAL;
12166 + /* Save core interrupt flag */
12167 + cfg->int_pin = R_REG(&sb->sbtpsflag) & SBTPS_NUM0_MASK;
12168 + /* Default to MIPS shared interrupt 0 */
12169 + cfg->int_line = 0;
12170 + /* MIPS sbipsflag maps core interrupt flags to interrupts 1 through 4 */
12171 + if ((regs = sb_setcore(sbh, SB_MIPS, 0)) ||
12172 + (regs = sb_setcore(sbh, SB_MIPS33, 0))) {
12173 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
12174 + val = R_REG(&sb->sbipsflag);
12175 + for (cfg->int_line = 1; cfg->int_line <= 4; cfg->int_line++) {
12176 + if (((val & sbips_int_mask[cfg->int_line]) >> sbips_int_shift[cfg->int_line]) == cfg->int_pin)
12177 + break;
12178 + }
12179 + if (cfg->int_line > 4)
12180 + cfg->int_line = 0;
12181 + }
12182 + /* Emulated core */
12183 + *((uint32 *) &cfg->sprom_control) = 0xffffffff;
12184 + }
12185 +
12186 + sb_setcoreidx(sbh, coreidx);
12187 + return 0;
12188 +}
12189 +
12190 +void
12191 +sbpci_check(void *sbh)
12192 +{
12193 + uint coreidx;
12194 + sbpciregs_t *pci;
12195 + uint32 sbtopci1;
12196 + uint32 buf[64], *ptr, i;
12197 + ulong pa;
12198 + volatile uint j;
12199 +
12200 + coreidx = sb_coreidx(sbh);
12201 + pci = (sbpciregs_t *) sb_setcore(sbh, SB_PCI, 0);
12202 +
12203 + /* Clear the test array */
12204 + pa = (ulong) DMA_MAP(NULL, buf, sizeof(buf), DMA_RX, NULL);
12205 + ptr = (uint32 *) OSL_UNCACHED(&buf[0]);
12206 + memset(ptr, 0, sizeof(buf));
12207 +
12208 + /* Point PCI window 1 to memory */
12209 + sbtopci1 = R_REG(&pci->sbtopci1);
12210 + W_REG(&pci->sbtopci1, SBTOPCI_MEM | (pa & SBTOPCI1_MASK));
12211 +
12212 + /* Fill the test array via PCI window 1 */
12213 + ptr = (uint32 *) REG_MAP(SB_PCI_CFG + (pa & ~SBTOPCI1_MASK), sizeof(buf));
12214 + for (i = 0; i < ARRAYSIZE(buf); i++) {
12215 + for (j = 0; j < 2; j++);
12216 + W_REG(&ptr[i], i);
12217 + }
12218 + REG_UNMAP(ptr);
12219 +
12220 + /* Restore PCI window 1 */
12221 + W_REG(&pci->sbtopci1, sbtopci1);
12222 +
12223 + /* Check the test array */
12224 + DMA_UNMAP(NULL, pa, sizeof(buf), DMA_RX, NULL);
12225 + ptr = (uint32 *) OSL_UNCACHED(&buf[0]);
12226 + for (i = 0; i < ARRAYSIZE(buf); i++) {
12227 + if (ptr[i] != i)
12228 + break;
12229 + }
12230 +
12231 + /* Change the clock if the test fails */
12232 + if (i < ARRAYSIZE(buf)) {
12233 + uint32 req, cur;
12234 +
12235 + cur = sb_clock(sbh);
12236 + printf("PCI: Test failed at %d MHz\n", (cur + 500000) / 1000000);
12237 + for (req = 104000000; req < 176000000; req += 4000000) {
12238 + printf("PCI: Resetting to %d MHz\n", (req + 500000) / 1000000);
12239 + /* This will only reset if the clocks are valid and have changed */
12240 + sb_mips_setclock(sbh, req, 0, 0);
12241 + }
12242 + /* Should not reach here */
12243 + ASSERT(0);
12244 + }
12245 +
12246 + sb_setcoreidx(sbh, coreidx);
12247 +}
12248 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/broadcom/sbutils.c linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/sbutils.c
12249 --- linux-2.6.12.5/arch/mips/bcm47xx/broadcom/sbutils.c 1970-01-01 01:00:00.000000000 +0100
12250 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/broadcom/sbutils.c 2005-08-28 11:12:20.482851248 +0200
12251 @@ -0,0 +1,1895 @@
12252 +/*
12253 + * Misc utility routines for accessing chip-specific features
12254 + * of the SiliconBackplane-based Broadcom chips.
12255 + *
12256 + * Copyright 2001-2003, Broadcom Corporation
12257 + * All Rights Reserved.
12258 + *
12259 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
12260 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
12261 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
12262 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
12263 + *
12264 + * $Id$
12265 + */
12266 +
12267 +#include <typedefs.h>
12268 +#include <osl.h>
12269 +#include <bcmutils.h>
12270 +#include <bcmdevs.h>
12271 +#include <sbconfig.h>
12272 +#include <sbchipc.h>
12273 +#include <sbpci.h>
12274 +#include <pcicfg.h>
12275 +#include <sbpcmcia.h>
12276 +#include <sbextif.h>
12277 +#include <sbutils.h>
12278 +#include <bcmsrom.h>
12279 +
12280 +/* debug/trace */
12281 +#define SB_ERROR(args)
12282 +
12283 +typedef uint32 (*sb_intrsoff_t)(void *intr_arg);
12284 +typedef void (*sb_intrsrestore_t)(void *intr_arg, uint32 arg);
12285 +
12286 +/* misc sb info needed by some of the routines */
12287 +typedef struct sb_info {
12288 + uint chip; /* chip number */
12289 + uint chiprev; /* chip revision */
12290 + uint chippkg; /* chip package option */
12291 + uint boardtype; /* board type */
12292 + uint boardvendor; /* board vendor id */
12293 + uint bus; /* what bus type we are going through */
12294 +
12295 + void *osh; /* osl os handle */
12296 + void *sdh; /* bcmsdh handle */
12297 +
12298 + void *curmap; /* current regs va */
12299 + void *regs[SB_MAXCORES]; /* other regs va */
12300 +
12301 + uint curidx; /* current core index */
12302 + uint dev_coreid; /* the core provides driver functions */
12303 + uint pciidx; /* pci core index */
12304 + uint pcirev; /* pci core rev */
12305 +
12306 + uint pcmciaidx; /* pcmcia core index */
12307 + uint pcmciarev; /* pcmcia core rev */
12308 + bool memseg; /* flag to toggle MEM_SEG register */
12309 +
12310 + uint ccrev; /* chipc core rev */
12311 +
12312 + uint gpioidx; /* gpio control core index */
12313 + uint gpioid; /* gpio control coretype */
12314 +
12315 + uint numcores; /* # discovered cores */
12316 + uint coreid[SB_MAXCORES]; /* id of each core */
12317 +
12318 + void *intr_arg; /* interrupt callback function arg */
12319 + sb_intrsoff_t intrsoff_fn; /* function turns chip interrupts off */
12320 + sb_intrsrestore_t intrsrestore_fn; /* function restore chip interrupts */
12321 +} sb_info_t;
12322 +
12323 +/* local prototypes */
12324 +static void* sb_doattach(sb_info_t *si, uint devid, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz);
12325 +static void sb_scan(sb_info_t *si);
12326 +static uint sb_corereg(void *sbh, uint coreidx, uint regoff, uint mask, uint val);
12327 +static uint _sb_coreidx(void *sbh);
12328 +static uint sb_findcoreidx(void *sbh, uint coreid, uint coreunit);
12329 +static uint sb_pcidev2chip(uint pcidev);
12330 +static uint sb_chip2numcores(uint chip);
12331 +
12332 +#define SB_INFO(sbh) (sb_info_t*)sbh
12333 +#define SET_SBREG(sbh, r, mask, val) W_SBREG((sbh), (r), ((R_SBREG((sbh), (r)) & ~(mask)) | (val)))
12334 +#define GOODCOREADDR(x) (((x) >= SB_ENUM_BASE) && ((x) <= SB_ENUM_LIM) \
12335 + && ISALIGNED((x), SB_CORE_SIZE))
12336 +#define GOODREGS(regs) (regs && ISALIGNED(regs, SB_CORE_SIZE))
12337 +#define REGS2SB(va) (sbconfig_t*) ((uint)(va) + SBCONFIGOFF)
12338 +#define GOODIDX(idx) (((uint)idx) < SB_MAXCORES)
12339 +#define BADIDX (SB_MAXCORES+1)
12340 +
12341 +#define R_SBREG(sbh, sbr) sb_read_sbreg((sbh), (sbr))
12342 +#define W_SBREG(sbh, sbr, v) sb_write_sbreg((sbh), (sbr), (v))
12343 +#define AND_SBREG(sbh, sbr, v) W_SBREG((sbh), (sbr), (R_SBREG((sbh), (sbr)) & (v)))
12344 +#define OR_SBREG(sbh, sbr, v) W_SBREG((sbh), (sbr), (R_SBREG((sbh), (sbr)) | (v)))
12345 +
12346 +/*
12347 + * Macros to disable/restore function core(D11, ENET, ILINE20, etc) interrupts before/
12348 + * after core switching to avoid invalid register accesss inside ISR.
12349 + */
12350 +#define INTR_OFF(si, intr_val) \
12351 + if ((si)->intrsoff_fn && (si)->coreid[(si)->curidx] == (si)->dev_coreid) { \
12352 + intr_val = (*(si)->intrsoff_fn)((si)->intr_arg); }
12353 +#define INTR_RESTORE(si, intr_val) \
12354 + if ((si)->intrsrestore_fn && (si)->coreid[(si)->curidx] == (si)->dev_coreid) { \
12355 + (*(si)->intrsrestore_fn)((si)->intr_arg, intr_val); }
12356 +
12357 +/* power control defines */
12358 +#define PLL_DELAY 150 /* 150us pll on delay */
12359 +#define FREF_DELAY 15 /* 15us fref change delay */
12360 +#define LPOMINFREQ 25000 /* low power oscillator min */
12361 +#define LPOMAXFREQ 43000 /* low power oscillator max */
12362 +#define XTALMINFREQ 19800000 /* 20mhz - 1% */
12363 +#define XTALMAXFREQ 20200000 /* 20mhz + 1% */
12364 +#define PCIMINFREQ 25000000 /* 25mhz */
12365 +#define PCIMAXFREQ 34000000 /* 33mhz + fudge */
12366 +
12367 +#define SCC_LOW2FAST_LIMIT 5000 /* turn on fast clock time, in unit of ms */
12368 +
12369 +
12370 +static uint32
12371 +sb_read_sbreg(void *sbh, volatile uint32 *sbr)
12372 +{
12373 + sb_info_t *si;
12374 + uint8 tmp;
12375 + uint32 val, intr_val = 0;
12376 +
12377 + si = SB_INFO(sbh);
12378 +
12379 + /*
12380 + * compact flash only has 11 bits address, while we needs 12 bits address.
12381 + * MEM_SEG will be OR'd with other 11 bits address in hardware,
12382 + * so we program MEM_SEG with 12th bit when necessary(access sb regsiters).
12383 + * For normal PCMCIA bus(CFTable_regwinsz > 2k), do nothing special
12384 + */
12385 + if(si->memseg) {
12386 + INTR_OFF(si, intr_val);
12387 + tmp = 1;
12388 + OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1);
12389 + (uint32)sbr &= ~(1 << 11); /* mask out bit 11*/
12390 + }
12391 +
12392 + val = R_REG(sbr);
12393 +
12394 + if(si->memseg) {
12395 + tmp = 0;
12396 + OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1);
12397 + INTR_RESTORE(si, intr_val);
12398 + }
12399 +
12400 + return (val);
12401 +}
12402 +
12403 +static void
12404 +sb_write_sbreg(void *sbh, volatile uint32 *sbr, uint32 v)
12405 +{
12406 + sb_info_t *si;
12407 + uint8 tmp;
12408 + volatile uint32 dummy;
12409 + uint32 intr_val = 0;
12410 +
12411 + si = SB_INFO(sbh);
12412 +
12413 + /*
12414 + * compact flash only has 11 bits address, while we needs 12 bits address.
12415 + * MEM_SEG will be OR'd with other 11 bits address in hardware,
12416 + * so we program MEM_SEG with 12th bit when necessary(access sb regsiters).
12417 + * For normal PCMCIA bus(CFTable_regwinsz > 2k), do nothing special
12418 + */
12419 + if(si->memseg) {
12420 + INTR_OFF(si, intr_val);
12421 + tmp = 1;
12422 + OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1);
12423 + (uint32)sbr &= ~(1 << 11); /* mask out bit 11 */
12424 + }
12425 +
12426 + if ((si->bus == PCMCIA_BUS) || (si->bus == PCI_BUS)) {
12427 +#ifdef IL_BIGENDIAN
12428 + dummy = R_REG(sbr);
12429 + W_REG((volatile uint16 *)((uint32)sbr + 2), (uint16)((v >> 16) & 0xffff));
12430 + dummy = R_REG(sbr);
12431 + W_REG((volatile uint16 *)sbr, (uint16)(v & 0xffff));
12432 +#else
12433 + dummy = R_REG(sbr);
12434 + W_REG((volatile uint16 *)sbr, (uint16)(v & 0xffff));
12435 + dummy = R_REG(sbr);
12436 + W_REG((volatile uint16 *)((uint32)sbr + 2), (uint16)((v >> 16) & 0xffff));
12437 +#endif
12438 + } else
12439 + W_REG(sbr, v);
12440 +
12441 + if(si->memseg) {
12442 + tmp = 0;
12443 + OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1);
12444 + INTR_RESTORE(si, intr_val);
12445 + }
12446 +}
12447 +
12448 +/*
12449 + * Allocate a sb handle.
12450 + * devid - pci device id (used to determine chip#)
12451 + * osh - opaque OS handle
12452 + * regs - virtual address of initial core registers
12453 + * bustype - pci/pcmcia/sb/sdio/etc
12454 + * vars - pointer to a pointer area for "environment" variables
12455 + * varsz - pointer to int to return the size of the vars
12456 + */
12457 +void*
12458 +sb_attach(uint devid, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz)
12459 +{
12460 + sb_info_t *si;
12461 +
12462 + /* alloc sb_info_t */
12463 + if ((si = MALLOC(sizeof (sb_info_t))) == NULL) {
12464 + SB_ERROR(("sb_attach: malloc failed!\n"));
12465 + return (NULL);
12466 + }
12467 +
12468 + return (sb_doattach(si, devid, osh, regs, bustype, sdh, vars, varsz));
12469 +}
12470 +
12471 +/* global kernel resource */
12472 +static sb_info_t ksi;
12473 +
12474 +/* generic kernel variant of sb_attach() */
12475 +void*
12476 +sb_kattach()
12477 +{
12478 + uint32 *regs;
12479 + char *unused;
12480 + int varsz;
12481 +
12482 + if (ksi.curmap == NULL) {
12483 + uint32 cid;
12484 + regs = (uint32 *)REG_MAP(SB_ENUM_BASE, SB_CORE_SIZE);
12485 + cid = R_REG((uint32 *)regs);
12486 + if ((cid == 0x08104712) || (cid == 0x08114712)) {
12487 + uint32 *scc, val;
12488 +
12489 + scc = (uint32 *)((uint32)regs + OFFSETOF(chipcregs_t, slow_clk_ctl));
12490 + val = R_REG(scc);
12491 + SB_ERROR((" initial scc = 0x%x\n", val));
12492 + val |= SCC_SS_XTAL;
12493 + W_REG(scc, val);
12494 + }
12495 +
12496 + sb_doattach(&ksi, BCM4710_DEVICE_ID, NULL, (void*)regs,
12497 + SB_BUS, NULL, &unused, &varsz);
12498 + }
12499 +
12500 + return &ksi;
12501 +}
12502 +
12503 +static void*
12504 +sb_doattach(sb_info_t *si, uint devid, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz)
12505 +{
12506 + uint origidx;
12507 + chipcregs_t *cc;
12508 + uint32 w;
12509 +
12510 + ASSERT(GOODREGS(regs));
12511 +
12512 + bzero((uchar*)si, sizeof (sb_info_t));
12513 +
12514 + si->pciidx = si->gpioidx = BADIDX;
12515 +
12516 + si->osh = osh;
12517 + si->curmap = regs;
12518 + si->sdh = sdh;
12519 +
12520 + /* 4317A0 PCMCIA is no longer supported */
12521 + if ((bustype == PCMCIA_BUS) && (R_REG((uint32 *)regs) == 0x04104317))
12522 + return NULL;
12523 +
12524 + /* check to see if we are a sb core mimic'ing a pci core */
12525 + if (bustype == PCI_BUS) {
12526 + if (OSL_PCI_READ_CONFIG(osh, PCI_SPROM_CONTROL, sizeof (uint32)) == 0xffffffff)
12527 + bustype = SB_BUS;
12528 + else
12529 + bustype = PCI_BUS;
12530 + }
12531 +
12532 + si->bus = bustype;
12533 +
12534 + /* kludge to enable the clock on the 4306 which lacks a slowclock */
12535 + if (si->bus == PCI_BUS)
12536 + sb_pwrctl_xtal((void*)si, XTAL|PLL, ON);
12537 +
12538 + /* clear any previous epidiag-induced target abort */
12539 + sb_taclear((void*)si);
12540 +
12541 + /* initialize current core index value */
12542 + si->curidx = _sb_coreidx((void*)si);
12543 +
12544 + /* keep and reuse the initial register mapping */
12545 + origidx = si->curidx;
12546 + if (si->bus == SB_BUS)
12547 + si->regs[origidx] = regs;
12548 +
12549 + /* initialize the vars */
12550 + if (srom_var_init(si->bus, si->curmap, osh, vars, varsz)) {
12551 + SB_ERROR(("sb_attach: srom_var_init failed\n"));
12552 + goto bad;
12553 + }
12554 +
12555 + if (si->bus == PCMCIA_BUS) {
12556 + w = getintvar(*vars, "regwindowsz");
12557 + si->memseg = (w <= CFTABLE_REGWIN_2K) ? TRUE : FALSE;
12558 + }
12559 +
12560 + /* is core-0 a chipcommon core? */
12561 + si->numcores = 1;
12562 + cc = (chipcregs_t*) sb_setcoreidx((void*)si, 0);
12563 + if (sb_coreid((void*)si) != SB_CC)
12564 + cc = NULL;
12565 +
12566 + /* determine chip id and rev */
12567 + if (cc) {
12568 + /* chip common core found! */
12569 + si->chip = R_REG(&cc->chipid) & CID_ID_MASK;
12570 + si->chiprev = (R_REG(&cc->chipid) & CID_REV_MASK) >> CID_REV_SHIFT;
12571 + si->chippkg = (R_REG(&cc->chipid) & CID_PKG_MASK) >> CID_PKG_SHIFT;
12572 + } else {
12573 + /* without chip common core, get devid for PCMCIA */
12574 + if (si->bus == PCMCIA_BUS)
12575 + devid = getintvar(*vars, "devid");
12576 +
12577 + /* no chip common core -- must convert device id to chip id */
12578 + if ((si->chip = sb_pcidev2chip(devid)) == 0) {
12579 + SB_ERROR(("sb_attach: unrecognized device id 0x%04x\n", devid));
12580 + goto bad;
12581 + }
12582 +
12583 + /*
12584 + * The chip revision number is hardwired into all
12585 + * of the pci function config rev fields and is
12586 + * independent from the individual core revision numbers.
12587 + * For example, the "A0" silicon of each chip is chip rev 0.
12588 + * For PCMCIA we get it from the CIS instead.
12589 + */
12590 + if (si->bus == PCMCIA_BUS) {
12591 + ASSERT(vars);
12592 + si->chiprev = getintvar(*vars, "chiprev");
12593 + } else if (si->bus == PCI_BUS) {
12594 + w = OSL_PCI_READ_CONFIG(osh, PCI_CFG_REV, sizeof (uint32));
12595 + si->chiprev = w & 0xff;
12596 + } else
12597 + si->chiprev = 0;
12598 + }
12599 +
12600 + /* get chipcommon rev */
12601 + si->ccrev = cc? sb_corerev((void*)si) : 0;
12602 +
12603 + /* determine numcores */
12604 + if ((si->ccrev == 4) || (si->ccrev >= 6))
12605 + si->numcores = (R_REG(&cc->chipid) & CID_CC_MASK) >> CID_CC_SHIFT;
12606 + else
12607 + si->numcores = sb_chip2numcores(si->chip);
12608 +
12609 + /* return to original core */
12610 + sb_setcoreidx((void*)si, origidx);
12611 +
12612 + /* sanity checks */
12613 + ASSERT(si->chip);
12614 + /* 4704A1 is chiprev 8 :-( */
12615 + ASSERT((si->chiprev < 8) ||
12616 + ((si->chip == BCM4704_DEVICE_ID) && ((si->chiprev == 8))));
12617 +
12618 + /* scan for cores */
12619 + sb_scan(si);
12620 +
12621 + /* pci core is required */
12622 + if (!GOODIDX(si->pciidx)) {
12623 + SB_ERROR(("sb_attach: pci core not found\n"));
12624 + goto bad;
12625 + }
12626 +
12627 + /* gpio control core is required */
12628 + if (!GOODIDX(si->gpioidx)) {
12629 + SB_ERROR(("sb_attach: gpio control core not found\n"));
12630 + goto bad;
12631 + }
12632 +
12633 + /* get boardtype and boardrev */
12634 + switch (si->bus) {
12635 + case PCI_BUS:
12636 + /* do a pci config read to get subsystem id and subvendor id */
12637 + w = OSL_PCI_READ_CONFIG(osh, PCI_CFG_SVID, sizeof (uint32));
12638 + si->boardvendor = w & 0xffff;
12639 + si->boardtype = (w >> 16) & 0xffff;
12640 + break;
12641 +
12642 + case PCMCIA_BUS:
12643 + case SDIO_BUS:
12644 + si->boardvendor = getintvar(*vars, "manfid");
12645 + si->boardtype = getintvar(*vars, "prodid");
12646 + break;
12647 +
12648 + case SB_BUS:
12649 + si->boardvendor = VENDOR_BROADCOM;
12650 + si->boardtype = 0xffff;
12651 + break;
12652 + }
12653 +
12654 + if (si->boardtype == 0) {
12655 + SB_ERROR(("sb_attach: unknown board type\n"));
12656 + ASSERT(si->boardtype);
12657 + }
12658 +
12659 + return ((void*)si);
12660 +
12661 +bad:
12662 + MFREE(si, sizeof (sb_info_t));
12663 + return (NULL);
12664 +}
12665 +
12666 +uint
12667 +sb_coreid(void *sbh)
12668 +{
12669 + sb_info_t *si;
12670 + sbconfig_t *sb;
12671 +
12672 + si = SB_INFO(sbh);
12673 + sb = REGS2SB(si->curmap);
12674 +
12675 + return ((R_SBREG(sbh, &(sb)->sbidhigh) & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT);
12676 +}
12677 +
12678 +uint
12679 +sb_coreidx(void *sbh)
12680 +{
12681 + sb_info_t *si;
12682 +
12683 + si = SB_INFO(sbh);
12684 + return (si->curidx);
12685 +}
12686 +
12687 +/* return current index of core */
12688 +static uint
12689 +_sb_coreidx(void *sbh)
12690 +{
12691 + sb_info_t *si;
12692 + sbconfig_t *sb;
12693 + uint32 sbaddr = 0;
12694 +
12695 + si = SB_INFO(sbh);
12696 + ASSERT(si);
12697 +
12698 + switch (si->bus) {
12699 + case SB_BUS:
12700 + sb = REGS2SB(si->curmap);
12701 + sbaddr = sb_base(R_SBREG(sbh, &sb->sbadmatch0));
12702 + break;
12703 +
12704 + case PCI_BUS:
12705 + sbaddr = OSL_PCI_READ_CONFIG(si->osh, PCI_BAR0_WIN, sizeof (uint32));
12706 + break;
12707 +
12708 + case PCMCIA_BUS: {
12709 + uint8 tmp;
12710 +
12711 + OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_ADDR0, &tmp, 1);
12712 + sbaddr = (uint)tmp << 12;
12713 + OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_ADDR1, &tmp, 1);
12714 + sbaddr |= (uint)tmp << 16;
12715 + OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_ADDR2, &tmp, 1);
12716 + sbaddr |= (uint)tmp << 24;
12717 + break;
12718 + }
12719 + default:
12720 + ASSERT(0);
12721 + }
12722 +
12723 + ASSERT(GOODCOREADDR(sbaddr));
12724 + return ((sbaddr - SB_ENUM_BASE)/SB_CORE_SIZE);
12725 +}
12726 +
12727 +uint
12728 +sb_corevendor(void *sbh)
12729 +{
12730 + sb_info_t *si;
12731 + sbconfig_t *sb;
12732 +
12733 + si = SB_INFO(sbh);
12734 + sb = REGS2SB(si->curmap);
12735 +
12736 + return ((R_SBREG(sbh, &(sb)->sbidhigh) & SBIDH_VC_MASK) >> SBIDH_VC_SHIFT);
12737 +}
12738 +
12739 +uint
12740 +sb_corerev(void *sbh)
12741 +{
12742 + sb_info_t *si;
12743 + sbconfig_t *sb;
12744 +
12745 + si = SB_INFO(sbh);
12746 + sb = REGS2SB(si->curmap);
12747 +
12748 + return (R_SBREG(sbh, &(sb)->sbidhigh) & SBIDH_RC_MASK);
12749 +}
12750 +
12751 +#define SBTML_ALLOW (SBTML_PE | SBTML_FGC | SBTML_FL_MASK)
12752 +
12753 +/* set/clear sbtmstatelow core-specific flags */
12754 +uint32
12755 +sb_coreflags(void *sbh, uint32 mask, uint32 val)
12756 +{
12757 + sb_info_t *si;
12758 + sbconfig_t *sb;
12759 + uint32 w;
12760 +
12761 + si = SB_INFO(sbh);
12762 + sb = REGS2SB(si->curmap);
12763 +
12764 + ASSERT((val & ~mask) == 0);
12765 + ASSERT((mask & ~SBTML_ALLOW) == 0);
12766 +
12767 + /* mask and set */
12768 + if (mask || val) {
12769 + w = (R_SBREG(sbh, &sb->sbtmstatelow) & ~mask) | val;
12770 + W_SBREG(sbh, &sb->sbtmstatelow, w);
12771 + }
12772 +
12773 + /* return the new value */
12774 + return (R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_ALLOW);
12775 +}
12776 +
12777 +/* set/clear sbtmstatehigh core-specific flags */
12778 +uint32
12779 +sb_coreflagshi(void *sbh, uint32 mask, uint32 val)
12780 +{
12781 + sb_info_t *si;
12782 + sbconfig_t *sb;
12783 + uint32 w;
12784 +
12785 + si = SB_INFO(sbh);
12786 + sb = REGS2SB(si->curmap);
12787 +
12788 + ASSERT((val & ~mask) == 0);
12789 + ASSERT((mask & ~SBTMH_FL_MASK) == 0);
12790 +
12791 + /* mask and set */
12792 + if (mask || val) {
12793 + w = (R_SBREG(sbh, &sb->sbtmstatehigh) & ~mask) | val;
12794 + W_SBREG(sbh, &sb->sbtmstatehigh, w);
12795 + }
12796 +
12797 + /* return the new value */
12798 + return (R_SBREG(sbh, &sb->sbtmstatehigh) & SBTMH_FL_MASK);
12799 +}
12800 +
12801 +bool
12802 +sb_iscoreup(void *sbh)
12803 +{
12804 + sb_info_t *si;
12805 + sbconfig_t *sb;
12806 +
12807 + si = SB_INFO(sbh);
12808 + sb = REGS2SB(si->curmap);
12809 +
12810 + return ((R_SBREG(sbh, &(sb)->sbtmstatelow) & (SBTML_RESET | SBTML_REJ | SBTML_CLK)) == SBTML_CLK);
12811 +}
12812 +
12813 +/*
12814 + * Switch to 'coreidx', issue a single arbitrary 32bit register mask&set operation,
12815 + * switch back to the original core, and return the new value.
12816 + */
12817 +static uint
12818 +sb_corereg(void *sbh, uint coreidx, uint regoff, uint mask, uint val)
12819 +{
12820 + sb_info_t *si;
12821 + uint origidx;
12822 + uint32 *r;
12823 + uint w;
12824 + uint intr_val = 0;
12825 +
12826 + ASSERT(GOODIDX(coreidx));
12827 + ASSERT(regoff < SB_CORE_SIZE);
12828 + ASSERT((val & ~mask) == 0);
12829 +
12830 + si = SB_INFO(sbh);
12831 +
12832 + /* save current core index */
12833 + origidx = sb_coreidx(sbh);
12834 +
12835 + /* switch core */
12836 + INTR_OFF(si, intr_val);
12837 + r = (uint32*) ((uint) sb_setcoreidx(sbh, coreidx) + regoff);
12838 +
12839 + /* mask and set */
12840 + if (mask || val) {
12841 + if (regoff >= SBCONFIGOFF) {
12842 + w = (R_SBREG(sbh, r) & ~mask) | val;
12843 + W_SBREG(sbh, r, w);
12844 + } else {
12845 + w = (R_REG(r) & ~mask) | val;
12846 + W_REG(r, w);
12847 + }
12848 + }
12849 +
12850 + /* readback */
12851 + w = R_SBREG(sbh, r);
12852 +
12853 + /* restore core index */
12854 + if (origidx != coreidx)
12855 + sb_setcoreidx(sbh, origidx);
12856 +
12857 + INTR_RESTORE(si, intr_val);
12858 + return (w);
12859 +}
12860 +
12861 +/* scan the sb enumerated space to identify all cores */
12862 +static void
12863 +sb_scan(sb_info_t *si)
12864 +{
12865 + void *sbh;
12866 + uint origidx;
12867 + uint i;
12868 +
12869 + sbh = (void*) si;
12870 +
12871 + /* numcores should already be set */
12872 + ASSERT((si->numcores > 0) && (si->numcores <= SB_MAXCORES));
12873 +
12874 + /* save current core index */
12875 + origidx = sb_coreidx(sbh);
12876 +
12877 + si->pciidx = si->gpioidx = BADIDX;
12878 +
12879 + for (i = 0; i < si->numcores; i++) {
12880 + sb_setcoreidx(sbh, i);
12881 + si->coreid[i] = sb_coreid(sbh);
12882 +
12883 + if (si->coreid[i] == SB_CC)
12884 + si->ccrev = sb_corerev(sbh);
12885 +
12886 + else if (si->coreid[i] == SB_PCI) {
12887 + si->pciidx = i;
12888 + si->pcirev = sb_corerev(sbh);
12889 +
12890 + }else if (si->coreid[i] == SB_PCMCIA){
12891 + si->pcmciaidx = i;
12892 + si->pcmciarev = sb_corerev(sbh);
12893 + }
12894 + }
12895 +
12896 + /*
12897 + * Find the gpio "controlling core" type and index.
12898 + * Precedence:
12899 + * - if there's a chip common core - use that
12900 + * - else if there's a pci core (rev >= 2) - use that
12901 + * - else there had better be an extif core (4710 only)
12902 + */
12903 + if (GOODIDX(sb_findcoreidx(sbh, SB_CC, 0))) {
12904 + si->gpioidx = sb_findcoreidx(sbh, SB_CC, 0);
12905 + si->gpioid = SB_CC;
12906 + } else if (GOODIDX(si->pciidx) && (si->pcirev >= 2)) {
12907 + si->gpioidx = si->pciidx;
12908 + si->gpioid = SB_PCI;
12909 + } else if (sb_findcoreidx(sbh, SB_EXTIF, 0)) {
12910 + si->gpioidx = sb_findcoreidx(sbh, SB_EXTIF, 0);
12911 + si->gpioid = SB_EXTIF;
12912 + }
12913 +
12914 + /* return to original core index */
12915 + sb_setcoreidx(sbh, origidx);
12916 +}
12917 +
12918 +/* may be called with core in reset */
12919 +void
12920 +sb_detach(void *sbh)
12921 +{
12922 + sb_info_t *si;
12923 + uint idx;
12924 +
12925 + si = SB_INFO(sbh);
12926 +
12927 + if (si == NULL)
12928 + return;
12929 +
12930 + if (si->bus == SB_BUS)
12931 + for (idx = 0; idx < SB_MAXCORES; idx++)
12932 + if (si->regs[idx]) {
12933 + REG_UNMAP(si->regs[idx]);
12934 + si->regs[idx] = NULL;
12935 + }
12936 +
12937 + MFREE(si, sizeof (sb_info_t));
12938 +}
12939 +
12940 +/* use pci dev id to determine chip id for chips not having a chipcommon core */
12941 +static uint
12942 +sb_pcidev2chip(uint pcidev)
12943 +{
12944 + if ((pcidev >= BCM4710_DEVICE_ID) && (pcidev <= BCM47XX_USB_ID))
12945 + return (BCM4710_DEVICE_ID);
12946 + if ((pcidev >= BCM4610_DEVICE_ID) && (pcidev <= BCM4610_USB_ID))
12947 + return (BCM4610_DEVICE_ID);
12948 + if ((pcidev >= BCM4402_DEVICE_ID) && (pcidev <= BCM4402_V90_ID))
12949 + return (BCM4402_DEVICE_ID);
12950 + if ((pcidev >= BCM4307_V90_ID) && (pcidev <= BCM4307_D11B_ID))
12951 + return (BCM4307_DEVICE_ID);
12952 + if (pcidev == BCM4301_DEVICE_ID)
12953 + return (BCM4301_DEVICE_ID);
12954 +
12955 + return (0);
12956 +}
12957 +
12958 +/* convert chip number to number of i/o cores */
12959 +static uint
12960 +sb_chip2numcores(uint chip)
12961 +{
12962 + if (chip == 0x4710)
12963 + return (9);
12964 + if (chip == 0x4610)
12965 + return (9);
12966 + if (chip == 0x4402)
12967 + return (3);
12968 + if ((chip == 0x4307) || (chip == 0x4301))
12969 + return (5);
12970 + if (chip == 0x4310)
12971 + return (8);
12972 + if (chip == 0x4306) /* < 4306c0 */
12973 + return (6);
12974 + if (chip == 0x4704)
12975 + return (9);
12976 + if (chip == 0x5365)
12977 + return (7);
12978 +
12979 + SB_ERROR(("sb_chip2numcores: unsupported chip 0x%x\n", chip));
12980 + ASSERT(0);
12981 + return (1);
12982 +}
12983 +
12984 +/* return index of coreid or BADIDX if not found */
12985 +static uint
12986 +sb_findcoreidx(void *sbh, uint coreid, uint coreunit)
12987 +{
12988 + sb_info_t *si;
12989 + uint found;
12990 + uint i;
12991 +
12992 + si = SB_INFO(sbh);
12993 + found = 0;
12994 +
12995 + for (i = 0; i < si->numcores; i++)
12996 + if (si->coreid[i] == coreid) {
12997 + if (found == coreunit)
12998 + return (i);
12999 + found++;
13000 + }
13001 +
13002 + return (BADIDX);
13003 +}
13004 +
13005 +/* change logical "focus" to the indiciated core */
13006 +void*
13007 +sb_setcoreidx(void *sbh, uint coreidx)
13008 +{
13009 + sb_info_t *si;
13010 + uint32 sbaddr;
13011 + uint8 tmp;
13012 +
13013 + si = SB_INFO(sbh);
13014 +
13015 + if (coreidx >= si->numcores)
13016 + return (NULL);
13017 +
13018 + /*
13019 + * If the user has provided an interrupt mask enabled function,
13020 + * then assert interrupts are disabled before switching the core.
13021 + */
13022 + ASSERT((si->imf == NULL) || !(*si->imf)(si->imfarg));
13023 +
13024 + sbaddr = SB_ENUM_BASE + (coreidx * SB_CORE_SIZE);
13025 +
13026 + switch (si->bus) {
13027 + case SB_BUS:
13028 + /* map new one */
13029 + if (!si->regs[coreidx]) {
13030 + si->regs[coreidx] = (void*)REG_MAP(sbaddr, SB_CORE_SIZE);
13031 + ASSERT(GOODREGS(si->regs[coreidx]));
13032 + }
13033 + si->curmap = si->regs[coreidx];
13034 + break;
13035 +
13036 + case PCI_BUS:
13037 + /* point bar0 window */
13038 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_BAR0_WIN, 4, sbaddr);
13039 + break;
13040 +
13041 + case PCMCIA_BUS:
13042 + tmp = (sbaddr >> 12) & 0x0f;
13043 + OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_ADDR0, &tmp, 1);
13044 + tmp = (sbaddr >> 16) & 0xff;
13045 + OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_ADDR1, &tmp, 1);
13046 + tmp = (sbaddr >> 24) & 0xff;
13047 + OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_ADDR2, &tmp, 1);
13048 + break;
13049 + }
13050 +
13051 + si->curidx = coreidx;
13052 +
13053 + return (si->curmap);
13054 +}
13055 +
13056 +/* change logical "focus" to the indicated core */
13057 +void*
13058 +sb_setcore(void *sbh, uint coreid, uint coreunit)
13059 +{
13060 + sb_info_t *si;
13061 + uint idx;
13062 +
13063 + si = SB_INFO(sbh);
13064 +
13065 + idx = sb_findcoreidx(sbh, coreid, coreunit);
13066 + if (!GOODIDX(idx))
13067 + return (NULL);
13068 +
13069 + return (sb_setcoreidx(sbh, idx));
13070 +}
13071 +
13072 +/* return chip number */
13073 +uint
13074 +sb_chip(void *sbh)
13075 +{
13076 + sb_info_t *si;
13077 +
13078 + si = SB_INFO(sbh);
13079 + return (si->chip);
13080 +}
13081 +
13082 +/* return chip revision number */
13083 +uint
13084 +sb_chiprev(void *sbh)
13085 +{
13086 + sb_info_t *si;
13087 +
13088 + si = SB_INFO(sbh);
13089 + return (si->chiprev);
13090 +}
13091 +
13092 +/* return chip package option */
13093 +uint
13094 +sb_chippkg(void *sbh)
13095 +{
13096 + sb_info_t *si;
13097 +
13098 + si = SB_INFO(sbh);
13099 + return (si->chippkg);
13100 +}
13101 +
13102 +/* return board vendor id */
13103 +uint
13104 +sb_boardvendor(void *sbh)
13105 +{
13106 + sb_info_t *si;
13107 +
13108 + si = SB_INFO(sbh);
13109 + return (si->boardvendor);
13110 +}
13111 +
13112 +/* return boardtype */
13113 +uint
13114 +sb_boardtype(void *sbh)
13115 +{
13116 + sb_info_t *si;
13117 + char *var;
13118 +
13119 + si = SB_INFO(sbh);
13120 +
13121 + if (si->bus == SB_BUS && si->boardtype == 0xffff) {
13122 + /* boardtype format is a hex string */
13123 + si->boardtype = getintvar(NULL, "boardtype");
13124 +
13125 + /* backward compatibility for older boardtype string format */
13126 + if ((si->boardtype == 0) && (var = getvar(NULL, "boardtype"))) {
13127 + if (!strcmp(var, "bcm94710dev"))
13128 + si->boardtype = BCM94710D_BOARD;
13129 + else if (!strcmp(var, "bcm94710ap"))
13130 + si->boardtype = BCM94710AP_BOARD;
13131 + else if (!strcmp(var, "bcm94310u"))
13132 + si->boardtype = BCM94310U_BOARD;
13133 + else if (!strcmp(var, "bu4711"))
13134 + si->boardtype = BU4711_BOARD;
13135 + else if (!strcmp(var, "bu4710"))
13136 + si->boardtype = BU4710_BOARD;
13137 + else if (!strcmp(var, "bcm94702mn"))
13138 + si->boardtype = BCM94702MN_BOARD;
13139 + else if (!strcmp(var, "bcm94710r1"))
13140 + si->boardtype = BCM94710R1_BOARD;
13141 + else if (!strcmp(var, "bcm94710r4"))
13142 + si->boardtype = BCM94710R4_BOARD;
13143 + else if (!strcmp(var, "bcm94702cpci"))
13144 + si->boardtype = BCM94702CPCI_BOARD;
13145 + else if (!strcmp(var, "bcm95380_rr"))
13146 + si->boardtype = BCM95380RR_BOARD;
13147 + }
13148 + }
13149 +
13150 + return (si->boardtype);
13151 +}
13152 +
13153 +/* return board bus style */
13154 +uint
13155 +sb_boardstyle(void *sbh)
13156 +{
13157 + sb_info_t *si;
13158 + uint16 w;
13159 +
13160 + si = SB_INFO(sbh);
13161 +
13162 + if (si->bus == PCMCIA_BUS)
13163 + return (BOARDSTYLE_PCMCIA);
13164 +
13165 + if (si->bus == SB_BUS)
13166 + return (BOARDSTYLE_SOC);
13167 +
13168 + /* bus is PCI */
13169 +
13170 + if (OSL_PCI_READ_CONFIG(si->osh, PCI_CFG_CIS, sizeof (uint32)) != 0)
13171 + return (BOARDSTYLE_CARDBUS);
13172 +
13173 + if ((srom_read(si->bus, si->curmap, si->osh, (SPROM_SIZE - 1) * 2, 2, &w) == 0) &&
13174 + (w == 0x0313))
13175 + return (BOARDSTYLE_CARDBUS);
13176 +
13177 + return (BOARDSTYLE_PCI);
13178 +}
13179 +
13180 +/* return boolean if sbh device is in pci hostmode or client mode */
13181 +uint
13182 +sb_bus(void *sbh)
13183 +{
13184 + sb_info_t *si;
13185 +
13186 + si = SB_INFO(sbh);
13187 + return (si->bus);
13188 +}
13189 +
13190 +/* return list of found cores */
13191 +uint
13192 +sb_corelist(void *sbh, uint coreid[])
13193 +{
13194 + sb_info_t *si;
13195 +
13196 + si = SB_INFO(sbh);
13197 +
13198 + bcopy((uchar*)si->coreid, (uchar*)coreid, (si->numcores * sizeof (uint)));
13199 + return (si->numcores);
13200 +}
13201 +
13202 +/* return current register mapping */
13203 +void *
13204 +sb_coreregs(void *sbh)
13205 +{
13206 + sb_info_t *si;
13207 +
13208 + si = SB_INFO(sbh);
13209 + ASSERT(GOODREGS(si->curmap));
13210 +
13211 + return (si->curmap);
13212 +}
13213 +
13214 +/* Check if a target abort has happened and clear it */
13215 +bool
13216 +sb_taclear(void *sbh)
13217 +{
13218 + sb_info_t *si;
13219 + bool rc = FALSE;
13220 + sbconfig_t *sb;
13221 +
13222 + si = SB_INFO(sbh);
13223 + sb = REGS2SB(si->curmap);
13224 +
13225 + if (si->bus == PCI_BUS) {
13226 + uint32 stcmd;
13227 +
13228 + stcmd = OSL_PCI_READ_CONFIG(si->osh, PCI_CFG_CMD, sizeof(stcmd));
13229 + rc = (stcmd & 0x08000000) != 0;
13230 +
13231 + if (rc) {
13232 + /* Target abort bit is set, clear it */
13233 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_CFG_CMD, sizeof(stcmd), stcmd);
13234 + }
13235 + } else if (si->bus == PCMCIA_BUS) {
13236 + rc = FALSE;
13237 + }
13238 + else if (si->bus == SDIO_BUS) {
13239 + /* due to 4317 A0 HW bug, sdio core wedged on target abort,
13240 + just clear SBSErr bit blindly */
13241 + if (0x0 != R_SBREG(sbh, &sb->sbtmerrlog)) {
13242 + SB_ERROR(("SDIO target abort, clean it"));
13243 + W_SBREG(sbh, &sb->sbtmstatehigh, 0);
13244 + }
13245 + rc = FALSE;
13246 + }
13247 +
13248 + return (rc);
13249 +}
13250 +
13251 +/* do buffered registers update */
13252 +void
13253 +sb_commit(void *sbh)
13254 +{
13255 + sb_info_t *si;
13256 + sbpciregs_t *pciregs;
13257 + uint origidx;
13258 + uint intr_val = 0;
13259 +
13260 + si = SB_INFO(sbh);
13261 +
13262 + origidx = si->curidx;
13263 + ASSERT(GOODIDX(origidx));
13264 +
13265 + INTR_OFF(si, intr_val);
13266 + /* switch over to pci core */
13267 + pciregs = (sbpciregs_t*) sb_setcore(sbh, SB_PCI, 0);
13268 +
13269 + /* do the buffer registers update */
13270 + W_REG(&pciregs->bcastaddr, SB_COMMIT);
13271 + W_REG(&pciregs->bcastdata, 0x0);
13272 +
13273 + /* restore core index */
13274 + sb_setcoreidx(sbh, origidx);
13275 + INTR_RESTORE(si, intr_val);
13276 +}
13277 +
13278 +/* reset and re-enable a core */
13279 +void
13280 +sb_core_reset(void *sbh, uint32 bits)
13281 +{
13282 + sb_info_t *si;
13283 + sbconfig_t *sb;
13284 + volatile uint32 dummy;
13285 +
13286 + si = SB_INFO(sbh);
13287 + ASSERT(GOODREGS(si->curmap));
13288 + sb = REGS2SB(si->curmap);
13289 +
13290 + /*
13291 + * Must do the disable sequence first to work for arbitrary current core state.
13292 + */
13293 + sb_core_disable(sbh, bits);
13294 +
13295 + /*
13296 + * Now do the initialization sequence.
13297 + */
13298 +
13299 + /* set reset while enabling the clock and forcing them on throughout the core */
13300 + W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_FGC | SBTML_CLK | SBTML_RESET | bits));
13301 + dummy = R_SBREG(sbh, &sb->sbtmstatelow);
13302 +
13303 + if (sb_coreid(sbh) == SB_ILINE100) {
13304 + bcm_mdelay(50);
13305 + } else {
13306 + OSL_DELAY(1);
13307 + }
13308 +
13309 + if (R_SBREG(sbh, &sb->sbtmstatehigh) & SBTMH_SERR) {
13310 + W_SBREG(sbh, &sb->sbtmstatehigh, 0);
13311 + }
13312 + if ((dummy = R_SBREG(sbh, &sb->sbimstate)) & (SBIM_IBE | SBIM_TO)) {
13313 + AND_SBREG(sbh, &sb->sbimstate, ~(SBIM_IBE | SBIM_TO));
13314 + }
13315 +
13316 + /* clear reset and allow it to propagate throughout the core */
13317 + W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_FGC | SBTML_CLK | bits));
13318 + dummy = R_SBREG(sbh, &sb->sbtmstatelow);
13319 + OSL_DELAY(1);
13320 +
13321 + /* leave clock enabled */
13322 + W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_CLK | bits));
13323 + dummy = R_SBREG(sbh, &sb->sbtmstatelow);
13324 + OSL_DELAY(1);
13325 +}
13326 +
13327 +void
13328 +sb_core_tofixup(void *sbh)
13329 +{
13330 + sb_info_t *si;
13331 + sbconfig_t *sb;
13332 +
13333 + si = SB_INFO(sbh);
13334 +
13335 + if (si->pcirev >= 5)
13336 + return;
13337 +
13338 + ASSERT(GOODREGS(si->curmap));
13339 + sb = REGS2SB(si->curmap);
13340 +
13341 + if (si->bus == SB_BUS) {
13342 + SET_SBREG(sbh, &sb->sbimconfiglow,
13343 + SBIMCL_RTO_MASK | SBIMCL_STO_MASK,
13344 + (0x5 << SBIMCL_RTO_SHIFT) | 0x3);
13345 + } else {
13346 + if (sb_coreid(sbh) == SB_PCI) {
13347 + SET_SBREG(sbh, &sb->sbimconfiglow,
13348 + SBIMCL_RTO_MASK | SBIMCL_STO_MASK,
13349 + (0x3 << SBIMCL_RTO_SHIFT) | 0x2);
13350 + } else {
13351 + SET_SBREG(sbh, &sb->sbimconfiglow, (SBIMCL_RTO_MASK | SBIMCL_STO_MASK), 0);
13352 + }
13353 + }
13354 +
13355 + sb_commit(sbh);
13356 +}
13357 +
13358 +void
13359 +sb_core_disable(void *sbh, uint32 bits)
13360 +{
13361 + sb_info_t *si;
13362 + volatile uint32 dummy;
13363 + sbconfig_t *sb;
13364 +
13365 + si = SB_INFO(sbh);
13366 +
13367 + ASSERT(GOODREGS(si->curmap));
13368 + sb = REGS2SB(si->curmap);
13369 +
13370 + /* must return if core is already in reset */
13371 + if (R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_RESET)
13372 + return;
13373 +
13374 + /* put into reset and return if clocks are not enabled */
13375 + if ((R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_CLK) == 0)
13376 + goto disable;
13377 +
13378 + /* set the reject bit */
13379 + W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_CLK | SBTML_REJ));
13380 +
13381 + /* spin until reject is set */
13382 + while ((R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_REJ) == 0)
13383 + OSL_DELAY(1);
13384 +
13385 + /* spin until sbtmstatehigh.busy is clear */
13386 + while (R_SBREG(sbh, &sb->sbtmstatehigh) & SBTMH_BUSY)
13387 + OSL_DELAY(1);
13388 +
13389 + /* set reset and reject while enabling the clocks */
13390 + W_SBREG(sbh, &sb->sbtmstatelow, (bits | SBTML_FGC | SBTML_CLK | SBTML_REJ | SBTML_RESET));
13391 + dummy = R_SBREG(sbh, &sb->sbtmstatelow);
13392 + OSL_DELAY(10);
13393 +
13394 + disable:
13395 + /* leave reset and reject asserted */
13396 + W_SBREG(sbh, &sb->sbtmstatelow, (bits | SBTML_REJ | SBTML_RESET));
13397 + OSL_DELAY(1);
13398 +}
13399 +
13400 +void
13401 +sb_watchdog(void *sbh, uint ticks)
13402 +{
13403 + sb_info_t *si = SB_INFO(sbh);
13404 +
13405 + /* instant NMI */
13406 + switch (si->gpioid) {
13407 + case SB_CC:
13408 + sb_corereg(sbh, si->gpioidx, OFFSETOF(chipcregs_t, watchdog), ~0, ticks);
13409 + break;
13410 + case SB_EXTIF:
13411 + sb_corereg(sbh, si->gpioidx, OFFSETOF(extifregs_t, watchdog), ~0, ticks);
13412 + break;
13413 + }
13414 +}
13415 +
13416 +/* initialize the pcmcia core */
13417 +void
13418 +sb_pcmcia_init(void *sbh)
13419 +{
13420 + sb_info_t *si;
13421 + uint8 cor;
13422 +
13423 + si = SB_INFO(sbh);
13424 +
13425 + /* enable d11 mac interrupts */
13426 + if (si->chip == BCM4301_DEVICE_ID) {
13427 + /* Have to use FCR2 in 4301 */
13428 + OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_FCR2 + PCMCIA_COR, &cor, 1);
13429 + cor |= COR_IRQEN | COR_FUNEN;
13430 + OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_FCR2 + PCMCIA_COR, &cor, 1);
13431 + } else {
13432 + OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_FCR0 + PCMCIA_COR, &cor, 1);
13433 + cor |= COR_IRQEN | COR_FUNEN;
13434 + OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_FCR0 + PCMCIA_COR, &cor, 1);
13435 + }
13436 +
13437 +}
13438 +
13439 +
13440 +/*
13441 + * Configure the pci core for pci client (NIC) action
13442 + * and get appropriate dma offset value.
13443 + * coremask is the bitvec of cores by index to be enabled.
13444 + */
13445 +void
13446 +sb_pci_setup(void *sbh, uint32 *dmaoffset, uint coremask)
13447 +{
13448 + sb_info_t *si;
13449 + sbconfig_t *sb;
13450 + sbpciregs_t *pciregs;
13451 + uint32 sbflag;
13452 + uint32 w;
13453 + uint idx;
13454 +
13455 + si = SB_INFO(sbh);
13456 +
13457 + if (dmaoffset)
13458 + *dmaoffset = 0;
13459 +
13460 + /* if not pci bus, we're done */
13461 + if (si->bus != PCI_BUS)
13462 + return;
13463 +
13464 + ASSERT(si->pciidx);
13465 +
13466 + /* get current core index */
13467 + idx = si->curidx;
13468 +
13469 + /* we interrupt on this backplane flag number */
13470 + ASSERT(GOODREGS(si->curmap));
13471 + sb = REGS2SB(si->curmap);
13472 + sbflag = R_SBREG(sbh, &sb->sbtpsflag) & SBTPS_NUM0_MASK;
13473 +
13474 + /* switch over to pci core */
13475 + pciregs = (sbpciregs_t*) sb_setcoreidx(sbh, si->pciidx);
13476 + sb = REGS2SB(pciregs);
13477 +
13478 + /*
13479 + * Enable sb->pci interrupts. Assume
13480 + * PCI rev 2.3 support was added in pci core rev 6 and things changed..
13481 + */
13482 + if (si->pcirev < 6) {
13483 + /* set sbintvec bit for our flag number */
13484 + OR_SBREG(sbh, &sb->sbintvec, (1 << sbflag));
13485 + } else {
13486 + /* pci config write to set this core bit in PCIIntMask */
13487 + w = OSL_PCI_READ_CONFIG(si->osh, PCI_INT_MASK, sizeof(uint32));
13488 + w |= (coremask << PCI_SBIM_SHIFT);
13489 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_INT_MASK, sizeof(uint32), w);
13490 + }
13491 +
13492 + /* enable prefetch and bursts for sonics-to-pci translation 2 */
13493 + OR_REG(&pciregs->sbtopci2, (SBTOPCI_PREF|SBTOPCI_BURST));
13494 +
13495 + if (si->pcirev < 5) {
13496 + SET_SBREG(sbh, &sb->sbimconfiglow, SBIMCL_RTO_MASK | SBIMCL_STO_MASK,
13497 + (0x3 << SBIMCL_RTO_SHIFT) | 0x2);
13498 + sb_commit(sbh);
13499 + }
13500 +
13501 + /* switch back to previous core */
13502 + sb_setcoreidx(sbh, idx);
13503 +
13504 + /* use large sb pci dma window */
13505 + if (dmaoffset)
13506 + *dmaoffset = SB_PCI_DMA;
13507 +}
13508 +
13509 +uint32
13510 +sb_base(uint32 admatch)
13511 +{
13512 + uint32 base;
13513 + uint type;
13514 +
13515 + type = admatch & SBAM_TYPE_MASK;
13516 + ASSERT(type < 3);
13517 +
13518 + base = 0;
13519 +
13520 + if (type == 0) {
13521 + base = admatch & SBAM_BASE0_MASK;
13522 + } else if (type == 1) {
13523 + ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */
13524 + base = admatch & SBAM_BASE1_MASK;
13525 + } else if (type == 2) {
13526 + ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */
13527 + base = admatch & SBAM_BASE2_MASK;
13528 + }
13529 +
13530 + return (base);
13531 +}
13532 +
13533 +uint32
13534 +sb_size(uint32 admatch)
13535 +{
13536 + uint32 size;
13537 + uint type;
13538 +
13539 + type = admatch & SBAM_TYPE_MASK;
13540 + ASSERT(type < 3);
13541 +
13542 + size = 0;
13543 +
13544 + if (type == 0) {
13545 + size = 1 << (((admatch & SBAM_ADINT0_MASK) >> SBAM_ADINT0_SHIFT) + 1);
13546 + } else if (type == 1) {
13547 + ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */
13548 + size = 1 << (((admatch & SBAM_ADINT1_MASK) >> SBAM_ADINT1_SHIFT) + 1);
13549 + } else if (type == 2) {
13550 + ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */
13551 + size = 1 << (((admatch & SBAM_ADINT2_MASK) >> SBAM_ADINT2_SHIFT) + 1);
13552 + }
13553 +
13554 + return (size);
13555 +}
13556 +
13557 +/* return the core-type instantiation # of the current core */
13558 +uint
13559 +sb_coreunit(void *sbh)
13560 +{
13561 + sb_info_t *si;
13562 + uint idx;
13563 + uint coreid;
13564 + uint coreunit;
13565 + uint i;
13566 +
13567 + si = SB_INFO(sbh);
13568 + coreunit = 0;
13569 +
13570 + idx = si->curidx;
13571 +
13572 + ASSERT(GOODREGS(si->curmap));
13573 + coreid = sb_coreid(sbh);
13574 +
13575 + /* count the cores of our type */
13576 + for (i = 0; i < idx; i++)
13577 + if (si->coreid[i] == coreid)
13578 + coreunit++;
13579 +
13580 + return (coreunit);
13581 +}
13582 +
13583 +static INLINE uint32
13584 +factor6(uint32 x)
13585 +{
13586 + switch (x) {
13587 + case CC_F6_2: return 2;
13588 + case CC_F6_3: return 3;
13589 + case CC_F6_4: return 4;
13590 + case CC_F6_5: return 5;
13591 + case CC_F6_6: return 6;
13592 + case CC_F6_7: return 7;
13593 + default: return 0;
13594 + }
13595 +}
13596 +
13597 +/* calculate the speed the SB would run at given a set of clockcontrol values */
13598 +uint32
13599 +sb_clock_rate(uint32 pll_type, uint32 n, uint32 m)
13600 +{
13601 + uint32 n1, n2, clock, m1, m2, m3, mc;
13602 +
13603 + n1 = n & CN_N1_MASK;
13604 + n2 = (n & CN_N2_MASK) >> CN_N2_SHIFT;
13605 +
13606 + if ((pll_type == PLL_TYPE1) || (pll_type == PLL_TYPE4)) {
13607 + n1 = factor6(n1);
13608 + n2 += CC_F5_BIAS;
13609 + } else if (pll_type == PLL_TYPE2) {
13610 + n1 += CC_T2_BIAS;
13611 + n2 += CC_T2_BIAS;
13612 + ASSERT((n1 >= 2) && (n1 <= 7));
13613 + ASSERT((n2 >= 5) && (n2 <= 23));
13614 + } else if (pll_type == PLL_TYPE3) {
13615 + return (100000000);
13616 + } else
13617 + ASSERT((pll_type >= PLL_TYPE1) && (pll_type <= PLL_TYPE4));
13618 +
13619 + clock = CC_CLOCK_BASE * n1 * n2;
13620 +
13621 + if (clock == 0)
13622 + return 0;
13623 +
13624 + m1 = m & CC_M1_MASK;
13625 + m2 = (m & CC_M2_MASK) >> CC_M2_SHIFT;
13626 + m3 = (m & CC_M3_MASK) >> CC_M3_SHIFT;
13627 + mc = (m & CC_MC_MASK) >> CC_MC_SHIFT;
13628 +
13629 + if ((pll_type == PLL_TYPE1) || (pll_type == PLL_TYPE4)) {
13630 + m1 = factor6(m1);
13631 + if (pll_type == PLL_TYPE1)
13632 + m2 += CC_F5_BIAS;
13633 + else
13634 + m2 = factor6(m2);
13635 + m3 = factor6(m3);
13636 +
13637 + switch (mc) {
13638 + case CC_MC_BYPASS: return (clock);
13639 + case CC_MC_M1: return (clock / m1);
13640 + case CC_MC_M1M2: return (clock / (m1 * m2));
13641 + case CC_MC_M1M2M3: return (clock / (m1 * m2 * m3));
13642 + case CC_MC_M1M3: return (clock / (m1 * m3));
13643 + default: return (0);
13644 + }
13645 + } else {
13646 + ASSERT(pll_type == PLL_TYPE2);
13647 +
13648 + m1 += CC_T2_BIAS;
13649 + m2 += CC_T2M2_BIAS;
13650 + m3 += CC_T2_BIAS;
13651 + ASSERT((m1 >= 2) && (m1 <= 7));
13652 + ASSERT((m2 >= 3) && (m2 <= 10));
13653 + ASSERT((m3 >= 2) && (m3 <= 7));
13654 +
13655 + if ((mc & CC_T2MC_M1BYP) == 0)
13656 + clock /= m1;
13657 + if ((mc & CC_T2MC_M2BYP) == 0)
13658 + clock /= m2;
13659 + if ((mc & CC_T2MC_M3BYP) == 0)
13660 + clock /= m3;
13661 +
13662 + return(clock);
13663 + }
13664 +}
13665 +
13666 +/* returns the current speed the SB is running at */
13667 +uint32
13668 +sb_clock(void *sbh)
13669 +{
13670 + sb_info_t *si;
13671 + extifregs_t *eir;
13672 + chipcregs_t *cc;
13673 + uint32 n, m;
13674 + uint idx;
13675 + uint32 pll_type, rate;
13676 + uint intr_val = 0;
13677 +
13678 + si = SB_INFO(sbh);
13679 + idx = si->curidx;
13680 + pll_type = PLL_TYPE1;
13681 +
13682 + INTR_OFF(si, intr_val);
13683 +
13684 + /* switch to extif or chipc core */
13685 + if ((eir = (extifregs_t *) sb_setcore(sbh, SB_EXTIF, 0))) {
13686 + n = R_REG(&eir->clockcontrol_n);
13687 + m = R_REG(&eir->clockcontrol_sb);
13688 + } else if ((cc = (chipcregs_t *) sb_setcore(sbh, SB_CC, 0))) {
13689 + pll_type = R_REG(&cc->capabilities) & CAP_PLL_MASK;
13690 + n = R_REG(&cc->clockcontrol_n);
13691 + m = R_REG(&cc->clockcontrol_sb);
13692 + } else {
13693 + INTR_RESTORE(si, intr_val);
13694 + return 0;
13695 + }
13696 +
13697 + /* calculate rate */
13698 + rate = sb_clock_rate(pll_type, n, m);
13699 +
13700 + /* switch back to previous core */
13701 + sb_setcoreidx(sbh, idx);
13702 +
13703 + INTR_RESTORE(si, intr_val);
13704 +
13705 + return rate;
13706 +}
13707 +
13708 +/* change logical "focus" to the gpio core for optimized access */
13709 +void*
13710 +sb_gpiosetcore(void *sbh)
13711 +{
13712 + sb_info_t *si;
13713 +
13714 + si = SB_INFO(sbh);
13715 +
13716 + return (sb_setcoreidx(sbh, si->gpioidx));
13717 +}
13718 +
13719 +/* mask&set gpiocontrol bits */
13720 +uint32
13721 +sb_gpiocontrol(void *sbh, uint32 mask, uint32 val)
13722 +{
13723 + sb_info_t *si;
13724 + uint regoff;
13725 +
13726 + si = SB_INFO(sbh);
13727 + regoff = 0;
13728 +
13729 + switch (si->gpioid) {
13730 + case SB_CC:
13731 + regoff = OFFSETOF(chipcregs_t, gpiocontrol);
13732 + break;
13733 +
13734 + case SB_PCI:
13735 + regoff = OFFSETOF(sbpciregs_t, gpiocontrol);
13736 + break;
13737 +
13738 + case SB_EXTIF:
13739 + return (0);
13740 + }
13741 +
13742 + return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
13743 +}
13744 +
13745 +/* mask&set gpio output enable bits */
13746 +uint32
13747 +sb_gpioouten(void *sbh, uint32 mask, uint32 val)
13748 +{
13749 + sb_info_t *si;
13750 + uint regoff;
13751 +
13752 + si = SB_INFO(sbh);
13753 + regoff = 0;
13754 +
13755 + switch (si->gpioid) {
13756 + case SB_CC:
13757 + regoff = OFFSETOF(chipcregs_t, gpioouten);
13758 + break;
13759 +
13760 + case SB_PCI:
13761 + regoff = OFFSETOF(sbpciregs_t, gpioouten);
13762 + break;
13763 +
13764 + case SB_EXTIF:
13765 + regoff = OFFSETOF(extifregs_t, gpio[0].outen);
13766 + break;
13767 + }
13768 +
13769 + return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
13770 +}
13771 +
13772 +/* mask&set gpio output bits */
13773 +uint32
13774 +sb_gpioout(void *sbh, uint32 mask, uint32 val)
13775 +{
13776 + sb_info_t *si;
13777 + uint regoff;
13778 +
13779 + si = SB_INFO(sbh);
13780 + regoff = 0;
13781 +
13782 + switch (si->gpioid) {
13783 + case SB_CC:
13784 + regoff = OFFSETOF(chipcregs_t, gpioout);
13785 + break;
13786 +
13787 + case SB_PCI:
13788 + regoff = OFFSETOF(sbpciregs_t, gpioout);
13789 + break;
13790 +
13791 + case SB_EXTIF:
13792 + regoff = OFFSETOF(extifregs_t, gpio[0].out);
13793 + break;
13794 + }
13795 +
13796 + return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
13797 +}
13798 +
13799 +/* return the current gpioin register value */
13800 +uint32
13801 +sb_gpioin(void *sbh)
13802 +{
13803 + sb_info_t *si;
13804 + uint regoff;
13805 +
13806 + si = SB_INFO(sbh);
13807 + regoff = 0;
13808 +
13809 + switch (si->gpioid) {
13810 + case SB_CC:
13811 + regoff = OFFSETOF(chipcregs_t, gpioin);
13812 + break;
13813 +
13814 + case SB_PCI:
13815 + regoff = OFFSETOF(sbpciregs_t, gpioin);
13816 + break;
13817 +
13818 + case SB_EXTIF:
13819 + regoff = OFFSETOF(extifregs_t, gpioin);
13820 + break;
13821 + }
13822 +
13823 + return (sb_corereg(sbh, si->gpioidx, regoff, 0, 0));
13824 +}
13825 +
13826 +/* mask&set gpio interrupt polarity bits */
13827 +uint32
13828 +sb_gpiointpolarity(void *sbh, uint32 mask, uint32 val)
13829 +{
13830 + sb_info_t *si;
13831 + uint regoff;
13832 +
13833 + si = SB_INFO(sbh);
13834 + regoff = 0;
13835 +
13836 + switch (si->gpioid) {
13837 + case SB_CC:
13838 + regoff = OFFSETOF(chipcregs_t, gpiointpolarity);
13839 + break;
13840 +
13841 + case SB_PCI:
13842 + /* pci gpio implementation does not support interrupt polarity */
13843 + ASSERT(0);
13844 + break;
13845 +
13846 + case SB_EXTIF:
13847 + regoff = OFFSETOF(extifregs_t, gpiointpolarity);
13848 + break;
13849 + }
13850 +
13851 + return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
13852 +}
13853 +
13854 +/* mask&set gpio interrupt mask bits */
13855 +uint32
13856 +sb_gpiointmask(void *sbh, uint32 mask, uint32 val)
13857 +{
13858 + sb_info_t *si;
13859 + uint regoff;
13860 +
13861 + si = SB_INFO(sbh);
13862 + regoff = 0;
13863 +
13864 + switch (si->gpioid) {
13865 + case SB_CC:
13866 + regoff = OFFSETOF(chipcregs_t, gpiointmask);
13867 + break;
13868 +
13869 + case SB_PCI:
13870 + /* pci gpio implementation does not support interrupt mask */
13871 + ASSERT(0);
13872 + break;
13873 +
13874 + case SB_EXTIF:
13875 + regoff = OFFSETOF(extifregs_t, gpiointmask);
13876 + break;
13877 + }
13878 +
13879 + return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
13880 +}
13881 +
13882 +
13883 +/*
13884 + * Return the slowclock min or max frequency.
13885 + * Three sources of SLOW CLOCK:
13886 + * 1. On Chip LPO - 32khz or 160khz
13887 + * 2. On Chip Xtal OSC - 20mhz/4*(divider+1)
13888 + * 3. External PCI clock - 66mhz/4*(divider+1)
13889 + */
13890 +static uint
13891 +slowfreq(void *sbh, bool max)
13892 +{
13893 + sb_info_t *si;
13894 + chipcregs_t *cc;
13895 + uint32 v;
13896 + uint div;
13897 +
13898 + si = SB_INFO(sbh);
13899 +
13900 + ASSERT(sb_coreid(sbh) == SB_CC);
13901 +
13902 + cc = (chipcregs_t*) sb_setcoreidx(sbh, si->curidx);
13903 +
13904 + /* shouldn't be here unless we've established the chip has dynamic power control */
13905 + ASSERT(R_REG(&cc->capabilities) & CAP_PWR_CTL);
13906 +
13907 + if (si->ccrev < 6) {
13908 + v = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32));
13909 +
13910 + if (v & PCI_CFG_GPIO_SCS)
13911 + return (max? (PCIMAXFREQ/64) : (PCIMINFREQ/64));
13912 + else
13913 + return (max? (XTALMAXFREQ/32) : (XTALMINFREQ/32));
13914 + } else {
13915 + v = R_REG(&cc->slow_clk_ctl) & SCC_SS_MASK;
13916 + div = 4 * (((R_REG(&cc->slow_clk_ctl) & SCC_CD_MASK) >> SCC_CD_SHF) + 1);
13917 + if (v == SCC_SS_LPO)
13918 + return (max? LPOMAXFREQ : LPOMINFREQ);
13919 + else if (v == SCC_SS_XTAL)
13920 + return (max? (XTALMAXFREQ/div) : (XTALMINFREQ/div));
13921 + else if (v == SCC_SS_PCI)
13922 + return (max? (PCIMAXFREQ/div) : (PCIMINFREQ/div));
13923 + else
13924 + ASSERT(0);
13925 + }
13926 + return (0);
13927 +}
13928 +
13929 +/* initialize power control delay registers */
13930 +void
13931 +sb_pwrctl_init(void *sbh)
13932 +{
13933 + sb_info_t *si;
13934 + uint origidx;
13935 + chipcregs_t *cc;
13936 + uint slowmaxfreq;
13937 + uint pll_on_delay, fref_sel_delay;
13938 +
13939 + si = SB_INFO(sbh);
13940 +
13941 + if (si->bus == SB_BUS)
13942 + return;
13943 +
13944 + origidx = si->curidx;
13945 +
13946 + if ((cc = (chipcregs_t*) sb_setcore(sbh, SB_CC, 0)) == NULL)
13947 + return;
13948 +
13949 + if (!(R_REG(&cc->capabilities) & CAP_PWR_CTL))
13950 + goto done;
13951 +
13952 + slowmaxfreq = slowfreq(sbh, TRUE);
13953 + pll_on_delay = ((slowmaxfreq * PLL_DELAY) + 999999) / 1000000;
13954 + fref_sel_delay = ((slowmaxfreq * FREF_DELAY) + 999999) / 1000000;
13955 +
13956 + W_REG(&cc->pll_on_delay, pll_on_delay);
13957 + W_REG(&cc->fref_sel_delay, fref_sel_delay);
13958 +
13959 + /* 4317pc does not work with SlowClock less than 5Mhz */
13960 + if (si->bus == PCMCIA_BUS)
13961 + SET_REG(&cc->slow_clk_ctl, SCC_CD_MASK, (0 << SCC_CD_SHF));
13962 +
13963 +done:
13964 + sb_setcoreidx(sbh, origidx);
13965 +}
13966 +
13967 +/* return the value suitable for writing to the dot11 core FAST_PWRUP_DELAY register */
13968 +uint16
13969 +sb_pwrctl_fast_pwrup_delay(void *sbh)
13970 +{
13971 + sb_info_t *si;
13972 + uint origidx;
13973 + chipcregs_t *cc;
13974 + uint slowminfreq;
13975 + uint16 fpdelay;
13976 + uint intr_val = 0;
13977 +
13978 + si = SB_INFO(sbh);
13979 + fpdelay = 0;
13980 + origidx = si->curidx;
13981 +
13982 + if (si->bus == SB_BUS)
13983 + goto done;
13984 +
13985 + INTR_OFF(si, intr_val);
13986 +
13987 + if ((cc = (chipcregs_t*) sb_setcore(sbh, SB_CC, 0)) == NULL)
13988 + goto done;
13989 +
13990 + if (!(R_REG(&cc->capabilities) & CAP_PWR_CTL))
13991 + goto done;
13992 +
13993 + slowminfreq = slowfreq(sbh, FALSE);
13994 + fpdelay = (((R_REG(&cc->pll_on_delay) + 2) * 1000000) + (slowminfreq - 1)) / slowminfreq;
13995 +
13996 +done:
13997 + sb_setcoreidx(sbh, origidx);
13998 + INTR_RESTORE(si, intr_val);
13999 + return (fpdelay);
14000 +}
14001 +
14002 +/* turn primary xtal and/or pll off/on */
14003 +int
14004 +sb_pwrctl_xtal(void *sbh, uint what, bool on)
14005 +{
14006 + sb_info_t *si;
14007 + uint32 in, out, outen;
14008 +
14009 + si = SB_INFO(sbh);
14010 +
14011 +
14012 + if (si->bus == PCMCIA_BUS) {
14013 + return (0);
14014 + }
14015 +
14016 + if (si->bus != PCI_BUS)
14017 + return (-1);
14018 +
14019 + in = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_IN, sizeof (uint32));
14020 + out = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32));
14021 + outen = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_OUTEN, sizeof (uint32));
14022 +
14023 + /*
14024 + * We can't actually read the state of the PLLPD so we infer it
14025 + * by the value of XTAL_PU which *is* readable via gpioin.
14026 + */
14027 + if (on && (in & PCI_CFG_GPIO_XTAL))
14028 + return (0);
14029 +
14030 + if (what & XTAL)
14031 + outen |= PCI_CFG_GPIO_XTAL;
14032 + if (what & PLL)
14033 + outen |= PCI_CFG_GPIO_PLL;
14034 +
14035 + if (on) {
14036 + /* turn primary xtal on */
14037 + if (what & XTAL) {
14038 + out |= PCI_CFG_GPIO_XTAL;
14039 + if (what & PLL)
14040 + out |= PCI_CFG_GPIO_PLL;
14041 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32), out);
14042 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUTEN, sizeof (uint32), outen);
14043 + OSL_DELAY(200);
14044 + }
14045 +
14046 + /* turn pll on */
14047 + if (what & PLL) {
14048 + out &= ~PCI_CFG_GPIO_PLL;
14049 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32), out);
14050 + OSL_DELAY(2000);
14051 + }
14052 + } else {
14053 + if (what & XTAL)
14054 + out &= ~PCI_CFG_GPIO_XTAL;
14055 + if (what & PLL)
14056 + out |= PCI_CFG_GPIO_PLL;
14057 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32), out);
14058 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUTEN, sizeof (uint32), outen);
14059 + }
14060 +
14061 + return (0);
14062 +}
14063 +
14064 +/* set dynamic power control mode (forceslow, forcefast, dynamic) */
14065 +/* returns true if ignore pll off is set and false if it is not */
14066 +bool
14067 +sb_pwrctl_clk(void *sbh, uint mode)
14068 +{
14069 + sb_info_t *si;
14070 + uint origidx;
14071 + chipcregs_t *cc;
14072 + uint32 scc;
14073 + bool forcefastclk=FALSE;
14074 + uint intr_val = 0;
14075 +
14076 + si = SB_INFO(sbh);
14077 +
14078 + /* chipcommon cores prior to rev6 don't support slowclkcontrol */
14079 + if (si->ccrev < 6)
14080 + return (FALSE);
14081 +
14082 + INTR_OFF(si, intr_val);
14083 +
14084 + origidx = si->curidx;
14085 +
14086 + cc = (chipcregs_t*) sb_setcore(sbh, SB_CC, 0);
14087 + ASSERT(cc != NULL);
14088 +
14089 + if (!(R_REG(&cc->capabilities) & CAP_PWR_CTL))
14090 + goto done;
14091 +
14092 + switch (mode) {
14093 + case CLK_FAST: /* force fast (pll) clock */
14094 + /* don't forget to force xtal back on before we clear SCC_DYN_XTAL.. */
14095 + sb_pwrctl_xtal(sbh, XTAL, ON);
14096 +
14097 + SET_REG(&cc->slow_clk_ctl, (SCC_XC | SCC_FS | SCC_IP), SCC_IP);
14098 + break;
14099 +
14100 + case CLK_SLOW: /* force slow clock */
14101 + if ((si->bus == SDIO_BUS) || (si->bus == PCMCIA_BUS))
14102 + return (-1);
14103 +
14104 + if (si->ccrev >= 6)
14105 + OR_REG(&cc->slow_clk_ctl, SCC_FS);
14106 + break;
14107 +
14108 + case CLK_DYNAMIC: /* enable dynamic power control */
14109 + scc = R_REG(&cc->slow_clk_ctl);
14110 + scc &= ~(SCC_FS | SCC_IP | SCC_XC);
14111 + if ((scc & SCC_SS_MASK) != SCC_SS_XTAL)
14112 + scc |= SCC_XC;
14113 + W_REG(&cc->slow_clk_ctl, scc);
14114 +
14115 + /* for dynamic control, we have to release our xtal_pu "force on" */
14116 + if (scc & SCC_XC)
14117 + sb_pwrctl_xtal(sbh, XTAL, OFF);
14118 + break;
14119 + }
14120 +
14121 + /* Is the h/w forcing the use of the fast clk */
14122 + forcefastclk = (bool)((R_REG(&cc->slow_clk_ctl) & SCC_IP) == SCC_IP);
14123 +
14124 +done:
14125 + sb_setcoreidx(sbh, origidx);
14126 + INTR_RESTORE(si, intr_val);
14127 + return (forcefastclk);
14128 +}
14129 +
14130 +/* register driver interrupt disabling and restoring callback functions */
14131 +void
14132 +sb_register_intr_callback(void *sbh, void *intrsoff_fn, void *intrsrestore_fn, void *intr_arg)
14133 +{
14134 + sb_info_t *si;
14135 +
14136 + si = SB_INFO(sbh);
14137 + si->intr_arg = intr_arg;
14138 + si->intrsoff_fn = (sb_intrsoff_t)intrsoff_fn;
14139 + si->intrsrestore_fn = (sb_intrsrestore_t)intrsrestore_fn;
14140 + /* save current core id. when this function called, the current core
14141 + * must be the core which provides driver functions(il, et, wl, etc.)
14142 + */
14143 + si->dev_coreid = si->coreid[si->curidx];
14144 +}
14145 +
14146 +
14147 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/compressed/Makefile linux-2.6.12.5-brcm/arch/mips/bcm47xx/compressed/Makefile
14148 --- linux-2.6.12.5/arch/mips/bcm47xx/compressed/Makefile 1970-01-01 01:00:00.000000000 +0100
14149 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/compressed/Makefile 2005-08-28 11:12:20.482851248 +0200
14150 @@ -0,0 +1,71 @@
14151 +#
14152 +# Makefile for Broadcom BCM947XX boards
14153 +#
14154 +# Copyright 2001-2003, Broadcom Corporation
14155 +# All Rights Reserved.
14156 +#
14157 +# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
14158 +# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
14159 +# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
14160 +# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
14161 +#
14162 +# $Id$
14163 +#
14164 +
14165 +# Link at 3 MB offset in RAM
14166 +LOADADDR := 0x80001000
14167 +TEXT_START := 0x80500000
14168 +ifdef TEXTADDR
14169 +LOADADDR := $(TEXTADDR)
14170 +endif
14171 +
14172 +STRIP := $(CROSS_COMPILE)strip
14173 +
14174 +OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
14175 +
14176 +# SRCBASE := $(TOPDIR)/../..
14177 +VPATH := $(SRCBASE)/shared
14178 +### Fix it by getting it from the Master rules
14179 +ASFLAGS += -mno-abicalls -fno-pic -pipe -finline-limit=100000 -mips2 -Wa,--trap -I$(TOPDIR)/include/asm/mach-generic
14180 +ASFLAGS += -I$(TOPDIR)/include/asm/gcc -nostdinc
14181 +ASFLAGS += -D__ASSEMBLY__ -I$(TOPDIR)/arch/mips/bcm47xx/broadcom/include -I$(TOPDIR)/include -DLOADADDR=$(LOADADDR)
14182 +CFLAGS += -I$(TOPDIR)/arch/mips/bcm47xx/broadcom/include -I$(TOPDIR)/include -DLOADADDR=$(LOADADDR)
14183 +CFLAGS += -I$(TOPDIR)/include/asm/gcc -I$(TOPDIR)/include/asm/mach-generic
14184 +ifdef CONFIG_MCOUNT
14185 +CFLAGS := $(subst -pg,,$(CFLAGS))
14186 +endif
14187 +SEDFLAGS := s/TEXT_START/$(TEXT_START)/
14188 +
14189 +SYSTEM := $(TOPDIR)/vmlinux
14190 +#OBJECTS := head.o sbsdram.o misc.o sflash.o
14191 +# Don't use nvram or dram initalization.Hope cfe to do it or kernel.
14192 +OBJECTS := head.o misc.o
14193 +
14194 +all: zImage
14195 +
14196 +# Don't build dependencies, this may die if $(CC) isn't gcc
14197 +dep:
14198 +
14199 +bzImage: vmlinux
14200 + $(OBJCOPY) $< $@
14201 +
14202 +vmlinux: vmlinux.lds $(OBJECTS) piggy.o
14203 + $(LD) -no-warn-mismatch -T vmlinux.lds -o $@ $(OBJECTS) piggy.o
14204 + $(STRIP) $@
14205 +
14206 +vmlinux.lds: vmlinux.lds.in Makefile
14207 + @sed "$(SEDFLAGS)" < $< > $@
14208 +
14209 +piggy.o: $(SYSTEM)
14210 + cp $(SYSTEM) $(TOPDIR)/vmlinuxs
14211 + $(STRIP) $(TOPDIR)/vmlinuxs
14212 + $(OBJCOPY) $(TOPDIR)/vmlinuxs piggy
14213 + gzip -c9 piggy > vmlinuz
14214 + echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > piggy.lnk
14215 + $(LD) -no-warn-mismatch -T piggy.lnk -r -o $@ -b binary vmlinuz -b elf32-tradlittlemips
14216 + rm $(TOPDIR)/vmlinuxs
14217 +
14218 +mrproper: clean
14219 +
14220 +clean:
14221 + rm -f vmlinux vmlinuz zImage vmlinux.lds piggy piggy.lnk *.o
14222 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/compressed/head.S linux-2.6.12.5-brcm/arch/mips/bcm47xx/compressed/head.S
14223 --- linux-2.6.12.5/arch/mips/bcm47xx/compressed/head.S 1970-01-01 01:00:00.000000000 +0100
14224 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/compressed/head.S 2005-08-28 11:12:20.502848208 +0200
14225 @@ -0,0 +1,84 @@
14226 +/*
14227 + * BCM947XX Self-Booting Linux
14228 + *
14229 + * Code should be position-independent until it copies itself to SDRAM.
14230 + *
14231 + * Copyright 2001-2003, Broadcom Corporation
14232 + * All Rights Reserved.
14233 + *
14234 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
14235 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
14236 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
14237 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
14238 + *
14239 + * $Id$
14240 + */
14241 +
14242 +#include <asm/asm.h>
14243 +#include <asm/regdef.h>
14244 +#include <asm/addrspace.h>
14245 +#include <asm/mipsregs.h>
14246 +#include <bcm4710.h>
14247 +
14248 + .text
14249 + LEAF(startup)
14250 + .set noreorder
14251 +
14252 +/* Dont look at nvram now for dram initalization. Hope cfe/bootloader did it. Fix it latter */
14253 +
14254 + blt t0, t1, inram
14255 + nop
14256 +
14257 +#if 0
14258 + /* Check if we booted from SDRAM */
14259 + bal 1f
14260 + nop
14261 +1: li t0, 0x1fffffff
14262 + and t0, t0, ra
14263 + li t1, BCM4710_FLASH
14264 + blt t0, t1, inram
14265 + nop
14266 +
14267 + /* Initialize SDRAM */
14268 + li t0, KSEG1ADDR(BCM4710_FLASH)
14269 + la t1, text_start
14270 + la t2, board_draminit
14271 + sub t2, t2, t1
14272 + add t2, t2, t0
14273 + jalr t2
14274 + nop
14275 +
14276 + /* Copy self to SDRAM */
14277 + li a0, BCM4710_FLASH
14278 + la a1, text_start
14279 + la a2, input_data
14280 +1: lw t0, 0(a0)
14281 + sw t0, 0(a1)
14282 + add a0, 4
14283 + add a1, 4
14284 + blt a1, a2, 1b
14285 + nop
14286 +#endif
14287 +inram:
14288 + /* Set up stack pointer */
14289 + li sp, 0x80800000 - 4
14290 +
14291 + /* Clear BSS */
14292 + la a0, bss_start
14293 + la a1, bss_end
14294 +1: sw zero, 0(a0)
14295 + addi a0, a0, 4
14296 + blt a0, a1, 1b
14297 + nop
14298 +
14299 + /* Jump to C */
14300 + la t0, c_main
14301 + jal t0
14302 + move a0, ra
14303 +
14304 + /* Embedded NVRAM */
14305 + .balign 0x400
14306 + .space 0x2000
14307 +
14308 + .set reorder
14309 + END(startup)
14310 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/compressed/misc.c linux-2.6.12.5-brcm/arch/mips/bcm47xx/compressed/misc.c
14311 --- linux-2.6.12.5/arch/mips/bcm47xx/compressed/misc.c 1970-01-01 01:00:00.000000000 +0100
14312 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/compressed/misc.c 2005-08-28 11:12:20.503848056 +0200
14313 @@ -0,0 +1,1183 @@
14314 +/*
14315 + * Misc initialization and support routines for self-booting
14316 + * compressed image.
14317 + *
14318 + * Copyright 2001-2003, Broadcom Corporation
14319 + * All Rights Reserved.
14320 + *
14321 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
14322 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
14323 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
14324 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
14325 + *
14326 + * $Id$
14327 + */
14328 +
14329 +#include <linux/init.h>
14330 +#include <linux/kernel.h>
14331 +#include <linux/sched.h>
14332 +#include <linux/mm.h>
14333 +#include <linux/serial_reg.h>
14334 +#include <linux/serial.h>
14335 +#include <linux/delay.h>
14336 +
14337 +#include <asm/bootinfo.h>
14338 +#include <asm/cpu.h>
14339 +#include <asm/bcache.h>
14340 +#include <asm/io.h>
14341 +#include <asm/page.h>
14342 +#include <asm/pgtable.h>
14343 +#include <asm/system.h>
14344 +#include <asm/mmu_context.h>
14345 +
14346 +#include <typedefs.h>
14347 +#include <bcmdevs.h>
14348 +#include <bcmnvram.h>
14349 +#include <bcmutils.h>
14350 +#include <sbconfig.h>
14351 +#include <sbextif.h>
14352 +#include <sbchipc.h>
14353 +#include <sbmips.h>
14354 +#include <sbmemc.h>
14355 +#include <sflash.h>
14356 +
14357 +/* At 125 MHz */
14358 +unsigned long loops_per_jiffy = 625000;
14359 +
14360 +/* Static variables */
14361 +static unsigned int chipid, chiprev, mipscore;
14362 +static unsigned int sbclock, mipsclock;
14363 +static extifregs_t *eir;
14364 +static chipcregs_t *cc;
14365 +static mipsregs_t *mipsr;
14366 +static sbmemcregs_t *memc;
14367 +static void *usb;
14368 +static struct serial_struct uart;
14369 +static struct sflash *sflash;
14370 +
14371 +#define LOG_BUF_LEN (1024)
14372 +#define LOG_BUF_MASK (LOG_BUF_LEN-1)
14373 +static char log_buf[LOG_BUF_LEN];
14374 +static unsigned long log_start;
14375 +
14376 +/* Declarations needed for the cache related includes below */
14377 +
14378 +/* Primary cache parameters. These declarations are needed*/
14379 +static int icache_size, dcache_size; /* Size in bytes */
14380 +static int ic_lsize, dc_lsize; /* LineSize in bytes */
14381 +
14382 +/* Chip information */
14383 +unsigned int bcm_chipid = BCM4710_DEVICE_ID;
14384 +unsigned int bcm_chiprev = 0;
14385 +
14386 +#if 0 /* fix latter ... hope cfe has done it */
14387 +#include <asm/cacheops.h>
14388 +#include <asm/bcm4710_cache.h>
14389 +
14390 +__BUILD_SET_C0(taglo,CP0_TAGLO);
14391 +__BUILD_SET_C0(taghi,CP0_TAGHI);
14392 +
14393 +static void
14394 +cache_init(void)
14395 +{
14396 + unsigned int config1;
14397 + unsigned int sets, ways;
14398 + unsigned int start, end;
14399 +
14400 + config1 = read_c0_config1();
14401 +
14402 + /* Instruction Cache Size = Associativity * Line Size * Sets Per Way */
14403 + if ((ic_lsize = ((config1 >> 19) & 7)))
14404 + ic_lsize = 2 << ic_lsize;
14405 + sets = 64 << ((config1 >> 22) & 7);
14406 + ways = 1 + ((config1 >> 16) & 7);
14407 + icache_size = ic_lsize * sets * ways;
14408 +
14409 + start = KSEG0;
14410 + end = (start + icache_size);
14411 + clear_c0_taglo(~0);
14412 + clear_c0_taghi(~0);
14413 + while (start < end) {
14414 + cache_unroll(start, Index_Store_Tag_I);
14415 + start += ic_lsize;
14416 + }
14417 +
14418 + /* Data Cache Size = Associativity * Line Size * Sets Per Way */
14419 + if ((dc_lsize = ((config1 >> 10) & 7)))
14420 + dc_lsize = 2 << dc_lsize;
14421 + sets = 64 << ((config1 >> 13) & 7);
14422 + ways = 1 + ((config1 >> 7) & 7);
14423 + dcache_size = dc_lsize * sets * ways;
14424 +
14425 + start = KSEG0;
14426 + end = (start + dcache_size);
14427 + clear_c0_taglo(~0);
14428 + clear_c0_taghi(~0);
14429 + while (start < end) {
14430 + cache_unroll(start, Index_Store_Tag_D);
14431 + start += dc_lsize;
14432 + }
14433 +}
14434 +#endif
14435 +
14436 +static inline unsigned int
14437 +serial_in(struct serial_struct *info, int offset)
14438 +{
14439 +#ifdef CONFIG_BCM4310
14440 + readb((unsigned long) info->iomem_base +
14441 + (UART_SCR<<info->iomem_reg_shift));
14442 +#endif
14443 + return readb((unsigned long) info->iomem_base +
14444 + (offset<<info->iomem_reg_shift));
14445 +}
14446 +
14447 +static inline void
14448 +serial_out(struct serial_struct *info, int offset, int value)
14449 +{
14450 +#ifdef SIM
14451 + return;
14452 +#else
14453 + writeb(value, (unsigned long) info->iomem_base +
14454 + (offset<<info->iomem_reg_shift));
14455 +#endif
14456 +}
14457 +
14458 +static void
14459 +sb_scan(void)
14460 +{
14461 + int i;
14462 + unsigned long cid, regs;
14463 + sbconfig_t *sb;
14464 +
14465 + /* Initialize static variables */
14466 + eir = NULL;
14467 + cc = NULL;
14468 + usb = NULL;
14469 + memc = NULL;
14470 + mipsr = NULL;
14471 + mipscore = 0;
14472 + chipid = BCM4710_DEVICE_ID;
14473 + chiprev = 0;
14474 +
14475 + /* Too early to probe or malloc */
14476 + for (i = 0; i < SB_MAXCORES; i++) {
14477 + regs = SB_ENUM_BASE + (i * SB_CORE_SIZE);
14478 + sb = (sbconfig_t *) KSEG1ADDR(regs + SBCONFIGOFF);
14479 + cid = (readl(&sb->sbidhigh) & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT;
14480 + switch (cid) {
14481 + case SB_EXTIF:
14482 + eir = (extifregs_t *) KSEG1ADDR(regs);
14483 + break;
14484 + case SB_CC:
14485 + cc = (chipcregs_t *) KSEG1ADDR(regs);
14486 + chipid = readl(&cc->chipid) & CID_ID_MASK;
14487 + chiprev = (readl(&cc->chipid) & CID_REV_MASK) >> CID_REV_SHIFT;
14488 + break;
14489 + case SB_USB:
14490 + usb = (void *)KSEG1ADDR(regs);
14491 + break;
14492 + case SB_MEMC:
14493 + memc = (void *)KSEG1ADDR(regs);
14494 + break;
14495 + case SB_MIPS:
14496 + case SB_MIPS33:
14497 + mipsr = (void *)KSEG1ADDR(regs);
14498 + mipscore = cid;
14499 + break;
14500 + }
14501 + if (eir)
14502 + break;
14503 + if (cc && mipsr) {
14504 + if (chipid == BCM4310_DEVICE_ID && chiprev == 0 && !usb)
14505 + continue;
14506 + else if (!memc)
14507 + continue;
14508 + break;
14509 + }
14510 + }
14511 +}
14512 +
14513 +static int
14514 +keyhit(void)
14515 +{
14516 +#ifdef SIM
14517 + return(1);
14518 +#endif
14519 +
14520 + return ((serial_in(&uart, UART_LSR) & UART_LSR_DR) != 0);
14521 +}
14522 +
14523 +static int
14524 +getc(void)
14525 +{
14526 +#ifdef SIM
14527 + return(0);
14528 +#endif
14529 +
14530 + while (!(serial_in(&uart, UART_LSR) & UART_LSR_DR));
14531 + return (serial_in(&uart, UART_RX));
14532 +}
14533 +
14534 +static void
14535 +putc(int c)
14536 +{
14537 +#ifdef SIM
14538 + return;
14539 +#endif
14540 + /* CR before LF */
14541 + if (c == '\n')
14542 + putc('\r');
14543 +
14544 + /* Store in log buffer */
14545 + *((char *) KSEG1ADDR(&log_buf[log_start])) = (char) c;
14546 + log_start = (log_start + 1) & LOG_BUF_MASK;
14547 +
14548 + while (!(serial_in(&uart, UART_LSR) & UART_LSR_THRE));
14549 + serial_out(&uart, UART_TX, c);
14550 +}
14551 +
14552 +static void
14553 +puts(const char *cs)
14554 +{
14555 +#ifdef SIM
14556 + return;
14557 +#else
14558 + char *s = (char *) cs;
14559 + short c;
14560 +
14561 + while (1) {
14562 + c = *(short *)(s);
14563 + if ((char)(c & 0xff))
14564 + putc((char)(c & 0xff));
14565 + else
14566 + break;
14567 + if ((char)((c >> 8) & 0xff))
14568 + putc((char)((c >> 8) & 0xff));
14569 + else
14570 + break;
14571 + s += sizeof(short);
14572 + }
14573 +#endif
14574 +}
14575 +
14576 +static void
14577 +puthex(unsigned int h)
14578 +{
14579 +#ifdef SIM
14580 + return;
14581 +#else
14582 + char c;
14583 + int i;
14584 +
14585 + for (i = 7; i >= 0; i--) {
14586 + c = (char)((h >> (i * 4)) & 0xf);
14587 + c += (c > 9) ? ('a' - 10) : '0';
14588 + putc(c);
14589 + }
14590 +#endif
14591 +}
14592 +
14593 +void
14594 +putdec(unsigned int d)
14595 +{
14596 +#ifdef SIM
14597 + return;
14598 +#else
14599 + int leading_zero;
14600 + unsigned int divisor, result, remainder;
14601 +
14602 + leading_zero = 1;
14603 + remainder = d;
14604 +
14605 + for (divisor = 1000000000;
14606 + divisor > 0;
14607 + divisor /= 10) {
14608 + result = remainder / divisor;
14609 + remainder %= divisor;
14610 +
14611 + if (result != 0 || divisor == 1)
14612 + leading_zero = 0;
14613 +
14614 + if (leading_zero == 0)
14615 + putc((char)(result) + '0');
14616 + }
14617 +#endif
14618 +}
14619 +
14620 +static INLINE uint32
14621 +factor6(uint32 x)
14622 +{
14623 + switch (x) {
14624 + case CC_F6_2: return 2;
14625 + case CC_F6_3: return 3;
14626 + case CC_F6_4: return 4;
14627 + case CC_F6_5: return 5;
14628 + case CC_F6_6: return 6;
14629 + case CC_F6_7: return 7;
14630 + default: return 0;
14631 + }
14632 +}
14633 +
14634 +/* calculate the speed the SB would run at given a set of clockcontrol values */
14635 +static uint32
14636 +sb_clock_rate(uint32 pll_type, uint32 n, uint32 m)
14637 +{
14638 +#if 1 /* PLL clock ??? */
14639 +#warning "Fix Me....................... misc.c sb_clock_rate"
14640 + return 100;
14641 +#else
14642 + uint32 n1, n2, clock, m1, m2, m3, mc;
14643 +
14644 + n1 = n & CN_N1_MASK;
14645 + n2 = (n & CN_N2_MASK) >> CN_N2_SHIFT;
14646 +
14647 + if ((pll_type == PLL_TYPE1) || (pll_type == PLL_TYPE4)) {
14648 + n1 = factor6(n1);
14649 + n2 += CC_F5_BIAS;
14650 + } else if (pll_type == PLL_TYPE2) {
14651 + n1 += CC_T2_BIAS;
14652 + n2 += CC_T2_BIAS;
14653 + } else if (pll_type == PLL_TYPE3) {
14654 + return (100000000);
14655 + }
14656 +
14657 + clock = CC_CLOCK_BASE * n1 * n2;
14658 +
14659 + if (clock == 0)
14660 + return 0;
14661 +
14662 + m1 = m & CC_M1_MASK;
14663 + m2 = (m & CC_M2_MASK) >> CC_M2_SHIFT;
14664 + m3 = (m & CC_M3_MASK) >> CC_M3_SHIFT;
14665 + mc = (m & CC_MC_MASK) >> CC_MC_SHIFT;
14666 +
14667 + if ((pll_type == PLL_TYPE1) || (pll_type == PLL_TYPE4)) {
14668 + m1 = factor6(m1);
14669 + if (pll_type == PLL_TYPE1)
14670 + m2 += CC_F5_BIAS;
14671 + else
14672 + m2 = factor6(m2);
14673 + m3 = factor6(m3);
14674 +
14675 + switch (mc) {
14676 + case CC_MC_BYPASS: return (clock);
14677 + case CC_MC_M1: return (clock / m1);
14678 + case CC_MC_M1M2: return (clock / (m1 * m2));
14679 + case CC_MC_M1M2M3: return (clock / (m1 * m2 * m3));
14680 + case CC_MC_M1M3: return (clock / (m1 * m3));
14681 + default: return (0);
14682 + }
14683 + } else {
14684 + m1 += CC_T2_BIAS;
14685 + m2 += CC_T2M2_BIAS;
14686 + m3 += CC_T2_BIAS;
14687 +
14688 + if ((mc & CC_T2MC_M1BYP) == 0)
14689 + clock /= m1;
14690 + if ((mc & CC_T2MC_M2BYP) == 0)
14691 + clock /= m2;
14692 + if ((mc & CC_T2MC_M3BYP) == 0)
14693 + clock /= m3;
14694 +
14695 + return(clock);
14696 + }
14697 +#endif
14698 +}
14699 +
14700 +static void
14701 +uart_init(int baud)
14702 +{
14703 + sbconfig_t *sb;
14704 + unsigned long base, hz, ns, tmp;
14705 + int quot;
14706 +
14707 + if (eir) {
14708 +#if 0
14709 + /* Determine external UART register base */
14710 + sb = (sbconfig_t *)((unsigned int) eir + SBCONFIGOFF);
14711 + base = EXTIF_CFGIF_BASE(readl(&sb->sbadmatch1) & SBAM_BASE1_MASK);
14712 +
14713 + /* Enable programmable interface */
14714 + writel(CF_EN, &eir->prog_config);
14715 +
14716 + /* Calculate clock cycle */
14717 + sbclock = mipsclock = hz = sb_clock_rate(PLL_TYPE1, readl(&eir->clockcontrol_n), readl(&eir->clockcontrol_sb));
14718 + hz = hz ? : 100000000;
14719 + ns = 1000000000 / hz;
14720 +
14721 + /* Set programmable interface timing for external uart */
14722 + tmp = CEIL(10, ns) << FW_W3_SHIFT; /* W3 = 10nS */
14723 + tmp = tmp | (CEIL(20, ns) << FW_W2_SHIFT); /* W2 = 20nS */
14724 + tmp = tmp | (CEIL(100, ns) << FW_W1_SHIFT); /* W1 = 100nS */
14725 + tmp = tmp | CEIL(120, ns); /* W0 = 120nS */
14726 + writel(tmp, &eir->prog_waitcount); /* 0x01020a0c for a 100Mhz clock */
14727 +
14728 + uart.baud_base = 13500000 / 16;
14729 + uart.iomem_reg_shift = 0;
14730 + uart.iomem_base = (u8 *) KSEG1ADDR(base);
14731 +#endif
14732 + } else if (cc) {
14733 + uint32 rev, cap, pll_type, tmp;
14734 +
14735 + /* Determine core revision */
14736 + sb = (sbconfig_t *)((unsigned int) cc + SBCONFIGOFF);
14737 + rev = readl(&sb->sbidhigh) & SBIDH_RC_MASK;
14738 + cap = readl(&cc->capabilities);
14739 + pll_type = cap & CAP_PLL_MASK;
14740 +
14741 + /* Determine internal UART clock source */
14742 + if (bcm_chipid ==BCM5365_DEVICE_ID) {
14743 +#ifdef CONFIG_BCM5XXX_FPGA
14744 + uart.baud_base = 2000000;
14745 +#else
14746 + uart.baud_base = 1850000;
14747 +#endif
14748 + }else if (pll_type ==0x0010000) {
14749 + /* PLL clock */
14750 + uart.baud_base = sb_clock_rate(pll_type, readl(&cc->clockcontrol_n),
14751 + readl(&cc->clockcontrol_m2));
14752 + sbclock = mipsclock = hz = sb_clock_rate(pll_type, readl(&cc->clockcontrol_n),
14753 + readl(&cc->clockcontrol_sb));
14754 + } else {
14755 + uint32 div;
14756 +
14757 + sbclock = hz = sb_clock_rate(pll_type, readl(&cc->clockcontrol_n),
14758 + readl(&cc->clockcontrol_sb));
14759 + mipsclock = sb_clock_rate(pll_type, readl(&cc->clockcontrol_n),
14760 + readl(&cc->clockcontrol_mips));
14761 + /* Internal backplane clock */
14762 + if (rev >= 3) {
14763 + uart.baud_base = sbclock;
14764 + div = uart.baud_base / 1843200;
14765 + writel(div, &cc->uart_clkdiv);
14766 + } else {
14767 + uart.baud_base = 88000000;
14768 + div = 48;
14769 + }
14770 + if ((rev > 0) && ((readl(&cc->corecontrol) & CC_UARTCLKO) == 0)) {
14771 + /* If UartClkOvveride is not set then t depends on strapping
14772 + * as reflected by the UCLKSEL field;
14773 + */
14774 + if ((cap & CAP_UCLKSEL) == CAP_UINTCLK) {
14775 + /* Internal divided backplane clock */
14776 + uart.baud_base /= div;
14777 + } else {
14778 + /* Assume external clock of 1.8432 MHz */
14779 + uart.baud_base = 1843200;
14780 + }
14781 + }
14782 + }
14783 + ns = 1000000000 / hz;
14784 +
14785 +#if 0
14786 + /* Set timing for the flash */
14787 + tmp = CEIL(10, ns) << FW_W3_SHIFT; /* W3 = 10nS */
14788 + tmp |= CEIL(10, ns) << FW_W1_SHIFT; /* W1 = 10nS */
14789 + tmp |= CEIL(120, ns); /* W0 = 120nS */
14790 + writel(tmp, &cc->parallelflashwaitcnt);
14791 +#endif
14792 +
14793 + writel(tmp, &cc->cs01memwaitcnt);
14794 +
14795 + uart.baud_base /= 16;
14796 + uart.iomem_reg_shift = 0;
14797 +#if 1
14798 +#warning "UART base Fix copied from linux "
14799 +#define UART_BASE 0xb8000400
14800 + uart.iomem_base = (u8 *) UART_BASE;
14801 +#if 0
14802 + if (rev)
14803 + uart.iomem_base = (u8 *) &cc->uart0data + (uart.line * 256);
14804 + else
14805 + uart.iomem_base = (u8 *) &cc->uart0data + (uart.line * 8);
14806 +#endif
14807 +#else
14808 + uart.iomem_base = (u8 *) &cc->uart0data;
14809 +#endif
14810 + }
14811 +
14812 + loops_per_jiffy = 5 * (mipsclock / 1000);
14813 +
14814 + /* Set baud and 8N1 */
14815 + quot = uart.baud_base / baud;
14816 + serial_out(&uart, UART_LCR, UART_LCR_DLAB);
14817 + serial_out(&uart, UART_DLL, quot & 0xff);
14818 + serial_out(&uart, UART_DLM, quot >> 8);
14819 + serial_out(&uart, UART_LCR, UART_LCR_WLEN8);
14820 +}
14821 +
14822 +static void
14823 +reset_usb(chipcregs_t *cc, void *usb)
14824 +{
14825 +#if defined(CONFIG_USB_OHCI) || defined(CONFIG_USBDEV)
14826 + sbconfig_t *sb;
14827 +
14828 + sb = (sbconfig_t *)((unsigned int) usb + SBCONFIGOFF);
14829 + if ((readl(&cc->intstatus) & 0x80000000) == 0 &&
14830 + (readl(&sb->sbidhigh) & SBIDH_RC_MASK) == 1) {
14831 + /* Reset USB host core into sane state */
14832 + writel((1 << 29) | SBTML_RESET | SBTML_CLK, &sb->sbtmstatelow);
14833 + udelay(10);
14834 + /* Reset USB device core into sane state */
14835 + writel(SBTML_RESET | SBTML_CLK, &sb->sbtmstatelow);
14836 + udelay(10);
14837 + /* Reset backplane to 96 MHz */
14838 + writel(0x0303, &cc->clockcontrol_n);
14839 + writel(0x04020011, &cc->clockcontrol_sb);
14840 + writel(0x11030011, &cc->clockcontrol_pci);
14841 + writel(0x01050811, &cc->clockcontrol_m2);
14842 + writel(1, &cc->watchdog);
14843 + while (1);
14844 + }
14845 +#endif
14846 +}
14847 +
14848 +static void
14849 +error(char *x)
14850 +{
14851 + puts("\n\n");
14852 + puts(x);
14853 + puts("\n\n -- System halted");
14854 +
14855 + while(1); /* Halt */
14856 +}
14857 +
14858 +
14859 +/*
14860 + * gzip declarations
14861 + */
14862 +
14863 +#define OF(args) args
14864 +#define STATIC static
14865 +
14866 +#undef memset
14867 +#undef memcpy
14868 +#define memzero(s, n) memset ((s), 0, (n))
14869 +
14870 +typedef unsigned char uch;
14871 +typedef unsigned short ush;
14872 +typedef unsigned long ulg;
14873 +
14874 +#define WSIZE 0x8000 /* Window size must be at least 32k, */
14875 + /* and a power of two */
14876 +
14877 +static uch *inbuf; /* input buffer */
14878 +static ulg tmp;
14879 +static uch window[WSIZE]; /* Sliding window buffer */
14880 +
14881 +static unsigned insize; /* valid bytes in inbuf */
14882 +static unsigned inptr; /* index of next byte to be processed in inbuf */
14883 +static unsigned outcnt; /* bytes in output buffer */
14884 +
14885 +/* gzip flag byte */
14886 +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
14887 +#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
14888 +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
14889 +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
14890 +#define COMMENT 0x10 /* bit 4 set: file comment present */
14891 +#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
14892 +#define RESERVED 0xC0 /* bit 6,7: reserved */
14893 +
14894 +extern uch input_data[];
14895 +extern int input_len;
14896 +extern char text_start[], text_end[];
14897 +extern char data_start[], data_end[];
14898 +extern char bss_start[], bss_end[];
14899 +
14900 +static inline uch
14901 +get_byte(void)
14902 +{
14903 + if (sflash) {
14904 +#if 0
14905 + uch c;
14906 + sflash_read(cc, inptr++, 1, &c);
14907 + return c;
14908 +#endif
14909 + } else {
14910 + if ((inptr % 4) == 0)
14911 + tmp = *((ulg *) &inbuf[inptr]);
14912 + return ((uch *) &tmp)[inptr++ % 4];
14913 + }
14914 +}
14915 +
14916 +/* Diagnostic functions */
14917 +#ifdef DEBUG
14918 +# define Assert(cond,msg) {if(!(cond)) error(msg);}
14919 +# define Trace(x) fprintf x
14920 +# define Tracev(x) {if (verbose) fprintf x ;}
14921 +# define Tracevv(x) {if (verbose>1) fprintf x ;}
14922 +# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
14923 +# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
14924 +#else
14925 +# define Assert(cond,msg)
14926 +# define Trace(x)
14927 +# define Tracev(x)
14928 +# define Tracevv(x)
14929 +# define Tracec(c,x)
14930 +# define Tracecv(c,x)
14931 +#endif
14932 +
14933 +static void flush_window(void);
14934 +static void error(char *m);
14935 +static void gzip_mark(void **);
14936 +static void gzip_release(void **);
14937 +
14938 +static uch *output_data;
14939 +static ulg output_ptr;
14940 +static ulg bytes_out;
14941 +
14942 +static void *malloc(int size);
14943 +static void free(void *where);
14944 +static void error(char *m);
14945 +static void gzip_mark(void **);
14946 +static void gzip_release(void **);
14947 +
14948 +static void puts(const char *);
14949 +
14950 +extern int end;
14951 +static ulg free_mem_ptr;
14952 +static ulg free_mem_ptr_end;
14953 +
14954 +#define HEAP_SIZE 0x2000
14955 +
14956 +#include "../../../../../lib/inflate.c"
14957 +
14958 +static void *
14959 +malloc(int size)
14960 +{
14961 + void *p;
14962 +
14963 + if (size <0) error("Malloc error\n");
14964 + if (free_mem_ptr <= 0) error("Memory error\n");
14965 +
14966 + free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
14967 +
14968 + p = (void *)free_mem_ptr;
14969 + free_mem_ptr += size;
14970 +
14971 + if (free_mem_ptr >= free_mem_ptr_end)
14972 + error("Out of memory");
14973 + return p;
14974 +}
14975 +
14976 +static void
14977 +free(void *where)
14978 +{ /* gzip_mark & gzip_release do the free */
14979 +}
14980 +
14981 +static void
14982 +gzip_mark(void **ptr)
14983 +{
14984 + *ptr = (void *) free_mem_ptr;
14985 +}
14986 +
14987 +static void
14988 +gzip_release(void **ptr)
14989 +{
14990 + free_mem_ptr = (long) *ptr;
14991 +}
14992 +
14993 +void*
14994 +memset(void* s, int c, size_t n)
14995 +{
14996 + int i;
14997 + char *ss = (char*)s;
14998 +
14999 + for (i=0;i<n;i++) ss[i] = c;
15000 + return s;
15001 +}
15002 +
15003 +void*
15004 +memcpy(void* __dest, __const void* __src, size_t __n)
15005 +{
15006 + int i;
15007 + char *d = (char *)__dest, *s = (char *)__src;
15008 +
15009 + for (i=0;i<__n;i++) d[i] = s[i];
15010 + return __dest;
15011 +}
15012 +
15013 +/* ===========================================================================
15014 + * Write the output window window[0..outcnt-1] and update crc and bytes_out.
15015 + * (Used for the decompressed data only.)
15016 + */
15017 +void
15018 +flush_window(void)
15019 +{
15020 + ulg c = crc;
15021 + unsigned n;
15022 + uch *in, *out, ch;
15023 +
15024 + in = window;
15025 + out = &output_data[output_ptr];
15026 + for (n = 0; n < outcnt; n++) {
15027 + ch = *out++ = *in++;
15028 + c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
15029 + }
15030 + crc = c;
15031 + bytes_out += (ulg)outcnt;
15032 + output_ptr += (ulg)outcnt;
15033 + outcnt = 0;
15034 + puts(".");
15035 +}
15036 +
15037 +static void
15038 +decompress_kernel(void)
15039 +{
15040 +#if 1 /* Fix Me */
15041 + inbuf = (uch *) 0x80500000;
15042 +#else
15043 + /* Decompress from flash */
15044 + inbuf = (uch *) KSEG1ADDR(0x1fc00000);
15045 +#endif
15046 + insize = input_len;
15047 + inptr = (unsigned) input_data - (unsigned) text_start;
15048 + output_data = (uch *) LOADADDR;
15049 + free_mem_ptr = (ulg) bss_end;
15050 + free_mem_ptr_end = (ulg) bss_end + 0x100000;
15051 +
15052 + makecrc();
15053 + puts("Uncompressing Linux...");
15054 +
15055 + gunzip();
15056 +
15057 + puts("done, booting the kernel.\n");
15058 +
15059 +#if 0
15060 + /* Flush all caches */
15061 + blast_dcache();
15062 + blast_icache();
15063 +#endif
15064 +
15065 + /* Jump to kernel */
15066 + ((void (*)(void)) LOADADDR)();
15067 +}
15068 +
15069 +#if 0
15070 +static void
15071 +sflash_self(chipcregs_t *cc)
15072 +{
15073 + unsigned char *start = text_start;
15074 + unsigned char *end = data_end;
15075 + unsigned char *cur = start;
15076 + unsigned int erasesize, len;
15077 +
15078 + while (cur < end) {
15079 + /* Erase sector */
15080 + puts("Erasing sector 0x");
15081 + puthex(cur - start);
15082 + puts("...");
15083 + if ((erasesize = sflash_erase(cc, cur - start)) < 0) {
15084 + puts("error\n");
15085 + break;
15086 + }
15087 + while (sflash_poll(cc, cur - start));
15088 + puts("done\n");
15089 +
15090 + /* Write sector */
15091 + puts("Writing sector 0x");
15092 + puthex(cur - start);
15093 + puts("...");
15094 + while (erasesize) {
15095 + if ((len = sflash_write(cc, cur - start, erasesize, cur)) < 0)
15096 + break;
15097 + while (sflash_poll(cc, cur - start));
15098 + cur += len;
15099 + erasesize -= len;
15100 + }
15101 + if (erasesize) {
15102 + puts("error\n");
15103 + break;
15104 + }
15105 + puts("done\n");
15106 + }
15107 +}
15108 +
15109 +static void
15110 +_change_cachability(u32 cm)
15111 +{
15112 + u32 prid;
15113 +
15114 + change_c0_config(CONF_CM_CMASK, cm);
15115 + prid = read_c0_prid();
15116 + if ((prid & (PRID_COMP_MASK | PRID_IMP_MASK)) ==
15117 + (PRID_COMP_BROADCOM | PRID_IMP_BCM3302)) {
15118 + cm = read_c0_diag();
15119 + /* Enable icache */
15120 + cm |= (1 << 31);
15121 + /* Enable dcache */
15122 + cm |= (1 << 30);
15123 + write_c0_diag(cm);
15124 + }
15125 +}
15126 +static void (*change_cachability)(u32);
15127 +
15128 +#define HANDLER_ADDR 0xa0000180
15129 +
15130 +void
15131 +handler(void)
15132 +{
15133 + /* enable interrupts */
15134 + clear_c0_status(IE_IRQ5 | IE_IRQ4 | IE_IRQ3 | IE_IRQ2 | IE_IRQ1 | IE_IRQ0 | ST0_IE);
15135 +
15136 + __asm__ __volatile__ (".set\tmips32\n\t"
15137 + "ssnop\n\t"
15138 + "ssnop\n\t"
15139 + "eret\n\t"
15140 + "nop\n\t"
15141 + "nop\n\t"
15142 + ".set\tmips0"); /* step 11 */
15143 +}
15144 +/* The followint MUST come right after handler() */
15145 +void
15146 +afterhandler(void)
15147 +{
15148 +}
15149 +
15150 +#define BCM4704_DEFAULT_MIPS_CLOCK 200000000
15151 +static unsigned int target_mips_clock = 264000000;
15152 +static unsigned int target_sb_clock = 132000000;
15153 +
15154 +typedef struct {
15155 + uint32 mipsclock;
15156 + uint32 sbclock;
15157 + uint16 n;
15158 + uint32 sb;
15159 + uint32 pci;
15160 + uint32 m2;
15161 + uint32 m3;
15162 + uint ratio;
15163 + uint32 ratio_parm;
15164 +} sb_clock_table_t;
15165 +
15166 +static sb_clock_table_t sb_clock_table[] = {
15167 + { 180000000, 90000000, 0x0403, 0x02000002, 0x00000002, 0x02000002, 0x06000002, 0x21, 0x0aaa0555},
15168 + { 200000000, 100000000, 0x0303, 0x02010000, 0x02040001, 0x02010000, 0x06000001, 0x21, 0x0aaa0555},
15169 + { 264000000, 132000000, 0x0903, 0x02000003, 0x04000702, 0x02000003, 0x06000003, 0x21, 0x0aaa0555},
15170 + { 280000000, 140000000, 0x0503, 0x02010000, 0x00010001, 0x02010000, 0x06000001, 0x21, 0x0aaa0555},
15171 + { 288000000, 144000000, 0x0404, 0x02010000, 0x00010001, 0x02010000, 0x06000001, 0x21, 0x0aaa0555},
15172 + { 300000000, 150000000, 0x0803, 0x02000002, 0x00010002, 0x02000002, 0x06000002, 0x21, 0x0aaa0555},
15173 + { 180000000, 80000000, 0x0403, 0x02010001, 0x00000002, 0x00010101, 0x06000002, 0x49, 0x012A00A9},
15174 + { 234000000, 104000000, 0x0b01, 0x02010001, 0x04000204, 0x00010101, 0x06000002, 0x49, 0x01250125},
15175 + { 300000000, 133333333, 0x0803, 0x02010001, 0x00010101, 0x00010101, 0x06000002, 0x49, 0x012a0115},
15176 + { 0 }
15177 +};
15178 +
15179 +void
15180 +change_clock(void)
15181 +{
15182 + int c;
15183 + u32 s, e, d, i, tmp, ratio_parm;
15184 + sb_clock_table_t *cte, *ccte = NULL, *tcte = NULL;
15185 +
15186 + /* Change the clock and reboot if needed */
15187 + /* Gross hack for now to go all the way */
15188 + if (chipid == BCM4704_DEVICE_ID) {
15189 + if (mipsclock != BCM4704_DEFAULT_MIPS_CLOCK) {
15190 + target_mips_clock = mipsclock;
15191 + target_sb_clock = sbclock;
15192 + }
15193 + if ((mipsclock != target_mips_clock) || (sbclock != target_sb_clock)) {
15194 + for (cte = sb_clock_table; cte->mipsclock; cte++) {
15195 + if ((cte->mipsclock == mipsclock) && (cte->sbclock == sbclock))
15196 + ccte = cte;
15197 + if ((cte->mipsclock == target_mips_clock) && (cte->sbclock == target_sb_clock))
15198 + tcte = cte;
15199 + }
15200 +
15201 + if ((ccte == NULL) || (tcte == NULL)) {
15202 + puts("\nCould not figure out current or target settings");
15203 + goto nochange;
15204 + }
15205 +
15206 + puts("Run at ");
15207 + putdec(tcte->mipsclock);
15208 + putc('/');
15209 + putdec(tcte->sbclock);
15210 + putc('?');
15211 + c = 'y';
15212 + for (i = 50; i; i--) {
15213 + if (keyhit()) {
15214 + c = getc() | 0x20;
15215 + break;
15216 + }
15217 + if ((i % 10) == 0)
15218 + putc('.');
15219 + mdelay(100);
15220 + }
15221 + if (c != 'y') {
15222 + for (i = 0, cte = sb_clock_table; cte->mipsclock; i++, cte++) {
15223 + puts("\n [");
15224 + putdec(i);
15225 + puts("] = ");
15226 + putdec(cte->mipsclock);
15227 + putc('/');
15228 + putdec(cte->sbclock);
15229 + if (cte == tcte)
15230 + putc('*');
15231 + }
15232 +
15233 + while (1) {
15234 + puts("\nChange to ?");
15235 + c = getc() - '0';
15236 + if ((c >= 0) && (c < i))
15237 + tcte = &sb_clock_table[c];
15238 + else {
15239 + puts("\nPlase type a number from 0 to ");
15240 + putdec(i - 1);
15241 + continue;
15242 + }
15243 + target_mips_clock = tcte->mipsclock;
15244 + target_sb_clock = tcte->sbclock;
15245 + puts("\nChanging to ");
15246 + putdec(tcte->mipsclock);
15247 + putc('/');
15248 + putdec(tcte->sbclock);
15249 + puts(", ok?");
15250 + c = getc() | 0x20;
15251 + if (c == 'y')
15252 + break;
15253 + }
15254 + }
15255 + if (tcte == ccte)
15256 + goto nochange;
15257 +
15258 + /* Set the pll controls now */
15259 + writel(tcte->n, &cc->clockcontrol_n);
15260 + writel(tcte->sb, &cc->clockcontrol_sb);
15261 + writel(tcte->pci, &cc->clockcontrol_pci);
15262 + writel(tcte->m2, &cc->clockcontrol_m2);
15263 + writel(tcte->m3, &cc->clockcontrol_mips);
15264 +
15265 + if (tcte->ratio_parm != ccte->ratio_parm) {
15266 + puts("\nChanging ratio_parm to 0x");
15267 + puthex(tcte->ratio_parm);
15268 + puts(", type new one to override: ");
15269 + ratio_parm = 0;
15270 + while (1) {
15271 + c = getc() & 0x7f;
15272 + putc(c);
15273 + if ((c == 'x') || (c == 'X')) {
15274 + ratio_parm = 0;
15275 + continue;
15276 + }
15277 + if ((c >= '0') && (c <= '9')) {
15278 + ratio_parm = (ratio_parm << 4) + (c - '0');
15279 + continue;
15280 + }
15281 + c &= ~0x20;
15282 + if ((c >= 'A') && (c <= 'F'))
15283 + ratio_parm = (ratio_parm << 4) + (c - 'A' + 10);
15284 + else
15285 + break;
15286 + }
15287 + putc('\n');
15288 +
15289 + if (ratio_parm == 0)
15290 + ratio_parm = tcte->ratio_parm;
15291 +
15292 + /* Preload the code in the cache */
15293 + s = ((u32)&&start_fill) & ~(ic_lsize - 1);
15294 + e = (((u32)&&end_fill) + (ic_lsize - 1)) & ~(ic_lsize - 1);
15295 + while (s < e) {
15296 + cache_unroll(s, Fill);
15297 + s += ic_lsize;
15298 + }
15299 +
15300 + /* Copy the handler & preload it into the cache */
15301 + s = (u32)&handler;
15302 + e = (u32)&afterhandler;
15303 + d = HANDLER_ADDR;
15304 + while (s < e) {
15305 + for (i = 0; i < ic_lsize; i += 4) {
15306 + *(long*)(d + i) = *(long *)(s + i);
15307 + }
15308 + cache_unroll(d, Fill);
15309 + s += ic_lsize;
15310 + d += ic_lsize;
15311 + }
15312 +
15313 + /* Clear BEV bit */
15314 + clear_c0_status(ST0_BEV);
15315 +
15316 + /* enable interrupts */
15317 + set_c0_status(IE_IRQ4 | IE_IRQ3 | IE_IRQ2 | IE_IRQ1 | IE_IRQ0 | ST0_IE);
15318 + /* enable timer interrupts */
15319 + writel(1, &mipsr->intmask);
15320 +
15321 +start_fill:
15322 + /* step 1, set clock ratios */
15323 + write_c0_diag3(ratio_parm);
15324 + write_c0_diag1(8);
15325 +
15326 + /* step 2: program timer intr */
15327 + writel(100, &mipsr->timer);
15328 + tmp = readl(&mipsr->timer); /* read it back to sync */
15329 +
15330 + /* step 3, switch to async */
15331 + write_c0_diag4(1 << 22);
15332 +
15333 + /* step 4, set cfg active */
15334 + write_c0_diag2(0x9);
15335 +
15336 + /* steps 5 & 6 */
15337 + __asm__ __volatile__(".set\tmips3\n\t"
15338 + "wait\n\t"
15339 + ".set\tmips0");
15340 +
15341 + /* step 7, clear cfg_active */
15342 + write_c0_diag2(0);
15343 +
15344 + /* step 8, fake soft reset */
15345 + write_c0_diag5(read_c0_diag5() | 4);
15346 + }
15347 +
15348 + /* step 9 set watchdog timer */
15349 + writel(20, &cc->watchdog);
15350 + tmp = readl(&cc->chipid); /* dummy read */
15351 +
15352 + /* step 11 */
15353 + __asm__ __volatile__(".set\tmips3\n\t"
15354 + "sync\n\t"
15355 + "wait\n\t"
15356 + ".set\tmips0");
15357 + while (1);
15358 + } else {
15359 +end_fill:
15360 +nochange:
15361 + puts("\nNot changing clock. mips=");
15362 + putdec(target_mips_clock);
15363 + putc('/');
15364 + putdec(target_sb_clock);
15365 + putc('\n');
15366 + }
15367 + } else {
15368 + puts("Not a 4704, not changing clock\n");
15369 + }
15370 +}
15371 +#endif
15372 +
15373 +void
15374 +c_main(unsigned long ra)
15375 +{
15376 + /* Disable interrupts */
15377 + clear_c0_status(1);
15378 +
15379 + /* Scan backplane */
15380 + sb_scan();
15381 +
15382 +// if (cc && usb && PHYSADDR(ra) >= 0x1fc00000)
15383 + reset_usb(cc, usb);
15384 +
15385 +
15386 + /* Determine chip ID and revision */
15387 + if (cc) {
15388 + bcm_chipid = readl(&cc->chipid) & CID_ID_MASK;
15389 + bcm_chiprev = (readl(&cc->chipid) & CID_REV_MASK) >> CID_REV_SHIFT;
15390 + }
15391 +
15392 + /* Initialize UART */
15393 + uart_init(115200);
15394 +#if 0
15395 + puts("\nSelf-booting Linux running on a ");
15396 + puthex(chipid);
15397 + puts(" Rev. ");
15398 + putdec(chiprev);
15399 + puts(" @ ");
15400 + putdec(mipsclock);
15401 + putc('/');
15402 + putdec(sbclock);
15403 + putc('\n');
15404 +
15405 + puts("CP0 PRID: 0x");
15406 + puthex(read_c0_prid());
15407 + putc('\n');
15408 + puts("CP0 Conf: 0x");
15409 + puthex(read_c0_conf());
15410 + putc('\n');
15411 + puts("CP0 Info: 0x");
15412 + puthex(read_c0_info());
15413 + putc('\n');
15414 + puts("CP0 Status: 0x");
15415 + puthex(read_c0_status());
15416 + putc('\n');
15417 + puts("CP0 Cause: 0x");
15418 + puthex(read_c0_cause());
15419 + putc('\n');
15420 + puts("CP0 Config: 0x");
15421 + puthex(read_c0_config());
15422 + putc('\n');
15423 + puts("CP0 Config1: 0x");
15424 + puthex(read_c0_config1());
15425 + putc('\n');
15426 + if (mipscore == SB_MIPS33)
15427 + puts("CP0 Reg22: sel0/1/2/3/4/5:\n ");
15428 + else
15429 + puts("CP0 Reg22: 0x");
15430 + puthex(read_c0_diag());
15431 + if (mipscore == SB_MIPS33) {
15432 + puts("\n ");
15433 + puthex(read_c0_diag1());
15434 + puts("\n ");
15435 + puthex(read_c0_diag2());
15436 + puts("\n ");
15437 + puthex(read_c0_diag3());
15438 + puts("\n ");
15439 + puthex(read_c0_diag4());
15440 + puts("\n ");
15441 + puthex(read_c0_diag5());
15442 + }
15443 + putc('\n');
15444 +
15445 + if (memc) {
15446 + puts("memc config: 0x");
15447 + puthex(readl(&memc->config));
15448 + putc('\n');
15449 + puts("memc mode: 0x");
15450 + puthex(readl(&memc->modebuf));
15451 + putc('\n');
15452 + puts("memc wrncdl: 0x");
15453 + puthex(readl(&memc->wrncdlcor));
15454 + putc('\n');
15455 + puts("memc rdncdl: 0x");
15456 + puthex(readl(&memc->rdncdlcor));
15457 + putc('\n');
15458 + puts("memc miscdly: 0x");
15459 + puthex(readl(&memc->miscdlyctl));
15460 + putc('\n');
15461 + puts("memc dqsgate: 0x");
15462 + puthex(readl(&memc->dqsgatencdl));
15463 + putc('\n');
15464 + }
15465 +#endif
15466 +#if 0
15467 + /* Switch back to sync */
15468 + write_c0_diag4(0);
15469 +#endif
15470 +#if 1
15471 +#warning "Fix cache init "
15472 +#else
15473 + /* Must be in KSEG1 to change cachability */
15474 + cache_init();
15475 + change_cachability = (void (*)(u32)) KSEG1ADDR((unsigned long)(_change_cachability));
15476 + change_cachability(CONF_CM_CACHABLE_NONCOHERENT);
15477 +
15478 + /* Change clock if needed */
15479 + change_clock();
15480 +
15481 + /* Initialize serial flash */
15482 + sflash = cc ? sflash_init(cc) : NULL;
15483 +
15484 + if (sflash)
15485 + puts("sflash set???");
15486 +
15487 + /* Copy self to flash if we booted from SDRAM */
15488 + if (PHYSADDR(ra) < 0x1fc00000) {
15489 + if (sflash)
15490 + sflash_self(cc);
15491 + }
15492 +#endif
15493 +
15494 + /* Decompress kernel */
15495 + decompress_kernel();
15496 +}
15497 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/compressed/piggy.lnk linux-2.6.12.5-brcm/arch/mips/bcm47xx/compressed/piggy.lnk
15498 --- linux-2.6.12.5/arch/mips/bcm47xx/compressed/piggy.lnk 1970-01-01 01:00:00.000000000 +0100
15499 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/compressed/piggy.lnk 2005-08-28 11:12:20.504847904 +0200
15500 @@ -0,0 +1 @@
15501 +SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}
15502 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/compressed/vmlinux.lds linux-2.6.12.5-brcm/arch/mips/bcm47xx/compressed/vmlinux.lds
15503 --- linux-2.6.12.5/arch/mips/bcm47xx/compressed/vmlinux.lds 1970-01-01 01:00:00.000000000 +0100
15504 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/compressed/vmlinux.lds 2005-08-28 11:12:20.504847904 +0200
15505 @@ -0,0 +1,23 @@
15506 +OUTPUT_ARCH(mips)
15507 +ENTRY(startup)
15508 +SECTIONS {
15509 + . = 0x80500000 ;
15510 + .text : {
15511 + text_start = .;
15512 + *(.text)
15513 + *(.rodata)
15514 + text_end = .;
15515 + }
15516 +
15517 + .data : {
15518 + data_start = .;
15519 + *(.data)
15520 + data_end = .;
15521 + }
15522 +
15523 + .bss : {
15524 + bss_start = .;
15525 + *(.bss)
15526 + bss_end = .;
15527 + }
15528 +}
15529 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/compressed/vmlinux.lds.in linux-2.6.12.5-brcm/arch/mips/bcm47xx/compressed/vmlinux.lds.in
15530 --- linux-2.6.12.5/arch/mips/bcm47xx/compressed/vmlinux.lds.in 1970-01-01 01:00:00.000000000 +0100
15531 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/compressed/vmlinux.lds.in 2005-08-28 11:12:20.504847904 +0200
15532 @@ -0,0 +1,23 @@
15533 +OUTPUT_ARCH(mips)
15534 +ENTRY(startup)
15535 +SECTIONS {
15536 + . = TEXT_START;
15537 + .text : {
15538 + text_start = .;
15539 + *(.text)
15540 + *(.rodata)
15541 + text_end = .;
15542 + }
15543 +
15544 + .data : {
15545 + data_start = .;
15546 + *(.data)
15547 + data_end = .;
15548 + }
15549 +
15550 + .bss : {
15551 + bss_start = .;
15552 + *(.bss)
15553 + bss_end = .;
15554 + }
15555 +}
15556 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/int-handler.S linux-2.6.12.5-brcm/arch/mips/bcm47xx/int-handler.S
15557 --- linux-2.6.12.5/arch/mips/bcm47xx/int-handler.S 1970-01-01 01:00:00.000000000 +0100
15558 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/int-handler.S 2005-08-28 11:12:20.505847752 +0200
15559 @@ -0,0 +1,24 @@
15560 +#include <asm/asm.h>
15561 +#include <asm/mipsregs.h>
15562 +#include <asm/regdef.h>
15563 +#include <asm/stackframe.h>
15564 +
15565 + .text
15566 + .set noreorder
15567 + .set noat
15568 + .align 5
15569 +
15570 + NESTED(bcm47xx_irq_handler, PT_SIZE, sp)
15571 + SAVE_ALL
15572 + CLI
15573 +
15574 + .set at
15575 + .set noreorder
15576 +
15577 + jal bcm47xx_irq_dispatch
15578 + move a0, sp
15579 +
15580 + j ret_from_irq
15581 + nop
15582 +
15583 + END(bcm47xx_irq_handler)
15584 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/irq.c linux-2.6.12.5-brcm/arch/mips/bcm47xx/irq.c
15585 --- linux-2.6.12.5/arch/mips/bcm47xx/irq.c 1970-01-01 01:00:00.000000000 +0100
15586 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/irq.c 2005-08-28 11:12:20.505847752 +0200
15587 @@ -0,0 +1,52 @@
15588 +#include <linux/config.h>
15589 +#include <linux/errno.h>
15590 +#include <linux/init.h>
15591 +#include <linux/interrupt.h>
15592 +#include <linux/irq.h>
15593 +#include <linux/module.h>
15594 +#include <linux/smp.h>
15595 +#include <linux/types.h>
15596 +
15597 +#include <asm/cpu.h>
15598 +#include <asm/io.h>
15599 +#include <asm/irq.h>
15600 +#include <asm/irq_cpu.h>
15601 +#include <asm/gdb-stub.h>
15602 +
15603 +extern asmlinkage void bcm47xx_irq_handler(void);
15604 +
15605 +void bcm47xx_irq_dispatch(struct pt_regs *regs)
15606 +{
15607 + u32 cause;
15608 +
15609 + cause = read_c0_cause() & read_c0_status() & CAUSEF_IP;
15610 +
15611 +#ifdef CONFIG_KERNPROF
15612 + change_c0_status(cause | 1, 1);
15613 +#else
15614 + clear_c0_status(cause);
15615 +#endif
15616 +
15617 + if (cause & CAUSEF_IP7)
15618 + do_IRQ(7, regs);
15619 + if (cause & CAUSEF_IP2)
15620 + do_IRQ(2, regs);
15621 + if (cause & CAUSEF_IP3)
15622 + do_IRQ(3, regs);
15623 + if (cause & CAUSEF_IP4)
15624 + do_IRQ(4, regs);
15625 + if (cause & CAUSEF_IP5)
15626 + do_IRQ(5, regs);
15627 + if (cause & CAUSEF_IP6)
15628 + do_IRQ(6, regs);
15629 +}
15630 +
15631 +void __init arch_init_irq(void)
15632 +{
15633 + set_except_vector(0, bcm47xx_irq_handler);
15634 + mips_cpu_irq_init(0);
15635 +
15636 +// printk("Breaking into debugger...\n");
15637 +// set_debug_traps();
15638 +// breakpoint();
15639 +}
15640 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/prom.c linux-2.6.12.5-brcm/arch/mips/bcm47xx/prom.c
15641 --- linux-2.6.12.5/arch/mips/bcm47xx/prom.c 1970-01-01 01:00:00.000000000 +0100
15642 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/prom.c 2005-08-28 11:12:20.505847752 +0200
15643 @@ -0,0 +1,35 @@
15644 +#include <linux/init.h>
15645 +#include <linux/mm.h>
15646 +#include <linux/sched.h>
15647 +#include <linux/bootmem.h>
15648 +
15649 +#include <asm/addrspace.h>
15650 +#include <asm/bootinfo.h>
15651 +#include <asm/pmon.h>
15652 +
15653 +const char *get_system_type(void)
15654 +{
15655 + return "Broadcom BCM47xx";
15656 +}
15657 +
15658 +void __init prom_init(void)
15659 +{
15660 + unsigned long mem;
15661 +
15662 + mips_machgroup = MACH_GROUP_BRCM;
15663 + mips_machtype = MACH_BCM47XX;
15664 +
15665 + /* Figure out memory size by finding aliases */
15666 + for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) {
15667 + if (*(unsigned long *)((unsigned long)(prom_init) + mem) ==
15668 + *(unsigned long *)(prom_init))
15669 + break;
15670 + }
15671 +
15672 + add_memory_region(0, mem, BOOT_MEM_RAM);
15673 +}
15674 +
15675 +unsigned long __init prom_free_prom_memory(void)
15676 +{
15677 + return 0;
15678 +}
15679 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/setup.c linux-2.6.12.5-brcm/arch/mips/bcm47xx/setup.c
15680 --- linux-2.6.12.5/arch/mips/bcm47xx/setup.c 1970-01-01 01:00:00.000000000 +0100
15681 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/setup.c 2005-08-28 11:12:20.506847600 +0200
15682 @@ -0,0 +1,111 @@
15683 +#include <linux/init.h>
15684 +#include <linux/types.h>
15685 +#include <linux/tty.h>
15686 +#include <linux/serial.h>
15687 +#include <linux/serial_core.h>
15688 +#include <linux/serial_reg.h>
15689 +#include <asm/time.h>
15690 +#include <asm/reboot.h>
15691 +
15692 +#include <typedefs.h>
15693 +#include <sbutils.h>
15694 +#include <sbmips.h>
15695 +#include <sbpci.h>
15696 +#include <sbconfig.h>
15697 +#include <bcmdevs.h>
15698 +
15699 +// #include <ssbcore.h>
15700 +
15701 +#if 1
15702 +
15703 +//#define SER_PORT1(reg) (*((volatile unsigned char *)(0xbf800000+reg)))
15704 +#define SER_PORT1(reg) (*((volatile unsigned char *)(0xb8000400+reg)))
15705 +
15706 +int putDebugChar(char c)
15707 +{
15708 + while (!(SER_PORT1(UART_LSR) & UART_LSR_THRE));
15709 + SER_PORT1(UART_TX) = c;
15710 +
15711 + return 1;
15712 +}
15713 +
15714 +char getDebugChar(void)
15715 +{
15716 + while (!(SER_PORT1(UART_LSR) & 1));
15717 + return SER_PORT1(UART_RX);
15718 +}
15719 +
15720 +
15721 +static int ser_line = 0;
15722 +
15723 +static void
15724 +serial_add(void *regs, uint irq, uint baud_base, uint reg_shift)
15725 +{
15726 + struct uart_port s;
15727 +
15728 + memset(&s, 0, sizeof(s));
15729 +
15730 + s.line = ser_line++;
15731 + s.membase = regs;
15732 + s.irq = irq + 2;
15733 + s.uartclk = baud_base;
15734 + //s.baud_base = baud_base / 16;
15735 + //s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | UPF_RESOURCES | ASYNC_AUTO_IRQ;
15736 + s.flags = ASYNC_BOOT_AUTOCONF;
15737 + s.iotype = SERIAL_IO_MEM;
15738 + s.regshift = reg_shift;
15739 +
15740 + if (early_serial_setup(&s) != 0) {
15741 + printk(KERN_ERR "Serial setup failed!\n");
15742 + }
15743 +}
15744 +#endif
15745 +
15746 +extern void bcm47xx_time_init(void);
15747 +extern void bcm47xx_timer_setup(struct irqaction *irq);
15748 +
15749 +void *nvram_get(char *foo)
15750 +{
15751 + return NULL;
15752 +}
15753 +
15754 +void *sbh;
15755 +
15756 +static void bcm47xx_machine_restart(char *command)
15757 +{
15758 + /* Set the watchdog timer to reset immediately */
15759 + cli();
15760 + sb_watchdog(sbh, 1);
15761 + while (1);
15762 +}
15763 +
15764 +static void bcm47xx_machine_halt(void)
15765 +{
15766 + /* Disable interrupts and watchdog and spin forever */
15767 + cli();
15768 + sb_watchdog(sbh, 0);
15769 + while (1);
15770 +}
15771 +
15772 +//static struct sb_bus bus;
15773 +
15774 +static int __init bcm47xx_init(void)
15775 +{
15776 +// sb_bus_add(&bus, SB_BUS, (void *)SB_ENUM_BASE, SB_ENUM_LIM - SB_ENUM_BASE, "bcm47xx", NULL);
15777 +
15778 + sbh = sb_kattach();
15779 + sb_mips_init(sbh);
15780 + sbpci_init(sbh);
15781 + sb_serial_init(sbh, serial_add);
15782 +
15783 + _machine_restart = bcm47xx_machine_restart;
15784 + _machine_halt = bcm47xx_machine_halt;
15785 + _machine_power_off = bcm47xx_machine_halt;
15786 +
15787 + board_time_init = bcm47xx_time_init;
15788 + board_timer_setup = bcm47xx_timer_setup;
15789 +
15790 + return 0;
15791 +}
15792 +
15793 +early_initcall(bcm47xx_init);
15794 diff -Nur linux-2.6.12.5/arch/mips/bcm47xx/time.c linux-2.6.12.5-brcm/arch/mips/bcm47xx/time.c
15795 --- linux-2.6.12.5/arch/mips/bcm47xx/time.c 1970-01-01 01:00:00.000000000 +0100
15796 +++ linux-2.6.12.5-brcm/arch/mips/bcm47xx/time.c 2005-08-28 11:12:20.506847600 +0200
15797 @@ -0,0 +1,74 @@
15798 +#include <linux/config.h>
15799 +#include <linux/init.h>
15800 +#include <linux/kernel.h>
15801 +#include <linux/sched.h>
15802 +#include <linux/serial_reg.h>
15803 +#include <linux/interrupt.h>
15804 +#include <asm/addrspace.h>
15805 +#include <asm/io.h>
15806 +#include <asm/time.h>
15807 +
15808 +//#include <typedefs.h>
15809 +//#include <bcmnvram.h>
15810 +//#include <sbconfig.h>
15811 +//#include <sbextif.h>
15812 +//#include <sbutils.h>
15813 +
15814 +/* Global SB handle */
15815 +//extern void *bcm947xx_sbh;
15816 +//extern spinlock_t bcm947xx_sbh_lock;
15817 +
15818 +/* Convenience */
15819 +//#define sbh bcm947xx_sbh
15820 +//#define sbh_lock bcm947xx_sbh_lock
15821 +
15822 +//extern int panic_timeout;
15823 +//static int watchdog = 0;
15824 +//static u8 *mcr = NULL;
15825 +
15826 +void __init
15827 +bcm47xx_time_init(void)
15828 +{
15829 + unsigned int hz;
15830 +// extifregs_t *eir;
15831 +
15832 + /*
15833 + * Use deterministic values for initial counter interrupt
15834 + * so that calibrate delay avoids encountering a counter wrap.
15835 + */
15836 + write_c0_count(0);
15837 + write_c0_compare(0xffff);
15838 +
15839 +// if (!(hz = sb_mips_clock(sbh)))
15840 +// hz = 100000000;
15841 + hz = 200 * 1000 * 1000;
15842 +
15843 +// printk("CPU: BCM%04x rev %d at %d MHz\n", sb_chip(sbh), sb_chiprev(sbh),
15844 +// (hz + 500000) / 1000000);
15845 +
15846 + /* Set MIPS counter frequency for fixed_rate_gettimeoffset() */
15847 + mips_hpt_frequency = hz / 2;
15848 +
15849 +#if 0
15850 + /* Set watchdog interval in ms */
15851 + watchdog = simple_strtoul(nvram_safe_get("watchdog"), NULL, 0);
15852 +
15853 + /* Set panic timeout in seconds */
15854 + panic_timeout = watchdog / 1000;
15855 + panic_timeout *= 10;
15856 +
15857 + /* Setup blink */
15858 + if ((eir = sb_setcore(sbh, SB_EXTIF, 0))) {
15859 + sbconfig_t *sb = (sbconfig_t *)((unsigned int) eir + SBCONFIGOFF);
15860 + unsigned long base = EXTIF_CFGIF_BASE(sb_base(readl(&sb->sbadmatch1)));
15861 + mcr = (u8 *) ioremap_nocache(base + UART_MCR, 1);
15862 + }
15863 +#endif
15864 +}
15865 +
15866 +void __init
15867 +bcm47xx_timer_setup(struct irqaction *irq)
15868 +{
15869 + /* Enable the timer interrupt */
15870 + setup_irq(7, irq);
15871 +}
15872 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
15873 --- linux-2.6.12.5/arch/mips/kernel/cpu-probe.c 2005-08-15 02:20:18.000000000 +0200
15874 +++ linux-2.6.12.5-brcm/arch/mips/kernel/cpu-probe.c 2005-08-28 11:12:20.538842736 +0200
15875 @@ -555,6 +555,28 @@
15876 }
15877 }
15878
15879 +static inline void cpu_probe_broadcom(struct cpuinfo_mips *c)
15880 +{
15881 + decode_config1(c);
15882 + switch (c->processor_id & 0xff00) {
15883 + case PRID_IMP_BCM3302:
15884 + c->cputype = CPU_BCM3302;
15885 + c->isa_level = MIPS_CPU_ISA_M32;
15886 + c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
15887 + MIPS_CPU_4KTLB | MIPS_CPU_COUNTER;
15888 + break;
15889 + case PRID_IMP_BCM4710:
15890 + c->cputype = CPU_BCM4710;
15891 + c->isa_level = MIPS_CPU_ISA_M32;
15892 + c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
15893 + MIPS_CPU_4KTLB | MIPS_CPU_COUNTER;
15894 + break;
15895 + default:
15896 + c->cputype = CPU_UNKNOWN;
15897 + break;
15898 + }
15899 +}
15900 +
15901 __init void cpu_probe(void)
15902 {
15903 struct cpuinfo_mips *c = &current_cpu_data;
15904 @@ -577,7 +599,9 @@
15905 case PRID_COMP_SIBYTE:
15906 cpu_probe_sibyte(c);
15907 break;
15908 -
15909 + case PRID_COMP_BROADCOM:
15910 + cpu_probe_broadcom(c);
15911 + break;
15912 case PRID_COMP_SANDCRAFT:
15913 cpu_probe_sandcraft(c);
15914 break;
15915 diff -Nur linux-2.6.12.5/arch/mips/kernel/head.S linux-2.6.12.5-brcm/arch/mips/kernel/head.S
15916 --- linux-2.6.12.5/arch/mips/kernel/head.S 2005-08-15 02:20:18.000000000 +0200
15917 +++ linux-2.6.12.5-brcm/arch/mips/kernel/head.S 2005-08-28 11:12:20.539842584 +0200
15918 @@ -122,6 +122,14 @@
15919 #endif
15920 .endm
15921
15922 +#ifdef CONFIG_BCM4710
15923 +#undef eret
15924 +#define eret nop; nop; eret
15925 +#endif
15926 +
15927 + j kernel_entry
15928 + nop
15929 +
15930 /*
15931 * Reserved space for exception handlers.
15932 * Necessary for machines which link their kernels at KSEG0.
15933 diff -Nur linux-2.6.12.5/arch/mips/kernel/proc.c linux-2.6.12.5-brcm/arch/mips/kernel/proc.c
15934 --- linux-2.6.12.5/arch/mips/kernel/proc.c 2005-08-15 02:20:18.000000000 +0200
15935 +++ linux-2.6.12.5-brcm/arch/mips/kernel/proc.c 2005-08-28 11:12:20.553840456 +0200
15936 @@ -75,7 +75,9 @@
15937 [CPU_VR4133] "NEC VR4133",
15938 [CPU_VR4181] "NEC VR4181",
15939 [CPU_VR4181A] "NEC VR4181A",
15940 - [CPU_SR71000] "Sandcraft SR71000"
15941 + [CPU_SR71000] "Sandcraft SR71000",
15942 + [CPU_BCM3302] "Broadcom BCM3302",
15943 + [CPU_BCM4710] "Broadcom BCM4710"
15944 };
15945
15946
15947 diff -Nur linux-2.6.12.5/arch/mips/mm/tlbex.c linux-2.6.12.5-brcm/arch/mips/mm/tlbex.c
15948 --- linux-2.6.12.5/arch/mips/mm/tlbex.c 2005-08-15 02:20:18.000000000 +0200
15949 +++ linux-2.6.12.5-brcm/arch/mips/mm/tlbex.c 2005-08-28 11:12:20.587835288 +0200
15950 @@ -851,6 +851,8 @@
15951 case CPU_4KSC:
15952 case CPU_20KC:
15953 case CPU_25KF:
15954 + case CPU_BCM3302:
15955 + case CPU_BCM4710:
15956 tlbw(p);
15957 break;
15958
15959 diff -Nur linux-2.6.12.5/arch/mips/pci/Makefile linux-2.6.12.5-brcm/arch/mips/pci/Makefile
15960 --- linux-2.6.12.5/arch/mips/pci/Makefile 2005-08-15 02:20:18.000000000 +0200
15961 +++ linux-2.6.12.5-brcm/arch/mips/pci/Makefile 2005-08-28 11:12:20.611831640 +0200
15962 @@ -18,6 +18,7 @@
15963 obj-$(CONFIG_MIPS_TX3927) += ops-jmr3927.o
15964 obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
15965 obj-$(CONFIG_NEC_CMBVR4133) += fixup-vr4133.o
15966 +obj-$(CONFIG_BCM47XX) += ops-sb.o fixup-bcm47xx.o pci-bcm47xx.o
15967
15968 #
15969 # These are still pretty much in the old state, watch, go blind.
15970 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
15971 --- linux-2.6.12.5/arch/mips/pci/fixup-bcm47xx.c 1970-01-01 01:00:00.000000000 +0100
15972 +++ linux-2.6.12.5-brcm/arch/mips/pci/fixup-bcm47xx.c 2005-08-28 11:12:20.611831640 +0200
15973 @@ -0,0 +1,23 @@
15974 +#include <linux/init.h>
15975 +#include <linux/pci.h>
15976 +
15977 +/* Do platform specific device initialization at pci_enable_device() time */
15978 +int pcibios_plat_dev_init(struct pci_dev *dev)
15979 +{
15980 + return 0;
15981 +}
15982 +
15983 +int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
15984 +{
15985 + u8 irq;
15986 +
15987 + if (dev->bus->number == 1)
15988 + return 2;
15989 +
15990 + pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
15991 + return irq + 2;
15992 +}
15993 +
15994 +struct pci_fixup pcibios_fixups[] __initdata = {
15995 + { 0 }
15996 +};
15997 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
15998 --- linux-2.6.12.5/arch/mips/pci/ops-sb.c 1970-01-01 01:00:00.000000000 +0100
15999 +++ linux-2.6.12.5-brcm/arch/mips/pci/ops-sb.c 2005-08-28 11:12:20.612831488 +0200
16000 @@ -0,0 +1,44 @@
16001 +#include <linux/kernel.h>
16002 +#include <linux/init.h>
16003 +#include <linux/pci.h>
16004 +#include <linux/types.h>
16005 +#include <asm/pci.h>
16006 +
16007 +#include <typedefs.h>
16008 +#include <sbpci.h>
16009 +
16010 +extern void *sbh;
16011 +//extern spinlock_t bcm47xx_sbh_lock;
16012 +
16013 +static int
16014 +sb_pci_read_config(struct pci_bus *bus, unsigned int devfn,
16015 + int reg, int size, u32 *val)
16016 +{
16017 + //unsigned long flags;
16018 + int ret;
16019 +
16020 +
16021 + //spin_lock_irqsave(&sbh_lock, flags);
16022 + ret = sbpci_read_config(sbh, bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), reg, val, size);
16023 + //spin_unlock_irqrestore(&sbh_lock, flags);
16024 +
16025 + return ret ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
16026 +}
16027 +
16028 +static int
16029 +sb_pci_write_config(struct pci_bus *bus, unsigned int devfn,
16030 + int reg, int size, u32 val)
16031 +{
16032 +// unsigned long flags;
16033 + int ret;
16034 +
16035 +// spin_lock_irqsave(&sbh_lock, flags);
16036 + ret = sbpci_write_config(sbh, bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), reg, &val, size);
16037 +// spin_unlock_irqrestore(&sbh_lock, flags);
16038 + return ret ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
16039 +}
16040 +
16041 +struct pci_ops sb_pci_ops = {
16042 + .read = sb_pci_read_config,
16043 + .write = sb_pci_write_config,
16044 +};
16045 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
16046 --- linux-2.6.12.5/arch/mips/pci/pci-bcm47xx.c 1970-01-01 01:00:00.000000000 +0100
16047 +++ linux-2.6.12.5-brcm/arch/mips/pci/pci-bcm47xx.c 2005-08-28 11:12:20.612831488 +0200
16048 @@ -0,0 +1,61 @@
16049 +#include <linux/init.h>
16050 +#include <linux/pci.h>
16051 +#include <linux/types.h>
16052 +
16053 +#include <asm/cpu.h>
16054 +#include <asm/io.h>
16055 +
16056 +#include <typedefs.h>
16057 +#include <sbconfig.h>
16058 +
16059 +extern struct pci_ops sb_pci_ops;
16060 +
16061 +static struct resource sb_pci_mem_resource = {
16062 + .name = "SB PCI Memory resources",
16063 + .start = SB_ENUM_BASE,
16064 + .end = SB_ENUM_LIM - 1,
16065 + .flags = IORESOURCE_MEM,
16066 +};
16067 +
16068 +static struct resource sb_pci_io_resource = {
16069 + .name = "SB PCI I/O resources",
16070 + .start = 0x100,
16071 + .end = 0x1FF,
16072 + .flags = IORESOURCE_IO,
16073 +};
16074 +
16075 +static struct pci_controller bcm47xx_sb_pci_controller = {
16076 + .pci_ops = &sb_pci_ops,
16077 + .mem_resource = &sb_pci_mem_resource,
16078 + .io_resource = &sb_pci_io_resource,
16079 +};
16080 +
16081 +static struct resource ext_pci_mem_resource = {
16082 + .name = "Ext PCI Memory resources",
16083 + .start = SB_PCI_DMA,
16084 +// .end = 0x7FFFFFFF,
16085 + .end = 0x40FFFFFF,
16086 + .flags = IORESOURCE_MEM,
16087 +};
16088 +
16089 +static struct resource ext_pci_io_resource = {
16090 + .name = "Ext PCI I/O resources",
16091 + .start = 0x200,
16092 + .end = 0x2FF,
16093 + .flags = IORESOURCE_IO,
16094 +};
16095 +
16096 +static struct pci_controller bcm47xx_ext_pci_controller = {
16097 + .pci_ops = &sb_pci_ops,
16098 + .mem_resource = &ext_pci_mem_resource,
16099 + .io_resource = &ext_pci_io_resource,
16100 +};
16101 +
16102 +static int __init bcm47xx_pci_init(void)
16103 +{
16104 + register_pci_controller(&bcm47xx_sb_pci_controller);
16105 + register_pci_controller(&bcm47xx_ext_pci_controller);
16106 + return 0;
16107 +}
16108 +
16109 +early_initcall(bcm47xx_pci_init);
16110 diff -Nur linux-2.6.12.5/arch/mips/pci/pci.c linux-2.6.12.5-brcm/arch/mips/pci/pci.c
16111 --- linux-2.6.12.5/arch/mips/pci/pci.c 2005-08-15 02:20:18.000000000 +0200
16112 +++ linux-2.6.12.5-brcm/arch/mips/pci/pci.c 2005-08-28 11:12:20.629828904 +0200
16113 @@ -238,7 +238,8 @@
16114 if (dev->resource[i].flags & IORESOURCE_IO)
16115 offset = hose->io_offset;
16116 else if (dev->resource[i].flags & IORESOURCE_MEM)
16117 - offset = hose->mem_offset;
16118 + offset = 0x26000000;
16119 + // offset = hose->mem_offset;
16120
16121 dev->resource[i].start += offset;
16122 dev->resource[i].end += offset;
16123 diff -Nur linux-2.6.12.5/drivers/mtd/maps/Kconfig linux-2.6.12.5-brcm/drivers/mtd/maps/Kconfig
16124 --- linux-2.6.12.5/drivers/mtd/maps/Kconfig 2005-08-15 02:20:18.000000000 +0200
16125 +++ linux-2.6.12.5-brcm/drivers/mtd/maps/Kconfig 2005-08-28 11:12:20.663823736 +0200
16126 @@ -357,6 +357,12 @@
16127 Mapping for the Flaga digital module. If you don't have one, ignore
16128 this setting.
16129
16130 +config MTD_BCM47XX
16131 + tristate "BCM47xx flash device"
16132 + depends on MIPS && MTD_CFI && BCM47XX
16133 + help
16134 + Support for the flash chips on the BCM47xx board.
16135 +
16136 config MTD_BEECH
16137 tristate "CFI Flash device mapped on IBM 405LP Beech"
16138 depends on MTD_CFI && PPC32 && 40x && BEECH
16139 diff -Nur linux-2.6.12.5/drivers/mtd/maps/Makefile linux-2.6.12.5-brcm/drivers/mtd/maps/Makefile
16140 --- linux-2.6.12.5/drivers/mtd/maps/Makefile 2005-08-15 02:20:18.000000000 +0200
16141 +++ linux-2.6.12.5-brcm/drivers/mtd/maps/Makefile 2005-08-28 11:12:20.666823280 +0200
16142 @@ -31,6 +31,7 @@
16143 obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o
16144 obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o
16145 obj-$(CONFIG_MTD_TQM8XXL) += tqm8xxl.o
16146 +obj-$(CONFIG_MTD_BCM47XX) += bcm47xx-flash.o
16147 obj-$(CONFIG_MTD_SA1100) += sa1100-flash.o
16148 obj-$(CONFIG_MTD_IPAQ) += ipaq-flash.o
16149 obj-$(CONFIG_MTD_SBC_GXX) += sbc_gxx.o
16150 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
16151 --- linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c 1970-01-01 01:00:00.000000000 +0100
16152 +++ linux-2.6.12.5-brcm/drivers/mtd/maps/bcm47xx-flash.c 2005-08-28 11:12:20.666823280 +0200
16153 @@ -0,0 +1,132 @@
16154 +/*
16155 + * Flash mapping for BCM947XX boards
16156 + *
16157 + * Copyright (C) 2001 Broadcom Corporation
16158 + *
16159 + * $Id$
16160 + */
16161 +
16162 +#include <linux/init.h>
16163 +#include <linux/module.h>
16164 +#include <linux/types.h>
16165 +#include <linux/kernel.h>
16166 +#include <asm/io.h>
16167 +#include <linux/mtd/mtd.h>
16168 +#include <linux/mtd/map.h>
16169 +#include <linux/mtd/partitions.h>
16170 +#include <linux/config.h>
16171 +
16172 +//#define WINDOW_ADDR 0x1fc00000
16173 +#define WINDOW_ADDR 0x1c000000
16174 +#define WINDOW_SIZE (0x400000*2)
16175 +#define BUSWIDTH 2
16176 +
16177 +static struct mtd_info *bcm947xx_mtd;
16178 +
16179 +static void bcm947xx_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
16180 +{
16181 +#define MIPS_MEMCPY_ALIGN 4
16182 + map_word ret;
16183 + ssize_t transfer;
16184 + ssize_t done = 0;
16185 + if ((len >= MIPS_MEMCPY_ALIGN) && (!(from & (MIPS_MEMCPY_ALIGN - 1))) && (!(((unsigned int)to & (MIPS_MEMCPY_ALIGN - 1))))) {
16186 + done = len & ~(MIPS_MEMCPY_ALIGN - 1);
16187 + memcpy_fromio(to, map->virt + from, done);
16188 + }
16189 + while (done < len) {
16190 + ret = map->read(map, from + done);
16191 + transfer = len - done;
16192 + if (transfer > map->bankwidth)
16193 + transfer = map->bankwidth;
16194 + memcpy((void *)((unsigned long)to + done), &ret.x[0], transfer);
16195 + done += transfer;
16196 + }
16197 +}
16198 +
16199 +static struct map_info bcm947xx_map = {
16200 + name: "Physically mapped flash",
16201 + size: WINDOW_SIZE,
16202 + bankwidth: BUSWIDTH,
16203 + phys: WINDOW_ADDR,
16204 +};
16205 +
16206 +#define SECTORS *64*1024
16207 +
16208 +#ifdef CONFIG_MTD_PARTITIONS
16209 +#if 0
16210 +static struct mtd_partition bcm947xx_parts[] = {
16211 +// 64 - 4 - 14 - 1 = 45 = 8 + 37
16212 + { name: "pmon", offset: 0, size: 4 SECTORS, mask_flags: MTD_WRITEABLE },
16213 + { name: "linux", offset: MTDPART_OFS_APPEND, size: 14 SECTORS },
16214 + { name: "rescue", offset: MTDPART_OFS_APPEND, size: 8 SECTORS },
16215 + { name: "rootfs", offset: MTDPART_OFS_APPEND, size: 37 SECTORS },
16216 + { name: "nvram", offset: MTDPART_OFS_APPEND, size: 1 SECTORS, mask_flags: MTD_WRITEABLE },
16217 +};
16218 +#else
16219 +static struct mtd_partition bcm947xx_parts[] = {
16220 + { name: "cfe",
16221 + offset: 0,
16222 + size: 384*1024,
16223 + mask_flags: MTD_WRITEABLE
16224 + },
16225 + { name: "config",
16226 + offset: MTDPART_OFS_APPEND,
16227 + size: 128*1024
16228 + },
16229 + { name: "linux",
16230 + offset: MTDPART_OFS_APPEND,
16231 + size: 10*128*1024
16232 + },
16233 + { name: "jffs",
16234 + offset: MTDPART_OFS_APPEND,
16235 + size: (8*1024*1024)-((384*1024)+(128*1024)+(10*128*1024)+(128*1024)),
16236 + },
16237 + { name: "nvram",
16238 + offset: MTDPART_OFS_APPEND,
16239 + size: 128*1024,
16240 + mask_flags: MTD_WRITEABLE
16241 + },
16242 +};
16243 +#endif
16244 +#endif
16245 +
16246 +int __init init_bcm947xx_map(void)
16247 +{
16248 + bcm947xx_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
16249 +
16250 + if (!bcm947xx_map.virt) {
16251 + printk("Failed to ioremap\n");
16252 + return -EIO;
16253 + }
16254 + simple_map_init(&bcm947xx_map);
16255 +
16256 + bcm947xx_map.copy_from = bcm947xx_map_copy_from;
16257 +
16258 + if (!(bcm947xx_mtd = do_map_probe("cfi_probe", &bcm947xx_map))) {
16259 + printk("Failed to do_map_probe\n");
16260 + iounmap((void *)bcm947xx_map.virt);
16261 + return -ENXIO;
16262 + }
16263 +
16264 + bcm947xx_mtd->owner = THIS_MODULE;
16265 +
16266 + printk(KERN_NOTICE "flash device: %x at %x\n", bcm947xx_mtd->size, WINDOW_ADDR);
16267 +
16268 +#ifdef CONFIG_MTD_PARTITIONS
16269 + return add_mtd_partitions(bcm947xx_mtd, bcm947xx_parts, sizeof(bcm947xx_parts)/sizeof(bcm947xx_parts[0]));
16270 +#else
16271 + return 0;
16272 +#endif
16273 +}
16274 +
16275 +void __exit cleanup_bcm947xx_map(void)
16276 +{
16277 +#ifdef CONFIG_MTD_PARTITIONS
16278 + del_mtd_partitions(bcm947xx_mtd);
16279 +#endif
16280 + map_destroy(bcm947xx_mtd);
16281 + iounmap((void *)bcm947xx_map.virt);
16282 +}
16283 +
16284 +module_init(init_bcm947xx_map);
16285 +module_exit(cleanup_bcm947xx_map);
16286 diff -Nur linux-2.6.12.5/drivers/net/b44.c linux-2.6.12.5-brcm/drivers/net/b44.c
16287 --- linux-2.6.12.5/drivers/net/b44.c 2005-08-15 02:20:18.000000000 +0200
16288 +++ linux-2.6.12.5-brcm/drivers/net/b44.c 2005-08-28 11:12:20.691819480 +0200
16289 @@ -1,7 +1,8 @@
16290 -/* b44.c: Broadcom 4400 device driver.
16291 +/* b44.c: Broadcom 4400/47xx device driver.
16292 *
16293 * Copyright (C) 2002 David S. Miller (davem@redhat.com)
16294 - * Fixed by Pekka Pietikainen (pp@ee.oulu.fi)
16295 + * Copyright (C) 2004 Pekka Pietikainen (pp@ee.oulu.fi)
16296 + * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
16297 *
16298 * Distribute under GPL.
16299 */
16300 @@ -78,7 +79,7 @@
16301 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
16302
16303 MODULE_AUTHOR("Florian Schirmer, Pekka Pietikainen, David S. Miller");
16304 -MODULE_DESCRIPTION("Broadcom 4400 10/100 PCI ethernet driver");
16305 +MODULE_DESCRIPTION("Broadcom 4400/47xx 10/100 PCI ethernet driver");
16306 MODULE_LICENSE("GPL");
16307 MODULE_VERSION(DRV_MODULE_VERSION);
16308
16309 @@ -93,6 +94,8 @@
16310 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
16311 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401B1,
16312 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
16313 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4713,
16314 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
16315 { } /* terminate list with empty entry */
16316 };
16317
16318 @@ -106,24 +109,13 @@
16319 static void b44_poll_controller(struct net_device *dev);
16320 #endif
16321
16322 -static inline unsigned long br32(const struct b44 *bp, unsigned long reg)
16323 -{
16324 - return readl(bp->regs + reg);
16325 -}
16326 -
16327 -static inline void bw32(const struct b44 *bp,
16328 - unsigned long reg, unsigned long val)
16329 -{
16330 - writel(val, bp->regs + reg);
16331 -}
16332 -
16333 static int b44_wait_bit(struct b44 *bp, unsigned long reg,
16334 u32 bit, unsigned long timeout, const int clear)
16335 {
16336 unsigned long i;
16337
16338 for (i = 0; i < timeout; i++) {
16339 - u32 val = br32(bp, reg);
16340 + u32 val = br32(reg);
16341
16342 if (clear && !(val & bit))
16343 break;
16344 @@ -154,7 +146,7 @@
16345
16346 static u32 ssb_get_core_rev(struct b44 *bp)
16347 {
16348 - return (br32(bp, B44_SBIDHIGH) & SBIDHIGH_RC_MASK);
16349 + return (br32(B44_SBIDHIGH) & SBIDHIGH_RC_MASK);
16350 }
16351
16352 static u32 ssb_pci_setup(struct b44 *bp, u32 cores)
16353 @@ -165,13 +157,13 @@
16354 pci_write_config_dword(bp->pdev, SSB_BAR0_WIN, BCM4400_PCI_CORE_ADDR);
16355 pci_rev = ssb_get_core_rev(bp);
16356
16357 - val = br32(bp, B44_SBINTVEC);
16358 + val = br32(B44_SBINTVEC);
16359 val |= cores;
16360 - bw32(bp, B44_SBINTVEC, val);
16361 + bw32(B44_SBINTVEC, val);
16362
16363 - val = br32(bp, SSB_PCI_TRANS_2);
16364 + val = br32(SSB_PCI_TRANS_2);
16365 val |= SSB_PCI_PREF | SSB_PCI_BURST;
16366 - bw32(bp, SSB_PCI_TRANS_2, val);
16367 + bw32(SSB_PCI_TRANS_2, val);
16368
16369 pci_write_config_dword(bp->pdev, SSB_BAR0_WIN, bar_orig);
16370
16371 @@ -180,18 +172,18 @@
16372
16373 static void ssb_core_disable(struct b44 *bp)
16374 {
16375 - if (br32(bp, B44_SBTMSLOW) & SBTMSLOW_RESET)
16376 + if (br32(B44_SBTMSLOW) & SBTMSLOW_RESET)
16377 return;
16378
16379 - bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_CLOCK));
16380 + bw32(B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_CLOCK));
16381 b44_wait_bit(bp, B44_SBTMSLOW, SBTMSLOW_REJECT, 100000, 0);
16382 b44_wait_bit(bp, B44_SBTMSHIGH, SBTMSHIGH_BUSY, 100000, 1);
16383 - bw32(bp, B44_SBTMSLOW, (SBTMSLOW_FGC | SBTMSLOW_CLOCK |
16384 + bw32(B44_SBTMSLOW, (SBTMSLOW_FGC | SBTMSLOW_CLOCK |
16385 SBTMSLOW_REJECT | SBTMSLOW_RESET));
16386 - br32(bp, B44_SBTMSLOW);
16387 + br32(B44_SBTMSLOW);
16388 udelay(1);
16389 - bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_RESET));
16390 - br32(bp, B44_SBTMSLOW);
16391 + bw32(B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_RESET));
16392 + br32(B44_SBTMSLOW);
16393 udelay(1);
16394 }
16395
16396 @@ -200,58 +192,65 @@
16397 u32 val;
16398
16399 ssb_core_disable(bp);
16400 - bw32(bp, B44_SBTMSLOW, (SBTMSLOW_RESET | SBTMSLOW_CLOCK | SBTMSLOW_FGC));
16401 - br32(bp, B44_SBTMSLOW);
16402 + bw32(B44_SBTMSLOW, (SBTMSLOW_RESET | SBTMSLOW_CLOCK | SBTMSLOW_FGC));
16403 + br32(B44_SBTMSLOW);
16404 udelay(1);
16405
16406 /* Clear SERR if set, this is a hw bug workaround. */
16407 - if (br32(bp, B44_SBTMSHIGH) & SBTMSHIGH_SERR)
16408 - bw32(bp, B44_SBTMSHIGH, 0);
16409 + if (br32(B44_SBTMSHIGH) & SBTMSHIGH_SERR)
16410 + bw32(B44_SBTMSHIGH, 0);
16411
16412 - val = br32(bp, B44_SBIMSTATE);
16413 + val = br32(B44_SBIMSTATE);
16414 if (val & (SBIMSTATE_IBE | SBIMSTATE_TO))
16415 - bw32(bp, B44_SBIMSTATE, val & ~(SBIMSTATE_IBE | SBIMSTATE_TO));
16416 + bw32(B44_SBIMSTATE, val & ~(SBIMSTATE_IBE | SBIMSTATE_TO));
16417
16418 - bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK | SBTMSLOW_FGC));
16419 - br32(bp, B44_SBTMSLOW);
16420 + bw32(B44_SBTMSLOW, (SBTMSLOW_CLOCK | SBTMSLOW_FGC));
16421 + br32(B44_SBTMSLOW);
16422 udelay(1);
16423
16424 - bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK));
16425 - br32(bp, B44_SBTMSLOW);
16426 + bw32(B44_SBTMSLOW, (SBTMSLOW_CLOCK));
16427 + br32(B44_SBTMSLOW);
16428 udelay(1);
16429 }
16430
16431 +static int b44_4713_instance;
16432 +
16433 static int ssb_core_unit(struct b44 *bp)
16434 {
16435 -#if 0
16436 - u32 val = br32(bp, B44_SBADMATCH0);
16437 - u32 base;
16438 -
16439 - type = val & SBADMATCH0_TYPE_MASK;
16440 - switch (type) {
16441 - case 0:
16442 - base = val & SBADMATCH0_BS0_MASK;
16443 - break;
16444 -
16445 - case 1:
16446 - base = val & SBADMATCH0_BS1_MASK;
16447 - break;
16448 -
16449 - case 2:
16450 - default:
16451 - base = val & SBADMATCH0_BS2_MASK;
16452 - break;
16453 - };
16454 -#endif
16455 - return 0;
16456 + if (bp->pdev->device == PCI_DEVICE_ID_BCM4713)
16457 + return b44_4713_instance++;
16458 + else
16459 + return 0;
16460 }
16461
16462 static int ssb_is_core_up(struct b44 *bp)
16463 {
16464 - return ((br32(bp, B44_SBTMSLOW) & (SBTMSLOW_RESET | SBTMSLOW_REJECT | SBTMSLOW_CLOCK))
16465 + return ((br32(B44_SBTMSLOW) & (SBTMSLOW_RESET | SBTMSLOW_REJECT | SBTMSLOW_CLOCK))
16466 == SBTMSLOW_CLOCK);
16467 }
16468
16469 +static void __b44_cam_read(struct b44 *bp, unsigned char *data, int index)
16470 +{
16471 + u32 val;
16472 +
16473 + bw32(B44_CAM_CTRL, (CAM_CTRL_READ |
16474 + (index << CAM_CTRL_INDEX_SHIFT)));
16475 +
16476 + b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1);
16477 +
16478 + val = br32(B44_CAM_DATA_LO);
16479 +
16480 + data[2] = (val >> 24) & 0xFF;
16481 + data[3] = (val >> 16) & 0xFF;
16482 + data[4] = (val >> 8) & 0xFF;
16483 + data[5] = (val >> 0) & 0xFF;
16484 +
16485 + val = br32(B44_CAM_DATA_HI);
16486 +
16487 + data[0] = (val >> 8) & 0xFF;
16488 + data[1] = (val >> 0) & 0xFF;
16489 +}
16490 +
16491 static void __b44_cam_write(struct b44 *bp, unsigned char *data, int index)
16492 {
16493 u32 val;
16494 @@ -260,19 +259,19 @@
16495 val |= ((u32) data[3]) << 16;
16496 val |= ((u32) data[4]) << 8;
16497 val |= ((u32) data[5]) << 0;
16498 - bw32(bp, B44_CAM_DATA_LO, val);
16499 + bw32(B44_CAM_DATA_LO, val);
16500 val = (CAM_DATA_HI_VALID |
16501 (((u32) data[0]) << 8) |
16502 (((u32) data[1]) << 0));
16503 - bw32(bp, B44_CAM_DATA_HI, val);
16504 - bw32(bp, B44_CAM_CTRL, (CAM_CTRL_WRITE |
16505 + bw32(B44_CAM_DATA_HI, val);
16506 + bw32(B44_CAM_CTRL, (CAM_CTRL_WRITE |
16507 (index << CAM_CTRL_INDEX_SHIFT)));
16508 b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1);
16509 }
16510
16511 static inline void __b44_disable_ints(struct b44 *bp)
16512 {
16513 - bw32(bp, B44_IMASK, 0);
16514 + bw32(B44_IMASK, 0);
16515 }
16516
16517 static void b44_disable_ints(struct b44 *bp)
16518 @@ -280,34 +279,40 @@
16519 __b44_disable_ints(bp);
16520
16521 /* Flush posted writes. */
16522 - br32(bp, B44_IMASK);
16523 + br32(B44_IMASK);
16524 }
16525
16526 static void b44_enable_ints(struct b44 *bp)
16527 {
16528 - bw32(bp, B44_IMASK, bp->imask);
16529 + bw32(B44_IMASK, bp->imask);
16530 }
16531
16532 static int b44_readphy(struct b44 *bp, int reg, u32 *val)
16533 {
16534 int err;
16535
16536 - bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII);
16537 - bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START |
16538 + if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
16539 + return 0;
16540 +
16541 + bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
16542 + bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
16543 (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) |
16544 (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
16545 (reg << MDIO_DATA_RA_SHIFT) |
16546 (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT)));
16547 err = b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
16548 - *val = br32(bp, B44_MDIO_DATA) & MDIO_DATA_DATA;
16549 + *val = br32(B44_MDIO_DATA) & MDIO_DATA_DATA;
16550
16551 return err;
16552 }
16553
16554 static int b44_writephy(struct b44 *bp, int reg, u32 val)
16555 {
16556 - bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII);
16557 - bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START |
16558 + if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
16559 + return 0;
16560 +
16561 + bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
16562 + bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
16563 (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) |
16564 (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
16565 (reg << MDIO_DATA_RA_SHIFT) |
16566 @@ -344,6 +349,9 @@
16567 u32 val;
16568 int err;
16569
16570 + if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
16571 + return 0;
16572 +
16573 err = b44_writephy(bp, MII_BMCR, BMCR_RESET);
16574 if (err)
16575 return err;
16576 @@ -367,20 +375,20 @@
16577 bp->flags &= ~(B44_FLAG_TX_PAUSE | B44_FLAG_RX_PAUSE);
16578 bp->flags |= pause_flags;
16579
16580 - val = br32(bp, B44_RXCONFIG);
16581 + val = br32(B44_RXCONFIG);
16582 if (pause_flags & B44_FLAG_RX_PAUSE)
16583 val |= RXCONFIG_FLOW;
16584 else
16585 val &= ~RXCONFIG_FLOW;
16586 - bw32(bp, B44_RXCONFIG, val);
16587 + bw32(B44_RXCONFIG, val);
16588
16589 - val = br32(bp, B44_MAC_FLOW);
16590 + val = br32(B44_MAC_FLOW);
16591 if (pause_flags & B44_FLAG_TX_PAUSE)
16592 val |= (MAC_FLOW_PAUSE_ENAB |
16593 (0xc0 & MAC_FLOW_RX_HI_WATER));
16594 else
16595 val &= ~MAC_FLOW_PAUSE_ENAB;
16596 - bw32(bp, B44_MAC_FLOW, val);
16597 + bw32(B44_MAC_FLOW, val);
16598 }
16599
16600 static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote)
16601 @@ -414,6 +422,9 @@
16602 u32 val;
16603 int err;
16604
16605 + if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
16606 + return 0;
16607 +
16608 if ((err = b44_readphy(bp, B44_MII_ALEDCTRL, &val)) != 0)
16609 goto out;
16610 if ((err = b44_writephy(bp, B44_MII_ALEDCTRL,
16611 @@ -476,11 +487,11 @@
16612
16613 val = &bp->hw_stats.tx_good_octets;
16614 for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) {
16615 - *val++ += br32(bp, reg);
16616 + *val++ += br32(reg);
16617 }
16618 val = &bp->hw_stats.rx_good_octets;
16619 for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) {
16620 - *val++ += br32(bp, reg);
16621 + *val++ += br32(reg);
16622 }
16623 }
16624
16625 @@ -506,6 +517,19 @@
16626 {
16627 u32 bmsr, aux;
16628
16629 + if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) {
16630 + bp->flags |= B44_FLAG_100_BASE_T;
16631 + bp->flags |= B44_FLAG_FULL_DUPLEX;
16632 + if (!netif_carrier_ok(bp->dev)) {
16633 + u32 val = br32(B44_TX_CTRL);
16634 + val |= TX_CTRL_DUPLEX;
16635 + bw32(B44_TX_CTRL, val);
16636 + netif_carrier_on(bp->dev);
16637 + b44_link_report(bp);
16638 + }
16639 + return;
16640 + }
16641 +
16642 if (!b44_readphy(bp, MII_BMSR, &bmsr) &&
16643 !b44_readphy(bp, B44_MII_AUXCTRL, &aux) &&
16644 (bmsr != 0xffff)) {
16645 @@ -520,14 +544,14 @@
16646
16647 if (!netif_carrier_ok(bp->dev) &&
16648 (bmsr & BMSR_LSTATUS)) {
16649 - u32 val = br32(bp, B44_TX_CTRL);
16650 + u32 val = br32(B44_TX_CTRL);
16651 u32 local_adv, remote_adv;
16652
16653 if (bp->flags & B44_FLAG_FULL_DUPLEX)
16654 val |= TX_CTRL_DUPLEX;
16655 else
16656 val &= ~TX_CTRL_DUPLEX;
16657 - bw32(bp, B44_TX_CTRL, val);
16658 + bw32(B44_TX_CTRL, val);
16659
16660 if (!(bp->flags & B44_FLAG_FORCE_LINK) &&
16661 !b44_readphy(bp, MII_ADVERTISE, &local_adv) &&
16662 @@ -572,7 +596,7 @@
16663 {
16664 u32 cur, cons;
16665
16666 - cur = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK;
16667 + cur = br32(B44_DMATX_STAT) & DMATX_STAT_CDMASK;
16668 cur /= sizeof(struct dma_desc);
16669
16670 /* XXX needs updating when NETIF_F_SG is supported */
16671 @@ -596,7 +620,7 @@
16672 TX_BUFFS_AVAIL(bp) > B44_TX_WAKEUP_THRESH)
16673 netif_wake_queue(bp->dev);
16674
16675 - bw32(bp, B44_GPTIMER, 0);
16676 + bw32(B44_GPTIMER, 0);
16677 }
16678
16679 /* Works like this. This chip writes a 'struct rx_header" 30 bytes
16680 @@ -713,7 +737,7 @@
16681 u32 cons, prod;
16682
16683 received = 0;
16684 - prod = br32(bp, B44_DMARX_STAT) & DMARX_STAT_CDMASK;
16685 + prod = br32(B44_DMARX_STAT) & DMARX_STAT_CDMASK;
16686 prod /= sizeof(struct dma_desc);
16687 cons = bp->rx_cons;
16688
16689 @@ -792,7 +816,7 @@
16690 }
16691
16692 bp->rx_cons = cons;
16693 - bw32(bp, B44_DMARX_PTR, cons * sizeof(struct dma_desc));
16694 + bw32(B44_DMARX_PTR, cons * sizeof(struct dma_desc));
16695
16696 return received;
16697 }
16698 @@ -856,8 +880,8 @@
16699
16700 spin_lock_irqsave(&bp->lock, flags);
16701
16702 - istat = br32(bp, B44_ISTAT);
16703 - imask = br32(bp, B44_IMASK);
16704 + istat = br32(B44_ISTAT);
16705 + imask = br32(B44_IMASK);
16706
16707 /* ??? What the fuck is the purpose of the interrupt mask
16708 * ??? register if we have to mask it out by hand anyways?
16709 @@ -877,8 +901,8 @@
16710 dev->name);
16711 }
16712
16713 - bw32(bp, B44_ISTAT, istat);
16714 - br32(bp, B44_ISTAT);
16715 + bw32(B44_ISTAT, istat);
16716 + br32(B44_ISTAT);
16717 }
16718 spin_unlock_irqrestore(&bp->lock, flags);
16719 return IRQ_RETVAL(handled);
16720 @@ -965,11 +989,11 @@
16721
16722 wmb();
16723
16724 - bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc));
16725 + bw32(B44_DMATX_PTR, entry * sizeof(struct dma_desc));
16726 if (bp->flags & B44_FLAG_BUGGY_TXPTR)
16727 - bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc));
16728 + bw32(B44_DMATX_PTR, entry * sizeof(struct dma_desc));
16729 if (bp->flags & B44_FLAG_REORDER_BUG)
16730 - br32(bp, B44_DMATX_PTR);
16731 + br32(B44_DMATX_PTR);
16732
16733 if (TX_BUFFS_AVAIL(bp) < 1)
16734 netif_stop_queue(dev);
16735 @@ -1137,32 +1161,35 @@
16736 {
16737 unsigned long reg;
16738
16739 - bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
16740 + bw32(B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
16741 for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL)
16742 - br32(bp, reg);
16743 + br32(reg);
16744 for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL)
16745 - br32(bp, reg);
16746 + br32(reg);
16747 }
16748
16749 /* bp->lock is held. */
16750 static void b44_chip_reset(struct b44 *bp)
16751 {
16752 + unsigned int sb_clock;
16753 +
16754 if (ssb_is_core_up(bp)) {
16755 - bw32(bp, B44_RCV_LAZY, 0);
16756 - bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE);
16757 + bw32(B44_RCV_LAZY, 0);
16758 + bw32(B44_ENET_CTRL, ENET_CTRL_DISABLE);
16759 b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 100, 1);
16760 - bw32(bp, B44_DMATX_CTRL, 0);
16761 + bw32(B44_DMATX_CTRL, 0);
16762 bp->tx_prod = bp->tx_cons = 0;
16763 - if (br32(bp, B44_DMARX_STAT) & DMARX_STAT_EMASK) {
16764 + if (br32(B44_DMARX_STAT) & DMARX_STAT_EMASK) {
16765 b44_wait_bit(bp, B44_DMARX_STAT, DMARX_STAT_SIDLE,
16766 100, 0);
16767 }
16768 - bw32(bp, B44_DMARX_CTRL, 0);
16769 + bw32(B44_DMARX_CTRL, 0);
16770 bp->rx_prod = bp->rx_cons = 0;
16771 } else {
16772 - ssb_pci_setup(bp, (bp->core_unit == 0 ?
16773 - SBINTVEC_ENET0 :
16774 - SBINTVEC_ENET1));
16775 + if (bp->pdev->device != PCI_DEVICE_ID_BCM4713)
16776 + ssb_pci_setup(bp, (bp->core_unit == 0 ?
16777 + SBINTVEC_ENET0 :
16778 + SBINTVEC_ENET1));
16779 }
16780
16781 ssb_core_reset(bp);
16782 @@ -1170,20 +1197,26 @@
16783 b44_clear_stats(bp);
16784
16785 /* Make PHY accessible. */
16786 - bw32(bp, B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
16787 - (0x0d & MDIO_CTRL_MAXF_MASK)));
16788 - br32(bp, B44_MDIO_CTRL);
16789 -
16790 - if (!(br32(bp, B44_DEVCTRL) & DEVCTRL_IPP)) {
16791 - bw32(bp, B44_ENET_CTRL, ENET_CTRL_EPSEL);
16792 - br32(bp, B44_ENET_CTRL);
16793 + if (bp->pdev->device == PCI_DEVICE_ID_BCM4713)
16794 + sb_clock = 100000000; /* 100 MHz */
16795 + else
16796 + sb_clock = 62500000; /* 62.5 MHz */
16797 +
16798 + bw32(B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
16799 + (((sb_clock + (B44_MDC_RATIO / 2)) / B44_MDC_RATIO)
16800 + & MDIO_CTRL_MAXF_MASK)));
16801 + br32(B44_MDIO_CTRL);
16802 +
16803 + if (!(br32(B44_DEVCTRL) & DEVCTRL_IPP)) {
16804 + bw32(B44_ENET_CTRL, ENET_CTRL_EPSEL);
16805 + br32(B44_ENET_CTRL);
16806 bp->flags &= ~B44_FLAG_INTERNAL_PHY;
16807 } else {
16808 - u32 val = br32(bp, B44_DEVCTRL);
16809 + u32 val = br32(B44_DEVCTRL);
16810
16811 if (val & DEVCTRL_EPR) {
16812 - bw32(bp, B44_DEVCTRL, (val & ~DEVCTRL_EPR));
16813 - br32(bp, B44_DEVCTRL);
16814 + bw32(B44_DEVCTRL, (val & ~DEVCTRL_EPR));
16815 + br32(B44_DEVCTRL);
16816 udelay(100);
16817 }
16818 bp->flags |= B44_FLAG_INTERNAL_PHY;
16819 @@ -1200,13 +1233,13 @@
16820 /* bp->lock is held. */
16821 static void __b44_set_mac_addr(struct b44 *bp)
16822 {
16823 - bw32(bp, B44_CAM_CTRL, 0);
16824 + bw32(B44_CAM_CTRL, 0);
16825 if (!(bp->dev->flags & IFF_PROMISC)) {
16826 u32 val;
16827
16828 __b44_cam_write(bp, bp->dev->dev_addr, 0);
16829 - val = br32(bp, B44_CAM_CTRL);
16830 - bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
16831 + val = br32(B44_CAM_CTRL);
16832 + bw32(B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
16833 }
16834 }
16835
16836 @@ -1240,30 +1273,30 @@
16837 b44_setup_phy(bp);
16838
16839 /* Enable CRC32, set proper LED modes and power on PHY */
16840 - bw32(bp, B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL);
16841 - bw32(bp, B44_RCV_LAZY, (1 << RCV_LAZY_FC_SHIFT));
16842 + bw32(B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL);
16843 + bw32(B44_RCV_LAZY, (1 << RCV_LAZY_FC_SHIFT));
16844
16845 /* This sets the MAC address too. */
16846 __b44_set_rx_mode(bp->dev);
16847
16848 /* MTU + eth header + possible VLAN tag + struct rx_header */
16849 - bw32(bp, B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
16850 - bw32(bp, B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
16851 + bw32(B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
16852 + bw32(B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
16853
16854 - bw32(bp, B44_TX_WMARK, 56); /* XXX magic */
16855 - bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
16856 - bw32(bp, B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset);
16857 - bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
16858 + bw32(B44_TX_WMARK, 56); /* XXX magic */
16859 + bw32(B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
16860 + bw32(B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset);
16861 + bw32(B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
16862 (bp->rx_offset << DMARX_CTRL_ROSHIFT)));
16863 - bw32(bp, B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
16864 + bw32(B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
16865
16866 - bw32(bp, B44_DMARX_PTR, bp->rx_pending);
16867 + bw32(B44_DMARX_PTR, bp->rx_pending);
16868 bp->rx_prod = bp->rx_pending;
16869
16870 - bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
16871 + bw32(B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
16872
16873 - val = br32(bp, B44_ENET_CTRL);
16874 - bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
16875 + val = br32(B44_ENET_CTRL);
16876 + bw32(B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
16877 }
16878
16879 static int b44_open(struct net_device *dev)
16880 @@ -1416,11 +1449,11 @@
16881 int i=0;
16882 unsigned char zero[6] = {0,0,0,0,0,0};
16883
16884 - val = br32(bp, B44_RXCONFIG);
16885 + val = br32(B44_RXCONFIG);
16886 val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI);
16887 if (dev->flags & IFF_PROMISC) {
16888 val |= RXCONFIG_PROMISC;
16889 - bw32(bp, B44_RXCONFIG, val);
16890 + bw32(B44_RXCONFIG, val);
16891 } else {
16892 __b44_set_mac_addr(bp);
16893
16894 @@ -1432,9 +1465,9 @@
16895 for(;i<64;i++) {
16896 __b44_cam_write(bp, zero, i);
16897 }
16898 - bw32(bp, B44_RXCONFIG, val);
16899 - val = br32(bp, B44_CAM_CTRL);
16900 - bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
16901 + bw32(B44_RXCONFIG, val);
16902 + val = br32(B44_CAM_CTRL);
16903 + bw32(B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
16904 }
16905 }
16906
16907 @@ -1704,19 +1737,41 @@
16908 {
16909 u8 eeprom[128];
16910 int err;
16911 + unsigned long flags;
16912
16913 - err = b44_read_eeprom(bp, &eeprom[0]);
16914 - if (err)
16915 - goto out;
16916 -
16917 - bp->dev->dev_addr[0] = eeprom[79];
16918 - bp->dev->dev_addr[1] = eeprom[78];
16919 - bp->dev->dev_addr[2] = eeprom[81];
16920 - bp->dev->dev_addr[3] = eeprom[80];
16921 - bp->dev->dev_addr[4] = eeprom[83];
16922 - bp->dev->dev_addr[5] = eeprom[82];
16923 -
16924 - bp->phy_addr = eeprom[90] & 0x1f;
16925 + if (bp->pdev->device == PCI_DEVICE_ID_BCM4713) {
16926 + /*
16927 + * BCM47xx boards don't have a EEPROM. The MAC is stored in
16928 + * a NVRAM area somewhere in the flash memory. As we don't
16929 + * know the location and/or the format of the NVRAM area
16930 + * here, we simply rely on the bootloader to write the
16931 + * MAC into the CAM.
16932 + */
16933 + spin_lock_irqsave(&bp->lock, flags);
16934 + __b44_cam_read(bp, bp->dev->dev_addr, 0);
16935 + spin_unlock_irqrestore(&bp->lock, flags);
16936 +
16937 + /*
16938 + * BCM47xx boards don't have a PHY. Usually there is a switch
16939 + * chip with multiple PHYs connected to the PHY port.
16940 + */
16941 + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
16942 + bp->dma_offset = 0;
16943 + } else {
16944 + err = b44_read_eeprom(bp, &eeprom[0]);
16945 + if (err)
16946 + return err;
16947 +
16948 + bp->dev->dev_addr[0] = eeprom[79];
16949 + bp->dev->dev_addr[1] = eeprom[78];
16950 + bp->dev->dev_addr[2] = eeprom[81];
16951 + bp->dev->dev_addr[3] = eeprom[80];
16952 + bp->dev->dev_addr[4] = eeprom[83];
16953 + bp->dev->dev_addr[5] = eeprom[82];
16954 +
16955 + bp->phy_addr = eeprom[90] & 0x1f;
16956 + bp->dma_offset = SB_PCI_DMA;
16957 + }
16958
16959 /* With this, plus the rx_header prepended to the data by the
16960 * hardware, we'll land the ethernet header on a 2-byte boundary.
16961 @@ -1726,13 +1781,12 @@
16962 bp->imask = IMASK_DEF;
16963
16964 bp->core_unit = ssb_core_unit(bp);
16965 - bp->dma_offset = SB_PCI_DMA;
16966
16967 /* XXX - really required?
16968 bp->flags |= B44_FLAG_BUGGY_TXPTR;
16969 */
16970 -out:
16971 - return err;
16972 +
16973 + return 0;
16974 }
16975
16976 static int __devinit b44_init_one(struct pci_dev *pdev,
16977 @@ -1810,7 +1864,7 @@
16978
16979 spin_lock_init(&bp->lock);
16980
16981 - bp->regs = ioremap(b44reg_base, b44reg_len);
16982 + bp->regs = (unsigned long) ioremap(b44reg_base, b44reg_len);
16983 if (bp->regs == 0UL) {
16984 printk(KERN_ERR PFX "Cannot map device registers, "
16985 "aborting.\n");
16986 @@ -1871,7 +1925,8 @@
16987
16988 pci_save_state(bp->pdev);
16989
16990 - printk(KERN_INFO "%s: Broadcom 4400 10/100BaseT Ethernet ", dev->name);
16991 + printk(KERN_INFO "%s: Broadcom %s 10/100BaseT Ethernet ", dev->name,
16992 + (pdev->device == PCI_DEVICE_ID_BCM4713) ? "47xx" : "4400");
16993 for (i = 0; i < 6; i++)
16994 printk("%2.2x%c", dev->dev_addr[i],
16995 i == 5 ? '\n' : ':');
16996 @@ -1879,7 +1934,7 @@
16997 return 0;
16998
16999 err_out_iounmap:
17000 - iounmap(bp->regs);
17001 + iounmap((void *) bp->regs);
17002
17003 err_out_free_dev:
17004 free_netdev(dev);
17005 @@ -1901,7 +1956,7 @@
17006 struct b44 *bp = netdev_priv(dev);
17007
17008 unregister_netdev(dev);
17009 - iounmap(bp->regs);
17010 + iounmap((void *) bp->regs);
17011 free_netdev(dev);
17012 pci_release_regions(pdev);
17013 pci_disable_device(pdev);
17014 diff -Nur linux-2.6.12.5/drivers/net/b44.c.orig linux-2.6.12.5-brcm/drivers/net/b44.c.orig
17015 --- linux-2.6.12.5/drivers/net/b44.c.orig 1970-01-01 01:00:00.000000000 +0100
17016 +++ linux-2.6.12.5-brcm/drivers/net/b44.c.orig 2005-08-15 02:20:18.000000000 +0200
17017 @@ -0,0 +1,1978 @@
17018 +/* b44.c: Broadcom 4400 device driver.
17019 + *
17020 + * Copyright (C) 2002 David S. Miller (davem@redhat.com)
17021 + * Fixed by Pekka Pietikainen (pp@ee.oulu.fi)
17022 + *
17023 + * Distribute under GPL.
17024 + */
17025 +
17026 +#include <linux/kernel.h>
17027 +#include <linux/module.h>
17028 +#include <linux/moduleparam.h>
17029 +#include <linux/types.h>
17030 +#include <linux/netdevice.h>
17031 +#include <linux/ethtool.h>
17032 +#include <linux/mii.h>
17033 +#include <linux/if_ether.h>
17034 +#include <linux/etherdevice.h>
17035 +#include <linux/pci.h>
17036 +#include <linux/delay.h>
17037 +#include <linux/init.h>
17038 +#include <linux/version.h>
17039 +
17040 +#include <asm/uaccess.h>
17041 +#include <asm/io.h>
17042 +#include <asm/irq.h>
17043 +
17044 +#include "b44.h"
17045 +
17046 +#define DRV_MODULE_NAME "b44"
17047 +#define PFX DRV_MODULE_NAME ": "
17048 +#define DRV_MODULE_VERSION "0.95"
17049 +#define DRV_MODULE_RELDATE "Aug 3, 2004"
17050 +
17051 +#define B44_DEF_MSG_ENABLE \
17052 + (NETIF_MSG_DRV | \
17053 + NETIF_MSG_PROBE | \
17054 + NETIF_MSG_LINK | \
17055 + NETIF_MSG_TIMER | \
17056 + NETIF_MSG_IFDOWN | \
17057 + NETIF_MSG_IFUP | \
17058 + NETIF_MSG_RX_ERR | \
17059 + NETIF_MSG_TX_ERR)
17060 +
17061 +/* length of time before we decide the hardware is borked,
17062 + * and dev->tx_timeout() should be called to fix the problem
17063 + */
17064 +#define B44_TX_TIMEOUT (5 * HZ)
17065 +
17066 +/* hardware minimum and maximum for a single frame's data payload */
17067 +#define B44_MIN_MTU 60
17068 +#define B44_MAX_MTU 1500
17069 +
17070 +#define B44_RX_RING_SIZE 512
17071 +#define B44_DEF_RX_RING_PENDING 200
17072 +#define B44_RX_RING_BYTES (sizeof(struct dma_desc) * \
17073 + B44_RX_RING_SIZE)
17074 +#define B44_TX_RING_SIZE 512
17075 +#define B44_DEF_TX_RING_PENDING (B44_TX_RING_SIZE - 1)
17076 +#define B44_TX_RING_BYTES (sizeof(struct dma_desc) * \
17077 + B44_TX_RING_SIZE)
17078 +#define B44_DMA_MASK 0x3fffffff
17079 +
17080 +#define TX_RING_GAP(BP) \
17081 + (B44_TX_RING_SIZE - (BP)->tx_pending)
17082 +#define TX_BUFFS_AVAIL(BP) \
17083 + (((BP)->tx_cons <= (BP)->tx_prod) ? \
17084 + (BP)->tx_cons + (BP)->tx_pending - (BP)->tx_prod : \
17085 + (BP)->tx_cons - (BP)->tx_prod - TX_RING_GAP(BP))
17086 +#define NEXT_TX(N) (((N) + 1) & (B44_TX_RING_SIZE - 1))
17087 +
17088 +#define RX_PKT_BUF_SZ (1536 + bp->rx_offset + 64)
17089 +#define TX_PKT_BUF_SZ (B44_MAX_MTU + ETH_HLEN + 8)
17090 +
17091 +/* minimum number of free TX descriptors required to wake up TX process */
17092 +#define B44_TX_WAKEUP_THRESH (B44_TX_RING_SIZE / 4)
17093 +
17094 +static char version[] __devinitdata =
17095 + DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
17096 +
17097 +MODULE_AUTHOR("Florian Schirmer, Pekka Pietikainen, David S. Miller");
17098 +MODULE_DESCRIPTION("Broadcom 4400 10/100 PCI ethernet driver");
17099 +MODULE_LICENSE("GPL");
17100 +MODULE_VERSION(DRV_MODULE_VERSION);
17101 +
17102 +static int b44_debug = -1; /* -1 == use B44_DEF_MSG_ENABLE as value */
17103 +module_param(b44_debug, int, 0);
17104 +MODULE_PARM_DESC(b44_debug, "B44 bitmapped debugging message enable value");
17105 +
17106 +static struct pci_device_id b44_pci_tbl[] = {
17107 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401,
17108 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
17109 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401B0,
17110 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
17111 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401B1,
17112 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
17113 + { } /* terminate list with empty entry */
17114 +};
17115 +
17116 +MODULE_DEVICE_TABLE(pci, b44_pci_tbl);
17117 +
17118 +static void b44_halt(struct b44 *);
17119 +static void b44_init_rings(struct b44 *);
17120 +static void b44_init_hw(struct b44 *);
17121 +static int b44_poll(struct net_device *dev, int *budget);
17122 +#ifdef CONFIG_NET_POLL_CONTROLLER
17123 +static void b44_poll_controller(struct net_device *dev);
17124 +#endif
17125 +
17126 +static inline unsigned long br32(const struct b44 *bp, unsigned long reg)
17127 +{
17128 + return readl(bp->regs + reg);
17129 +}
17130 +
17131 +static inline void bw32(const struct b44 *bp,
17132 + unsigned long reg, unsigned long val)
17133 +{
17134 + writel(val, bp->regs + reg);
17135 +}
17136 +
17137 +static int b44_wait_bit(struct b44 *bp, unsigned long reg,
17138 + u32 bit, unsigned long timeout, const int clear)
17139 +{
17140 + unsigned long i;
17141 +
17142 + for (i = 0; i < timeout; i++) {
17143 + u32 val = br32(bp, reg);
17144 +
17145 + if (clear && !(val & bit))
17146 + break;
17147 + if (!clear && (val & bit))
17148 + break;
17149 + udelay(10);
17150 + }
17151 + if (i == timeout) {
17152 + printk(KERN_ERR PFX "%s: BUG! Timeout waiting for bit %08x of register "
17153 + "%lx to %s.\n",
17154 + bp->dev->name,
17155 + bit, reg,
17156 + (clear ? "clear" : "set"));
17157 + return -ENODEV;
17158 + }
17159 + return 0;
17160 +}
17161 +
17162 +/* Sonics SiliconBackplane support routines. ROFL, you should see all the
17163 + * buzz words used on this company's website :-)
17164 + *
17165 + * All of these routines must be invoked with bp->lock held and
17166 + * interrupts disabled.
17167 + */
17168 +
17169 +#define SB_PCI_DMA 0x40000000 /* Client Mode PCI memory access space (1 GB) */
17170 +#define BCM4400_PCI_CORE_ADDR 0x18002000 /* Address of PCI core on BCM4400 cards */
17171 +
17172 +static u32 ssb_get_core_rev(struct b44 *bp)
17173 +{
17174 + return (br32(bp, B44_SBIDHIGH) & SBIDHIGH_RC_MASK);
17175 +}
17176 +
17177 +static u32 ssb_pci_setup(struct b44 *bp, u32 cores)
17178 +{
17179 + u32 bar_orig, pci_rev, val;
17180 +
17181 + pci_read_config_dword(bp->pdev, SSB_BAR0_WIN, &bar_orig);
17182 + pci_write_config_dword(bp->pdev, SSB_BAR0_WIN, BCM4400_PCI_CORE_ADDR);
17183 + pci_rev = ssb_get_core_rev(bp);
17184 +
17185 + val = br32(bp, B44_SBINTVEC);
17186 + val |= cores;
17187 + bw32(bp, B44_SBINTVEC, val);
17188 +
17189 + val = br32(bp, SSB_PCI_TRANS_2);
17190 + val |= SSB_PCI_PREF | SSB_PCI_BURST;
17191 + bw32(bp, SSB_PCI_TRANS_2, val);
17192 +
17193 + pci_write_config_dword(bp->pdev, SSB_BAR0_WIN, bar_orig);
17194 +
17195 + return pci_rev;
17196 +}
17197 +
17198 +static void ssb_core_disable(struct b44 *bp)
17199 +{
17200 + if (br32(bp, B44_SBTMSLOW) & SBTMSLOW_RESET)
17201 + return;
17202 +
17203 + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_CLOCK));
17204 + b44_wait_bit(bp, B44_SBTMSLOW, SBTMSLOW_REJECT, 100000, 0);
17205 + b44_wait_bit(bp, B44_SBTMSHIGH, SBTMSHIGH_BUSY, 100000, 1);
17206 + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_FGC | SBTMSLOW_CLOCK |
17207 + SBTMSLOW_REJECT | SBTMSLOW_RESET));
17208 + br32(bp, B44_SBTMSLOW);
17209 + udelay(1);
17210 + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_RESET));
17211 + br32(bp, B44_SBTMSLOW);
17212 + udelay(1);
17213 +}
17214 +
17215 +static void ssb_core_reset(struct b44 *bp)
17216 +{
17217 + u32 val;
17218 +
17219 + ssb_core_disable(bp);
17220 + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_RESET | SBTMSLOW_CLOCK | SBTMSLOW_FGC));
17221 + br32(bp, B44_SBTMSLOW);
17222 + udelay(1);
17223 +
17224 + /* Clear SERR if set, this is a hw bug workaround. */
17225 + if (br32(bp, B44_SBTMSHIGH) & SBTMSHIGH_SERR)
17226 + bw32(bp, B44_SBTMSHIGH, 0);
17227 +
17228 + val = br32(bp, B44_SBIMSTATE);
17229 + if (val & (SBIMSTATE_IBE | SBIMSTATE_TO))
17230 + bw32(bp, B44_SBIMSTATE, val & ~(SBIMSTATE_IBE | SBIMSTATE_TO));
17231 +
17232 + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK | SBTMSLOW_FGC));
17233 + br32(bp, B44_SBTMSLOW);
17234 + udelay(1);
17235 +
17236 + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK));
17237 + br32(bp, B44_SBTMSLOW);
17238 + udelay(1);
17239 +}
17240 +
17241 +static int ssb_core_unit(struct b44 *bp)
17242 +{
17243 +#if 0
17244 + u32 val = br32(bp, B44_SBADMATCH0);
17245 + u32 base;
17246 +
17247 + type = val & SBADMATCH0_TYPE_MASK;
17248 + switch (type) {
17249 + case 0:
17250 + base = val & SBADMATCH0_BS0_MASK;
17251 + break;
17252 +
17253 + case 1:
17254 + base = val & SBADMATCH0_BS1_MASK;
17255 + break;
17256 +
17257 + case 2:
17258 + default:
17259 + base = val & SBADMATCH0_BS2_MASK;
17260 + break;
17261 + };
17262 +#endif
17263 + return 0;
17264 +}
17265 +
17266 +static int ssb_is_core_up(struct b44 *bp)
17267 +{
17268 + return ((br32(bp, B44_SBTMSLOW) & (SBTMSLOW_RESET | SBTMSLOW_REJECT | SBTMSLOW_CLOCK))
17269 + == SBTMSLOW_CLOCK);
17270 +}
17271 +
17272 +static void __b44_cam_write(struct b44 *bp, unsigned char *data, int index)
17273 +{
17274 + u32 val;
17275 +
17276 + val = ((u32) data[2]) << 24;
17277 + val |= ((u32) data[3]) << 16;
17278 + val |= ((u32) data[4]) << 8;
17279 + val |= ((u32) data[5]) << 0;
17280 + bw32(bp, B44_CAM_DATA_LO, val);
17281 + val = (CAM_DATA_HI_VALID |
17282 + (((u32) data[0]) << 8) |
17283 + (((u32) data[1]) << 0));
17284 + bw32(bp, B44_CAM_DATA_HI, val);
17285 + bw32(bp, B44_CAM_CTRL, (CAM_CTRL_WRITE |
17286 + (index << CAM_CTRL_INDEX_SHIFT)));
17287 + b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1);
17288 +}
17289 +
17290 +static inline void __b44_disable_ints(struct b44 *bp)
17291 +{
17292 + bw32(bp, B44_IMASK, 0);
17293 +}
17294 +
17295 +static void b44_disable_ints(struct b44 *bp)
17296 +{
17297 + __b44_disable_ints(bp);
17298 +
17299 + /* Flush posted writes. */
17300 + br32(bp, B44_IMASK);
17301 +}
17302 +
17303 +static void b44_enable_ints(struct b44 *bp)
17304 +{
17305 + bw32(bp, B44_IMASK, bp->imask);
17306 +}
17307 +
17308 +static int b44_readphy(struct b44 *bp, int reg, u32 *val)
17309 +{
17310 + int err;
17311 +
17312 + bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII);
17313 + bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START |
17314 + (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) |
17315 + (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
17316 + (reg << MDIO_DATA_RA_SHIFT) |
17317 + (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT)));
17318 + err = b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
17319 + *val = br32(bp, B44_MDIO_DATA) & MDIO_DATA_DATA;
17320 +
17321 + return err;
17322 +}
17323 +
17324 +static int b44_writephy(struct b44 *bp, int reg, u32 val)
17325 +{
17326 + bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII);
17327 + bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START |
17328 + (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) |
17329 + (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
17330 + (reg << MDIO_DATA_RA_SHIFT) |
17331 + (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT) |
17332 + (val & MDIO_DATA_DATA)));
17333 + return b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
17334 +}
17335 +
17336 +/* miilib interface */
17337 +/* FIXME FIXME: phy_id is ignored, bp->phy_addr use is unconditional
17338 + * due to code existing before miilib use was added to this driver.
17339 + * Someone should remove this artificial driver limitation in
17340 + * b44_{read,write}phy. bp->phy_addr itself is fine (and needed).
17341 + */
17342 +static int b44_mii_read(struct net_device *dev, int phy_id, int location)
17343 +{
17344 + u32 val;
17345 + struct b44 *bp = netdev_priv(dev);
17346 + int rc = b44_readphy(bp, location, &val);
17347 + if (rc)
17348 + return 0xffffffff;
17349 + return val;
17350 +}
17351 +
17352 +static void b44_mii_write(struct net_device *dev, int phy_id, int location,
17353 + int val)
17354 +{
17355 + struct b44 *bp = netdev_priv(dev);
17356 + b44_writephy(bp, location, val);
17357 +}
17358 +
17359 +static int b44_phy_reset(struct b44 *bp)
17360 +{
17361 + u32 val;
17362 + int err;
17363 +
17364 + err = b44_writephy(bp, MII_BMCR, BMCR_RESET);
17365 + if (err)
17366 + return err;
17367 + udelay(100);
17368 + err = b44_readphy(bp, MII_BMCR, &val);
17369 + if (!err) {
17370 + if (val & BMCR_RESET) {
17371 + printk(KERN_ERR PFX "%s: PHY Reset would not complete.\n",
17372 + bp->dev->name);
17373 + err = -ENODEV;
17374 + }
17375 + }
17376 +
17377 + return 0;
17378 +}
17379 +
17380 +static void __b44_set_flow_ctrl(struct b44 *bp, u32 pause_flags)
17381 +{
17382 + u32 val;
17383 +
17384 + bp->flags &= ~(B44_FLAG_TX_PAUSE | B44_FLAG_RX_PAUSE);
17385 + bp->flags |= pause_flags;
17386 +
17387 + val = br32(bp, B44_RXCONFIG);
17388 + if (pause_flags & B44_FLAG_RX_PAUSE)
17389 + val |= RXCONFIG_FLOW;
17390 + else
17391 + val &= ~RXCONFIG_FLOW;
17392 + bw32(bp, B44_RXCONFIG, val);
17393 +
17394 + val = br32(bp, B44_MAC_FLOW);
17395 + if (pause_flags & B44_FLAG_TX_PAUSE)
17396 + val |= (MAC_FLOW_PAUSE_ENAB |
17397 + (0xc0 & MAC_FLOW_RX_HI_WATER));
17398 + else
17399 + val &= ~MAC_FLOW_PAUSE_ENAB;
17400 + bw32(bp, B44_MAC_FLOW, val);
17401 +}
17402 +
17403 +static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote)
17404 +{
17405 + u32 pause_enab = bp->flags & (B44_FLAG_TX_PAUSE |
17406 + B44_FLAG_RX_PAUSE);
17407 +
17408 + if (local & ADVERTISE_PAUSE_CAP) {
17409 + if (local & ADVERTISE_PAUSE_ASYM) {
17410 + if (remote & LPA_PAUSE_CAP)
17411 + pause_enab |= (B44_FLAG_TX_PAUSE |
17412 + B44_FLAG_RX_PAUSE);
17413 + else if (remote & LPA_PAUSE_ASYM)
17414 + pause_enab |= B44_FLAG_RX_PAUSE;
17415 + } else {
17416 + if (remote & LPA_PAUSE_CAP)
17417 + pause_enab |= (B44_FLAG_TX_PAUSE |
17418 + B44_FLAG_RX_PAUSE);
17419 + }
17420 + } else if (local & ADVERTISE_PAUSE_ASYM) {
17421 + if ((remote & LPA_PAUSE_CAP) &&
17422 + (remote & LPA_PAUSE_ASYM))
17423 + pause_enab |= B44_FLAG_TX_PAUSE;
17424 + }
17425 +
17426 + __b44_set_flow_ctrl(bp, pause_enab);
17427 +}
17428 +
17429 +static int b44_setup_phy(struct b44 *bp)
17430 +{
17431 + u32 val;
17432 + int err;
17433 +
17434 + if ((err = b44_readphy(bp, B44_MII_ALEDCTRL, &val)) != 0)
17435 + goto out;
17436 + if ((err = b44_writephy(bp, B44_MII_ALEDCTRL,
17437 + val & MII_ALEDCTRL_ALLMSK)) != 0)
17438 + goto out;
17439 + if ((err = b44_readphy(bp, B44_MII_TLEDCTRL, &val)) != 0)
17440 + goto out;
17441 + if ((err = b44_writephy(bp, B44_MII_TLEDCTRL,
17442 + val | MII_TLEDCTRL_ENABLE)) != 0)
17443 + goto out;
17444 +
17445 + if (!(bp->flags & B44_FLAG_FORCE_LINK)) {
17446 + u32 adv = ADVERTISE_CSMA;
17447 +
17448 + if (bp->flags & B44_FLAG_ADV_10HALF)
17449 + adv |= ADVERTISE_10HALF;
17450 + if (bp->flags & B44_FLAG_ADV_10FULL)
17451 + adv |= ADVERTISE_10FULL;
17452 + if (bp->flags & B44_FLAG_ADV_100HALF)
17453 + adv |= ADVERTISE_100HALF;
17454 + if (bp->flags & B44_FLAG_ADV_100FULL)
17455 + adv |= ADVERTISE_100FULL;
17456 +
17457 + if (bp->flags & B44_FLAG_PAUSE_AUTO)
17458 + adv |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
17459 +
17460 + if ((err = b44_writephy(bp, MII_ADVERTISE, adv)) != 0)
17461 + goto out;
17462 + if ((err = b44_writephy(bp, MII_BMCR, (BMCR_ANENABLE |
17463 + BMCR_ANRESTART))) != 0)
17464 + goto out;
17465 + } else {
17466 + u32 bmcr;
17467 +
17468 + if ((err = b44_readphy(bp, MII_BMCR, &bmcr)) != 0)
17469 + goto out;
17470 + bmcr &= ~(BMCR_FULLDPLX | BMCR_ANENABLE | BMCR_SPEED100);
17471 + if (bp->flags & B44_FLAG_100_BASE_T)
17472 + bmcr |= BMCR_SPEED100;
17473 + if (bp->flags & B44_FLAG_FULL_DUPLEX)
17474 + bmcr |= BMCR_FULLDPLX;
17475 + if ((err = b44_writephy(bp, MII_BMCR, bmcr)) != 0)
17476 + goto out;
17477 +
17478 + /* Since we will not be negotiating there is no safe way
17479 + * to determine if the link partner supports flow control
17480 + * or not. So just disable it completely in this case.
17481 + */
17482 + b44_set_flow_ctrl(bp, 0, 0);
17483 + }
17484 +
17485 +out:
17486 + return err;
17487 +}
17488 +
17489 +static void b44_stats_update(struct b44 *bp)
17490 +{
17491 + unsigned long reg;
17492 + u32 *val;
17493 +
17494 + val = &bp->hw_stats.tx_good_octets;
17495 + for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) {
17496 + *val++ += br32(bp, reg);
17497 + }
17498 + val = &bp->hw_stats.rx_good_octets;
17499 + for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) {
17500 + *val++ += br32(bp, reg);
17501 + }
17502 +}
17503 +
17504 +static void b44_link_report(struct b44 *bp)
17505 +{
17506 + if (!netif_carrier_ok(bp->dev)) {
17507 + printk(KERN_INFO PFX "%s: Link is down.\n", bp->dev->name);
17508 + } else {
17509 + printk(KERN_INFO PFX "%s: Link is up at %d Mbps, %s duplex.\n",
17510 + bp->dev->name,
17511 + (bp->flags & B44_FLAG_100_BASE_T) ? 100 : 10,
17512 + (bp->flags & B44_FLAG_FULL_DUPLEX) ? "full" : "half");
17513 +
17514 + printk(KERN_INFO PFX "%s: Flow control is %s for TX and "
17515 + "%s for RX.\n",
17516 + bp->dev->name,
17517 + (bp->flags & B44_FLAG_TX_PAUSE) ? "on" : "off",
17518 + (bp->flags & B44_FLAG_RX_PAUSE) ? "on" : "off");
17519 + }
17520 +}
17521 +
17522 +static void b44_check_phy(struct b44 *bp)
17523 +{
17524 + u32 bmsr, aux;
17525 +
17526 + if (!b44_readphy(bp, MII_BMSR, &bmsr) &&
17527 + !b44_readphy(bp, B44_MII_AUXCTRL, &aux) &&
17528 + (bmsr != 0xffff)) {
17529 + if (aux & MII_AUXCTRL_SPEED)
17530 + bp->flags |= B44_FLAG_100_BASE_T;
17531 + else
17532 + bp->flags &= ~B44_FLAG_100_BASE_T;
17533 + if (aux & MII_AUXCTRL_DUPLEX)
17534 + bp->flags |= B44_FLAG_FULL_DUPLEX;
17535 + else
17536 + bp->flags &= ~B44_FLAG_FULL_DUPLEX;
17537 +
17538 + if (!netif_carrier_ok(bp->dev) &&
17539 + (bmsr & BMSR_LSTATUS)) {
17540 + u32 val = br32(bp, B44_TX_CTRL);
17541 + u32 local_adv, remote_adv;
17542 +
17543 + if (bp->flags & B44_FLAG_FULL_DUPLEX)
17544 + val |= TX_CTRL_DUPLEX;
17545 + else
17546 + val &= ~TX_CTRL_DUPLEX;
17547 + bw32(bp, B44_TX_CTRL, val);
17548 +
17549 + if (!(bp->flags & B44_FLAG_FORCE_LINK) &&
17550 + !b44_readphy(bp, MII_ADVERTISE, &local_adv) &&
17551 + !b44_readphy(bp, MII_LPA, &remote_adv))
17552 + b44_set_flow_ctrl(bp, local_adv, remote_adv);
17553 +
17554 + /* Link now up */
17555 + netif_carrier_on(bp->dev);
17556 + b44_link_report(bp);
17557 + } else if (netif_carrier_ok(bp->dev) && !(bmsr & BMSR_LSTATUS)) {
17558 + /* Link now down */
17559 + netif_carrier_off(bp->dev);
17560 + b44_link_report(bp);
17561 + }
17562 +
17563 + if (bmsr & BMSR_RFAULT)
17564 + printk(KERN_WARNING PFX "%s: Remote fault detected in PHY\n",
17565 + bp->dev->name);
17566 + if (bmsr & BMSR_JCD)
17567 + printk(KERN_WARNING PFX "%s: Jabber detected in PHY\n",
17568 + bp->dev->name);
17569 + }
17570 +}
17571 +
17572 +static void b44_timer(unsigned long __opaque)
17573 +{
17574 + struct b44 *bp = (struct b44 *) __opaque;
17575 +
17576 + spin_lock_irq(&bp->lock);
17577 +
17578 + b44_check_phy(bp);
17579 +
17580 + b44_stats_update(bp);
17581 +
17582 + spin_unlock_irq(&bp->lock);
17583 +
17584 + bp->timer.expires = jiffies + HZ;
17585 + add_timer(&bp->timer);
17586 +}
17587 +
17588 +static void b44_tx(struct b44 *bp)
17589 +{
17590 + u32 cur, cons;
17591 +
17592 + cur = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK;
17593 + cur /= sizeof(struct dma_desc);
17594 +
17595 + /* XXX needs updating when NETIF_F_SG is supported */
17596 + for (cons = bp->tx_cons; cons != cur; cons = NEXT_TX(cons)) {
17597 + struct ring_info *rp = &bp->tx_buffers[cons];
17598 + struct sk_buff *skb = rp->skb;
17599 +
17600 + if (unlikely(skb == NULL))
17601 + BUG();
17602 +
17603 + pci_unmap_single(bp->pdev,
17604 + pci_unmap_addr(rp, mapping),
17605 + skb->len,
17606 + PCI_DMA_TODEVICE);
17607 + rp->skb = NULL;
17608 + dev_kfree_skb_irq(skb);
17609 + }
17610 +
17611 + bp->tx_cons = cons;
17612 + if (netif_queue_stopped(bp->dev) &&
17613 + TX_BUFFS_AVAIL(bp) > B44_TX_WAKEUP_THRESH)
17614 + netif_wake_queue(bp->dev);
17615 +
17616 + bw32(bp, B44_GPTIMER, 0);
17617 +}
17618 +
17619 +/* Works like this. This chip writes a 'struct rx_header" 30 bytes
17620 + * before the DMA address you give it. So we allocate 30 more bytes
17621 + * for the RX buffer, DMA map all of it, skb_reserve the 30 bytes, then
17622 + * point the chip at 30 bytes past where the rx_header will go.
17623 + */
17624 +static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
17625 +{
17626 + struct dma_desc *dp;
17627 + struct ring_info *src_map, *map;
17628 + struct rx_header *rh;
17629 + struct sk_buff *skb;
17630 + dma_addr_t mapping;
17631 + int dest_idx;
17632 + u32 ctrl;
17633 +
17634 + src_map = NULL;
17635 + if (src_idx >= 0)
17636 + src_map = &bp->rx_buffers[src_idx];
17637 + dest_idx = dest_idx_unmasked & (B44_RX_RING_SIZE - 1);
17638 + map = &bp->rx_buffers[dest_idx];
17639 + skb = dev_alloc_skb(RX_PKT_BUF_SZ);
17640 + if (skb == NULL)
17641 + return -ENOMEM;
17642 +
17643 + mapping = pci_map_single(bp->pdev, skb->data,
17644 + RX_PKT_BUF_SZ,
17645 + PCI_DMA_FROMDEVICE);
17646 +
17647 + /* Hardware bug work-around, the chip is unable to do PCI DMA
17648 + to/from anything above 1GB :-( */
17649 + if(mapping+RX_PKT_BUF_SZ > B44_DMA_MASK) {
17650 + /* Sigh... */
17651 + pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
17652 + dev_kfree_skb_any(skb);
17653 + skb = __dev_alloc_skb(RX_PKT_BUF_SZ,GFP_DMA);
17654 + if (skb == NULL)
17655 + return -ENOMEM;
17656 + mapping = pci_map_single(bp->pdev, skb->data,
17657 + RX_PKT_BUF_SZ,
17658 + PCI_DMA_FROMDEVICE);
17659 + if(mapping+RX_PKT_BUF_SZ > B44_DMA_MASK) {
17660 + pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
17661 + dev_kfree_skb_any(skb);
17662 + return -ENOMEM;
17663 + }
17664 + }
17665 +
17666 + skb->dev = bp->dev;
17667 + skb_reserve(skb, bp->rx_offset);
17668 +
17669 + rh = (struct rx_header *)
17670 + (skb->data - bp->rx_offset);
17671 + rh->len = 0;
17672 + rh->flags = 0;
17673 +
17674 + map->skb = skb;
17675 + pci_unmap_addr_set(map, mapping, mapping);
17676 +
17677 + if (src_map != NULL)
17678 + src_map->skb = NULL;
17679 +
17680 + ctrl = (DESC_CTRL_LEN & (RX_PKT_BUF_SZ - bp->rx_offset));
17681 + if (dest_idx == (B44_RX_RING_SIZE - 1))
17682 + ctrl |= DESC_CTRL_EOT;
17683 +
17684 + dp = &bp->rx_ring[dest_idx];
17685 + dp->ctrl = cpu_to_le32(ctrl);
17686 + dp->addr = cpu_to_le32((u32) mapping + bp->rx_offset + bp->dma_offset);
17687 +
17688 + return RX_PKT_BUF_SZ;
17689 +}
17690 +
17691 +static void b44_recycle_rx(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
17692 +{
17693 + struct dma_desc *src_desc, *dest_desc;
17694 + struct ring_info *src_map, *dest_map;
17695 + struct rx_header *rh;
17696 + int dest_idx;
17697 + u32 ctrl;
17698 +
17699 + dest_idx = dest_idx_unmasked & (B44_RX_RING_SIZE - 1);
17700 + dest_desc = &bp->rx_ring[dest_idx];
17701 + dest_map = &bp->rx_buffers[dest_idx];
17702 + src_desc = &bp->rx_ring[src_idx];
17703 + src_map = &bp->rx_buffers[src_idx];
17704 +
17705 + dest_map->skb = src_map->skb;
17706 + rh = (struct rx_header *) src_map->skb->data;
17707 + rh->len = 0;
17708 + rh->flags = 0;
17709 + pci_unmap_addr_set(dest_map, mapping,
17710 + pci_unmap_addr(src_map, mapping));
17711 +
17712 + ctrl = src_desc->ctrl;
17713 + if (dest_idx == (B44_RX_RING_SIZE - 1))
17714 + ctrl |= cpu_to_le32(DESC_CTRL_EOT);
17715 + else
17716 + ctrl &= cpu_to_le32(~DESC_CTRL_EOT);
17717 +
17718 + dest_desc->ctrl = ctrl;
17719 + dest_desc->addr = src_desc->addr;
17720 + src_map->skb = NULL;
17721 +
17722 + pci_dma_sync_single_for_device(bp->pdev, src_desc->addr,
17723 + RX_PKT_BUF_SZ,
17724 + PCI_DMA_FROMDEVICE);
17725 +}
17726 +
17727 +static int b44_rx(struct b44 *bp, int budget)
17728 +{
17729 + int received;
17730 + u32 cons, prod;
17731 +
17732 + received = 0;
17733 + prod = br32(bp, B44_DMARX_STAT) & DMARX_STAT_CDMASK;
17734 + prod /= sizeof(struct dma_desc);
17735 + cons = bp->rx_cons;
17736 +
17737 + while (cons != prod && budget > 0) {
17738 + struct ring_info *rp = &bp->rx_buffers[cons];
17739 + struct sk_buff *skb = rp->skb;
17740 + dma_addr_t map = pci_unmap_addr(rp, mapping);
17741 + struct rx_header *rh;
17742 + u16 len;
17743 +
17744 + pci_dma_sync_single_for_cpu(bp->pdev, map,
17745 + RX_PKT_BUF_SZ,
17746 + PCI_DMA_FROMDEVICE);
17747 + rh = (struct rx_header *) skb->data;
17748 + len = cpu_to_le16(rh->len);
17749 + if ((len > (RX_PKT_BUF_SZ - bp->rx_offset)) ||
17750 + (rh->flags & cpu_to_le16(RX_FLAG_ERRORS))) {
17751 + drop_it:
17752 + b44_recycle_rx(bp, cons, bp->rx_prod);
17753 + drop_it_no_recycle:
17754 + bp->stats.rx_dropped++;
17755 + goto next_pkt;
17756 + }
17757 +
17758 + if (len == 0) {
17759 + int i = 0;
17760 +
17761 + do {
17762 + udelay(2);
17763 + barrier();
17764 + len = cpu_to_le16(rh->len);
17765 + } while (len == 0 && i++ < 5);
17766 + if (len == 0)
17767 + goto drop_it;
17768 + }
17769 +
17770 + /* Omit CRC. */
17771 + len -= 4;
17772 +
17773 + if (len > RX_COPY_THRESHOLD) {
17774 + int skb_size;
17775 + skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod);
17776 + if (skb_size < 0)
17777 + goto drop_it;
17778 + pci_unmap_single(bp->pdev, map,
17779 + skb_size, PCI_DMA_FROMDEVICE);
17780 + /* Leave out rx_header */
17781 + skb_put(skb, len+bp->rx_offset);
17782 + skb_pull(skb,bp->rx_offset);
17783 + } else {
17784 + struct sk_buff *copy_skb;
17785 +
17786 + b44_recycle_rx(bp, cons, bp->rx_prod);
17787 + copy_skb = dev_alloc_skb(len + 2);
17788 + if (copy_skb == NULL)
17789 + goto drop_it_no_recycle;
17790 +
17791 + copy_skb->dev = bp->dev;
17792 + skb_reserve(copy_skb, 2);
17793 + skb_put(copy_skb, len);
17794 + /* DMA sync done above, copy just the actual packet */
17795 + memcpy(copy_skb->data, skb->data+bp->rx_offset, len);
17796 +
17797 + skb = copy_skb;
17798 + }
17799 + skb->ip_summed = CHECKSUM_NONE;
17800 + skb->protocol = eth_type_trans(skb, bp->dev);
17801 + netif_receive_skb(skb);
17802 + bp->dev->last_rx = jiffies;
17803 + received++;
17804 + budget--;
17805 + next_pkt:
17806 + bp->rx_prod = (bp->rx_prod + 1) &
17807 + (B44_RX_RING_SIZE - 1);
17808 + cons = (cons + 1) & (B44_RX_RING_SIZE - 1);
17809 + }
17810 +
17811 + bp->rx_cons = cons;
17812 + bw32(bp, B44_DMARX_PTR, cons * sizeof(struct dma_desc));
17813 +
17814 + return received;
17815 +}
17816 +
17817 +static int b44_poll(struct net_device *netdev, int *budget)
17818 +{
17819 + struct b44 *bp = netdev_priv(netdev);
17820 + int done;
17821 +
17822 + spin_lock_irq(&bp->lock);
17823 +
17824 + if (bp->istat & (ISTAT_TX | ISTAT_TO)) {
17825 + /* spin_lock(&bp->tx_lock); */
17826 + b44_tx(bp);
17827 + /* spin_unlock(&bp->tx_lock); */
17828 + }
17829 + spin_unlock_irq(&bp->lock);
17830 +
17831 + done = 1;
17832 + if (bp->istat & ISTAT_RX) {
17833 + int orig_budget = *budget;
17834 + int work_done;
17835 +
17836 + if (orig_budget > netdev->quota)
17837 + orig_budget = netdev->quota;
17838 +
17839 + work_done = b44_rx(bp, orig_budget);
17840 +
17841 + *budget -= work_done;
17842 + netdev->quota -= work_done;
17843 +
17844 + if (work_done >= orig_budget)
17845 + done = 0;
17846 + }
17847 +
17848 + if (bp->istat & ISTAT_ERRORS) {
17849 + spin_lock_irq(&bp->lock);
17850 + b44_halt(bp);
17851 + b44_init_rings(bp);
17852 + b44_init_hw(bp);
17853 + netif_wake_queue(bp->dev);
17854 + spin_unlock_irq(&bp->lock);
17855 + done = 1;
17856 + }
17857 +
17858 + if (done) {
17859 + netif_rx_complete(netdev);
17860 + b44_enable_ints(bp);
17861 + }
17862 +
17863 + return (done ? 0 : 1);
17864 +}
17865 +
17866 +static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs)
17867 +{
17868 + struct net_device *dev = dev_id;
17869 + struct b44 *bp = netdev_priv(dev);
17870 + unsigned long flags;
17871 + u32 istat, imask;
17872 + int handled = 0;
17873 +
17874 + spin_lock_irqsave(&bp->lock, flags);
17875 +
17876 + istat = br32(bp, B44_ISTAT);
17877 + imask = br32(bp, B44_IMASK);
17878 +
17879 + /* ??? What the fuck is the purpose of the interrupt mask
17880 + * ??? register if we have to mask it out by hand anyways?
17881 + */
17882 + istat &= imask;
17883 + if (istat) {
17884 + handled = 1;
17885 + if (netif_rx_schedule_prep(dev)) {
17886 + /* NOTE: These writes are posted by the readback of
17887 + * the ISTAT register below.
17888 + */
17889 + bp->istat = istat;
17890 + __b44_disable_ints(bp);
17891 + __netif_rx_schedule(dev);
17892 + } else {
17893 + printk(KERN_ERR PFX "%s: Error, poll already scheduled\n",
17894 + dev->name);
17895 + }
17896 +
17897 + bw32(bp, B44_ISTAT, istat);
17898 + br32(bp, B44_ISTAT);
17899 + }
17900 + spin_unlock_irqrestore(&bp->lock, flags);
17901 + return IRQ_RETVAL(handled);
17902 +}
17903 +
17904 +static void b44_tx_timeout(struct net_device *dev)
17905 +{
17906 + struct b44 *bp = netdev_priv(dev);
17907 +
17908 + printk(KERN_ERR PFX "%s: transmit timed out, resetting\n",
17909 + dev->name);
17910 +
17911 + spin_lock_irq(&bp->lock);
17912 +
17913 + b44_halt(bp);
17914 + b44_init_rings(bp);
17915 + b44_init_hw(bp);
17916 +
17917 + spin_unlock_irq(&bp->lock);
17918 +
17919 + b44_enable_ints(bp);
17920 +
17921 + netif_wake_queue(dev);
17922 +}
17923 +
17924 +static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
17925 +{
17926 + struct b44 *bp = netdev_priv(dev);
17927 + struct sk_buff *bounce_skb;
17928 + dma_addr_t mapping;
17929 + u32 len, entry, ctrl;
17930 +
17931 + len = skb->len;
17932 + spin_lock_irq(&bp->lock);
17933 +
17934 + /* This is a hard error, log it. */
17935 + if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) {
17936 + netif_stop_queue(dev);
17937 + spin_unlock_irq(&bp->lock);
17938 + printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n",
17939 + dev->name);
17940 + return 1;
17941 + }
17942 +
17943 + mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE);
17944 + if(mapping+len > B44_DMA_MASK) {
17945 + /* Chip can't handle DMA to/from >1GB, use bounce buffer */
17946 + pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE);
17947 +
17948 + bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ,
17949 + GFP_ATOMIC|GFP_DMA);
17950 + if (!bounce_skb)
17951 + return NETDEV_TX_BUSY;
17952 +
17953 + mapping = pci_map_single(bp->pdev, bounce_skb->data,
17954 + len, PCI_DMA_TODEVICE);
17955 + if(mapping+len > B44_DMA_MASK) {
17956 + pci_unmap_single(bp->pdev, mapping,
17957 + len, PCI_DMA_TODEVICE);
17958 + dev_kfree_skb_any(bounce_skb);
17959 + return NETDEV_TX_BUSY;
17960 + }
17961 +
17962 + memcpy(skb_put(bounce_skb, len), skb->data, skb->len);
17963 + dev_kfree_skb_any(skb);
17964 + skb = bounce_skb;
17965 + }
17966 +
17967 + entry = bp->tx_prod;
17968 + bp->tx_buffers[entry].skb = skb;
17969 + pci_unmap_addr_set(&bp->tx_buffers[entry], mapping, mapping);
17970 +
17971 + ctrl = (len & DESC_CTRL_LEN);
17972 + ctrl |= DESC_CTRL_IOC | DESC_CTRL_SOF | DESC_CTRL_EOF;
17973 + if (entry == (B44_TX_RING_SIZE - 1))
17974 + ctrl |= DESC_CTRL_EOT;
17975 +
17976 + bp->tx_ring[entry].ctrl = cpu_to_le32(ctrl);
17977 + bp->tx_ring[entry].addr = cpu_to_le32((u32) mapping+bp->dma_offset);
17978 +
17979 + entry = NEXT_TX(entry);
17980 +
17981 + bp->tx_prod = entry;
17982 +
17983 + wmb();
17984 +
17985 + bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc));
17986 + if (bp->flags & B44_FLAG_BUGGY_TXPTR)
17987 + bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc));
17988 + if (bp->flags & B44_FLAG_REORDER_BUG)
17989 + br32(bp, B44_DMATX_PTR);
17990 +
17991 + if (TX_BUFFS_AVAIL(bp) < 1)
17992 + netif_stop_queue(dev);
17993 +
17994 + spin_unlock_irq(&bp->lock);
17995 +
17996 + dev->trans_start = jiffies;
17997 +
17998 + return 0;
17999 +}
18000 +
18001 +static int b44_change_mtu(struct net_device *dev, int new_mtu)
18002 +{
18003 + struct b44 *bp = netdev_priv(dev);
18004 +
18005 + if (new_mtu < B44_MIN_MTU || new_mtu > B44_MAX_MTU)
18006 + return -EINVAL;
18007 +
18008 + if (!netif_running(dev)) {
18009 + /* We'll just catch it later when the
18010 + * device is up'd.
18011 + */
18012 + dev->mtu = new_mtu;
18013 + return 0;
18014 + }
18015 +
18016 + spin_lock_irq(&bp->lock);
18017 + b44_halt(bp);
18018 + dev->mtu = new_mtu;
18019 + b44_init_rings(bp);
18020 + b44_init_hw(bp);
18021 + spin_unlock_irq(&bp->lock);
18022 +
18023 + b44_enable_ints(bp);
18024 +
18025 + return 0;
18026 +}
18027 +
18028 +/* Free up pending packets in all rx/tx rings.
18029 + *
18030 + * The chip has been shut down and the driver detached from
18031 + * the networking, so no interrupts or new tx packets will
18032 + * end up in the driver. bp->lock is not held and we are not
18033 + * in an interrupt context and thus may sleep.
18034 + */
18035 +static void b44_free_rings(struct b44 *bp)
18036 +{
18037 + struct ring_info *rp;
18038 + int i;
18039 +
18040 + for (i = 0; i < B44_RX_RING_SIZE; i++) {
18041 + rp = &bp->rx_buffers[i];
18042 +
18043 + if (rp->skb == NULL)
18044 + continue;
18045 + pci_unmap_single(bp->pdev,
18046 + pci_unmap_addr(rp, mapping),
18047 + RX_PKT_BUF_SZ,
18048 + PCI_DMA_FROMDEVICE);
18049 + dev_kfree_skb_any(rp->skb);
18050 + rp->skb = NULL;
18051 + }
18052 +
18053 + /* XXX needs changes once NETIF_F_SG is set... */
18054 + for (i = 0; i < B44_TX_RING_SIZE; i++) {
18055 + rp = &bp->tx_buffers[i];
18056 +
18057 + if (rp->skb == NULL)
18058 + continue;
18059 + pci_unmap_single(bp->pdev,
18060 + pci_unmap_addr(rp, mapping),
18061 + rp->skb->len,
18062 + PCI_DMA_TODEVICE);
18063 + dev_kfree_skb_any(rp->skb);
18064 + rp->skb = NULL;
18065 + }
18066 +}
18067 +
18068 +/* Initialize tx/rx rings for packet processing.
18069 + *
18070 + * The chip has been shut down and the driver detached from
18071 + * the networking, so no interrupts or new tx packets will
18072 + * end up in the driver. bp->lock is not held and we are not
18073 + * in an interrupt context and thus may sleep.
18074 + */
18075 +static void b44_init_rings(struct b44 *bp)
18076 +{
18077 + int i;
18078 +
18079 + b44_free_rings(bp);
18080 +
18081 + memset(bp->rx_ring, 0, B44_RX_RING_BYTES);
18082 + memset(bp->tx_ring, 0, B44_TX_RING_BYTES);
18083 +
18084 + for (i = 0; i < bp->rx_pending; i++) {
18085 + if (b44_alloc_rx_skb(bp, -1, i) < 0)
18086 + break;
18087 + }
18088 +}
18089 +
18090 +/*
18091 + * Must not be invoked with interrupt sources disabled and
18092 + * the hardware shutdown down.
18093 + */
18094 +static void b44_free_consistent(struct b44 *bp)
18095 +{
18096 + if (bp->rx_buffers) {
18097 + kfree(bp->rx_buffers);
18098 + bp->rx_buffers = NULL;
18099 + }
18100 + if (bp->tx_buffers) {
18101 + kfree(bp->tx_buffers);
18102 + bp->tx_buffers = NULL;
18103 + }
18104 + if (bp->rx_ring) {
18105 + pci_free_consistent(bp->pdev, DMA_TABLE_BYTES,
18106 + bp->rx_ring, bp->rx_ring_dma);
18107 + bp->rx_ring = NULL;
18108 + }
18109 + if (bp->tx_ring) {
18110 + pci_free_consistent(bp->pdev, DMA_TABLE_BYTES,
18111 + bp->tx_ring, bp->tx_ring_dma);
18112 + bp->tx_ring = NULL;
18113 + }
18114 +}
18115 +
18116 +/*
18117 + * Must not be invoked with interrupt sources disabled and
18118 + * the hardware shutdown down. Can sleep.
18119 + */
18120 +static int b44_alloc_consistent(struct b44 *bp)
18121 +{
18122 + int size;
18123 +
18124 + size = B44_RX_RING_SIZE * sizeof(struct ring_info);
18125 + bp->rx_buffers = kmalloc(size, GFP_KERNEL);
18126 + if (!bp->rx_buffers)
18127 + goto out_err;
18128 + memset(bp->rx_buffers, 0, size);
18129 +
18130 + size = B44_TX_RING_SIZE * sizeof(struct ring_info);
18131 + bp->tx_buffers = kmalloc(size, GFP_KERNEL);
18132 + if (!bp->tx_buffers)
18133 + goto out_err;
18134 + memset(bp->tx_buffers, 0, size);
18135 +
18136 + size = DMA_TABLE_BYTES;
18137 + bp->rx_ring = pci_alloc_consistent(bp->pdev, size, &bp->rx_ring_dma);
18138 + if (!bp->rx_ring)
18139 + goto out_err;
18140 +
18141 + bp->tx_ring = pci_alloc_consistent(bp->pdev, size, &bp->tx_ring_dma);
18142 + if (!bp->tx_ring)
18143 + goto out_err;
18144 +
18145 + return 0;
18146 +
18147 +out_err:
18148 + b44_free_consistent(bp);
18149 + return -ENOMEM;
18150 +}
18151 +
18152 +/* bp->lock is held. */
18153 +static void b44_clear_stats(struct b44 *bp)
18154 +{
18155 + unsigned long reg;
18156 +
18157 + bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
18158 + for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL)
18159 + br32(bp, reg);
18160 + for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL)
18161 + br32(bp, reg);
18162 +}
18163 +
18164 +/* bp->lock is held. */
18165 +static void b44_chip_reset(struct b44 *bp)
18166 +{
18167 + if (ssb_is_core_up(bp)) {
18168 + bw32(bp, B44_RCV_LAZY, 0);
18169 + bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE);
18170 + b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 100, 1);
18171 + bw32(bp, B44_DMATX_CTRL, 0);
18172 + bp->tx_prod = bp->tx_cons = 0;
18173 + if (br32(bp, B44_DMARX_STAT) & DMARX_STAT_EMASK) {
18174 + b44_wait_bit(bp, B44_DMARX_STAT, DMARX_STAT_SIDLE,
18175 + 100, 0);
18176 + }
18177 + bw32(bp, B44_DMARX_CTRL, 0);
18178 + bp->rx_prod = bp->rx_cons = 0;
18179 + } else {
18180 + ssb_pci_setup(bp, (bp->core_unit == 0 ?
18181 + SBINTVEC_ENET0 :
18182 + SBINTVEC_ENET1));
18183 + }
18184 +
18185 + ssb_core_reset(bp);
18186 +
18187 + b44_clear_stats(bp);
18188 +
18189 + /* Make PHY accessible. */
18190 + bw32(bp, B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
18191 + (0x0d & MDIO_CTRL_MAXF_MASK)));
18192 + br32(bp, B44_MDIO_CTRL);
18193 +
18194 + if (!(br32(bp, B44_DEVCTRL) & DEVCTRL_IPP)) {
18195 + bw32(bp, B44_ENET_CTRL, ENET_CTRL_EPSEL);
18196 + br32(bp, B44_ENET_CTRL);
18197 + bp->flags &= ~B44_FLAG_INTERNAL_PHY;
18198 + } else {
18199 + u32 val = br32(bp, B44_DEVCTRL);
18200 +
18201 + if (val & DEVCTRL_EPR) {
18202 + bw32(bp, B44_DEVCTRL, (val & ~DEVCTRL_EPR));
18203 + br32(bp, B44_DEVCTRL);
18204 + udelay(100);
18205 + }
18206 + bp->flags |= B44_FLAG_INTERNAL_PHY;
18207 + }
18208 +}
18209 +
18210 +/* bp->lock is held. */
18211 +static void b44_halt(struct b44 *bp)
18212 +{
18213 + b44_disable_ints(bp);
18214 + b44_chip_reset(bp);
18215 +}
18216 +
18217 +/* bp->lock is held. */
18218 +static void __b44_set_mac_addr(struct b44 *bp)
18219 +{
18220 + bw32(bp, B44_CAM_CTRL, 0);
18221 + if (!(bp->dev->flags & IFF_PROMISC)) {
18222 + u32 val;
18223 +
18224 + __b44_cam_write(bp, bp->dev->dev_addr, 0);
18225 + val = br32(bp, B44_CAM_CTRL);
18226 + bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
18227 + }
18228 +}
18229 +
18230 +static int b44_set_mac_addr(struct net_device *dev, void *p)
18231 +{
18232 + struct b44 *bp = netdev_priv(dev);
18233 + struct sockaddr *addr = p;
18234 +
18235 + if (netif_running(dev))
18236 + return -EBUSY;
18237 +
18238 + memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
18239 +
18240 + spin_lock_irq(&bp->lock);
18241 + __b44_set_mac_addr(bp);
18242 + spin_unlock_irq(&bp->lock);
18243 +
18244 + return 0;
18245 +}
18246 +
18247 +/* Called at device open time to get the chip ready for
18248 + * packet processing. Invoked with bp->lock held.
18249 + */
18250 +static void __b44_set_rx_mode(struct net_device *);
18251 +static void b44_init_hw(struct b44 *bp)
18252 +{
18253 + u32 val;
18254 +
18255 + b44_chip_reset(bp);
18256 + b44_phy_reset(bp);
18257 + b44_setup_phy(bp);
18258 +
18259 + /* Enable CRC32, set proper LED modes and power on PHY */
18260 + bw32(bp, B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL);
18261 + bw32(bp, B44_RCV_LAZY, (1 << RCV_LAZY_FC_SHIFT));
18262 +
18263 + /* This sets the MAC address too. */
18264 + __b44_set_rx_mode(bp->dev);
18265 +
18266 + /* MTU + eth header + possible VLAN tag + struct rx_header */
18267 + bw32(bp, B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
18268 + bw32(bp, B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
18269 +
18270 + bw32(bp, B44_TX_WMARK, 56); /* XXX magic */
18271 + bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
18272 + bw32(bp, B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset);
18273 + bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
18274 + (bp->rx_offset << DMARX_CTRL_ROSHIFT)));
18275 + bw32(bp, B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
18276 +
18277 + bw32(bp, B44_DMARX_PTR, bp->rx_pending);
18278 + bp->rx_prod = bp->rx_pending;
18279 +
18280 + bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
18281 +
18282 + val = br32(bp, B44_ENET_CTRL);
18283 + bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
18284 +}
18285 +
18286 +static int b44_open(struct net_device *dev)
18287 +{
18288 + struct b44 *bp = netdev_priv(dev);
18289 + int err;
18290 +
18291 + err = b44_alloc_consistent(bp);
18292 + if (err)
18293 + return err;
18294 +
18295 + err = request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev);
18296 + if (err)
18297 + goto err_out_free;
18298 +
18299 + spin_lock_irq(&bp->lock);
18300 +
18301 + b44_init_rings(bp);
18302 + b44_init_hw(bp);
18303 + bp->flags |= B44_FLAG_INIT_COMPLETE;
18304 +
18305 + spin_unlock_irq(&bp->lock);
18306 +
18307 + init_timer(&bp->timer);
18308 + bp->timer.expires = jiffies + HZ;
18309 + bp->timer.data = (unsigned long) bp;
18310 + bp->timer.function = b44_timer;
18311 + add_timer(&bp->timer);
18312 +
18313 + b44_enable_ints(bp);
18314 +
18315 + return 0;
18316 +
18317 +err_out_free:
18318 + b44_free_consistent(bp);
18319 + return err;
18320 +}
18321 +
18322 +#if 0
18323 +/*static*/ void b44_dump_state(struct b44 *bp)
18324 +{
18325 + u32 val32, val32_2, val32_3, val32_4, val32_5;
18326 + u16 val16;
18327 +
18328 + pci_read_config_word(bp->pdev, PCI_STATUS, &val16);
18329 + printk("DEBUG: PCI status [%04x] \n", val16);
18330 +
18331 +}
18332 +#endif
18333 +
18334 +#ifdef CONFIG_NET_POLL_CONTROLLER
18335 +/*
18336 + * Polling receive - used by netconsole and other diagnostic tools
18337 + * to allow network i/o with interrupts disabled.
18338 + */
18339 +static void b44_poll_controller(struct net_device *dev)
18340 +{
18341 + disable_irq(dev->irq);
18342 + b44_interrupt(dev->irq, dev, NULL);
18343 + enable_irq(dev->irq);
18344 +}
18345 +#endif
18346 +
18347 +static int b44_close(struct net_device *dev)
18348 +{
18349 + struct b44 *bp = netdev_priv(dev);
18350 +
18351 + netif_stop_queue(dev);
18352 +
18353 + del_timer_sync(&bp->timer);
18354 +
18355 + spin_lock_irq(&bp->lock);
18356 +
18357 +#if 0
18358 + b44_dump_state(bp);
18359 +#endif
18360 + b44_halt(bp);
18361 + b44_free_rings(bp);
18362 + bp->flags &= ~B44_FLAG_INIT_COMPLETE;
18363 + netif_carrier_off(bp->dev);
18364 +
18365 + spin_unlock_irq(&bp->lock);
18366 +
18367 + free_irq(dev->irq, dev);
18368 +
18369 + b44_free_consistent(bp);
18370 +
18371 + return 0;
18372 +}
18373 +
18374 +static struct net_device_stats *b44_get_stats(struct net_device *dev)
18375 +{
18376 + struct b44 *bp = netdev_priv(dev);
18377 + struct net_device_stats *nstat = &bp->stats;
18378 + struct b44_hw_stats *hwstat = &bp->hw_stats;
18379 +
18380 + /* Convert HW stats into netdevice stats. */
18381 + nstat->rx_packets = hwstat->rx_pkts;
18382 + nstat->tx_packets = hwstat->tx_pkts;
18383 + nstat->rx_bytes = hwstat->rx_octets;
18384 + nstat->tx_bytes = hwstat->tx_octets;
18385 + nstat->tx_errors = (hwstat->tx_jabber_pkts +
18386 + hwstat->tx_oversize_pkts +
18387 + hwstat->tx_underruns +
18388 + hwstat->tx_excessive_cols +
18389 + hwstat->tx_late_cols);
18390 + nstat->multicast = hwstat->tx_multicast_pkts;
18391 + nstat->collisions = hwstat->tx_total_cols;
18392 +
18393 + nstat->rx_length_errors = (hwstat->rx_oversize_pkts +
18394 + hwstat->rx_undersize);
18395 + nstat->rx_over_errors = hwstat->rx_missed_pkts;
18396 + nstat->rx_frame_errors = hwstat->rx_align_errs;
18397 + nstat->rx_crc_errors = hwstat->rx_crc_errs;
18398 + nstat->rx_errors = (hwstat->rx_jabber_pkts +
18399 + hwstat->rx_oversize_pkts +
18400 + hwstat->rx_missed_pkts +
18401 + hwstat->rx_crc_align_errs +
18402 + hwstat->rx_undersize +
18403 + hwstat->rx_crc_errs +
18404 + hwstat->rx_align_errs +
18405 + hwstat->rx_symbol_errs);
18406 +
18407 + nstat->tx_aborted_errors = hwstat->tx_underruns;
18408 +#if 0
18409 + /* Carrier lost counter seems to be broken for some devices */
18410 + nstat->tx_carrier_errors = hwstat->tx_carrier_lost;
18411 +#endif
18412 +
18413 + return nstat;
18414 +}
18415 +
18416 +static int __b44_load_mcast(struct b44 *bp, struct net_device *dev)
18417 +{
18418 + struct dev_mc_list *mclist;
18419 + int i, num_ents;
18420 +
18421 + num_ents = min_t(int, dev->mc_count, B44_MCAST_TABLE_SIZE);
18422 + mclist = dev->mc_list;
18423 + for (i = 0; mclist && i < num_ents; i++, mclist = mclist->next) {
18424 + __b44_cam_write(bp, mclist->dmi_addr, i + 1);
18425 + }
18426 + return i+1;
18427 +}
18428 +
18429 +static void __b44_set_rx_mode(struct net_device *dev)
18430 +{
18431 + struct b44 *bp = netdev_priv(dev);
18432 + u32 val;
18433 + int i=0;
18434 + unsigned char zero[6] = {0,0,0,0,0,0};
18435 +
18436 + val = br32(bp, B44_RXCONFIG);
18437 + val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI);
18438 + if (dev->flags & IFF_PROMISC) {
18439 + val |= RXCONFIG_PROMISC;
18440 + bw32(bp, B44_RXCONFIG, val);
18441 + } else {
18442 + __b44_set_mac_addr(bp);
18443 +
18444 + if (dev->flags & IFF_ALLMULTI)
18445 + val |= RXCONFIG_ALLMULTI;
18446 + else
18447 + i=__b44_load_mcast(bp, dev);
18448 +
18449 + for(;i<64;i++) {
18450 + __b44_cam_write(bp, zero, i);
18451 + }
18452 + bw32(bp, B44_RXCONFIG, val);
18453 + val = br32(bp, B44_CAM_CTRL);
18454 + bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
18455 + }
18456 +}
18457 +
18458 +static void b44_set_rx_mode(struct net_device *dev)
18459 +{
18460 + struct b44 *bp = netdev_priv(dev);
18461 +
18462 + spin_lock_irq(&bp->lock);
18463 + __b44_set_rx_mode(dev);
18464 + spin_unlock_irq(&bp->lock);
18465 +}
18466 +
18467 +static u32 b44_get_msglevel(struct net_device *dev)
18468 +{
18469 + struct b44 *bp = netdev_priv(dev);
18470 + return bp->msg_enable;
18471 +}
18472 +
18473 +static void b44_set_msglevel(struct net_device *dev, u32 value)
18474 +{
18475 + struct b44 *bp = netdev_priv(dev);
18476 + bp->msg_enable = value;
18477 +}
18478 +
18479 +static void b44_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
18480 +{
18481 + struct b44 *bp = netdev_priv(dev);
18482 + struct pci_dev *pci_dev = bp->pdev;
18483 +
18484 + strcpy (info->driver, DRV_MODULE_NAME);
18485 + strcpy (info->version, DRV_MODULE_VERSION);
18486 + strcpy (info->bus_info, pci_name(pci_dev));
18487 +}
18488 +
18489 +static int b44_nway_reset(struct net_device *dev)
18490 +{
18491 + struct b44 *bp = netdev_priv(dev);
18492 + u32 bmcr;
18493 + int r;
18494 +
18495 + spin_lock_irq(&bp->lock);
18496 + b44_readphy(bp, MII_BMCR, &bmcr);
18497 + b44_readphy(bp, MII_BMCR, &bmcr);
18498 + r = -EINVAL;
18499 + if (bmcr & BMCR_ANENABLE) {
18500 + b44_writephy(bp, MII_BMCR,
18501 + bmcr | BMCR_ANRESTART);
18502 + r = 0;
18503 + }
18504 + spin_unlock_irq(&bp->lock);
18505 +
18506 + return r;
18507 +}
18508 +
18509 +static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
18510 +{
18511 + struct b44 *bp = netdev_priv(dev);
18512 +
18513 + if (!(bp->flags & B44_FLAG_INIT_COMPLETE))
18514 + return -EAGAIN;
18515 + cmd->supported = (SUPPORTED_Autoneg);
18516 + cmd->supported |= (SUPPORTED_100baseT_Half |
18517 + SUPPORTED_100baseT_Full |
18518 + SUPPORTED_10baseT_Half |
18519 + SUPPORTED_10baseT_Full |
18520 + SUPPORTED_MII);
18521 +
18522 + cmd->advertising = 0;
18523 + if (bp->flags & B44_FLAG_ADV_10HALF)
18524 + cmd->advertising |= ADVERTISE_10HALF;
18525 + if (bp->flags & B44_FLAG_ADV_10FULL)
18526 + cmd->advertising |= ADVERTISE_10FULL;
18527 + if (bp->flags & B44_FLAG_ADV_100HALF)
18528 + cmd->advertising |= ADVERTISE_100HALF;
18529 + if (bp->flags & B44_FLAG_ADV_100FULL)
18530 + cmd->advertising |= ADVERTISE_100FULL;
18531 + cmd->advertising |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
18532 + cmd->speed = (bp->flags & B44_FLAG_100_BASE_T) ?
18533 + SPEED_100 : SPEED_10;
18534 + cmd->duplex = (bp->flags & B44_FLAG_FULL_DUPLEX) ?
18535 + DUPLEX_FULL : DUPLEX_HALF;
18536 + cmd->port = 0;
18537 + cmd->phy_address = bp->phy_addr;
18538 + cmd->transceiver = (bp->flags & B44_FLAG_INTERNAL_PHY) ?
18539 + XCVR_INTERNAL : XCVR_EXTERNAL;
18540 + cmd->autoneg = (bp->flags & B44_FLAG_FORCE_LINK) ?
18541 + AUTONEG_DISABLE : AUTONEG_ENABLE;
18542 + cmd->maxtxpkt = 0;
18543 + cmd->maxrxpkt = 0;
18544 + return 0;
18545 +}
18546 +
18547 +static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
18548 +{
18549 + struct b44 *bp = netdev_priv(dev);
18550 +
18551 + if (!(bp->flags & B44_FLAG_INIT_COMPLETE))
18552 + return -EAGAIN;
18553 +
18554 + /* We do not support gigabit. */
18555 + if (cmd->autoneg == AUTONEG_ENABLE) {
18556 + if (cmd->advertising &
18557 + (ADVERTISED_1000baseT_Half |
18558 + ADVERTISED_1000baseT_Full))
18559 + return -EINVAL;
18560 + } else if ((cmd->speed != SPEED_100 &&
18561 + cmd->speed != SPEED_10) ||
18562 + (cmd->duplex != DUPLEX_HALF &&
18563 + cmd->duplex != DUPLEX_FULL)) {
18564 + return -EINVAL;
18565 + }
18566 +
18567 + spin_lock_irq(&bp->lock);
18568 +
18569 + if (cmd->autoneg == AUTONEG_ENABLE) {
18570 + bp->flags &= ~B44_FLAG_FORCE_LINK;
18571 + bp->flags &= ~(B44_FLAG_ADV_10HALF |
18572 + B44_FLAG_ADV_10FULL |
18573 + B44_FLAG_ADV_100HALF |
18574 + B44_FLAG_ADV_100FULL);
18575 + if (cmd->advertising & ADVERTISE_10HALF)
18576 + bp->flags |= B44_FLAG_ADV_10HALF;
18577 + if (cmd->advertising & ADVERTISE_10FULL)
18578 + bp->flags |= B44_FLAG_ADV_10FULL;
18579 + if (cmd->advertising & ADVERTISE_100HALF)
18580 + bp->flags |= B44_FLAG_ADV_100HALF;
18581 + if (cmd->advertising & ADVERTISE_100FULL)
18582 + bp->flags |= B44_FLAG_ADV_100FULL;
18583 + } else {
18584 + bp->flags |= B44_FLAG_FORCE_LINK;
18585 + if (cmd->speed == SPEED_100)
18586 + bp->flags |= B44_FLAG_100_BASE_T;
18587 + if (cmd->duplex == DUPLEX_FULL)
18588 + bp->flags |= B44_FLAG_FULL_DUPLEX;
18589 + }
18590 +
18591 + b44_setup_phy(bp);
18592 +
18593 + spin_unlock_irq(&bp->lock);
18594 +
18595 + return 0;
18596 +}
18597 +
18598 +static void b44_get_ringparam(struct net_device *dev,
18599 + struct ethtool_ringparam *ering)
18600 +{
18601 + struct b44 *bp = netdev_priv(dev);
18602 +
18603 + ering->rx_max_pending = B44_RX_RING_SIZE - 1;
18604 + ering->rx_pending = bp->rx_pending;
18605 +
18606 + /* XXX ethtool lacks a tx_max_pending, oops... */
18607 +}
18608 +
18609 +static int b44_set_ringparam(struct net_device *dev,
18610 + struct ethtool_ringparam *ering)
18611 +{
18612 + struct b44 *bp = netdev_priv(dev);
18613 +
18614 + if ((ering->rx_pending > B44_RX_RING_SIZE - 1) ||
18615 + (ering->rx_mini_pending != 0) ||
18616 + (ering->rx_jumbo_pending != 0) ||
18617 + (ering->tx_pending > B44_TX_RING_SIZE - 1))
18618 + return -EINVAL;
18619 +
18620 + spin_lock_irq(&bp->lock);
18621 +
18622 + bp->rx_pending = ering->rx_pending;
18623 + bp->tx_pending = ering->tx_pending;
18624 +
18625 + b44_halt(bp);
18626 + b44_init_rings(bp);
18627 + b44_init_hw(bp);
18628 + netif_wake_queue(bp->dev);
18629 + spin_unlock_irq(&bp->lock);
18630 +
18631 + b44_enable_ints(bp);
18632 +
18633 + return 0;
18634 +}
18635 +
18636 +static void b44_get_pauseparam(struct net_device *dev,
18637 + struct ethtool_pauseparam *epause)
18638 +{
18639 + struct b44 *bp = netdev_priv(dev);
18640 +
18641 + epause->autoneg =
18642 + (bp->flags & B44_FLAG_PAUSE_AUTO) != 0;
18643 + epause->rx_pause =
18644 + (bp->flags & B44_FLAG_RX_PAUSE) != 0;
18645 + epause->tx_pause =
18646 + (bp->flags & B44_FLAG_TX_PAUSE) != 0;
18647 +}
18648 +
18649 +static int b44_set_pauseparam(struct net_device *dev,
18650 + struct ethtool_pauseparam *epause)
18651 +{
18652 + struct b44 *bp = netdev_priv(dev);
18653 +
18654 + spin_lock_irq(&bp->lock);
18655 + if (epause->autoneg)
18656 + bp->flags |= B44_FLAG_PAUSE_AUTO;
18657 + else
18658 + bp->flags &= ~B44_FLAG_PAUSE_AUTO;
18659 + if (epause->rx_pause)
18660 + bp->flags |= B44_FLAG_RX_PAUSE;
18661 + else
18662 + bp->flags &= ~B44_FLAG_RX_PAUSE;
18663 + if (epause->tx_pause)
18664 + bp->flags |= B44_FLAG_TX_PAUSE;
18665 + else
18666 + bp->flags &= ~B44_FLAG_TX_PAUSE;
18667 + if (bp->flags & B44_FLAG_PAUSE_AUTO) {
18668 + b44_halt(bp);
18669 + b44_init_rings(bp);
18670 + b44_init_hw(bp);
18671 + } else {
18672 + __b44_set_flow_ctrl(bp, bp->flags);
18673 + }
18674 + spin_unlock_irq(&bp->lock);
18675 +
18676 + b44_enable_ints(bp);
18677 +
18678 + return 0;
18679 +}
18680 +
18681 +static struct ethtool_ops b44_ethtool_ops = {
18682 + .get_drvinfo = b44_get_drvinfo,
18683 + .get_settings = b44_get_settings,
18684 + .set_settings = b44_set_settings,
18685 + .nway_reset = b44_nway_reset,
18686 + .get_link = ethtool_op_get_link,
18687 + .get_ringparam = b44_get_ringparam,
18688 + .set_ringparam = b44_set_ringparam,
18689 + .get_pauseparam = b44_get_pauseparam,
18690 + .set_pauseparam = b44_set_pauseparam,
18691 + .get_msglevel = b44_get_msglevel,
18692 + .set_msglevel = b44_set_msglevel,
18693 +};
18694 +
18695 +static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
18696 +{
18697 + struct mii_ioctl_data *data = if_mii(ifr);
18698 + struct b44 *bp = netdev_priv(dev);
18699 + int err;
18700 +
18701 + spin_lock_irq(&bp->lock);
18702 + err = generic_mii_ioctl(&bp->mii_if, data, cmd, NULL);
18703 + spin_unlock_irq(&bp->lock);
18704 +
18705 + return err;
18706 +}
18707 +
18708 +/* Read 128-bytes of EEPROM. */
18709 +static int b44_read_eeprom(struct b44 *bp, u8 *data)
18710 +{
18711 + long i;
18712 + u16 *ptr = (u16 *) data;
18713 +
18714 + for (i = 0; i < 128; i += 2)
18715 + ptr[i / 2] = readw(bp->regs + 4096 + i);
18716 +
18717 + return 0;
18718 +}
18719 +
18720 +static int __devinit b44_get_invariants(struct b44 *bp)
18721 +{
18722 + u8 eeprom[128];
18723 + int err;
18724 +
18725 + err = b44_read_eeprom(bp, &eeprom[0]);
18726 + if (err)
18727 + goto out;
18728 +
18729 + bp->dev->dev_addr[0] = eeprom[79];
18730 + bp->dev->dev_addr[1] = eeprom[78];
18731 + bp->dev->dev_addr[2] = eeprom[81];
18732 + bp->dev->dev_addr[3] = eeprom[80];
18733 + bp->dev->dev_addr[4] = eeprom[83];
18734 + bp->dev->dev_addr[5] = eeprom[82];
18735 +
18736 + bp->phy_addr = eeprom[90] & 0x1f;
18737 +
18738 + /* With this, plus the rx_header prepended to the data by the
18739 + * hardware, we'll land the ethernet header on a 2-byte boundary.
18740 + */
18741 + bp->rx_offset = 30;
18742 +
18743 + bp->imask = IMASK_DEF;
18744 +
18745 + bp->core_unit = ssb_core_unit(bp);
18746 + bp->dma_offset = SB_PCI_DMA;
18747 +
18748 + /* XXX - really required?
18749 + bp->flags |= B44_FLAG_BUGGY_TXPTR;
18750 + */
18751 +out:
18752 + return err;
18753 +}
18754 +
18755 +static int __devinit b44_init_one(struct pci_dev *pdev,
18756 + const struct pci_device_id *ent)
18757 +{
18758 + static int b44_version_printed = 0;
18759 + unsigned long b44reg_base, b44reg_len;
18760 + struct net_device *dev;
18761 + struct b44 *bp;
18762 + int err, i;
18763 +
18764 + if (b44_version_printed++ == 0)
18765 + printk(KERN_INFO "%s", version);
18766 +
18767 + err = pci_enable_device(pdev);
18768 + if (err) {
18769 + printk(KERN_ERR PFX "Cannot enable PCI device, "
18770 + "aborting.\n");
18771 + return err;
18772 + }
18773 +
18774 + if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
18775 + printk(KERN_ERR PFX "Cannot find proper PCI device "
18776 + "base address, aborting.\n");
18777 + err = -ENODEV;
18778 + goto err_out_disable_pdev;
18779 + }
18780 +
18781 + err = pci_request_regions(pdev, DRV_MODULE_NAME);
18782 + if (err) {
18783 + printk(KERN_ERR PFX "Cannot obtain PCI resources, "
18784 + "aborting.\n");
18785 + goto err_out_disable_pdev;
18786 + }
18787 +
18788 + pci_set_master(pdev);
18789 +
18790 + err = pci_set_dma_mask(pdev, (u64) B44_DMA_MASK);
18791 + if (err) {
18792 + printk(KERN_ERR PFX "No usable DMA configuration, "
18793 + "aborting.\n");
18794 + goto err_out_free_res;
18795 + }
18796 +
18797 + err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK);
18798 + if (err) {
18799 + printk(KERN_ERR PFX "No usable DMA configuration, "
18800 + "aborting.\n");
18801 + goto err_out_free_res;
18802 + }
18803 +
18804 + b44reg_base = pci_resource_start(pdev, 0);
18805 + b44reg_len = pci_resource_len(pdev, 0);
18806 +
18807 + dev = alloc_etherdev(sizeof(*bp));
18808 + if (!dev) {
18809 + printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n");
18810 + err = -ENOMEM;
18811 + goto err_out_free_res;
18812 + }
18813 +
18814 + SET_MODULE_OWNER(dev);
18815 + SET_NETDEV_DEV(dev,&pdev->dev);
18816 +
18817 + /* No interesting netdevice features in this card... */
18818 + dev->features |= 0;
18819 +
18820 + bp = netdev_priv(dev);
18821 + bp->pdev = pdev;
18822 + bp->dev = dev;
18823 + if (b44_debug >= 0)
18824 + bp->msg_enable = (1 << b44_debug) - 1;
18825 + else
18826 + bp->msg_enable = B44_DEF_MSG_ENABLE;
18827 +
18828 + spin_lock_init(&bp->lock);
18829 +
18830 + bp->regs = ioremap(b44reg_base, b44reg_len);
18831 + if (bp->regs == 0UL) {
18832 + printk(KERN_ERR PFX "Cannot map device registers, "
18833 + "aborting.\n");
18834 + err = -ENOMEM;
18835 + goto err_out_free_dev;
18836 + }
18837 +
18838 + bp->rx_pending = B44_DEF_RX_RING_PENDING;
18839 + bp->tx_pending = B44_DEF_TX_RING_PENDING;
18840 +
18841 + dev->open = b44_open;
18842 + dev->stop = b44_close;
18843 + dev->hard_start_xmit = b44_start_xmit;
18844 + dev->get_stats = b44_get_stats;
18845 + dev->set_multicast_list = b44_set_rx_mode;
18846 + dev->set_mac_address = b44_set_mac_addr;
18847 + dev->do_ioctl = b44_ioctl;
18848 + dev->tx_timeout = b44_tx_timeout;
18849 + dev->poll = b44_poll;
18850 + dev->weight = 64;
18851 + dev->watchdog_timeo = B44_TX_TIMEOUT;
18852 +#ifdef CONFIG_NET_POLL_CONTROLLER
18853 + dev->poll_controller = b44_poll_controller;
18854 +#endif
18855 + dev->change_mtu = b44_change_mtu;
18856 + dev->irq = pdev->irq;
18857 + SET_ETHTOOL_OPS(dev, &b44_ethtool_ops);
18858 +
18859 + err = b44_get_invariants(bp);
18860 + if (err) {
18861 + printk(KERN_ERR PFX "Problem fetching invariants of chip, "
18862 + "aborting.\n");
18863 + goto err_out_iounmap;
18864 + }
18865 +
18866 + bp->mii_if.dev = dev;
18867 + bp->mii_if.mdio_read = b44_mii_read;
18868 + bp->mii_if.mdio_write = b44_mii_write;
18869 + bp->mii_if.phy_id = bp->phy_addr;
18870 + bp->mii_if.phy_id_mask = 0x1f;
18871 + bp->mii_if.reg_num_mask = 0x1f;
18872 +
18873 + /* By default, advertise all speed/duplex settings. */
18874 + bp->flags |= (B44_FLAG_ADV_10HALF | B44_FLAG_ADV_10FULL |
18875 + B44_FLAG_ADV_100HALF | B44_FLAG_ADV_100FULL);
18876 +
18877 + /* By default, auto-negotiate PAUSE. */
18878 + bp->flags |= B44_FLAG_PAUSE_AUTO;
18879 +
18880 + err = register_netdev(dev);
18881 + if (err) {
18882 + printk(KERN_ERR PFX "Cannot register net device, "
18883 + "aborting.\n");
18884 + goto err_out_iounmap;
18885 + }
18886 +
18887 + pci_set_drvdata(pdev, dev);
18888 +
18889 + pci_save_state(bp->pdev);
18890 +
18891 + printk(KERN_INFO "%s: Broadcom 4400 10/100BaseT Ethernet ", dev->name);
18892 + for (i = 0; i < 6; i++)
18893 + printk("%2.2x%c", dev->dev_addr[i],
18894 + i == 5 ? '\n' : ':');
18895 +
18896 + return 0;
18897 +
18898 +err_out_iounmap:
18899 + iounmap(bp->regs);
18900 +
18901 +err_out_free_dev:
18902 + free_netdev(dev);
18903 +
18904 +err_out_free_res:
18905 + pci_release_regions(pdev);
18906 +
18907 +err_out_disable_pdev:
18908 + pci_disable_device(pdev);
18909 + pci_set_drvdata(pdev, NULL);
18910 + return err;
18911 +}
18912 +
18913 +static void __devexit b44_remove_one(struct pci_dev *pdev)
18914 +{
18915 + struct net_device *dev = pci_get_drvdata(pdev);
18916 +
18917 + if (dev) {
18918 + struct b44 *bp = netdev_priv(dev);
18919 +
18920 + unregister_netdev(dev);
18921 + iounmap(bp->regs);
18922 + free_netdev(dev);
18923 + pci_release_regions(pdev);
18924 + pci_disable_device(pdev);
18925 + pci_set_drvdata(pdev, NULL);
18926 + }
18927 +}
18928 +
18929 +static int b44_suspend(struct pci_dev *pdev, pm_message_t state)
18930 +{
18931 + struct net_device *dev = pci_get_drvdata(pdev);
18932 + struct b44 *bp = netdev_priv(dev);
18933 +
18934 + if (!netif_running(dev))
18935 + return 0;
18936 +
18937 + del_timer_sync(&bp->timer);
18938 +
18939 + spin_lock_irq(&bp->lock);
18940 +
18941 + b44_halt(bp);
18942 + netif_carrier_off(bp->dev);
18943 + netif_device_detach(bp->dev);
18944 + b44_free_rings(bp);
18945 +
18946 + spin_unlock_irq(&bp->lock);
18947 + return 0;
18948 +}
18949 +
18950 +static int b44_resume(struct pci_dev *pdev)
18951 +{
18952 + struct net_device *dev = pci_get_drvdata(pdev);
18953 + struct b44 *bp = netdev_priv(dev);
18954 +
18955 + pci_restore_state(pdev);
18956 +
18957 + if (!netif_running(dev))
18958 + return 0;
18959 +
18960 + spin_lock_irq(&bp->lock);
18961 +
18962 + b44_init_rings(bp);
18963 + b44_init_hw(bp);
18964 + netif_device_attach(bp->dev);
18965 + spin_unlock_irq(&bp->lock);
18966 +
18967 + bp->timer.expires = jiffies + HZ;
18968 + add_timer(&bp->timer);
18969 +
18970 + b44_enable_ints(bp);
18971 + return 0;
18972 +}
18973 +
18974 +static struct pci_driver b44_driver = {
18975 + .name = DRV_MODULE_NAME,
18976 + .id_table = b44_pci_tbl,
18977 + .probe = b44_init_one,
18978 + .remove = __devexit_p(b44_remove_one),
18979 + .suspend = b44_suspend,
18980 + .resume = b44_resume,
18981 +};
18982 +
18983 +static int __init b44_init(void)
18984 +{
18985 + return pci_module_init(&b44_driver);
18986 +}
18987 +
18988 +static void __exit b44_cleanup(void)
18989 +{
18990 + pci_unregister_driver(&b44_driver);
18991 +}
18992 +
18993 +module_init(b44_init);
18994 +module_exit(b44_cleanup);
18995 +
18996 diff -Nur linux-2.6.12.5/drivers/net/b44.h linux-2.6.12.5-brcm/drivers/net/b44.h
18997 --- linux-2.6.12.5/drivers/net/b44.h 2005-08-15 02:20:18.000000000 +0200
18998 +++ linux-2.6.12.5-brcm/drivers/net/b44.h 2005-08-28 11:12:20.694819024 +0200
18999 @@ -292,6 +292,9 @@
19000 #define SSB_PCI_MASK1 0xfc000000
19001 #define SSB_PCI_MASK2 0xc0000000
19002
19003 +#define br32(REG) readl(bp->regs + (REG))
19004 +#define bw32(REG,VAL) writel((VAL), bp->regs + (REG))
19005 +
19006 /* 4400 PHY registers */
19007 #define B44_MII_AUXCTRL 24 /* Auxiliary Control */
19008 #define MII_AUXCTRL_DUPLEX 0x0001 /* Full Duplex */
19009 @@ -345,6 +348,8 @@
19010 };
19011
19012 #define B44_MCAST_TABLE_SIZE 32
19013 +#define B44_PHY_ADDR_NO_PHY 30
19014 +#define B44_MDC_RATIO 5000000
19015
19016 /* SW copy of device statistics, kept up to date by periodic timer
19017 * which probes HW values. Must have same relative layout as HW
19018 @@ -410,7 +415,7 @@
19019 struct net_device_stats stats;
19020 struct b44_hw_stats hw_stats;
19021
19022 - void __iomem *regs;
19023 + unsigned long regs;
19024 struct pci_dev *pdev;
19025 struct net_device *dev;
19026
19027 diff -Nur linux-2.6.12.5/drivers/net/b44.h.orig linux-2.6.12.5-brcm/drivers/net/b44.h.orig
19028 --- linux-2.6.12.5/drivers/net/b44.h.orig 1970-01-01 01:00:00.000000000 +0100
19029 +++ linux-2.6.12.5-brcm/drivers/net/b44.h.orig 2005-08-15 02:20:18.000000000 +0200
19030 @@ -0,0 +1,427 @@
19031 +#ifndef _B44_H
19032 +#define _B44_H
19033 +
19034 +/* Register layout. (These correspond to struct _bcmenettregs in bcm4400.) */
19035 +#define B44_DEVCTRL 0x0000UL /* Device Control */
19036 +#define DEVCTRL_MPM 0x00000040 /* Magic Packet PME Enable (B0 only) */
19037 +#define DEVCTRL_PFE 0x00000080 /* Pattern Filtering Enable */
19038 +#define DEVCTRL_IPP 0x00000400 /* Internal EPHY Present */
19039 +#define DEVCTRL_EPR 0x00008000 /* EPHY Reset */
19040 +#define DEVCTRL_PME 0x00001000 /* PHY Mode Enable */
19041 +#define DEVCTRL_PMCE 0x00002000 /* PHY Mode Clocks Enable */
19042 +#define DEVCTRL_PADDR 0x0007c000 /* PHY Address */
19043 +#define DEVCTRL_PADDR_SHIFT 18
19044 +#define B44_BIST_STAT 0x000CUL /* Built-In Self-Test Status */
19045 +#define B44_WKUP_LEN 0x0010UL /* Wakeup Length */
19046 +#define WKUP_LEN_P0_MASK 0x0000007f /* Pattern 0 */
19047 +#define WKUP_LEN_D0 0x00000080
19048 +#define WKUP_LEN_P1_MASK 0x00007f00 /* Pattern 1 */
19049 +#define WKUP_LEN_P1_SHIFT 8
19050 +#define WKUP_LEN_D1 0x00008000
19051 +#define WKUP_LEN_P2_MASK 0x007f0000 /* Pattern 2 */
19052 +#define WKUP_LEN_P2_SHIFT 16
19053 +#define WKUP_LEN_D2 0x00000000
19054 +#define WKUP_LEN_P3_MASK 0x7f000000 /* Pattern 3 */
19055 +#define WKUP_LEN_P3_SHIFT 24
19056 +#define WKUP_LEN_D3 0x80000000
19057 +#define B44_ISTAT 0x0020UL /* Interrupt Status */
19058 +#define ISTAT_LS 0x00000020 /* Link Change (B0 only) */
19059 +#define ISTAT_PME 0x00000040 /* Power Management Event */
19060 +#define ISTAT_TO 0x00000080 /* General Purpose Timeout */
19061 +#define ISTAT_DSCE 0x00000400 /* Descriptor Error */
19062 +#define ISTAT_DATAE 0x00000800 /* Data Error */
19063 +#define ISTAT_DPE 0x00001000 /* Descr. Protocol Error */
19064 +#define ISTAT_RDU 0x00002000 /* Receive Descr. Underflow */
19065 +#define ISTAT_RFO 0x00004000 /* Receive FIFO Overflow */
19066 +#define ISTAT_TFU 0x00008000 /* Transmit FIFO Underflow */
19067 +#define ISTAT_RX 0x00010000 /* RX Interrupt */
19068 +#define ISTAT_TX 0x01000000 /* TX Interrupt */
19069 +#define ISTAT_EMAC 0x04000000 /* EMAC Interrupt */
19070 +#define ISTAT_MII_WRITE 0x08000000 /* MII Write Interrupt */
19071 +#define ISTAT_MII_READ 0x10000000 /* MII Read Interrupt */
19072 +#define ISTAT_ERRORS (ISTAT_DSCE|ISTAT_DATAE|ISTAT_DPE|ISTAT_RDU|ISTAT_RFO|ISTAT_TFU)
19073 +#define B44_IMASK 0x0024UL /* Interrupt Mask */
19074 +#define IMASK_DEF (ISTAT_ERRORS | ISTAT_TO | ISTAT_RX | ISTAT_TX)
19075 +#define B44_GPTIMER 0x0028UL /* General Purpose Timer */
19076 +#define B44_ADDR_LO 0x0088UL /* ENET Address Lo (B0 only) */
19077 +#define B44_ADDR_HI 0x008CUL /* ENET Address Hi (B0 only) */
19078 +#define B44_FILT_ADDR 0x0090UL /* ENET Filter Address */
19079 +#define B44_FILT_DATA 0x0094UL /* ENET Filter Data */
19080 +#define B44_TXBURST 0x00A0UL /* TX Max Burst Length */
19081 +#define B44_RXBURST 0x00A4UL /* RX Max Burst Length */
19082 +#define B44_MAC_CTRL 0x00A8UL /* MAC Control */
19083 +#define MAC_CTRL_CRC32_ENAB 0x00000001 /* CRC32 Generation Enable */
19084 +#define MAC_CTRL_PHY_PDOWN 0x00000004 /* Onchip EPHY Powerdown */
19085 +#define MAC_CTRL_PHY_EDET 0x00000008 /* Onchip EPHY Energy Detected */
19086 +#define MAC_CTRL_PHY_LEDCTRL 0x000000e0 /* Onchip EPHY LED Control */
19087 +#define MAC_CTRL_PHY_LEDCTRL_SHIFT 5
19088 +#define B44_MAC_FLOW 0x00ACUL /* MAC Flow Control */
19089 +#define MAC_FLOW_RX_HI_WATER 0x000000ff /* Receive FIFO HI Water Mark */
19090 +#define MAC_FLOW_PAUSE_ENAB 0x00008000 /* Enable Pause Frame Generation */
19091 +#define B44_RCV_LAZY 0x0100UL /* Lazy Interrupt Control */
19092 +#define RCV_LAZY_TO_MASK 0x00ffffff /* Timeout */
19093 +#define RCV_LAZY_FC_MASK 0xff000000 /* Frame Count */
19094 +#define RCV_LAZY_FC_SHIFT 24
19095 +#define B44_DMATX_CTRL 0x0200UL /* DMA TX Control */
19096 +#define DMATX_CTRL_ENABLE 0x00000001 /* Enable */
19097 +#define DMATX_CTRL_SUSPEND 0x00000002 /* Suepend Request */
19098 +#define DMATX_CTRL_LPBACK 0x00000004 /* Loopback Enable */
19099 +#define DMATX_CTRL_FAIRPRIOR 0x00000008 /* Fair Priority */
19100 +#define DMATX_CTRL_FLUSH 0x00000010 /* Flush Request */
19101 +#define B44_DMATX_ADDR 0x0204UL /* DMA TX Descriptor Ring Address */
19102 +#define B44_DMATX_PTR 0x0208UL /* DMA TX Last Posted Descriptor */
19103 +#define B44_DMATX_STAT 0x020CUL /* DMA TX Current Active Desc. + Status */
19104 +#define DMATX_STAT_CDMASK 0x00000fff /* Current Descriptor Mask */
19105 +#define DMATX_STAT_SMASK 0x0000f000 /* State Mask */
19106 +#define DMATX_STAT_SDISABLED 0x00000000 /* State Disabled */
19107 +#define DMATX_STAT_SACTIVE 0x00001000 /* State Active */
19108 +#define DMATX_STAT_SIDLE 0x00002000 /* State Idle Wait */
19109 +#define DMATX_STAT_SSTOPPED 0x00003000 /* State Stopped */
19110 +#define DMATX_STAT_SSUSP 0x00004000 /* State Suspend Pending */
19111 +#define DMATX_STAT_EMASK 0x000f0000 /* Error Mask */
19112 +#define DMATX_STAT_ENONE 0x00000000 /* Error None */
19113 +#define DMATX_STAT_EDPE 0x00010000 /* Error Desc. Protocol Error */
19114 +#define DMATX_STAT_EDFU 0x00020000 /* Error Data FIFO Underrun */
19115 +#define DMATX_STAT_EBEBR 0x00030000 /* Error Bus Error on Buffer Read */
19116 +#define DMATX_STAT_EBEDA 0x00040000 /* Error Bus Error on Desc. Access */
19117 +#define DMATX_STAT_FLUSHED 0x00100000 /* Flushed */
19118 +#define B44_DMARX_CTRL 0x0210UL /* DMA RX Control */
19119 +#define DMARX_CTRL_ENABLE 0x00000001 /* Enable */
19120 +#define DMARX_CTRL_ROMASK 0x000000fe /* Receive Offset Mask */
19121 +#define DMARX_CTRL_ROSHIFT 1 /* Receive Offset Shift */
19122 +#define B44_DMARX_ADDR 0x0214UL /* DMA RX Descriptor Ring Address */
19123 +#define B44_DMARX_PTR 0x0218UL /* DMA RX Last Posted Descriptor */
19124 +#define B44_DMARX_STAT 0x021CUL /* DMA RX Current Active Desc. + Status */
19125 +#define DMARX_STAT_CDMASK 0x00000fff /* Current Descriptor Mask */
19126 +#define DMARX_STAT_SMASK 0x0000f000 /* State Mask */
19127 +#define DMARX_STAT_SDISABLED 0x00000000 /* State Disbaled */
19128 +#define DMARX_STAT_SACTIVE 0x00001000 /* State Active */
19129 +#define DMARX_STAT_SIDLE 0x00002000 /* State Idle Wait */
19130 +#define DMARX_STAT_SSTOPPED 0x00003000 /* State Stopped */
19131 +#define DMARX_STAT_EMASK 0x000f0000 /* Error Mask */
19132 +#define DMARX_STAT_ENONE 0x00000000 /* Error None */
19133 +#define DMARX_STAT_EDPE 0x00010000 /* Error Desc. Protocol Error */
19134 +#define DMARX_STAT_EDFO 0x00020000 /* Error Data FIFO Overflow */
19135 +#define DMARX_STAT_EBEBW 0x00030000 /* Error Bus Error on Buffer Write */
19136 +#define DMARX_STAT_EBEDA 0x00040000 /* Error Bus Error on Desc. Access */
19137 +#define B44_DMAFIFO_AD 0x0220UL /* DMA FIFO Diag Address */
19138 +#define DMAFIFO_AD_OMASK 0x0000ffff /* Offset Mask */
19139 +#define DMAFIFO_AD_SMASK 0x000f0000 /* Select Mask */
19140 +#define DMAFIFO_AD_SXDD 0x00000000 /* Select Transmit DMA Data */
19141 +#define DMAFIFO_AD_SXDP 0x00010000 /* Select Transmit DMA Pointers */
19142 +#define DMAFIFO_AD_SRDD 0x00040000 /* Select Receive DMA Data */
19143 +#define DMAFIFO_AD_SRDP 0x00050000 /* Select Receive DMA Pointers */
19144 +#define DMAFIFO_AD_SXFD 0x00080000 /* Select Transmit FIFO Data */
19145 +#define DMAFIFO_AD_SXFP 0x00090000 /* Select Transmit FIFO Pointers */
19146 +#define DMAFIFO_AD_SRFD 0x000c0000 /* Select Receive FIFO Data */
19147 +#define DMAFIFO_AD_SRFP 0x000c0000 /* Select Receive FIFO Pointers */
19148 +#define B44_DMAFIFO_LO 0x0224UL /* DMA FIFO Diag Low Data */
19149 +#define B44_DMAFIFO_HI 0x0228UL /* DMA FIFO Diag High Data */
19150 +#define B44_RXCONFIG 0x0400UL /* EMAC RX Config */
19151 +#define RXCONFIG_DBCAST 0x00000001 /* Disable Broadcast */
19152 +#define RXCONFIG_ALLMULTI 0x00000002 /* Accept All Multicast */
19153 +#define RXCONFIG_NORX_WHILE_TX 0x00000004 /* Receive Disable While Transmitting */
19154 +#define RXCONFIG_PROMISC 0x00000008 /* Promiscuous Enable */
19155 +#define RXCONFIG_LPBACK 0x00000010 /* Loopback Enable */
19156 +#define RXCONFIG_FLOW 0x00000020 /* Flow Control Enable */
19157 +#define RXCONFIG_FLOW_ACCEPT 0x00000040 /* Accept Unicast Flow Control Frame */
19158 +#define RXCONFIG_RFILT 0x00000080 /* Reject Filter */
19159 +#define B44_RXMAXLEN 0x0404UL /* EMAC RX Max Packet Length */
19160 +#define B44_TXMAXLEN 0x0408UL /* EMAC TX Max Packet Length */
19161 +#define B44_MDIO_CTRL 0x0410UL /* EMAC MDIO Control */
19162 +#define MDIO_CTRL_MAXF_MASK 0x0000007f /* MDC Frequency */
19163 +#define MDIO_CTRL_PREAMBLE 0x00000080 /* MII Preamble Enable */
19164 +#define B44_MDIO_DATA 0x0414UL /* EMAC MDIO Data */
19165 +#define MDIO_DATA_DATA 0x0000ffff /* R/W Data */
19166 +#define MDIO_DATA_TA_MASK 0x00030000 /* Turnaround Value */
19167 +#define MDIO_DATA_TA_SHIFT 16
19168 +#define MDIO_TA_VALID 2
19169 +#define MDIO_DATA_RA_MASK 0x007c0000 /* Register Address */
19170 +#define MDIO_DATA_RA_SHIFT 18
19171 +#define MDIO_DATA_PMD_MASK 0x0f800000 /* Physical Media Device */
19172 +#define MDIO_DATA_PMD_SHIFT 23
19173 +#define MDIO_DATA_OP_MASK 0x30000000 /* Opcode */
19174 +#define MDIO_DATA_OP_SHIFT 28
19175 +#define MDIO_OP_WRITE 1
19176 +#define MDIO_OP_READ 2
19177 +#define MDIO_DATA_SB_MASK 0xc0000000 /* Start Bits */
19178 +#define MDIO_DATA_SB_SHIFT 30
19179 +#define MDIO_DATA_SB_START 0x40000000 /* Start Of Frame */
19180 +#define B44_EMAC_IMASK 0x0418UL /* EMAC Interrupt Mask */
19181 +#define B44_EMAC_ISTAT 0x041CUL /* EMAC Interrupt Status */
19182 +#define EMAC_INT_MII 0x00000001 /* MII MDIO Interrupt */
19183 +#define EMAC_INT_MIB 0x00000002 /* MIB Interrupt */
19184 +#define EMAC_INT_FLOW 0x00000003 /* Flow Control Interrupt */
19185 +#define B44_CAM_DATA_LO 0x0420UL /* EMAC CAM Data Low */
19186 +#define B44_CAM_DATA_HI 0x0424UL /* EMAC CAM Data High */
19187 +#define CAM_DATA_HI_VALID 0x00010000 /* Valid Bit */
19188 +#define B44_CAM_CTRL 0x0428UL /* EMAC CAM Control */
19189 +#define CAM_CTRL_ENABLE 0x00000001 /* CAM Enable */
19190 +#define CAM_CTRL_MSEL 0x00000002 /* Mask Select */
19191 +#define CAM_CTRL_READ 0x00000004 /* Read */
19192 +#define CAM_CTRL_WRITE 0x00000008 /* Read */
19193 +#define CAM_CTRL_INDEX_MASK 0x003f0000 /* Index Mask */
19194 +#define CAM_CTRL_INDEX_SHIFT 16
19195 +#define CAM_CTRL_BUSY 0x80000000 /* CAM Busy */
19196 +#define B44_ENET_CTRL 0x042CUL /* EMAC ENET Control */
19197 +#define ENET_CTRL_ENABLE 0x00000001 /* EMAC Enable */
19198 +#define ENET_CTRL_DISABLE 0x00000002 /* EMAC Disable */
19199 +#define ENET_CTRL_SRST 0x00000004 /* EMAC Soft Reset */
19200 +#define ENET_CTRL_EPSEL 0x00000008 /* External PHY Select */
19201 +#define B44_TX_CTRL 0x0430UL /* EMAC TX Control */
19202 +#define TX_CTRL_DUPLEX 0x00000001 /* Full Duplex */
19203 +#define TX_CTRL_FMODE 0x00000002 /* Flow Mode */
19204 +#define TX_CTRL_SBENAB 0x00000004 /* Single Backoff Enable */
19205 +#define TX_CTRL_SMALL_SLOT 0x00000008 /* Small Slottime */
19206 +#define B44_TX_WMARK 0x0434UL /* EMAC TX Watermark */
19207 +#define B44_MIB_CTRL 0x0438UL /* EMAC MIB Control */
19208 +#define MIB_CTRL_CLR_ON_READ 0x00000001 /* Autoclear on Read */
19209 +#define B44_TX_GOOD_O 0x0500UL /* MIB TX Good Octets */
19210 +#define B44_TX_GOOD_P 0x0504UL /* MIB TX Good Packets */
19211 +#define B44_TX_O 0x0508UL /* MIB TX Octets */
19212 +#define B44_TX_P 0x050CUL /* MIB TX Packets */
19213 +#define B44_TX_BCAST 0x0510UL /* MIB TX Broadcast Packets */
19214 +#define B44_TX_MCAST 0x0514UL /* MIB TX Multicast Packets */
19215 +#define B44_TX_64 0x0518UL /* MIB TX <= 64 byte Packets */
19216 +#define B44_TX_65_127 0x051CUL /* MIB TX 65 to 127 byte Packets */
19217 +#define B44_TX_128_255 0x0520UL /* MIB TX 128 to 255 byte Packets */
19218 +#define B44_TX_256_511 0x0524UL /* MIB TX 256 to 511 byte Packets */
19219 +#define B44_TX_512_1023 0x0528UL /* MIB TX 512 to 1023 byte Packets */
19220 +#define B44_TX_1024_MAX 0x052CUL /* MIB TX 1024 to max byte Packets */
19221 +#define B44_TX_JABBER 0x0530UL /* MIB TX Jabber Packets */
19222 +#define B44_TX_OSIZE 0x0534UL /* MIB TX Oversize Packets */
19223 +#define B44_TX_FRAG 0x0538UL /* MIB TX Fragment Packets */
19224 +#define B44_TX_URUNS 0x053CUL /* MIB TX Underruns */
19225 +#define B44_TX_TCOLS 0x0540UL /* MIB TX Total Collisions */
19226 +#define B44_TX_SCOLS 0x0544UL /* MIB TX Single Collisions */
19227 +#define B44_TX_MCOLS 0x0548UL /* MIB TX Multiple Collisions */
19228 +#define B44_TX_ECOLS 0x054CUL /* MIB TX Excessive Collisions */
19229 +#define B44_TX_LCOLS 0x0550UL /* MIB TX Late Collisions */
19230 +#define B44_TX_DEFERED 0x0554UL /* MIB TX Defered Packets */
19231 +#define B44_TX_CLOST 0x0558UL /* MIB TX Carrier Lost */
19232 +#define B44_TX_PAUSE 0x055CUL /* MIB TX Pause Packets */
19233 +#define B44_RX_GOOD_O 0x0580UL /* MIB RX Good Octets */
19234 +#define B44_RX_GOOD_P 0x0584UL /* MIB RX Good Packets */
19235 +#define B44_RX_O 0x0588UL /* MIB RX Octets */
19236 +#define B44_RX_P 0x058CUL /* MIB RX Packets */
19237 +#define B44_RX_BCAST 0x0590UL /* MIB RX Broadcast Packets */
19238 +#define B44_RX_MCAST 0x0594UL /* MIB RX Multicast Packets */
19239 +#define B44_RX_64 0x0598UL /* MIB RX <= 64 byte Packets */
19240 +#define B44_RX_65_127 0x059CUL /* MIB RX 65 to 127 byte Packets */
19241 +#define B44_RX_128_255 0x05A0UL /* MIB RX 128 to 255 byte Packets */
19242 +#define B44_RX_256_511 0x05A4UL /* MIB RX 256 to 511 byte Packets */
19243 +#define B44_RX_512_1023 0x05A8UL /* MIB RX 512 to 1023 byte Packets */
19244 +#define B44_RX_1024_MAX 0x05ACUL /* MIB RX 1024 to max byte Packets */
19245 +#define B44_RX_JABBER 0x05B0UL /* MIB RX Jabber Packets */
19246 +#define B44_RX_OSIZE 0x05B4UL /* MIB RX Oversize Packets */
19247 +#define B44_RX_FRAG 0x05B8UL /* MIB RX Fragment Packets */
19248 +#define B44_RX_MISS 0x05BCUL /* MIB RX Missed Packets */
19249 +#define B44_RX_CRCA 0x05C0UL /* MIB RX CRC Align Errors */
19250 +#define B44_RX_USIZE 0x05C4UL /* MIB RX Undersize Packets */
19251 +#define B44_RX_CRC 0x05C8UL /* MIB RX CRC Errors */
19252 +#define B44_RX_ALIGN 0x05CCUL /* MIB RX Align Errors */
19253 +#define B44_RX_SYM 0x05D0UL /* MIB RX Symbol Errors */
19254 +#define B44_RX_PAUSE 0x05D4UL /* MIB RX Pause Packets */
19255 +#define B44_RX_NPAUSE 0x05D8UL /* MIB RX Non-Pause Packets */
19256 +
19257 +/* Silicon backplane register definitions */
19258 +#define B44_SBIMSTATE 0x0F90UL /* SB Initiator Agent State */
19259 +#define SBIMSTATE_PC 0x0000000f /* Pipe Count */
19260 +#define SBIMSTATE_AP_MASK 0x00000030 /* Arbitration Priority */
19261 +#define SBIMSTATE_AP_BOTH 0x00000000 /* Use both timeslices and token */
19262 +#define SBIMSTATE_AP_TS 0x00000010 /* Use timeslices only */
19263 +#define SBIMSTATE_AP_TK 0x00000020 /* Use token only */
19264 +#define SBIMSTATE_AP_RSV 0x00000030 /* Reserved */
19265 +#define SBIMSTATE_IBE 0x00020000 /* In Band Error */
19266 +#define SBIMSTATE_TO 0x00040000 /* Timeout */
19267 +#define B44_SBINTVEC 0x0F94UL /* SB Interrupt Mask */
19268 +#define SBINTVEC_PCI 0x00000001 /* Enable interrupts for PCI */
19269 +#define SBINTVEC_ENET0 0x00000002 /* Enable interrupts for enet 0 */
19270 +#define SBINTVEC_ILINE20 0x00000004 /* Enable interrupts for iline20 */
19271 +#define SBINTVEC_CODEC 0x00000008 /* Enable interrupts for v90 codec */
19272 +#define SBINTVEC_USB 0x00000010 /* Enable interrupts for usb */
19273 +#define SBINTVEC_EXTIF 0x00000020 /* Enable interrupts for external i/f */
19274 +#define SBINTVEC_ENET1 0x00000040 /* Enable interrupts for enet 1 */
19275 +#define B44_SBTMSLOW 0x0F98UL /* SB Target State Low */
19276 +#define SBTMSLOW_RESET 0x00000001 /* Reset */
19277 +#define SBTMSLOW_REJECT 0x00000002 /* Reject */
19278 +#define SBTMSLOW_CLOCK 0x00010000 /* Clock Enable */
19279 +#define SBTMSLOW_FGC 0x00020000 /* Force Gated Clocks On */
19280 +#define SBTMSLOW_PE 0x40000000 /* Power Management Enable */
19281 +#define SBTMSLOW_BE 0x80000000 /* BIST Enable */
19282 +#define B44_SBTMSHIGH 0x0F9CUL /* SB Target State High */
19283 +#define SBTMSHIGH_SERR 0x00000001 /* S-error */
19284 +#define SBTMSHIGH_INT 0x00000002 /* Interrupt */
19285 +#define SBTMSHIGH_BUSY 0x00000004 /* Busy */
19286 +#define SBTMSHIGH_GCR 0x20000000 /* Gated Clock Request */
19287 +#define SBTMSHIGH_BISTF 0x40000000 /* BIST Failed */
19288 +#define SBTMSHIGH_BISTD 0x80000000 /* BIST Done */
19289 +#define B44_SBIDHIGH 0x0FFCUL /* SB Identification High */
19290 +#define SBIDHIGH_RC_MASK 0x0000000f /* Revision Code */
19291 +#define SBIDHIGH_CC_MASK 0x0000fff0 /* Core Code */
19292 +#define SBIDHIGH_CC_SHIFT 4
19293 +#define SBIDHIGH_VC_MASK 0xffff0000 /* Vendor Code */
19294 +#define SBIDHIGH_VC_SHIFT 16
19295 +
19296 +/* SSB PCI config space registers. */
19297 +#define SSB_BAR0_WIN 0x80
19298 +#define SSB_BAR1_WIN 0x84
19299 +#define SSB_SPROM_CONTROL 0x88
19300 +#define SSB_BAR1_CONTROL 0x8c
19301 +
19302 +/* SSB core and host control registers. */
19303 +#define SSB_CONTROL 0x0000UL
19304 +#define SSB_ARBCONTROL 0x0010UL
19305 +#define SSB_ISTAT 0x0020UL
19306 +#define SSB_IMASK 0x0024UL
19307 +#define SSB_MBOX 0x0028UL
19308 +#define SSB_BCAST_ADDR 0x0050UL
19309 +#define SSB_BCAST_DATA 0x0054UL
19310 +#define SSB_PCI_TRANS_0 0x0100UL
19311 +#define SSB_PCI_TRANS_1 0x0104UL
19312 +#define SSB_PCI_TRANS_2 0x0108UL
19313 +#define SSB_SPROM 0x0800UL
19314 +
19315 +#define SSB_PCI_MEM 0x00000000
19316 +#define SSB_PCI_IO 0x00000001
19317 +#define SSB_PCI_CFG0 0x00000002
19318 +#define SSB_PCI_CFG1 0x00000003
19319 +#define SSB_PCI_PREF 0x00000004
19320 +#define SSB_PCI_BURST 0x00000008
19321 +#define SSB_PCI_MASK0 0xfc000000
19322 +#define SSB_PCI_MASK1 0xfc000000
19323 +#define SSB_PCI_MASK2 0xc0000000
19324 +
19325 +/* 4400 PHY registers */
19326 +#define B44_MII_AUXCTRL 24 /* Auxiliary Control */
19327 +#define MII_AUXCTRL_DUPLEX 0x0001 /* Full Duplex */
19328 +#define MII_AUXCTRL_SPEED 0x0002 /* 1=100Mbps, 0=10Mbps */
19329 +#define MII_AUXCTRL_FORCED 0x0004 /* Forced 10/100 */
19330 +#define B44_MII_ALEDCTRL 26 /* Activity LED */
19331 +#define MII_ALEDCTRL_ALLMSK 0x7fff
19332 +#define B44_MII_TLEDCTRL 27 /* Traffic Meter LED */
19333 +#define MII_TLEDCTRL_ENABLE 0x0040
19334 +
19335 +struct dma_desc {
19336 + u32 ctrl;
19337 + u32 addr;
19338 +};
19339 +
19340 +/* There are only 12 bits in the DMA engine for descriptor offsetting
19341 + * so the table must be aligned on a boundary of this.
19342 + */
19343 +#define DMA_TABLE_BYTES 4096
19344 +
19345 +#define DESC_CTRL_LEN 0x00001fff
19346 +#define DESC_CTRL_CMASK 0x0ff00000 /* Core specific bits */
19347 +#define DESC_CTRL_EOT 0x10000000 /* End of Table */
19348 +#define DESC_CTRL_IOC 0x20000000 /* Interrupt On Completion */
19349 +#define DESC_CTRL_EOF 0x40000000 /* End of Frame */
19350 +#define DESC_CTRL_SOF 0x80000000 /* Start of Frame */
19351 +
19352 +#define RX_COPY_THRESHOLD 256
19353 +
19354 +struct rx_header {
19355 + u16 len;
19356 + u16 flags;
19357 + u16 pad[12];
19358 +};
19359 +#define RX_HEADER_LEN 28
19360 +
19361 +#define RX_FLAG_OFIFO 0x00000001 /* FIFO Overflow */
19362 +#define RX_FLAG_CRCERR 0x00000002 /* CRC Error */
19363 +#define RX_FLAG_SERR 0x00000004 /* Receive Symbol Error */
19364 +#define RX_FLAG_ODD 0x00000008 /* Frame has odd number of nibbles */
19365 +#define RX_FLAG_LARGE 0x00000010 /* Frame is > RX MAX Length */
19366 +#define RX_FLAG_MCAST 0x00000020 /* Dest is Multicast Address */
19367 +#define RX_FLAG_BCAST 0x00000040 /* Dest is Broadcast Address */
19368 +#define RX_FLAG_MISS 0x00000080 /* Received due to promisc mode */
19369 +#define RX_FLAG_LAST 0x00000800 /* Last buffer in frame */
19370 +#define RX_FLAG_ERRORS (RX_FLAG_ODD | RX_FLAG_SERR | RX_FLAG_CRCERR | RX_FLAG_OFIFO)
19371 +
19372 +struct ring_info {
19373 + struct sk_buff *skb;
19374 + DECLARE_PCI_UNMAP_ADDR(mapping);
19375 +};
19376 +
19377 +#define B44_MCAST_TABLE_SIZE 32
19378 +
19379 +/* SW copy of device statistics, kept up to date by periodic timer
19380 + * which probes HW values. Must have same relative layout as HW
19381 + * register above, because b44_stats_update depends upon this.
19382 + */
19383 +struct b44_hw_stats {
19384 + u32 tx_good_octets, tx_good_pkts, tx_octets;
19385 + u32 tx_pkts, tx_broadcast_pkts, tx_multicast_pkts;
19386 + u32 tx_len_64, tx_len_65_to_127, tx_len_128_to_255;
19387 + u32 tx_len_256_to_511, tx_len_512_to_1023, tx_len_1024_to_max;
19388 + u32 tx_jabber_pkts, tx_oversize_pkts, tx_fragment_pkts;
19389 + u32 tx_underruns, tx_total_cols, tx_single_cols;
19390 + u32 tx_multiple_cols, tx_excessive_cols, tx_late_cols;
19391 + u32 tx_defered, tx_carrier_lost, tx_pause_pkts;
19392 + u32 __pad1[8];
19393 +
19394 + u32 rx_good_octets, rx_good_pkts, rx_octets;
19395 + u32 rx_pkts, rx_broadcast_pkts, rx_multicast_pkts;
19396 + u32 rx_len_64, rx_len_65_to_127, rx_len_128_to_255;
19397 + u32 rx_len_256_to_511, rx_len_512_to_1023, rx_len_1024_to_max;
19398 + u32 rx_jabber_pkts, rx_oversize_pkts, rx_fragment_pkts;
19399 + u32 rx_missed_pkts, rx_crc_align_errs, rx_undersize;
19400 + u32 rx_crc_errs, rx_align_errs, rx_symbol_errs;
19401 + u32 rx_pause_pkts, rx_nonpause_pkts;
19402 +};
19403 +
19404 +struct b44 {
19405 + spinlock_t lock;
19406 +
19407 + u32 imask, istat;
19408 +
19409 + struct dma_desc *rx_ring, *tx_ring;
19410 +
19411 + u32 tx_prod, tx_cons;
19412 + u32 rx_prod, rx_cons;
19413 +
19414 + struct ring_info *rx_buffers;
19415 + struct ring_info *tx_buffers;
19416 +
19417 + u32 dma_offset;
19418 + u32 flags;
19419 +#define B44_FLAG_INIT_COMPLETE 0x00000001
19420 +#define B44_FLAG_BUGGY_TXPTR 0x00000002
19421 +#define B44_FLAG_REORDER_BUG 0x00000004
19422 +#define B44_FLAG_PAUSE_AUTO 0x00008000
19423 +#define B44_FLAG_FULL_DUPLEX 0x00010000
19424 +#define B44_FLAG_100_BASE_T 0x00020000
19425 +#define B44_FLAG_TX_PAUSE 0x00040000
19426 +#define B44_FLAG_RX_PAUSE 0x00080000
19427 +#define B44_FLAG_FORCE_LINK 0x00100000
19428 +#define B44_FLAG_ADV_10HALF 0x01000000
19429 +#define B44_FLAG_ADV_10FULL 0x02000000
19430 +#define B44_FLAG_ADV_100HALF 0x04000000
19431 +#define B44_FLAG_ADV_100FULL 0x08000000
19432 +#define B44_FLAG_INTERNAL_PHY 0x10000000
19433 +
19434 + u32 rx_offset;
19435 +
19436 + u32 msg_enable;
19437 +
19438 + struct timer_list timer;
19439 +
19440 + struct net_device_stats stats;
19441 + struct b44_hw_stats hw_stats;
19442 +
19443 + void __iomem *regs;
19444 + struct pci_dev *pdev;
19445 + struct net_device *dev;
19446 +
19447 + dma_addr_t rx_ring_dma, tx_ring_dma;
19448 +
19449 + u32 rx_pending;
19450 + u32 tx_pending;
19451 + u8 phy_addr;
19452 + u8 core_unit;
19453 +
19454 + struct mii_if_info mii_if;
19455 +};
19456 +
19457 +#endif /* _B44_H */
19458 diff -Nur linux-2.6.12.5/include/asm-mips/bootinfo.h linux-2.6.12.5-brcm/include/asm-mips/bootinfo.h
19459 --- linux-2.6.12.5/include/asm-mips/bootinfo.h 2005-08-15 02:20:18.000000000 +0200
19460 +++ linux-2.6.12.5-brcm/include/asm-mips/bootinfo.h 2005-08-28 11:12:20.695818872 +0200
19461 @@ -213,6 +213,12 @@
19462 #define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */
19463 #define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */
19464
19465 +/*
19466 + * Valid machtype for group Broadcom
19467 + */
19468 +#define MACH_GROUP_BRCM 23 /* Broadcom */
19469 +#define MACH_BCM47XX 1 /* Broadcom BCM47xx */
19470 +
19471 #define CL_SIZE COMMAND_LINE_SIZE
19472
19473 const char *get_system_type(void);
19474 diff -Nur linux-2.6.12.5/include/asm-mips/cpu.h linux-2.6.12.5-brcm/include/asm-mips/cpu.h
19475 --- linux-2.6.12.5/include/asm-mips/cpu.h 2005-08-15 02:20:18.000000000 +0200
19476 +++ linux-2.6.12.5-brcm/include/asm-mips/cpu.h 2005-08-28 11:12:20.695818872 +0200
19477 @@ -87,6 +87,13 @@
19478 #define PRID_IMP_SR71000 0x0400
19479
19480 /*
19481 + * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM
19482 + */
19483 +
19484 +#define PRID_IMP_BCM4710 0x4000
19485 +#define PRID_IMP_BCM3302 0x9000
19486 +
19487 +/*
19488 * Definitions for 7:0 on legacy processors
19489 */
19490
19491 @@ -177,7 +184,9 @@
19492 #define CPU_VR4133 56
19493 #define CPU_AU1550 57
19494 #define CPU_24K 58
19495 -#define CPU_LAST 58
19496 +#define CPU_BCM3302 59
19497 +#define CPU_BCM4710 60
19498 +#define CPU_LAST 60
19499
19500 /*
19501 * ISA Level encodings
19502 diff -Nur linux-2.6.12.5/include/asm-mips/mipsregs.h linux-2.6.12.5-brcm/include/asm-mips/mipsregs.h
19503 --- linux-2.6.12.5/include/asm-mips/mipsregs.h 2005-08-15 02:20:18.000000000 +0200
19504 +++ linux-2.6.12.5-brcm/include/asm-mips/mipsregs.h 2005-08-28 11:12:20.722814768 +0200
19505 @@ -790,10 +790,18 @@
19506 #define read_c0_config1() __read_32bit_c0_register($16, 1)
19507 #define read_c0_config2() __read_32bit_c0_register($16, 2)
19508 #define read_c0_config3() __read_32bit_c0_register($16, 3)
19509 +#define read_c0_config4() __read_32bit_c0_register($16, 4)
19510 +#define read_c0_config5() __read_32bit_c0_register($16, 5)
19511 +#define read_c0_config6() __read_32bit_c0_register($16, 6)
19512 +#define read_c0_config7() __read_32bit_c0_register($16, 7)
19513 #define write_c0_config(val) __write_32bit_c0_register($16, 0, val)
19514 #define write_c0_config1(val) __write_32bit_c0_register($16, 1, val)
19515 #define write_c0_config2(val) __write_32bit_c0_register($16, 2, val)
19516 #define write_c0_config3(val) __write_32bit_c0_register($16, 3, val)
19517 +#define write_c0_config4(val) __write_32bit_c0_register($16, 4, val)
19518 +#define write_c0_config5(val) __write_32bit_c0_register($16, 5, val)
19519 +#define write_c0_config6(val) __write_32bit_c0_register($16, 6, val)
19520 +#define write_c0_config7(val) __write_32bit_c0_register($16, 7, val)
19521
19522 /*
19523 * The WatchLo register. There may be upto 8 of them.
19524 diff -Nur linux-2.6.12.5/include/linux/init.h linux-2.6.12.5-brcm/include/linux/init.h
19525 --- linux-2.6.12.5/include/linux/init.h 2005-08-15 02:20:18.000000000 +0200
19526 +++ linux-2.6.12.5-brcm/include/linux/init.h 2005-08-28 11:12:20.723814616 +0200
19527 @@ -86,6 +86,8 @@
19528 static initcall_t __initcall_##fn __attribute_used__ \
19529 __attribute__((__section__(".initcall" level ".init"))) = fn
19530
19531 +#define early_initcall(fn) __define_initcall(".early1",fn)
19532 +
19533 #define core_initcall(fn) __define_initcall("1",fn)
19534 #define postcore_initcall(fn) __define_initcall("2",fn)
19535 #define arch_initcall(fn) __define_initcall("3",fn)
19536 diff -Nur linux-2.6.12.5/include/linux/pci_ids.h linux-2.6.12.5-brcm/include/linux/pci_ids.h
19537 --- linux-2.6.12.5/include/linux/pci_ids.h 2005-08-15 02:20:18.000000000 +0200
19538 +++ linux-2.6.12.5-brcm/include/linux/pci_ids.h 2005-08-28 11:12:20.726814160 +0200
19539 @@ -2110,6 +2110,7 @@
19540 #define PCI_DEVICE_ID_TIGON3_5901_2 0x170e
19541 #define PCI_DEVICE_ID_BCM4401 0x4401
19542 #define PCI_DEVICE_ID_BCM4401B0 0x4402
19543 +#define PCI_DEVICE_ID_BCM4713 0x4713
19544
19545 #define PCI_VENDOR_ID_TOPIC 0x151f
19546 #define PCI_DEVICE_ID_TOPIC_TP560 0x0000
19547 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
19548 --- linux-2.6.12.5/include/linux/pci_ids.h.orig 1970-01-01 01:00:00.000000000 +0100
19549 +++ linux-2.6.12.5-brcm/include/linux/pci_ids.h.orig 2005-08-15 02:20:18.000000000 +0200
19550 @@ -0,0 +1,2609 @@
19551 +/*
19552 + * PCI Class, Vendor and Device IDs
19553 + *
19554 + * Please keep sorted.
19555 + */
19556 +
19557 +/* Device classes and subclasses */
19558 +
19559 +#define PCI_CLASS_NOT_DEFINED 0x0000
19560 +#define PCI_CLASS_NOT_DEFINED_VGA 0x0001
19561 +
19562 +#define PCI_BASE_CLASS_STORAGE 0x01
19563 +#define PCI_CLASS_STORAGE_SCSI 0x0100
19564 +#define PCI_CLASS_STORAGE_IDE 0x0101
19565 +#define PCI_CLASS_STORAGE_FLOPPY 0x0102
19566 +#define PCI_CLASS_STORAGE_IPI 0x0103
19567 +#define PCI_CLASS_STORAGE_RAID 0x0104
19568 +#define PCI_CLASS_STORAGE_OTHER 0x0180
19569 +
19570 +#define PCI_BASE_CLASS_NETWORK 0x02
19571 +#define PCI_CLASS_NETWORK_ETHERNET 0x0200
19572 +#define PCI_CLASS_NETWORK_TOKEN_RING 0x0201
19573 +#define PCI_CLASS_NETWORK_FDDI 0x0202
19574 +#define PCI_CLASS_NETWORK_ATM 0x0203
19575 +#define PCI_CLASS_NETWORK_OTHER 0x0280
19576 +
19577 +#define PCI_BASE_CLASS_DISPLAY 0x03
19578 +#define PCI_CLASS_DISPLAY_VGA 0x0300
19579 +#define PCI_CLASS_DISPLAY_XGA 0x0301
19580 +#define PCI_CLASS_DISPLAY_3D 0x0302
19581 +#define PCI_CLASS_DISPLAY_OTHER 0x0380
19582 +
19583 +#define PCI_BASE_CLASS_MULTIMEDIA 0x04
19584 +#define PCI_CLASS_MULTIMEDIA_VIDEO 0x0400
19585 +#define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401
19586 +#define PCI_CLASS_MULTIMEDIA_PHONE 0x0402
19587 +#define PCI_CLASS_MULTIMEDIA_OTHER 0x0480
19588 +
19589 +#define PCI_BASE_CLASS_MEMORY 0x05
19590 +#define PCI_CLASS_MEMORY_RAM 0x0500
19591 +#define PCI_CLASS_MEMORY_FLASH 0x0501
19592 +#define PCI_CLASS_MEMORY_OTHER 0x0580
19593 +
19594 +#define PCI_BASE_CLASS_BRIDGE 0x06
19595 +#define PCI_CLASS_BRIDGE_HOST 0x0600
19596 +#define PCI_CLASS_BRIDGE_ISA 0x0601
19597 +#define PCI_CLASS_BRIDGE_EISA 0x0602
19598 +#define PCI_CLASS_BRIDGE_MC 0x0603
19599 +#define PCI_CLASS_BRIDGE_PCI 0x0604
19600 +#define PCI_CLASS_BRIDGE_PCMCIA 0x0605
19601 +#define PCI_CLASS_BRIDGE_NUBUS 0x0606
19602 +#define PCI_CLASS_BRIDGE_CARDBUS 0x0607
19603 +#define PCI_CLASS_BRIDGE_RACEWAY 0x0608
19604 +#define PCI_CLASS_BRIDGE_OTHER 0x0680
19605 +
19606 +#define PCI_BASE_CLASS_COMMUNICATION 0x07
19607 +#define PCI_CLASS_COMMUNICATION_SERIAL 0x0700
19608 +#define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701
19609 +#define PCI_CLASS_COMMUNICATION_MULTISERIAL 0x0702
19610 +#define PCI_CLASS_COMMUNICATION_MODEM 0x0703
19611 +#define PCI_CLASS_COMMUNICATION_OTHER 0x0780
19612 +
19613 +#define PCI_BASE_CLASS_SYSTEM 0x08
19614 +#define PCI_CLASS_SYSTEM_PIC 0x0800
19615 +#define PCI_CLASS_SYSTEM_DMA 0x0801
19616 +#define PCI_CLASS_SYSTEM_TIMER 0x0802
19617 +#define PCI_CLASS_SYSTEM_RTC 0x0803
19618 +#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804
19619 +#define PCI_CLASS_SYSTEM_OTHER 0x0880
19620 +
19621 +#define PCI_BASE_CLASS_INPUT 0x09
19622 +#define PCI_CLASS_INPUT_KEYBOARD 0x0900
19623 +#define PCI_CLASS_INPUT_PEN 0x0901
19624 +#define PCI_CLASS_INPUT_MOUSE 0x0902
19625 +#define PCI_CLASS_INPUT_SCANNER 0x0903
19626 +#define PCI_CLASS_INPUT_GAMEPORT 0x0904
19627 +#define PCI_CLASS_INPUT_OTHER 0x0980
19628 +
19629 +#define PCI_BASE_CLASS_DOCKING 0x0a
19630 +#define PCI_CLASS_DOCKING_GENERIC 0x0a00
19631 +#define PCI_CLASS_DOCKING_OTHER 0x0a80
19632 +
19633 +#define PCI_BASE_CLASS_PROCESSOR 0x0b
19634 +#define PCI_CLASS_PROCESSOR_386 0x0b00
19635 +#define PCI_CLASS_PROCESSOR_486 0x0b01
19636 +#define PCI_CLASS_PROCESSOR_PENTIUM 0x0b02
19637 +#define PCI_CLASS_PROCESSOR_ALPHA 0x0b10
19638 +#define PCI_CLASS_PROCESSOR_POWERPC 0x0b20
19639 +#define PCI_CLASS_PROCESSOR_MIPS 0x0b30
19640 +#define PCI_CLASS_PROCESSOR_CO 0x0b40
19641 +
19642 +#define PCI_BASE_CLASS_SERIAL 0x0c
19643 +#define PCI_CLASS_SERIAL_FIREWIRE 0x0c00
19644 +#define PCI_CLASS_SERIAL_ACCESS 0x0c01
19645 +#define PCI_CLASS_SERIAL_SSA 0x0c02
19646 +#define PCI_CLASS_SERIAL_USB 0x0c03
19647 +#define PCI_CLASS_SERIAL_FIBER 0x0c04
19648 +#define PCI_CLASS_SERIAL_SMBUS 0x0c05
19649 +
19650 +#define PCI_BASE_CLASS_INTELLIGENT 0x0e
19651 +#define PCI_CLASS_INTELLIGENT_I2O 0x0e00
19652 +
19653 +#define PCI_BASE_CLASS_SATELLITE 0x0f
19654 +#define PCI_CLASS_SATELLITE_TV 0x0f00
19655 +#define PCI_CLASS_SATELLITE_AUDIO 0x0f01
19656 +#define PCI_CLASS_SATELLITE_VOICE 0x0f03
19657 +#define PCI_CLASS_SATELLITE_DATA 0x0f04
19658 +
19659 +#define PCI_BASE_CLASS_CRYPT 0x10
19660 +#define PCI_CLASS_CRYPT_NETWORK 0x1000
19661 +#define PCI_CLASS_CRYPT_ENTERTAINMENT 0x1001
19662 +#define PCI_CLASS_CRYPT_OTHER 0x1080
19663 +
19664 +#define PCI_BASE_CLASS_SIGNAL_PROCESSING 0x11
19665 +#define PCI_CLASS_SP_DPIO 0x1100
19666 +#define PCI_CLASS_SP_OTHER 0x1180
19667 +
19668 +#define PCI_CLASS_OTHERS 0xff
19669 +
19670 +/* Vendors and devices. Sort key: vendor first, device next. */
19671 +
19672 +#define PCI_VENDOR_ID_DYNALINK 0x0675
19673 +#define PCI_DEVICE_ID_DYNALINK_IS64PH 0x1702
19674 +
19675 +#define PCI_VENDOR_ID_BERKOM 0x0871
19676 +#define PCI_DEVICE_ID_BERKOM_A1T 0xffa1
19677 +#define PCI_DEVICE_ID_BERKOM_T_CONCEPT 0xffa2
19678 +#define PCI_DEVICE_ID_BERKOM_A4T 0xffa4
19679 +#define PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO 0xffa8
19680 +
19681 +#define PCI_VENDOR_ID_COMPAQ 0x0e11
19682 +#define PCI_DEVICE_ID_COMPAQ_TOKENRING 0x0508
19683 +#define PCI_DEVICE_ID_COMPAQ_1280 0x3033
19684 +#define PCI_DEVICE_ID_COMPAQ_TRIFLEX 0x4000
19685 +#define PCI_DEVICE_ID_COMPAQ_6010 0x6010
19686 +#define PCI_DEVICE_ID_COMPAQ_TACHYON 0xa0fc
19687 +#define PCI_DEVICE_ID_COMPAQ_SMART2P 0xae10
19688 +#define PCI_DEVICE_ID_COMPAQ_NETEL100 0xae32
19689 +#define PCI_DEVICE_ID_COMPAQ_NETEL10 0xae34
19690 +#define PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE 0xae33
19691 +#define PCI_DEVICE_ID_COMPAQ_NETFLEX3I 0xae35
19692 +#define PCI_DEVICE_ID_COMPAQ_NETEL100D 0xae40
19693 +#define PCI_DEVICE_ID_COMPAQ_NETEL100PI 0xae43
19694 +#define PCI_DEVICE_ID_COMPAQ_NETEL100I 0xb011
19695 +#define PCI_DEVICE_ID_COMPAQ_CISS 0xb060
19696 +#define PCI_DEVICE_ID_COMPAQ_CISSB 0xb178
19697 +#define PCI_DEVICE_ID_COMPAQ_CISSC 0x46
19698 +#define PCI_DEVICE_ID_COMPAQ_THUNDER 0xf130
19699 +#define PCI_DEVICE_ID_COMPAQ_NETFLEX3B 0xf150
19700 +
19701 +#define PCI_VENDOR_ID_NCR 0x1000
19702 +#define PCI_VENDOR_ID_LSI_LOGIC 0x1000
19703 +#define PCI_DEVICE_ID_NCR_53C810 0x0001
19704 +#define PCI_DEVICE_ID_NCR_53C820 0x0002
19705 +#define PCI_DEVICE_ID_NCR_53C825 0x0003
19706 +#define PCI_DEVICE_ID_NCR_53C815 0x0004
19707 +#define PCI_DEVICE_ID_LSI_53C810AP 0x0005
19708 +#define PCI_DEVICE_ID_NCR_53C860 0x0006
19709 +#define PCI_DEVICE_ID_LSI_53C1510 0x000a
19710 +#define PCI_DEVICE_ID_NCR_53C896 0x000b
19711 +#define PCI_DEVICE_ID_NCR_53C895 0x000c
19712 +#define PCI_DEVICE_ID_NCR_53C885 0x000d
19713 +#define PCI_DEVICE_ID_NCR_53C875 0x000f
19714 +#define PCI_DEVICE_ID_NCR_53C1510 0x0010
19715 +#define PCI_DEVICE_ID_LSI_53C895A 0x0012
19716 +#define PCI_DEVICE_ID_LSI_53C875A 0x0013
19717 +#define PCI_DEVICE_ID_LSI_53C1010_33 0x0020
19718 +#define PCI_DEVICE_ID_LSI_53C1010_66 0x0021
19719 +#define PCI_DEVICE_ID_LSI_53C1030 0x0030
19720 +#define PCI_DEVICE_ID_LSI_1030_53C1035 0x0032
19721 +#define PCI_DEVICE_ID_LSI_53C1035 0x0040
19722 +#define PCI_DEVICE_ID_NCR_53C875J 0x008f
19723 +#define PCI_DEVICE_ID_LSI_FC909 0x0621
19724 +#define PCI_DEVICE_ID_LSI_FC929 0x0622
19725 +#define PCI_DEVICE_ID_LSI_FC929_LAN 0x0623
19726 +#define PCI_DEVICE_ID_LSI_FC919 0x0624
19727 +#define PCI_DEVICE_ID_LSI_FC919_LAN 0x0625
19728 +#define PCI_DEVICE_ID_LSI_FC929X 0x0626
19729 +#define PCI_DEVICE_ID_LSI_FC939X 0x0642
19730 +#define PCI_DEVICE_ID_LSI_FC949X 0x0640
19731 +#define PCI_DEVICE_ID_LSI_FC919X 0x0628
19732 +#define PCI_DEVICE_ID_NCR_YELLOWFIN 0x0701
19733 +#define PCI_DEVICE_ID_LSI_61C102 0x0901
19734 +#define PCI_DEVICE_ID_LSI_63C815 0x1000
19735 +#define PCI_DEVICE_ID_LSI_SAS1064 0x0050
19736 +#define PCI_DEVICE_ID_LSI_SAS1066 0x005E
19737 +#define PCI_DEVICE_ID_LSI_SAS1068 0x0054
19738 +#define PCI_DEVICE_ID_LSI_SAS1064A 0x005C
19739 +#define PCI_DEVICE_ID_LSI_SAS1064E 0x0056
19740 +#define PCI_DEVICE_ID_LSI_SAS1066E 0x005A
19741 +#define PCI_DEVICE_ID_LSI_SAS1068E 0x0058
19742 +#define PCI_DEVICE_ID_LSI_SAS1078 0x0060
19743 +
19744 +#define PCI_VENDOR_ID_ATI 0x1002
19745 +/* Mach64 */
19746 +#define PCI_DEVICE_ID_ATI_68800 0x4158
19747 +#define PCI_DEVICE_ID_ATI_215CT222 0x4354
19748 +#define PCI_DEVICE_ID_ATI_210888CX 0x4358
19749 +#define PCI_DEVICE_ID_ATI_215ET222 0x4554
19750 +/* Mach64 / Rage */
19751 +#define PCI_DEVICE_ID_ATI_215GB 0x4742
19752 +#define PCI_DEVICE_ID_ATI_215GD 0x4744
19753 +#define PCI_DEVICE_ID_ATI_215GI 0x4749
19754 +#define PCI_DEVICE_ID_ATI_215GP 0x4750
19755 +#define PCI_DEVICE_ID_ATI_215GQ 0x4751
19756 +#define PCI_DEVICE_ID_ATI_215XL 0x4752
19757 +#define PCI_DEVICE_ID_ATI_215GT 0x4754
19758 +#define PCI_DEVICE_ID_ATI_215GTB 0x4755
19759 +#define PCI_DEVICE_ID_ATI_215_IV 0x4756
19760 +#define PCI_DEVICE_ID_ATI_215_IW 0x4757
19761 +#define PCI_DEVICE_ID_ATI_215_IZ 0x475A
19762 +#define PCI_DEVICE_ID_ATI_210888GX 0x4758
19763 +#define PCI_DEVICE_ID_ATI_215_LB 0x4c42
19764 +#define PCI_DEVICE_ID_ATI_215_LD 0x4c44
19765 +#define PCI_DEVICE_ID_ATI_215_LG 0x4c47
19766 +#define PCI_DEVICE_ID_ATI_215_LI 0x4c49
19767 +#define PCI_DEVICE_ID_ATI_215_LM 0x4c4D
19768 +#define PCI_DEVICE_ID_ATI_215_LN 0x4c4E
19769 +#define PCI_DEVICE_ID_ATI_215_LR 0x4c52
19770 +#define PCI_DEVICE_ID_ATI_215_LS 0x4c53
19771 +#define PCI_DEVICE_ID_ATI_264_LT 0x4c54
19772 +/* Mach64 VT */
19773 +#define PCI_DEVICE_ID_ATI_264VT 0x5654
19774 +#define PCI_DEVICE_ID_ATI_264VU 0x5655
19775 +#define PCI_DEVICE_ID_ATI_264VV 0x5656
19776 +/* Rage128 GL */
19777 +#define PCI_DEVICE_ID_ATI_RAGE128_RE 0x5245
19778 +#define PCI_DEVICE_ID_ATI_RAGE128_RF 0x5246
19779 +#define PCI_DEVICE_ID_ATI_RAGE128_RG 0x5247
19780 +/* Rage128 VR */
19781 +#define PCI_DEVICE_ID_ATI_RAGE128_RK 0x524b
19782 +#define PCI_DEVICE_ID_ATI_RAGE128_RL 0x524c
19783 +#define PCI_DEVICE_ID_ATI_RAGE128_SE 0x5345
19784 +#define PCI_DEVICE_ID_ATI_RAGE128_SF 0x5346
19785 +#define PCI_DEVICE_ID_ATI_RAGE128_SG 0x5347
19786 +#define PCI_DEVICE_ID_ATI_RAGE128_SH 0x5348
19787 +#define PCI_DEVICE_ID_ATI_RAGE128_SK 0x534b
19788 +#define PCI_DEVICE_ID_ATI_RAGE128_SL 0x534c
19789 +#define PCI_DEVICE_ID_ATI_RAGE128_SM 0x534d
19790 +#define PCI_DEVICE_ID_ATI_RAGE128_SN 0x534e
19791 +/* Rage128 Ultra */
19792 +#define PCI_DEVICE_ID_ATI_RAGE128_TF 0x5446
19793 +#define PCI_DEVICE_ID_ATI_RAGE128_TL 0x544c
19794 +#define PCI_DEVICE_ID_ATI_RAGE128_TR 0x5452
19795 +#define PCI_DEVICE_ID_ATI_RAGE128_TS 0x5453
19796 +#define PCI_DEVICE_ID_ATI_RAGE128_TT 0x5454
19797 +#define PCI_DEVICE_ID_ATI_RAGE128_TU 0x5455
19798 +/* Rage128 M3 */
19799 +#define PCI_DEVICE_ID_ATI_RAGE128_LE 0x4c45
19800 +#define PCI_DEVICE_ID_ATI_RAGE128_LF 0x4c46
19801 +/* Rage128 M4 */
19802 +#define PCI_DEVICE_ID_ATI_RAGE128_MF 0x4d46
19803 +#define PCI_DEVICE_ID_ATI_RAGE128_ML 0x4d4c
19804 +/* Rage128 Pro GL */
19805 +#define PCI_DEVICE_ID_ATI_RAGE128_PA 0x5041
19806 +#define PCI_DEVICE_ID_ATI_RAGE128_PB 0x5042
19807 +#define PCI_DEVICE_ID_ATI_RAGE128_PC 0x5043
19808 +#define PCI_DEVICE_ID_ATI_RAGE128_PD 0x5044
19809 +#define PCI_DEVICE_ID_ATI_RAGE128_PE 0x5045
19810 +#define PCI_DEVICE_ID_ATI_RAGE128_PF 0x5046
19811 +/* Rage128 Pro VR */
19812 +#define PCI_DEVICE_ID_ATI_RAGE128_PG 0x5047
19813 +#define PCI_DEVICE_ID_ATI_RAGE128_PH 0x5048
19814 +#define PCI_DEVICE_ID_ATI_RAGE128_PI 0x5049
19815 +#define PCI_DEVICE_ID_ATI_RAGE128_PJ 0x504A
19816 +#define PCI_DEVICE_ID_ATI_RAGE128_PK 0x504B
19817 +#define PCI_DEVICE_ID_ATI_RAGE128_PL 0x504C
19818 +#define PCI_DEVICE_ID_ATI_RAGE128_PM 0x504D
19819 +#define PCI_DEVICE_ID_ATI_RAGE128_PN 0x504E
19820 +#define PCI_DEVICE_ID_ATI_RAGE128_PO 0x504F
19821 +#define PCI_DEVICE_ID_ATI_RAGE128_PP 0x5050
19822 +#define PCI_DEVICE_ID_ATI_RAGE128_PQ 0x5051
19823 +#define PCI_DEVICE_ID_ATI_RAGE128_PR 0x5052
19824 +#define PCI_DEVICE_ID_ATI_RAGE128_TR 0x5452
19825 +#define PCI_DEVICE_ID_ATI_RAGE128_PS 0x5053
19826 +#define PCI_DEVICE_ID_ATI_RAGE128_PT 0x5054
19827 +#define PCI_DEVICE_ID_ATI_RAGE128_PU 0x5055
19828 +#define PCI_DEVICE_ID_ATI_RAGE128_PV 0x5056
19829 +#define PCI_DEVICE_ID_ATI_RAGE128_PW 0x5057
19830 +#define PCI_DEVICE_ID_ATI_RAGE128_PX 0x5058
19831 +/* Rage128 M4 */
19832 +#define PCI_DEVICE_ID_ATI_RADEON_LE 0x4d45
19833 +#define PCI_DEVICE_ID_ATI_RADEON_LF 0x4d46
19834 +/* Radeon R100 */
19835 +#define PCI_DEVICE_ID_ATI_RADEON_QD 0x5144
19836 +#define PCI_DEVICE_ID_ATI_RADEON_QE 0x5145
19837 +#define PCI_DEVICE_ID_ATI_RADEON_QF 0x5146
19838 +#define PCI_DEVICE_ID_ATI_RADEON_QG 0x5147
19839 +/* Radeon RV100 (VE) */
19840 +#define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159
19841 +#define PCI_DEVICE_ID_ATI_RADEON_QZ 0x515a
19842 +/* Radeon R200 (8500) */
19843 +#define PCI_DEVICE_ID_ATI_RADEON_QL 0x514c
19844 +#define PCI_DEVICE_ID_ATI_RADEON_QN 0x514e
19845 +#define PCI_DEVICE_ID_ATI_RADEON_QO 0x514f
19846 +#define PCI_DEVICE_ID_ATI_RADEON_Ql 0x516c
19847 +#define PCI_DEVICE_ID_ATI_RADEON_BB 0x4242
19848 +/* Radeon R200 (9100) */
19849 +#define PCI_DEVICE_ID_ATI_RADEON_QM 0x514d
19850 +/* Radeon RV200 (7500) */
19851 +#define PCI_DEVICE_ID_ATI_RADEON_QW 0x5157
19852 +#define PCI_DEVICE_ID_ATI_RADEON_QX 0x5158
19853 +/* Radeon NV-100 */
19854 +#define PCI_DEVICE_ID_ATI_RADEON_N1 0x5159
19855 +#define PCI_DEVICE_ID_ATI_RADEON_N2 0x515a
19856 +/* Radeon RV250 (9000) */
19857 +#define PCI_DEVICE_ID_ATI_RADEON_Id 0x4964
19858 +#define PCI_DEVICE_ID_ATI_RADEON_Ie 0x4965
19859 +#define PCI_DEVICE_ID_ATI_RADEON_If 0x4966
19860 +#define PCI_DEVICE_ID_ATI_RADEON_Ig 0x4967
19861 +/* Radeon RV280 (9200) */
19862 +#define PCI_DEVICE_ID_ATI_RADEON_Y_ 0x5960
19863 +#define PCI_DEVICE_ID_ATI_RADEON_Ya 0x5961
19864 +#define PCI_DEVICE_ID_ATI_RADEON_Yd 0x5964
19865 +/* Radeon R300 (9500) */
19866 +#define PCI_DEVICE_ID_ATI_RADEON_AD 0x4144
19867 +/* Radeon R300 (9700) */
19868 +#define PCI_DEVICE_ID_ATI_RADEON_ND 0x4e44
19869 +#define PCI_DEVICE_ID_ATI_RADEON_NE 0x4e45
19870 +#define PCI_DEVICE_ID_ATI_RADEON_NF 0x4e46
19871 +#define PCI_DEVICE_ID_ATI_RADEON_NG 0x4e47
19872 +#define PCI_DEVICE_ID_ATI_RADEON_AE 0x4145
19873 +#define PCI_DEVICE_ID_ATI_RADEON_AF 0x4146
19874 +/* Radeon R350 (9800) */
19875 +#define PCI_DEVICE_ID_ATI_RADEON_NH 0x4e48
19876 +#define PCI_DEVICE_ID_ATI_RADEON_NI 0x4e49
19877 +/* Radeon RV350 (9600) */
19878 +#define PCI_DEVICE_ID_ATI_RADEON_AP 0x4150
19879 +#define PCI_DEVICE_ID_ATI_RADEON_AR 0x4152
19880 +/* Radeon M6 */
19881 +#define PCI_DEVICE_ID_ATI_RADEON_LY 0x4c59
19882 +#define PCI_DEVICE_ID_ATI_RADEON_LZ 0x4c5a
19883 +/* Radeon M7 */
19884 +#define PCI_DEVICE_ID_ATI_RADEON_LW 0x4c57
19885 +#define PCI_DEVICE_ID_ATI_RADEON_LX 0x4c58
19886 +/* Radeon M9 */
19887 +#define PCI_DEVICE_ID_ATI_RADEON_Ld 0x4c64
19888 +#define PCI_DEVICE_ID_ATI_RADEON_Le 0x4c65
19889 +#define PCI_DEVICE_ID_ATI_RADEON_Lf 0x4c66
19890 +#define PCI_DEVICE_ID_ATI_RADEON_Lg 0x4c67
19891 +/* Radeon */
19892 +#define PCI_DEVICE_ID_ATI_RADEON_RA 0x5144
19893 +#define PCI_DEVICE_ID_ATI_RADEON_RB 0x5145
19894 +#define PCI_DEVICE_ID_ATI_RADEON_RC 0x5146
19895 +#define PCI_DEVICE_ID_ATI_RADEON_RD 0x5147
19896 +/* RadeonIGP */
19897 +#define PCI_DEVICE_ID_ATI_RS100 0xcab0
19898 +#define PCI_DEVICE_ID_ATI_RS200 0xcab2
19899 +#define PCI_DEVICE_ID_ATI_RS200_B 0xcbb2
19900 +#define PCI_DEVICE_ID_ATI_RS250 0xcab3
19901 +#define PCI_DEVICE_ID_ATI_RS300_100 0x5830
19902 +#define PCI_DEVICE_ID_ATI_RS300_133 0x5831
19903 +#define PCI_DEVICE_ID_ATI_RS300_166 0x5832
19904 +#define PCI_DEVICE_ID_ATI_RS300_200 0x5833
19905 +#define PCI_DEVICE_ID_ATI_RS350_100 0x7830
19906 +#define PCI_DEVICE_ID_ATI_RS350_133 0x7831
19907 +#define PCI_DEVICE_ID_ATI_RS350_166 0x7832
19908 +#define PCI_DEVICE_ID_ATI_RS350_200 0x7833
19909 +#define PCI_DEVICE_ID_ATI_RS400_100 0x5a30
19910 +#define PCI_DEVICE_ID_ATI_RS400_133 0x5a31
19911 +#define PCI_DEVICE_ID_ATI_RS400_166 0x5a32
19912 +#define PCI_DEVICE_ID_ATI_RS400_200 0x5a33
19913 +#define PCI_DEVICE_ID_ATI_RS480 0x5950
19914 +/* ATI IXP Chipset */
19915 +#define PCI_DEVICE_ID_ATI_IXP200_IDE 0x4349
19916 +#define PCI_DEVICE_ID_ATI_IXP300_IDE 0x4369
19917 +#define PCI_DEVICE_ID_ATI_IXP300_SATA 0x436e
19918 +#define PCI_DEVICE_ID_ATI_IXP400_IDE 0x4376
19919 +#define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379
19920 +
19921 +#define PCI_VENDOR_ID_VLSI 0x1004
19922 +#define PCI_DEVICE_ID_VLSI_82C592 0x0005
19923 +#define PCI_DEVICE_ID_VLSI_82C593 0x0006
19924 +#define PCI_DEVICE_ID_VLSI_82C594 0x0007
19925 +#define PCI_DEVICE_ID_VLSI_82C597 0x0009
19926 +#define PCI_DEVICE_ID_VLSI_82C541 0x000c
19927 +#define PCI_DEVICE_ID_VLSI_82C543 0x000d
19928 +#define PCI_DEVICE_ID_VLSI_82C532 0x0101
19929 +#define PCI_DEVICE_ID_VLSI_82C534 0x0102
19930 +#define PCI_DEVICE_ID_VLSI_82C535 0x0104
19931 +#define PCI_DEVICE_ID_VLSI_82C147 0x0105
19932 +#define PCI_DEVICE_ID_VLSI_VAS96011 0x0702
19933 +
19934 +#define PCI_VENDOR_ID_ADL 0x1005
19935 +#define PCI_DEVICE_ID_ADL_2301 0x2301
19936 +
19937 +#define PCI_VENDOR_ID_NS 0x100b
19938 +#define PCI_DEVICE_ID_NS_87415 0x0002
19939 +#define PCI_DEVICE_ID_NS_87560_LIO 0x000e
19940 +#define PCI_DEVICE_ID_NS_87560_USB 0x0012
19941 +#define PCI_DEVICE_ID_NS_83815 0x0020
19942 +#define PCI_DEVICE_ID_NS_83820 0x0022
19943 +#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500
19944 +#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501
19945 +#define PCI_DEVICE_ID_NS_SCx200_IDE 0x0502
19946 +#define PCI_DEVICE_ID_NS_SCx200_AUDIO 0x0503
19947 +#define PCI_DEVICE_ID_NS_SCx200_VIDEO 0x0504
19948 +#define PCI_DEVICE_ID_NS_SCx200_XBUS 0x0505
19949 +#define PCI_DEVICE_ID_NS_SC1100_BRIDGE 0x0510
19950 +#define PCI_DEVICE_ID_NS_SC1100_SMI 0x0511
19951 +#define PCI_DEVICE_ID_NS_SC1100_XBUS 0x0515
19952 +#define PCI_DEVICE_ID_NS_87410 0xd001
19953 +
19954 +#define PCI_VENDOR_ID_TSENG 0x100c
19955 +#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202
19956 +#define PCI_DEVICE_ID_TSENG_W32P_b 0x3205
19957 +#define PCI_DEVICE_ID_TSENG_W32P_c 0x3206
19958 +#define PCI_DEVICE_ID_TSENG_W32P_d 0x3207
19959 +#define PCI_DEVICE_ID_TSENG_ET6000 0x3208
19960 +
19961 +#define PCI_VENDOR_ID_WEITEK 0x100e
19962 +#define PCI_DEVICE_ID_WEITEK_P9000 0x9001
19963 +#define PCI_DEVICE_ID_WEITEK_P9100 0x9100
19964 +
19965 +#define PCI_VENDOR_ID_DEC 0x1011
19966 +#define PCI_DEVICE_ID_DEC_BRD 0x0001
19967 +#define PCI_DEVICE_ID_DEC_TULIP 0x0002
19968 +#define PCI_DEVICE_ID_DEC_TGA 0x0004
19969 +#define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009
19970 +#define PCI_DEVICE_ID_DEC_TGA2 0x000D
19971 +#define PCI_DEVICE_ID_DEC_FDDI 0x000F
19972 +#define PCI_DEVICE_ID_DEC_TULIP_PLUS 0x0014
19973 +#define PCI_DEVICE_ID_DEC_21142 0x0019
19974 +#define PCI_DEVICE_ID_DEC_21052 0x0021
19975 +#define PCI_DEVICE_ID_DEC_21150 0x0022
19976 +#define PCI_DEVICE_ID_DEC_21152 0x0024
19977 +#define PCI_DEVICE_ID_DEC_21153 0x0025
19978 +#define PCI_DEVICE_ID_DEC_21154 0x0026
19979 +#define PCI_DEVICE_ID_DEC_21285 0x1065
19980 +#define PCI_DEVICE_ID_COMPAQ_42XX 0x0046
19981 +
19982 +#define PCI_VENDOR_ID_CIRRUS 0x1013
19983 +#define PCI_DEVICE_ID_CIRRUS_7548 0x0038
19984 +#define PCI_DEVICE_ID_CIRRUS_5430 0x00a0
19985 +#define PCI_DEVICE_ID_CIRRUS_5434_4 0x00a4
19986 +#define PCI_DEVICE_ID_CIRRUS_5434_8 0x00a8
19987 +#define PCI_DEVICE_ID_CIRRUS_5436 0x00ac
19988 +#define PCI_DEVICE_ID_CIRRUS_5446 0x00b8
19989 +#define PCI_DEVICE_ID_CIRRUS_5480 0x00bc
19990 +#define PCI_DEVICE_ID_CIRRUS_5462 0x00d0
19991 +#define PCI_DEVICE_ID_CIRRUS_5464 0x00d4
19992 +#define PCI_DEVICE_ID_CIRRUS_5465 0x00d6
19993 +#define PCI_DEVICE_ID_CIRRUS_6729 0x1100
19994 +#define PCI_DEVICE_ID_CIRRUS_6832 0x1110
19995 +#define PCI_DEVICE_ID_CIRRUS_7542 0x1200
19996 +#define PCI_DEVICE_ID_CIRRUS_7543 0x1202
19997 +#define PCI_DEVICE_ID_CIRRUS_7541 0x1204
19998 +
19999 +#define PCI_VENDOR_ID_IBM 0x1014
20000 +#define PCI_DEVICE_ID_IBM_FIRE_CORAL 0x000a
20001 +#define PCI_DEVICE_ID_IBM_TR 0x0018
20002 +#define PCI_DEVICE_ID_IBM_82G2675 0x001d
20003 +#define PCI_DEVICE_ID_IBM_MCA 0x0020
20004 +#define PCI_DEVICE_ID_IBM_82351 0x0022
20005 +#define PCI_DEVICE_ID_IBM_PYTHON 0x002d
20006 +#define PCI_DEVICE_ID_IBM_SERVERAID 0x002e
20007 +#define PCI_DEVICE_ID_IBM_TR_WAKE 0x003e
20008 +#define PCI_DEVICE_ID_IBM_MPIC 0x0046
20009 +#define PCI_DEVICE_ID_IBM_3780IDSP 0x007d
20010 +#define PCI_DEVICE_ID_IBM_CHUKAR 0x0096
20011 +#define PCI_DEVICE_ID_IBM_CPC710_PCI64 0x00fc
20012 +#define PCI_DEVICE_ID_IBM_CPC710_PCI32 0x0105
20013 +#define PCI_DEVICE_ID_IBM_405GP 0x0156
20014 +#define PCI_DEVICE_ID_IBM_SNIPE 0x0180
20015 +#define PCI_DEVICE_ID_IBM_SERVERAIDI960 0x01bd
20016 +#define PCI_DEVICE_ID_IBM_CITRINE 0x028C
20017 +#define PCI_DEVICE_ID_IBM_GEMSTONE 0xB166
20018 +#define PCI_DEVICE_ID_IBM_MPIC_2 0xffff
20019 +#define PCI_DEVICE_ID_IBM_ICOM_DEV_ID_1 0x0031
20020 +#define PCI_DEVICE_ID_IBM_ICOM_DEV_ID_2 0x0219
20021 +#define PCI_DEVICE_ID_IBM_ICOM_V2_TWO_PORTS_RVX 0x021A
20022 +#define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM 0x0251
20023 +#define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252
20024 +
20025 +#define PCI_VENDOR_ID_COMPEX2 0x101a // pci.ids says "AT&T GIS (NCR)"
20026 +#define PCI_DEVICE_ID_COMPEX2_100VG 0x0005
20027 +
20028 +#define PCI_VENDOR_ID_WD 0x101c
20029 +#define PCI_DEVICE_ID_WD_7197 0x3296
20030 +#define PCI_DEVICE_ID_WD_90C 0xc24a
20031 +
20032 +#define PCI_VENDOR_ID_AMI 0x101e
20033 +#define PCI_DEVICE_ID_AMI_MEGARAID3 0x1960
20034 +#define PCI_DEVICE_ID_AMI_MEGARAID 0x9010
20035 +#define PCI_DEVICE_ID_AMI_MEGARAID2 0x9060
20036 +
20037 +#define PCI_VENDOR_ID_AMD 0x1022
20038 +#define PCI_DEVICE_ID_AMD_LANCE 0x2000
20039 +#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
20040 +#define PCI_DEVICE_ID_AMD_SCSI 0x2020
20041 +#define PCI_DEVICE_ID_AMD_SERENADE 0x36c0
20042 +#define PCI_DEVICE_ID_AMD_FE_GATE_7006 0x7006
20043 +#define PCI_DEVICE_ID_AMD_FE_GATE_7007 0x7007
20044 +#define PCI_DEVICE_ID_AMD_FE_GATE_700C 0x700C
20045 +#define PCI_DEVICE_ID_AMD_FE_GATE_700D 0x700D
20046 +#define PCI_DEVICE_ID_AMD_FE_GATE_700E 0x700E
20047 +#define PCI_DEVICE_ID_AMD_FE_GATE_700F 0x700F
20048 +#define PCI_DEVICE_ID_AMD_COBRA_7400 0x7400
20049 +#define PCI_DEVICE_ID_AMD_COBRA_7401 0x7401
20050 +#define PCI_DEVICE_ID_AMD_COBRA_7403 0x7403
20051 +#define PCI_DEVICE_ID_AMD_COBRA_7404 0x7404
20052 +#define PCI_DEVICE_ID_AMD_VIPER_7408 0x7408
20053 +#define PCI_DEVICE_ID_AMD_VIPER_7409 0x7409
20054 +#define PCI_DEVICE_ID_AMD_VIPER_740B 0x740B
20055 +#define PCI_DEVICE_ID_AMD_VIPER_740C 0x740C
20056 +#define PCI_DEVICE_ID_AMD_VIPER_7410 0x7410
20057 +#define PCI_DEVICE_ID_AMD_VIPER_7411 0x7411
20058 +#define PCI_DEVICE_ID_AMD_VIPER_7413 0x7413
20059 +#define PCI_DEVICE_ID_AMD_VIPER_7414 0x7414
20060 +#define PCI_DEVICE_ID_AMD_OPUS_7440 0x7440
20061 +# define PCI_DEVICE_ID_AMD_VIPER_7440 PCI_DEVICE_ID_AMD_OPUS_7440
20062 +#define PCI_DEVICE_ID_AMD_OPUS_7441 0x7441
20063 +# define PCI_DEVICE_ID_AMD_VIPER_7441 PCI_DEVICE_ID_AMD_OPUS_7441
20064 +#define PCI_DEVICE_ID_AMD_OPUS_7443 0x7443
20065 +# define PCI_DEVICE_ID_AMD_VIPER_7443 PCI_DEVICE_ID_AMD_OPUS_7443
20066 +#define PCI_DEVICE_ID_AMD_OPUS_7445 0x7445
20067 +#define PCI_DEVICE_ID_AMD_OPUS_7448 0x7448
20068 +# define PCI_DEVICE_ID_AMD_VIPER_7448 PCI_DEVICE_ID_AMD_OPUS_7448
20069 +#define PCI_DEVICE_ID_AMD_OPUS_7449 0x7449
20070 +# define PCI_DEVICE_ID_AMD_VIPER_7449 PCI_DEVICE_ID_AMD_OPUS_7449
20071 +#define PCI_DEVICE_ID_AMD_8111_LAN 0x7462
20072 +#define PCI_DEVICE_ID_AMD_8111_LPC 0x7468
20073 +#define PCI_DEVICE_ID_AMD_8111_IDE 0x7469
20074 +#define PCI_DEVICE_ID_AMD_8111_SMBUS2 0x746a
20075 +#define PCI_DEVICE_ID_AMD_8111_SMBUS 0x746b
20076 +#define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d
20077 +#define PCI_DEVICE_ID_AMD_8151_0 0x7454
20078 +#define PCI_DEVICE_ID_AMD_8131_APIC 0x7450
20079 +
20080 +#define PCI_VENDOR_ID_TRIDENT 0x1023
20081 +#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
20082 +#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001
20083 +#define PCI_DEVICE_ID_TRIDENT_9320 0x9320
20084 +#define PCI_DEVICE_ID_TRIDENT_9388 0x9388
20085 +#define PCI_DEVICE_ID_TRIDENT_9397 0x9397
20086 +#define PCI_DEVICE_ID_TRIDENT_939A 0x939A
20087 +#define PCI_DEVICE_ID_TRIDENT_9520 0x9520
20088 +#define PCI_DEVICE_ID_TRIDENT_9525 0x9525
20089 +#define PCI_DEVICE_ID_TRIDENT_9420 0x9420
20090 +#define PCI_DEVICE_ID_TRIDENT_9440 0x9440
20091 +#define PCI_DEVICE_ID_TRIDENT_9660 0x9660
20092 +#define PCI_DEVICE_ID_TRIDENT_9750 0x9750
20093 +#define PCI_DEVICE_ID_TRIDENT_9850 0x9850
20094 +#define PCI_DEVICE_ID_TRIDENT_9880 0x9880
20095 +#define PCI_DEVICE_ID_TRIDENT_8400 0x8400
20096 +#define PCI_DEVICE_ID_TRIDENT_8420 0x8420
20097 +#define PCI_DEVICE_ID_TRIDENT_8500 0x8500
20098 +
20099 +#define PCI_VENDOR_ID_AI 0x1025
20100 +#define PCI_DEVICE_ID_AI_M1435 0x1435
20101 +
20102 +#define PCI_VENDOR_ID_DELL 0x1028
20103 +#define PCI_DEVICE_ID_DELL_RACIII 0x0008
20104 +#define PCI_DEVICE_ID_DELL_RAC4 0x0012
20105 +
20106 +#define PCI_VENDOR_ID_MATROX 0x102B
20107 +#define PCI_DEVICE_ID_MATROX_MGA_2 0x0518
20108 +#define PCI_DEVICE_ID_MATROX_MIL 0x0519
20109 +#define PCI_DEVICE_ID_MATROX_MYS 0x051A
20110 +#define PCI_DEVICE_ID_MATROX_MIL_2 0x051b
20111 +#define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f
20112 +#define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10
20113 +#define PCI_DEVICE_ID_MATROX_G100_MM 0x1000
20114 +#define PCI_DEVICE_ID_MATROX_G100_AGP 0x1001
20115 +#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520
20116 +#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521
20117 +#define PCI_DEVICE_ID_MATROX_G400 0x0525
20118 +#define PCI_DEVICE_ID_MATROX_G550 0x2527
20119 +#define PCI_DEVICE_ID_MATROX_VIA 0x4536
20120 +
20121 +#define PCI_VENDOR_ID_CT 0x102c
20122 +#define PCI_DEVICE_ID_CT_69000 0x00c0
20123 +#define PCI_DEVICE_ID_CT_65545 0x00d8
20124 +#define PCI_DEVICE_ID_CT_65548 0x00dc
20125 +#define PCI_DEVICE_ID_CT_65550 0x00e0
20126 +#define PCI_DEVICE_ID_CT_65554 0x00e4
20127 +#define PCI_DEVICE_ID_CT_65555 0x00e5
20128 +
20129 +#define PCI_VENDOR_ID_MIRO 0x1031
20130 +#define PCI_DEVICE_ID_MIRO_36050 0x5601
20131 +#define PCI_DEVICE_ID_MIRO_DC10PLUS 0x7efe
20132 +#define PCI_DEVICE_ID_MIRO_DC30PLUS 0xd801
20133 +
20134 +#define PCI_VENDOR_ID_NEC 0x1033
20135 +#define PCI_DEVICE_ID_NEC_CBUS_1 0x0001 /* PCI-Cbus Bridge */
20136 +#define PCI_DEVICE_ID_NEC_LOCAL 0x0002 /* Local Bridge */
20137 +#define PCI_DEVICE_ID_NEC_ATM 0x0003 /* ATM LAN Controller */
20138 +#define PCI_DEVICE_ID_NEC_R4000 0x0004 /* R4000 Bridge */
20139 +#define PCI_DEVICE_ID_NEC_486 0x0005 /* 486 Like Peripheral Bus Bridge */
20140 +#define PCI_DEVICE_ID_NEC_ACCEL_1 0x0006 /* Graphic Accelerator */
20141 +#define PCI_DEVICE_ID_NEC_UXBUS 0x0007 /* UX-Bus Bridge */
20142 +#define PCI_DEVICE_ID_NEC_ACCEL_2 0x0008 /* Graphic Accelerator */
20143 +#define PCI_DEVICE_ID_NEC_GRAPH 0x0009 /* PCI-CoreGraph Bridge */
20144 +#define PCI_DEVICE_ID_NEC_VL 0x0016 /* PCI-VL Bridge */
20145 +#define PCI_DEVICE_ID_NEC_STARALPHA2 0x002c /* STAR ALPHA2 */
20146 +#define PCI_DEVICE_ID_NEC_CBUS_2 0x002d /* PCI-Cbus Bridge */
20147 +#define PCI_DEVICE_ID_NEC_USB 0x0035 /* PCI-USB Host */
20148 +#define PCI_DEVICE_ID_NEC_CBUS_3 0x003b
20149 +#define PCI_DEVICE_ID_NEC_NAPCCARD 0x003e
20150 +#define PCI_DEVICE_ID_NEC_PCX2 0x0046 /* PowerVR */
20151 +#define PCI_DEVICE_ID_NEC_NILE4 0x005a
20152 +#define PCI_DEVICE_ID_NEC_VRC5476 0x009b
20153 +#define PCI_DEVICE_ID_NEC_VRC4173 0x00a5
20154 +#define PCI_DEVICE_ID_NEC_VRC5477_AC97 0x00a6
20155 +#define PCI_DEVICE_ID_NEC_PC9821CS01 0x800c /* PC-9821-CS01 */
20156 +#define PCI_DEVICE_ID_NEC_PC9821NRB06 0x800d /* PC-9821NR-B06 */
20157 +
20158 +#define PCI_VENDOR_ID_FD 0x1036
20159 +#define PCI_DEVICE_ID_FD_36C70 0x0000
20160 +
20161 +#define PCI_VENDOR_ID_SI 0x1039
20162 +#define PCI_DEVICE_ID_SI_5591_AGP 0x0001
20163 +#define PCI_DEVICE_ID_SI_6202 0x0002
20164 +#define PCI_DEVICE_ID_SI_503 0x0008
20165 +#define PCI_DEVICE_ID_SI_ACPI 0x0009
20166 +#define PCI_DEVICE_ID_SI_SMBUS 0x0016
20167 +#define PCI_DEVICE_ID_SI_LPC 0x0018
20168 +#define PCI_DEVICE_ID_SI_5597_VGA 0x0200
20169 +#define PCI_DEVICE_ID_SI_6205 0x0205
20170 +#define PCI_DEVICE_ID_SI_501 0x0406
20171 +#define PCI_DEVICE_ID_SI_496 0x0496
20172 +#define PCI_DEVICE_ID_SI_300 0x0300
20173 +#define PCI_DEVICE_ID_SI_315H 0x0310
20174 +#define PCI_DEVICE_ID_SI_315 0x0315
20175 +#define PCI_DEVICE_ID_SI_315PRO 0x0325
20176 +#define PCI_DEVICE_ID_SI_530 0x0530
20177 +#define PCI_DEVICE_ID_SI_540 0x0540
20178 +#define PCI_DEVICE_ID_SI_550 0x0550
20179 +#define PCI_DEVICE_ID_SI_540_VGA 0x5300
20180 +#define PCI_DEVICE_ID_SI_550_VGA 0x5315
20181 +#define PCI_DEVICE_ID_SI_601 0x0601
20182 +#define PCI_DEVICE_ID_SI_620 0x0620
20183 +#define PCI_DEVICE_ID_SI_630 0x0630
20184 +#define PCI_DEVICE_ID_SI_633 0x0633
20185 +#define PCI_DEVICE_ID_SI_635 0x0635
20186 +#define PCI_DEVICE_ID_SI_640 0x0640
20187 +#define PCI_DEVICE_ID_SI_645 0x0645
20188 +#define PCI_DEVICE_ID_SI_646 0x0646
20189 +#define PCI_DEVICE_ID_SI_648 0x0648
20190 +#define PCI_DEVICE_ID_SI_650 0x0650
20191 +#define PCI_DEVICE_ID_SI_651 0x0651
20192 +#define PCI_DEVICE_ID_SI_652 0x0652
20193 +#define PCI_DEVICE_ID_SI_655 0x0655
20194 +#define PCI_DEVICE_ID_SI_661 0x0661
20195 +#define PCI_DEVICE_ID_SI_730 0x0730
20196 +#define PCI_DEVICE_ID_SI_733 0x0733
20197 +#define PCI_DEVICE_ID_SI_630_VGA 0x6300
20198 +#define PCI_DEVICE_ID_SI_730_VGA 0x7300
20199 +#define PCI_DEVICE_ID_SI_735 0x0735
20200 +#define PCI_DEVICE_ID_SI_740 0x0740
20201 +#define PCI_DEVICE_ID_SI_741 0x0741
20202 +#define PCI_DEVICE_ID_SI_745 0x0745
20203 +#define PCI_DEVICE_ID_SI_746 0x0746
20204 +#define PCI_DEVICE_ID_SI_748 0x0748
20205 +#define PCI_DEVICE_ID_SI_750 0x0750
20206 +#define PCI_DEVICE_ID_SI_751 0x0751
20207 +#define PCI_DEVICE_ID_SI_752 0x0752
20208 +#define PCI_DEVICE_ID_SI_755 0x0755
20209 +#define PCI_DEVICE_ID_SI_760 0x0760
20210 +#define PCI_DEVICE_ID_SI_900 0x0900
20211 +#define PCI_DEVICE_ID_SI_961 0x0961
20212 +#define PCI_DEVICE_ID_SI_962 0x0962
20213 +#define PCI_DEVICE_ID_SI_963 0x0963
20214 +#define PCI_DEVICE_ID_SI_5107 0x5107
20215 +#define PCI_DEVICE_ID_SI_5300 0x5300
20216 +#define PCI_DEVICE_ID_SI_5511 0x5511
20217 +#define PCI_DEVICE_ID_SI_5513 0x5513
20218 +#define PCI_DEVICE_ID_SI_5518 0x5518
20219 +#define PCI_DEVICE_ID_SI_5571 0x5571
20220 +#define PCI_DEVICE_ID_SI_5581 0x5581
20221 +#define PCI_DEVICE_ID_SI_5582 0x5582
20222 +#define PCI_DEVICE_ID_SI_5591 0x5591
20223 +#define PCI_DEVICE_ID_SI_5596 0x5596
20224 +#define PCI_DEVICE_ID_SI_5597 0x5597
20225 +#define PCI_DEVICE_ID_SI_5598 0x5598
20226 +#define PCI_DEVICE_ID_SI_5600 0x5600
20227 +#define PCI_DEVICE_ID_SI_6300 0x6300
20228 +#define PCI_DEVICE_ID_SI_6306 0x6306
20229 +#define PCI_DEVICE_ID_SI_6326 0x6326
20230 +#define PCI_DEVICE_ID_SI_7001 0x7001
20231 +#define PCI_DEVICE_ID_SI_7012 0x7012
20232 +#define PCI_DEVICE_ID_SI_7016 0x7016
20233 +
20234 +#define PCI_VENDOR_ID_HP 0x103c
20235 +#define PCI_DEVICE_ID_HP_VISUALIZE_EG 0x1005
20236 +#define PCI_DEVICE_ID_HP_VISUALIZE_FX6 0x1006
20237 +#define PCI_DEVICE_ID_HP_VISUALIZE_FX4 0x1008
20238 +#define PCI_DEVICE_ID_HP_VISUALIZE_FX2 0x100a
20239 +#define PCI_DEVICE_ID_HP_TACHYON 0x1028
20240 +#define PCI_DEVICE_ID_HP_TACHLITE 0x1029
20241 +#define PCI_DEVICE_ID_HP_J2585A 0x1030
20242 +#define PCI_DEVICE_ID_HP_J2585B 0x1031
20243 +#define PCI_DEVICE_ID_HP_J2973A 0x1040
20244 +#define PCI_DEVICE_ID_HP_J2970A 0x1042
20245 +#define PCI_DEVICE_ID_HP_DIVA 0x1048
20246 +#define PCI_DEVICE_ID_HP_DIVA_TOSCA1 0x1049
20247 +#define PCI_DEVICE_ID_HP_DIVA_TOSCA2 0x104A
20248 +#define PCI_DEVICE_ID_HP_DIVA_MAESTRO 0x104B
20249 +#define PCI_DEVICE_ID_HP_PCI_LBA 0x1054
20250 +#define PCI_DEVICE_ID_HP_REO_SBA 0x10f0
20251 +#define PCI_DEVICE_ID_HP_REO_IOC 0x10f1
20252 +#define PCI_DEVICE_ID_HP_VISUALIZE_FXE 0x108b
20253 +#define PCI_DEVICE_ID_HP_DIVA_HALFDOME 0x1223
20254 +#define PCI_DEVICE_ID_HP_DIVA_KEYSTONE 0x1226
20255 +#define PCI_DEVICE_ID_HP_DIVA_POWERBAR 0x1227
20256 +#define PCI_DEVICE_ID_HP_ZX1_SBA 0x1229
20257 +#define PCI_DEVICE_ID_HP_ZX1_IOC 0x122a
20258 +#define PCI_DEVICE_ID_HP_PCIX_LBA 0x122e
20259 +#define PCI_DEVICE_ID_HP_SX1000_IOC 0x127c
20260 +#define PCI_DEVICE_ID_HP_DIVA_EVEREST 0x1282
20261 +#define PCI_DEVICE_ID_HP_DIVA_AUX 0x1290
20262 +#define PCI_DEVICE_ID_HP_DIVA_RMP3 0x1301
20263 +#define PCI_DEVICE_ID_HP_CISSA 0x3220
20264 +#define PCI_DEVICE_ID_HP_CISSB 0x3230
20265 +#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031
20266 +
20267 +#define PCI_VENDOR_ID_PCTECH 0x1042
20268 +#define PCI_DEVICE_ID_PCTECH_RZ1000 0x1000
20269 +#define PCI_DEVICE_ID_PCTECH_RZ1001 0x1001
20270 +#define PCI_DEVICE_ID_PCTECH_SAMURAI_0 0x3000
20271 +#define PCI_DEVICE_ID_PCTECH_SAMURAI_1 0x3010
20272 +#define PCI_DEVICE_ID_PCTECH_SAMURAI_IDE 0x3020
20273 +
20274 +#define PCI_VENDOR_ID_ASUSTEK 0x1043
20275 +#define PCI_DEVICE_ID_ASUSTEK_0675 0x0675
20276 +
20277 +#define PCI_VENDOR_ID_DPT 0x1044
20278 +#define PCI_DEVICE_ID_DPT 0xa400
20279 +
20280 +#define PCI_VENDOR_ID_OPTI 0x1045
20281 +#define PCI_DEVICE_ID_OPTI_92C178 0xc178
20282 +#define PCI_DEVICE_ID_OPTI_82C557 0xc557
20283 +#define PCI_DEVICE_ID_OPTI_82C558 0xc558
20284 +#define PCI_DEVICE_ID_OPTI_82C621 0xc621
20285 +#define PCI_DEVICE_ID_OPTI_82C700 0xc700
20286 +#define PCI_DEVICE_ID_OPTI_82C701 0xc701
20287 +#define PCI_DEVICE_ID_OPTI_82C814 0xc814
20288 +#define PCI_DEVICE_ID_OPTI_82C822 0xc822
20289 +#define PCI_DEVICE_ID_OPTI_82C861 0xc861
20290 +#define PCI_DEVICE_ID_OPTI_82C825 0xd568
20291 +
20292 +#define PCI_VENDOR_ID_ELSA 0x1048
20293 +#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000
20294 +#define PCI_DEVICE_ID_ELSA_QS3000 0x3000
20295 +
20296 +#define PCI_VENDOR_ID_SGS 0x104a
20297 +#define PCI_DEVICE_ID_SGS_2000 0x0008
20298 +#define PCI_DEVICE_ID_SGS_1764 0x0009
20299 +
20300 +#define PCI_VENDOR_ID_BUSLOGIC 0x104B
20301 +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140
20302 +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040
20303 +#define PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT 0x8130
20304 +
20305 +#define PCI_VENDOR_ID_TI 0x104c
20306 +#define PCI_DEVICE_ID_TI_TVP4010 0x3d04
20307 +#define PCI_DEVICE_ID_TI_TVP4020 0x3d07
20308 +#define PCI_DEVICE_ID_TI_4450 0x8011
20309 +#define PCI_DEVICE_ID_TI_1130 0xac12
20310 +#define PCI_DEVICE_ID_TI_1031 0xac13
20311 +#define PCI_DEVICE_ID_TI_1131 0xac15
20312 +#define PCI_DEVICE_ID_TI_1250 0xac16
20313 +#define PCI_DEVICE_ID_TI_1220 0xac17
20314 +#define PCI_DEVICE_ID_TI_1221 0xac19
20315 +#define PCI_DEVICE_ID_TI_1210 0xac1a
20316 +#define PCI_DEVICE_ID_TI_1450 0xac1b
20317 +#define PCI_DEVICE_ID_TI_1225 0xac1c
20318 +#define PCI_DEVICE_ID_TI_1251A 0xac1d
20319 +#define PCI_DEVICE_ID_TI_1211 0xac1e
20320 +#define PCI_DEVICE_ID_TI_1251B 0xac1f
20321 +#define PCI_DEVICE_ID_TI_4410 0xac41
20322 +#define PCI_DEVICE_ID_TI_4451 0xac42
20323 +#define PCI_DEVICE_ID_TI_4510 0xac44
20324 +#define PCI_DEVICE_ID_TI_4520 0xac46
20325 +#define PCI_DEVICE_ID_TI_1410 0xac50
20326 +#define PCI_DEVICE_ID_TI_1420 0xac51
20327 +#define PCI_DEVICE_ID_TI_1451A 0xac52
20328 +#define PCI_DEVICE_ID_TI_1620 0xac54
20329 +#define PCI_DEVICE_ID_TI_1520 0xac55
20330 +#define PCI_DEVICE_ID_TI_1510 0xac56
20331 +
20332 +#define PCI_VENDOR_ID_SONY 0x104d
20333 +#define PCI_DEVICE_ID_SONY_CXD3222 0x8039
20334 +
20335 +#define PCI_VENDOR_ID_OAK 0x104e
20336 +#define PCI_DEVICE_ID_OAK_OTI107 0x0107
20337 +
20338 +/* Winbond have two vendor IDs! See 0x10ad as well */
20339 +#define PCI_VENDOR_ID_WINBOND2 0x1050
20340 +#define PCI_DEVICE_ID_WINBOND2_89C940 0x0940
20341 +#define PCI_DEVICE_ID_WINBOND2_89C940F 0x5a5a
20342 +#define PCI_DEVICE_ID_WINBOND2_6692 0x6692
20343 +
20344 +#define PCI_VENDOR_ID_ANIGMA 0x1051
20345 +#define PCI_DEVICE_ID_ANIGMA_MC145575 0x0100
20346 +
20347 +#define PCI_VENDOR_ID_EFAR 0x1055
20348 +#define PCI_DEVICE_ID_EFAR_SLC90E66_1 0x9130
20349 +#define PCI_DEVICE_ID_EFAR_SLC90E66_0 0x9460
20350 +#define PCI_DEVICE_ID_EFAR_SLC90E66_2 0x9462
20351 +#define PCI_DEVICE_ID_EFAR_SLC90E66_3 0x9463
20352 +
20353 +#define PCI_VENDOR_ID_MOTOROLA 0x1057
20354 +#define PCI_VENDOR_ID_MOTOROLA_OOPS 0x1507
20355 +#define PCI_DEVICE_ID_MOTOROLA_MPC105 0x0001
20356 +#define PCI_DEVICE_ID_MOTOROLA_MPC106 0x0002
20357 +#define PCI_DEVICE_ID_MOTOROLA_MPC107 0x0004
20358 +#define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801
20359 +#define PCI_DEVICE_ID_MOTOROLA_FALCON 0x4802
20360 +#define PCI_DEVICE_ID_MOTOROLA_HAWK 0x4803
20361 +#define PCI_DEVICE_ID_MOTOROLA_CPX8216 0x4806
20362 +#define PCI_DEVICE_ID_MOTOROLA_HARRIER 0x480b
20363 +#define PCI_DEVICE_ID_MOTOROLA_MPC5200 0x5803
20364 +
20365 +#define PCI_VENDOR_ID_PROMISE 0x105a
20366 +#define PCI_DEVICE_ID_PROMISE_20265 0x0d30
20367 +#define PCI_DEVICE_ID_PROMISE_20267 0x4d30
20368 +#define PCI_DEVICE_ID_PROMISE_20246 0x4d33
20369 +#define PCI_DEVICE_ID_PROMISE_20262 0x4d38
20370 +#define PCI_DEVICE_ID_PROMISE_20263 0x0D38
20371 +#define PCI_DEVICE_ID_PROMISE_20268 0x4d68
20372 +#define PCI_DEVICE_ID_PROMISE_20268R 0x6268
20373 +#define PCI_DEVICE_ID_PROMISE_20269 0x4d69
20374 +#define PCI_DEVICE_ID_PROMISE_20270 0x6268
20375 +#define PCI_DEVICE_ID_PROMISE_20271 0x6269
20376 +#define PCI_DEVICE_ID_PROMISE_20275 0x1275
20377 +#define PCI_DEVICE_ID_PROMISE_20276 0x5275
20378 +#define PCI_DEVICE_ID_PROMISE_20277 0x7275
20379 +#define PCI_DEVICE_ID_PROMISE_5300 0x5300
20380 +
20381 +#define PCI_VENDOR_ID_N9 0x105d
20382 +#define PCI_DEVICE_ID_N9_I128 0x2309
20383 +#define PCI_DEVICE_ID_N9_I128_2 0x2339
20384 +#define PCI_DEVICE_ID_N9_I128_T2R 0x493d
20385 +
20386 +#define PCI_VENDOR_ID_UMC 0x1060
20387 +#define PCI_DEVICE_ID_UMC_UM8673F 0x0101
20388 +#define PCI_DEVICE_ID_UMC_UM8891A 0x0891
20389 +#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a
20390 +#define PCI_DEVICE_ID_UMC_UM8886A 0x886a
20391 +#define PCI_DEVICE_ID_UMC_UM8881F 0x8881
20392 +#define PCI_DEVICE_ID_UMC_UM8886F 0x8886
20393 +#define PCI_DEVICE_ID_UMC_UM9017F 0x9017
20394 +#define PCI_DEVICE_ID_UMC_UM8886N 0xe886
20395 +#define PCI_DEVICE_ID_UMC_UM8891N 0xe891
20396 +
20397 +#define PCI_VENDOR_ID_X 0x1061
20398 +#define PCI_DEVICE_ID_X_AGX016 0x0001
20399 +
20400 +#define PCI_VENDOR_ID_MYLEX 0x1069
20401 +#define PCI_DEVICE_ID_MYLEX_DAC960_P 0x0001
20402 +#define PCI_DEVICE_ID_MYLEX_DAC960_PD 0x0002
20403 +#define PCI_DEVICE_ID_MYLEX_DAC960_PG 0x0010
20404 +#define PCI_DEVICE_ID_MYLEX_DAC960_LA 0x0020
20405 +#define PCI_DEVICE_ID_MYLEX_DAC960_LP 0x0050
20406 +#define PCI_DEVICE_ID_MYLEX_DAC960_BA 0xBA56
20407 +#define PCI_DEVICE_ID_MYLEX_DAC960_GEM 0xB166
20408 +
20409 +#define PCI_VENDOR_ID_PICOP 0x1066
20410 +#define PCI_DEVICE_ID_PICOP_PT86C52X 0x0001
20411 +#define PCI_DEVICE_ID_PICOP_PT80C524 0x8002
20412 +
20413 +#define PCI_VENDOR_ID_APPLE 0x106b
20414 +#define PCI_DEVICE_ID_APPLE_BANDIT 0x0001
20415 +#define PCI_DEVICE_ID_APPLE_GC 0x0002
20416 +#define PCI_DEVICE_ID_APPLE_HYDRA 0x000e
20417 +#define PCI_DEVICE_ID_APPLE_UNI_N_FW 0x0018
20418 +#define PCI_DEVICE_ID_APPLE_KL_USB 0x0019
20419 +#define PCI_DEVICE_ID_APPLE_UNI_N_AGP 0x0020
20420 +#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC 0x0021
20421 +#define PCI_DEVICE_ID_APPLE_KEYLARGO 0x0022
20422 +#define PCI_DEVICE_ID_APPLE_UNI_N_GMACP 0x0024
20423 +#define PCI_DEVICE_ID_APPLE_KEYLARGO_P 0x0025
20424 +#define PCI_DEVICE_ID_APPLE_KL_USB_P 0x0026
20425 +#define PCI_DEVICE_ID_APPLE_UNI_N_AGP_P 0x0027
20426 +#define PCI_DEVICE_ID_APPLE_UNI_N_AGP15 0x002d
20427 +#define PCI_DEVICE_ID_APPLE_UNI_N_PCI15 0x002e
20428 +#define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030
20429 +#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032
20430 +#define PCI_DEVIEC_ID_APPLE_UNI_N_ATA 0x0033
20431 +#define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034
20432 +#define PCI_DEVICE_ID_APPLE_IPID_ATA100 0x003b
20433 +#define PCI_DEVICE_ID_APPLE_KEYLARGO_I 0x003e
20434 +#define PCI_DEVICE_ID_APPLE_K2_ATA100 0x0043
20435 +#define PCI_DEVICE_ID_APPLE_U3_AGP 0x004b
20436 +#define PCI_DEVICE_ID_APPLE_K2_GMAC 0x004c
20437 +#define PCI_DEVICE_ID_APPLE_SH_ATA 0x0050
20438 +#define PCI_DEVICE_ID_APPLE_SH_SUNGEM 0x0051
20439 +#define PCI_DEVICE_ID_APPLE_SH_FW 0x0052
20440 +#define PCI_DEVICE_ID_APPLE_U3L_AGP 0x0058
20441 +#define PCI_DEVICE_ID_APPLE_U3H_AGP 0x0059
20442 +#define PCI_DEVICE_ID_APPLE_TIGON3 0x1645
20443 +
20444 +#define PCI_VENDOR_ID_YAMAHA 0x1073
20445 +#define PCI_DEVICE_ID_YAMAHA_724 0x0004
20446 +#define PCI_DEVICE_ID_YAMAHA_724F 0x000d
20447 +#define PCI_DEVICE_ID_YAMAHA_740 0x000a
20448 +#define PCI_DEVICE_ID_YAMAHA_740C 0x000c
20449 +#define PCI_DEVICE_ID_YAMAHA_744 0x0010
20450 +#define PCI_DEVICE_ID_YAMAHA_754 0x0012
20451 +
20452 +#define PCI_VENDOR_ID_NEXGEN 0x1074
20453 +#define PCI_DEVICE_ID_NEXGEN_82C501 0x4e78
20454 +
20455 +#define PCI_VENDOR_ID_QLOGIC 0x1077
20456 +#define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020
20457 +#define PCI_DEVICE_ID_QLOGIC_ISP1022 0x1022
20458 +#define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100
20459 +#define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200
20460 +
20461 +#define PCI_VENDOR_ID_CYRIX 0x1078
20462 +#define PCI_DEVICE_ID_CYRIX_5510 0x0000
20463 +#define PCI_DEVICE_ID_CYRIX_PCI_MASTER 0x0001
20464 +#define PCI_DEVICE_ID_CYRIX_5520 0x0002
20465 +#define PCI_DEVICE_ID_CYRIX_5530_LEGACY 0x0100
20466 +#define PCI_DEVICE_ID_CYRIX_5530_SMI 0x0101
20467 +#define PCI_DEVICE_ID_CYRIX_5530_IDE 0x0102
20468 +#define PCI_DEVICE_ID_CYRIX_5530_AUDIO 0x0103
20469 +#define PCI_DEVICE_ID_CYRIX_5530_VIDEO 0x0104
20470 +
20471 +#define PCI_VENDOR_ID_LEADTEK 0x107d
20472 +#define PCI_DEVICE_ID_LEADTEK_805 0x0000
20473 +
20474 +#define PCI_VENDOR_ID_INTERPHASE 0x107e
20475 +#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004
20476 +#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005
20477 +#define PCI_DEVICE_ID_INTERPHASE_5575 0x0008
20478 +
20479 +#define PCI_VENDOR_ID_CONTAQ 0x1080
20480 +#define PCI_DEVICE_ID_CONTAQ_82C599 0x0600
20481 +#define PCI_DEVICE_ID_CONTAQ_82C693 0xc693
20482 +
20483 +#define PCI_VENDOR_ID_FOREX 0x1083
20484 +
20485 +#define PCI_VENDOR_ID_OLICOM 0x108d
20486 +#define PCI_DEVICE_ID_OLICOM_OC3136 0x0001
20487 +#define PCI_DEVICE_ID_OLICOM_OC2315 0x0011
20488 +#define PCI_DEVICE_ID_OLICOM_OC2325 0x0012
20489 +#define PCI_DEVICE_ID_OLICOM_OC2183 0x0013
20490 +#define PCI_DEVICE_ID_OLICOM_OC2326 0x0014
20491 +#define PCI_DEVICE_ID_OLICOM_OC6151 0x0021
20492 +
20493 +#define PCI_VENDOR_ID_SUN 0x108e
20494 +#define PCI_DEVICE_ID_SUN_EBUS 0x1000
20495 +#define PCI_DEVICE_ID_SUN_HAPPYMEAL 0x1001
20496 +#define PCI_DEVICE_ID_SUN_RIO_EBUS 0x1100
20497 +#define PCI_DEVICE_ID_SUN_RIO_GEM 0x1101
20498 +#define PCI_DEVICE_ID_SUN_RIO_1394 0x1102
20499 +#define PCI_DEVICE_ID_SUN_RIO_USB 0x1103
20500 +#define PCI_DEVICE_ID_SUN_GEM 0x2bad
20501 +#define PCI_DEVICE_ID_SUN_SIMBA 0x5000
20502 +#define PCI_DEVICE_ID_SUN_PBM 0x8000
20503 +#define PCI_DEVICE_ID_SUN_SCHIZO 0x8001
20504 +#define PCI_DEVICE_ID_SUN_SABRE 0xa000
20505 +#define PCI_DEVICE_ID_SUN_HUMMINGBIRD 0xa001
20506 +#define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801
20507 +
20508 +#define PCI_VENDOR_ID_CMD 0x1095
20509 +#define PCI_DEVICE_ID_CMD_640 0x0640
20510 +#define PCI_DEVICE_ID_CMD_643 0x0643
20511 +#define PCI_DEVICE_ID_CMD_646 0x0646
20512 +#define PCI_DEVICE_ID_CMD_647 0x0647
20513 +#define PCI_DEVICE_ID_CMD_648 0x0648
20514 +#define PCI_DEVICE_ID_CMD_649 0x0649
20515 +#define PCI_DEVICE_ID_CMD_670 0x0670
20516 +#define PCI_DEVICE_ID_CMD_680 0x0680
20517 +
20518 +#define PCI_DEVICE_ID_SII_680 0x0680
20519 +#define PCI_DEVICE_ID_SII_3112 0x3112
20520 +#define PCI_DEVICE_ID_SII_1210SA 0x0240
20521 +
20522 +#define PCI_VENDOR_ID_VISION 0x1098
20523 +#define PCI_DEVICE_ID_VISION_QD8500 0x0001
20524 +#define PCI_DEVICE_ID_VISION_QD8580 0x0002
20525 +
20526 +#define PCI_VENDOR_ID_BROOKTREE 0x109e
20527 +#define PCI_DEVICE_ID_BROOKTREE_848 0x0350
20528 +#define PCI_DEVICE_ID_BROOKTREE_849A 0x0351
20529 +#define PCI_DEVICE_ID_BROOKTREE_878_1 0x036e
20530 +#define PCI_DEVICE_ID_BROOKTREE_878 0x0878
20531 +#define PCI_DEVICE_ID_BROOKTREE_8474 0x8474
20532 +
20533 +#define PCI_VENDOR_ID_SIERRA 0x10a8
20534 +#define PCI_DEVICE_ID_SIERRA_STB 0x0000
20535 +
20536 +#define PCI_VENDOR_ID_SGI 0x10a9
20537 +#define PCI_DEVICE_ID_SGI_IOC3 0x0003
20538 +#define PCI_DEVICE_ID_SGI_IOC4 0x100a
20539 +#define PCI_VENDOR_ID_SGI_LITHIUM 0x1002
20540 +
20541 +#define PCI_VENDOR_ID_ACC 0x10aa
20542 +#define PCI_DEVICE_ID_ACC_2056 0x0000
20543 +
20544 +#define PCI_VENDOR_ID_WINBOND 0x10ad
20545 +#define PCI_DEVICE_ID_WINBOND_83769 0x0001
20546 +#define PCI_DEVICE_ID_WINBOND_82C105 0x0105
20547 +#define PCI_DEVICE_ID_WINBOND_83C553 0x0565
20548 +
20549 +#define PCI_VENDOR_ID_DATABOOK 0x10b3
20550 +#define PCI_DEVICE_ID_DATABOOK_87144 0xb106
20551 +
20552 +#define PCI_VENDOR_ID_PLX 0x10b5
20553 +#define PCI_DEVICE_ID_PLX_R685 0x1030
20554 +#define PCI_DEVICE_ID_PLX_ROMULUS 0x106a
20555 +#define PCI_DEVICE_ID_PLX_SPCOM800 0x1076
20556 +#define PCI_DEVICE_ID_PLX_1077 0x1077
20557 +#define PCI_DEVICE_ID_PLX_SPCOM200 0x1103
20558 +#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151
20559 +#define PCI_DEVICE_ID_PLX_R753 0x1152
20560 +#define PCI_DEVICE_ID_PLX_9030 0x9030
20561 +#define PCI_DEVICE_ID_PLX_9050 0x9050
20562 +#define PCI_DEVICE_ID_PLX_9060 0x9060
20563 +#define PCI_DEVICE_ID_PLX_9060ES 0x906E
20564 +#define PCI_DEVICE_ID_PLX_9060SD 0x906D
20565 +#define PCI_DEVICE_ID_PLX_9080 0x9080
20566 +#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001
20567 +
20568 +#define PCI_VENDOR_ID_MADGE 0x10b6
20569 +#define PCI_DEVICE_ID_MADGE_MK2 0x0002
20570 +#define PCI_DEVICE_ID_MADGE_C155S 0x1001
20571 +
20572 +#define PCI_VENDOR_ID_3COM 0x10b7
20573 +#define PCI_DEVICE_ID_3COM_3C985 0x0001
20574 +#define PCI_DEVICE_ID_3COM_3C940 0x1700
20575 +#define PCI_DEVICE_ID_3COM_3C339 0x3390
20576 +#define PCI_DEVICE_ID_3COM_3C359 0x3590
20577 +#define PCI_DEVICE_ID_3COM_3C590 0x5900
20578 +#define PCI_DEVICE_ID_3COM_3C595TX 0x5950
20579 +#define PCI_DEVICE_ID_3COM_3C595T4 0x5951
20580 +#define PCI_DEVICE_ID_3COM_3C595MII 0x5952
20581 +#define PCI_DEVICE_ID_3COM_3C940B 0x80eb
20582 +#define PCI_DEVICE_ID_3COM_3C900TPO 0x9000
20583 +#define PCI_DEVICE_ID_3COM_3C900COMBO 0x9001
20584 +#define PCI_DEVICE_ID_3COM_3C905TX 0x9050
20585 +#define PCI_DEVICE_ID_3COM_3C905T4 0x9051
20586 +#define PCI_DEVICE_ID_3COM_3C905B_TX 0x9055
20587 +#define PCI_DEVICE_ID_3COM_3CR990 0x9900
20588 +#define PCI_DEVICE_ID_3COM_3CR990_TX_95 0x9902
20589 +#define PCI_DEVICE_ID_3COM_3CR990_TX_97 0x9903
20590 +#define PCI_DEVICE_ID_3COM_3CR990B 0x9904
20591 +#define PCI_DEVICE_ID_3COM_3CR990_FX 0x9905
20592 +#define PCI_DEVICE_ID_3COM_3CR990SVR95 0x9908
20593 +#define PCI_DEVICE_ID_3COM_3CR990SVR97 0x9909
20594 +#define PCI_DEVICE_ID_3COM_3CR990SVR 0x990a
20595 +
20596 +#define PCI_VENDOR_ID_SMC 0x10b8
20597 +#define PCI_DEVICE_ID_SMC_EPIC100 0x0005
20598 +
20599 +#define PCI_VENDOR_ID_AL 0x10b9
20600 +#define PCI_DEVICE_ID_AL_M1445 0x1445
20601 +#define PCI_DEVICE_ID_AL_M1449 0x1449
20602 +#define PCI_DEVICE_ID_AL_M1451 0x1451
20603 +#define PCI_DEVICE_ID_AL_M1461 0x1461
20604 +#define PCI_DEVICE_ID_AL_M1489 0x1489
20605 +#define PCI_DEVICE_ID_AL_M1511 0x1511
20606 +#define PCI_DEVICE_ID_AL_M1513 0x1513
20607 +#define PCI_DEVICE_ID_AL_M1521 0x1521
20608 +#define PCI_DEVICE_ID_AL_M1523 0x1523
20609 +#define PCI_DEVICE_ID_AL_M1531 0x1531
20610 +#define PCI_DEVICE_ID_AL_M1533 0x1533
20611 +#define PCI_DEVICE_ID_AL_M1535 0x1535
20612 +#define PCI_DEVICE_ID_AL_M1541 0x1541
20613 +#define PCI_DEVICE_ID_AL_M1543 0x1543
20614 +#define PCI_DEVICE_ID_AL_M1563 0x1563
20615 +#define PCI_DEVICE_ID_AL_M1621 0x1621
20616 +#define PCI_DEVICE_ID_AL_M1631 0x1631
20617 +#define PCI_DEVICE_ID_AL_M1632 0x1632
20618 +#define PCI_DEVICE_ID_AL_M1641 0x1641
20619 +#define PCI_DEVICE_ID_AL_M1644 0x1644
20620 +#define PCI_DEVICE_ID_AL_M1647 0x1647
20621 +#define PCI_DEVICE_ID_AL_M1651 0x1651
20622 +#define PCI_DEVICE_ID_AL_M1671 0x1671
20623 +#define PCI_DEVICE_ID_AL_M1681 0x1681
20624 +#define PCI_DEVICE_ID_AL_M1683 0x1683
20625 +#define PCI_DEVICE_ID_AL_M1689 0x1689
20626 +#define PCI_DEVICE_ID_AL_M3307 0x3307
20627 +#define PCI_DEVICE_ID_AL_M4803 0x5215
20628 +#define PCI_DEVICE_ID_AL_M5219 0x5219
20629 +#define PCI_DEVICE_ID_AL_M5228 0x5228
20630 +#define PCI_DEVICE_ID_AL_M5229 0x5229
20631 +#define PCI_DEVICE_ID_AL_M5237 0x5237
20632 +#define PCI_DEVICE_ID_AL_M5243 0x5243
20633 +#define PCI_DEVICE_ID_AL_M5451 0x5451
20634 +#define PCI_DEVICE_ID_AL_M7101 0x7101
20635 +
20636 +#define PCI_VENDOR_ID_MITSUBISHI 0x10ba
20637 +
20638 +#define PCI_VENDOR_ID_SURECOM 0x10bd
20639 +#define PCI_DEVICE_ID_SURECOM_NE34 0x0e34
20640 +
20641 +#define PCI_VENDOR_ID_NEOMAGIC 0x10c8
20642 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2070 0x0001
20643 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128V 0x0002
20644 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZV 0x0003
20645 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2160 0x0004
20646 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICMEDIA_256AV 0x0005
20647 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZVPLUS 0x0083
20648 +
20649 +#define PCI_VENDOR_ID_ASP 0x10cd
20650 +#define PCI_DEVICE_ID_ASP_ABP940 0x1200
20651 +#define PCI_DEVICE_ID_ASP_ABP940U 0x1300
20652 +#define PCI_DEVICE_ID_ASP_ABP940UW 0x2300
20653 +
20654 +#define PCI_VENDOR_ID_MACRONIX 0x10d9
20655 +#define PCI_DEVICE_ID_MACRONIX_MX98713 0x0512
20656 +#define PCI_DEVICE_ID_MACRONIX_MX987x5 0x0531
20657 +
20658 +#define PCI_VENDOR_ID_TCONRAD 0x10da
20659 +#define PCI_DEVICE_ID_TCONRAD_TOKENRING 0x0508
20660 +
20661 +#define PCI_VENDOR_ID_CERN 0x10dc
20662 +#define PCI_DEVICE_ID_CERN_SPSB_PMC 0x0001
20663 +#define PCI_DEVICE_ID_CERN_SPSB_PCI 0x0002
20664 +#define PCI_DEVICE_ID_CERN_HIPPI_DST 0x0021
20665 +#define PCI_DEVICE_ID_CERN_HIPPI_SRC 0x0022
20666 +
20667 +#define PCI_VENDOR_ID_NVIDIA 0x10de
20668 +#define PCI_DEVICE_ID_NVIDIA_TNT 0x0020
20669 +#define PCI_DEVICE_ID_NVIDIA_TNT2 0x0028
20670 +#define PCI_DEVICE_ID_NVIDIA_UTNT2 0x0029
20671 +#define PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN 0x002a
20672 +#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C
20673 +#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D
20674 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035
20675 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036
20676 +#define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037
20677 +#define PCI_DEVICE_ID_NVIDIA_NVENET_11 0x0038
20678 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2 0x003e
20679 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_ULTRA 0x0040
20680 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800 0x0041
20681 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_LE 0x0042
20682 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x0045
20683 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_4000 0x004E
20684 +#define PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS 0x0052
20685 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE 0x0053
20686 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA 0x0054
20687 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2 0x0055
20688 +#define PCI_DEVICE_ID_NVIDIA_NVENET_8 0x0056
20689 +#define PCI_DEVICE_ID_NVIDIA_NVENET_9 0x0057
20690 +#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059
20691 +#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064
20692 +#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065
20693 +#define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066
20694 +#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a
20695 +#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS 0x0084
20696 +#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085
20697 +#define PCI_DEVICE_ID_NVIDIA_NVENET_4 0x0086
20698 +#define PCI_DEVICE_ID_NVIDIA_NVENET_5 0x008c
20699 +#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e
20700 +#define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0
20701 +#define PCI_DEVICE_ID_GEFORCE_6800A 0x00c1
20702 +#define PCI_DEVICE_ID_GEFORCE_6800A_LE 0x00c2
20703 +#define PCI_DEVICE_ID_GEFORCE_GO_6800 0x00c8
20704 +#define PCI_DEVICE_ID_GEFORCE_GO_6800_ULTRA 0x00c9
20705 +#define PCI_DEVICE_ID_QUADRO_FX_GO1400 0x00cc
20706 +#define PCI_DEVICE_ID_QUADRO_FX_1400 0x00ce
20707 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3 0x00d1
20708 +#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
20709 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS 0x00d4
20710 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE 0x00d5
20711 +#define PCI_DEVICE_ID_NVIDIA_NVENET_3 0x00d6
20712 +#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
20713 +#define PCI_DEVICE_ID_NVIDIA_NVENET_7 0x00df
20714 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1
20715 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA 0x00e3
20716 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS 0x00e4
20717 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE 0x00e5
20718 +#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6
20719 +#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee
20720 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100
20721 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101
20722 +#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103
20723 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX 0x0110
20724 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX2 0x0111
20725 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GO 0x0112
20726 +#define PCI_DEVICE_ID_NVIDIA_QUADRO2_MXR 0x0113
20727 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6600_GT 0x0140
20728 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6600 0x0141
20729 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6610_XL 0x0145
20730 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_540 0x014E
20731 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6200 0x014F
20732 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS 0x0150
20733 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS2 0x0151
20734 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_ULTRA 0x0152
20735 +#define PCI_DEVICE_ID_NVIDIA_QUADRO2_PRO 0x0153
20736 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6200_TURBOCACHE 0x0161
20737 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6200 0x0164
20738 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6250 0x0166
20739 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6200_1 0x0167
20740 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6250_1 0x0168
20741 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_460 0x0170
20742 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440 0x0171
20743 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420 0x0172
20744 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440_SE 0x0173
20745 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_440_GO 0x0174
20746 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_420_GO 0x0175
20747 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_420_GO_M32 0x0176
20748 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_460_GO 0x0177
20749 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_500XGL 0x0178
20750 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_440_GO_M64 0x0179
20751 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_200 0x017A
20752 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_550XGL 0x017B
20753 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_500_GOGL 0x017C
20754 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_410_GO_M16 0x017D
20755 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440_8X 0x0181
20756 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440SE_8X 0x0182
20757 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420_8X 0x0183
20758 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_448_GO 0x0186
20759 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_488_GO 0x0187
20760 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_580_XGL 0x0188
20761 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_MAC 0x0189
20762 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_280_NVS 0x018A
20763 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_380_XGL 0x018B
20764 +#define PCI_DEVICE_ID_NVIDIA_IGEFORCE2 0x01a0
20765 +#define PCI_DEVICE_ID_NVIDIA_NFORCE 0x01a4
20766 +#define PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO 0x01b1
20767 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS 0x01b4
20768 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE 0x01bc
20769 +#define PCI_DEVICE_ID_NVIDIA_NVENET_1 0x01c3
20770 +#define PCI_DEVICE_ID_NVIDIA_NFORCE2 0x01e0
20771 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE3 0x0200
20772 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE3_1 0x0201
20773 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE3_2 0x0202
20774 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_DDC 0x0203
20775 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B 0x0211
20776 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B_LE 0x0212
20777 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B_GT 0x0215
20778 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4600 0x0250
20779 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4400 0x0251
20780 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4200 0x0253
20781 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL 0x0258
20782 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL 0x0259
20783 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL 0x025B
20784 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265
20785 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266
20786 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267
20787 +#define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268
20788 +#define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269
20789 +#define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B
20790 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800 0x0280
20791 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X 0x0281
20792 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE 0x0282
20793 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_4200_GO 0x0286
20794 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_980_XGL 0x0288
20795 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_780_XGL 0x0289
20796 +#define PCI_DEVICE_ID_NVIDIA_QUADRO4_700_GOGL 0x028C
20797 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5800_ULTRA 0x0301
20798 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5800 0x0302
20799 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_2000 0x0308
20800 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1000 0x0309
20801 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600_ULTRA 0x0311
20802 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600 0x0312
20803 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600SE 0x0314
20804 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5600 0x031A
20805 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5650 0x031B
20806 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO700 0x031C
20807 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200 0x0320
20808 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200_ULTRA 0x0321
20809 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200_1 0x0322
20810 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200SE 0x0323
20811 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5200 0x0324
20812 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5250 0x0325
20813 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5500 0x0326
20814 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5100 0x0327
20815 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5250_32 0x0328
20816 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO_5200 0x0329
20817 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_NVS_280_PCI 0x032A
20818 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_500 0x032B
20819 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5300 0x032C
20820 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5100 0x032D
20821 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900_ULTRA 0x0330
20822 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900 0x0331
20823 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900XT 0x0332
20824 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5950_ULTRA 0x0333
20825 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900ZT 0x0334
20826 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_3000 0x0338
20827 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_700 0x033F
20828 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700_ULTRA 0x0341
20829 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700 0x0342
20830 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700LE 0x0343
20831 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700VE 0x0344
20832 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_1 0x0347
20833 +#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348
20834 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C
20835 +#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E
20836 +
20837 +#define PCI_VENDOR_ID_IMS 0x10e0
20838 +#define PCI_DEVICE_ID_IMS_8849 0x8849
20839 +#define PCI_DEVICE_ID_IMS_TT128 0x9128
20840 +#define PCI_DEVICE_ID_IMS_TT3D 0x9135
20841 +
20842 +#define PCI_VENDOR_ID_TEKRAM2 0x10e1
20843 +#define PCI_DEVICE_ID_TEKRAM2_690c 0x690c
20844 +
20845 +#define PCI_VENDOR_ID_TUNDRA 0x10e3
20846 +#define PCI_DEVICE_ID_TUNDRA_CA91C042 0x0000
20847 +
20848 +#define PCI_VENDOR_ID_AMCC 0x10e8
20849 +#define PCI_DEVICE_ID_AMCC_MYRINET 0x8043
20850 +#define PCI_DEVICE_ID_AMCC_PARASTATION 0x8062
20851 +#define PCI_DEVICE_ID_AMCC_S5933 0x807d
20852 +#define PCI_DEVICE_ID_AMCC_S5933_HEPC3 0x809c
20853 +
20854 +#define PCI_VENDOR_ID_INTERG 0x10ea
20855 +#define PCI_DEVICE_ID_INTERG_1680 0x1680
20856 +#define PCI_DEVICE_ID_INTERG_1682 0x1682
20857 +#define PCI_DEVICE_ID_INTERG_2000 0x2000
20858 +#define PCI_DEVICE_ID_INTERG_2010 0x2010
20859 +#define PCI_DEVICE_ID_INTERG_5000 0x5000
20860 +#define PCI_DEVICE_ID_INTERG_5050 0x5050
20861 +
20862 +#define PCI_VENDOR_ID_REALTEK 0x10ec
20863 +#define PCI_DEVICE_ID_REALTEK_8029 0x8029
20864 +#define PCI_DEVICE_ID_REALTEK_8129 0x8129
20865 +#define PCI_DEVICE_ID_REALTEK_8139 0x8139
20866 +#define PCI_DEVICE_ID_REALTEK_8169 0x8169
20867 +
20868 +#define PCI_VENDOR_ID_XILINX 0x10ee
20869 +#define PCI_DEVICE_ID_TURBOPAM 0x4020
20870 +
20871 +#define PCI_VENDOR_ID_TRUEVISION 0x10fa
20872 +#define PCI_DEVICE_ID_TRUEVISION_T1000 0x000c
20873 +
20874 +#define PCI_VENDOR_ID_INIT 0x1101
20875 +#define PCI_DEVICE_ID_INIT_320P 0x9100
20876 +#define PCI_DEVICE_ID_INIT_360P 0x9500
20877 +
20878 +#define PCI_VENDOR_ID_CREATIVE 0x1102 // duplicate: ECTIVA
20879 +#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002
20880 +
20881 +#define PCI_VENDOR_ID_ECTIVA 0x1102 // duplicate: CREATIVE
20882 +#define PCI_DEVICE_ID_ECTIVA_EV1938 0x8938
20883 +
20884 +#define PCI_VENDOR_ID_TTI 0x1103
20885 +#define PCI_DEVICE_ID_TTI_HPT343 0x0003
20886 +#define PCI_DEVICE_ID_TTI_HPT366 0x0004
20887 +#define PCI_DEVICE_ID_TTI_HPT372 0x0005
20888 +#define PCI_DEVICE_ID_TTI_HPT302 0x0006
20889 +#define PCI_DEVICE_ID_TTI_HPT371 0x0007
20890 +#define PCI_DEVICE_ID_TTI_HPT374 0x0008
20891 +#define PCI_DEVICE_ID_TTI_HPT372N 0x0009 // apparently a 372N variant?
20892 +
20893 +#define PCI_VENDOR_ID_VIA 0x1106
20894 +#define PCI_DEVICE_ID_VIA_8763_0 0x0198
20895 +#define PCI_DEVICE_ID_VIA_8380_0 0x0204
20896 +#define PCI_DEVICE_ID_VIA_3238_0 0x0238
20897 +#define PCI_DEVICE_ID_VIA_PT880 0x0258
20898 +#define PCI_DEVICE_ID_VIA_PX8X0_0 0x0259
20899 +#define PCI_DEVICE_ID_VIA_3269_0 0x0269
20900 +#define PCI_DEVICE_ID_VIA_K8T800PRO_0 0x0282
20901 +#define PCI_DEVICE_ID_VIA_8363_0 0x0305
20902 +#define PCI_DEVICE_ID_VIA_8371_0 0x0391
20903 +#define PCI_DEVICE_ID_VIA_8501_0 0x0501
20904 +#define PCI_DEVICE_ID_VIA_82C505 0x0505
20905 +#define PCI_DEVICE_ID_VIA_82C561 0x0561
20906 +#define PCI_DEVICE_ID_VIA_82C586_1 0x0571
20907 +#define PCI_DEVICE_ID_VIA_82C576 0x0576
20908 +#define PCI_DEVICE_ID_VIA_82C585 0x0585
20909 +#define PCI_DEVICE_ID_VIA_82C586_0 0x0586
20910 +#define PCI_DEVICE_ID_VIA_82C595 0x0595
20911 +#define PCI_DEVICE_ID_VIA_82C596 0x0596
20912 +#define PCI_DEVICE_ID_VIA_82C597_0 0x0597
20913 +#define PCI_DEVICE_ID_VIA_82C598_0 0x0598
20914 +#define PCI_DEVICE_ID_VIA_8601_0 0x0601
20915 +#define PCI_DEVICE_ID_VIA_8605_0 0x0605
20916 +#define PCI_DEVICE_ID_VIA_82C680 0x0680
20917 +#define PCI_DEVICE_ID_VIA_82C686 0x0686
20918 +#define PCI_DEVICE_ID_VIA_82C691_0 0x0691
20919 +#define PCI_DEVICE_ID_VIA_82C693 0x0693
20920 +#define PCI_DEVICE_ID_VIA_82C693_1 0x0698
20921 +#define PCI_DEVICE_ID_VIA_82C926 0x0926
20922 +#define PCI_DEVICE_ID_VIA_82C576_1 0x1571
20923 +#define PCI_DEVICE_ID_VIA_82C595_97 0x1595
20924 +#define PCI_DEVICE_ID_VIA_82C586_2 0x3038
20925 +#define PCI_DEVICE_ID_VIA_82C586_3 0x3040
20926 +#define PCI_DEVICE_ID_VIA_6305 0x3044
20927 +#define PCI_DEVICE_ID_VIA_82C596_3 0x3050
20928 +#define PCI_DEVICE_ID_VIA_82C596B_3 0x3051
20929 +#define PCI_DEVICE_ID_VIA_82C686_4 0x3057
20930 +#define PCI_DEVICE_ID_VIA_82C686_5 0x3058
20931 +#define PCI_DEVICE_ID_VIA_8233_5 0x3059
20932 +#define PCI_DEVICE_ID_VIA_8233_7 0x3065
20933 +#define PCI_DEVICE_ID_VIA_82C686_6 0x3068
20934 +#define PCI_DEVICE_ID_VIA_8233_0 0x3074
20935 +#define PCI_DEVICE_ID_VIA_8633_0 0x3091
20936 +#define PCI_DEVICE_ID_VIA_8367_0 0x3099
20937 +#define PCI_DEVICE_ID_VIA_8653_0 0x3101
20938 +#define PCI_DEVICE_ID_VIA_8622 0x3102
20939 +#define PCI_DEVICE_ID_VIA_8233C_0 0x3109
20940 +#define PCI_DEVICE_ID_VIA_8361 0x3112
20941 +#define PCI_DEVICE_ID_VIA_XM266 0x3116
20942 +#define PCI_DEVICE_ID_VIA_612X 0x3119
20943 +#define PCI_DEVICE_ID_VIA_862X_0 0x3123
20944 +#define PCI_DEVICE_ID_VIA_8753_0 0x3128
20945 +#define PCI_DEVICE_ID_VIA_8233A 0x3147
20946 +#define PCI_DEVICE_ID_VIA_8703_51_0 0x3148
20947 +#define PCI_DEVICE_ID_VIA_8237_SATA 0x3149
20948 +#define PCI_DEVICE_ID_VIA_XN266 0x3156
20949 +#define PCI_DEVICE_ID_VIA_8754C_0 0x3168
20950 +#define PCI_DEVICE_ID_VIA_8235 0x3177
20951 +#define PCI_DEVICE_ID_VIA_P4N333 0x3178
20952 +#define PCI_DEVICE_ID_VIA_8385_0 0x3188
20953 +#define PCI_DEVICE_ID_VIA_8377_0 0x3189
20954 +#define PCI_DEVICE_ID_VIA_8378_0 0x3205
20955 +#define PCI_DEVICE_ID_VIA_8783_0 0x3208
20956 +#define PCI_DEVICE_ID_VIA_P4M400 0x3209
20957 +#define PCI_DEVICE_ID_VIA_8237 0x3227
20958 +#define PCI_DEVICE_ID_VIA_3296_0 0x0296
20959 +#define PCI_DEVICE_ID_VIA_86C100A 0x6100
20960 +#define PCI_DEVICE_ID_VIA_8231 0x8231
20961 +#define PCI_DEVICE_ID_VIA_8231_4 0x8235
20962 +#define PCI_DEVICE_ID_VIA_8365_1 0x8305
20963 +#define PCI_DEVICE_ID_VIA_8371_1 0x8391
20964 +#define PCI_DEVICE_ID_VIA_8501_1 0x8501
20965 +#define PCI_DEVICE_ID_VIA_82C597_1 0x8597
20966 +#define PCI_DEVICE_ID_VIA_82C598_1 0x8598
20967 +#define PCI_DEVICE_ID_VIA_8601_1 0x8601
20968 +#define PCI_DEVICE_ID_VIA_8505_1 0x8605
20969 +#define PCI_DEVICE_ID_VIA_8633_1 0xB091
20970 +#define PCI_DEVICE_ID_VIA_8367_1 0xB099
20971 +#define PCI_DEVICE_ID_VIA_P4X266_1 0xB101
20972 +#define PCI_DEVICE_ID_VIA_8615_1 0xB103
20973 +#define PCI_DEVICE_ID_VIA_8361_1 0xB112
20974 +#define PCI_DEVICE_ID_VIA_8235_1 0xB168
20975 +#define PCI_DEVICE_ID_VIA_838X_1 0xB188
20976 +#define PCI_DEVICE_ID_VIA_83_87XX_1 0xB198
20977 +
20978 +#define PCI_VENDOR_ID_SIEMENS 0x110A
20979 +#define PCI_DEVICE_ID_SIEMENS_DSCC4 0x2102
20980 +
20981 +#define PCI_VENDOR_ID_SMC2 0x1113
20982 +#define PCI_DEVICE_ID_SMC2_1211TX 0x1211
20983 +
20984 +#define PCI_VENDOR_ID_VORTEX 0x1119
20985 +#define PCI_DEVICE_ID_VORTEX_GDT60x0 0x0000
20986 +#define PCI_DEVICE_ID_VORTEX_GDT6000B 0x0001
20987 +#define PCI_DEVICE_ID_VORTEX_GDT6x10 0x0002
20988 +#define PCI_DEVICE_ID_VORTEX_GDT6x20 0x0003
20989 +#define PCI_DEVICE_ID_VORTEX_GDT6530 0x0004
20990 +#define PCI_DEVICE_ID_VORTEX_GDT6550 0x0005
20991 +#define PCI_DEVICE_ID_VORTEX_GDT6x17 0x0006
20992 +#define PCI_DEVICE_ID_VORTEX_GDT6x27 0x0007
20993 +#define PCI_DEVICE_ID_VORTEX_GDT6537 0x0008
20994 +#define PCI_DEVICE_ID_VORTEX_GDT6557 0x0009
20995 +#define PCI_DEVICE_ID_VORTEX_GDT6x15 0x000a
20996 +#define PCI_DEVICE_ID_VORTEX_GDT6x25 0x000b
20997 +#define PCI_DEVICE_ID_VORTEX_GDT6535 0x000c
20998 +#define PCI_DEVICE_ID_VORTEX_GDT6555 0x000d
20999 +#define PCI_DEVICE_ID_VORTEX_GDT6x17RP 0x0100
21000 +#define PCI_DEVICE_ID_VORTEX_GDT6x27RP 0x0101
21001 +#define PCI_DEVICE_ID_VORTEX_GDT6537RP 0x0102
21002 +#define PCI_DEVICE_ID_VORTEX_GDT6557RP 0x0103
21003 +#define PCI_DEVICE_ID_VORTEX_GDT6x11RP 0x0104
21004 +#define PCI_DEVICE_ID_VORTEX_GDT6x21RP 0x0105
21005 +#define PCI_DEVICE_ID_VORTEX_GDT6x17RP1 0x0110
21006 +#define PCI_DEVICE_ID_VORTEX_GDT6x27RP1 0x0111
21007 +#define PCI_DEVICE_ID_VORTEX_GDT6537RP1 0x0112
21008 +#define PCI_DEVICE_ID_VORTEX_GDT6557RP1 0x0113
21009 +#define PCI_DEVICE_ID_VORTEX_GDT6x11RP1 0x0114
21010 +#define PCI_DEVICE_ID_VORTEX_GDT6x21RP1 0x0115
21011 +#define PCI_DEVICE_ID_VORTEX_GDT6x17RP2 0x0120
21012 +#define PCI_DEVICE_ID_VORTEX_GDT6x27RP2 0x0121
21013 +#define PCI_DEVICE_ID_VORTEX_GDT6537RP2 0x0122
21014 +#define PCI_DEVICE_ID_VORTEX_GDT6557RP2 0x0123
21015 +#define PCI_DEVICE_ID_VORTEX_GDT6x11RP2 0x0124
21016 +#define PCI_DEVICE_ID_VORTEX_GDT6x21RP2 0x0125
21017 +
21018 +#define PCI_VENDOR_ID_EF 0x111a
21019 +#define PCI_DEVICE_ID_EF_ATM_FPGA 0x0000
21020 +#define PCI_DEVICE_ID_EF_ATM_ASIC 0x0002
21021 +#define PCI_VENDOR_ID_EF_ATM_LANAI2 0x0003
21022 +#define PCI_VENDOR_ID_EF_ATM_LANAIHB 0x0005
21023 +
21024 +#define PCI_VENDOR_ID_IDT 0x111d
21025 +#define PCI_DEVICE_ID_IDT_IDT77201 0x0001
21026 +
21027 +#define PCI_VENDOR_ID_FORE 0x1127
21028 +#define PCI_DEVICE_ID_FORE_PCA200PC 0x0210
21029 +#define PCI_DEVICE_ID_FORE_PCA200E 0x0300
21030 +
21031 +#define PCI_VENDOR_ID_IMAGINGTECH 0x112f
21032 +#define PCI_DEVICE_ID_IMAGINGTECH_ICPCI 0x0000
21033 +
21034 +#define PCI_VENDOR_ID_PHILIPS 0x1131
21035 +#define PCI_DEVICE_ID_PHILIPS_SAA7145 0x7145
21036 +#define PCI_DEVICE_ID_PHILIPS_SAA7146 0x7146
21037 +#define PCI_DEVICE_ID_PHILIPS_SAA9730 0x9730
21038 +
21039 +#define PCI_VENDOR_ID_EICON 0x1133
21040 +#define PCI_DEVICE_ID_EICON_DIVA20PRO 0xe001
21041 +#define PCI_DEVICE_ID_EICON_DIVA20 0xe002
21042 +#define PCI_DEVICE_ID_EICON_DIVA20PRO_U 0xe003
21043 +#define PCI_DEVICE_ID_EICON_DIVA20_U 0xe004
21044 +#define PCI_DEVICE_ID_EICON_DIVA201 0xe005
21045 +#define PCI_DEVICE_ID_EICON_DIVA202 0xe00b
21046 +#define PCI_DEVICE_ID_EICON_MAESTRA 0xe010
21047 +#define PCI_DEVICE_ID_EICON_MAESTRAQ 0xe012
21048 +#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013
21049 +#define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014
21050 +
21051 +#define PCI_VENDOR_ID_ZIATECH 0x1138
21052 +#define PCI_DEVICE_ID_ZIATECH_5550_HC 0x5550
21053 +
21054 +#define PCI_VENDOR_ID_CYCLONE 0x113c
21055 +#define PCI_DEVICE_ID_CYCLONE_SDK 0x0001
21056 +
21057 +#define PCI_VENDOR_ID_ALLIANCE 0x1142
21058 +#define PCI_DEVICE_ID_ALLIANCE_PROMOTIO 0x3210
21059 +#define PCI_DEVICE_ID_ALLIANCE_PROVIDEO 0x6422
21060 +#define PCI_DEVICE_ID_ALLIANCE_AT24 0x6424
21061 +#define PCI_DEVICE_ID_ALLIANCE_AT3D 0x643d
21062 +
21063 +#define PCI_VENDOR_ID_SYSKONNECT 0x1148
21064 +#define PCI_DEVICE_ID_SYSKONNECT_FP 0x4000
21065 +#define PCI_DEVICE_ID_SYSKONNECT_TR 0x4200
21066 +#define PCI_DEVICE_ID_SYSKONNECT_GE 0x4300
21067 +#define PCI_DEVICE_ID_SYSKONNECT_YU 0x4320
21068 +#define PCI_DEVICE_ID_SYSKONNECT_9DXX 0x4400
21069 +#define PCI_DEVICE_ID_SYSKONNECT_9MXX 0x4500
21070 +
21071 +#define PCI_VENDOR_ID_VMIC 0x114a
21072 +#define PCI_DEVICE_ID_VMIC_VME 0x7587
21073 +
21074 +#define PCI_VENDOR_ID_DIGI 0x114f
21075 +#define PCI_DEVICE_ID_DIGI_EPC 0x0002
21076 +#define PCI_DEVICE_ID_DIGI_RIGHTSWITCH 0x0003
21077 +#define PCI_DEVICE_ID_DIGI_XEM 0x0004
21078 +#define PCI_DEVICE_ID_DIGI_XR 0x0005
21079 +#define PCI_DEVICE_ID_DIGI_CX 0x0006
21080 +#define PCI_DEVICE_ID_DIGI_XRJ 0x0009
21081 +#define PCI_DEVICE_ID_DIGI_EPCJ 0x000a
21082 +#define PCI_DEVICE_ID_DIGI_XR_920 0x0027
21083 +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070
21084 +#define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071
21085 +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072
21086 +#define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073
21087 +#define PCI_DEVICE_ID_NEO_2DB9 0x00C8
21088 +#define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9
21089 +#define PCI_DEVICE_ID_NEO_2RJ45 0x00CA
21090 +#define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB
21091 +
21092 +#define PCI_VENDOR_ID_MUTECH 0x1159
21093 +#define PCI_DEVICE_ID_MUTECH_MV1000 0x0001
21094 +
21095 +#define PCI_VENDOR_ID_XIRCOM 0x115d
21096 +#define PCI_DEVICE_ID_XIRCOM_X3201_ETH 0x0003
21097 +#define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101
21098 +#define PCI_DEVICE_ID_XIRCOM_X3201_MDM 0x0103
21099 +
21100 +#define PCI_VENDOR_ID_RENDITION 0x1163
21101 +#define PCI_DEVICE_ID_RENDITION_VERITE 0x0001
21102 +#define PCI_DEVICE_ID_RENDITION_VERITE2100 0x2000
21103 +
21104 +#define PCI_VENDOR_ID_SERVERWORKS 0x1166
21105 +#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008
21106 +#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009
21107 +#define PCI_DEVICE_ID_SERVERWORKS_CIOB30 0x0010
21108 +#define PCI_DEVICE_ID_SERVERWORKS_CMIC_HE 0x0011
21109 +#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017
21110 +#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200
21111 +#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201
21112 +#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203
21113 +#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211
21114 +#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212
21115 +#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213
21116 +#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217
21117 +#define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220
21118 +#define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB
21119 +#define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221
21120 +#define PCI_DEVICE_ID_SERVERWORKS_GCLE 0x0225
21121 +#define PCI_DEVICE_ID_SERVERWORKS_GCLE2 0x0227
21122 +#define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230
21123 +
21124 +#define PCI_VENDOR_ID_SBE 0x1176
21125 +#define PCI_DEVICE_ID_SBE_WANXL100 0x0301
21126 +#define PCI_DEVICE_ID_SBE_WANXL200 0x0302
21127 +#define PCI_DEVICE_ID_SBE_WANXL400 0x0104
21128 +
21129 +#define PCI_VENDOR_ID_TOSHIBA 0x1179
21130 +#define PCI_DEVICE_ID_TOSHIBA_PICCOLO 0x0102
21131 +#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_1 0x0103
21132 +#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_2 0x0105
21133 +#define PCI_DEVICE_ID_TOSHIBA_601 0x0601
21134 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC95 0x060a
21135 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC95_A 0x0603
21136 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC95_B 0x060a
21137 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC97 0x060f
21138 +#define PCI_DEVICE_ID_TOSHIBA_TOPIC100 0x0617
21139 +
21140 +#define PCI_VENDOR_ID_TOSHIBA_2 0x102f
21141 +#define PCI_DEVICE_ID_TOSHIBA_TX3927 0x000a
21142 +#define PCI_DEVICE_ID_TOSHIBA_TC35815CF 0x0030
21143 +#define PCI_DEVICE_ID_TOSHIBA_TX4927 0x0180
21144 +#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108
21145 +
21146 +#define PCI_VENDOR_ID_RICOH 0x1180
21147 +#define PCI_DEVICE_ID_RICOH_RL5C465 0x0465
21148 +#define PCI_DEVICE_ID_RICOH_RL5C466 0x0466
21149 +#define PCI_DEVICE_ID_RICOH_RL5C475 0x0475
21150 +#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476
21151 +#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478
21152 +
21153 +#define PCI_VENDOR_ID_DLINK 0x1186
21154 +#define PCI_DEVICE_ID_DLINK_DGE510T 0x4c00
21155 +
21156 +#define PCI_VENDOR_ID_ARTOP 0x1191
21157 +#define PCI_DEVICE_ID_ARTOP_ATP8400 0x0004
21158 +#define PCI_DEVICE_ID_ARTOP_ATP850UF 0x0005
21159 +#define PCI_DEVICE_ID_ARTOP_ATP860 0x0006
21160 +#define PCI_DEVICE_ID_ARTOP_ATP860R 0x0007
21161 +#define PCI_DEVICE_ID_ARTOP_ATP865 0x0008
21162 +#define PCI_DEVICE_ID_ARTOP_ATP865R 0x0009
21163 +#define PCI_DEVICE_ID_ARTOP_AEC7610 0x8002
21164 +#define PCI_DEVICE_ID_ARTOP_AEC7612UW 0x8010
21165 +#define PCI_DEVICE_ID_ARTOP_AEC7612U 0x8020
21166 +#define PCI_DEVICE_ID_ARTOP_AEC7612S 0x8030
21167 +#define PCI_DEVICE_ID_ARTOP_AEC7612D 0x8040
21168 +#define PCI_DEVICE_ID_ARTOP_AEC7612SUW 0x8050
21169 +#define PCI_DEVICE_ID_ARTOP_8060 0x8060
21170 +#define PCI_DEVICE_ID_ARTOP_AEC67160 0x8080
21171 +#define PCI_DEVICE_ID_ARTOP_AEC67160_2 0x8081
21172 +#define PCI_DEVICE_ID_ARTOP_AEC67162 0x808a
21173 +
21174 +#define PCI_VENDOR_ID_ZEITNET 0x1193
21175 +#define PCI_DEVICE_ID_ZEITNET_1221 0x0001
21176 +#define PCI_DEVICE_ID_ZEITNET_1225 0x0002
21177 +
21178 +#define PCI_VENDOR_ID_OMEGA 0x119b
21179 +#define PCI_DEVICE_ID_OMEGA_82C092G 0x1221
21180 +
21181 +#define PCI_VENDOR_ID_FUJITSU_ME 0x119e
21182 +#define PCI_DEVICE_ID_FUJITSU_FS155 0x0001
21183 +#define PCI_DEVICE_ID_FUJITSU_FS50 0x0003
21184 +
21185 +#define PCI_SUBVENDOR_ID_KEYSPAN 0x11a9
21186 +#define PCI_SUBDEVICE_ID_KEYSPAN_SX2 0x5334
21187 +
21188 +#define PCI_VENDOR_ID_MARVELL 0x11ab
21189 +#define PCI_DEVICE_ID_MARVELL_GT64011 0x4146
21190 +#define PCI_DEVICE_ID_MARVELL_GT64111 0x4146
21191 +#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430
21192 +#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460
21193 +#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480
21194 +#define PCI_DEVICE_ID_MARVELL_GT96100 0x9652
21195 +#define PCI_DEVICE_ID_MARVELL_GT96100A 0x9653
21196 +
21197 +#define PCI_VENDOR_ID_LITEON 0x11ad
21198 +#define PCI_DEVICE_ID_LITEON_LNE100TX 0x0002
21199 +
21200 +#define PCI_VENDOR_ID_V3 0x11b0
21201 +#define PCI_DEVICE_ID_V3_V960 0x0001
21202 +#define PCI_DEVICE_ID_V3_V350 0x0001
21203 +#define PCI_DEVICE_ID_V3_V961 0x0002
21204 +#define PCI_DEVICE_ID_V3_V351 0x0002
21205 +
21206 +#define PCI_VENDOR_ID_NP 0x11bc
21207 +#define PCI_DEVICE_ID_NP_PCI_FDDI 0x0001
21208 +
21209 +#define PCI_VENDOR_ID_ATT 0x11c1
21210 +#define PCI_DEVICE_ID_ATT_L56XMF 0x0440
21211 +#define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480
21212 +
21213 +#define PCI_VENDOR_ID_NEC2 0x11c3 /* NEC (2nd) */
21214 +
21215 +#define PCI_VENDOR_ID_SPECIALIX 0x11cb
21216 +#define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000
21217 +#define PCI_DEVICE_ID_SPECIALIX_XIO 0x4000
21218 +#define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000
21219 +#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004
21220 +
21221 +#define PCI_VENDOR_ID_AURAVISION 0x11d1
21222 +#define PCI_DEVICE_ID_AURAVISION_VXP524 0x01f7
21223 +
21224 +#define PCI_VENDOR_ID_ANALOG_DEVICES 0x11d4
21225 +#define PCI_DEVICE_ID_AD1889JS 0x1889
21226 +
21227 +#define PCI_VENDOR_ID_IKON 0x11d5
21228 +#define PCI_DEVICE_ID_IKON_10115 0x0115
21229 +#define PCI_DEVICE_ID_IKON_10117 0x0117
21230 +
21231 +#define PCI_VENDOR_ID_SEGA 0x11db
21232 +#define PCI_DEVICE_ID_SEGA_BBA 0x1234
21233 +
21234 +#define PCI_VENDOR_ID_ZORAN 0x11de
21235 +#define PCI_DEVICE_ID_ZORAN_36057 0x6057
21236 +#define PCI_DEVICE_ID_ZORAN_36120 0x6120
21237 +
21238 +#define PCI_VENDOR_ID_KINETIC 0x11f4
21239 +#define PCI_DEVICE_ID_KINETIC_2915 0x2915
21240 +
21241 +#define PCI_VENDOR_ID_COMPEX 0x11f6
21242 +#define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112
21243 +#define PCI_DEVICE_ID_COMPEX_RL2000 0x1401
21244 +
21245 +#define PCI_VENDOR_ID_RP 0x11fe
21246 +#define PCI_DEVICE_ID_RP32INTF 0x0001
21247 +#define PCI_DEVICE_ID_RP8INTF 0x0002
21248 +#define PCI_DEVICE_ID_RP16INTF 0x0003
21249 +#define PCI_DEVICE_ID_RP4QUAD 0x0004
21250 +#define PCI_DEVICE_ID_RP8OCTA 0x0005
21251 +#define PCI_DEVICE_ID_RP8J 0x0006
21252 +#define PCI_DEVICE_ID_RP4J 0x0007
21253 +#define PCI_DEVICE_ID_RP8SNI 0x0008
21254 +#define PCI_DEVICE_ID_RP16SNI 0x0009
21255 +#define PCI_DEVICE_ID_RPP4 0x000A
21256 +#define PCI_DEVICE_ID_RPP8 0x000B
21257 +#define PCI_DEVICE_ID_RP8M 0x000C
21258 +#define PCI_DEVICE_ID_RP4M 0x000D
21259 +#define PCI_DEVICE_ID_RP2_232 0x000E
21260 +#define PCI_DEVICE_ID_RP2_422 0x000F
21261 +#define PCI_DEVICE_ID_URP32INTF 0x0801
21262 +#define PCI_DEVICE_ID_URP8INTF 0x0802
21263 +#define PCI_DEVICE_ID_URP16INTF 0x0803
21264 +#define PCI_DEVICE_ID_URP8OCTA 0x0805
21265 +#define PCI_DEVICE_ID_UPCI_RM3_8PORT 0x080C
21266 +#define PCI_DEVICE_ID_UPCI_RM3_4PORT 0x080D
21267 +#define PCI_DEVICE_ID_CRP16INTF 0x0903
21268 +
21269 +#define PCI_VENDOR_ID_CYCLADES 0x120e
21270 +#define PCI_DEVICE_ID_CYCLOM_Y_Lo 0x0100
21271 +#define PCI_DEVICE_ID_CYCLOM_Y_Hi 0x0101
21272 +#define PCI_DEVICE_ID_CYCLOM_4Y_Lo 0x0102
21273 +#define PCI_DEVICE_ID_CYCLOM_4Y_Hi 0x0103
21274 +#define PCI_DEVICE_ID_CYCLOM_8Y_Lo 0x0104
21275 +#define PCI_DEVICE_ID_CYCLOM_8Y_Hi 0x0105
21276 +#define PCI_DEVICE_ID_CYCLOM_Z_Lo 0x0200
21277 +#define PCI_DEVICE_ID_CYCLOM_Z_Hi 0x0201
21278 +#define PCI_DEVICE_ID_PC300_RX_2 0x0300
21279 +#define PCI_DEVICE_ID_PC300_RX_1 0x0301
21280 +#define PCI_DEVICE_ID_PC300_TE_2 0x0310
21281 +#define PCI_DEVICE_ID_PC300_TE_1 0x0311
21282 +#define PCI_DEVICE_ID_PC300_TE_M_2 0x0320
21283 +#define PCI_DEVICE_ID_PC300_TE_M_1 0x0321
21284 +
21285 +/* Allied Telesyn */
21286 +#define PCI_VENDOR_ID_AT 0x1259
21287 +#define PCI_SUBDEVICE_ID_AT_2701FX 0x2703
21288 +
21289 +#define PCI_VENDOR_ID_ESSENTIAL 0x120f
21290 +#define PCI_DEVICE_ID_ESSENTIAL_ROADRUNNER 0x0001
21291 +
21292 +#define PCI_VENDOR_ID_O2 0x1217
21293 +#define PCI_DEVICE_ID_O2_6729 0x6729
21294 +#define PCI_DEVICE_ID_O2_6730 0x673a
21295 +#define PCI_DEVICE_ID_O2_6832 0x6832
21296 +#define PCI_DEVICE_ID_O2_6836 0x6836
21297 +
21298 +#define PCI_VENDOR_ID_3DFX 0x121a
21299 +#define PCI_DEVICE_ID_3DFX_VOODOO 0x0001
21300 +#define PCI_DEVICE_ID_3DFX_VOODOO2 0x0002
21301 +#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003
21302 +#define PCI_DEVICE_ID_3DFX_VOODOO3 0x0005
21303 +#define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009
21304 +
21305 +#define PCI_VENDOR_ID_SIGMADES 0x1236
21306 +#define PCI_DEVICE_ID_SIGMADES_6425 0x6401
21307 +
21308 +#define PCI_VENDOR_ID_CCUBE 0x123f
21309 +
21310 +#define PCI_VENDOR_ID_AVM 0x1244
21311 +#define PCI_DEVICE_ID_AVM_B1 0x0700
21312 +#define PCI_DEVICE_ID_AVM_C4 0x0800
21313 +#define PCI_DEVICE_ID_AVM_A1 0x0a00
21314 +#define PCI_DEVICE_ID_AVM_A1_V2 0x0e00
21315 +#define PCI_DEVICE_ID_AVM_C2 0x1100
21316 +#define PCI_DEVICE_ID_AVM_T1 0x1200
21317 +
21318 +#define PCI_VENDOR_ID_DIPIX 0x1246
21319 +
21320 +#define PCI_VENDOR_ID_STALLION 0x124d
21321 +#define PCI_DEVICE_ID_STALLION_ECHPCI832 0x0000
21322 +#define PCI_DEVICE_ID_STALLION_ECHPCI864 0x0002
21323 +#define PCI_DEVICE_ID_STALLION_EIOPCI 0x0003
21324 +
21325 +#define PCI_VENDOR_ID_OPTIBASE 0x1255
21326 +#define PCI_DEVICE_ID_OPTIBASE_FORGE 0x1110
21327 +#define PCI_DEVICE_ID_OPTIBASE_FUSION 0x1210
21328 +#define PCI_DEVICE_ID_OPTIBASE_VPLEX 0x2110
21329 +#define PCI_DEVICE_ID_OPTIBASE_VPLEXCC 0x2120
21330 +#define PCI_DEVICE_ID_OPTIBASE_VQUEST 0x2130
21331 +
21332 +/* Allied Telesyn */
21333 +#define PCI_VENDOR_ID_AT 0x1259
21334 +#define PCI_SUBDEVICE_ID_AT_2700FX 0x2701
21335 +#define PCI_SUBDEVICE_ID_AT_2701FX 0x2703
21336 +
21337 +#define PCI_VENDOR_ID_ESS 0x125d
21338 +#define PCI_DEVICE_ID_ESS_ESS1968 0x1968
21339 +#define PCI_DEVICE_ID_ESS_AUDIOPCI 0x1969
21340 +#define PCI_DEVICE_ID_ESS_ESS1978 0x1978
21341 +
21342 +#define PCI_VENDOR_ID_SATSAGEM 0x1267
21343 +#define PCI_DEVICE_ID_SATSAGEM_NICCY 0x1016
21344 +#define PCI_DEVICE_ID_SATSAGEM_PCR2101 0x5352
21345 +#define PCI_DEVICE_ID_SATSAGEM_TELSATTURBO 0x5a4b
21346 +
21347 +#define PCI_VENDOR_ID_HUGHES 0x1273
21348 +#define PCI_DEVICE_ID_HUGHES_DIRECPC 0x0002
21349 +
21350 +#define PCI_VENDOR_ID_ENSONIQ 0x1274
21351 +#define PCI_DEVICE_ID_ENSONIQ_CT5880 0x5880
21352 +#define PCI_DEVICE_ID_ENSONIQ_ES1370 0x5000
21353 +#define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371
21354 +
21355 +#define PCI_VENDOR_ID_TRANSMETA 0x1279
21356 +#define PCI_DEVICE_ID_EFFICEON 0x0060
21357 +
21358 +#define PCI_VENDOR_ID_ROCKWELL 0x127A
21359 +
21360 +#define PCI_VENDOR_ID_ITE 0x1283
21361 +#define PCI_DEVICE_ID_ITE_IT8172G 0x8172
21362 +#define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801
21363 +#define PCI_DEVICE_ID_ITE_8872 0x8872
21364 +#define PCI_DEVICE_ID_ITE_IT8330G_0 0xe886
21365 +
21366 +/* formerly Platform Tech */
21367 +#define PCI_VENDOR_ID_ESS_OLD 0x1285
21368 +#define PCI_DEVICE_ID_ESS_ESS0100 0x0100
21369 +
21370 +#define PCI_VENDOR_ID_ALTEON 0x12ae
21371 +#define PCI_DEVICE_ID_ALTEON_ACENIC 0x0001
21372 +
21373 +#define PCI_VENDOR_ID_USR 0x12B9
21374 +
21375 +#define PCI_SUBVENDOR_ID_CONNECT_TECH 0x12c4
21376 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232 0x0001
21377 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232 0x0002
21378 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232 0x0003
21379 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485 0x0004
21380 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4 0x0005
21381 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485 0x0006
21382 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2 0x0007
21383 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485 0x0008
21384 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009
21385 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A
21386 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B
21387 +
21388 +#define PCI_VENDOR_ID_PICTUREL 0x12c5
21389 +#define PCI_DEVICE_ID_PICTUREL_PCIVST 0x0081
21390 +
21391 +#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2
21392 +#define PCI_DEVICE_ID_NVIDIA_SGS_RIVA128 0x0018
21393 +
21394 +#define PCI_SUBVENDOR_ID_CHASE_PCIFAST 0x12E0
21395 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST4 0x0031
21396 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST8 0x0021
21397 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16 0x0011
21398 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC 0x0041
21399 +#define PCI_SUBVENDOR_ID_CHASE_PCIRAS 0x124D
21400 +#define PCI_SUBDEVICE_ID_CHASE_PCIRAS4 0xF001
21401 +#define PCI_SUBDEVICE_ID_CHASE_PCIRAS8 0xF010
21402 +
21403 +#define PCI_VENDOR_ID_AUREAL 0x12eb
21404 +#define PCI_DEVICE_ID_AUREAL_VORTEX_1 0x0001
21405 +#define PCI_DEVICE_ID_AUREAL_VORTEX_2 0x0002
21406 +#define PCI_DEVICE_ID_AUREAL_ADVANTAGE 0x0003
21407 +
21408 +#define PCI_VENDOR_ID_ELECTRONICDESIGNGMBH 0x12f8
21409 +#define PCI_DEVICE_ID_LML_33R10 0x8a02
21410 +
21411 +#define PCI_VENDOR_ID_CBOARDS 0x1307
21412 +#define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001
21413 +
21414 +#define PCI_VENDOR_ID_SIIG 0x131f
21415 +#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000
21416 +#define PCI_DEVICE_ID_SIIG_1S_10x_650 0x1001
21417 +#define PCI_DEVICE_ID_SIIG_1S_10x_850 0x1002
21418 +#define PCI_DEVICE_ID_SIIG_1S1P_10x_550 0x1010
21419 +#define PCI_DEVICE_ID_SIIG_1S1P_10x_650 0x1011
21420 +#define PCI_DEVICE_ID_SIIG_1S1P_10x_850 0x1012
21421 +#define PCI_DEVICE_ID_SIIG_1P_10x 0x1020
21422 +#define PCI_DEVICE_ID_SIIG_2P_10x 0x1021
21423 +#define PCI_DEVICE_ID_SIIG_2S_10x_550 0x1030
21424 +#define PCI_DEVICE_ID_SIIG_2S_10x_650 0x1031
21425 +#define PCI_DEVICE_ID_SIIG_2S_10x_850 0x1032
21426 +#define PCI_DEVICE_ID_SIIG_2S1P_10x_550 0x1034
21427 +#define PCI_DEVICE_ID_SIIG_2S1P_10x_650 0x1035
21428 +#define PCI_DEVICE_ID_SIIG_2S1P_10x_850 0x1036
21429 +#define PCI_DEVICE_ID_SIIG_4S_10x_550 0x1050
21430 +#define PCI_DEVICE_ID_SIIG_4S_10x_650 0x1051
21431 +#define PCI_DEVICE_ID_SIIG_4S_10x_850 0x1052
21432 +#define PCI_DEVICE_ID_SIIG_1S_20x_550 0x2000
21433 +#define PCI_DEVICE_ID_SIIG_1S_20x_650 0x2001
21434 +#define PCI_DEVICE_ID_SIIG_1S_20x_850 0x2002
21435 +#define PCI_DEVICE_ID_SIIG_1P_20x 0x2020
21436 +#define PCI_DEVICE_ID_SIIG_2P_20x 0x2021
21437 +#define PCI_DEVICE_ID_SIIG_2S_20x_550 0x2030
21438 +#define PCI_DEVICE_ID_SIIG_2S_20x_650 0x2031
21439 +#define PCI_DEVICE_ID_SIIG_2S_20x_850 0x2032
21440 +#define PCI_DEVICE_ID_SIIG_2P1S_20x_550 0x2040
21441 +#define PCI_DEVICE_ID_SIIG_2P1S_20x_650 0x2041
21442 +#define PCI_DEVICE_ID_SIIG_2P1S_20x_850 0x2042
21443 +#define PCI_DEVICE_ID_SIIG_1S1P_20x_550 0x2010
21444 +#define PCI_DEVICE_ID_SIIG_1S1P_20x_650 0x2011
21445 +#define PCI_DEVICE_ID_SIIG_1S1P_20x_850 0x2012
21446 +#define PCI_DEVICE_ID_SIIG_4S_20x_550 0x2050
21447 +#define PCI_DEVICE_ID_SIIG_4S_20x_650 0x2051
21448 +#define PCI_DEVICE_ID_SIIG_4S_20x_850 0x2052
21449 +#define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060
21450 +#define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061
21451 +#define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062
21452 +
21453 +#define PCI_VENDOR_ID_RADISYS 0x1331
21454 +#define PCI_DEVICE_ID_RADISYS_ENP2611 0x0030
21455 +
21456 +#define PCI_VENDOR_ID_DOMEX 0x134a
21457 +#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001
21458 +
21459 +#define PCI_VENDOR_ID_QUATECH 0x135C
21460 +#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010
21461 +#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020
21462 +#define PCI_DEVICE_ID_QUATECH_DSC200 0x0030
21463 +#define PCI_DEVICE_ID_QUATECH_QSC200 0x0040
21464 +#define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050
21465 +#define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060
21466 +
21467 +#define PCI_VENDOR_ID_SEALEVEL 0x135e
21468 +#define PCI_DEVICE_ID_SEALEVEL_U530 0x7101
21469 +#define PCI_DEVICE_ID_SEALEVEL_UCOMM2 0x7201
21470 +#define PCI_DEVICE_ID_SEALEVEL_UCOMM422 0x7402
21471 +#define PCI_DEVICE_ID_SEALEVEL_UCOMM232 0x7202
21472 +#define PCI_DEVICE_ID_SEALEVEL_COMM4 0x7401
21473 +#define PCI_DEVICE_ID_SEALEVEL_COMM8 0x7801
21474 +#define PCI_DEVICE_ID_SEALEVEL_UCOMM8 0x7804
21475 +
21476 +#define PCI_VENDOR_ID_HYPERCOPE 0x1365
21477 +#define PCI_DEVICE_ID_HYPERCOPE_PLX 0x9050
21478 +#define PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO 0x0104
21479 +#define PCI_SUBDEVICE_ID_HYPERCOPE_ERGO 0x0106
21480 +#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107
21481 +#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108
21482 +#define PCI_SUBDEVICE_ID_HYPERCOPE_PLEXUS 0x0109
21483 +
21484 +#define PCI_VENDOR_ID_KAWASAKI 0x136b
21485 +#define PCI_DEVICE_ID_MCHIP_KL5A72002 0xff01
21486 +
21487 +#define PCI_VENDOR_ID_CNET 0x1371
21488 +#define PCI_DEVICE_ID_CNET_GIGACARD 0x434e
21489 +
21490 +#define PCI_VENDOR_ID_LMC 0x1376
21491 +#define PCI_DEVICE_ID_LMC_HSSI 0x0003
21492 +#define PCI_DEVICE_ID_LMC_DS3 0x0004
21493 +#define PCI_DEVICE_ID_LMC_SSI 0x0005
21494 +#define PCI_DEVICE_ID_LMC_T1 0x0006
21495 +
21496 +#define PCI_VENDOR_ID_NETGEAR 0x1385
21497 +#define PCI_DEVICE_ID_NETGEAR_GA620 0x620a
21498 +#define PCI_DEVICE_ID_NETGEAR_GA622 0x622a
21499 +
21500 +#define PCI_VENDOR_ID_APPLICOM 0x1389
21501 +#define PCI_DEVICE_ID_APPLICOM_PCIGENERIC 0x0001
21502 +#define PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN 0x0002
21503 +#define PCI_DEVICE_ID_APPLICOM_PCI2000PFB 0x0003
21504 +
21505 +#define PCI_VENDOR_ID_MOXA 0x1393
21506 +#define PCI_DEVICE_ID_MOXA_RC7000 0x0001
21507 +#define PCI_DEVICE_ID_MOXA_CP102 0x1020
21508 +#define PCI_DEVICE_ID_MOXA_CP102UL 0x1021
21509 +#define PCI_DEVICE_ID_MOXA_CP102U 0x1022
21510 +#define PCI_DEVICE_ID_MOXA_C104 0x1040
21511 +#define PCI_DEVICE_ID_MOXA_CP104U 0x1041
21512 +#define PCI_DEVICE_ID_MOXA_CP104JU 0x1042
21513 +#define PCI_DEVICE_ID_MOXA_CT114 0x1140
21514 +#define PCI_DEVICE_ID_MOXA_CP114 0x1141
21515 +#define PCI_DEVICE_ID_MOXA_CP118U 0x1180
21516 +#define PCI_DEVICE_ID_MOXA_CP132 0x1320
21517 +#define PCI_DEVICE_ID_MOXA_CP132U 0x1321
21518 +#define PCI_DEVICE_ID_MOXA_CP134U 0x1340
21519 +#define PCI_DEVICE_ID_MOXA_C168 0x1680
21520 +#define PCI_DEVICE_ID_MOXA_CP168U 0x1681
21521 +#define PCI_DEVICE_ID_MOXA_CP204J 0x2040
21522 +#define PCI_DEVICE_ID_MOXA_C218 0x2180
21523 +#define PCI_DEVICE_ID_MOXA_C320 0x3200
21524 +
21525 +#define PCI_VENDOR_ID_CCD 0x1397
21526 +#define PCI_DEVICE_ID_CCD_2BD0 0x2bd0
21527 +#define PCI_DEVICE_ID_CCD_B000 0xb000
21528 +#define PCI_DEVICE_ID_CCD_B006 0xb006
21529 +#define PCI_DEVICE_ID_CCD_B007 0xb007
21530 +#define PCI_DEVICE_ID_CCD_B008 0xb008
21531 +#define PCI_DEVICE_ID_CCD_B009 0xb009
21532 +#define PCI_DEVICE_ID_CCD_B00A 0xb00a
21533 +#define PCI_DEVICE_ID_CCD_B00B 0xb00b
21534 +#define PCI_DEVICE_ID_CCD_B00C 0xb00c
21535 +#define PCI_DEVICE_ID_CCD_B100 0xb100
21536 +
21537 +#define PCI_VENDOR_ID_EXAR 0x13a8
21538 +#define PCI_DEVICE_ID_EXAR_XR17C152 0x0152
21539 +#define PCI_DEVICE_ID_EXAR_XR17C154 0x0154
21540 +#define PCI_DEVICE_ID_EXAR_XR17C158 0x0158
21541 +
21542 +#define PCI_VENDOR_ID_MICROGATE 0x13c0
21543 +#define PCI_DEVICE_ID_MICROGATE_USC 0x0010
21544 +#define PCI_DEVICE_ID_MICROGATE_SCC 0x0020
21545 +#define PCI_DEVICE_ID_MICROGATE_SCA 0x0030
21546 +#define PCI_DEVICE_ID_MICROGATE_USC2 0x0210
21547 +
21548 +#define PCI_VENDOR_ID_3WARE 0x13C1
21549 +#define PCI_DEVICE_ID_3WARE_1000 0x1000
21550 +#define PCI_DEVICE_ID_3WARE_7000 0x1001
21551 +#define PCI_DEVICE_ID_3WARE_9000 0x1002
21552 +
21553 +#define PCI_VENDOR_ID_IOMEGA 0x13ca
21554 +#define PCI_DEVICE_ID_IOMEGA_BUZ 0x4231
21555 +
21556 +#define PCI_VENDOR_ID_ABOCOM 0x13D1
21557 +#define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1
21558 +
21559 +#define PCI_VENDOR_ID_CMEDIA 0x13f6
21560 +#define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100
21561 +#define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101
21562 +#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111
21563 +#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112
21564 +
21565 +#define PCI_VENDOR_ID_LAVA 0x1407
21566 +#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */
21567 +#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */
21568 +#define PCI_DEVICE_ID_LAVA_QUATRO_B 0x0102 /* 2x 16550, half of 4 port */
21569 +#define PCI_DEVICE_ID_LAVA_OCTO_A 0x0180 /* 4x 16550A, half of 8 port */
21570 +#define PCI_DEVICE_ID_LAVA_OCTO_B 0x0181 /* 4x 16550A, half of 8 port */
21571 +#define PCI_DEVICE_ID_LAVA_PORT_PLUS 0x0200 /* 2x 16650 */
21572 +#define PCI_DEVICE_ID_LAVA_QUAD_A 0x0201 /* 2x 16650, half of 4 port */
21573 +#define PCI_DEVICE_ID_LAVA_QUAD_B 0x0202 /* 2x 16650, half of 4 port */
21574 +#define PCI_DEVICE_ID_LAVA_SSERIAL 0x0500 /* 1x 16550 */
21575 +#define PCI_DEVICE_ID_LAVA_PORT_650 0x0600 /* 1x 16650 */
21576 +#define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000
21577 +#define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 /* The Lava Dual Parallel is */
21578 +#define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 /* two PCI devices on a card */
21579 +#define PCI_DEVICE_ID_LAVA_BOCA_IOPPAR 0x8800
21580 +
21581 +#define PCI_VENDOR_ID_TIMEDIA 0x1409
21582 +#define PCI_DEVICE_ID_TIMEDIA_1889 0x7168
21583 +
21584 +#define PCI_VENDOR_ID_OXSEMI 0x1415
21585 +#define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403
21586 +#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501
21587 +#define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511
21588 +#define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513
21589 +#define PCI_DEVICE_ID_OXSEMI_16PCI952 0x9521
21590 +
21591 +#define PCI_VENDOR_ID_SAMSUNG 0x144d
21592 +
21593 +#define PCI_VENDOR_ID_AIRONET 0x14b9
21594 +#define PCI_DEVICE_ID_AIRONET_4800_1 0x0001
21595 +#define PCI_DEVICE_ID_AIRONET_4800 0x4500 // values switched? see
21596 +#define PCI_DEVICE_ID_AIRONET_4500 0x4800 // drivers/net/aironet4500_card.c
21597 +
21598 +#define PCI_VENDOR_ID_TITAN 0x14D2
21599 +#define PCI_DEVICE_ID_TITAN_010L 0x8001
21600 +#define PCI_DEVICE_ID_TITAN_100L 0x8010
21601 +#define PCI_DEVICE_ID_TITAN_110L 0x8011
21602 +#define PCI_DEVICE_ID_TITAN_200L 0x8020
21603 +#define PCI_DEVICE_ID_TITAN_210L 0x8021
21604 +#define PCI_DEVICE_ID_TITAN_400L 0x8040
21605 +#define PCI_DEVICE_ID_TITAN_800L 0x8080
21606 +#define PCI_DEVICE_ID_TITAN_100 0xA001
21607 +#define PCI_DEVICE_ID_TITAN_200 0xA005
21608 +#define PCI_DEVICE_ID_TITAN_400 0xA003
21609 +#define PCI_DEVICE_ID_TITAN_800B 0xA004
21610 +
21611 +#define PCI_VENDOR_ID_PANACOM 0x14d4
21612 +#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400
21613 +#define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402
21614 +
21615 +#define PCI_VENDOR_ID_SIPACKETS 0x14d9
21616 +#define PCI_DEVICE_ID_SP_HT 0x0010
21617 +
21618 +#define PCI_VENDOR_ID_AFAVLAB 0x14db
21619 +#define PCI_DEVICE_ID_AFAVLAB_P028 0x2180
21620 +#define PCI_DEVICE_ID_AFAVLAB_P030 0x2182
21621 +
21622 +#define PCI_VENDOR_ID_BROADCOM 0x14e4
21623 +#define PCI_DEVICE_ID_TIGON3_5752 0x1600
21624 +#define PCI_DEVICE_ID_TIGON3_5752M 0x1601
21625 +#define PCI_DEVICE_ID_TIGON3_5700 0x1644
21626 +#define PCI_DEVICE_ID_TIGON3_5701 0x1645
21627 +#define PCI_DEVICE_ID_TIGON3_5702 0x1646
21628 +#define PCI_DEVICE_ID_TIGON3_5703 0x1647
21629 +#define PCI_DEVICE_ID_TIGON3_5704 0x1648
21630 +#define PCI_DEVICE_ID_TIGON3_5704S_2 0x1649
21631 +#define PCI_DEVICE_ID_NX2_5706 0x164a
21632 +#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d
21633 +#define PCI_DEVICE_ID_TIGON3_5705 0x1653
21634 +#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
21635 +#define PCI_DEVICE_ID_TIGON3_5720 0x1658
21636 +#define PCI_DEVICE_ID_TIGON3_5721 0x1659
21637 +#define PCI_DEVICE_ID_TIGON3_5705M 0x165d
21638 +#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e
21639 +#define PCI_DEVICE_ID_TIGON3_5705F 0x166e
21640 +#define PCI_DEVICE_ID_TIGON3_5750 0x1676
21641 +#define PCI_DEVICE_ID_TIGON3_5751 0x1677
21642 +#define PCI_DEVICE_ID_TIGON3_5750M 0x167c
21643 +#define PCI_DEVICE_ID_TIGON3_5751M 0x167d
21644 +#define PCI_DEVICE_ID_TIGON3_5751F 0x167e
21645 +#define PCI_DEVICE_ID_TIGON3_5782 0x1696
21646 +#define PCI_DEVICE_ID_TIGON3_5788 0x169c
21647 +#define PCI_DEVICE_ID_TIGON3_5789 0x169d
21648 +#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6
21649 +#define PCI_DEVICE_ID_TIGON3_5703X 0x16a7
21650 +#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8
21651 +#define PCI_DEVICE_ID_NX2_5706S 0x16aa
21652 +#define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6
21653 +#define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7
21654 +#define PCI_DEVICE_ID_TIGON3_5781 0x16dd
21655 +#define PCI_DEVICE_ID_TIGON3_5753 0x16f7
21656 +#define PCI_DEVICE_ID_TIGON3_5753M 0x16fd
21657 +#define PCI_DEVICE_ID_TIGON3_5753F 0x16fe
21658 +#define PCI_DEVICE_ID_TIGON3_5901 0x170d
21659 +#define PCI_DEVICE_ID_BCM4401B1 0x170c
21660 +#define PCI_DEVICE_ID_TIGON3_5901_2 0x170e
21661 +#define PCI_DEVICE_ID_BCM4401 0x4401
21662 +#define PCI_DEVICE_ID_BCM4401B0 0x4402
21663 +
21664 +#define PCI_VENDOR_ID_TOPIC 0x151f
21665 +#define PCI_DEVICE_ID_TOPIC_TP560 0x0000
21666 +
21667 +#define PCI_VENDOR_ID_ENE 0x1524
21668 +#define PCI_DEVICE_ID_ENE_1211 0x1211
21669 +#define PCI_DEVICE_ID_ENE_1225 0x1225
21670 +#define PCI_DEVICE_ID_ENE_1410 0x1410
21671 +#define PCI_DEVICE_ID_ENE_1420 0x1420
21672 +
21673 +#define PCI_VENDOR_ID_SYBA 0x1592
21674 +#define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782
21675 +#define PCI_DEVICE_ID_SYBA_1P_ECP 0x0783
21676 +
21677 +#define PCI_VENDOR_ID_MORETON 0x15aa
21678 +#define PCI_DEVICE_ID_RASTEL_2PORT 0x2000
21679 +
21680 +#define PCI_VENDOR_ID_ZOLTRIX 0x15b0
21681 +#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0
21682 +
21683 +#define PCI_VENDOR_ID_MELLANOX 0x15b3
21684 +#define PCI_DEVICE_ID_MELLANOX_TAVOR 0x5a44
21685 +#define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278
21686 +#define PCI_DEVICE_ID_MELLANOX_ARBEL 0x6282
21687 +#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c
21688 +#define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274
21689 +
21690 +#define PCI_VENDOR_ID_PDC 0x15e9
21691 +#define PCI_DEVICE_ID_PDC_1841 0x1841
21692 +
21693 +#define PCI_VENDOR_ID_MACROLINK 0x15ed
21694 +#define PCI_DEVICE_ID_MACROLINK_MCCS8 0x1000
21695 +#define PCI_DEVICE_ID_MACROLINK_MCCS 0x1001
21696 +#define PCI_DEVICE_ID_MACROLINK_MCCS8H 0x1002
21697 +#define PCI_DEVICE_ID_MACROLINK_MCCSH 0x1003
21698 +#define PCI_DEVICE_ID_MACROLINK_MCCR8 0x2000
21699 +#define PCI_DEVICE_ID_MACROLINK_MCCR 0x2001
21700 +
21701 +#define PCI_VENDOR_ID_FARSITE 0x1619
21702 +#define PCI_DEVICE_ID_FARSITE_T2P 0x0400
21703 +#define PCI_DEVICE_ID_FARSITE_T4P 0x0440
21704 +#define PCI_DEVICE_ID_FARSITE_T1U 0x0610
21705 +#define PCI_DEVICE_ID_FARSITE_T2U 0x0620
21706 +#define PCI_DEVICE_ID_FARSITE_T4U 0x0640
21707 +#define PCI_DEVICE_ID_FARSITE_TE1 0x1610
21708 +#define PCI_DEVICE_ID_FARSITE_TE1C 0x1612
21709 +
21710 +#define PCI_VENDOR_ID_SIBYTE 0x166d
21711 +#define PCI_DEVICE_ID_BCM1250_HT 0x0002
21712 +
21713 +#define PCI_VENDOR_ID_LINKSYS 0x1737
21714 +#define PCI_DEVICE_ID_LINKSYS_EG1032 0x1032
21715 +#define PCI_DEVICE_ID_LINKSYS_EG1064 0x1064
21716 +
21717 +#define PCI_VENDOR_ID_ALTIMA 0x173b
21718 +#define PCI_DEVICE_ID_ALTIMA_AC1000 0x03e8
21719 +#define PCI_DEVICE_ID_ALTIMA_AC1001 0x03e9
21720 +#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea
21721 +#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb
21722 +
21723 +#define PCI_VENDOR_ID_S2IO 0x17d5
21724 +#define PCI_DEVICE_ID_S2IO_WIN 0x5731
21725 +#define PCI_DEVICE_ID_S2IO_UNI 0x5831
21726 +#define PCI_DEVICE_ID_HERC_WIN 0x5732
21727 +#define PCI_DEVICE_ID_HERC_UNI 0x5832
21728 +
21729 +#define PCI_VENDOR_ID_INFINICON 0x1820
21730 +
21731 +#define PCI_VENDOR_ID_TOPSPIN 0x1867
21732 +
21733 +#define PCI_VENDOR_ID_TDI 0x192E
21734 +#define PCI_DEVICE_ID_TDI_EHCI 0x0101
21735 +
21736 +#define PCI_VENDOR_ID_SYMPHONY 0x1c1c
21737 +#define PCI_DEVICE_ID_SYMPHONY_101 0x0001
21738 +
21739 +#define PCI_VENDOR_ID_TEKRAM 0x1de1
21740 +#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
21741 +
21742 +#define PCI_VENDOR_ID_HINT 0x3388
21743 +#define PCI_DEVICE_ID_HINT_VXPROII_IDE 0x8013
21744 +
21745 +#define PCI_VENDOR_ID_3DLABS 0x3d3d
21746 +#define PCI_DEVICE_ID_3DLABS_300SX 0x0001
21747 +#define PCI_DEVICE_ID_3DLABS_500TX 0x0002
21748 +#define PCI_DEVICE_ID_3DLABS_DELTA 0x0003
21749 +#define PCI_DEVICE_ID_3DLABS_PERMEDIA 0x0004
21750 +#define PCI_DEVICE_ID_3DLABS_MX 0x0006
21751 +#define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007
21752 +#define PCI_DEVICE_ID_3DLABS_GAMMA 0x0008
21753 +#define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009
21754 +
21755 +#define PCI_VENDOR_ID_AVANCE 0x4005
21756 +#define PCI_DEVICE_ID_AVANCE_ALG2064 0x2064
21757 +#define PCI_DEVICE_ID_AVANCE_2302 0x2302
21758 +
21759 +#define PCI_VENDOR_ID_AKS 0x416c
21760 +#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100
21761 +#define PCI_DEVICE_ID_AKS_CPC 0x0200
21762 +
21763 +#define PCI_VENDOR_ID_REDCREEK 0x4916
21764 +#define PCI_DEVICE_ID_RC45 0x1960
21765 +
21766 +#define PCI_VENDOR_ID_NETVIN 0x4a14
21767 +#define PCI_DEVICE_ID_NETVIN_NV5000SC 0x5000
21768 +
21769 +#define PCI_VENDOR_ID_S3 0x5333
21770 +#define PCI_DEVICE_ID_S3_PLATO_PXS 0x0551
21771 +#define PCI_DEVICE_ID_S3_ViRGE 0x5631
21772 +#define PCI_DEVICE_ID_S3_TRIO 0x8811
21773 +#define PCI_DEVICE_ID_S3_AURORA64VP 0x8812
21774 +#define PCI_DEVICE_ID_S3_TRIO64UVP 0x8814
21775 +#define PCI_DEVICE_ID_S3_ViRGE_VX 0x883d
21776 +#define PCI_DEVICE_ID_S3_868 0x8880
21777 +#define PCI_DEVICE_ID_S3_928 0x88b0
21778 +#define PCI_DEVICE_ID_S3_864_1 0x88c0
21779 +#define PCI_DEVICE_ID_S3_864_2 0x88c1
21780 +#define PCI_DEVICE_ID_S3_964_1 0x88d0
21781 +#define PCI_DEVICE_ID_S3_964_2 0x88d1
21782 +#define PCI_DEVICE_ID_S3_968 0x88f0
21783 +#define PCI_DEVICE_ID_S3_TRIO64V2 0x8901
21784 +#define PCI_DEVICE_ID_S3_PLATO_PXG 0x8902
21785 +#define PCI_DEVICE_ID_S3_ViRGE_DXGX 0x8a01
21786 +#define PCI_DEVICE_ID_S3_ViRGE_GX2 0x8a10
21787 +#define PCI_DEVICE_ID_S3_SAVAGE4 0x8a25
21788 +#define PCI_DEVICE_ID_S3_ViRGE_MX 0x8c01
21789 +#define PCI_DEVICE_ID_S3_ViRGE_MXP 0x8c02
21790 +#define PCI_DEVICE_ID_S3_ViRGE_MXPMV 0x8c03
21791 +#define PCI_DEVICE_ID_S3_PROSAVAGE8 0x8d04
21792 +#define PCI_DEVICE_ID_S3_SONICVIBES 0xca00
21793 +
21794 +#define PCI_VENDOR_ID_DUNORD 0x5544
21795 +#define PCI_DEVICE_ID_DUNORD_I3000 0x0001
21796 +
21797 +#define PCI_VENDOR_ID_DCI 0x6666
21798 +#define PCI_DEVICE_ID_DCI_PCCOM4 0x0001
21799 +#define PCI_DEVICE_ID_DCI_PCCOM8 0x0002
21800 +
21801 +#define PCI_VENDOR_ID_DUNORD 0x5544
21802 +#define PCI_DEVICE_ID_DUNORD_I3000 0x0001
21803 +
21804 +#define PCI_VENDOR_ID_GENROCO 0x5555
21805 +#define PCI_DEVICE_ID_GENROCO_HFP832 0x0003
21806 +
21807 +#define PCI_VENDOR_ID_INTEL 0x8086
21808 +#define PCI_DEVICE_ID_INTEL_EESSC 0x0008
21809 +#define PCI_DEVICE_ID_INTEL_21145 0x0039
21810 +#define PCI_DEVICE_ID_INTEL_82375 0x0482
21811 +#define PCI_DEVICE_ID_INTEL_82424 0x0483
21812 +#define PCI_DEVICE_ID_INTEL_82378 0x0484
21813 +#define PCI_DEVICE_ID_INTEL_82430 0x0486
21814 +#define PCI_DEVICE_ID_INTEL_82434 0x04a3
21815 +#define PCI_DEVICE_ID_INTEL_I960 0x0960
21816 +#define PCI_DEVICE_ID_INTEL_I960RM 0x0962
21817 +#define PCI_DEVICE_ID_INTEL_82562ET 0x1031
21818 +#define PCI_DEVICE_ID_INTEL_82801CAM 0x1038
21819 +#define PCI_DEVICE_ID_INTEL_82815_MC 0x1130
21820 +#define PCI_DEVICE_ID_INTEL_82815_AB 0x1131
21821 +#define PCI_DEVICE_ID_INTEL_82815_CGC 0x1132
21822 +#define PCI_DEVICE_ID_INTEL_82559ER 0x1209
21823 +#define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221
21824 +#define PCI_DEVICE_ID_INTEL_82092AA_1 0x1222
21825 +#define PCI_DEVICE_ID_INTEL_7116 0x1223
21826 +#define PCI_DEVICE_ID_INTEL_7505_0 0x2550
21827 +#define PCI_DEVICE_ID_INTEL_7505_1 0x2552
21828 +#define PCI_DEVICE_ID_INTEL_7205_0 0x255d
21829 +#define PCI_DEVICE_ID_INTEL_82596 0x1226
21830 +#define PCI_DEVICE_ID_INTEL_82865 0x1227
21831 +#define PCI_DEVICE_ID_INTEL_82557 0x1229
21832 +#define PCI_DEVICE_ID_INTEL_82437 0x122d
21833 +#define PCI_DEVICE_ID_INTEL_82371FB_0 0x122e
21834 +#define PCI_DEVICE_ID_INTEL_82371FB_1 0x1230
21835 +#define PCI_DEVICE_ID_INTEL_82371MX 0x1234
21836 +#define PCI_DEVICE_ID_INTEL_82437MX 0x1235
21837 +#define PCI_DEVICE_ID_INTEL_82441 0x1237
21838 +#define PCI_DEVICE_ID_INTEL_82380FB 0x124b
21839 +#define PCI_DEVICE_ID_INTEL_82439 0x1250
21840 +#define PCI_DEVICE_ID_INTEL_80960_RP 0x1960
21841 +#define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21
21842 +#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30
21843 +#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410
21844 +#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411
21845 +#define PCI_DEVICE_ID_INTEL_82801AA_2 0x2412
21846 +#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413
21847 +#define PCI_DEVICE_ID_INTEL_82801AA_5 0x2415
21848 +#define PCI_DEVICE_ID_INTEL_82801AA_6 0x2416
21849 +#define PCI_DEVICE_ID_INTEL_82801AA_8 0x2418
21850 +#define PCI_DEVICE_ID_INTEL_82801AB_0 0x2420
21851 +#define PCI_DEVICE_ID_INTEL_82801AB_1 0x2421
21852 +#define PCI_DEVICE_ID_INTEL_82801AB_2 0x2422
21853 +#define PCI_DEVICE_ID_INTEL_82801AB_3 0x2423
21854 +#define PCI_DEVICE_ID_INTEL_82801AB_5 0x2425
21855 +#define PCI_DEVICE_ID_INTEL_82801AB_6 0x2426
21856 +#define PCI_DEVICE_ID_INTEL_82801AB_8 0x2428
21857 +#define PCI_DEVICE_ID_INTEL_82801BA_0 0x2440
21858 +#define PCI_DEVICE_ID_INTEL_82801BA_1 0x2442
21859 +#define PCI_DEVICE_ID_INTEL_82801BA_2 0x2443
21860 +#define PCI_DEVICE_ID_INTEL_82801BA_3 0x2444
21861 +#define PCI_DEVICE_ID_INTEL_82801BA_4 0x2445
21862 +#define PCI_DEVICE_ID_INTEL_82801BA_5 0x2446
21863 +#define PCI_DEVICE_ID_INTEL_82801BA_6 0x2448
21864 +#define PCI_DEVICE_ID_INTEL_82801BA_7 0x2449
21865 +#define PCI_DEVICE_ID_INTEL_82801BA_8 0x244a
21866 +#define PCI_DEVICE_ID_INTEL_82801BA_9 0x244b
21867 +#define PCI_DEVICE_ID_INTEL_82801BA_10 0x244c
21868 +#define PCI_DEVICE_ID_INTEL_82801BA_11 0x244e
21869 +#define PCI_DEVICE_ID_INTEL_82801E_0 0x2450
21870 +#define PCI_DEVICE_ID_INTEL_82801E_2 0x2452
21871 +#define PCI_DEVICE_ID_INTEL_82801E_3 0x2453
21872 +#define PCI_DEVICE_ID_INTEL_82801E_9 0x2459
21873 +#define PCI_DEVICE_ID_INTEL_82801E_11 0x245b
21874 +#define PCI_DEVICE_ID_INTEL_82801E_13 0x245d
21875 +#define PCI_DEVICE_ID_INTEL_82801E_14 0x245e
21876 +#define PCI_DEVICE_ID_INTEL_82801CA_0 0x2480
21877 +#define PCI_DEVICE_ID_INTEL_82801CA_2 0x2482
21878 +#define PCI_DEVICE_ID_INTEL_82801CA_3 0x2483
21879 +#define PCI_DEVICE_ID_INTEL_82801CA_4 0x2484
21880 +#define PCI_DEVICE_ID_INTEL_82801CA_5 0x2485
21881 +#define PCI_DEVICE_ID_INTEL_82801CA_6 0x2486
21882 +#define PCI_DEVICE_ID_INTEL_82801CA_7 0x2487
21883 +#define PCI_DEVICE_ID_INTEL_82801CA_10 0x248a
21884 +#define PCI_DEVICE_ID_INTEL_82801CA_11 0x248b
21885 +#define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c
21886 +#define PCI_DEVICE_ID_INTEL_82801DB_0 0x24c0
21887 +#define PCI_DEVICE_ID_INTEL_82801DB_1 0x24c1
21888 +#define PCI_DEVICE_ID_INTEL_82801DB_2 0x24c2
21889 +#define PCI_DEVICE_ID_INTEL_82801DB_3 0x24c3
21890 +#define PCI_DEVICE_ID_INTEL_82801DB_4 0x24c4
21891 +#define PCI_DEVICE_ID_INTEL_82801DB_5 0x24c5
21892 +#define PCI_DEVICE_ID_INTEL_82801DB_6 0x24c6
21893 +#define PCI_DEVICE_ID_INTEL_82801DB_7 0x24c7
21894 +#define PCI_DEVICE_ID_INTEL_82801DB_9 0x24c9
21895 +#define PCI_DEVICE_ID_INTEL_82801DB_10 0x24ca
21896 +#define PCI_DEVICE_ID_INTEL_82801DB_11 0x24cb
21897 +#define PCI_DEVICE_ID_INTEL_82801DB_12 0x24cc
21898 +#define PCI_DEVICE_ID_INTEL_82801DB_13 0x24cd
21899 +#define PCI_DEVICE_ID_INTEL_82801EB_0 0x24d0
21900 +#define PCI_DEVICE_ID_INTEL_82801EB_1 0x24d1
21901 +#define PCI_DEVICE_ID_INTEL_82801EB_2 0x24d2
21902 +#define PCI_DEVICE_ID_INTEL_82801EB_3 0x24d3
21903 +#define PCI_DEVICE_ID_INTEL_82801EB_4 0x24d4
21904 +#define PCI_DEVICE_ID_INTEL_82801EB_5 0x24d5
21905 +#define PCI_DEVICE_ID_INTEL_82801EB_6 0x24d6
21906 +#define PCI_DEVICE_ID_INTEL_82801EB_7 0x24d7
21907 +#define PCI_DEVICE_ID_INTEL_82801EB_11 0x24db
21908 +#define PCI_DEVICE_ID_INTEL_82801EB_13 0x24dd
21909 +#define PCI_DEVICE_ID_INTEL_ESB_1 0x25a1
21910 +#define PCI_DEVICE_ID_INTEL_ESB_2 0x25a2
21911 +#define PCI_DEVICE_ID_INTEL_ESB_3 0x25a3
21912 +#define PCI_DEVICE_ID_INTEL_ESB_31 0x25b0
21913 +#define PCI_DEVICE_ID_INTEL_ESB_4 0x25a4
21914 +#define PCI_DEVICE_ID_INTEL_ESB_5 0x25a6
21915 +#define PCI_DEVICE_ID_INTEL_ESB_6 0x25a7
21916 +#define PCI_DEVICE_ID_INTEL_ESB_7 0x25a9
21917 +#define PCI_DEVICE_ID_INTEL_ESB_8 0x25aa
21918 +#define PCI_DEVICE_ID_INTEL_ESB_9 0x25ab
21919 +#define PCI_DEVICE_ID_INTEL_ESB_11 0x25ac
21920 +#define PCI_DEVICE_ID_INTEL_ESB_12 0x25ad
21921 +#define PCI_DEVICE_ID_INTEL_ESB_13 0x25ae
21922 +#define PCI_DEVICE_ID_INTEL_82820_HB 0x2500
21923 +#define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501
21924 +#define PCI_DEVICE_ID_INTEL_82850_HB 0x2530
21925 +#define PCI_DEVICE_ID_INTEL_82860_HB 0x2531
21926 +#define PCI_DEVICE_ID_INTEL_82845G_HB 0x2560
21927 +#define PCI_DEVICE_ID_INTEL_82845G_IG 0x2562
21928 +#define PCI_DEVICE_ID_INTEL_82865_HB 0x2570
21929 +#define PCI_DEVICE_ID_INTEL_82865_IG 0x2572
21930 +#define PCI_DEVICE_ID_INTEL_82875_HB 0x2578
21931 +#define PCI_DEVICE_ID_INTEL_82875_IG 0x257b
21932 +#define PCI_DEVICE_ID_INTEL_82915G_HB 0x2580
21933 +#define PCI_DEVICE_ID_INTEL_82915G_IG 0x2582
21934 +#define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590
21935 +#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592
21936 +#define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770
21937 +#define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772
21938 +#define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640
21939 +#define PCI_DEVICE_ID_INTEL_ICH6_1 0x2641
21940 +#define PCI_DEVICE_ID_INTEL_ICH6_2 0x2642
21941 +#define PCI_DEVICE_ID_INTEL_ICH6_3 0x2651
21942 +#define PCI_DEVICE_ID_INTEL_ICH6_4 0x2652
21943 +#define PCI_DEVICE_ID_INTEL_ICH6_5 0x2653
21944 +#define PCI_DEVICE_ID_INTEL_ICH6_6 0x2658
21945 +#define PCI_DEVICE_ID_INTEL_ICH6_7 0x2659
21946 +#define PCI_DEVICE_ID_INTEL_ICH6_8 0x265a
21947 +#define PCI_DEVICE_ID_INTEL_ICH6_9 0x265b
21948 +#define PCI_DEVICE_ID_INTEL_ICH6_10 0x265c
21949 +#define PCI_DEVICE_ID_INTEL_ICH6_11 0x2660
21950 +#define PCI_DEVICE_ID_INTEL_ICH6_12 0x2662
21951 +#define PCI_DEVICE_ID_INTEL_ICH6_13 0x2664
21952 +#define PCI_DEVICE_ID_INTEL_ICH6_14 0x2666
21953 +#define PCI_DEVICE_ID_INTEL_ICH6_15 0x2668
21954 +#define PCI_DEVICE_ID_INTEL_ICH6_16 0x266a
21955 +#define PCI_DEVICE_ID_INTEL_ICH6_17 0x266d
21956 +#define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e
21957 +#define PCI_DEVICE_ID_INTEL_ICH6_19 0x266f
21958 +#define PCI_DEVICE_ID_INTEL_ESB2_0 0x2670
21959 +#define PCI_DEVICE_ID_INTEL_ESB2_1 0x2680
21960 +#define PCI_DEVICE_ID_INTEL_ESB2_2 0x2681
21961 +#define PCI_DEVICE_ID_INTEL_ESB2_3 0x2682
21962 +#define PCI_DEVICE_ID_INTEL_ESB2_4 0x2683
21963 +#define PCI_DEVICE_ID_INTEL_ESB2_5 0x2688
21964 +#define PCI_DEVICE_ID_INTEL_ESB2_6 0x2689
21965 +#define PCI_DEVICE_ID_INTEL_ESB2_7 0x268a
21966 +#define PCI_DEVICE_ID_INTEL_ESB2_8 0x268b
21967 +#define PCI_DEVICE_ID_INTEL_ESB2_9 0x268c
21968 +#define PCI_DEVICE_ID_INTEL_ESB2_10 0x2690
21969 +#define PCI_DEVICE_ID_INTEL_ESB2_11 0x2692
21970 +#define PCI_DEVICE_ID_INTEL_ESB2_12 0x2694
21971 +#define PCI_DEVICE_ID_INTEL_ESB2_13 0x2696
21972 +#define PCI_DEVICE_ID_INTEL_ESB2_14 0x2698
21973 +#define PCI_DEVICE_ID_INTEL_ESB2_15 0x2699
21974 +#define PCI_DEVICE_ID_INTEL_ESB2_16 0x269a
21975 +#define PCI_DEVICE_ID_INTEL_ESB2_17 0x269b
21976 +#define PCI_DEVICE_ID_INTEL_ESB2_18 0x269e
21977 +#define PCI_DEVICE_ID_INTEL_ICH7_0 0x27b8
21978 +#define PCI_DEVICE_ID_INTEL_ICH7_1 0x27b9
21979 +#define PCI_DEVICE_ID_INTEL_ICH7_2 0x27c0
21980 +#define PCI_DEVICE_ID_INTEL_ICH7_3 0x27c1
21981 +#define PCI_DEVICE_ID_INTEL_ICH7_30 0x27b0
21982 +#define PCI_DEVICE_ID_INTEL_ICH7_31 0x27bd
21983 +#define PCI_DEVICE_ID_INTEL_ICH7_5 0x27c4
21984 +#define PCI_DEVICE_ID_INTEL_ICH7_6 0x27c5
21985 +#define PCI_DEVICE_ID_INTEL_ICH7_7 0x27c8
21986 +#define PCI_DEVICE_ID_INTEL_ICH7_8 0x27c9
21987 +#define PCI_DEVICE_ID_INTEL_ICH7_9 0x27ca
21988 +#define PCI_DEVICE_ID_INTEL_ICH7_10 0x27cb
21989 +#define PCI_DEVICE_ID_INTEL_ICH7_11 0x27cc
21990 +#define PCI_DEVICE_ID_INTEL_ICH7_12 0x27d0
21991 +#define PCI_DEVICE_ID_INTEL_ICH7_13 0x27d2
21992 +#define PCI_DEVICE_ID_INTEL_ICH7_14 0x27d4
21993 +#define PCI_DEVICE_ID_INTEL_ICH7_15 0x27d6
21994 +#define PCI_DEVICE_ID_INTEL_ICH7_16 0x27d8
21995 +#define PCI_DEVICE_ID_INTEL_ICH7_17 0x27da
21996 +#define PCI_DEVICE_ID_INTEL_ICH7_18 0x27dc
21997 +#define PCI_DEVICE_ID_INTEL_ICH7_19 0x27dd
21998 +#define PCI_DEVICE_ID_INTEL_ICH7_20 0x27de
21999 +#define PCI_DEVICE_ID_INTEL_ICH7_21 0x27df
22000 +#define PCI_DEVICE_ID_INTEL_ICH7_22 0x27e0
22001 +#define PCI_DEVICE_ID_INTEL_ICH7_23 0x27e2
22002 +#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
22003 +#define PCI_DEVICE_ID_INTEL_ESB2_19 0x3500
22004 +#define PCI_DEVICE_ID_INTEL_ESB2_20 0x3501
22005 +#define PCI_DEVICE_ID_INTEL_ESB2_21 0x3504
22006 +#define PCI_DEVICE_ID_INTEL_ESB2_22 0x3505
22007 +#define PCI_DEVICE_ID_INTEL_ESB2_23 0x350c
22008 +#define PCI_DEVICE_ID_INTEL_ESB2_24 0x350d
22009 +#define PCI_DEVICE_ID_INTEL_ESB2_25 0x3510
22010 +#define PCI_DEVICE_ID_INTEL_ESB2_26 0x3511
22011 +#define PCI_DEVICE_ID_INTEL_ESB2_27 0x3514
22012 +#define PCI_DEVICE_ID_INTEL_ESB2_28 0x3515
22013 +#define PCI_DEVICE_ID_INTEL_ESB2_29 0x3518
22014 +#define PCI_DEVICE_ID_INTEL_ESB2_30 0x3519
22015 +#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
22016 +#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
22017 +#define PCI_DEVICE_ID_INTEL_82855GM_HB 0x3580
22018 +#define PCI_DEVICE_ID_INTEL_82855GM_IG 0x3582
22019 +#define PCI_DEVICE_ID_INTEL_E7520_MCH 0x3590
22020 +#define PCI_DEVICE_ID_INTEL_E7320_MCH 0x3592
22021 +#define PCI_DEVICE_ID_INTEL_MCH_PA 0x3595
22022 +#define PCI_DEVICE_ID_INTEL_MCH_PA1 0x3596
22023 +#define PCI_DEVICE_ID_INTEL_MCH_PB 0x3597
22024 +#define PCI_DEVICE_ID_INTEL_MCH_PB1 0x3598
22025 +#define PCI_DEVICE_ID_INTEL_MCH_PC 0x3599
22026 +#define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a
22027 +#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e
22028 +#define PCI_DEVICE_ID_INTEL_80310 0x530d
22029 +#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000
22030 +#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010
22031 +#define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020
22032 +#define PCI_DEVICE_ID_INTEL_82437VX 0x7030
22033 +#define PCI_DEVICE_ID_INTEL_82439TX 0x7100
22034 +#define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110
22035 +#define PCI_DEVICE_ID_INTEL_82371AB 0x7111
22036 +#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112
22037 +#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113
22038 +#define PCI_DEVICE_ID_INTEL_82810_MC1 0x7120
22039 +#define PCI_DEVICE_ID_INTEL_82810_IG1 0x7121
22040 +#define PCI_DEVICE_ID_INTEL_82810_MC3 0x7122
22041 +#define PCI_DEVICE_ID_INTEL_82810_IG3 0x7123
22042 +#define PCI_DEVICE_ID_INTEL_82810E_MC 0x7124
22043 +#define PCI_DEVICE_ID_INTEL_82810E_IG 0x7125
22044 +#define PCI_DEVICE_ID_INTEL_82443LX_0 0x7180
22045 +#define PCI_DEVICE_ID_INTEL_82443LX_1 0x7181
22046 +#define PCI_DEVICE_ID_INTEL_82443BX_0 0x7190
22047 +#define PCI_DEVICE_ID_INTEL_82443BX_1 0x7191
22048 +#define PCI_DEVICE_ID_INTEL_82443BX_2 0x7192
22049 +#define PCI_DEVICE_ID_INTEL_440MX 0x7195
22050 +#define PCI_DEVICE_ID_INTEL_82443MX_0 0x7198
22051 +#define PCI_DEVICE_ID_INTEL_82443MX_1 0x7199
22052 +#define PCI_DEVICE_ID_INTEL_82443MX_2 0x719a
22053 +#define PCI_DEVICE_ID_INTEL_82443MX_3 0x719b
22054 +#define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0
22055 +#define PCI_DEVICE_ID_INTEL_82443GX_1 0x71a1
22056 +#define PCI_DEVICE_ID_INTEL_82443GX_2 0x71a2
22057 +#define PCI_DEVICE_ID_INTEL_82372FB_0 0x7600
22058 +#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601
22059 +#define PCI_DEVICE_ID_INTEL_82372FB_2 0x7602
22060 +#define PCI_DEVICE_ID_INTEL_82372FB_3 0x7603
22061 +#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4
22062 +#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5
22063 +#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca
22064 +#define PCI_DEVICE_ID_INTEL_82454NX 0x84cb
22065 +#define PCI_DEVICE_ID_INTEL_84460GX 0x84ea
22066 +#define PCI_DEVICE_ID_INTEL_IXP4XX 0x8500
22067 +#define PCI_DEVICE_ID_INTEL_IXP2400 0x9001
22068 +#define PCI_DEVICE_ID_INTEL_IXP2800 0x9004
22069 +#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
22070 +
22071 +#define PCI_VENDOR_ID_COMPUTONE 0x8e0e
22072 +#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291
22073 +#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302
22074 +#define PCI_SUBVENDOR_ID_COMPUTONE 0x8e0e
22075 +#define PCI_SUBDEVICE_ID_COMPUTONE_PG4 0x0001
22076 +#define PCI_SUBDEVICE_ID_COMPUTONE_PG8 0x0002
22077 +#define PCI_SUBDEVICE_ID_COMPUTONE_PG6 0x0003
22078 +
22079 +#define PCI_VENDOR_ID_KTI 0x8e2e
22080 +#define PCI_DEVICE_ID_KTI_ET32P2 0x3000
22081 +
22082 +#define PCI_VENDOR_ID_ADAPTEC 0x9004
22083 +#define PCI_DEVICE_ID_ADAPTEC_7810 0x1078
22084 +#define PCI_DEVICE_ID_ADAPTEC_7821 0x2178
22085 +#define PCI_DEVICE_ID_ADAPTEC_38602 0x3860
22086 +#define PCI_DEVICE_ID_ADAPTEC_7850 0x5078
22087 +#define PCI_DEVICE_ID_ADAPTEC_7855 0x5578
22088 +#define PCI_DEVICE_ID_ADAPTEC_5800 0x5800
22089 +#define PCI_DEVICE_ID_ADAPTEC_3860 0x6038
22090 +#define PCI_DEVICE_ID_ADAPTEC_1480A 0x6075
22091 +#define PCI_DEVICE_ID_ADAPTEC_7860 0x6078
22092 +#define PCI_DEVICE_ID_ADAPTEC_7861 0x6178
22093 +#define PCI_DEVICE_ID_ADAPTEC_7870 0x7078
22094 +#define PCI_DEVICE_ID_ADAPTEC_7871 0x7178
22095 +#define PCI_DEVICE_ID_ADAPTEC_7872 0x7278
22096 +#define PCI_DEVICE_ID_ADAPTEC_7873 0x7378
22097 +#define PCI_DEVICE_ID_ADAPTEC_7874 0x7478
22098 +#define PCI_DEVICE_ID_ADAPTEC_7895 0x7895
22099 +#define PCI_DEVICE_ID_ADAPTEC_7880 0x8078
22100 +#define PCI_DEVICE_ID_ADAPTEC_7881 0x8178
22101 +#define PCI_DEVICE_ID_ADAPTEC_7882 0x8278
22102 +#define PCI_DEVICE_ID_ADAPTEC_7883 0x8378
22103 +#define PCI_DEVICE_ID_ADAPTEC_7884 0x8478
22104 +#define PCI_DEVICE_ID_ADAPTEC_7885 0x8578
22105 +#define PCI_DEVICE_ID_ADAPTEC_7886 0x8678
22106 +#define PCI_DEVICE_ID_ADAPTEC_7887 0x8778
22107 +#define PCI_DEVICE_ID_ADAPTEC_7888 0x8878
22108 +#define PCI_DEVICE_ID_ADAPTEC_1030 0x8b78
22109 +
22110 +#define PCI_VENDOR_ID_ADAPTEC2 0x9005
22111 +#define PCI_DEVICE_ID_ADAPTEC2_2940U2 0x0010
22112 +#define PCI_DEVICE_ID_ADAPTEC2_2930U2 0x0011
22113 +#define PCI_DEVICE_ID_ADAPTEC2_7890B 0x0013
22114 +#define PCI_DEVICE_ID_ADAPTEC2_7890 0x001f
22115 +#define PCI_DEVICE_ID_ADAPTEC2_3940U2 0x0050
22116 +#define PCI_DEVICE_ID_ADAPTEC2_3950U2D 0x0051
22117 +#define PCI_DEVICE_ID_ADAPTEC2_7896 0x005f
22118 +#define PCI_DEVICE_ID_ADAPTEC2_7892A 0x0080
22119 +#define PCI_DEVICE_ID_ADAPTEC2_7892B 0x0081
22120 +#define PCI_DEVICE_ID_ADAPTEC2_7892D 0x0083
22121 +#define PCI_DEVICE_ID_ADAPTEC2_7892P 0x008f
22122 +#define PCI_DEVICE_ID_ADAPTEC2_7899A 0x00c0
22123 +#define PCI_DEVICE_ID_ADAPTEC2_7899B 0x00c1
22124 +#define PCI_DEVICE_ID_ADAPTEC2_7899D 0x00c3
22125 +#define PCI_DEVICE_ID_ADAPTEC2_7899P 0x00cf
22126 +#define PCI_DEVICE_ID_ADAPTEC2_SCAMP 0x0503
22127 +
22128 +#define PCI_VENDOR_ID_ATRONICS 0x907f
22129 +#define PCI_DEVICE_ID_ATRONICS_2015 0x2015
22130 +
22131 +#define PCI_VENDOR_ID_HOLTEK 0x9412
22132 +#define PCI_DEVICE_ID_HOLTEK_6565 0x6565
22133 +
22134 +#define PCI_VENDOR_ID_NETMOS 0x9710
22135 +#define PCI_DEVICE_ID_NETMOS_9705 0x9705
22136 +#define PCI_DEVICE_ID_NETMOS_9715 0x9715
22137 +#define PCI_DEVICE_ID_NETMOS_9735 0x9735
22138 +#define PCI_DEVICE_ID_NETMOS_9745 0x9745
22139 +#define PCI_DEVICE_ID_NETMOS_9755 0x9755
22140 +#define PCI_DEVICE_ID_NETMOS_9805 0x9805
22141 +#define PCI_DEVICE_ID_NETMOS_9815 0x9815
22142 +#define PCI_DEVICE_ID_NETMOS_9835 0x9835
22143 +#define PCI_DEVICE_ID_NETMOS_9845 0x9845
22144 +#define PCI_DEVICE_ID_NETMOS_9855 0x9855
22145 +
22146 +#define PCI_SUBVENDOR_ID_EXSYS 0xd84d
22147 +#define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014
22148 +
22149 +#define PCI_VENDOR_ID_TIGERJET 0xe159
22150 +#define PCI_DEVICE_ID_TIGERJET_300 0x0001
22151 +#define PCI_DEVICE_ID_TIGERJET_100 0x0002
22152 +
22153 +#define PCI_VENDOR_ID_TTTECH 0x0357
22154 +#define PCI_DEVICE_ID_TTTECH_MC322 0x000A
22155 +
22156 +#define PCI_VENDOR_ID_ARK 0xedd8
22157 +#define PCI_DEVICE_ID_ARK_STING 0xa091
22158 +#define PCI_DEVICE_ID_ARK_STINGARK 0xa099
22159 +#define PCI_DEVICE_ID_ARK_2000MT 0xa0a1