Mercurial > hvf > hvf-old
changeset 530:94dc1afb9214
cp: added definitions for format-0 ccws & conversion function
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Tue, 26 Apr 2011 09:31:31 -0400 |
parents | 3879c28965b4 |
children | 055987394405 |
files | cp/include/channel.h |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/cp/include/channel.h Mon Apr 25 22:45:28 2011 -0400 +++ b/cp/include/channel.h Tue Apr 26 09:31:31 2011 -0400 @@ -18,6 +18,8 @@ u32 addr; /* Data Address */ } __attribute__((packed,aligned(8))); +#define CCW0_ADDR(c) ((((u64)((c)->addr_hi)) << 16) | (((u64)((c)->addr_lo)))) + struct ccw0 { u8 cmd; /* Command code */ u8 addr_hi; /* Data Address (bits 8-15) */ @@ -27,6 +29,7 @@ u16 count; /* Count */ } __attribute__((packed,aligned(8))); +#define CCW_CMD_INVAL 0x00 #define CCW_CMD_IPL_READ 0x02 #define CCW_CMD_NOP 0x03 #define CCW_CMD_BASIC_SENSE 0x04 @@ -42,6 +45,16 @@ #define CCW_FLAG_S 0x02 /* Suspend */ #define CCW_FLAG_MIDA 0x01 /* Modified-Indirect-Data-Address */ +static inline void ccw0_to_ccw1(struct ccw *out, struct ccw0 *in) +{ + /* 0x08 is TIC; format-0 CCWs allow upper nibble to be non-zero */ + out->cmd = ((in->cmd & 0x0f) == CCW_CMD_TIC) ? + CCW_CMD_TIC : in->cmd; + out->flags = in->flags; + out->count = in->count; + out->addr = CCW0_ADDR(in); +} + /* * ORB */