← Documents Documentation/admin-guide/parport.rst GitHub 원문 ↗

Linux 6.18.37 · Administration

Parport

Linux parallel-port sharing, module·boot parameter, /proc interface와 printer 문제 진단 절차를 설명합니다.

Source pathDocumentation/admin-guide/parport.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

운영 핵심

parport.rst:1-286

Generic sharing layer와 hardware driver를 구분하고, 가장 단순한 polling 경로부터 IRQ·PIO·DMA 순서로 검증하면 설정과 hardware mode 문제를 분리할 수 있습니다.

관점핵심
구성Generic `parport`가 port sharing을, architecture-dependent driver가 hardware access를 담당
Module`parport` 뒤 `parport_pc`를 load하고 `io`, `irq` option으로 port를 지정
Built-inKernel command line의 `parport=...`; `parport=0`은 전체 비활성화
상태 확인`/proc/sys/dev/parport`에서 address, IRQ, DMA, mode, device ID와 점유 driver 확인
Device mapping`lp`의 `parport=` 또는 boot의 `lp=parportN`으로 `/dev/lpN` 연결을 지정
진단Polling부터 interrupt·PIO·DMA 순으로 경로를 늘려 고장 mode를 분리

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 Parport
2 +++++++
3
4 The ``parport`` code provides parallel-port support under Linux. This
5 includes the ability to share one port between multiple device
6 drivers.
7
8 You can pass parameters to the ``parport`` code to override its automatic
9 detection of your hardware. This is particularly useful if you want
10 to use IRQs, since in general these can't be autoprobed successfully.
11 By default IRQs are not used even if they **can** be probed. This is
12 because there are a lot of people using the same IRQ for their
13 parallel port and a sound card or network card.
14
15 The ``parport`` code is split into two parts: generic (which deals with
16 port-sharing) and architecture-dependent (which deals with actually
17 using the port).
18
19
20 Parport as modules
21 ==================
22
23 If you load the `parport`` code as a module, say::
24
25 # insmod parport
26
27 to load the generic ``parport`` code. You then must load the
28 architecture-dependent code with (for example)::
29
30 # insmod parport_pc io=0x3bc,0x378,0x278 irq=none,7,auto
31
32 to tell the ``parport`` code that you want three PC-style ports, one at
33 0x3bc with no IRQ, one at 0x378 using IRQ 7, and one at 0x278 with an
34 auto-detected IRQ. Currently, PC-style (``parport_pc``), Sun ``bpp``,
35 Amiga, Atari, and MFC3 hardware is supported.
36
37 PCI parallel I/O card support comes from ``parport_pc``. Base I/O
38 addresses should not be specified for supported PCI cards since they
39 are automatically detected.
40
41
42 modprobe
43 --------
44
45 If you use modprobe , you will find it useful to add lines as below to a
46 configuration file in /etc/modprobe.d/ directory::
47
48 alias parport_lowlevel parport_pc
49 options parport_pc io=0x378,0x278 irq=7,auto
50
51 modprobe will load ``parport_pc`` (with the options ``io=0x378,0x278 irq=7,auto``)
52 whenever a parallel port device driver (such as ``lp``) is loaded.
53
54 Note that these are example lines only! You shouldn't in general need
55 to specify any options to ``parport_pc`` in order to be able to use a
56 parallel port.
57
58
59 Parport probe [optional]
60 ------------------------
61
62 In 2.2 kernels there was a module called ``parport_probe``, which was used
63 for collecting IEEE 1284 device ID information. This has now been
64 enhanced and now lives with the IEEE 1284 support. When a parallel
65 port is detected, the devices that are connected to it are analysed,
66 and information is logged like this::
67
68 parport0: Printer, BJC-210 (Canon)
69
70 The probe information is available from files in ``/proc/sys/dev/parport/``.
71
72
73 Parport linked into the kernel statically
74 =========================================
75
76 If you compile the ``parport`` code into the kernel, then you can use
77 kernel boot parameters to get the same effect. Add something like the
78 following to your LILO command line::
79
80 parport=0x3bc parport=0x378,7 parport=0x278,auto,nofifo
81
82 You can have many ``parport=...`` statements, one for each port you want
83 to add. Adding ``parport=0`` to the kernel command-line will disable
84 parport support entirely. Adding ``parport=auto`` to the kernel
85 command-line will make ``parport`` use any IRQ lines or DMA channels that
86 it auto-detects.
87
88
89 Files in /proc
90 ==============
91
92 If you have configured the ``/proc`` filesystem into your kernel, you will
93 see a new directory entry: ``/proc/sys/dev/parport``. In there will be a
94 directory entry for each parallel port for which parport is
95 configured. In each of those directories are a collection of files
96 describing that parallel port.
97
98 The ``/proc/sys/dev/parport`` directory tree looks like::
99
100 parport
101 |-- default
102 | |-- spintime
103 | `-- timeslice
104 |-- parport0
105 | |-- autoprobe
106 | |-- autoprobe0
107 | |-- autoprobe1
108 | |-- autoprobe2
109 | |-- autoprobe3
110 | |-- devices
111 | | |-- active
112 | | `-- lp
113 | | `-- timeslice
114 | |-- base-addr
115 | |-- irq
116 | |-- dma
117 | |-- modes
118 | `-- spintime
119 `-- parport1
120 |-- autoprobe
121 |-- autoprobe0
122 |-- autoprobe1
123 |-- autoprobe2
124 |-- autoprobe3
125 |-- devices
126 | |-- active
127 | `-- ppa
128 | `-- timeslice
129 |-- base-addr
130 |-- irq
131 |-- dma
132 |-- modes
133 `-- spintime
134
135 .. tabularcolumns:: |p{4.0cm}|p{13.5cm}|
136
137 ======================= =======================================================
138 File Contents
139 ======================= =======================================================
140 ``devices/active`` A list of the device drivers using that port. A "+"
141 will appear by the name of the device currently using
142 the port (it might not appear against any). The
143 string "none" means that there are no device drivers
144 using that port.
145
146 ``base-addr`` Parallel port's base address, or addresses if the port
147 has more than one in which case they are separated
148 with tabs. These values might not have any sensible
149 meaning for some ports.
150
151 ``irq`` Parallel port's IRQ, or -1 if none is being used.
152
153 ``dma`` Parallel port's DMA channel, or -1 if none is being
154 used.
155
156 ``modes`` Parallel port's hardware modes, comma-separated,
157 meaning:
158
159 - PCSPP
160 PC-style SPP registers are available.
161
162 - TRISTATE
163 Port is bidirectional.
164
165 - COMPAT
166 Hardware acceleration for printers is
167 available and will be used.
168
169 - EPP
170 Hardware acceleration for EPP protocol
171 is available and will be used.
172
173 - ECP
174 Hardware acceleration for ECP protocol
175 is available and will be used.
176
177 - DMA
178 DMA is available and will be used.
179
180 Note that the current implementation will only take
181 advantage of COMPAT and ECP modes if it has an IRQ
182 line to use.
183
184 ``autoprobe`` Any IEEE-1284 device ID information that has been
185 acquired from the (non-IEEE 1284.3) device.
186
187 ``autoprobe[0-3]`` IEEE 1284 device ID information retrieved from
188 daisy-chain devices that conform to IEEE 1284.3.
189
190 ``spintime`` The number of microseconds to busy-loop while waiting
191 for the peripheral to respond. You might find that
192 adjusting this improves performance, depending on your
193 peripherals. This is a port-wide setting, i.e. it
194 applies to all devices on a particular port.
195
196 ``timeslice`` The number of milliseconds that a device driver is
197 allowed to keep a port claimed for. This is advisory,
198 and driver can ignore it if it must.
199
200 ``default/*`` The defaults for spintime and timeslice. When a new
201 port is registered, it picks up the default spintime.
202 When a new device is registered, it picks up the
203 default timeslice.
204 ======================= =======================================================
205
206 Device drivers
207 ==============
208
209 Once the parport code is initialised, you can attach device drivers to
210 specific ports. Normally this happens automatically; if the lp driver
211 is loaded it will create one lp device for each port found. You can
212 override this, though, by using parameters either when you load the lp
213 driver::
214
215 # insmod lp parport=0,2
216
217 or on the LILO command line::
218
219 lp=parport0 lp=parport2
220
221 Both the above examples would inform lp that you want ``/dev/lp0`` to be
222 the first parallel port, and /dev/lp1 to be the **third** parallel port,
223 with no lp device associated with the second port (parport1). Note
224 that this is different to the way older kernels worked; there used to
225 be a static association between the I/O port address and the device
226 name, so ``/dev/lp0`` was always the port at 0x3bc. This is no longer the
227 case - if you only have one port, it will default to being ``/dev/lp0``,
228 regardless of base address.
229
230 Also:
231
232 * If you selected the IEEE 1284 support at compile time, you can say
233 ``lp=auto`` on the kernel command line, and lp will create devices
234 only for those ports that seem to have printers attached.
235
236 * If you give PLIP the ``timid`` parameter, either with ``plip=timid`` on
237 the command line, or with ``insmod plip timid=1`` when using modules,
238 it will avoid any ports that seem to be in use by other devices.
239
240 * IRQ autoprobing works only for a few port types at the moment.
241
242 Reporting printer problems with parport
243 =======================================
244
245 If you are having problems printing, please go through these steps to
246 try to narrow down where the problem area is.
247
248 When reporting problems with parport, really you need to give all of
249 the messages that ``parport_pc`` spits out when it initialises. There are
250 several code paths:
251
252 - polling
253 - interrupt-driven, protocol in software
254 - interrupt-driven, protocol in hardware using PIO
255 - interrupt-driven, protocol in hardware using DMA
256
257 The kernel messages that ``parport_pc`` logs give an indication of which
258 code path is being used. (They could be a lot better actually..)
259
260 For normal printer protocol, having IEEE 1284 modes enabled or not
261 should not make a difference.
262
263 To turn off the 'protocol in hardware' code paths, disable
264 ``CONFIG_PARPORT_PC_FIFO``. Note that when they are enabled they are not
265 necessarily **used**; it depends on whether the hardware is available,
266 enabled by the BIOS, and detected by the driver.
267
268 So, to start with, disable ``CONFIG_PARPORT_PC_FIFO``, and load ``parport_pc``
269 with ``irq=none``. See if printing works then. It really should,
270 because this is the simplest code path.
271
272 If that works fine, try with ``io=0x378 irq=7`` (adjust for your
273 hardware), to make it use interrupt-driven in-software protocol.
274
275 If **that** works fine, then one of the hardware modes isn't working
276 right. Enable ``CONFIG_FIFO`` (no, it isn't a module option,
277 and yes, it should be), set the port to ECP mode in the BIOS and note
278 the DMA channel, and try with::
279
280 io=0x378 irq=7 dma=none (for PIO)
281 io=0x378 irq=7 dma=3 (for DMA)
282
283 ----------
284
287

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Parport 구조와 IRQ 기본 정책

1-18

`parport` code는 Linux의 parallel-port 지원을 제공하며, 하나의 port를 여러 device driver가 공유할 수 있게 합니다.

Hardware 자동 검출 결과를 덮어쓰도록 `parport` parameter를 전달할 수 있습니다. 특히 IRQ는 일반적으로 autoprobed 결과를 안정적으로 얻기 어려워 이 기능이 유용합니다.

IRQ를 probe할 수 있더라도 기본값은 IRQ를 사용하지 않는 것입니다. Parallel port와 sound card 또는 network card가 같은 IRQ를 공유하는 system이 많기 때문입니다.

`parport` code는 port-sharing을 처리하는 generic 부분과 실제 port 사용을 처리하는 architecture-dependent 부분으로 나뉩니다.

Module로 parport 구성

19-40

먼저 generic `parport` code를 module로 load합니다.

# insmod parport

그 뒤 architecture-dependent code를 load해야 합니다. 다음 예시는 PC-style port 세 개를 요청합니다.

# insmod parport_pc io=0x3bc,0x378,0x278 irq=none,7,auto

이 command는 `0x3bc` port에는 IRQ를 쓰지 않고, `0x378` port에는 IRQ 7을 사용하며, `0x278` port의 IRQ는 자동 검출하도록 지정합니다.

현재 PC-style `parport_pc`, Sun `bpp`, Amiga, Atari, MFC3 hardware를 지원합니다.

PCI parallel I/O card 지원은 `parport_pc`가 제공합니다. 지원되는 PCI card는 자동 검출되므로 base I/O address를 지정하지 않아야 합니다.

modprobe 설정과 IEEE 1284 probe

41-71

`modprobe`를 사용한다면 `/etc/modprobe.d/` directory의 configuration file에 다음과 같은 줄을 둘 수 있습니다.

alias parport_lowlevel parport_pc
options parport_pc io=0x378,0x278 irq=7,auto

그러면 `lp` 같은 parallel port device driver를 load할 때마다 `modprobe`가 `io=0x378,0x278 irq=7,auto` option과 함께 `parport_pc`를 load합니다.

위 줄은 예시일 뿐입니다. 일반적으로 parallel port를 사용하기 위해 `parport_pc` option을 지정할 필요는 없습니다.

2.2 kernel의 `parport_probe` module은 IEEE 1284 device ID 정보를 수집했습니다. 이 기능은 향상되어 현재 IEEE 1284 support에 포함됩니다.

Parallel port를 검출하면 연결된 device를 분석해 다음과 같은 정보를 log에 남깁니다.

parport0: Printer, BJC-210 (Canon)

Probe 정보는 `/proc/sys/dev/parport/` 아래 file에서 확인할 수 있습니다.

Kernel built-in의 boot parameter

72-87

`parport` code를 kernel에 정적으로 compile했다면 kernel boot parameter로 module option과 같은 효과를 낼 수 있습니다. LILO command line 예시는 다음과 같습니다.

parport=0x3bc parport=0x378,7 parport=0x278,auto,nofifo

추가하려는 port마다 `parport=...` statement를 하나씩 여러 개 둘 수 있습니다. `parport=0`은 parport support 전체를 비활성화합니다.

`parport=auto`는 자동 검출한 IRQ line 또는 DMA channel을 `parport`가 사용하게 합니다.

/proc interface와 file 의미

88-204

Kernel에 `/proc` filesystem을 구성했다면 `/proc/sys/dev/parport` directory가 생깁니다. Parport가 구성된 parallel port마다 하위 directory가 있고 그 안의 file들이 해당 port를 설명합니다.

/proc/sys/dev/parport 구조
`/proc/sys/dev/parport``default``spintime`, `timeslice`
`/proc/sys/dev/parport``parport0``autoprobe`, `autoprobe0` ... `autoprobe3`
`/proc/sys/dev/parport``parport0``base-addr`, `irq`, `dma`, `modes`, `spintime`
`/proc/sys/dev/parport``parport0/devices``active`, `lp/timeslice`
`/proc/sys/dev/parport``parport1``autoprobe`, `autoprobe0` ... `autoprobe3`
`/proc/sys/dev/parport``parport1``base-addr`, `irq`, `dma`, `modes`, `spintime`
`/proc/sys/dev/parport``parport1/devices``active`, `ppa/timeslice`

원문의 ASCII directory tree를 port별 설정, probe 정보와 driver별 timeslice 경로로 구조화했습니다.

File내용
`devices/active`이 port를 사용하는 device driver 목록입니다. 현재 port를 점유한 driver 이름에는 `+`가 붙으며 아무 driver도 없으면 `none`입니다.
`base-addr`Parallel port의 base address입니다. 주소가 여러 개면 tab으로 구분하며 일부 port에서는 의미 있는 값이 아닐 수 있습니다.
`irq`사용 중인 IRQ이며 IRQ를 사용하지 않으면 `-1`입니다.
`dma`사용 중인 DMA channel이며 DMA를 사용하지 않으면 `-1`입니다.
`modes`Comma-separated hardware mode 목록입니다: PCSPP, TRISTATE, COMPAT, EPP, ECP, DMA.
`autoprobe`IEEE 1284.3 장치가 아닌 peripheral에서 얻은 IEEE-1284 device ID 정보입니다.
`autoprobe[0-3]`IEEE 1284.3을 따르는 daisy-chain device에서 얻은 IEEE 1284 device ID 정보입니다.
`spintime`Peripheral 응답을 기다리며 busy-loop할 microsecond 수입니다. Port 전체의 모든 device에 적용됩니다.
`timeslice`Device driver가 port 점유를 유지하도록 허용하는 millisecond 수입니다. 권고값이므로 필요하면 driver가 무시할 수 있습니다.
`default/*`새 port는 기본 spintime을, 새 device는 기본 timeslice를 등록 시점에 가져옵니다.

`modes`에 나타나는 hardware mode의 의미는 다음과 같습니다.

Mode의미
`PCSPP`PC-style SPP register를 사용할 수 있습니다.
`TRISTATE`Port가 bidirectional입니다.
`COMPAT`Printer용 hardware acceleration을 사용할 수 있고 실제로 사용합니다.
`EPP`EPP protocol용 hardware acceleration을 사용할 수 있고 실제로 사용합니다.
`ECP`ECP protocol용 hardware acceleration을 사용할 수 있고 실제로 사용합니다.
`DMA`DMA를 사용할 수 있고 실제로 사용합니다.

현재 구현은 사용할 IRQ line이 있을 때만 `COMPAT`와 `ECP` mode를 활용합니다.

Device driver와 port 연결

205-241

Parport code가 초기화되면 device driver를 특정 port에 연결할 수 있습니다. 보통은 자동으로 이뤄지며, `lp` driver를 load하면 발견한 port마다 `lp` device 하나를 만듭니다.

Module load parameter로 기본 연결을 덮어쓸 수 있습니다.

# insmod lp parport=0,2

LILO command line에서도 같은 연결을 지정할 수 있습니다.

lp=parport0 lp=parport2

두 예시는 모두 첫 parallel port를 `/dev/lp0`으로, 세 번째 parallel port를 `/dev/lp1`으로 만들고 두 번째 port인 `parport1`에는 lp device를 연결하지 않습니다.

이는 예전 kernel과 다릅니다. 과거에는 I/O port address와 device name이 정적으로 연결되어 `/dev/lp0`이 항상 `0x3bc` port였지만, 이제는 그렇지 않습니다. Port가 하나뿐이면 base address와 무관하게 기본적으로 `/dev/lp0`이 됩니다.

Compile 시 IEEE 1284 support를 선택했다면 kernel command line에 `lp=auto`를 지정할 수 있습니다. 그러면 `lp`는 printer가 연결된 것으로 보이는 port에만 device를 만듭니다.

PLIP에 command line의 `plip=timid` 또는 module load의 `insmod plip timid=1`로 `timid` parameter를 주면 다른 device가 사용 중인 것으로 보이는 port를 피합니다.

현재 IRQ autoprobing은 일부 port type에서만 동작합니다.

Printer 문제 보고와 code path 분리

242-282

Printing 문제가 있다면 아래 단계로 문제 영역을 좁힙니다. Parport 문제를 보고할 때는 `parport_pc`가 초기화 중 출력한 message를 모두 제공해야 합니다.

가능한 code path는 polling, software protocol을 쓰는 interrupt-driven 경로, PIO로 hardware protocol을 쓰는 interrupt-driven 경로, DMA로 hardware protocol을 쓰는 interrupt-driven 경로입니다.

`parport_pc` kernel message는 사용 중인 code path를 알려 줍니다. 일반 printer protocol에서는 IEEE 1284 mode 활성화 여부가 차이를 만들지 않아야 합니다.

`protocol in hardware` code path를 끄려면 `CONFIG_PARPORT_PC_FIFO`를 비활성화합니다. 이 option을 켰다고 항상 hardware path를 사용하는 것은 아니며 hardware 가용성, BIOS 활성화와 driver 검출 결과에 따라 달라집니다.

먼저 `CONFIG_PARPORT_PC_FIFO`를 끄고 `irq=none`으로 `parport_pc`를 load해 printing을 시험합니다. 가장 단순한 code path이므로 정상 동작해야 합니다.

정상이라면 hardware에 맞춰 `io=0x378 irq=7`로 바꾸어 software protocol을 쓰는 interrupt-driven 경로를 시험합니다.

이 경로도 정상이라면 hardware mode 중 하나가 잘못된 것입니다. `CONFIG_FIFO`를 활성화하고 port를 BIOS에서 ECP mode로 설정한 뒤 DMA channel을 확인하여 다음 PIO와 DMA 경로를 각각 시험합니다.

io=0x378 irq=7 dma=none (for PIO)
io=0x378 irq=7 dma=3 (for DMA)

원문 연락처

283-286

원문 끝에는 `[email protected]`와 `[email protected]` 연락처가 기재되어 있습니다.