Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Mar 2009 14:08:50 +0200
From:      Boris Kotzev <boris.kotzev@gmail.com>
To:        Sean Bruno <sean.bruno@dsl-only.net>
Cc:        freebsd-firewire@freebsd.org
Subject:   firewire disk stopped working
Message-ID:  <200903161408.51018.boris.kotzev@gmail.com>

next in thread | raw e-mail | index | archive | help
>On Fri, 2009-03-13 at 14:42 +0900, Hidetoshi Shimokawa wrote:
>> Hi Sean,
>>
>> It looks like you broke Configuration ROM build procedure in firewire stack in
>> http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/firewire/firewire.c.diff?r1=1.104;r2=1.105
>>
>> In this change, you just copy "src" to "fc->config_rom" but it's wrong.
>> You have to call crom_load() to get CROM built correctly.
>> It is a critical problem for SCSI and dcons(4) target that highly
>> depend on CROM.
>> I think you can easily check this problem by 'fwcontrol -c [your own node_id]',
>> you'll get broken CROM and CRC. If there are anything I can help you to fix this
>> bug, let me know.
>>
>> Thanks,
>>
>> Hidetoshi at AsiaBSDCon2009
>>
>> @@ -739,19 +758,19 @@ fw_busreset(struct firewire_comm *fc, ui
>>  		free(devlistp, M_TEMP);
>>  	}
>>
>> -	newrom = malloc(CROMSIZE, M_FW, M_NOWAIT | M_ZERO);
>>  	src = &fc->crom_src_buf->src;
>> -	crom_load(src, (uint32_t *)newrom, CROMSIZE);
>> -	if (bcmp(newrom, fc->config_rom, CROMSIZE) != 0) {
>> -		/* bump generation and reload */
>> -		src->businfo.generation ++;
>> -		/* generation must be between 0x2 and 0xF */
>> -		if (src->businfo.generation < 2)
>> -			src->businfo.generation ++;
>> -		crom_load(src, (uint32_t *)newrom, CROMSIZE);
>> -		bcopy(newrom, (void *)fc->config_rom, CROMSIZE);
>> -	}
>> -	free(newrom, M_FW);
>> +	/*
>> +	 * If the old config rom needs to be overwritten,
>> +	 * bump the businfo.generation indicator to
>> +	 * indicate that we need to be reprobed
>> +	 */
>> +	if (bcmp(src, fc->config_rom, CROMSIZE) != 0) {
>> +		/* generation is a 2 bit field */
>> +		/* valid values are only from 0 - 3 */
>> +		src->businfo.generation = 1;
>> +		bcopy(src, (void *)fc->config_rom, CROMSIZE);
>> +	} else
>> +		src->businfo.generation = 0;
>>  }
>>
>>  /* Call once after reboot */
>> @@ -807,13 +826,7 @@ void fw_init(struct firewire_comm *fc)
>
>Please give this patch at try.  I think this should work.
>
>Sean

After updating the source to CURRENT from yesterday and applying your
last patch to firewire.c, I found out that the external firewire disk was
functional again.

The system information is:

FreeBSD laptop.universe 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Mon Mar 16 09:13:13 EET 2009     
user@laptop.universe:/mnt/ufs/usr/src/sys/CUSTOM  amd64

When the disk attaches the dmesg output is: 

fwohci0: fwohci_intr_core: BUS reset
fwohci0: fwohci_intr_core: node_id=0x00000001, SelfID Count=3, CYCLEMASTER mode
firewire0: 2 nodes, maxhop <= 1 cable IRM irm(1)  (me)
firewire0: bus manager 1
firewire0: New S400 device ID:0020370004a03421
sbp0: sbp_show_sdev_info: sbp0:0:0: ordered:1 type:0 EUI:0020370004a03421 node:0 speed:2 maxrec:8
sbp0: sbp_show_sdev_info: sbp0:0:0 'Seagate' 'ATA Device 00' '000102'
fwohci0: fwohci_intr_core: BUS reset
fwohci0: fwohci_intr_core: node_id=0x00000001, SelfID Count=4, CYCLEMASTER mode
firewire0: 2 nodes, maxhop <= 1 cable IRM irm(1)  (me)
firewire0: bus manager 1
sbp0: sbp_show_sdev_info: sbp0:0:0: ordered:1 type:0 EUI:0020370004a03421 node:0 speed:2 maxrec:8
sbp0: sbp_show_sdev_info: sbp0:0:0 'Seagate' 'ATA Device 00' '000102'
da0 at sbp0 bus 0 target 0 lun 0
da0: <Seagate ATA Device 00 0102> Fixed Direct Access SCSI-4 device
da0: 50.000MB/s transfers
da0: 715404MB (1465149168 512 byte sectors: 255H 63S/T 91201C)

I have not done much testing - so far it seems to be working o.k.

Thank you very much!

Best regards,

Boris Kotzev



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