source: mainline/boot/arch/sparc32/include/ambapp.h@ ef9a2a8

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since ef9a2a8 was b6b02c0, checked in by Jakub Klama <jakub.klama@…>, 12 years ago

Initial work on sparc32 architecture support.

  • /boot/arch/sparc32 loosely based on arm32 port
  • /kernel/arch/sparc32 based on abs32le template
  • /uspace/lib/c/arch/sparc32 based on sparc64 implementation with incompatible parts temporarily commented out.

Work currently done:

  • AMBA plug and play support in loader
  • initial MMU setup
  • kernel booting
  • register window traps
  • context_save_arch/context_restore_arch

Completed milestones: M1, M2

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2 * Copyright (c) 2013 Jakub Klama
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 sparc32boot
30 * @{
31 */
32/** @file
33 * @brief Definitions of structures and addresses of AMBA Plug&Play interface
34 */
35
36#ifndef BOOT_sparc32_AMBAPP_H
37#define BOOT_sparc32_AMBAPP_H
38
39#define AMBAPP_MAX_DEVICES 64
40#define AMBAPP_AHBMASTER_AREA 0xfffff000
41#define AMBAPP_AHBSLAVE_AREA 0xfffff800
42#define AMBAPP_CONF_AREA 0xff000
43
44typedef enum {
45 GAISLER = 1,
46 ESA = 4
47} amba_vendor_id_t;
48
49typedef enum {
50 GAISLER_LEON3 = 0x003,
51 GAISLER_LEON3DSU = 0x004,
52 GAISLER_ETHAHB = 0x005,
53 GAISLER_APBMST = 0x006,
54 GAISLER_AHBUART = 0x007,
55 GAISLER_SRCTRL = 0x008,
56 GAISLER_SDCTRL = 0x009,
57 GAISLER_APBUART = 0x00C,
58 GAISLER_IRQMP = 0x00D,
59 GAISLER_AHBRAM = 0x00E,
60 GAISLER_GPTIMER = 0x011,
61 GAISLER_PCITRG = 0x012,
62 GAISLER_PCISBRG = 0x013,
63 GAISLER_PCIFBRG = 0x014,
64 GAISLER_PCITRACE = 0x015,
65 GAISLER_PCIDMA = 0x016,
66 GAISLER_AHBTRACE = 0x017,
67 GAISLER_ETHDSU = 0x018,
68 GAISLER_PIOPORT = 0x01A,
69 GAISLER_AHBJTAG = 0x01c,
70 GAISLER_SPW = 0x01f,
71 GAISLER_ATACTRL = 0x024,
72 GAISLER_VGA = 0x061,
73 GAISLER_KBD = 0x060,
74 GAISLER_ETHMAC = 0x01D,
75 GAISLER_DDRSPA = 0x025,
76 GAISLER_EHCI = 0x026,
77 GAISLER_UHCI = 0x027,
78 GAISLER_SPW2 = 0x029,
79 GAISLER_DDR2SPA = 0x02E,
80 GAISLER_AHBSTAT = 0x052,
81 GAISLER_FTMCTRL = 0x054,
82 ESA_MCTRL = 0x00F,
83} amba_device_id_t;
84
85typedef struct {
86 /* Primary serial port location */
87 uintptr_t uart_base;
88 size_t uart_size;
89 int uart_irq;
90 /* Timers location */
91 uintptr_t timer_base;
92 size_t timer_size;
93 int timer_irq;
94} amba_info_t;
95
96typedef struct {
97 amba_vendor_id_t vendor_id;
98 amba_device_id_t device_id;
99 int irq;
100 int version;
101 uint32_t args[3];
102 struct {
103 uintptr_t start;
104 uintptr_t size;
105 bool prefetchable;
106 bool cacheable;
107 } bars[4];
108} amba_device_t;
109
110typedef struct {
111 unsigned int addr: 12;
112 unsigned int reserved: 2;
113 unsigned int prefetchable: 1;
114 unsigned int cacheable: 1;
115 unsigned int mask: 12;
116 unsigned int type: 4;
117} __attribute__((packed)) ambapp_bar_t;
118
119typedef struct {
120 unsigned int vendor_id: 8;
121 unsigned int device_id: 24;
122 unsigned int reserved: 2;
123 unsigned int version: 5;
124 unsigned int irq: 5;
125 uint32_t user_defined[3];
126 ambapp_bar_t bar[4];
127} __attribute__((packed)) ambapp_entry_t;
128
129amba_device_t amba_devices[AMBAPP_MAX_DEVICES];
130int amba_devices_found;
131uintptr_t amba_uart_base;
132
133void ambapp_scan(void);
134void ambapp_qemu_fake_scan(void);
135void ambapp_print_devices(void);
136amba_device_t *ambapp_lookup_first(amba_vendor_id_t, amba_device_id_t);
137
138#endif
139
140/** @}
141 */
Note: See TracBrowser for help on using the repository browser.