[AIX 진단 서브시스템 7] 테스트 단위 64비트 이식 지침

핵심 정리

  • 64비트 커널로 옮길 때 테스트 단위(TU)는 그대로 32비트 응용 프로그램으로 남고, 2차 인터럽트 처리기(SLIH)만 64비트로 만듭니다. 아키텍처를 지킨 TU라면 변경은 적습니다.
  • 64비트에서 long과 포인터가 64비트가 되므로, TU와 SLIH 사이에 넘기는 data_area 구조체에 long·포인터가 있으면 크기를 맞춰(reshape) 줘야 합니다.
  • SLIH Makefile은 32비트 실행 파일과 이름 뒤에 64를 붙인 64비트 실행 파일(예: fcphal_intr64)을 함께 만듭니다.
  • 필수 변경: pdiag_dd_read/pdiag_dd_write 호출을 #ifdef __64BIT_KERNEL로 나눠 64비트 쪽은 pdiag_dd_read_64/pdiag_dd_write_64로(intrlev는 늘 INTRKMEM), SLIH 원형의 sleep_word·sleep_flag 형 선언 변경.
  • 마이크로코드 표시와 설치는 TU를 따로 둡니다. EEH 지원을 위해 읽은 데이터가 모두 1이면(예상한 경우가 아니면) 고유한 오류로 보고합니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (내용이 같음)
원문 Understanding the Diagnostic Subsystem for AIX — 5.3판 3장(7376쪽), 6.1판 6063쪽
관련 함수 pdiag_dd_read_64, pdiag_dd_write_64, pdiag_dd_read, pdiag_dd_write

이 이식 지침은 테스트 단위와 SLIH가 64비트 커널에서 동작하도록 하는 데 필요한 변경을 설명합니다.

64비트 커널에서 실행되는 pdiagex 커널 확장의 변경은 테스트 단위 개발자를 염두에 두고 설계했습니다. 테스트 단위를 이식하는 데 필요한 변경은 대부분 2차 인터럽트 처리기(SLIH) 수준에서 이루어집니다. 이 문서의 아키텍처를 따른 테스트 단위 개발자라면 변경은 작고 시험도 최소한으로 하면 됩니다.

기존 테스트 단위 묶음을 이식하기 전에, 테스트 단위의 응용 프로그램 환경과 64비트 C 데이터 모델이 32비트 모델과 어떻게 다른지 이해하는 것이 중요합니다.

테스트 단위는 32비트 커널에서 32비트 응용 프로그램으로 실행되므로 32비트 커널 확장(pdiagex)만 씁니다. 테스트 단위는 계속 32비트 응용 프로그램으로 실행되며, SLIH만 64비트 응용 프로그램이 됩니다.

영어 원문

Test unit 64-bit porting guideline

This porting guideline describes the required changes to the test units and SLIH in order to function under a 64-bit kernel.

Changes to the pdiagex kernel extension running under a 64-bit kernel were designed with the test unit developer in mind. Most of the changes required to port the test units are done at the Second Level Interrupt Handler (SLIH) level. For a test unit developer that has followed the architecture specified in this document, the changes are minor and will require minimal testing.

Before porting an existing set of test units, it is important to understand the test units application environment as well as the 64-bit C language data model and how it differs from the 32-bit model.

Test units execute as 32-bit applications under a 32-bit kernel and therefore only use 32-bit kernel extensions (pdiagex). The test units will continue executing as 32-bit applications: only the SLIHs will be 64-bit applications.

C 데이터 모델

32비트와 64비트 운영 체제 환경의 C 데이터 모델은 다음 표와 같습니다.

테스트 단위에서 SLIH로 넘기고 돌려받는 데이터의 크기는 한 환경에서 다른 환경으로 넘어가며 바뀔 수 있으므로 반드시 고려해야 합니다. 구조체나 포인터 형태로 정보를 넘길 때 특히 조심합니다.

