Date: Wed, 30 Apr 2003 23:30:36 -0700 (PDT) From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 30288 for review Message-ID: <200305010630.h416Uat9018233@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=30288 Change 30288 by marcel@marcel_pluto1 on 2003/04/30 23:30:04 IFC @30287 Affected files ... .. //depot/projects/ia64/sys/cam/scsi/scsi_da.c#42 integrate .. //depot/projects/ia64/sys/dev/ata/ata-chipset.c#11 integrate .. //depot/projects/ia64/sys/dev/ata/ata-disk.c#22 integrate .. //depot/projects/ia64/sys/dev/ata/ata-pci.h#7 integrate Differences ... ==== //depot/projects/ia64/sys/cam/scsi/scsi_da.c#42 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.140 2003/04/30 13:36:51 phk Exp $ + * $FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.141 2003/05/01 05:16:13 ken Exp $ */ #ifdef _KERNEL @@ -1785,6 +1785,8 @@ int error; softc = (struct da_softc *)periph->softc; + block_len = 0; + maxsector = 0; error = 0; /* Do a read capacity */ ==== //depot/projects/ia64/sys/dev/ata/ata-chipset.c#11 (text+ko) ==== @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.20 2003/04/16 08:30:40 sos Exp $ + * $FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.21 2003/05/01 06:20:50 sos Exp $ */ #include "opt_ata.h" #include <sys/param.h> @@ -79,12 +79,17 @@ static void ata_via_family_setmode(struct ata_device *, int); static void ata_via_southbridge_fixup(device_t); static int ata_promise_chipinit(device_t); +static int ata_promise_mio_allocate(device_t, struct ata_channel *); static void ata_promise_old_intr(void *); static void ata_promise_tx2_intr(void *); +static void ata_promise_mio_intr(void *); static void ata_promise_setmode(struct ata_device *, int); static int ata_promise_old_dmainit(struct ata_channel *); static int ata_promise_old_dmastart(struct ata_channel *, caddr_t, int32_t,int); static int ata_promise_old_dmastop(struct ata_channel *); +static int ata_promise_mio_dmainit(struct ata_channel *); +static int ata_promise_mio_dmastart(struct ata_channel *, caddr_t, int32_t,int); +static int ata_promise_mio_dmastop(struct ata_channel *); static int ata_serverworks_chipinit(device_t); static void ata_serverworks_setmode(struct ata_device *, int); static int ata_sii_chipinit(device_t); @@ -939,6 +944,18 @@ { ATA_PDC20275, 0, PRTX, 0x00, ATA_UDMA6, "Promise PDC20275" }, { ATA_PDC20276, 0, PRTX, PRSX6K, ATA_UDMA6, "Promise PDC20276" }, { ATA_PDC20277, 0, PRTX, 0x00, ATA_UDMA6, "Promise PDC20277" }, + { ATA_PDC20318, 0, PRMIO, PRSATA, ATA_UDMA6, "Promise PDC20318" }, + { ATA_PDC20319, 0, PRMIO, PRSATA, ATA_UDMA6, "Promise PDC20319" }, + { ATA_PDC20371, 0, PRMIO, PRSATA, ATA_UDMA6, "Promise PDC20371" }, + { ATA_PDC20375, 0, PRMIO, PRSATA, ATA_UDMA6, "Promise PDC20375" }, + { ATA_PDC20376, 0, PRMIO, PRSATA, ATA_UDMA6, "Promise PDC20376" }, + { ATA_PDC20377, 0, PRMIO, PRSATA, ATA_UDMA6, "Promise PDC20377" }, + { ATA_PDC20378, 0, PRMIO, PRSATA, ATA_UDMA6, "Promise PDC20378" }, + { ATA_PDC20379, 0, PRMIO, PRSATA, ATA_UDMA6, "Promise PDC20379" }, + { ATA_PDC20617, 0, PRMIO, PRDUAL, ATA_UDMA6, "Promise PDC20617" }, + { ATA_PDC20618, 0, PRMIO, PRDUAL, ATA_UDMA6, "Promise PDC20618" }, + { ATA_PDC20619, 0, PRMIO, PRDUAL, ATA_UDMA6, "Promise PDC20619" }, + { ATA_PDC20620, 0, PRMIO, PRDUAL, ATA_UDMA6, "Promise PDC20620" }, { 0, 0, 0, 0, 0, 0}}; char *desc, buffer[64]; uintptr_t devid = 0; @@ -1015,11 +1032,67 @@ return ENXIO; } break; + + case PRMIO: + rid = 0x1c; + if (!(ctlr->r_io2 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, + 0, ~0, 1, RF_ACTIVE))) + return ENXIO; + + ctlr->dmainit = ata_promise_mio_dmainit; + ctlr->allocate = ata_promise_mio_allocate; + + if (ctlr->chip->cfg2 & PRDUAL) { + ctlr->channels = ((ATA_INL(ctlr->r_io2, 0x48) & 0x01) > 0) + + ((ATA_INL(ctlr->r_io2, 0x48) & 0x02) > 0) + 2; + } + else if (ctlr->chip->cfg2 & PRSATA) { + ATA_OUTL(ctlr->r_io2, 0x06c, 0x00ff0033); + ctlr->channels = ((ATA_INL(ctlr->r_io2, 0x48) & 0x02) > 0) + 3; + } + else + ctlr->channels = 4; + + if ((bus_setup_intr(dev, ctlr->r_irq, INTR_TYPE_BIO | INTR_ENTROPY, + ata_promise_mio_intr, ctlr, &ctlr->handle))) { + device_printf(dev, "unable to setup interrupt\n"); + return ENXIO; + } + break; } ctlr->setmode = ata_promise_setmode; return 0; } +static int +ata_promise_mio_allocate(device_t dev, struct ata_channel *ch) +{ + struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); + int i; + + for (i = ATA_DATA; i <= ATA_STATUS; i++) { + ch->r_io[i].res = ctlr->r_io2; + ch->r_io[i].offset = 0x200 + (i << 2) + (ch->unit << 7); + } + ch->r_io[ATA_ALTSTAT].res = ctlr->r_io2; + ch->r_io[ATA_ALTSTAT].offset = 0x238 + (ch->unit << 7); + ch->r_io[ATA_BMCTL_PORT].res = ctlr->r_io2; + ch->r_io[ATA_BMCTL_PORT].offset = 0x260 + (ch->unit << 7); + ch->r_io[ATA_BMDTP_PORT].res = ctlr->r_io2; + ch->r_io[ATA_BMDTP_PORT].offset = 0x244 + (ch->unit << 7); + ch->r_io[ATA_BMDEVSPEC_0].res = ctlr->r_io2; + ch->r_io[ATA_BMDEVSPEC_0].offset = (ch->unit << 2); + ch->r_io[ATA_IDX_ADDR].res = ctlr->r_io2; + + ATA_IDX_OUTL(ch, ATA_BMCMD_PORT, + (ATA_IDX_INL(ch, ATA_BMCMD_PORT) & ~0x00000f8f) | ch->unit); + ATA_IDX_OUTL(ch, ATA_BMDEVSPEC_0, 0x00000001); + + ch->flags |= ATA_NO_SLAVE; + ctlr->dmainit(ch); + return 0; +} + static void ata_promise_old_intr(void *data) { @@ -1072,6 +1145,24 @@ } static void +ata_promise_mio_intr(void *data) +{ + struct ata_pci_controller *ctlr = data; + struct ata_channel *ch; + u_int32_t irq_vector; + int unit; + + irq_vector = ATA_INL(ctlr->r_io2, 0x0040); + for (unit = 0; unit < ctlr->channels; unit++) { + if (irq_vector & (1 << unit)) { + if ((ch = ctlr->interrupt[unit].argument)) + ctlr->interrupt[unit].function(ch); + ATA_IDX_OUTL(ch, ATA_BMDEVSPEC_0, 0x00000001); + } + } +} + +static void ata_promise_setmode(struct ata_device *atadev, int mode) { device_t parent = device_get_parent(atadev->channel->dev); @@ -1098,8 +1189,19 @@ mode = ata_limit_mode(atadev, mode, ctlr->chip->max_dma); - /* is this a TX2 or later chip ? */ switch (ctlr->chip->cfg1) { + case PROLD: + case PRNEW: + if (mode > ATA_UDMA2 && (pci_read_config(parent, 0x50, 2) & + (atadev->channel->unit ? 1 << 11 : 1 << 10))) { + ata_prtdev(atadev, + "DMA limited to UDMA33, non-ATA66 cable or device\n"); + mode = ATA_UDMA2; + } + if (ATAPI_DEVICE(atadev) && mode > ATA_PIO_MAX) + mode = ata_limit_mode(atadev, mode, ATA_PIO_MAX); + break; + case PRTX: ATA_IDX_OUTB(atadev->channel, ATA_BMDEVSPEC_0, 0x0b); if (mode > ATA_UDMA2 && @@ -1110,16 +1212,14 @@ } break; - case PROLD: - case PRNEW: - if (mode > ATA_UDMA2 && (pci_read_config(parent, 0x50, 2) & - (atadev->channel->unit ? 1 << 11 : 1 << 10))) { + case PRMIO: + if (mode > ATA_UDMA2 && + (ATA_IDX_INL(atadev->channel, ATA_BMCTL_PORT) & 0x01000000)) { ata_prtdev(atadev, "DMA limited to UDMA33, non-ATA66 cable or device\n"); mode = ATA_UDMA2; } - if (ATAPI_DEVICE(atadev) && mode > ATA_PIO_MAX) - mode = ata_limit_mode(atadev, mode, ATA_PIO_MAX); + break; } error = ata_command(atadev, ATA_C_SETFEATURES, 0, mode, @@ -1196,6 +1296,43 @@ return error; } +static int +ata_promise_mio_dmainit(struct ata_channel *ch) +{ + int error; + + if ((error = ata_dmainit(ch))) + return error; + + ch->dma->start = ata_promise_mio_dmastart; + ch->dma->stop = ata_promise_mio_dmastop; + return 0; +} + +static int +ata_promise_mio_dmastart(struct ata_channel *ch, + caddr_t data, int32_t count, int dir) +{ + int error; + + if ((error = ata_dmastart(ch, data, count, dir))) + return error; + + ATA_IDX_OUTL(ch, ATA_BMDTP_PORT, ch->dma->mdmatab); + ATA_IDX_OUTL(ch, ATA_BMCTL_PORT, + (ATA_IDX_INL(ch, ATA_BMCTL_PORT) & ~0x000000c0) | + ((dir) ? 0x00000080 : 0x000000c0)); + return error; +} + +static int +ata_promise_mio_dmastop(struct ata_channel *ch) +{ + ATA_IDX_OUTL(ch, ATA_BMCTL_PORT, + ATA_IDX_INL(ch, ATA_BMCTL_PORT) & ~0x00000080); + return ata_dmastop(ch); +} + /* * ServerWorks chipset support functions */ ==== //depot/projects/ia64/sys/dev/ata/ata-disk.c#22 (text+ko) ==== @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.151 2003/04/07 14:14:29 sos Exp $ + * $FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.152 2003/05/01 06:17:30 sos Exp $ */ #include "opt_ata.h" @@ -121,8 +121,8 @@ !(atadev->param->atavalid & ATA_FLAG_54_58) || !lbasize) adp->flags |= AD_F_CHS_USED; - /* use the 28bit LBA size if valid */ - if (atadev->param->cylinders == 16383 && adp->total_secs < lbasize) + /* use the 28bit LBA size if valid or bigger than the CHS mapping */ + if (atadev->param->cylinders == 16383 || adp->total_secs < lbasize) adp->total_secs = lbasize; lbasize48 = ((u_int64_t)atadev->param->lba_size48_1) | ==== //depot/projects/ia64/sys/dev/ata/ata-pci.h#7 (text+ko) ==== @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ata/ata-pci.h,v 1.7 2003/04/10 12:24:39 sos Exp $ + * $FreeBSD: src/sys/dev/ata/ata-pci.h,v 1.8 2003/05/01 06:20:50 sos Exp $ */ /* structure holding chipset config info */ @@ -129,7 +129,18 @@ #define ATA_PDC20275 0x1275105a #define ATA_PDC20276 0x5275105a #define ATA_PDC20277 0x7275105a +#define ATA_PDC20318 0x3318105a +#define ATA_PDC20319 0x3319105a +#define ATA_PDC20371 0x3371105a +#define ATA_PDC20375 0x3375105a #define ATA_PDC20376 0x3376105a +#define ATA_PDC20377 0x3377105a +#define ATA_PDC20378 0x3373105a +#define ATA_PDC20379 0x3372105a +#define ATA_PDC20617 0x6617105a +#define ATA_PDC20618 0x6626105a +#define ATA_PDC20619 0x6629105a +#define ATA_PDC20620 0x6620105a #define ATA_PDC20621 0x6621105a #define ATA_SERVERWORKS_ID 0x1166 @@ -216,9 +227,13 @@ #define PROLD 0 #define PRNEW 1 #define PRTX 2 -#define PRMEM 3 +#define PRMIO 3 +#define PRIDX 4 #define PRTX4 0x01 -#define PRSX6K 0x02 +#define PRSX4K 0x02 +#define PRSX6K 0x04 +#define PRSATA 0x08 +#define PRDUAL 0x10 #define SWKS33 0 #define SWKS66 1
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305010630.h416Uat9018233>