Int 21 Fn 4402 - Advanced Scsi Programming Interface (aspi) - Interface [d]

AX = 4402h
BX = file handle for device "SCSIMGR$"
CX = 0004h or 0005h (refer to notes below)
DS:DX -> buffer for result (see #1139), set to zeros before call

Return: CF clear if successful
AX = 0004h or 0005h (refer to notes below)
CF set on error
AX = error code (01h,05h,06h,0Dh) (see #1366 at AH=59h/BX=0000h)

Notes: the variant of the call requesting five bytes is an UNDOCUMENTED
extension supported by Adaptec's ASPI2DOS.SYS, ASPI4DOS.SYS, and
ASPI7DOS.SYS; if made of a host manager which does not support the
variant, only four bytes will be returned. If the variant is
supported, Adaptec's WINASPI.DLL assumes that the host manager is
an "advanced" one which operates in either real or protected mode
(and thus does not require a DPMI INT 31/AX=0301h call to be invoked
from protected mode). Support of the five-byte variant also appears
to imply that an advanced ASPI host manager uses no temporary
storage space except the SRB (see #1141) and the stack, and that it
is fully reentrant.
if called with a standard request for four bytes, even Adaptec's
advanced drivers return only the requested four bytes containing the
ASPI entry point address
the function address is called with the address of a SCSI Request
Block (see #1141) on the stack and the caller must clean up the
stack

See Also: AX=440Ch"ASPITAPE",INT 11/AH=FFh"WD7000"

Format of ASPI IOCTL result:
Offset Size Description (Table 1139)
00h DWORD function address
04h BYTE number of SCSI host adapters supported by host manager

(Table 1140)
Values for ASPI request number:
00h "HA_INQ" host adapter inquiry / extended host adapter inquiry
01h "GET_TYPE" get device type
02h "EXEC_SIO" execute SCSI I/O
03h "ABORT_SRB" abort SRB
04h "RESET_DEV" reset SCSI device
05h "SET_HAPRMS" set host adapter parameters
06h get disk drive information

Format of SCSI Request Block (64 bytes):
Offset Size Description (Table 1141)
00h BYTE request number (see #1140)
01h BYTE request status (see #1142)
02h BYTE host adapter ID
03h BYTE request flags (see #1143)
04h DWORD reserved (0)
---request 00h---
08h BYTE (ret) number of host adapters
09h BYTE (ret) target adapter ID
0Ah 16 BYTEs (ret) SCSI manager ID
1Ah 16 BYTEs (ret) host adapter ID
2Ah 16 BYTEs (ret) host adapter-unique parameters
---extended request 00h---
04h 2 BYTEs (call) extended request signature 55h AAh
(ret) if extended request supported, reply AAh 55h
06h WORD (call) length of extended buffer at offset 3Ah
(ret) number of bytes returned in extended buffer
08h BYTE (ret) number of host adapters
09h BYTE (ret) target adapter ID
0Ah 16 BYTEs (ret) SCSI manager ID
1Ah 16 BYTEs (ret) host adapter ID
2Ah 16 BYTEs (ret) host adapter-unique parameters
3Ah N BYTEs extended buffer
3Ah WORD features (see #1144)
3Ch WORD maximum scatter/gather list length
3Eh DWORD maximum SCIS data transfer size (0 = unlimited)
---request 01h---
08h BYTE target ID
09h BYTE logical unit number
0Ah BYTE (ret) device type (see #1147)
---request 02h---
08h BYTE target ID
09h BYTE logical unit number
0Ah DWORD data allocation length
(ret) residual byte length (if supported and requested)
0Eh BYTE sense allocation length
0Fh DWORD data buffer pointer
13h DWORD next request pointer (for linking)
17h BYTE CDB length
18h BYTE (ret) host adapter status (see #1141)
19h BYTE (ret) target status (see #1146)
1Ah DWORD post routine address (see #1153)
1Eh WORD real mode Post DS
20h DWORD SRB pointer
24h WORD reserved
26h DWORD SRB physical address
2Ah 22 BYTEs SCSIMGR$ workspace
40h N BYTEs CCB, including sense data (20-24 bytes)
---request 03h---
08h DWORD address of SRB to abort
---request 04h---
08h BYTE target ID
09h BYTE logical unit number
0Ah 14 BYTEs reserved
18h BYTE (ret) host adapter status (see #1145)
19h BYTE (ret) target status (see #1146)
1Ah DWORD post routine address
1Eh 34 BYTEs workspace
---request 05h---
08h 16 BYTEs host adapter-unique parameters
---request 06h---
08h BYTE target ID
09h BYTE logical unit number
0Ah BYTE disk drive flags (see #1148)
0Bh BYTE INT 13h drive number
0Ch BYTE preferred head number translation
0Dh BYTE preferred sector size translation
0Eh 10 BYTEs reserved

See Also: #1149

(Table 1142)
Values for ASPI request status:
00h not done yet
01h completed successfully
02h aborted by host
04h SCSI I/O error
80h invalid
81h no adapter
82h no device attached
else status

See Also: #1141

Bitfields for ASPI request flags:
Bit(s) Description (Table 1143)
0 posting enabled
1 linking enabled
2 residual byte length reported in Data Allocation Length field
3 transfer from SCSI target to host
4 transfer from host to SCSI target
5 scatter/gather
7-6 reserved

Note: no data is transferred if both bits 3 and 4 are set; if neither is
set, the direction is determined by the SCSI command

See Also: #1141

Bitfields for ASPI extended features:
Bit(s) Description (Table 1144)
0 scatter/gather supported
1 residual byte length reported
2 Wide SCSI 16 host adapter
3 Wide SCSI 32 host adapter
15-4 reserved

See Also: #1141

(Table 1145)
Values for host adapter status:
00h no error detected
11h select timeout
12h data overrun
13h bus error
14h bus failure

(Table 1146)
Values for target status:
00h no status
02h sense data stored in SRB
08h target busy
18h reservation error

(Table 1147)
Values for device type:
00h disk drive
01h tape drive (streamer)
02h printer
03h processor
04h WORM drive
05h CD-ROM drive
06h scanner
07h optical drive
08h autochanger
09h communications device

(Table 1148)
Values for disk drive flags:
00h no INT 13 access
01h INT 13 with DOS access
02h INT 13 without DOS access
03h invalid flags

Format of CCB:
Offset Size Description (Table 1149)
00h BYTE command code (see #1150)
01h BYTE flags
bits 4-0: vary by function
bits 7-5: logical unit number
02h BYTE "adr_1"
03h BYTE "adr_0"
04h BYTE length
05h BYTE control
...
06h/0Ah 14 BYTEs buffer for sense data (see #1151)

See Also: #1141

(Table 1150)
Values for CCB command code:
00h test unit ready
01h rewind
03h request sense data
05h get block size limits
08h Group 0 read
0Ah Group 0 write
10h write file marks
11h SCSI Space (set position?)
12h SCSI Inquire
15h set mode information
16h reserve SCSI device
17h release SCSI device
19h erase
1Ah request mode information
1Bh load/unload media
1Dh request target self-check
24h set window parameters
25h get window parameters
28h Group 1 read
2Ah Group 1 write
31h document feeder control
34h get scan data status
---vendor-specific commands---
D3h get document feeder status
D4h set document feeder mode

Format of sense data:
Offset Size Description (Table 1151)
00h BYTE error code (bit 7 set if valid)
01h BYTE segment number
02h BYTE sense key
bit 6: EOM
bit 5: ILI
bits 0-3: sense key (see #1152)
03h 4 BYTEs information bytes
07h BYTE additional sense length (0Ah)
08h 4 BYTEs command-specific information
0Ch BYTE additional sense code
0Dh BYTE additional sense code qualifier
0Eh BYTE field replaceable unit code
0Fh 3 BYTEs sense key specific bytes

(Table 1152)
Values for sense key:
00h no sense data
02h SCSI unit not ready
03h media error
04h unrecoverable hardware error
05h illegal parameter in CDB
06h target has been reset
0Bh target aborted command

(Table 1153)
Values APSI post function is called with:
STACK: DWORD -> SRB (see #1141) which completed
interrupts disabled

Return: EBP, EBX, ESI, EDI must be preserved
interrupts disabled

Note: the post function may issue any APSI function except an abort; it
should complete as quickly as possible