Commit 9ea9a886b0e8630e12cff515955e7f0f5be32cb1

Authored by Clemens Ladisch
Committed by Linus Torvalds
1 parent 135d5655dc

vt: make the default cursor shape configurable

For embedded systems, the blinking cursor at startup time can be annoying
and unintended.  Add a new kernel parameter to change the default cursor
shape.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Cc: Daniel Mack <daniel@caiaq.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: David Newall <davidn@davidnewall.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 10 additions and 2 deletions Inline Diff

Documentation/kernel-parameters.txt
1 Kernel Parameters 1 Kernel Parameters
2 ~~~~~~~~~~~~~~~~~ 2 ~~~~~~~~~~~~~~~~~
3 3
4 The following is a consolidated list of the kernel parameters as implemented 4 The following is a consolidated list of the kernel parameters as implemented
5 (mostly) by the __setup() macro and sorted into English Dictionary order 5 (mostly) by the __setup() macro and sorted into English Dictionary order
6 (defined as ignoring all punctuation and sorting digits before letters in a 6 (defined as ignoring all punctuation and sorting digits before letters in a
7 case insensitive manner), and with descriptions where known. 7 case insensitive manner), and with descriptions where known.
8 8
9 Module parameters for loadable modules are specified only as the 9 Module parameters for loadable modules are specified only as the
10 parameter name with optional '=' and value as appropriate, such as: 10 parameter name with optional '=' and value as appropriate, such as:
11 11
12 modprobe usbcore blinkenlights=1 12 modprobe usbcore blinkenlights=1
13 13
14 Module parameters for modules that are built into the kernel image 14 Module parameters for modules that are built into the kernel image
15 are specified on the kernel command line with the module name plus 15 are specified on the kernel command line with the module name plus
16 '.' plus parameter name, with '=' and value if appropriate, such as: 16 '.' plus parameter name, with '=' and value if appropriate, such as:
17 17
18 usbcore.blinkenlights=1 18 usbcore.blinkenlights=1
19 19
20 Hyphens (dashes) and underscores are equivalent in parameter names, so 20 Hyphens (dashes) and underscores are equivalent in parameter names, so
21 log_buf_len=1M print-fatal-signals=1 21 log_buf_len=1M print-fatal-signals=1
22 can also be entered as 22 can also be entered as
23 log-buf-len=1M print_fatal_signals=1 23 log-buf-len=1M print_fatal_signals=1
24 24
25 25
26 This document may not be entirely up to date and comprehensive. The command 26 This document may not be entirely up to date and comprehensive. The command
27 "modinfo -p ${modulename}" shows a current list of all parameters of a loadable 27 "modinfo -p ${modulename}" shows a current list of all parameters of a loadable
28 module. Loadable modules, after being loaded into the running kernel, also 28 module. Loadable modules, after being loaded into the running kernel, also
29 reveal their parameters in /sys/module/${modulename}/parameters/. Some of these 29 reveal their parameters in /sys/module/${modulename}/parameters/. Some of these
30 parameters may be changed at runtime by the command 30 parameters may be changed at runtime by the command
31 "echo -n ${value} > /sys/module/${modulename}/parameters/${parm}". 31 "echo -n ${value} > /sys/module/${modulename}/parameters/${parm}".
32 32
33 The parameters listed below are only valid if certain kernel build options were 33 The parameters listed below are only valid if certain kernel build options were
34 enabled and if respective hardware is present. The text in square brackets at 34 enabled and if respective hardware is present. The text in square brackets at
35 the beginning of each description states the restrictions within which a 35 the beginning of each description states the restrictions within which a
36 parameter is applicable: 36 parameter is applicable:
37 37
38 ACPI ACPI support is enabled. 38 ACPI ACPI support is enabled.
39 AGP AGP (Accelerated Graphics Port) is enabled. 39 AGP AGP (Accelerated Graphics Port) is enabled.
40 ALSA ALSA sound support is enabled. 40 ALSA ALSA sound support is enabled.
41 APIC APIC support is enabled. 41 APIC APIC support is enabled.
42 APM Advanced Power Management support is enabled. 42 APM Advanced Power Management support is enabled.
43 AVR32 AVR32 architecture is enabled. 43 AVR32 AVR32 architecture is enabled.
44 AX25 Appropriate AX.25 support is enabled. 44 AX25 Appropriate AX.25 support is enabled.
45 BLACKFIN Blackfin architecture is enabled. 45 BLACKFIN Blackfin architecture is enabled.
46 DRM Direct Rendering Management support is enabled. 46 DRM Direct Rendering Management support is enabled.
47 EDD BIOS Enhanced Disk Drive Services (EDD) is enabled 47 EDD BIOS Enhanced Disk Drive Services (EDD) is enabled
48 EFI EFI Partitioning (GPT) is enabled 48 EFI EFI Partitioning (GPT) is enabled
49 EIDE EIDE/ATAPI support is enabled. 49 EIDE EIDE/ATAPI support is enabled.
50 FB The frame buffer device is enabled. 50 FB The frame buffer device is enabled.
51 GCOV GCOV profiling is enabled. 51 GCOV GCOV profiling is enabled.
52 HW Appropriate hardware is enabled. 52 HW Appropriate hardware is enabled.
53 IA-64 IA-64 architecture is enabled. 53 IA-64 IA-64 architecture is enabled.
54 IMA Integrity measurement architecture is enabled. 54 IMA Integrity measurement architecture is enabled.
55 IOSCHED More than one I/O scheduler is enabled. 55 IOSCHED More than one I/O scheduler is enabled.
56 IP_PNP IP DHCP, BOOTP, or RARP is enabled. 56 IP_PNP IP DHCP, BOOTP, or RARP is enabled.
57 ISAPNP ISA PnP code is enabled. 57 ISAPNP ISA PnP code is enabled.
58 ISDN Appropriate ISDN support is enabled. 58 ISDN Appropriate ISDN support is enabled.
59 JOY Appropriate joystick support is enabled. 59 JOY Appropriate joystick support is enabled.
60 KVM Kernel Virtual Machine support is enabled. 60 KVM Kernel Virtual Machine support is enabled.
61 LIBATA Libata driver is enabled 61 LIBATA Libata driver is enabled
62 LP Printer support is enabled. 62 LP Printer support is enabled.
63 LOOP Loopback device support is enabled. 63 LOOP Loopback device support is enabled.
64 M68k M68k architecture is enabled. 64 M68k M68k architecture is enabled.
65 These options have more detailed description inside of 65 These options have more detailed description inside of
66 Documentation/m68k/kernel-options.txt. 66 Documentation/m68k/kernel-options.txt.
67 MCA MCA bus support is enabled. 67 MCA MCA bus support is enabled.
68 MDA MDA console support is enabled. 68 MDA MDA console support is enabled.
69 MOUSE Appropriate mouse support is enabled. 69 MOUSE Appropriate mouse support is enabled.
70 MSI Message Signaled Interrupts (PCI). 70 MSI Message Signaled Interrupts (PCI).
71 MTD MTD (Memory Technology Device) support is enabled. 71 MTD MTD (Memory Technology Device) support is enabled.
72 NET Appropriate network support is enabled. 72 NET Appropriate network support is enabled.
73 NUMA NUMA support is enabled. 73 NUMA NUMA support is enabled.
74 GENERIC_TIME The generic timeofday code is enabled. 74 GENERIC_TIME The generic timeofday code is enabled.
75 NFS Appropriate NFS support is enabled. 75 NFS Appropriate NFS support is enabled.
76 OSS OSS sound support is enabled. 76 OSS OSS sound support is enabled.
77 PV_OPS A paravirtualized kernel is enabled. 77 PV_OPS A paravirtualized kernel is enabled.
78 PARIDE The ParIDE (parallel port IDE) subsystem is enabled. 78 PARIDE The ParIDE (parallel port IDE) subsystem is enabled.
79 PARISC The PA-RISC architecture is enabled. 79 PARISC The PA-RISC architecture is enabled.
80 PCI PCI bus support is enabled. 80 PCI PCI bus support is enabled.
81 PCIE PCI Express support is enabled. 81 PCIE PCI Express support is enabled.
82 PCMCIA The PCMCIA subsystem is enabled. 82 PCMCIA The PCMCIA subsystem is enabled.
83 PNP Plug & Play support is enabled. 83 PNP Plug & Play support is enabled.
84 PPC PowerPC architecture is enabled. 84 PPC PowerPC architecture is enabled.
85 PPT Parallel port support is enabled. 85 PPT Parallel port support is enabled.
86 PS2 Appropriate PS/2 support is enabled. 86 PS2 Appropriate PS/2 support is enabled.
87 RAM RAM disk support is enabled. 87 RAM RAM disk support is enabled.
88 S390 S390 architecture is enabled. 88 S390 S390 architecture is enabled.
89 SCSI Appropriate SCSI support is enabled. 89 SCSI Appropriate SCSI support is enabled.
90 A lot of drivers has their options described inside of 90 A lot of drivers has their options described inside of
91 Documentation/scsi/. 91 Documentation/scsi/.
92 SECURITY Different security models are enabled. 92 SECURITY Different security models are enabled.
93 SELINUX SELinux support is enabled. 93 SELINUX SELinux support is enabled.
94 SERIAL Serial support is enabled. 94 SERIAL Serial support is enabled.
95 SH SuperH architecture is enabled. 95 SH SuperH architecture is enabled.
96 SMP The kernel is an SMP kernel. 96 SMP The kernel is an SMP kernel.
97 SPARC Sparc architecture is enabled. 97 SPARC Sparc architecture is enabled.
98 SWSUSP Software suspend (hibernation) is enabled. 98 SWSUSP Software suspend (hibernation) is enabled.
99 SUSPEND System suspend states are enabled. 99 SUSPEND System suspend states are enabled.
100 FTRACE Function tracing enabled. 100 FTRACE Function tracing enabled.
101 TS Appropriate touchscreen support is enabled. 101 TS Appropriate touchscreen support is enabled.
102 UMS USB Mass Storage support is enabled. 102 UMS USB Mass Storage support is enabled.
103 USB USB support is enabled. 103 USB USB support is enabled.
104 USBHID USB Human Interface Device support is enabled. 104 USBHID USB Human Interface Device support is enabled.
105 V4L Video For Linux support is enabled. 105 V4L Video For Linux support is enabled.
106 VGA The VGA console has been enabled. 106 VGA The VGA console has been enabled.
107 VT Virtual terminal support is enabled. 107 VT Virtual terminal support is enabled.
108 WDT Watchdog support is enabled. 108 WDT Watchdog support is enabled.
109 XT IBM PC/XT MFM hard disk support is enabled. 109 XT IBM PC/XT MFM hard disk support is enabled.
110 X86-32 X86-32, aka i386 architecture is enabled. 110 X86-32 X86-32, aka i386 architecture is enabled.
111 X86-64 X86-64 architecture is enabled. 111 X86-64 X86-64 architecture is enabled.
112 More X86-64 boot options can be found in 112 More X86-64 boot options can be found in
113 Documentation/x86/x86_64/boot-options.txt . 113 Documentation/x86/x86_64/boot-options.txt .
114 X86 Either 32bit or 64bit x86 (same as X86-32+X86-64) 114 X86 Either 32bit or 64bit x86 (same as X86-32+X86-64)
115 115
116 In addition, the following text indicates that the option: 116 In addition, the following text indicates that the option:
117 117
118 BUGS= Relates to possible processor bugs on the said processor. 118 BUGS= Relates to possible processor bugs on the said processor.
119 KNL Is a kernel start-up parameter. 119 KNL Is a kernel start-up parameter.
120 BOOT Is a boot loader parameter. 120 BOOT Is a boot loader parameter.
121 121
122 Parameters denoted with BOOT are actually interpreted by the boot 122 Parameters denoted with BOOT are actually interpreted by the boot
123 loader, and have no meaning to the kernel directly. 123 loader, and have no meaning to the kernel directly.
124 Do not modify the syntax of boot loader parameters without extreme 124 Do not modify the syntax of boot loader parameters without extreme
125 need or coordination with <Documentation/x86/boot.txt>. 125 need or coordination with <Documentation/x86/boot.txt>.
126 126
127 There are also arch-specific kernel-parameters not documented here. 127 There are also arch-specific kernel-parameters not documented here.
128 See for example <Documentation/x86/x86_64/boot-options.txt>. 128 See for example <Documentation/x86/x86_64/boot-options.txt>.
129 129
130 Note that ALL kernel parameters listed below are CASE SENSITIVE, and that 130 Note that ALL kernel parameters listed below are CASE SENSITIVE, and that
131 a trailing = on the name of any parameter states that that parameter will 131 a trailing = on the name of any parameter states that that parameter will
132 be entered as an environment variable, whereas its absence indicates that 132 be entered as an environment variable, whereas its absence indicates that
133 it will appear as a kernel argument readable via /proc/cmdline by programs 133 it will appear as a kernel argument readable via /proc/cmdline by programs
134 running once the system is up. 134 running once the system is up.
135 135
136 The number of kernel parameters is not limited, but the length of the 136 The number of kernel parameters is not limited, but the length of the
137 complete command line (parameters including spaces etc.) is limited to 137 complete command line (parameters including spaces etc.) is limited to
138 a fixed number of characters. This limit depends on the architecture 138 a fixed number of characters. This limit depends on the architecture
139 and is between 256 and 4096 characters. It is defined in the file 139 and is between 256 and 4096 characters. It is defined in the file
140 ./include/asm/setup.h as COMMAND_LINE_SIZE. 140 ./include/asm/setup.h as COMMAND_LINE_SIZE.
141 141
142 142
143 acpi= [HW,ACPI,X86] 143 acpi= [HW,ACPI,X86]
144 Advanced Configuration and Power Interface 144 Advanced Configuration and Power Interface
145 Format: { force | off | ht | strict | noirq | rsdt } 145 Format: { force | off | ht | strict | noirq | rsdt }
146 force -- enable ACPI if default was off 146 force -- enable ACPI if default was off
147 off -- disable ACPI if default was on 147 off -- disable ACPI if default was on
148 noirq -- do not use ACPI for IRQ routing 148 noirq -- do not use ACPI for IRQ routing
149 ht -- run only enough ACPI to enable Hyper Threading 149 ht -- run only enough ACPI to enable Hyper Threading
150 strict -- Be less tolerant of platforms that are not 150 strict -- Be less tolerant of platforms that are not
151 strictly ACPI specification compliant. 151 strictly ACPI specification compliant.
152 rsdt -- prefer RSDT over (default) XSDT 152 rsdt -- prefer RSDT over (default) XSDT
153 153
154 See also Documentation/power/pm.txt, pci=noacpi 154 See also Documentation/power/pm.txt, pci=noacpi
155 155
156 acpi_apic_instance= [ACPI, IOAPIC] 156 acpi_apic_instance= [ACPI, IOAPIC]
157 Format: <int> 157 Format: <int>
158 2: use 2nd APIC table, if available 158 2: use 2nd APIC table, if available
159 1,0: use 1st APIC table 159 1,0: use 1st APIC table
160 default: 0 160 default: 0
161 161
162 acpi_backlight= [HW,ACPI] 162 acpi_backlight= [HW,ACPI]
163 acpi_backlight=vendor 163 acpi_backlight=vendor
164 acpi_backlight=video 164 acpi_backlight=video
165 If set to vendor, prefer vendor specific driver 165 If set to vendor, prefer vendor specific driver
166 (e.g. thinkpad_acpi, sony_acpi, etc.) instead 166 (e.g. thinkpad_acpi, sony_acpi, etc.) instead
167 of the ACPI video.ko driver. 167 of the ACPI video.ko driver.
168 168
169 acpi.debug_layer= [HW,ACPI,ACPI_DEBUG] 169 acpi.debug_layer= [HW,ACPI,ACPI_DEBUG]
170 acpi.debug_level= [HW,ACPI,ACPI_DEBUG] 170 acpi.debug_level= [HW,ACPI,ACPI_DEBUG]
171 Format: <int> 171 Format: <int>
172 CONFIG_ACPI_DEBUG must be enabled to produce any ACPI 172 CONFIG_ACPI_DEBUG must be enabled to produce any ACPI
173 debug output. Bits in debug_layer correspond to a 173 debug output. Bits in debug_layer correspond to a
174 _COMPONENT in an ACPI source file, e.g., 174 _COMPONENT in an ACPI source file, e.g.,
175 #define _COMPONENT ACPI_PCI_COMPONENT 175 #define _COMPONENT ACPI_PCI_COMPONENT
176 Bits in debug_level correspond to a level in 176 Bits in debug_level correspond to a level in
177 ACPI_DEBUG_PRINT statements, e.g., 177 ACPI_DEBUG_PRINT statements, e.g.,
178 ACPI_DEBUG_PRINT((ACPI_DB_INFO, ... 178 ACPI_DEBUG_PRINT((ACPI_DB_INFO, ...
179 The debug_level mask defaults to "info". See 179 The debug_level mask defaults to "info". See
180 Documentation/acpi/debug.txt for more information about 180 Documentation/acpi/debug.txt for more information about
181 debug layers and levels. 181 debug layers and levels.
182 182
183 Enable processor driver info messages: 183 Enable processor driver info messages:
184 acpi.debug_layer=0x20000000 184 acpi.debug_layer=0x20000000
185 Enable PCI/PCI interrupt routing info messages: 185 Enable PCI/PCI interrupt routing info messages:
186 acpi.debug_layer=0x400000 186 acpi.debug_layer=0x400000
187 Enable AML "Debug" output, i.e., stores to the Debug 187 Enable AML "Debug" output, i.e., stores to the Debug
188 object while interpreting AML: 188 object while interpreting AML:
189 acpi.debug_layer=0xffffffff acpi.debug_level=0x2 189 acpi.debug_layer=0xffffffff acpi.debug_level=0x2
190 Enable all messages related to ACPI hardware: 190 Enable all messages related to ACPI hardware:
191 acpi.debug_layer=0x2 acpi.debug_level=0xffffffff 191 acpi.debug_layer=0x2 acpi.debug_level=0xffffffff
192 192
193 Some values produce so much output that the system is 193 Some values produce so much output that the system is
194 unusable. The "log_buf_len" parameter may be useful 194 unusable. The "log_buf_len" parameter may be useful
195 if you need to capture more output. 195 if you need to capture more output.
196 196
197 acpi_display_output= [HW,ACPI] 197 acpi_display_output= [HW,ACPI]
198 acpi_display_output=vendor 198 acpi_display_output=vendor
199 acpi_display_output=video 199 acpi_display_output=video
200 See above. 200 See above.
201 201
202 acpi_irq_balance [HW,ACPI] 202 acpi_irq_balance [HW,ACPI]
203 ACPI will balance active IRQs 203 ACPI will balance active IRQs
204 default in APIC mode 204 default in APIC mode
205 205
206 acpi_irq_nobalance [HW,ACPI] 206 acpi_irq_nobalance [HW,ACPI]
207 ACPI will not move active IRQs (default) 207 ACPI will not move active IRQs (default)
208 default in PIC mode 208 default in PIC mode
209 209
210 acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA 210 acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA
211 Format: <irq>,<irq>... 211 Format: <irq>,<irq>...
212 212
213 acpi_irq_pci= [HW,ACPI] If irq_balance, clear listed IRQs for 213 acpi_irq_pci= [HW,ACPI] If irq_balance, clear listed IRQs for
214 use by PCI 214 use by PCI
215 Format: <irq>,<irq>... 215 Format: <irq>,<irq>...
216 216
217 acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT 217 acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT
218 218
219 acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS 219 acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS
220 Format: To spoof as Windows 98: ="Microsoft Windows" 220 Format: To spoof as Windows 98: ="Microsoft Windows"
221 221
222 acpi_osi= [HW,ACPI] Modify list of supported OS interface strings 222 acpi_osi= [HW,ACPI] Modify list of supported OS interface strings
223 acpi_osi="string1" # add string1 -- only one string 223 acpi_osi="string1" # add string1 -- only one string
224 acpi_osi="!string2" # remove built-in string2 224 acpi_osi="!string2" # remove built-in string2
225 acpi_osi= # disable all strings 225 acpi_osi= # disable all strings
226 226
227 acpi_pm_good [X86] 227 acpi_pm_good [X86]
228 Override the pmtimer bug detection: force the kernel 228 Override the pmtimer bug detection: force the kernel
229 to assume that this machine's pmtimer latches its value 229 to assume that this machine's pmtimer latches its value
230 and always returns good values. 230 and always returns good values.
231 231
232 acpi_sci= [HW,ACPI] ACPI System Control Interrupt trigger mode 232 acpi_sci= [HW,ACPI] ACPI System Control Interrupt trigger mode
233 Format: { level | edge | high | low } 233 Format: { level | edge | high | low }
234 234
235 acpi_serialize [HW,ACPI] force serialization of AML methods 235 acpi_serialize [HW,ACPI] force serialization of AML methods
236 236
237 acpi_skip_timer_override [HW,ACPI] 237 acpi_skip_timer_override [HW,ACPI]
238 Recognize and ignore IRQ0/pin2 Interrupt Override. 238 Recognize and ignore IRQ0/pin2 Interrupt Override.
239 For broken nForce2 BIOS resulting in XT-PIC timer. 239 For broken nForce2 BIOS resulting in XT-PIC timer.
240 240
241 acpi_sleep= [HW,ACPI] Sleep options 241 acpi_sleep= [HW,ACPI] Sleep options
242 Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig, 242 Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig,
243 old_ordering, s4_nonvs } 243 old_ordering, s4_nonvs }
244 See Documentation/power/video.txt for information on 244 See Documentation/power/video.txt for information on
245 s3_bios and s3_mode. 245 s3_bios and s3_mode.
246 s3_beep is for debugging; it makes the PC's speaker beep 246 s3_beep is for debugging; it makes the PC's speaker beep
247 as soon as the kernel's real-mode entry point is called. 247 as soon as the kernel's real-mode entry point is called.
248 s4_nohwsig prevents ACPI hardware signature from being 248 s4_nohwsig prevents ACPI hardware signature from being
249 used during resume from hibernation. 249 used during resume from hibernation.
250 old_ordering causes the ACPI 1.0 ordering of the _PTS 250 old_ordering causes the ACPI 1.0 ordering of the _PTS
251 control method, with respect to putting devices into 251 control method, with respect to putting devices into
252 low power states, to be enforced (the ACPI 2.0 ordering 252 low power states, to be enforced (the ACPI 2.0 ordering
253 of _PTS is used by default). 253 of _PTS is used by default).
254 s4_nonvs prevents the kernel from saving/restoring the 254 s4_nonvs prevents the kernel from saving/restoring the
255 ACPI NVS memory during hibernation. 255 ACPI NVS memory during hibernation.
256 256
257 acpi_use_timer_override [HW,ACPI] 257 acpi_use_timer_override [HW,ACPI]
258 Use timer override. For some broken Nvidia NF5 boards 258 Use timer override. For some broken Nvidia NF5 boards
259 that require a timer override, but don't have HPET 259 that require a timer override, but don't have HPET
260 260
261 acpi_enforce_resources= [ACPI] 261 acpi_enforce_resources= [ACPI]
262 { strict | lax | no } 262 { strict | lax | no }
263 Check for resource conflicts between native drivers 263 Check for resource conflicts between native drivers
264 and ACPI OperationRegions (SystemIO and SystemMemory 264 and ACPI OperationRegions (SystemIO and SystemMemory
265 only). IO ports and memory declared in ACPI might be 265 only). IO ports and memory declared in ACPI might be
266 used by the ACPI subsystem in arbitrary AML code and 266 used by the ACPI subsystem in arbitrary AML code and
267 can interfere with legacy drivers. 267 can interfere with legacy drivers.
268 strict (default): access to resources claimed by ACPI 268 strict (default): access to resources claimed by ACPI
269 is denied; legacy drivers trying to access reserved 269 is denied; legacy drivers trying to access reserved
270 resources will fail to bind to device using them. 270 resources will fail to bind to device using them.
271 lax: access to resources claimed by ACPI is allowed; 271 lax: access to resources claimed by ACPI is allowed;
272 legacy drivers trying to access reserved resources 272 legacy drivers trying to access reserved resources
273 will bind successfully but a warning message is logged. 273 will bind successfully but a warning message is logged.
274 no: ACPI OperationRegions are not marked as reserved, 274 no: ACPI OperationRegions are not marked as reserved,
275 no further checks are performed. 275 no further checks are performed.
276 276
277 ad1848= [HW,OSS] 277 ad1848= [HW,OSS]
278 Format: <io>,<irq>,<dma>,<dma2>,<type> 278 Format: <io>,<irq>,<dma>,<dma2>,<type>
279 279
280 add_efi_memmap [EFI; X86] Include EFI memory map in 280 add_efi_memmap [EFI; X86] Include EFI memory map in
281 kernel's map of available physical RAM. 281 kernel's map of available physical RAM.
282 282
283 advansys= [HW,SCSI] 283 advansys= [HW,SCSI]
284 See header of drivers/scsi/advansys.c. 284 See header of drivers/scsi/advansys.c.
285 285
286 advwdt= [HW,WDT] Advantech WDT 286 advwdt= [HW,WDT] Advantech WDT
287 Format: <iostart>,<iostop> 287 Format: <iostart>,<iostop>
288 288
289 aedsp16= [HW,OSS] Audio Excel DSP 16 289 aedsp16= [HW,OSS] Audio Excel DSP 16
290 Format: <io>,<irq>,<dma>,<mss_io>,<mpu_io>,<mpu_irq> 290 Format: <io>,<irq>,<dma>,<mss_io>,<mpu_io>,<mpu_irq>
291 See also header of sound/oss/aedsp16.c. 291 See also header of sound/oss/aedsp16.c.
292 292
293 agp= [AGP] 293 agp= [AGP]
294 { off | try_unsupported } 294 { off | try_unsupported }
295 off: disable AGP support 295 off: disable AGP support
296 try_unsupported: try to drive unsupported chipsets 296 try_unsupported: try to drive unsupported chipsets
297 (may crash computer or cause data corruption) 297 (may crash computer or cause data corruption)
298 298
299 aha152x= [HW,SCSI] 299 aha152x= [HW,SCSI]
300 See Documentation/scsi/aha152x.txt. 300 See Documentation/scsi/aha152x.txt.
301 301
302 aha1542= [HW,SCSI] 302 aha1542= [HW,SCSI]
303 Format: <portbase>[,<buson>,<busoff>[,<dmaspeed>]] 303 Format: <portbase>[,<buson>,<busoff>[,<dmaspeed>]]
304 304
305 aic7xxx= [HW,SCSI] 305 aic7xxx= [HW,SCSI]
306 See Documentation/scsi/aic7xxx.txt. 306 See Documentation/scsi/aic7xxx.txt.
307 307
308 aic79xx= [HW,SCSI] 308 aic79xx= [HW,SCSI]
309 See Documentation/scsi/aic79xx.txt. 309 See Documentation/scsi/aic79xx.txt.
310 310
311 amd_iommu= [HW,X86-84] 311 amd_iommu= [HW,X86-84]
312 Pass parameters to the AMD IOMMU driver in the system. 312 Pass parameters to the AMD IOMMU driver in the system.
313 Possible values are: 313 Possible values are:
314 isolate - enable device isolation (each device, as far 314 isolate - enable device isolation (each device, as far
315 as possible, will get its own protection 315 as possible, will get its own protection
316 domain) [default] 316 domain) [default]
317 share - put every device behind one IOMMU into the 317 share - put every device behind one IOMMU into the
318 same protection domain 318 same protection domain
319 fullflush - enable flushing of IO/TLB entries when 319 fullflush - enable flushing of IO/TLB entries when
320 they are unmapped. Otherwise they are 320 they are unmapped. Otherwise they are
321 flushed before they will be reused, which 321 flushed before they will be reused, which
322 is a lot of faster 322 is a lot of faster
323 323
324 amijoy.map= [HW,JOY] Amiga joystick support 324 amijoy.map= [HW,JOY] Amiga joystick support
325 Map of devices attached to JOY0DAT and JOY1DAT 325 Map of devices attached to JOY0DAT and JOY1DAT
326 Format: <a>,<b> 326 Format: <a>,<b>
327 See also Documentation/kernel/input/joystick.txt 327 See also Documentation/kernel/input/joystick.txt
328 328
329 analog.map= [HW,JOY] Analog joystick and gamepad support 329 analog.map= [HW,JOY] Analog joystick and gamepad support
330 Specifies type or capabilities of an analog joystick 330 Specifies type or capabilities of an analog joystick
331 connected to one of 16 gameports 331 connected to one of 16 gameports
332 Format: <type1>,<type2>,..<type16> 332 Format: <type1>,<type2>,..<type16>
333 333
334 apc= [HW,SPARC] 334 apc= [HW,SPARC]
335 Power management functions (SPARCstation-4/5 + deriv.) 335 Power management functions (SPARCstation-4/5 + deriv.)
336 Format: noidle 336 Format: noidle
337 Disable APC CPU standby support. SPARCstation-Fox does 337 Disable APC CPU standby support. SPARCstation-Fox does
338 not play well with APC CPU idle - disable it if you have 338 not play well with APC CPU idle - disable it if you have
339 APC and your system crashes randomly. 339 APC and your system crashes randomly.
340 340
341 apic= [APIC,X86-32] Advanced Programmable Interrupt Controller 341 apic= [APIC,X86-32] Advanced Programmable Interrupt Controller
342 Change the output verbosity whilst booting 342 Change the output verbosity whilst booting
343 Format: { quiet (default) | verbose | debug } 343 Format: { quiet (default) | verbose | debug }
344 Change the amount of debugging information output 344 Change the amount of debugging information output
345 when initialising the APIC and IO-APIC components. 345 when initialising the APIC and IO-APIC components.
346 346
347 show_lapic= [APIC,X86] Advanced Programmable Interrupt Controller 347 show_lapic= [APIC,X86] Advanced Programmable Interrupt Controller
348 Limit apic dumping. The parameter defines the maximal 348 Limit apic dumping. The parameter defines the maximal
349 number of local apics being dumped. Also it is possible 349 number of local apics being dumped. Also it is possible
350 to set it to "all" by meaning -- no limit here. 350 to set it to "all" by meaning -- no limit here.
351 Format: { 1 (default) | 2 | ... | all }. 351 Format: { 1 (default) | 2 | ... | all }.
352 The parameter valid if only apic=debug or 352 The parameter valid if only apic=debug or
353 apic=verbose is specified. 353 apic=verbose is specified.
354 Example: apic=debug show_lapic=all 354 Example: apic=debug show_lapic=all
355 355
356 apm= [APM] Advanced Power Management 356 apm= [APM] Advanced Power Management
357 See header of arch/x86/kernel/apm_32.c. 357 See header of arch/x86/kernel/apm_32.c.
358 358
359 arcrimi= [HW,NET] ARCnet - "RIM I" (entirely mem-mapped) cards 359 arcrimi= [HW,NET] ARCnet - "RIM I" (entirely mem-mapped) cards
360 Format: <io>,<irq>,<nodeID> 360 Format: <io>,<irq>,<nodeID>
361 361
362 ataflop= [HW,M68k] 362 ataflop= [HW,M68k]
363 363
364 atarimouse= [HW,MOUSE] Atari Mouse 364 atarimouse= [HW,MOUSE] Atari Mouse
365 365
366 atascsi= [HW,SCSI] Atari SCSI 366 atascsi= [HW,SCSI] Atari SCSI
367 367
368 atkbd.extra= [HW] Enable extra LEDs and keys on IBM RapidAccess, 368 atkbd.extra= [HW] Enable extra LEDs and keys on IBM RapidAccess,
369 EzKey and similar keyboards 369 EzKey and similar keyboards
370 370
371 atkbd.reset= [HW] Reset keyboard during initialization 371 atkbd.reset= [HW] Reset keyboard during initialization
372 372
373 atkbd.set= [HW] Select keyboard code set 373 atkbd.set= [HW] Select keyboard code set
374 Format: <int> (2 = AT (default), 3 = PS/2) 374 Format: <int> (2 = AT (default), 3 = PS/2)
375 375
376 atkbd.scroll= [HW] Enable scroll wheel on MS Office and similar 376 atkbd.scroll= [HW] Enable scroll wheel on MS Office and similar
377 keyboards 377 keyboards
378 378
379 atkbd.softraw= [HW] Choose between synthetic and real raw mode 379 atkbd.softraw= [HW] Choose between synthetic and real raw mode
380 Format: <bool> (0 = real, 1 = synthetic (default)) 380 Format: <bool> (0 = real, 1 = synthetic (default))
381 381
382 atkbd.softrepeat= [HW] 382 atkbd.softrepeat= [HW]
383 Use software keyboard repeat 383 Use software keyboard repeat
384 384
385 autotest [IA64] 385 autotest [IA64]
386 386
387 baycom_epp= [HW,AX25] 387 baycom_epp= [HW,AX25]
388 Format: <io>,<mode> 388 Format: <io>,<mode>
389 389
390 baycom_par= [HW,AX25] BayCom Parallel Port AX.25 Modem 390 baycom_par= [HW,AX25] BayCom Parallel Port AX.25 Modem
391 Format: <io>,<mode> 391 Format: <io>,<mode>
392 See header of drivers/net/hamradio/baycom_par.c. 392 See header of drivers/net/hamradio/baycom_par.c.
393 393
394 baycom_ser_fdx= [HW,AX25] 394 baycom_ser_fdx= [HW,AX25]
395 BayCom Serial Port AX.25 Modem (Full Duplex Mode) 395 BayCom Serial Port AX.25 Modem (Full Duplex Mode)
396 Format: <io>,<irq>,<mode>[,<baud>] 396 Format: <io>,<irq>,<mode>[,<baud>]
397 See header of drivers/net/hamradio/baycom_ser_fdx.c. 397 See header of drivers/net/hamradio/baycom_ser_fdx.c.
398 398
399 baycom_ser_hdx= [HW,AX25] 399 baycom_ser_hdx= [HW,AX25]
400 BayCom Serial Port AX.25 Modem (Half Duplex Mode) 400 BayCom Serial Port AX.25 Modem (Half Duplex Mode)
401 Format: <io>,<irq>,<mode> 401 Format: <io>,<irq>,<mode>
402 See header of drivers/net/hamradio/baycom_ser_hdx.c. 402 See header of drivers/net/hamradio/baycom_ser_hdx.c.
403 403
404 boot_delay= Milliseconds to delay each printk during boot. 404 boot_delay= Milliseconds to delay each printk during boot.
405 Values larger than 10 seconds (10000) are changed to 405 Values larger than 10 seconds (10000) are changed to
406 no delay (0). 406 no delay (0).
407 Format: integer 407 Format: integer
408 408
409 bootmem_debug [KNL] Enable bootmem allocator debug messages. 409 bootmem_debug [KNL] Enable bootmem allocator debug messages.
410 410
411 bttv.card= [HW,V4L] bttv (bt848 + bt878 based grabber cards) 411 bttv.card= [HW,V4L] bttv (bt848 + bt878 based grabber cards)
412 bttv.radio= Most important insmod options are available as 412 bttv.radio= Most important insmod options are available as
413 kernel args too. 413 kernel args too.
414 bttv.pll= See Documentation/video4linux/bttv/Insmod-options 414 bttv.pll= See Documentation/video4linux/bttv/Insmod-options
415 bttv.tuner= and Documentation/video4linux/bttv/CARDLIST 415 bttv.tuner= and Documentation/video4linux/bttv/CARDLIST
416 416
417 BusLogic= [HW,SCSI] 417 BusLogic= [HW,SCSI]
418 See drivers/scsi/BusLogic.c, comment before function 418 See drivers/scsi/BusLogic.c, comment before function
419 BusLogic_ParseDriverOptions(). 419 BusLogic_ParseDriverOptions().
420 420
421 c101= [NET] Moxa C101 synchronous serial card 421 c101= [NET] Moxa C101 synchronous serial card
422 422
423 cachesize= [BUGS=X86-32] Override level 2 CPU cache size detection. 423 cachesize= [BUGS=X86-32] Override level 2 CPU cache size detection.
424 Sometimes CPU hardware bugs make them report the cache 424 Sometimes CPU hardware bugs make them report the cache
425 size incorrectly. The kernel will attempt work arounds 425 size incorrectly. The kernel will attempt work arounds
426 to fix known problems, but for some CPUs it is not 426 to fix known problems, but for some CPUs it is not
427 possible to determine what the correct size should be. 427 possible to determine what the correct size should be.
428 This option provides an override for these situations. 428 This option provides an override for these situations.
429 429
430 capability.disable= 430 capability.disable=
431 [SECURITY] Disable capabilities. This would normally 431 [SECURITY] Disable capabilities. This would normally
432 be used only if an alternative security model is to be 432 be used only if an alternative security model is to be
433 configured. Potentially dangerous and should only be 433 configured. Potentially dangerous and should only be
434 used if you are entirely sure of the consequences. 434 used if you are entirely sure of the consequences.
435 435
436 ccw_timeout_log [S390] 436 ccw_timeout_log [S390]
437 See Documentation/s390/CommonIO for details. 437 See Documentation/s390/CommonIO for details.
438 438
439 cgroup_disable= [KNL] Disable a particular controller 439 cgroup_disable= [KNL] Disable a particular controller
440 Format: {name of the controller(s) to disable} 440 Format: {name of the controller(s) to disable}
441 {Currently supported controllers - "memory"} 441 {Currently supported controllers - "memory"}
442 442
443 checkreqprot [SELINUX] Set initial checkreqprot flag value. 443 checkreqprot [SELINUX] Set initial checkreqprot flag value.
444 Format: { "0" | "1" } 444 Format: { "0" | "1" }
445 See security/selinux/Kconfig help text. 445 See security/selinux/Kconfig help text.
446 0 -- check protection applied by kernel (includes 446 0 -- check protection applied by kernel (includes
447 any implied execute protection). 447 any implied execute protection).
448 1 -- check protection requested by application. 448 1 -- check protection requested by application.
449 Default value is set via a kernel config option. 449 Default value is set via a kernel config option.
450 Value can be changed at runtime via 450 Value can be changed at runtime via
451 /selinux/checkreqprot. 451 /selinux/checkreqprot.
452 452
453 cio_ignore= [S390] 453 cio_ignore= [S390]
454 See Documentation/s390/CommonIO for details. 454 See Documentation/s390/CommonIO for details.
455 455
456 clock= [BUGS=X86-32, HW] gettimeofday clocksource override. 456 clock= [BUGS=X86-32, HW] gettimeofday clocksource override.
457 [Deprecated] 457 [Deprecated]
458 Forces specified clocksource (if available) to be used 458 Forces specified clocksource (if available) to be used
459 when calculating gettimeofday(). If specified 459 when calculating gettimeofday(). If specified
460 clocksource is not available, it defaults to PIT. 460 clocksource is not available, it defaults to PIT.
461 Format: { pit | tsc | cyclone | pmtmr } 461 Format: { pit | tsc | cyclone | pmtmr }
462 462
463 clocksource= [GENERIC_TIME] Override the default clocksource 463 clocksource= [GENERIC_TIME] Override the default clocksource
464 Format: <string> 464 Format: <string>
465 Override the default clocksource and use the clocksource 465 Override the default clocksource and use the clocksource
466 with the name specified. 466 with the name specified.
467 Some clocksource names to choose from, depending on 467 Some clocksource names to choose from, depending on
468 the platform: 468 the platform:
469 [all] jiffies (this is the base, fallback clocksource) 469 [all] jiffies (this is the base, fallback clocksource)
470 [ACPI] acpi_pm 470 [ACPI] acpi_pm
471 [ARM] imx_timer1,OSTS,netx_timer,mpu_timer2, 471 [ARM] imx_timer1,OSTS,netx_timer,mpu_timer2,
472 pxa_timer,timer3,32k_counter,timer0_1 472 pxa_timer,timer3,32k_counter,timer0_1
473 [AVR32] avr32 473 [AVR32] avr32
474 [X86-32] pit,hpet,tsc,vmi-timer; 474 [X86-32] pit,hpet,tsc,vmi-timer;
475 scx200_hrt on Geode; cyclone on IBM x440 475 scx200_hrt on Geode; cyclone on IBM x440
476 [MIPS] MIPS 476 [MIPS] MIPS
477 [PARISC] cr16 477 [PARISC] cr16
478 [S390] tod 478 [S390] tod
479 [SH] SuperH 479 [SH] SuperH
480 [SPARC64] tick 480 [SPARC64] tick
481 [X86-64] hpet,tsc 481 [X86-64] hpet,tsc
482 482
483 clearcpuid=BITNUM [X86] 483 clearcpuid=BITNUM [X86]
484 Disable CPUID feature X for the kernel. See 484 Disable CPUID feature X for the kernel. See
485 arch/x86/include/asm/cpufeature.h for the valid bit 485 arch/x86/include/asm/cpufeature.h for the valid bit
486 numbers. Note the Linux specific bits are not necessarily 486 numbers. Note the Linux specific bits are not necessarily
487 stable over kernel options, but the vendor specific 487 stable over kernel options, but the vendor specific
488 ones should be. 488 ones should be.
489 Also note that user programs calling CPUID directly 489 Also note that user programs calling CPUID directly
490 or using the feature without checking anything 490 or using the feature without checking anything
491 will still see it. This just prevents it from 491 will still see it. This just prevents it from
492 being used by the kernel or shown in /proc/cpuinfo. 492 being used by the kernel or shown in /proc/cpuinfo.
493 Also note the kernel might malfunction if you disable 493 Also note the kernel might malfunction if you disable
494 some critical bits. 494 some critical bits.
495 495
496 cmo_free_hint= [PPC] Format: { yes | no } 496 cmo_free_hint= [PPC] Format: { yes | no }
497 Specify whether pages are marked as being inactive 497 Specify whether pages are marked as being inactive
498 when they are freed. This is used in CMO environments 498 when they are freed. This is used in CMO environments
499 to determine OS memory pressure for page stealing by 499 to determine OS memory pressure for page stealing by
500 a hypervisor. 500 a hypervisor.
501 Default: yes 501 Default: yes
502 502
503 code_bytes [X86] How many bytes of object code to print 503 code_bytes [X86] How many bytes of object code to print
504 in an oops report. 504 in an oops report.
505 Range: 0 - 8192 505 Range: 0 - 8192
506 Default: 64 506 Default: 64
507 507
508 com20020= [HW,NET] ARCnet - COM20020 chipset 508 com20020= [HW,NET] ARCnet - COM20020 chipset
509 Format: 509 Format:
510 <io>[,<irq>[,<nodeID>[,<backplane>[,<ckp>[,<timeout>]]]]] 510 <io>[,<irq>[,<nodeID>[,<backplane>[,<ckp>[,<timeout>]]]]]
511 511
512 com90io= [HW,NET] ARCnet - COM90xx chipset (IO-mapped buffers) 512 com90io= [HW,NET] ARCnet - COM90xx chipset (IO-mapped buffers)
513 Format: <io>[,<irq>] 513 Format: <io>[,<irq>]
514 514
515 com90xx= [HW,NET] 515 com90xx= [HW,NET]
516 ARCnet - COM90xx chipset (memory-mapped buffers) 516 ARCnet - COM90xx chipset (memory-mapped buffers)
517 Format: <io>[,<irq>[,<memstart>]] 517 Format: <io>[,<irq>[,<memstart>]]
518 518
519 condev= [HW,S390] console device 519 condev= [HW,S390] console device
520 conmode= 520 conmode=
521 521
522 console= [KNL] Output console device and options. 522 console= [KNL] Output console device and options.
523 523
524 tty<n> Use the virtual console device <n>. 524 tty<n> Use the virtual console device <n>.
525 525
526 ttyS<n>[,options] 526 ttyS<n>[,options]
527 ttyUSB0[,options] 527 ttyUSB0[,options]
528 Use the specified serial port. The options are of 528 Use the specified serial port. The options are of
529 the form "bbbbpnf", where "bbbb" is the baud rate, 529 the form "bbbbpnf", where "bbbb" is the baud rate,
530 "p" is parity ("n", "o", or "e"), "n" is number of 530 "p" is parity ("n", "o", or "e"), "n" is number of
531 bits, and "f" is flow control ("r" for RTS or 531 bits, and "f" is flow control ("r" for RTS or
532 omit it). Default is "9600n8". 532 omit it). Default is "9600n8".
533 533
534 See Documentation/serial-console.txt for more 534 See Documentation/serial-console.txt for more
535 information. See 535 information. See
536 Documentation/networking/netconsole.txt for an 536 Documentation/networking/netconsole.txt for an
537 alternative. 537 alternative.
538 538
539 uart[8250],io,<addr>[,options] 539 uart[8250],io,<addr>[,options]
540 uart[8250],mmio,<addr>[,options] 540 uart[8250],mmio,<addr>[,options]
541 Start an early, polled-mode console on the 8250/16550 541 Start an early, polled-mode console on the 8250/16550
542 UART at the specified I/O port or MMIO address, 542 UART at the specified I/O port or MMIO address,
543 switching to the matching ttyS device later. The 543 switching to the matching ttyS device later. The
544 options are the same as for ttyS, above. 544 options are the same as for ttyS, above.
545 545
546 If the device connected to the port is not a TTY but a braille 546 If the device connected to the port is not a TTY but a braille
547 device, prepend "brl," before the device type, for instance 547 device, prepend "brl," before the device type, for instance
548 console=brl,ttyS0 548 console=brl,ttyS0
549 For now, only VisioBraille is supported. 549 For now, only VisioBraille is supported.
550 550
551 consoleblank= [KNL] The console blank (screen saver) timeout in 551 consoleblank= [KNL] The console blank (screen saver) timeout in
552 seconds. Defaults to 10*60 = 10mins. A value of 0 552 seconds. Defaults to 10*60 = 10mins. A value of 0
553 disables the blank timer. 553 disables the blank timer.
554 554
555 coredump_filter= 555 coredump_filter=
556 [KNL] Change the default value for 556 [KNL] Change the default value for
557 /proc/<pid>/coredump_filter. 557 /proc/<pid>/coredump_filter.
558 See also Documentation/filesystems/proc.txt. 558 See also Documentation/filesystems/proc.txt.
559 559
560 cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver 560 cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver
561 Format: 561 Format:
562 <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>] 562 <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>]
563 563
564 crashkernel=nn[KMG]@ss[KMG] 564 crashkernel=nn[KMG]@ss[KMG]
565 [KNL] Reserve a chunk of physical memory to 565 [KNL] Reserve a chunk of physical memory to
566 hold a kernel to switch to with kexec on panic. 566 hold a kernel to switch to with kexec on panic.
567 567
568 crashkernel=range1:size1[,range2:size2,...][@offset] 568 crashkernel=range1:size1[,range2:size2,...][@offset]
569 [KNL] Same as above, but depends on the memory 569 [KNL] Same as above, but depends on the memory
570 in the running system. The syntax of range is 570 in the running system. The syntax of range is
571 start-[end] where start and end are both 571 start-[end] where start and end are both
572 a memory unit (amount[KMG]). See also 572 a memory unit (amount[KMG]). See also
573 Documentation/kdump/kdump.txt for a example. 573 Documentation/kdump/kdump.txt for a example.
574 574
575 cs89x0_dma= [HW,NET] 575 cs89x0_dma= [HW,NET]
576 Format: <dma> 576 Format: <dma>
577 577
578 cs89x0_media= [HW,NET] 578 cs89x0_media= [HW,NET]
579 Format: { rj45 | aui | bnc } 579 Format: { rj45 | aui | bnc }
580 580
581 dasd= [HW,NET] 581 dasd= [HW,NET]
582 See header of drivers/s390/block/dasd_devmap.c. 582 See header of drivers/s390/block/dasd_devmap.c.
583 583
584 db9.dev[2|3]= [HW,JOY] Multisystem joystick support via parallel port 584 db9.dev[2|3]= [HW,JOY] Multisystem joystick support via parallel port
585 (one device per port) 585 (one device per port)
586 Format: <port#>,<type> 586 Format: <port#>,<type>
587 See also Documentation/input/joystick-parport.txt 587 See also Documentation/input/joystick-parport.txt
588 588
589 debug [KNL] Enable kernel debugging (events log level). 589 debug [KNL] Enable kernel debugging (events log level).
590 590
591 debug_locks_verbose= 591 debug_locks_verbose=
592 [KNL] verbose self-tests 592 [KNL] verbose self-tests
593 Format=<0|1> 593 Format=<0|1>
594 Print debugging info while doing the locking API 594 Print debugging info while doing the locking API
595 self-tests. 595 self-tests.
596 We default to 0 (no extra messages), setting it to 596 We default to 0 (no extra messages), setting it to
597 1 will print _a lot_ more information - normally 597 1 will print _a lot_ more information - normally
598 only useful to kernel developers. 598 only useful to kernel developers.
599 599
600 debug_objects [KNL] Enable object debugging 600 debug_objects [KNL] Enable object debugging
601 601
602 no_debug_objects 602 no_debug_objects
603 [KNL] Disable object debugging 603 [KNL] Disable object debugging
604 604
605 debugpat [X86] Enable PAT debugging 605 debugpat [X86] Enable PAT debugging
606 606
607 decnet.addr= [HW,NET] 607 decnet.addr= [HW,NET]
608 Format: <area>[,<node>] 608 Format: <area>[,<node>]
609 See also Documentation/networking/decnet.txt. 609 See also Documentation/networking/decnet.txt.
610 610
611 default_hugepagesz= 611 default_hugepagesz=
612 [same as hugepagesz=] The size of the default 612 [same as hugepagesz=] The size of the default
613 HugeTLB page size. This is the size represented by 613 HugeTLB page size. This is the size represented by
614 the legacy /proc/ hugepages APIs, used for SHM, and 614 the legacy /proc/ hugepages APIs, used for SHM, and
615 default size when mounting hugetlbfs filesystems. 615 default size when mounting hugetlbfs filesystems.
616 Defaults to the default architecture's huge page size 616 Defaults to the default architecture's huge page size
617 if not specified. 617 if not specified.
618 618
619 dhash_entries= [KNL] 619 dhash_entries= [KNL]
620 Set number of hash buckets for dentry cache. 620 Set number of hash buckets for dentry cache.
621 621
622 digi= [HW,SERIAL] 622 digi= [HW,SERIAL]
623 IO parameters + enable/disable command. 623 IO parameters + enable/disable command.
624 624
625 digiepca= [HW,SERIAL] 625 digiepca= [HW,SERIAL]
626 See drivers/char/README.epca and 626 See drivers/char/README.epca and
627 Documentation/serial/digiepca.txt. 627 Documentation/serial/digiepca.txt.
628 628
629 disable_mtrr_cleanup [X86] 629 disable_mtrr_cleanup [X86]
630 The kernel tries to adjust MTRR layout from continuous 630 The kernel tries to adjust MTRR layout from continuous
631 to discrete, to make X server driver able to add WB 631 to discrete, to make X server driver able to add WB
632 entry later. This parameter disables that. 632 entry later. This parameter disables that.
633 633
634 disable_mtrr_trim [X86, Intel and AMD only] 634 disable_mtrr_trim [X86, Intel and AMD only]
635 By default the kernel will trim any uncacheable 635 By default the kernel will trim any uncacheable
636 memory out of your available memory pool based on 636 memory out of your available memory pool based on
637 MTRR settings. This parameter disables that behavior, 637 MTRR settings. This parameter disables that behavior,
638 possibly causing your machine to run very slowly. 638 possibly causing your machine to run very slowly.
639 639
640 disable_timer_pin_1 [X86] 640 disable_timer_pin_1 [X86]
641 Disable PIN 1 of APIC timer 641 Disable PIN 1 of APIC timer
642 Can be useful to work around chipset bugs. 642 Can be useful to work around chipset bugs.
643 643
644 dmasound= [HW,OSS] Sound subsystem buffers 644 dmasound= [HW,OSS] Sound subsystem buffers
645 645
646 dma_debug=off If the kernel is compiled with DMA_API_DEBUG support, 646 dma_debug=off If the kernel is compiled with DMA_API_DEBUG support,
647 this option disables the debugging code at boot. 647 this option disables the debugging code at boot.
648 648
649 dma_debug_entries=<number> 649 dma_debug_entries=<number>
650 This option allows to tune the number of preallocated 650 This option allows to tune the number of preallocated
651 entries for DMA-API debugging code. One entry is 651 entries for DMA-API debugging code. One entry is
652 required per DMA-API allocation. Use this if the 652 required per DMA-API allocation. Use this if the
653 DMA-API debugging code disables itself because the 653 DMA-API debugging code disables itself because the
654 architectural default is too low. 654 architectural default is too low.
655 655
656 dma_debug_driver=<driver_name> 656 dma_debug_driver=<driver_name>
657 With this option the DMA-API debugging driver 657 With this option the DMA-API debugging driver
658 filter feature can be enabled at boot time. Just 658 filter feature can be enabled at boot time. Just
659 pass the driver to filter for as the parameter. 659 pass the driver to filter for as the parameter.
660 The filter can be disabled or changed to another 660 The filter can be disabled or changed to another
661 driver later using sysfs. 661 driver later using sysfs.
662 662
663 dscc4.setup= [NET] 663 dscc4.setup= [NET]
664 664
665 dtc3181e= [HW,SCSI] 665 dtc3181e= [HW,SCSI]
666 666
667 dynamic_printk Enables pr_debug()/dev_dbg() calls if 667 dynamic_printk Enables pr_debug()/dev_dbg() calls if
668 CONFIG_DYNAMIC_PRINTK_DEBUG has been enabled. 668 CONFIG_DYNAMIC_PRINTK_DEBUG has been enabled.
669 These can also be switched on/off via 669 These can also be switched on/off via
670 <debugfs>/dynamic_printk/modules 670 <debugfs>/dynamic_printk/modules
671 671
672 earlycon= [KNL] Output early console device and options. 672 earlycon= [KNL] Output early console device and options.
673 uart[8250],io,<addr>[,options] 673 uart[8250],io,<addr>[,options]
674 uart[8250],mmio,<addr>[,options] 674 uart[8250],mmio,<addr>[,options]
675 Start an early, polled-mode console on the 8250/16550 675 Start an early, polled-mode console on the 8250/16550
676 UART at the specified I/O port or MMIO address. 676 UART at the specified I/O port or MMIO address.
677 The options are the same as for ttyS, above. 677 The options are the same as for ttyS, above.
678 678
679 earlyprintk= [X86,SH,BLACKFIN] 679 earlyprintk= [X86,SH,BLACKFIN]
680 earlyprintk=vga 680 earlyprintk=vga
681 earlyprintk=serial[,ttySn[,baudrate]] 681 earlyprintk=serial[,ttySn[,baudrate]]
682 earlyprintk=ttySn[,baudrate] 682 earlyprintk=ttySn[,baudrate]
683 earlyprintk=dbgp[debugController#] 683 earlyprintk=dbgp[debugController#]
684 684
685 Append ",keep" to not disable it when the real console 685 Append ",keep" to not disable it when the real console
686 takes over. 686 takes over.
687 687
688 Only vga or serial or usb debug port at a time. 688 Only vga or serial or usb debug port at a time.
689 689
690 Currently only ttyS0 and ttyS1 are supported. 690 Currently only ttyS0 and ttyS1 are supported.
691 691
692 Interaction with the standard serial driver is not 692 Interaction with the standard serial driver is not
693 very good. 693 very good.
694 694
695 The VGA output is eventually overwritten by the real 695 The VGA output is eventually overwritten by the real
696 console. 696 console.
697 697
698 eata= [HW,SCSI] 698 eata= [HW,SCSI]
699 699
700 edd= [EDD] 700 edd= [EDD]
701 Format: {"off" | "on" | "skip[mbr]"} 701 Format: {"off" | "on" | "skip[mbr]"}
702 702
703 eisa_irq_edge= [PARISC,HW] 703 eisa_irq_edge= [PARISC,HW]
704 See header of drivers/parisc/eisa.c. 704 See header of drivers/parisc/eisa.c.
705 705
706 elanfreq= [X86-32] 706 elanfreq= [X86-32]
707 See comment before function elanfreq_setup() in 707 See comment before function elanfreq_setup() in
708 arch/x86/kernel/cpu/cpufreq/elanfreq.c. 708 arch/x86/kernel/cpu/cpufreq/elanfreq.c.
709 709
710 elevator= [IOSCHED] 710 elevator= [IOSCHED]
711 Format: {"anticipatory" | "cfq" | "deadline" | "noop"} 711 Format: {"anticipatory" | "cfq" | "deadline" | "noop"}
712 See Documentation/block/as-iosched.txt and 712 See Documentation/block/as-iosched.txt and
713 Documentation/block/deadline-iosched.txt for details. 713 Documentation/block/deadline-iosched.txt for details.
714 714
715 elfcorehdr= [IA64,PPC,SH,X86] 715 elfcorehdr= [IA64,PPC,SH,X86]
716 Specifies physical address of start of kernel core 716 Specifies physical address of start of kernel core
717 image elf header. Generally kexec loader will 717 image elf header. Generally kexec loader will
718 pass this option to capture kernel. 718 pass this option to capture kernel.
719 See Documentation/kdump/kdump.txt for details. 719 See Documentation/kdump/kdump.txt for details.
720 720
721 enable_mtrr_cleanup [X86] 721 enable_mtrr_cleanup [X86]
722 The kernel tries to adjust MTRR layout from continuous 722 The kernel tries to adjust MTRR layout from continuous
723 to discrete, to make X server driver able to add WB 723 to discrete, to make X server driver able to add WB
724 entry later. This parameter enables that. 724 entry later. This parameter enables that.
725 725
726 enable_timer_pin_1 [X86] 726 enable_timer_pin_1 [X86]
727 Enable PIN 1 of APIC timer 727 Enable PIN 1 of APIC timer
728 Can be useful to work around chipset bugs 728 Can be useful to work around chipset bugs
729 (in particular on some ATI chipsets). 729 (in particular on some ATI chipsets).
730 The kernel tries to set a reasonable default. 730 The kernel tries to set a reasonable default.
731 731
732 enforcing [SELINUX] Set initial enforcing status. 732 enforcing [SELINUX] Set initial enforcing status.
733 Format: {"0" | "1"} 733 Format: {"0" | "1"}
734 See security/selinux/Kconfig help text. 734 See security/selinux/Kconfig help text.
735 0 -- permissive (log only, no denials). 735 0 -- permissive (log only, no denials).
736 1 -- enforcing (deny and log). 736 1 -- enforcing (deny and log).
737 Default value is 0. 737 Default value is 0.
738 Value can be changed at runtime via /selinux/enforce. 738 Value can be changed at runtime via /selinux/enforce.
739 739
740 ether= [HW,NET] Ethernet cards parameters 740 ether= [HW,NET] Ethernet cards parameters
741 This option is obsoleted by the "netdev=" option, which 741 This option is obsoleted by the "netdev=" option, which
742 has equivalent usage. See its documentation for details. 742 has equivalent usage. See its documentation for details.
743 743
744 eurwdt= [HW,WDT] Eurotech CPU-1220/1410 onboard watchdog. 744 eurwdt= [HW,WDT] Eurotech CPU-1220/1410 onboard watchdog.
745 Format: <io>[,<irq>] 745 Format: <io>[,<irq>]
746 746
747 failslab= 747 failslab=
748 fail_page_alloc= 748 fail_page_alloc=
749 fail_make_request=[KNL] 749 fail_make_request=[KNL]
750 General fault injection mechanism. 750 General fault injection mechanism.
751 Format: <interval>,<probability>,<space>,<times> 751 Format: <interval>,<probability>,<space>,<times>
752 See also /Documentation/fault-injection/. 752 See also /Documentation/fault-injection/.
753 753
754 fd_mcs= [HW,SCSI] 754 fd_mcs= [HW,SCSI]
755 See header of drivers/scsi/fd_mcs.c. 755 See header of drivers/scsi/fd_mcs.c.
756 756
757 fdomain= [HW,SCSI] 757 fdomain= [HW,SCSI]
758 See header of drivers/scsi/fdomain.c. 758 See header of drivers/scsi/fdomain.c.
759 759
760 floppy= [HW] 760 floppy= [HW]
761 See Documentation/blockdev/floppy.txt. 761 See Documentation/blockdev/floppy.txt.
762 762
763 force_pal_cache_flush 763 force_pal_cache_flush
764 [IA-64] Avoid check_sal_cache_flush which may hang on 764 [IA-64] Avoid check_sal_cache_flush which may hang on
765 buggy SAL_CACHE_FLUSH implementations. Using this 765 buggy SAL_CACHE_FLUSH implementations. Using this
766 parameter will force ia64_sal_cache_flush to call 766 parameter will force ia64_sal_cache_flush to call
767 ia64_pal_cache_flush instead of SAL_CACHE_FLUSH. 767 ia64_pal_cache_flush instead of SAL_CACHE_FLUSH.
768 768
769 ftrace=[tracer] 769 ftrace=[tracer]
770 [FTRACE] will set and start the specified tracer 770 [FTRACE] will set and start the specified tracer
771 as early as possible in order to facilitate early 771 as early as possible in order to facilitate early
772 boot debugging. 772 boot debugging.
773 773
774 ftrace_dump_on_oops 774 ftrace_dump_on_oops
775 [FTRACE] will dump the trace buffers on oops. 775 [FTRACE] will dump the trace buffers on oops.
776 776
777 ftrace_filter=[function-list] 777 ftrace_filter=[function-list]
778 [FTRACE] Limit the functions traced by the function 778 [FTRACE] Limit the functions traced by the function
779 tracer at boot up. function-list is a comma separated 779 tracer at boot up. function-list is a comma separated
780 list of functions. This list can be changed at run 780 list of functions. This list can be changed at run
781 time by the set_ftrace_filter file in the debugfs 781 time by the set_ftrace_filter file in the debugfs
782 tracing directory. 782 tracing directory.
783 783
784 ftrace_notrace=[function-list] 784 ftrace_notrace=[function-list]
785 [FTRACE] Do not trace the functions specified in 785 [FTRACE] Do not trace the functions specified in
786 function-list. This list can be changed at run time 786 function-list. This list can be changed at run time
787 by the set_ftrace_notrace file in the debugfs 787 by the set_ftrace_notrace file in the debugfs
788 tracing directory. 788 tracing directory.
789 789
790 ftrace_graph_filter=[function-list] 790 ftrace_graph_filter=[function-list]
791 [FTRACE] Limit the top level callers functions traced 791 [FTRACE] Limit the top level callers functions traced
792 by the function graph tracer at boot up. 792 by the function graph tracer at boot up.
793 function-list is a comma separated list of functions 793 function-list is a comma separated list of functions
794 that can be changed at run time by the 794 that can be changed at run time by the
795 set_graph_function file in the debugfs tracing directory. 795 set_graph_function file in the debugfs tracing directory.
796 796
797 gamecon.map[2|3]= 797 gamecon.map[2|3]=
798 [HW,JOY] Multisystem joystick and NES/SNES/PSX pad 798 [HW,JOY] Multisystem joystick and NES/SNES/PSX pad
799 support via parallel port (up to 5 devices per port) 799 support via parallel port (up to 5 devices per port)
800 Format: <port#>,<pad1>,<pad2>,<pad3>,<pad4>,<pad5> 800 Format: <port#>,<pad1>,<pad2>,<pad3>,<pad4>,<pad5>
801 See also Documentation/input/joystick-parport.txt 801 See also Documentation/input/joystick-parport.txt
802 802
803 gamma= [HW,DRM] 803 gamma= [HW,DRM]
804 804
805 gart_fix_e820= [X86_64] disable the fix e820 for K8 GART 805 gart_fix_e820= [X86_64] disable the fix e820 for K8 GART
806 Format: off | on 806 Format: off | on
807 default: on 807 default: on
808 808
809 gcov_persist= [GCOV] When non-zero (default), profiling data for 809 gcov_persist= [GCOV] When non-zero (default), profiling data for
810 kernel modules is saved and remains accessible via 810 kernel modules is saved and remains accessible via
811 debugfs, even when the module is unloaded/reloaded. 811 debugfs, even when the module is unloaded/reloaded.
812 When zero, profiling data is discarded and associated 812 When zero, profiling data is discarded and associated
813 debugfs files are removed at module unload time. 813 debugfs files are removed at module unload time.
814 814
815 gdth= [HW,SCSI] 815 gdth= [HW,SCSI]
816 See header of drivers/scsi/gdth.c. 816 See header of drivers/scsi/gdth.c.
817 817
818 gpt [EFI] Forces disk with valid GPT signature but 818 gpt [EFI] Forces disk with valid GPT signature but
819 invalid Protective MBR to be treated as GPT. 819 invalid Protective MBR to be treated as GPT.
820 820
821 gvp11= [HW,SCSI] 821 gvp11= [HW,SCSI]
822 822
823 hashdist= [KNL,NUMA] Large hashes allocated during boot 823 hashdist= [KNL,NUMA] Large hashes allocated during boot
824 are distributed across NUMA nodes. Defaults on 824 are distributed across NUMA nodes. Defaults on
825 for 64bit NUMA, off otherwise. 825 for 64bit NUMA, off otherwise.
826 Format: 0 | 1 (for off | on) 826 Format: 0 | 1 (for off | on)
827 827
828 hcl= [IA-64] SGI's Hardware Graph compatibility layer 828 hcl= [IA-64] SGI's Hardware Graph compatibility layer
829 829
830 hd= [EIDE] (E)IDE hard drive subsystem geometry 830 hd= [EIDE] (E)IDE hard drive subsystem geometry
831 Format: <cyl>,<head>,<sect> 831 Format: <cyl>,<head>,<sect>
832 832
833 highmem=nn[KMG] [KNL,BOOT] forces the highmem zone to have an exact 833 highmem=nn[KMG] [KNL,BOOT] forces the highmem zone to have an exact
834 size of <nn>. This works even on boxes that have no 834 size of <nn>. This works even on boxes that have no
835 highmem otherwise. This also works to reduce highmem 835 highmem otherwise. This also works to reduce highmem
836 size on bigger boxes. 836 size on bigger boxes.
837 837
838 highres= [KNL] Enable/disable high resolution timer mode. 838 highres= [KNL] Enable/disable high resolution timer mode.
839 Valid parameters: "on", "off" 839 Valid parameters: "on", "off"
840 Default: "on" 840 Default: "on"
841 841
842 hisax= [HW,ISDN] 842 hisax= [HW,ISDN]
843 See Documentation/isdn/README.HiSax. 843 See Documentation/isdn/README.HiSax.
844 844
845 hlt [BUGS=ARM,SH] 845 hlt [BUGS=ARM,SH]
846 846
847 hpet= [X86-32,HPET] option to control HPET usage 847 hpet= [X86-32,HPET] option to control HPET usage
848 Format: { enable (default) | disable | force | 848 Format: { enable (default) | disable | force |
849 verbose } 849 verbose }
850 disable: disable HPET and use PIT instead 850 disable: disable HPET and use PIT instead
851 force: allow force enabled of undocumented chips (ICH4, 851 force: allow force enabled of undocumented chips (ICH4,
852 VIA, nVidia) 852 VIA, nVidia)
853 verbose: show contents of HPET registers during setup 853 verbose: show contents of HPET registers during setup
854 854
855 hugepages= [HW,X86-32,IA-64] HugeTLB pages to allocate at boot. 855 hugepages= [HW,X86-32,IA-64] HugeTLB pages to allocate at boot.
856 hugepagesz= [HW,IA-64,PPC,X86-64] The size of the HugeTLB pages. 856 hugepagesz= [HW,IA-64,PPC,X86-64] The size of the HugeTLB pages.
857 On x86-64 and powerpc, this option can be specified 857 On x86-64 and powerpc, this option can be specified
858 multiple times interleaved with hugepages= to reserve 858 multiple times interleaved with hugepages= to reserve
859 huge pages of different sizes. Valid pages sizes on 859 huge pages of different sizes. Valid pages sizes on
860 x86-64 are 2M (when the CPU supports "pse") and 1G 860 x86-64 are 2M (when the CPU supports "pse") and 1G
861 (when the CPU supports the "pdpe1gb" cpuinfo flag) 861 (when the CPU supports the "pdpe1gb" cpuinfo flag)
862 Note that 1GB pages can only be allocated at boot time 862 Note that 1GB pages can only be allocated at boot time
863 using hugepages= and not freed afterwards. 863 using hugepages= and not freed afterwards.
864 864
865 hvc_iucv= [S390] Number of z/VM IUCV hypervisor console (HVC) 865 hvc_iucv= [S390] Number of z/VM IUCV hypervisor console (HVC)
866 terminal devices. Valid values: 0..8 866 terminal devices. Valid values: 0..8
867 hvc_iucv_allow= [S390] Comma-separated list of z/VM user IDs. 867 hvc_iucv_allow= [S390] Comma-separated list of z/VM user IDs.
868 If specified, z/VM IUCV HVC accepts connections 868 If specified, z/VM IUCV HVC accepts connections
869 from listed z/VM user IDs only. 869 from listed z/VM user IDs only.
870 870
871 i2c_bus= [HW] Override the default board specific I2C bus speed 871 i2c_bus= [HW] Override the default board specific I2C bus speed
872 or register an additional I2C bus that is not 872 or register an additional I2C bus that is not
873 registered from board initialization code. 873 registered from board initialization code.
874 Format: 874 Format:
875 <bus_id>,<clkrate> 875 <bus_id>,<clkrate>
876 876
877 i8042.debug [HW] Toggle i8042 debug mode 877 i8042.debug [HW] Toggle i8042 debug mode
878 i8042.direct [HW] Put keyboard port into non-translated mode 878 i8042.direct [HW] Put keyboard port into non-translated mode
879 i8042.dumbkbd [HW] Pretend that controller can only read data from 879 i8042.dumbkbd [HW] Pretend that controller can only read data from
880 keyboard and cannot control its state 880 keyboard and cannot control its state
881 (Don't attempt to blink the leds) 881 (Don't attempt to blink the leds)
882 i8042.noaux [HW] Don't check for auxiliary (== mouse) port 882 i8042.noaux [HW] Don't check for auxiliary (== mouse) port
883 i8042.nokbd [HW] Don't check/create keyboard port 883 i8042.nokbd [HW] Don't check/create keyboard port
884 i8042.noloop [HW] Disable the AUX Loopback command while probing 884 i8042.noloop [HW] Disable the AUX Loopback command while probing
885 for the AUX port 885 for the AUX port
886 i8042.nomux [HW] Don't check presence of an active multiplexing 886 i8042.nomux [HW] Don't check presence of an active multiplexing
887 controller 887 controller
888 i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX 888 i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX
889 controllers 889 controllers
890 i8042.panicblink= 890 i8042.panicblink=
891 [HW] Frequency with which keyboard LEDs should blink 891 [HW] Frequency with which keyboard LEDs should blink
892 when kernel panics (default is 0.5 sec) 892 when kernel panics (default is 0.5 sec)
893 i8042.reset [HW] Reset the controller during init and cleanup 893 i8042.reset [HW] Reset the controller during init and cleanup
894 i8042.unlock [HW] Unlock (ignore) the keylock 894 i8042.unlock [HW] Unlock (ignore) the keylock
895 895
896 i810= [HW,DRM] 896 i810= [HW,DRM]
897 897
898 i8k.ignore_dmi [HW] Continue probing hardware even if DMI data 898 i8k.ignore_dmi [HW] Continue probing hardware even if DMI data
899 indicates that the driver is running on unsupported 899 indicates that the driver is running on unsupported
900 hardware. 900 hardware.
901 i8k.force [HW] Activate i8k driver even if SMM BIOS signature 901 i8k.force [HW] Activate i8k driver even if SMM BIOS signature
902 does not match list of supported models. 902 does not match list of supported models.
903 i8k.power_status 903 i8k.power_status
904 [HW] Report power status in /proc/i8k 904 [HW] Report power status in /proc/i8k
905 (disabled by default) 905 (disabled by default)
906 i8k.restricted [HW] Allow controlling fans only if SYS_ADMIN 906 i8k.restricted [HW] Allow controlling fans only if SYS_ADMIN
907 capability is set. 907 capability is set.
908 908
909 ibmmcascsi= [HW,MCA,SCSI] IBM MicroChannel SCSI adapter 909 ibmmcascsi= [HW,MCA,SCSI] IBM MicroChannel SCSI adapter
910 See Documentation/mca.txt. 910 See Documentation/mca.txt.
911 911
912 icn= [HW,ISDN] 912 icn= [HW,ISDN]
913 Format: <io>[,<membase>[,<icn_id>[,<icn_id2>]]] 913 Format: <io>[,<membase>[,<icn_id>[,<icn_id2>]]]
914 914
915 ide-core.nodma= [HW] (E)IDE subsystem 915 ide-core.nodma= [HW] (E)IDE subsystem
916 Format: =0.0 to prevent dma on hda, =0.1 hdb =1.0 hdc 916 Format: =0.0 to prevent dma on hda, =0.1 hdb =1.0 hdc
917 .vlb_clock .pci_clock .noflush .nohpa .noprobe .nowerr 917 .vlb_clock .pci_clock .noflush .nohpa .noprobe .nowerr
918 .cdrom .chs .ignore_cable are additional options 918 .cdrom .chs .ignore_cable are additional options
919 See Documentation/ide/ide.txt. 919 See Documentation/ide/ide.txt.
920 920
921 ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem 921 ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem
922 Claim all unknown PCI IDE storage controllers. 922 Claim all unknown PCI IDE storage controllers.
923 923
924 idle= [X86] 924 idle= [X86]
925 Format: idle=poll, idle=mwait, idle=halt, idle=nomwait 925 Format: idle=poll, idle=mwait, idle=halt, idle=nomwait
926 Poll forces a polling idle loop that can slightly 926 Poll forces a polling idle loop that can slightly
927 improve the performance of waking up a idle CPU, but 927 improve the performance of waking up a idle CPU, but
928 will use a lot of power and make the system run hot. 928 will use a lot of power and make the system run hot.
929 Not recommended. 929 Not recommended.
930 idle=mwait: On systems which support MONITOR/MWAIT but 930 idle=mwait: On systems which support MONITOR/MWAIT but
931 the kernel chose to not use it because it doesn't save 931 the kernel chose to not use it because it doesn't save
932 as much power as a normal idle loop, use the 932 as much power as a normal idle loop, use the
933 MONITOR/MWAIT idle loop anyways. Performance should be 933 MONITOR/MWAIT idle loop anyways. Performance should be
934 the same as idle=poll. 934 the same as idle=poll.
935 idle=halt: Halt is forced to be used for CPU idle. 935 idle=halt: Halt is forced to be used for CPU idle.
936 In such case C2/C3 won't be used again. 936 In such case C2/C3 won't be used again.
937 idle=nomwait: Disable mwait for CPU C-states 937 idle=nomwait: Disable mwait for CPU C-states
938 938
939 ignore_loglevel [KNL] 939 ignore_loglevel [KNL]
940 Ignore loglevel setting - this will print /all/ 940 Ignore loglevel setting - this will print /all/
941 kernel messages to the console. Useful for debugging. 941 kernel messages to the console. Useful for debugging.
942 942
943 ihash_entries= [KNL] 943 ihash_entries= [KNL]
944 Set number of hash buckets for inode cache. 944 Set number of hash buckets for inode cache.
945 945
946 ima_audit= [IMA] 946 ima_audit= [IMA]
947 Format: { "0" | "1" } 947 Format: { "0" | "1" }
948 0 -- integrity auditing messages. (Default) 948 0 -- integrity auditing messages. (Default)
949 1 -- enable informational integrity auditing messages. 949 1 -- enable informational integrity auditing messages.
950 950
951 ima_hash= [IMA] 951 ima_hash= [IMA]
952 Format: { "sha1" | "md5" } 952 Format: { "sha1" | "md5" }
953 default: "sha1" 953 default: "sha1"
954 954
955 ima_tcb [IMA] 955 ima_tcb [IMA]
956 Load a policy which meets the needs of the Trusted 956 Load a policy which meets the needs of the Trusted
957 Computing Base. This means IMA will measure all 957 Computing Base. This means IMA will measure all
958 programs exec'd, files mmap'd for exec, and all files 958 programs exec'd, files mmap'd for exec, and all files
959 opened for read by uid=0. 959 opened for read by uid=0.
960 960
961 in2000= [HW,SCSI] 961 in2000= [HW,SCSI]
962 See header of drivers/scsi/in2000.c. 962 See header of drivers/scsi/in2000.c.
963 963
964 init= [KNL] 964 init= [KNL]
965 Format: <full_path> 965 Format: <full_path>
966 Run specified binary instead of /sbin/init as init 966 Run specified binary instead of /sbin/init as init
967 process. 967 process.
968 968
969 initcall_debug [KNL] Trace initcalls as they are executed. Useful 969 initcall_debug [KNL] Trace initcalls as they are executed. Useful
970 for working out where the kernel is dying during 970 for working out where the kernel is dying during
971 startup. 971 startup.
972 972
973 initrd= [BOOT] Specify the location of the initial ramdisk 973 initrd= [BOOT] Specify the location of the initial ramdisk
974 974
975 inport.irq= [HW] Inport (ATI XL and Microsoft) busmouse driver 975 inport.irq= [HW] Inport (ATI XL and Microsoft) busmouse driver
976 Format: <irq> 976 Format: <irq>
977 977
978 intel_iommu= [DMAR] Intel IOMMU driver (DMAR) option 978 intel_iommu= [DMAR] Intel IOMMU driver (DMAR) option
979 on 979 on
980 Enable intel iommu driver. 980 Enable intel iommu driver.
981 off 981 off
982 Disable intel iommu driver. 982 Disable intel iommu driver.
983 igfx_off [Default Off] 983 igfx_off [Default Off]
984 By default, gfx is mapped as normal device. If a gfx 984 By default, gfx is mapped as normal device. If a gfx
985 device has a dedicated DMAR unit, the DMAR unit is 985 device has a dedicated DMAR unit, the DMAR unit is
986 bypassed by not enabling DMAR with this option. In 986 bypassed by not enabling DMAR with this option. In
987 this case, gfx device will use physical address for 987 this case, gfx device will use physical address for
988 DMA. 988 DMA.
989 forcedac [x86_64] 989 forcedac [x86_64]
990 With this option iommu will not optimize to look 990 With this option iommu will not optimize to look
991 for io virtual address below 32 bit forcing dual 991 for io virtual address below 32 bit forcing dual
992 address cycle on pci bus for cards supporting greater 992 address cycle on pci bus for cards supporting greater
993 than 32 bit addressing. The default is to look 993 than 32 bit addressing. The default is to look
994 for translation below 32 bit and if not available 994 for translation below 32 bit and if not available
995 then look in the higher range. 995 then look in the higher range.
996 strict [Default Off] 996 strict [Default Off]
997 With this option on every unmap_single operation will 997 With this option on every unmap_single operation will
998 result in a hardware IOTLB flush operation as opposed 998 result in a hardware IOTLB flush operation as opposed
999 to batching them for performance. 999 to batching them for performance.
1000 1000
1001 inttest= [IA64] 1001 inttest= [IA64]
1002 1002
1003 iomem= Disable strict checking of access to MMIO memory 1003 iomem= Disable strict checking of access to MMIO memory
1004 strict regions from userspace. 1004 strict regions from userspace.
1005 relaxed 1005 relaxed
1006 1006
1007 iommu= [x86] 1007 iommu= [x86]
1008 off 1008 off
1009 force 1009 force
1010 noforce 1010 noforce
1011 biomerge 1011 biomerge
1012 panic 1012 panic
1013 nopanic 1013 nopanic
1014 merge 1014 merge
1015 nomerge 1015 nomerge
1016 forcesac 1016 forcesac
1017 soft 1017 soft
1018 pt [x86, IA64] 1018 pt [x86, IA64]
1019 1019
1020 io7= [HW] IO7 for Marvel based alpha systems 1020 io7= [HW] IO7 for Marvel based alpha systems
1021 See comment before marvel_specify_io7 in 1021 See comment before marvel_specify_io7 in
1022 arch/alpha/kernel/core_marvel.c. 1022 arch/alpha/kernel/core_marvel.c.
1023 1023
1024 io_delay= [X86] I/O delay method 1024 io_delay= [X86] I/O delay method
1025 0x80 1025 0x80
1026 Standard port 0x80 based delay 1026 Standard port 0x80 based delay
1027 0xed 1027 0xed
1028 Alternate port 0xed based delay (needed on some systems) 1028 Alternate port 0xed based delay (needed on some systems)
1029 udelay 1029 udelay
1030 Simple two microseconds delay 1030 Simple two microseconds delay
1031 none 1031 none
1032 No delay 1032 No delay
1033 1033
1034 ip= [IP_PNP] 1034 ip= [IP_PNP]
1035 See Documentation/filesystems/nfsroot.txt. 1035 See Documentation/filesystems/nfsroot.txt.
1036 1036
1037 ip2= [HW] Set IO/IRQ pairs for up to 4 IntelliPort boards 1037 ip2= [HW] Set IO/IRQ pairs for up to 4 IntelliPort boards
1038 See comment before ip2_setup() in 1038 See comment before ip2_setup() in
1039 drivers/char/ip2/ip2base.c. 1039 drivers/char/ip2/ip2base.c.
1040 1040
1041 ips= [HW,SCSI] Adaptec / IBM ServeRAID controller 1041 ips= [HW,SCSI] Adaptec / IBM ServeRAID controller
1042 See header of drivers/scsi/ips.c. 1042 See header of drivers/scsi/ips.c.
1043 1043
1044 irqfixup [HW] 1044 irqfixup [HW]
1045 When an interrupt is not handled search all handlers 1045 When an interrupt is not handled search all handlers
1046 for it. Intended to get systems with badly broken 1046 for it. Intended to get systems with badly broken
1047 firmware running. 1047 firmware running.
1048 1048
1049 irqpoll [HW] 1049 irqpoll [HW]
1050 When an interrupt is not handled search all handlers 1050 When an interrupt is not handled search all handlers
1051 for it. Also check all handlers each timer 1051 for it. Also check all handlers each timer
1052 interrupt. Intended to get systems with badly broken 1052 interrupt. Intended to get systems with badly broken
1053 firmware running. 1053 firmware running.
1054 1054
1055 isapnp= [ISAPNP] 1055 isapnp= [ISAPNP]
1056 Format: <RDP>,<reset>,<pci_scan>,<verbosity> 1056 Format: <RDP>,<reset>,<pci_scan>,<verbosity>
1057 1057
1058 isolcpus= [KNL,SMP] Isolate CPUs from the general scheduler. 1058 isolcpus= [KNL,SMP] Isolate CPUs from the general scheduler.
1059 Format: 1059 Format:
1060 <cpu number>,...,<cpu number> 1060 <cpu number>,...,<cpu number>
1061 or 1061 or
1062 <cpu number>-<cpu number> 1062 <cpu number>-<cpu number>
1063 (must be a positive range in ascending order) 1063 (must be a positive range in ascending order)
1064 or a mixture 1064 or a mixture
1065 <cpu number>,...,<cpu number>-<cpu number> 1065 <cpu number>,...,<cpu number>-<cpu number>
1066 1066
1067 This option can be used to specify one or more CPUs 1067 This option can be used to specify one or more CPUs
1068 to isolate from the general SMP balancing and scheduling 1068 to isolate from the general SMP balancing and scheduling
1069 algorithms. You can move a process onto or off an 1069 algorithms. You can move a process onto or off an
1070 "isolated" CPU via the CPU affinity syscalls or cpuset. 1070 "isolated" CPU via the CPU affinity syscalls or cpuset.
1071 <cpu number> begins at 0 and the maximum value is 1071 <cpu number> begins at 0 and the maximum value is
1072 "number of CPUs in system - 1". 1072 "number of CPUs in system - 1".
1073 1073
1074 This option is the preferred way to isolate CPUs. The 1074 This option is the preferred way to isolate CPUs. The
1075 alternative -- manually setting the CPU mask of all 1075 alternative -- manually setting the CPU mask of all
1076 tasks in the system -- can cause problems and 1076 tasks in the system -- can cause problems and
1077 suboptimal load balancer performance. 1077 suboptimal load balancer performance.
1078 1078
1079 iucv= [HW,NET] 1079 iucv= [HW,NET]
1080 1080
1081 js= [HW,JOY] Analog joystick 1081 js= [HW,JOY] Analog joystick
1082 See Documentation/input/joystick.txt. 1082 See Documentation/input/joystick.txt.
1083 1083
1084 keepinitrd [HW,ARM] 1084 keepinitrd [HW,ARM]
1085 1085
1086 kernelcore=nn[KMG] [KNL,X86,IA-64,PPC] This parameter 1086 kernelcore=nn[KMG] [KNL,X86,IA-64,PPC] This parameter
1087 specifies the amount of memory usable by the kernel 1087 specifies the amount of memory usable by the kernel
1088 for non-movable allocations. The requested amount is 1088 for non-movable allocations. The requested amount is
1089 spread evenly throughout all nodes in the system. The 1089 spread evenly throughout all nodes in the system. The
1090 remaining memory in each node is used for Movable 1090 remaining memory in each node is used for Movable
1091 pages. In the event, a node is too small to have both 1091 pages. In the event, a node is too small to have both
1092 kernelcore and Movable pages, kernelcore pages will 1092 kernelcore and Movable pages, kernelcore pages will
1093 take priority and other nodes will have a larger number 1093 take priority and other nodes will have a larger number
1094 of kernelcore pages. The Movable zone is used for the 1094 of kernelcore pages. The Movable zone is used for the
1095 allocation of pages that may be reclaimed or moved 1095 allocation of pages that may be reclaimed or moved
1096 by the page migration subsystem. This means that 1096 by the page migration subsystem. This means that
1097 HugeTLB pages may not be allocated from this zone. 1097 HugeTLB pages may not be allocated from this zone.
1098 Note that allocations like PTEs-from-HighMem still 1098 Note that allocations like PTEs-from-HighMem still
1099 use the HighMem zone if it exists, and the Normal 1099 use the HighMem zone if it exists, and the Normal
1100 zone if it does not. 1100 zone if it does not.
1101 1101
1102 kgdboc= [HW] kgdb over consoles. 1102 kgdboc= [HW] kgdb over consoles.
1103 Requires a tty driver that supports console polling. 1103 Requires a tty driver that supports console polling.
1104 (only serial supported for now) 1104 (only serial supported for now)
1105 Format: <serial_device>[,baud] 1105 Format: <serial_device>[,baud]
1106 1106
1107 kmac= [MIPS] korina ethernet MAC address. 1107 kmac= [MIPS] korina ethernet MAC address.
1108 Configure the RouterBoard 532 series on-chip 1108 Configure the RouterBoard 532 series on-chip
1109 Ethernet adapter MAC address. 1109 Ethernet adapter MAC address.
1110 1110
1111 kmemleak= [KNL] Boot-time kmemleak enable/disable 1111 kmemleak= [KNL] Boot-time kmemleak enable/disable
1112 Valid arguments: on, off 1112 Valid arguments: on, off
1113 Default: on 1113 Default: on
1114 1114
1115 kstack=N [X86] Print N words from the kernel stack 1115 kstack=N [X86] Print N words from the kernel stack
1116 in oops dumps. 1116 in oops dumps.
1117 1117
1118 kvm.ignore_msrs=[KVM] Ignore guest accesses to unhandled MSRs. 1118 kvm.ignore_msrs=[KVM] Ignore guest accesses to unhandled MSRs.
1119 Default is 0 (don't ignore, but inject #GP) 1119 Default is 0 (don't ignore, but inject #GP)
1120 1120
1121 kvm.oos_shadow= [KVM] Disable out-of-sync shadow paging. 1121 kvm.oos_shadow= [KVM] Disable out-of-sync shadow paging.
1122 Default is 1 (enabled) 1122 Default is 1 (enabled)
1123 1123
1124 kvm-amd.nested= [KVM,AMD] Allow nested virtualization in KVM/SVM. 1124 kvm-amd.nested= [KVM,AMD] Allow nested virtualization in KVM/SVM.
1125 Default is 0 (off) 1125 Default is 0 (off)
1126 1126
1127 kvm-amd.npt= [KVM,AMD] Disable nested paging (virtualized MMU) 1127 kvm-amd.npt= [KVM,AMD] Disable nested paging (virtualized MMU)
1128 for all guests. 1128 for all guests.
1129 Default is 1 (enabled) if in 64bit or 32bit-PAE mode 1129 Default is 1 (enabled) if in 64bit or 32bit-PAE mode
1130 1130
1131 kvm-intel.bypass_guest_pf= 1131 kvm-intel.bypass_guest_pf=
1132 [KVM,Intel] Disables bypassing of guest page faults 1132 [KVM,Intel] Disables bypassing of guest page faults
1133 on Intel chips. Default is 1 (enabled) 1133 on Intel chips. Default is 1 (enabled)
1134 1134
1135 kvm-intel.ept= [KVM,Intel] Disable extended page tables 1135 kvm-intel.ept= [KVM,Intel] Disable extended page tables
1136 (virtualized MMU) support on capable Intel chips. 1136 (virtualized MMU) support on capable Intel chips.
1137 Default is 1 (enabled) 1137 Default is 1 (enabled)
1138 1138
1139 kvm-intel.emulate_invalid_guest_state= 1139 kvm-intel.emulate_invalid_guest_state=
1140 [KVM,Intel] Enable emulation of invalid guest states 1140 [KVM,Intel] Enable emulation of invalid guest states
1141 Default is 0 (disabled) 1141 Default is 0 (disabled)
1142 1142
1143 kvm-intel.flexpriority= 1143 kvm-intel.flexpriority=
1144 [KVM,Intel] Disable FlexPriority feature (TPR shadow). 1144 [KVM,Intel] Disable FlexPriority feature (TPR shadow).
1145 Default is 1 (enabled) 1145 Default is 1 (enabled)
1146 1146
1147 kvm-intel.unrestricted_guest= 1147 kvm-intel.unrestricted_guest=
1148 [KVM,Intel] Disable unrestricted guest feature 1148 [KVM,Intel] Disable unrestricted guest feature
1149 (virtualized real and unpaged mode) on capable 1149 (virtualized real and unpaged mode) on capable
1150 Intel chips. Default is 1 (enabled) 1150 Intel chips. Default is 1 (enabled)
1151 1151
1152 kvm-intel.vpid= [KVM,Intel] Disable Virtual Processor Identification 1152 kvm-intel.vpid= [KVM,Intel] Disable Virtual Processor Identification
1153 feature (tagged TLBs) on capable Intel chips. 1153 feature (tagged TLBs) on capable Intel chips.
1154 Default is 1 (enabled) 1154 Default is 1 (enabled)
1155 1155
1156 l2cr= [PPC] 1156 l2cr= [PPC]
1157 1157
1158 l3cr= [PPC] 1158 l3cr= [PPC]
1159 1159
1160 lapic [X86-32,APIC] Enable the local APIC even if BIOS 1160 lapic [X86-32,APIC] Enable the local APIC even if BIOS
1161 disabled it. 1161 disabled it.
1162 1162
1163 lapic_timer_c2_ok [X86,APIC] trust the local apic timer 1163 lapic_timer_c2_ok [X86,APIC] trust the local apic timer
1164 in C2 power state. 1164 in C2 power state.
1165 1165
1166 libata.dma= [LIBATA] DMA control 1166 libata.dma= [LIBATA] DMA control
1167 libata.dma=0 Disable all PATA and SATA DMA 1167 libata.dma=0 Disable all PATA and SATA DMA
1168 libata.dma=1 PATA and SATA Disk DMA only 1168 libata.dma=1 PATA and SATA Disk DMA only
1169 libata.dma=2 ATAPI (CDROM) DMA only 1169 libata.dma=2 ATAPI (CDROM) DMA only
1170 libata.dma=4 Compact Flash DMA only 1170 libata.dma=4 Compact Flash DMA only
1171 Combinations also work, so libata.dma=3 enables DMA 1171 Combinations also work, so libata.dma=3 enables DMA
1172 for disks and CDROMs, but not CFs. 1172 for disks and CDROMs, but not CFs.
1173 1173
1174 libata.ignore_hpa= [LIBATA] Ignore HPA limit 1174 libata.ignore_hpa= [LIBATA] Ignore HPA limit
1175 libata.ignore_hpa=0 keep BIOS limits (default) 1175 libata.ignore_hpa=0 keep BIOS limits (default)
1176 libata.ignore_hpa=1 ignore limits, using full disk 1176 libata.ignore_hpa=1 ignore limits, using full disk
1177 1177
1178 libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume 1178 libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume
1179 when set. 1179 when set.
1180 Format: <int> 1180 Format: <int>
1181 1181
1182 libata.force= [LIBATA] Force configurations. The format is comma 1182 libata.force= [LIBATA] Force configurations. The format is comma
1183 separated list of "[ID:]VAL" where ID is 1183 separated list of "[ID:]VAL" where ID is
1184 PORT[:DEVICE]. PORT and DEVICE are decimal numbers 1184 PORT[:DEVICE]. PORT and DEVICE are decimal numbers
1185 matching port, link or device. Basically, it matches 1185 matching port, link or device. Basically, it matches
1186 the ATA ID string printed on console by libata. If 1186 the ATA ID string printed on console by libata. If
1187 the whole ID part is omitted, the last PORT and DEVICE 1187 the whole ID part is omitted, the last PORT and DEVICE
1188 values are used. If ID hasn't been specified yet, the 1188 values are used. If ID hasn't been specified yet, the
1189 configuration applies to all ports, links and devices. 1189 configuration applies to all ports, links and devices.
1190 1190
1191 If only DEVICE is omitted, the parameter applies to 1191 If only DEVICE is omitted, the parameter applies to
1192 the port and all links and devices behind it. DEVICE 1192 the port and all links and devices behind it. DEVICE
1193 number of 0 either selects the first device or the 1193 number of 0 either selects the first device or the
1194 first fan-out link behind PMP device. It does not 1194 first fan-out link behind PMP device. It does not
1195 select the host link. DEVICE number of 15 selects the 1195 select the host link. DEVICE number of 15 selects the
1196 host link and device attached to it. 1196 host link and device attached to it.
1197 1197
1198 The VAL specifies the configuration to force. As long 1198 The VAL specifies the configuration to force. As long
1199 as there's no ambiguity shortcut notation is allowed. 1199 as there's no ambiguity shortcut notation is allowed.
1200 For example, both 1.5 and 1.5G would work for 1.5Gbps. 1200 For example, both 1.5 and 1.5G would work for 1.5Gbps.
1201 The following configurations can be forced. 1201 The following configurations can be forced.
1202 1202
1203 * Cable type: 40c, 80c, short40c, unk, ign or sata. 1203 * Cable type: 40c, 80c, short40c, unk, ign or sata.
1204 Any ID with matching PORT is used. 1204 Any ID with matching PORT is used.
1205 1205
1206 * SATA link speed limit: 1.5Gbps or 3.0Gbps. 1206 * SATA link speed limit: 1.5Gbps or 3.0Gbps.
1207 1207
1208 * Transfer mode: pio[0-7], mwdma[0-4] and udma[0-7]. 1208 * Transfer mode: pio[0-7], mwdma[0-4] and udma[0-7].
1209 udma[/][16,25,33,44,66,100,133] notation is also 1209 udma[/][16,25,33,44,66,100,133] notation is also
1210 allowed. 1210 allowed.
1211 1211
1212 * [no]ncq: Turn on or off NCQ. 1212 * [no]ncq: Turn on or off NCQ.
1213 1213
1214 * nohrst, nosrst, norst: suppress hard, soft 1214 * nohrst, nosrst, norst: suppress hard, soft
1215 and both resets. 1215 and both resets.
1216 1216
1217 If there are multiple matching configurations changing 1217 If there are multiple matching configurations changing
1218 the same attribute, the last one is used. 1218 the same attribute, the last one is used.
1219 1219
1220 lmb=debug [KNL] Enable lmb debug messages. 1220 lmb=debug [KNL] Enable lmb debug messages.
1221 1221
1222 load_ramdisk= [RAM] List of ramdisks to load from floppy 1222 load_ramdisk= [RAM] List of ramdisks to load from floppy
1223 See Documentation/blockdev/ramdisk.txt. 1223 See Documentation/blockdev/ramdisk.txt.
1224 1224
1225 lockd.nlm_grace_period=P [NFS] Assign grace period. 1225 lockd.nlm_grace_period=P [NFS] Assign grace period.
1226 Format: <integer> 1226 Format: <integer>
1227 1227
1228 lockd.nlm_tcpport=N [NFS] Assign TCP port. 1228 lockd.nlm_tcpport=N [NFS] Assign TCP port.
1229 Format: <integer> 1229 Format: <integer>
1230 1230
1231 lockd.nlm_timeout=T [NFS] Assign timeout value. 1231 lockd.nlm_timeout=T [NFS] Assign timeout value.
1232 Format: <integer> 1232 Format: <integer>
1233 1233
1234 lockd.nlm_udpport=M [NFS] Assign UDP port. 1234 lockd.nlm_udpport=M [NFS] Assign UDP port.
1235 Format: <integer> 1235 Format: <integer>
1236 1236
1237 logibm.irq= [HW,MOUSE] Logitech Bus Mouse Driver 1237 logibm.irq= [HW,MOUSE] Logitech Bus Mouse Driver
1238 Format: <irq> 1238 Format: <irq>
1239 1239
1240 loglevel= All Kernel Messages with a loglevel smaller than the 1240 loglevel= All Kernel Messages with a loglevel smaller than the
1241 console loglevel will be printed to the console. It can 1241 console loglevel will be printed to the console. It can
1242 also be changed with klogd or other programs. The 1242 also be changed with klogd or other programs. The
1243 loglevels are defined as follows: 1243 loglevels are defined as follows:
1244 1244
1245 0 (KERN_EMERG) system is unusable 1245 0 (KERN_EMERG) system is unusable
1246 1 (KERN_ALERT) action must be taken immediately 1246 1 (KERN_ALERT) action must be taken immediately
1247 2 (KERN_CRIT) critical conditions 1247 2 (KERN_CRIT) critical conditions
1248 3 (KERN_ERR) error conditions 1248 3 (KERN_ERR) error conditions
1249 4 (KERN_WARNING) warning conditions 1249 4 (KERN_WARNING) warning conditions
1250 5 (KERN_NOTICE) normal but significant condition 1250 5 (KERN_NOTICE) normal but significant condition
1251 6 (KERN_INFO) informational 1251 6 (KERN_INFO) informational
1252 7 (KERN_DEBUG) debug-level messages 1252 7 (KERN_DEBUG) debug-level messages
1253 1253
1254 log_buf_len=n Sets the size of the printk ring buffer, in bytes. 1254 log_buf_len=n Sets the size of the printk ring buffer, in bytes.
1255 Format: { n | nk | nM } 1255 Format: { n | nk | nM }
1256 n must be a power of two. The default size 1256 n must be a power of two. The default size
1257 is set in the kernel config file. 1257 is set in the kernel config file.
1258 1258
1259 logo.nologo [FB] Disables display of the built-in Linux logo. 1259 logo.nologo [FB] Disables display of the built-in Linux logo.
1260 This may be used to provide more screen space for 1260 This may be used to provide more screen space for
1261 kernel log messages and is useful when debugging 1261 kernel log messages and is useful when debugging
1262 kernel boot problems. 1262 kernel boot problems.
1263 1263
1264 lp=0 [LP] Specify parallel ports to use, e.g, 1264 lp=0 [LP] Specify parallel ports to use, e.g,
1265 lp=port[,port...] lp=none,parport0 (lp0 not configured, lp1 uses 1265 lp=port[,port...] lp=none,parport0 (lp0 not configured, lp1 uses
1266 lp=reset first parallel port). 'lp=0' disables the 1266 lp=reset first parallel port). 'lp=0' disables the
1267 lp=auto printer driver. 'lp=reset' (which can be 1267 lp=auto printer driver. 'lp=reset' (which can be
1268 specified in addition to the ports) causes 1268 specified in addition to the ports) causes
1269 attached printers to be reset. Using 1269 attached printers to be reset. Using
1270 lp=port1,port2,... specifies the parallel ports 1270 lp=port1,port2,... specifies the parallel ports
1271 to associate lp devices with, starting with 1271 to associate lp devices with, starting with
1272 lp0. A port specification may be 'none' to skip 1272 lp0. A port specification may be 'none' to skip
1273 that lp device, or a parport name such as 1273 that lp device, or a parport name such as
1274 'parport0'. Specifying 'lp=auto' instead of a 1274 'parport0'. Specifying 'lp=auto' instead of a
1275 port specification list means that device IDs 1275 port specification list means that device IDs
1276 from each port should be examined, to see if 1276 from each port should be examined, to see if
1277 an IEEE 1284-compliant printer is attached; if 1277 an IEEE 1284-compliant printer is attached; if
1278 so, the driver will manage that printer. 1278 so, the driver will manage that printer.
1279 See also header of drivers/char/lp.c. 1279 See also header of drivers/char/lp.c.
1280 1280
1281 lpj=n [KNL] 1281 lpj=n [KNL]
1282 Sets loops_per_jiffy to given constant, thus avoiding 1282 Sets loops_per_jiffy to given constant, thus avoiding
1283 time-consuming boot-time autodetection (up to 250 ms per 1283 time-consuming boot-time autodetection (up to 250 ms per
1284 CPU). 0 enables autodetection (default). To determine 1284 CPU). 0 enables autodetection (default). To determine
1285 the correct value for your kernel, boot with normal 1285 the correct value for your kernel, boot with normal
1286 autodetection and see what value is printed. Note that 1286 autodetection and see what value is printed. Note that
1287 on SMP systems the preset will be applied to all CPUs, 1287 on SMP systems the preset will be applied to all CPUs,
1288 which is likely to cause problems if your CPUs need 1288 which is likely to cause problems if your CPUs need
1289 significantly divergent settings. An incorrect value 1289 significantly divergent settings. An incorrect value
1290 will cause delays in the kernel to be wrong, leading to 1290 will cause delays in the kernel to be wrong, leading to
1291 unpredictable I/O errors and other breakage. Although 1291 unpredictable I/O errors and other breakage. Although
1292 unlikely, in the extreme case this might damage your 1292 unlikely, in the extreme case this might damage your
1293 hardware. 1293 hardware.
1294 1294
1295 ltpc= [NET] 1295 ltpc= [NET]
1296 Format: <io>,<irq>,<dma> 1296 Format: <io>,<irq>,<dma>
1297 1297
1298 mac5380= [HW,SCSI] Format: 1298 mac5380= [HW,SCSI] Format:
1299 <can_queue>,<cmd_per_lun>,<sg_tablesize>,<hostid>,<use_tags> 1299 <can_queue>,<cmd_per_lun>,<sg_tablesize>,<hostid>,<use_tags>
1300 1300
1301 machvec= [IA64] Force the use of a particular machine-vector 1301 machvec= [IA64] Force the use of a particular machine-vector
1302 (machvec) in a generic kernel. 1302 (machvec) in a generic kernel.
1303 Example: machvec=hpzx1_swiotlb 1303 Example: machvec=hpzx1_swiotlb
1304 1304
1305 machtype= [Loongson] Share the same kernel image file between different 1305 machtype= [Loongson] Share the same kernel image file between different
1306 yeeloong laptop. 1306 yeeloong laptop.
1307 Example: machtype=lemote-yeeloong-2f-7inch 1307 Example: machtype=lemote-yeeloong-2f-7inch
1308 1308
1309 max_addr=nn[KMG] [KNL,BOOT,ia64] All physical memory greater 1309 max_addr=nn[KMG] [KNL,BOOT,ia64] All physical memory greater
1310 than or equal to this physical address is ignored. 1310 than or equal to this physical address is ignored.
1311 1311
1312 maxcpus= [SMP] Maximum number of processors that an SMP kernel 1312 maxcpus= [SMP] Maximum number of processors that an SMP kernel
1313 should make use of. maxcpus=n : n >= 0 limits the 1313 should make use of. maxcpus=n : n >= 0 limits the
1314 kernel to using 'n' processors. n=0 is a special case, 1314 kernel to using 'n' processors. n=0 is a special case,
1315 it is equivalent to "nosmp", which also disables 1315 it is equivalent to "nosmp", which also disables
1316 the IO APIC. 1316 the IO APIC.
1317 1317
1318 max_loop= [LOOP] Maximum number of loopback devices that can 1318 max_loop= [LOOP] Maximum number of loopback devices that can
1319 be mounted 1319 be mounted
1320 Format: <1-256> 1320 Format: <1-256>
1321 1321
1322 max_luns= [SCSI] Maximum number of LUNs to probe. 1322 max_luns= [SCSI] Maximum number of LUNs to probe.
1323 Should be between 1 and 2^32-1. 1323 Should be between 1 and 2^32-1.
1324 1324
1325 max_report_luns= 1325 max_report_luns=
1326 [SCSI] Maximum number of LUNs received. 1326 [SCSI] Maximum number of LUNs received.
1327 Should be between 1 and 16384. 1327 Should be between 1 and 16384.
1328 1328
1329 mcatest= [IA-64] 1329 mcatest= [IA-64]
1330 1330
1331 mce [X86-32] Machine Check Exception 1331 mce [X86-32] Machine Check Exception
1332 1332
1333 mce=option [X86-64] See Documentation/x86/x86_64/boot-options.txt 1333 mce=option [X86-64] See Documentation/x86/x86_64/boot-options.txt
1334 1334
1335 md= [HW] RAID subsystems devices and level 1335 md= [HW] RAID subsystems devices and level
1336 See Documentation/md.txt. 1336 See Documentation/md.txt.
1337 1337
1338 mdacon= [MDA] 1338 mdacon= [MDA]
1339 Format: <first>,<last> 1339 Format: <first>,<last>
1340 Specifies range of consoles to be captured by the MDA. 1340 Specifies range of consoles to be captured by the MDA.
1341 1341
1342 mem=nn[KMG] [KNL,BOOT] Force usage of a specific amount of memory 1342 mem=nn[KMG] [KNL,BOOT] Force usage of a specific amount of memory
1343 Amount of memory to be used when the kernel is not able 1343 Amount of memory to be used when the kernel is not able
1344 to see the whole system memory or for test. 1344 to see the whole system memory or for test.
1345 [X86-32] Use together with memmap= to avoid physical 1345 [X86-32] Use together with memmap= to avoid physical
1346 address space collisions. Without memmap= PCI devices 1346 address space collisions. Without memmap= PCI devices
1347 could be placed at addresses belonging to unused RAM. 1347 could be placed at addresses belonging to unused RAM.
1348 1348
1349 mem=nopentium [BUGS=X86-32] Disable usage of 4MB pages for kernel 1349 mem=nopentium [BUGS=X86-32] Disable usage of 4MB pages for kernel
1350 memory. 1350 memory.
1351 1351
1352 memchunk=nn[KMG] 1352 memchunk=nn[KMG]
1353 [KNL,SH] Allow user to override the default size for 1353 [KNL,SH] Allow user to override the default size for
1354 per-device physically contiguous DMA buffers. 1354 per-device physically contiguous DMA buffers.
1355 1355
1356 memmap=exactmap [KNL,X86] Enable setting of an exact 1356 memmap=exactmap [KNL,X86] Enable setting of an exact
1357 E820 memory map, as specified by the user. 1357 E820 memory map, as specified by the user.
1358 Such memmap=exactmap lines can be constructed based on 1358 Such memmap=exactmap lines can be constructed based on
1359 BIOS output or other requirements. See the memmap=nn@ss 1359 BIOS output or other requirements. See the memmap=nn@ss
1360 option description. 1360 option description.
1361 1361
1362 memmap=nn[KMG]@ss[KMG] 1362 memmap=nn[KMG]@ss[KMG]
1363 [KNL] Force usage of a specific region of memory 1363 [KNL] Force usage of a specific region of memory
1364 Region of memory to be used, from ss to ss+nn. 1364 Region of memory to be used, from ss to ss+nn.
1365 1365
1366 memmap=nn[KMG]#ss[KMG] 1366 memmap=nn[KMG]#ss[KMG]
1367 [KNL,ACPI] Mark specific memory as ACPI data. 1367 [KNL,ACPI] Mark specific memory as ACPI data.
1368 Region of memory to be used, from ss to ss+nn. 1368 Region of memory to be used, from ss to ss+nn.
1369 1369
1370 memmap=nn[KMG]$ss[KMG] 1370 memmap=nn[KMG]$ss[KMG]
1371 [KNL,ACPI] Mark specific memory as reserved. 1371 [KNL,ACPI] Mark specific memory as reserved.
1372 Region of memory to be used, from ss to ss+nn. 1372 Region of memory to be used, from ss to ss+nn.
1373 Example: Exclude memory from 0x18690000-0x1869ffff 1373 Example: Exclude memory from 0x18690000-0x1869ffff
1374 memmap=64K$0x18690000 1374 memmap=64K$0x18690000
1375 or 1375 or
1376 memmap=0x10000$0x18690000 1376 memmap=0x10000$0x18690000
1377 1377
1378 memory_corruption_check=0/1 [X86] 1378 memory_corruption_check=0/1 [X86]
1379 Some BIOSes seem to corrupt the first 64k of 1379 Some BIOSes seem to corrupt the first 64k of
1380 memory when doing things like suspend/resume. 1380 memory when doing things like suspend/resume.
1381 Setting this option will scan the memory 1381 Setting this option will scan the memory
1382 looking for corruption. Enabling this will 1382 looking for corruption. Enabling this will
1383 both detect corruption and prevent the kernel 1383 both detect corruption and prevent the kernel
1384 from using the memory being corrupted. 1384 from using the memory being corrupted.
1385 However, its intended as a diagnostic tool; if 1385 However, its intended as a diagnostic tool; if
1386 repeatable BIOS-originated corruption always 1386 repeatable BIOS-originated corruption always
1387 affects the same memory, you can use memmap= 1387 affects the same memory, you can use memmap=
1388 to prevent the kernel from using that memory. 1388 to prevent the kernel from using that memory.
1389 1389
1390 memory_corruption_check_size=size [X86] 1390 memory_corruption_check_size=size [X86]
1391 By default it checks for corruption in the low 1391 By default it checks for corruption in the low
1392 64k, making this memory unavailable for normal 1392 64k, making this memory unavailable for normal
1393 use. Use this parameter to scan for 1393 use. Use this parameter to scan for
1394 corruption in more or less memory. 1394 corruption in more or less memory.
1395 1395
1396 memory_corruption_check_period=seconds [X86] 1396 memory_corruption_check_period=seconds [X86]
1397 By default it checks for corruption every 60 1397 By default it checks for corruption every 60
1398 seconds. Use this parameter to check at some 1398 seconds. Use this parameter to check at some
1399 other rate. 0 disables periodic checking. 1399 other rate. 0 disables periodic checking.
1400 1400
1401 memtest= [KNL,X86] Enable memtest 1401 memtest= [KNL,X86] Enable memtest
1402 Format: <integer> 1402 Format: <integer>
1403 default : 0 <disable> 1403 default : 0 <disable>
1404 Specifies the number of memtest passes to be 1404 Specifies the number of memtest passes to be
1405 performed. Each pass selects another test 1405 performed. Each pass selects another test
1406 pattern from a given set of patterns. Memtest 1406 pattern from a given set of patterns. Memtest
1407 fills the memory with this pattern, validates 1407 fills the memory with this pattern, validates
1408 memory contents and reserves bad memory 1408 memory contents and reserves bad memory
1409 regions that are detected. 1409 regions that are detected.
1410 1410
1411 meye.*= [HW] Set MotionEye Camera parameters 1411 meye.*= [HW] Set MotionEye Camera parameters
1412 See Documentation/video4linux/meye.txt. 1412 See Documentation/video4linux/meye.txt.
1413 1413
1414 mfgpt_irq= [IA-32] Specify the IRQ to use for the 1414 mfgpt_irq= [IA-32] Specify the IRQ to use for the
1415 Multi-Function General Purpose Timers on AMD Geode 1415 Multi-Function General Purpose Timers on AMD Geode
1416 platforms. 1416 platforms.
1417 1417
1418 mfgptfix [X86-32] Fix MFGPT timers on AMD Geode platforms when 1418 mfgptfix [X86-32] Fix MFGPT timers on AMD Geode platforms when
1419 the BIOS has incorrectly applied a workaround. TinyBIOS 1419 the BIOS has incorrectly applied a workaround. TinyBIOS
1420 version 0.98 is known to be affected, 0.99 fixes the 1420 version 0.98 is known to be affected, 0.99 fixes the
1421 problem by letting the user disable the workaround. 1421 problem by letting the user disable the workaround.
1422 1422
1423 mga= [HW,DRM] 1423 mga= [HW,DRM]
1424 1424
1425 min_addr=nn[KMG] [KNL,BOOT,ia64] All physical memory below this 1425 min_addr=nn[KMG] [KNL,BOOT,ia64] All physical memory below this
1426 physical address is ignored. 1426 physical address is ignored.
1427 1427
1428 mini2440= [ARM,HW,KNL] 1428 mini2440= [ARM,HW,KNL]
1429 Format:[0..2][b][c][t] 1429 Format:[0..2][b][c][t]
1430 Default: "0tb" 1430 Default: "0tb"
1431 MINI2440 configuration specification: 1431 MINI2440 configuration specification:
1432 0 - The attached screen is the 3.5" TFT 1432 0 - The attached screen is the 3.5" TFT
1433 1 - The attached screen is the 7" TFT 1433 1 - The attached screen is the 7" TFT
1434 2 - The VGA Shield is attached (1024x768) 1434 2 - The VGA Shield is attached (1024x768)
1435 Leaving out the screen size parameter will not load 1435 Leaving out the screen size parameter will not load
1436 the TFT driver, and the framebuffer will be left 1436 the TFT driver, and the framebuffer will be left
1437 unconfigured. 1437 unconfigured.
1438 b - Enable backlight. The TFT backlight pin will be 1438 b - Enable backlight. The TFT backlight pin will be
1439 linked to the kernel VESA blanking code and a GPIO 1439 linked to the kernel VESA blanking code and a GPIO
1440 LED. This parameter is not necessary when using the 1440 LED. This parameter is not necessary when using the
1441 VGA shield. 1441 VGA shield.
1442 c - Enable the s3c camera interface. 1442 c - Enable the s3c camera interface.
1443 t - Reserved for enabling touchscreen support. The 1443 t - Reserved for enabling touchscreen support. The
1444 touchscreen support is not enabled in the mainstream 1444 touchscreen support is not enabled in the mainstream
1445 kernel as of 2.6.30, a preliminary port can be found 1445 kernel as of 2.6.30, a preliminary port can be found
1446 in the "bleeding edge" mini2440 support kernel at 1446 in the "bleeding edge" mini2440 support kernel at
1447 http://repo.or.cz/w/linux-2.6/mini2440.git 1447 http://repo.or.cz/w/linux-2.6/mini2440.git
1448 1448
1449 mminit_loglevel= 1449 mminit_loglevel=
1450 [KNL] When CONFIG_DEBUG_MEMORY_INIT is set, this 1450 [KNL] When CONFIG_DEBUG_MEMORY_INIT is set, this
1451 parameter allows control of the logging verbosity for 1451 parameter allows control of the logging verbosity for
1452 the additional memory initialisation checks. A value 1452 the additional memory initialisation checks. A value
1453 of 0 disables mminit logging and a level of 4 will 1453 of 0 disables mminit logging and a level of 4 will
1454 log everything. Information is printed at KERN_DEBUG 1454 log everything. Information is printed at KERN_DEBUG
1455 so loglevel=8 may also need to be specified. 1455 so loglevel=8 may also need to be specified.
1456 1456
1457 mousedev.tap_time= 1457 mousedev.tap_time=
1458 [MOUSE] Maximum time between finger touching and 1458 [MOUSE] Maximum time between finger touching and
1459 leaving touchpad surface for touch to be considered 1459 leaving touchpad surface for touch to be considered
1460 a tap and be reported as a left button click (for 1460 a tap and be reported as a left button click (for
1461 touchpads working in absolute mode only). 1461 touchpads working in absolute mode only).
1462 Format: <msecs> 1462 Format: <msecs>
1463 mousedev.xres= [MOUSE] Horizontal screen resolution, used for devices 1463 mousedev.xres= [MOUSE] Horizontal screen resolution, used for devices
1464 reporting absolute coordinates, such as tablets 1464 reporting absolute coordinates, such as tablets
1465 mousedev.yres= [MOUSE] Vertical screen resolution, used for devices 1465 mousedev.yres= [MOUSE] Vertical screen resolution, used for devices
1466 reporting absolute coordinates, such as tablets 1466 reporting absolute coordinates, such as tablets
1467 1467
1468 movablecore=nn[KMG] [KNL,X86,IA-64,PPC] This parameter 1468 movablecore=nn[KMG] [KNL,X86,IA-64,PPC] This parameter
1469 is similar to kernelcore except it specifies the 1469 is similar to kernelcore except it specifies the
1470 amount of memory used for migratable allocations. 1470 amount of memory used for migratable allocations.
1471 If both kernelcore and movablecore is specified, 1471 If both kernelcore and movablecore is specified,
1472 then kernelcore will be at *least* the specified 1472 then kernelcore will be at *least* the specified
1473 value but may be more. If movablecore on its own 1473 value but may be more. If movablecore on its own
1474 is specified, the administrator must be careful 1474 is specified, the administrator must be careful
1475 that the amount of memory usable for all allocations 1475 that the amount of memory usable for all allocations
1476 is not too small. 1476 is not too small.
1477 1477
1478 mpu401= [HW,OSS] 1478 mpu401= [HW,OSS]
1479 Format: <io>,<irq> 1479 Format: <io>,<irq>
1480 1480
1481 MTD_Partition= [MTD] 1481 MTD_Partition= [MTD]
1482 Format: <name>,<region-number>,<size>,<offset> 1482 Format: <name>,<region-number>,<size>,<offset>
1483 1483
1484 MTD_Region= [MTD] Format: 1484 MTD_Region= [MTD] Format:
1485 <name>,<region-number>[,<base>,<size>,<buswidth>,<altbuswidth>] 1485 <name>,<region-number>[,<base>,<size>,<buswidth>,<altbuswidth>]
1486 1486
1487 mtdparts= [MTD] 1487 mtdparts= [MTD]
1488 See drivers/mtd/cmdlinepart.c. 1488 See drivers/mtd/cmdlinepart.c.
1489 1489
1490 onenand.bdry= [HW,MTD] Flex-OneNAND Boundary Configuration 1490 onenand.bdry= [HW,MTD] Flex-OneNAND Boundary Configuration
1491 1491
1492 Format: [die0_boundary][,die0_lock][,die1_boundary][,die1_lock] 1492 Format: [die0_boundary][,die0_lock][,die1_boundary][,die1_lock]
1493 1493
1494 boundary - index of last SLC block on Flex-OneNAND. 1494 boundary - index of last SLC block on Flex-OneNAND.
1495 The remaining blocks are configured as MLC blocks. 1495 The remaining blocks are configured as MLC blocks.
1496 lock - Configure if Flex-OneNAND boundary should be locked. 1496 lock - Configure if Flex-OneNAND boundary should be locked.
1497 Once locked, the boundary cannot be changed. 1497 Once locked, the boundary cannot be changed.
1498 1 indicates lock status, 0 indicates unlock status. 1498 1 indicates lock status, 0 indicates unlock status.
1499 1499
1500 mtdset= [ARM] 1500 mtdset= [ARM]
1501 ARM/S3C2412 JIVE boot control 1501 ARM/S3C2412 JIVE boot control
1502 1502
1503 See arch/arm/mach-s3c2412/mach-jive.c 1503 See arch/arm/mach-s3c2412/mach-jive.c
1504 1504
1505 mtouchusb.raw_coordinates= 1505 mtouchusb.raw_coordinates=
1506 [HW] Make the MicroTouch USB driver use raw coordinates 1506 [HW] Make the MicroTouch USB driver use raw coordinates
1507 ('y', default) or cooked coordinates ('n') 1507 ('y', default) or cooked coordinates ('n')
1508 1508
1509 mtrr_chunk_size=nn[KMG] [X86] 1509 mtrr_chunk_size=nn[KMG] [X86]
1510 used for mtrr cleanup. It is largest continuous chunk 1510 used for mtrr cleanup. It is largest continuous chunk
1511 that could hold holes aka. UC entries. 1511 that could hold holes aka. UC entries.
1512 1512
1513 mtrr_gran_size=nn[KMG] [X86] 1513 mtrr_gran_size=nn[KMG] [X86]
1514 Used for mtrr cleanup. It is granularity of mtrr block. 1514 Used for mtrr cleanup. It is granularity of mtrr block.
1515 Default is 1. 1515 Default is 1.
1516 Large value could prevent small alignment from 1516 Large value could prevent small alignment from
1517 using up MTRRs. 1517 using up MTRRs.
1518 1518
1519 mtrr_spare_reg_nr=n [X86] 1519 mtrr_spare_reg_nr=n [X86]
1520 Format: <integer> 1520 Format: <integer>
1521 Range: 0,7 : spare reg number 1521 Range: 0,7 : spare reg number
1522 Default : 1 1522 Default : 1
1523 Used for mtrr cleanup. It is spare mtrr entries number. 1523 Used for mtrr cleanup. It is spare mtrr entries number.
1524 Set to 2 or more if your graphical card needs more. 1524 Set to 2 or more if your graphical card needs more.
1525 1525
1526 n2= [NET] SDL Inc. RISCom/N2 synchronous serial card 1526 n2= [NET] SDL Inc. RISCom/N2 synchronous serial card
1527 1527
1528 NCR_D700= [HW,SCSI] 1528 NCR_D700= [HW,SCSI]
1529 See header of drivers/scsi/NCR_D700.c. 1529 See header of drivers/scsi/NCR_D700.c.
1530 1530
1531 ncr5380= [HW,SCSI] 1531 ncr5380= [HW,SCSI]
1532 1532
1533 ncr53c400= [HW,SCSI] 1533 ncr53c400= [HW,SCSI]
1534 1534
1535 ncr53c400a= [HW,SCSI] 1535 ncr53c400a= [HW,SCSI]
1536 1536
1537 ncr53c406a= [HW,SCSI] 1537 ncr53c406a= [HW,SCSI]
1538 1538
1539 ncr53c8xx= [HW,SCSI] 1539 ncr53c8xx= [HW,SCSI]
1540 1540
1541 netdev= [NET] Network devices parameters 1541 netdev= [NET] Network devices parameters
1542 Format: <irq>,<io>,<mem_start>,<mem_end>,<name> 1542 Format: <irq>,<io>,<mem_start>,<mem_end>,<name>
1543 Note that mem_start is often overloaded to mean 1543 Note that mem_start is often overloaded to mean
1544 something different and driver-specific. 1544 something different and driver-specific.
1545 This usage is only documented in each driver source 1545 This usage is only documented in each driver source
1546 file if at all. 1546 file if at all.
1547 1547
1548 nf_conntrack.acct= 1548 nf_conntrack.acct=
1549 [NETFILTER] Enable connection tracking flow accounting 1549 [NETFILTER] Enable connection tracking flow accounting
1550 0 to disable accounting 1550 0 to disable accounting
1551 1 to enable accounting 1551 1 to enable accounting
1552 Default value depends on CONFIG_NF_CT_ACCT that is 1552 Default value depends on CONFIG_NF_CT_ACCT that is
1553 going to be removed in 2.6.29. 1553 going to be removed in 2.6.29.
1554 1554
1555 nfsaddrs= [NFS] 1555 nfsaddrs= [NFS]
1556 See Documentation/filesystems/nfsroot.txt. 1556 See Documentation/filesystems/nfsroot.txt.
1557 1557
1558 nfsroot= [NFS] nfs root filesystem for disk-less boxes. 1558 nfsroot= [NFS] nfs root filesystem for disk-less boxes.
1559 See Documentation/filesystems/nfsroot.txt. 1559 See Documentation/filesystems/nfsroot.txt.
1560 1560
1561 nfs.callback_tcpport= 1561 nfs.callback_tcpport=
1562 [NFS] set the TCP port on which the NFSv4 callback 1562 [NFS] set the TCP port on which the NFSv4 callback
1563 channel should listen. 1563 channel should listen.
1564 1564
1565 nfs.cache_getent= 1565 nfs.cache_getent=
1566 [NFS] sets the pathname to the program which is used 1566 [NFS] sets the pathname to the program which is used
1567 to update the NFS client cache entries. 1567 to update the NFS client cache entries.
1568 1568
1569 nfs.cache_getent_timeout= 1569 nfs.cache_getent_timeout=
1570 [NFS] sets the timeout after which an attempt to 1570 [NFS] sets the timeout after which an attempt to
1571 update a cache entry is deemed to have failed. 1571 update a cache entry is deemed to have failed.
1572 1572
1573 nfs.idmap_cache_timeout= 1573 nfs.idmap_cache_timeout=
1574 [NFS] set the maximum lifetime for idmapper cache 1574 [NFS] set the maximum lifetime for idmapper cache
1575 entries. 1575 entries.
1576 1576
1577 nfs.enable_ino64= 1577 nfs.enable_ino64=
1578 [NFS] enable 64-bit inode numbers. 1578 [NFS] enable 64-bit inode numbers.
1579 If zero, the NFS client will fake up a 32-bit inode 1579 If zero, the NFS client will fake up a 32-bit inode
1580 number for the readdir() and stat() syscalls instead 1580 number for the readdir() and stat() syscalls instead
1581 of returning the full 64-bit number. 1581 of returning the full 64-bit number.
1582 The default is to return 64-bit inode numbers. 1582 The default is to return 64-bit inode numbers.
1583 1583
1584 nmi_debug= [KNL,AVR32,SH] Specify one or more actions to take 1584 nmi_debug= [KNL,AVR32,SH] Specify one or more actions to take
1585 when a NMI is triggered. 1585 when a NMI is triggered.
1586 Format: [state][,regs][,debounce][,die] 1586 Format: [state][,regs][,debounce][,die]
1587 1587
1588 nmi_watchdog= [KNL,BUGS=X86] Debugging features for SMP kernels 1588 nmi_watchdog= [KNL,BUGS=X86] Debugging features for SMP kernels
1589 Format: [panic,][num] 1589 Format: [panic,][num]
1590 Valid num: 0,1,2 1590 Valid num: 0,1,2
1591 0 - turn nmi_watchdog off 1591 0 - turn nmi_watchdog off
1592 1 - use the IO-APIC timer for the NMI watchdog 1592 1 - use the IO-APIC timer for the NMI watchdog
1593 2 - use the local APIC for the NMI watchdog using 1593 2 - use the local APIC for the NMI watchdog using
1594 a performance counter. Note: This will use one 1594 a performance counter. Note: This will use one
1595 performance counter and the local APIC's performance 1595 performance counter and the local APIC's performance
1596 vector. 1596 vector.
1597 When panic is specified, panic when an NMI watchdog 1597 When panic is specified, panic when an NMI watchdog
1598 timeout occurs. 1598 timeout occurs.
1599 This is useful when you use a panic=... timeout and 1599 This is useful when you use a panic=... timeout and
1600 need the box quickly up again. 1600 need the box quickly up again.
1601 Instead of 1 and 2 it is possible to use the following 1601 Instead of 1 and 2 it is possible to use the following
1602 symbolic names: lapic and ioapic 1602 symbolic names: lapic and ioapic
1603 Example: nmi_watchdog=2 or nmi_watchdog=panic,lapic 1603 Example: nmi_watchdog=2 or nmi_watchdog=panic,lapic
1604 1604
1605 netpoll.carrier_timeout= 1605 netpoll.carrier_timeout=
1606 [NET] Specifies amount of time (in seconds) that 1606 [NET] Specifies amount of time (in seconds) that
1607 netpoll should wait for a carrier. By default netpoll 1607 netpoll should wait for a carrier. By default netpoll
1608 waits 4 seconds. 1608 waits 4 seconds.
1609 1609
1610 no387 [BUGS=X86-32] Tells the kernel to use the 387 maths 1610 no387 [BUGS=X86-32] Tells the kernel to use the 387 maths
1611 emulation library even if a 387 maths coprocessor 1611 emulation library even if a 387 maths coprocessor
1612 is present. 1612 is present.
1613 1613
1614 no_console_suspend 1614 no_console_suspend
1615 [HW] Never suspend the console 1615 [HW] Never suspend the console
1616 Disable suspending of consoles during suspend and 1616 Disable suspending of consoles during suspend and
1617 hibernate operations. Once disabled, debugging 1617 hibernate operations. Once disabled, debugging
1618 messages can reach various consoles while the rest 1618 messages can reach various consoles while the rest
1619 of the system is being put to sleep (ie, while 1619 of the system is being put to sleep (ie, while
1620 debugging driver suspend/resume hooks). This may 1620 debugging driver suspend/resume hooks). This may
1621 not work reliably with all consoles, but is known 1621 not work reliably with all consoles, but is known
1622 to work with serial and VGA consoles. 1622 to work with serial and VGA consoles.
1623 1623
1624 noaliencache [MM, NUMA, SLAB] Disables the allocation of alien 1624 noaliencache [MM, NUMA, SLAB] Disables the allocation of alien
1625 caches in the slab allocator. Saves per-node memory, 1625 caches in the slab allocator. Saves per-node memory,
1626 but will impact performance. 1626 but will impact performance.
1627 1627
1628 noalign [KNL,ARM] 1628 noalign [KNL,ARM]
1629 1629
1630 noapic [SMP,APIC] Tells the kernel to not make use of any 1630 noapic [SMP,APIC] Tells the kernel to not make use of any
1631 IOAPICs that may be present in the system. 1631 IOAPICs that may be present in the system.
1632 1632
1633 nobats [PPC] Do not use BATs for mapping kernel lowmem 1633 nobats [PPC] Do not use BATs for mapping kernel lowmem
1634 on "Classic" PPC cores. 1634 on "Classic" PPC cores.
1635 1635
1636 nocache [ARM] 1636 nocache [ARM]
1637 1637
1638 noclflush [BUGS=X86] Don't use the CLFLUSH instruction 1638 noclflush [BUGS=X86] Don't use the CLFLUSH instruction
1639 1639
1640 nodelayacct [KNL] Disable per-task delay accounting 1640 nodelayacct [KNL] Disable per-task delay accounting
1641 1641
1642 nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects. 1642 nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects.
1643 1643
1644 nodsp [SH] Disable hardware DSP at boot time. 1644 nodsp [SH] Disable hardware DSP at boot time.
1645 1645
1646 noefi [X86] Disable EFI runtime services support. 1646 noefi [X86] Disable EFI runtime services support.
1647 1647
1648 noexec [IA-64] 1648 noexec [IA-64]
1649 1649
1650 noexec [X86] 1650 noexec [X86]
1651 On X86-32 available only on PAE configured kernels. 1651 On X86-32 available only on PAE configured kernels.
1652 noexec=on: enable non-executable mappings (default) 1652 noexec=on: enable non-executable mappings (default)
1653 noexec=off: disable non-executable mappings 1653 noexec=off: disable non-executable mappings
1654 1654
1655 noexec32 [X86-64] 1655 noexec32 [X86-64]
1656 This affects only 32-bit executables. 1656 This affects only 32-bit executables.
1657 noexec32=on: enable non-executable mappings (default) 1657 noexec32=on: enable non-executable mappings (default)
1658 read doesn't imply executable mappings 1658 read doesn't imply executable mappings
1659 noexec32=off: disable non-executable mappings 1659 noexec32=off: disable non-executable mappings
1660 read implies executable mappings 1660 read implies executable mappings
1661 1661
1662 nofpu [SH] Disable hardware FPU at boot time. 1662 nofpu [SH] Disable hardware FPU at boot time.
1663 1663
1664 nofxsr [BUGS=X86-32] Disables x86 floating point extended 1664 nofxsr [BUGS=X86-32] Disables x86 floating point extended
1665 register save and restore. The kernel will only save 1665 register save and restore. The kernel will only save
1666 legacy floating-point registers on task switch. 1666 legacy floating-point registers on task switch.
1667 1667
1668 noxsave [BUGS=X86] Disables x86 extended register state save 1668 noxsave [BUGS=X86] Disables x86 extended register state save
1669 and restore using xsave. The kernel will fallback to 1669 and restore using xsave. The kernel will fallback to
1670 enabling legacy floating-point and sse state. 1670 enabling legacy floating-point and sse state.
1671 1671
1672 nohlt [BUGS=ARM,SH] Tells the kernel that the sleep(SH) or 1672 nohlt [BUGS=ARM,SH] Tells the kernel that the sleep(SH) or
1673 wfi(ARM) instruction doesn't work correctly and not to 1673 wfi(ARM) instruction doesn't work correctly and not to
1674 use it. This is also useful when using JTAG debugger. 1674 use it. This is also useful when using JTAG debugger.
1675 1675
1676 no-hlt [BUGS=X86-32] Tells the kernel that the hlt 1676 no-hlt [BUGS=X86-32] Tells the kernel that the hlt
1677 instruction doesn't work correctly and not to 1677 instruction doesn't work correctly and not to
1678 use it. 1678 use it.
1679 1679
1680 no_file_caps Tells the kernel not to honor file capabilities. The 1680 no_file_caps Tells the kernel not to honor file capabilities. The
1681 only way then for a file to be executed with privilege 1681 only way then for a file to be executed with privilege
1682 is to be setuid root or executed by root. 1682 is to be setuid root or executed by root.
1683 1683
1684 nohalt [IA-64] Tells the kernel not to use the power saving 1684 nohalt [IA-64] Tells the kernel not to use the power saving
1685 function PAL_HALT_LIGHT when idle. This increases 1685 function PAL_HALT_LIGHT when idle. This increases
1686 power-consumption. On the positive side, it reduces 1686 power-consumption. On the positive side, it reduces
1687 interrupt wake-up latency, which may improve performance 1687 interrupt wake-up latency, which may improve performance
1688 in certain environments such as networked servers or 1688 in certain environments such as networked servers or
1689 real-time systems. 1689 real-time systems.
1690 1690
1691 nohz= [KNL] Boottime enable/disable dynamic ticks 1691 nohz= [KNL] Boottime enable/disable dynamic ticks
1692 Valid arguments: on, off 1692 Valid arguments: on, off
1693 Default: on 1693 Default: on
1694 1694
1695 noiotrap [SH] Disables trapped I/O port accesses. 1695 noiotrap [SH] Disables trapped I/O port accesses.
1696 1696
1697 noirqdebug [X86-32] Disables the code which attempts to detect and 1697 noirqdebug [X86-32] Disables the code which attempts to detect and
1698 disable unhandled interrupt sources. 1698 disable unhandled interrupt sources.
1699 1699
1700 no_timer_check [X86,APIC] Disables the code which tests for 1700 no_timer_check [X86,APIC] Disables the code which tests for
1701 broken timer IRQ sources. 1701 broken timer IRQ sources.
1702 1702
1703 noisapnp [ISAPNP] Disables ISA PnP code. 1703 noisapnp [ISAPNP] Disables ISA PnP code.
1704 1704
1705 noinitrd [RAM] Tells the kernel not to load any configured 1705 noinitrd [RAM] Tells the kernel not to load any configured
1706 initial RAM disk. 1706 initial RAM disk.
1707 1707
1708 nointremap [X86-64, Intel-IOMMU] Do not enable interrupt 1708 nointremap [X86-64, Intel-IOMMU] Do not enable interrupt
1709 remapping. 1709 remapping.
1710 1710
1711 nointroute [IA-64] 1711 nointroute [IA-64]
1712 1712
1713 nojitter [IA64] Disables jitter checking for ITC timers. 1713 nojitter [IA64] Disables jitter checking for ITC timers.
1714 1714
1715 nolapic [X86-32,APIC] Do not enable or use the local APIC. 1715 nolapic [X86-32,APIC] Do not enable or use the local APIC.
1716 1716
1717 nolapic_timer [X86-32,APIC] Do not use the local APIC timer. 1717 nolapic_timer [X86-32,APIC] Do not use the local APIC timer.
1718 1718
1719 noltlbs [PPC] Do not use large page/tlb entries for kernel 1719 noltlbs [PPC] Do not use large page/tlb entries for kernel
1720 lowmem mapping on PPC40x. 1720 lowmem mapping on PPC40x.
1721 1721
1722 nomca [IA-64] Disable machine check abort handling 1722 nomca [IA-64] Disable machine check abort handling
1723 1723
1724 nomce [X86-32] Machine Check Exception 1724 nomce [X86-32] Machine Check Exception
1725 1725
1726 nomfgpt [X86-32] Disable Multi-Function General Purpose 1726 nomfgpt [X86-32] Disable Multi-Function General Purpose
1727 Timer usage (for AMD Geode machines). 1727 Timer usage (for AMD Geode machines).
1728 1728
1729 norandmaps Don't use address space randomization. Equivalent to 1729 norandmaps Don't use address space randomization. Equivalent to
1730 echo 0 > /proc/sys/kernel/randomize_va_space 1730 echo 0 > /proc/sys/kernel/randomize_va_space
1731 1731
1732 noreplace-paravirt [X86-32,PV_OPS] Don't patch paravirt_ops 1732 noreplace-paravirt [X86-32,PV_OPS] Don't patch paravirt_ops
1733 1733
1734 noreplace-smp [X86-32,SMP] Don't replace SMP instructions 1734 noreplace-smp [X86-32,SMP] Don't replace SMP instructions
1735 with UP alternatives 1735 with UP alternatives
1736 1736
1737 noresidual [PPC] Don't use residual data on PReP machines. 1737 noresidual [PPC] Don't use residual data on PReP machines.
1738 1738
1739 noresume [SWSUSP] Disables resume and restores original swap 1739 noresume [SWSUSP] Disables resume and restores original swap
1740 space. 1740 space.
1741 1741
1742 no-scroll [VGA] Disables scrollback. 1742 no-scroll [VGA] Disables scrollback.
1743 This is required for the Braillex ib80-piezo Braille 1743 This is required for the Braillex ib80-piezo Braille
1744 reader made by F.H. Papenmeier (Germany). 1744 reader made by F.H. Papenmeier (Germany).
1745 1745
1746 nosbagart [IA-64] 1746 nosbagart [IA-64]
1747 1747
1748 nosep [BUGS=X86-32] Disables x86 SYSENTER/SYSEXIT support. 1748 nosep [BUGS=X86-32] Disables x86 SYSENTER/SYSEXIT support.
1749 1749
1750 nosmp [SMP] Tells an SMP kernel to act as a UP kernel, 1750 nosmp [SMP] Tells an SMP kernel to act as a UP kernel,
1751 and disable the IO APIC. legacy for "maxcpus=0". 1751 and disable the IO APIC. legacy for "maxcpus=0".
1752 1752
1753 nosoftlockup [KNL] Disable the soft-lockup detector. 1753 nosoftlockup [KNL] Disable the soft-lockup detector.
1754 1754
1755 noswapaccount [KNL] Disable accounting of swap in memory resource 1755 noswapaccount [KNL] Disable accounting of swap in memory resource
1756 controller. (See Documentation/cgroups/memory.txt) 1756 controller. (See Documentation/cgroups/memory.txt)
1757 1757
1758 nosync [HW,M68K] Disables sync negotiation for all devices. 1758 nosync [HW,M68K] Disables sync negotiation for all devices.
1759 1759
1760 notsc [BUGS=X86-32] Disable Time Stamp Counter 1760 notsc [BUGS=X86-32] Disable Time Stamp Counter
1761 1761
1762 nousb [USB] Disable the USB subsystem 1762 nousb [USB] Disable the USB subsystem
1763 1763
1764 nowb [ARM] 1764 nowb [ARM]
1765 1765
1766 nox2apic [X86-64,APIC] Do not enable x2APIC mode. 1766 nox2apic [X86-64,APIC] Do not enable x2APIC mode.
1767 1767
1768 nptcg= [IA64] Override max number of concurrent global TLB 1768 nptcg= [IA64] Override max number of concurrent global TLB
1769 purges which is reported from either PAL_VM_SUMMARY or 1769 purges which is reported from either PAL_VM_SUMMARY or
1770 SAL PALO. 1770 SAL PALO.
1771 1771
1772 nr_uarts= [SERIAL] maximum number of UARTs to be registered. 1772 nr_uarts= [SERIAL] maximum number of UARTs to be registered.
1773 1773
1774 numa_zonelist_order= [KNL, BOOT] Select zonelist order for NUMA. 1774 numa_zonelist_order= [KNL, BOOT] Select zonelist order for NUMA.
1775 one of ['zone', 'node', 'default'] can be specified 1775 one of ['zone', 'node', 'default'] can be specified
1776 This can be set from sysctl after boot. 1776 This can be set from sysctl after boot.
1777 See Documentation/sysctl/vm.txt for details. 1777 See Documentation/sysctl/vm.txt for details.
1778 1778
1779 ohci1394_dma=early [HW] enable debugging via the ohci1394 driver. 1779 ohci1394_dma=early [HW] enable debugging via the ohci1394 driver.
1780 See Documentation/debugging-via-ohci1394.txt for more 1780 See Documentation/debugging-via-ohci1394.txt for more
1781 info. 1781 info.
1782 1782
1783 olpc_ec_timeout= [OLPC] ms delay when issuing EC commands 1783 olpc_ec_timeout= [OLPC] ms delay when issuing EC commands
1784 Rather than timing out after 20 ms if an EC 1784 Rather than timing out after 20 ms if an EC
1785 command is not properly ACKed, override the length 1785 command is not properly ACKed, override the length
1786 of the timeout. We have interrupts disabled while 1786 of the timeout. We have interrupts disabled while
1787 waiting for the ACK, so if this is set too high 1787 waiting for the ACK, so if this is set too high
1788 interrupts *may* be lost! 1788 interrupts *may* be lost!
1789 1789
1790 omap_mux= [OMAP] Override bootloader pin multiplexing. 1790 omap_mux= [OMAP] Override bootloader pin multiplexing.
1791 Format: <mux_mode0.mode_name=value>... 1791 Format: <mux_mode0.mode_name=value>...
1792 For example, to override I2C bus2: 1792 For example, to override I2C bus2:
1793 omap_mux=i2c2_scl.i2c2_scl=0x100,i2c2_sda.i2c2_sda=0x100 1793 omap_mux=i2c2_scl.i2c2_scl=0x100,i2c2_sda.i2c2_sda=0x100
1794 1794
1795 opl3= [HW,OSS] 1795 opl3= [HW,OSS]
1796 Format: <io> 1796 Format: <io>
1797 1797
1798 oprofile.timer= [HW] 1798 oprofile.timer= [HW]
1799 Use timer interrupt instead of performance counters 1799 Use timer interrupt instead of performance counters
1800 1800
1801 oprofile.cpu_type= Force an oprofile cpu type 1801 oprofile.cpu_type= Force an oprofile cpu type
1802 This might be useful if you have an older oprofile 1802 This might be useful if you have an older oprofile
1803 userland or if you want common events. 1803 userland or if you want common events.
1804 Format: { arch_perfmon } 1804 Format: { arch_perfmon }
1805 arch_perfmon: [X86] Force use of architectural 1805 arch_perfmon: [X86] Force use of architectural
1806 perfmon on Intel CPUs instead of the 1806 perfmon on Intel CPUs instead of the
1807 CPU specific event set. 1807 CPU specific event set.
1808 1808
1809 osst= [HW,SCSI] SCSI Tape Driver 1809 osst= [HW,SCSI] SCSI Tape Driver
1810 Format: <buffer_size>,<write_threshold> 1810 Format: <buffer_size>,<write_threshold>
1811 See also Documentation/scsi/st.txt. 1811 See also Documentation/scsi/st.txt.
1812 1812
1813 panic= [KNL] Kernel behaviour on panic 1813 panic= [KNL] Kernel behaviour on panic
1814 Format: <timeout> 1814 Format: <timeout>
1815 1815
1816 parkbd.port= [HW] Parallel port number the keyboard adapter is 1816 parkbd.port= [HW] Parallel port number the keyboard adapter is
1817 connected to, default is 0. 1817 connected to, default is 0.
1818 Format: <parport#> 1818 Format: <parport#>
1819 parkbd.mode= [HW] Parallel port keyboard adapter mode of operation, 1819 parkbd.mode= [HW] Parallel port keyboard adapter mode of operation,
1820 0 for XT, 1 for AT (default is AT). 1820 0 for XT, 1 for AT (default is AT).
1821 Format: <mode> 1821 Format: <mode>
1822 1822
1823 parport= [HW,PPT] Specify parallel ports. 0 disables. 1823 parport= [HW,PPT] Specify parallel ports. 0 disables.
1824 Format: { 0 | auto | 0xBBB[,IRQ[,DMA]] } 1824 Format: { 0 | auto | 0xBBB[,IRQ[,DMA]] }
1825 Use 'auto' to force the driver to use any 1825 Use 'auto' to force the driver to use any
1826 IRQ/DMA settings detected (the default is to 1826 IRQ/DMA settings detected (the default is to
1827 ignore detected IRQ/DMA settings because of 1827 ignore detected IRQ/DMA settings because of
1828 possible conflicts). You can specify the base 1828 possible conflicts). You can specify the base
1829 address, IRQ, and DMA settings; IRQ and DMA 1829 address, IRQ, and DMA settings; IRQ and DMA
1830 should be numbers, or 'auto' (for using detected 1830 should be numbers, or 'auto' (for using detected
1831 settings on that particular port), or 'nofifo' 1831 settings on that particular port), or 'nofifo'
1832 (to avoid using a FIFO even if it is detected). 1832 (to avoid using a FIFO even if it is detected).
1833 Parallel ports are assigned in the order they 1833 Parallel ports are assigned in the order they
1834 are specified on the command line, starting 1834 are specified on the command line, starting
1835 with parport0. 1835 with parport0.
1836 1836
1837 parport_init_mode= [HW,PPT] 1837 parport_init_mode= [HW,PPT]
1838 Configure VIA parallel port to operate in 1838 Configure VIA parallel port to operate in
1839 a specific mode. This is necessary on Pegasos 1839 a specific mode. This is necessary on Pegasos
1840 computer where firmware has no options for setting 1840 computer where firmware has no options for setting
1841 up parallel port mode and sets it to spp. 1841 up parallel port mode and sets it to spp.
1842 Currently this function knows 686a and 8231 chips. 1842 Currently this function knows 686a and 8231 chips.
1843 Format: [spp|ps2|epp|ecp|ecpepp] 1843 Format: [spp|ps2|epp|ecp|ecpepp]
1844 1844
1845 pas2= [HW,OSS] Format: 1845 pas2= [HW,OSS] Format:
1846 <io>,<irq>,<dma>,<dma16>,<sb_io>,<sb_irq>,<sb_dma>,<sb_dma16> 1846 <io>,<irq>,<dma>,<dma16>,<sb_io>,<sb_irq>,<sb_dma>,<sb_dma16>
1847 1847
1848 pas16= [HW,SCSI] 1848 pas16= [HW,SCSI]
1849 See header of drivers/scsi/pas16.c. 1849 See header of drivers/scsi/pas16.c.
1850 1850
1851 pause_on_oops= 1851 pause_on_oops=
1852 Halt all CPUs after the first oops has been printed for 1852 Halt all CPUs after the first oops has been printed for
1853 the specified number of seconds. This is to be used if 1853 the specified number of seconds. This is to be used if
1854 your oopses keep scrolling off the screen. 1854 your oopses keep scrolling off the screen.
1855 1855
1856 pcbit= [HW,ISDN] 1856 pcbit= [HW,ISDN]
1857 1857
1858 pcd. [PARIDE] 1858 pcd. [PARIDE]
1859 See header of drivers/block/paride/pcd.c. 1859 See header of drivers/block/paride/pcd.c.
1860 See also Documentation/blockdev/paride.txt. 1860 See also Documentation/blockdev/paride.txt.
1861 1861
1862 pci=option[,option...] [PCI] various PCI subsystem options: 1862 pci=option[,option...] [PCI] various PCI subsystem options:
1863 earlydump [X86] dump PCI config space before the kernel 1863 earlydump [X86] dump PCI config space before the kernel
1864 changes anything 1864 changes anything
1865 off [X86] don't probe for the PCI bus 1865 off [X86] don't probe for the PCI bus
1866 bios [X86-32] force use of PCI BIOS, don't access 1866 bios [X86-32] force use of PCI BIOS, don't access
1867 the hardware directly. Use this if your machine 1867 the hardware directly. Use this if your machine
1868 has a non-standard PCI host bridge. 1868 has a non-standard PCI host bridge.
1869 nobios [X86-32] disallow use of PCI BIOS, only direct 1869 nobios [X86-32] disallow use of PCI BIOS, only direct
1870 hardware access methods are allowed. Use this 1870 hardware access methods are allowed. Use this
1871 if you experience crashes upon bootup and you 1871 if you experience crashes upon bootup and you
1872 suspect they are caused by the BIOS. 1872 suspect they are caused by the BIOS.
1873 conf1 [X86] Force use of PCI Configuration 1873 conf1 [X86] Force use of PCI Configuration
1874 Mechanism 1. 1874 Mechanism 1.
1875 conf2 [X86] Force use of PCI Configuration 1875 conf2 [X86] Force use of PCI Configuration
1876 Mechanism 2. 1876 Mechanism 2.
1877 noaer [PCIE] If the PCIEAER kernel config parameter is 1877 noaer [PCIE] If the PCIEAER kernel config parameter is
1878 enabled, this kernel boot option can be used to 1878 enabled, this kernel boot option can be used to
1879 disable the use of PCIE advanced error reporting. 1879 disable the use of PCIE advanced error reporting.
1880 nodomains [PCI] Disable support for multiple PCI 1880 nodomains [PCI] Disable support for multiple PCI
1881 root domains (aka PCI segments, in ACPI-speak). 1881 root domains (aka PCI segments, in ACPI-speak).
1882 nommconf [X86] Disable use of MMCONFIG for PCI 1882 nommconf [X86] Disable use of MMCONFIG for PCI
1883 Configuration 1883 Configuration
1884 check_enable_amd_mmconf [X86] check for and enable 1884 check_enable_amd_mmconf [X86] check for and enable
1885 properly configured MMIO access to PCI 1885 properly configured MMIO access to PCI
1886 config space on AMD family 10h CPU 1886 config space on AMD family 10h CPU
1887 nomsi [MSI] If the PCI_MSI kernel config parameter is 1887 nomsi [MSI] If the PCI_MSI kernel config parameter is
1888 enabled, this kernel boot option can be used to 1888 enabled, this kernel boot option can be used to
1889 disable the use of MSI interrupts system-wide. 1889 disable the use of MSI interrupts system-wide.
1890 noioapicquirk [APIC] Disable all boot interrupt quirks. 1890 noioapicquirk [APIC] Disable all boot interrupt quirks.
1891 Safety option to keep boot IRQs enabled. This 1891 Safety option to keep boot IRQs enabled. This
1892 should never be necessary. 1892 should never be necessary.
1893 ioapicreroute [APIC] Enable rerouting of boot IRQs to the 1893 ioapicreroute [APIC] Enable rerouting of boot IRQs to the
1894 primary IO-APIC for bridges that cannot disable 1894 primary IO-APIC for bridges that cannot disable
1895 boot IRQs. This fixes a source of spurious IRQs 1895 boot IRQs. This fixes a source of spurious IRQs
1896 when the system masks IRQs. 1896 when the system masks IRQs.
1897 noioapicreroute [APIC] Disable workaround that uses the 1897 noioapicreroute [APIC] Disable workaround that uses the
1898 boot IRQ equivalent of an IRQ that connects to 1898 boot IRQ equivalent of an IRQ that connects to
1899 a chipset where boot IRQs cannot be disabled. 1899 a chipset where boot IRQs cannot be disabled.
1900 The opposite of ioapicreroute. 1900 The opposite of ioapicreroute.
1901 biosirq [X86-32] Use PCI BIOS calls to get the interrupt 1901 biosirq [X86-32] Use PCI BIOS calls to get the interrupt
1902 routing table. These calls are known to be buggy 1902 routing table. These calls are known to be buggy
1903 on several machines and they hang the machine 1903 on several machines and they hang the machine
1904 when used, but on other computers it's the only 1904 when used, but on other computers it's the only
1905 way to get the interrupt routing table. Try 1905 way to get the interrupt routing table. Try
1906 this option if the kernel is unable to allocate 1906 this option if the kernel is unable to allocate
1907 IRQs or discover secondary PCI buses on your 1907 IRQs or discover secondary PCI buses on your
1908 motherboard. 1908 motherboard.
1909 rom [X86] Assign address space to expansion ROMs. 1909 rom [X86] Assign address space to expansion ROMs.
1910 Use with caution as certain devices share 1910 Use with caution as certain devices share
1911 address decoders between ROMs and other 1911 address decoders between ROMs and other
1912 resources. 1912 resources.
1913 norom [X86] Do not assign address space to 1913 norom [X86] Do not assign address space to
1914 expansion ROMs that do not already have 1914 expansion ROMs that do not already have
1915 BIOS assigned address ranges. 1915 BIOS assigned address ranges.
1916 irqmask=0xMMMM [X86] Set a bit mask of IRQs allowed to be 1916 irqmask=0xMMMM [X86] Set a bit mask of IRQs allowed to be
1917 assigned automatically to PCI devices. You can 1917 assigned automatically to PCI devices. You can
1918 make the kernel exclude IRQs of your ISA cards 1918 make the kernel exclude IRQs of your ISA cards
1919 this way. 1919 this way.
1920 pirqaddr=0xAAAAA [X86] Specify the physical address 1920 pirqaddr=0xAAAAA [X86] Specify the physical address
1921 of the PIRQ table (normally generated 1921 of the PIRQ table (normally generated
1922 by the BIOS) if it is outside the 1922 by the BIOS) if it is outside the
1923 F0000h-100000h range. 1923 F0000h-100000h range.
1924 lastbus=N [X86] Scan all buses thru bus #N. Can be 1924 lastbus=N [X86] Scan all buses thru bus #N. Can be
1925 useful if the kernel is unable to find your 1925 useful if the kernel is unable to find your
1926 secondary buses and you want to tell it 1926 secondary buses and you want to tell it
1927 explicitly which ones they are. 1927 explicitly which ones they are.
1928 assign-busses [X86] Always assign all PCI bus 1928 assign-busses [X86] Always assign all PCI bus
1929 numbers ourselves, overriding 1929 numbers ourselves, overriding
1930 whatever the firmware may have done. 1930 whatever the firmware may have done.
1931 usepirqmask [X86] Honor the possible IRQ mask stored 1931 usepirqmask [X86] Honor the possible IRQ mask stored
1932 in the BIOS $PIR table. This is needed on 1932 in the BIOS $PIR table. This is needed on
1933 some systems with broken BIOSes, notably 1933 some systems with broken BIOSes, notably
1934 some HP Pavilion N5400 and Omnibook XE3 1934 some HP Pavilion N5400 and Omnibook XE3
1935 notebooks. This will have no effect if ACPI 1935 notebooks. This will have no effect if ACPI
1936 IRQ routing is enabled. 1936 IRQ routing is enabled.
1937 noacpi [X86] Do not use ACPI for IRQ routing 1937 noacpi [X86] Do not use ACPI for IRQ routing
1938 or for PCI scanning. 1938 or for PCI scanning.
1939 use_crs [X86] Use _CRS for PCI resource 1939 use_crs [X86] Use _CRS for PCI resource
1940 allocation. 1940 allocation.
1941 routeirq Do IRQ routing for all PCI devices. 1941 routeirq Do IRQ routing for all PCI devices.
1942 This is normally done in pci_enable_device(), 1942 This is normally done in pci_enable_device(),
1943 so this option is a temporary workaround 1943 so this option is a temporary workaround
1944 for broken drivers that don't call it. 1944 for broken drivers that don't call it.
1945 skip_isa_align [X86] do not align io start addr, so can 1945 skip_isa_align [X86] do not align io start addr, so can
1946 handle more pci cards 1946 handle more pci cards
1947 firmware [ARM] Do not re-enumerate the bus but instead 1947 firmware [ARM] Do not re-enumerate the bus but instead
1948 just use the configuration from the 1948 just use the configuration from the
1949 bootloader. This is currently used on 1949 bootloader. This is currently used on
1950 IXP2000 systems where the bus has to be 1950 IXP2000 systems where the bus has to be
1951 configured a certain way for adjunct CPUs. 1951 configured a certain way for adjunct CPUs.
1952 noearly [X86] Don't do any early type 1 scanning. 1952 noearly [X86] Don't do any early type 1 scanning.
1953 This might help on some broken boards which 1953 This might help on some broken boards which
1954 machine check when some devices' config space 1954 machine check when some devices' config space
1955 is read. But various workarounds are disabled 1955 is read. But various workarounds are disabled
1956 and some IOMMU drivers will not work. 1956 and some IOMMU drivers will not work.
1957 bfsort Sort PCI devices into breadth-first order. 1957 bfsort Sort PCI devices into breadth-first order.
1958 This sorting is done to get a device 1958 This sorting is done to get a device
1959 order compatible with older (<= 2.4) kernels. 1959 order compatible with older (<= 2.4) kernels.
1960 nobfsort Don't sort PCI devices into breadth-first order. 1960 nobfsort Don't sort PCI devices into breadth-first order.
1961 cbiosize=nn[KMG] The fixed amount of bus space which is 1961 cbiosize=nn[KMG] The fixed amount of bus space which is
1962 reserved for the CardBus bridge's IO window. 1962 reserved for the CardBus bridge's IO window.
1963 The default value is 256 bytes. 1963 The default value is 256 bytes.
1964 cbmemsize=nn[KMG] The fixed amount of bus space which is 1964 cbmemsize=nn[KMG] The fixed amount of bus space which is
1965 reserved for the CardBus bridge's memory 1965 reserved for the CardBus bridge's memory
1966 window. The default value is 64 megabytes. 1966 window. The default value is 64 megabytes.
1967 resource_alignment= 1967 resource_alignment=
1968 Format: 1968 Format:
1969 [<order of align>@][<domain>:]<bus>:<slot>.<func>[; ...] 1969 [<order of align>@][<domain>:]<bus>:<slot>.<func>[; ...]
1970 Specifies alignment and device to reassign 1970 Specifies alignment and device to reassign
1971 aligned memory resources. 1971 aligned memory resources.
1972 If <order of align> is not specified, 1972 If <order of align> is not specified,
1973 PAGE_SIZE is used as alignment. 1973 PAGE_SIZE is used as alignment.
1974 PCI-PCI bridge can be specified, if resource 1974 PCI-PCI bridge can be specified, if resource
1975 windows need to be expanded. 1975 windows need to be expanded.
1976 ecrc= Enable/disable PCIe ECRC (transaction layer 1976 ecrc= Enable/disable PCIe ECRC (transaction layer
1977 end-to-end CRC checking). 1977 end-to-end CRC checking).
1978 bios: Use BIOS/firmware settings. This is the 1978 bios: Use BIOS/firmware settings. This is the
1979 the default. 1979 the default.
1980 off: Turn ECRC off 1980 off: Turn ECRC off
1981 on: Turn ECRC on. 1981 on: Turn ECRC on.
1982 1982
1983 pcie_aspm= [PCIE] Forcibly enable or disable PCIe Active State Power 1983 pcie_aspm= [PCIE] Forcibly enable or disable PCIe Active State Power
1984 Management. 1984 Management.
1985 off Disable ASPM. 1985 off Disable ASPM.
1986 force Enable ASPM even on devices that claim not to support it. 1986 force Enable ASPM even on devices that claim not to support it.
1987 WARNING: Forcing ASPM on may cause system lockups. 1987 WARNING: Forcing ASPM on may cause system lockups.
1988 1988
1989 pcmv= [HW,PCMCIA] BadgePAD 4 1989 pcmv= [HW,PCMCIA] BadgePAD 4
1990 1990
1991 pd. [PARIDE] 1991 pd. [PARIDE]
1992 See Documentation/blockdev/paride.txt. 1992 See Documentation/blockdev/paride.txt.
1993 1993
1994 pdcchassis= [PARISC,HW] Disable/Enable PDC Chassis Status codes at 1994 pdcchassis= [PARISC,HW] Disable/Enable PDC Chassis Status codes at
1995 boot time. 1995 boot time.
1996 Format: { 0 | 1 } 1996 Format: { 0 | 1 }
1997 See arch/parisc/kernel/pdc_chassis.c 1997 See arch/parisc/kernel/pdc_chassis.c
1998 1998
1999 percpu_alloc= Select which percpu first chunk allocator to use. 1999 percpu_alloc= Select which percpu first chunk allocator to use.
2000 Currently supported values are "embed" and "page". 2000 Currently supported values are "embed" and "page".
2001 Archs may support subset or none of the selections. 2001 Archs may support subset or none of the selections.
2002 See comments in mm/percpu.c for details on each 2002 See comments in mm/percpu.c for details on each
2003 allocator. This parameter is primarily for debugging 2003 allocator. This parameter is primarily for debugging
2004 and performance comparison. 2004 and performance comparison.
2005 2005
2006 pf. [PARIDE] 2006 pf. [PARIDE]
2007 See Documentation/blockdev/paride.txt. 2007 See Documentation/blockdev/paride.txt.
2008 2008
2009 pg. [PARIDE] 2009 pg. [PARIDE]
2010 See Documentation/blockdev/paride.txt. 2010 See Documentation/blockdev/paride.txt.
2011 2011
2012 pirq= [SMP,APIC] Manual mp-table setup 2012 pirq= [SMP,APIC] Manual mp-table setup
2013 See Documentation/x86/i386/IO-APIC.txt. 2013 See Documentation/x86/i386/IO-APIC.txt.
2014 2014
2015 plip= [PPT,NET] Parallel port network link 2015 plip= [PPT,NET] Parallel port network link
2016 Format: { parport<nr> | timid | 0 } 2016 Format: { parport<nr> | timid | 0 }
2017 See also Documentation/parport.txt. 2017 See also Documentation/parport.txt.
2018 2018
2019 pmtmr= [X86] Manual setup of pmtmr I/O Port. 2019 pmtmr= [X86] Manual setup of pmtmr I/O Port.
2020 Override pmtimer IOPort with a hex value. 2020 Override pmtimer IOPort with a hex value.
2021 e.g. pmtmr=0x508 2021 e.g. pmtmr=0x508
2022 2022
2023 pnp.debug [PNP] 2023 pnp.debug [PNP]
2024 Enable PNP debug messages. This depends on the 2024 Enable PNP debug messages. This depends on the
2025 CONFIG_PNP_DEBUG_MESSAGES option. 2025 CONFIG_PNP_DEBUG_MESSAGES option.
2026 2026
2027 pnpacpi= [ACPI] 2027 pnpacpi= [ACPI]
2028 { off } 2028 { off }
2029 2029
2030 pnpbios= [ISAPNP] 2030 pnpbios= [ISAPNP]
2031 { on | off | curr | res | no-curr | no-res } 2031 { on | off | curr | res | no-curr | no-res }
2032 2032
2033 pnp_reserve_irq= 2033 pnp_reserve_irq=
2034 [ISAPNP] Exclude IRQs for the autoconfiguration 2034 [ISAPNP] Exclude IRQs for the autoconfiguration
2035 2035
2036 pnp_reserve_dma= 2036 pnp_reserve_dma=
2037 [ISAPNP] Exclude DMAs for the autoconfiguration 2037 [ISAPNP] Exclude DMAs for the autoconfiguration
2038 2038
2039 pnp_reserve_io= [ISAPNP] Exclude I/O ports for the autoconfiguration 2039 pnp_reserve_io= [ISAPNP] Exclude I/O ports for the autoconfiguration
2040 Ranges are in pairs (I/O port base and size). 2040 Ranges are in pairs (I/O port base and size).
2041 2041
2042 pnp_reserve_mem= 2042 pnp_reserve_mem=
2043 [ISAPNP] Exclude memory regions for the 2043 [ISAPNP] Exclude memory regions for the
2044 autoconfiguration. 2044 autoconfiguration.
2045 Ranges are in pairs (memory base and size). 2045 Ranges are in pairs (memory base and size).
2046 2046
2047 ports= [IP_VS_FTP] IPVS ftp helper module 2047 ports= [IP_VS_FTP] IPVS ftp helper module
2048 Default is 21. 2048 Default is 21.
2049 Up to 8 (IP_VS_APP_MAX_PORTS) ports 2049 Up to 8 (IP_VS_APP_MAX_PORTS) ports
2050 may be specified. 2050 may be specified.
2051 Format: <port>,<port>.... 2051 Format: <port>,<port>....
2052 2052
2053 print-fatal-signals= 2053 print-fatal-signals=
2054 [KNL] debug: print fatal signals 2054 [KNL] debug: print fatal signals
2055 2055
2056 If enabled, warn about various signal handling 2056 If enabled, warn about various signal handling
2057 related application anomalies: too many signals, 2057 related application anomalies: too many signals,
2058 too many POSIX.1 timers, fatal signals causing a 2058 too many POSIX.1 timers, fatal signals causing a
2059 coredump - etc. 2059 coredump - etc.
2060 2060
2061 If you hit the warning due to signal overflow, 2061 If you hit the warning due to signal overflow,
2062 you might want to try "ulimit -i unlimited". 2062 you might want to try "ulimit -i unlimited".
2063 2063
2064 default: off. 2064 default: off.
2065 2065
2066 printk.time= Show timing data prefixed to each printk message line 2066 printk.time= Show timing data prefixed to each printk message line
2067 Format: <bool> (1/Y/y=enable, 0/N/n=disable) 2067 Format: <bool> (1/Y/y=enable, 0/N/n=disable)
2068 2068
2069 processor.max_cstate= [HW,ACPI] 2069 processor.max_cstate= [HW,ACPI]
2070 Limit processor to maximum C-state 2070 Limit processor to maximum C-state
2071 max_cstate=9 overrides any DMI blacklist limit. 2071 max_cstate=9 overrides any DMI blacklist limit.
2072 2072
2073 processor.nocst [HW,ACPI] 2073 processor.nocst [HW,ACPI]
2074 Ignore the _CST method to determine C-states, 2074 Ignore the _CST method to determine C-states,
2075 instead using the legacy FADT method 2075 instead using the legacy FADT method
2076 2076
2077 profile= [KNL] Enable kernel profiling via /proc/profile 2077 profile= [KNL] Enable kernel profiling via /proc/profile
2078 Format: [schedule,]<number> 2078 Format: [schedule,]<number>
2079 Param: "schedule" - profile schedule points. 2079 Param: "schedule" - profile schedule points.
2080 Param: <number> - step/bucket size as a power of 2 for 2080 Param: <number> - step/bucket size as a power of 2 for
2081 statistical time based profiling. 2081 statistical time based profiling.
2082 Param: "sleep" - profile D-state sleeping (millisecs). 2082 Param: "sleep" - profile D-state sleeping (millisecs).
2083 Requires CONFIG_SCHEDSTATS 2083 Requires CONFIG_SCHEDSTATS
2084 Param: "kvm" - profile VM exits. 2084 Param: "kvm" - profile VM exits.
2085 2085
2086 prompt_ramdisk= [RAM] List of RAM disks to prompt for floppy disk 2086 prompt_ramdisk= [RAM] List of RAM disks to prompt for floppy disk
2087 before loading. 2087 before loading.
2088 See Documentation/blockdev/ramdisk.txt. 2088 See Documentation/blockdev/ramdisk.txt.
2089 2089
2090 psmouse.proto= [HW,MOUSE] Highest PS2 mouse protocol extension to 2090 psmouse.proto= [HW,MOUSE] Highest PS2 mouse protocol extension to
2091 probe for; one of (bare|imps|exps|lifebook|any). 2091 probe for; one of (bare|imps|exps|lifebook|any).
2092 psmouse.rate= [HW,MOUSE] Set desired mouse report rate, in reports 2092 psmouse.rate= [HW,MOUSE] Set desired mouse report rate, in reports
2093 per second. 2093 per second.
2094 psmouse.resetafter= [HW,MOUSE] 2094 psmouse.resetafter= [HW,MOUSE]
2095 Try to reset the device after so many bad packets 2095 Try to reset the device after so many bad packets
2096 (0 = never). 2096 (0 = never).
2097 psmouse.resolution= 2097 psmouse.resolution=
2098 [HW,MOUSE] Set desired mouse resolution, in dpi. 2098 [HW,MOUSE] Set desired mouse resolution, in dpi.
2099 psmouse.smartscroll= 2099 psmouse.smartscroll=
2100 [HW,MOUSE] Controls Logitech smartscroll autorepeat. 2100 [HW,MOUSE] Controls Logitech smartscroll autorepeat.
2101 0 = disabled, 1 = enabled (default). 2101 0 = disabled, 1 = enabled (default).
2102 2102
2103 pss= [HW,OSS] Personal Sound System (ECHO ESC614) 2103 pss= [HW,OSS] Personal Sound System (ECHO ESC614)
2104 Format: 2104 Format:
2105 <io>,<mss_io>,<mss_irq>,<mss_dma>,<mpu_io>,<mpu_irq> 2105 <io>,<mss_io>,<mss_irq>,<mss_dma>,<mpu_io>,<mpu_irq>
2106 2106
2107 pt. [PARIDE] 2107 pt. [PARIDE]
2108 See Documentation/blockdev/paride.txt. 2108 See Documentation/blockdev/paride.txt.
2109 2109
2110 pty.legacy_count= 2110 pty.legacy_count=
2111 [KNL] Number of legacy pty's. Overwrites compiled-in 2111 [KNL] Number of legacy pty's. Overwrites compiled-in
2112 default number. 2112 default number.
2113 2113
2114 quiet [KNL] Disable most log messages 2114 quiet [KNL] Disable most log messages
2115 2115
2116 r128= [HW,DRM] 2116 r128= [HW,DRM]
2117 2117
2118 raid= [HW,RAID] 2118 raid= [HW,RAID]
2119 See Documentation/md.txt. 2119 See Documentation/md.txt.
2120 2120
2121 ramdisk_blocksize= [RAM] 2121 ramdisk_blocksize= [RAM]
2122 See Documentation/blockdev/ramdisk.txt. 2122 See Documentation/blockdev/ramdisk.txt.
2123 2123
2124 ramdisk_size= [RAM] Sizes of RAM disks in kilobytes 2124 ramdisk_size= [RAM] Sizes of RAM disks in kilobytes
2125 See Documentation/blockdev/ramdisk.txt. 2125 See Documentation/blockdev/ramdisk.txt.
2126 2126
2127 rcupdate.blimit= [KNL,BOOT] 2127 rcupdate.blimit= [KNL,BOOT]
2128 Set maximum number of finished RCU callbacks to process 2128 Set maximum number of finished RCU callbacks to process
2129 in one batch. 2129 in one batch.
2130 2130
2131 rcupdate.qhimark= [KNL,BOOT] 2131 rcupdate.qhimark= [KNL,BOOT]
2132 Set threshold of queued 2132 Set threshold of queued
2133 RCU callbacks over which batch limiting is disabled. 2133 RCU callbacks over which batch limiting is disabled.
2134 2134
2135 rcupdate.qlowmark= [KNL,BOOT] 2135 rcupdate.qlowmark= [KNL,BOOT]
2136 Set threshold of queued RCU callbacks below which 2136 Set threshold of queued RCU callbacks below which
2137 batch limiting is re-enabled. 2137 batch limiting is re-enabled.
2138 2138
2139 rdinit= [KNL] 2139 rdinit= [KNL]
2140 Format: <full_path> 2140 Format: <full_path>
2141 Run specified binary instead of /init from the ramdisk, 2141 Run specified binary instead of /init from the ramdisk,
2142 used for early userspace startup. See initrd. 2142 used for early userspace startup. See initrd.
2143 2143
2144 reboot= [BUGS=X86-32,BUGS=ARM,BUGS=IA-64] Rebooting mode 2144 reboot= [BUGS=X86-32,BUGS=ARM,BUGS=IA-64] Rebooting mode
2145 Format: <reboot_mode>[,<reboot_mode2>[,...]] 2145 Format: <reboot_mode>[,<reboot_mode2>[,...]]
2146 See arch/*/kernel/reboot.c or arch/*/kernel/process.c 2146 See arch/*/kernel/reboot.c or arch/*/kernel/process.c
2147 2147
2148 relax_domain_level= 2148 relax_domain_level=
2149 [KNL, SMP] Set scheduler's default relax_domain_level. 2149 [KNL, SMP] Set scheduler's default relax_domain_level.
2150 See Documentation/cgroups/cpusets.txt. 2150 See Documentation/cgroups/cpusets.txt.
2151 2151
2152 reserve= [KNL,BUGS] Force the kernel to ignore some iomem area 2152 reserve= [KNL,BUGS] Force the kernel to ignore some iomem area
2153 2153
2154 reservetop= [X86-32] 2154 reservetop= [X86-32]
2155 Format: nn[KMG] 2155 Format: nn[KMG]
2156 Reserves a hole at the top of the kernel virtual 2156 Reserves a hole at the top of the kernel virtual
2157 address space. 2157 address space.
2158 2158
2159 reset_devices [KNL] Force drivers to reset the underlying device 2159 reset_devices [KNL] Force drivers to reset the underlying device
2160 during initialization. 2160 during initialization.
2161 2161
2162 resume= [SWSUSP] 2162 resume= [SWSUSP]
2163 Specify the partition device for software suspend 2163 Specify the partition device for software suspend
2164 2164
2165 resume_offset= [SWSUSP] 2165 resume_offset= [SWSUSP]
2166 Specify the offset from the beginning of the partition 2166 Specify the offset from the beginning of the partition
2167 given by "resume=" at which the swap header is located, 2167 given by "resume=" at which the swap header is located,
2168 in <PAGE_SIZE> units (needed only for swap files). 2168 in <PAGE_SIZE> units (needed only for swap files).
2169 See Documentation/power/swsusp-and-swap-files.txt 2169 See Documentation/power/swsusp-and-swap-files.txt
2170 2170
2171 retain_initrd [RAM] Keep initrd memory after extraction 2171 retain_initrd [RAM] Keep initrd memory after extraction
2172 2172
2173 rhash_entries= [KNL,NET] 2173 rhash_entries= [KNL,NET]
2174 Set number of hash buckets for route cache 2174 Set number of hash buckets for route cache
2175 2175
2176 riscom8= [HW,SERIAL] 2176 riscom8= [HW,SERIAL]
2177 Format: <io_board1>[,<io_board2>[,...<io_boardN>]] 2177 Format: <io_board1>[,<io_board2>[,...<io_boardN>]]
2178 2178
2179 ro [KNL] Mount root device read-only on boot 2179 ro [KNL] Mount root device read-only on boot
2180 2180
2181 root= [KNL] Root filesystem 2181 root= [KNL] Root filesystem
2182 2182
2183 rootdelay= [KNL] Delay (in seconds) to pause before attempting to 2183 rootdelay= [KNL] Delay (in seconds) to pause before attempting to
2184 mount the root filesystem 2184 mount the root filesystem
2185 2185
2186 rootflags= [KNL] Set root filesystem mount option string 2186 rootflags= [KNL] Set root filesystem mount option string
2187 2187
2188 rootfstype= [KNL] Set root filesystem type 2188 rootfstype= [KNL] Set root filesystem type
2189 2189
2190 rootwait [KNL] Wait (indefinitely) for root device to show up. 2190 rootwait [KNL] Wait (indefinitely) for root device to show up.
2191 Useful for devices that are detected asynchronously 2191 Useful for devices that are detected asynchronously
2192 (e.g. USB and MMC devices). 2192 (e.g. USB and MMC devices).
2193 2193
2194 rw [KNL] Mount root device read-write on boot 2194 rw [KNL] Mount root device read-write on boot
2195 2195
2196 S [KNL] Run init in single mode 2196 S [KNL] Run init in single mode
2197 2197
2198 sa1100ir [NET] 2198 sa1100ir [NET]
2199 See drivers/net/irda/sa1100_ir.c. 2199 See drivers/net/irda/sa1100_ir.c.
2200 2200
2201 sbni= [NET] Granch SBNI12 leased line adapter 2201 sbni= [NET] Granch SBNI12 leased line adapter
2202 2202
2203 sched_debug [KNL] Enables verbose scheduler debug messages. 2203 sched_debug [KNL] Enables verbose scheduler debug messages.
2204 2204
2205 sc1200wdt= [HW,WDT] SC1200 WDT (watchdog) driver 2205 sc1200wdt= [HW,WDT] SC1200 WDT (watchdog) driver
2206 Format: <io>[,<timeout>[,<isapnp>]] 2206 Format: <io>[,<timeout>[,<isapnp>]]
2207 2207
2208 scsi_debug_*= [SCSI] 2208 scsi_debug_*= [SCSI]
2209 See drivers/scsi/scsi_debug.c. 2209 See drivers/scsi/scsi_debug.c.
2210 2210
2211 scsi_default_dev_flags= 2211 scsi_default_dev_flags=
2212 [SCSI] SCSI default device flags 2212 [SCSI] SCSI default device flags
2213 Format: <integer> 2213 Format: <integer>
2214 2214
2215 scsi_dev_flags= [SCSI] Black/white list entry for vendor and model 2215 scsi_dev_flags= [SCSI] Black/white list entry for vendor and model
2216 Format: <vendor>:<model>:<flags> 2216 Format: <vendor>:<model>:<flags>
2217 (flags are integer value) 2217 (flags are integer value)
2218 2218
2219 scsi_logging_level= [SCSI] a bit mask of logging levels 2219 scsi_logging_level= [SCSI] a bit mask of logging levels
2220 See drivers/scsi/scsi_logging.h for bits. Also 2220 See drivers/scsi/scsi_logging.h for bits. Also
2221 settable via sysctl at dev.scsi.logging_level 2221 settable via sysctl at dev.scsi.logging_level
2222 (/proc/sys/dev/scsi/logging_level). 2222 (/proc/sys/dev/scsi/logging_level).
2223 There is also a nice 'scsi_logging_level' script in the 2223 There is also a nice 'scsi_logging_level' script in the
2224 S390-tools package, available for download at 2224 S390-tools package, available for download at
2225 http://www-128.ibm.com/developerworks/linux/linux390/s390-tools-1.5.4.html 2225 http://www-128.ibm.com/developerworks/linux/linux390/s390-tools-1.5.4.html
2226 2226
2227 scsi_mod.scan= [SCSI] sync (default) scans SCSI busses as they are 2227 scsi_mod.scan= [SCSI] sync (default) scans SCSI busses as they are
2228 discovered. async scans them in kernel threads, 2228 discovered. async scans them in kernel threads,
2229 allowing boot to proceed. none ignores them, expecting 2229 allowing boot to proceed. none ignores them, expecting
2230 user space to do the scan. 2230 user space to do the scan.
2231 2231
2232 security= [SECURITY] Choose a security module to enable at boot. 2232 security= [SECURITY] Choose a security module to enable at boot.
2233 If this boot parameter is not specified, only the first 2233 If this boot parameter is not specified, only the first
2234 security module asking for security registration will be 2234 security module asking for security registration will be
2235 loaded. An invalid security module name will be treated 2235 loaded. An invalid security module name will be treated
2236 as if no module has been chosen. 2236 as if no module has been chosen.
2237 2237
2238 selinux= [SELINUX] Disable or enable SELinux at boot time. 2238 selinux= [SELINUX] Disable or enable SELinux at boot time.
2239 Format: { "0" | "1" } 2239 Format: { "0" | "1" }
2240 See security/selinux/Kconfig help text. 2240 See security/selinux/Kconfig help text.
2241 0 -- disable. 2241 0 -- disable.
2242 1 -- enable. 2242 1 -- enable.
2243 Default value is set via kernel config option. 2243 Default value is set via kernel config option.
2244 If enabled at boot time, /selinux/disable can be used 2244 If enabled at boot time, /selinux/disable can be used
2245 later to disable prior to initial policy load. 2245 later to disable prior to initial policy load.
2246 2246
2247 serialnumber [BUGS=X86-32] 2247 serialnumber [BUGS=X86-32]
2248 2248
2249 shapers= [NET] 2249 shapers= [NET]
2250 Maximal number of shapers. 2250 Maximal number of shapers.
2251 2251
2252 show_msr= [x86] show boot-time MSR settings 2252 show_msr= [x86] show boot-time MSR settings
2253 Format: { <integer> } 2253 Format: { <integer> }
2254 Show boot-time (BIOS-initialized) MSR settings. 2254 Show boot-time (BIOS-initialized) MSR settings.
2255 The parameter means the number of CPUs to show, 2255 The parameter means the number of CPUs to show,
2256 for example 1 means boot CPU only. 2256 for example 1 means boot CPU only.
2257 2257
2258 sim710= [SCSI,HW] 2258 sim710= [SCSI,HW]
2259 See header of drivers/scsi/sim710.c. 2259 See header of drivers/scsi/sim710.c.
2260 2260
2261 simeth= [IA-64] 2261 simeth= [IA-64]
2262 simscsi= 2262 simscsi=
2263 2263
2264 slram= [HW,MTD] 2264 slram= [HW,MTD]
2265 2265
2266 slub_debug[=options[,slabs]] [MM, SLUB] 2266 slub_debug[=options[,slabs]] [MM, SLUB]
2267 Enabling slub_debug allows one to determine the 2267 Enabling slub_debug allows one to determine the
2268 culprit if slab objects become corrupted. Enabling 2268 culprit if slab objects become corrupted. Enabling
2269 slub_debug can create guard zones around objects and 2269 slub_debug can create guard zones around objects and
2270 may poison objects when not in use. Also tracks the 2270 may poison objects when not in use. Also tracks the
2271 last alloc / free. For more information see 2271 last alloc / free. For more information see
2272 Documentation/vm/slub.txt. 2272 Documentation/vm/slub.txt.
2273 2273
2274 slub_max_order= [MM, SLUB] 2274 slub_max_order= [MM, SLUB]
2275 Determines the maximum allowed order for slabs. 2275 Determines the maximum allowed order for slabs.
2276 A high setting may cause OOMs due to memory 2276 A high setting may cause OOMs due to memory
2277 fragmentation. For more information see 2277 fragmentation. For more information see
2278 Documentation/vm/slub.txt. 2278 Documentation/vm/slub.txt.
2279 2279
2280 slub_min_objects= [MM, SLUB] 2280 slub_min_objects= [MM, SLUB]
2281 The minimum number of objects per slab. SLUB will 2281 The minimum number of objects per slab. SLUB will
2282 increase the slab order up to slub_max_order to 2282 increase the slab order up to slub_max_order to
2283 generate a sufficiently large slab able to contain 2283 generate a sufficiently large slab able to contain
2284 the number of objects indicated. The higher the number 2284 the number of objects indicated. The higher the number
2285 of objects the smaller the overhead of tracking slabs 2285 of objects the smaller the overhead of tracking slabs
2286 and the less frequently locks need to be acquired. 2286 and the less frequently locks need to be acquired.
2287 For more information see Documentation/vm/slub.txt. 2287 For more information see Documentation/vm/slub.txt.
2288 2288
2289 slub_min_order= [MM, SLUB] 2289 slub_min_order= [MM, SLUB]
2290 Determines the mininum page order for slabs. Must be 2290 Determines the mininum page order for slabs. Must be
2291 lower than slub_max_order. 2291 lower than slub_max_order.
2292 For more information see Documentation/vm/slub.txt. 2292 For more information see Documentation/vm/slub.txt.
2293 2293
2294 slub_nomerge [MM, SLUB] 2294 slub_nomerge [MM, SLUB]
2295 Disable merging of slabs with similar size. May be 2295 Disable merging of slabs with similar size. May be
2296 necessary if there is some reason to distinguish 2296 necessary if there is some reason to distinguish
2297 allocs to different slabs. Debug options disable 2297 allocs to different slabs. Debug options disable
2298 merging on their own. 2298 merging on their own.
2299 For more information see Documentation/vm/slub.txt. 2299 For more information see Documentation/vm/slub.txt.
2300 2300
2301 smart2= [HW] 2301 smart2= [HW]
2302 Format: <io1>[,<io2>[,...,<io8>]] 2302 Format: <io1>[,<io2>[,...,<io8>]]
2303 2303
2304 smp-alt-once [X86-32,SMP] On a hotplug CPU system, only 2304 smp-alt-once [X86-32,SMP] On a hotplug CPU system, only
2305 attempt to substitute SMP alternatives once at boot. 2305 attempt to substitute SMP alternatives once at boot.
2306 2306
2307 smsc-ircc2.nopnp [HW] Don't use PNP to discover SMC devices 2307 smsc-ircc2.nopnp [HW] Don't use PNP to discover SMC devices
2308 smsc-ircc2.ircc_cfg= [HW] Device configuration I/O port 2308 smsc-ircc2.ircc_cfg= [HW] Device configuration I/O port
2309 smsc-ircc2.ircc_sir= [HW] SIR base I/O port 2309 smsc-ircc2.ircc_sir= [HW] SIR base I/O port
2310 smsc-ircc2.ircc_fir= [HW] FIR base I/O port 2310 smsc-ircc2.ircc_fir= [HW] FIR base I/O port
2311 smsc-ircc2.ircc_irq= [HW] IRQ line 2311 smsc-ircc2.ircc_irq= [HW] IRQ line
2312 smsc-ircc2.ircc_dma= [HW] DMA channel 2312 smsc-ircc2.ircc_dma= [HW] DMA channel
2313 smsc-ircc2.ircc_transceiver= [HW] Transceiver type: 2313 smsc-ircc2.ircc_transceiver= [HW] Transceiver type:
2314 0: Toshiba Satellite 1800 (GP data pin select) 2314 0: Toshiba Satellite 1800 (GP data pin select)
2315 1: Fast pin select (default) 2315 1: Fast pin select (default)
2316 2: ATC IRMode 2316 2: ATC IRMode
2317 2317
2318 snd-ad1816a= [HW,ALSA] 2318 snd-ad1816a= [HW,ALSA]
2319 2319
2320 snd-ad1848= [HW,ALSA] 2320 snd-ad1848= [HW,ALSA]
2321 2321
2322 snd-ali5451= [HW,ALSA] 2322 snd-ali5451= [HW,ALSA]
2323 2323
2324 snd-als100= [HW,ALSA] 2324 snd-als100= [HW,ALSA]
2325 2325
2326 snd-als4000= [HW,ALSA] 2326 snd-als4000= [HW,ALSA]
2327 2327
2328 snd-azt2320= [HW,ALSA] 2328 snd-azt2320= [HW,ALSA]
2329 2329
2330 snd-cmi8330= [HW,ALSA] 2330 snd-cmi8330= [HW,ALSA]
2331 2331
2332 snd-cmipci= [HW,ALSA] 2332 snd-cmipci= [HW,ALSA]
2333 2333
2334 snd-cs4231= [HW,ALSA] 2334 snd-cs4231= [HW,ALSA]
2335 2335
2336 snd-cs4232= [HW,ALSA] 2336 snd-cs4232= [HW,ALSA]
2337 2337
2338 snd-cs4236= [HW,ALSA] 2338 snd-cs4236= [HW,ALSA]
2339 2339
2340 snd-cs4281= [HW,ALSA] 2340 snd-cs4281= [HW,ALSA]
2341 2341
2342 snd-cs46xx= [HW,ALSA] 2342 snd-cs46xx= [HW,ALSA]
2343 2343
2344 snd-dt019x= [HW,ALSA] 2344 snd-dt019x= [HW,ALSA]
2345 2345
2346 snd-dummy= [HW,ALSA] 2346 snd-dummy= [HW,ALSA]
2347 2347
2348 snd-emu10k1= [HW,ALSA] 2348 snd-emu10k1= [HW,ALSA]
2349 2349
2350 snd-ens1370= [HW,ALSA] 2350 snd-ens1370= [HW,ALSA]
2351 2351
2352 snd-ens1371= [HW,ALSA] 2352 snd-ens1371= [HW,ALSA]
2353 2353
2354 snd-es968= [HW,ALSA] 2354 snd-es968= [HW,ALSA]
2355 2355
2356 snd-es1688= [HW,ALSA] 2356 snd-es1688= [HW,ALSA]
2357 2357
2358 snd-es18xx= [HW,ALSA] 2358 snd-es18xx= [HW,ALSA]
2359 2359
2360 snd-es1938= [HW,ALSA] 2360 snd-es1938= [HW,ALSA]
2361 2361
2362 snd-es1968= [HW,ALSA] 2362 snd-es1968= [HW,ALSA]
2363 2363
2364 snd-fm801= [HW,ALSA] 2364 snd-fm801= [HW,ALSA]
2365 2365
2366 snd-gusclassic= [HW,ALSA] 2366 snd-gusclassic= [HW,ALSA]
2367 2367
2368 snd-gusextreme= [HW,ALSA] 2368 snd-gusextreme= [HW,ALSA]
2369 2369
2370 snd-gusmax= [HW,ALSA] 2370 snd-gusmax= [HW,ALSA]
2371 2371
2372 snd-hdsp= [HW,ALSA] 2372 snd-hdsp= [HW,ALSA]
2373 2373
2374 snd-ice1712= [HW,ALSA] 2374 snd-ice1712= [HW,ALSA]
2375 2375
2376 snd-intel8x0= [HW,ALSA] 2376 snd-intel8x0= [HW,ALSA]
2377 2377
2378 snd-interwave= [HW,ALSA] 2378 snd-interwave= [HW,ALSA]
2379 2379
2380 snd-interwave-stb= 2380 snd-interwave-stb=
2381 [HW,ALSA] 2381 [HW,ALSA]
2382 2382
2383 snd-korg1212= [HW,ALSA] 2383 snd-korg1212= [HW,ALSA]
2384 2384
2385 snd-maestro3= [HW,ALSA] 2385 snd-maestro3= [HW,ALSA]
2386 2386
2387 snd-mpu401= [HW,ALSA] 2387 snd-mpu401= [HW,ALSA]
2388 2388
2389 snd-mtpav= [HW,ALSA] 2389 snd-mtpav= [HW,ALSA]
2390 2390
2391 snd-nm256= [HW,ALSA] 2391 snd-nm256= [HW,ALSA]
2392 2392
2393 snd-opl3sa2= [HW,ALSA] 2393 snd-opl3sa2= [HW,ALSA]
2394 2394
2395 snd-opti92x-ad1848= 2395 snd-opti92x-ad1848=
2396 [HW,ALSA] 2396 [HW,ALSA]
2397 2397
2398 snd-opti92x-cs4231= 2398 snd-opti92x-cs4231=
2399 [HW,ALSA] 2399 [HW,ALSA]
2400 2400
2401 snd-opti93x= [HW,ALSA] 2401 snd-opti93x= [HW,ALSA]
2402 2402
2403 snd-pmac= [HW,ALSA] 2403 snd-pmac= [HW,ALSA]
2404 2404
2405 snd-rme32= [HW,ALSA] 2405 snd-rme32= [HW,ALSA]
2406 2406
2407 snd-rme96= [HW,ALSA] 2407 snd-rme96= [HW,ALSA]
2408 2408
2409 snd-rme9652= [HW,ALSA] 2409 snd-rme9652= [HW,ALSA]
2410 2410
2411 snd-sb8= [HW,ALSA] 2411 snd-sb8= [HW,ALSA]
2412 2412
2413 snd-sb16= [HW,ALSA] 2413 snd-sb16= [HW,ALSA]
2414 2414
2415 snd-sbawe= [HW,ALSA] 2415 snd-sbawe= [HW,ALSA]
2416 2416
2417 snd-serial= [HW,ALSA] 2417 snd-serial= [HW,ALSA]
2418 2418
2419 snd-sgalaxy= [HW,ALSA] 2419 snd-sgalaxy= [HW,ALSA]
2420 2420
2421 snd-sonicvibes= [HW,ALSA] 2421 snd-sonicvibes= [HW,ALSA]
2422 2422
2423 snd-sun-amd7930= 2423 snd-sun-amd7930=
2424 [HW,ALSA] 2424 [HW,ALSA]
2425 2425
2426 snd-sun-cs4231= [HW,ALSA] 2426 snd-sun-cs4231= [HW,ALSA]
2427 2427
2428 snd-trident= [HW,ALSA] 2428 snd-trident= [HW,ALSA]
2429 2429
2430 snd-usb-audio= [HW,ALSA,USB] 2430 snd-usb-audio= [HW,ALSA,USB]
2431 2431
2432 snd-via82xx= [HW,ALSA] 2432 snd-via82xx= [HW,ALSA]
2433 2433
2434 snd-virmidi= [HW,ALSA] 2434 snd-virmidi= [HW,ALSA]
2435 2435
2436 snd-wavefront= [HW,ALSA] 2436 snd-wavefront= [HW,ALSA]
2437 2437
2438 snd-ymfpci= [HW,ALSA] 2438 snd-ymfpci= [HW,ALSA]
2439 2439
2440 softlockup_panic= 2440 softlockup_panic=
2441 [KNL] Should the soft-lockup detector generate panics. 2441 [KNL] Should the soft-lockup detector generate panics.
2442 2442
2443 sonypi.*= [HW] Sony Programmable I/O Control Device driver 2443 sonypi.*= [HW] Sony Programmable I/O Control Device driver
2444 See Documentation/sonypi.txt 2444 See Documentation/sonypi.txt
2445 2445
2446 specialix= [HW,SERIAL] Specialix multi-serial port adapter 2446 specialix= [HW,SERIAL] Specialix multi-serial port adapter
2447 See Documentation/serial/specialix.txt. 2447 See Documentation/serial/specialix.txt.
2448 2448
2449 spia_io_base= [HW,MTD] 2449 spia_io_base= [HW,MTD]
2450 spia_fio_base= 2450 spia_fio_base=
2451 spia_pedr= 2451 spia_pedr=
2452 spia_peddr= 2452 spia_peddr=
2453 2453
2454 sscape= [HW,OSS] 2454 sscape= [HW,OSS]
2455 Format: <io>,<irq>,<dma>,<mpu_io>,<mpu_irq> 2455 Format: <io>,<irq>,<dma>,<mpu_io>,<mpu_irq>
2456 2456
2457 st= [HW,SCSI] SCSI tape parameters (buffers, etc.) 2457 st= [HW,SCSI] SCSI tape parameters (buffers, etc.)
2458 See Documentation/scsi/st.txt. 2458 See Documentation/scsi/st.txt.
2459 2459
2460 stacktrace [FTRACE] 2460 stacktrace [FTRACE]
2461 Enabled the stack tracer on boot up. 2461 Enabled the stack tracer on boot up.
2462 2462
2463 sti= [PARISC,HW] 2463 sti= [PARISC,HW]
2464 Format: <num> 2464 Format: <num>
2465 Set the STI (builtin display/keyboard on the HP-PARISC 2465 Set the STI (builtin display/keyboard on the HP-PARISC
2466 machines) console (graphic card) which should be used 2466 machines) console (graphic card) which should be used
2467 as the initial boot-console. 2467 as the initial boot-console.
2468 See also comment in drivers/video/console/sticore.c. 2468 See also comment in drivers/video/console/sticore.c.
2469 2469
2470 sti_font= [HW] 2470 sti_font= [HW]
2471 See comment in drivers/video/console/sticore.c. 2471 See comment in drivers/video/console/sticore.c.
2472 2472
2473 stifb= [HW] 2473 stifb= [HW]
2474 Format: bpp:<bpp1>[:<bpp2>[:<bpp3>...]] 2474 Format: bpp:<bpp1>[:<bpp2>[:<bpp3>...]]
2475 2475
2476 sunrpc.min_resvport= 2476 sunrpc.min_resvport=
2477 sunrpc.max_resvport= 2477 sunrpc.max_resvport=
2478 [NFS,SUNRPC] 2478 [NFS,SUNRPC]
2479 SunRPC servers often require that client requests 2479 SunRPC servers often require that client requests
2480 originate from a privileged port (i.e. a port in the 2480 originate from a privileged port (i.e. a port in the
2481 range 0 < portnr < 1024). 2481 range 0 < portnr < 1024).
2482 An administrator who wishes to reserve some of these 2482 An administrator who wishes to reserve some of these
2483 ports for other uses may adjust the range that the 2483 ports for other uses may adjust the range that the
2484 kernel's sunrpc client considers to be privileged 2484 kernel's sunrpc client considers to be privileged
2485 using these two parameters to set the minimum and 2485 using these two parameters to set the minimum and
2486 maximum port values. 2486 maximum port values.
2487 2487
2488 sunrpc.pool_mode= 2488 sunrpc.pool_mode=
2489 [NFS] 2489 [NFS]
2490 Control how the NFS server code allocates CPUs to 2490 Control how the NFS server code allocates CPUs to
2491 service thread pools. Depending on how many NICs 2491 service thread pools. Depending on how many NICs
2492 you have and where their interrupts are bound, this 2492 you have and where their interrupts are bound, this
2493 option will affect which CPUs will do NFS serving. 2493 option will affect which CPUs will do NFS serving.
2494 Note: this parameter cannot be changed while the 2494 Note: this parameter cannot be changed while the
2495 NFS server is running. 2495 NFS server is running.
2496 2496
2497 auto the server chooses an appropriate mode 2497 auto the server chooses an appropriate mode
2498 automatically using heuristics 2498 automatically using heuristics
2499 global a single global pool contains all CPUs 2499 global a single global pool contains all CPUs
2500 percpu one pool for each CPU 2500 percpu one pool for each CPU
2501 pernode one pool for each NUMA node (equivalent 2501 pernode one pool for each NUMA node (equivalent
2502 to global on non-NUMA machines) 2502 to global on non-NUMA machines)
2503 2503
2504 sunrpc.tcp_slot_table_entries= 2504 sunrpc.tcp_slot_table_entries=
2505 sunrpc.udp_slot_table_entries= 2505 sunrpc.udp_slot_table_entries=
2506 [NFS,SUNRPC] 2506 [NFS,SUNRPC]
2507 Sets the upper limit on the number of simultaneous 2507 Sets the upper limit on the number of simultaneous
2508 RPC calls that can be sent from the client to a 2508 RPC calls that can be sent from the client to a
2509 server. Increasing these values may allow you to 2509 server. Increasing these values may allow you to
2510 improve throughput, but will also increase the 2510 improve throughput, but will also increase the
2511 amount of memory reserved for use by the client. 2511 amount of memory reserved for use by the client.
2512 2512
2513 swiotlb= [IA-64] Number of I/O TLB slabs 2513 swiotlb= [IA-64] Number of I/O TLB slabs
2514 2514
2515 switches= [HW,M68k] 2515 switches= [HW,M68k]
2516 2516
2517 sym53c416= [HW,SCSI] 2517 sym53c416= [HW,SCSI]
2518 See header of drivers/scsi/sym53c416.c. 2518 See header of drivers/scsi/sym53c416.c.
2519 2519
2520 sysrq_always_enabled 2520 sysrq_always_enabled
2521 [KNL] 2521 [KNL]
2522 Ignore sysrq setting - this boot parameter will 2522 Ignore sysrq setting - this boot parameter will
2523 neutralize any effect of /proc/sys/kernel/sysrq. 2523 neutralize any effect of /proc/sys/kernel/sysrq.
2524 Useful for debugging. 2524 Useful for debugging.
2525 2525
2526 t128= [HW,SCSI] 2526 t128= [HW,SCSI]
2527 See header of drivers/scsi/t128.c. 2527 See header of drivers/scsi/t128.c.
2528 2528
2529 tdfx= [HW,DRM] 2529 tdfx= [HW,DRM]
2530 2530
2531 test_suspend= [SUSPEND] 2531 test_suspend= [SUSPEND]
2532 Specify "mem" (for Suspend-to-RAM) or "standby" (for 2532 Specify "mem" (for Suspend-to-RAM) or "standby" (for
2533 standby suspend) as the system sleep state to briefly 2533 standby suspend) as the system sleep state to briefly
2534 enter during system startup. The system is woken from 2534 enter during system startup. The system is woken from
2535 this state using a wakeup-capable RTC alarm. 2535 this state using a wakeup-capable RTC alarm.
2536 2536
2537 thash_entries= [KNL,NET] 2537 thash_entries= [KNL,NET]
2538 Set number of hash buckets for TCP connection 2538 Set number of hash buckets for TCP connection
2539 2539
2540 thermal.act= [HW,ACPI] 2540 thermal.act= [HW,ACPI]
2541 -1: disable all active trip points in all thermal zones 2541 -1: disable all active trip points in all thermal zones
2542 <degrees C>: override all lowest active trip points 2542 <degrees C>: override all lowest active trip points
2543 2543
2544 thermal.crt= [HW,ACPI] 2544 thermal.crt= [HW,ACPI]
2545 -1: disable all critical trip points in all thermal zones 2545 -1: disable all critical trip points in all thermal zones
2546 <degrees C>: override all critical trip points 2546 <degrees C>: override all critical trip points
2547 2547
2548 thermal.nocrt= [HW,ACPI] 2548 thermal.nocrt= [HW,ACPI]
2549 Set to disable actions on ACPI thermal zone 2549 Set to disable actions on ACPI thermal zone
2550 critical and hot trip points. 2550 critical and hot trip points.
2551 2551
2552 thermal.off= [HW,ACPI] 2552 thermal.off= [HW,ACPI]
2553 1: disable ACPI thermal control 2553 1: disable ACPI thermal control
2554 2554
2555 thermal.psv= [HW,ACPI] 2555 thermal.psv= [HW,ACPI]
2556 -1: disable all passive trip points 2556 -1: disable all passive trip points
2557 <degrees C>: override all passive trip points to this 2557 <degrees C>: override all passive trip points to this
2558 value 2558 value
2559 2559
2560 thermal.tzp= [HW,ACPI] 2560 thermal.tzp= [HW,ACPI]
2561 Specify global default ACPI thermal zone polling rate 2561 Specify global default ACPI thermal zone polling rate
2562 <deci-seconds>: poll all this frequency 2562 <deci-seconds>: poll all this frequency
2563 0: no polling (default) 2563 0: no polling (default)
2564 2564
2565 tmscsim= [HW,SCSI] 2565 tmscsim= [HW,SCSI]
2566 See comment before function dc390_setup() in 2566 See comment before function dc390_setup() in
2567 drivers/scsi/tmscsim.c. 2567 drivers/scsi/tmscsim.c.
2568 2568
2569 topology= [S390] 2569 topology= [S390]
2570 Format: {off | on} 2570 Format: {off | on}
2571 Specify if the kernel should make use of the cpu 2571 Specify if the kernel should make use of the cpu
2572 topology informations if the hardware supports these. 2572 topology informations if the hardware supports these.
2573 The scheduler will make use of these informations and 2573 The scheduler will make use of these informations and
2574 e.g. base its process migration decisions on it. 2574 e.g. base its process migration decisions on it.
2575 Default is off. 2575 Default is off.
2576 2576
2577 tp720= [HW,PS2] 2577 tp720= [HW,PS2]
2578 2578
2579 trace_buf_size=nn[KMG] 2579 trace_buf_size=nn[KMG]
2580 [FTRACE] will set tracing buffer size. 2580 [FTRACE] will set tracing buffer size.
2581 2581
2582 trace_event=[event-list] 2582 trace_event=[event-list]
2583 [FTRACE] Set and start specified trace events in order 2583 [FTRACE] Set and start specified trace events in order
2584 to facilitate early boot debugging. 2584 to facilitate early boot debugging.
2585 See also Documentation/trace/events.txt 2585 See also Documentation/trace/events.txt
2586 2586
2587 trix= [HW,OSS] MediaTrix AudioTrix Pro 2587 trix= [HW,OSS] MediaTrix AudioTrix Pro
2588 Format: 2588 Format:
2589 <io>,<irq>,<dma>,<dma2>,<sb_io>,<sb_irq>,<sb_dma>,<mpu_io>,<mpu_irq> 2589 <io>,<irq>,<dma>,<dma2>,<sb_io>,<sb_irq>,<sb_dma>,<mpu_io>,<mpu_irq>
2590 2590
2591 tsc= Disable clocksource-must-verify flag for TSC. 2591 tsc= Disable clocksource-must-verify flag for TSC.
2592 Format: <string> 2592 Format: <string>
2593 [x86] reliable: mark tsc clocksource as reliable, this 2593 [x86] reliable: mark tsc clocksource as reliable, this
2594 disables clocksource verification at runtime. 2594 disables clocksource verification at runtime.
2595 Used to enable high-resolution timer mode on older 2595 Used to enable high-resolution timer mode on older
2596 hardware, and in virtualized environment. 2596 hardware, and in virtualized environment.
2597 2597
2598 turbografx.map[2|3]= [HW,JOY] 2598 turbografx.map[2|3]= [HW,JOY]
2599 TurboGraFX parallel port interface 2599 TurboGraFX parallel port interface
2600 Format: 2600 Format:
2601 <port#>,<js1>,<js2>,<js3>,<js4>,<js5>,<js6>,<js7> 2601 <port#>,<js1>,<js2>,<js3>,<js4>,<js5>,<js6>,<js7>
2602 See also Documentation/input/joystick-parport.txt 2602 See also Documentation/input/joystick-parport.txt
2603 2603
2604 u14-34f= [HW,SCSI] UltraStor 14F/34F SCSI host adapter 2604 u14-34f= [HW,SCSI] UltraStor 14F/34F SCSI host adapter
2605 See header of drivers/scsi/u14-34f.c. 2605 See header of drivers/scsi/u14-34f.c.
2606 2606
2607 uart401= [HW,OSS] 2607 uart401= [HW,OSS]
2608 Format: <io>,<irq> 2608 Format: <io>,<irq>
2609 2609
2610 uart6850= [HW,OSS] 2610 uart6850= [HW,OSS]
2611 Format: <io>,<irq> 2611 Format: <io>,<irq>
2612 2612
2613 uhash_entries= [KNL,NET] 2613 uhash_entries= [KNL,NET]
2614 Set number of hash buckets for UDP/UDP-Lite connections 2614 Set number of hash buckets for UDP/UDP-Lite connections
2615 2615
2616 uhci-hcd.ignore_oc= 2616 uhci-hcd.ignore_oc=
2617 [USB] Ignore overcurrent events (default N). 2617 [USB] Ignore overcurrent events (default N).
2618 Some badly-designed motherboards generate lots of 2618 Some badly-designed motherboards generate lots of
2619 bogus events, for ports that aren't wired to 2619 bogus events, for ports that aren't wired to
2620 anything. Set this parameter to avoid log spamming. 2620 anything. Set this parameter to avoid log spamming.
2621 Note that genuine overcurrent events won't be 2621 Note that genuine overcurrent events won't be
2622 reported either. 2622 reported either.
2623 2623
2624 unknown_nmi_panic 2624 unknown_nmi_panic
2625 [X86] 2625 [X86]
2626 Set unknown_nmi_panic=1 early on boot. 2626 Set unknown_nmi_panic=1 early on boot.
2627 2627
2628 usbcore.autosuspend= 2628 usbcore.autosuspend=
2629 [USB] The autosuspend time delay (in seconds) used 2629 [USB] The autosuspend time delay (in seconds) used
2630 for newly-detected USB devices (default 2). This 2630 for newly-detected USB devices (default 2). This
2631 is the time required before an idle device will be 2631 is the time required before an idle device will be
2632 autosuspended. Devices for which the delay is set 2632 autosuspended. Devices for which the delay is set
2633 to a negative value won't be autosuspended at all. 2633 to a negative value won't be autosuspended at all.
2634 2634
2635 usbcore.usbfs_snoop= 2635 usbcore.usbfs_snoop=
2636 [USB] Set to log all usbfs traffic (default 0 = off). 2636 [USB] Set to log all usbfs traffic (default 0 = off).
2637 2637
2638 usbcore.blinkenlights= 2638 usbcore.blinkenlights=
2639 [USB] Set to cycle leds on hubs (default 0 = off). 2639 [USB] Set to cycle leds on hubs (default 0 = off).
2640 2640
2641 usbcore.old_scheme_first= 2641 usbcore.old_scheme_first=
2642 [USB] Start with the old device initialization 2642 [USB] Start with the old device initialization
2643 scheme (default 0 = off). 2643 scheme (default 0 = off).
2644 2644
2645 usbcore.use_both_schemes= 2645 usbcore.use_both_schemes=
2646 [USB] Try the other device initialization scheme 2646 [USB] Try the other device initialization scheme
2647 if the first one fails (default 1 = enabled). 2647 if the first one fails (default 1 = enabled).
2648 2648
2649 usbcore.initial_descriptor_timeout= 2649 usbcore.initial_descriptor_timeout=
2650 [USB] Specifies timeout for the initial 64-byte 2650 [USB] Specifies timeout for the initial 64-byte
2651 USB_REQ_GET_DESCRIPTOR request in milliseconds 2651 USB_REQ_GET_DESCRIPTOR request in milliseconds
2652 (default 5000 = 5.0 seconds). 2652 (default 5000 = 5.0 seconds).
2653 2653
2654 usbhid.mousepoll= 2654 usbhid.mousepoll=
2655 [USBHID] The interval which mice are to be polled at. 2655 [USBHID] The interval which mice are to be polled at.
2656 2656
2657 usb-storage.delay_use= 2657 usb-storage.delay_use=
2658 [UMS] The delay in seconds before a new device is 2658 [UMS] The delay in seconds before a new device is
2659 scanned for Logical Units (default 5). 2659 scanned for Logical Units (default 5).
2660 2660
2661 usb-storage.quirks= 2661 usb-storage.quirks=
2662 [UMS] A list of quirks entries to supplement or 2662 [UMS] A list of quirks entries to supplement or
2663 override the built-in unusual_devs list. List 2663 override the built-in unusual_devs list. List
2664 entries are separated by commas. Each entry has 2664 entries are separated by commas. Each entry has
2665 the form VID:PID:Flags where VID and PID are Vendor 2665 the form VID:PID:Flags where VID and PID are Vendor
2666 and Product ID values (4-digit hex numbers) and 2666 and Product ID values (4-digit hex numbers) and
2667 Flags is a set of characters, each corresponding 2667 Flags is a set of characters, each corresponding
2668 to a common usb-storage quirk flag as follows: 2668 to a common usb-storage quirk flag as follows:
2669 a = SANE_SENSE (collect more than 18 bytes 2669 a = SANE_SENSE (collect more than 18 bytes
2670 of sense data); 2670 of sense data);
2671 b = BAD_SENSE (don't collect more than 18 2671 b = BAD_SENSE (don't collect more than 18
2672 bytes of sense data); 2672 bytes of sense data);
2673 c = FIX_CAPACITY (decrease the reported 2673 c = FIX_CAPACITY (decrease the reported
2674 device capacity by one sector); 2674 device capacity by one sector);
2675 h = CAPACITY_HEURISTICS (decrease the 2675 h = CAPACITY_HEURISTICS (decrease the
2676 reported device capacity by one 2676 reported device capacity by one
2677 sector if the number is odd); 2677 sector if the number is odd);
2678 i = IGNORE_DEVICE (don't bind to this 2678 i = IGNORE_DEVICE (don't bind to this
2679 device); 2679 device);
2680 l = NOT_LOCKABLE (don't try to lock and 2680 l = NOT_LOCKABLE (don't try to lock and
2681 unlock ejectable media); 2681 unlock ejectable media);
2682 m = MAX_SECTORS_64 (don't transfer more 2682 m = MAX_SECTORS_64 (don't transfer more
2683 than 64 sectors = 32 KB at a time); 2683 than 64 sectors = 32 KB at a time);
2684 o = CAPACITY_OK (accept the capacity 2684 o = CAPACITY_OK (accept the capacity
2685 reported by the device); 2685 reported by the device);
2686 r = IGNORE_RESIDUE (the device reports 2686 r = IGNORE_RESIDUE (the device reports
2687 bogus residue values); 2687 bogus residue values);
2688 s = SINGLE_LUN (the device has only one 2688 s = SINGLE_LUN (the device has only one
2689 Logical Unit); 2689 Logical Unit);
2690 w = NO_WP_DETECT (don't test whether the 2690 w = NO_WP_DETECT (don't test whether the
2691 medium is write-protected). 2691 medium is write-protected).
2692 Example: quirks=0419:aaf5:rl,0421:0433:rc 2692 Example: quirks=0419:aaf5:rl,0421:0433:rc
2693 2693
2694 vdso= [X86,SH] 2694 vdso= [X86,SH]
2695 vdso=2: enable compat VDSO (default with COMPAT_VDSO) 2695 vdso=2: enable compat VDSO (default with COMPAT_VDSO)
2696 vdso=1: enable VDSO (default) 2696 vdso=1: enable VDSO (default)
2697 vdso=0: disable VDSO mapping 2697 vdso=0: disable VDSO mapping
2698 2698
2699 vdso32= [X86] 2699 vdso32= [X86]
2700 vdso32=2: enable compat VDSO (default with COMPAT_VDSO) 2700 vdso32=2: enable compat VDSO (default with COMPAT_VDSO)
2701 vdso32=1: enable 32-bit VDSO (default) 2701 vdso32=1: enable 32-bit VDSO (default)
2702 vdso32=0: disable 32-bit VDSO mapping 2702 vdso32=0: disable 32-bit VDSO mapping
2703 2703
2704 vector= [IA-64,SMP] 2704 vector= [IA-64,SMP]
2705 vector=percpu: enable percpu vector domain 2705 vector=percpu: enable percpu vector domain
2706 2706
2707 video= [FB] Frame buffer configuration 2707 video= [FB] Frame buffer configuration
2708 See Documentation/fb/modedb.txt. 2708 See Documentation/fb/modedb.txt.
2709 2709
2710 vga= [BOOT,X86-32] Select a particular video mode 2710 vga= [BOOT,X86-32] Select a particular video mode
2711 See Documentation/x86/boot.txt and 2711 See Documentation/x86/boot.txt and
2712 Documentation/svga.txt. 2712 Documentation/svga.txt.
2713 Use vga=ask for menu. 2713 Use vga=ask for menu.
2714 This is actually a boot loader parameter; the value is 2714 This is actually a boot loader parameter; the value is
2715 passed to the kernel using a special protocol. 2715 passed to the kernel using a special protocol.
2716 2716
2717 vmalloc=nn[KMG] [KNL,BOOT] Forces the vmalloc area to have an exact 2717 vmalloc=nn[KMG] [KNL,BOOT] Forces the vmalloc area to have an exact
2718 size of <nn>. This can be used to increase the 2718 size of <nn>. This can be used to increase the
2719 minimum size (128MB on x86). It can also be used to 2719 minimum size (128MB on x86). It can also be used to
2720 decrease the size and leave more room for directly 2720 decrease the size and leave more room for directly
2721 mapped kernel RAM. 2721 mapped kernel RAM.
2722 2722
2723 vmhalt= [KNL,S390] Perform z/VM CP command after system halt. 2723 vmhalt= [KNL,S390] Perform z/VM CP command after system halt.
2724 Format: <command> 2724 Format: <command>
2725 2725
2726 vmpanic= [KNL,S390] Perform z/VM CP command after kernel panic. 2726 vmpanic= [KNL,S390] Perform z/VM CP command after kernel panic.
2727 Format: <command> 2727 Format: <command>
2728 2728
2729 vmpoff= [KNL,S390] Perform z/VM CP command after power off. 2729 vmpoff= [KNL,S390] Perform z/VM CP command after power off.
2730 Format: <command> 2730 Format: <command>
2731 2731
2732 vt.cur_default= [VT] Default cursor shape.
2733 Format: 0xCCBBAA, where AA, BB, and CC are the same as
2734 the parameters of the <Esc>[?A;B;Cc escape sequence;
2735 see VGA-softcursor.txt. Default: 2 = underline.
2736
2732 vt.default_blu= [VT] 2737 vt.default_blu= [VT]
2733 Format: <blue0>,<blue1>,<blue2>,...,<blue15> 2738 Format: <blue0>,<blue1>,<blue2>,...,<blue15>
2734 Change the default blue palette of the console. 2739 Change the default blue palette of the console.
2735 This is a 16-member array composed of values 2740 This is a 16-member array composed of values
2736 ranging from 0-255. 2741 ranging from 0-255.
2737 2742
2738 vt.default_grn= [VT] 2743 vt.default_grn= [VT]
2739 Format: <green0>,<green1>,<green2>,...,<green15> 2744 Format: <green0>,<green1>,<green2>,...,<green15>
2740 Change the default green palette of the console. 2745 Change the default green palette of the console.
2741 This is a 16-member array composed of values 2746 This is a 16-member array composed of values
2742 ranging from 0-255. 2747 ranging from 0-255.
2743 2748
2744 vt.default_red= [VT] 2749 vt.default_red= [VT]
2745 Format: <red0>,<red1>,<red2>,...,<red15> 2750 Format: <red0>,<red1>,<red2>,...,<red15>
2746 Change the default red palette of the console. 2751 Change the default red palette of the console.
2747 This is a 16-member array composed of values 2752 This is a 16-member array composed of values
2748 ranging from 0-255. 2753 ranging from 0-255.
2749 2754
2750 vt.default_utf8= 2755 vt.default_utf8=
2751 [VT] 2756 [VT]
2752 Format=<0|1> 2757 Format=<0|1>
2753 Set system-wide default UTF-8 mode for all tty's. 2758 Set system-wide default UTF-8 mode for all tty's.
2754 Default is 1, i.e. UTF-8 mode is enabled for all 2759 Default is 1, i.e. UTF-8 mode is enabled for all
2755 newly opened terminals. 2760 newly opened terminals.
2756 2761
2757 vt.global_cursor_default= 2762 vt.global_cursor_default=
2758 [VT] 2763 [VT]
2759 Format=<-1|0|1> 2764 Format=<-1|0|1>
2760 Set system-wide default for whether a cursor 2765 Set system-wide default for whether a cursor
2761 is shown on new VTs. Default is -1, 2766 is shown on new VTs. Default is -1,
2762 i.e. cursors will be created by default unless 2767 i.e. cursors will be created by default unless
2763 overridden by individual drivers. 0 will hide 2768 overridden by individual drivers. 0 will hide
2764 cursors, 1 will display them. 2769 cursors, 1 will display them.
2765 2770
2766 waveartist= [HW,OSS] 2771 waveartist= [HW,OSS]
2767 Format: <io>,<irq>,<dma>,<dma2> 2772 Format: <io>,<irq>,<dma>,<dma2>
2768 2773
2769 wd33c93= [HW,SCSI] 2774 wd33c93= [HW,SCSI]
2770 See header of drivers/scsi/wd33c93.c. 2775 See header of drivers/scsi/wd33c93.c.
2771 2776
2772 wd7000= [HW,SCSI] 2777 wd7000= [HW,SCSI]
2773 See header of drivers/scsi/wd7000.c. 2778 See header of drivers/scsi/wd7000.c.
2774 2779
2775 wdt= [WDT] Watchdog 2780 wdt= [WDT] Watchdog
2776 See Documentation/watchdog/wdt.txt. 2781 See Documentation/watchdog/wdt.txt.
2777 2782
2778 x2apic_phys [X86-64,APIC] Use x2apic physical mode instead of 2783 x2apic_phys [X86-64,APIC] Use x2apic physical mode instead of
2779 default x2apic cluster mode on platforms 2784 default x2apic cluster mode on platforms
2780 supporting x2apic. 2785 supporting x2apic.
2781 2786
2782 xd= [HW,XT] Original XT pre-IDE (RLL encoded) disks. 2787 xd= [HW,XT] Original XT pre-IDE (RLL encoded) disks.
2783 xd_geo= See header of drivers/block/xd.c. 2788 xd_geo= See header of drivers/block/xd.c.
2784 2789
2785 xirc2ps_cs= [NET,PCMCIA] 2790 xirc2ps_cs= [NET,PCMCIA]
2786 Format: 2791 Format:
2787 <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]] 2792 <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
2788 2793
2789 ______________________________________________________________________ 2794 ______________________________________________________________________
2790 2795
2791 TODO: 2796 TODO:
2792 2797
2793 Add documentation for ALSA options. 2798 Add documentation for ALSA options.
2794 Add more DRM drivers. 2799 Add more DRM drivers.
2795 2800
1 /* 1 /*
2 * linux/drivers/char/vt.c 2 * linux/drivers/char/vt.c
3 * 3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds 4 * Copyright (C) 1991, 1992 Linus Torvalds
5 */ 5 */
6 6
7 /* 7 /*
8 * Hopefully this will be a rather complete VT102 implementation. 8 * Hopefully this will be a rather complete VT102 implementation.
9 * 9 *
10 * Beeping thanks to John T Kohl. 10 * Beeping thanks to John T Kohl.
11 * 11 *
12 * Virtual Consoles, Screen Blanking, Screen Dumping, Color, Graphics 12 * Virtual Consoles, Screen Blanking, Screen Dumping, Color, Graphics
13 * Chars, and VT100 enhancements by Peter MacDonald. 13 * Chars, and VT100 enhancements by Peter MacDonald.
14 * 14 *
15 * Copy and paste function by Andrew Haylett, 15 * Copy and paste function by Andrew Haylett,
16 * some enhancements by Alessandro Rubini. 16 * some enhancements by Alessandro Rubini.
17 * 17 *
18 * Code to check for different video-cards mostly by Galen Hunt, 18 * Code to check for different video-cards mostly by Galen Hunt,
19 * <g-hunt@ee.utah.edu> 19 * <g-hunt@ee.utah.edu>
20 * 20 *
21 * Rudimentary ISO 10646/Unicode/UTF-8 character set support by 21 * Rudimentary ISO 10646/Unicode/UTF-8 character set support by
22 * Markus Kuhn, <mskuhn@immd4.informatik.uni-erlangen.de>. 22 * Markus Kuhn, <mskuhn@immd4.informatik.uni-erlangen.de>.
23 * 23 *
24 * Dynamic allocation of consoles, aeb@cwi.nl, May 1994 24 * Dynamic allocation of consoles, aeb@cwi.nl, May 1994
25 * Resizing of consoles, aeb, 940926 25 * Resizing of consoles, aeb, 940926
26 * 26 *
27 * Code for xterm like mouse click reporting by Peter Orbaek 20-Jul-94 27 * Code for xterm like mouse click reporting by Peter Orbaek 20-Jul-94
28 * <poe@daimi.aau.dk> 28 * <poe@daimi.aau.dk>
29 * 29 *
30 * User-defined bell sound, new setterm control sequences and printk 30 * User-defined bell sound, new setterm control sequences and printk
31 * redirection by Martin Mares <mj@k332.feld.cvut.cz> 19-Nov-95 31 * redirection by Martin Mares <mj@k332.feld.cvut.cz> 19-Nov-95
32 * 32 *
33 * APM screenblank bug fixed Takashi Manabe <manabe@roy.dsl.tutics.tut.jp> 33 * APM screenblank bug fixed Takashi Manabe <manabe@roy.dsl.tutics.tut.jp>
34 * 34 *
35 * Merge with the abstract console driver by Geert Uytterhoeven 35 * Merge with the abstract console driver by Geert Uytterhoeven
36 * <geert@linux-m68k.org>, Jan 1997. 36 * <geert@linux-m68k.org>, Jan 1997.
37 * 37 *
38 * Original m68k console driver modifications by 38 * Original m68k console driver modifications by
39 * 39 *
40 * - Arno Griffioen <arno@usn.nl> 40 * - Arno Griffioen <arno@usn.nl>
41 * - David Carter <carter@cs.bris.ac.uk> 41 * - David Carter <carter@cs.bris.ac.uk>
42 * 42 *
43 * The abstract console driver provides a generic interface for a text 43 * The abstract console driver provides a generic interface for a text
44 * console. It supports VGA text mode, frame buffer based graphical consoles 44 * console. It supports VGA text mode, frame buffer based graphical consoles
45 * and special graphics processors that are only accessible through some 45 * and special graphics processors that are only accessible through some
46 * registers (e.g. a TMS340x0 GSP). 46 * registers (e.g. a TMS340x0 GSP).
47 * 47 *
48 * The interface to the hardware is specified using a special structure 48 * The interface to the hardware is specified using a special structure
49 * (struct consw) which contains function pointers to console operations 49 * (struct consw) which contains function pointers to console operations
50 * (see <linux/console.h> for more information). 50 * (see <linux/console.h> for more information).
51 * 51 *
52 * Support for changeable cursor shape 52 * Support for changeable cursor shape
53 * by Pavel Machek <pavel@atrey.karlin.mff.cuni.cz>, August 1997 53 * by Pavel Machek <pavel@atrey.karlin.mff.cuni.cz>, August 1997
54 * 54 *
55 * Ported to i386 and con_scrolldelta fixed 55 * Ported to i386 and con_scrolldelta fixed
56 * by Emmanuel Marty <core@ggi-project.org>, April 1998 56 * by Emmanuel Marty <core@ggi-project.org>, April 1998
57 * 57 *
58 * Resurrected character buffers in videoram plus lots of other trickery 58 * Resurrected character buffers in videoram plus lots of other trickery
59 * by Martin Mares <mj@atrey.karlin.mff.cuni.cz>, July 1998 59 * by Martin Mares <mj@atrey.karlin.mff.cuni.cz>, July 1998
60 * 60 *
61 * Removed old-style timers, introduced console_timer, made timer 61 * Removed old-style timers, introduced console_timer, made timer
62 * deletion SMP-safe. 17Jun00, Andrew Morton 62 * deletion SMP-safe. 17Jun00, Andrew Morton
63 * 63 *
64 * Removed console_lock, enabled interrupts across all console operations 64 * Removed console_lock, enabled interrupts across all console operations
65 * 13 March 2001, Andrew Morton 65 * 13 March 2001, Andrew Morton
66 * 66 *
67 * Fixed UTF-8 mode so alternate charset modes always work according 67 * Fixed UTF-8 mode so alternate charset modes always work according
68 * to control sequences interpreted in do_con_trol function 68 * to control sequences interpreted in do_con_trol function
69 * preserving backward VT100 semigraphics compatibility, 69 * preserving backward VT100 semigraphics compatibility,
70 * malformed UTF sequences represented as sequences of replacement glyphs, 70 * malformed UTF sequences represented as sequences of replacement glyphs,
71 * original codes or '?' as a last resort if replacement glyph is undefined 71 * original codes or '?' as a last resort if replacement glyph is undefined
72 * by Adam Tla/lka <atlka@pg.gda.pl>, Aug 2006 72 * by Adam Tla/lka <atlka@pg.gda.pl>, Aug 2006
73 */ 73 */
74 74
75 #include <linux/module.h> 75 #include <linux/module.h>
76 #include <linux/types.h> 76 #include <linux/types.h>
77 #include <linux/sched.h> 77 #include <linux/sched.h>
78 #include <linux/tty.h> 78 #include <linux/tty.h>
79 #include <linux/tty_flip.h> 79 #include <linux/tty_flip.h>
80 #include <linux/kernel.h> 80 #include <linux/kernel.h>
81 #include <linux/string.h> 81 #include <linux/string.h>
82 #include <linux/errno.h> 82 #include <linux/errno.h>
83 #include <linux/kd.h> 83 #include <linux/kd.h>
84 #include <linux/slab.h> 84 #include <linux/slab.h>
85 #include <linux/major.h> 85 #include <linux/major.h>
86 #include <linux/mm.h> 86 #include <linux/mm.h>
87 #include <linux/console.h> 87 #include <linux/console.h>
88 #include <linux/init.h> 88 #include <linux/init.h>
89 #include <linux/mutex.h> 89 #include <linux/mutex.h>
90 #include <linux/vt_kern.h> 90 #include <linux/vt_kern.h>
91 #include <linux/selection.h> 91 #include <linux/selection.h>
92 #include <linux/smp_lock.h> 92 #include <linux/smp_lock.h>
93 #include <linux/tiocl.h> 93 #include <linux/tiocl.h>
94 #include <linux/kbd_kern.h> 94 #include <linux/kbd_kern.h>
95 #include <linux/consolemap.h> 95 #include <linux/consolemap.h>
96 #include <linux/timer.h> 96 #include <linux/timer.h>
97 #include <linux/interrupt.h> 97 #include <linux/interrupt.h>
98 #include <linux/workqueue.h> 98 #include <linux/workqueue.h>
99 #include <linux/pm.h> 99 #include <linux/pm.h>
100 #include <linux/font.h> 100 #include <linux/font.h>
101 #include <linux/bitops.h> 101 #include <linux/bitops.h>
102 #include <linux/notifier.h> 102 #include <linux/notifier.h>
103 #include <linux/device.h> 103 #include <linux/device.h>
104 #include <linux/io.h> 104 #include <linux/io.h>
105 #include <asm/system.h> 105 #include <asm/system.h>
106 #include <linux/uaccess.h> 106 #include <linux/uaccess.h>
107 107
108 #define MAX_NR_CON_DRIVER 16 108 #define MAX_NR_CON_DRIVER 16
109 109
110 #define CON_DRIVER_FLAG_MODULE 1 110 #define CON_DRIVER_FLAG_MODULE 1
111 #define CON_DRIVER_FLAG_INIT 2 111 #define CON_DRIVER_FLAG_INIT 2
112 #define CON_DRIVER_FLAG_ATTR 4 112 #define CON_DRIVER_FLAG_ATTR 4
113 113
114 struct con_driver { 114 struct con_driver {
115 const struct consw *con; 115 const struct consw *con;
116 const char *desc; 116 const char *desc;
117 struct device *dev; 117 struct device *dev;
118 int node; 118 int node;
119 int first; 119 int first;
120 int last; 120 int last;
121 int flag; 121 int flag;
122 }; 122 };
123 123
124 static struct con_driver registered_con_driver[MAX_NR_CON_DRIVER]; 124 static struct con_driver registered_con_driver[MAX_NR_CON_DRIVER];
125 const struct consw *conswitchp; 125 const struct consw *conswitchp;
126 126
127 /* A bitmap for codes <32. A bit of 1 indicates that the code 127 /* A bitmap for codes <32. A bit of 1 indicates that the code
128 * corresponding to that bit number invokes some special action 128 * corresponding to that bit number invokes some special action
129 * (such as cursor movement) and should not be displayed as a 129 * (such as cursor movement) and should not be displayed as a
130 * glyph unless the disp_ctrl mode is explicitly enabled. 130 * glyph unless the disp_ctrl mode is explicitly enabled.
131 */ 131 */
132 #define CTRL_ACTION 0x0d00ff81 132 #define CTRL_ACTION 0x0d00ff81
133 #define CTRL_ALWAYS 0x0800f501 /* Cannot be overridden by disp_ctrl */ 133 #define CTRL_ALWAYS 0x0800f501 /* Cannot be overridden by disp_ctrl */
134 134
135 /* 135 /*
136 * Here is the default bell parameters: 750HZ, 1/8th of a second 136 * Here is the default bell parameters: 750HZ, 1/8th of a second
137 */ 137 */
138 #define DEFAULT_BELL_PITCH 750 138 #define DEFAULT_BELL_PITCH 750
139 #define DEFAULT_BELL_DURATION (HZ/8) 139 #define DEFAULT_BELL_DURATION (HZ/8)
140 140
141 struct vc vc_cons [MAX_NR_CONSOLES]; 141 struct vc vc_cons [MAX_NR_CONSOLES];
142 142
143 #ifndef VT_SINGLE_DRIVER 143 #ifndef VT_SINGLE_DRIVER
144 static const struct consw *con_driver_map[MAX_NR_CONSOLES]; 144 static const struct consw *con_driver_map[MAX_NR_CONSOLES];
145 #endif 145 #endif
146 146
147 static int con_open(struct tty_struct *, struct file *); 147 static int con_open(struct tty_struct *, struct file *);
148 static void vc_init(struct vc_data *vc, unsigned int rows, 148 static void vc_init(struct vc_data *vc, unsigned int rows,
149 unsigned int cols, int do_clear); 149 unsigned int cols, int do_clear);
150 static void gotoxy(struct vc_data *vc, int new_x, int new_y); 150 static void gotoxy(struct vc_data *vc, int new_x, int new_y);
151 static void save_cur(struct vc_data *vc); 151 static void save_cur(struct vc_data *vc);
152 static void reset_terminal(struct vc_data *vc, int do_clear); 152 static void reset_terminal(struct vc_data *vc, int do_clear);
153 static void con_flush_chars(struct tty_struct *tty); 153 static void con_flush_chars(struct tty_struct *tty);
154 static int set_vesa_blanking(char __user *p); 154 static int set_vesa_blanking(char __user *p);
155 static void set_cursor(struct vc_data *vc); 155 static void set_cursor(struct vc_data *vc);
156 static void hide_cursor(struct vc_data *vc); 156 static void hide_cursor(struct vc_data *vc);
157 static void console_callback(struct work_struct *ignored); 157 static void console_callback(struct work_struct *ignored);
158 static void blank_screen_t(unsigned long dummy); 158 static void blank_screen_t(unsigned long dummy);
159 static void set_palette(struct vc_data *vc); 159 static void set_palette(struct vc_data *vc);
160 160
161 static int printable; /* Is console ready for printing? */ 161 static int printable; /* Is console ready for printing? */
162 int default_utf8 = true; 162 int default_utf8 = true;
163 module_param(default_utf8, int, S_IRUGO | S_IWUSR); 163 module_param(default_utf8, int, S_IRUGO | S_IWUSR);
164 int global_cursor_default = -1; 164 int global_cursor_default = -1;
165 module_param(global_cursor_default, int, S_IRUGO | S_IWUSR); 165 module_param(global_cursor_default, int, S_IRUGO | S_IWUSR);
166 166
167 static int cur_default = CUR_DEFAULT;
168 module_param(cur_default, int, S_IRUGO | S_IWUSR);
169
167 /* 170 /*
168 * ignore_poke: don't unblank the screen when things are typed. This is 171 * ignore_poke: don't unblank the screen when things are typed. This is
169 * mainly for the privacy of braille terminal users. 172 * mainly for the privacy of braille terminal users.
170 */ 173 */
171 static int ignore_poke; 174 static int ignore_poke;
172 175
173 int do_poke_blanked_console; 176 int do_poke_blanked_console;
174 int console_blanked; 177 int console_blanked;
175 178
176 static int vesa_blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */ 179 static int vesa_blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */
177 static int vesa_off_interval; 180 static int vesa_off_interval;
178 static int blankinterval = 10*60; 181 static int blankinterval = 10*60;
179 core_param(consoleblank, blankinterval, int, 0444); 182 core_param(consoleblank, blankinterval, int, 0444);
180 183
181 static DECLARE_WORK(console_work, console_callback); 184 static DECLARE_WORK(console_work, console_callback);
182 185
183 /* 186 /*
184 * fg_console is the current virtual console, 187 * fg_console is the current virtual console,
185 * last_console is the last used one, 188 * last_console is the last used one,
186 * want_console is the console we want to switch to, 189 * want_console is the console we want to switch to,
187 */ 190 */
188 int fg_console; 191 int fg_console;
189 int last_console; 192 int last_console;
190 int want_console = -1; 193 int want_console = -1;
191 194
192 /* 195 /*
193 * For each existing display, we have a pointer to console currently visible 196 * For each existing display, we have a pointer to console currently visible
194 * on that display, allowing consoles other than fg_console to be refreshed 197 * on that display, allowing consoles other than fg_console to be refreshed
195 * appropriately. Unless the low-level driver supplies its own display_fg 198 * appropriately. Unless the low-level driver supplies its own display_fg
196 * variable, we use this one for the "master display". 199 * variable, we use this one for the "master display".
197 */ 200 */
198 static struct vc_data *master_display_fg; 201 static struct vc_data *master_display_fg;
199 202
200 /* 203 /*
201 * Unfortunately, we need to delay tty echo when we're currently writing to the 204 * Unfortunately, we need to delay tty echo when we're currently writing to the
202 * console since the code is (and always was) not re-entrant, so we schedule 205 * console since the code is (and always was) not re-entrant, so we schedule
203 * all flip requests to process context with schedule-task() and run it from 206 * all flip requests to process context with schedule-task() and run it from
204 * console_callback(). 207 * console_callback().
205 */ 208 */
206 209
207 /* 210 /*
208 * For the same reason, we defer scrollback to the console callback. 211 * For the same reason, we defer scrollback to the console callback.
209 */ 212 */
210 static int scrollback_delta; 213 static int scrollback_delta;
211 214
212 /* 215 /*
213 * Hook so that the power management routines can (un)blank 216 * Hook so that the power management routines can (un)blank
214 * the console on our behalf. 217 * the console on our behalf.
215 */ 218 */
216 int (*console_blank_hook)(int); 219 int (*console_blank_hook)(int);
217 220
218 static DEFINE_TIMER(console_timer, blank_screen_t, 0, 0); 221 static DEFINE_TIMER(console_timer, blank_screen_t, 0, 0);
219 static int blank_state; 222 static int blank_state;
220 static int blank_timer_expired; 223 static int blank_timer_expired;
221 enum { 224 enum {
222 blank_off = 0, 225 blank_off = 0,
223 blank_normal_wait, 226 blank_normal_wait,
224 blank_vesa_wait, 227 blank_vesa_wait,
225 }; 228 };
226 229
227 /* 230 /*
228 * Notifier list for console events. 231 * Notifier list for console events.
229 */ 232 */
230 static ATOMIC_NOTIFIER_HEAD(vt_notifier_list); 233 static ATOMIC_NOTIFIER_HEAD(vt_notifier_list);
231 234
232 int register_vt_notifier(struct notifier_block *nb) 235 int register_vt_notifier(struct notifier_block *nb)
233 { 236 {
234 return atomic_notifier_chain_register(&vt_notifier_list, nb); 237 return atomic_notifier_chain_register(&vt_notifier_list, nb);
235 } 238 }
236 EXPORT_SYMBOL_GPL(register_vt_notifier); 239 EXPORT_SYMBOL_GPL(register_vt_notifier);
237 240
238 int unregister_vt_notifier(struct notifier_block *nb) 241 int unregister_vt_notifier(struct notifier_block *nb)
239 { 242 {
240 return atomic_notifier_chain_unregister(&vt_notifier_list, nb); 243 return atomic_notifier_chain_unregister(&vt_notifier_list, nb);
241 } 244 }
242 EXPORT_SYMBOL_GPL(unregister_vt_notifier); 245 EXPORT_SYMBOL_GPL(unregister_vt_notifier);
243 246
244 static void notify_write(struct vc_data *vc, unsigned int unicode) 247 static void notify_write(struct vc_data *vc, unsigned int unicode)
245 { 248 {
246 struct vt_notifier_param param = { .vc = vc, unicode = unicode }; 249 struct vt_notifier_param param = { .vc = vc, unicode = unicode };
247 atomic_notifier_call_chain(&vt_notifier_list, VT_WRITE, &param); 250 atomic_notifier_call_chain(&vt_notifier_list, VT_WRITE, &param);
248 } 251 }
249 252
250 static void notify_update(struct vc_data *vc) 253 static void notify_update(struct vc_data *vc)
251 { 254 {
252 struct vt_notifier_param param = { .vc = vc }; 255 struct vt_notifier_param param = { .vc = vc };
253 atomic_notifier_call_chain(&vt_notifier_list, VT_UPDATE, &param); 256 atomic_notifier_call_chain(&vt_notifier_list, VT_UPDATE, &param);
254 } 257 }
255 /* 258 /*
256 * Low-Level Functions 259 * Low-Level Functions
257 */ 260 */
258 261
259 #define IS_FG(vc) ((vc)->vc_num == fg_console) 262 #define IS_FG(vc) ((vc)->vc_num == fg_console)
260 263
261 #ifdef VT_BUF_VRAM_ONLY 264 #ifdef VT_BUF_VRAM_ONLY
262 #define DO_UPDATE(vc) 0 265 #define DO_UPDATE(vc) 0
263 #else 266 #else
264 #define DO_UPDATE(vc) (CON_IS_VISIBLE(vc) && !console_blanked) 267 #define DO_UPDATE(vc) (CON_IS_VISIBLE(vc) && !console_blanked)
265 #endif 268 #endif
266 269
267 static inline unsigned short *screenpos(struct vc_data *vc, int offset, int viewed) 270 static inline unsigned short *screenpos(struct vc_data *vc, int offset, int viewed)
268 { 271 {
269 unsigned short *p; 272 unsigned short *p;
270 273
271 if (!viewed) 274 if (!viewed)
272 p = (unsigned short *)(vc->vc_origin + offset); 275 p = (unsigned short *)(vc->vc_origin + offset);
273 else if (!vc->vc_sw->con_screen_pos) 276 else if (!vc->vc_sw->con_screen_pos)
274 p = (unsigned short *)(vc->vc_visible_origin + offset); 277 p = (unsigned short *)(vc->vc_visible_origin + offset);
275 else 278 else
276 p = vc->vc_sw->con_screen_pos(vc, offset); 279 p = vc->vc_sw->con_screen_pos(vc, offset);
277 return p; 280 return p;
278 } 281 }
279 282
280 static inline void scrolldelta(int lines) 283 static inline void scrolldelta(int lines)
281 { 284 {
282 scrollback_delta += lines; 285 scrollback_delta += lines;
283 schedule_console_callback(); 286 schedule_console_callback();
284 } 287 }
285 288
286 void schedule_console_callback(void) 289 void schedule_console_callback(void)
287 { 290 {
288 schedule_work(&console_work); 291 schedule_work(&console_work);
289 } 292 }
290 293
291 static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr) 294 static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
292 { 295 {
293 unsigned short *d, *s; 296 unsigned short *d, *s;
294 297
295 if (t+nr >= b) 298 if (t+nr >= b)
296 nr = b - t - 1; 299 nr = b - t - 1;
297 if (b > vc->vc_rows || t >= b || nr < 1) 300 if (b > vc->vc_rows || t >= b || nr < 1)
298 return; 301 return;
299 if (CON_IS_VISIBLE(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_UP, nr)) 302 if (CON_IS_VISIBLE(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_UP, nr))
300 return; 303 return;
301 d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); 304 d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t);
302 s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr)); 305 s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr));
303 scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row); 306 scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row);
304 scr_memsetw(d + (b - t - nr) * vc->vc_cols, vc->vc_video_erase_char, 307 scr_memsetw(d + (b - t - nr) * vc->vc_cols, vc->vc_video_erase_char,
305 vc->vc_size_row * nr); 308 vc->vc_size_row * nr);
306 } 309 }
307 310
308 static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b, int nr) 311 static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
309 { 312 {
310 unsigned short *s; 313 unsigned short *s;
311 unsigned int step; 314 unsigned int step;
312 315
313 if (t+nr >= b) 316 if (t+nr >= b)
314 nr = b - t - 1; 317 nr = b - t - 1;
315 if (b > vc->vc_rows || t >= b || nr < 1) 318 if (b > vc->vc_rows || t >= b || nr < 1)
316 return; 319 return;
317 if (CON_IS_VISIBLE(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_DOWN, nr)) 320 if (CON_IS_VISIBLE(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_DOWN, nr))
318 return; 321 return;
319 s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); 322 s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t);
320 step = vc->vc_cols * nr; 323 step = vc->vc_cols * nr;
321 scr_memmovew(s + step, s, (b - t - nr) * vc->vc_size_row); 324 scr_memmovew(s + step, s, (b - t - nr) * vc->vc_size_row);
322 scr_memsetw(s, vc->vc_video_erase_char, 2 * step); 325 scr_memsetw(s, vc->vc_video_erase_char, 2 * step);
323 } 326 }
324 327
325 static void do_update_region(struct vc_data *vc, unsigned long start, int count) 328 static void do_update_region(struct vc_data *vc, unsigned long start, int count)
326 { 329 {
327 #ifndef VT_BUF_VRAM_ONLY 330 #ifndef VT_BUF_VRAM_ONLY
328 unsigned int xx, yy, offset; 331 unsigned int xx, yy, offset;
329 u16 *p; 332 u16 *p;
330 333
331 p = (u16 *) start; 334 p = (u16 *) start;
332 if (!vc->vc_sw->con_getxy) { 335 if (!vc->vc_sw->con_getxy) {
333 offset = (start - vc->vc_origin) / 2; 336 offset = (start - vc->vc_origin) / 2;
334 xx = offset % vc->vc_cols; 337 xx = offset % vc->vc_cols;
335 yy = offset / vc->vc_cols; 338 yy = offset / vc->vc_cols;
336 } else { 339 } else {
337 int nxx, nyy; 340 int nxx, nyy;
338 start = vc->vc_sw->con_getxy(vc, start, &nxx, &nyy); 341 start = vc->vc_sw->con_getxy(vc, start, &nxx, &nyy);
339 xx = nxx; yy = nyy; 342 xx = nxx; yy = nyy;
340 } 343 }
341 for(;;) { 344 for(;;) {
342 u16 attrib = scr_readw(p) & 0xff00; 345 u16 attrib = scr_readw(p) & 0xff00;
343 int startx = xx; 346 int startx = xx;
344 u16 *q = p; 347 u16 *q = p;
345 while (xx < vc->vc_cols && count) { 348 while (xx < vc->vc_cols && count) {
346 if (attrib != (scr_readw(p) & 0xff00)) { 349 if (attrib != (scr_readw(p) & 0xff00)) {
347 if (p > q) 350 if (p > q)
348 vc->vc_sw->con_putcs(vc, q, p-q, yy, startx); 351 vc->vc_sw->con_putcs(vc, q, p-q, yy, startx);
349 startx = xx; 352 startx = xx;
350 q = p; 353 q = p;
351 attrib = scr_readw(p) & 0xff00; 354 attrib = scr_readw(p) & 0xff00;
352 } 355 }
353 p++; 356 p++;
354 xx++; 357 xx++;
355 count--; 358 count--;
356 } 359 }
357 if (p > q) 360 if (p > q)
358 vc->vc_sw->con_putcs(vc, q, p-q, yy, startx); 361 vc->vc_sw->con_putcs(vc, q, p-q, yy, startx);
359 if (!count) 362 if (!count)
360 break; 363 break;
361 xx = 0; 364 xx = 0;
362 yy++; 365 yy++;
363 if (vc->vc_sw->con_getxy) { 366 if (vc->vc_sw->con_getxy) {
364 p = (u16 *)start; 367 p = (u16 *)start;
365 start = vc->vc_sw->con_getxy(vc, start, NULL, NULL); 368 start = vc->vc_sw->con_getxy(vc, start, NULL, NULL);
366 } 369 }
367 } 370 }
368 #endif 371 #endif
369 } 372 }
370 373
371 void update_region(struct vc_data *vc, unsigned long start, int count) 374 void update_region(struct vc_data *vc, unsigned long start, int count)
372 { 375 {
373 WARN_CONSOLE_UNLOCKED(); 376 WARN_CONSOLE_UNLOCKED();
374 377
375 if (DO_UPDATE(vc)) { 378 if (DO_UPDATE(vc)) {
376 hide_cursor(vc); 379 hide_cursor(vc);
377 do_update_region(vc, start, count); 380 do_update_region(vc, start, count);
378 set_cursor(vc); 381 set_cursor(vc);
379 } 382 }
380 } 383 }
381 384
382 /* Structure of attributes is hardware-dependent */ 385 /* Structure of attributes is hardware-dependent */
383 386
384 static u8 build_attr(struct vc_data *vc, u8 _color, u8 _intensity, u8 _blink, 387 static u8 build_attr(struct vc_data *vc, u8 _color, u8 _intensity, u8 _blink,
385 u8 _underline, u8 _reverse, u8 _italic) 388 u8 _underline, u8 _reverse, u8 _italic)
386 { 389 {
387 if (vc->vc_sw->con_build_attr) 390 if (vc->vc_sw->con_build_attr)
388 return vc->vc_sw->con_build_attr(vc, _color, _intensity, 391 return vc->vc_sw->con_build_attr(vc, _color, _intensity,
389 _blink, _underline, _reverse, _italic); 392 _blink, _underline, _reverse, _italic);
390 393
391 #ifndef VT_BUF_VRAM_ONLY 394 #ifndef VT_BUF_VRAM_ONLY
392 /* 395 /*
393 * ++roman: I completely changed the attribute format for monochrome 396 * ++roman: I completely changed the attribute format for monochrome
394 * mode (!can_do_color). The formerly used MDA (monochrome display 397 * mode (!can_do_color). The formerly used MDA (monochrome display
395 * adapter) format didn't allow the combination of certain effects. 398 * adapter) format didn't allow the combination of certain effects.
396 * Now the attribute is just a bit vector: 399 * Now the attribute is just a bit vector:
397 * Bit 0..1: intensity (0..2) 400 * Bit 0..1: intensity (0..2)
398 * Bit 2 : underline 401 * Bit 2 : underline
399 * Bit 3 : reverse 402 * Bit 3 : reverse
400 * Bit 7 : blink 403 * Bit 7 : blink
401 */ 404 */
402 { 405 {
403 u8 a = _color; 406 u8 a = _color;
404 if (!vc->vc_can_do_color) 407 if (!vc->vc_can_do_color)
405 return _intensity | 408 return _intensity |
406 (_italic ? 2 : 0) | 409 (_italic ? 2 : 0) |
407 (_underline ? 4 : 0) | 410 (_underline ? 4 : 0) |
408 (_reverse ? 8 : 0) | 411 (_reverse ? 8 : 0) |
409 (_blink ? 0x80 : 0); 412 (_blink ? 0x80 : 0);
410 if (_italic) 413 if (_italic)
411 a = (a & 0xF0) | vc->vc_itcolor; 414 a = (a & 0xF0) | vc->vc_itcolor;
412 else if (_underline) 415 else if (_underline)
413 a = (a & 0xf0) | vc->vc_ulcolor; 416 a = (a & 0xf0) | vc->vc_ulcolor;
414 else if (_intensity == 0) 417 else if (_intensity == 0)
415 a = (a & 0xf0) | vc->vc_ulcolor; 418 a = (a & 0xf0) | vc->vc_ulcolor;
416 if (_reverse) 419 if (_reverse)
417 a = ((a) & 0x88) | ((((a) >> 4) | ((a) << 4)) & 0x77); 420 a = ((a) & 0x88) | ((((a) >> 4) | ((a) << 4)) & 0x77);
418 if (_blink) 421 if (_blink)
419 a ^= 0x80; 422 a ^= 0x80;
420 if (_intensity == 2) 423 if (_intensity == 2)
421 a ^= 0x08; 424 a ^= 0x08;
422 if (vc->vc_hi_font_mask == 0x100) 425 if (vc->vc_hi_font_mask == 0x100)
423 a <<= 1; 426 a <<= 1;
424 return a; 427 return a;
425 } 428 }
426 #else 429 #else
427 return 0; 430 return 0;
428 #endif 431 #endif
429 } 432 }
430 433
431 static void update_attr(struct vc_data *vc) 434 static void update_attr(struct vc_data *vc)
432 { 435 {
433 vc->vc_attr = build_attr(vc, vc->vc_color, vc->vc_intensity, 436 vc->vc_attr = build_attr(vc, vc->vc_color, vc->vc_intensity,
434 vc->vc_blink, vc->vc_underline, 437 vc->vc_blink, vc->vc_underline,
435 vc->vc_reverse ^ vc->vc_decscnm, vc->vc_italic); 438 vc->vc_reverse ^ vc->vc_decscnm, vc->vc_italic);
436 vc->vc_video_erase_char = (build_attr(vc, vc->vc_color, 1, vc->vc_blink, 0, vc->vc_decscnm, 0) << 8) | ' '; 439 vc->vc_video_erase_char = (build_attr(vc, vc->vc_color, 1, vc->vc_blink, 0, vc->vc_decscnm, 0) << 8) | ' ';
437 } 440 }
438 441
439 /* Note: inverting the screen twice should revert to the original state */ 442 /* Note: inverting the screen twice should revert to the original state */
440 void invert_screen(struct vc_data *vc, int offset, int count, int viewed) 443 void invert_screen(struct vc_data *vc, int offset, int count, int viewed)
441 { 444 {
442 unsigned short *p; 445 unsigned short *p;
443 446
444 WARN_CONSOLE_UNLOCKED(); 447 WARN_CONSOLE_UNLOCKED();
445 448
446 count /= 2; 449 count /= 2;
447 p = screenpos(vc, offset, viewed); 450 p = screenpos(vc, offset, viewed);
448 if (vc->vc_sw->con_invert_region) 451 if (vc->vc_sw->con_invert_region)
449 vc->vc_sw->con_invert_region(vc, p, count); 452 vc->vc_sw->con_invert_region(vc, p, count);
450 #ifndef VT_BUF_VRAM_ONLY 453 #ifndef VT_BUF_VRAM_ONLY
451 else { 454 else {
452 u16 *q = p; 455 u16 *q = p;
453 int cnt = count; 456 int cnt = count;
454 u16 a; 457 u16 a;
455 458
456 if (!vc->vc_can_do_color) { 459 if (!vc->vc_can_do_color) {
457 while (cnt--) { 460 while (cnt--) {
458 a = scr_readw(q); 461 a = scr_readw(q);
459 a ^= 0x0800; 462 a ^= 0x0800;
460 scr_writew(a, q); 463 scr_writew(a, q);
461 q++; 464 q++;
462 } 465 }
463 } else if (vc->vc_hi_font_mask == 0x100) { 466 } else if (vc->vc_hi_font_mask == 0x100) {
464 while (cnt--) { 467 while (cnt--) {
465 a = scr_readw(q); 468 a = scr_readw(q);
466 a = ((a) & 0x11ff) | (((a) & 0xe000) >> 4) | (((a) & 0x0e00) << 4); 469 a = ((a) & 0x11ff) | (((a) & 0xe000) >> 4) | (((a) & 0x0e00) << 4);
467 scr_writew(a, q); 470 scr_writew(a, q);
468 q++; 471 q++;
469 } 472 }
470 } else { 473 } else {
471 while (cnt--) { 474 while (cnt--) {
472 a = scr_readw(q); 475 a = scr_readw(q);
473 a = ((a) & 0x88ff) | (((a) & 0x7000) >> 4) | (((a) & 0x0700) << 4); 476 a = ((a) & 0x88ff) | (((a) & 0x7000) >> 4) | (((a) & 0x0700) << 4);
474 scr_writew(a, q); 477 scr_writew(a, q);
475 q++; 478 q++;
476 } 479 }
477 } 480 }
478 } 481 }
479 #endif 482 #endif
480 if (DO_UPDATE(vc)) 483 if (DO_UPDATE(vc))
481 do_update_region(vc, (unsigned long) p, count); 484 do_update_region(vc, (unsigned long) p, count);
482 } 485 }
483 486
484 /* used by selection: complement pointer position */ 487 /* used by selection: complement pointer position */
485 void complement_pos(struct vc_data *vc, int offset) 488 void complement_pos(struct vc_data *vc, int offset)
486 { 489 {
487 static int old_offset = -1; 490 static int old_offset = -1;
488 static unsigned short old; 491 static unsigned short old;
489 static unsigned short oldx, oldy; 492 static unsigned short oldx, oldy;
490 493
491 WARN_CONSOLE_UNLOCKED(); 494 WARN_CONSOLE_UNLOCKED();
492 495
493 if (old_offset != -1 && old_offset >= 0 && 496 if (old_offset != -1 && old_offset >= 0 &&
494 old_offset < vc->vc_screenbuf_size) { 497 old_offset < vc->vc_screenbuf_size) {
495 scr_writew(old, screenpos(vc, old_offset, 1)); 498 scr_writew(old, screenpos(vc, old_offset, 1));
496 if (DO_UPDATE(vc)) 499 if (DO_UPDATE(vc))
497 vc->vc_sw->con_putc(vc, old, oldy, oldx); 500 vc->vc_sw->con_putc(vc, old, oldy, oldx);
498 } 501 }
499 502
500 old_offset = offset; 503 old_offset = offset;
501 504
502 if (offset != -1 && offset >= 0 && 505 if (offset != -1 && offset >= 0 &&
503 offset < vc->vc_screenbuf_size) { 506 offset < vc->vc_screenbuf_size) {
504 unsigned short new; 507 unsigned short new;
505 unsigned short *p; 508 unsigned short *p;
506 p = screenpos(vc, offset, 1); 509 p = screenpos(vc, offset, 1);
507 old = scr_readw(p); 510 old = scr_readw(p);
508 new = old ^ vc->vc_complement_mask; 511 new = old ^ vc->vc_complement_mask;
509 scr_writew(new, p); 512 scr_writew(new, p);
510 if (DO_UPDATE(vc)) { 513 if (DO_UPDATE(vc)) {
511 oldx = (offset >> 1) % vc->vc_cols; 514 oldx = (offset >> 1) % vc->vc_cols;
512 oldy = (offset >> 1) / vc->vc_cols; 515 oldy = (offset >> 1) / vc->vc_cols;
513 vc->vc_sw->con_putc(vc, new, oldy, oldx); 516 vc->vc_sw->con_putc(vc, new, oldy, oldx);
514 } 517 }
515 } 518 }
516 519
517 } 520 }
518 521
519 static void insert_char(struct vc_data *vc, unsigned int nr) 522 static void insert_char(struct vc_data *vc, unsigned int nr)
520 { 523 {
521 unsigned short *p, *q = (unsigned short *)vc->vc_pos; 524 unsigned short *p, *q = (unsigned short *)vc->vc_pos;
522 525
523 p = q + vc->vc_cols - nr - vc->vc_x; 526 p = q + vc->vc_cols - nr - vc->vc_x;
524 while (--p >= q) 527 while (--p >= q)
525 scr_writew(scr_readw(p), p + nr); 528 scr_writew(scr_readw(p), p + nr);
526 scr_memsetw(q, vc->vc_video_erase_char, nr * 2); 529 scr_memsetw(q, vc->vc_video_erase_char, nr * 2);
527 vc->vc_need_wrap = 0; 530 vc->vc_need_wrap = 0;
528 if (DO_UPDATE(vc)) { 531 if (DO_UPDATE(vc)) {
529 unsigned short oldattr = vc->vc_attr; 532 unsigned short oldattr = vc->vc_attr;
530 vc->vc_sw->con_bmove(vc, vc->vc_y, vc->vc_x, vc->vc_y, vc->vc_x + nr, 1, 533 vc->vc_sw->con_bmove(vc, vc->vc_y, vc->vc_x, vc->vc_y, vc->vc_x + nr, 1,
531 vc->vc_cols - vc->vc_x - nr); 534 vc->vc_cols - vc->vc_x - nr);
532 vc->vc_attr = vc->vc_video_erase_char >> 8; 535 vc->vc_attr = vc->vc_video_erase_char >> 8;
533 while (nr--) 536 while (nr--)
534 vc->vc_sw->con_putc(vc, vc->vc_video_erase_char, vc->vc_y, vc->vc_x + nr); 537 vc->vc_sw->con_putc(vc, vc->vc_video_erase_char, vc->vc_y, vc->vc_x + nr);
535 vc->vc_attr = oldattr; 538 vc->vc_attr = oldattr;
536 } 539 }
537 } 540 }
538 541
539 static void delete_char(struct vc_data *vc, unsigned int nr) 542 static void delete_char(struct vc_data *vc, unsigned int nr)
540 { 543 {
541 unsigned int i = vc->vc_x; 544 unsigned int i = vc->vc_x;
542 unsigned short *p = (unsigned short *)vc->vc_pos; 545 unsigned short *p = (unsigned short *)vc->vc_pos;
543 546
544 while (++i <= vc->vc_cols - nr) { 547 while (++i <= vc->vc_cols - nr) {
545 scr_writew(scr_readw(p+nr), p); 548 scr_writew(scr_readw(p+nr), p);
546 p++; 549 p++;
547 } 550 }
548 scr_memsetw(p, vc->vc_video_erase_char, nr * 2); 551 scr_memsetw(p, vc->vc_video_erase_char, nr * 2);
549 vc->vc_need_wrap = 0; 552 vc->vc_need_wrap = 0;
550 if (DO_UPDATE(vc)) { 553 if (DO_UPDATE(vc)) {
551 unsigned short oldattr = vc->vc_attr; 554 unsigned short oldattr = vc->vc_attr;
552 vc->vc_sw->con_bmove(vc, vc->vc_y, vc->vc_x + nr, vc->vc_y, vc->vc_x, 1, 555 vc->vc_sw->con_bmove(vc, vc->vc_y, vc->vc_x + nr, vc->vc_y, vc->vc_x, 1,
553 vc->vc_cols - vc->vc_x - nr); 556 vc->vc_cols - vc->vc_x - nr);
554 vc->vc_attr = vc->vc_video_erase_char >> 8; 557 vc->vc_attr = vc->vc_video_erase_char >> 8;
555 while (nr--) 558 while (nr--)
556 vc->vc_sw->con_putc(vc, vc->vc_video_erase_char, vc->vc_y, 559 vc->vc_sw->con_putc(vc, vc->vc_video_erase_char, vc->vc_y,
557 vc->vc_cols - 1 - nr); 560 vc->vc_cols - 1 - nr);
558 vc->vc_attr = oldattr; 561 vc->vc_attr = oldattr;
559 } 562 }
560 } 563 }
561 564
562 static int softcursor_original; 565 static int softcursor_original;
563 566
564 static void add_softcursor(struct vc_data *vc) 567 static void add_softcursor(struct vc_data *vc)
565 { 568 {
566 int i = scr_readw((u16 *) vc->vc_pos); 569 int i = scr_readw((u16 *) vc->vc_pos);
567 u32 type = vc->vc_cursor_type; 570 u32 type = vc->vc_cursor_type;
568 571
569 if (! (type & 0x10)) return; 572 if (! (type & 0x10)) return;
570 if (softcursor_original != -1) return; 573 if (softcursor_original != -1) return;
571 softcursor_original = i; 574 softcursor_original = i;
572 i |= ((type >> 8) & 0xff00 ); 575 i |= ((type >> 8) & 0xff00 );
573 i ^= ((type) & 0xff00 ); 576 i ^= ((type) & 0xff00 );
574 if ((type & 0x20) && ((softcursor_original & 0x7000) == (i & 0x7000))) i ^= 0x7000; 577 if ((type & 0x20) && ((softcursor_original & 0x7000) == (i & 0x7000))) i ^= 0x7000;
575 if ((type & 0x40) && ((i & 0x700) == ((i & 0x7000) >> 4))) i ^= 0x0700; 578 if ((type & 0x40) && ((i & 0x700) == ((i & 0x7000) >> 4))) i ^= 0x0700;
576 scr_writew(i, (u16 *) vc->vc_pos); 579 scr_writew(i, (u16 *) vc->vc_pos);
577 if (DO_UPDATE(vc)) 580 if (DO_UPDATE(vc))
578 vc->vc_sw->con_putc(vc, i, vc->vc_y, vc->vc_x); 581 vc->vc_sw->con_putc(vc, i, vc->vc_y, vc->vc_x);
579 } 582 }
580 583
581 static void hide_softcursor(struct vc_data *vc) 584 static void hide_softcursor(struct vc_data *vc)
582 { 585 {
583 if (softcursor_original != -1) { 586 if (softcursor_original != -1) {
584 scr_writew(softcursor_original, (u16 *)vc->vc_pos); 587 scr_writew(softcursor_original, (u16 *)vc->vc_pos);
585 if (DO_UPDATE(vc)) 588 if (DO_UPDATE(vc))
586 vc->vc_sw->con_putc(vc, softcursor_original, 589 vc->vc_sw->con_putc(vc, softcursor_original,
587 vc->vc_y, vc->vc_x); 590 vc->vc_y, vc->vc_x);
588 softcursor_original = -1; 591 softcursor_original = -1;
589 } 592 }
590 } 593 }
591 594
592 static void hide_cursor(struct vc_data *vc) 595 static void hide_cursor(struct vc_data *vc)
593 { 596 {
594 if (vc == sel_cons) 597 if (vc == sel_cons)
595 clear_selection(); 598 clear_selection();
596 vc->vc_sw->con_cursor(vc, CM_ERASE); 599 vc->vc_sw->con_cursor(vc, CM_ERASE);
597 hide_softcursor(vc); 600 hide_softcursor(vc);
598 } 601 }
599 602
600 static void set_cursor(struct vc_data *vc) 603 static void set_cursor(struct vc_data *vc)
601 { 604 {
602 if (!IS_FG(vc) || console_blanked || 605 if (!IS_FG(vc) || console_blanked ||
603 vc->vc_mode == KD_GRAPHICS) 606 vc->vc_mode == KD_GRAPHICS)
604 return; 607 return;
605 if (vc->vc_deccm) { 608 if (vc->vc_deccm) {
606 if (vc == sel_cons) 609 if (vc == sel_cons)
607 clear_selection(); 610 clear_selection();
608 add_softcursor(vc); 611 add_softcursor(vc);
609 if ((vc->vc_cursor_type & 0x0f) != 1) 612 if ((vc->vc_cursor_type & 0x0f) != 1)
610 vc->vc_sw->con_cursor(vc, CM_DRAW); 613 vc->vc_sw->con_cursor(vc, CM_DRAW);
611 } else 614 } else
612 hide_cursor(vc); 615 hide_cursor(vc);
613 } 616 }
614 617
615 static void set_origin(struct vc_data *vc) 618 static void set_origin(struct vc_data *vc)
616 { 619 {
617 WARN_CONSOLE_UNLOCKED(); 620 WARN_CONSOLE_UNLOCKED();
618 621
619 if (!CON_IS_VISIBLE(vc) || 622 if (!CON_IS_VISIBLE(vc) ||
620 !vc->vc_sw->con_set_origin || 623 !vc->vc_sw->con_set_origin ||
621 !vc->vc_sw->con_set_origin(vc)) 624 !vc->vc_sw->con_set_origin(vc))
622 vc->vc_origin = (unsigned long)vc->vc_screenbuf; 625 vc->vc_origin = (unsigned long)vc->vc_screenbuf;
623 vc->vc_visible_origin = vc->vc_origin; 626 vc->vc_visible_origin = vc->vc_origin;
624 vc->vc_scr_end = vc->vc_origin + vc->vc_screenbuf_size; 627 vc->vc_scr_end = vc->vc_origin + vc->vc_screenbuf_size;
625 vc->vc_pos = vc->vc_origin + vc->vc_size_row * vc->vc_y + 2 * vc->vc_x; 628 vc->vc_pos = vc->vc_origin + vc->vc_size_row * vc->vc_y + 2 * vc->vc_x;
626 } 629 }
627 630
628 static inline void save_screen(struct vc_data *vc) 631 static inline void save_screen(struct vc_data *vc)
629 { 632 {
630 WARN_CONSOLE_UNLOCKED(); 633 WARN_CONSOLE_UNLOCKED();
631 634
632 if (vc->vc_sw->con_save_screen) 635 if (vc->vc_sw->con_save_screen)
633 vc->vc_sw->con_save_screen(vc); 636 vc->vc_sw->con_save_screen(vc);
634 } 637 }
635 638
636 /* 639 /*
637 * Redrawing of screen 640 * Redrawing of screen
638 */ 641 */
639 642
640 static void clear_buffer_attributes(struct vc_data *vc) 643 static void clear_buffer_attributes(struct vc_data *vc)
641 { 644 {
642 unsigned short *p = (unsigned short *)vc->vc_origin; 645 unsigned short *p = (unsigned short *)vc->vc_origin;
643 int count = vc->vc_screenbuf_size / 2; 646 int count = vc->vc_screenbuf_size / 2;
644 int mask = vc->vc_hi_font_mask | 0xff; 647 int mask = vc->vc_hi_font_mask | 0xff;
645 648
646 for (; count > 0; count--, p++) { 649 for (; count > 0; count--, p++) {
647 scr_writew((scr_readw(p)&mask) | (vc->vc_video_erase_char & ~mask), p); 650 scr_writew((scr_readw(p)&mask) | (vc->vc_video_erase_char & ~mask), p);
648 } 651 }
649 } 652 }
650 653
651 void redraw_screen(struct vc_data *vc, int is_switch) 654 void redraw_screen(struct vc_data *vc, int is_switch)
652 { 655 {
653 int redraw = 0; 656 int redraw = 0;
654 657
655 WARN_CONSOLE_UNLOCKED(); 658 WARN_CONSOLE_UNLOCKED();
656 659
657 if (!vc) { 660 if (!vc) {
658 /* strange ... */ 661 /* strange ... */
659 /* printk("redraw_screen: tty %d not allocated ??\n", new_console+1); */ 662 /* printk("redraw_screen: tty %d not allocated ??\n", new_console+1); */
660 return; 663 return;
661 } 664 }
662 665
663 if (is_switch) { 666 if (is_switch) {
664 struct vc_data *old_vc = vc_cons[fg_console].d; 667 struct vc_data *old_vc = vc_cons[fg_console].d;
665 if (old_vc == vc) 668 if (old_vc == vc)
666 return; 669 return;
667 if (!CON_IS_VISIBLE(vc)) 670 if (!CON_IS_VISIBLE(vc))
668 redraw = 1; 671 redraw = 1;
669 *vc->vc_display_fg = vc; 672 *vc->vc_display_fg = vc;
670 fg_console = vc->vc_num; 673 fg_console = vc->vc_num;
671 hide_cursor(old_vc); 674 hide_cursor(old_vc);
672 if (!CON_IS_VISIBLE(old_vc)) { 675 if (!CON_IS_VISIBLE(old_vc)) {
673 save_screen(old_vc); 676 save_screen(old_vc);
674 set_origin(old_vc); 677 set_origin(old_vc);
675 } 678 }
676 } else { 679 } else {
677 hide_cursor(vc); 680 hide_cursor(vc);
678 redraw = 1; 681 redraw = 1;
679 } 682 }
680 683
681 if (redraw) { 684 if (redraw) {
682 int update; 685 int update;
683 int old_was_color = vc->vc_can_do_color; 686 int old_was_color = vc->vc_can_do_color;
684 687
685 set_origin(vc); 688 set_origin(vc);
686 update = vc->vc_sw->con_switch(vc); 689 update = vc->vc_sw->con_switch(vc);
687 set_palette(vc); 690 set_palette(vc);
688 /* 691 /*
689 * If console changed from mono<->color, the best we can do 692 * If console changed from mono<->color, the best we can do
690 * is to clear the buffer attributes. As it currently stands, 693 * is to clear the buffer attributes. As it currently stands,
691 * rebuilding new attributes from the old buffer is not doable 694 * rebuilding new attributes from the old buffer is not doable
692 * without overly complex code. 695 * without overly complex code.
693 */ 696 */
694 if (old_was_color != vc->vc_can_do_color) { 697 if (old_was_color != vc->vc_can_do_color) {
695 update_attr(vc); 698 update_attr(vc);
696 clear_buffer_attributes(vc); 699 clear_buffer_attributes(vc);
697 } 700 }
698 if (update && vc->vc_mode != KD_GRAPHICS) 701 if (update && vc->vc_mode != KD_GRAPHICS)
699 do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); 702 do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2);
700 } 703 }
701 set_cursor(vc); 704 set_cursor(vc);
702 if (is_switch) { 705 if (is_switch) {
703 set_leds(); 706 set_leds();
704 compute_shiftstate(); 707 compute_shiftstate();
705 notify_update(vc); 708 notify_update(vc);
706 } 709 }
707 } 710 }
708 711
709 /* 712 /*
710 * Allocation, freeing and resizing of VTs. 713 * Allocation, freeing and resizing of VTs.
711 */ 714 */
712 715
713 int vc_cons_allocated(unsigned int i) 716 int vc_cons_allocated(unsigned int i)
714 { 717 {
715 return (i < MAX_NR_CONSOLES && vc_cons[i].d); 718 return (i < MAX_NR_CONSOLES && vc_cons[i].d);
716 } 719 }
717 720
718 static void visual_init(struct vc_data *vc, int num, int init) 721 static void visual_init(struct vc_data *vc, int num, int init)
719 { 722 {
720 /* ++Geert: vc->vc_sw->con_init determines console size */ 723 /* ++Geert: vc->vc_sw->con_init determines console size */
721 if (vc->vc_sw) 724 if (vc->vc_sw)
722 module_put(vc->vc_sw->owner); 725 module_put(vc->vc_sw->owner);
723 vc->vc_sw = conswitchp; 726 vc->vc_sw = conswitchp;
724 #ifndef VT_SINGLE_DRIVER 727 #ifndef VT_SINGLE_DRIVER
725 if (con_driver_map[num]) 728 if (con_driver_map[num])
726 vc->vc_sw = con_driver_map[num]; 729 vc->vc_sw = con_driver_map[num];
727 #endif 730 #endif
728 __module_get(vc->vc_sw->owner); 731 __module_get(vc->vc_sw->owner);
729 vc->vc_num = num; 732 vc->vc_num = num;
730 vc->vc_display_fg = &master_display_fg; 733 vc->vc_display_fg = &master_display_fg;
731 vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir; 734 vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir;
732 vc->vc_uni_pagedir = 0; 735 vc->vc_uni_pagedir = 0;
733 vc->vc_hi_font_mask = 0; 736 vc->vc_hi_font_mask = 0;
734 vc->vc_complement_mask = 0; 737 vc->vc_complement_mask = 0;
735 vc->vc_can_do_color = 0; 738 vc->vc_can_do_color = 0;
736 vc->vc_sw->con_init(vc, init); 739 vc->vc_sw->con_init(vc, init);
737 if (!vc->vc_complement_mask) 740 if (!vc->vc_complement_mask)
738 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; 741 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
739 vc->vc_s_complement_mask = vc->vc_complement_mask; 742 vc->vc_s_complement_mask = vc->vc_complement_mask;
740 vc->vc_size_row = vc->vc_cols << 1; 743 vc->vc_size_row = vc->vc_cols << 1;
741 vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row; 744 vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row;
742 } 745 }
743 746
744 int vc_allocate(unsigned int currcons) /* return 0 on success */ 747 int vc_allocate(unsigned int currcons) /* return 0 on success */
745 { 748 {
746 WARN_CONSOLE_UNLOCKED(); 749 WARN_CONSOLE_UNLOCKED();
747 750
748 if (currcons >= MAX_NR_CONSOLES) 751 if (currcons >= MAX_NR_CONSOLES)
749 return -ENXIO; 752 return -ENXIO;
750 if (!vc_cons[currcons].d) { 753 if (!vc_cons[currcons].d) {
751 struct vc_data *vc; 754 struct vc_data *vc;
752 struct vt_notifier_param param; 755 struct vt_notifier_param param;
753 756
754 /* prevent users from taking too much memory */ 757 /* prevent users from taking too much memory */
755 if (currcons >= MAX_NR_USER_CONSOLES && !capable(CAP_SYS_RESOURCE)) 758 if (currcons >= MAX_NR_USER_CONSOLES && !capable(CAP_SYS_RESOURCE))
756 return -EPERM; 759 return -EPERM;
757 760
758 /* due to the granularity of kmalloc, we waste some memory here */ 761 /* due to the granularity of kmalloc, we waste some memory here */
759 /* the alloc is done in two steps, to optimize the common situation 762 /* the alloc is done in two steps, to optimize the common situation
760 of a 25x80 console (structsize=216, screenbuf_size=4000) */ 763 of a 25x80 console (structsize=216, screenbuf_size=4000) */
761 /* although the numbers above are not valid since long ago, the 764 /* although the numbers above are not valid since long ago, the
762 point is still up-to-date and the comment still has its value 765 point is still up-to-date and the comment still has its value
763 even if only as a historical artifact. --mj, July 1998 */ 766 even if only as a historical artifact. --mj, July 1998 */
764 param.vc = vc = kzalloc(sizeof(struct vc_data), GFP_KERNEL); 767 param.vc = vc = kzalloc(sizeof(struct vc_data), GFP_KERNEL);
765 if (!vc) 768 if (!vc)
766 return -ENOMEM; 769 return -ENOMEM;
767 vc_cons[currcons].d = vc; 770 vc_cons[currcons].d = vc;
768 INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); 771 INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
769 visual_init(vc, currcons, 1); 772 visual_init(vc, currcons, 1);
770 if (!*vc->vc_uni_pagedir_loc) 773 if (!*vc->vc_uni_pagedir_loc)
771 con_set_default_unimap(vc); 774 con_set_default_unimap(vc);
772 vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL); 775 vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL);
773 if (!vc->vc_screenbuf) { 776 if (!vc->vc_screenbuf) {
774 kfree(vc); 777 kfree(vc);
775 vc_cons[currcons].d = NULL; 778 vc_cons[currcons].d = NULL;
776 return -ENOMEM; 779 return -ENOMEM;
777 } 780 }
778 781
779 /* If no drivers have overridden us and the user didn't pass a 782 /* If no drivers have overridden us and the user didn't pass a
780 boot option, default to displaying the cursor */ 783 boot option, default to displaying the cursor */
781 if (global_cursor_default == -1) 784 if (global_cursor_default == -1)
782 global_cursor_default = 1; 785 global_cursor_default = 1;
783 786
784 vc_init(vc, vc->vc_rows, vc->vc_cols, 1); 787 vc_init(vc, vc->vc_rows, vc->vc_cols, 1);
785 vcs_make_sysfs(currcons); 788 vcs_make_sysfs(currcons);
786 atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, &param); 789 atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, &param);
787 } 790 }
788 return 0; 791 return 0;
789 } 792 }
790 793
791 static inline int resize_screen(struct vc_data *vc, int width, int height, 794 static inline int resize_screen(struct vc_data *vc, int width, int height,
792 int user) 795 int user)
793 { 796 {
794 /* Resizes the resolution of the display adapater */ 797 /* Resizes the resolution of the display adapater */
795 int err = 0; 798 int err = 0;
796 799
797 if (vc->vc_mode != KD_GRAPHICS && vc->vc_sw->con_resize) 800 if (vc->vc_mode != KD_GRAPHICS && vc->vc_sw->con_resize)
798 err = vc->vc_sw->con_resize(vc, width, height, user); 801 err = vc->vc_sw->con_resize(vc, width, height, user);
799 802
800 return err; 803 return err;
801 } 804 }
802 805
803 /* 806 /*
804 * Change # of rows and columns (0 means unchanged/the size of fg_console) 807 * Change # of rows and columns (0 means unchanged/the size of fg_console)
805 * [this is to be used together with some user program 808 * [this is to be used together with some user program
806 * like resize that changes the hardware videomode] 809 * like resize that changes the hardware videomode]
807 */ 810 */
808 #define VC_RESIZE_MAXCOL (32767) 811 #define VC_RESIZE_MAXCOL (32767)
809 #define VC_RESIZE_MAXROW (32767) 812 #define VC_RESIZE_MAXROW (32767)
810 813
811 /** 814 /**
812 * vc_do_resize - resizing method for the tty 815 * vc_do_resize - resizing method for the tty
813 * @tty: tty being resized 816 * @tty: tty being resized
814 * @real_tty: real tty (different to tty if a pty/tty pair) 817 * @real_tty: real tty (different to tty if a pty/tty pair)
815 * @vc: virtual console private data 818 * @vc: virtual console private data
816 * @cols: columns 819 * @cols: columns
817 * @lines: lines 820 * @lines: lines
818 * 821 *
819 * Resize a virtual console, clipping according to the actual constraints. 822 * Resize a virtual console, clipping according to the actual constraints.
820 * If the caller passes a tty structure then update the termios winsize 823 * If the caller passes a tty structure then update the termios winsize
821 * information and perform any neccessary signal handling. 824 * information and perform any neccessary signal handling.
822 * 825 *
823 * Caller must hold the console semaphore. Takes the termios mutex and 826 * Caller must hold the console semaphore. Takes the termios mutex and
824 * ctrl_lock of the tty IFF a tty is passed. 827 * ctrl_lock of the tty IFF a tty is passed.
825 */ 828 */
826 829
827 static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, 830 static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
828 unsigned int cols, unsigned int lines) 831 unsigned int cols, unsigned int lines)
829 { 832 {
830 unsigned long old_origin, new_origin, new_scr_end, rlth, rrem, err = 0; 833 unsigned long old_origin, new_origin, new_scr_end, rlth, rrem, err = 0;
831 unsigned int old_cols, old_rows, old_row_size, old_screen_size; 834 unsigned int old_cols, old_rows, old_row_size, old_screen_size;
832 unsigned int new_cols, new_rows, new_row_size, new_screen_size; 835 unsigned int new_cols, new_rows, new_row_size, new_screen_size;
833 unsigned int end, user; 836 unsigned int end, user;
834 unsigned short *newscreen; 837 unsigned short *newscreen;
835 838
836 WARN_CONSOLE_UNLOCKED(); 839 WARN_CONSOLE_UNLOCKED();
837 840
838 if (!vc) 841 if (!vc)
839 return -ENXIO; 842 return -ENXIO;
840 843
841 user = vc->vc_resize_user; 844 user = vc->vc_resize_user;
842 vc->vc_resize_user = 0; 845 vc->vc_resize_user = 0;
843 846
844 if (cols > VC_RESIZE_MAXCOL || lines > VC_RESIZE_MAXROW) 847 if (cols > VC_RESIZE_MAXCOL || lines > VC_RESIZE_MAXROW)
845 return -EINVAL; 848 return -EINVAL;
846 849
847 new_cols = (cols ? cols : vc->vc_cols); 850 new_cols = (cols ? cols : vc->vc_cols);
848 new_rows = (lines ? lines : vc->vc_rows); 851 new_rows = (lines ? lines : vc->vc_rows);
849 new_row_size = new_cols << 1; 852 new_row_size = new_cols << 1;
850 new_screen_size = new_row_size * new_rows; 853 new_screen_size = new_row_size * new_rows;
851 854
852 if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) 855 if (new_cols == vc->vc_cols && new_rows == vc->vc_rows)
853 return 0; 856 return 0;
854 857
855 newscreen = kmalloc(new_screen_size, GFP_USER); 858 newscreen = kmalloc(new_screen_size, GFP_USER);
856 if (!newscreen) 859 if (!newscreen)
857 return -ENOMEM; 860 return -ENOMEM;
858 861
859 old_rows = vc->vc_rows; 862 old_rows = vc->vc_rows;
860 old_cols = vc->vc_cols; 863 old_cols = vc->vc_cols;
861 old_row_size = vc->vc_size_row; 864 old_row_size = vc->vc_size_row;
862 old_screen_size = vc->vc_screenbuf_size; 865 old_screen_size = vc->vc_screenbuf_size;
863 866
864 err = resize_screen(vc, new_cols, new_rows, user); 867 err = resize_screen(vc, new_cols, new_rows, user);
865 if (err) { 868 if (err) {
866 kfree(newscreen); 869 kfree(newscreen);
867 return err; 870 return err;
868 } 871 }
869 872
870 vc->vc_rows = new_rows; 873 vc->vc_rows = new_rows;
871 vc->vc_cols = new_cols; 874 vc->vc_cols = new_cols;
872 vc->vc_size_row = new_row_size; 875 vc->vc_size_row = new_row_size;
873 vc->vc_screenbuf_size = new_screen_size; 876 vc->vc_screenbuf_size = new_screen_size;
874 877
875 rlth = min(old_row_size, new_row_size); 878 rlth = min(old_row_size, new_row_size);
876 rrem = new_row_size - rlth; 879 rrem = new_row_size - rlth;
877 old_origin = vc->vc_origin; 880 old_origin = vc->vc_origin;
878 new_origin = (long) newscreen; 881 new_origin = (long) newscreen;
879 new_scr_end = new_origin + new_screen_size; 882 new_scr_end = new_origin + new_screen_size;
880 883
881 if (vc->vc_y > new_rows) { 884 if (vc->vc_y > new_rows) {
882 if (old_rows - vc->vc_y < new_rows) { 885 if (old_rows - vc->vc_y < new_rows) {
883 /* 886 /*
884 * Cursor near the bottom, copy contents from the 887 * Cursor near the bottom, copy contents from the
885 * bottom of buffer 888 * bottom of buffer
886 */ 889 */
887 old_origin += (old_rows - new_rows) * old_row_size; 890 old_origin += (old_rows - new_rows) * old_row_size;
888 end = vc->vc_scr_end; 891 end = vc->vc_scr_end;
889 } else { 892 } else {
890 /* 893 /*
891 * Cursor is in no man's land, copy 1/2 screenful 894 * Cursor is in no man's land, copy 1/2 screenful
892 * from the top and bottom of cursor position 895 * from the top and bottom of cursor position
893 */ 896 */
894 old_origin += (vc->vc_y - new_rows/2) * old_row_size; 897 old_origin += (vc->vc_y - new_rows/2) * old_row_size;
895 end = old_origin + (old_row_size * new_rows); 898 end = old_origin + (old_row_size * new_rows);
896 } 899 }
897 } else 900 } else
898 /* 901 /*
899 * Cursor near the top, copy contents from the top of buffer 902 * Cursor near the top, copy contents from the top of buffer
900 */ 903 */
901 end = (old_rows > new_rows) ? old_origin + 904 end = (old_rows > new_rows) ? old_origin +
902 (old_row_size * new_rows) : 905 (old_row_size * new_rows) :
903 vc->vc_scr_end; 906 vc->vc_scr_end;
904 907
905 update_attr(vc); 908 update_attr(vc);
906 909
907 while (old_origin < end) { 910 while (old_origin < end) {
908 scr_memcpyw((unsigned short *) new_origin, 911 scr_memcpyw((unsigned short *) new_origin,
909 (unsigned short *) old_origin, rlth); 912 (unsigned short *) old_origin, rlth);
910 if (rrem) 913 if (rrem)
911 scr_memsetw((void *)(new_origin + rlth), 914 scr_memsetw((void *)(new_origin + rlth),
912 vc->vc_video_erase_char, rrem); 915 vc->vc_video_erase_char, rrem);
913 old_origin += old_row_size; 916 old_origin += old_row_size;
914 new_origin += new_row_size; 917 new_origin += new_row_size;
915 } 918 }
916 if (new_scr_end > new_origin) 919 if (new_scr_end > new_origin)
917 scr_memsetw((void *)new_origin, vc->vc_video_erase_char, 920 scr_memsetw((void *)new_origin, vc->vc_video_erase_char,
918 new_scr_end - new_origin); 921 new_scr_end - new_origin);
919 kfree(vc->vc_screenbuf); 922 kfree(vc->vc_screenbuf);
920 vc->vc_screenbuf = newscreen; 923 vc->vc_screenbuf = newscreen;
921 vc->vc_screenbuf_size = new_screen_size; 924 vc->vc_screenbuf_size = new_screen_size;
922 set_origin(vc); 925 set_origin(vc);
923 926
924 /* do part of a reset_terminal() */ 927 /* do part of a reset_terminal() */
925 vc->vc_top = 0; 928 vc->vc_top = 0;
926 vc->vc_bottom = vc->vc_rows; 929 vc->vc_bottom = vc->vc_rows;
927 gotoxy(vc, vc->vc_x, vc->vc_y); 930 gotoxy(vc, vc->vc_x, vc->vc_y);
928 save_cur(vc); 931 save_cur(vc);
929 932
930 if (tty) { 933 if (tty) {
931 /* Rewrite the requested winsize data with the actual 934 /* Rewrite the requested winsize data with the actual
932 resulting sizes */ 935 resulting sizes */
933 struct winsize ws; 936 struct winsize ws;
934 memset(&ws, 0, sizeof(ws)); 937 memset(&ws, 0, sizeof(ws));
935 ws.ws_row = vc->vc_rows; 938 ws.ws_row = vc->vc_rows;
936 ws.ws_col = vc->vc_cols; 939 ws.ws_col = vc->vc_cols;
937 ws.ws_ypixel = vc->vc_scan_lines; 940 ws.ws_ypixel = vc->vc_scan_lines;
938 tty_do_resize(tty, &ws); 941 tty_do_resize(tty, &ws);
939 } 942 }
940 943
941 if (CON_IS_VISIBLE(vc)) 944 if (CON_IS_VISIBLE(vc))
942 update_screen(vc); 945 update_screen(vc);
943 vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); 946 vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num);
944 return err; 947 return err;
945 } 948 }
946 949
947 /** 950 /**
948 * vc_resize - resize a VT 951 * vc_resize - resize a VT
949 * @vc: virtual console 952 * @vc: virtual console
950 * @cols: columns 953 * @cols: columns
951 * @rows: rows 954 * @rows: rows
952 * 955 *
953 * Resize a virtual console as seen from the console end of things. We 956 * Resize a virtual console as seen from the console end of things. We
954 * use the common vc_do_resize methods to update the structures. The 957 * use the common vc_do_resize methods to update the structures. The
955 * caller must hold the console sem to protect console internals and 958 * caller must hold the console sem to protect console internals and
956 * vc->vc_tty 959 * vc->vc_tty
957 */ 960 */
958 961
959 int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int rows) 962 int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int rows)
960 { 963 {
961 return vc_do_resize(vc->vc_tty, vc, cols, rows); 964 return vc_do_resize(vc->vc_tty, vc, cols, rows);
962 } 965 }
963 966
964 /** 967 /**
965 * vt_resize - resize a VT 968 * vt_resize - resize a VT
966 * @tty: tty to resize 969 * @tty: tty to resize
967 * @ws: winsize attributes 970 * @ws: winsize attributes
968 * 971 *
969 * Resize a virtual terminal. This is called by the tty layer as we 972 * Resize a virtual terminal. This is called by the tty layer as we
970 * register our own handler for resizing. The mutual helper does all 973 * register our own handler for resizing. The mutual helper does all
971 * the actual work. 974 * the actual work.
972 * 975 *
973 * Takes the console sem and the called methods then take the tty 976 * Takes the console sem and the called methods then take the tty
974 * termios_mutex and the tty ctrl_lock in that order. 977 * termios_mutex and the tty ctrl_lock in that order.
975 */ 978 */
976 static int vt_resize(struct tty_struct *tty, struct winsize *ws) 979 static int vt_resize(struct tty_struct *tty, struct winsize *ws)
977 { 980 {
978 struct vc_data *vc = tty->driver_data; 981 struct vc_data *vc = tty->driver_data;
979 int ret; 982 int ret;
980 983
981 acquire_console_sem(); 984 acquire_console_sem();
982 ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row); 985 ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row);
983 release_console_sem(); 986 release_console_sem();
984 return ret; 987 return ret;
985 } 988 }
986 989
987 void vc_deallocate(unsigned int currcons) 990 void vc_deallocate(unsigned int currcons)
988 { 991 {
989 WARN_CONSOLE_UNLOCKED(); 992 WARN_CONSOLE_UNLOCKED();
990 993
991 if (vc_cons_allocated(currcons)) { 994 if (vc_cons_allocated(currcons)) {
992 struct vc_data *vc = vc_cons[currcons].d; 995 struct vc_data *vc = vc_cons[currcons].d;
993 struct vt_notifier_param param = { .vc = vc }; 996 struct vt_notifier_param param = { .vc = vc };
994 997
995 atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, &param); 998 atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, &param);
996 vcs_remove_sysfs(currcons); 999 vcs_remove_sysfs(currcons);
997 vc->vc_sw->con_deinit(vc); 1000 vc->vc_sw->con_deinit(vc);
998 put_pid(vc->vt_pid); 1001 put_pid(vc->vt_pid);
999 module_put(vc->vc_sw->owner); 1002 module_put(vc->vc_sw->owner);
1000 kfree(vc->vc_screenbuf); 1003 kfree(vc->vc_screenbuf);
1001 if (currcons >= MIN_NR_CONSOLES) 1004 if (currcons >= MIN_NR_CONSOLES)
1002 kfree(vc); 1005 kfree(vc);
1003 vc_cons[currcons].d = NULL; 1006 vc_cons[currcons].d = NULL;
1004 } 1007 }
1005 } 1008 }
1006 1009
1007 /* 1010 /*
1008 * VT102 emulator 1011 * VT102 emulator
1009 */ 1012 */
1010 1013
1011 #define set_kbd(vc, x) set_vc_kbd_mode(kbd_table + (vc)->vc_num, (x)) 1014 #define set_kbd(vc, x) set_vc_kbd_mode(kbd_table + (vc)->vc_num, (x))
1012 #define clr_kbd(vc, x) clr_vc_kbd_mode(kbd_table + (vc)->vc_num, (x)) 1015 #define clr_kbd(vc, x) clr_vc_kbd_mode(kbd_table + (vc)->vc_num, (x))
1013 #define is_kbd(vc, x) vc_kbd_mode(kbd_table + (vc)->vc_num, (x)) 1016 #define is_kbd(vc, x) vc_kbd_mode(kbd_table + (vc)->vc_num, (x))
1014 1017
1015 #define decarm VC_REPEAT 1018 #define decarm VC_REPEAT
1016 #define decckm VC_CKMODE 1019 #define decckm VC_CKMODE
1017 #define kbdapplic VC_APPLIC 1020 #define kbdapplic VC_APPLIC
1018 #define lnm VC_CRLF 1021 #define lnm VC_CRLF
1019 1022
1020 /* 1023 /*
1021 * this is what the terminal answers to a ESC-Z or csi0c query. 1024 * this is what the terminal answers to a ESC-Z or csi0c query.
1022 */ 1025 */
1023 #define VT100ID "\033[?1;2c" 1026 #define VT100ID "\033[?1;2c"
1024 #define VT102ID "\033[?6c" 1027 #define VT102ID "\033[?6c"
1025 1028
1026 unsigned char color_table[] = { 0, 4, 2, 6, 1, 5, 3, 7, 1029 unsigned char color_table[] = { 0, 4, 2, 6, 1, 5, 3, 7,
1027 8,12,10,14, 9,13,11,15 }; 1030 8,12,10,14, 9,13,11,15 };
1028 1031
1029 /* the default colour table, for VGA+ colour systems */ 1032 /* the default colour table, for VGA+ colour systems */
1030 int default_red[] = {0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa, 1033 int default_red[] = {0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,
1031 0x55,0xff,0x55,0xff,0x55,0xff,0x55,0xff}; 1034 0x55,0xff,0x55,0xff,0x55,0xff,0x55,0xff};
1032 int default_grn[] = {0x00,0x00,0xaa,0x55,0x00,0x00,0xaa,0xaa, 1035 int default_grn[] = {0x00,0x00,0xaa,0x55,0x00,0x00,0xaa,0xaa,
1033 0x55,0x55,0xff,0xff,0x55,0x55,0xff,0xff}; 1036 0x55,0x55,0xff,0xff,0x55,0x55,0xff,0xff};
1034 int default_blu[] = {0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa, 1037 int default_blu[] = {0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa,
1035 0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff}; 1038 0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff};
1036 1039
1037 module_param_array(default_red, int, NULL, S_IRUGO | S_IWUSR); 1040 module_param_array(default_red, int, NULL, S_IRUGO | S_IWUSR);
1038 module_param_array(default_grn, int, NULL, S_IRUGO | S_IWUSR); 1041 module_param_array(default_grn, int, NULL, S_IRUGO | S_IWUSR);
1039 module_param_array(default_blu, int, NULL, S_IRUGO | S_IWUSR); 1042 module_param_array(default_blu, int, NULL, S_IRUGO | S_IWUSR);
1040 1043
1041 /* 1044 /*
1042 * gotoxy() must verify all boundaries, because the arguments 1045 * gotoxy() must verify all boundaries, because the arguments
1043 * might also be negative. If the given position is out of 1046 * might also be negative. If the given position is out of
1044 * bounds, the cursor is placed at the nearest margin. 1047 * bounds, the cursor is placed at the nearest margin.
1045 */ 1048 */
1046 static void gotoxy(struct vc_data *vc, int new_x, int new_y) 1049 static void gotoxy(struct vc_data *vc, int new_x, int new_y)
1047 { 1050 {
1048 int min_y, max_y; 1051 int min_y, max_y;
1049 1052
1050 if (new_x < 0) 1053 if (new_x < 0)
1051 vc->vc_x = 0; 1054 vc->vc_x = 0;
1052 else { 1055 else {
1053 if (new_x >= vc->vc_cols) 1056 if (new_x >= vc->vc_cols)
1054 vc->vc_x = vc->vc_cols - 1; 1057 vc->vc_x = vc->vc_cols - 1;
1055 else 1058 else
1056 vc->vc_x = new_x; 1059 vc->vc_x = new_x;
1057 } 1060 }
1058 1061
1059 if (vc->vc_decom) { 1062 if (vc->vc_decom) {
1060 min_y = vc->vc_top; 1063 min_y = vc->vc_top;
1061 max_y = vc->vc_bottom; 1064 max_y = vc->vc_bottom;
1062 } else { 1065 } else {
1063 min_y = 0; 1066 min_y = 0;
1064 max_y = vc->vc_rows; 1067 max_y = vc->vc_rows;
1065 } 1068 }
1066 if (new_y < min_y) 1069 if (new_y < min_y)
1067 vc->vc_y = min_y; 1070 vc->vc_y = min_y;
1068 else if (new_y >= max_y) 1071 else if (new_y >= max_y)
1069 vc->vc_y = max_y - 1; 1072 vc->vc_y = max_y - 1;
1070 else 1073 else
1071 vc->vc_y = new_y; 1074 vc->vc_y = new_y;
1072 vc->vc_pos = vc->vc_origin + vc->vc_y * vc->vc_size_row + (vc->vc_x<<1); 1075 vc->vc_pos = vc->vc_origin + vc->vc_y * vc->vc_size_row + (vc->vc_x<<1);
1073 vc->vc_need_wrap = 0; 1076 vc->vc_need_wrap = 0;
1074 } 1077 }
1075 1078
1076 /* for absolute user moves, when decom is set */ 1079 /* for absolute user moves, when decom is set */
1077 static void gotoxay(struct vc_data *vc, int new_x, int new_y) 1080 static void gotoxay(struct vc_data *vc, int new_x, int new_y)
1078 { 1081 {
1079 gotoxy(vc, new_x, vc->vc_decom ? (vc->vc_top + new_y) : new_y); 1082 gotoxy(vc, new_x, vc->vc_decom ? (vc->vc_top + new_y) : new_y);
1080 } 1083 }
1081 1084
1082 void scrollback(struct vc_data *vc, int lines) 1085 void scrollback(struct vc_data *vc, int lines)
1083 { 1086 {
1084 if (!lines) 1087 if (!lines)
1085 lines = vc->vc_rows / 2; 1088 lines = vc->vc_rows / 2;
1086 scrolldelta(-lines); 1089 scrolldelta(-lines);
1087 } 1090 }
1088 1091
1089 void scrollfront(struct vc_data *vc, int lines) 1092 void scrollfront(struct vc_data *vc, int lines)
1090 { 1093 {
1091 if (!lines) 1094 if (!lines)
1092 lines = vc->vc_rows / 2; 1095 lines = vc->vc_rows / 2;
1093 scrolldelta(lines); 1096 scrolldelta(lines);
1094 } 1097 }
1095 1098
1096 static void lf(struct vc_data *vc) 1099 static void lf(struct vc_data *vc)
1097 { 1100 {
1098 /* don't scroll if above bottom of scrolling region, or 1101 /* don't scroll if above bottom of scrolling region, or
1099 * if below scrolling region 1102 * if below scrolling region
1100 */ 1103 */
1101 if (vc->vc_y + 1 == vc->vc_bottom) 1104 if (vc->vc_y + 1 == vc->vc_bottom)
1102 scrup(vc, vc->vc_top, vc->vc_bottom, 1); 1105 scrup(vc, vc->vc_top, vc->vc_bottom, 1);
1103 else if (vc->vc_y < vc->vc_rows - 1) { 1106 else if (vc->vc_y < vc->vc_rows - 1) {
1104 vc->vc_y++; 1107 vc->vc_y++;
1105 vc->vc_pos += vc->vc_size_row; 1108 vc->vc_pos += vc->vc_size_row;
1106 } 1109 }
1107 vc->vc_need_wrap = 0; 1110 vc->vc_need_wrap = 0;
1108 notify_write(vc, '\n'); 1111 notify_write(vc, '\n');
1109 } 1112 }
1110 1113
1111 static void ri(struct vc_data *vc) 1114 static void ri(struct vc_data *vc)
1112 { 1115 {
1113 /* don't scroll if below top of scrolling region, or 1116 /* don't scroll if below top of scrolling region, or
1114 * if above scrolling region 1117 * if above scrolling region
1115 */ 1118 */
1116 if (vc->vc_y == vc->vc_top) 1119 if (vc->vc_y == vc->vc_top)
1117 scrdown(vc, vc->vc_top, vc->vc_bottom, 1); 1120 scrdown(vc, vc->vc_top, vc->vc_bottom, 1);
1118 else if (vc->vc_y > 0) { 1121 else if (vc->vc_y > 0) {
1119 vc->vc_y--; 1122 vc->vc_y--;
1120 vc->vc_pos -= vc->vc_size_row; 1123 vc->vc_pos -= vc->vc_size_row;
1121 } 1124 }
1122 vc->vc_need_wrap = 0; 1125 vc->vc_need_wrap = 0;
1123 } 1126 }
1124 1127
1125 static inline void cr(struct vc_data *vc) 1128 static inline void cr(struct vc_data *vc)
1126 { 1129 {
1127 vc->vc_pos -= vc->vc_x << 1; 1130 vc->vc_pos -= vc->vc_x << 1;
1128 vc->vc_need_wrap = vc->vc_x = 0; 1131 vc->vc_need_wrap = vc->vc_x = 0;
1129 notify_write(vc, '\r'); 1132 notify_write(vc, '\r');
1130 } 1133 }
1131 1134
1132 static inline void bs(struct vc_data *vc) 1135 static inline void bs(struct vc_data *vc)
1133 { 1136 {
1134 if (vc->vc_x) { 1137 if (vc->vc_x) {
1135 vc->vc_pos -= 2; 1138 vc->vc_pos -= 2;
1136 vc->vc_x--; 1139 vc->vc_x--;
1137 vc->vc_need_wrap = 0; 1140 vc->vc_need_wrap = 0;
1138 notify_write(vc, '\b'); 1141 notify_write(vc, '\b');
1139 } 1142 }
1140 } 1143 }
1141 1144
1142 static inline void del(struct vc_data *vc) 1145 static inline void del(struct vc_data *vc)
1143 { 1146 {
1144 /* ignored */ 1147 /* ignored */
1145 } 1148 }
1146 1149
1147 static void csi_J(struct vc_data *vc, int vpar) 1150 static void csi_J(struct vc_data *vc, int vpar)
1148 { 1151 {
1149 unsigned int count; 1152 unsigned int count;
1150 unsigned short * start; 1153 unsigned short * start;
1151 1154
1152 switch (vpar) { 1155 switch (vpar) {
1153 case 0: /* erase from cursor to end of display */ 1156 case 0: /* erase from cursor to end of display */
1154 count = (vc->vc_scr_end - vc->vc_pos) >> 1; 1157 count = (vc->vc_scr_end - vc->vc_pos) >> 1;
1155 start = (unsigned short *)vc->vc_pos; 1158 start = (unsigned short *)vc->vc_pos;
1156 if (DO_UPDATE(vc)) { 1159 if (DO_UPDATE(vc)) {
1157 /* do in two stages */ 1160 /* do in two stages */
1158 vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1, 1161 vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1,
1159 vc->vc_cols - vc->vc_x); 1162 vc->vc_cols - vc->vc_x);
1160 vc->vc_sw->con_clear(vc, vc->vc_y + 1, 0, 1163 vc->vc_sw->con_clear(vc, vc->vc_y + 1, 0,
1161 vc->vc_rows - vc->vc_y - 1, 1164 vc->vc_rows - vc->vc_y - 1,
1162 vc->vc_cols); 1165 vc->vc_cols);
1163 } 1166 }
1164 break; 1167 break;
1165 case 1: /* erase from start to cursor */ 1168 case 1: /* erase from start to cursor */
1166 count = ((vc->vc_pos - vc->vc_origin) >> 1) + 1; 1169 count = ((vc->vc_pos - vc->vc_origin) >> 1) + 1;
1167 start = (unsigned short *)vc->vc_origin; 1170 start = (unsigned short *)vc->vc_origin;
1168 if (DO_UPDATE(vc)) { 1171 if (DO_UPDATE(vc)) {
1169 /* do in two stages */ 1172 /* do in two stages */
1170 vc->vc_sw->con_clear(vc, 0, 0, vc->vc_y, 1173 vc->vc_sw->con_clear(vc, 0, 0, vc->vc_y,
1171 vc->vc_cols); 1174 vc->vc_cols);
1172 vc->vc_sw->con_clear(vc, vc->vc_y, 0, 1, 1175 vc->vc_sw->con_clear(vc, vc->vc_y, 0, 1,
1173 vc->vc_x + 1); 1176 vc->vc_x + 1);
1174 } 1177 }
1175 break; 1178 break;
1176 case 2: /* erase whole display */ 1179 case 2: /* erase whole display */
1177 count = vc->vc_cols * vc->vc_rows; 1180 count = vc->vc_cols * vc->vc_rows;
1178 start = (unsigned short *)vc->vc_origin; 1181 start = (unsigned short *)vc->vc_origin;
1179 if (DO_UPDATE(vc)) 1182 if (DO_UPDATE(vc))
1180 vc->vc_sw->con_clear(vc, 0, 0, 1183 vc->vc_sw->con_clear(vc, 0, 0,
1181 vc->vc_rows, 1184 vc->vc_rows,
1182 vc->vc_cols); 1185 vc->vc_cols);
1183 break; 1186 break;
1184 default: 1187 default:
1185 return; 1188 return;
1186 } 1189 }
1187 scr_memsetw(start, vc->vc_video_erase_char, 2 * count); 1190 scr_memsetw(start, vc->vc_video_erase_char, 2 * count);
1188 vc->vc_need_wrap = 0; 1191 vc->vc_need_wrap = 0;
1189 } 1192 }
1190 1193
1191 static void csi_K(struct vc_data *vc, int vpar) 1194 static void csi_K(struct vc_data *vc, int vpar)
1192 { 1195 {
1193 unsigned int count; 1196 unsigned int count;
1194 unsigned short * start; 1197 unsigned short * start;
1195 1198
1196 switch (vpar) { 1199 switch (vpar) {
1197 case 0: /* erase from cursor to end of line */ 1200 case 0: /* erase from cursor to end of line */
1198 count = vc->vc_cols - vc->vc_x; 1201 count = vc->vc_cols - vc->vc_x;
1199 start = (unsigned short *)vc->vc_pos; 1202 start = (unsigned short *)vc->vc_pos;
1200 if (DO_UPDATE(vc)) 1203 if (DO_UPDATE(vc))
1201 vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1, 1204 vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1,
1202 vc->vc_cols - vc->vc_x); 1205 vc->vc_cols - vc->vc_x);
1203 break; 1206 break;
1204 case 1: /* erase from start of line to cursor */ 1207 case 1: /* erase from start of line to cursor */
1205 start = (unsigned short *)(vc->vc_pos - (vc->vc_x << 1)); 1208 start = (unsigned short *)(vc->vc_pos - (vc->vc_x << 1));
1206 count = vc->vc_x + 1; 1209 count = vc->vc_x + 1;
1207 if (DO_UPDATE(vc)) 1210 if (DO_UPDATE(vc))
1208 vc->vc_sw->con_clear(vc, vc->vc_y, 0, 1, 1211 vc->vc_sw->con_clear(vc, vc->vc_y, 0, 1,
1209 vc->vc_x + 1); 1212 vc->vc_x + 1);
1210 break; 1213 break;
1211 case 2: /* erase whole line */ 1214 case 2: /* erase whole line */
1212 start = (unsigned short *)(vc->vc_pos - (vc->vc_x << 1)); 1215 start = (unsigned short *)(vc->vc_pos - (vc->vc_x << 1));
1213 count = vc->vc_cols; 1216 count = vc->vc_cols;
1214 if (DO_UPDATE(vc)) 1217 if (DO_UPDATE(vc))
1215 vc->vc_sw->con_clear(vc, vc->vc_y, 0, 1, 1218 vc->vc_sw->con_clear(vc, vc->vc_y, 0, 1,
1216 vc->vc_cols); 1219 vc->vc_cols);
1217 break; 1220 break;
1218 default: 1221 default:
1219 return; 1222 return;
1220 } 1223 }
1221 scr_memsetw(start, vc->vc_video_erase_char, 2 * count); 1224 scr_memsetw(start, vc->vc_video_erase_char, 2 * count);
1222 vc->vc_need_wrap = 0; 1225 vc->vc_need_wrap = 0;
1223 } 1226 }
1224 1227
1225 static void csi_X(struct vc_data *vc, int vpar) /* erase the following vpar positions */ 1228 static void csi_X(struct vc_data *vc, int vpar) /* erase the following vpar positions */
1226 { /* not vt100? */ 1229 { /* not vt100? */
1227 int count; 1230 int count;
1228 1231
1229 if (!vpar) 1232 if (!vpar)
1230 vpar++; 1233 vpar++;
1231 count = (vpar > vc->vc_cols - vc->vc_x) ? (vc->vc_cols - vc->vc_x) : vpar; 1234 count = (vpar > vc->vc_cols - vc->vc_x) ? (vc->vc_cols - vc->vc_x) : vpar;
1232 1235
1233 scr_memsetw((unsigned short *)vc->vc_pos, vc->vc_video_erase_char, 2 * count); 1236 scr_memsetw((unsigned short *)vc->vc_pos, vc->vc_video_erase_char, 2 * count);
1234 if (DO_UPDATE(vc)) 1237 if (DO_UPDATE(vc))
1235 vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1, count); 1238 vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1, count);
1236 vc->vc_need_wrap = 0; 1239 vc->vc_need_wrap = 0;
1237 } 1240 }
1238 1241
1239 static void default_attr(struct vc_data *vc) 1242 static void default_attr(struct vc_data *vc)
1240 { 1243 {
1241 vc->vc_intensity = 1; 1244 vc->vc_intensity = 1;
1242 vc->vc_italic = 0; 1245 vc->vc_italic = 0;
1243 vc->vc_underline = 0; 1246 vc->vc_underline = 0;
1244 vc->vc_reverse = 0; 1247 vc->vc_reverse = 0;
1245 vc->vc_blink = 0; 1248 vc->vc_blink = 0;
1246 vc->vc_color = vc->vc_def_color; 1249 vc->vc_color = vc->vc_def_color;
1247 } 1250 }
1248 1251
1249 /* console_sem is held */ 1252 /* console_sem is held */
1250 static void csi_m(struct vc_data *vc) 1253 static void csi_m(struct vc_data *vc)
1251 { 1254 {
1252 int i; 1255 int i;
1253 1256
1254 for (i = 0; i <= vc->vc_npar; i++) 1257 for (i = 0; i <= vc->vc_npar; i++)
1255 switch (vc->vc_par[i]) { 1258 switch (vc->vc_par[i]) {
1256 case 0: /* all attributes off */ 1259 case 0: /* all attributes off */
1257 default_attr(vc); 1260 default_attr(vc);
1258 break; 1261 break;
1259 case 1: 1262 case 1:
1260 vc->vc_intensity = 2; 1263 vc->vc_intensity = 2;
1261 break; 1264 break;
1262 case 2: 1265 case 2:
1263 vc->vc_intensity = 0; 1266 vc->vc_intensity = 0;
1264 break; 1267 break;
1265 case 3: 1268 case 3:
1266 vc->vc_italic = 1; 1269 vc->vc_italic = 1;
1267 break; 1270 break;
1268 case 4: 1271 case 4:
1269 vc->vc_underline = 1; 1272 vc->vc_underline = 1;
1270 break; 1273 break;
1271 case 5: 1274 case 5:
1272 vc->vc_blink = 1; 1275 vc->vc_blink = 1;
1273 break; 1276 break;
1274 case 7: 1277 case 7:
1275 vc->vc_reverse = 1; 1278 vc->vc_reverse = 1;
1276 break; 1279 break;
1277 case 10: /* ANSI X3.64-1979 (SCO-ish?) 1280 case 10: /* ANSI X3.64-1979 (SCO-ish?)
1278 * Select primary font, don't display 1281 * Select primary font, don't display
1279 * control chars if defined, don't set 1282 * control chars if defined, don't set
1280 * bit 8 on output. 1283 * bit 8 on output.
1281 */ 1284 */
1282 vc->vc_translate = set_translate(vc->vc_charset == 0 1285 vc->vc_translate = set_translate(vc->vc_charset == 0
1283 ? vc->vc_G0_charset 1286 ? vc->vc_G0_charset
1284 : vc->vc_G1_charset, vc); 1287 : vc->vc_G1_charset, vc);
1285 vc->vc_disp_ctrl = 0; 1288 vc->vc_disp_ctrl = 0;
1286 vc->vc_toggle_meta = 0; 1289 vc->vc_toggle_meta = 0;
1287 break; 1290 break;
1288 case 11: /* ANSI X3.64-1979 (SCO-ish?) 1291 case 11: /* ANSI X3.64-1979 (SCO-ish?)
1289 * Select first alternate font, lets 1292 * Select first alternate font, lets
1290 * chars < 32 be displayed as ROM chars. 1293 * chars < 32 be displayed as ROM chars.
1291 */ 1294 */
1292 vc->vc_translate = set_translate(IBMPC_MAP, vc); 1295 vc->vc_translate = set_translate(IBMPC_MAP, vc);
1293 vc->vc_disp_ctrl = 1; 1296 vc->vc_disp_ctrl = 1;
1294 vc->vc_toggle_meta = 0; 1297 vc->vc_toggle_meta = 0;
1295 break; 1298 break;
1296 case 12: /* ANSI X3.64-1979 (SCO-ish?) 1299 case 12: /* ANSI X3.64-1979 (SCO-ish?)
1297 * Select second alternate font, toggle 1300 * Select second alternate font, toggle
1298 * high bit before displaying as ROM char. 1301 * high bit before displaying as ROM char.
1299 */ 1302 */
1300 vc->vc_translate = set_translate(IBMPC_MAP, vc); 1303 vc->vc_translate = set_translate(IBMPC_MAP, vc);
1301 vc->vc_disp_ctrl = 1; 1304 vc->vc_disp_ctrl = 1;
1302 vc->vc_toggle_meta = 1; 1305 vc->vc_toggle_meta = 1;
1303 break; 1306 break;
1304 case 21: 1307 case 21:
1305 case 22: 1308 case 22:
1306 vc->vc_intensity = 1; 1309 vc->vc_intensity = 1;
1307 break; 1310 break;
1308 case 23: 1311 case 23:
1309 vc->vc_italic = 0; 1312 vc->vc_italic = 0;
1310 break; 1313 break;
1311 case 24: 1314 case 24:
1312 vc->vc_underline = 0; 1315 vc->vc_underline = 0;
1313 break; 1316 break;
1314 case 25: 1317 case 25:
1315 vc->vc_blink = 0; 1318 vc->vc_blink = 0;
1316 break; 1319 break;
1317 case 27: 1320 case 27:
1318 vc->vc_reverse = 0; 1321 vc->vc_reverse = 0;
1319 break; 1322 break;
1320 case 38: /* ANSI X3.64-1979 (SCO-ish?) 1323 case 38: /* ANSI X3.64-1979 (SCO-ish?)
1321 * Enables underscore, white foreground 1324 * Enables underscore, white foreground
1322 * with white underscore (Linux - use 1325 * with white underscore (Linux - use
1323 * default foreground). 1326 * default foreground).
1324 */ 1327 */
1325 vc->vc_color = (vc->vc_def_color & 0x0f) | (vc->vc_color & 0xf0); 1328 vc->vc_color = (vc->vc_def_color & 0x0f) | (vc->vc_color & 0xf0);
1326 vc->vc_underline = 1; 1329 vc->vc_underline = 1;
1327 break; 1330 break;
1328 case 39: /* ANSI X3.64-1979 (SCO-ish?) 1331 case 39: /* ANSI X3.64-1979 (SCO-ish?)
1329 * Disable underline option. 1332 * Disable underline option.
1330 * Reset colour to default? It did this 1333 * Reset colour to default? It did this
1331 * before... 1334 * before...
1332 */ 1335 */
1333 vc->vc_color = (vc->vc_def_color & 0x0f) | (vc->vc_color & 0xf0); 1336 vc->vc_color = (vc->vc_def_color & 0x0f) | (vc->vc_color & 0xf0);
1334 vc->vc_underline = 0; 1337 vc->vc_underline = 0;
1335 break; 1338 break;
1336 case 49: 1339 case 49:
1337 vc->vc_color = (vc->vc_def_color & 0xf0) | (vc->vc_color & 0x0f); 1340 vc->vc_color = (vc->vc_def_color & 0xf0) | (vc->vc_color & 0x0f);
1338 break; 1341 break;
1339 default: 1342 default:
1340 if (vc->vc_par[i] >= 30 && vc->vc_par[i] <= 37) 1343 if (vc->vc_par[i] >= 30 && vc->vc_par[i] <= 37)
1341 vc->vc_color = color_table[vc->vc_par[i] - 30] 1344 vc->vc_color = color_table[vc->vc_par[i] - 30]
1342 | (vc->vc_color & 0xf0); 1345 | (vc->vc_color & 0xf0);
1343 else if (vc->vc_par[i] >= 40 && vc->vc_par[i] <= 47) 1346 else if (vc->vc_par[i] >= 40 && vc->vc_par[i] <= 47)
1344 vc->vc_color = (color_table[vc->vc_par[i] - 40] << 4) 1347 vc->vc_color = (color_table[vc->vc_par[i] - 40] << 4)
1345 | (vc->vc_color & 0x0f); 1348 | (vc->vc_color & 0x0f);
1346 break; 1349 break;
1347 } 1350 }
1348 update_attr(vc); 1351 update_attr(vc);
1349 } 1352 }
1350 1353
1351 static void respond_string(const char *p, struct tty_struct *tty) 1354 static void respond_string(const char *p, struct tty_struct *tty)
1352 { 1355 {
1353 while (*p) { 1356 while (*p) {
1354 tty_insert_flip_char(tty, *p, 0); 1357 tty_insert_flip_char(tty, *p, 0);
1355 p++; 1358 p++;
1356 } 1359 }
1357 con_schedule_flip(tty); 1360 con_schedule_flip(tty);
1358 } 1361 }
1359 1362
1360 static void cursor_report(struct vc_data *vc, struct tty_struct *tty) 1363 static void cursor_report(struct vc_data *vc, struct tty_struct *tty)
1361 { 1364 {
1362 char buf[40]; 1365 char buf[40];
1363 1366
1364 sprintf(buf, "\033[%d;%dR", vc->vc_y + (vc->vc_decom ? vc->vc_top + 1 : 1), vc->vc_x + 1); 1367 sprintf(buf, "\033[%d;%dR", vc->vc_y + (vc->vc_decom ? vc->vc_top + 1 : 1), vc->vc_x + 1);
1365 respond_string(buf, tty); 1368 respond_string(buf, tty);
1366 } 1369 }
1367 1370
1368 static inline void status_report(struct tty_struct *tty) 1371 static inline void status_report(struct tty_struct *tty)
1369 { 1372 {
1370 respond_string("\033[0n", tty); /* Terminal ok */ 1373 respond_string("\033[0n", tty); /* Terminal ok */
1371 } 1374 }
1372 1375
1373 static inline void respond_ID(struct tty_struct * tty) 1376 static inline void respond_ID(struct tty_struct * tty)
1374 { 1377 {
1375 respond_string(VT102ID, tty); 1378 respond_string(VT102ID, tty);
1376 } 1379 }
1377 1380
1378 void mouse_report(struct tty_struct *tty, int butt, int mrx, int mry) 1381 void mouse_report(struct tty_struct *tty, int butt, int mrx, int mry)
1379 { 1382 {
1380 char buf[8]; 1383 char buf[8];
1381 1384
1382 sprintf(buf, "\033[M%c%c%c", (char)(' ' + butt), (char)('!' + mrx), 1385 sprintf(buf, "\033[M%c%c%c", (char)(' ' + butt), (char)('!' + mrx),
1383 (char)('!' + mry)); 1386 (char)('!' + mry));
1384 respond_string(buf, tty); 1387 respond_string(buf, tty);
1385 } 1388 }
1386 1389
1387 /* invoked via ioctl(TIOCLINUX) and through set_selection */ 1390 /* invoked via ioctl(TIOCLINUX) and through set_selection */
1388 int mouse_reporting(void) 1391 int mouse_reporting(void)
1389 { 1392 {
1390 return vc_cons[fg_console].d->vc_report_mouse; 1393 return vc_cons[fg_console].d->vc_report_mouse;
1391 } 1394 }
1392 1395
1393 /* console_sem is held */ 1396 /* console_sem is held */
1394 static void set_mode(struct vc_data *vc, int on_off) 1397 static void set_mode(struct vc_data *vc, int on_off)
1395 { 1398 {
1396 int i; 1399 int i;
1397 1400
1398 for (i = 0; i <= vc->vc_npar; i++) 1401 for (i = 0; i <= vc->vc_npar; i++)
1399 if (vc->vc_ques) { 1402 if (vc->vc_ques) {
1400 switch(vc->vc_par[i]) { /* DEC private modes set/reset */ 1403 switch(vc->vc_par[i]) { /* DEC private modes set/reset */
1401 case 1: /* Cursor keys send ^[Ox/^[[x */ 1404 case 1: /* Cursor keys send ^[Ox/^[[x */
1402 if (on_off) 1405 if (on_off)
1403 set_kbd(vc, decckm); 1406 set_kbd(vc, decckm);
1404 else 1407 else
1405 clr_kbd(vc, decckm); 1408 clr_kbd(vc, decckm);
1406 break; 1409 break;
1407 case 3: /* 80/132 mode switch unimplemented */ 1410 case 3: /* 80/132 mode switch unimplemented */
1408 vc->vc_deccolm = on_off; 1411 vc->vc_deccolm = on_off;
1409 #if 0 1412 #if 0
1410 vc_resize(deccolm ? 132 : 80, vc->vc_rows); 1413 vc_resize(deccolm ? 132 : 80, vc->vc_rows);
1411 /* this alone does not suffice; some user mode 1414 /* this alone does not suffice; some user mode
1412 utility has to change the hardware regs */ 1415 utility has to change the hardware regs */
1413 #endif 1416 #endif
1414 break; 1417 break;
1415 case 5: /* Inverted screen on/off */ 1418 case 5: /* Inverted screen on/off */
1416 if (vc->vc_decscnm != on_off) { 1419 if (vc->vc_decscnm != on_off) {
1417 vc->vc_decscnm = on_off; 1420 vc->vc_decscnm = on_off;
1418 invert_screen(vc, 0, vc->vc_screenbuf_size, 0); 1421 invert_screen(vc, 0, vc->vc_screenbuf_size, 0);
1419 update_attr(vc); 1422 update_attr(vc);
1420 } 1423 }
1421 break; 1424 break;
1422 case 6: /* Origin relative/absolute */ 1425 case 6: /* Origin relative/absolute */
1423 vc->vc_decom = on_off; 1426 vc->vc_decom = on_off;
1424 gotoxay(vc, 0, 0); 1427 gotoxay(vc, 0, 0);
1425 break; 1428 break;
1426 case 7: /* Autowrap on/off */ 1429 case 7: /* Autowrap on/off */
1427 vc->vc_decawm = on_off; 1430 vc->vc_decawm = on_off;
1428 break; 1431 break;
1429 case 8: /* Autorepeat on/off */ 1432 case 8: /* Autorepeat on/off */
1430 if (on_off) 1433 if (on_off)
1431 set_kbd(vc, decarm); 1434 set_kbd(vc, decarm);
1432 else 1435 else
1433 clr_kbd(vc, decarm); 1436 clr_kbd(vc, decarm);
1434 break; 1437 break;
1435 case 9: 1438 case 9:
1436 vc->vc_report_mouse = on_off ? 1 : 0; 1439 vc->vc_report_mouse = on_off ? 1 : 0;
1437 break; 1440 break;
1438 case 25: /* Cursor on/off */ 1441 case 25: /* Cursor on/off */
1439 vc->vc_deccm = on_off; 1442 vc->vc_deccm = on_off;
1440 break; 1443 break;
1441 case 1000: 1444 case 1000:
1442 vc->vc_report_mouse = on_off ? 2 : 0; 1445 vc->vc_report_mouse = on_off ? 2 : 0;
1443 break; 1446 break;
1444 } 1447 }
1445 } else { 1448 } else {
1446 switch(vc->vc_par[i]) { /* ANSI modes set/reset */ 1449 switch(vc->vc_par[i]) { /* ANSI modes set/reset */
1447 case 3: /* Monitor (display ctrls) */ 1450 case 3: /* Monitor (display ctrls) */
1448 vc->vc_disp_ctrl = on_off; 1451 vc->vc_disp_ctrl = on_off;
1449 break; 1452 break;
1450 case 4: /* Insert Mode on/off */ 1453 case 4: /* Insert Mode on/off */
1451 vc->vc_decim = on_off; 1454 vc->vc_decim = on_off;
1452 break; 1455 break;
1453 case 20: /* Lf, Enter == CrLf/Lf */ 1456 case 20: /* Lf, Enter == CrLf/Lf */
1454 if (on_off) 1457 if (on_off)
1455 set_kbd(vc, lnm); 1458 set_kbd(vc, lnm);
1456 else 1459 else
1457 clr_kbd(vc, lnm); 1460 clr_kbd(vc, lnm);
1458 break; 1461 break;
1459 } 1462 }
1460 } 1463 }
1461 } 1464 }
1462 1465
1463 /* console_sem is held */ 1466 /* console_sem is held */
1464 static void setterm_command(struct vc_data *vc) 1467 static void setterm_command(struct vc_data *vc)
1465 { 1468 {
1466 switch(vc->vc_par[0]) { 1469 switch(vc->vc_par[0]) {
1467 case 1: /* set color for underline mode */ 1470 case 1: /* set color for underline mode */
1468 if (vc->vc_can_do_color && 1471 if (vc->vc_can_do_color &&
1469 vc->vc_par[1] < 16) { 1472 vc->vc_par[1] < 16) {
1470 vc->vc_ulcolor = color_table[vc->vc_par[1]]; 1473 vc->vc_ulcolor = color_table[vc->vc_par[1]];
1471 if (vc->vc_underline) 1474 if (vc->vc_underline)
1472 update_attr(vc); 1475 update_attr(vc);
1473 } 1476 }
1474 break; 1477 break;
1475 case 2: /* set color for half intensity mode */ 1478 case 2: /* set color for half intensity mode */
1476 if (vc->vc_can_do_color && 1479 if (vc->vc_can_do_color &&
1477 vc->vc_par[1] < 16) { 1480 vc->vc_par[1] < 16) {
1478 vc->vc_halfcolor = color_table[vc->vc_par[1]]; 1481 vc->vc_halfcolor = color_table[vc->vc_par[1]];
1479 if (vc->vc_intensity == 0) 1482 if (vc->vc_intensity == 0)
1480 update_attr(vc); 1483 update_attr(vc);
1481 } 1484 }
1482 break; 1485 break;
1483 case 8: /* store colors as defaults */ 1486 case 8: /* store colors as defaults */
1484 vc->vc_def_color = vc->vc_attr; 1487 vc->vc_def_color = vc->vc_attr;
1485 if (vc->vc_hi_font_mask == 0x100) 1488 if (vc->vc_hi_font_mask == 0x100)
1486 vc->vc_def_color >>= 1; 1489 vc->vc_def_color >>= 1;
1487 default_attr(vc); 1490 default_attr(vc);
1488 update_attr(vc); 1491 update_attr(vc);
1489 break; 1492 break;
1490 case 9: /* set blanking interval */ 1493 case 9: /* set blanking interval */
1491 blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60; 1494 blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60;
1492 poke_blanked_console(); 1495 poke_blanked_console();
1493 break; 1496 break;
1494 case 10: /* set bell frequency in Hz */ 1497 case 10: /* set bell frequency in Hz */
1495 if (vc->vc_npar >= 1) 1498 if (vc->vc_npar >= 1)
1496 vc->vc_bell_pitch = vc->vc_par[1]; 1499 vc->vc_bell_pitch = vc->vc_par[1];
1497 else 1500 else
1498 vc->vc_bell_pitch = DEFAULT_BELL_PITCH; 1501 vc->vc_bell_pitch = DEFAULT_BELL_PITCH;
1499 break; 1502 break;
1500 case 11: /* set bell duration in msec */ 1503 case 11: /* set bell duration in msec */
1501 if (vc->vc_npar >= 1) 1504 if (vc->vc_npar >= 1)
1502 vc->vc_bell_duration = (vc->vc_par[1] < 2000) ? 1505 vc->vc_bell_duration = (vc->vc_par[1] < 2000) ?
1503 vc->vc_par[1] * HZ / 1000 : 0; 1506 vc->vc_par[1] * HZ / 1000 : 0;
1504 else 1507 else
1505 vc->vc_bell_duration = DEFAULT_BELL_DURATION; 1508 vc->vc_bell_duration = DEFAULT_BELL_DURATION;
1506 break; 1509 break;
1507 case 12: /* bring specified console to the front */ 1510 case 12: /* bring specified console to the front */
1508 if (vc->vc_par[1] >= 1 && vc_cons_allocated(vc->vc_par[1] - 1)) 1511 if (vc->vc_par[1] >= 1 && vc_cons_allocated(vc->vc_par[1] - 1))
1509 set_console(vc->vc_par[1] - 1); 1512 set_console(vc->vc_par[1] - 1);
1510 break; 1513 break;
1511 case 13: /* unblank the screen */ 1514 case 13: /* unblank the screen */
1512 poke_blanked_console(); 1515 poke_blanked_console();
1513 break; 1516 break;
1514 case 14: /* set vesa powerdown interval */ 1517 case 14: /* set vesa powerdown interval */
1515 vesa_off_interval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60 * HZ; 1518 vesa_off_interval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60 * HZ;
1516 break; 1519 break;
1517 case 15: /* activate the previous console */ 1520 case 15: /* activate the previous console */
1518 set_console(last_console); 1521 set_console(last_console);
1519 break; 1522 break;
1520 } 1523 }
1521 } 1524 }
1522 1525
1523 /* console_sem is held */ 1526 /* console_sem is held */
1524 static void csi_at(struct vc_data *vc, unsigned int nr) 1527 static void csi_at(struct vc_data *vc, unsigned int nr)
1525 { 1528 {
1526 if (nr > vc->vc_cols - vc->vc_x) 1529 if (nr > vc->vc_cols - vc->vc_x)
1527 nr = vc->vc_cols - vc->vc_x; 1530 nr = vc->vc_cols - vc->vc_x;
1528 else if (!nr) 1531 else if (!nr)
1529 nr = 1; 1532 nr = 1;
1530 insert_char(vc, nr); 1533 insert_char(vc, nr);
1531 } 1534 }
1532 1535
1533 /* console_sem is held */ 1536 /* console_sem is held */
1534 static void csi_L(struct vc_data *vc, unsigned int nr) 1537 static void csi_L(struct vc_data *vc, unsigned int nr)
1535 { 1538 {
1536 if (nr > vc->vc_rows - vc->vc_y) 1539 if (nr > vc->vc_rows - vc->vc_y)
1537 nr = vc->vc_rows - vc->vc_y; 1540 nr = vc->vc_rows - vc->vc_y;
1538 else if (!nr) 1541 else if (!nr)
1539 nr = 1; 1542 nr = 1;
1540 scrdown(vc, vc->vc_y, vc->vc_bottom, nr); 1543 scrdown(vc, vc->vc_y, vc->vc_bottom, nr);
1541 vc->vc_need_wrap = 0; 1544 vc->vc_need_wrap = 0;
1542 } 1545 }
1543 1546
1544 /* console_sem is held */ 1547 /* console_sem is held */
1545 static void csi_P(struct vc_data *vc, unsigned int nr) 1548 static void csi_P(struct vc_data *vc, unsigned int nr)
1546 { 1549 {
1547 if (nr > vc->vc_cols - vc->vc_x) 1550 if (nr > vc->vc_cols - vc->vc_x)
1548 nr = vc->vc_cols - vc->vc_x; 1551 nr = vc->vc_cols - vc->vc_x;
1549 else if (!nr) 1552 else if (!nr)
1550 nr = 1; 1553 nr = 1;
1551 delete_char(vc, nr); 1554 delete_char(vc, nr);
1552 } 1555 }
1553 1556
1554 /* console_sem is held */ 1557 /* console_sem is held */
1555 static void csi_M(struct vc_data *vc, unsigned int nr) 1558 static void csi_M(struct vc_data *vc, unsigned int nr)
1556 { 1559 {
1557 if (nr > vc->vc_rows - vc->vc_y) 1560 if (nr > vc->vc_rows - vc->vc_y)
1558 nr = vc->vc_rows - vc->vc_y; 1561 nr = vc->vc_rows - vc->vc_y;
1559 else if (!nr) 1562 else if (!nr)
1560 nr=1; 1563 nr=1;
1561 scrup(vc, vc->vc_y, vc->vc_bottom, nr); 1564 scrup(vc, vc->vc_y, vc->vc_bottom, nr);
1562 vc->vc_need_wrap = 0; 1565 vc->vc_need_wrap = 0;
1563 } 1566 }
1564 1567
1565 /* console_sem is held (except via vc_init->reset_terminal */ 1568 /* console_sem is held (except via vc_init->reset_terminal */
1566 static void save_cur(struct vc_data *vc) 1569 static void save_cur(struct vc_data *vc)
1567 { 1570 {
1568 vc->vc_saved_x = vc->vc_x; 1571 vc->vc_saved_x = vc->vc_x;
1569 vc->vc_saved_y = vc->vc_y; 1572 vc->vc_saved_y = vc->vc_y;
1570 vc->vc_s_intensity = vc->vc_intensity; 1573 vc->vc_s_intensity = vc->vc_intensity;
1571 vc->vc_s_italic = vc->vc_italic; 1574 vc->vc_s_italic = vc->vc_italic;
1572 vc->vc_s_underline = vc->vc_underline; 1575 vc->vc_s_underline = vc->vc_underline;
1573 vc->vc_s_blink = vc->vc_blink; 1576 vc->vc_s_blink = vc->vc_blink;
1574 vc->vc_s_reverse = vc->vc_reverse; 1577 vc->vc_s_reverse = vc->vc_reverse;
1575 vc->vc_s_charset = vc->vc_charset; 1578 vc->vc_s_charset = vc->vc_charset;
1576 vc->vc_s_color = vc->vc_color; 1579 vc->vc_s_color = vc->vc_color;
1577 vc->vc_saved_G0 = vc->vc_G0_charset; 1580 vc->vc_saved_G0 = vc->vc_G0_charset;
1578 vc->vc_saved_G1 = vc->vc_G1_charset; 1581 vc->vc_saved_G1 = vc->vc_G1_charset;
1579 } 1582 }
1580 1583
1581 /* console_sem is held */ 1584 /* console_sem is held */
1582 static void restore_cur(struct vc_data *vc) 1585 static void restore_cur(struct vc_data *vc)
1583 { 1586 {
1584 gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y); 1587 gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y);
1585 vc->vc_intensity = vc->vc_s_intensity; 1588 vc->vc_intensity = vc->vc_s_intensity;
1586 vc->vc_italic = vc->vc_s_italic; 1589 vc->vc_italic = vc->vc_s_italic;
1587 vc->vc_underline = vc->vc_s_underline; 1590 vc->vc_underline = vc->vc_s_underline;
1588 vc->vc_blink = vc->vc_s_blink; 1591 vc->vc_blink = vc->vc_s_blink;
1589 vc->vc_reverse = vc->vc_s_reverse; 1592 vc->vc_reverse = vc->vc_s_reverse;
1590 vc->vc_charset = vc->vc_s_charset; 1593 vc->vc_charset = vc->vc_s_charset;
1591 vc->vc_color = vc->vc_s_color; 1594 vc->vc_color = vc->vc_s_color;
1592 vc->vc_G0_charset = vc->vc_saved_G0; 1595 vc->vc_G0_charset = vc->vc_saved_G0;
1593 vc->vc_G1_charset = vc->vc_saved_G1; 1596 vc->vc_G1_charset = vc->vc_saved_G1;
1594 vc->vc_translate = set_translate(vc->vc_charset ? vc->vc_G1_charset : vc->vc_G0_charset, vc); 1597 vc->vc_translate = set_translate(vc->vc_charset ? vc->vc_G1_charset : vc->vc_G0_charset, vc);
1595 update_attr(vc); 1598 update_attr(vc);
1596 vc->vc_need_wrap = 0; 1599 vc->vc_need_wrap = 0;
1597 } 1600 }
1598 1601
1599 enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey, 1602 enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
1600 EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd, 1603 EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,
1601 ESpalette }; 1604 ESpalette };
1602 1605
1603 /* console_sem is held (except via vc_init()) */ 1606 /* console_sem is held (except via vc_init()) */
1604 static void reset_terminal(struct vc_data *vc, int do_clear) 1607 static void reset_terminal(struct vc_data *vc, int do_clear)
1605 { 1608 {
1606 vc->vc_top = 0; 1609 vc->vc_top = 0;
1607 vc->vc_bottom = vc->vc_rows; 1610 vc->vc_bottom = vc->vc_rows;
1608 vc->vc_state = ESnormal; 1611 vc->vc_state = ESnormal;
1609 vc->vc_ques = 0; 1612 vc->vc_ques = 0;
1610 vc->vc_translate = set_translate(LAT1_MAP, vc); 1613 vc->vc_translate = set_translate(LAT1_MAP, vc);
1611 vc->vc_G0_charset = LAT1_MAP; 1614 vc->vc_G0_charset = LAT1_MAP;
1612 vc->vc_G1_charset = GRAF_MAP; 1615 vc->vc_G1_charset = GRAF_MAP;
1613 vc->vc_charset = 0; 1616 vc->vc_charset = 0;
1614 vc->vc_need_wrap = 0; 1617 vc->vc_need_wrap = 0;
1615 vc->vc_report_mouse = 0; 1618 vc->vc_report_mouse = 0;
1616 vc->vc_utf = default_utf8; 1619 vc->vc_utf = default_utf8;
1617 vc->vc_utf_count = 0; 1620 vc->vc_utf_count = 0;
1618 1621
1619 vc->vc_disp_ctrl = 0; 1622 vc->vc_disp_ctrl = 0;
1620 vc->vc_toggle_meta = 0; 1623 vc->vc_toggle_meta = 0;
1621 1624
1622 vc->vc_decscnm = 0; 1625 vc->vc_decscnm = 0;
1623 vc->vc_decom = 0; 1626 vc->vc_decom = 0;
1624 vc->vc_decawm = 1; 1627 vc->vc_decawm = 1;
1625 vc->vc_deccm = global_cursor_default; 1628 vc->vc_deccm = global_cursor_default;
1626 vc->vc_decim = 0; 1629 vc->vc_decim = 0;
1627 1630
1628 set_kbd(vc, decarm); 1631 set_kbd(vc, decarm);
1629 clr_kbd(vc, decckm); 1632 clr_kbd(vc, decckm);
1630 clr_kbd(vc, kbdapplic); 1633 clr_kbd(vc, kbdapplic);
1631 clr_kbd(vc, lnm); 1634 clr_kbd(vc, lnm);
1632 kbd_table[vc->vc_num].lockstate = 0; 1635 kbd_table[vc->vc_num].lockstate = 0;
1633 kbd_table[vc->vc_num].slockstate = 0; 1636 kbd_table[vc->vc_num].slockstate = 0;
1634 kbd_table[vc->vc_num].ledmode = LED_SHOW_FLAGS; 1637 kbd_table[vc->vc_num].ledmode = LED_SHOW_FLAGS;
1635 kbd_table[vc->vc_num].ledflagstate = kbd_table[vc->vc_num].default_ledflagstate; 1638 kbd_table[vc->vc_num].ledflagstate = kbd_table[vc->vc_num].default_ledflagstate;
1636 /* do not do set_leds here because this causes an endless tasklet loop 1639 /* do not do set_leds here because this causes an endless tasklet loop
1637 when the keyboard hasn't been initialized yet */ 1640 when the keyboard hasn't been initialized yet */
1638 1641
1639 vc->vc_cursor_type = CUR_DEFAULT; 1642 vc->vc_cursor_type = cur_default;
1640 vc->vc_complement_mask = vc->vc_s_complement_mask; 1643 vc->vc_complement_mask = vc->vc_s_complement_mask;
1641 1644
1642 default_attr(vc); 1645 default_attr(vc);
1643 update_attr(vc); 1646 update_attr(vc);
1644 1647
1645 vc->vc_tab_stop[0] = 0x01010100; 1648 vc->vc_tab_stop[0] = 0x01010100;
1646 vc->vc_tab_stop[1] = 1649 vc->vc_tab_stop[1] =
1647 vc->vc_tab_stop[2] = 1650 vc->vc_tab_stop[2] =
1648 vc->vc_tab_stop[3] = 1651 vc->vc_tab_stop[3] =
1649 vc->vc_tab_stop[4] = 1652 vc->vc_tab_stop[4] =
1650 vc->vc_tab_stop[5] = 1653 vc->vc_tab_stop[5] =
1651 vc->vc_tab_stop[6] = 1654 vc->vc_tab_stop[6] =
1652 vc->vc_tab_stop[7] = 0x01010101; 1655 vc->vc_tab_stop[7] = 0x01010101;
1653 1656
1654 vc->vc_bell_pitch = DEFAULT_BELL_PITCH; 1657 vc->vc_bell_pitch = DEFAULT_BELL_PITCH;
1655 vc->vc_bell_duration = DEFAULT_BELL_DURATION; 1658 vc->vc_bell_duration = DEFAULT_BELL_DURATION;
1656 1659
1657 gotoxy(vc, 0, 0); 1660 gotoxy(vc, 0, 0);
1658 save_cur(vc); 1661 save_cur(vc);
1659 if (do_clear) 1662 if (do_clear)
1660 csi_J(vc, 2); 1663 csi_J(vc, 2);
1661 } 1664 }
1662 1665
1663 /* console_sem is held */ 1666 /* console_sem is held */
1664 static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) 1667 static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
1665 { 1668 {
1666 /* 1669 /*
1667 * Control characters can be used in the _middle_ 1670 * Control characters can be used in the _middle_
1668 * of an escape sequence. 1671 * of an escape sequence.
1669 */ 1672 */
1670 switch (c) { 1673 switch (c) {
1671 case 0: 1674 case 0:
1672 return; 1675 return;
1673 case 7: 1676 case 7:
1674 if (vc->vc_bell_duration) 1677 if (vc->vc_bell_duration)
1675 kd_mksound(vc->vc_bell_pitch, vc->vc_bell_duration); 1678 kd_mksound(vc->vc_bell_pitch, vc->vc_bell_duration);
1676 return; 1679 return;
1677 case 8: 1680 case 8:
1678 bs(vc); 1681 bs(vc);
1679 return; 1682 return;
1680 case 9: 1683 case 9:
1681 vc->vc_pos -= (vc->vc_x << 1); 1684 vc->vc_pos -= (vc->vc_x << 1);
1682 while (vc->vc_x < vc->vc_cols - 1) { 1685 while (vc->vc_x < vc->vc_cols - 1) {
1683 vc->vc_x++; 1686 vc->vc_x++;
1684 if (vc->vc_tab_stop[vc->vc_x >> 5] & (1 << (vc->vc_x & 31))) 1687 if (vc->vc_tab_stop[vc->vc_x >> 5] & (1 << (vc->vc_x & 31)))
1685 break; 1688 break;
1686 } 1689 }
1687 vc->vc_pos += (vc->vc_x << 1); 1690 vc->vc_pos += (vc->vc_x << 1);
1688 notify_write(vc, '\t'); 1691 notify_write(vc, '\t');
1689 return; 1692 return;
1690 case 10: case 11: case 12: 1693 case 10: case 11: case 12:
1691 lf(vc); 1694 lf(vc);
1692 if (!is_kbd(vc, lnm)) 1695 if (!is_kbd(vc, lnm))
1693 return; 1696 return;
1694 case 13: 1697 case 13:
1695 cr(vc); 1698 cr(vc);
1696 return; 1699 return;
1697 case 14: 1700 case 14:
1698 vc->vc_charset = 1; 1701 vc->vc_charset = 1;
1699 vc->vc_translate = set_translate(vc->vc_G1_charset, vc); 1702 vc->vc_translate = set_translate(vc->vc_G1_charset, vc);
1700 vc->vc_disp_ctrl = 1; 1703 vc->vc_disp_ctrl = 1;
1701 return; 1704 return;
1702 case 15: 1705 case 15:
1703 vc->vc_charset = 0; 1706 vc->vc_charset = 0;
1704 vc->vc_translate = set_translate(vc->vc_G0_charset, vc); 1707 vc->vc_translate = set_translate(vc->vc_G0_charset, vc);
1705 vc->vc_disp_ctrl = 0; 1708 vc->vc_disp_ctrl = 0;
1706 return; 1709 return;
1707 case 24: case 26: 1710 case 24: case 26:
1708 vc->vc_state = ESnormal; 1711 vc->vc_state = ESnormal;
1709 return; 1712 return;
1710 case 27: 1713 case 27:
1711 vc->vc_state = ESesc; 1714 vc->vc_state = ESesc;
1712 return; 1715 return;
1713 case 127: 1716 case 127:
1714 del(vc); 1717 del(vc);
1715 return; 1718 return;
1716 case 128+27: 1719 case 128+27:
1717 vc->vc_state = ESsquare; 1720 vc->vc_state = ESsquare;
1718 return; 1721 return;
1719 } 1722 }
1720 switch(vc->vc_state) { 1723 switch(vc->vc_state) {
1721 case ESesc: 1724 case ESesc:
1722 vc->vc_state = ESnormal; 1725 vc->vc_state = ESnormal;
1723 switch (c) { 1726 switch (c) {
1724 case '[': 1727 case '[':
1725 vc->vc_state = ESsquare; 1728 vc->vc_state = ESsquare;
1726 return; 1729 return;
1727 case ']': 1730 case ']':
1728 vc->vc_state = ESnonstd; 1731 vc->vc_state = ESnonstd;
1729 return; 1732 return;
1730 case '%': 1733 case '%':
1731 vc->vc_state = ESpercent; 1734 vc->vc_state = ESpercent;
1732 return; 1735 return;
1733 case 'E': 1736 case 'E':
1734 cr(vc); 1737 cr(vc);
1735 lf(vc); 1738 lf(vc);
1736 return; 1739 return;
1737 case 'M': 1740 case 'M':
1738 ri(vc); 1741 ri(vc);
1739 return; 1742 return;
1740 case 'D': 1743 case 'D':
1741 lf(vc); 1744 lf(vc);
1742 return; 1745 return;
1743 case 'H': 1746 case 'H':
1744 vc->vc_tab_stop[vc->vc_x >> 5] |= (1 << (vc->vc_x & 31)); 1747 vc->vc_tab_stop[vc->vc_x >> 5] |= (1 << (vc->vc_x & 31));
1745 return; 1748 return;
1746 case 'Z': 1749 case 'Z':
1747 respond_ID(tty); 1750 respond_ID(tty);
1748 return; 1751 return;
1749 case '7': 1752 case '7':
1750 save_cur(vc); 1753 save_cur(vc);
1751 return; 1754 return;
1752 case '8': 1755 case '8':
1753 restore_cur(vc); 1756 restore_cur(vc);
1754 return; 1757 return;
1755 case '(': 1758 case '(':
1756 vc->vc_state = ESsetG0; 1759 vc->vc_state = ESsetG0;
1757 return; 1760 return;
1758 case ')': 1761 case ')':
1759 vc->vc_state = ESsetG1; 1762 vc->vc_state = ESsetG1;
1760 return; 1763 return;
1761 case '#': 1764 case '#':
1762 vc->vc_state = EShash; 1765 vc->vc_state = EShash;
1763 return; 1766 return;
1764 case 'c': 1767 case 'c':
1765 reset_terminal(vc, 1); 1768 reset_terminal(vc, 1);
1766 return; 1769 return;
1767 case '>': /* Numeric keypad */ 1770 case '>': /* Numeric keypad */
1768 clr_kbd(vc, kbdapplic); 1771 clr_kbd(vc, kbdapplic);
1769 return; 1772 return;
1770 case '=': /* Appl. keypad */ 1773 case '=': /* Appl. keypad */
1771 set_kbd(vc, kbdapplic); 1774 set_kbd(vc, kbdapplic);
1772 return; 1775 return;
1773 } 1776 }
1774 return; 1777 return;
1775 case ESnonstd: 1778 case ESnonstd:
1776 if (c=='P') { /* palette escape sequence */ 1779 if (c=='P') { /* palette escape sequence */
1777 for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++) 1780 for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++)
1778 vc->vc_par[vc->vc_npar] = 0; 1781 vc->vc_par[vc->vc_npar] = 0;
1779 vc->vc_npar = 0; 1782 vc->vc_npar = 0;
1780 vc->vc_state = ESpalette; 1783 vc->vc_state = ESpalette;
1781 return; 1784 return;
1782 } else if (c=='R') { /* reset palette */ 1785 } else if (c=='R') { /* reset palette */
1783 reset_palette(vc); 1786 reset_palette(vc);
1784 vc->vc_state = ESnormal; 1787 vc->vc_state = ESnormal;
1785 } else 1788 } else
1786 vc->vc_state = ESnormal; 1789 vc->vc_state = ESnormal;
1787 return; 1790 return;
1788 case ESpalette: 1791 case ESpalette:
1789 if ( (c>='0'&&c<='9') || (c>='A'&&c<='F') || (c>='a'&&c<='f') ) { 1792 if ( (c>='0'&&c<='9') || (c>='A'&&c<='F') || (c>='a'&&c<='f') ) {
1790 vc->vc_par[vc->vc_npar++] = (c > '9' ? (c & 0xDF) - 'A' + 10 : c - '0'); 1793 vc->vc_par[vc->vc_npar++] = (c > '9' ? (c & 0xDF) - 'A' + 10 : c - '0');
1791 if (vc->vc_npar == 7) { 1794 if (vc->vc_npar == 7) {
1792 int i = vc->vc_par[0] * 3, j = 1; 1795 int i = vc->vc_par[0] * 3, j = 1;
1793 vc->vc_palette[i] = 16 * vc->vc_par[j++]; 1796 vc->vc_palette[i] = 16 * vc->vc_par[j++];
1794 vc->vc_palette[i++] += vc->vc_par[j++]; 1797 vc->vc_palette[i++] += vc->vc_par[j++];
1795 vc->vc_palette[i] = 16 * vc->vc_par[j++]; 1798 vc->vc_palette[i] = 16 * vc->vc_par[j++];
1796 vc->vc_palette[i++] += vc->vc_par[j++]; 1799 vc->vc_palette[i++] += vc->vc_par[j++];
1797 vc->vc_palette[i] = 16 * vc->vc_par[j++]; 1800 vc->vc_palette[i] = 16 * vc->vc_par[j++];
1798 vc->vc_palette[i] += vc->vc_par[j]; 1801 vc->vc_palette[i] += vc->vc_par[j];
1799 set_palette(vc); 1802 set_palette(vc);
1800 vc->vc_state = ESnormal; 1803 vc->vc_state = ESnormal;
1801 } 1804 }
1802 } else 1805 } else
1803 vc->vc_state = ESnormal; 1806 vc->vc_state = ESnormal;
1804 return; 1807 return;
1805 case ESsquare: 1808 case ESsquare:
1806 for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++) 1809 for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++)
1807 vc->vc_par[vc->vc_npar] = 0; 1810 vc->vc_par[vc->vc_npar] = 0;
1808 vc->vc_npar = 0; 1811 vc->vc_npar = 0;
1809 vc->vc_state = ESgetpars; 1812 vc->vc_state = ESgetpars;
1810 if (c == '[') { /* Function key */ 1813 if (c == '[') { /* Function key */
1811 vc->vc_state=ESfunckey; 1814 vc->vc_state=ESfunckey;
1812 return; 1815 return;
1813 } 1816 }
1814 vc->vc_ques = (c == '?'); 1817 vc->vc_ques = (c == '?');
1815 if (vc->vc_ques) 1818 if (vc->vc_ques)
1816 return; 1819 return;
1817 case ESgetpars: 1820 case ESgetpars:
1818 if (c == ';' && vc->vc_npar < NPAR - 1) { 1821 if (c == ';' && vc->vc_npar < NPAR - 1) {
1819 vc->vc_npar++; 1822 vc->vc_npar++;
1820 return; 1823 return;
1821 } else if (c>='0' && c<='9') { 1824 } else if (c>='0' && c<='9') {
1822 vc->vc_par[vc->vc_npar] *= 10; 1825 vc->vc_par[vc->vc_npar] *= 10;
1823 vc->vc_par[vc->vc_npar] += c - '0'; 1826 vc->vc_par[vc->vc_npar] += c - '0';
1824 return; 1827 return;
1825 } else 1828 } else
1826 vc->vc_state = ESgotpars; 1829 vc->vc_state = ESgotpars;
1827 case ESgotpars: 1830 case ESgotpars:
1828 vc->vc_state = ESnormal; 1831 vc->vc_state = ESnormal;
1829 switch(c) { 1832 switch(c) {
1830 case 'h': 1833 case 'h':
1831 set_mode(vc, 1); 1834 set_mode(vc, 1);
1832 return; 1835 return;
1833 case 'l': 1836 case 'l':
1834 set_mode(vc, 0); 1837 set_mode(vc, 0);
1835 return; 1838 return;
1836 case 'c': 1839 case 'c':
1837 if (vc->vc_ques) { 1840 if (vc->vc_ques) {
1838 if (vc->vc_par[0]) 1841 if (vc->vc_par[0])
1839 vc->vc_cursor_type = vc->vc_par[0] | (vc->vc_par[1] << 8) | (vc->vc_par[2] << 16); 1842 vc->vc_cursor_type = vc->vc_par[0] | (vc->vc_par[1] << 8) | (vc->vc_par[2] << 16);
1840 else 1843 else
1841 vc->vc_cursor_type = CUR_DEFAULT; 1844 vc->vc_cursor_type = cur_default;
1842 return; 1845 return;
1843 } 1846 }
1844 break; 1847 break;
1845 case 'm': 1848 case 'm':
1846 if (vc->vc_ques) { 1849 if (vc->vc_ques) {
1847 clear_selection(); 1850 clear_selection();
1848 if (vc->vc_par[0]) 1851 if (vc->vc_par[0])
1849 vc->vc_complement_mask = vc->vc_par[0] << 8 | vc->vc_par[1]; 1852 vc->vc_complement_mask = vc->vc_par[0] << 8 | vc->vc_par[1];
1850 else 1853 else
1851 vc->vc_complement_mask = vc->vc_s_complement_mask; 1854 vc->vc_complement_mask = vc->vc_s_complement_mask;
1852 return; 1855 return;
1853 } 1856 }
1854 break; 1857 break;
1855 case 'n': 1858 case 'n':
1856 if (!vc->vc_ques) { 1859 if (!vc->vc_ques) {
1857 if (vc->vc_par[0] == 5) 1860 if (vc->vc_par[0] == 5)
1858 status_report(tty); 1861 status_report(tty);
1859 else if (vc->vc_par[0] == 6) 1862 else if (vc->vc_par[0] == 6)
1860 cursor_report(vc, tty); 1863 cursor_report(vc, tty);
1861 } 1864 }
1862 return; 1865 return;
1863 } 1866 }
1864 if (vc->vc_ques) { 1867 if (vc->vc_ques) {
1865 vc->vc_ques = 0; 1868 vc->vc_ques = 0;
1866 return; 1869 return;
1867 } 1870 }
1868 switch(c) { 1871 switch(c) {
1869 case 'G': case '`': 1872 case 'G': case '`':
1870 if (vc->vc_par[0]) 1873 if (vc->vc_par[0])
1871 vc->vc_par[0]--; 1874 vc->vc_par[0]--;
1872 gotoxy(vc, vc->vc_par[0], vc->vc_y); 1875 gotoxy(vc, vc->vc_par[0], vc->vc_y);
1873 return; 1876 return;
1874 case 'A': 1877 case 'A':
1875 if (!vc->vc_par[0]) 1878 if (!vc->vc_par[0])
1876 vc->vc_par[0]++; 1879 vc->vc_par[0]++;
1877 gotoxy(vc, vc->vc_x, vc->vc_y - vc->vc_par[0]); 1880 gotoxy(vc, vc->vc_x, vc->vc_y - vc->vc_par[0]);
1878 return; 1881 return;
1879 case 'B': case 'e': 1882 case 'B': case 'e':
1880 if (!vc->vc_par[0]) 1883 if (!vc->vc_par[0])
1881 vc->vc_par[0]++; 1884 vc->vc_par[0]++;
1882 gotoxy(vc, vc->vc_x, vc->vc_y + vc->vc_par[0]); 1885 gotoxy(vc, vc->vc_x, vc->vc_y + vc->vc_par[0]);
1883 return; 1886 return;
1884 case 'C': case 'a': 1887 case 'C': case 'a':
1885 if (!vc->vc_par[0]) 1888 if (!vc->vc_par[0])
1886 vc->vc_par[0]++; 1889 vc->vc_par[0]++;
1887 gotoxy(vc, vc->vc_x + vc->vc_par[0], vc->vc_y); 1890 gotoxy(vc, vc->vc_x + vc->vc_par[0], vc->vc_y);
1888 return; 1891 return;
1889 case 'D': 1892 case 'D':
1890 if (!vc->vc_par[0]) 1893 if (!vc->vc_par[0])
1891 vc->vc_par[0]++; 1894 vc->vc_par[0]++;
1892 gotoxy(vc, vc->vc_x - vc->vc_par[0], vc->vc_y); 1895 gotoxy(vc, vc->vc_x - vc->vc_par[0], vc->vc_y);
1893 return; 1896 return;
1894 case 'E': 1897 case 'E':
1895 if (!vc->vc_par[0]) 1898 if (!vc->vc_par[0])
1896 vc->vc_par[0]++; 1899 vc->vc_par[0]++;
1897 gotoxy(vc, 0, vc->vc_y + vc->vc_par[0]); 1900 gotoxy(vc, 0, vc->vc_y + vc->vc_par[0]);
1898 return; 1901 return;
1899 case 'F': 1902 case 'F':
1900 if (!vc->vc_par[0]) 1903 if (!vc->vc_par[0])
1901 vc->vc_par[0]++; 1904 vc->vc_par[0]++;
1902 gotoxy(vc, 0, vc->vc_y - vc->vc_par[0]); 1905 gotoxy(vc, 0, vc->vc_y - vc->vc_par[0]);
1903 return; 1906 return;
1904 case 'd': 1907 case 'd':
1905 if (vc->vc_par[0]) 1908 if (vc->vc_par[0])
1906 vc->vc_par[0]--; 1909 vc->vc_par[0]--;
1907 gotoxay(vc, vc->vc_x ,vc->vc_par[0]); 1910 gotoxay(vc, vc->vc_x ,vc->vc_par[0]);
1908 return; 1911 return;
1909 case 'H': case 'f': 1912 case 'H': case 'f':
1910 if (vc->vc_par[0]) 1913 if (vc->vc_par[0])
1911 vc->vc_par[0]--; 1914 vc->vc_par[0]--;
1912 if (vc->vc_par[1]) 1915 if (vc->vc_par[1])
1913 vc->vc_par[1]--; 1916 vc->vc_par[1]--;
1914 gotoxay(vc, vc->vc_par[1], vc->vc_par[0]); 1917 gotoxay(vc, vc->vc_par[1], vc->vc_par[0]);
1915 return; 1918 return;
1916 case 'J': 1919 case 'J':
1917 csi_J(vc, vc->vc_par[0]); 1920 csi_J(vc, vc->vc_par[0]);
1918 return; 1921 return;
1919 case 'K': 1922 case 'K':
1920 csi_K(vc, vc->vc_par[0]); 1923 csi_K(vc, vc->vc_par[0]);
1921 return; 1924 return;
1922 case 'L': 1925 case 'L':
1923 csi_L(vc, vc->vc_par[0]); 1926 csi_L(vc, vc->vc_par[0]);
1924 return; 1927 return;
1925 case 'M': 1928 case 'M':
1926 csi_M(vc, vc->vc_par[0]); 1929 csi_M(vc, vc->vc_par[0]);
1927 return; 1930 return;
1928 case 'P': 1931 case 'P':
1929 csi_P(vc, vc->vc_par[0]); 1932 csi_P(vc, vc->vc_par[0]);
1930 return; 1933 return;
1931 case 'c': 1934 case 'c':
1932 if (!vc->vc_par[0]) 1935 if (!vc->vc_par[0])
1933 respond_ID(tty); 1936 respond_ID(tty);
1934 return; 1937 return;
1935 case 'g': 1938 case 'g':
1936 if (!vc->vc_par[0]) 1939 if (!vc->vc_par[0])
1937 vc->vc_tab_stop[vc->vc_x >> 5] &= ~(1 << (vc->vc_x & 31)); 1940 vc->vc_tab_stop[vc->vc_x >> 5] &= ~(1 << (vc->vc_x & 31));
1938 else if (vc->vc_par[0] == 3) { 1941 else if (vc->vc_par[0] == 3) {
1939 vc->vc_tab_stop[0] = 1942 vc->vc_tab_stop[0] =
1940 vc->vc_tab_stop[1] = 1943 vc->vc_tab_stop[1] =
1941 vc->vc_tab_stop[2] = 1944 vc->vc_tab_stop[2] =
1942 vc->vc_tab_stop[3] = 1945 vc->vc_tab_stop[3] =
1943 vc->vc_tab_stop[4] = 1946 vc->vc_tab_stop[4] =
1944 vc->vc_tab_stop[5] = 1947 vc->vc_tab_stop[5] =
1945 vc->vc_tab_stop[6] = 1948 vc->vc_tab_stop[6] =
1946 vc->vc_tab_stop[7] = 0; 1949 vc->vc_tab_stop[7] = 0;
1947 } 1950 }
1948 return; 1951 return;
1949 case 'm': 1952 case 'm':
1950 csi_m(vc); 1953 csi_m(vc);
1951 return; 1954 return;
1952 case 'q': /* DECLL - but only 3 leds */ 1955 case 'q': /* DECLL - but only 3 leds */
1953 /* map 0,1,2,3 to 0,1,2,4 */ 1956 /* map 0,1,2,3 to 0,1,2,4 */
1954 if (vc->vc_par[0] < 4) 1957 if (vc->vc_par[0] < 4)
1955 setledstate(kbd_table + vc->vc_num, 1958 setledstate(kbd_table + vc->vc_num,
1956 (vc->vc_par[0] < 3) ? vc->vc_par[0] : 4); 1959 (vc->vc_par[0] < 3) ? vc->vc_par[0] : 4);
1957 return; 1960 return;
1958 case 'r': 1961 case 'r':
1959 if (!vc->vc_par[0]) 1962 if (!vc->vc_par[0])
1960 vc->vc_par[0]++; 1963 vc->vc_par[0]++;
1961 if (!vc->vc_par[1]) 1964 if (!vc->vc_par[1])
1962 vc->vc_par[1] = vc->vc_rows; 1965 vc->vc_par[1] = vc->vc_rows;
1963 /* Minimum allowed region is 2 lines */ 1966 /* Minimum allowed region is 2 lines */
1964 if (vc->vc_par[0] < vc->vc_par[1] && 1967 if (vc->vc_par[0] < vc->vc_par[1] &&
1965 vc->vc_par[1] <= vc->vc_rows) { 1968 vc->vc_par[1] <= vc->vc_rows) {
1966 vc->vc_top = vc->vc_par[0] - 1; 1969 vc->vc_top = vc->vc_par[0] - 1;
1967 vc->vc_bottom = vc->vc_par[1]; 1970 vc->vc_bottom = vc->vc_par[1];
1968 gotoxay(vc, 0, 0); 1971 gotoxay(vc, 0, 0);
1969 } 1972 }
1970 return; 1973 return;
1971 case 's': 1974 case 's':
1972 save_cur(vc); 1975 save_cur(vc);
1973 return; 1976 return;
1974 case 'u': 1977 case 'u':
1975 restore_cur(vc); 1978 restore_cur(vc);
1976 return; 1979 return;
1977 case 'X': 1980 case 'X':
1978 csi_X(vc, vc->vc_par[0]); 1981 csi_X(vc, vc->vc_par[0]);
1979 return; 1982 return;
1980 case '@': 1983 case '@':
1981 csi_at(vc, vc->vc_par[0]); 1984 csi_at(vc, vc->vc_par[0]);
1982 return; 1985 return;
1983 case ']': /* setterm functions */ 1986 case ']': /* setterm functions */
1984 setterm_command(vc); 1987 setterm_command(vc);
1985 return; 1988 return;
1986 } 1989 }
1987 return; 1990 return;
1988 case ESpercent: 1991 case ESpercent:
1989 vc->vc_state = ESnormal; 1992 vc->vc_state = ESnormal;
1990 switch (c) { 1993 switch (c) {
1991 case '@': /* defined in ISO 2022 */ 1994 case '@': /* defined in ISO 2022 */
1992 vc->vc_utf = 0; 1995 vc->vc_utf = 0;
1993 return; 1996 return;
1994 case 'G': /* prelim official escape code */ 1997 case 'G': /* prelim official escape code */
1995 case '8': /* retained for compatibility */ 1998 case '8': /* retained for compatibility */
1996 vc->vc_utf = 1; 1999 vc->vc_utf = 1;
1997 return; 2000 return;
1998 } 2001 }
1999 return; 2002 return;
2000 case ESfunckey: 2003 case ESfunckey:
2001 vc->vc_state = ESnormal; 2004 vc->vc_state = ESnormal;
2002 return; 2005 return;
2003 case EShash: 2006 case EShash:
2004 vc->vc_state = ESnormal; 2007 vc->vc_state = ESnormal;
2005 if (c == '8') { 2008 if (c == '8') {
2006 /* DEC screen alignment test. kludge :-) */ 2009 /* DEC screen alignment test. kludge :-) */
2007 vc->vc_video_erase_char = 2010 vc->vc_video_erase_char =
2008 (vc->vc_video_erase_char & 0xff00) | 'E'; 2011 (vc->vc_video_erase_char & 0xff00) | 'E';
2009 csi_J(vc, 2); 2012 csi_J(vc, 2);
2010 vc->vc_video_erase_char = 2013 vc->vc_video_erase_char =
2011 (vc->vc_video_erase_char & 0xff00) | ' '; 2014 (vc->vc_video_erase_char & 0xff00) | ' ';
2012 do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); 2015 do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2);
2013 } 2016 }
2014 return; 2017 return;
2015 case ESsetG0: 2018 case ESsetG0:
2016 if (c == '0') 2019 if (c == '0')
2017 vc->vc_G0_charset = GRAF_MAP; 2020 vc->vc_G0_charset = GRAF_MAP;
2018 else if (c == 'B') 2021 else if (c == 'B')
2019 vc->vc_G0_charset = LAT1_MAP; 2022 vc->vc_G0_charset = LAT1_MAP;
2020 else if (c == 'U') 2023 else if (c == 'U')
2021 vc->vc_G0_charset = IBMPC_MAP; 2024 vc->vc_G0_charset = IBMPC_MAP;
2022 else if (c == 'K') 2025 else if (c == 'K')
2023 vc->vc_G0_charset = USER_MAP; 2026 vc->vc_G0_charset = USER_MAP;
2024 if (vc->vc_charset == 0) 2027 if (vc->vc_charset == 0)
2025 vc->vc_translate = set_translate(vc->vc_G0_charset, vc); 2028 vc->vc_translate = set_translate(vc->vc_G0_charset, vc);
2026 vc->vc_state = ESnormal; 2029 vc->vc_state = ESnormal;
2027 return; 2030 return;
2028 case ESsetG1: 2031 case ESsetG1:
2029 if (c == '0') 2032 if (c == '0')
2030 vc->vc_G1_charset = GRAF_MAP; 2033 vc->vc_G1_charset = GRAF_MAP;
2031 else if (c == 'B') 2034 else if (c == 'B')
2032 vc->vc_G1_charset = LAT1_MAP; 2035 vc->vc_G1_charset = LAT1_MAP;
2033 else if (c == 'U') 2036 else if (c == 'U')
2034 vc->vc_G1_charset = IBMPC_MAP; 2037 vc->vc_G1_charset = IBMPC_MAP;
2035 else if (c == 'K') 2038 else if (c == 'K')
2036 vc->vc_G1_charset = USER_MAP; 2039 vc->vc_G1_charset = USER_MAP;
2037 if (vc->vc_charset == 1) 2040 if (vc->vc_charset == 1)
2038 vc->vc_translate = set_translate(vc->vc_G1_charset, vc); 2041 vc->vc_translate = set_translate(vc->vc_G1_charset, vc);
2039 vc->vc_state = ESnormal; 2042 vc->vc_state = ESnormal;
2040 return; 2043 return;
2041 default: 2044 default:
2042 vc->vc_state = ESnormal; 2045 vc->vc_state = ESnormal;
2043 } 2046 }
2044 } 2047 }
2045 2048
2046 /* This is a temporary buffer used to prepare a tty console write 2049 /* This is a temporary buffer used to prepare a tty console write
2047 * so that we can easily avoid touching user space while holding the 2050 * so that we can easily avoid touching user space while holding the
2048 * console spinlock. It is allocated in con_init and is shared by 2051 * console spinlock. It is allocated in con_init and is shared by
2049 * this code and the vc_screen read/write tty calls. 2052 * this code and the vc_screen read/write tty calls.
2050 * 2053 *
2051 * We have to allocate this statically in the kernel data section 2054 * We have to allocate this statically in the kernel data section
2052 * since console_init (and thus con_init) are called before any 2055 * since console_init (and thus con_init) are called before any
2053 * kernel memory allocation is available. 2056 * kernel memory allocation is available.
2054 */ 2057 */
2055 char con_buf[CON_BUF_SIZE]; 2058 char con_buf[CON_BUF_SIZE];
2056 DEFINE_MUTEX(con_buf_mtx); 2059 DEFINE_MUTEX(con_buf_mtx);
2057 2060
2058 /* is_double_width() is based on the wcwidth() implementation by 2061 /* is_double_width() is based on the wcwidth() implementation by
2059 * Markus Kuhn -- 2007-05-26 (Unicode 5.0) 2062 * Markus Kuhn -- 2007-05-26 (Unicode 5.0)
2060 * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c 2063 * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
2061 */ 2064 */
2062 struct interval { 2065 struct interval {
2063 uint32_t first; 2066 uint32_t first;
2064 uint32_t last; 2067 uint32_t last;
2065 }; 2068 };
2066 2069
2067 static int bisearch(uint32_t ucs, const struct interval *table, int max) 2070 static int bisearch(uint32_t ucs, const struct interval *table, int max)
2068 { 2071 {
2069 int min = 0; 2072 int min = 0;
2070 int mid; 2073 int mid;
2071 2074
2072 if (ucs < table[0].first || ucs > table[max].last) 2075 if (ucs < table[0].first || ucs > table[max].last)
2073 return 0; 2076 return 0;
2074 while (max >= min) { 2077 while (max >= min) {
2075 mid = (min + max) / 2; 2078 mid = (min + max) / 2;
2076 if (ucs > table[mid].last) 2079 if (ucs > table[mid].last)
2077 min = mid + 1; 2080 min = mid + 1;
2078 else if (ucs < table[mid].first) 2081 else if (ucs < table[mid].first)
2079 max = mid - 1; 2082 max = mid - 1;
2080 else 2083 else
2081 return 1; 2084 return 1;
2082 } 2085 }
2083 return 0; 2086 return 0;
2084 } 2087 }
2085 2088
2086 static int is_double_width(uint32_t ucs) 2089 static int is_double_width(uint32_t ucs)
2087 { 2090 {
2088 static const struct interval double_width[] = { 2091 static const struct interval double_width[] = {
2089 { 0x1100, 0x115F }, { 0x2329, 0x232A }, { 0x2E80, 0x303E }, 2092 { 0x1100, 0x115F }, { 0x2329, 0x232A }, { 0x2E80, 0x303E },
2090 { 0x3040, 0xA4CF }, { 0xAC00, 0xD7A3 }, { 0xF900, 0xFAFF }, 2093 { 0x3040, 0xA4CF }, { 0xAC00, 0xD7A3 }, { 0xF900, 0xFAFF },
2091 { 0xFE10, 0xFE19 }, { 0xFE30, 0xFE6F }, { 0xFF00, 0xFF60 }, 2094 { 0xFE10, 0xFE19 }, { 0xFE30, 0xFE6F }, { 0xFF00, 0xFF60 },
2092 { 0xFFE0, 0xFFE6 }, { 0x20000, 0x2FFFD }, { 0x30000, 0x3FFFD } 2095 { 0xFFE0, 0xFFE6 }, { 0x20000, 0x2FFFD }, { 0x30000, 0x3FFFD }
2093 }; 2096 };
2094 return bisearch(ucs, double_width, ARRAY_SIZE(double_width) - 1); 2097 return bisearch(ucs, double_width, ARRAY_SIZE(double_width) - 1);
2095 } 2098 }
2096 2099
2097 /* acquires console_sem */ 2100 /* acquires console_sem */
2098 static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count) 2101 static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count)
2099 { 2102 {
2100 #ifdef VT_BUF_VRAM_ONLY 2103 #ifdef VT_BUF_VRAM_ONLY
2101 #define FLUSH do { } while(0); 2104 #define FLUSH do { } while(0);
2102 #else 2105 #else
2103 #define FLUSH if (draw_x >= 0) { \ 2106 #define FLUSH if (draw_x >= 0) { \
2104 vc->vc_sw->con_putcs(vc, (u16 *)draw_from, (u16 *)draw_to - (u16 *)draw_from, vc->vc_y, draw_x); \ 2107 vc->vc_sw->con_putcs(vc, (u16 *)draw_from, (u16 *)draw_to - (u16 *)draw_from, vc->vc_y, draw_x); \
2105 draw_x = -1; \ 2108 draw_x = -1; \
2106 } 2109 }
2107 #endif 2110 #endif
2108 2111
2109 int c, tc, ok, n = 0, draw_x = -1; 2112 int c, tc, ok, n = 0, draw_x = -1;
2110 unsigned int currcons; 2113 unsigned int currcons;
2111 unsigned long draw_from = 0, draw_to = 0; 2114 unsigned long draw_from = 0, draw_to = 0;
2112 struct vc_data *vc; 2115 struct vc_data *vc;
2113 unsigned char vc_attr; 2116 unsigned char vc_attr;
2114 struct vt_notifier_param param; 2117 struct vt_notifier_param param;
2115 uint8_t rescan; 2118 uint8_t rescan;
2116 uint8_t inverse; 2119 uint8_t inverse;
2117 uint8_t width; 2120 uint8_t width;
2118 u16 himask, charmask; 2121 u16 himask, charmask;
2119 const unsigned char *orig_buf = NULL; 2122 const unsigned char *orig_buf = NULL;
2120 int orig_count; 2123 int orig_count;
2121 2124
2122 if (in_interrupt()) 2125 if (in_interrupt())
2123 return count; 2126 return count;
2124 2127
2125 might_sleep(); 2128 might_sleep();
2126 2129
2127 acquire_console_sem(); 2130 acquire_console_sem();
2128 vc = tty->driver_data; 2131 vc = tty->driver_data;
2129 if (vc == NULL) { 2132 if (vc == NULL) {
2130 printk(KERN_ERR "vt: argh, driver_data is NULL !\n"); 2133 printk(KERN_ERR "vt: argh, driver_data is NULL !\n");
2131 release_console_sem(); 2134 release_console_sem();
2132 return 0; 2135 return 0;
2133 } 2136 }
2134 2137
2135 currcons = vc->vc_num; 2138 currcons = vc->vc_num;
2136 if (!vc_cons_allocated(currcons)) { 2139 if (!vc_cons_allocated(currcons)) {
2137 /* could this happen? */ 2140 /* could this happen? */
2138 printk_once("con_write: tty %d not allocated\n", currcons+1); 2141 printk_once("con_write: tty %d not allocated\n", currcons+1);
2139 release_console_sem(); 2142 release_console_sem();
2140 return 0; 2143 return 0;
2141 } 2144 }
2142 orig_buf = buf; 2145 orig_buf = buf;
2143 orig_count = count; 2146 orig_count = count;
2144 2147
2145 himask = vc->vc_hi_font_mask; 2148 himask = vc->vc_hi_font_mask;
2146 charmask = himask ? 0x1ff : 0xff; 2149 charmask = himask ? 0x1ff : 0xff;
2147 2150
2148 /* undraw cursor first */ 2151 /* undraw cursor first */
2149 if (IS_FG(vc)) 2152 if (IS_FG(vc))
2150 hide_cursor(vc); 2153 hide_cursor(vc);
2151 2154
2152 param.vc = vc; 2155 param.vc = vc;
2153 2156
2154 while (!tty->stopped && count) { 2157 while (!tty->stopped && count) {
2155 int orig = *buf; 2158 int orig = *buf;
2156 c = orig; 2159 c = orig;
2157 buf++; 2160 buf++;
2158 n++; 2161 n++;
2159 count--; 2162 count--;
2160 rescan = 0; 2163 rescan = 0;
2161 inverse = 0; 2164 inverse = 0;
2162 width = 1; 2165 width = 1;
2163 2166
2164 /* Do no translation at all in control states */ 2167 /* Do no translation at all in control states */
2165 if (vc->vc_state != ESnormal) { 2168 if (vc->vc_state != ESnormal) {
2166 tc = c; 2169 tc = c;
2167 } else if (vc->vc_utf && !vc->vc_disp_ctrl) { 2170 } else if (vc->vc_utf && !vc->vc_disp_ctrl) {
2168 /* Combine UTF-8 into Unicode in vc_utf_char. 2171 /* Combine UTF-8 into Unicode in vc_utf_char.
2169 * vc_utf_count is the number of continuation bytes still 2172 * vc_utf_count is the number of continuation bytes still
2170 * expected to arrive. 2173 * expected to arrive.
2171 * vc_npar is the number of continuation bytes arrived so 2174 * vc_npar is the number of continuation bytes arrived so
2172 * far 2175 * far
2173 */ 2176 */
2174 rescan_last_byte: 2177 rescan_last_byte:
2175 if ((c & 0xc0) == 0x80) { 2178 if ((c & 0xc0) == 0x80) {
2176 /* Continuation byte received */ 2179 /* Continuation byte received */
2177 static const uint32_t utf8_length_changes[] = { 0x0000007f, 0x000007ff, 0x0000ffff, 0x001fffff, 0x03ffffff, 0x7fffffff }; 2180 static const uint32_t utf8_length_changes[] = { 0x0000007f, 0x000007ff, 0x0000ffff, 0x001fffff, 0x03ffffff, 0x7fffffff };
2178 if (vc->vc_utf_count) { 2181 if (vc->vc_utf_count) {
2179 vc->vc_utf_char = (vc->vc_utf_char << 6) | (c & 0x3f); 2182 vc->vc_utf_char = (vc->vc_utf_char << 6) | (c & 0x3f);
2180 vc->vc_npar++; 2183 vc->vc_npar++;
2181 if (--vc->vc_utf_count) { 2184 if (--vc->vc_utf_count) {
2182 /* Still need some bytes */ 2185 /* Still need some bytes */
2183 continue; 2186 continue;
2184 } 2187 }
2185 /* Got a whole character */ 2188 /* Got a whole character */
2186 c = vc->vc_utf_char; 2189 c = vc->vc_utf_char;
2187 /* Reject overlong sequences */ 2190 /* Reject overlong sequences */
2188 if (c <= utf8_length_changes[vc->vc_npar - 1] || 2191 if (c <= utf8_length_changes[vc->vc_npar - 1] ||
2189 c > utf8_length_changes[vc->vc_npar]) 2192 c > utf8_length_changes[vc->vc_npar])
2190 c = 0xfffd; 2193 c = 0xfffd;
2191 } else { 2194 } else {
2192 /* Unexpected continuation byte */ 2195 /* Unexpected continuation byte */
2193 vc->vc_utf_count = 0; 2196 vc->vc_utf_count = 0;
2194 c = 0xfffd; 2197 c = 0xfffd;
2195 } 2198 }
2196 } else { 2199 } else {
2197 /* Single ASCII byte or first byte of a sequence received */ 2200 /* Single ASCII byte or first byte of a sequence received */
2198 if (vc->vc_utf_count) { 2201 if (vc->vc_utf_count) {
2199 /* Continuation byte expected */ 2202 /* Continuation byte expected */
2200 rescan = 1; 2203 rescan = 1;
2201 vc->vc_utf_count = 0; 2204 vc->vc_utf_count = 0;
2202 c = 0xfffd; 2205 c = 0xfffd;
2203 } else if (c > 0x7f) { 2206 } else if (c > 0x7f) {
2204 /* First byte of a multibyte sequence received */ 2207 /* First byte of a multibyte sequence received */
2205 vc->vc_npar = 0; 2208 vc->vc_npar = 0;
2206 if ((c & 0xe0) == 0xc0) { 2209 if ((c & 0xe0) == 0xc0) {
2207 vc->vc_utf_count = 1; 2210 vc->vc_utf_count = 1;
2208 vc->vc_utf_char = (c & 0x1f); 2211 vc->vc_utf_char = (c & 0x1f);
2209 } else if ((c & 0xf0) == 0xe0) { 2212 } else if ((c & 0xf0) == 0xe0) {
2210 vc->vc_utf_count = 2; 2213 vc->vc_utf_count = 2;
2211 vc->vc_utf_char = (c & 0x0f); 2214 vc->vc_utf_char = (c & 0x0f);
2212 } else if ((c & 0xf8) == 0xf0) { 2215 } else if ((c & 0xf8) == 0xf0) {
2213 vc->vc_utf_count = 3; 2216 vc->vc_utf_count = 3;
2214 vc->vc_utf_char = (c & 0x07); 2217 vc->vc_utf_char = (c & 0x07);
2215 } else if ((c & 0xfc) == 0xf8) { 2218 } else if ((c & 0xfc) == 0xf8) {
2216 vc->vc_utf_count = 4; 2219 vc->vc_utf_count = 4;
2217 vc->vc_utf_char = (c & 0x03); 2220 vc->vc_utf_char = (c & 0x03);
2218 } else if ((c & 0xfe) == 0xfc) { 2221 } else if ((c & 0xfe) == 0xfc) {
2219 vc->vc_utf_count = 5; 2222 vc->vc_utf_count = 5;
2220 vc->vc_utf_char = (c & 0x01); 2223 vc->vc_utf_char = (c & 0x01);
2221 } else { 2224 } else {
2222 /* 254 and 255 are invalid */ 2225 /* 254 and 255 are invalid */
2223 c = 0xfffd; 2226 c = 0xfffd;
2224 } 2227 }
2225 if (vc->vc_utf_count) { 2228 if (vc->vc_utf_count) {
2226 /* Still need some bytes */ 2229 /* Still need some bytes */
2227 continue; 2230 continue;
2228 } 2231 }
2229 } 2232 }
2230 /* Nothing to do if an ASCII byte was received */ 2233 /* Nothing to do if an ASCII byte was received */
2231 } 2234 }
2232 /* End of UTF-8 decoding. */ 2235 /* End of UTF-8 decoding. */
2233 /* c is the received character, or U+FFFD for invalid sequences. */ 2236 /* c is the received character, or U+FFFD for invalid sequences. */
2234 /* Replace invalid Unicode code points with U+FFFD too */ 2237 /* Replace invalid Unicode code points with U+FFFD too */
2235 if ((c >= 0xd800 && c <= 0xdfff) || c == 0xfffe || c == 0xffff) 2238 if ((c >= 0xd800 && c <= 0xdfff) || c == 0xfffe || c == 0xffff)
2236 c = 0xfffd; 2239 c = 0xfffd;
2237 tc = c; 2240 tc = c;
2238 } else { /* no utf or alternate charset mode */ 2241 } else { /* no utf or alternate charset mode */
2239 tc = vc_translate(vc, c); 2242 tc = vc_translate(vc, c);
2240 } 2243 }
2241 2244
2242 param.c = tc; 2245 param.c = tc;
2243 if (atomic_notifier_call_chain(&vt_notifier_list, VT_PREWRITE, 2246 if (atomic_notifier_call_chain(&vt_notifier_list, VT_PREWRITE,
2244 &param) == NOTIFY_STOP) 2247 &param) == NOTIFY_STOP)
2245 continue; 2248 continue;
2246 2249
2247 /* If the original code was a control character we 2250 /* If the original code was a control character we
2248 * only allow a glyph to be displayed if the code is 2251 * only allow a glyph to be displayed if the code is
2249 * not normally used (such as for cursor movement) or 2252 * not normally used (such as for cursor movement) or
2250 * if the disp_ctrl mode has been explicitly enabled. 2253 * if the disp_ctrl mode has been explicitly enabled.
2251 * Certain characters (as given by the CTRL_ALWAYS 2254 * Certain characters (as given by the CTRL_ALWAYS
2252 * bitmap) are always displayed as control characters, 2255 * bitmap) are always displayed as control characters,
2253 * as the console would be pretty useless without 2256 * as the console would be pretty useless without
2254 * them; to display an arbitrary font position use the 2257 * them; to display an arbitrary font position use the
2255 * direct-to-font zone in UTF-8 mode. 2258 * direct-to-font zone in UTF-8 mode.
2256 */ 2259 */
2257 ok = tc && (c >= 32 || 2260 ok = tc && (c >= 32 ||
2258 !(vc->vc_disp_ctrl ? (CTRL_ALWAYS >> c) & 1 : 2261 !(vc->vc_disp_ctrl ? (CTRL_ALWAYS >> c) & 1 :
2259 vc->vc_utf || ((CTRL_ACTION >> c) & 1))) 2262 vc->vc_utf || ((CTRL_ACTION >> c) & 1)))
2260 && (c != 127 || vc->vc_disp_ctrl) 2263 && (c != 127 || vc->vc_disp_ctrl)
2261 && (c != 128+27); 2264 && (c != 128+27);
2262 2265
2263 if (vc->vc_state == ESnormal && ok) { 2266 if (vc->vc_state == ESnormal && ok) {
2264 if (vc->vc_utf && !vc->vc_disp_ctrl) { 2267 if (vc->vc_utf && !vc->vc_disp_ctrl) {
2265 if (is_double_width(c)) 2268 if (is_double_width(c))
2266 width = 2; 2269 width = 2;
2267 } 2270 }
2268 /* Now try to find out how to display it */ 2271 /* Now try to find out how to display it */
2269 tc = conv_uni_to_pc(vc, tc); 2272 tc = conv_uni_to_pc(vc, tc);
2270 if (tc & ~charmask) { 2273 if (tc & ~charmask) {
2271 if (tc == -1 || tc == -2) { 2274 if (tc == -1 || tc == -2) {
2272 continue; /* nothing to display */ 2275 continue; /* nothing to display */
2273 } 2276 }
2274 /* Glyph not found */ 2277 /* Glyph not found */
2275 if ((!(vc->vc_utf && !vc->vc_disp_ctrl) || c < 128) && !(c & ~charmask)) { 2278 if ((!(vc->vc_utf && !vc->vc_disp_ctrl) || c < 128) && !(c & ~charmask)) {
2276 /* In legacy mode use the glyph we get by a 1:1 mapping. 2279 /* In legacy mode use the glyph we get by a 1:1 mapping.
2277 This would make absolutely no sense with Unicode in mind, 2280 This would make absolutely no sense with Unicode in mind,
2278 but do this for ASCII characters since a font may lack 2281 but do this for ASCII characters since a font may lack
2279 Unicode mapping info and we don't want to end up with 2282 Unicode mapping info and we don't want to end up with
2280 having question marks only. */ 2283 having question marks only. */
2281 tc = c; 2284 tc = c;
2282 } else { 2285 } else {
2283 /* Display U+FFFD. If it's not found, display an inverse question mark. */ 2286 /* Display U+FFFD. If it's not found, display an inverse question mark. */
2284 tc = conv_uni_to_pc(vc, 0xfffd); 2287 tc = conv_uni_to_pc(vc, 0xfffd);
2285 if (tc < 0) { 2288 if (tc < 0) {
2286 inverse = 1; 2289 inverse = 1;
2287 tc = conv_uni_to_pc(vc, '?'); 2290 tc = conv_uni_to_pc(vc, '?');
2288 if (tc < 0) tc = '?'; 2291 if (tc < 0) tc = '?';
2289 } 2292 }
2290 } 2293 }
2291 } 2294 }
2292 2295
2293 if (!inverse) { 2296 if (!inverse) {
2294 vc_attr = vc->vc_attr; 2297 vc_attr = vc->vc_attr;
2295 } else { 2298 } else {
2296 /* invert vc_attr */ 2299 /* invert vc_attr */
2297 if (!vc->vc_can_do_color) { 2300 if (!vc->vc_can_do_color) {
2298 vc_attr = (vc->vc_attr) ^ 0x08; 2301 vc_attr = (vc->vc_attr) ^ 0x08;
2299 } else if (vc->vc_hi_font_mask == 0x100) { 2302 } else if (vc->vc_hi_font_mask == 0x100) {
2300 vc_attr = ((vc->vc_attr) & 0x11) | (((vc->vc_attr) & 0xe0) >> 4) | (((vc->vc_attr) & 0x0e) << 4); 2303 vc_attr = ((vc->vc_attr) & 0x11) | (((vc->vc_attr) & 0xe0) >> 4) | (((vc->vc_attr) & 0x0e) << 4);
2301 } else { 2304 } else {
2302 vc_attr = ((vc->vc_attr) & 0x88) | (((vc->vc_attr) & 0x70) >> 4) | (((vc->vc_attr) & 0x07) << 4); 2305 vc_attr = ((vc->vc_attr) & 0x88) | (((vc->vc_attr) & 0x70) >> 4) | (((vc->vc_attr) & 0x07) << 4);
2303 } 2306 }
2304 FLUSH 2307 FLUSH
2305 } 2308 }
2306 2309
2307 while (1) { 2310 while (1) {
2308 if (vc->vc_need_wrap || vc->vc_decim) 2311 if (vc->vc_need_wrap || vc->vc_decim)
2309 FLUSH 2312 FLUSH
2310 if (vc->vc_need_wrap) { 2313 if (vc->vc_need_wrap) {
2311 cr(vc); 2314 cr(vc);
2312 lf(vc); 2315 lf(vc);
2313 } 2316 }
2314 if (vc->vc_decim) 2317 if (vc->vc_decim)
2315 insert_char(vc, 1); 2318 insert_char(vc, 1);
2316 scr_writew(himask ? 2319 scr_writew(himask ?
2317 ((vc_attr << 8) & ~himask) + ((tc & 0x100) ? himask : 0) + (tc & 0xff) : 2320 ((vc_attr << 8) & ~himask) + ((tc & 0x100) ? himask : 0) + (tc & 0xff) :
2318 (vc_attr << 8) + tc, 2321 (vc_attr << 8) + tc,
2319 (u16 *) vc->vc_pos); 2322 (u16 *) vc->vc_pos);
2320 if (DO_UPDATE(vc) && draw_x < 0) { 2323 if (DO_UPDATE(vc) && draw_x < 0) {
2321 draw_x = vc->vc_x; 2324 draw_x = vc->vc_x;
2322 draw_from = vc->vc_pos; 2325 draw_from = vc->vc_pos;
2323 } 2326 }
2324 if (vc->vc_x == vc->vc_cols - 1) { 2327 if (vc->vc_x == vc->vc_cols - 1) {
2325 vc->vc_need_wrap = vc->vc_decawm; 2328 vc->vc_need_wrap = vc->vc_decawm;
2326 draw_to = vc->vc_pos + 2; 2329 draw_to = vc->vc_pos + 2;
2327 } else { 2330 } else {
2328 vc->vc_x++; 2331 vc->vc_x++;
2329 draw_to = (vc->vc_pos += 2); 2332 draw_to = (vc->vc_pos += 2);
2330 } 2333 }
2331 2334
2332 if (!--width) break; 2335 if (!--width) break;
2333 2336
2334 tc = conv_uni_to_pc(vc, ' '); /* A space is printed in the second column */ 2337 tc = conv_uni_to_pc(vc, ' '); /* A space is printed in the second column */
2335 if (tc < 0) tc = ' '; 2338 if (tc < 0) tc = ' ';
2336 } 2339 }
2337 notify_write(vc, c); 2340 notify_write(vc, c);
2338 2341
2339 if (inverse) { 2342 if (inverse) {
2340 FLUSH 2343 FLUSH
2341 } 2344 }
2342 2345
2343 if (rescan) { 2346 if (rescan) {
2344 rescan = 0; 2347 rescan = 0;
2345 inverse = 0; 2348 inverse = 0;
2346 width = 1; 2349 width = 1;
2347 c = orig; 2350 c = orig;
2348 goto rescan_last_byte; 2351 goto rescan_last_byte;
2349 } 2352 }
2350 continue; 2353 continue;
2351 } 2354 }
2352 FLUSH 2355 FLUSH
2353 do_con_trol(tty, vc, orig); 2356 do_con_trol(tty, vc, orig);
2354 } 2357 }
2355 FLUSH 2358 FLUSH
2356 console_conditional_schedule(); 2359 console_conditional_schedule();
2357 release_console_sem(); 2360 release_console_sem();
2358 notify_update(vc); 2361 notify_update(vc);
2359 return n; 2362 return n;
2360 #undef FLUSH 2363 #undef FLUSH
2361 } 2364 }
2362 2365
2363 /* 2366 /*
2364 * This is the console switching callback. 2367 * This is the console switching callback.
2365 * 2368 *
2366 * Doing console switching in a process context allows 2369 * Doing console switching in a process context allows
2367 * us to do the switches asynchronously (needed when we want 2370 * us to do the switches asynchronously (needed when we want
2368 * to switch due to a keyboard interrupt). Synchronization 2371 * to switch due to a keyboard interrupt). Synchronization
2369 * with other console code and prevention of re-entrancy is 2372 * with other console code and prevention of re-entrancy is
2370 * ensured with console_sem. 2373 * ensured with console_sem.
2371 */ 2374 */
2372 static void console_callback(struct work_struct *ignored) 2375 static void console_callback(struct work_struct *ignored)
2373 { 2376 {
2374 acquire_console_sem(); 2377 acquire_console_sem();
2375 2378
2376 if (want_console >= 0) { 2379 if (want_console >= 0) {
2377 if (want_console != fg_console && 2380 if (want_console != fg_console &&
2378 vc_cons_allocated(want_console)) { 2381 vc_cons_allocated(want_console)) {
2379 hide_cursor(vc_cons[fg_console].d); 2382 hide_cursor(vc_cons[fg_console].d);
2380 change_console(vc_cons[want_console].d); 2383 change_console(vc_cons[want_console].d);
2381 /* we only changed when the console had already 2384 /* we only changed when the console had already
2382 been allocated - a new console is not created 2385 been allocated - a new console is not created
2383 in an interrupt routine */ 2386 in an interrupt routine */
2384 } 2387 }
2385 want_console = -1; 2388 want_console = -1;
2386 } 2389 }
2387 if (do_poke_blanked_console) { /* do not unblank for a LED change */ 2390 if (do_poke_blanked_console) { /* do not unblank for a LED change */
2388 do_poke_blanked_console = 0; 2391 do_poke_blanked_console = 0;
2389 poke_blanked_console(); 2392 poke_blanked_console();
2390 } 2393 }
2391 if (scrollback_delta) { 2394 if (scrollback_delta) {
2392 struct vc_data *vc = vc_cons[fg_console].d; 2395 struct vc_data *vc = vc_cons[fg_console].d;
2393 clear_selection(); 2396 clear_selection();
2394 if (vc->vc_mode == KD_TEXT) 2397 if (vc->vc_mode == KD_TEXT)
2395 vc->vc_sw->con_scrolldelta(vc, scrollback_delta); 2398 vc->vc_sw->con_scrolldelta(vc, scrollback_delta);
2396 scrollback_delta = 0; 2399 scrollback_delta = 0;
2397 } 2400 }
2398 if (blank_timer_expired) { 2401 if (blank_timer_expired) {
2399 do_blank_screen(0); 2402 do_blank_screen(0);
2400 blank_timer_expired = 0; 2403 blank_timer_expired = 0;
2401 } 2404 }
2402 notify_update(vc_cons[fg_console].d); 2405 notify_update(vc_cons[fg_console].d);
2403 2406
2404 release_console_sem(); 2407 release_console_sem();
2405 } 2408 }
2406 2409
2407 int set_console(int nr) 2410 int set_console(int nr)
2408 { 2411 {
2409 struct vc_data *vc = vc_cons[fg_console].d; 2412 struct vc_data *vc = vc_cons[fg_console].d;
2410 2413
2411 if (!vc_cons_allocated(nr) || vt_dont_switch || 2414 if (!vc_cons_allocated(nr) || vt_dont_switch ||
2412 (vc->vt_mode.mode == VT_AUTO && vc->vc_mode == KD_GRAPHICS)) { 2415 (vc->vt_mode.mode == VT_AUTO && vc->vc_mode == KD_GRAPHICS)) {
2413 2416
2414 /* 2417 /*
2415 * Console switch will fail in console_callback() or 2418 * Console switch will fail in console_callback() or
2416 * change_console() so there is no point scheduling 2419 * change_console() so there is no point scheduling
2417 * the callback 2420 * the callback
2418 * 2421 *
2419 * Existing set_console() users don't check the return 2422 * Existing set_console() users don't check the return
2420 * value so this shouldn't break anything 2423 * value so this shouldn't break anything
2421 */ 2424 */
2422 return -EINVAL; 2425 return -EINVAL;
2423 } 2426 }
2424 2427
2425 want_console = nr; 2428 want_console = nr;
2426 schedule_console_callback(); 2429 schedule_console_callback();
2427 2430
2428 return 0; 2431 return 0;
2429 } 2432 }
2430 2433
2431 struct tty_driver *console_driver; 2434 struct tty_driver *console_driver;
2432 2435
2433 #ifdef CONFIG_VT_CONSOLE 2436 #ifdef CONFIG_VT_CONSOLE
2434 2437
2435 /** 2438 /**
2436 * vt_kmsg_redirect() - Sets/gets the kernel message console 2439 * vt_kmsg_redirect() - Sets/gets the kernel message console
2437 * @new: The new virtual terminal number or -1 if the console should stay 2440 * @new: The new virtual terminal number or -1 if the console should stay
2438 * unchanged 2441 * unchanged
2439 * 2442 *
2440 * By default, the kernel messages are always printed on the current virtual 2443 * By default, the kernel messages are always printed on the current virtual
2441 * console. However, the user may modify that default with the 2444 * console. However, the user may modify that default with the
2442 * TIOCL_SETKMSGREDIRECT ioctl call. 2445 * TIOCL_SETKMSGREDIRECT ioctl call.
2443 * 2446 *
2444 * This function sets the kernel message console to be @new. It returns the old 2447 * This function sets the kernel message console to be @new. It returns the old
2445 * virtual console number. The virtual terminal number 0 (both as parameter and 2448 * virtual console number. The virtual terminal number 0 (both as parameter and
2446 * return value) means no redirection (i.e. always printed on the currently 2449 * return value) means no redirection (i.e. always printed on the currently
2447 * active console). 2450 * active console).
2448 * 2451 *
2449 * The parameter -1 means that only the current console is returned, but the 2452 * The parameter -1 means that only the current console is returned, but the
2450 * value is not modified. You may use the macro vt_get_kmsg_redirect() in that 2453 * value is not modified. You may use the macro vt_get_kmsg_redirect() in that
2451 * case to make the code more understandable. 2454 * case to make the code more understandable.
2452 * 2455 *
2453 * When the kernel is compiled without CONFIG_VT_CONSOLE, this function ignores 2456 * When the kernel is compiled without CONFIG_VT_CONSOLE, this function ignores
2454 * the parameter and always returns 0. 2457 * the parameter and always returns 0.
2455 */ 2458 */
2456 int vt_kmsg_redirect(int new) 2459 int vt_kmsg_redirect(int new)
2457 { 2460 {
2458 static int kmsg_con; 2461 static int kmsg_con;
2459 2462
2460 if (new != -1) 2463 if (new != -1)
2461 return xchg(&kmsg_con, new); 2464 return xchg(&kmsg_con, new);
2462 else 2465 else
2463 return kmsg_con; 2466 return kmsg_con;
2464 } 2467 }
2465 2468
2466 /* 2469 /*
2467 * Console on virtual terminal 2470 * Console on virtual terminal
2468 * 2471 *
2469 * The console must be locked when we get here. 2472 * The console must be locked when we get here.
2470 */ 2473 */
2471 2474
2472 static void vt_console_print(struct console *co, const char *b, unsigned count) 2475 static void vt_console_print(struct console *co, const char *b, unsigned count)
2473 { 2476 {
2474 struct vc_data *vc = vc_cons[fg_console].d; 2477 struct vc_data *vc = vc_cons[fg_console].d;
2475 unsigned char c; 2478 unsigned char c;
2476 static DEFINE_SPINLOCK(printing_lock); 2479 static DEFINE_SPINLOCK(printing_lock);
2477 const ushort *start; 2480 const ushort *start;
2478 ushort cnt = 0; 2481 ushort cnt = 0;
2479 ushort myx; 2482 ushort myx;
2480 int kmsg_console; 2483 int kmsg_console;
2481 2484
2482 /* console busy or not yet initialized */ 2485 /* console busy or not yet initialized */
2483 if (!printable) 2486 if (!printable)
2484 return; 2487 return;
2485 if (!spin_trylock(&printing_lock)) 2488 if (!spin_trylock(&printing_lock))
2486 return; 2489 return;
2487 2490
2488 kmsg_console = vt_get_kmsg_redirect(); 2491 kmsg_console = vt_get_kmsg_redirect();
2489 if (kmsg_console && vc_cons_allocated(kmsg_console - 1)) 2492 if (kmsg_console && vc_cons_allocated(kmsg_console - 1))
2490 vc = vc_cons[kmsg_console - 1].d; 2493 vc = vc_cons[kmsg_console - 1].d;
2491 2494
2492 /* read `x' only after setting currcons properly (otherwise 2495 /* read `x' only after setting currcons properly (otherwise
2493 the `x' macro will read the x of the foreground console). */ 2496 the `x' macro will read the x of the foreground console). */
2494 myx = vc->vc_x; 2497 myx = vc->vc_x;
2495 2498
2496 if (!vc_cons_allocated(fg_console)) { 2499 if (!vc_cons_allocated(fg_console)) {
2497 /* impossible */ 2500 /* impossible */
2498 /* printk("vt_console_print: tty %d not allocated ??\n", currcons+1); */ 2501 /* printk("vt_console_print: tty %d not allocated ??\n", currcons+1); */
2499 goto quit; 2502 goto quit;
2500 } 2503 }
2501 2504
2502 if (vc->vc_mode != KD_TEXT) 2505 if (vc->vc_mode != KD_TEXT)
2503 goto quit; 2506 goto quit;
2504 2507
2505 /* undraw cursor first */ 2508 /* undraw cursor first */
2506 if (IS_FG(vc)) 2509 if (IS_FG(vc))
2507 hide_cursor(vc); 2510 hide_cursor(vc);
2508 2511
2509 start = (ushort *)vc->vc_pos; 2512 start = (ushort *)vc->vc_pos;
2510 2513
2511 /* Contrived structure to try to emulate original need_wrap behaviour 2514 /* Contrived structure to try to emulate original need_wrap behaviour
2512 * Problems caused when we have need_wrap set on '\n' character */ 2515 * Problems caused when we have need_wrap set on '\n' character */
2513 while (count--) { 2516 while (count--) {
2514 c = *b++; 2517 c = *b++;
2515 if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { 2518 if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) {
2516 if (cnt > 0) { 2519 if (cnt > 0) {
2517 if (CON_IS_VISIBLE(vc)) 2520 if (CON_IS_VISIBLE(vc))
2518 vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); 2521 vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x);
2519 vc->vc_x += cnt; 2522 vc->vc_x += cnt;
2520 if (vc->vc_need_wrap) 2523 if (vc->vc_need_wrap)
2521 vc->vc_x--; 2524 vc->vc_x--;
2522 cnt = 0; 2525 cnt = 0;
2523 } 2526 }
2524 if (c == 8) { /* backspace */ 2527 if (c == 8) { /* backspace */
2525 bs(vc); 2528 bs(vc);
2526 start = (ushort *)vc->vc_pos; 2529 start = (ushort *)vc->vc_pos;
2527 myx = vc->vc_x; 2530 myx = vc->vc_x;
2528 continue; 2531 continue;
2529 } 2532 }
2530 if (c != 13) 2533 if (c != 13)
2531 lf(vc); 2534 lf(vc);
2532 cr(vc); 2535 cr(vc);
2533 start = (ushort *)vc->vc_pos; 2536 start = (ushort *)vc->vc_pos;
2534 myx = vc->vc_x; 2537 myx = vc->vc_x;
2535 if (c == 10 || c == 13) 2538 if (c == 10 || c == 13)
2536 continue; 2539 continue;
2537 } 2540 }
2538 scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos); 2541 scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos);
2539 notify_write(vc, c); 2542 notify_write(vc, c);
2540 cnt++; 2543 cnt++;
2541 if (myx == vc->vc_cols - 1) { 2544 if (myx == vc->vc_cols - 1) {
2542 vc->vc_need_wrap = 1; 2545 vc->vc_need_wrap = 1;
2543 continue; 2546 continue;
2544 } 2547 }
2545 vc->vc_pos += 2; 2548 vc->vc_pos += 2;
2546 myx++; 2549 myx++;
2547 } 2550 }
2548 if (cnt > 0) { 2551 if (cnt > 0) {
2549 if (CON_IS_VISIBLE(vc)) 2552 if (CON_IS_VISIBLE(vc))
2550 vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); 2553 vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x);
2551 vc->vc_x += cnt; 2554 vc->vc_x += cnt;
2552 if (vc->vc_x == vc->vc_cols) { 2555 if (vc->vc_x == vc->vc_cols) {
2553 vc->vc_x--; 2556 vc->vc_x--;
2554 vc->vc_need_wrap = 1; 2557 vc->vc_need_wrap = 1;
2555 } 2558 }
2556 } 2559 }
2557 set_cursor(vc); 2560 set_cursor(vc);
2558 notify_update(vc); 2561 notify_update(vc);
2559 2562
2560 quit: 2563 quit:
2561 spin_unlock(&printing_lock); 2564 spin_unlock(&printing_lock);
2562 } 2565 }
2563 2566
2564 static struct tty_driver *vt_console_device(struct console *c, int *index) 2567 static struct tty_driver *vt_console_device(struct console *c, int *index)
2565 { 2568 {
2566 *index = c->index ? c->index-1 : fg_console; 2569 *index = c->index ? c->index-1 : fg_console;
2567 return console_driver; 2570 return console_driver;
2568 } 2571 }
2569 2572
2570 static struct console vt_console_driver = { 2573 static struct console vt_console_driver = {
2571 .name = "tty", 2574 .name = "tty",
2572 .write = vt_console_print, 2575 .write = vt_console_print,
2573 .device = vt_console_device, 2576 .device = vt_console_device,
2574 .unblank = unblank_screen, 2577 .unblank = unblank_screen,
2575 .flags = CON_PRINTBUFFER, 2578 .flags = CON_PRINTBUFFER,
2576 .index = -1, 2579 .index = -1,
2577 }; 2580 };
2578 #endif 2581 #endif
2579 2582
2580 /* 2583 /*
2581 * Handling of Linux-specific VC ioctls 2584 * Handling of Linux-specific VC ioctls
2582 */ 2585 */
2583 2586
2584 /* 2587 /*
2585 * Generally a bit racy with respect to console_sem(). 2588 * Generally a bit racy with respect to console_sem().
2586 * 2589 *
2587 * There are some functions which don't need it. 2590 * There are some functions which don't need it.
2588 * 2591 *
2589 * There are some functions which can sleep for arbitrary periods 2592 * There are some functions which can sleep for arbitrary periods
2590 * (paste_selection) but we don't need the lock there anyway. 2593 * (paste_selection) but we don't need the lock there anyway.
2591 * 2594 *
2592 * set_selection has locking, and definitely needs it 2595 * set_selection has locking, and definitely needs it
2593 */ 2596 */
2594 2597
2595 int tioclinux(struct tty_struct *tty, unsigned long arg) 2598 int tioclinux(struct tty_struct *tty, unsigned long arg)
2596 { 2599 {
2597 char type, data; 2600 char type, data;
2598 char __user *p = (char __user *)arg; 2601 char __user *p = (char __user *)arg;
2599 int lines; 2602 int lines;
2600 int ret; 2603 int ret;
2601 2604
2602 if (current->signal->tty != tty && !capable(CAP_SYS_ADMIN)) 2605 if (current->signal->tty != tty && !capable(CAP_SYS_ADMIN))
2603 return -EPERM; 2606 return -EPERM;
2604 if (get_user(type, p)) 2607 if (get_user(type, p))
2605 return -EFAULT; 2608 return -EFAULT;
2606 ret = 0; 2609 ret = 0;
2607 2610
2608 lock_kernel(); 2611 lock_kernel();
2609 2612
2610 switch (type) 2613 switch (type)
2611 { 2614 {
2612 case TIOCL_SETSEL: 2615 case TIOCL_SETSEL:
2613 acquire_console_sem(); 2616 acquire_console_sem();
2614 ret = set_selection((struct tiocl_selection __user *)(p+1), tty); 2617 ret = set_selection((struct tiocl_selection __user *)(p+1), tty);
2615 release_console_sem(); 2618 release_console_sem();
2616 break; 2619 break;
2617 case TIOCL_PASTESEL: 2620 case TIOCL_PASTESEL:
2618 ret = paste_selection(tty); 2621 ret = paste_selection(tty);
2619 break; 2622 break;
2620 case TIOCL_UNBLANKSCREEN: 2623 case TIOCL_UNBLANKSCREEN:
2621 acquire_console_sem(); 2624 acquire_console_sem();
2622 unblank_screen(); 2625 unblank_screen();
2623 release_console_sem(); 2626 release_console_sem();
2624 break; 2627 break;
2625 case TIOCL_SELLOADLUT: 2628 case TIOCL_SELLOADLUT:
2626 ret = sel_loadlut(p); 2629 ret = sel_loadlut(p);
2627 break; 2630 break;
2628 case TIOCL_GETSHIFTSTATE: 2631 case TIOCL_GETSHIFTSTATE:
2629 2632
2630 /* 2633 /*
2631 * Make it possible to react to Shift+Mousebutton. 2634 * Make it possible to react to Shift+Mousebutton.
2632 * Note that 'shift_state' is an undocumented 2635 * Note that 'shift_state' is an undocumented
2633 * kernel-internal variable; programs not closely 2636 * kernel-internal variable; programs not closely
2634 * related to the kernel should not use this. 2637 * related to the kernel should not use this.
2635 */ 2638 */
2636 data = shift_state; 2639 data = shift_state;
2637 ret = __put_user(data, p); 2640 ret = __put_user(data, p);
2638 break; 2641 break;
2639 case TIOCL_GETMOUSEREPORTING: 2642 case TIOCL_GETMOUSEREPORTING:
2640 data = mouse_reporting(); 2643 data = mouse_reporting();
2641 ret = __put_user(data, p); 2644 ret = __put_user(data, p);
2642 break; 2645 break;
2643 case TIOCL_SETVESABLANK: 2646 case TIOCL_SETVESABLANK:
2644 ret = set_vesa_blanking(p); 2647 ret = set_vesa_blanking(p);
2645 break; 2648 break;
2646 case TIOCL_GETKMSGREDIRECT: 2649 case TIOCL_GETKMSGREDIRECT:
2647 data = vt_get_kmsg_redirect(); 2650 data = vt_get_kmsg_redirect();
2648 ret = __put_user(data, p); 2651 ret = __put_user(data, p);
2649 break; 2652 break;
2650 case TIOCL_SETKMSGREDIRECT: 2653 case TIOCL_SETKMSGREDIRECT:
2651 if (!capable(CAP_SYS_ADMIN)) { 2654 if (!capable(CAP_SYS_ADMIN)) {
2652 ret = -EPERM; 2655 ret = -EPERM;
2653 } else { 2656 } else {
2654 if (get_user(data, p+1)) 2657 if (get_user(data, p+1))
2655 ret = -EFAULT; 2658 ret = -EFAULT;
2656 else 2659 else
2657 vt_kmsg_redirect(data); 2660 vt_kmsg_redirect(data);
2658 } 2661 }
2659 break; 2662 break;
2660 case TIOCL_GETFGCONSOLE: 2663 case TIOCL_GETFGCONSOLE:
2661 ret = fg_console; 2664 ret = fg_console;
2662 break; 2665 break;
2663 case TIOCL_SCROLLCONSOLE: 2666 case TIOCL_SCROLLCONSOLE:
2664 if (get_user(lines, (s32 __user *)(p+4))) { 2667 if (get_user(lines, (s32 __user *)(p+4))) {
2665 ret = -EFAULT; 2668 ret = -EFAULT;
2666 } else { 2669 } else {
2667 scrollfront(vc_cons[fg_console].d, lines); 2670 scrollfront(vc_cons[fg_console].d, lines);
2668 ret = 0; 2671 ret = 0;
2669 } 2672 }
2670 break; 2673 break;
2671 case TIOCL_BLANKSCREEN: /* until explicitly unblanked, not only poked */ 2674 case TIOCL_BLANKSCREEN: /* until explicitly unblanked, not only poked */
2672 acquire_console_sem(); 2675 acquire_console_sem();
2673 ignore_poke = 1; 2676 ignore_poke = 1;
2674 do_blank_screen(0); 2677 do_blank_screen(0);
2675 release_console_sem(); 2678 release_console_sem();
2676 break; 2679 break;
2677 case TIOCL_BLANKEDSCREEN: 2680 case TIOCL_BLANKEDSCREEN:
2678 ret = console_blanked; 2681 ret = console_blanked;
2679 break; 2682 break;
2680 default: 2683 default:
2681 ret = -EINVAL; 2684 ret = -EINVAL;
2682 break; 2685 break;
2683 } 2686 }
2684 unlock_kernel(); 2687 unlock_kernel();
2685 return ret; 2688 return ret;
2686 } 2689 }
2687 2690
2688 /* 2691 /*
2689 * /dev/ttyN handling 2692 * /dev/ttyN handling
2690 */ 2693 */
2691 2694
2692 static int con_write(struct tty_struct *tty, const unsigned char *buf, int count) 2695 static int con_write(struct tty_struct *tty, const unsigned char *buf, int count)
2693 { 2696 {
2694 int retval; 2697 int retval;
2695 2698
2696 retval = do_con_write(tty, buf, count); 2699 retval = do_con_write(tty, buf, count);
2697 con_flush_chars(tty); 2700 con_flush_chars(tty);
2698 2701
2699 return retval; 2702 return retval;
2700 } 2703 }
2701 2704
2702 static int con_put_char(struct tty_struct *tty, unsigned char ch) 2705 static int con_put_char(struct tty_struct *tty, unsigned char ch)
2703 { 2706 {
2704 if (in_interrupt()) 2707 if (in_interrupt())
2705 return 0; /* n_r3964 calls put_char() from interrupt context */ 2708 return 0; /* n_r3964 calls put_char() from interrupt context */
2706 return do_con_write(tty, &ch, 1); 2709 return do_con_write(tty, &ch, 1);
2707 } 2710 }
2708 2711
2709 static int con_write_room(struct tty_struct *tty) 2712 static int con_write_room(struct tty_struct *tty)
2710 { 2713 {
2711 if (tty->stopped) 2714 if (tty->stopped)
2712 return 0; 2715 return 0;
2713 return 32768; /* No limit, really; we're not buffering */ 2716 return 32768; /* No limit, really; we're not buffering */
2714 } 2717 }
2715 2718
2716 static int con_chars_in_buffer(struct tty_struct *tty) 2719 static int con_chars_in_buffer(struct tty_struct *tty)
2717 { 2720 {
2718 return 0; /* we're not buffering */ 2721 return 0; /* we're not buffering */
2719 } 2722 }
2720 2723
2721 /* 2724 /*
2722 * con_throttle and con_unthrottle are only used for 2725 * con_throttle and con_unthrottle are only used for
2723 * paste_selection(), which has to stuff in a large number of 2726 * paste_selection(), which has to stuff in a large number of
2724 * characters... 2727 * characters...
2725 */ 2728 */
2726 static void con_throttle(struct tty_struct *tty) 2729 static void con_throttle(struct tty_struct *tty)
2727 { 2730 {
2728 } 2731 }
2729 2732
2730 static void con_unthrottle(struct tty_struct *tty) 2733 static void con_unthrottle(struct tty_struct *tty)
2731 { 2734 {
2732 struct vc_data *vc = tty->driver_data; 2735 struct vc_data *vc = tty->driver_data;
2733 2736
2734 wake_up_interruptible(&vc->paste_wait); 2737 wake_up_interruptible(&vc->paste_wait);
2735 } 2738 }
2736 2739
2737 /* 2740 /*
2738 * Turn the Scroll-Lock LED on when the tty is stopped 2741 * Turn the Scroll-Lock LED on when the tty is stopped
2739 */ 2742 */
2740 static void con_stop(struct tty_struct *tty) 2743 static void con_stop(struct tty_struct *tty)
2741 { 2744 {
2742 int console_num; 2745 int console_num;
2743 if (!tty) 2746 if (!tty)
2744 return; 2747 return;
2745 console_num = tty->index; 2748 console_num = tty->index;
2746 if (!vc_cons_allocated(console_num)) 2749 if (!vc_cons_allocated(console_num))
2747 return; 2750 return;
2748 set_vc_kbd_led(kbd_table + console_num, VC_SCROLLOCK); 2751 set_vc_kbd_led(kbd_table + console_num, VC_SCROLLOCK);
2749 set_leds(); 2752 set_leds();
2750 } 2753 }
2751 2754
2752 /* 2755 /*
2753 * Turn the Scroll-Lock LED off when the console is started 2756 * Turn the Scroll-Lock LED off when the console is started
2754 */ 2757 */
2755 static void con_start(struct tty_struct *tty) 2758 static void con_start(struct tty_struct *tty)
2756 { 2759 {
2757 int console_num; 2760 int console_num;
2758 if (!tty) 2761 if (!tty)
2759 return; 2762 return;
2760 console_num = tty->index; 2763 console_num = tty->index;
2761 if (!vc_cons_allocated(console_num)) 2764 if (!vc_cons_allocated(console_num))
2762 return; 2765 return;
2763 clr_vc_kbd_led(kbd_table + console_num, VC_SCROLLOCK); 2766 clr_vc_kbd_led(kbd_table + console_num, VC_SCROLLOCK);
2764 set_leds(); 2767 set_leds();
2765 } 2768 }
2766 2769
2767 static void con_flush_chars(struct tty_struct *tty) 2770 static void con_flush_chars(struct tty_struct *tty)
2768 { 2771 {
2769 struct vc_data *vc; 2772 struct vc_data *vc;
2770 2773
2771 if (in_interrupt()) /* from flush_to_ldisc */ 2774 if (in_interrupt()) /* from flush_to_ldisc */
2772 return; 2775 return;
2773 2776
2774 /* if we race with con_close(), vt may be null */ 2777 /* if we race with con_close(), vt may be null */
2775 acquire_console_sem(); 2778 acquire_console_sem();
2776 vc = tty->driver_data; 2779 vc = tty->driver_data;
2777 if (vc) 2780 if (vc)
2778 set_cursor(vc); 2781 set_cursor(vc);
2779 release_console_sem(); 2782 release_console_sem();
2780 } 2783 }
2781 2784
2782 /* 2785 /*
2783 * Allocate the console screen memory. 2786 * Allocate the console screen memory.
2784 */ 2787 */
2785 static int con_open(struct tty_struct *tty, struct file *filp) 2788 static int con_open(struct tty_struct *tty, struct file *filp)
2786 { 2789 {
2787 unsigned int currcons = tty->index; 2790 unsigned int currcons = tty->index;
2788 int ret = 0; 2791 int ret = 0;
2789 2792
2790 acquire_console_sem(); 2793 acquire_console_sem();
2791 if (tty->driver_data == NULL) { 2794 if (tty->driver_data == NULL) {
2792 ret = vc_allocate(currcons); 2795 ret = vc_allocate(currcons);
2793 if (ret == 0) { 2796 if (ret == 0) {
2794 struct vc_data *vc = vc_cons[currcons].d; 2797 struct vc_data *vc = vc_cons[currcons].d;
2795 2798
2796 /* Still being freed */ 2799 /* Still being freed */
2797 if (vc->vc_tty) { 2800 if (vc->vc_tty) {
2798 release_console_sem(); 2801 release_console_sem();
2799 return -ERESTARTSYS; 2802 return -ERESTARTSYS;
2800 } 2803 }
2801 tty->driver_data = vc; 2804 tty->driver_data = vc;
2802 vc->vc_tty = tty; 2805 vc->vc_tty = tty;
2803 2806
2804 if (!tty->winsize.ws_row && !tty->winsize.ws_col) { 2807 if (!tty->winsize.ws_row && !tty->winsize.ws_col) {
2805 tty->winsize.ws_row = vc_cons[currcons].d->vc_rows; 2808 tty->winsize.ws_row = vc_cons[currcons].d->vc_rows;
2806 tty->winsize.ws_col = vc_cons[currcons].d->vc_cols; 2809 tty->winsize.ws_col = vc_cons[currcons].d->vc_cols;
2807 } 2810 }
2808 if (vc->vc_utf) 2811 if (vc->vc_utf)
2809 tty->termios->c_iflag |= IUTF8; 2812 tty->termios->c_iflag |= IUTF8;
2810 else 2813 else
2811 tty->termios->c_iflag &= ~IUTF8; 2814 tty->termios->c_iflag &= ~IUTF8;
2812 release_console_sem(); 2815 release_console_sem();
2813 return ret; 2816 return ret;
2814 } 2817 }
2815 } 2818 }
2816 release_console_sem(); 2819 release_console_sem();
2817 return ret; 2820 return ret;
2818 } 2821 }
2819 2822
2820 static void con_close(struct tty_struct *tty, struct file *filp) 2823 static void con_close(struct tty_struct *tty, struct file *filp)
2821 { 2824 {
2822 /* Nothing to do - we defer to shutdown */ 2825 /* Nothing to do - we defer to shutdown */
2823 } 2826 }
2824 2827
2825 static void con_shutdown(struct tty_struct *tty) 2828 static void con_shutdown(struct tty_struct *tty)
2826 { 2829 {
2827 struct vc_data *vc = tty->driver_data; 2830 struct vc_data *vc = tty->driver_data;
2828 BUG_ON(vc == NULL); 2831 BUG_ON(vc == NULL);
2829 acquire_console_sem(); 2832 acquire_console_sem();
2830 vc->vc_tty = NULL; 2833 vc->vc_tty = NULL;
2831 release_console_sem(); 2834 release_console_sem();
2832 tty_shutdown(tty); 2835 tty_shutdown(tty);
2833 } 2836 }
2834 2837
2835 static int default_italic_color = 2; // green (ASCII) 2838 static int default_italic_color = 2; // green (ASCII)
2836 static int default_underline_color = 3; // cyan (ASCII) 2839 static int default_underline_color = 3; // cyan (ASCII)
2837 module_param_named(italic, default_italic_color, int, S_IRUGO | S_IWUSR); 2840 module_param_named(italic, default_italic_color, int, S_IRUGO | S_IWUSR);
2838 module_param_named(underline, default_underline_color, int, S_IRUGO | S_IWUSR); 2841 module_param_named(underline, default_underline_color, int, S_IRUGO | S_IWUSR);
2839 2842
2840 static void vc_init(struct vc_data *vc, unsigned int rows, 2843 static void vc_init(struct vc_data *vc, unsigned int rows,
2841 unsigned int cols, int do_clear) 2844 unsigned int cols, int do_clear)
2842 { 2845 {
2843 int j, k ; 2846 int j, k ;
2844 2847
2845 vc->vc_cols = cols; 2848 vc->vc_cols = cols;
2846 vc->vc_rows = rows; 2849 vc->vc_rows = rows;
2847 vc->vc_size_row = cols << 1; 2850 vc->vc_size_row = cols << 1;
2848 vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row; 2851 vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row;
2849 2852
2850 set_origin(vc); 2853 set_origin(vc);
2851 vc->vc_pos = vc->vc_origin; 2854 vc->vc_pos = vc->vc_origin;
2852 reset_vc(vc); 2855 reset_vc(vc);
2853 for (j=k=0; j<16; j++) { 2856 for (j=k=0; j<16; j++) {
2854 vc->vc_palette[k++] = default_red[j] ; 2857 vc->vc_palette[k++] = default_red[j] ;
2855 vc->vc_palette[k++] = default_grn[j] ; 2858 vc->vc_palette[k++] = default_grn[j] ;
2856 vc->vc_palette[k++] = default_blu[j] ; 2859 vc->vc_palette[k++] = default_blu[j] ;
2857 } 2860 }
2858 vc->vc_def_color = 0x07; /* white */ 2861 vc->vc_def_color = 0x07; /* white */
2859 vc->vc_ulcolor = default_underline_color; 2862 vc->vc_ulcolor = default_underline_color;
2860 vc->vc_itcolor = default_italic_color; 2863 vc->vc_itcolor = default_italic_color;
2861 vc->vc_halfcolor = 0x08; /* grey */ 2864 vc->vc_halfcolor = 0x08; /* grey */
2862 init_waitqueue_head(&vc->paste_wait); 2865 init_waitqueue_head(&vc->paste_wait);
2863 reset_terminal(vc, do_clear); 2866 reset_terminal(vc, do_clear);
2864 } 2867 }
2865 2868
2866 /* 2869 /*
2867 * This routine initializes console interrupts, and does nothing 2870 * This routine initializes console interrupts, and does nothing
2868 * else. If you want the screen to clear, call tty_write with 2871 * else. If you want the screen to clear, call tty_write with
2869 * the appropriate escape-sequence. 2872 * the appropriate escape-sequence.
2870 */ 2873 */
2871 2874
2872 static int __init con_init(void) 2875 static int __init con_init(void)
2873 { 2876 {
2874 const char *display_desc = NULL; 2877 const char *display_desc = NULL;
2875 struct vc_data *vc; 2878 struct vc_data *vc;
2876 unsigned int currcons = 0, i; 2879 unsigned int currcons = 0, i;
2877 2880
2878 acquire_console_sem(); 2881 acquire_console_sem();
2879 2882
2880 if (conswitchp) 2883 if (conswitchp)
2881 display_desc = conswitchp->con_startup(); 2884 display_desc = conswitchp->con_startup();
2882 if (!display_desc) { 2885 if (!display_desc) {
2883 fg_console = 0; 2886 fg_console = 0;
2884 release_console_sem(); 2887 release_console_sem();
2885 return 0; 2888 return 0;
2886 } 2889 }
2887 2890
2888 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 2891 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
2889 struct con_driver *con_driver = &registered_con_driver[i]; 2892 struct con_driver *con_driver = &registered_con_driver[i];
2890 2893
2891 if (con_driver->con == NULL) { 2894 if (con_driver->con == NULL) {
2892 con_driver->con = conswitchp; 2895 con_driver->con = conswitchp;
2893 con_driver->desc = display_desc; 2896 con_driver->desc = display_desc;
2894 con_driver->flag = CON_DRIVER_FLAG_INIT; 2897 con_driver->flag = CON_DRIVER_FLAG_INIT;
2895 con_driver->first = 0; 2898 con_driver->first = 0;
2896 con_driver->last = MAX_NR_CONSOLES - 1; 2899 con_driver->last = MAX_NR_CONSOLES - 1;
2897 break; 2900 break;
2898 } 2901 }
2899 } 2902 }
2900 2903
2901 for (i = 0; i < MAX_NR_CONSOLES; i++) 2904 for (i = 0; i < MAX_NR_CONSOLES; i++)
2902 con_driver_map[i] = conswitchp; 2905 con_driver_map[i] = conswitchp;
2903 2906
2904 if (blankinterval) { 2907 if (blankinterval) {
2905 blank_state = blank_normal_wait; 2908 blank_state = blank_normal_wait;
2906 mod_timer(&console_timer, jiffies + (blankinterval * HZ)); 2909 mod_timer(&console_timer, jiffies + (blankinterval * HZ));
2907 } 2910 }
2908 2911
2909 for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) { 2912 for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) {
2910 vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT); 2913 vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT);
2911 INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); 2914 INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
2912 visual_init(vc, currcons, 1); 2915 visual_init(vc, currcons, 1);
2913 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT); 2916 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);
2914 vc_init(vc, vc->vc_rows, vc->vc_cols, 2917 vc_init(vc, vc->vc_rows, vc->vc_cols,
2915 currcons || !vc->vc_sw->con_save_screen); 2918 currcons || !vc->vc_sw->con_save_screen);
2916 } 2919 }
2917 currcons = fg_console = 0; 2920 currcons = fg_console = 0;
2918 master_display_fg = vc = vc_cons[currcons].d; 2921 master_display_fg = vc = vc_cons[currcons].d;
2919 set_origin(vc); 2922 set_origin(vc);
2920 save_screen(vc); 2923 save_screen(vc);
2921 gotoxy(vc, vc->vc_x, vc->vc_y); 2924 gotoxy(vc, vc->vc_x, vc->vc_y);
2922 csi_J(vc, 0); 2925 csi_J(vc, 0);
2923 update_screen(vc); 2926 update_screen(vc);
2924 printk("Console: %s %s %dx%d", 2927 printk("Console: %s %s %dx%d",
2925 vc->vc_can_do_color ? "colour" : "mono", 2928 vc->vc_can_do_color ? "colour" : "mono",
2926 display_desc, vc->vc_cols, vc->vc_rows); 2929 display_desc, vc->vc_cols, vc->vc_rows);
2927 printable = 1; 2930 printable = 1;
2928 printk("\n"); 2931 printk("\n");
2929 2932
2930 release_console_sem(); 2933 release_console_sem();
2931 2934
2932 #ifdef CONFIG_VT_CONSOLE 2935 #ifdef CONFIG_VT_CONSOLE
2933 register_console(&vt_console_driver); 2936 register_console(&vt_console_driver);
2934 #endif 2937 #endif
2935 return 0; 2938 return 0;
2936 } 2939 }
2937 console_initcall(con_init); 2940 console_initcall(con_init);
2938 2941
2939 static const struct tty_operations con_ops = { 2942 static const struct tty_operations con_ops = {
2940 .open = con_open, 2943 .open = con_open,
2941 .close = con_close, 2944 .close = con_close,
2942 .write = con_write, 2945 .write = con_write,
2943 .write_room = con_write_room, 2946 .write_room = con_write_room,
2944 .put_char = con_put_char, 2947 .put_char = con_put_char,
2945 .flush_chars = con_flush_chars, 2948 .flush_chars = con_flush_chars,
2946 .chars_in_buffer = con_chars_in_buffer, 2949 .chars_in_buffer = con_chars_in_buffer,
2947 .ioctl = vt_ioctl, 2950 .ioctl = vt_ioctl,
2948 #ifdef CONFIG_COMPAT 2951 #ifdef CONFIG_COMPAT
2949 .compat_ioctl = vt_compat_ioctl, 2952 .compat_ioctl = vt_compat_ioctl,
2950 #endif 2953 #endif
2951 .stop = con_stop, 2954 .stop = con_stop,
2952 .start = con_start, 2955 .start = con_start,
2953 .throttle = con_throttle, 2956 .throttle = con_throttle,
2954 .unthrottle = con_unthrottle, 2957 .unthrottle = con_unthrottle,
2955 .resize = vt_resize, 2958 .resize = vt_resize,
2956 .shutdown = con_shutdown 2959 .shutdown = con_shutdown
2957 }; 2960 };
2958 2961
2959 static struct cdev vc0_cdev; 2962 static struct cdev vc0_cdev;
2960 2963
2961 int __init vty_init(const struct file_operations *console_fops) 2964 int __init vty_init(const struct file_operations *console_fops)
2962 { 2965 {
2963 cdev_init(&vc0_cdev, console_fops); 2966 cdev_init(&vc0_cdev, console_fops);
2964 if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || 2967 if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
2965 register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) 2968 register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
2966 panic("Couldn't register /dev/tty0 driver\n"); 2969 panic("Couldn't register /dev/tty0 driver\n");
2967 device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); 2970 device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
2968 2971
2969 vcs_init(); 2972 vcs_init();
2970 2973
2971 console_driver = alloc_tty_driver(MAX_NR_CONSOLES); 2974 console_driver = alloc_tty_driver(MAX_NR_CONSOLES);
2972 if (!console_driver) 2975 if (!console_driver)
2973 panic("Couldn't allocate console driver\n"); 2976 panic("Couldn't allocate console driver\n");
2974 console_driver->owner = THIS_MODULE; 2977 console_driver->owner = THIS_MODULE;
2975 console_driver->name = "tty"; 2978 console_driver->name = "tty";
2976 console_driver->name_base = 1; 2979 console_driver->name_base = 1;
2977 console_driver->major = TTY_MAJOR; 2980 console_driver->major = TTY_MAJOR;
2978 console_driver->minor_start = 1; 2981 console_driver->minor_start = 1;
2979 console_driver->type = TTY_DRIVER_TYPE_CONSOLE; 2982 console_driver->type = TTY_DRIVER_TYPE_CONSOLE;
2980 console_driver->init_termios = tty_std_termios; 2983 console_driver->init_termios = tty_std_termios;
2981 if (default_utf8) 2984 if (default_utf8)
2982 console_driver->init_termios.c_iflag |= IUTF8; 2985 console_driver->init_termios.c_iflag |= IUTF8;
2983 console_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS; 2986 console_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS;
2984 tty_set_operations(console_driver, &con_ops); 2987 tty_set_operations(console_driver, &con_ops);
2985 if (tty_register_driver(console_driver)) 2988 if (tty_register_driver(console_driver))
2986 panic("Couldn't register console driver\n"); 2989 panic("Couldn't register console driver\n");
2987 kbd_init(); 2990 kbd_init();
2988 console_map_init(); 2991 console_map_init();
2989 #ifdef CONFIG_MDA_CONSOLE 2992 #ifdef CONFIG_MDA_CONSOLE
2990 mda_console_init(); 2993 mda_console_init();
2991 #endif 2994 #endif
2992 return 0; 2995 return 0;
2993 } 2996 }
2994 2997
2995 #ifndef VT_SINGLE_DRIVER 2998 #ifndef VT_SINGLE_DRIVER
2996 2999
2997 static struct class *vtconsole_class; 3000 static struct class *vtconsole_class;
2998 3001
2999 static int bind_con_driver(const struct consw *csw, int first, int last, 3002 static int bind_con_driver(const struct consw *csw, int first, int last,
3000 int deflt) 3003 int deflt)
3001 { 3004 {
3002 struct module *owner = csw->owner; 3005 struct module *owner = csw->owner;
3003 const char *desc = NULL; 3006 const char *desc = NULL;
3004 struct con_driver *con_driver; 3007 struct con_driver *con_driver;
3005 int i, j = -1, k = -1, retval = -ENODEV; 3008 int i, j = -1, k = -1, retval = -ENODEV;
3006 3009
3007 if (!try_module_get(owner)) 3010 if (!try_module_get(owner))
3008 return -ENODEV; 3011 return -ENODEV;
3009 3012
3010 acquire_console_sem(); 3013 acquire_console_sem();
3011 3014
3012 /* check if driver is registered */ 3015 /* check if driver is registered */
3013 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3016 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
3014 con_driver = &registered_con_driver[i]; 3017 con_driver = &registered_con_driver[i];
3015 3018
3016 if (con_driver->con == csw) { 3019 if (con_driver->con == csw) {
3017 desc = con_driver->desc; 3020 desc = con_driver->desc;
3018 retval = 0; 3021 retval = 0;
3019 break; 3022 break;
3020 } 3023 }
3021 } 3024 }
3022 3025
3023 if (retval) 3026 if (retval)
3024 goto err; 3027 goto err;
3025 3028
3026 if (!(con_driver->flag & CON_DRIVER_FLAG_INIT)) { 3029 if (!(con_driver->flag & CON_DRIVER_FLAG_INIT)) {
3027 csw->con_startup(); 3030 csw->con_startup();
3028 con_driver->flag |= CON_DRIVER_FLAG_INIT; 3031 con_driver->flag |= CON_DRIVER_FLAG_INIT;
3029 } 3032 }
3030 3033
3031 if (deflt) { 3034 if (deflt) {
3032 if (conswitchp) 3035 if (conswitchp)
3033 module_put(conswitchp->owner); 3036 module_put(conswitchp->owner);
3034 3037
3035 __module_get(owner); 3038 __module_get(owner);
3036 conswitchp = csw; 3039 conswitchp = csw;
3037 } 3040 }
3038 3041
3039 first = max(first, con_driver->first); 3042 first = max(first, con_driver->first);
3040 last = min(last, con_driver->last); 3043 last = min(last, con_driver->last);
3041 3044
3042 for (i = first; i <= last; i++) { 3045 for (i = first; i <= last; i++) {
3043 int old_was_color; 3046 int old_was_color;
3044 struct vc_data *vc = vc_cons[i].d; 3047 struct vc_data *vc = vc_cons[i].d;
3045 3048
3046 if (con_driver_map[i]) 3049 if (con_driver_map[i])
3047 module_put(con_driver_map[i]->owner); 3050 module_put(con_driver_map[i]->owner);
3048 __module_get(owner); 3051 __module_get(owner);
3049 con_driver_map[i] = csw; 3052 con_driver_map[i] = csw;
3050 3053
3051 if (!vc || !vc->vc_sw) 3054 if (!vc || !vc->vc_sw)
3052 continue; 3055 continue;
3053 3056
3054 j = i; 3057 j = i;
3055 3058
3056 if (CON_IS_VISIBLE(vc)) { 3059 if (CON_IS_VISIBLE(vc)) {
3057 k = i; 3060 k = i;
3058 save_screen(vc); 3061 save_screen(vc);
3059 } 3062 }
3060 3063
3061 old_was_color = vc->vc_can_do_color; 3064 old_was_color = vc->vc_can_do_color;
3062 vc->vc_sw->con_deinit(vc); 3065 vc->vc_sw->con_deinit(vc);
3063 vc->vc_origin = (unsigned long)vc->vc_screenbuf; 3066 vc->vc_origin = (unsigned long)vc->vc_screenbuf;
3064 visual_init(vc, i, 0); 3067 visual_init(vc, i, 0);
3065 set_origin(vc); 3068 set_origin(vc);
3066 update_attr(vc); 3069 update_attr(vc);
3067 3070
3068 /* If the console changed between mono <-> color, then 3071 /* If the console changed between mono <-> color, then
3069 * the attributes in the screenbuf will be wrong. The 3072 * the attributes in the screenbuf will be wrong. The
3070 * following resets all attributes to something sane. 3073 * following resets all attributes to something sane.
3071 */ 3074 */
3072 if (old_was_color != vc->vc_can_do_color) 3075 if (old_was_color != vc->vc_can_do_color)
3073 clear_buffer_attributes(vc); 3076 clear_buffer_attributes(vc);
3074 } 3077 }
3075 3078
3076 printk("Console: switching "); 3079 printk("Console: switching ");
3077 if (!deflt) 3080 if (!deflt)
3078 printk("consoles %d-%d ", first+1, last+1); 3081 printk("consoles %d-%d ", first+1, last+1);
3079 if (j >= 0) { 3082 if (j >= 0) {
3080 struct vc_data *vc = vc_cons[j].d; 3083 struct vc_data *vc = vc_cons[j].d;
3081 3084
3082 printk("to %s %s %dx%d\n", 3085 printk("to %s %s %dx%d\n",
3083 vc->vc_can_do_color ? "colour" : "mono", 3086 vc->vc_can_do_color ? "colour" : "mono",
3084 desc, vc->vc_cols, vc->vc_rows); 3087 desc, vc->vc_cols, vc->vc_rows);
3085 3088
3086 if (k >= 0) { 3089 if (k >= 0) {
3087 vc = vc_cons[k].d; 3090 vc = vc_cons[k].d;
3088 update_screen(vc); 3091 update_screen(vc);
3089 } 3092 }
3090 } else 3093 } else
3091 printk("to %s\n", desc); 3094 printk("to %s\n", desc);
3092 3095
3093 retval = 0; 3096 retval = 0;
3094 err: 3097 err:
3095 release_console_sem(); 3098 release_console_sem();
3096 module_put(owner); 3099 module_put(owner);
3097 return retval; 3100 return retval;
3098 }; 3101 };
3099 3102
3100 #ifdef CONFIG_VT_HW_CONSOLE_BINDING 3103 #ifdef CONFIG_VT_HW_CONSOLE_BINDING
3101 static int con_is_graphics(const struct consw *csw, int first, int last) 3104 static int con_is_graphics(const struct consw *csw, int first, int last)
3102 { 3105 {
3103 int i, retval = 0; 3106 int i, retval = 0;
3104 3107
3105 for (i = first; i <= last; i++) { 3108 for (i = first; i <= last; i++) {
3106 struct vc_data *vc = vc_cons[i].d; 3109 struct vc_data *vc = vc_cons[i].d;
3107 3110
3108 if (vc && vc->vc_mode == KD_GRAPHICS) { 3111 if (vc && vc->vc_mode == KD_GRAPHICS) {
3109 retval = 1; 3112 retval = 1;
3110 break; 3113 break;
3111 } 3114 }
3112 } 3115 }
3113 3116
3114 return retval; 3117 return retval;
3115 } 3118 }
3116 3119
3117 /** 3120 /**
3118 * unbind_con_driver - unbind a console driver 3121 * unbind_con_driver - unbind a console driver
3119 * @csw: pointer to console driver to unregister 3122 * @csw: pointer to console driver to unregister
3120 * @first: first in range of consoles that @csw should be unbound from 3123 * @first: first in range of consoles that @csw should be unbound from
3121 * @last: last in range of consoles that @csw should be unbound from 3124 * @last: last in range of consoles that @csw should be unbound from
3122 * @deflt: should next bound console driver be default after @csw is unbound? 3125 * @deflt: should next bound console driver be default after @csw is unbound?
3123 * 3126 *
3124 * To unbind a driver from all possible consoles, pass 0 as @first and 3127 * To unbind a driver from all possible consoles, pass 0 as @first and
3125 * %MAX_NR_CONSOLES as @last. 3128 * %MAX_NR_CONSOLES as @last.
3126 * 3129 *
3127 * @deflt controls whether the console that ends up replacing @csw should be 3130 * @deflt controls whether the console that ends up replacing @csw should be
3128 * the default console. 3131 * the default console.
3129 * 3132 *
3130 * RETURNS: 3133 * RETURNS:
3131 * -ENODEV if @csw isn't a registered console driver or can't be unregistered 3134 * -ENODEV if @csw isn't a registered console driver or can't be unregistered
3132 * or 0 on success. 3135 * or 0 on success.
3133 */ 3136 */
3134 int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) 3137 int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
3135 { 3138 {
3136 struct module *owner = csw->owner; 3139 struct module *owner = csw->owner;
3137 const struct consw *defcsw = NULL; 3140 const struct consw *defcsw = NULL;
3138 struct con_driver *con_driver = NULL, *con_back = NULL; 3141 struct con_driver *con_driver = NULL, *con_back = NULL;
3139 int i, retval = -ENODEV; 3142 int i, retval = -ENODEV;
3140 3143
3141 if (!try_module_get(owner)) 3144 if (!try_module_get(owner))
3142 return -ENODEV; 3145 return -ENODEV;
3143 3146
3144 acquire_console_sem(); 3147 acquire_console_sem();
3145 3148
3146 /* check if driver is registered and if it is unbindable */ 3149 /* check if driver is registered and if it is unbindable */
3147 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3150 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
3148 con_driver = &registered_con_driver[i]; 3151 con_driver = &registered_con_driver[i];
3149 3152
3150 if (con_driver->con == csw && 3153 if (con_driver->con == csw &&
3151 con_driver->flag & CON_DRIVER_FLAG_MODULE) { 3154 con_driver->flag & CON_DRIVER_FLAG_MODULE) {
3152 retval = 0; 3155 retval = 0;
3153 break; 3156 break;
3154 } 3157 }
3155 } 3158 }
3156 3159
3157 if (retval) { 3160 if (retval) {
3158 release_console_sem(); 3161 release_console_sem();
3159 goto err; 3162 goto err;
3160 } 3163 }
3161 3164
3162 retval = -ENODEV; 3165 retval = -ENODEV;
3163 3166
3164 /* check if backup driver exists */ 3167 /* check if backup driver exists */
3165 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3168 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
3166 con_back = &registered_con_driver[i]; 3169 con_back = &registered_con_driver[i];
3167 3170
3168 if (con_back->con && 3171 if (con_back->con &&
3169 !(con_back->flag & CON_DRIVER_FLAG_MODULE)) { 3172 !(con_back->flag & CON_DRIVER_FLAG_MODULE)) {
3170 defcsw = con_back->con; 3173 defcsw = con_back->con;
3171 retval = 0; 3174 retval = 0;
3172 break; 3175 break;
3173 } 3176 }
3174 } 3177 }
3175 3178
3176 if (retval) { 3179 if (retval) {
3177 release_console_sem(); 3180 release_console_sem();
3178 goto err; 3181 goto err;
3179 } 3182 }
3180 3183
3181 if (!con_is_bound(csw)) { 3184 if (!con_is_bound(csw)) {
3182 release_console_sem(); 3185 release_console_sem();
3183 goto err; 3186 goto err;
3184 } 3187 }
3185 3188
3186 first = max(first, con_driver->first); 3189 first = max(first, con_driver->first);
3187 last = min(last, con_driver->last); 3190 last = min(last, con_driver->last);
3188 3191
3189 for (i = first; i <= last; i++) { 3192 for (i = first; i <= last; i++) {
3190 if (con_driver_map[i] == csw) { 3193 if (con_driver_map[i] == csw) {
3191 module_put(csw->owner); 3194 module_put(csw->owner);
3192 con_driver_map[i] = NULL; 3195 con_driver_map[i] = NULL;
3193 } 3196 }
3194 } 3197 }
3195 3198
3196 if (!con_is_bound(defcsw)) { 3199 if (!con_is_bound(defcsw)) {
3197 const struct consw *defconsw = conswitchp; 3200 const struct consw *defconsw = conswitchp;
3198 3201
3199 defcsw->con_startup(); 3202 defcsw->con_startup();
3200 con_back->flag |= CON_DRIVER_FLAG_INIT; 3203 con_back->flag |= CON_DRIVER_FLAG_INIT;
3201 /* 3204 /*
3202 * vgacon may change the default driver to point 3205 * vgacon may change the default driver to point
3203 * to dummycon, we restore it here... 3206 * to dummycon, we restore it here...
3204 */ 3207 */
3205 conswitchp = defconsw; 3208 conswitchp = defconsw;
3206 } 3209 }
3207 3210
3208 if (!con_is_bound(csw)) 3211 if (!con_is_bound(csw))
3209 con_driver->flag &= ~CON_DRIVER_FLAG_INIT; 3212 con_driver->flag &= ~CON_DRIVER_FLAG_INIT;
3210 3213
3211 release_console_sem(); 3214 release_console_sem();
3212 /* ignore return value, binding should not fail */ 3215 /* ignore return value, binding should not fail */
3213 bind_con_driver(defcsw, first, last, deflt); 3216 bind_con_driver(defcsw, first, last, deflt);
3214 err: 3217 err:
3215 module_put(owner); 3218 module_put(owner);
3216 return retval; 3219 return retval;
3217 3220
3218 } 3221 }
3219 EXPORT_SYMBOL(unbind_con_driver); 3222 EXPORT_SYMBOL(unbind_con_driver);
3220 3223
3221 static int vt_bind(struct con_driver *con) 3224 static int vt_bind(struct con_driver *con)
3222 { 3225 {
3223 const struct consw *defcsw = NULL, *csw = NULL; 3226 const struct consw *defcsw = NULL, *csw = NULL;
3224 int i, more = 1, first = -1, last = -1, deflt = 0; 3227 int i, more = 1, first = -1, last = -1, deflt = 0;
3225 3228
3226 if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) || 3229 if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) ||
3227 con_is_graphics(con->con, con->first, con->last)) 3230 con_is_graphics(con->con, con->first, con->last))
3228 goto err; 3231 goto err;
3229 3232
3230 csw = con->con; 3233 csw = con->con;
3231 3234
3232 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3235 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
3233 struct con_driver *con = &registered_con_driver[i]; 3236 struct con_driver *con = &registered_con_driver[i];
3234 3237
3235 if (con->con && !(con->flag & CON_DRIVER_FLAG_MODULE)) { 3238 if (con->con && !(con->flag & CON_DRIVER_FLAG_MODULE)) {
3236 defcsw = con->con; 3239 defcsw = con->con;
3237 break; 3240 break;
3238 } 3241 }
3239 } 3242 }
3240 3243
3241 if (!defcsw) 3244 if (!defcsw)
3242 goto err; 3245 goto err;
3243 3246
3244 while (more) { 3247 while (more) {
3245 more = 0; 3248 more = 0;
3246 3249
3247 for (i = con->first; i <= con->last; i++) { 3250 for (i = con->first; i <= con->last; i++) {
3248 if (con_driver_map[i] == defcsw) { 3251 if (con_driver_map[i] == defcsw) {
3249 if (first == -1) 3252 if (first == -1)
3250 first = i; 3253 first = i;
3251 last = i; 3254 last = i;
3252 more = 1; 3255 more = 1;
3253 } else if (first != -1) 3256 } else if (first != -1)
3254 break; 3257 break;
3255 } 3258 }
3256 3259
3257 if (first == 0 && last == MAX_NR_CONSOLES -1) 3260 if (first == 0 && last == MAX_NR_CONSOLES -1)
3258 deflt = 1; 3261 deflt = 1;
3259 3262
3260 if (first != -1) 3263 if (first != -1)
3261 bind_con_driver(csw, first, last, deflt); 3264 bind_con_driver(csw, first, last, deflt);
3262 3265
3263 first = -1; 3266 first = -1;
3264 last = -1; 3267 last = -1;
3265 deflt = 0; 3268 deflt = 0;
3266 } 3269 }
3267 3270
3268 err: 3271 err:
3269 return 0; 3272 return 0;
3270 } 3273 }
3271 3274
3272 static int vt_unbind(struct con_driver *con) 3275 static int vt_unbind(struct con_driver *con)
3273 { 3276 {
3274 const struct consw *csw = NULL; 3277 const struct consw *csw = NULL;
3275 int i, more = 1, first = -1, last = -1, deflt = 0; 3278 int i, more = 1, first = -1, last = -1, deflt = 0;
3276 3279
3277 if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) || 3280 if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) ||
3278 con_is_graphics(con->con, con->first, con->last)) 3281 con_is_graphics(con->con, con->first, con->last))
3279 goto err; 3282 goto err;
3280 3283
3281 csw = con->con; 3284 csw = con->con;
3282 3285
3283 while (more) { 3286 while (more) {
3284 more = 0; 3287 more = 0;
3285 3288
3286 for (i = con->first; i <= con->last; i++) { 3289 for (i = con->first; i <= con->last; i++) {
3287 if (con_driver_map[i] == csw) { 3290 if (con_driver_map[i] == csw) {
3288 if (first == -1) 3291 if (first == -1)
3289 first = i; 3292 first = i;
3290 last = i; 3293 last = i;
3291 more = 1; 3294 more = 1;
3292 } else if (first != -1) 3295 } else if (first != -1)
3293 break; 3296 break;
3294 } 3297 }
3295 3298
3296 if (first == 0 && last == MAX_NR_CONSOLES -1) 3299 if (first == 0 && last == MAX_NR_CONSOLES -1)
3297 deflt = 1; 3300 deflt = 1;
3298 3301
3299 if (first != -1) 3302 if (first != -1)
3300 unbind_con_driver(csw, first, last, deflt); 3303 unbind_con_driver(csw, first, last, deflt);
3301 3304
3302 first = -1; 3305 first = -1;
3303 last = -1; 3306 last = -1;
3304 deflt = 0; 3307 deflt = 0;
3305 } 3308 }
3306 3309
3307 err: 3310 err:
3308 return 0; 3311 return 0;
3309 } 3312 }
3310 #else 3313 #else
3311 static inline int vt_bind(struct con_driver *con) 3314 static inline int vt_bind(struct con_driver *con)
3312 { 3315 {
3313 return 0; 3316 return 0;
3314 } 3317 }
3315 static inline int vt_unbind(struct con_driver *con) 3318 static inline int vt_unbind(struct con_driver *con)
3316 { 3319 {
3317 return 0; 3320 return 0;
3318 } 3321 }
3319 #endif /* CONFIG_VT_HW_CONSOLE_BINDING */ 3322 #endif /* CONFIG_VT_HW_CONSOLE_BINDING */
3320 3323
3321 static ssize_t store_bind(struct device *dev, struct device_attribute *attr, 3324 static ssize_t store_bind(struct device *dev, struct device_attribute *attr,
3322 const char *buf, size_t count) 3325 const char *buf, size_t count)
3323 { 3326 {
3324 struct con_driver *con = dev_get_drvdata(dev); 3327 struct con_driver *con = dev_get_drvdata(dev);
3325 int bind = simple_strtoul(buf, NULL, 0); 3328 int bind = simple_strtoul(buf, NULL, 0);
3326 3329
3327 if (bind) 3330 if (bind)
3328 vt_bind(con); 3331 vt_bind(con);
3329 else 3332 else
3330 vt_unbind(con); 3333 vt_unbind(con);
3331 3334
3332 return count; 3335 return count;
3333 } 3336 }
3334 3337
3335 static ssize_t show_bind(struct device *dev, struct device_attribute *attr, 3338 static ssize_t show_bind(struct device *dev, struct device_attribute *attr,
3336 char *buf) 3339 char *buf)
3337 { 3340 {
3338 struct con_driver *con = dev_get_drvdata(dev); 3341 struct con_driver *con = dev_get_drvdata(dev);
3339 int bind = con_is_bound(con->con); 3342 int bind = con_is_bound(con->con);
3340 3343
3341 return snprintf(buf, PAGE_SIZE, "%i\n", bind); 3344 return snprintf(buf, PAGE_SIZE, "%i\n", bind);
3342 } 3345 }
3343 3346
3344 static ssize_t show_name(struct device *dev, struct device_attribute *attr, 3347 static ssize_t show_name(struct device *dev, struct device_attribute *attr,
3345 char *buf) 3348 char *buf)
3346 { 3349 {
3347 struct con_driver *con = dev_get_drvdata(dev); 3350 struct con_driver *con = dev_get_drvdata(dev);
3348 3351
3349 return snprintf(buf, PAGE_SIZE, "%s %s\n", 3352 return snprintf(buf, PAGE_SIZE, "%s %s\n",
3350 (con->flag & CON_DRIVER_FLAG_MODULE) ? "(M)" : "(S)", 3353 (con->flag & CON_DRIVER_FLAG_MODULE) ? "(M)" : "(S)",
3351 con->desc); 3354 con->desc);
3352 3355
3353 } 3356 }
3354 3357
3355 static struct device_attribute device_attrs[] = { 3358 static struct device_attribute device_attrs[] = {
3356 __ATTR(bind, S_IRUGO|S_IWUSR, show_bind, store_bind), 3359 __ATTR(bind, S_IRUGO|S_IWUSR, show_bind, store_bind),
3357 __ATTR(name, S_IRUGO, show_name, NULL), 3360 __ATTR(name, S_IRUGO, show_name, NULL),
3358 }; 3361 };
3359 3362
3360 static int vtconsole_init_device(struct con_driver *con) 3363 static int vtconsole_init_device(struct con_driver *con)
3361 { 3364 {
3362 int i; 3365 int i;
3363 int error = 0; 3366 int error = 0;
3364 3367
3365 con->flag |= CON_DRIVER_FLAG_ATTR; 3368 con->flag |= CON_DRIVER_FLAG_ATTR;
3366 dev_set_drvdata(con->dev, con); 3369 dev_set_drvdata(con->dev, con);
3367 for (i = 0; i < ARRAY_SIZE(device_attrs); i++) { 3370 for (i = 0; i < ARRAY_SIZE(device_attrs); i++) {
3368 error = device_create_file(con->dev, &device_attrs[i]); 3371 error = device_create_file(con->dev, &device_attrs[i]);
3369 if (error) 3372 if (error)
3370 break; 3373 break;
3371 } 3374 }
3372 3375
3373 if (error) { 3376 if (error) {
3374 while (--i >= 0) 3377 while (--i >= 0)
3375 device_remove_file(con->dev, &device_attrs[i]); 3378 device_remove_file(con->dev, &device_attrs[i]);
3376 con->flag &= ~CON_DRIVER_FLAG_ATTR; 3379 con->flag &= ~CON_DRIVER_FLAG_ATTR;
3377 } 3380 }
3378 3381
3379 return error; 3382 return error;
3380 } 3383 }
3381 3384
3382 static void vtconsole_deinit_device(struct con_driver *con) 3385 static void vtconsole_deinit_device(struct con_driver *con)
3383 { 3386 {
3384 int i; 3387 int i;
3385 3388
3386 if (con->flag & CON_DRIVER_FLAG_ATTR) { 3389 if (con->flag & CON_DRIVER_FLAG_ATTR) {
3387 for (i = 0; i < ARRAY_SIZE(device_attrs); i++) 3390 for (i = 0; i < ARRAY_SIZE(device_attrs); i++)
3388 device_remove_file(con->dev, &device_attrs[i]); 3391 device_remove_file(con->dev, &device_attrs[i]);
3389 con->flag &= ~CON_DRIVER_FLAG_ATTR; 3392 con->flag &= ~CON_DRIVER_FLAG_ATTR;
3390 } 3393 }
3391 } 3394 }
3392 3395
3393 /** 3396 /**
3394 * con_is_bound - checks if driver is bound to the console 3397 * con_is_bound - checks if driver is bound to the console
3395 * @csw: console driver 3398 * @csw: console driver
3396 * 3399 *
3397 * RETURNS: zero if unbound, nonzero if bound 3400 * RETURNS: zero if unbound, nonzero if bound
3398 * 3401 *
3399 * Drivers can call this and if zero, they should release 3402 * Drivers can call this and if zero, they should release
3400 * all resources allocated on con_startup() 3403 * all resources allocated on con_startup()
3401 */ 3404 */
3402 int con_is_bound(const struct consw *csw) 3405 int con_is_bound(const struct consw *csw)
3403 { 3406 {
3404 int i, bound = 0; 3407 int i, bound = 0;
3405 3408
3406 for (i = 0; i < MAX_NR_CONSOLES; i++) { 3409 for (i = 0; i < MAX_NR_CONSOLES; i++) {
3407 if (con_driver_map[i] == csw) { 3410 if (con_driver_map[i] == csw) {
3408 bound = 1; 3411 bound = 1;
3409 break; 3412 break;
3410 } 3413 }
3411 } 3414 }
3412 3415
3413 return bound; 3416 return bound;
3414 } 3417 }
3415 EXPORT_SYMBOL(con_is_bound); 3418 EXPORT_SYMBOL(con_is_bound);
3416 3419
3417 /** 3420 /**
3418 * register_con_driver - register console driver to console layer 3421 * register_con_driver - register console driver to console layer
3419 * @csw: console driver 3422 * @csw: console driver
3420 * @first: the first console to take over, minimum value is 0 3423 * @first: the first console to take over, minimum value is 0
3421 * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1 3424 * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1
3422 * 3425 *
3423 * DESCRIPTION: This function registers a console driver which can later 3426 * DESCRIPTION: This function registers a console driver which can later
3424 * bind to a range of consoles specified by @first and @last. It will 3427 * bind to a range of consoles specified by @first and @last. It will
3425 * also initialize the console driver by calling con_startup(). 3428 * also initialize the console driver by calling con_startup().
3426 */ 3429 */
3427 int register_con_driver(const struct consw *csw, int first, int last) 3430 int register_con_driver(const struct consw *csw, int first, int last)
3428 { 3431 {
3429 struct module *owner = csw->owner; 3432 struct module *owner = csw->owner;
3430 struct con_driver *con_driver; 3433 struct con_driver *con_driver;
3431 const char *desc; 3434 const char *desc;
3432 int i, retval = 0; 3435 int i, retval = 0;
3433 3436
3434 if (!try_module_get(owner)) 3437 if (!try_module_get(owner))
3435 return -ENODEV; 3438 return -ENODEV;
3436 3439
3437 acquire_console_sem(); 3440 acquire_console_sem();
3438 3441
3439 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3442 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
3440 con_driver = &registered_con_driver[i]; 3443 con_driver = &registered_con_driver[i];
3441 3444
3442 /* already registered */ 3445 /* already registered */
3443 if (con_driver->con == csw) 3446 if (con_driver->con == csw)
3444 retval = -EINVAL; 3447 retval = -EINVAL;
3445 } 3448 }
3446 3449
3447 if (retval) 3450 if (retval)
3448 goto err; 3451 goto err;
3449 3452
3450 desc = csw->con_startup(); 3453 desc = csw->con_startup();
3451 3454
3452 if (!desc) 3455 if (!desc)
3453 goto err; 3456 goto err;
3454 3457
3455 retval = -EINVAL; 3458 retval = -EINVAL;
3456 3459
3457 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3460 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
3458 con_driver = &registered_con_driver[i]; 3461 con_driver = &registered_con_driver[i];
3459 3462
3460 if (con_driver->con == NULL) { 3463 if (con_driver->con == NULL) {
3461 con_driver->con = csw; 3464 con_driver->con = csw;
3462 con_driver->desc = desc; 3465 con_driver->desc = desc;
3463 con_driver->node = i; 3466 con_driver->node = i;
3464 con_driver->flag = CON_DRIVER_FLAG_MODULE | 3467 con_driver->flag = CON_DRIVER_FLAG_MODULE |
3465 CON_DRIVER_FLAG_INIT; 3468 CON_DRIVER_FLAG_INIT;
3466 con_driver->first = first; 3469 con_driver->first = first;
3467 con_driver->last = last; 3470 con_driver->last = last;
3468 retval = 0; 3471 retval = 0;
3469 break; 3472 break;
3470 } 3473 }
3471 } 3474 }
3472 3475
3473 if (retval) 3476 if (retval)
3474 goto err; 3477 goto err;
3475 3478
3476 con_driver->dev = device_create(vtconsole_class, NULL, 3479 con_driver->dev = device_create(vtconsole_class, NULL,
3477 MKDEV(0, con_driver->node), 3480 MKDEV(0, con_driver->node),
3478 NULL, "vtcon%i", 3481 NULL, "vtcon%i",
3479 con_driver->node); 3482 con_driver->node);
3480 3483
3481 if (IS_ERR(con_driver->dev)) { 3484 if (IS_ERR(con_driver->dev)) {
3482 printk(KERN_WARNING "Unable to create device for %s; " 3485 printk(KERN_WARNING "Unable to create device for %s; "
3483 "errno = %ld\n", con_driver->desc, 3486 "errno = %ld\n", con_driver->desc,
3484 PTR_ERR(con_driver->dev)); 3487 PTR_ERR(con_driver->dev));
3485 con_driver->dev = NULL; 3488 con_driver->dev = NULL;
3486 } else { 3489 } else {
3487 vtconsole_init_device(con_driver); 3490 vtconsole_init_device(con_driver);
3488 } 3491 }
3489 3492
3490 err: 3493 err:
3491 release_console_sem(); 3494 release_console_sem();
3492 module_put(owner); 3495 module_put(owner);
3493 return retval; 3496 return retval;
3494 } 3497 }
3495 EXPORT_SYMBOL(register_con_driver); 3498 EXPORT_SYMBOL(register_con_driver);
3496 3499
3497 /** 3500 /**
3498 * unregister_con_driver - unregister console driver from console layer 3501 * unregister_con_driver - unregister console driver from console layer
3499 * @csw: console driver 3502 * @csw: console driver
3500 * 3503 *
3501 * DESCRIPTION: All drivers that registers to the console layer must 3504 * DESCRIPTION: All drivers that registers to the console layer must
3502 * call this function upon exit, or if the console driver is in a state 3505 * call this function upon exit, or if the console driver is in a state
3503 * where it won't be able to handle console services, such as the 3506 * where it won't be able to handle console services, such as the
3504 * framebuffer console without loaded framebuffer drivers. 3507 * framebuffer console without loaded framebuffer drivers.
3505 * 3508 *
3506 * The driver must unbind first prior to unregistration. 3509 * The driver must unbind first prior to unregistration.
3507 */ 3510 */
3508 int unregister_con_driver(const struct consw *csw) 3511 int unregister_con_driver(const struct consw *csw)
3509 { 3512 {
3510 int i, retval = -ENODEV; 3513 int i, retval = -ENODEV;
3511 3514
3512 acquire_console_sem(); 3515 acquire_console_sem();
3513 3516
3514 /* cannot unregister a bound driver */ 3517 /* cannot unregister a bound driver */
3515 if (con_is_bound(csw)) 3518 if (con_is_bound(csw))
3516 goto err; 3519 goto err;
3517 3520
3518 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3521 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
3519 struct con_driver *con_driver = &registered_con_driver[i]; 3522 struct con_driver *con_driver = &registered_con_driver[i];
3520 3523
3521 if (con_driver->con == csw && 3524 if (con_driver->con == csw &&
3522 con_driver->flag & CON_DRIVER_FLAG_MODULE) { 3525 con_driver->flag & CON_DRIVER_FLAG_MODULE) {
3523 vtconsole_deinit_device(con_driver); 3526 vtconsole_deinit_device(con_driver);
3524 device_destroy(vtconsole_class, 3527 device_destroy(vtconsole_class,
3525 MKDEV(0, con_driver->node)); 3528 MKDEV(0, con_driver->node));
3526 con_driver->con = NULL; 3529 con_driver->con = NULL;
3527 con_driver->desc = NULL; 3530 con_driver->desc = NULL;
3528 con_driver->dev = NULL; 3531 con_driver->dev = NULL;
3529 con_driver->node = 0; 3532 con_driver->node = 0;
3530 con_driver->flag = 0; 3533 con_driver->flag = 0;
3531 con_driver->first = 0; 3534 con_driver->first = 0;
3532 con_driver->last = 0; 3535 con_driver->last = 0;
3533 retval = 0; 3536 retval = 0;
3534 break; 3537 break;
3535 } 3538 }
3536 } 3539 }
3537 err: 3540 err:
3538 release_console_sem(); 3541 release_console_sem();
3539 return retval; 3542 return retval;
3540 } 3543 }
3541 EXPORT_SYMBOL(unregister_con_driver); 3544 EXPORT_SYMBOL(unregister_con_driver);
3542 3545
3543 /* 3546 /*
3544 * If we support more console drivers, this function is used 3547 * If we support more console drivers, this function is used
3545 * when a driver wants to take over some existing consoles 3548 * when a driver wants to take over some existing consoles
3546 * and become default driver for newly opened ones. 3549 * and become default driver for newly opened ones.
3547 * 3550 *
3548 * take_over_console is basically a register followed by unbind 3551 * take_over_console is basically a register followed by unbind
3549 */ 3552 */
3550 int take_over_console(const struct consw *csw, int first, int last, int deflt) 3553 int take_over_console(const struct consw *csw, int first, int last, int deflt)
3551 { 3554 {
3552 int err; 3555 int err;
3553 3556
3554 err = register_con_driver(csw, first, last); 3557 err = register_con_driver(csw, first, last);
3555 3558
3556 if (!err) 3559 if (!err)
3557 bind_con_driver(csw, first, last, deflt); 3560 bind_con_driver(csw, first, last, deflt);
3558 3561
3559 return err; 3562 return err;
3560 } 3563 }
3561 3564
3562 /* 3565 /*
3563 * give_up_console is a wrapper to unregister_con_driver. It will only 3566 * give_up_console is a wrapper to unregister_con_driver. It will only
3564 * work if driver is fully unbound. 3567 * work if driver is fully unbound.
3565 */ 3568 */
3566 void give_up_console(const struct consw *csw) 3569 void give_up_console(const struct consw *csw)
3567 { 3570 {
3568 unregister_con_driver(csw); 3571 unregister_con_driver(csw);
3569 } 3572 }
3570 3573
3571 static int __init vtconsole_class_init(void) 3574 static int __init vtconsole_class_init(void)
3572 { 3575 {
3573 int i; 3576 int i;
3574 3577
3575 vtconsole_class = class_create(THIS_MODULE, "vtconsole"); 3578 vtconsole_class = class_create(THIS_MODULE, "vtconsole");
3576 if (IS_ERR(vtconsole_class)) { 3579 if (IS_ERR(vtconsole_class)) {
3577 printk(KERN_WARNING "Unable to create vt console class; " 3580 printk(KERN_WARNING "Unable to create vt console class; "
3578 "errno = %ld\n", PTR_ERR(vtconsole_class)); 3581 "errno = %ld\n", PTR_ERR(vtconsole_class));
3579 vtconsole_class = NULL; 3582 vtconsole_class = NULL;
3580 } 3583 }
3581 3584
3582 /* Add system drivers to sysfs */ 3585 /* Add system drivers to sysfs */
3583 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3586 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
3584 struct con_driver *con = &registered_con_driver[i]; 3587 struct con_driver *con = &registered_con_driver[i];
3585 3588
3586 if (con->con && !con->dev) { 3589 if (con->con && !con->dev) {
3587 con->dev = device_create(vtconsole_class, NULL, 3590 con->dev = device_create(vtconsole_class, NULL,
3588 MKDEV(0, con->node), 3591 MKDEV(0, con->node),
3589 NULL, "vtcon%i", 3592 NULL, "vtcon%i",
3590 con->node); 3593 con->node);
3591 3594
3592 if (IS_ERR(con->dev)) { 3595 if (IS_ERR(con->dev)) {
3593 printk(KERN_WARNING "Unable to create " 3596 printk(KERN_WARNING "Unable to create "
3594 "device for %s; errno = %ld\n", 3597 "device for %s; errno = %ld\n",
3595 con->desc, PTR_ERR(con->dev)); 3598 con->desc, PTR_ERR(con->dev));
3596 con->dev = NULL; 3599 con->dev = NULL;
3597 } else { 3600 } else {
3598 vtconsole_init_device(con); 3601 vtconsole_init_device(con);
3599 } 3602 }
3600 } 3603 }
3601 } 3604 }
3602 3605
3603 return 0; 3606 return 0;
3604 } 3607 }
3605 postcore_initcall(vtconsole_class_init); 3608 postcore_initcall(vtconsole_class_init);
3606 3609
3607 #endif 3610 #endif
3608 3611
3609 /* 3612 /*
3610 * Screen blanking 3613 * Screen blanking
3611 */ 3614 */
3612 3615
3613 static int set_vesa_blanking(char __user *p) 3616 static int set_vesa_blanking(char __user *p)
3614 { 3617 {
3615 unsigned int mode; 3618 unsigned int mode;
3616 3619
3617 if (get_user(mode, p + 1)) 3620 if (get_user(mode, p + 1))
3618 return -EFAULT; 3621 return -EFAULT;
3619 3622
3620 vesa_blank_mode = (mode < 4) ? mode : 0; 3623 vesa_blank_mode = (mode < 4) ? mode : 0;
3621 return 0; 3624 return 0;
3622 } 3625 }
3623 3626
3624 void do_blank_screen(int entering_gfx) 3627 void do_blank_screen(int entering_gfx)
3625 { 3628 {
3626 struct vc_data *vc = vc_cons[fg_console].d; 3629 struct vc_data *vc = vc_cons[fg_console].d;
3627 int i; 3630 int i;
3628 3631
3629 WARN_CONSOLE_UNLOCKED(); 3632 WARN_CONSOLE_UNLOCKED();
3630 3633
3631 if (console_blanked) { 3634 if (console_blanked) {
3632 if (blank_state == blank_vesa_wait) { 3635 if (blank_state == blank_vesa_wait) {
3633 blank_state = blank_off; 3636 blank_state = blank_off;
3634 vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0); 3637 vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0);
3635 } 3638 }
3636 return; 3639 return;
3637 } 3640 }
3638 3641
3639 /* entering graphics mode? */ 3642 /* entering graphics mode? */
3640 if (entering_gfx) { 3643 if (entering_gfx) {
3641 hide_cursor(vc); 3644 hide_cursor(vc);
3642 save_screen(vc); 3645 save_screen(vc);
3643 vc->vc_sw->con_blank(vc, -1, 1); 3646 vc->vc_sw->con_blank(vc, -1, 1);
3644 console_blanked = fg_console + 1; 3647 console_blanked = fg_console + 1;
3645 blank_state = blank_off; 3648 blank_state = blank_off;
3646 set_origin(vc); 3649 set_origin(vc);
3647 return; 3650 return;
3648 } 3651 }
3649 3652
3650 if (blank_state != blank_normal_wait) 3653 if (blank_state != blank_normal_wait)
3651 return; 3654 return;
3652 blank_state = blank_off; 3655 blank_state = blank_off;
3653 3656
3654 /* don't blank graphics */ 3657 /* don't blank graphics */
3655 if (vc->vc_mode != KD_TEXT) { 3658 if (vc->vc_mode != KD_TEXT) {
3656 console_blanked = fg_console + 1; 3659 console_blanked = fg_console + 1;
3657 return; 3660 return;
3658 } 3661 }
3659 3662
3660 hide_cursor(vc); 3663 hide_cursor(vc);
3661 del_timer_sync(&console_timer); 3664 del_timer_sync(&console_timer);
3662 blank_timer_expired = 0; 3665 blank_timer_expired = 0;
3663 3666
3664 save_screen(vc); 3667 save_screen(vc);
3665 /* In case we need to reset origin, blanking hook returns 1 */ 3668 /* In case we need to reset origin, blanking hook returns 1 */
3666 i = vc->vc_sw->con_blank(vc, vesa_off_interval ? 1 : (vesa_blank_mode + 1), 0); 3669 i = vc->vc_sw->con_blank(vc, vesa_off_interval ? 1 : (vesa_blank_mode + 1), 0);
3667 console_blanked = fg_console + 1; 3670 console_blanked = fg_console + 1;
3668 if (i) 3671 if (i)
3669 set_origin(vc); 3672 set_origin(vc);
3670 3673
3671 if (console_blank_hook && console_blank_hook(1)) 3674 if (console_blank_hook && console_blank_hook(1))
3672 return; 3675 return;
3673 3676
3674 if (vesa_off_interval && vesa_blank_mode) { 3677 if (vesa_off_interval && vesa_blank_mode) {
3675 blank_state = blank_vesa_wait; 3678 blank_state = blank_vesa_wait;
3676 mod_timer(&console_timer, jiffies + vesa_off_interval); 3679 mod_timer(&console_timer, jiffies + vesa_off_interval);
3677 } 3680 }
3678 vt_event_post(VT_EVENT_BLANK, vc->vc_num, vc->vc_num); 3681 vt_event_post(VT_EVENT_BLANK, vc->vc_num, vc->vc_num);
3679 } 3682 }
3680 EXPORT_SYMBOL(do_blank_screen); 3683 EXPORT_SYMBOL(do_blank_screen);
3681 3684
3682 /* 3685 /*
3683 * Called by timer as well as from vt_console_driver 3686 * Called by timer as well as from vt_console_driver
3684 */ 3687 */
3685 void do_unblank_screen(int leaving_gfx) 3688 void do_unblank_screen(int leaving_gfx)
3686 { 3689 {
3687 struct vc_data *vc; 3690 struct vc_data *vc;
3688 3691
3689 /* This should now always be called from a "sane" (read: can schedule) 3692 /* This should now always be called from a "sane" (read: can schedule)
3690 * context for the sake of the low level drivers, except in the special 3693 * context for the sake of the low level drivers, except in the special
3691 * case of oops_in_progress 3694 * case of oops_in_progress
3692 */ 3695 */
3693 if (!oops_in_progress) 3696 if (!oops_in_progress)
3694 might_sleep(); 3697 might_sleep();
3695 3698
3696 WARN_CONSOLE_UNLOCKED(); 3699 WARN_CONSOLE_UNLOCKED();
3697 3700
3698 ignore_poke = 0; 3701 ignore_poke = 0;
3699 if (!console_blanked) 3702 if (!console_blanked)
3700 return; 3703 return;
3701 if (!vc_cons_allocated(fg_console)) { 3704 if (!vc_cons_allocated(fg_console)) {
3702 /* impossible */ 3705 /* impossible */
3703 printk("unblank_screen: tty %d not allocated ??\n", fg_console+1); 3706 printk("unblank_screen: tty %d not allocated ??\n", fg_console+1);
3704 return; 3707 return;
3705 } 3708 }
3706 vc = vc_cons[fg_console].d; 3709 vc = vc_cons[fg_console].d;
3707 if (vc->vc_mode != KD_TEXT) 3710 if (vc->vc_mode != KD_TEXT)
3708 return; /* but leave console_blanked != 0 */ 3711 return; /* but leave console_blanked != 0 */
3709 3712
3710 if (blankinterval) { 3713 if (blankinterval) {
3711 mod_timer(&console_timer, jiffies + (blankinterval * HZ)); 3714 mod_timer(&console_timer, jiffies + (blankinterval * HZ));
3712 blank_state = blank_normal_wait; 3715 blank_state = blank_normal_wait;
3713 } 3716 }
3714 3717
3715 console_blanked = 0; 3718 console_blanked = 0;
3716 if (vc->vc_sw->con_blank(vc, 0, leaving_gfx)) 3719 if (vc->vc_sw->con_blank(vc, 0, leaving_gfx))
3717 /* Low-level driver cannot restore -> do it ourselves */ 3720 /* Low-level driver cannot restore -> do it ourselves */
3718 update_screen(vc); 3721 update_screen(vc);
3719 if (console_blank_hook) 3722 if (console_blank_hook)
3720 console_blank_hook(0); 3723 console_blank_hook(0);
3721 set_palette(vc); 3724 set_palette(vc);
3722 set_cursor(vc); 3725 set_cursor(vc);
3723 vt_event_post(VT_EVENT_UNBLANK, vc->vc_num, vc->vc_num); 3726 vt_event_post(VT_EVENT_UNBLANK, vc->vc_num, vc->vc_num);
3724 } 3727 }
3725 EXPORT_SYMBOL(do_unblank_screen); 3728 EXPORT_SYMBOL(do_unblank_screen);
3726 3729
3727 /* 3730 /*
3728 * This is called by the outside world to cause a forced unblank, mostly for 3731 * This is called by the outside world to cause a forced unblank, mostly for
3729 * oopses. Currently, I just call do_unblank_screen(0), but we could eventually 3732 * oopses. Currently, I just call do_unblank_screen(0), but we could eventually
3730 * call it with 1 as an argument and so force a mode restore... that may kill 3733 * call it with 1 as an argument and so force a mode restore... that may kill
3731 * X or at least garbage the screen but would also make the Oops visible... 3734 * X or at least garbage the screen but would also make the Oops visible...
3732 */ 3735 */
3733 void unblank_screen(void) 3736 void unblank_screen(void)
3734 { 3737 {
3735 do_unblank_screen(0); 3738 do_unblank_screen(0);
3736 } 3739 }
3737 3740
3738 /* 3741 /*
3739 * We defer the timer blanking to work queue so it can take the console mutex 3742 * We defer the timer blanking to work queue so it can take the console mutex
3740 * (console operations can still happen at irq time, but only from printk which 3743 * (console operations can still happen at irq time, but only from printk which
3741 * has the console mutex. Not perfect yet, but better than no locking 3744 * has the console mutex. Not perfect yet, but better than no locking
3742 */ 3745 */
3743 static void blank_screen_t(unsigned long dummy) 3746 static void blank_screen_t(unsigned long dummy)
3744 { 3747 {
3745 if (unlikely(!keventd_up())) { 3748 if (unlikely(!keventd_up())) {
3746 mod_timer(&console_timer, jiffies + (blankinterval * HZ)); 3749 mod_timer(&console_timer, jiffies + (blankinterval * HZ));
3747 return; 3750 return;
3748 } 3751 }
3749 blank_timer_expired = 1; 3752 blank_timer_expired = 1;
3750 schedule_work(&console_work); 3753 schedule_work(&console_work);
3751 } 3754 }
3752 3755
3753 void poke_blanked_console(void) 3756 void poke_blanked_console(void)
3754 { 3757 {
3755 WARN_CONSOLE_UNLOCKED(); 3758 WARN_CONSOLE_UNLOCKED();
3756 3759
3757 /* Add this so we quickly catch whoever might call us in a non 3760 /* Add this so we quickly catch whoever might call us in a non
3758 * safe context. Nowadays, unblank_screen() isn't to be called in 3761 * safe context. Nowadays, unblank_screen() isn't to be called in
3759 * atomic contexts and is allowed to schedule (with the special case 3762 * atomic contexts and is allowed to schedule (with the special case
3760 * of oops_in_progress, but that isn't of any concern for this 3763 * of oops_in_progress, but that isn't of any concern for this
3761 * function. --BenH. 3764 * function. --BenH.
3762 */ 3765 */
3763 might_sleep(); 3766 might_sleep();
3764 3767
3765 /* This isn't perfectly race free, but a race here would be mostly harmless, 3768 /* This isn't perfectly race free, but a race here would be mostly harmless,
3766 * at worse, we'll do a spurrious blank and it's unlikely 3769 * at worse, we'll do a spurrious blank and it's unlikely
3767 */ 3770 */
3768 del_timer(&console_timer); 3771 del_timer(&console_timer);
3769 blank_timer_expired = 0; 3772 blank_timer_expired = 0;
3770 3773
3771 if (ignore_poke || !vc_cons[fg_console].d || vc_cons[fg_console].d->vc_mode == KD_GRAPHICS) 3774 if (ignore_poke || !vc_cons[fg_console].d || vc_cons[fg_console].d->vc_mode == KD_GRAPHICS)
3772 return; 3775 return;
3773 if (console_blanked) 3776 if (console_blanked)
3774 unblank_screen(); 3777 unblank_screen();
3775 else if (blankinterval) { 3778 else if (blankinterval) {
3776 mod_timer(&console_timer, jiffies + (blankinterval * HZ)); 3779 mod_timer(&console_timer, jiffies + (blankinterval * HZ));
3777 blank_state = blank_normal_wait; 3780 blank_state = blank_normal_wait;
3778 } 3781 }
3779 } 3782 }
3780 3783
3781 /* 3784 /*
3782 * Palettes 3785 * Palettes
3783 */ 3786 */
3784 3787
3785 static void set_palette(struct vc_data *vc) 3788 static void set_palette(struct vc_data *vc)
3786 { 3789 {
3787 WARN_CONSOLE_UNLOCKED(); 3790 WARN_CONSOLE_UNLOCKED();
3788 3791
3789 if (vc->vc_mode != KD_GRAPHICS) 3792 if (vc->vc_mode != KD_GRAPHICS)
3790 vc->vc_sw->con_set_palette(vc, color_table); 3793 vc->vc_sw->con_set_palette(vc, color_table);
3791 } 3794 }
3792 3795
3793 static int set_get_cmap(unsigned char __user *arg, int set) 3796 static int set_get_cmap(unsigned char __user *arg, int set)
3794 { 3797 {
3795 int i, j, k; 3798 int i, j, k;
3796 3799
3797 WARN_CONSOLE_UNLOCKED(); 3800 WARN_CONSOLE_UNLOCKED();
3798 3801
3799 for (i = 0; i < 16; i++) 3802 for (i = 0; i < 16; i++)
3800 if (set) { 3803 if (set) {
3801 get_user(default_red[i], arg++); 3804 get_user(default_red[i], arg++);
3802 get_user(default_grn[i], arg++); 3805 get_user(default_grn[i], arg++);
3803 get_user(default_blu[i], arg++); 3806 get_user(default_blu[i], arg++);
3804 } else { 3807 } else {
3805 put_user(default_red[i], arg++); 3808 put_user(default_red[i], arg++);
3806 put_user(default_grn[i], arg++); 3809 put_user(default_grn[i], arg++);
3807 put_user(default_blu[i], arg++); 3810 put_user(default_blu[i], arg++);
3808 } 3811 }
3809 if (set) { 3812 if (set) {
3810 for (i = 0; i < MAX_NR_CONSOLES; i++) 3813 for (i = 0; i < MAX_NR_CONSOLES; i++)
3811 if (vc_cons_allocated(i)) { 3814 if (vc_cons_allocated(i)) {
3812 for (j = k = 0; j < 16; j++) { 3815 for (j = k = 0; j < 16; j++) {
3813 vc_cons[i].d->vc_palette[k++] = default_red[j]; 3816 vc_cons[i].d->vc_palette[k++] = default_red[j];
3814 vc_cons[i].d->vc_palette[k++] = default_grn[j]; 3817 vc_cons[i].d->vc_palette[k++] = default_grn[j];
3815 vc_cons[i].d->vc_palette[k++] = default_blu[j]; 3818 vc_cons[i].d->vc_palette[k++] = default_blu[j];
3816 } 3819 }
3817 set_palette(vc_cons[i].d); 3820 set_palette(vc_cons[i].d);
3818 } 3821 }
3819 } 3822 }
3820 return 0; 3823 return 0;
3821 } 3824 }
3822 3825
3823 /* 3826 /*
3824 * Load palette into the DAC registers. arg points to a colour 3827 * Load palette into the DAC registers. arg points to a colour
3825 * map, 3 bytes per colour, 16 colours, range from 0 to 255. 3828 * map, 3 bytes per colour, 16 colours, range from 0 to 255.
3826 */ 3829 */
3827 3830
3828 int con_set_cmap(unsigned char __user *arg) 3831 int con_set_cmap(unsigned char __user *arg)
3829 { 3832 {
3830 int rc; 3833 int rc;
3831 3834
3832 acquire_console_sem(); 3835 acquire_console_sem();
3833 rc = set_get_cmap (arg,1); 3836 rc = set_get_cmap (arg,1);
3834 release_console_sem(); 3837 release_console_sem();
3835 3838
3836 return rc; 3839 return rc;
3837 } 3840 }
3838 3841
3839 int con_get_cmap(unsigned char __user *arg) 3842 int con_get_cmap(unsigned char __user *arg)
3840 { 3843 {
3841 int rc; 3844 int rc;
3842 3845
3843 acquire_console_sem(); 3846 acquire_console_sem();
3844 rc = set_get_cmap (arg,0); 3847 rc = set_get_cmap (arg,0);
3845 release_console_sem(); 3848 release_console_sem();
3846 3849
3847 return rc; 3850 return rc;
3848 } 3851 }
3849 3852
3850 void reset_palette(struct vc_data *vc) 3853 void reset_palette(struct vc_data *vc)
3851 { 3854 {
3852 int j, k; 3855 int j, k;
3853 for (j=k=0; j<16; j++) { 3856 for (j=k=0; j<16; j++) {
3854 vc->vc_palette[k++] = default_red[j]; 3857 vc->vc_palette[k++] = default_red[j];
3855 vc->vc_palette[k++] = default_grn[j]; 3858 vc->vc_palette[k++] = default_grn[j];
3856 vc->vc_palette[k++] = default_blu[j]; 3859 vc->vc_palette[k++] = default_blu[j];
3857 } 3860 }
3858 set_palette(vc); 3861 set_palette(vc);
3859 } 3862 }
3860 3863
3861 /* 3864 /*
3862 * Font switching 3865 * Font switching
3863 * 3866 *
3864 * Currently we only support fonts up to 32 pixels wide, at a maximum height 3867 * Currently we only support fonts up to 32 pixels wide, at a maximum height
3865 * of 32 pixels. Userspace fontdata is stored with 32 bytes (shorts/ints, 3868 * of 32 pixels. Userspace fontdata is stored with 32 bytes (shorts/ints,
3866 * depending on width) reserved for each character which is kinda wasty, but 3869 * depending on width) reserved for each character which is kinda wasty, but
3867 * this is done in order to maintain compatibility with the EGA/VGA fonts. It 3870 * this is done in order to maintain compatibility with the EGA/VGA fonts. It
3868 * is upto the actual low-level console-driver convert data into its favorite 3871 * is upto the actual low-level console-driver convert data into its favorite
3869 * format (maybe we should add a `fontoffset' field to the `display' 3872 * format (maybe we should add a `fontoffset' field to the `display'
3870 * structure so we won't have to convert the fontdata all the time. 3873 * structure so we won't have to convert the fontdata all the time.
3871 * /Jes 3874 * /Jes
3872 */ 3875 */
3873 3876
3874 #define max_font_size 65536 3877 #define max_font_size 65536
3875 3878
3876 static int con_font_get(struct vc_data *vc, struct console_font_op *op) 3879 static int con_font_get(struct vc_data *vc, struct console_font_op *op)
3877 { 3880 {
3878 struct console_font font; 3881 struct console_font font;
3879 int rc = -EINVAL; 3882 int rc = -EINVAL;
3880 int c; 3883 int c;
3881 3884
3882 if (vc->vc_mode != KD_TEXT) 3885 if (vc->vc_mode != KD_TEXT)
3883 return -EINVAL; 3886 return -EINVAL;
3884 3887
3885 if (op->data) { 3888 if (op->data) {
3886 font.data = kmalloc(max_font_size, GFP_KERNEL); 3889 font.data = kmalloc(max_font_size, GFP_KERNEL);
3887 if (!font.data) 3890 if (!font.data)
3888 return -ENOMEM; 3891 return -ENOMEM;
3889 } else 3892 } else
3890 font.data = NULL; 3893 font.data = NULL;
3891 3894
3892 acquire_console_sem(); 3895 acquire_console_sem();
3893 if (vc->vc_sw->con_font_get) 3896 if (vc->vc_sw->con_font_get)
3894 rc = vc->vc_sw->con_font_get(vc, &font); 3897 rc = vc->vc_sw->con_font_get(vc, &font);
3895 else 3898 else
3896 rc = -ENOSYS; 3899 rc = -ENOSYS;
3897 release_console_sem(); 3900 release_console_sem();
3898 3901
3899 if (rc) 3902 if (rc)
3900 goto out; 3903 goto out;
3901 3904
3902 c = (font.width+7)/8 * 32 * font.charcount; 3905 c = (font.width+7)/8 * 32 * font.charcount;
3903 3906
3904 if (op->data && font.charcount > op->charcount) 3907 if (op->data && font.charcount > op->charcount)
3905 rc = -ENOSPC; 3908 rc = -ENOSPC;
3906 if (!(op->flags & KD_FONT_FLAG_OLD)) { 3909 if (!(op->flags & KD_FONT_FLAG_OLD)) {
3907 if (font.width > op->width || font.height > op->height) 3910 if (font.width > op->width || font.height > op->height)
3908 rc = -ENOSPC; 3911 rc = -ENOSPC;
3909 } else { 3912 } else {
3910 if (font.width != 8) 3913 if (font.width != 8)
3911 rc = -EIO; 3914 rc = -EIO;
3912 else if ((op->height && font.height > op->height) || 3915 else if ((op->height && font.height > op->height) ||
3913 font.height > 32) 3916 font.height > 32)
3914 rc = -ENOSPC; 3917 rc = -ENOSPC;
3915 } 3918 }
3916 if (rc) 3919 if (rc)
3917 goto out; 3920 goto out;
3918 3921
3919 op->height = font.height; 3922 op->height = font.height;
3920 op->width = font.width; 3923 op->width = font.width;
3921 op->charcount = font.charcount; 3924 op->charcount = font.charcount;
3922 3925
3923 if (op->data && copy_to_user(op->data, font.data, c)) 3926 if (op->data && copy_to_user(op->data, font.data, c))
3924 rc = -EFAULT; 3927 rc = -EFAULT;
3925 3928
3926 out: 3929 out:
3927 kfree(font.data); 3930 kfree(font.data);
3928 return rc; 3931 return rc;
3929 } 3932 }
3930 3933
3931 static int con_font_set(struct vc_data *vc, struct console_font_op *op) 3934 static int con_font_set(struct vc_data *vc, struct console_font_op *op)
3932 { 3935 {
3933 struct console_font font; 3936 struct console_font font;
3934 int rc = -EINVAL; 3937 int rc = -EINVAL;
3935 int size; 3938 int size;
3936 3939
3937 if (vc->vc_mode != KD_TEXT) 3940 if (vc->vc_mode != KD_TEXT)
3938 return -EINVAL; 3941 return -EINVAL;
3939 if (!op->data) 3942 if (!op->data)
3940 return -EINVAL; 3943 return -EINVAL;
3941 if (op->charcount > 512) 3944 if (op->charcount > 512)
3942 return -EINVAL; 3945 return -EINVAL;
3943 if (!op->height) { /* Need to guess font height [compat] */ 3946 if (!op->height) { /* Need to guess font height [compat] */
3944 int h, i; 3947 int h, i;
3945 u8 __user *charmap = op->data; 3948 u8 __user *charmap = op->data;
3946 u8 tmp; 3949 u8 tmp;
3947 3950
3948 /* If from KDFONTOP ioctl, don't allow things which can be done in userland, 3951 /* If from KDFONTOP ioctl, don't allow things which can be done in userland,
3949 so that we can get rid of this soon */ 3952 so that we can get rid of this soon */
3950 if (!(op->flags & KD_FONT_FLAG_OLD)) 3953 if (!(op->flags & KD_FONT_FLAG_OLD))
3951 return -EINVAL; 3954 return -EINVAL;
3952 for (h = 32; h > 0; h--) 3955 for (h = 32; h > 0; h--)
3953 for (i = 0; i < op->charcount; i++) { 3956 for (i = 0; i < op->charcount; i++) {
3954 if (get_user(tmp, &charmap[32*i+h-1])) 3957 if (get_user(tmp, &charmap[32*i+h-1]))
3955 return -EFAULT; 3958 return -EFAULT;
3956 if (tmp) 3959 if (tmp)
3957 goto nonzero; 3960 goto nonzero;
3958 } 3961 }
3959 return -EINVAL; 3962 return -EINVAL;
3960 nonzero: 3963 nonzero:
3961 op->height = h; 3964 op->height = h;
3962 } 3965 }
3963 if (op->width <= 0 || op->width > 32 || op->height > 32) 3966 if (op->width <= 0 || op->width > 32 || op->height > 32)
3964 return -EINVAL; 3967 return -EINVAL;
3965 size = (op->width+7)/8 * 32 * op->charcount; 3968 size = (op->width+7)/8 * 32 * op->charcount;
3966 if (size > max_font_size) 3969 if (size > max_font_size)
3967 return -ENOSPC; 3970 return -ENOSPC;
3968 font.charcount = op->charcount; 3971 font.charcount = op->charcount;
3969 font.height = op->height; 3972 font.height = op->height;
3970 font.width = op->width; 3973 font.width = op->width;
3971 font.data = kmalloc(size, GFP_KERNEL); 3974 font.data = kmalloc(size, GFP_KERNEL);
3972 if (!font.data) 3975 if (!font.data)
3973 return -ENOMEM; 3976 return -ENOMEM;
3974 if (copy_from_user(font.data, op->data, size)) { 3977 if (copy_from_user(font.data, op->data, size)) {
3975 kfree(font.data); 3978 kfree(font.data);
3976 return -EFAULT; 3979 return -EFAULT;
3977 } 3980 }
3978 acquire_console_sem(); 3981 acquire_console_sem();
3979 if (vc->vc_sw->con_font_set) 3982 if (vc->vc_sw->con_font_set)
3980 rc = vc->vc_sw->con_font_set(vc, &font, op->flags); 3983 rc = vc->vc_sw->con_font_set(vc, &font, op->flags);
3981 else 3984 else
3982 rc = -ENOSYS; 3985 rc = -ENOSYS;
3983 release_console_sem(); 3986 release_console_sem();
3984 kfree(font.data); 3987 kfree(font.data);
3985 return rc; 3988 return rc;
3986 } 3989 }
3987 3990
3988 static int con_font_default(struct vc_data *vc, struct console_font_op *op) 3991 static int con_font_default(struct vc_data *vc, struct console_font_op *op)
3989 { 3992 {
3990 struct console_font font = {.width = op->width, .height = op->height}; 3993 struct console_font font = {.width = op->width, .height = op->height};
3991 char name[MAX_FONT_NAME]; 3994 char name[MAX_FONT_NAME];
3992 char *s = name; 3995 char *s = name;
3993 int rc; 3996 int rc;
3994 3997
3995 if (vc->vc_mode != KD_TEXT) 3998 if (vc->vc_mode != KD_TEXT)
3996 return -EINVAL; 3999 return -EINVAL;
3997 4000
3998 if (!op->data) 4001 if (!op->data)
3999 s = NULL; 4002 s = NULL;
4000 else if (strncpy_from_user(name, op->data, MAX_FONT_NAME - 1) < 0) 4003 else if (strncpy_from_user(name, op->data, MAX_FONT_NAME - 1) < 0)
4001 return -EFAULT; 4004 return -EFAULT;
4002 else 4005 else
4003 name[MAX_FONT_NAME - 1] = 0; 4006 name[MAX_FONT_NAME - 1] = 0;
4004 4007
4005 acquire_console_sem(); 4008 acquire_console_sem();
4006 if (vc->vc_sw->con_font_default) 4009 if (vc->vc_sw->con_font_default)
4007 rc = vc->vc_sw->con_font_default(vc, &font, s); 4010 rc = vc->vc_sw->con_font_default(vc, &font, s);
4008 else 4011 else
4009 rc = -ENOSYS; 4012 rc = -ENOSYS;
4010 release_console_sem(); 4013 release_console_sem();
4011 if (!rc) { 4014 if (!rc) {
4012 op->width = font.width; 4015 op->width = font.width;
4013 op->height = font.height; 4016 op->height = font.height;
4014 } 4017 }
4015 return rc; 4018 return rc;
4016 } 4019 }
4017 4020
4018 static int con_font_copy(struct vc_data *vc, struct console_font_op *op) 4021 static int con_font_copy(struct vc_data *vc, struct console_font_op *op)
4019 { 4022 {
4020 int con = op->height; 4023 int con = op->height;
4021 int rc; 4024 int rc;
4022 4025
4023 if (vc->vc_mode != KD_TEXT) 4026 if (vc->vc_mode != KD_TEXT)
4024 return -EINVAL; 4027 return -EINVAL;
4025 4028
4026 acquire_console_sem(); 4029 acquire_console_sem();
4027 if (!vc->vc_sw->con_font_copy) 4030 if (!vc->vc_sw->con_font_copy)
4028 rc = -ENOSYS; 4031 rc = -ENOSYS;
4029 else if (con < 0 || !vc_cons_allocated(con)) 4032 else if (con < 0 || !vc_cons_allocated(con))
4030 rc = -ENOTTY; 4033 rc = -ENOTTY;
4031 else if (con == vc->vc_num) /* nothing to do */ 4034 else if (con == vc->vc_num) /* nothing to do */
4032 rc = 0; 4035 rc = 0;
4033 else 4036 else
4034 rc = vc->vc_sw->con_font_copy(vc, con); 4037 rc = vc->vc_sw->con_font_copy(vc, con);
4035 release_console_sem(); 4038 release_console_sem();
4036 return rc; 4039 return rc;
4037 } 4040 }
4038 4041
4039 int con_font_op(struct vc_data *vc, struct console_font_op *op) 4042 int con_font_op(struct vc_data *vc, struct console_font_op *op)
4040 { 4043 {
4041 switch (op->op) { 4044 switch (op->op) {
4042 case KD_FONT_OP_SET: 4045 case KD_FONT_OP_SET:
4043 return con_font_set(vc, op); 4046 return con_font_set(vc, op);
4044 case KD_FONT_OP_GET: 4047 case KD_FONT_OP_GET:
4045 return con_font_get(vc, op); 4048 return con_font_get(vc, op);
4046 case KD_FONT_OP_SET_DEFAULT: 4049 case KD_FONT_OP_SET_DEFAULT:
4047 return con_font_default(vc, op); 4050 return con_font_default(vc, op);
4048 case KD_FONT_OP_COPY: 4051 case KD_FONT_OP_COPY:
4049 return con_font_copy(vc, op); 4052 return con_font_copy(vc, op);
4050 } 4053 }
4051 return -ENOSYS; 4054 return -ENOSYS;
4052 } 4055 }
4053 4056
4054 /* 4057 /*
4055 * Interface exported to selection and vcs. 4058 * Interface exported to selection and vcs.
4056 */ 4059 */
4057 4060
4058 /* used by selection */ 4061 /* used by selection */
4059 u16 screen_glyph(struct vc_data *vc, int offset) 4062 u16 screen_glyph(struct vc_data *vc, int offset)
4060 { 4063 {
4061 u16 w = scr_readw(screenpos(vc, offset, 1)); 4064 u16 w = scr_readw(screenpos(vc, offset, 1));
4062 u16 c = w & 0xff; 4065 u16 c = w & 0xff;
4063 4066
4064 if (w & vc->vc_hi_font_mask) 4067 if (w & vc->vc_hi_font_mask)
4065 c |= 0x100; 4068 c |= 0x100;
4066 return c; 4069 return c;
4067 } 4070 }
4068 EXPORT_SYMBOL_GPL(screen_glyph); 4071 EXPORT_SYMBOL_GPL(screen_glyph);
4069 4072
4070 /* used by vcs - note the word offset */ 4073 /* used by vcs - note the word offset */
4071 unsigned short *screen_pos(struct vc_data *vc, int w_offset, int viewed) 4074 unsigned short *screen_pos(struct vc_data *vc, int w_offset, int viewed)
4072 { 4075 {
4073 return screenpos(vc, 2 * w_offset, viewed); 4076 return screenpos(vc, 2 * w_offset, viewed);
4074 } 4077 }
4075 4078
4076 void getconsxy(struct vc_data *vc, unsigned char *p) 4079 void getconsxy(struct vc_data *vc, unsigned char *p)
4077 { 4080 {
4078 p[0] = vc->vc_x; 4081 p[0] = vc->vc_x;
4079 p[1] = vc->vc_y; 4082 p[1] = vc->vc_y;
4080 } 4083 }
4081 4084
4082 void putconsxy(struct vc_data *vc, unsigned char *p) 4085 void putconsxy(struct vc_data *vc, unsigned char *p)
4083 { 4086 {
4084 hide_cursor(vc); 4087 hide_cursor(vc);
4085 gotoxy(vc, p[0], p[1]); 4088 gotoxy(vc, p[0], p[1]);
4086 set_cursor(vc); 4089 set_cursor(vc);
4087 } 4090 }
4088 4091
4089 u16 vcs_scr_readw(struct vc_data *vc, const u16 *org) 4092 u16 vcs_scr_readw(struct vc_data *vc, const u16 *org)
4090 { 4093 {
4091 if ((unsigned long)org == vc->vc_pos && softcursor_original != -1) 4094 if ((unsigned long)org == vc->vc_pos && softcursor_original != -1)
4092 return softcursor_original; 4095 return softcursor_original;
4093 return scr_readw(org); 4096 return scr_readw(org);
4094 } 4097 }
4095 4098
4096 void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org) 4099 void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org)
4097 { 4100 {
4098 scr_writew(val, org); 4101 scr_writew(val, org);
4099 if ((unsigned long)org == vc->vc_pos) { 4102 if ((unsigned long)org == vc->vc_pos) {
4100 softcursor_original = -1; 4103 softcursor_original = -1;
4101 add_softcursor(vc); 4104 add_softcursor(vc);
4102 } 4105 }
4103 } 4106 }
4104 4107
4105 /* 4108 /*
4106 * Visible symbols for modules 4109 * Visible symbols for modules
4107 */ 4110 */
4108 4111
4109 EXPORT_SYMBOL(color_table); 4112 EXPORT_SYMBOL(color_table);
4110 EXPORT_SYMBOL(default_red); 4113 EXPORT_SYMBOL(default_red);
4111 EXPORT_SYMBOL(default_grn); 4114 EXPORT_SYMBOL(default_grn);
4112 EXPORT_SYMBOL(default_blu); 4115 EXPORT_SYMBOL(default_blu);
4113 EXPORT_SYMBOL(update_region); 4116 EXPORT_SYMBOL(update_region);
4114 EXPORT_SYMBOL(redraw_screen); 4117 EXPORT_SYMBOL(redraw_screen);
4115 EXPORT_SYMBOL(vc_resize); 4118 EXPORT_SYMBOL(vc_resize);
4116 EXPORT_SYMBOL(fg_console); 4119 EXPORT_SYMBOL(fg_console);
4117 EXPORT_SYMBOL(console_blank_hook); 4120 EXPORT_SYMBOL(console_blank_hook);
4118 EXPORT_SYMBOL(console_blanked); 4121 EXPORT_SYMBOL(console_blanked);
4119 EXPORT_SYMBOL(vc_cons); 4122 EXPORT_SYMBOL(vc_cons);
4120 EXPORT_SYMBOL(global_cursor_default); 4123 EXPORT_SYMBOL(global_cursor_default);
4121 #ifndef VT_SINGLE_DRIVER 4124 #ifndef VT_SINGLE_DRIVER
4122 EXPORT_SYMBOL(take_over_console); 4125 EXPORT_SYMBOL(take_over_console);
4123 EXPORT_SYMBOL(give_up_console); 4126 EXPORT_SYMBOL(give_up_console);
4124 #endif 4127 #endif
4125 4128