aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/Kconfig
blob: f09fc0e2062dfdf9b0d2c4d816cd4fada77c4628 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
#
# Character device configuration
#

menu "Character devices"

config VT
	bool "Virtual terminal" if EMBEDDED
	depends on !S390
	select INPUT
	default y
	---help---
	  If you say Y here, you will get support for terminal devices with
	  display and keyboard devices. These are called "virtual" because you
	  can run several virtual terminals (also called virtual consoles) on
	  one physical terminal. This is rather useful, for example one
	  virtual terminal can collect system messages and warnings, another
	  one can be used for a text-mode user session, and a third could run
	  an X session, all in parallel. Switching between virtual terminals
	  is done with certain key combinations, usually Alt-<function key>.

	  The setterm command ("man setterm") can be used to change the
	  properties (such as colors or beeping) of a virtual terminal. The
	  man page console_codes(4) ("man console_codes") contains the special
	  character sequences that can be used to change those properties
	  directly. The fonts used on virtual terminals can be changed with
	  the setfont ("man setfont") command and the key bindings are defined
	  with the loadkeys ("man loadkeys") command.

	  You need at least one virtual terminal device in order to make use
	  of your keyboard and monitor. Therefore, only people configuring an
	  embedded system would want to say N here in order to save some
	  memory; the only way to log into such a system is then via a serial
	  or network connection.

	  If unsure, say Y, or else you won't be able to do much with your new
	  shiny Linux system :-)

config CONSOLE_TRANSLATIONS
	depends on VT
	default y
	bool "Enable character translations in console" if EMBEDDED
	---help---
	  This enables support for font mapping and Unicode translation
	  on virtual consoles.

config VT_CONSOLE
	bool "Support for console on virtual terminal" if EMBEDDED
	depends on VT
	default y
	---help---
	  The system console is the device which receives all kernel messages
	  and warnings and which allows logins in single user mode. If you
	  answer Y here, a virtual terminal (the device used to interact with
	  a physical terminal) can be used as system console. This is the most
	  common mode of operations, so you should say Y here unless you want
	  the kernel messages be output only to a serial port (in which case
	  you should say Y to "Console on serial port", below).

	  If you do say Y here, by default the currently visible virtual
	  terminal (/dev/tty0) will be used as system console. You can change
	  that with a kernel command line option such as "console=tty3" which
	  would use the third virtual terminal as system console. (Try "man
	  bootparam" or see the documentation of your boot loader (lilo or
	  loadlin) about how to pass options to the kernel at boot time.)

	  If unsure, say Y.

config HW_CONSOLE
	bool
	depends on VT && !S390 && !UML
	default y

config VT_HW_CONSOLE_BINDING
       bool "Support for binding and unbinding console drivers"
       depends on HW_CONSOLE
       default n
       ---help---
         The virtual terminal is the device that interacts with the physical
         terminal through console drivers. On these systems, at least one
         console driver is loaded. In other configurations, additional console
         drivers may be enabled, such as the framebuffer console. If more than
         1 console driver is enabled, setting this to 'y' will allow you to
         select the console driver that will serve as the backend for the
         virtual terminals.

	 See <file:Documentation/console/console.txt> for more
	 information. For framebuffer console users, please refer to
	 <file:Documentation/fb/fbcon.txt>.

config DEVKMEM
	bool "/dev/kmem virtual device support"
	default y
	help
	  Say Y here if you want to support the /dev/kmem device. The
	  /dev/kmem device is rarely used, but can be used for certain
	  kind of kernel debugging operations.
	  When in doubt, say "N".

config BFIN_JTAG_COMM
	tristate "Blackfin JTAG Communication"
	depends on BLACKFIN
	help
	  Add support for emulating a TTY device over the Blackfin JTAG.

	  To compile this driver as a module, choose M here: the
	  module will be called bfin_jtag_comm.

config BFIN_JTAG_COMM_CONSOLE
	bool "Console on Blackfin JTAG"
	depends on BFIN_JTAG_COMM=y

config SERIAL_NONSTANDARD
	bool "Non-standard serial port support"
	depends on HAS_IOMEM
	---help---
	  Say Y here if you have any non-standard serial boards -- boards
	  which aren't supported using the standard "dumb" serial driver.
	  This includes intelligent serial boards such as Cyclades,
	  Digiboards, etc. These are usually used for systems that need many
	  serial ports because they serve many terminals or dial-in
	  connections.

	  Note that the answer to this question won't directly affect the
	  kernel: saying N will just cause the configurator to skip all
	  the questions about non-standard serial boards.

	  Most people can say N here.

config COMPUTONE
	tristate "Computone IntelliPort Plus serial support"
	depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
	---help---
	  This driver supports the entire family of Intelliport II/Plus
	  controllers with the exception of the MicroChannel controllers and
	  products previous to the Intelliport II. These are multiport cards,
	  which give you many serial ports. You would need something like this
	  to connect more than two modems to your Linux box, for instance in
	  order to become a dial-in server. If you have a card like that, say
	  Y here and read <file:Documentation/serial/computone.txt>.

	  To compile this driver as module, choose M here: the
	  module will be called ip2.

config ROCKETPORT
	tristate "Comtrol RocketPort support"
	depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
	help
	  This driver supports Comtrol RocketPort and RocketModem PCI boards.   
          These boards provide 2, 4, 8, 16, or 32 high-speed serial ports or
          modems.  For information about the RocketPort/RocketModem  boards
          and this driver read <file:Documentation/serial/rocket.txt>.

	  To compile this driver as a module, choose M here: the
	  module will be called rocket.

	  If you want to compile this driver into the kernel, say Y here.  If
          you don't have a Comtrol RocketPort/RocketModem card installed, say N.

config CYCLADES
	tristate "Cyclades async mux support"
	depends on SERIAL_NONSTANDARD && (PCI || ISA)
	select FW_LOADER
	---help---
	  This driver supports Cyclades Z and Y multiserial boards.
	  You would need something like this to connect more than two modems to
	  your Linux box, for instance in order to become a dial-in server.

	  For information about the Cyclades-Z card, read
	  <file:Documentation/serial/README.cycladesZ>.

	  To compile this driver as a module, choose M here: the
	  module will be called cyclades.

	  If you haven't heard about it, it's safe to say N.

config CYZ_INTR
	bool "Cyclades-Z interrupt mode operation (EXPERIMENTAL)"
	depends on EXPERIMENTAL && CYCLADES
	help
	  The Cyclades-Z family of multiport cards allows 2 (two) driver op
	  modes: polling and interrupt. In polling mode, the driver will check
	  the status of the Cyclades-Z ports every certain amount of time
	  (which is called polling cycle and is configurable). In interrupt
	  mode, it will use an interrupt line (IRQ) in order to check the
	  status of the Cyclades-Z ports. The default op mode is polling. If
	  unsure, say N.

config DIGIEPCA
	tristate "Digiboard Intelligent Async Support"
	depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
	---help---
	  This is a driver for Digi International's Xx, Xeve, and Xem series
	  of cards which provide multiple serial ports. You would need
	  something like this to connect more than two modems to your Linux
	  box, for instance in order to become a dial-in server. This driver
	  supports the original PC (ISA) boards as well as PCI, and EISA. If
	  you have a card like this, say Y here and read the file
	  <file:Documentation/serial/digiepca.txt>.

	  To compile this driver as a module, choose M here: the
	  module will be called epca.

config MOXA_INTELLIO
	tristate "Moxa Intellio support"
	depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
	select FW_LOADER
	help
	  Say Y here if you have a Moxa Intellio multiport serial card.

	  To compile this driver as a module, choose M here: the
	  module will be called moxa.

config MOXA_SMARTIO
	tristate "Moxa SmartIO support v. 2.0"
	depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA)
	help
	  Say Y here if you have a Moxa SmartIO multiport serial card and/or
	  want to help develop a new version of this driver.

	  This is upgraded (1.9.1) driver from original Moxa drivers with
	  changes finally resulting in PCI probing.

	  This driver can also be built as a module. The module will be called
	  mxser. If you want to do that, say M here.

config ISI
	tristate "Multi-Tech multiport card support (EXPERIMENTAL)"
	depends on SERIAL_NONSTANDARD && PCI
	select FW_LOADER
	help
	  This is a driver for the Multi-Tech cards which provide several
	  serial ports.  The driver is experimental and can currently only be
	  built as a module. The module will be called isicom.
	  If you want to do that, choose M here.

config SYNCLINK
	tristate "Microgate SyncLink card support"
	depends on SERIAL_NONSTANDARD && PCI && ISA_DMA_API
	help
	  Provides support for the SyncLink ISA and PCI multiprotocol serial
	  adapters. These adapters support asynchronous and HDLC bit
	  synchronous communication up to 10Mbps (PCI adapter).

	  This driver can only be built as a module ( = code which can be
	  inserted in and removed from the running kernel whenever you want).
	  The module will be called synclink.  If you want to do that, say M
	  here.

config SYNCLINKMP
	tristate "SyncLink Multiport support"
	depends on SERIAL_NONSTANDARD && PCI
	help
	  Enable support for the SyncLink Multiport (2 or 4 ports)
	  serial adapter, running asynchronous and HDLC communications up
	  to 2.048Mbps. Each ports is independently selectable for
	  RS-232, V.35, RS-449, RS-530, and X.21

	  This driver may be built as a module ( = code which can be
	  inserted in and removed from the running kernel whenever you want).
	  The module will be called synclinkmp.  If you want to do that, say M
	  here.

config SYNCLINK_GT
	tristate "SyncLink GT/AC support"
	depends on SERIAL_NONSTANDARD && PCI
	help
	  Support for SyncLink GT and SyncLink AC families of
	  synchronous and asynchronous serial adapters
	  manufactured by Microgate Systems, Ltd. (www.microgate.com)

config N_HDLC
	tristate "HDLC line discipline support"
	depends on SERIAL_NONSTANDARD
	help
	  Allows synchronous HDLC communications with tty device drivers that
	  support synchronous HDLC such as the Microgate SyncLink adapter.

	  This driver can be built as a module ( = code which can be
	  inserted in and removed from the running kernel whenever you want).
	  The module will be called n_hdlc. If you want to do that, say M
	  here.

config N_GSM
	tristate "GSM MUX line discipline support (EXPERIMENTAL)"
	depends on EXPERIMENTAL
	depends on NET
	help
	  This line discipline provides support for the GSM MUX protocol and
	  presents the mux as a set of 61 individual tty devices.

config RISCOM8
	tristate "SDL RISCom/8 card support"
	depends on SERIAL_NONSTANDARD
	help
	  This is a driver for the SDL Communications RISCom/8 multiport card,
	  which gives you many serial ports. You would need something like
	  this to connect more than two modems to your Linux box, for instance
	  in order to become a dial-in server. If you have a card like that,
	  say Y here and read the file <file:Documentation/serial/riscom8.txt>.

	  Also it's possible to say M here and compile this driver as kernel
	  loadable module; the module will be called riscom8.

config SPECIALIX
	tristate "Specialix IO8+ card support"
	depends on SERIAL_NONSTANDARD
	help
	  This is a driver for the Specialix IO8+ multiport card (both the
	  ISA and the PCI version) which gives you many serial ports. You
	  would need something like this to connect more than two modems to
	  your Linux box, for instance in order to become a dial-in server.

	  If you have a card like that, say Y here and read the file
	  <file:Documentation/serial/specialix.txt>. Also it's possible to say
	  M here and compile this driver as kernel loadable module which will be
	  called specialix.

config SX
	tristate "Specialix SX (and SI) card support"
	depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) && BROKEN
	help
	  This is a driver for the SX and SI multiport serial cards.
	  Please read the file <file:Documentation/serial/sx.txt> for details.

	  This driver can only be built as a module ( = code which can be
	  inserted in and removed from the running kernel whenever you want).
	  The module will be called sx. If you want to do that, say M here.

config RIO
	tristate "Specialix RIO system support"
	depends on SERIAL_NONSTANDARD && BROKEN
	help
	  This is a driver for the Specialix RIO, a smart serial card which
	  drives an outboard box that can support up to 128 ports.  Product
	  information is at <http://www.perle.com/support/documentation.html#multiport>.
	  There are both ISA and PCI versions.

config RIO_OLDPCI
	bool "Support really old RIO/PCI cards"
	depends on RIO
	help
	  Older RIO PCI cards need some initialization-time configuration to
	  determine the IRQ and some control addresses.  If you have a RIO and
	  this doesn't seem to work, try setting this to Y.

