-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fvp dram1 #1860
Fvp dram1 #1860
Changes from all commits
6592db5
090b89c
bdf5355
cb7f218
c73de40
7980b88
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,22 +165,56 @@ static inline const char *teecore_memtype_name(enum teecore_memtypes type) | |
struct core_mmu_phys_mem { | ||
const char *name; | ||
enum teecore_memtypes type; | ||
paddr_t addr; | ||
size_t size; | ||
__extension__ union { | ||
#if __SIZEOF_LONG__ != __SIZEOF_PADDR__ | ||
struct { | ||
uint32_t lo_addr; | ||
uint32_t hi_addr; | ||
}; | ||
#endif | ||
paddr_t addr; | ||
}; | ||
__extension__ union { | ||
#if __SIZEOF_LONG__ != __SIZEOF_PADDR__ | ||
struct { | ||
uint32_t lo_size; | ||
uint32_t hi_size; | ||
}; | ||
#endif | ||
paddr_size_t size; | ||
}; | ||
}; | ||
|
||
#define __register_memory2(_name, _type, _addr, _size, _section, _id) \ | ||
static const struct core_mmu_phys_mem __phys_mem_ ## _id \ | ||
__used __section(_section) = \ | ||
{ .name = _name, .type = _type, .addr = _addr, .size = _size } | ||
|
||
#if __SIZEOF_LONG__ != __SIZEOF_PADDR__ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks strange to have 2 macros
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need both the normal and the _ul version. The normal is needed when supplying 64-bit addresses from a proper constant, while the _ul version must be used when initializing from variables provided by the link script. It's not beautiful and have some sharp corners, but I can't find a way around it. |
||
#define __register_memory2_ul(_name, _type, _addr, _size, _section, _id) \ | ||
static const struct core_mmu_phys_mem __phys_mem_ ## _id \ | ||
__used __section(_section) = \ | ||
{ .name = _name, .type = _type, .lo_addr = _addr, \ | ||
.lo_size = _size } | ||
#else | ||
#define __register_memory2_ul(_name, _type, _addr, _size, _section, _id) \ | ||
__register_memory2(_name, _type, _addr, _size, _section, _id) | ||
#endif | ||
|
||
#define __register_memory1(name, type, addr, size, section, id) \ | ||
__register_memory2(name, type, addr, size, #section, id) | ||
|
||
#define __register_memory1_ul(name, type, addr, size, section, id) \ | ||
__register_memory2_ul(name, type, addr, size, #section, id) | ||
|
||
#define register_phys_mem(type, addr, size) \ | ||
__register_memory1(#addr, (type), (addr), (size), \ | ||
phys_mem_map_section, __COUNTER__) | ||
|
||
#define register_phys_mem_ul(type, addr, size) \ | ||
__register_memory1_ul(#addr, (type), (addr), (size), \ | ||
phys_mem_map_section, __COUNTER__) | ||
|
||
#define register_sdp_mem(addr, size) \ | ||
__register_memory1(#addr, MEM_AREA_SDP_MEM, (addr), (size), \ | ||
phys_sdp_mem_section, __COUNTER__) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As these hold physical addresses/sizes,
CFG_CORE_LARGE_PHYS_ADDR=y
requires 64bit fields here. Why doesn'tpaddr_t
fit?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Static initialization based on addresses of variables seems to the a bit fragile. As soon as there's a 64-bit type on a 32-bit system involved the compiler tends to complain.
unsigned long
should be a good enough compromise for all systems.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok