[zaptel-commits] kpfleming: branch 1.4 r3393 - /branches/1.4/wct4xxp/base.c

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Mon Dec 10 14:31:29 CST 2007


Author: kpfleming
Date: Mon Dec 10 14:31:28 2007
New Revision: 3393

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3393
Log:
report 'location' for cards supported by wct4xxp using the 'order' switches on the card when possible

Modified:
    branches/1.4/wct4xxp/base.c

Modified: branches/1.4/wct4xxp/base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wct4xxp/base.c?view=diff&rev=3393&r1=3392&r2=3393
==============================================================================
--- branches/1.4/wct4xxp/base.c (original)
+++ branches/1.4/wct4xxp/base.c Mon Dec 10 14:31:28 2007
@@ -1514,6 +1514,11 @@
 	return 0;
 }
 
+/* The number of cards we have seen with each
+   possible 'order' switch setting.
+*/
+static unsigned int order_index[16];
+
 static void init_spans(struct t4 *wc)
 {
 	int x,y;
@@ -1540,9 +1545,12 @@
 		}
 		snprintf(ts->span.devicetype, sizeof(ts->span.devicetype) - 1, "%s%s", wc->variety,
 			 (wc->vpm != T4_VPM_PRESENT) ? "" : (wc->vpm450m) ? " with VPM450M" : "with VPM400M");
-		snprintf(ts->span.location, sizeof(ts->span.location) - 1,
-			 "PCI%s Bus %02d Slot %02d", (ts->spanflags & FLAG_EXPRESS) ? " Express" : " ",
-			 wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+		if (order_index[wc->order] == 1)
+			snprintf(ts->span.location, sizeof(ts->span.location) - 1, "Board ID Switch %d", wc->order);
+		else
+			snprintf(ts->span.location, sizeof(ts->span.location) - 1,
+				 "PCI%s Bus %02d Slot %02d", (ts->spanflags & FLAG_EXPRESS) ? " Express" : " ",
+				 wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
 		switch (ts->spantype) {
 		case TYPE_T1:
 			ts->span.spantype = "T1";
@@ -3416,6 +3424,7 @@
 	else
 		wc->t1e1 = ((t4_pci_in(wc, WC_LEDS)) & 0x0f00) >> 8;
 	wc->order = ((t4_pci_in(wc, WC_LEDS)) & 0xf0000000) >> 28;
+	order_index[wc->order]++;
 	return 0;
 }
 
@@ -3639,8 +3648,7 @@
 			init_spans(wc);
 
 			/* Launch cards as appropriate */
-			x = 0;
-			for(;;) {
+			for (;;) {
 				/* Find a card to activate */
 				f = 0;
 				for (x=0;cards[x];x++) {
@@ -3758,6 +3766,9 @@
 #if 1
 		free_irq(pdev->irq, wc);
 #endif		
+
+		order_index[wc->order]--;
+
 		cards[wc->num] = NULL;
 		pci_set_drvdata(pdev, NULL);
 		for (x=0;x<wc->numspans;x++) {




More information about the zaptel-commits mailing list