summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/chipsets/ata-acard.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ata/chipsets/ata-acard.c')
-rw-r--r--sys/dev/ata/chipsets/ata-acard.c100
1 files changed, 0 insertions, 100 deletions
diff --git a/sys/dev/ata/chipsets/ata-acard.c b/sys/dev/ata/chipsets/ata-acard.c
index e66224f..bfa15e4 100644
--- a/sys/dev/ata/chipsets/ata-acard.c
+++ b/sys/dev/ata/chipsets/ata-acard.c
@@ -51,25 +51,12 @@ __FBSDID("$FreeBSD$");
#include <dev/ata/ata-pci.h>
#include <ata_if.h>
-#ifndef ATA_CAM
-struct ata_serialize {
- struct mtx locked_mtx;
- int locked_ch;
- int restart_ch;
-};
-#endif
-
/* local prototypes */
static int ata_acard_chipinit(device_t dev);
static int ata_acard_ch_attach(device_t dev);
static int ata_acard_status(device_t dev);
static int ata_acard_850_setmode(device_t dev, int target, int mode);
static int ata_acard_86X_setmode(device_t dev, int target, int mode);
-#ifndef ATA_CAM
-static int ata_acard_chipdeinit(device_t dev);
-static int ata_serialize(device_t dev, int flags);
-static void ata_serialize_init(struct ata_serialize *serial);
-#endif
/* misc defines */
#define ATP_OLD 1
@@ -97,9 +84,6 @@ ata_acard_probe(device_t dev)
ata_set_desc(dev);
ctlr->chipinit = ata_acard_chipinit;
-#ifndef ATA_CAM
- ctlr->chipdeinit = ata_acard_chipdeinit;
-#endif
return (BUS_PROBE_DEFAULT);
}
@@ -107,9 +91,6 @@ static int
ata_acard_chipinit(device_t dev)
{
struct ata_pci_controller *ctlr = device_get_softc(dev);
-#ifndef ATA_CAM
- struct ata_serialize *serial;
-#endif
if (ata_setup_interrupt(dev, ata_generic_intr))
return ENXIO;
@@ -118,40 +99,15 @@ ata_acard_chipinit(device_t dev)
ctlr->ch_detach = ata_pci_ch_detach;
if (ctlr->chip->cfg1 == ATP_OLD) {
ctlr->setmode = ata_acard_850_setmode;
-#ifndef ATA_CAM
- ctlr->locking = ata_serialize;
- serial = malloc(sizeof(struct ata_serialize),
- M_ATAPCI, M_WAITOK | M_ZERO);
- ata_serialize_init(serial);
- ctlr->chipset_data = serial;
-#else
/* Work around the lack of channel serialization in ATA_CAM. */
ctlr->channels = 1;
device_printf(dev, "second channel ignored\n");
-#endif
}
else
ctlr->setmode = ata_acard_86X_setmode;
return 0;
}
-#ifndef ATA_CAM
-static int
-ata_acard_chipdeinit(device_t dev)
-{
- struct ata_pci_controller *ctlr = device_get_softc(dev);
- struct ata_serialize *serial;
-
- if (ctlr->chip->cfg1 == ATP_OLD) {
- serial = ctlr->chipset_data;
- mtx_destroy(&serial->locked_mtx);
- free(serial, M_ATAPCI);
- ctlr->chipset_data = NULL;
- }
- return (0);
-}
-#endif
-
static int
ata_acard_ch_attach(device_t dev)
{
@@ -169,12 +125,8 @@ ata_acard_ch_attach(device_t dev)
static int
ata_acard_status(device_t dev)
{
- struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
struct ata_channel *ch = device_get_softc(dev);
- if (ctlr->chip->cfg1 == ATP_OLD &&
- ATA_LOCKING(dev, ATA_LF_WHICH) != ch->unit)
- return 0;
if (ch->dma.flags & ATA_DMA_ACTIVE) {
int bmstat = ATA_IDX_INB(ch, ATA_BMSTAT_PORT) & ATA_BMSTAT_MASK;
@@ -243,56 +195,4 @@ ata_acard_86X_setmode(device_t dev, int target, int mode)
return (mode);
}
-#ifndef ATA_CAM
-static void
-ata_serialize_init(struct ata_serialize *serial)
-{
-
- mtx_init(&serial->locked_mtx, "ATA serialize lock", NULL, MTX_DEF);
- serial->locked_ch = -1;
- serial->restart_ch = -1;
-}
-
-static int
-ata_serialize(device_t dev, int flags)
-{
- struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
- struct ata_channel *ch = device_get_softc(dev);
- struct ata_serialize *serial;
- int res;
-
- serial = ctlr->chipset_data;
-
- mtx_lock(&serial->locked_mtx);
- switch (flags) {
- case ATA_LF_LOCK:
- if (serial->locked_ch == -1)
- serial->locked_ch = ch->unit;
- if (serial->locked_ch != ch->unit)
- serial->restart_ch = ch->unit;
- break;
-
- case ATA_LF_UNLOCK:
- if (serial->locked_ch == ch->unit) {
- serial->locked_ch = -1;
- if (serial->restart_ch != -1) {
- if ((ch = ctlr->interrupt[serial->restart_ch].argument)) {
- serial->restart_ch = -1;
- mtx_unlock(&serial->locked_mtx);
- ata_start(dev);
- return -1;
- }
- }
- }
- break;
-
- case ATA_LF_WHICH:
- break;
- }
- res = serial->locked_ch;
- mtx_unlock(&serial->locked_mtx);
- return res;
-}
-#endif
-
ATA_DECLARE_DRIVER(ata_acard);
OpenPOWER on IntegriCloud