C 형 32비트 크기 64비트 크기
char 8비트 8비트
short 16비트 16비트
int 32비트 32비트
long 32비트 64비트
long long 64비트 64비트
포인터 32비트 64비트
영어 원문

C language data model

The C language data model used in the 32-bit and 64-bit operating system environments are defined in the following table.

You must consider the size of the data passed from the Test Units to the SLIHs and back, since sizes can change as they are passed from one environment to the other. Use special care when passing information in the form of structures or pointers.

C Type 32-bit Data Size 64-bit Data Size
char 8 bits 8 bits
short 16 bits 16 bits
int 32 bits 32 bits
long 32 bits 64 bits
long long 64 bits 64 bits
pointer 32 bits 64 bits

Makefile

32비트와 64비트 SLIH를 모두 지원하려면 SLIH Makefile이 실행 파일 두 개를 만들도록 고쳐야 합니다. 32비트용은 지금 이름 그대로 두고, 64비트 SLIH는 이름 뒤에 64를 붙입니다.

구분 이름 형식 예
32비트 filename fcphal_intr
64비트 filename64 fcpthal_intr64
영어 원문

Makefile

To support 32-bit and 64-bit SLIHs, the SLIH Makefile has to be modified to build two executables; one for 32-bits that will remain named as it is today and one for the 64-bit SLIH which will have 64 appended to the name.

File Names Syntax Example
32-bit filename fcphal_intr
64-bit filename64 fcpthal_intr64

Makefile 소스

32비트와 64비트 SLIH를 같은 소스로 만드는 Makefile의 예입니다.

참고: 이 예를 쓰려면 환경 변수와 파일 이름을 자기 것으로 바꿉니다.

text
# @(#)17     1.1  src/idd/en_US/aixprggd/diagunsd/TU_64bit_port.htm,
iddiagunsd, idd500 5/23/00 13:54:31
#
.include <${MAKETOP}bos/kernext/Kernext.mk>
TU_VPATH   = ${MAKETOP}/bos/diag/tu/tu_dir
VPATH      = ${MAKETOP}bos/kernel/exp:${MAKETOP}bos/kernext/exp:$TU_VPATH
# 32-bit version of load object
#
KERNEL_EXT      = your_intr
# 64-bit version of load object
#
KERNEL_EXT64    = your_intr64
IDIR            = /usr/lpp/diagnostics/slih/
# install list containing 32-bit and 64-bit version
#
ILIST           = your_intr your_intr64
OPT_LEVEL       =    -qlist -qsource
# entry point, import and export files for 32-bit version
#
your_intr _DEPENDS       = your_intr .exp
your_intr _ENTRYPOINT    = your_interrupt
your_intr _IMPORTS       = -bI:pdiagex.exp
your_intr _EXPORTS       = -bE: your_intr .exp
# entry point, import and export files for 64-bit version
# (common with 32-bit version)
your_intr64 _DEPENDS     = your_intr .exp
your_intr64 _ENTRYPOINT  = your_interrupt
your_intr64 _IMPORTS     = -bI:pdiagex.exp \
                                 pdiagex64.exp
your_intr64 _EXPORTS     = -bE: your_intr .exp
# object list definition for 32-bit version
#
your_intr _OFILES    =  your_intr .o
# object list definition for 64-bit version (common objects
# across 32-bit and 64-bit versions), with 64-bit objects
# renamed to .64o
#
your_intr64 _OFILES  =  your_intr .64o
INCFLAGS   = -I${MAKETOP}/bos/diag/tu/tu_dir \
             -I${MAKETOP}bos/usr/include
LIBS       = ${KERNEXT_LIBS}
.include <${RULES_MK}>
영어 원문

Makefile Source

Here is an example of what a common source 32-bit and 64-bit SLIH Makefile might look like:

Note: Replace the environment variables and file names with your own names to customize this example for your own use.

