summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorsimokawa <simokawa@FreeBSD.org>2003-01-24 12:45:19 +0000
committersimokawa <simokawa@FreeBSD.org>2003-01-24 12:45:19 +0000
commit14df48f9953febe4b9b0e84b1926c490ca39c9e4 (patch)
treedb0a3115817f052960e1ba49436b6bfa6c73039e /sys
parente15ccd761313273ab1326f65bf8cd686d39157b3 (diff)
downloadFreeBSD-src-14df48f9953febe4b9b0e84b1926c490ca39c9e4.zip
FreeBSD-src-14df48f9953febe4b9b0e84b1926c490ca39c9e4.tar.gz
Merge little and big endian case.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/firewire/firewire.h340
-rw-r--r--sys/dev/firewire/sbp.c38
2 files changed, 127 insertions, 251 deletions
diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h
index a30ce8a..f31496b 100644
--- a/sys/dev/firewire/firewire.h
+++ b/sys/dev/firewire/firewire.h
@@ -40,6 +40,7 @@
#define DEV_DEF 0
#define DEV_DV 2
+#if 0
struct dv_data{
u_int32_t n_write;
u_int32_t a_write;
@@ -60,6 +61,7 @@ struct dv_data_req_t {
unsigned long len;
unsigned long off;
};
+#endif
struct fw_isochreq {
unsigned char ch:6,
@@ -74,7 +76,7 @@ struct fw_isobufreq {
} tx, rx;
};
-struct fw_addr{
+struct fw_addr {
unsigned long hi;
unsigned long lo;
};
@@ -84,7 +86,7 @@ struct fw_asybindreq {
unsigned long len;
};
-struct fw_reg_req_t{
+struct fw_reg_req_t {
unsigned long addr;
unsigned long data;
};
@@ -125,12 +127,15 @@ struct fw_reg_req_t{
#define FWP_TL_VALID (1 << 7)
-struct fw_isohdr{
+struct fw_isohdr {
u_int32_t hdr[1];
};
-struct fw_asyhdr{
+
+struct fw_asyhdr {
u_int32_t hdr[4];
};
+
+#if 0
#define FWPHYSIDSUBS(SID) (((SID) >> 23) & 1)
#define FWPHYSIDNODE(SID) (((SID) >> 24) & 0x3f)
#define FWPHYSIDLINK(SID) (((SID) >> 22) & 1)
@@ -153,108 +158,111 @@ struct fw_asyhdr{
#define FWPHYSIDPF(SID) (((SID) >> 6) & 0x3)
#define FWPHYSIDPG(SID) (((SID) >> 4) & 0x3)
#define FWPHYSIDPH(SID) (((SID) >> 2) & 0x3)
-struct fw_pkt{
-#if BYTE_ORDER == LITTLE_ENDIAN
- union{
+#endif
+
+struct fw_pkt {
+ union {
u_int32_t ld[0];
struct {
- u_int32_t :28,
+ u_int16_t :16;
+ u_int8_t :8;
+ u_int8_t :4,
tcode:4;
- }common;
+ } common;
struct {
u_int16_t len;
- u_int8_t chtag;
- u_int8_t sy:4,
- tcode:4;
+ u_int8_t chtag;
+ u_int8_t sy:4,
+ tcode:4;
u_int32_t payload[0];
- }stream;
+ } stream;
struct {
u_int16_t dst;
- u_int8_t tlrt;
- u_int8_t pri:4,
- tcode:4;
+ u_int8_t tlrt;
+ u_int8_t pri:4,
+ tcode:4;
u_int16_t src;
- }hdr;
+ } hdr;
struct {
u_int16_t dst;
- u_int8_t tlrt;
- u_int8_t pri:4,
- tcode:4;
+ u_int8_t tlrt;
+ u_int8_t pri:4,
+ tcode:4;
u_int16_t src;
u_int16_t dest_hi;
u_int32_t dest_lo;
- }rreqq;
+ } rreqq;
struct {
u_int16_t dst;
- u_int8_t tlrt;
- u_int8_t pri:4,
- tcode:4;
+ u_int8_t tlrt;
+ u_int8_t pri:4,
+ tcode:4;
u_int16_t src;
- u_int16_t res1:4,
- rtcode:4,
- res2:8;
- u_int32_t res3;
- }wres;
+ u_int8_t :4,
+ rtcode:4;
+ u_int8_t :8;
+ u_int32_t :32;
+ } wres;
struct {
u_int16_t dst;
- u_int8_t tlrt;
- u_int8_t pri:4,
- tcode:4;
+ u_int8_t tlrt;
+ u_int8_t pri:4,
+ tcode:4;
u_int16_t src;
u_int16_t dest_hi;
u_int32_t dest_lo;
u_int16_t len;
u_int16_t extcode:16;
- }rreqb;
+ } rreqb;
struct {
u_int16_t dst;
- u_int8_t tlrt;
- u_int8_t pri:4,
- tcode:4;
+ u_int8_t tlrt;
+ u_int8_t pri:4,
+ tcode:4;
u_int16_t src;
- u_int16_t dest_hi:16;
+ u_int16_t dest_hi;
u_int32_t dest_lo;
u_int32_t data;
- }wreqq;
+ } wreqq;
struct {
u_int16_t dst;
- u_int8_t tlrt;
- u_int8_t pri:4,
- tcode:4;
+ u_int8_t tlrt;
+ u_int8_t pri:4,
+ tcode:4;
u_int16_t src;
u_int16_t dest_hi;
u_int32_t dest_lo;
u_int32_t data;
- }cyc;
+ } cyc;
struct {
u_int16_t dst;
- u_int8_t tlrt;
- u_int8_t pri:4,
- tcode:4;
+ u_int8_t tlrt;
+ u_int8_t pri:4,
+ tcode:4;
u_int16_t src;
- u_int16_t res1:4,
- rtcode:4,
- res2:8;
- u_int32_t res3;
+ u_int8_t :4,
+ rtcode:4;
+ u_int8_t :8;
+ u_int32_t :32;
u_int32_t data;
- }rresq;
+ } rresq;
struct {
u_int16_t dst;
- u_int8_t tlrt;
- u_int8_t pri:4,
- tcode:4;
+ u_int8_t tlrt;
+ u_int8_t pri:4,
+ tcode:4;
u_int16_t src;
u_int16_t dest_hi;
u_int32_t dest_lo;
u_int16_t len;
u_int16_t extcode;
u_int32_t payload[0];
- }wreqb;
+ } wreqb;
struct {
u_int16_t dst;
- u_int8_t tlrt;
- u_int8_t pri:4,
- tcode:4;
+ u_int8_t tlrt;
+ u_int8_t pri:4,
+ tcode:4;
u_int16_t src;
u_int16_t dest_hi;
u_int32_t dest_lo;
@@ -267,182 +275,42 @@ struct fw_pkt{
#define FW_LREQ_BDADD 5
#define FW_LREQ_WRADD 6
u_int32_t payload[0];
- }lreq;
+ } lreq;
struct {
u_int16_t dst;
- u_int8_t tlrt;
- u_int8_t pri:4,
- tcode:4;
- u_int16_t src;
- u_int16_t res1:4,
- rtcode:4,
- res2:8;
- u_int32_t res3;
- u_int16_t len;
- u_int16_t extcode;
- u_int32_t payload[0];
- }rresb;
- struct {
- u_int16_t dst;
- u_int8_t tlrt;
- u_int8_t pri:4,
- tcode:4;
+ u_int8_t tlrt;
+ u_int8_t pri:4,
+ tcode:4;
u_int16_t src;
- u_int16_t res1:4,
- rtcode:4,
- res2:8;
- u_int32_t res3;
+ u_int8_t :4,
+ rtcode:4;
+ u_int8_t :8;
+ u_int32_t :32;
u_int16_t len;
u_int16_t extcode;
u_int32_t payload[0];
- }lres;
- }mode;
-#else
- union{
- u_int32_t ld[0];
- struct {
- u_int32_t :4,
- tcode:4,
- :24;
- }common;
- struct {
- u_int8_t sy:4,
- tcode:4;
- u_int8_t chtag;
- u_int16_t len;
- u_int32_t payload[0];
- }stream;
- struct {
- u_int32_t pri:4,
- tcode:4,
- tlrt:8,
- dst:16;
- u_int32_t :16,
- src:16;
- }hdr;
- struct {
- u_int8_t pri:4,
- tcode:4;
- u_int8_t tlrt;
- u_int16_t dst;
- u_int16_t dest_hi;
- u_int16_t src;
- u_int32_t dest_lo;
- }rreqq;
- struct {
- u_int8_t pri:4,
- tcode:4;
- u_int8_t tlrt;
- u_int16_t dst;
- u_int16_t res1:12,
- rtcode:4;
- u_int16_t src;
- u_int32_t res3;
- }wres;
- struct {
- u_int8_t pri:4,
- tcode:4;
- u_int8_t tlrt;
- u_int16_t dst;
- u_int16_t dest_hi;
- u_int16_t src;
- u_int32_t dest_lo;
- u_int16_t extcode:16;
- u_int16_t len;
- }rreqb;
- struct {
- u_int8_t pri:4,
- tcode:4;
- u_int8_t tlrt;
- u_int16_t dst;
- u_int16_t dest_hi:16;
- u_int16_t src;
- u_int32_t dest_lo;
- u_int32_t data;
- }wreqq;
- struct {
- u_int8_t pri:4,
- tcode:4;
- u_int8_t tlrt;
- u_int16_t dst;
- u_int16_t dest_hi;
- u_int16_t src;
- u_int32_t dest_lo;
- u_int32_t data;
- }cyc;
+ } rresb;
struct {
- u_int8_t pri:4,
- tcode:4;
- u_int8_t tlrt;
u_int16_t dst;
- u_int16_t res1:12,
- rtcode:4;
- u_int16_t src;
- u_int32_t res3;
- u_int32_t data;
- }rresq;
- struct {
- u_int8_t pri:4,
- tcode:4;
u_int8_t tlrt;
- u_int16_t dst;
- u_int16_t dest_hi;
- u_int16_t src;
- u_int32_t dest_lo;
- u_int16_t extcode;
- u_int16_t len;
- u_int32_t payload[0];
- }wreqb;
- struct {
u_int8_t pri:4,
tcode:4;
- u_int8_t tlrt;
- u_int16_t dst;
- u_int16_t dest_hi;
u_int16_t src;
- u_int32_t dest_lo;
- u_int16_t extcode;
- u_int16_t len;
-#define FW_LREQ_MSKSWAP 1
-#define FW_LREQ_CMPSWAP 2
-#define FW_LREQ_FTADD 3
-#define FW_LREQ_LTADD 4
-#define FW_LREQ_BDADD 5
-#define FW_LREQ_WRADD 6
- u_int32_t payload[0];
- }lreq;
- struct {
- u_int8_t pri:4,
- tcode:4;
- u_int8_t tlrt;
- u_int16_t dst;
- u_int16_t res1:12,
+ u_int8_t :4,
rtcode:4;
- u_int16_t src;
- u_int32_t res3;
- u_int16_t extcode;
+ u_int8_t :8;
+ u_int32_t :32;
u_int16_t len;
- u_int32_t payload[0];
- }rresb;
- struct {
- u_int8_t pri:4,
- tcode:4;
- u_int8_t tlrt;
- u_int16_t dst;
- u_int16_t res1:12,
- rtcode:4;
- u_int16_t src;
- u_int32_t res3;
u_int16_t extcode;
- u_int16_t len;
u_int32_t payload[0];
- }lres;
- }mode;
-#endif
+ } lres;
+ } mode;
};
+
struct fw_eui64 {
u_int32_t hi, lo;
};
+
struct fw_asyreq {
struct fw_asyreq_t{
unsigned char sped;
@@ -459,16 +327,19 @@ struct fw_asyreq {
struct fw_pkt pkt;
u_int32_t data[512];
};
+
struct fw_devlstreq {
int n;
struct fw_eui64 eui[64];
u_int16_t dst[64];
u_int16_t status[64];
};
+
#define FW_SELF_ID_PORT_CONNECTED_TO_CHILD 3
#define FW_SELF_ID_PORT_CONNECTED_TO_PARENT 2
#define FW_SELF_ID_PORT_NOT_CONNECTED 1
#define FW_SELF_ID_PORT_NOT_EXISTS 0
+#if 0
union fw_self_id {
struct {
u_int32_t more_packets:1,
@@ -504,6 +375,45 @@ union fw_self_id {
id:2;
} p1;
};
+#else
+union fw_self_id {
+ struct {
+ u_int8_t more_packets:1,
+ initiated_reset:1,
+ port2:2,
+ port1:2,
+ port0:2;
+ u_int8_t power_class:3,
+ contender:1,
+ phy_delay:2,
+ phy_speed:2;
+ u_int8_t gap_count:6,
+ link_active:1,
+ sequel:1;
+ u_int8_t phy_id:6,
+ id:2;
+ } p0;
+ struct {
+ u_int8_t more_packets:1,
+ reserved1:1,
+ porth:2,
+ portg:2,
+ portf:2;
+ u_int8_t porte:2,
+ portd:2,
+ portc:2,
+ portb:2;
+ u_int8_t porta:2,
+ reserved2:2,
+ sequence_num:3,
+ sequel:1;
+ u_int8_t phy_id:6,
+ id:2;
+ } p1;
+};
+#endif
+
+
struct fw_topology_map {
u_int32_t crc:16,
crc_len:16;
@@ -512,21 +422,25 @@ struct fw_topology_map {
node_count:16;
union fw_self_id self_id[4*64];
};
+
struct fw_speed_map {
u_int32_t crc:16,
crc_len:16;
u_int32_t generation;
u_int8_t speed[64][64];
};
+
struct fw_map_buf {
int len;
void *ptr;
};
+
struct fw_crom_buf {
struct fw_eui64 eui;
int len;
void *ptr;
};
+
#define FWSTMAXCHUNK 16
/*
* FireWire specific system requests.
diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c
index 43da1cd..51ec83c 100644
--- a/sys/dev/firewire/sbp.c
+++ b/sys/dev/firewire/sbp.c
@@ -169,7 +169,6 @@ struct sbp_ocb {
#define SBP_RESOURCE_SHORTAGE 0x10
struct sbp_login_res{
-#if FW_ENDIANSWAP == 0 && BYTE_ORDER == LITTLE_ENDIAN
u_int16_t len;
u_int16_t id;
u_int16_t res0;
@@ -177,18 +176,8 @@ struct sbp_login_res{
u_int32_t cmd_lo;
u_int16_t res1;
u_int16_t recon_hold;
-#else
- u_int16_t id;
- u_int16_t len;
- u_int16_t cmd_hi;
- u_int16_t res0;
- u_int32_t cmd_lo;
- u_int16_t recon_hold;
- u_int16_t res1;
-#endif
};
struct sbp_status{
-#if FW_ENDIANSWAP == 0 && BYTE_ORDER == LITTLE_ENDIAN
u_int8_t len:3,
dead:1,
resp:2,
@@ -197,21 +186,10 @@ struct sbp_status{
u_int16_t orb_hi;
u_int32_t orb_lo;
u_int32_t data[6];
-#else
- u_int16_t orb_hi;
- u_int8_t status:8;
- u_int8_t len:3,
- dead:1,
- resp:2,
- src:2;
- u_int32_t orb_lo;
- u_int32_t data[6];
-#endif
};
struct sbp_cmd_status{
#define SBP_SFMT_CURR 0
#define SBP_SFMT_DEFER 1
-#if FW_ENDIANSWAP == 0 && BYTE_ORDER == LITTLE_ENDIAN
u_int8_t status:6,
sfmt:2;
u_int8_t s_key:4,
@@ -226,22 +204,6 @@ struct sbp_cmd_status{
u_int32_t fru:8,
s_keydep:24;
u_int32_t vend[2];
-#else
- u_int8_t s_qlfr;
- u_int8_t s_code;
- u_int8_t s_key:4,
- ill_len:1,
- eom:1,
- mark:1,
- valid:1;
- u_int8_t status:6,
- sfmt:2;
- u_int32_t info;
- u_int32_t cdb;
- u_int32_t s_keydep:24,
- fru:8;
- u_int32_t vend[2];
-#endif
};
struct sbp_dev{
OpenPOWER on IntegriCloud