summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/chipsets/ata-via.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2010-10-18 11:30:13 +0000
committermav <mav@FreeBSD.org>2010-10-18 11:30:13 +0000
commitd5157b74694d4a37a03c0245b1681f20321cd062 (patch)
treefd926a601552c1bcf585c33dddb137654dc80a3f /sys/dev/ata/chipsets/ata-via.c
parentc2ef20d77bba663f8ce180c864d82fee39cb3482 (diff)
downloadFreeBSD-src-d5157b74694d4a37a03c0245b1681f20321cd062.zip
FreeBSD-src-d5157b74694d4a37a03c0245b1681f20321cd062.tar.gz
Set of legacy mode SATA enchancements:
- Implement proper combined mode decoding for Intel controllers to properly identify SATA and PATA channels and associate ATA channels with SATA ports. This fixes wrong reporting and in some cases hard resets to wrong SATA ports. - Improve SATA registers support to handle hot-plug events and potentially interface errors. For ICH5/6300ESB chipsets these registers accessible via PCI config space. For later ones they may be accessible via PCI BAR(5). - For controllers not generating interrupts on hot-plug events, implement periodic status polling. Use it to detect hot-plug on Intel and VIA controllers. Same probably could also be used for Serverworks and SIS.
Diffstat (limited to 'sys/dev/ata/chipsets/ata-via.c')
-rw-r--r--sys/dev/ata/chipsets/ata-via.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/dev/ata/chipsets/ata-via.c b/sys/dev/ata/chipsets/ata-via.c
index 8d87f31..284a892 100644
--- a/sys/dev/ata/chipsets/ata-via.c
+++ b/sys/dev/ata/chipsets/ata-via.c
@@ -56,6 +56,7 @@ static int ata_via_chipinit(device_t dev);
static int ata_via_ch_attach(device_t dev);
static int ata_via_ch_detach(device_t dev);
static void ata_via_reset(device_t dev);
+static int ata_via_status(device_t dev);
static int ata_via_old_setmode(device_t dev, int target, int mode);
static void ata_via_southbridge_fixup(device_t dev);
static int ata_via_new_setmode(device_t dev, int target, int mode);
@@ -249,11 +250,13 @@ ata_via_ch_attach(device_t dev)
ch->r_io[ATA_SERROR].offset = 0x04 + (ch->unit << ctlr->chip->cfg1);
ch->r_io[ATA_SCONTROL].res = ctlr->r_res2;
ch->r_io[ATA_SCONTROL].offset = 0x08 + (ch->unit << ctlr->chip->cfg1);
+ ch->hw.status = ata_via_status;
ch->flags |= ATA_NO_SLAVE;
ch->flags |= ATA_SATA;
+ ch->flags |= ATA_PERIODIC_POLL;
+
+ ata_sata_scr_write(ch, -1, ATA_SERROR, 0xffffffff);
- /* XXX SOS PHY hotplug handling missing in VIA chip ?? */
- /* XXX SOS unknown how to enable PHY state change interrupt */
return 0;
}
@@ -299,6 +302,14 @@ ata_via_reset(device_t dev)
}
static int
+ata_via_status(device_t dev)
+{
+
+ ata_sata_phy_check_events(dev, -1);
+ return (ata_pci_status(dev));
+}
+
+static int
ata_via_new_setmode(device_t dev, int target, int mode)
{
device_t parent = device_get_parent(dev);
OpenPOWER on IntegriCloud