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 physalign; /* location of lba0 within phys0 */
106 uint c; /* disgusting, no? */
112 Dlba = 1<<0, /* required for sata */
129 void setfissig(Sfis*, uint);
130 int txmodefis(Sfis*, uchar*, uchar);
131 int atapirwfis(Sfis*, uchar*, uchar*, int, int);
132 int featfis(Sfis*, uchar*, uchar);
133 int flushcachefis(Sfis*, uchar*);
134 int identifyfis(Sfis*, uchar*);
135 int nopfis(Sfis*, uchar*, int);
136 int rwfis(Sfis*, uchar*, int, int, uvlong);
137 void skelfis(uchar*);
138 void sigtofis(Sfis*, uchar*);
139 uvlong fisrw(Sfis*, uchar*, int*);
141 void idmove(char*, ushort*, int);
142 vlong idfeat(Sfis*, ushort*);
143 uvlong idwwn(Sfis*, ushort*);
144 int idss(Sfis*, ushort*);
146 ushort id16(ushort*, int);
147 uint id32(ushort*, int);
148 uvlong id64(ushort*, int);
149 char *pflag(char*, char*, Sfis*);
150 uint fistosig(uchar*);
153 typedef struct Cfis Cfis;
162 void smpskelframe(Cfis*, uchar*, int);
163 uint sashash(uvlong);
164 uchar *sasbhash(uchar*, uchar*);