summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ata')
-rw-r--r--sys/dev/ata/ata-all.c4
-rw-r--r--sys/dev/ata/ata-all.h4
-rw-r--r--sys/dev/ata/ata-chipset.c7
-rw-r--r--sys/dev/ata/ata-lowlevel.c7
-rw-r--r--sys/dev/ata/ata-pci.c2
-rw-r--r--sys/dev/ata/ata_if.m8
6 files changed, 18 insertions, 14 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 85bf333..a2f0bab 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -126,7 +126,7 @@ ata_attach(device_t dev)
/* reset the controller HW, the channel and device(s) */
while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit)
tsleep(&error, PRIBIO, "ataatch", 1);
- ch->hw.reset(ch);
+ ATA_RESET(dev);
ATA_LOCKING(dev, ATA_LF_UNLOCK);
/* setup interrupt delivery */
@@ -201,7 +201,7 @@ ata_reinit(device_t dev)
mtx_unlock(&ch->state_mtx);
/* reset the controller HW, the channel and device(s) */
- ch->hw.reset(ch);
+ ATA_RESET(dev);
/* reinit the children and delete any that fails */
if (!device_get_children(dev, &children, &nchildren)) {
diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h
index c8aeb3c8..141e534 100644
--- a/sys/dev/ata/ata-all.h
+++ b/sys/dev/ata/ata-all.h
@@ -387,7 +387,6 @@ struct ata_dma {
struct ata_lowlevel {
int (*begin_transaction)(struct ata_request *request);
int (*end_transaction)(struct ata_request *request);
- void (*reset)(struct ata_channel *ch);
int (*command)(struct ata_device *atadev, u_int8_t command, u_int64_t lba, u_int16_t count, u_int16_t feature);
};
@@ -472,9 +471,10 @@ void ata_fail_requests(struct ata_channel *ch, device_t dev);
char *ata_cmd2str(struct ata_request *request);
/* ata-lowlevel.c: */
+int ata_getparam(device_t parent, struct ata_device *atadev, u_int8_t command);
void ata_generic_hw(struct ata_channel *ch);
+void ata_generic_reset(struct ata_channel *ch);
int ata_generic_command(struct ata_device *atadev, u_int8_t command, u_int64_t lba, u_int16_t count, u_int16_t feature);
-int ata_getparam(device_t parent, struct ata_device *atadev, u_int8_t command);
/* macros for alloc/free of struct ata_request */
extern uma_zone_t ata_request_zone;
diff --git a/sys/dev/ata/ata-chipset.c b/sys/dev/ata/ata-chipset.c
index afd7472..6bda58b 100644
--- a/sys/dev/ata/ata-chipset.c
+++ b/sys/dev/ata/ata-chipset.c
@@ -1142,6 +1142,7 @@ ata_intel_reset(struct ata_channel *ch)
break;
ata_udelay(10000);
}
+ ata_generic_reset(ch);
}
static void
@@ -2039,6 +2040,7 @@ ata_promise_mio_reset(struct ata_channel *ch)
(ATA_INL(ctlr->r_res2, 0xc012c) & ~0x00000f9f));
hpktp->busy = 0;
mtx_unlock(&hpktp->mtx);
+ ata_generic_reset(ch);
break;
case PRCMBO:
@@ -2065,6 +2067,8 @@ ata_promise_mio_reset(struct ata_channel *ch)
/* reset and enable plug/unplug intr */
ATA_OUTL(ctlr->r_res2, 0x06c, (0x00000011 << ch->unit));
}
+ else
+ ata_generic_reset(ch);
break;
case PRCMBO2:
@@ -2101,7 +2105,10 @@ ata_promise_mio_reset(struct ata_channel *ch)
/* set portmultiplier port */
ATA_OUTL(ctlr->r_res2, 0x4e8 + (ch->unit << 8), 0x00);
}
+ else
+ ata_generic_reset(ch);
break;
+
}
}
diff --git a/sys/dev/ata/ata-lowlevel.c b/sys/dev/ata/ata-lowlevel.c
index b6bf9e1..a723fa9 100644
--- a/sys/dev/ata/ata-lowlevel.c
+++ b/sys/dev/ata/ata-lowlevel.c
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
/* prototypes */
static int ata_begin_transaction(struct ata_request *);
static int ata_end_transaction(struct ata_request *);
-static void ata_generic_reset(struct ata_channel *);
static int ata_wait(struct ata_channel *ch, struct ata_device *, u_int8_t);
static void ata_pio_read(struct ata_request *, int);
static void ata_pio_write(struct ata_request *, int);
@@ -158,7 +157,6 @@ ata_generic_hw(struct ata_channel *ch)
{
ch->hw.begin_transaction = ata_begin_transaction;
ch->hw.end_transaction = ata_end_transaction;
- ch->hw.reset = ata_generic_reset;
ch->hw.command = ata_generic_command;
}
@@ -623,16 +621,13 @@ end_continue:
}
/* must be called with ATA channel locked */
-static void
+void
ata_generic_reset(struct ata_channel *ch)
{
u_int8_t ostat0 = 0, stat0 = 0, ostat1 = 0, stat1 = 0;
u_int8_t err = 0, lsb = 0, msb = 0;
int mask = 0, timeout;
- /* reset controller (host) */
- ATA_RESET(ch->dev);
-
/* do we have any signs of ATA/ATAPI HW being present ? */
ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_MASTER);
DELAY(10);
diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c
index 0401bdf..8e1a073 100644
--- a/sys/dev/ata/ata-pci.c
+++ b/sys/dev/ata/ata-pci.c
@@ -574,6 +574,8 @@ ata_pcichannel_reset(device_t dev)
/* reset the controller HW */
if (ctlr->reset)
ctlr->reset(ch);
+ else
+ ata_generic_reset(ch);
}
static void
diff --git a/sys/dev/ata/ata_if.m b/sys/dev/ata/ata_if.m
index 0f84447..448cb53 100644
--- a/sys/dev/ata/ata_if.m
+++ b/sys/dev/ata/ata_if.m
@@ -58,15 +58,15 @@ HEADER {
#define ATA_LF_WHICH 0x0004
};
-METHOD void reset {
- device_t channel;
-};
-
METHOD void setmode {
device_t channel;
device_t dev;
};
+METHOD void reset {
+ device_t channel;
+} DEFAULT ata_generic_reset;
+
METHOD int reinit {
device_t dev;
};
OpenPOWER on IntegriCloud