← Documents Documentation/pcmcia/driver.rst GitHub 원문 ↗

Linux 6.18.37 · PCMCIA

PCMCIA driver

Sysfs new_id에 runtime PCMCIA match tuple을 추가하고 미소유 device의 probe를 다시 실행하는 방법을 설명합니다.

Source pathDocumentation/pcmcia/driver.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

driver.rst:1-30

`new_id`에 hexadecimal match field를 기록하면 driver ID table이 runtime에 갱신되고 core가 아직 claim되지 않은 PCMCIA device에 probe를 호출합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 =============
2 PCMCIA Driver
3 =============
4
5 sysfs
6 -----
7
8 New PCMCIA IDs may be added to a device driver pcmcia_device_id table at
9 runtime as shown below::
10
11 echo "match_flags manf_id card_id func_id function device_no \
12 prod_id_hash[0] prod_id_hash[1] prod_id_hash[2] prod_id_hash[3]" > \
13 /sys/bus/pcmcia/drivers/{driver}/new_id
14
15 All fields are passed in as hexadecimal values (no leading 0x).
16 The meaning is described in the PCMCIA specification, the match_flags is
17 a bitwise or-ed combination from PCMCIA_DEV_ID_MATCH_* constants
18 defined in include/linux/mod_devicetable.h.
19
20 Once added, the driver probe routine will be invoked for any unclaimed
21 PCMCIA device listed in its (newly updated) pcmcia_device_id list.
22
23 A common use-case is to add a new device according to the manufacturer ID
24 and the card ID (form the manf_id and card_id file in the device tree).
25 For this, just use::
26
27 echo "0x3 manf_id card_id 0 0 0 0 0 0 0" > \
28 /sys/bus/pcmcia/drivers/{driver}/new_id
29
30 after loading the driver.
31

3. 한국어 전문 번역

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

Sysfs new_id 형식

1-18

Runtime에 PCMCIA device driver의 `pcmcia_device_id` table에 새 ID를 추가할 수 있습니다.

echo "match_flags manf_id card_id func_id function device_no \
prod_id_hash[0] prod_id_hash[1] prod_id_hash[2] prod_id_hash[3]" > \
/sys/bus/pcmcia/drivers/{driver}/new_id

모든 field는 앞에 `0x`를 붙이지 않은 hexadecimal 값으로 전달합니다. 의미는 PCMCIA specification에 정의되어 있습니다.

`match_flags`는 `include/linux/mod_devicetable.h`에 정의된 `PCMCIA_DEV_ID_MATCH_*` constant들을 bitwise OR한 값입니다.

new_id field
Field의미
match_flagsPCMCIA_DEV_ID_MATCH_* bit mask
manf_id / card_idManufacturer와 card ID
func_id / function / device_noFunction match
prod_id_hash[0..3]Product ID string hash

Runtime ID match에 전달하는 순서입니다.

=============
PCMCIA Driver
=============

sysfs
-----

New PCMCIA IDs may be added to a device driver pcmcia_device_id table at
runtime as shown below::

  echo "match_flags manf_id card_id func_id function device_no \
  prod_id_hash[0] prod_id_hash[1] prod_id_hash[2] prod_id_hash[3]" > \
  /sys/bus/pcmcia/drivers/{driver}/new_id

All fields are passed in as hexadecimal values (no leading 0x).
The meaning is described in the PCMCIA specification, the match_flags is
a bitwise or-ed combination from PCMCIA_DEV_ID_MATCH_* constants
defined in include/linux/mod_devicetable.h.

Runtime ID 추가와 probe

19-30

ID를 추가하면 새로 갱신된 `pcmcia_device_id` list와 match하면서 아직 claim되지 않은 모든 PCMCIA device에 driver의 probe routine이 호출됩니다.

일반적인 용도는 device tree의 `manf_id`와 `card_id` file 값을 사용해 manufacturer ID와 card ID로 새 device를 추가하는 것입니다. Driver를 load한 뒤 아래처럼 기록합니다.

echo "0x3 manf_id card_id 0 0 0 0 0 0 0" > \
  /sys/bus/pcmcia/drivers/{driver}/new_id

이 예제의 첫 값 `0x3`은 manufacturer ID와 card ID match flag 조합입니다. 원문의 일반 형식은 hexadecimal 값에 leading `0x`를 쓰지 말라고 하지만 이 구체적 예제는 `0x3`을 그대로 제시하므로 원문 표기를 보존합니다.

Runtime device binding
Driver loadnew_id에 match tuple 기록pcmcia_device_id list 갱신Unclaimed device matchprobe() 호출

새 ID를 table에 넣으면 core가 미소유 device를 다시 match합니다.


Once added, the driver probe routine will be invoked for any unclaimed
PCMCIA device listed in its (newly updated) pcmcia_device_id list.

A common use-case is to add a new device according to the manufacturer ID
and the card ID (form the manf_id and card_id file in the device tree).
For this, just use::

  echo "0x3 manf_id card_id 0 0 0 0 0 0 0" > \
    /sys/bus/pcmcia/drivers/{driver}/new_id

after loading the driver.