Module Name: src Committed By: phx Date: Sat Nov 12 16:56:12 UTC 2011
Modified Files: src/sys/arch/sandpoint/stand/altboot: dsk.c pciide.c Log Message: Add support for IT821x IDE. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sandpoint/stand/altboot/dsk.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sandpoint/stand/altboot/pciide.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/sandpoint/stand/altboot/dsk.c diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.10 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.11 --- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.10 Tue Nov 1 16:32:57 2011 +++ src/sys/arch/sandpoint/stand/altboot/dsk.c Sat Nov 12 16:56:12 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: dsk.c,v 1.10 2011/11/01 16:32:57 phx Exp $ */ +/* $NetBSD: dsk.c,v 1.11 2011/11/12 16:56:12 phx Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -186,7 +186,7 @@ perform_atareset(struct dkdev_ata *l, in delay(10); CSR_WRITE_1(chan->ctl, ATA_DREQ); - return spinwait_unbusy(l, n, 150, NULL); + return spinwait_unbusy(l, n, 250, NULL); } int Index: src/sys/arch/sandpoint/stand/altboot/pciide.c diff -u src/sys/arch/sandpoint/stand/altboot/pciide.c:1.9 src/sys/arch/sandpoint/stand/altboot/pciide.c:1.10 --- src/sys/arch/sandpoint/stand/altboot/pciide.c:1.9 Wed Nov 2 04:10:33 2011 +++ src/sys/arch/sandpoint/stand/altboot/pciide.c Sat Nov 12 16:56:12 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pciide.c,v 1.9 2011/11/02 04:10:33 nisimura Exp $ */ +/* $NetBSD: pciide.c,v 1.10 2011/11/12 16:56:12 phx Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -37,6 +37,7 @@ static int cmdidefix(struct dkdev_ata *); static int apoidefix(struct dkdev_ata *); +static int iteidefix(struct dkdev_ata *); static uint32_t pciiobase = PCI_XIOBASE; @@ -47,6 +48,7 @@ struct myops { static struct myops defaultops = { NULL, NULL }; static struct myops cmdideops = { cmdidefix, NULL }; static struct myops apoideops = { apoidefix, NULL }; +static struct myops iteideops = { iteidefix, NULL }; static struct myops *myops; int @@ -65,6 +67,8 @@ pciide_match(unsigned tag, void *data) myops = &apoideops; return 1; case PCI_DEVICE(0x1283, 0x8211): /* ITE 8211 IDE */ + myops = &iteideops; + return 1; case PCI_DEVICE(0x10ad, 0x0105): /* Symphony Labs 82C105 IDE */ case PCI_DEVICE(0x10b8, 0x5229): /* ALi IDE */ case PCI_DEVICE(0x1191, 0x0008): /* ACARD ATP865 */ @@ -127,10 +131,10 @@ pciide_init(unsigned tag, void *data) for (n = 0; n < 2; n++) { if (myops->presense && (*myops->presense)(l, n) == 0) l->presense[n] = 0; /* found not exist */ - else { + else /* check to see whether soft reset works */ l->presense[n] = perform_atareset(l, n); - } + if (l->presense[n]) printf("channel %d present\n", n); } @@ -166,3 +170,19 @@ apoidefix(struct dkdev_ata *l) return 1; } + +static int +iteidefix(struct dkdev_ata *l) +{ + unsigned v; + + /* set PCI mode and 66Mhz reference clock, disable IT8212 RAID */ + v = pcicfgread(l->tag, 0x50); + pcicfgwrite(l->tag, 0x50, v & ~0x83); + + /* i/o configuration, enable channels, cables, IORDY */ + v = pcicfgread(l->tag, 0x40); + pcicfgwrite(l->tag, 0x40, (v & ~0xffffff) | 0x36a0f3); + + return 1; +}