summaryrefslogtreecommitdiff
path: root/wct4xxp
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-10 20:31:28 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-10 20:31:28 +0000
commit486c64f2c5aae33d0069e37f9f64c8d730985af3 (patch)
treeda787006c12097e2d60b6564493ac0d0ff0ec810 /wct4xxp
parent3487a5e3307be13cc40a2b21bd425ec2fb0e9775 (diff)
report 'location' for cards supported by wct4xxp using the 'order' switches on the card when possible
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3393 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wct4xxp')
-rw-r--r--wct4xxp/base.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/wct4xxp/base.c b/wct4xxp/base.c
index 19611a8..b33c443 100644
--- a/wct4xxp/base.c
+++ b/wct4xxp/base.c
@@ -1514,6 +1514,11 @@ static int t4_close(struct zt_chan *chan)
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 @@ static void init_spans(struct t4 *wc)
}
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 @@ static int t4_hardware_init_1(struct t4 *wc, unsigned int cardflags)
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 @@ static int __devinit t4_init_one(struct pci_dev *pdev, const struct pci_device_i
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 @@ static void __devexit t4_remove_one(struct pci_dev *pdev)
#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++) {