Fix Yabel compilation on non-x86 platforms
Mostly preventing inb/outb being used on non-x86 Change-Id: I0434df4ce477c262337672867dc6ce398ff95279 Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: http://review.coreboot.org/2002 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
parent
4c4dd93be7
commit
91f1423cac
|
@ -157,7 +157,7 @@ config YABEL_VIRTMEM_LOCATION
|
||||||
config YABEL_DIRECTHW
|
config YABEL_DIRECTHW
|
||||||
prompt "Direct hardware access"
|
prompt "Direct hardware access"
|
||||||
bool
|
bool
|
||||||
depends on PCI_OPTION_ROM_RUN_YABEL
|
depends on PCI_OPTION_ROM_RUN_YABEL && ARCH_X86
|
||||||
help
|
help
|
||||||
YABEL consists of two parts: It uses x86emu for the CPU emulation and
|
YABEL consists of two parts: It uses x86emu for the CPU emulation and
|
||||||
additionally provides a PC system emulation that filters bad device
|
additionally provides a PC system emulation that filters bad device
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
void outb(u8 val, u16 port);
|
||||||
|
void outw(u16 val, u16 port);
|
||||||
|
void outl(u32 val, u16 port);
|
||||||
|
|
||||||
|
u8 inb(u16 port);
|
||||||
|
u16 inw(u16 port);
|
||||||
|
u32 inl(u16 port);
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include <arch/io.h>
|
#include <arch/io.h>
|
||||||
#include <x86emu/x86emu.h>
|
#include <x86emu/x86emu.h>
|
||||||
#include <x86emu/regs.h>
|
#include <x86emu/regs.h>
|
||||||
|
#include <device/oprom/include/io.h>
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "prim_ops.h"
|
#include "prim_ops.h"
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,8 @@ unsigned long tb_freq = 0;
|
||||||
|
|
||||||
u64 get_time(void)
|
u64 get_time(void)
|
||||||
{
|
{
|
||||||
u64 act;
|
u64 act = 0;
|
||||||
|
#if CONFIG_ARCH_X86
|
||||||
u32 eax, edx;
|
u32 eax, edx;
|
||||||
|
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
|
@ -55,5 +56,6 @@ u64 get_time(void)
|
||||||
: "=a"(eax), "=d"(edx)
|
: "=a"(eax), "=d"(edx)
|
||||||
: /* no inputs, no clobber */);
|
: /* no inputs, no clobber */);
|
||||||
act = ((u64) edx << 32) | eax;
|
act = ((u64) edx << 32) | eax;
|
||||||
|
#endif
|
||||||
return act;
|
return act;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ u8 biosemu_dev_translate_address(int type, unsigned long * addr);
|
||||||
static inline void
|
static inline void
|
||||||
out32le(void *addr, u32 val)
|
out32le(void *addr, u32 val)
|
||||||
{
|
{
|
||||||
#ifdef __i386
|
#if CONFIG_ARCH_X86 || CONFIG_ARCH_ARMV7
|
||||||
*((u32*) addr) = cpu_to_le32(val);
|
*((u32*) addr) = cpu_to_le32(val);
|
||||||
#else
|
#else
|
||||||
asm volatile ("stwbrx %0, 0, %1"::"r" (val), "r"(addr));
|
asm volatile ("stwbrx %0, 0, %1"::"r" (val), "r"(addr));
|
||||||
|
@ -139,7 +139,7 @@ static inline u32
|
||||||
in32le(void *addr)
|
in32le(void *addr)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
#ifdef __i386
|
#if CONFIG_ARCH_X86 || CONFIG_ARCH_ARMV7
|
||||||
val = cpu_to_le32(*((u32 *) addr));
|
val = cpu_to_le32(*((u32 *) addr));
|
||||||
#else
|
#else
|
||||||
asm volatile ("lwbrx %0, 0, %1":"=r" (val):"r"(addr));
|
asm volatile ("lwbrx %0, 0, %1":"=r" (val):"r"(addr));
|
||||||
|
@ -150,7 +150,7 @@ in32le(void *addr)
|
||||||
static inline void
|
static inline void
|
||||||
out16le(void *addr, u16 val)
|
out16le(void *addr, u16 val)
|
||||||
{
|
{
|
||||||
#ifdef __i386
|
#if CONFIG_ARCH_X86 || CONFIG_ARCH_ARMV7
|
||||||
*((u16*) addr) = cpu_to_le16(val);
|
*((u16*) addr) = cpu_to_le16(val);
|
||||||
#else
|
#else
|
||||||
asm volatile ("sthbrx %0, 0, %1"::"r" (val), "r"(addr));
|
asm volatile ("sthbrx %0, 0, %1"::"r" (val), "r"(addr));
|
||||||
|
@ -161,7 +161,7 @@ static inline u16
|
||||||
in16le(void *addr)
|
in16le(void *addr)
|
||||||
{
|
{
|
||||||
u16 val;
|
u16 val;
|
||||||
#ifdef __i386
|
#if CONFIG_ARCH_X86 || CONFIG_ARCH_ARMV7
|
||||||
val = cpu_to_le16(*((u16*) addr));
|
val = cpu_to_le16(*((u16*) addr));
|
||||||
#else
|
#else
|
||||||
asm volatile ("lhbrx %0, 0, %1":"=r" (val):"r"(addr));
|
asm volatile ("lhbrx %0, 0, %1":"=r" (val):"r"(addr));
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include <x86emu/x86emu.h>
|
#include <x86emu/x86emu.h>
|
||||||
|
#include <device/oprom/include/io.h>
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
|
|
||||||
#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
|
#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
|
||||||
|
@ -74,6 +75,9 @@ inl(u16 port)
|
||||||
HALT_SYS();
|
HALT_SYS();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef CONFIG_PCI
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_YABEL_DIRECTHW
|
#if CONFIG_YABEL_DIRECTHW
|
||||||
|
@ -136,13 +140,13 @@ read_io(void *addr, size_t sz)
|
||||||
|
|
||||||
switch (sz) {
|
switch (sz) {
|
||||||
case 1:
|
case 1:
|
||||||
asm volatile ("inb %1, %b0" : "=a"(ret) : "d" (port));
|
ret = inb(port);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
asm volatile ("inw %1, %w0" : "=a"(ret) : "d" (port));
|
ret = inw(port);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
asm volatile ("inl %1, %0" : "=a"(ret) : "d" (port));
|
ret = inl(port);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -158,13 +162,13 @@ write_io(void *addr, unsigned int value, size_t sz)
|
||||||
switch (sz) {
|
switch (sz) {
|
||||||
/* since we are using inb instructions, we need the port number as 16bit value */
|
/* since we are using inb instructions, we need the port number as 16bit value */
|
||||||
case 1:
|
case 1:
|
||||||
asm volatile ("outb %b0, %1" : : "a"(value), "d" (port));
|
outb(value, port);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
asm volatile ("outw %w0, %1" : : "a"(value), "d" (port));
|
outw(value, port);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
asm volatile ("outl %0, %1" : : "a"(value), "d" (port));
|
outl(value, port);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue