From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 7 22:05:52 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 53E7116A4DE; Mon, 7 Aug 2006 22:05:52 +0000 (UTC) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (gate.funkthat.com [69.17.45.168]) by mx1.FreeBSD.org (Postfix) with ESMTP id CC03A43D69; Mon, 7 Aug 2006 22:05:51 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (urrj39rygb7s74oq@localhost.funkthat.com [127.0.0.1]) by hydrogen.funkthat.com (8.13.6/8.13.3) with ESMTP id k77M5pgs044318; Mon, 7 Aug 2006 15:05:51 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.13.6/8.13.3/Submit) id k77M5pMW044317; Mon, 7 Aug 2006 15:05:51 -0700 (PDT) (envelope-from jmg) Date: Mon, 7 Aug 2006 15:05:51 -0700 From: John-Mark Gurney To: John Baldwin Message-ID: <20060807220550.GF99774@funkthat.com> Mail-Followup-To: John Baldwin , freebsd-hackers@freebsd.org References: <44D4A5DC.7080403@cytexbg.com> <200608071527.50711.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200608071527.50711.jhb@freebsd.org> User-Agent: Mutt/1.4.2.1i X-Operating-System: FreeBSD 5.4-RELEASE-p6 i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html 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 Reply-To: John-Mark Gurney List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2006 22:05:52 -0000 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... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."