2
* Copyright (c) 2013 Jakub Jermar
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
9
* - Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* - Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
14
* - The name of the author may not be used to endorse or promote products
15
* derived from this software without specific prior written permission.
17
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
/** @addtogroup mips32
33
* @brief MIPS Malta platform driver.
36
#include <arch/mach/malta/malta.h>
37
#include <console/console.h>
38
#include <console/chardev.h>
39
#include <arch/mm/page.h>
41
static void malta_init(void);
42
static void malta_cpu_halt(void);
43
static void malta_get_memory_extents(uintptr_t *, size_t *);
44
static void malta_frame_init(void);
45
static void malta_output_init(void);
46
static void malta_input_init(void);
47
static const char *malta_get_platform_name(void);
49
struct mips32_machine_ops malta_machine_ops = {
50
.machine_init = malta_init,
51
.machine_cpu_halt = malta_cpu_halt,
52
.machine_get_memory_extents = malta_get_memory_extents,
53
.machine_frame_init = malta_frame_init,
54
.machine_output_init = malta_output_init,
55
.machine_input_init = malta_input_init,
56
.machine_get_platform_name = malta_get_platform_name
63
void malta_cpu_halt(void)
67
void malta_get_memory_extents(uintptr_t *start, size_t *size)
71
void malta_frame_init(void)
75
#define YAMON_SUBR_BASE PA2KA(0x1fc00500)
76
#define YAMON_SUBR_PRINT_COUNT (YAMON_SUBR_BASE + 0x4)
78
typedef void (**yamon_print_count_ptr_t)(uint32_t, const char *, uint32_t);
80
yamon_print_count_ptr_t yamon_print_count =
81
(yamon_print_count_ptr_t) YAMON_SUBR_PRINT_COUNT;
83
static void yamon_putchar(outdev_t *dev, const wchar_t wch)
86
const char ch = (char) wch;
88
(*yamon_print_count)(0, &ch, 1);
91
static outdev_t yamon_outdev;
92
static outdev_operations_t yamon_outdev_ops = {
93
.write = yamon_putchar,
97
void malta_output_init(void)
99
outdev_initialize("yamon", &yamon_outdev, &yamon_outdev_ops);
100
stdout_wire(&yamon_outdev);
103
void malta_input_init(void)
107
const char *malta_get_platform_name(void)