Date: Fri, 13 Mar 2009 14:42:22 +0900 From: Hidetoshi Shimokawa <simokawa@FreeBSD.ORG> To: Sean Bruno <sbruno@miralink.com> Cc: nork@freebsd.org, firewire@freebsd.org Subject: Configuration ROM in firewire stack Message-ID: <626eb4530903122242y4202739cg70d69aba84197107@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
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@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) -- /\ Hidetoshi Shimokawa \/ simokawa@FreeBSD.ORG
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?626eb4530903122242y4202739cg70d69aba84197107>