wcte13xp: Trivial. Remove duplicate pointer to "struct pci_dev".

This pointer was left over during the switch to the wcxb library.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
wcte13xp: Remove redundant call to synchronize_irq().

disable_irq() already synchronizes with any running handlers.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
wcte43xp: Close potential unbalanced call to enable_irq().

If the memory allocation for the new channel array fails, it would be possible
to call enable_irq() without the corresponding call to disable_irq().

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
dahdi: Define pf_fmt() globally in kernel.h

Normally the board drivers should define this, but if they do not we will
provide a suitable default. This allows compilation with vanilla Linux 2.6.18.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
wctc4xxp: Trivial. Remove unused timer_list from struct tcb.

The timer_list member of the transcoder buffer has not been used for a long
time. Saves some space in the buffer in addition to removing any future
curiosity about what it is for.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
wcte43x: Trivial fix of 'source' in comment.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
wcte43x: Build against 2.6.18 and CentOS 5.5

This is to support users who are unable to update to the lastest CentOS 5.x.
There is no change for most users on the latest releases of their distribution.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Don't install firmware to /usr/lib/hotplug/firmware

/usr/lib/hotplug/firmware is an old location not used since the move
from the old hotplug system. We no longer need to support it. No need to
keep two copies of the firmware files.

Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
xpp: fix failed multi-PRI E1<->T1 transition

In an Astribank with >= 2 PRI ports, switching from E1 to T1 at run-time
may fail at the DAHDI_CHANCONFIG ioctl on the first channel in a span,
That is, on first run of dahdi_cfg, it fails on second span, on second:
it fails on third span, etc.

The code clears the D-channel information on the DAHDI_CHANCONFIG call
for the first channel in the span.

However The code tested for the global "channo" rather than the per-span
"chanpos" to check for the first channel in the span. This the test
failed.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
xpp: new xbus attribute: dahdi_registration

XPP devices have implicit support for device registration and
unregistration. Even though it is only used for the legacy (non-hotplug)
configuration case, we still prefer to make it explicit.

This attribute would later allow a simpler implementation of the user
space (xpp-specific) tool dahdi_registration.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
xpp: prevent double dahdi un-registration

* It's currently harmless (just re-run the pre/post XPD registrations)
* But it's cleaner this way (as with xbus_register_dahdi_device())

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
xpp: pri: Fix more than a single CAS/R2 call

Fixes regression from bb63d03bbad48f798177dfce62a1ee392d736c57 (before
v2.7.0). This failed to set the PCM mask on a CAS span when
DAHDI_AUDIO_NOTIFY was not set.

As the first channel of each xbus would be enabled (for
synchronization), a single call may still have passed.

This patch sets the PCM mask on any CAS channel explicitly.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
wctc4xxp: Make sure we call the pci_enable_mwi() function.

I've not seen this directly tied to any issue, but it's enabled on the voicebus
cards and so brings the wctc4xxp driver in line.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
wctc4xxp: Disable read-line and read-line-multiple PCI commands.

The read-line-multiple command was already disabled on the voicebus cards, which
use the same interface, in commit 4de462c3e014c612b2aa5bbf7f056c747eb01687. This
does the same thing for the transcoder card and also disables the read line
command.

I've seen this change directly correlated to problems with the AN983 receiving
packets from the onboard DSP on some platforms.

Internal-Issue-ID: DAHDI-1071
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
wctc4xxp: Halt the card when an alert is received.

When an unsolicited alert is received, we'll flag the card as halted so that
commands will not be retried. This is because often times the firmware will no
longer process any commands in this state and the driver will hold processes in
the dstate while waiting to retry the commands.

This is a debugging aide in that it simplies unloading the driver if the card /
driver is currently in a failed state.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
wctc4xxp: Remove unused debug ioctl interface.

The ioctls for the debug network interface on the tc400b0 has not been used for
a long time. It is now gone.

This will also allow the sempahore set in the ioctl to be changed into a mutex
which provides enhanced debugging checks.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
wctc4xxp: Replace channel semaphore with channel mutex.

Clarifies that the semaphore was being used as a mutex. Mutexes are also more
efficient and allow better debugging checks.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
wctc4xxp: Enable the fatal bus error interrupt.

The kernel log will now contain reports if there are bus errors.
This is a troubleshooting aide on systems with bus issues.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
wctc4xxp: Always ack a response packet.

Even if it is duplicated or we don't have an outbound message waiting, we should
ack it so that the firmware does not keep trying to send it to the host.
Otherwise the firmware could get into situations where it was constantly
retrying to send packets for which it did not receive our previous ACK and
exhaust memory.

I was only seeing this on platforms were packets were going missing in the
stream, increasing the probability that the driver would miss early responses.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
wctc4xxp: Check for shutdown after acquiring the mutex lock.

In case we missed an alert, this will allow for rapid shutdown of Asterisk.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>