1*3695ecbbSad /* $NetBSD: p_sni_rm200pci.c,v 1.16 2020/06/13 20:01:27 ad Exp $ */
256716eddSsoda /* $OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $ */
356716eddSsoda
456716eddSsoda /*
59b6bd2d9Srmind * Copyright (c) 1988 University of Utah.
656716eddSsoda * Copyright (c) 1992, 1993
756716eddSsoda * The Regents of the University of California. All rights reserved.
856716eddSsoda *
956716eddSsoda * This code is derived from software contributed to Berkeley by
1056716eddSsoda * the Systems Programming Group of the University of Utah Computer
1156716eddSsoda * Science Department, The Mach Operating System project at
1256716eddSsoda * Carnegie-Mellon University and Ralph Campbell.
1356716eddSsoda *
1456716eddSsoda * Redistribution and use in source and binary forms, with or without
1556716eddSsoda * modification, are permitted provided that the following conditions
1656716eddSsoda * are met:
1756716eddSsoda * 1. Redistributions of source code must retain the above copyright
1856716eddSsoda * notice, this list of conditions and the following disclaimer.
1956716eddSsoda * 2. Redistributions in binary form must reproduce the above copyright
2056716eddSsoda * notice, this list of conditions and the following disclaimer in the
2156716eddSsoda * documentation and/or other materials provided with the distribution.
22aad01611Sagc * 3. Neither the name of the University nor the names of its contributors
23aad01611Sagc * may be used to endorse or promote products derived from this software
24aad01611Sagc * without specific prior written permission.
25aad01611Sagc *
26aad01611Sagc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27aad01611Sagc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28aad01611Sagc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29aad01611Sagc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30aad01611Sagc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31aad01611Sagc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32aad01611Sagc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33aad01611Sagc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34aad01611Sagc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35aad01611Sagc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36aad01611Sagc * SUCH DAMAGE.
37aad01611Sagc *
38aad01611Sagc * from: @(#)machdep.c 8.3 (Berkeley) 1/12/94
39aad01611Sagc */
4056716eddSsoda
417641af97Smatt #define __INTR_PRIVATE
42a4183603Slukem #include <sys/cdefs.h>
43*3695ecbbSad __KERNEL_RCSID(0, "$NetBSD: p_sni_rm200pci.c,v 1.16 2020/06/13 20:01:27 ad Exp $");
44a4183603Slukem
4556716eddSsoda #include <sys/param.h>
4656716eddSsoda #include <sys/systm.h>
4756716eddSsoda #include <sys/device.h>
487641af97Smatt #include <sys/intr.h>
497641af97Smatt #include <sys/bus.h>
507641af97Smatt
517641af97Smatt #include <uvm/uvm_extern.h>
5256716eddSsoda
5356716eddSsoda #include <machine/autoconf.h>
5456716eddSsoda #include <machine/pio.h>
5556716eddSsoda #include <machine/platform.h>
567ff0d7e3Stsutsui #include <machine/wired_map.h>
577ff0d7e3Stsutsui
5856716eddSsoda #include <mips/pte.h>
5956716eddSsoda
607fe2a5a0Stsutsui void p_sni_rm200pci_init(void);
617fe2a5a0Stsutsui void p_sni_rm200pci_cons_init(void);
6256716eddSsoda
6356716eddSsoda #include "com.h"
6456716eddSsoda #if NCOM > 0
6556716eddSsoda #include <sys/termios.h>
6656716eddSsoda #include <dev/ic/comreg.h>
6756716eddSsoda #include <dev/ic/comvar.h>
6856716eddSsoda #endif
6956716eddSsoda
7056716eddSsoda struct platform platform_sni_rm200pci = {
7156716eddSsoda "RM200PCI",
7256716eddSsoda NULL, /* unknown */
7356716eddSsoda "",
7456716eddSsoda "RM200",
7556716eddSsoda "Siemens Nixdorf",
7656716eddSsoda 150, /* MHz ?? */
7756716eddSsoda NULL, /* XXX */
7856716eddSsoda platform_generic_match,
7956716eddSsoda p_sni_rm200pci_init,
8056716eddSsoda p_sni_rm200pci_cons_init,
8156716eddSsoda platform_nop, /* reset */
8256716eddSsoda arc_set_intr, /* ??? */
8356716eddSsoda };
8456716eddSsoda
8556716eddSsoda /*
8651260decStsutsui * This is a mask of bits to clear in the SR when we go to a
8751260decStsutsui * given interrupt priority level.
8851260decStsutsui */
8951260decStsutsui /* XXX lack of hardware info for sni_rm200pci */
907641af97Smatt static const struct ipl_sr_map sni_rm200pci_ipl_sr_map = {
917641af97Smatt .sr_bits = {
92dd8d8eb3Stsutsui [IPL_NONE] = 0,
937641af97Smatt [IPL_SOFTCLOCK] = MIPS_SOFT_INT_MASK_0,
947641af97Smatt [IPL_SOFTNET] = MIPS_SOFT_INT_MASK,
957641af97Smatt [IPL_VM] = MIPS_INT_MASK, /* XXX */
967641af97Smatt [IPL_SCHED] = MIPS_INT_MASK,
977641af97Smatt [IPL_DDB] = MIPS_INT_MASK,
987641af97Smatt [IPL_HIGH] = MIPS_INT_MASK,
997641af97Smatt },
10051260decStsutsui };
10151260decStsutsui
10251260decStsutsui /*
10356716eddSsoda * critial i/o space, interrupt, and other chipset related initialization.
10456716eddSsoda */
10556716eddSsoda void
p_sni_rm200pci_init(void)1067fe2a5a0Stsutsui p_sni_rm200pci_init(void)
10756716eddSsoda {
1087fe2a5a0Stsutsui
10956716eddSsoda /*
1107ff0d7e3Stsutsui * Initialize wired TLB for I/O space which is used on early stage
1117ff0d7e3Stsutsui */
1127ff0d7e3Stsutsui
1137ff0d7e3Stsutsui /*
1147ff0d7e3Stsutsui * Initialize interrupt priority
1157ff0d7e3Stsutsui */
1167641af97Smatt ipl_sr_map = sni_rm200pci_ipl_sr_map;
1177ff0d7e3Stsutsui
1187ff0d7e3Stsutsui /*
11956716eddSsoda * Initialize I/O address offset
12056716eddSsoda */
1217ff0d7e3Stsutsui arc_init_wired_map();
12256716eddSsoda #if 0
12356716eddSsoda arc_bus_space_init(&arc_bus_io, "rm200isaio",
12456716eddSsoda RM200_P_ISA_IO, RM200_V_ISA_IO, 0, RM200_S_ISA_IO);
12556716eddSsoda arc_bus_space_init(&arc_bus_mem, "rm200isamem",
12656716eddSsoda RM200_P_ISA_MEM, RM200_V_ISA_MEM, 0, RM200_S_ISA_MEM);
12756716eddSsoda #endif
12856716eddSsoda }
12956716eddSsoda
13056716eddSsoda void
p_sni_rm200pci_cons_init(void)1317fe2a5a0Stsutsui p_sni_rm200pci_cons_init(void)
13256716eddSsoda {
1337fe2a5a0Stsutsui
13456716eddSsoda if (!com_console) {
13556716eddSsoda /* XXX For now... */
13656716eddSsoda }
13756716eddSsoda if (com_console_address == 0) {
13856716eddSsoda #if 0 /* XXX */
13956716eddSsoda com_console_address = xxx;
14056716eddSsoda #else
14156716eddSsoda panic("console address unknown");
14256716eddSsoda #endif
14356716eddSsoda }
14456716eddSsoda comcnattach(&arc_bus_io /* XXX? */, com_console_address,
1450eff6718Sthorpej com_console_speed, com_freq, COM_TYPE_NORMAL, com_console_mode);
14656716eddSsoda }
147