123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- /* dat.h: include file for vblade AoE target */
- #include <sys/types.h>
- #define nil ((void *)0)
- /*
- * tunable variables
- */
- enum {
- VBLADE_VERSION = 25,
- // Firmware version
- FWV = 0x4000 + VBLADE_VERSION,
- };
- #undef major
- #undef minor
- #undef makedev
- #define major(x) ((x) >> 24 & 0xFF)
- #define minor(x) ((x) & 0xffffff)
- #define makedev(x, y) ((x) << 24 | (y))
- typedef unsigned char uchar;
- //typedef unsigned short ushort;
- #ifdef __FreeBSD__
- typedef unsigned long ulong;
- #else
- //typedef unsigned long ulong;
- #endif
- typedef long long vlong;
- typedef struct Aoehdr Aoehdr;
- typedef struct Ata Ata;
- typedef struct Conf Conf;
- typedef struct Ataregs Ataregs;
- typedef struct Mdir Mdir;
- typedef struct Aoemask Aoemask;
- typedef struct Aoesrr Aoesrr;
- struct Ataregs
- {
- vlong lba;
- uchar cmd;
- uchar status;
- uchar err;
- uchar feature;
- uchar sectors;
- };
- struct Aoehdr
- {
- uchar dst[6];
- uchar src[6];
- ushort type;
- uchar flags;
- uchar error;
- ushort maj;
- uchar min;
- uchar cmd;
- uchar tag[4];
- };
- struct Ata
- {
- Aoehdr h;
- uchar aflag;
- uchar err;
- uchar sectors;
- uchar cmd;
- uchar lba[6];
- uchar resvd[2];
- };
- struct Conf
- {
- Aoehdr h;
- ushort bufcnt;
- ushort firmware;
- uchar scnt;
- uchar vercmd;
- ushort len;
- uchar data[1024];
- };
- // mask directive
- struct Mdir {
- uchar res;
- uchar cmd;
- uchar mac[6];
- };
- struct Aoemask {
- Aoehdr h;
- uchar res;
- uchar cmd;
- uchar merror;
- uchar nmacs;
- // struct Mdir m[0];
- };
- struct Aoesrr {
- Aoehdr h;
- uchar rcmd;
- uchar nmacs;
- // uchar mac[6][nmacs];
- };
- enum {
- AoEver = 1,
- ATAcmd = 0, // command codes
- Config,
- Mask,
- Resrel,
- Resp = (1<<3), // flags
- Error = (1<<2),
- BadCmd = 1,
- BadArg,
- DevUnavailable,
- ConfigErr,
- BadVersion,
- Res,
- Write = (1<<0),
- Async = (1<<1),
- Device = (1<<4),
- Extend = (1<<6),
- Qread = 0,
- Qtest,
- Qprefix,
- Qset,
- Qfset,
- Nretries = 3,
- Nconfig = 1024,
- Bufcount = 16,
- /* mask commands */
- Mread= 0,
- Medit,
- /* mask directives */
- MDnop= 0,
- MDadd,
- MDdel,
- /* mask errors */
- MEunspec= 1,
- MEbaddir,
- MEfull,
- /* header sizes, including aoe hdr */
- Naoehdr= 24,
- Natahdr= Naoehdr + 12,
- Ncfghdr= Naoehdr + 8,
- Nmaskhdr= Naoehdr + 4,
- Nsrrhdr= Naoehdr + 2,
- Nserial= 20,
- };
- extern int shelf, slot;
- extern ulong aoetag;
- extern uchar mac[6];
- extern int bfd; // block file descriptor
- extern int sfd; // socket file descriptor
- extern vlong size; // size of vblade
- extern vlong offset;
- extern char *progname;
- extern char serial[Nserial+1];
|