mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-17 07:28:51 +09:00
![Masahiro Yamada](/assets/img/avatar_default.png)
When we import code from Linux, with regular re-sync planned, we want to use printk() and pr_*(). U-Boot does not support them in a clean way. So, people end up with local macros, or compat headers here and there, then we occasionally see build errors of definition conflicts. We have include/linux/compat.h, but putting all sorts of unrelated things into a single header is just a temporal workaround. Hence this patch, to find the best home for all printk variants. If you want to use printk() and friends, please include <linux/printk.h>. This header is self-contained, and pulls in only a few headers. When I was testing this clean-up, I noticed the image size exceeded its platform limit on some boards. This is because all pr_*() that were previously defined as no-op in include/linux/mtd/mtd.h (unless CONFIG_MTD_DEBUG is set), are now enabled. To make such boards happy, this commit also implements CONFIG_LOGLEVEL. The concept is similar to the kernel parameter "loglevel". (Actually, the Kconfig help message was taken from kernel-paremeter.txt of Linux) Messages with a loglevel smaller than console loglevel will be printed. The difference is the loglevel is build-time determined. To save the image size, lower priority pr_*() are compiled out. I set the default of CONFIG_LOGLEVEL to 6, i.e. pr_notice and higher priority messages are compiled in. I adjusted CONFIG_LOGLEVEL to avoid build error for some boards. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> [trini: Add in SPL_LOGLEVEL that is the same as LOGLEVEL] Signed-off-by: Tom Rini <trini@konsulko.com>
99 lines
3.5 KiB
C
99 lines
3.5 KiB
C
/****************************************************************************
|
|
*
|
|
* Realmode X86 Emulator Library
|
|
*
|
|
* Copyright (C) 1991-2004 SciTech Software, Inc.
|
|
* Copyright (C) David Mosberger-Tang
|
|
* Copyright (C) 1999 Egbert Eich
|
|
*
|
|
* ========================================================================
|
|
*
|
|
* Permission to use, copy, modify, distribute, and sell this software and
|
|
* its documentation for any purpose is hereby granted without fee,
|
|
* provided that the above copyright notice appear in all copies and that
|
|
* both that copyright notice and this permission notice appear in
|
|
* supporting documentation, and that the name of the authors not be used
|
|
* in advertising or publicity pertaining to distribution of the software
|
|
* without specific, written prior permission. The authors makes no
|
|
* representations about the suitability of this software for any purpose.
|
|
* It is provided "as is" without express or implied warranty.
|
|
*
|
|
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
|
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
*
|
|
* ========================================================================
|
|
*
|
|
* Language: ANSI C
|
|
* Environment: Any
|
|
* Developer: Kendall Bennett
|
|
*
|
|
* Description: Header file for system specific functions. These functions
|
|
* are always compiled and linked in the OS depedent libraries,
|
|
* and never in a binary portable driver.
|
|
*
|
|
****************************************************************************/
|
|
|
|
#ifndef __X86EMU_X86EMUI_H
|
|
#define __X86EMU_X86EMUI_H
|
|
|
|
/* If we are compiling in C++ mode, we can compile some functions as
|
|
* inline to increase performance (however the code size increases quite
|
|
* dramatically in this case).
|
|
*/
|
|
|
|
#if defined(__cplusplus) && !defined(_NO_INLINE)
|
|
#define _INLINE inline
|
|
#else
|
|
#define _INLINE static
|
|
#endif
|
|
|
|
/* Get rid of unused parameters in C++ compilation mode */
|
|
|
|
#ifdef __cplusplus
|
|
#define X86EMU_UNUSED(v)
|
|
#else
|
|
#define X86EMU_UNUSED(v) v
|
|
#endif
|
|
|
|
#include "x86emu.h"
|
|
#include "x86emu/regs.h"
|
|
#include "x86emu/debug.h"
|
|
#include "x86emu/decode.h"
|
|
#include "x86emu/ops.h"
|
|
#include "x86emu/prim_ops.h"
|
|
#ifndef __KERNEL__
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#endif
|
|
|
|
/*--------------------------- Inline Functions ----------------------------*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" { /* Use "C" linkage when in C++ mode */
|
|
#endif
|
|
|
|
extern u8(X86APIP sys_rdb) (u32 addr);
|
|
extern u16(X86APIP sys_rdw) (u32 addr);
|
|
extern u32(X86APIP sys_rdl) (u32 addr);
|
|
extern void (X86APIP sys_wrb) (u32 addr, u8 val);
|
|
extern void (X86APIP sys_wrw) (u32 addr, u16 val);
|
|
extern void (X86APIP sys_wrl) (u32 addr, u32 val);
|
|
|
|
extern u8(X86APIP sys_inb) (X86EMU_pioAddr addr);
|
|
extern u16(X86APIP sys_inw) (X86EMU_pioAddr addr);
|
|
extern u32(X86APIP sys_inl) (X86EMU_pioAddr addr);
|
|
extern void (X86APIP sys_outb) (X86EMU_pioAddr addr, u8 val);
|
|
extern void (X86APIP sys_outw) (X86EMU_pioAddr addr, u16 val);
|
|
extern void (X86APIP sys_outl) (X86EMU_pioAddr addr, u32 val);
|
|
|
|
#ifdef __cplusplus
|
|
} /* End of "C" linkage for C++ */
|
|
#endif
|
|
#endif /* __X86EMU_X86EMUI_H */
|