Re: [PATCH 2/7] MIPS: SGI-IP27: clean up bridge access and header files

From: Christoph Hellwig
Date: Mon Jan 28 2019 - 08:20:11 EST


On Thu, Jan 24, 2019 at 06:47:23PM +0100, Thomas Bogendoerfer wrote:
> #ifndef __ASSEMBLY__
> +/* Address translation entry for mapped pci32 accesses */
> +union bridge_ate {
> + u64 ent;
> + struct ate_s {
> + u64 rmf:16;
> + u64 addr:36;
> + u64 targ:4;
> + u64 reserved:3;
> + u64 barrier:1;
> + u64 prefetch:1;
> + u64 precise:1;
> + u64 coherent:1;
> + u64 valid:1;
> + } field;

Note that we generally try to avoid using bitfields for hardware
descriptions and instead use masking/shifting, possibly hidden in
macros. The portability argument for that doesn't really apply
here as the code is obviously MIPS/big endian specific, but I think
it generally is a good example and more readable as well.