From owner-freebsd-firewire@FreeBSD.ORG Fri Mar 13 06:05:42 2009 Return-Path: Delivered-To: firewire@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B65391065678 for ; Fri, 13 Mar 2009 06:05:42 +0000 (UTC) (envelope-from freebsd@gm.nunu.org) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.171]) by mx1.freebsd.org (Postfix) with ESMTP id 99AC58FC12 for ; Fri, 13 Mar 2009 06:05:42 +0000 (UTC) (envelope-from freebsd@gm.nunu.org) Received: by wf-out-1314.google.com with SMTP id 27so1511637wfd.7 for ; Thu, 12 Mar 2009 23:05:42 -0700 (PDT) MIME-Version: 1.0 Sender: freebsd@gm.nunu.org Received: by 10.142.105.10 with SMTP id d10mr374663wfc.71.1236922942209; Thu, 12 Mar 2009 22:42:22 -0700 (PDT) Date: Fri, 13 Mar 2009 14:42:22 +0900 X-Google-Sender-Auth: 90c4c3bacaf906c0 Message-ID: <626eb4530903122242y4202739cg70d69aba84197107@mail.gmail.com> From: Hidetoshi Shimokawa To: Sean Bruno Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: nork@freebsd.org, firewire@freebsd.org Subject: Configuration ROM in firewire stack X-BeenThere: freebsd-firewire@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Firewire support in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Mar 2009 06:05:43 -0000 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