mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-05 07:36:56 +07:00
1197ab2942
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (106 commits) powerpc/p3060qds: Add support for P3060QDS board powerpc/83xx: Add shutdown request support to MCU handling on MPC8349 MITX powerpc/85xx: Make kexec to interate over online cpus powerpc/fsl_booke: Fix comment in head_fsl_booke.S powerpc/85xx: issue 15 EOI after core reset for FSL CoreNet devices powerpc/8xxx: Fix interrupt handling in MPC8xxx GPIO driver powerpc/85xx: Add 'fsl,pq3-gpio' compatiable for GPIO driver powerpc/86xx: Correct Gianfar support for GE boards powerpc/cpm: Clear muram before it is in use. drivers/virt: add ioctl for 32-bit compat on 64-bit to fsl-hv-manager powerpc/fsl_msi: add support for "msi-address-64" property powerpc/85xx: Setup secondary cores PIR with hard SMP id powerpc/fsl-booke: Fix settlbcam for 64-bit powerpc/85xx: Adding DCSR node to dtsi device trees powerpc/85xx: clean up FPGA device tree nodes for Freecsale QorIQ boards powerpc/85xx: fix PHYS_64BIT selection for P1022DS powerpc/fsl-booke: Fix setup_initial_memory_limit to not blindly map powerpc: respect mem= setting for early memory limit setup powerpc: Update corenet64_smp_defconfig powerpc: Update mpc85xx/corenet 32-bit defconfigs ... Fix up trivial conflicts in: - arch/powerpc/configs/40x/hcu4_defconfig removed stale file, edited elsewhere - arch/powerpc/include/asm/udbg.h, arch/powerpc/kernel/udbg.c: added opal and gelic drivers vs added ePAPR driver - drivers/tty/serial/8250.c moved UPIO_TSI to powerpc vs removed UPIO_DWAPB support
210 lines
4.6 KiB
C
210 lines
4.6 KiB
C
/*
|
|
* polling mode stateless debugging stuff, originally for NS16550 Serial Ports
|
|
*
|
|
* c 2001 PPC 64 Team, IBM Corp
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version
|
|
* 2 of the License, or (at your option) any later version.
|
|
*/
|
|
|
|
#include <stdarg.h>
|
|
#include <linux/types.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/console.h>
|
|
#include <linux/init.h>
|
|
#include <asm/processor.h>
|
|
#include <asm/udbg.h>
|
|
|
|
void (*udbg_putc)(char c);
|
|
void (*udbg_flush)(void);
|
|
int (*udbg_getc)(void);
|
|
int (*udbg_getc_poll)(void);
|
|
|
|
/*
|
|
* Early debugging facilities. You can enable _one_ of these via .config,
|
|
* if you do so your kernel _will not boot_ on anything else. Be careful.
|
|
*/
|
|
void __init udbg_early_init(void)
|
|
{
|
|
#if defined(CONFIG_PPC_EARLY_DEBUG_LPAR)
|
|
/* For LPAR machines that have an HVC console on vterm 0 */
|
|
udbg_init_debug_lpar();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_LPAR_HVSI)
|
|
/* For LPAR machines that have an HVSI console on vterm 0 */
|
|
udbg_init_debug_lpar_hvsi();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_G5)
|
|
/* For use on Apple G5 machines */
|
|
udbg_init_pmac_realmode();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS_PANEL)
|
|
/* RTAS panel debug */
|
|
udbg_init_rtas_panel();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS_CONSOLE)
|
|
/* RTAS console debug */
|
|
udbg_init_rtas_console();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE)
|
|
/* Maple real mode debug */
|
|
udbg_init_maple_realmode();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_ISERIES)
|
|
/* For iSeries - hit Ctrl-x Ctrl-x to see the output */
|
|
udbg_init_iseries();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_BEAT)
|
|
udbg_init_debug_beat();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_PAS_REALMODE)
|
|
udbg_init_pas_realmode();
|
|
#elif defined(CONFIG_BOOTX_TEXT)
|
|
udbg_init_btext();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_44x)
|
|
/* PPC44x debug */
|
|
udbg_init_44x_as1();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_40x)
|
|
/* PPC40x debug */
|
|
udbg_init_40x_realmode();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_CPM)
|
|
udbg_init_cpm();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_USBGECKO)
|
|
udbg_init_usbgecko();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_WSP)
|
|
udbg_init_wsp();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_EHV_BC)
|
|
udbg_init_ehv_bc();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_PS3GELIC)
|
|
udbg_init_ps3gelic();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_OPAL_RAW)
|
|
udbg_init_debug_opal_raw();
|
|
#elif defined(CONFIG_PPC_EARLY_DEBUG_OPAL_HVSI)
|
|
udbg_init_debug_opal_hvsi();
|
|
#endif
|
|
|
|
#ifdef CONFIG_PPC_EARLY_DEBUG
|
|
console_loglevel = 10;
|
|
|
|
register_early_udbg_console();
|
|
#endif
|
|
}
|
|
|
|
/* udbg library, used by xmon et al */
|
|
void udbg_puts(const char *s)
|
|
{
|
|
if (udbg_putc) {
|
|
char c;
|
|
|
|
if (s && *s != '\0') {
|
|
while ((c = *s++) != '\0')
|
|
udbg_putc(c);
|
|
}
|
|
|
|
if (udbg_flush)
|
|
udbg_flush();
|
|
}
|
|
#if 0
|
|
else {
|
|
printk("%s", s);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
int udbg_write(const char *s, int n)
|
|
{
|
|
int remain = n;
|
|
char c;
|
|
|
|
if (!udbg_putc)
|
|
return 0;
|
|
|
|
if (s && *s != '\0') {
|
|
while (((c = *s++) != '\0') && (remain-- > 0)) {
|
|
udbg_putc(c);
|
|
}
|
|
}
|
|
|
|
if (udbg_flush)
|
|
udbg_flush();
|
|
|
|
return n - remain;
|
|
}
|
|
|
|
int udbg_read(char *buf, int buflen)
|
|
{
|
|
char *p = buf;
|
|
int i, c;
|
|
|
|
if (!udbg_getc)
|
|
return 0;
|
|
|
|
for (i = 0; i < buflen; ++i) {
|
|
do {
|
|
c = udbg_getc();
|
|
if (c == -1 && i == 0)
|
|
return -1;
|
|
|
|
} while (c == 0x11 || c == 0x13);
|
|
if (c == 0 || c == -1)
|
|
break;
|
|
*p++ = c;
|
|
}
|
|
|
|
return i;
|
|
}
|
|
|
|
#define UDBG_BUFSIZE 256
|
|
void udbg_printf(const char *fmt, ...)
|
|
{
|
|
char buf[UDBG_BUFSIZE];
|
|
va_list args;
|
|
|
|
va_start(args, fmt);
|
|
vsnprintf(buf, UDBG_BUFSIZE, fmt, args);
|
|
udbg_puts(buf);
|
|
va_end(args);
|
|
}
|
|
|
|
void __init udbg_progress(char *s, unsigned short hex)
|
|
{
|
|
udbg_puts(s);
|
|
udbg_puts("\n");
|
|
}
|
|
|
|
/*
|
|
* Early boot console based on udbg
|
|
*/
|
|
static void udbg_console_write(struct console *con, const char *s,
|
|
unsigned int n)
|
|
{
|
|
udbg_write(s, n);
|
|
}
|
|
|
|
static struct console udbg_console = {
|
|
.name = "udbg",
|
|
.write = udbg_console_write,
|
|
.flags = CON_PRINTBUFFER | CON_ENABLED | CON_BOOT | CON_ANYTIME,
|
|
.index = 0,
|
|
};
|
|
|
|
static int early_console_initialized;
|
|
|
|
/*
|
|
* Called by setup_system after ppc_md->probe and ppc_md->early_init.
|
|
* Call it again after setting udbg_putc in ppc_md->setup_arch.
|
|
*/
|
|
void __init register_early_udbg_console(void)
|
|
{
|
|
if (early_console_initialized)
|
|
return;
|
|
|
|
if (!udbg_putc)
|
|
return;
|
|
|
|
if (strstr(boot_command_line, "udbg-immortal")) {
|
|
printk(KERN_INFO "early console immortal !\n");
|
|
udbg_console.flags &= ~CON_BOOT;
|
|
}
|
|
early_console_initialized = 1;
|
|
register_console(&udbg_console);
|
|
}
|
|
|
|
#if 0 /* if you want to use this as a regular output console */
|
|
console_initcall(register_udbg_console);
|
|
#endif
|