libpayload: Use the same type for 32 bit data in readl as in uint32_t.
The compiler gets mad when the types are equivalent size but not necessarily interchangeable because of strict aliasing checks. Since uint32_t is likely to be used when trying to read 32 bit data, it makes sense for them to be the compatible. This change was originally written for ARM but applies to x86 as well. BUG=None TEST=Built and booted on link. BRANCH=None Change-Id: I91b5e39f40e516405b9802032c87d3b15ed52c23 Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: https://chromium-review.googlesource.com/169121 Reviewed-by: Ronald Minnich <rminnich@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com> Commit-Queue: Gabe Black <gabeblack@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org>
This commit is contained in:
parent
733bf811c8
commit
6bbb073cf6
1 changed files with 4 additions and 4 deletions
|
|
@ -33,13 +33,13 @@
|
|||
|
||||
#define readb(_a) (*(volatile unsigned char *) (_a))
|
||||
#define readw(_a) (*(volatile unsigned short *) (_a))
|
||||
#define readl(_a) (*(volatile unsigned long *) (_a))
|
||||
#define readl(_a) (*(volatile unsigned int *) (_a))
|
||||
|
||||
#define writeb(_v, _a) (*(volatile unsigned char *) (_a) = (_v))
|
||||
#define writew(_v, _a) (*(volatile unsigned short *) (_a) = (_v))
|
||||
#define writel(_v, _a) (*(volatile unsigned long *) (_a) = (_v))
|
||||
#define writel(_v, _a) (*(volatile unsigned int *) (_a) = (_v))
|
||||
|
||||
static inline unsigned long inl(int port)
|
||||
static inline unsigned int inl(int port)
|
||||
{
|
||||
unsigned long val;
|
||||
__asm__ __volatile__("inl %w1, %0" : "=a"(val) : "Nd"(port));
|
||||
|
|
@ -60,7 +60,7 @@ static inline unsigned char inb(int port)
|
|||
return val;
|
||||
}
|
||||
|
||||
static inline void outl(unsigned long val, int port)
|
||||
static inline void outl(unsigned int val, int port)
|
||||
{
|
||||
__asm__ __volatile__("outl %0, %w1" : : "a"(val), "Nd"(port));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue