Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11db04c8 authored by Paul Martin's avatar Paul Martin Committed by Ralf Baechle
Browse files

MIPS: Octeon: Turn hardware bitfields and structures inside out.



Although the proper way to do this for bitfields would be to use
the macro that Ralf has provided, this is a little easier to
understand as a diff.

Signed-off-by: default avatarPaul Martin <paul.martin@codethink.co.uk>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9628/


Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 0a1cd2c5
Loading
Loading
Loading
Loading
+45 −0
Original line number Original line Diff line number Diff line
@@ -519,44 +519,89 @@ int cvmx_l2c_unlock_mem_region(uint64_t start, uint64_t len)
union __cvmx_l2c_tag {
union __cvmx_l2c_tag {
	uint64_t u64;
	uint64_t u64;
	struct cvmx_l2c_tag_cn50xx {
	struct cvmx_l2c_tag_cn50xx {
#ifdef __BIG_ENDIAN_BITFIELD
		uint64_t reserved:40;
		uint64_t reserved:40;
		uint64_t V:1;		/* Line valid */
		uint64_t V:1;		/* Line valid */
		uint64_t D:1;		/* Line dirty */
		uint64_t D:1;		/* Line dirty */
		uint64_t L:1;		/* Line locked */
		uint64_t L:1;		/* Line locked */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t addr:20;	/* Phys mem addr (33..14) */
		uint64_t addr:20;	/* Phys mem addr (33..14) */
#else
		uint64_t addr:20;	/* Phys mem addr (33..14) */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t L:1;		/* Line locked */
		uint64_t D:1;		/* Line dirty */
		uint64_t V:1;		/* Line valid */
		uint64_t reserved:40;
#endif
	} cn50xx;
	} cn50xx;
	struct cvmx_l2c_tag_cn30xx {
	struct cvmx_l2c_tag_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
		uint64_t reserved:41;
		uint64_t reserved:41;
		uint64_t V:1;		/* Line valid */
		uint64_t V:1;		/* Line valid */
		uint64_t D:1;		/* Line dirty */
		uint64_t D:1;		/* Line dirty */
		uint64_t L:1;		/* Line locked */
		uint64_t L:1;		/* Line locked */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t addr:19;	/* Phys mem addr (33..15) */
		uint64_t addr:19;	/* Phys mem addr (33..15) */
#else
		uint64_t addr:19;	/* Phys mem addr (33..15) */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t L:1;		/* Line locked */
		uint64_t D:1;		/* Line dirty */
		uint64_t V:1;		/* Line valid */
		uint64_t reserved:41;
#endif
	} cn30xx;
	} cn30xx;
	struct cvmx_l2c_tag_cn31xx {
	struct cvmx_l2c_tag_cn31xx {
#ifdef __BIG_ENDIAN_BITFIELD
		uint64_t reserved:42;
		uint64_t reserved:42;
		uint64_t V:1;		/* Line valid */
		uint64_t V:1;		/* Line valid */
		uint64_t D:1;		/* Line dirty */
		uint64_t D:1;		/* Line dirty */
		uint64_t L:1;		/* Line locked */
		uint64_t L:1;		/* Line locked */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t addr:18;	/* Phys mem addr (33..16) */
		uint64_t addr:18;	/* Phys mem addr (33..16) */
#else
		uint64_t addr:18;	/* Phys mem addr (33..16) */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t L:1;		/* Line locked */
		uint64_t D:1;		/* Line dirty */
		uint64_t V:1;		/* Line valid */
		uint64_t reserved:42;
#endif
	} cn31xx;
	} cn31xx;
	struct cvmx_l2c_tag_cn38xx {
	struct cvmx_l2c_tag_cn38xx {
#ifdef __BIG_ENDIAN_BITFIELD
		uint64_t reserved:43;
		uint64_t reserved:43;
		uint64_t V:1;		/* Line valid */
		uint64_t V:1;		/* Line valid */
		uint64_t D:1;		/* Line dirty */
		uint64_t D:1;		/* Line dirty */
		uint64_t L:1;		/* Line locked */
		uint64_t L:1;		/* Line locked */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t addr:17;	/* Phys mem addr (33..17) */
		uint64_t addr:17;	/* Phys mem addr (33..17) */
#else
		uint64_t addr:17;	/* Phys mem addr (33..17) */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t L:1;		/* Line locked */
		uint64_t D:1;		/* Line dirty */
		uint64_t V:1;		/* Line valid */
		uint64_t reserved:43;
#endif
	} cn38xx;
	} cn38xx;
	struct cvmx_l2c_tag_cn58xx {
	struct cvmx_l2c_tag_cn58xx {
#ifdef __BIG_ENDIAN_BITFIELD
		uint64_t reserved:44;
		uint64_t reserved:44;
		uint64_t V:1;		/* Line valid */
		uint64_t V:1;		/* Line valid */
		uint64_t D:1;		/* Line dirty */
		uint64_t D:1;		/* Line dirty */
		uint64_t L:1;		/* Line locked */
		uint64_t L:1;		/* Line locked */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t addr:16;	/* Phys mem addr (33..18) */
		uint64_t addr:16;	/* Phys mem addr (33..18) */
#else
		uint64_t addr:16;	/* Phys mem addr (33..18) */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t L:1;		/* Line locked */
		uint64_t D:1;		/* Line dirty */
		uint64_t V:1;		/* Line valid */
		uint64_t reserved:44;
#endif
	} cn58xx;
	} cn58xx;
	struct cvmx_l2c_tag_cn58xx cn56xx;	/* 2048 sets */
	struct cvmx_l2c_tag_cn58xx cn56xx;	/* 2048 sets */
	struct cvmx_l2c_tag_cn31xx cn52xx;	/* 512 sets */
	struct cvmx_l2c_tag_cn31xx cn52xx;	/* 512 sets */
+67 −0
Original line number Original line Diff line number Diff line
@@ -104,6 +104,7 @@ typedef enum {
typedef union {
typedef union {


	uint64_t u64;
	uint64_t u64;
#ifdef __BIG_ENDIAN_BITFIELD
	/* mapped or unmapped virtual address */
	/* mapped or unmapped virtual address */
	struct {
	struct {
		uint64_t R:2;
		uint64_t R:2;
@@ -202,6 +203,72 @@ typedef union {
		uint64_t didspace:24;
		uint64_t didspace:24;
		uint64_t unused:40;
		uint64_t unused:40;
	} sfilldidspace;
	} sfilldidspace;
#else
	struct {
		uint64_t offset:62;
		uint64_t R:2;
	} sva;

	struct {
		uint64_t offset:31;
		uint64_t zeroes:33;
	} suseg;

	struct {
		uint64_t offset:29;
		uint64_t sp:2;
		uint64_t ones:33;
	} sxkseg;

	struct {
		uint64_t pa:49;
		uint64_t mbz:10;
		uint64_t cca:3;
		uint64_t R:2;
	} sxkphys;

	struct {
		uint64_t offset:36;
		uint64_t unaddr:4;
		uint64_t did:8;
		uint64_t is_io:1;
		uint64_t mbz:15;
	} sphys;

	struct {
		uint64_t offset:36;
		uint64_t unaddr:4;
		uint64_t zeroes:24;
	} smem;

	struct {
		uint64_t offset:36;
		uint64_t unaddr:4;
		uint64_t did:8;
		uint64_t is_io:1;
		uint64_t mbz:13;
		uint64_t mem_region:2;
	} sio;

	struct {
		uint64_t addr:13;
		cvmx_add_win_dec_t csrdec:2;
		uint64_t ones:49;
	} sscr;

	struct {
		uint64_t addr:7;
		uint64_t type:3;
		uint64_t unused2:3;
		uint64_t csrdec:2;
		uint64_t ones:49;
	} sdma;

	struct {
		uint64_t unused:40;
		uint64_t didspace:24;
	} sfilldidspace;
#endif


} cvmx_addr_t;
} cvmx_addr_t;


+14 −0
Original line number Original line Diff line number Diff line
@@ -95,6 +95,7 @@ struct cvmx_bootmem_named_block_desc {
 * positions for backwards compatibility.
 * positions for backwards compatibility.
 */
 */
struct cvmx_bootmem_desc {
struct cvmx_bootmem_desc {
#if defined(__BIG_ENDIAN_BITFIELD) || defined(CVMX_BUILD_FOR_LINUX_HOST)
	/* spinlock to control access to list */
	/* spinlock to control access to list */
	uint32_t lock;
	uint32_t lock;
	/* flags for indicating various conditions */
	/* flags for indicating various conditions */
@@ -120,7 +121,20 @@ struct cvmx_bootmem_desc {
	uint32_t named_block_name_len;
	uint32_t named_block_name_len;
	/* address of named memory block descriptors */
	/* address of named memory block descriptors */
	uint64_t named_block_array_addr;
	uint64_t named_block_array_addr;
#else                           /* __LITTLE_ENDIAN */
	uint32_t flags;
	uint32_t lock;
	uint64_t head_addr;


	uint32_t minor_version;
	uint32_t major_version;
	uint64_t app_data_addr;
	uint64_t app_data_size;

	uint32_t named_block_name_len;
	uint32_t named_block_num_blocks;
	uint64_t named_block_array_addr;
#endif
};
};


/**
/**
+7 −0
Original line number Original line Diff line number Diff line
@@ -49,6 +49,7 @@
typedef union {
typedef union {
	uint64_t u64;
	uint64_t u64;
	struct {
	struct {
#ifdef __BIG_ENDIAN_BITFIELD
		/*
		/*
		 * the (64-bit word) location in scratchpad to write
		 * the (64-bit word) location in scratchpad to write
		 * to (if len != 0)
		 * to (if len != 0)
@@ -63,6 +64,12 @@ typedef union {
		 * the NCB bus.
		 * the NCB bus.
		 */
		 */
		uint64_t addr:40;
		uint64_t addr:40;
#else
		uint64_t addr:40;
		uint64_t did:8;
		uint64_t len:8;
		uint64_t scraddr:8;
#endif
	} s;
	} s;
} cvmx_fpa_iobdma_data_t;
} cvmx_fpa_iobdma_data_t;


+9 −0
Original line number Original line Diff line number Diff line
@@ -53,12 +53,21 @@
union cvmx_l2c_tag {
union cvmx_l2c_tag {
	uint64_t u64;
	uint64_t u64;
	struct {
	struct {
#ifdef __BIG_ENDIAN_BITFIELD
		uint64_t reserved:28;
		uint64_t reserved:28;
		uint64_t V:1;		/* Line valid */
		uint64_t V:1;		/* Line valid */
		uint64_t D:1;		/* Line dirty */
		uint64_t D:1;		/* Line dirty */
		uint64_t L:1;		/* Line locked */
		uint64_t L:1;		/* Line locked */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t addr:32;	/* Phys mem (not all bits valid) */
		uint64_t addr:32;	/* Phys mem (not all bits valid) */
#else
		uint64_t addr:32;	/* Phys mem (not all bits valid) */
		uint64_t U:1;		/* Use, LRU eviction */
		uint64_t L:1;		/* Line locked */
		uint64_t D:1;		/* Line dirty */
		uint64_t V:1;		/* Line valid */
		uint64_t reserved:28;
#endif
	} s;
	} s;
};
};


Loading