[a522999] | 1 | /*
|
---|
| 2 | * Copyright (c) 2013 Jakub Jermar
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 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.
|
---|
| 16 | *
|
---|
| 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.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | /** @addtogroup mips32
|
---|
| 30 | * @{
|
---|
| 31 | */
|
---|
| 32 | /** @file
|
---|
| 33 | * @brief MIPS Malta platform driver.
|
---|
| 34 | */
|
---|
| 35 |
|
---|
| 36 | #include <arch/mach/malta/malta.h>
|
---|
[b5e17b1] | 37 | #include <console/console.h>
|
---|
| 38 | #include <console/chardev.h>
|
---|
| 39 | #include <arch/mm/page.h>
|
---|
[a522999] | 40 |
|
---|
| 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);
|
---|
| 48 |
|
---|
| 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
|
---|
| 57 | };
|
---|
| 58 |
|
---|
| 59 | void malta_init(void)
|
---|
| 60 | {
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | void malta_cpu_halt(void)
|
---|
| 64 | {
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | void malta_get_memory_extents(uintptr_t *start, size_t *size)
|
---|
| 68 | {
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | void malta_frame_init(void)
|
---|
| 72 | {
|
---|
| 73 | }
|
---|
| 74 |
|
---|
[b5e17b1] | 75 | #define YAMON_SUBR_BASE PA2KA(0x1fc00500)
|
---|
| 76 | #define YAMON_SUBR_PRINT_COUNT (YAMON_SUBR_BASE + 0x4)
|
---|
| 77 |
|
---|
| 78 | typedef void (**yamon_print_count_ptr_t)(uint32_t, const char *, uint32_t);
|
---|
| 79 |
|
---|
| 80 | yamon_print_count_ptr_t yamon_print_count =
|
---|
| 81 | (yamon_print_count_ptr_t) YAMON_SUBR_PRINT_COUNT;
|
---|
| 82 |
|
---|
| 83 | static void yamon_putchar(outdev_t *dev, const wchar_t wch)
|
---|
| 84 | {
|
---|
| 85 |
|
---|
| 86 | const char ch = (char) wch;
|
---|
| 87 |
|
---|
| 88 | (*yamon_print_count)(0, &ch, 1);
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | static outdev_t yamon_outdev;
|
---|
| 92 | static outdev_operations_t yamon_outdev_ops = {
|
---|
| 93 | .write = yamon_putchar,
|
---|
| 94 | .redraw = NULL
|
---|
| 95 | };
|
---|
| 96 |
|
---|
[a522999] | 97 | void malta_output_init(void)
|
---|
| 98 | {
|
---|
[b5e17b1] | 99 | outdev_initialize("yamon", &yamon_outdev, &yamon_outdev_ops);
|
---|
| 100 | stdout_wire(&yamon_outdev);
|
---|
[a522999] | 101 | }
|
---|
| 102 |
|
---|
| 103 | void malta_input_init(void)
|
---|
| 104 | {
|
---|
[7d771d5] | 105 | (void) stdin_wire();
|
---|
[a522999] | 106 | }
|
---|
| 107 |
|
---|
| 108 | const char *malta_get_platform_name(void)
|
---|
| 109 | {
|
---|
| 110 | return "malta";
|
---|
| 111 | }
|
---|
| 112 |
|
---|
| 113 | /** @}
|
---|
| 114 | */
|
---|