config STALDRV
	bool "Stallion multiport serial support"
	depends on SERIAL_NONSTANDARD
	help
	  Stallion cards give you many serial ports.  You would need something
	  like this to connect more than two modems to your Linux box, for
	  instance in order to become a dial-in server.  If you say Y here,
	  you will be asked for your specific card model in the next
	  questions.  Make sure to read <file:Documentation/serial/stallion.txt>
	  in this case.  If you have never heard about all this, it's safe to
	  say N.

config STALLION
	tristate "Stallion EasyIO or EC8/32 support"
	depends on STALDRV && (ISA || EISA || PCI)
	help
	  If you have an EasyIO or EasyConnection 8/32 multiport Stallion
	  card, then this is for you; say Y.  Make sure to read
	  <file:Documentation/serial/stallion.txt>.

	  To compile this driver as a module, choose M here: the
	  module will be called stallion.

config ISTALLION
	tristate "Stallion EC8/64, ONboard, Brumby support"
	depends on STALDRV && (ISA || EISA || PCI)
	help
	  If you have an EasyConnection 8/64, ONboard, Brumby or Stallion
	  serial multiport card, say Y here. Make sure to read
	  <file:Documentation/serial/stallion.txt>.

	  To compile this driver as a module, choose M here: the
	  module will be called istallion.

config NOZOMI
	tristate "HSDPA Broadband Wireless Data Card - Globe Trotter"
	depends on PCI && EXPERIMENTAL
	help
	  If you have a HSDPA driver Broadband Wireless Data Card -
	  Globe Trotter PCMCIA card, say Y here.

	  To compile this driver as a module, choose M here, the module
	  will be called nozomi.

config A2232
	tristate "Commodore A2232 serial support (EXPERIMENTAL)"
	depends on EXPERIMENTAL && ZORRO && BROKEN
	---help---
	  This option supports the 2232 7-port serial card shipped with the
	  Amiga 2000 and other Zorro-bus machines, dating from 1989.  At
	  a max of 19,200 bps, the ports are served by a 6551 ACIA UART chip
	  each, plus a 8520 CIA, and a master 6502 CPU and buffer as well. The
	  ports were connected with 8 pin DIN connectors on the card bracket,
	  for which 8 pin to DB25 adapters were supplied. The card also had
	  jumpers internally to toggle various pinning configurations.

	  This driver can be built as a module; but then "generic_serial"
	  will also be built as a module. This has to be loaded before
	  "ser_a2232". If you want to do this, answer M here.

config SGI_SNSC
	bool "SGI Altix system controller communication support"
	depends on (IA64_SGI_SN2 || IA64_GENERIC)
	help
	  If you have an SGI Altix and you want to enable system
	  controller communication from user space (you want this!),
	  say Y.  Otherwise, say N.

config SGI_TIOCX
       bool "SGI TIO CX driver support"
       depends on (IA64_SGI_SN2 || IA64_GENERIC)
       help
         If you have an SGI Altix and you have fpga devices attached
         to your TIO, say Y here, otherwise say N.

config SGI_MBCS
       tristate "SGI FPGA Core Services driver support"
       depends on SGI_TIOCX
       help
         If you have an SGI Altix with an attached SABrick
         say Y or M here, otherwise say N.

source "drivers/serial/Kconfig"

config UNIX98_PTYS
	bool "Unix98 PTY support" if EMBEDDED
	default y
	---help---
	  A pseudo terminal (PTY) is a software device consisting of two
	  halves: a master and a slave. The slave device behaves identical to
	  a physical terminal; the master device is used by a process to
	  read data from and write data to the slave, thereby emulating a
	  terminal. Typical programs for the master side are telnet servers
	  and xterms.

	  Linux has traditionally used the BSD-like names /dev/ptyxx for
	  masters and /dev/ttyxx for slaves of pseudo terminals. This scheme
	  has a number of problems. The GNU C library glibc 2.1 and later,
	  however, supports the Unix98 naming standard: in order to acquire a
	  pseudo terminal, a process opens /dev/ptmx; the number of the pseudo
	  terminal is then made available to the process and the pseudo
	  terminal slave can be accessed as /dev/pts/<number>. What was
	  traditionally /dev/ttyp2 will then be /dev/pts/2, for example.

	  All modern Linux systems use the Unix98 ptys.  Say Y unless
	  you're on an embedded system and want to conserve memory.

config DEVPTS_MULTIPLE_INSTANCES
	bool "Support multiple instances of devpts"
	depends on UNIX98_PTYS
	default n
	---help---
	  Enable support for multiple instances of devpts filesystem.
	  If you want to have isolated PTY namespaces (eg: in containers),
	  say Y here.  Otherwise, say N. If enabled, each mount of devpts
	  filesystem with the '-o newinstance' option will create an
	  independent PTY namespace.

config LEGACY_PTYS
	bool "Legacy (BSD) PTY support"
	default y
	---help---
	  A pseudo terminal (PTY) is a software device consisting of two
	  halves: a master and a slave. The slave device behaves identical to
	  a physical terminal; the master device is used by a process to
	  read data from and write data to the slave, thereby emulating a
	  terminal. Typical programs for the master side are telnet servers
	  and xterms.

	  Linux has traditionally used the BSD-like names /dev/ptyxx
	  for masters and /dev/ttyxx for slaves of pseudo
	  terminals. This scheme has a number of problems, including
	  security.  This option enables these legacy devices; on most
	  systems, it is safe to say N.


config LEGACY_PTY_COUNT
	int "Maximum number of legacy PTY in use"
	depends on LEGACY_PTYS
	range 0 256
	default "256"
	---help---
	  The maximum number of legacy PTYs that can be used at any one time.
	  The default is 256, and should be more than enough.  Embedded
	  systems may want to reduce this to save memory.

	  When not in use, each legacy PTY occupies 12 bytes on 32-bit
	  architectures and 24 bytes on 64-bit architectures.

config BRIQ_PANEL
	tristate 'Total Impact briQ front panel driver'
	depends on PPC_CHRP
	---help---
	  The briQ is a small footprint CHRP computer with a frontpanel VFD, a
	  tristate led and two switches. It is the size of a CDROM drive.

	  If you have such one and want anything showing on the VFD then you
	  must answer Y here.

	  To compile this driver as a module, choose M here: the
	  module will be called briq_panel.

	  It's safe to say N here.

config BFIN_OTP
	tristate "Blackfin On-Chip OTP Memory Support"
	depends on BLACKFIN && (BF51x || BF52x || BF54x)
	default y
	help
	  If you say Y here, you will get support for a character device
	  interface into the One Time Programmable memory pages that are
	  stored on the Blackfin processor.  This will not get you access
	  to the secure memory pages however.  You will need to write your
	  own secure code and reader for that.

	  To compile this driver as a module, choose M here: the module
	  will be called bfin-otp.

	  If unsure, it is safe to say Y.

config BFIN_OTP_WRITE_ENABLE
	bool "Enable writing support of OTP pages"
	depends on BFIN_OTP
	default n
	help
	  If you say Y here, you will enable support for writing of the
	  OTP pages.  This is dangerous by nature as you can only program
	  the pages once, so only enable this option when you actually
	  need it so as to not inadvertently clobber data.

	  If unsure, say N.

config PRINTER
	tristate "Parallel printer support"
	depends on PARPORT
	---help---
	  If you intend to attach a printer to the parallel port of your Linux
	  box (as opposed to using a serial printer; if the connector at the
	  printer has 9 or 25 holes ["female"], then it's serial), say Y.
	  Also read the Printing-HOWTO, available from
	  <http://www.tldp.org/docs.html#howto>.

	  It is possible to share one parallel port among several devices
	  (e.g. printer and ZIP drive) and it is safe to compile the
	  corresponding drivers into the kernel.

	  To compile this driver as a module, choose M here and read
	  <file:Documentation/parport.txt>.  The module will be called lp.

	  If you have several parallel ports, you can specify which ports to
	  use with the "lp" kernel command line option.  (Try "man bootparam"
	  or see the documentation of your boot loader (lilo or loadlin) about
	  how to pass options to the kernel at boot time.)  The syntax of the
	  "lp" command line option can be found in <file:drivers/char/lp.c>.

	  If you have more than 8 printers, you need to increase the LP_NO
	  macro in lp.c and the PARPORT_MAX macro in parport.h.

config LP_CONSOLE
	bool "Support for console on line printer"
	depends on PRINTER
	---help---
	  If you want kernel messages to be printed out as they occur, you
	  can have a console on the printer. This option adds support for
	  doing that; to actually get it to happen you need to pass the
	  option "console=lp0" to the kernel at boot time.

	  If the printer is out of paper (or off, or unplugged, or too
	  busy..) the kernel will stall until the printer is ready again.
	  By defining CONSOLE_LP_STRICT to 0 (at your own risk) you
	  can make the kernel continue when this happens,
	  but it'll lose the kernel messages.

	  If unsure, say N.

config PPDEV
	tristate "Support for user-space parallel port device drivers"
	depends on PARPORT
	---help---
	  Saying Y to this adds support for /dev/parport device nodes.  This
	  is needed for programs that want portable access to the parallel
	  port, for instance deviceid (which displays Plug-and-Play device
	  IDs).

	  This is the parallel port equivalent of SCSI generic support (sg).
	  It is safe to say N to this -- it is not needed for normal printing
	  or parallel port CD-ROM/disk support.

	  To compile this driver as a module, choose M here: the
	  module will be called ppdev.

	  If unsure, say N.

config HVC_DRIVER
	bool
	help
	  Generic "hypervisor virtual console" infrastructure for various
	  hypervisors (pSeries, iSeries, Xen, lguest).
	  It will automatically be selected if one of the back-end console drivers
	  is selected.

config HVC_IRQ
	bool

config HVC_CONSOLE
	bool "pSeries Hypervisor Virtual Console support"
	depends on PPC_PSERIES
	select HVC_DRIVER
	select HVC_IRQ
	help
	  pSeries machines when partitioned support a hypervisor virtual
	  console. This driver allows each pSeries partition to have a console
	  which is accessed via the HMC.

config HVC_ISERIES
	bool "iSeries Hypervisor Virtual Console support"
	depends on PPC_ISERIES
	default y
	select HVC_DRIVER
	select HVC_IRQ
	select VIOPATH
	help
	  iSeries machines support a hypervisor virtual console.

config HVC_RTAS
	bool "IBM RTAS Console support"
	depends on PPC_RTAS
	select HVC_DRIVER
	help
	  IBM Console device driver which makes use of RTAS

config HVC_BEAT
	bool "Toshiba's Beat Hypervisor Console support"
	depends on PPC_CELLEB
	select HVC_DRIVER
	help
	  Toshiba's Cell Reference Set Beat Console device driver

config HVC_IUCV
	bool "z/VM IUCV Hypervisor console support (VM only)"
	depends on S390
	select HVC_DRIVER
	select IUCV
	default y
	help
	  This driver provides a Hypervisor console (HVC) back-end to access
	  a Linux (console) terminal via a z/VM IUCV communication path.

config HVC_XEN
	bool "Xen Hypervisor Console support"
	depends on XEN
	select HVC_DRIVER
	select HVC_IRQ
	default y
	help
	  Xen virtual console device driver

config HVC_UDBG
       bool "udbg based fake hypervisor console"
       depends on PPC && EXPERIMENTAL
       select HVC_DRIVER
       default n

config VIRTIO_CONSOLE
	tristate "Virtio console"
	depends on VIRTIO
	select HVC_DRIVER
	help
	  Virtio console for use with lguest and other hypervisors.

	  Also serves as a general-purpose serial device for data
	  transfer between the guest and host.  Character devices at
	  /dev/vportNpn will be created when corresponding ports are
	  found, where N is the device number and n is the port number
	  within that device.  If specified by the host, a sysfs
	  attribute called 'name' will be populated with a name for
	  the port which can be used by udev scripts to create a
	  symlink to the device.

config HVCS
	tristate "IBM Hypervisor Virtual Console Server support"
	depends on PPC_PSERIES && HVC_CONSOLE
	help
	  Partitionable IBM Power5 ppc64 machines allow hosting of
	  firmware virtual consoles from one Linux partition by
	  another Linux partition.  This driver allows console data
	  from Linux partitions to be accessed through TTY device
	  interfaces in the device tree of a Linux partition running
	  this driver.

	  To compile this driver as a module, choose M here: the
	  module will be called hvcs.  Additionally, this module
	  will depend on arch specific APIs exported from hvcserver.ko
	  which will also be compiled when this driver is built as a
	  module.

config IBM_BSR
	tristate "IBM POWER Barrier Synchronization Register support"
	depends on PPC_PSERIES
	help
	  This devices exposes a hardware mechanism for fast synchronization
	  of threads across a large system which avoids bouncing a cacheline
	  between several cores on a system

source "drivers/char/ipmi/Kconfig"

config DS1620
	tristate "NetWinder thermometer support"
	depends on ARCH_NETWINDER
	help
	  Say Y here to include support for the thermal management hardware
	  found in the NetWinder. This driver allows the user to control the
	  temperature set points and to read the current temperature.

	  It is also possible to say M here to build it as a module (ds1620)
	  It is recommended to be used on a NetWinder, but it is not a
	  necessity.

config NWBUTTON
	tristate "NetWinder Button"
	depends on ARCH_NETWINDER
	---help---
	  If you say Y here and create a character device node /dev/nwbutton
	  with major and minor numbers 10 and 158 ("man mknod"), then every
	  time the orange button is pressed a number of times, the number of
	  times the button was pressed will be written to that device.

	  This is most useful for applications, as yet unwritten, which
	  perform actions based on how many times the button is pressed in a
	  row.

	  Do not hold the button down for too long, as the driver does not
	  alter the behaviour of the hardware reset circuitry attached to the
	  button; it will still execute a hard reset if the button is held
	  down for longer than approximately five seconds.

	  To compile this driver as a module, choose M here: the
	  module will be called nwbutton.

	  Most people will answer Y to this question and "Reboot Using Button"
	  below to be able to initiate a system shutdown from the button.

config NWBUTTON_REBOOT
	bool "Reboot Using Button"
	depends on NWBUTTON
	help
	  If you say Y here, then you will be able to initiate a system
	  shutdown and reboot by pressing the orange button a number of times.
	  The number of presses to initiate the shutdown is two by default,
	  but this can be altered by modifying the value of NUM_PRESSES_REBOOT
	  in nwbutton.h and recompiling the driver or, if you compile the
	  driver as a module, you can specify the number of presses at load
	  time with "insmod button reboot_count=<something>".

config NWFLASH
	tristate "NetWinder flash support"
	depends on ARCH_NETWINDER
	---help---
	  If you say Y here and create a character device /dev/flash with
	  major 10 and minor 160 you can manipulate the flash ROM containing
	  the NetWinder firmware. Be careful as accidentally overwriting the
	  flash contents can render your computer unbootable. On no account
	  allow random users access to this device. :-)

	  To compile this driver as a module, choose M here: the
	  module will be called nwflash.

	  If you're not sure, say N.

source "drivers/char/hw_random/Kconfig"

config NVRAM
	tristate "/dev/nvram support"
	depends on ATARI || X86 || (ARM && RTC_DRV_CMOS) || GENERIC_NVRAM
	---help---
	  If you say Y here and create a character special file /dev/nvram
	  with major number 10 and minor number 144 using mknod ("man mknod"),
	  you get read and write access to the extra bytes of non-volatile
	  memory in the real time clock (RTC), which is contained in every PC
	  and most Ataris.  The actual number of bytes varies, depending on the
	  nvram in the system, but is usually 114 (128-14 for the RTC).

	  This memory is conventionally called "CMOS RAM" on PCs and "NVRAM"
	  on Ataris. /dev/nvram may be used to view settings there, or to
	  change them (with some utility). It could also be used to frequently
	  save a few bits of very important data that may not be lost over
	  power-off and for which writing to disk is too insecure. Note
	  however that most NVRAM space in a PC belongs to the BIOS and you
	  should NEVER idly tamper with it. See Ralf Brown's interrupt list
	  for a guide to the use of CMOS bytes by your BIOS.

	  On Atari machines, /dev/nvram is always configured and does not need
	  to be selected.

	  To compile this driver as a module, choose M here: the
	  module will be called nvram.

#
# These legacy RTC drivers just cause too many conflicts with the generic
# RTC framework ... let's not even try to coexist any more.
#
if RTC_LIB=n

config RTC
	tristate "Enhanced Real Time Clock Support (legacy PC RTC driver)"
	depends on !PPC && !PARISC && !IA64 && !M68K && !SPARC && !FRV \
			&& !ARM && !SUPERH && !S390 && !AVR32 && !BLACKFIN
	---help---
	  If you say Y here and create a character special file /dev/rtc with
	  major number 10 and minor number 135 using mknod ("man mknod"), you
	  will get access to the real time clock (or hardware clock) built
	  into your computer.

	  Every PC has such a clock built in. It can be used to generate
	  signals from as low as 1Hz up to 8192Hz, and can also be used
	  as a 24 hour alarm. It reports status information via the file
	  /proc/driver/rtc and its behaviour is set by various ioctls on
	  /dev/rtc.

	  If you run Linux on a multiprocessor machine and said Y to
	  "Symmetric Multi Processing" above, you should say Y here to read
	  and set the RTC in an SMP compatible fashion.

	  If you think you have a use for such a device (such as periodic data
	  sampling), then say Y here, and read <file:Documentation/rtc.txt>
	  for details.

	  To compile this driver as a module, choose M here: the
	  module will be called rtc.

config JS_RTC
	tristate "Enhanced Real Time Clock Support"
	depends on SPARC32 && PCI
	---help---
	  If you say Y here and create a character special file /dev/rtc with
	  major number 10 and minor number 135 using mknod ("man mknod"), you
	  will get access to the real time clock (or hardware clock) built
	  into your computer.

	  Every PC has such a clock built in. It can be used to generate
	  signals from as low as 1Hz up to 8192Hz, and can also be used
	  as a 24 hour alarm. It reports status information via the file
	  /proc/driver/rtc and its behaviour is set by various ioctls on
	  /dev/rtc.

	  If you think you have a use for such a device (such as periodic data
	  sampling), then say Y here, and read <file:Documentation/rtc.txt>
	  for details.

	  To compile this driver as a module, choose M here: the
	  module will be called js-rtc.

config GEN_RTC
	tristate "Generic /dev/rtc emulation"
	depends on RTC!=y && !IA64 && !ARM && !M32R && !MIPS && !SPARC && !FRV && !S390 && !SUPERH && !AVR32 && !BLACKFIN
	---help---
	  If you say Y here and create a character special file /dev/rtc with
	  major number 10 and minor number 135 using mknod ("man mknod"), you
	  will get access to the real time clock (or hardware clock) built
	  into your computer.

	  It reports status information via the file /proc/driver/rtc and its
	  behaviour is set by various ioctls on /dev/rtc. If you enable the
	  "extended RTC operation" below it will also provide an emulation
	  for RTC_UIE which is required by some programs and may improve
	  precision in some cases.

	  To compile this driver as a module, choose M here: the
	  module will be called genrtc.

config GEN_RTC_X
	bool "Extended RTC operation"
	depends on GEN_RTC
	help
	  Provides an emulation for RTC_UIE which is required by some programs
	  and may improve precision of the generic RTC support in some cases.

config EFI_RTC
	bool "EFI Real Time Clock Services"
	depends on IA64

config DS1302
	tristate "DS1302 RTC support"
	depends on M32R && (PLAT_M32700UT || PLAT_OPSPUT)
	help
	  If you say Y here and create a character special file /dev/rtc with
	  major number 121 and minor number 0 using mknod ("man mknod"), you
	  will get access to the real time clock (or hardware clock) built
	  into your computer.

endif # RTC_LIB

config DTLK
	tristate "Double Talk PC internal speech card support"
	depends on ISA
	help
	  This driver is for the DoubleTalk PC, a speech synthesizer
	  manufactured by RC Systems (<http://www.rcsys.com/>).  It is also
	  called the `internal DoubleTalk'.

	  To compile this driver as a module, choose M here: the
	  module will be called dtlk.

config XILINX_HWICAP
	tristate "Xilinx HWICAP Support"
	depends on XILINX_VIRTEX || MICROBLAZE
	help
	  This option enables support for Xilinx Internal Configuration
	  Access Port (ICAP) driver.  The ICAP is used on Xilinx Virtex
	  FPGA platforms to partially reconfigure the FPGA at runtime.

	  If unsure, say N.

config R3964
	tristate "Siemens R3964 line discipline"
	---help---
	  This driver allows synchronous communication with devices using the
	  Siemens R3964 packet protocol. Unless you are dealing with special
	  hardware like PLCs, you are unlikely to need this.

	  To compile this driver as a module, choose M here: the
	  module will be called n_r3964.

	  If unsure, say N.

config APPLICOM
	tristate "Applicom intelligent fieldbus card support"
	depends on PCI
	---help---
	  This driver provides the kernel-side support for the intelligent
	  fieldbus cards made by Applicom International. More information
	  about these cards can be found on the WWW at the address
	  <http://www.applicom-int.com/>, or by email from David Woodhouse
	  <dwmw2@infradead.org>.

	  To compile this driver as a module, choose M here: the
	  module will be called applicom.

	  If unsure, say N.

config SONYPI
	tristate "Sony Vaio Programmable I/O Control Device support (EXPERIMENTAL)"
	depends on EXPERIMENTAL && X86 && PCI && INPUT && !64BIT
	---help---
	  This driver enables access to the Sony Programmable I/O Control
	  Device which can be found in many (all ?) Sony Vaio laptops.

	  If you have one of those laptops, read
	  <file:Documentation/laptops/sonypi.txt>, and say Y or M here.

	  To compile this driver as a module, choose M here: the
	  module will be called sonypi.

config GPIO_TB0219
	tristate "TANBAC TB0219 GPIO support"
	depends on TANBAC_TB022X
	select GPIO_VR41XX

source "drivers/char/pcmcia/Kconfig"

config MWAVE
	tristate "ACP Modem (Mwave) support"
	depends on X86
	select SERIAL_8250
	---help---
	  The ACP modem (Mwave) for Linux is a WinModem. It is composed of a
	  kernel driver and a user level application. Together these components
	  support direct attachment to public switched telephone networks (PSTNs)
	  and support selected world wide countries.

	  This version of the ACP Modem driver supports the IBM Thinkpad 600E,
	  600, and 770 that include on board ACP modem hardware.

	  The modem also supports the standard communications port interface
	  (ttySx) and is compatible with the Hayes AT Command Set.

	  The user level application needed to use this driver can be found at
	  the IBM Linux Technology Center (LTC) web site:
	  <http://www.ibm.com/linux/ltc/>.

	  If you own one of the above IBM Thinkpads which has the Mwave chipset
	  in it, say Y.

	  To compile this driver as a module, choose M here: the
	  module will be called mwave.

config SCx200_GPIO
	tristate "NatSemi SCx200 GPIO Support"
	depends on SCx200
	select NSC_GPIO
	help
	  Give userspace access to the GPIO pins on the National
	  Semiconductor SCx200 processors.

	  If compiled as a module, it will be called scx200_gpio.

config PC8736x_GPIO
	tristate "NatSemi PC8736x GPIO Support"
	depends on X86
	default SCx200_GPIO	# mostly N
	select NSC_GPIO		# needed for support routines
	help
	  Give userspace access to the GPIO pins on the National
	  Semiconductor PC-8736x (x=[03456]) SuperIO chip.  The chip
	  has multiple functional units, inc several managed by
	  hwmon/pc87360 driver.  Tested with PC-87366

	  If compiled as a module, it will be called pc8736x_gpio.

config NSC_GPIO
	tristate "NatSemi Base GPIO Support"
	depends on X86_32
	# selected by SCx200_GPIO and PC8736x_GPIO
	# what about 2 selectors differing: m != y
	help
	  Common support used (and needed) by scx200_gpio and
	  pc8736x_gpio drivers.  If those drivers are built as
	  modules, this one will be too, named nsc_gpio

config CS5535_GPIO
	tristate "AMD CS5535/CS5536 GPIO (Geode Companion Device)"
	depends on X86_32
	help
	  Give userspace access to the GPIO pins on the AMD CS5535 and
	  CS5536 Geode companion devices.

	  If compiled as a module, it will be called cs5535_gpio.

config RAW_DRIVER
	tristate "RAW driver (/dev/raw/rawN)"
	depends on BLOCK
	help
	  The raw driver permits block devices to be bound to /dev/raw/rawN.
	  Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O.
	  See the raw(8) manpage for more details.

          Applications should preferably open the device (eg /dev/hda1)
          with the O_DIRECT flag.

config MAX_RAW_DEVS
	int "Maximum number of RAW devices to support (1-8192)"
	depends on RAW_DRIVER
	default "256"
	help
	  The maximum number of RAW devices that are supported.
	  Default is 256. Increase this number in case you need lots of
	  raw devices.

config HPET
	bool "HPET - High Precision Event Timer" if (X86 || IA64)
	default n
	depends on ACPI
	help
	  If you say Y here, you will have a miscdevice named "/dev/hpet/".  Each
	  open selects one of the timers supported by the HPET.  The timers are
	  non-periodic and/or periodic.

config HPET_MMAP
	bool "Allow mmap of HPET"
	default y
	depends on HPET
	help
	  If you say Y here, user applications will be able to mmap
	  the HPET registers.

	  In some hardware implementations, the page containing HPET
	  registers may also contain other things that shouldn't be
	  exposed to the user.  If this applies to your hardware,
	  say N here.

config HANGCHECK_TIMER
	tristate "Hangcheck timer"
	depends on X86 || IA64 || PPC64 || S390
	help
	  The hangcheck-timer module detects when the system has gone
	  out to lunch past a certain margin.  It can reboot the system
	  or merely print a warning.

config MMTIMER
	tristate "MMTIMER Memory mapped RTC for SGI Altix"
	depends on IA64_GENERIC || IA64_SGI_SN2
	default y
	help
	  The mmtimer device allows direct userspace access to the
	  Altix system timer.

config UV_MMTIMER
	tristate "UV_MMTIMER Memory mapped RTC for SGI UV"
	depends on X86_UV
	default m
	help
	  The uv_mmtimer device allows direct userspace access to the
	  UV system timer.

source "drivers/char/tpm/Kconfig"

config TELCLOCK
	tristate "Telecom clock driver for ATCA SBC"
	depends on EXPERIMENTAL && X86
	default n
	help
	  The telecom clock device is specific to the MPCBL0010 and MPCBL0050
	  ATCA computers and allows direct userspace access to the
	  configuration of the telecom clock configuration settings.  This
	  device is used for hardware synchronization across the ATCA backplane
	  fabric.  Upon loading, the driver exports a sysfs directory,
	  /sys/devices/platform/telco_clock, with a number of files for
	  controlling the behavior of this hardware.

config DEVPORT
	bool
	depends on !M68K
	depends on ISA || PCI
	default y

source "drivers/s390/char/Kconfig"

config RAMOOPS
	tristate "Log panic/oops to a RAM buffer"
	default n
	help
	  This enables panic and oops messages to be logged to a circular
	  buffer in RAM where it can be read back at some later point.

endmenu

46'>46 47 48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568




























                                                                              
                         






                           
                                  
                                          
  



                                                                        
                                                 





                                                            
                                              
                                                      
 







                                      

                                      
                                      
                                      
                                      
                                      
                                      
                                      











                                                          
                                                          




                                                                  
                                                          
                                                          
                                                          






                                                                  
                                                          
                                                          
 
                                                           

                                                                   
                                                           




                                                                    
                                                          
























                                                                                  
                                                 









                                                                    
                                                                    














                                                                                       
                                                     






                                                                                  
                                                 

                                                         
                                                        
























                                                                   
                                                                  






















































                                                                                



                                       



                           




























                                                                            



                                            









                                                                 
                                 
 


                                                                    




































                                                                 
                                    





















                                                    






















                                                            













                                                                            

                                                
                                               


                                         






















                                             
                                            
                                      

                              
                        


                                      
                           




                                      
                           
                                      













                                                      



                                                          
























                                                                              
                                                          
                                                          






                                                         
                                           
            
                                         

















































                                                                




                                     




















                                             











                                            







                                           
                                      
                           
                                         

                                             

                                      








                                                 
                                     
                           


                                                  





                                                  
                                  
                             








                                      


                                                    
                           
                                      






                                                        
                                  
                               

                               
                                                    
                                      






                                                             
                                  
                               


                                                             
                                      



                                                             
                                      










                                                                      




                                      




                                      
























































                                                                                      









                                                               
                                                               


                                                               
                                                               































                                                                     
                                                                    



                                                                    
                                                                    

















                                                            
                                    











































                                                        





                                       







                                            
                                        













                                                             
                                            
                                            
                                   



















































                                                
                       

                                            
                     










                             
                       










                                          





                       













                                                
                              
                       

                              
 
                                         

























































                                                                                
                                     









                                                                       
                     


                                        













                                       
                                         
 
                                 










                                                           
                                  


                                            
                                                   





































































































































                                                                             
                                                




















                                                                           
                                                                            

                                                                                
 
                                                                
                                             
                                                                      
 









                                                                         









                                                                                                         

                                                
                                                                                    






































































                                                                       














                                                                               














                                                                  












                                                                                 







                                                                    
                                                                   





























                                                              
/*
 * ipr.h -- driver for IBM Power Linux RAID adapters
 *
 * Written By: Brian King <brking@us.ibm.com>, IBM Corporation
 *
 * Copyright (C) 2003, 2004 IBM Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Alan Cox <alan@redhat.com> - Removed several careless u32/dma_addr_t errors
 *				that broke 64bit platforms.
 */

#ifndef _IPR_H
#define _IPR_H

#include <linux/types.h>
#include <linux/completion.h>
#include <linux/libata.h>
#include <linux/list.h>
#include <linux/kref.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>

/*
 * Literals
 */
#define IPR_DRIVER_VERSION "2.4.1"
#define IPR_DRIVER_DATE "(April 24, 2007)"

/*
 * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding
 *	ops per device for devices not running tagged command queuing.
 *	This can be adjusted at runtime through sysfs device attributes.
 */
#define IPR_MAX_CMD_PER_LUN				6
#define IPR_MAX_CMD_PER_ATA_LUN			1

/*
 * IPR_NUM_BASE_CMD_BLKS: This defines the maximum number of
 *	ops the mid-layer can send to the adapter.
 */
#define IPR_NUM_BASE_CMD_BLKS				100

#define PCI_DEVICE_ID_IBM_OBSIDIAN_E	0x0339
#define PCI_DEVICE_ID_IBM_SCAMP_E		0x034A

#define IPR_SUBS_DEV_ID_2780	0x0264
#define IPR_SUBS_DEV_ID_5702	0x0266
#define IPR_SUBS_DEV_ID_5703	0x0278
#define IPR_SUBS_DEV_ID_572E  0x028D
#define IPR_SUBS_DEV_ID_573E  0x02D3
#define IPR_SUBS_DEV_ID_573D  0x02D4
#define IPR_SUBS_DEV_ID_571A	0x02C0
#define IPR_SUBS_DEV_ID_571B	0x02BE
#define IPR_SUBS_DEV_ID_571E  0x02BF
#define IPR_SUBS_DEV_ID_571F	0x02D5
#define IPR_SUBS_DEV_ID_572A	0x02C1
#define IPR_SUBS_DEV_ID_572B	0x02C2
#define IPR_SUBS_DEV_ID_572F	0x02C3
#define IPR_SUBS_DEV_ID_574D	0x030B
#define IPR_SUBS_DEV_ID_574E	0x030A
#define IPR_SUBS_DEV_ID_575B	0x030D
#define IPR_SUBS_DEV_ID_575C	0x0338
#define IPR_SUBS_DEV_ID_575D	0x033E
#define IPR_SUBS_DEV_ID_57B3	0x033A
#define IPR_SUBS_DEV_ID_57B7	0x0360
#define IPR_SUBS_DEV_ID_57B8	0x02C2

#define IPR_NAME				"ipr"

/*
 * Return codes
 */
#define IPR_RC_JOB_CONTINUE		1
#define IPR_RC_JOB_RETURN		2

/*
 * IOASCs
 */
#define IPR_IOASC_NR_INIT_CMD_REQUIRED		0x02040200
#define IPR_IOASC_NR_IOA_RESET_REQUIRED		0x02048000
#define IPR_IOASC_SYNC_REQUIRED			0x023f0000
#define IPR_IOASC_MED_DO_NOT_REALLOC		0x03110C00
#define IPR_IOASC_HW_SEL_TIMEOUT			0x04050000
#define IPR_IOASC_HW_DEV_BUS_STATUS			0x04448500
#define	IPR_IOASC_IOASC_MASK			0xFFFFFF00
#define	IPR_IOASC_SCSI_STATUS_MASK		0x000000FF
#define IPR_IOASC_IR_INVALID_REQ_TYPE_OR_PKT	0x05240000
#define IPR_IOASC_IR_RESOURCE_HANDLE		0x05250000
#define IPR_IOASC_IR_NO_CMDS_TO_2ND_IOA		0x05258100
#define IPR_IOASA_IR_DUAL_IOA_DISABLED		0x052C8000
#define IPR_IOASC_BUS_WAS_RESET			0x06290000
#define IPR_IOASC_BUS_WAS_RESET_BY_OTHER		0x06298000
#define IPR_IOASC_ABORTED_CMD_TERM_BY_HOST	0x0B5A0000

#define IPR_FIRST_DRIVER_IOASC			0x10000000
#define IPR_IOASC_IOA_WAS_RESET			0x10000001
#define IPR_IOASC_PCI_ACCESS_ERROR			0x10000002

/* Driver data flags */
#define IPR_USE_LONG_TRANSOP_TIMEOUT		0x00000001
#define IPR_USE_PCI_WARM_RESET			0x00000002

#define IPR_DEFAULT_MAX_ERROR_DUMP			984
#define IPR_NUM_LOG_HCAMS				2
#define IPR_NUM_CFG_CHG_HCAMS				2
#define IPR_NUM_HCAMS	(IPR_NUM_LOG_HCAMS + IPR_NUM_CFG_CHG_HCAMS)
#define IPR_MAX_NUM_TARGETS_PER_BUS			256
#define IPR_MAX_NUM_LUNS_PER_TARGET			256
#define IPR_MAX_NUM_VSET_LUNS_PER_TARGET	8
#define IPR_VSET_BUS					0xff
#define IPR_IOA_BUS						0xff
#define IPR_IOA_TARGET					0xff
#define IPR_IOA_LUN						0xff
#define IPR_MAX_NUM_BUSES				16
#define IPR_MAX_BUS_TO_SCAN				IPR_MAX_NUM_BUSES

#define IPR_NUM_RESET_RELOAD_RETRIES		3

/* We need resources for HCAMS, IOA reset, IOA bringdown, and ERP */
#define IPR_NUM_INTERNAL_CMD_BLKS	(IPR_NUM_HCAMS + \
                                     ((IPR_NUM_RESET_RELOAD_RETRIES + 1) * 2) + 3)

#define IPR_MAX_COMMANDS		IPR_NUM_BASE_CMD_BLKS
#define IPR_NUM_CMD_BLKS		(IPR_NUM_BASE_CMD_BLKS + \
						IPR_NUM_INTERNAL_CMD_BLKS)

#define IPR_MAX_PHYSICAL_DEVS				192

#define IPR_MAX_SGLIST					64
#define IPR_IOA_MAX_SECTORS				32767
#define IPR_VSET_MAX_SECTORS				512
#define IPR_MAX_CDB_LEN					16

#define IPR_DEFAULT_BUS_WIDTH				16
#define IPR_80MBs_SCSI_RATE		((80 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8))
#define IPR_U160_SCSI_RATE	((160 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8))
#define IPR_U320_SCSI_RATE	((320 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8))
#define IPR_MAX_SCSI_RATE(width) ((320 * 10) / ((width) / 8))

#define IPR_IOA_RES_HANDLE				0xffffffff
#define IPR_INVALID_RES_HANDLE			0
#define IPR_IOA_RES_ADDR				0x00ffffff

/*
 * Adapter Commands
 */
#define IPR_QUERY_RSRC_STATE				0xC2
#define IPR_RESET_DEVICE				0xC3
#define	IPR_RESET_TYPE_SELECT				0x80
#define	IPR_LUN_RESET					0x40
#define	IPR_TARGET_RESET					0x20
#define	IPR_BUS_RESET					0x10
#define	IPR_ATA_PHY_RESET					0x80
#define IPR_ID_HOST_RR_Q				0xC4
#define IPR_QUERY_IOA_CONFIG				0xC5
#define IPR_CANCEL_ALL_REQUESTS			0xCE
#define IPR_HOST_CONTROLLED_ASYNC			0xCF
#define	IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE	0x01
#define	IPR_HCAM_CDB_OP_CODE_LOG_DATA		0x02
#define IPR_SET_SUPPORTED_DEVICES			0xFB
#define IPR_IOA_SHUTDOWN				0xF7
#define	IPR_WR_BUF_DOWNLOAD_AND_SAVE			0x05

/*
 * Timeouts
 */
#define IPR_SHUTDOWN_TIMEOUT			(ipr_fastfail ? 60 * HZ : 10 * 60 * HZ)
#define IPR_VSET_RW_TIMEOUT			(ipr_fastfail ? 30 * HZ : 2 * 60 * HZ)
#define IPR_ABBREV_SHUTDOWN_TIMEOUT		(10 * HZ)
#define IPR_DUAL_IOA_ABBR_SHUTDOWN_TO	(2 * 60 * HZ)
#define IPR_DEVICE_RESET_TIMEOUT		(ipr_fastfail ? 10 * HZ : 30 * HZ)
#define IPR_CANCEL_ALL_TIMEOUT		(ipr_fastfail ? 10 * HZ : 30 * HZ)
#define IPR_ABORT_TASK_TIMEOUT		(ipr_fastfail ? 10 * HZ : 30 * HZ)
#define IPR_INTERNAL_TIMEOUT			(ipr_fastfail ? 10 * HZ : 30 * HZ)
#define IPR_WRITE_BUFFER_TIMEOUT		(10 * 60 * HZ)
#define IPR_SET_SUP_DEVICE_TIMEOUT		(2 * 60 * HZ)
#define IPR_REQUEST_SENSE_TIMEOUT		(10 * HZ)
#define IPR_OPERATIONAL_TIMEOUT		(5 * 60)
#define IPR_LONG_OPERATIONAL_TIMEOUT	(12 * 60)
#define IPR_WAIT_FOR_RESET_TIMEOUT		(2 * HZ)
#define IPR_CHECK_FOR_RESET_TIMEOUT		(HZ / 10)
#define IPR_WAIT_FOR_BIST_TIMEOUT		(2 * HZ)
#define IPR_PCI_RESET_TIMEOUT			(HZ / 2)
#define IPR_DUMP_TIMEOUT			(15 * HZ)

/*
 * SCSI Literals
 */
#define IPR_VENDOR_ID_LEN			8
#define IPR_PROD_ID_LEN				16
#define IPR_SERIAL_NUM_LEN			8

/*
 * Hardware literals
 */
#define IPR_FMT2_MBX_ADDR_MASK				0x0fffffff
#define IPR_FMT2_MBX_BAR_SEL_MASK			0xf0000000
#define IPR_FMT2_MKR_BAR_SEL_SHIFT			28
#define IPR_GET_FMT2_BAR_SEL(mbx) \
(((mbx) & IPR_FMT2_MBX_BAR_SEL_MASK) >> IPR_FMT2_MKR_BAR_SEL_SHIFT)
#define IPR_SDT_FMT2_BAR0_SEL				0x0
#define IPR_SDT_FMT2_BAR1_SEL				0x1
#define IPR_SDT_FMT2_BAR2_SEL				0x2
#define IPR_SDT_FMT2_BAR3_SEL				0x3
#define IPR_SDT_FMT2_BAR4_SEL				0x4
#define IPR_SDT_FMT2_BAR5_SEL				0x5
#define IPR_SDT_FMT2_EXP_ROM_SEL			0x8
#define IPR_FMT2_SDT_READY_TO_USE			0xC4D4E3F2
#define IPR_DOORBELL					0x82800000
#define IPR_RUNTIME_RESET				0x40000000

#define IPR_PCII_IOA_TRANS_TO_OPER			(0x80000000 >> 0)
#define IPR_PCII_IOARCB_XFER_FAILED			(0x80000000 >> 3)
#define IPR_PCII_IOA_UNIT_CHECKED			(0x80000000 >> 4)
#define IPR_PCII_NO_HOST_RRQ				(0x80000000 >> 5)
#define IPR_PCII_CRITICAL_OPERATION			(0x80000000 >> 6)
#define IPR_PCII_IO_DEBUG_ACKNOWLEDGE		(0x80000000 >> 7)
#define IPR_PCII_IOARRIN_LOST				(0x80000000 >> 27)
#define IPR_PCII_MMIO_ERROR				(0x80000000 >> 28)
#define IPR_PCII_PROC_ERR_STATE			(0x80000000 >> 29)
#define IPR_PCII_HRRQ_UPDATED				(0x80000000 >> 30)
#define IPR_PCII_CORE_ISSUED_RST_REQ		(0x80000000 >> 31)

#define IPR_PCII_ERROR_INTERRUPTS \
(IPR_PCII_IOARCB_XFER_FAILED | IPR_PCII_IOA_UNIT_CHECKED | \
IPR_PCII_NO_HOST_RRQ | IPR_PCII_IOARRIN_LOST | IPR_PCII_MMIO_ERROR)

#define IPR_PCII_OPER_INTERRUPTS \
(IPR_PCII_ERROR_INTERRUPTS | IPR_PCII_HRRQ_UPDATED | IPR_PCII_IOA_TRANS_TO_OPER)

#define IPR_UPROCI_RESET_ALERT			(0x80000000 >> 7)
#define IPR_UPROCI_IO_DEBUG_ALERT			(0x80000000 >> 9)

#define IPR_LDUMP_MAX_LONG_ACK_DELAY_IN_USEC		200000	/* 200 ms */
#define IPR_LDUMP_MAX_SHORT_ACK_DELAY_IN_USEC		200000	/* 200 ms */

/*
 * Dump literals
 */
#define IPR_MAX_IOA_DUMP_SIZE				(4 * 1024 * 1024)
#define IPR_NUM_SDT_ENTRIES				511
#define IPR_MAX_NUM_DUMP_PAGES	((IPR_MAX_IOA_DUMP_SIZE / PAGE_SIZE) + 1)

/*
 * Misc literals
 */
#define IPR_NUM_IOADL_ENTRIES			IPR_MAX_SGLIST

/*
 * Adapter interface types
 */

struct ipr_res_addr {
	u8 reserved;
	u8 bus;
	u8 target;
	u8 lun;
#define IPR_GET_PHYS_LOC(res_addr) \
	(((res_addr).bus << 16) | ((res_addr).target << 8) | (res_addr).lun)
}__attribute__((packed, aligned (4)));

struct ipr_std_inq_vpids {
	u8 vendor_id[IPR_VENDOR_ID_LEN];
	u8 product_id[IPR_PROD_ID_LEN];
}__attribute__((packed));

struct ipr_vpd {
	struct ipr_std_inq_vpids vpids;
	u8 sn[IPR_SERIAL_NUM_LEN];
}__attribute__((packed));

struct ipr_ext_vpd {
	struct ipr_vpd vpd;
	__be32 wwid[2];
}__attribute__((packed));

struct ipr_std_inq_data {
	u8 peri_qual_dev_type;
#define IPR_STD_INQ_PERI_QUAL(peri) ((peri) >> 5)
#define IPR_STD_INQ_PERI_DEV_TYPE(peri) ((peri) & 0x1F)

	u8 removeable_medium_rsvd;
#define IPR_STD_INQ_REMOVEABLE_MEDIUM 0x80

#define IPR_IS_DASD_DEVICE(std_inq) \
((IPR_STD_INQ_PERI_DEV_TYPE((std_inq).peri_qual_dev_type) == TYPE_DISK) && \
!(((std_inq).removeable_medium_rsvd) & IPR_STD_INQ_REMOVEABLE_MEDIUM))

#define IPR_IS_SES_DEVICE(std_inq) \
(IPR_STD_INQ_PERI_DEV_TYPE((std_inq).peri_qual_dev_type) == TYPE_ENCLOSURE)

	u8 version;
	u8 aen_naca_fmt;
	u8 additional_len;
	u8 sccs_rsvd;
	u8 bq_enc_multi;
	u8 sync_cmdq_flags;

	struct ipr_std_inq_vpids vpids;

	u8 ros_rsvd_ram_rsvd[4];

	u8 serial_num[IPR_SERIAL_NUM_LEN];
}__attribute__ ((packed));

struct ipr_config_table_entry {
	u8 proto;
#define IPR_PROTO_SATA			0x02
#define IPR_PROTO_SATA_ATAPI		0x03
#define IPR_PROTO_SAS_STP		0x06
#define IPR_PROTO_SAS_STP_ATAPI	0x07
	u8 array_id;
	u8 flags;
#define IPR_IS_IOA_RESOURCE	0x80
#define IPR_IS_ARRAY_MEMBER 0x20
#define IPR_IS_HOT_SPARE	0x10

	u8 rsvd_subtype;
#define IPR_RES_SUBTYPE(res) (((res)->cfgte.rsvd_subtype) & 0x0f)
#define IPR_SUBTYPE_AF_DASD			0
#define IPR_SUBTYPE_GENERIC_SCSI	1
#define IPR_SUBTYPE_VOLUME_SET		2
#define IPR_SUBTYPE_GENERIC_ATA	4

#define IPR_QUEUEING_MODEL(res)	((((res)->cfgte.flags) & 0x70) >> 4)
#define IPR_QUEUE_FROZEN_MODEL	0
#define IPR_QUEUE_NACA_MODEL		1

	struct ipr_res_addr res_addr;
	__be32 res_handle;
	__be32 reserved4[2];
	struct ipr_std_inq_data std_inq_data;
}__attribute__ ((packed, aligned (4)));

struct ipr_config_table_hdr {
	u8 num_entries;
	u8 flags;
#define IPR_UCODE_DOWNLOAD_REQ	0x10
	__be16 reserved;
}__attribute__((packed, aligned (4)));

struct ipr_config_table {
	struct ipr_config_table_hdr hdr;
	struct ipr_config_table_entry dev[IPR_MAX_PHYSICAL_DEVS];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_cfg_ch_not {
	struct ipr_config_table_entry cfgte;
	u8 reserved[936];
}__attribute__((packed, aligned (4)));

struct ipr_supported_device {
	__be16 data_length;
	u8 reserved;
	u8 num_records;
	struct ipr_std_inq_vpids vpids;
	u8 reserved2[16];
}__attribute__((packed, aligned (4)));

/* Command packet structure */
struct ipr_cmd_pkt {
	__be16 reserved;		/* Reserved by IOA */
	u8 request_type;
#define IPR_RQTYPE_SCSICDB		0x00
#define IPR_RQTYPE_IOACMD		0x01
#define IPR_RQTYPE_HCAM			0x02
#define IPR_RQTYPE_ATA_PASSTHRU	0x04

	u8 luntar_luntrn;

	u8 flags_hi;
#define IPR_FLAGS_HI_WRITE_NOT_READ		0x80
#define IPR_FLAGS_HI_NO_ULEN_CHK		0x20
#define IPR_FLAGS_HI_SYNC_OVERRIDE		0x10
#define IPR_FLAGS_HI_SYNC_COMPLETE		0x08
#define IPR_FLAGS_HI_NO_LINK_DESC		0x04

	u8 flags_lo;
#define IPR_FLAGS_LO_ALIGNED_BFR		0x20
#define IPR_FLAGS_LO_DELAY_AFTER_RST	0x10
#define IPR_FLAGS_LO_UNTAGGED_TASK		0x00
#define IPR_FLAGS_LO_SIMPLE_TASK		0x02
#define IPR_FLAGS_LO_ORDERED_TASK		0x04
#define IPR_FLAGS_LO_HEAD_OF_Q_TASK		0x06
#define IPR_FLAGS_LO_ACA_TASK			0x08

	u8 cdb[16];
	__be16 timeout;
}__attribute__ ((packed, aligned(4)));

struct ipr_ioarcb_ata_regs {
	u8 flags;
#define IPR_ATA_FLAG_PACKET_CMD			0x80
#define IPR_ATA_FLAG_XFER_TYPE_DMA			0x40
#define IPR_ATA_FLAG_STATUS_ON_GOOD_COMPLETION	0x20
	u8 reserved[3];

	__be16 data;
	u8 feature;
	u8 nsect;
	u8 lbal;
	u8 lbam;
	u8 lbah;
	u8 device;
	u8 command;
	u8 reserved2[3];
	u8 hob_feature;
	u8 hob_nsect;
	u8 hob_lbal;
	u8 hob_lbam;
	u8 hob_lbah;
	u8 ctl;
}__attribute__ ((packed, aligned(4)));

struct ipr_ioadl_desc {
	__be32 flags_and_data_len;
#define IPR_IOADL_FLAGS_MASK		0xff000000
#define IPR_IOADL_GET_FLAGS(x) (be32_to_cpu(x) & IPR_IOADL_FLAGS_MASK)
#define IPR_IOADL_DATA_LEN_MASK		0x00ffffff
#define IPR_IOADL_GET_DATA_LEN(x) (be32_to_cpu(x) & IPR_IOADL_DATA_LEN_MASK)
#define IPR_IOADL_FLAGS_READ		0x48000000
#define IPR_IOADL_FLAGS_READ_LAST	0x49000000
#define IPR_IOADL_FLAGS_WRITE		0x68000000
#define IPR_IOADL_FLAGS_WRITE_LAST	0x69000000
#define IPR_IOADL_FLAGS_LAST		0x01000000

	__be32 address;
}__attribute__((packed, aligned (8)));

struct ipr_ioarcb_add_data {
	union {
		struct ipr_ioarcb_ata_regs regs;
		struct ipr_ioadl_desc ioadl[5];
		__be32 add_cmd_parms[10];
	}u;
}__attribute__ ((packed, aligned(4)));

/* IOA Request Control Block    128 bytes  */
struct ipr_ioarcb {
	__be32 ioarcb_host_pci_addr;
	__be32 reserved;
	__be32 res_handle;
	__be32 host_response_handle;
	__be32 reserved1;
	__be32 reserved2;
	__be32 reserved3;

	__be32 write_data_transfer_length;
	__be32 read_data_transfer_length;
	__be32 write_ioadl_addr;
	__be32 write_ioadl_len;
	__be32 read_ioadl_addr;
	__be32 read_ioadl_len;

	__be32 ioasa_host_pci_addr;
	__be16 ioasa_len;
	__be16 reserved4;

	struct ipr_cmd_pkt cmd_pkt;

	__be32 add_cmd_parms_len;
	struct ipr_ioarcb_add_data add_data;
}__attribute__((packed, aligned (4)));

struct ipr_ioasa_vset {
	__be32 failing_lba_hi;
	__be32 failing_lba_lo;
	__be32 reserved;
}__attribute__((packed, aligned (4)));

struct ipr_ioasa_af_dasd {
	__be32 failing_lba;
	__be32 reserved[2];
}__attribute__((packed, aligned (4)));

struct ipr_ioasa_gpdd {
	u8 end_state;
	u8 bus_phase;
	__be16 reserved;
	__be32 ioa_data[2];
}__attribute__((packed, aligned (4)));

struct ipr_ioasa_gata {
	u8 error;
	u8 nsect;		/* Interrupt reason */
	u8 lbal;
	u8 lbam;
	u8 lbah;
	u8 device;
	u8 status;
	u8 alt_status;	/* ATA CTL */
	u8 hob_nsect;
	u8 hob_lbal;
	u8 hob_lbam;
	u8 hob_lbah;
}__attribute__((packed, aligned (4)));

struct ipr_auto_sense {
	__be16 auto_sense_len;
	__be16 ioa_data_len;
	__be32 data[SCSI_SENSE_BUFFERSIZE/sizeof(__be32)];
};

struct ipr_ioasa {
	__be32 ioasc;
#define IPR_IOASC_SENSE_KEY(ioasc) ((ioasc) >> 24)
#define IPR_IOASC_SENSE_CODE(ioasc) (((ioasc) & 0x00ff0000) >> 16)
#define IPR_IOASC_SENSE_QUAL(ioasc) (((ioasc) & 0x0000ff00) >> 8)
#define IPR_IOASC_SENSE_STATUS(ioasc) ((ioasc) & 0x000000ff)

	__be16 ret_stat_len;	/* Length of the returned IOASA */

	__be16 avail_stat_len;	/* Total Length of status available. */

	__be32 residual_data_len;	/* number of bytes in the host data */
	/* buffers that were not used by the IOARCB command. */

	__be32 ilid;
#define IPR_NO_ILID			0
#define IPR_DRIVER_ILID		0xffffffff

	__be32 fd_ioasc;

	__be32 fd_phys_locator;

	__be32 fd_res_handle;

	__be32 ioasc_specific;	/* status code specific field */
#define IPR_ADDITIONAL_STATUS_FMT		0x80000000
#define IPR_AUTOSENSE_VALID			0x40000000
#define IPR_ATA_DEVICE_WAS_RESET		0x20000000
#define IPR_IOASC_SPECIFIC_MASK		0x00ffffff
#define IPR_FIELD_POINTER_VALID		(0x80000000 >> 8)
#define IPR_FIELD_POINTER_MASK		0x0000ffff

	union {
		struct ipr_ioasa_vset vset;
		struct ipr_ioasa_af_dasd dasd;
		struct ipr_ioasa_gpdd gpdd;
		struct ipr_ioasa_gata gata;
	} u;

	struct ipr_auto_sense auto_sense;
}__attribute__((packed, aligned (4)));

struct ipr_mode_parm_hdr {
	u8 length;
	u8 medium_type;
	u8 device_spec_parms;
	u8 block_desc_len;
}__attribute__((packed));

struct ipr_mode_pages {
	struct ipr_mode_parm_hdr hdr;
	u8 data[255 - sizeof(struct ipr_mode_parm_hdr)];
}__attribute__((packed));

struct ipr_mode_page_hdr {
	u8 ps_page_code;
#define IPR_MODE_PAGE_PS	0x80
#define IPR_GET_MODE_PAGE_CODE(hdr) ((hdr)->ps_page_code & 0x3F)
	u8 page_length;
}__attribute__ ((packed));

struct ipr_dev_bus_entry {
	struct ipr_res_addr res_addr;
	u8 flags;
#define IPR_SCSI_ATTR_ENABLE_QAS			0x80
#define IPR_SCSI_ATTR_DISABLE_QAS			0x40
#define IPR_SCSI_ATTR_QAS_MASK				0xC0
#define IPR_SCSI_ATTR_ENABLE_TM				0x20
#define IPR_SCSI_ATTR_NO_TERM_PWR			0x10
#define IPR_SCSI_ATTR_TM_SUPPORTED			0x08
#define IPR_SCSI_ATTR_LVD_TO_SE_NOT_ALLOWED	0x04

	u8 scsi_id;
	u8 bus_width;
	u8 extended_reset_delay;
#define IPR_EXTENDED_RESET_DELAY	7

	__be32 max_xfer_rate;

	u8 spinup_delay;
	u8 reserved3;
	__be16 reserved4;
}__attribute__((packed, aligned (4)));

struct ipr_mode_page28 {
	struct ipr_mode_page_hdr hdr;
	u8 num_entries;
	u8 entry_length;
	struct ipr_dev_bus_entry bus[0];
}__attribute__((packed));

struct ipr_mode_page24 {
	struct ipr_mode_page_hdr hdr;
	u8 flags;
#define IPR_ENABLE_DUAL_IOA_AF 0x80
}__attribute__((packed));

struct ipr_ioa_vpd {
	struct ipr_std_inq_data std_inq_data;
	u8 ascii_part_num[12];
	u8 reserved[40];
	u8 ascii_plant_code[4];
}__attribute__((packed));

struct ipr_inquiry_page3 {
	u8 peri_qual_dev_type;
	u8 page_code;
	u8 reserved1;
	u8 page_length;
	u8 ascii_len;
	u8 reserved2[3];
	u8 load_id[4];
	u8 major_release;
	u8 card_type;
	u8 minor_release[2];
	u8 ptf_number[4];
	u8 patch_number[4];
}__attribute__((packed));

struct ipr_inquiry_cap {
	u8 peri_qual_dev_type;
	u8 page_code;
	u8 reserved1;
	u8 page_length;
	u8 ascii_len;
	u8 reserved2;
	u8 sis_version[2];
	u8 cap;
#define IPR_CAP_DUAL_IOA_RAID		0x80
	u8 reserved3[15];
}__attribute__((packed));

#define IPR_INQUIRY_PAGE0_ENTRIES 20
struct ipr_inquiry_page0 {
	u8 peri_qual_dev_type;
	u8 page_code;
	u8 reserved1;
	u8 len;
	u8 page[IPR_INQUIRY_PAGE0_ENTRIES];
}__attribute__((packed));

struct ipr_hostrcb_device_data_entry {
	struct ipr_vpd vpd;
	struct ipr_res_addr dev_res_addr;
	struct ipr_vpd new_vpd;
	struct ipr_vpd ioa_last_with_dev_vpd;
	struct ipr_vpd cfc_last_with_dev_vpd;
	__be32 ioa_data[5];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_device_data_entry_enhanced {
	struct ipr_ext_vpd vpd;
	u8 ccin[4];
	struct ipr_res_addr dev_res_addr;
	struct ipr_ext_vpd new_vpd;
	u8 new_ccin[4];
	struct ipr_ext_vpd ioa_last_with_dev_vpd;
	struct ipr_ext_vpd cfc_last_with_dev_vpd;
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_array_data_entry {
	struct ipr_vpd vpd;
	struct ipr_res_addr expected_dev_res_addr;
	struct ipr_res_addr dev_res_addr;
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_array_data_entry_enhanced {
	struct ipr_ext_vpd vpd;
	u8 ccin[4];
	struct ipr_res_addr expected_dev_res_addr;
	struct ipr_res_addr dev_res_addr;
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_type_ff_error {
	__be32 ioa_data[502];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_type_01_error {
	__be32 seek_counter;
	__be32 read_counter;
	u8 sense_data[32];
	__be32 ioa_data[236];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_type_02_error {
	struct ipr_vpd ioa_vpd;
	struct ipr_vpd cfc_vpd;
	struct ipr_vpd ioa_last_attached_to_cfc_vpd;
	struct ipr_vpd cfc_last_attached_to_ioa_vpd;
	__be32 ioa_data[3];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_type_12_error {
	struct ipr_ext_vpd ioa_vpd;
	struct ipr_ext_vpd cfc_vpd;
	struct ipr_ext_vpd ioa_last_attached_to_cfc_vpd;
	struct ipr_ext_vpd cfc_last_attached_to_ioa_vpd;
	__be32 ioa_data[3];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_type_03_error {
	struct ipr_vpd ioa_vpd;
	struct ipr_vpd cfc_vpd;
	__be32 errors_detected;
	__be32 errors_logged;
	u8 ioa_data[12];
	struct ipr_hostrcb_device_data_entry dev[3];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_type_13_error {
	struct ipr_ext_vpd ioa_vpd;
	struct ipr_ext_vpd cfc_vpd;
	__be32 errors_detected;
	__be32 errors_logged;
	struct ipr_hostrcb_device_data_entry_enhanced dev[3];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_type_04_error {
	struct ipr_vpd ioa_vpd;
	struct ipr_vpd cfc_vpd;
	u8 ioa_data[12];
	struct ipr_hostrcb_array_data_entry array_member[10];
	__be32 exposed_mode_adn;
	__be32 array_id;
	struct ipr_vpd incomp_dev_vpd;
	__be32 ioa_data2;
	struct ipr_hostrcb_array_data_entry array_member2[8];
	struct ipr_res_addr last_func_vset_res_addr;
	u8 vset_serial_num[IPR_SERIAL_NUM_LEN];
	u8 protection_level[8];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_type_14_error {
	struct ipr_ext_vpd ioa_vpd;
	struct ipr_ext_vpd cfc_vpd;
	__be32 exposed_mode_adn;
	__be32 array_id;
	struct ipr_res_addr last_func_vset_res_addr;
	u8 vset_serial_num[IPR_SERIAL_NUM_LEN];
	u8 protection_level[8];
	__be32 num_entries;
	struct ipr_hostrcb_array_data_entry_enhanced array_member[18];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_type_07_error {
	u8 failure_reason[64];
	struct ipr_vpd vpd;
	u32 data[222];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_type_17_error {
	u8 failure_reason[64];
	struct ipr_ext_vpd vpd;
	u32 data[476];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_config_element {
	u8 type_status;
#define IPR_PATH_CFG_TYPE_MASK	0xF0
#define IPR_PATH_CFG_NOT_EXIST	0x00
#define IPR_PATH_CFG_IOA_PORT		0x10
#define IPR_PATH_CFG_EXP_PORT		0x20
#define IPR_PATH_CFG_DEVICE_PORT	0x30
#define IPR_PATH_CFG_DEVICE_LUN	0x40

#define IPR_PATH_CFG_STATUS_MASK	0x0F
#define IPR_PATH_CFG_NO_PROB		0x00
#define IPR_PATH_CFG_DEGRADED		0x01
#define IPR_PATH_CFG_FAILED		0x02
#define IPR_PATH_CFG_SUSPECT		0x03
#define IPR_PATH_NOT_DETECTED		0x04
#define IPR_PATH_INCORRECT_CONN	0x05

	u8 cascaded_expander;
	u8 phy;
	u8 link_rate;
#define IPR_PHY_LINK_RATE_MASK	0x0F

	__be32 wwid[2];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_fabric_desc {
	__be16 length;
	u8 ioa_port;
	u8 cascaded_expander;
	u8 phy;
	u8 path_state;
#define IPR_PATH_ACTIVE_MASK		0xC0
#define IPR_PATH_NO_INFO		0x00
#define IPR_PATH_ACTIVE			0x40
#define IPR_PATH_NOT_ACTIVE		0x80

#define IPR_PATH_STATE_MASK		0x0F
#define IPR_PATH_STATE_NO_INFO	0x00
#define IPR_PATH_HEALTHY		0x01
#define IPR_PATH_DEGRADED		0x02
#define IPR_PATH_FAILED			0x03

	__be16 num_entries;
	struct ipr_hostrcb_config_element elem[1];
}__attribute__((packed, aligned (4)));

#define for_each_fabric_cfg(fabric, cfg) \
		for (cfg = (fabric)->elem; \
			cfg < ((fabric)->elem + be16_to_cpu((fabric)->num_entries)); \
			cfg++)

struct ipr_hostrcb_type_20_error {
	u8 failure_reason[64];
	u8 reserved[3];
	u8 num_entries;
	struct ipr_hostrcb_fabric_desc desc[1];
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_error {
	__be32 failing_dev_ioasc;
	struct ipr_res_addr failing_dev_res_addr;
	__be32 failing_dev_res_handle;
	__be32 prc;
	union {
		struct ipr_hostrcb_type_ff_error type_ff_error;
		struct ipr_hostrcb_type_01_error type_01_error;
		struct ipr_hostrcb_type_02_error type_02_error;
		struct ipr_hostrcb_type_03_error type_03_error;
		struct ipr_hostrcb_type_04_error type_04_error;
		struct ipr_hostrcb_type_07_error type_07_error;
		struct ipr_hostrcb_type_12_error type_12_error;
		struct ipr_hostrcb_type_13_error type_13_error;
		struct ipr_hostrcb_type_14_error type_14_error;
		struct ipr_hostrcb_type_17_error type_17_error;
		struct ipr_hostrcb_type_20_error type_20_error;
	} u;
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb_raw {
	__be32 data[sizeof(struct ipr_hostrcb_error)/sizeof(__be32)];
}__attribute__((packed, aligned (4)));

struct ipr_hcam {
	u8 op_code;
#define IPR_HOST_RCB_OP_CODE_CONFIG_CHANGE			0xE1
#define IPR_HOST_RCB_OP_CODE_LOG_DATA				0xE2

	u8 notify_type;
#define IPR_HOST_RCB_NOTIF_TYPE_EXISTING_CHANGED	0x00
#define IPR_HOST_RCB_NOTIF_TYPE_NEW_ENTRY			0x01
#define IPR_HOST_RCB_NOTIF_TYPE_REM_ENTRY			0x02
#define IPR_HOST_RCB_NOTIF_TYPE_ERROR_LOG_ENTRY		0x10
#define IPR_HOST_RCB_NOTIF_TYPE_INFORMATION_ENTRY	0x11

	u8 notifications_lost;
#define IPR_HOST_RCB_NO_NOTIFICATIONS_LOST			0
#define IPR_HOST_RCB_NOTIFICATIONS_LOST				0x80

	u8 flags;
#define IPR_HOSTRCB_INTERNAL_OPER	0x80
#define IPR_HOSTRCB_ERR_RESP_SENT	0x40

	u8 overlay_id;
#define IPR_HOST_RCB_OVERLAY_ID_1				0x01
#define IPR_HOST_RCB_OVERLAY_ID_2				0x02
#define IPR_HOST_RCB_OVERLAY_ID_3				0x03
#define IPR_HOST_RCB_OVERLAY_ID_4				0x04
#define IPR_HOST_RCB_OVERLAY_ID_6				0x06
#define IPR_HOST_RCB_OVERLAY_ID_7				0x07
#define IPR_HOST_RCB_OVERLAY_ID_12				0x12
#define IPR_HOST_RCB_OVERLAY_ID_13				0x13
#define IPR_HOST_RCB_OVERLAY_ID_14				0x14
#define IPR_HOST_RCB_OVERLAY_ID_16				0x16
#define IPR_HOST_RCB_OVERLAY_ID_17				0x17
#define IPR_HOST_RCB_OVERLAY_ID_20				0x20
#define IPR_HOST_RCB_OVERLAY_ID_DEFAULT			0xFF

	u8 reserved1[3];
	__be32 ilid;
	__be32 time_since_last_ioa_reset;
	__be32 reserved2;
	__be32 length;

	union {
		struct ipr_hostrcb_error error;
		struct ipr_hostrcb_cfg_ch_not ccn;
		struct ipr_hostrcb_raw raw;
	} u;
}__attribute__((packed, aligned (4)));

struct ipr_hostrcb {
	struct ipr_hcam hcam;
	dma_addr_t hostrcb_dma;
	struct list_head queue;
	struct ipr_ioa_cfg *ioa_cfg;
};

/* IPR smart dump table structures */
struct ipr_sdt_entry {
	__be32 bar_str_offset;
	__be32 end_offset;
	u8 entry_byte;
	u8 reserved[3];

	u8 flags;
#define IPR_SDT_ENDIAN		0x80
#define IPR_SDT_VALID_ENTRY	0x20

	u8 resv;
	__be16 priority;
}__attribute__((packed, aligned (4)));

struct ipr_sdt_header {
	__be32 state;
	__be32 num_entries;
	__be32 num_entries_used;
	__be32 dump_size;
}__attribute__((packed, aligned (4)));

struct ipr_sdt {
	struct ipr_sdt_header hdr;
	struct ipr_sdt_entry entry[IPR_NUM_SDT_ENTRIES];
}__attribute__((packed, aligned (4)));

struct ipr_uc_sdt {
	struct ipr_sdt_header hdr;
	struct ipr_sdt_entry entry[1];
}__attribute__((packed, aligned (4)));

/*
 * Driver types
 */
struct ipr_bus_attributes {
	u8 bus;
	u8 qas_enabled;
	u8 bus_width;
	u8 reserved;
	u32 max_xfer_rate;
};

struct ipr_sata_port {
	struct ipr_ioa_cfg *ioa_cfg;
	struct ata_port *ap;
	struct ipr_resource_entry *res;
	struct ipr_ioasa_gata ioasa;
};

struct ipr_resource_entry {
	struct ipr_config_table_entry cfgte;
	u8 needs_sync_complete:1;
	u8 in_erp:1;
	u8 add_to_ml:1;
	u8 del_from_ml:1;
	u8 resetting_device:1;

	struct scsi_device *sdev;
	struct ipr_sata_port *sata_port;
	struct list_head queue;
};

struct ipr_resource_hdr {
	u16 num_entries;
	u16 reserved;
};

struct ipr_resource_table {
	struct ipr_resource_hdr hdr;
	struct ipr_resource_entry dev[IPR_MAX_PHYSICAL_DEVS];
};

struct ipr_misc_cbs {
	struct ipr_ioa_vpd ioa_vpd;
	struct ipr_inquiry_page0 page0_data;
	struct ipr_inquiry_page3 page3_data;
	struct ipr_inquiry_cap cap;
	struct ipr_mode_pages mode_pages;
	struct ipr_supported_device supp_dev;
};

struct ipr_interrupt_offsets {
	unsigned long set_interrupt_mask_reg;
	unsigned long clr_interrupt_mask_reg;
	unsigned long sense_interrupt_mask_reg;
	unsigned long clr_interrupt_reg;

	unsigned long sense_interrupt_reg;
	unsigned long ioarrin_reg;
	unsigned long sense_uproc_interrupt_reg;
	unsigned long set_uproc_interrupt_reg;
	unsigned long clr_uproc_interrupt_reg;
};

struct ipr_interrupts {
	void __iomem *set_interrupt_mask_reg;
	void __iomem *clr_interrupt_mask_reg;
	void __iomem *sense_interrupt_mask_reg;
	void __iomem *clr_interrupt_reg;

	void __iomem *sense_interrupt_reg;
	void __iomem *ioarrin_reg;
	void __iomem *sense_uproc_interrupt_reg;
	void __iomem *set_uproc_interrupt_reg;
	void __iomem *clr_uproc_interrupt_reg;
};

struct ipr_chip_cfg_t {
	u32 mailbox;
	u8 cache_line_size;
	struct ipr_interrupt_offsets regs;
};

struct ipr_chip_t {
	u16 vendor;
	u16 device;
	const struct ipr_chip_cfg_t *cfg;
};

enum ipr_shutdown_type {
	IPR_SHUTDOWN_NORMAL = 0x00,
	IPR_SHUTDOWN_PREPARE_FOR_NORMAL = 0x40,
	IPR_SHUTDOWN_ABBREV = 0x80,
	IPR_SHUTDOWN_NONE = 0x100
};

struct ipr_trace_entry {
	u32 time;

	u8 op_code;
	u8 ata_op_code;
	u8 type;
#define IPR_TRACE_START			0x00
#define IPR_TRACE_FINISH		0xff
	u8 cmd_index;

	__be32 res_handle;
	union {
		u32 ioasc;
		u32 add_data;
		u32 res_addr;
	} u;
};

struct ipr_sglist {
	u32 order;
	u32 num_sg;
	u32 num_dma_sg;
	u32 buffer_len;
	struct scatterlist scatterlist[1];
};

enum ipr_sdt_state {
	INACTIVE,
	WAIT_FOR_DUMP,
	GET_DUMP,
	ABORT_DUMP,
	DUMP_OBTAINED
};

enum ipr_cache_state {
	CACHE_NONE,
	CACHE_DISABLED,
	CACHE_ENABLED,
	CACHE_INVALID
};

/* Per-controller data */
struct ipr_ioa_cfg {
	char eye_catcher[8];
#define IPR_EYECATCHER			"iprcfg"

	struct list_head queue;

	u8 allow_interrupts:1;
	u8 in_reset_reload:1;
	u8 in_ioa_bringdown:1;
	u8 ioa_unit_checked:1;
	u8 ioa_is_dead:1;
	u8 dump_taken:1;
	u8 allow_cmds:1;
	u8 allow_ml_add_del:1;
	u8 needs_hard_reset:1;
	u8 dual_raid:1;
	u8 needs_warm_reset:1;

	u8 revid;

	enum ipr_cache_state cache_state;
	u16 type; /* CCIN of the card */

	u8 log_level;
#define IPR_MAX_LOG_LEVEL			4
#define IPR_DEFAULT_LOG_LEVEL		2

#define IPR_NUM_TRACE_INDEX_BITS	8
#define IPR_NUM_TRACE_ENTRIES		(1 << IPR_NUM_TRACE_INDEX_BITS)
#define IPR_TRACE_SIZE	(sizeof(struct ipr_trace_entry) * IPR_NUM_TRACE_ENTRIES)
	char trace_start[8];
#define IPR_TRACE_START_LABEL			"trace"
	struct ipr_trace_entry *trace;
	u32 trace_index:IPR_NUM_TRACE_INDEX_BITS;

	/*
	 * Queue for free command blocks
	 */
	char ipr_free_label[8];
#define IPR_FREEQ_LABEL			"free-q"
	struct list_head free_q;

	/*
	 * Queue for command blocks outstanding to the adapter
	 */
	char ipr_pending_label[8];
#define IPR_PENDQ_LABEL			"pend-q"
	struct list_head pending_q;

	char cfg_table_start[8];
#define IPR_CFG_TBL_START		"cfg"
	struct ipr_config_table *cfg_table;
	dma_addr_t cfg_table_dma;

	char resource_table_label[8];
#define IPR_RES_TABLE_LABEL		"res_tbl"
	struct ipr_resource_entry *res_entries;
	struct list_head free_res_q;
	struct list_head used_res_q;

	char ipr_hcam_label[8];
#define IPR_HCAM_LABEL			"hcams"
	struct ipr_hostrcb *hostrcb[IPR_NUM_HCAMS];
	dma_addr_t hostrcb_dma[IPR_NUM_HCAMS];
	struct list_head hostrcb_free_q;
	struct list_head hostrcb_pending_q;

	__be32 *host_rrq;
	dma_addr_t host_rrq_dma;
#define IPR_HRRQ_REQ_RESP_HANDLE_MASK	0xfffffffc
#define IPR_HRRQ_RESP_BIT_SET			0x00000002
#define IPR_HRRQ_TOGGLE_BIT				0x00000001
#define IPR_HRRQ_REQ_RESP_HANDLE_SHIFT	2
	volatile __be32 *hrrq_start;
	volatile __be32 *hrrq_end;
	volatile __be32 *hrrq_curr;
	volatile u32 toggle_bit;

	struct ipr_bus_attributes bus_attr[IPR_MAX_NUM_BUSES];

	unsigned int transop_timeout;
	const struct ipr_chip_cfg_t *chip_cfg;

	void __iomem *hdw_dma_regs;	/* iomapped PCI memory space */
	unsigned long hdw_dma_regs_pci;	/* raw PCI memory space */
	void __iomem *ioa_mailbox;
	struct ipr_interrupts regs;

	u16 saved_pcix_cmd_reg;
	u16 reset_retries;

	u32 errors_logged;
	u32 doorbell;

	struct Scsi_Host *host;
	struct pci_dev *pdev;
	struct ipr_sglist *ucode_sglist;
	u8 saved_mode_page_len;

	struct work_struct work_q;

	wait_queue_head_t reset_wait_q;

	struct ipr_dump *dump;
	enum ipr_sdt_state sdt_state;

	struct ipr_misc_cbs *vpd_cbs;
	dma_addr_t vpd_cbs_dma;

	struct pci_pool *ipr_cmd_pool;

	struct ipr_cmnd *reset_cmd;
	int (*reset) (struct ipr_cmnd *);

	struct ata_host ata_host;
	char ipr_cmd_label[8];
#define IPR_CMD_LABEL		"ipr_cmnd"
	struct ipr_cmnd *ipr_cmnd_list[IPR_NUM_CMD_BLKS];
	u32 ipr_cmnd_list_dma[IPR_NUM_CMD_BLKS];
};

struct ipr_cmnd {
	struct ipr_ioarcb ioarcb;
	struct ipr_ioasa ioasa;
	struct ipr_ioadl_desc ioadl[IPR_NUM_IOADL_ENTRIES];
	struct list_head queue;
	struct scsi_cmnd *scsi_cmd;
	struct ata_queued_cmd *qc;
	struct completion completion;
	struct timer_list timer;
	void (*done) (struct ipr_cmnd *);
	int (*job_step) (struct ipr_cmnd *);
	int (*job_step_failed) (struct ipr_cmnd *);
	u16 cmd_index;
	u8 sense_buffer[SCSI_SENSE_BUFFERSIZE];
	dma_addr_t sense_buffer_dma;
	unsigned short dma_use_sg;
	dma_addr_t dma_handle;
	struct ipr_cmnd *sibling;
	union {
		enum ipr_shutdown_type shutdown_type;
		struct ipr_hostrcb *hostrcb;
		unsigned long time_left;
		unsigned long scratch;
		struct ipr_resource_entry *res;
		struct scsi_device *sdev;
	} u;

	struct ipr_ioa_cfg *ioa_cfg;
};

struct ipr_ses_table_entry {
	char product_id[17];
	char compare_product_id_byte[17];
	u32 max_bus_speed_limit;	/* MB/sec limit for this backplane */
};

struct ipr_dump_header {
	u32 eye_catcher;
#define IPR_DUMP_EYE_CATCHER		0xC5D4E3F2
	u32 len;
	u32 num_entries;
	u32 first_entry_offset;
	u32 status;
#define IPR_DUMP_STATUS_SUCCESS			0
#define IPR_DUMP_STATUS_QUAL_SUCCESS		2
#define IPR_DUMP_STATUS_FAILED			0xffffffff
	u32 os;
#define IPR_DUMP_OS_LINUX	0x4C4E5558
	u32 driver_name;
#define IPR_DUMP_DRIVER_NAME	0x49505232
}__attribute__((packed, aligned (4)));

struct ipr_dump_entry_header {
	u32 eye_catcher;
#define IPR_DUMP_EYE_CATCHER		0xC5D4E3F2
	u32 len;
	u32 num_elems;
	u32 offset;
	u32 data_type;
#define IPR_DUMP_DATA_TYPE_ASCII	0x41534349
#define IPR_DUMP_DATA_TYPE_BINARY	0x42494E41
	u32 id;
#define IPR_DUMP_IOA_DUMP_ID		0x494F4131
#define IPR_DUMP_LOCATION_ID		0x4C4F4341
#define IPR_DUMP_TRACE_ID		0x54524143
#define IPR_DUMP_DRIVER_VERSION_ID	0x44525652
#define IPR_DUMP_DRIVER_TYPE_ID	0x54595045
#define IPR_DUMP_IOA_CTRL_BLK		0x494F4342
#define IPR_DUMP_PEND_OPS		0x414F5053
	u32 status;
}__attribute__((packed, aligned (4)));

struct ipr_dump_location_entry {
	struct ipr_dump_entry_header hdr;
	u8 location[BUS_ID_SIZE];
}__attribute__((packed));

struct ipr_dump_trace_entry {
	struct ipr_dump_entry_header hdr;
	u32 trace[IPR_TRACE_SIZE / sizeof(u32)];
}__attribute__((packed, aligned (4)));

struct ipr_dump_version_entry {
	struct ipr_dump_entry_header hdr;
	u8 version[sizeof(IPR_DRIVER_VERSION)];
};

struct ipr_dump_ioa_type_entry {
	struct ipr_dump_entry_header hdr;
	u32 type;
	u32 fw_version;
};

struct ipr_driver_dump {
	struct ipr_dump_header hdr;
	struct ipr_dump_version_entry version_entry;
	struct ipr_dump_location_entry location_entry;
	struct ipr_dump_ioa_type_entry ioa_type_entry;
	struct ipr_dump_trace_entry trace_entry;
}__attribute__((packed));

struct ipr_ioa_dump {
	struct ipr_dump_entry_header hdr;
	struct ipr_sdt sdt;
	__be32 *ioa_data[IPR_MAX_NUM_DUMP_PAGES];
	u32 reserved;
	u32 next_page_index;
	u32 page_offset;
	u32 format;
#define IPR_SDT_FMT2		2
#define IPR_SDT_UNKNOWN		3
}__attribute__((packed, aligned (4)));

struct ipr_dump {
	struct kref kref;
	struct ipr_ioa_cfg *ioa_cfg;
	struct ipr_driver_dump driver_dump;
	struct ipr_ioa_dump ioa_dump;
};

struct ipr_error_table_t {
	u32 ioasc;
	int log_ioasa;
	int log_hcam;
	char *error;
};

struct ipr_software_inq_lid_info {
	__be32 load_id;
	__be32 timestamp[3];
}__attribute__((packed, aligned (4)));

struct ipr_ucode_image_header {
	__be32 header_length;
	__be32 lid_table_offset;
	u8 major_release;
	u8 card_type;
	u8 minor_release[2];
	u8 reserved[20];
	char eyecatcher[16];
	__be32 num_lids;
	struct ipr_software_inq_lid_info lid[1];
}__attribute__((packed, aligned (4)));

/*
 * Macros
 */
#define IPR_DBG_CMD(CMD) if (ipr_debug) { CMD; }

#ifdef CONFIG_SCSI_IPR_TRACE
#define ipr_create_trace_file(kobj, attr) sysfs_create_bin_file(kobj, attr)
#define ipr_remove_trace_file(kobj, attr) sysfs_remove_bin_file(kobj, attr)
#else
#define ipr_create_trace_file(kobj, attr) 0
#define ipr_remove_trace_file(kobj, attr) do { } while(0)
#endif

#ifdef CONFIG_SCSI_IPR_DUMP
#define ipr_create_dump_file(kobj, attr) sysfs_create_bin_file(kobj, attr)
#define ipr_remove_dump_file(kobj, attr) sysfs_remove_bin_file(kobj, attr)
#else
#define ipr_create_dump_file(kobj, attr) 0
#define ipr_remove_dump_file(kobj, attr) do { } while(0)
#endif

/*
 * Error logging macros
 */
#define ipr_err(...) printk(KERN_ERR IPR_NAME ": "__VA_ARGS__)
#define ipr_info(...) printk(KERN_INFO IPR_NAME ": "__VA_ARGS__)
#define ipr_dbg(...) IPR_DBG_CMD(printk(KERN_INFO IPR_NAME ": "__VA_ARGS__))

#define ipr_ra_printk(level, ioa_cfg, ra, fmt, ...) \
	printk(level IPR_NAME ": %d:%d:%d:%d: " fmt, (ioa_cfg)->host->host_no, \
		(ra).bus, (ra).target, (ra).lun, ##__VA_ARGS__)

#define ipr_ra_err(ioa_cfg, ra, fmt, ...) \
	ipr_ra_printk(KERN_ERR, ioa_cfg, ra, fmt, ##__VA_ARGS__)

#define ipr_res_err(ioa_cfg, res, fmt, ...) \
	ipr_ra_err(ioa_cfg, (res)->cfgte.res_addr, fmt, ##__VA_ARGS__)

#define ipr_phys_res_err(ioa_cfg, res, fmt, ...)			\
{									\
	if ((res).bus >= IPR_MAX_NUM_BUSES) {				\
		ipr_err(fmt": unknown\n", ##__VA_ARGS__);		\
	} else {							\
		ipr_err(fmt": %d:%d:%d:%d\n",				\
			##__VA_ARGS__, (ioa_cfg)->host->host_no,	\
			(res).bus, (res).target, (res).lun);		\
	}								\
}

#define ipr_hcam_err(hostrcb, fmt, ...)					\
{													\
	if (ipr_is_device(&(hostrcb)->hcam.u.error.failing_dev_res_addr)) {		\
		ipr_ra_err((hostrcb)->ioa_cfg,							\
				(hostrcb)->hcam.u.error.failing_dev_res_addr,			\
				fmt, ##__VA_ARGS__);							\
	} else {											\
		dev_err(&(hostrcb)->ioa_cfg->pdev->dev, fmt, ##__VA_ARGS__);		\
	}												\
}

#define ipr_trace ipr_dbg("%s: %s: Line: %d\n",\
	__FILE__, __FUNCTION__, __LINE__)

#define ENTER IPR_DBG_CMD(printk(KERN_INFO IPR_NAME": Entering %s\n", __FUNCTION__))
#define LEAVE IPR_DBG_CMD(printk(KERN_INFO IPR_NAME": Leaving %s\n", __FUNCTION__))

#define ipr_err_separator \
ipr_err("----------------------------------------------------------\n")


/*
 * Inlines
 */

/**
 * ipr_is_ioa_resource - Determine if a resource is the IOA
 * @res:	resource entry struct
 *
 * Return value:
 * 	1 if IOA / 0 if not IOA
 **/
static inline int ipr_is_ioa_resource(struct ipr_resource_entry *res)
{
	return (res->cfgte.flags & IPR_IS_IOA_RESOURCE) ? 1 : 0;
}

/**
 * ipr_is_af_dasd_device - Determine if a resource is an AF DASD
 * @res:	resource entry struct
 *
 * Return value:
 * 	1 if AF DASD / 0 if not AF DASD
 **/
static inline int ipr_is_af_dasd_device(struct ipr_resource_entry *res)
{
	if (IPR_IS_DASD_DEVICE(res->cfgte.std_inq_data) &&
	    !ipr_is_ioa_resource(res) &&
	    IPR_RES_SUBTYPE(res) == IPR_SUBTYPE_AF_DASD)
		return 1;
	else
		return 0;
}

/**
 * ipr_is_vset_device - Determine if a resource is a VSET
 * @res:	resource entry struct
 *
 * Return value:
 * 	1 if VSET / 0 if not VSET
 **/
static inline int ipr_is_vset_device(struct ipr_resource_entry *res)
{
	if (IPR_IS_DASD_DEVICE(res->cfgte.std_inq_data) &&
	    !ipr_is_ioa_resource(res) &&
	    IPR_RES_SUBTYPE(res) == IPR_SUBTYPE_VOLUME_SET)
		return 1;
	else
		return 0;
}

/**
 * ipr_is_gscsi - Determine if a resource is a generic scsi resource
 * @res:	resource entry struct
 *
 * Return value:
 * 	1 if GSCSI / 0 if not GSCSI
 **/
static inline int ipr_is_gscsi(struct ipr_resource_entry *res)
{
	if (!ipr_is_ioa_resource(res) &&
	    IPR_RES_SUBTYPE(res) == IPR_SUBTYPE_GENERIC_SCSI)
		return 1;
	else
		return 0;
}

/**
 * ipr_is_scsi_disk - Determine if a resource is a SCSI disk
 * @res:	resource entry struct
 *
 * Return value:
 * 	1 if SCSI disk / 0 if not SCSI disk
 **/
static inline int ipr_is_scsi_disk(struct ipr_resource_entry *res)
{
	if (ipr_is_af_dasd_device(res) ||
	    (ipr_is_gscsi(res) && IPR_IS_DASD_DEVICE(res->cfgte.std_inq_data)))
		return 1;
	else
		return 0;
}

/**
 * ipr_is_gata - Determine if a resource is a generic ATA resource
 * @res:	resource entry struct
 *
 * Return value:
 * 	1 if GATA / 0 if not GATA
 **/
static inline int ipr_is_gata(struct ipr_resource_entry *res)
{
	if (!ipr_is_ioa_resource(res) &&
	    IPR_RES_SUBTYPE(res) == IPR_SUBTYPE_GENERIC_ATA)
		return 1;
	else
		return 0;
}

/**
 * ipr_is_naca_model - Determine if a resource is using NACA queueing model
 * @res:	resource entry struct
 *