Home | History | Annotate | Line # | Download | only in rmi
      1 /*	$NetBSD: rmixl_firmware.h,v 1.4 2020/05/14 08:34:20 msaitoh Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2009 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Cliff Neighbors
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  * POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 /*********************************************************************
     33 
     34   Copyright 2003-2006 Raza Microelectronics, Inc. (RMI). All rights
     35   reserved.
     36 
     37   Redistribution and use in source and binary forms, with or without
     38   modification, are permitted provided that the following conditions
     39   are met:
     40 
     41   1. Redistributions of source code must retain the above copyright
     42   notice, this list of conditions and the following disclaimer.
     43   2. Redistributions in binary form must reproduce the above copyright
     44   notice, this list of conditions and the following disclaimer in
     45   the documentation and/or other materials provided with the
     46   distribution.
     47 
     48   THIS SOFTWARE IS PROVIDED BY Raza Microelectronics, Inc. ``AS IS'' AND
     49   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     50   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     51   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RMI OR CONTRIBUTORS BE LIABLE
     52   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     53   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     54   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     55   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     56   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     57   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     58   THE POSSIBILITY OF SUCH DAMAGE.
     59 
     60   *****************************#RMI_2#**********************************/
     61 
     62 #ifndef _ARCH_MIPS_RMI_RMIXL_FIRMWARE_H_
     63 #define _ARCH_MIPS_RMI_RMIXL_FIRMWARE_H_
     64 
     65 typedef struct rmixlfw_info {
     66 	uint64_t boot_level;
     67 	uint64_t io_base;
     68 	uint64_t output_device;
     69 	uint64_t uart_print;
     70 	uint64_t led_output;
     71 	uint64_t init;
     72 	uint64_t exit;
     73 	uint64_t warm_reset;
     74 	uint64_t wakeup;
     75 	uint64_t cpu_online_map;
     76 	uint64_t master_reentry_sp;
     77 	uint64_t master_reentry_gp;
     78 	uint64_t master_reentry_fn;
     79 	uint64_t slave_reentry_fn;
     80 	uint64_t magic_dword;
     81 	uint64_t uart_putchar;
     82 	uint64_t size;
     83 	uint64_t uart_getchar;
     84 	uint64_t nmi_handler;
     85 	uint64_t psb_version;
     86 	uint64_t mac_addr;
     87 	uint64_t cpu_frequency;
     88 	uint64_t board_version;
     89 	uint64_t malloc;
     90 	uint64_t free;
     91 	uint64_t global_shmem_addr;
     92 	uint64_t global_shmem_size;
     93 	uint64_t psb_os_cpu_map;
     94 	uint64_t userapp_cpu_map;
     95 	uint64_t wakeup_os;
     96 	uint64_t psb_mem_map;
     97 	uint64_t board_major_version;
     98 	uint64_t board_minor_version;
     99 	uint64_t board_manf_revision;
    100 	uint64_t board_serial_number;
    101 	uint64_t psb_physaddr_map;
    102 	uint64_t xlr_loaderip_config;
    103 	uint64_t bldr_envp;
    104 	uint64_t avail_mem_map;
    105 } rmixlfw_info_t;
    106 
    107 
    108 #define RMIXLFW_MMAP_MAX_MMAPS		32
    109 
    110 #define RMIXLFW_MMAP_TYPE_RAM		1
    111 #define RMIXLFW_MMAP_TYPE_ROM		2
    112 #define RMIXLFW_MMAP_TYPE_RESERVED	3
    113 #define RMIXLFW_MMAP_TYPE_DEV_IO	0x10
    114 #define RMIXLFW_MMAP_TYPE_PCI_IO	0x11
    115 #define RMIXLFW_MMAP_TYPE_PCI_CFG	0x12
    116 #define RMIXLFW_MMAP_TYPE_PCI_MEM	0x13
    117 #define RMIXLFW_MMAP_TYPE_UNKNOWN	0xff
    118 
    119 /*
    120  * struct at psb_mem_map, psb_physaddr_map, avail_mem_map
    121  */
    122 typedef struct rmixlfw_mmap {
    123 	uint32_t nmmaps;
    124 	struct rmixlfw_mmap_entry {
    125 		uint64_t start;
    126 		uint64_t size;
    127 		uint32_t type;
    128 	} entry[RMIXLFW_MMAP_MAX_MMAPS];
    129 } rmixlfw_mmap_t;
    130 
    131 #define XLR_ARGV_BUF_SIZE	256
    132 #define XLR_ENV_BUF_SIZE	256
    133 #define XLR_MAX_ARGV		32
    134 #define XLR_MAX_ENV		32
    135 #define MAX_ELF_SEGMENTS	16
    136 #define MAX_TLB_MAPPINGS	16
    137 
    138 struct lib_cpu_tlb_mapping {
    139 	int page_size;
    140 	int asid;
    141 	int coherency;
    142 	int attr;
    143 	uint32_t virt;
    144 	uint64_t phys;
    145 };
    146 
    147 struct core_segment_info
    148 {
    149 	uint64_t vaddr;
    150 	uint64_t memsz;
    151 	uint32_t flags;
    152 };
    153 
    154 typedef struct rmixlfw_cpu_wakeup_info {
    155 	volatile uint32_t cpu_status;
    156 	int valid;			/* structure is valid */
    157 	struct {
    158 		int32_t addr;
    159 		int32_t args;
    160 		uint64_t sp;
    161 		uint64_t gp;
    162 	} entry;
    163 	u_int master_cpu;
    164 	uint32_t master_cpu_mask;
    165 	uint32_t buddy_cpu_mask;
    166 	uint32_t psb_os_cpu_map;
    167 	int argc;
    168 	uint32_t argv[XLR_MAX_ARGV];		/* pointers ... */
    169 	char argv_buf[XLR_ARGV_BUF_SIZE];	/* ... storage */
    170 	int valid_tlb_entries;
    171 	struct lib_cpu_tlb_mapping tlb_map[MAX_TLB_MAPPINGS];
    172 	struct core_segment_info seg_info[MAX_ELF_SEGMENTS];
    173 	int envc;
    174 	uint32_t envs[XLR_MAX_ENV];
    175 	char env_buf[XLR_ENV_BUF_SIZE];
    176 	uint32_t app_mode;
    177 	int32_t printk_lock;
    178 	int kseg_master;
    179 	int32_t kuseg_reentry_function;
    180 	uint32_t kuseg_reentry_args;
    181 	uint64_t app_shared_mem_addr;
    182 	uint64_t app_shared_mem_size;
    183 	uint64_t app_shared_mem_orig;
    184 	int32_t loader_lock;
    185 	int32_t global_wakeup_mask;
    186 	union {
    187 		uint32_t unused_0;
    188 		struct vcpu_extended_info *vcpu_extended_info;
    189 	};
    190 } rmixlfw_cpu_wakeup_info_t;
    191 
    192 /* RMI firmware-defined IPI IRQs */
    193 #define RMIXLFW_IPI_STOP	51
    194 #define RMIXLFW_IPI_WAKEUP	52
    195 #define RMIXLFW_IPI_RECLAIM	53
    196 
    197 #endif	/* _ARCH_MIPS_RMI_RMIXL_FIRMWARE_H_ */
    198