kern/125421: [ata][patch] sii 680 failed to allocate resources

Andrey V. Elsukov bu7cher at yandex.ru
Wed Jul 9 06:50:02 UTC 2008


>Number:         125421
>Category:       kern
>Synopsis:       [ata][patch] sii 680 failed to allocate resources
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 09 06:50:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Andrey V. Elsukov
>Release:        FreeBSD 6.2-STABLE i386
>Organization:
>Environment:
	FreeBSD
>Description:
atapci1: <SiI SiI 0680 UDMA133 controller> port 0xa800-0xa807,0xa400-0xa403,0xa000-0xa007,0x9800-0x9803,0x9400-0x940f irq 22 at device 10.0 on pci1
atapci1: Reserved 0x10 bytes for rid 0x20 type 4 at 0x9400
ioapic0: routing intpin 22 (PCI IRQ 22) to vector 54
atapci1: [MPSAFE]
atapci1: [ITHREAD]
device_attach: atapci1 attach returned 6

Driver failed to allocate MMIO resources. Attached patch adds a fallback path.
It uses generic IDE facilities if sii-specific allocations failed. After path
we have:

atapci1: <SiI 0680 UDMA133 controller> port 0xa800-0xa807,0xa400-0xa403,0xa000-0xa007,0x9800-0x9803,0x9400-0x940f irq 21 at device 11.0 on pci1
atapci1: Reserved 0x10 bytes for rid 0x20 type 4 at 0x9400
ioapic0: routing intpin 21 (PCI IRQ 21) to vector 54
atapci1: [MPSAFE]
atapci1: [ITHREAD]
ata4: <ATA channel 0> on atapci1
atapci1: Reserved 0x8 bytes for rid 0x10 type 4 at 0xa800
atapci1: Reserved 0x4 bytes for rid 0x14 type 4 at 0xa400
ata4: reset tp1 mask=03 ostat0=50 ostat1=00
ata4: stat0=0x00 err=0x01 lsb=0x14 msb=0xeb
ata4: stat1=0x00 err=0x04 lsb=0x0e msb=0x00
ata4: reset tp2 stat0=00 stat1=00 devices=0x4<ATAPI_MASTER>
ata4: [MPSAFE]
ata4: [ITHREAD]
ata5: <ATA channel 1> on atapci1
atapci1: Reserved 0x8 bytes for rid 0x18 type 4 at 0xa000
atapci1: Reserved 0x4 bytes for rid 0x1c type 4 at 0x9800
ata5: reset tp1 mask=03 ostat0=7f ostat1=7f
ata5: stat0=0x7f err=0x7f lsb=0x7f msb=0x7f
ata5: stat0=0x7f err=0x7f lsb=0x7f msb=0x7f
ata5: stat0=0x7f err=0x7f lsb=0x7f msb=0x7f
ata5: stat0=0x7f err=0x7f lsb=0x7f msb=0x7f
ata5: stat0=0x7f err=0x7f lsb=0x7f msb=0x7f
ata5: stat0=0x7f err=0x7f lsb=0x7f msb=0x7f
ata5: stat0=0x7f err=0x7f lsb=0x7f msb=0x7f
ata5: stat0=0x7f err=0x7f lsb=0x7f msb=0x7f
ata5: stat0=0x7f err=0x7f lsb=0x7f msb=0x7f
ata5: stat0=0x7f err=0x7f lsb=0x7f msb=0x7f
ata5: stat0=0x7f err=0x7f lsb=0x7f msb=0x7f
ata5: stat0=0x7f err=0x7f lsb=0x7f msb=0x7f
ata5: stat1=0x7f err=0x7f lsb=0x7f msb=0x7f
ata5: reset tp2 stat0=ff stat1=ff devices=0x0
ata5: [MPSAFE]
ata5: [ITHREAD]
isab0: <PCI-ISA bridge> at device 31.0 on pci0
...
ata4-master: pio=PIO4 wdma=WDMA2 udma=UDMA33 cable=40 wire
acd0: setting PIO4 on 0680 chip
acd0: setting UDMA33 on 0680 chip
acd0: <NEC DVD RW ND-4570A/1.02> DVDR drive at ata4 as master
acd0: read 8268KB/s (8268KB/s) write 8268KB/s (8268KB/s), 2048KB buffer, UDMA33
acd0: Reads: CDR, CDRW, CDDA stream, DVDROM, DVDR, DVDRAM, packet
acd0: Writes: CDR, CDRW, DVDR, DVDRAM, test write, burnproof
acd0: Audio: play, 256 volume levels
acd0: Mechanism: ejectable tray, unlocked
acd0: Medium: no/blank disc 

>How-To-Repeat:
	Can be repeated on some buggy(?) controllers.
>Fix:

	

--- sii_680_alloc_resource_fallback_path.diff begins here ---
--- ata-chipset.c.orig	2008-03-25 13:32:44.000000000 +0300
+++ ata-chipset.c	2008-03-25 14:25:32.000000000 +0300
@@ -4514,12 +4514,15 @@ ata_sii_chipinit(device_t dev)
 	ctlr->r_type2 = SYS_RES_MEMORY;
 	ctlr->r_rid2 = PCIR_BAR(5);
 	if (!(ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2,
-						    &ctlr->r_rid2, RF_ACTIVE)))
-	    return ENXIO;
+						    &ctlr->r_rid2, RF_ACTIVE))) {
+	    if (ctlr->chip->chipid != ATA_SII0680 ||
+			    (pci_read_config(dev, 0x8a, 1) & 1))
+		return ENXIO;
+	}
 
 	if (ctlr->chip->cfg2 & SIISETCLK) {
 	    if ((pci_read_config(dev, 0x8a, 1) & 0x30) != 0x10)
-		pci_write_config(dev, 0x8a, 
+		pci_write_config(dev, 0x8a,
 				 (pci_read_config(dev, 0x8a, 1) & 0xcf)|0x10,1);
 	    if ((pci_read_config(dev, 0x8a, 1) & 0x30) != 0x10)
 		device_printf(dev, "%s could not set ATA133 clock\n",
@@ -4539,7 +4542,9 @@ ata_sii_chipinit(device_t dev)
 	/* enable PCI interrupt as BIOS might not */
 	pci_write_config(dev, 0x8a, (pci_read_config(dev, 0x8a, 1) & 0x3f), 1);
 
-	ctlr->allocate = ata_sii_allocate;
+	if (ctlr->r_res2)
+	    ctlr->allocate = ata_sii_allocate;
+
 	if (ctlr->chip->max_dma >= ATA_SA150) {
 	    ctlr->reset = ata_sii_reset;
 	    ctlr->setmode = ata_sata_setmode;
--- sii_680_alloc_resource_fallback_path.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list