Configuration ROM in firewire stack

Sean Bruno sean.bruno at dsl-only.net
Fri Mar 13 07:32:48 PDT 2009


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: firewire.c.diff
Type: text/x-patch
Size: 4553 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-firewire/attachments/20090313/1fb1e009/firewire.c.bin


More information about the freebsd-firewire mailing list