2 #pragma src "/sys/src/libfis"
6 Emed = 1<<0, /* media error */
7 Enm = 1<<1, /* no media */
8 Eabrt = 1<<2, /* abort */
9 Emcr = 1<<3, /* media change request */
10 Eidnf = 1<<4, /* no user-accessible address */
11 Emc = 1<<5, /* media change */
12 Eunc = 1<<6, /* data error */
13 Ewp = 1<<6, /* write protect */
14 Eicrc = 1<<7, /* interface crc error */
16 Efatal = Eidnf|Eicrc, /* must sw reset */
21 ASerr = 1<<0, /* error */
22 ASdrq = 1<<3, /* request */
23 ASdf = 1<<5, /* fault */
24 ASdrdy = 1<<6, /* ready */
25 ASbsy = 1<<7, /* busy */
27 ASobs = 1<<1|1<<2|1<<4,
42 /* nominal fis size (fits any fis) */
46 /* sata device-to-host (0x27) fis layout */
62 Ficc, /* isochronous cmd completion */
66 /* sata host-to-device fis (0x34) differences */
73 /* ata protcol type */
75 Pnd = 0<<0, /* data direction */
80 Ppio = 1<<2, /* ata protocol */
88 P48 = 0<<5, /* command “size” */
92 Pssn = 0<<6, /* sector size */
97 typedef struct Sfis Sfis;
104 uint physshift; /* log2(log/phys) */
105 uint c; /* disgusting, no? */
111 Dlba = 1<<0, /* required for sata */
128 void setfissig(Sfis*, uint);
129 int txmodefis(Sfis*, uchar*, uchar);
130 int atapirwfis(Sfis*, uchar*, uchar*, int, int);
131 int featfis(Sfis*, uchar*, uchar);
132 int flushcachefis(Sfis*, uchar*);
133 int identifyfis(Sfis*, uchar*);
134 int nopfis(Sfis*, uchar*, int);
135 int rwfis(Sfis*, uchar*, int, int, uvlong);
136 void skelfis(uchar*);
137 void sigtofis(Sfis*, uchar*);
138 uvlong fisrw(Sfis*, uchar*, int*);
140 void idmove(char*, ushort*, int);
141 vlong idfeat(Sfis*, ushort*);
142 uvlong idwwn(Sfis*, ushort*);
143 int idss(Sfis*, ushort*);
145 ushort id16(ushort*, int);
146 uint id32(ushort*, int);
147 uvlong id64(ushort*, int);
148 char *pflag(char*, char*, Sfis*);
149 uint fistosig(uchar*);
152 typedef struct Cfis Cfis;
161 void smpskelframe(Cfis*, uchar*, int);
162 uint sashash(uvlong);
163 uchar *sasbhash(uchar*, uchar*);