]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/ieee1394/ieee1394_core.c
ieee1394: add definitions for phy packet constants
[mv-sheeva.git] / drivers / ieee1394 / ieee1394_core.c
index b248d89de8b4e26c543d5b30c2bd7a187d657059..f2f5e4805b5fc6836a4b35ee8cb8417306605666 100644 (file)
@@ -70,7 +70,7 @@ const char *hpsb_speedto_str[] = { "S100", "S200", "S400", "S800", "S1600", "S32
 struct class *hpsb_protocol_class;
 
 #ifdef CONFIG_IEEE1394_VERBOSEDEBUG
-static void dump_packet(const char *text, quadlet_t *data, int size)
+static void dump_packet(const char *text, quadlet_t *data, int size, int speed)
 {
        int i;
 
@@ -78,12 +78,15 @@ static void dump_packet(const char *text, quadlet_t *data, int size)
        size = (size > 4 ? 4 : size);
 
        printk(KERN_DEBUG "ieee1394: %s", text);
+       if (speed > -1 && speed < 6)
+               printk(" at %s", hpsb_speedto_str[speed]);
+       printk(":");
        for (i = 0; i < size; i++)
                printk(" %08x", data[i]);
        printk("\n");
 }
 #else
-#define dump_packet(x,y,z)
+#define dump_packet(a,b,c,d)
 #endif
 
 static void abort_requests(struct hpsb_host *host);
@@ -253,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;
@@ -265,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;
         }
@@ -300,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--;
@@ -544,8 +553,7 @@ int hpsb_send_packet(struct hpsb_packet *packet)
                 if (packet->data_size)
                        memcpy(((u8*)data) + packet->header_size, packet->data, packet->data_size);
 
-                dump_packet("send packet local:", packet->header,
-                            packet->header_size);
+                dump_packet("send packet local", packet->header, packet->header_size, -1);
 
                 hpsb_packet_sent(host, packet, packet->expect_response ? ACK_PENDING : ACK_COMPLETE);
                 hpsb_packet_received(host, data, size, 0);
@@ -561,21 +569,7 @@ int hpsb_send_packet(struct hpsb_packet *packet)
                                        + NODEID_TO_NODE(packet->node_id)];
         }
 
-#ifdef CONFIG_IEEE1394_VERBOSEDEBUG
-        switch (packet->speed_code) {
-        case 2:
-                dump_packet("send packet 400:", packet->header,
-                            packet->header_size);
-                break;
-        case 1:
-                dump_packet("send packet 200:", packet->header,
-                            packet->header_size);
-                break;
-        default:
-                dump_packet("send packet 100:", packet->header,
-                            packet->header_size);
-        }
-#endif
+        dump_packet("send packet", packet->header, packet->header_size, packet->speed_code);
 
         return host->driver->transmit_packet(host, packet);
 }
@@ -636,7 +630,7 @@ static void handle_packet_response(struct hpsb_host *host, int tcode,
 
        if (packet == NULL) {
                 HPSB_DEBUG("unsolicited response packet received - no tlabel match");
-                dump_packet("contents:", data, 16);
+                dump_packet("contents", data, 16, -1);
                spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
                 return;
         }
@@ -677,11 +671,11 @@ static void handle_packet_response(struct hpsb_host *host, int tcode,
         if (!tcode_match) {
                spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
                 HPSB_INFO("unsolicited response packet received - tcode mismatch");
-                dump_packet("contents:", data, 16);
+                dump_packet("contents", data, 16, -1);
                 return;
         }
 
-       __skb_unlink(skb, skb->list);
+       __skb_unlink(skb, &host->pending_packet_queue);
 
        if (packet->state == hpsb_queued) {
                packet->sendtime = jiffies;
@@ -914,7 +908,7 @@ void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size,
                 return;
         }
 
-        dump_packet("received packet:", data, size);
+        dump_packet("received packet", data, size, -1);
 
         tcode = (data[0] >> 4) & 0xf;
 
@@ -989,7 +983,7 @@ void abort_timedouts(unsigned long __opaque)
                packet = (struct hpsb_packet *)skb->data;
 
                if (time_before(packet->sendtime + expire, jiffies)) {
-                       __skb_unlink(skb, skb->list);
+                       __skb_unlink(skb, &host->pending_packet_queue);
                        packet->state = hpsb_complete;
                        packet->ack_code = ACKX_TIMEOUT;
                        queue_packet_complete(packet);