(42줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

SLIH 변환 요령

SLIH를 깔끔하게 변환하려면 다음 요령에 특히 주의합니다.

  • int, long, 포인터 형의 크기가 같다고 가정한 소스 코드는 모두 64비트 환경에 맞게 고쳐야(reshape) 합니다.
  • 아래 데이터 형이 바뀌었을 수 있으므로 형 변환(cast)을 모두 검토합니다.
  • long 형과 포인터가 든 자료 구조, 특히 테스트 단위와 SLIH 사이에 넘기는 데이터(data_area)의 크기를 확인합니다. C 데이터 모델 표를 보고, "인터럽트 처리기 호출 인터페이스"도 봐서 data_area에 알맞은 데이터 형이 들어 있는지 확인합니다. 이 구조체로 long 형이나 포인터(또는 둘 다)를 넘기면 SLIH가 쓰기 전에 구조체를 고쳐야 합니다.
  • 형 선언에는 될 수 있는 대로 시스템이 정의한 형(system-derived types)을 씁니다.
영어 원문

SLIH conversion tips

To achieve a clean SLIH conversion, pay special attention to the SLIH Conversion Tips. • Any source code that assumes that int, long and pointer types are the same size must be corrected (reshaped) for 64-bit environment. • Review any type casting, since the underlying data types may have changed. • Make sure that any data structures containing long types and pointers are checked for sizes, especially data passed between test units and SLIHs (data_area). Refer to the C Language Data Model table. Also see Interrupt Handler Call Interface to make sure the data_area contains the proper data types. When long types or pointers (or both) are passed in this structure, the structure must be reshaped before it is used by the SLIH. • Use system-derived types for type declarations whenever possible.

SLIH 변환에 필요한 변경

64비트 커널로 이식하는 모든 SLIH에 다음 변경을 적용해야 합니다.

  1. 장치 읽기 작업: 64비트용으로 pdiag_dd_read를 쓰는 곳마다 pdiag_dd_read_64를 따로 둬야 합니다. 32비트 SLIH에서 pdiag_dd_read를 쓰는 모든 곳에 64비트 SLIH는 pdiag_dd_read_64를 씁니다. 조건부 전처리기 문(#ifdef)으로 합니다. 32비트와 64비트 읽기 호출을 같은 소스로 쓰는 예입니다.
text
#ifdef __64BIT_KERNEL
     rc = pdiag_dd_read_64(pdiagex_handle, IOSHORT16, io_addr, &datas,
&flags);
#else
     rc = pdiag_dd_read(pdiagex_handle, IOSHORT16, io_addr, &datas,
&flags);
#endif

참고:

  • __64BIT_KERNEL 컴파일러 지시자는 64비트 커널 컴파일러에서 정의되므로 사용자가 정의하지 않아도 됩니다.
  • IOLONG32 읽기는 특별한 경우로, 함수 호출 뒤 데이터를 오른쪽으로 32비트 밀어야 합니다(data = data >> 32;).
  • pdiag_dd_read_64 함수는 커널 환경에서만 쓰므로 intrlev 플래그를 늘 INTRKMEM으로 설정해야 합니다.
  1. 장치 쓰기 작업: 64비트용으로 pdiag_dd_write를 쓰는 곳마다 pdiag_dd_write_64를 따로 둬야 합니다. 32비트 SLIH에서 pdiag_dd_write를 쓰는 모든 곳에 64비트 SLIH는 pdiag_dd_write_64를 씁니다. 조건부 전처리기 문(#ifdef)으로 합니다. 같은 소스로 쓰는 예입니다.
text
#ifdef __64BIT_KERNEL
        rc = pdiag_dd_write_64(pdiagex_handle, IOLONG32, io_addr,
&datal, &flags);
#else
        rc = pdiag_dd_write(pdiagex_handle, IOLONG32, io_addr, &datal,
&flags);
#endif

참고:

  • __64BIT_KERNEL 컴파일러 지시자는 64비트 커널 컴파일러에서 정의되므로 사용자가 정의하지 않아도 됩니다.
  • pdiag_dd_write_64 함수는 커널 환경에서만 쓰므로 intrlev 플래그를 늘 INTRKMEM으로 설정해야 합니다(원문은 여기서도 pdiag_dd_read_64라고 적음).
  1. SLIH 함수 원형: *sleep_word와 sleep_flag의 형 선언을 다음과 같이 바꿔야 합니다.
text
int your_interrupt (pdiag_info_handle_t pdiagex_handle, char
*data_area, int *interrupt_flag,
#ifdef __64BIT_KERNEL
        long sleep_flag, long *sleep_word)
#else
        int sleep_flag, int *sleep_word)
#endif

관련 개념

  • 진단 구성 요소: 진단 서브시스템 환경을 이루는 여러 구성 요소의 정보입니다.
  • 인터럽트 처리기 호출 인터페이스: 장치의 진단 인터럽트 처리기 함수는 테스트 단위 라이브러리와 따로 실행 모듈로 묶어야 하며, TU_OPEN이 pdiag_open 함수를 부를 때 운영 체제에 적재되고 진단 시스템 서비스에 등록됩니다.

관련 참조

pdiag_dd_read, pdiag_dd_read_64 / pdiag_dd_write, pdiag_dd_write_64(진단 커널 확장 (2) 글)

영어 원문

SLIH conversion required changes

The following required changes must be applied to all SLIHs being ported to 64-bit kernel.

  1. Performing Read Operations to a Device All instances of pdiag_dd_read will have to be duplicated with pdiag_dd_read_64 for 64-bit. Every place where pdiag_dd_read is used for a 32-bit SLIH, a pdiag_dd_read_64 will be used for a 64-bit SLIH. This will be accomplished by using conditional preprocessor compiler statements (#ifdef). Here is an example of what a common source 32-bit and 64-bit read call might look like:
text
#ifdef __64BIT_KERNEL
     rc = pdiag_dd_read_64(pdiagex_handle, IOSHORT16, io_addr, &datas,
&flags);
#else
     rc = pdiag_dd_read(pdiagex_handle, IOSHORT16, io_addr, &datas,
&flags);
#endif

Note

  1. The __64BIT_KERNEL compiler directive is defined for 64-bit kernel compilers, therefore the user will not need to define it. b. Special case for IOLONG32 reads, the data has to be shifted 32-bits right after the function call, such as, (data = data >> 32;). c. The pdiag_dd_read_64 function is used in kernel environment only, therefore the intrlev flag must always be set to INTRKMEM.
  1. Performing Write Operations to a Device All instances of pdiag_dd_write have to be duplicated with pdiag_dd_write_64 for 64-bit. Every place where pdiag_dd_write is used for a 32-bit SLIH, a pdiag_dd_write_64 will be used for a 64-bit SLIH. This will be accomplished by using conditional preprocessor compiler statements (#ifdef). Here is an example of what a common source 32-bit and 64-bit write call might look like:
text
#ifdef __64BIT_KERNEL
        rc = pdiag_dd_write_64(pdiagex_handle, IOLONG32, io_addr,
&datal, &flags);
#else
        rc = pdiag_dd_write(pdiagex_handle, IOLONG32, io_addr, &datal,
&flags);
#endif

Note

  1. The __64BIT_KERNEL compiler directive is defined for 64-bit kernel compilers, therefore the user will not need to define it.

  2. The pdiag_dd_read_64 function is used in kernel environment only, therefore the intrlev flag must always be set to INTRKMEM.

  1. SLIH function prototype The SLIH function prototype requires change in the type declaration for *sleep_word and sleep_flag as follows:
text
int your_interrupt (pdiag_info_handle_t pdiagex_handle, char
*data_area, int *interrupt_flag,
#ifdef __64BIT_KERNEL
        long sleep_flag, long *sleep_word)
#else
        int sleep_flag, int *sleep_word)
#endif

Related concepts

Diagnostic components This section contains information on the various components that make up the Diagnostic Subsystem environment. Interrupt handler call interface The diagnostic interrupt handler function for a device must be packaged in an executable module separate from the Test Unit library. This module is loaded into the operating system and registered with the diagnostic system services when the TU_OPEN calls the pdiag_open function.

Related reference

“pdiag_dd_read, pdiag_dd_read_64” on page 84 “pdiag_dd_write, pdiag_dd_write_64” on page 82

테스트 단위의 마이크로코드 내려받기·표시 요구 사항

현장에서 갱신할 수 있는 상주 마이크로코드나 펌웨어가 있는 어댑터나 장치는, 설치된 마이크로코드·펌웨어 수준 표시와 마이크로코드·펌웨어 설치에 각각 별도의 테스트 단위가 있습니다. 기능(표시와 설치)마다 다음처럼 별도의 테스트 단위를 씁니다.

테스트 단위 설명
마이크로코드 표시 시험할 어댑터나 장치에 있는 현재 마이크로코드 개정 수준을 모두 호출 응용 프로그램에 줍니다. 장치나 어댑터에 마이크로코드를 물어 얻은 장치별 출력은 TU_INPUT_TYPE에 정의된 OUTPUT_DATA(*data_log)로 호출 응용 프로그램에 넘깁니다("exectu()의 정의" 참고).
마이크로코드 설치 어댑터나 장치의 마이크로코드를 갱신하는 기능을 줍니다. 마이크로코드 파일 이름은 호출 응용 프로그램이 TU_INPUT_TYPE에 정의된 INPUT_DATA(*tu_data)로 넘깁니다("exectu()의 정의" 참고).
영어 원문

Microcode download or display requirements for test units

Any adapter or device that has resident microcode or firmware that can be updated in the field has a separate Test unit for both the display of the installed microcode or firmware level and the installation of the microcode or firmware. Use a separate Test Unit for each specific function (display and install) as follows:

  • Microcode Display: — This Test Unit provides the calling application with all the present microcode revision levels residing in the adapter or device under test. All device specific output resulting from a microcode device or adapter queries are passed to the calling application using OUTPUT_DATA (*data_log) as defined in TU_INPUT_TYPE. For more information refer to Definition of EXECTU().
  • Microcode Installation: — This Test Unit provides a function to update the Adapter or Device Microcode. The Microcode file name is passed from the calling application using INPUT_DATA (*tu_data) as defined in TU_INPUT_TYPE. For more information refer to Definition of EXECTU().

EEH 옵션

진단 테스트 단위 응용 프로그램 인터페이스는 모든 읽기 함수를 다음과 같이 맞춥니다.

  • 어댑터에서 읽은 데이터는 따로 예상한 경우가 아니면 모두 1이 아닌지 확인해야 합니다. 모두 1인 데이터 읽기는 고유한 오류를 만들어 진단 응용 프로그램에 보고합니다.
  • 특정 시험의 성격 때문에 정상 동작으로 모두 1을 예상하는 테스트 단위는, 요청한 데이터로 그 오류가 모두 1 때문임을 확인할 때까지 오류를 보고하지 않습니다.
  • 진단 응용 프로그램 개발자와 테스트 단위 개발자는 EEH(Enhanced Error Handling)용 고유 오류 코드를 함께 정해야 합니다.
영어 원문

Enhanced error handling option

The Diagnostics Test Units Application interface consists of adapting all read functions.

  • All data reads for the adapter must be verified that the data read is other than all 1s, unless otherwise expected. Any data reads that result in all 1s produce a unique error, which is reported to the Diagnostics application.

  • A test unit that expects all 1s as normal operation, because of a particular test's nature, does not report the error until that error is verified by the requesting data as being caused by all 1s.

  • Diagnostics application developers and test unit developers must determine jointly a unique error code for enhanced error handling.