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

From: Thomas Bogendoerfer
Date: Mon Jan 28 2019 - 08:24:45 EST


On Mon, 28 Jan 2019 05:20:03 -0800
Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:

> 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.

I totally agreed. I only moved the original defintion around while cleaning
up the header file. Right now there is no code using it. Should I remove it
and access macros as soon there is a need for it ?

Thomas.

--
SUSE Linux GmbH
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)