NetBSD/sys/dev/ieee1394/NOTES
jmc 1db8069fe5 First pass (checkpoint checkin) for firewire scsi code.
There are a number of issues here for anyone trying to use this today:

1. On my test drive the command engine on the drive seems to stall after the
   inquire is done. So the mode sense times out for a long time before
   aborting. This obviously needs to be tracked down and fixed.

   However it does do a proper inquire:

scsibus0 at sbpscsi0: 1 target, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Maxtor, 1394 storage, 60> disk fixed

2. This code is quite ugly in places as debug code was added to test things.
   Definitly needs cleanup/documention in places where it's using command
   structures. The structure for alloc'ing orbs, running them through the
   command engine and getting state back is mostly set but implementation needs
   an overhaul in places.

3. For testing I use the following config options:

fwohci* at cardbus? dev ? function ?    # IEEE1394 Controller
fw*     at fwbus?
options FW_DEBUG
options FWNODE_DEBUG
options P1212_DEBUG
options SBP2_DEBUG
options SBPSCSI_DEBUG
fwnode* at fwbus?
sbpscsi* at fwnode?
scsibus* at sbpscsi?
2002-11-22 16:28:54 +00:00

146 lines
2.3 KiB
Plaintext

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
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
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
setup generic status callback
request -
Accept packet through request routine
examine packet for data vs. cmd
cmd:
construct orb with no data addr
data:
determine direction bit
examine packet for uio vs direct map:
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
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
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