ieee1394: add definitions for phy packet constants
authorStefan Richter <stefanr@s5r6.in-berlin.de>
Thu, 1 Dec 2005 23:51:56 +0000 (18:51 -0500)
committerJody McIntyre <scjody@modernduck.com>
Thu, 1 Dec 2005 23:51:56 +0000 (18:51 -0500)
Introduce new macros related to phy packets and use them in ieee1394_core and
nodemgr.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Jody McIntyre <scjody@modernduck.com>
drivers/ieee1394/ieee1394.h
drivers/ieee1394/ieee1394_core.c
drivers/ieee1394/nodemgr.c

index b634a9bb365c9888c8fa3c736a8fa4964094ee56..936d776de00a883bdcd0301f7bde5742e64f1384 100644 (file)
@@ -62,6 +62,7 @@
 extern const char *hpsb_speedto_str[];
 
 
+/* 1394a cable PHY packets */
 #define SELFID_PWRCL_NO_POWER    0x0
 #define SELFID_PWRCL_PROVIDE_15W 0x1
 #define SELFID_PWRCL_PROVIDE_30W 0x2
@@ -76,8 +77,24 @@ extern const char *hpsb_speedto_str[];
 #define SELFID_PORT_NCONN        0x1
 #define SELFID_PORT_NONE         0x0
 
+#define PHYPACKET_LINKON                       0x40000000
+#define PHYPACKET_PHYCONFIG_R                  0x00800000
+#define PHYPACKET_PHYCONFIG_T                  0x00400000
+#define EXTPHYPACKET_TYPE_PING                 0x00000000
+#define EXTPHYPACKET_TYPE_REMOTEACCESS_BASE    0x00040000
+#define EXTPHYPACKET_TYPE_REMOTEACCESS_PAGED   0x00140000
+#define EXTPHYPACKET_TYPE_REMOTEREPLY_BASE     0x000C0000
+#define EXTPHYPACKET_TYPE_REMOTEREPLY_PAGED    0x001C0000
+#define EXTPHYPACKET_TYPE_REMOTECOMMAND                0x00200000
+#define EXTPHYPACKET_TYPE_REMOTECONFIRMATION   0x00280000
+#define EXTPHYPACKET_TYPE_RESUME               0x003C0000
 
-/* 1394a PHY bitmasks */
+#define EXTPHYPACKET_TYPEMASK                  0xC0FC0000
+
+#define PHYPACKET_PORT_SHIFT     24
+#define PHYPACKET_GAPCOUNT_SHIFT 16
+
+/* 1394a PHY register map bitmasks */
 #define PHY_00_PHYSICAL_ID       0xFC
 #define PHY_00_R                 0x02 /* Root */
 #define PHY_00_PS                0x01 /* Power Status*/
index 32a1e016c85e76d2ec80b02dc055621c959b74c2..f2f5e4805b5fc6836a4b35ee8cb8417306605666 100644 (file)
@@ -256,10 +256,14 @@ static int check_selfids(struct hpsb_host *host)
 
         esid = (struct ext_selfid *)(sid - 1);
         while (esid->extended) {
-                if ((esid->porta == 0x2) || (esid->portb == 0x2)
-                    || (esid->portc == 0x2) || (esid->portd == 0x2)
-                    || (esid->porte == 0x2) || (esid->portf == 0x2)
-                    || (esid->portg == 0x2) || (esid->porth == 0x2)) {
+                if ((esid->porta == SELFID_PORT_PARENT) ||
+                   (esid->portb == SELFID_PORT_PARENT) ||
+                   (esid->portc == SELFID_PORT_PARENT) ||
+                   (esid->portd == SELFID_PORT_PARENT) ||
+                   (esid->porte == SELFID_PORT_PARENT) ||
+                   (esid->portf == SELFID_PORT_PARENT) ||
+                   (esid->portg == SELFID_PORT_PARENT) ||
+                   (esid->porth == SELFID_PORT_PARENT)) {
                        HPSB_INFO("SelfIDs failed root check on "
                                  "extended SelfID");
                        return 0;
@@ -268,7 +272,9 @@ static int check_selfids(struct hpsb_host *host)
         }
 
         sid = (struct selfid *)esid;
-        if ((sid->port0 == 0x2) || (sid->port1 == 0x2) || (sid->port2 == 0x2)) {
+       if ((sid->port0 == SELFID_PORT_PARENT) ||
+           (sid->port1 == SELFID_PORT_PARENT) ||
+           (sid->port2 == SELFID_PORT_PARENT)) {
                HPSB_INFO("SelfIDs failed root check");
                return 0;
         }
@@ -303,18 +309,18 @@ static void build_speed_map(struct hpsb_host *host, int nodecount)
                 if (sid->extended) {
                         esid = (struct ext_selfid *)sid;
 
-                        if (esid->porta == 0x3) cldcnt[n]++;
-                        if (esid->portb == 0x3) cldcnt[n]++;
-                        if (esid->portc == 0x3) cldcnt[n]++;
-                        if (esid->portd == 0x3) cldcnt[n]++;
-                        if (esid->porte == 0x3) cldcnt[n]++;
-                        if (esid->portf == 0x3) cldcnt[n]++;
-                        if (esid->portg == 0x3) cldcnt[n]++;
-                        if (esid->porth == 0x3) cldcnt[n]++;
+                       if (esid->porta == SELFID_PORT_CHILD) cldcnt[n]++;
+                       if (esid->portb == SELFID_PORT_CHILD) cldcnt[n]++;
+                       if (esid->portc == SELFID_PORT_CHILD) cldcnt[n]++;
+                       if (esid->portd == SELFID_PORT_CHILD) cldcnt[n]++;
+                       if (esid->porte == SELFID_PORT_CHILD) cldcnt[n]++;
+                       if (esid->portf == SELFID_PORT_CHILD) cldcnt[n]++;
+                       if (esid->portg == SELFID_PORT_CHILD) cldcnt[n]++;
+                       if (esid->porth == SELFID_PORT_CHILD) cldcnt[n]++;
                 } else {
-                        if (sid->port0 == 0x3) cldcnt[n]++;
-                        if (sid->port1 == 0x3) cldcnt[n]++;
-                        if (sid->port2 == 0x3) cldcnt[n]++;
+                       if (sid->port0 == SELFID_PORT_CHILD) cldcnt[n]++;
+                       if (sid->port1 == SELFID_PORT_CHILD) cldcnt[n]++;
+                       if (sid->port2 == SELFID_PORT_CHILD) cldcnt[n]++;
 
                         speedcap[n] = sid->speed;
                         n--;
index b56934edd62b9d46b95b8fa636c29ee378b682ca..f4b6025fde61e6aa493a29a84369f702255d28aa 100644 (file)
@@ -1416,7 +1416,8 @@ static int nodemgr_send_resume_packet(struct hpsb_host *host)
        int ret = 1;
 
        packet = hpsb_make_phypacket(host,
-                       0x003c0000 | NODEID_TO_NODE(host->node_id) << 24);
+                       EXTPHYPACKET_TYPE_RESUME |
+                       NODEID_TO_NODE(host->node_id) << PHYPACKET_PORT_SHIFT);
        if (packet) {
                packet->no_waiter = 1;
                packet->generation = get_hpsb_generation(host);