요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
==============
Driver changes
==============
This file details changes in 2.6 which affect PCMCIA card driver authors:
* pcmcia_loop_config() and autoconfiguration (as of 2.6.36)
If `struct pcmcia_device *p_dev->config_flags` is set accordingly,
pcmcia_loop_config() now sets up certain configuration values
automatically, though the driver may still override the settings
in the callback function. The following autoconfiguration options
are provided at the moment:
- CONF_AUTO_CHECK_VCC : check for matching Vcc
- CONF_AUTO_SET_VPP : set Vpp
- CONF_AUTO_AUDIO : auto-enable audio line, if required
- CONF_AUTO_SET_IO : set ioport resources (->resource[0,1])
- CONF_AUTO_SET_IOMEM : set first iomem resource (->resource[2])
* pcmcia_request_configuration -> pcmcia_enable_device (as of 2.6.36)
pcmcia_request_configuration() got renamed to pcmcia_enable_device(),
as it mirrors pcmcia_disable_device(). Configuration settings are now
stored in struct pcmcia_device, e.g. in the fields config_flags,
config_index, config_base, vpp.
* pcmcia_request_window changes (as of 2.6.36)
Instead of win_req_t, drivers are now requested to fill out
`struct pcmcia_device *p_dev->resource[2,3,4,5]` for up to four ioport
ranges. After a call to pcmcia_request_window(), the regions found there
are reserved and may be used immediately -- until pcmcia_release_window()
is called.
* pcmcia_request_io changes (as of 2.6.36)
Instead of io_req_t, drivers are now requested to fill out
`struct pcmcia_device *p_dev->resource[0,1]` for up to two ioport
ranges. After a call to pcmcia_request_io(), the ports found there
are reserved, after calling pcmcia_request_configuration(), they may
be used.
* No dev_info_t, no cs_types.h (as of 2.6.36)
dev_info_t and a few other typedefs are removed. No longer use them
in PCMCIA device drivers. Also, do not include pcmcia/cs_types.h, as
this file is gone.
* No dev_node_t (as of 2.6.35)
There is no more need to fill out a "dev_node_t" structure.
* New IRQ request rules (as of 2.6.35)
Instead of the old pcmcia_request_irq() interface, drivers may now
choose between:
- calling request_irq/free_irq directly. Use the IRQ from `*p_dev->irq`.
- use pcmcia_request_irq(p_dev, handler_t); the PCMCIA core will
clean up automatically on calls to pcmcia_disable_device() or
device ejection.
* no cs_error / CS_CHECK / CONFIG_PCMCIA_DEBUG (as of 2.6.33)
Instead of the cs_error() callback or the CS_CHECK() macro, please use
Linux-style checking of return values, and -- if necessary -- debug
messages using "dev_dbg()" or "pr_debug()".
* New CIS tuple access (as of 2.6.33)
Instead of pcmcia_get_{first,next}_tuple(), pcmcia_get_tuple_data() and
pcmcia_parse_tuple(), a driver shall use "pcmcia_get_tuple()" if it is
only interested in one (raw) tuple, or "pcmcia_loop_tuple()" if it is
interested in all tuples of one type. To decode the MAC from CISTPL_FUNCE,
a new helper "pcmcia_get_mac_from_cis()" was added.
* New configuration loop helper (as of 2.6.28)
By calling pcmcia_loop_config(), a driver can iterate over all available
configuration options. During a driver's probe() phase, one doesn't need
to use pcmcia_get_{first,next}_tuple, pcmcia_get_tuple_data and
pcmcia_parse_tuple directly in most if not all cases.
* New release helper (as of 2.6.17)
Instead of calling pcmcia_release_{configuration,io,irq,win}, all that's
necessary now is calling pcmcia_disable_device. As there is no valid
reason left to call pcmcia_release_io and pcmcia_release_irq, the
exports for them were removed.
* Unify detach and REMOVAL event code, as well as attach and INSERTION
code (as of 2.6.16)::
void (*remove) (struct pcmcia_device *dev);
int (*probe) (struct pcmcia_device *dev);
* Move suspend, resume and reset out of event handler (as of 2.6.16)::
int (*suspend) (struct pcmcia_device *dev);
int (*resume) (struct pcmcia_device *dev);
should be initialized in struct pcmcia_driver, and handle
(SUSPEND == RESET_PHYSICAL) and (RESUME == CARD_RESET) events
* event handler initialization in struct pcmcia_driver (as of 2.6.13)
The event handler is notified of all events, and must be initialized
as the event() callback in the driver's struct pcmcia_driver.
* pcmcia/version.h should not be used (as of 2.6.13)
This file will be removed eventually.
* in-kernel device<->driver matching (as of 2.6.13)
PCMCIA devices and their correct drivers can now be matched in
kernelspace. See 'devicetable.txt' for details.
* Device model integration (as of 2.6.11)
A struct pcmcia_device is registered with the device model core,
and can be used (e.g. for SET_NETDEV_DEV) by using
handle_to_dev(client_handle_t * handle).
* Convert internal I/O port addresses to unsigned int (as of 2.6.11)
ioaddr_t should be replaced by unsigned int in PCMCIA card drivers.
* irq_mask and irq_list parameters (as of 2.6.11)
The irq_mask and irq_list parameters should no longer be used in
PCMCIA card drivers. Instead, it is the job of the PCMCIA core to
determine which IRQ should be used. Therefore, link->irq.IRQInfo2
is ignored.
* client->PendingEvents is gone (as of 2.6.11)
client->PendingEvents is no longer available.
* client->Attributes are gone (as of 2.6.11)
client->Attributes is unused, therefore it is removed from all
PCMCIA card drivers
* core functions no longer available (as of 2.6.11)
The following functions have been removed from the kernel source
because they are unused by all in-kernel drivers, and no external
driver was reported to rely on them::
pcmcia_get_first_region()
pcmcia_get_next_region()
pcmcia_modify_window()
pcmcia_set_event_mask()
pcmcia_get_first_window()
pcmcia_get_next_window()
* device list iteration upon module removal (as of 2.6.10)
It is no longer necessary to iterate on the driver's internal
client list and call the ->detach() function upon module removal.
* Resource management. (as of 2.6.8)
Although the PCMCIA subsystem will allocate resources for cards,
it no longer marks these resources busy. This means that driver
authors are now responsible for claiming your resources as per
other drivers in Linux. You should use request_region() to mark
your IO regions in-use, and request_mem_region() to mark your
memory regions in-use. The name argument should be a pointer to
your driver name. Eg, for pcnet_cs, name should point to the
string "pcnet_cs".
* CardServices is gone
CardServices() in 2.4 is just a big switch statement to call various
services. In 2.6, all of those entry points are exported and called
directly (except for pcmcia_report_error(), just use cs_error() instead).
* struct pcmcia_driver
You need to use struct pcmcia_driver and pcmcia_{un,}register_driver
instead of {un,}register_pccard_driver
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
2.6.36: 자동 구성과 device enable
1-24이 문서는 Linux 2.6 계열에서 PCMCIA card driver 작성자에게 영향을 준 변경 사항을 정리합니다.
2.6.36부터 `struct pcmcia_device *p_dev->config_flags`를 설정하면 `pcmcia_loop_config()`가 일부 configuration 값을 자동으로 설정합니다. Driver는 callback에서 그 설정을 덮어쓸 수 있습니다.
`config_flags`로 요청할 수 있는 현재 option입니다.
`pcmcia_request_configuration()`은 대응하는 disable 함수와 이름을 맞추기 위해 `pcmcia_enable_device()`로 변경됐습니다. Configuration 값은 이제 `struct pcmcia_device`의 `config_flags`, `config_index`, `config_base`, `vpp` field에 저장합니다.
설정 저장 위치와 enable/disable 이름을 일관되게 바꿨습니다.
==============
Driver changes
==============
This file details changes in 2.6 which affect PCMCIA card driver authors:
* pcmcia_loop_config() and autoconfiguration (as of 2.6.36)
If `struct pcmcia_device *p_dev->config_flags` is set accordingly,
pcmcia_loop_config() now sets up certain configuration values
automatically, though the driver may still override the settings
in the callback function. The following autoconfiguration options
are provided at the moment:
- CONF_AUTO_CHECK_VCC : check for matching Vcc
- CONF_AUTO_SET_VPP : set Vpp
- CONF_AUTO_AUDIO : auto-enable audio line, if required
- CONF_AUTO_SET_IO : set ioport resources (->resource[0,1])
- CONF_AUTO_SET_IOMEM : set first iomem resource (->resource[2])
* pcmcia_request_configuration -> pcmcia_enable_device (as of 2.6.36)
pcmcia_request_configuration() got renamed to pcmcia_enable_device(),
as it mirrors pcmcia_disable_device(). Configuration settings are now
stored in struct pcmcia_device, e.g. in the fields config_flags,
config_index, config_base, vpp.
2.6.36: Window·I/O resource와 제거된 type
25-47`pcmcia_request_window()`에는 `win_req_t` 대신 `p_dev->resource[2,3,4,5]`를 채워 최대 네 I/O port range를 요청합니다. 함수가 성공하면 region이 reserve되어 즉시 사용할 수 있고 `pcmcia_release_window()`까지 유지됩니다.
`pcmcia_request_io()`에는 `io_req_t` 대신 `p_dev->resource[0,1]`을 채워 최대 두 I/O port range를 요청합니다. Port는 request 시 reserve되고 `pcmcia_request_configuration()` 뒤 사용할 수 있습니다.
요청 종류별 `struct pcmcia_device.resource[]` index입니다.
`dev_info_t`와 여러 typedef가 제거됐으므로 PCMCIA driver에서 사용하면 안 됩니다. `pcmcia/cs_types.h` file도 없어졌으므로 include하지 않습니다. 2.6.35부터는 `dev_node_t` 구조체를 채울 필요도 없습니다.
* pcmcia_request_window changes (as of 2.6.36)
Instead of win_req_t, drivers are now requested to fill out
`struct pcmcia_device *p_dev->resource[2,3,4,5]` for up to four ioport
ranges. After a call to pcmcia_request_window(), the regions found there
are reserved and may be used immediately -- until pcmcia_release_window()
is called.
* pcmcia_request_io changes (as of 2.6.36)
Instead of io_req_t, drivers are now requested to fill out
`struct pcmcia_device *p_dev->resource[0,1]` for up to two ioport
ranges. After a call to pcmcia_request_io(), the ports found there
are reserved, after calling pcmcia_request_configuration(), they may
be used.
* No dev_info_t, no cs_types.h (as of 2.6.36)
dev_info_t and a few other typedefs are removed. No longer use them
in PCMCIA device drivers. Also, do not include pcmcia/cs_types.h, as
this file is gone.
* No dev_node_t (as of 2.6.35)
There is no more need to fill out a "dev_node_t" structure.
2.6.35~2.6.33: IRQ·error·CIS tuple
48-682.6.35부터 오래된 `pcmcia_request_irq()` interface 대신 두 방식을 선택할 수 있습니다. `*p_dev->irq`의 IRQ로 `request_irq()`·`free_irq()`를 직접 호출하거나 `pcmcia_request_irq(p_dev, handler_t)`를 사용합니다.
두 번째 방식에서는 `pcmcia_disable_device()` 또는 device eject 때 PCMCIA core가 자동으로 정리합니다.
직접 lifetime을 관리하거나 PCMCIA core cleanup을 사용할 수 있습니다.
2.6.33부터 `cs_error()` callback, `CS_CHECK()` macro, `CONFIG_PCMCIA_DEBUG` 대신 Linux 방식으로 return value를 검사하고 필요하면 `dev_dbg()` 또는 `pr_debug()`를 사용합니다.
CIS tuple 하나의 raw data만 필요하면 `pcmcia_get_tuple()`, 한 type의 모든 tuple이 필요하면 `pcmcia_loop_tuple()`을 사용합니다. CISTPL_FUNCE에서 MAC을 decode하는 `pcmcia_get_mac_from_cis()` helper도 추가됐습니다.
여러 단계의 legacy tuple API를 목적별 helper로 대체합니다.
* New IRQ request rules (as of 2.6.35)
Instead of the old pcmcia_request_irq() interface, drivers may now
choose between:
- calling request_irq/free_irq directly. Use the IRQ from `*p_dev->irq`.
- use pcmcia_request_irq(p_dev, handler_t); the PCMCIA core will
clean up automatically on calls to pcmcia_disable_device() or
device ejection.
* no cs_error / CS_CHECK / CONFIG_PCMCIA_DEBUG (as of 2.6.33)
Instead of the cs_error() callback or the CS_CHECK() macro, please use
Linux-style checking of return values, and -- if necessary -- debug
messages using "dev_dbg()" or "pr_debug()".
* New CIS tuple access (as of 2.6.33)
Instead of pcmcia_get_{first,next}_tuple(), pcmcia_get_tuple_data() and
pcmcia_parse_tuple(), a driver shall use "pcmcia_get_tuple()" if it is
only interested in one (raw) tuple, or "pcmcia_loop_tuple()" if it is
interested in all tuples of one type. To decode the MAC from CISTPL_FUNCE,
a new helper "pcmcia_get_mac_from_cis()" was added.
2.6.28~2.6.17: Config loop와 통합 release
69-802.6.28부터 `pcmcia_loop_config()`로 사용 가능한 모든 configuration option을 순회할 수 있습니다. 대부분의 probe에서는 `pcmcia_get_{first,next}_tuple`, `pcmcia_get_tuple_data`, `pcmcia_parse_tuple`을 직접 사용할 필요가 없습니다.
2.6.17부터 `pcmcia_release_{configuration,io,irq,win}`을 각각 호출하지 않고 `pcmcia_disable_device()` 하나로 정리합니다. `pcmcia_release_io()`와 `pcmcia_release_irq()`를 직접 호출할 유효한 이유가 없어 export도 제거됐습니다.
여러 low-level 호출을 loop helper와 단일 disable 함수로 묶었습니다.
* New configuration loop helper (as of 2.6.28)
By calling pcmcia_loop_config(), a driver can iterate over all available
configuration options. During a driver's probe() phase, one doesn't need
to use pcmcia_get_{first,next}_tuple, pcmcia_get_tuple_data and
pcmcia_parse_tuple directly in most if not all cases.
* New release helper (as of 2.6.17)
Instead of calling pcmcia_release_{configuration,io,irq,win}, all that's
necessary now is calling pcmcia_disable_device. As there is no valid
reason left to call pcmcia_release_io and pcmcia_release_irq, the
exports for them were removed.
2.6.16~2.6.13: Driver callback과 kernel match
81-1052.6.16부터 detach와 REMOVAL event code는 `remove(struct pcmcia_device *dev)`로, attach와 INSERTION code는 `probe(struct pcmcia_device *dev)`로 통합됩니다.
void (*remove)(struct pcmcia_device *dev);
int (*probe)(struct pcmcia_device *dev);
Suspend, resume, reset도 event handler 밖으로 옮겨 `struct pcmcia_driver`의 `suspend`와 `resume` callback으로 초기화합니다. 이 callback은 각각 `(SUSPEND == RESET_PHYSICAL)`과 `(RESUME == CARD_RESET)` event를 처리합니다.
int (*suspend)(struct pcmcia_device *dev);
int (*resume)(struct pcmcia_device *dev);
2.6.13에서는 모든 event를 알리는 handler를 `struct pcmcia_driver`의 `event()` callback으로 초기화해야 합니다. `pcmcia/version.h`는 더 이상 사용하지 않으며 장차 제거될 예정이었습니다.
PCMCIA device와 올바른 driver를 kernel space에서 match할 수 있게 됐습니다. 자세한 내용은 원문이 가리키는 `devicetable.txt`를 참조합니다.
Event 종류를 표준 driver-model callback에 연결합니다.
* Unify detach and REMOVAL event code, as well as attach and INSERTION
code (as of 2.6.16)::
void (*remove) (struct pcmcia_device *dev);
int (*probe) (struct pcmcia_device *dev);
* Move suspend, resume and reset out of event handler (as of 2.6.16)::
int (*suspend) (struct pcmcia_device *dev);
int (*resume) (struct pcmcia_device *dev);
should be initialized in struct pcmcia_driver, and handle
(SUSPEND == RESET_PHYSICAL) and (RESUME == CARD_RESET) events
* event handler initialization in struct pcmcia_driver (as of 2.6.13)
The event handler is notified of all events, and must be initialized
as the event() callback in the driver's struct pcmcia_driver.
* pcmcia/version.h should not be used (as of 2.6.13)
This file will be removed eventually.
* in-kernel device<->driver matching (as of 2.6.13)
PCMCIA devices and their correct drivers can now be matched in
kernelspace. See 'devicetable.txt' for details.
2.6.11: Device model·주소·IRQ 정책
106-126`struct pcmcia_device`가 device model core에 등록되어 `handle_to_dev(client_handle_t *handle)`을 통해 `SET_NETDEV_DEV` 같은 용도로 사용할 수 있게 됐습니다.
PCMCIA driver의 내부 I/O port address type은 `ioaddr_t`에서 `unsigned int`로 바꿔야 합니다.
`irq_mask`와 `irq_list` parameter는 더 이상 사용하지 않습니다. 사용할 IRQ는 PCMCIA core가 결정하므로 `link->irq.IRQInfo2`도 무시됩니다.
`client->PendingEvents`는 없어졌고 사용되지 않던 `client->Attributes`도 모든 PCMCIA card driver에서 제거됐습니다.
Core가 담당할 정보와 제거된 client field를 구분합니다.
* Device model integration (as of 2.6.11)
A struct pcmcia_device is registered with the device model core,
and can be used (e.g. for SET_NETDEV_DEV) by using
handle_to_dev(client_handle_t * handle).
* Convert internal I/O port addresses to unsigned int (as of 2.6.11)
ioaddr_t should be replaced by unsigned int in PCMCIA card drivers.
* irq_mask and irq_list parameters (as of 2.6.11)
The irq_mask and irq_list parameters should no longer be used in
PCMCIA card drivers. Instead, it is the job of the PCMCIA core to
determine which IRQ should be used. Therefore, link->irq.IRQInfo2
is ignored.
* client->PendingEvents is gone (as of 2.6.11)
client->PendingEvents is no longer available.
* client->Attributes are gone (as of 2.6.11)
client->Attributes is unused, therefore it is removed from all
PCMCIA card drivers
2.6.11~2.6.8: 제거 API와 resource 관리
127-151In-kernel driver와 알려진 external driver가 사용하지 않아 다음 core 함수가 kernel source에서 제거됐습니다.
pcmcia_get_first_region()
pcmcia_get_next_region()
pcmcia_modify_window()
pcmcia_set_event_mask()
pcmcia_get_first_window()
pcmcia_get_next_window()
2.6.10부터 module 제거 때 driver 내부 client list를 순회하며 `->detach()`를 호출할 필요가 없습니다.
2.6.8부터 PCMCIA subsystem은 card resource를 할당하지만 busy로 mark하지 않습니다. 다른 Linux driver처럼 driver 작성자가 직접 resource를 claim해야 합니다.
I/O region은 `request_region()`, memory region은 `request_mem_region()`으로 사용 중임을 표시합니다. Name 인자는 driver name을 가리켜야 하며 `pcnet_cs`라면 문자열 `"pcnet_cs"`를 사용합니다.
PCMCIA core 할당 뒤 실제 busy 소유권은 driver가 표시합니다.
* core functions no longer available (as of 2.6.11)
The following functions have been removed from the kernel source
because they are unused by all in-kernel drivers, and no external
driver was reported to rely on them::
pcmcia_get_first_region()
pcmcia_get_next_region()
pcmcia_modify_window()
pcmcia_set_event_mask()
pcmcia_get_first_window()
pcmcia_get_next_window()
* device list iteration upon module removal (as of 2.6.10)
It is no longer necessary to iterate on the driver's internal
client list and call the ->detach() function upon module removal.
* Resource management. (as of 2.6.8)
Although the PCMCIA subsystem will allocate resources for cards,
it no longer marks these resources busy. This means that driver
authors are now responsible for claiming your resources as per
other drivers in Linux. You should use request_region() to mark
your IO regions in-use, and request_mem_region() to mark your
memory regions in-use. The name argument should be a pointer to
your driver name. Eg, for pcnet_cs, name should point to the
string "pcnet_cs".
CardServices와 driver 등록 API
152-160Linux 2.4의 `CardServices()`는 여러 service를 호출하는 큰 switch 문이었습니다. 2.6에서는 entry point를 직접 export하고 호출합니다. 원문은 `pcmcia_report_error()` 대신 `cs_error()`를 사용하라고 안내합니다.
Driver는 `{un,}register_pccard_driver` 대신 `struct pcmcia_driver`와 `pcmcia_{un,}register_driver`를 사용해야 합니다.
CardServices 중계와 구형 pccard 등록을 직접 API로 바꿉니다.
* CardServices is gone
CardServices() in 2.4 is just a big switch statement to call various
services. In 2.6, all of those entry points are exported and called
directly (except for pcmcia_report_error(), just use cs_error() instead).
* struct pcmcia_driver
You need to use struct pcmcia_driver and pcmcia_{un,}register_driver
instead of {un,}register_pccard_driver
요약·해설
driver-changes.rst:1-160PCMCIA 2.6 API는 low-level tuple·resource·event 처리를 helper와 표준 driver-model callback으로 통합했습니다. Driver는 core가 정한 IRQ를 사용하고 resource busy ownership은 일반 Linux driver처럼 직접 claim해야 합니다.