Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Nov 1998 22:22:37 +0200 (EET)
From:      "Vladimir N.Silyaev" <vns@delta.odessa.ua>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/8824: IDE BusMaster and driver unit number
Message-ID:  <199811232022.WAA00995@storage.delta.odessa.ua>

next in thread | raw e-mail | index | archive | help

>Number:         8824
>Category:       kern
>Synopsis:       Incorrect driver unit number in IDE BusMaster code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 23 12:30:00 PST 1998
>Last-Modified:
>Originator:     Vladimir N.Silyaev
>Organization:
JSC INT
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:
		 FreeBSD 3.0-Current CVSupped last evening
		 Motherboard with Intel VX chipset
		 HDD QUANTUM FIREBALL TM2550A

>Description:

	When detecting support BusMaster modes and for stage configuring
	IDE controller incorrect determine drive unit number. Actualy
	for IDE bus this is a Master/Slave device.
	This incorrect unit number may lead to incorrect configuring
	the IDE controller or don't detecting posibility BusMaster
	devices and etc.

	The reason it is next: at the time of PCI IDE controller
	detection in pci/ide_pci.c module for every enabled channel 
	Primary and Secondary are created two ide_pci_cookie structure,
	one for Master device and one for Secondary device. This structure 
	has a fields for controller number ctrl - (0-Primary, 1-Secondary),
	IO base port  iobase_wd, and unit number (0-Master, 1-Secondary). 
 	The code for specific IDE controller use this fields for controller
	detection/configuring. The create structures ide_pci_cookie after
	its creating are added to softc.cookies list. This module has
	a function ide_pci_candma which find ide_pci_cookie for pair
	iobase_wd(IO base port) and unit (actualy it is a controller
	number, not a drive unit number) and return a pointer to a
	ide_pci_cookie structure. 
	  When function ide_pci_candme called from i386/isa/wd.c module via
	the function pointer candma in wddma array, it's return same pointer 
	for a master and slave devices. Because of the ide_pci_cookie items 
	are added into the head of list, always returned pointer for a slave
	device.
 
>How-To-Repeat:

	 Enabled support DMA for ide controller (0x2000 bit in flags) 
	 Any motherboard with IDE BusMaster support, supported now in FreeBSD
	 Any HDD with MultiWord DMA or Ultra DMA support as Master device
	 at the IDE connector.
	
	 Booting in the verbose (-v at a boot prompt) mode.	
	 You can see:
...
ide_pci0: <Intel PIIX3 Bus-master IDE controller> rev 0x00 on pci0.7.1
intel_piix_status: primary master/slave sample = 3, master/slave recovery = 3
intel_piix_status: primary master fastDMAonly disabled, pre/post enabled,
intel_piix_status:  IORDY sampling enabled,
intel_piix_status:  fast PIO enabled
intel_piix_status: primary master/slave sample = 3, master/slave recovery = 3
intel_piix_status: primary slave fastDMAonly disabled, pre/post disabled,
intel_piix_status:  IORDY sampling disabled,
intel_piix_status:  fast PIO disabled
ide_pci: busmaster 0 status: 04 from port: 0000f002
....
wdc0 at 0x1f0-0x1f7 irq 14 flags 0xa0ffa0ff on isa
intel_piix_dmainit: setting multiword DMA mode 2
wd0: wdsetmode() setting transfer mode to 22
intel_piix_status: primary slave sample = 3, slave recovery = 1
intel_piix_status: primary slave fastDMAonly disabled, pre/post enabled,
intel_piix_status:  IORDY sampling enabled,
intel_piix_status:  fast PIO enabled
wdc0: unit 0 (wd0): <QUANTUM FIREBALL_TM2550A>, DMA, 32-bit, multi-block-16
wd0: 2445MB (5008752 sectors), 4969 cyls, 16 heads, 63 S/T, 512 B/S
wd0: ATA INQUIRE valid = 0003, dmamword = 0407, apio = 0003, udma = 0000
wdc1 at 0x170-0x177 irq 15 flags 0xa0ffa0ff on isa

In this example BusMaster drive is a Master device, but transfer mode setting 
was changed for a Slave device.

>Fix:
	
	Don't use DMA if master and slave devices has differnt parameters.
	Often it may work, but if detection/configuring code depend from 
	unit number BusMaster will be not detecting (at least for Intel PIIX) 
	or set incorrect mode for slave device.
 
	For fixing this problem need add new parameter to candma family
	function/function pointer - the paramter wdd_unit. And 
	ide_pci_candma must scna for a three paramters IO Base, controller
	number, and the device number.
	
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811232022.WAA00995>