NetBSD/sys/dev/ieee1394/NOTES

146 lines
2.3 KiB
Plaintext
Raw Normal View History

SBP2 SCSI notes:
sbp *sbp_init(dir node *, int numorbs)
int sbp_runcmd(sbp *, sbp_cmd *);
orb *sbp_construct_orb(data *, orb data *, void *callback, cbarg)
void sbp_free(sbp *);
cmd - u_int8_t cmd[12]
int cmdlen
u_char *data
int datalen (0 if data uio)
u_int16_t lun;
int r/w
void (*cb)(void *, sbp2_status *)
void *cb_arg
2005-02-27 03:26:58 +03:00
status -
u_int8_t resp;
u_int8_t sbp_status;
u_int8_t object;
u_int8_t serial_error;
u_int32_t *data
u_int16_t datalen;
crc check
status orb
src
resp
dead
2005-02-27 03:26:58 +03:00
len
sbp status
u_int32_t *data
sbp2 management struct:
struct ieee1394_softc *dev
mgmt register
csr regs
loginid
speed
maxpayload
mgmt orb timeout
orb size
sbp state
orb:
*need addr for orb address range
*need addr for data address range
*need addr for page table address range
abuf *
abuf count
inuse
void *request
fwscsi:
sbp2 struct
orb *
orbcount
init sbp2 (ieeesoftc and sbp2 struct)
send login packet
setup handlers for login resp
and status fifo
get login resp and clear handler
get status but leave handler for unsolicated responses.
login resp has mgmt registers pointer, save it
also contains login id, save it
setup dummy orb and get agent ready by having it fetch this
return dummy orb or NULL on error
scsi-init
2005-02-27 03:26:58 +03:00
setup generic status callback
request -
Accept packet through request routine
examine packet for data vs. cmd
2005-02-27 03:26:58 +03:00
cmd:
construct orb with no data addr
data:
determine direction bit
examine packet for uio vs direct map:
2005-02-27 03:26:58 +03:00
direct map:
setup read callback if <= 64k in size
else setup uio and do uio
uio:
setup unrestricted page table in 64k chunks
setup callback for each chunk
setup callback for page table
find current end of orb chain
DIAG - make sure there's room for a new orb
2005-02-27 03:26:58 +03:00
add new orb into chain
setup callback to read that orb
ring doorbell
status callback - mark orb as not in use, pull data and call scsipi_done with
status
unregister all callback associated with orb
extend orbs -
allocate more orb pointers
config rom -
a typical match routine will
find_type(type code) == X type
find_type(type code) == X type
...
ex
2005-02-27 03:26:58 +03:00
find_type(unit spec id) == sbp2
find_type(unit sw version) == scsi
in attach:
call sbp2_register_print for unit directory -- fwscsi_rom_print
direcotory entries need print callback pointer