diff --git a/sys/dev/ata/ata-chipset.c b/sys/dev/ata/ata-chipset.c index 629fcfa3ac0..af174f2cdee 100644 --- a/sys/dev/ata/ata-chipset.c +++ b/sys/dev/ata/ata-chipset.c @@ -118,6 +118,8 @@ static void ata_marvell_edma_dmasetprd(void *xsc, bus_dma_segment_t *segs, int n static void ata_marvell_edma_dmainit(device_t dev); static int ata_national_chipinit(device_t dev); static void ata_national_setmode(device_t dev, int mode); +static int ata_netcell_chipinit(device_t dev); +static int ata_netcell_allocate(device_t dev); static int ata_nvidia_chipinit(device_t dev); static int ata_nvidia_allocate(device_t dev); static int ata_nvidia_status(device_t dev); @@ -2855,6 +2857,49 @@ ata_national_setmode(device_t dev, int mode) } } +/* + * NetCell chipset support functions + */ +int +ata_netcell_ident(device_t dev) +{ + struct ata_pci_controller *ctlr = device_get_softc(dev); + + if (pci_get_devid(dev) == ATA_NETCELL_SR) { + device_set_desc(dev, "Netcell SyncRAID SR3000/5000 RAID Controller"); + ctlr->chipinit = ata_netcell_chipinit; + return 0; + } + return ENXIO; +} + +static int +ata_netcell_chipinit(device_t dev) +{ + struct ata_pci_controller *ctlr = device_get_softc(dev); + + if (ata_generic_chipinit(dev)) + return ENXIO; + + ctlr->allocate = ata_netcell_allocate; + return 0; +} + +static int +ata_netcell_allocate(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + /* setup the usual register normal pci style */ + if (ata_pci_allocate(dev)) + return ENXIO; + + /* don't use 32 bit PIO transfers; these cause the NetCell to return + * garbage */ + ch->flags |= ATA_USE_16BIT; + + return 0; +} /* * nVidia chipset support functions diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index e322757141d..fc3585ad124 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -120,6 +120,10 @@ ata_pci_probe(device_t dev) if (!ata_national_ident(dev)) return ATA_PROBE_OK; break; + case ATA_NETCELL_ID: + if (!ata_netcell_ident(dev)) + return ATA_PROBE_OK; + break; case ATA_NVIDIA_ID: if (!ata_nvidia_ident(dev)) return ATA_PROBE_OK; diff --git a/sys/dev/ata/ata-pci.h b/sys/dev/ata/ata-pci.h index 784a3aa4688..d7fc883de25 100644 --- a/sys/dev/ata/ata-pci.h +++ b/sys/dev/ata/ata-pci.h @@ -198,6 +198,9 @@ struct ata_connect_task { #define ATA_NATIONAL_ID 0x100b #define ATA_SC1100 0x0502100b +#define ATA_NETCELL_ID 0x169c +#define ATA_NETCELL_SR 0x0044169c + #define ATA_NVIDIA_ID 0x10de #define ATA_NFORCE1 0x01bc10de #define ATA_NFORCE2 0x006510de @@ -450,6 +453,7 @@ int ata_jmicron_ident(device_t); int ata_marvell_ident(device_t); int ata_national_ident(device_t); int ata_nvidia_ident(device_t); +int ata_netcell_ident(device_t); int ata_promise_ident(device_t); int ata_serverworks_ident(device_t); int ata_sii_ident(device_t);