diff options
author | peter <peter@FreeBSD.org> | 1999-04-16 21:22:55 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-04-16 21:22:55 +0000 |
commit | 087d4857e56f150a8f549600150404f273efb895 (patch) | |
tree | cf4e27432c59d956f4e5784207180115ee8fef9d /sys/dev/ata | |
parent | c5fe612b8411a32a8e6e426fc1a70cba0cca3d31 (diff) | |
download | FreeBSD-src-087d4857e56f150a8f549600150404f273efb895.zip FreeBSD-src-087d4857e56f150a8f549600150404f273efb895.tar.gz |
Bring the 'new-bus' to the i386. This extensively changes the way the
i386 platform boots, it is no longer ISA-centric, and is fully dynamic.
Most old drivers compile and run without modification via 'compatability
shims' to enable a smoother transition. eisa, isapnp and pccard* are
not yet using the new resource manager. Once fully converted, all drivers
will be loadable, including PCI and ISA.
(Some other changes appear to have snuck in, including a port of Soren's
ATA driver to the Alpha. Soren, back this out if you need to.)
This is a checkpoint of work-in-progress, but is quite functional.
The bulk of the work was done over the last few years by Doug Rabson and
Garrett Wollman.
Approved by: core
Diffstat (limited to 'sys/dev/ata')
-rw-r--r-- | sys/dev/ata/ata-all.c | 34 | ||||
-rw-r--r-- | sys/dev/ata/ata-disk.c | 10 | ||||
-rw-r--r-- | sys/dev/ata/ata-dma.c | 14 | ||||
-rw-r--r-- | sys/dev/ata/atapi-all.c | 10 |
4 files changed, 47 insertions, 21 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 680c334..4bee8d3 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -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. * - * $Id: ata-all.c,v 1.5 1999/03/28 18:57:18 sos Exp $ + * $Id: ata-all.c,v 1.6 1999/04/10 18:53:35 sos Exp $ */ #include "ata.h" @@ -44,12 +44,18 @@ #include <vm/vm.h> #include <vm/pmap.h> #include <machine/clock.h> +#ifdef __i386__ #include <machine/smp.h> +#endif #include <pci/pcivar.h> #include <pci/pcireg.h> +#ifdef __i386__ #include <i386/isa/icu.h> #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> +#else +#include <isa/isareg.h> +#endif #include <dev/ata/ata-all.h> #include <dev/ata/ata-disk.h> #include <dev/ata/atapi-all.h> @@ -62,7 +68,7 @@ #endif /* prototypes */ -#if NISA > 0 +#if NISA > 0 && defined(__i386__) static int32_t ata_isaprobe(struct isa_device *); static int32_t ata_isaattach(struct isa_device *); #endif @@ -76,9 +82,10 @@ static void ataintr(int32_t); static int32_t atanlun = 0; struct ata_softc *atadevices[MAXATA]; + +#if NISA > 0 && defined(__i386__) struct isa_driver atadriver = { ata_isaprobe, ata_isaattach, "ata" }; -#if NISA > 0 static int32_t ata_isaprobe(struct isa_device *devp) { @@ -133,6 +140,10 @@ ata_pciprobe(pcici_t tag, pcidi_t type) return "Promise Ultra/33 IDE controller"; case 0x522910b9: return "AcerLabs Aladdin IDE controller"; + case 0x06401095: + return "CMD 640 IDE controller"; + case 0x06461095: + return "CMD 646 IDE controller"; #if 0 case 0x05711106: return "VIA Apollo IDE controller"; @@ -222,14 +233,18 @@ ata_pciattach(pcici_t tag, int32_t unit) lun = 0; if (ata_probe(iobase_1, altiobase_1, bmaddr_1, tag, &lun)) { if (iobase_1 == IO_WD1) +#ifdef __i386__ register_intr(irq1, (int)"", 0, (inthand2_t *)ataintr, &bio_imask, lun); +#else + alpha_platform_setup_ide_intr(0, ataintr, (void *)(intptr_t)lun); +#endif else { if (sysctrl) pci_map_int(tag, (inthand2_t *)promise_intr, - (void *)lun, &bio_imask); + (void *)(intptr_t)lun, &bio_imask); else - pci_map_int(tag, (inthand2_t *)ataintr, (void *)lun,&bio_imask); + pci_map_int(tag, (inthand2_t *)ataintr, (void *)(intptr_t)lun,&bio_imask); } printf("ata%d at 0x%04x irq %d on ata-pci%d\n", lun, iobase_1, isa_apic_irq(irq1), unit); @@ -237,11 +252,15 @@ ata_pciattach(pcici_t tag, int32_t unit) lun = 1; if (ata_probe(iobase_2, altiobase_2, bmaddr_2, tag, &lun)) { if (iobase_2 == IO_WD2) +#ifdef __i386__ register_intr(irq2, (int)"", 0, (inthand2_t *)ataintr, &bio_imask, lun); +#else + alpha_platform_setup_ide_intr(1, ataintr, (void *)(intptr_t)lun); +#endif else { if (!sysctrl) - pci_map_int(tag, (inthand2_t *)ataintr, (void *)lun,&bio_imask); + pci_map_int(tag, (inthand2_t *)ataintr, (void *)(intptr_t)lun,&bio_imask); } printf("ata%d at 0x%04x irq %d on ata-pci%d\n", lun, iobase_2, isa_apic_irq(irq2), unit); @@ -418,6 +437,7 @@ ata_probe(int32_t ioaddr, int32_t altioaddr, int32_t bmaddr, #ifndef ATA_STATIC_ID atanlun++; #endif + outb(scp->ioaddr + ATA_DRIVE, ATA_D_IBM | ATA_MASTER); return ATA_IOSIZE; } @@ -571,7 +591,7 @@ printf("ata_command: addr=%04x, device=%02x, cmd=%02x, c=%d, h=%d, s=%d, count=% scp->active = ATA_WAIT_INTR; outb(scp->ioaddr + ATA_CMD, command); if (tsleep((caddr_t)scp, PRIBIO, "atacmd", 500)) { - printf("ata_command: timeout waiting for interrupt"); + printf("ata_command: timeout waiting for interrupt\n"); scp->active = ATA_IDLE; return -1; } diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index c5f7a41..c5efe55 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -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. * - * $Id: ata-disk.c,v 1.5 1999/03/28 18:57:18 sos Exp $ + * $Id: ata-disk.c,v 1.6 1999/04/10 18:53:35 sos Exp $ */ #include "ata.h" @@ -527,11 +527,11 @@ ad_transfer(struct buf *bp) /* output the data */ #if 0 outsw(adp->controller->ioaddr + ATA_DATA, - (void *)((int32_t)bp->b_data + adp->donecount), + (void *)((uintptr_t)bp->b_data + adp->donecount), adp->currentsize / sizeof(int16_t)); #else outsl(adp->controller->ioaddr + ATA_DATA, - (void *)((int32_t)bp->b_data + adp->donecount), + (void *)((uintptr_t)bp->b_data + adp->donecount), adp->currentsize / sizeof(int32_t)); #endif adp->bytecount -= adp->currentsize; @@ -590,11 +590,11 @@ oops: /* data ready, read in */ #if 0 insw(adp->controller->ioaddr + ATA_DATA, - (void *)((int32_t)bp->b_data + adp->donecount), + (void *)((uintptr_t)bp->b_data + adp->donecount), adp->currentsize / sizeof(int16_t)); #else insl(adp->controller->ioaddr + ATA_DATA, - (void *)((int32_t)bp->b_data + adp->donecount), + (void *)((uintptr_t)bp->b_data + adp->donecount), adp->currentsize / sizeof(int32_t)); #endif adp->bytecount -= adp->currentsize; diff --git a/sys/dev/ata/ata-dma.c b/sys/dev/ata/ata-dma.c index fe0a08c..0886dbe 100644 --- a/sys/dev/ata/ata-dma.c +++ b/sys/dev/ata/ata-dma.c @@ -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. * - * $Id: ata-dma.c,v 1.3 1999/03/30 13:09:47 sos Exp $ + * $Id: ata-dma.c,v 1.4 1999/04/10 18:53:35 sos Exp $ */ #include "ata.h" @@ -42,6 +42,12 @@ #include <pci/pcireg.h> #include <dev/ata/ata-all.h> +#ifdef __alpha__ +#undef vtophys +#define vtophys(va) (pmap_kextract(((vm_offset_t) (va))) \ + + 1*1024*1024*1024) +#endif + /* misc defines */ #define MIN(a,b) ((a)>(b)?(b):(a)) @@ -64,7 +70,7 @@ ata_dmainit(struct ata_softc *scp, int32_t device, if (!(dmatab = malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT))) return -1; - if (((int)dmatab>>PAGE_SHIFT)^(((int)dmatab+PAGE_SIZE-1)>>PAGE_SHIFT)) { + if (((uintptr_t)dmatab>>PAGE_SHIFT)^(((uintptr_t)dmatab+PAGE_SIZE-1)>>PAGE_SHIFT)) { printf("ata_dmainit: dmatab crosses page boundary, no DMA\n"); free(dmatab, M_DEVBUF); return -1; @@ -252,7 +258,7 @@ ata_dmasetup(struct ata_softc *scp, int32_t device, #ifdef ATA_DEBUGDMA printf("ata%d: dmasetup\n", scp->lun); #endif - if (((u_int32_t)data & 1) || (count & 1)) + if (((uintptr_t)data & 1) || (count & 1)) return -1; if (!count) { @@ -263,7 +269,7 @@ ata_dmasetup(struct ata_softc *scp, int32_t device, dmatab = scp->dmatab[device ? 1 : 0]; dma_base = vtophys(data); - dma_count = MIN(count, (PAGE_SIZE - ((u_int32_t)data & PAGE_MASK))); + dma_count = MIN(count, (PAGE_SIZE - ((uintptr_t)data & PAGE_MASK))); data += dma_count; count -= dma_count; diff --git a/sys/dev/ata/atapi-all.c b/sys/dev/ata/atapi-all.c index 6322475..3b48966 100644 --- a/sys/dev/ata/atapi-all.c +++ b/sys/dev/ata/atapi-all.c @@ -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. * - * $Id: atapi-all.c,v 1.5 1999/03/28 18:57:19 sos Exp $ + * $Id: atapi-all.c,v 1.6 1999/04/10 18:53:35 sos Exp $ */ #include "ata.h" @@ -310,13 +310,13 @@ printf("atapi_interrupt: length=%d reason=0x%02x\n", length, reason); printf("atapi_interrupt: write data underrun %d/%d\n", length, request->bytecount); outsw(atp->controller->ioaddr + ATA_DATA, - (void *)((int32_t)request->data), length / sizeof(int16_t)); + (void *)((uintptr_t)request->data), length / sizeof(int16_t)); for (resid=request->bytecount; resid<length; resid+=sizeof(int16_t)) outw(atp->controller->ioaddr + ATA_DATA, 0); } else { outsw(atp->controller->ioaddr + ATA_DATA, - (void *)((int32_t)request->data), length / sizeof(int16_t)); + (void *)((uintptr_t)request->data), length / sizeof(int16_t)); } request->bytecount -= length; request->data += length; @@ -331,13 +331,13 @@ printf("atapi_interrupt: length=%d reason=0x%02x\n", length, reason); printf("atapi_interrupt: read data overrun %d/%d\n", length, request->bytecount); insw(atp->controller->ioaddr + ATA_DATA, - (void *)((int32_t)request->data), length / sizeof(int16_t)); + (void *)((uintptr_t)request->data), length / sizeof(int16_t)); for (resid=request->bytecount; resid<length; resid+=sizeof(int16_t)) inw(atp->controller->ioaddr + ATA_DATA); } else { insw(atp->controller->ioaddr + ATA_DATA, - (void *)((int32_t)request->data), length / sizeof(int16_t)); + (void *)((uintptr_t)request->data), length / sizeof(int16_t)); } request->bytecount -= length; request->data += length; |