| 1 | /*	$OpenBSD: autoconf.h,v 1.17 2017/05/21 13:00:53 visa Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions |
| 8 | * are met: |
| 9 | * 1. Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * 2. 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 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS |
| 16 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 25 | * SUCH DAMAGE. |
| 26 | * |
| 27 | */ |
| 28 | |
| 29 | /* |
| 30 | * Definitions used by autoconfiguration. |
| 31 | */ |
| 32 | |
| 33 | #ifndef _MACHINE_AUTOCONF_H_ |
| 34 | #define _MACHINE_AUTOCONF_H_ |
| 35 | |
| 36 | #include <machine/bus.h> |
| 37 | |
| 38 | struct bonito_config; |
| 39 | struct htb_config; |
| 40 | struct mips_isa_chipset; |
| 41 | |
| 42 | /* |
| 43 | * List of legacy I/O ranges. |
| 44 | */ |
| 45 | struct legacy_io_range { |
| 46 | 	bus_addr_t	start; |
| 47 | 	bus_size_t	end;	/* inclusive */ |
| 48 | }; |
| 49 | |
| 50 | /* |
| 51 | * Per platform information. |
| 52 | */ |
| 53 | struct platform { |
| 54 | 	int				 system_type; |
| 55 | #define	LOONGSON_2E		0x0000	/* Generic Loongson 2E system */ |
| 56 | #define	LOONGSON_YEELOONG	0x0001	/* Lemote Yeeloong */ |
| 57 | #define	LOONGSON_GDIUM		0x0002	/* EMTEC Gdium Liberty */ |
| 58 | #define	LOONGSON_FULOONG	0x0003	/* Lemote Fuloong */ |
| 59 | #define	LOONGSON_LYNLOONG	0x0004	/* Lemote Lynloong */ |
| 60 | #define	LOONGSON_EBT700		0x0005	/* eBenton EBT700 */ |
| 61 | #define	LOONGSON_3A		0x0066	/* Loongson 2Gq or 3A based system */ |
| 62 | |
| 63 | 	char				*vendor; |
| 64 | 	char				*product; |
| 65 | |
| 66 | 	const struct bonito_config	*bonito_config; |
| 67 | 	const struct htb_config		*htb_config; |
| 68 | 	struct mips_isa_chipset		*isa_chipset; |
| 69 | 	const struct legacy_io_range	*legacy_io_ranges; |
| 70 | |
| 71 | 	void				(*setup)(void); |
| 72 | 	void				(*device_register)(struct device *, |
| 73 | 					 void *); |
| 74 | |
| 75 | 	void				(*powerdown)(void); |
| 76 | 	void				(*reset)(void); |
| 77 | 	int				(*suspend)(void); |
| 78 | 	int				(*resume)(void); |
| 79 | |
| 80 | #ifdef MULTIPROCESSOR |
| 81 | 	void				(*config_secondary_cpus)( |
| 82 | 					 struct device *, cfprint_t); |
| 83 | 	void				(*boot_secondary_cpu)( |
| 84 | 					 struct cpu_info *); |
| 85 | 	int				(*ipi_establish)(int (*)(void *), |
| 86 | 					 cpuid_t); |
| 87 | 	void				(*ipi_set)(cpuid_t); |
| 88 | 	void				(*ipi_clear)(cpuid_t); |
| 89 | #endif /* MULTIPROCESSOR */ |
| 90 | }; |
| 91 | |
| 92 | #define LOONGSON_MAXCPUS	16 |
| 93 | |
| 94 | extern const struct platform *sys_platform; |
| 95 | extern void *loongson_videobios; |
| 96 | extern uint loongson_cpumask; |
| 97 | extern uint loongson_ver; |
| 98 | extern int nnodes; |
| 99 | |
| 100 | #ifdef MULTIPROCESSOR |
| 101 | extern uint64_t cpu_spinup_a0; |
| 102 | extern uint64_t cpu_spinup_sp; |
| 103 | #endif |
| 104 | |
| 105 | struct mainbus_attach_args { |
| 106 | 	const char	*maa_name; |
| 107 | }; |
| 108 | |
| 109 | extern struct device *bootdv; |
| 110 | extern char bootdev[]; |
| 111 | extern enum devclass bootdev_class; |
| 112 | |
| 113 | extern bus_space_tag_t early_mem_t; |
| 114 | extern bus_space_tag_t early_io_t; |
| 115 | |
| 116 | #define	REGVAL8(x)	*((volatile uint8_t *)PHYS_TO_XKPHYS((x), CCA_NC)) |
| 117 | #define	REGVAL32(x)	*((volatile uint32_t *)PHYS_TO_XKPHYS((x), CCA_NC)) |
| 118 | #define	REGVAL64(x)	*((volatile uint64_t *)PHYS_TO_XKPHYS((x), CCA_NC)) |
| 119 | |
| 120 | #define	REGVAL(x)	REGVAL32(x) |
| 121 | |
| 122 | #include <mips64/autoconf.h> |
| 123 | |
| 124 | #endif /* _MACHINE_AUTOCONF_H_ */ |