libpayload: x86: correct types used for IO
libpayload on x86 defines u32 and uint32_t as typedefs of unsigned int. However, the readl/writel routines use long. With alias checking this throws type punning errors. Align the readl/writel/inl/outl types with the 32-bit fixed width ones that are exposed. Change-Id: Ie51cff8af4596948f6132e3cb743f1bc4ea8f204 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/10186 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
parent
1f04e94b79
commit
0a50d9b353
|
@ -33,13 +33,13 @@
|
||||||
|
|
||||||
#define readb(_a) (*(volatile const unsigned char *) (_a))
|
#define readb(_a) (*(volatile const unsigned char *) (_a))
|
||||||
#define readw(_a) (*(volatile const unsigned short *) (_a))
|
#define readw(_a) (*(volatile const unsigned short *) (_a))
|
||||||
#define readl(_a) (*(volatile const unsigned long *) (_a))
|
#define readl(_a) (*(volatile const unsigned int *) (_a))
|
||||||
|
|
||||||
#define writeb(_v, _a) (*(volatile unsigned char *) (_a) = (_v))
|
#define writeb(_v, _a) (*(volatile unsigned char *) (_a) = (_v))
|
||||||
#define writew(_v, _a) (*(volatile unsigned short *) (_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;
|
unsigned long val;
|
||||||
__asm__ __volatile__("inl %w1, %0" : "=a"(val) : "Nd"(port));
|
__asm__ __volatile__("inl %w1, %0" : "=a"(val) : "Nd"(port));
|
||||||
|
@ -60,7 +60,7 @@ static inline unsigned char inb(int port)
|
||||||
return val;
|
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));
|
__asm__ __volatile__("outl %0, %w1" : : "a"(val), "Nd"(port));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue