From owner-freebsd-arch@FreeBSD.ORG Tue Jan 13 14:08:51 2009 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAF641065670 for ; Tue, 13 Jan 2009 14:08:51 +0000 (UTC) (envelope-from rb@gid.co.uk) Received: from mx0.gid.co.uk (mx0.gid.co.uk [194.32.164.250]) by mx1.freebsd.org (Postfix) with ESMTP id 490338FC18 for ; Tue, 13 Jan 2009 14:08:51 +0000 (UTC) (envelope-from rb@gid.co.uk) Received: from gidgate.gid.co.uk (80-46-130-69.static.dsl.as9105.com [80.46.130.69]) by mx0.gid.co.uk (8.14.2/8.14.2) with ESMTP id n0DDqm9x056602; Tue, 13 Jan 2009 13:52:49 GMT (envelope-from rb@gid.co.uk) Received: from [192.168.255.1] (seagoon.gid.co.uk [194.32.164.1]) by gidgate.gid.co.uk (8.13.8/8.13.8) with ESMTP id n0DDqgwb057587; Tue, 13 Jan 2009 13:52:42 GMT (envelope-from rb@gid.co.uk) Message-Id: <284781C0-CC39-42C8-8772-83911A26FA85@gid.co.uk> From: Bob Bishop To: Andriy Gapon In-Reply-To: <496C8C6A.2030708@icyb.net.ua> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Tue, 13 Jan 2009 13:52:42 +0000 References: <496C8C6A.2030708@icyb.net.ua> X-Mailer: Apple Mail (2.930.3) Cc: freebsd-arch@freebsd.org Subject: Re: smb(4): address format X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jan 2009 14:08:52 -0000 Hi, On 13 Jan 2009, at 12:43, Andriy Gapon wrote: > Maybe this is not sufficiently suitable for arch@, but I couldn't > think > of a more relevant list. > > smb(4) conveniently omits specifying what SMBus slave address is. > Ditto > for iic(4). > > As you know the address itself is 7 bit but how to align those bits > within a byte is somewhat ambiguous. Even the SMBus Specification > sometimes refers to a 7-bit value as to a slave address, but sometimes > uses phrases like "Slave Address Bits 7-1". The confusion seems to > come > from how the address is actually transmitted on the wire where the > least > significant bit of an address byte is used to indicate direction of an > operation (read or write). Version 2 of the standard is pretty clear that the MSb of the slave address is transmitted first and the LSb is the r/w indicator, but confusingly labels timing diagrams in bit transmission order so that slave address bit 7 is labelled 1 and the r/w bit is labelled 8. However it is clear from Fig 4-9 that the address bits precede the r/w bit on the wire. > So, in practice, there two conventions of specifying a slave address: > either as 0XXXXXXXb or XXXXXXX0b. While a convention is just that, it would seem to be perverse to put what is clearly the LSb at the left of the byte and I'd vote for XXXXXXX0b. > On FreeBSD we have a situation where smb/smbus doesn't insist on any > convention nor try to enforce it, and specific hardware drivers have > differing ideas. > > E.g. please see PR 100513: > http://www.freebsd.org/cgi/query-pr.cgi?pr=100513 > > This inconsistency can not be a good thing. > Maybe we should pick one format, document it and enforce it? > >> From FreeBSD-centric point of view XXXXXXX0b format seems to be > preferable - IMHO, of course. Majority hardware drivers already expect > this format, userland programs like mbmon and smbmsg(8) also seem to > use it. > > In wider world 0XXXXXXXb format seems to be preferred, Linux also > sticks > to it. > > Of course, choosing one format means changes for those using the other > one, but I think that having current inconsistency is worse. > > P.S. I hope this won't trigger a bikeshed discussion. Can you get a bikeshed with an SMBus interface? :-) > -- > Andriy Gapon -- Bob Bishop rb@gid.co.uk