From 486c64f2c5aae33d0069e37f9f64c8d730985af3 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Mon, 10 Dec 2007 20:31:28 +0000 Subject: 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 --- wct4xxp/base.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'wct4xxp') 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;xnumspans;x++) { -- cgit v1.2.3