Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Aug 2006 11:42:30 +0300
From:      Niki Denev <nike_d@cytexbg.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: jkh weird problem (reading pci device memory)
Message-ID:  <44DD9476.7020706@cytexbg.com>
In-Reply-To: <200608071527.50711.jhb@freebsd.org>
References:  <44D4A5DC.7080403@cytexbg.com> <200608071527.50711.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Baldwin wrote:
> On Saturday 05 August 2006 10:06, Niki Denev wrote:
>> 	for(i=0; i < sizeof(config_table_t); i++) {
>> 		r =  bus_space_read_1(sc->bar.tag, sc->bar.hdl, i);
>> 		*((u_int8_t *)&sc->cfg_table + i) =  r;
>> 		}
> 
> Note that you can replace this with:
> 
> 	bus_space_read_multi_1(sc->bar.tag, sc->bar.hdl, 0,
> 	    (u_int8_t *)&sc->cfg_table, sizeof(config_table_t));
> 

I can't understand why the code above gives me different results.
i.e.:

	for(i=0; i < sizeof(config_table_t); i++) {
		*((u_int8_t *)&sc->cfg_table + i) =  bus_read_1(sc->res, i);
	}
	printf("cfg_table signature : %08X\n", sc->cfg_table.signature);

This prints : cfg_table signaature 0xEFEFFEFE, which is the correct signature
that should be read from the card.

But this code :

	bus_read_multi_1(sc->res, 0, (u_int8_t *)&sc->cfg_table, sizeof(config_table_t));
	printf("cfg_table signature : %08X\n", sc->cfg_table.signature);

prints : cfg_table signature 0xFEFEFEFE
which is not correct...

Shouldn't the above examples do exactly the same thing?


- --niki
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE3ZR2HNAJ/fLbfrkRAlVBAJ42fHV0cQ4uw5SIdUl7TQHaKkBSKQCZAcd6
eCFWNusXoCuqm88OObX+AFw=
=J0mZ
-----END PGP SIGNATURE-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44DD9476.7020706>