From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 8 18:02:08 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3804416A512 for ; Tue, 8 Aug 2006 18:02:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4CD7643D45 for ; Tue, 8 Aug 2006 18:02:07 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id k78I1vku051917; Tue, 8 Aug 2006 14:02:05 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: John-Mark Gurney Date: Tue, 8 Aug 2006 13:42:51 -0400 User-Agent: KMail/1.9.1 References: <44D4A5DC.7080403@cytexbg.com> <200608071527.50711.jhb@freebsd.org> <20060807220550.GF99774@funkthat.com> In-Reply-To: <20060807220550.GF99774@funkthat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200608081342.51800.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Tue, 08 Aug 2006 14:02:06 -0400 (EDT) X-Virus-Scanned: ClamAV 0.87.1/1640/Mon Aug 7 21:11:04 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: freebsd-hackers@freebsd.org Subject: Re: jkh weird problem (reading pci device memory) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Aug 2006 18:02:08 -0000 On Monday 07 August 2006 18:05, John-Mark Gurney wrote: > John Baldwin wrote this message on Mon, Aug 07, 2006 at 15:27 -0400: > > sc->cfg_table.signature = letoh32(bus_read_4(sc->bar.res, 0)); > > sc->cfg_table.version = letoh16(bus_read_2(sc->bar.res, 4)); > > sc->cfg_table.dummy = bus_read_1(sc->bar.res, 5); > > Note that this may or may not be correct... the bus_read_X macros > do endian conversion if the bus is of different endianness than the > processor arch... So if the device is on a PCI bus, and the machine > is sparc64, the bus_read_X will already be swapped as necessary... If > you don't want the byte swapping to be done for you, there are the > _stream versions... The are useful for transfering data like disk > data that needs to maintain the same order... Then why are folks adding these macros to things like mpt? -- John Baldwin