Tue Mar 30 05:18:37 2021 UTC ()
- G/C unused.
- Sort headers.

No binary changes.


(rin)
diff -r1.9 -r1.10 src/sys/arch/evbppc/walnut/consinit.c

cvs diff -r1.9 -r1.10 src/sys/arch/evbppc/walnut/consinit.c (switch to unified diff)

--- src/sys/arch/evbppc/walnut/consinit.c 2021/03/29 13:59:15 1.9
+++ src/sys/arch/evbppc/walnut/consinit.c 2021/03/30 05:18:37 1.10
@@ -1,115 +1,108 @@ @@ -1,115 +1,108 @@
1/* $NetBSD: consinit.c,v 1.9 2021/03/29 13:59:15 rin Exp $ */ 1/* $NetBSD: consinit.c,v 1.10 2021/03/30 05:18:37 rin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998 4 * Copyright (c) 1998
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * 26 *
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.9 2021/03/29 13:59:15 rin Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.10 2021/03/30 05:18:37 rin Exp $");
31 31
32#include "opt_kgdb.h" 32#include "opt_kgdb.h"
33 33
34#include <sys/param.h> 34#include <sys/param.h>
35#include <sys/systm.h> 
36#include <sys/device.h> 
37#include <sys/bus.h> 35#include <sys/bus.h>
 36#include <sys/device.h>
 37#include <sys/systm.h>
38 38
39#include <powerpc/ibm4xx/ibm405gp.h> 39#include <powerpc/ibm4xx/ibm405gp.h>
40#include <powerpc/ibm4xx/dev/opbvar.h> 
41 40
42#include "com.h" 41#include "com.h"
43#if (NCOM > 0) 42#if (NCOM > 0)
44#include <sys/termios.h> 43#include <sys/termios.h>
45#include <dev/ic/comreg.h> 44#include <dev/ic/comreg.h>
46#include <dev/ic/comvar.h> 45#include <dev/ic/comvar.h>
47#include <powerpc/ibm4xx/dev/comopbvar.h> 46#include <powerpc/ibm4xx/dev/comopbvar.h>
48#endif 47#endif
49 48
50#include <dev/cons.h> 
51 
52#ifndef CONSDEVNAME 
53#define CONSDEVNAME "com" 
54#endif 
55 
56#if (NCOM > 0) 49#if (NCOM > 0)
57#ifndef CONADDR 50#ifndef CONADDR
58#define CONADDR IBM405GP_UART0_BASE 51#define CONADDR IBM405GP_UART0_BASE
59#endif 52#endif
60#ifndef CONSPEED 53#ifndef CONSPEED
61#define CONSPEED B9600 /* */ 54#define CONSPEED B9600 /* */
62// #define CONSPEED B115200 /* 9600 is too slow for my taste */ 55// #define CONSPEED B115200 /* 9600 is too slow for my taste */
63#endif 56#endif
64#ifndef CONMODE 57#ifndef CONMODE
65#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */ 58#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
66#endif 59#endif
67int comcnmode = CONMODE; 60int comcnmode = CONMODE;
68#endif /* NCOM */ 61#endif /* NCOM */
69 62
70#ifdef KGDB 63#ifdef KGDB
71#ifndef KGDB_DEVNAME 64#ifndef KGDB_DEVNAME
72#define KGDB_DEVNAME "com" 65#define KGDB_DEVNAME "com"
73#endif 66#endif
74char kgdb_devname[] = KGDB_DEVNAME; 67char kgdb_devname[] = KGDB_DEVNAME;
75 68
76#if (NCOM > 1) 69#if (NCOM > 1)
77#ifndef KGDB_DEVADDR 70#ifndef KGDB_DEVADDR
78#define KGDB_DEVADDR UART1_BASE 71#define KGDB_DEVADDR UART1_BASE
79#endif 72#endif
80int comkgdbaddr = KGDB_DEVADDR; 73int comkgdbaddr = KGDB_DEVADDR;
81 74
82#ifndef KGDB_DEVRATE 75#ifndef KGDB_DEVRATE
83#define KGDB_DEVRATE CONSPEED 76#define KGDB_DEVRATE CONSPEED
84#endif 77#endif
85int comkgdbrate = KGDB_DEVRATE; 78int comkgdbrate = KGDB_DEVRATE;
86 79
87#ifndef KGDB_DEVMODE 80#ifndef KGDB_DEVMODE
88#define KGDB_DEVMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */ 81#define KGDB_DEVMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
89#endif 82#endif
90int comkgdbmode = KGDB_DEVMODE; 83int comkgdbmode = KGDB_DEVMODE;
91 84
92#endif /* NCOM */ 85#endif /* NCOM */
93 86
94#endif /* KGDB */ 87#endif /* KGDB */
95 88
96void 89void
97consinit(void) 90consinit(void)
98{ 91{
99 92
100 com_opb_cnattach(COM_FREQ * 6, CONADDR, CONSPEED, comcnmode); 93 com_opb_cnattach(COM_FREQ * 6, CONADDR, CONSPEED, comcnmode);
101} 94}
102 95
103#ifdef KGDB 96#ifdef KGDB
104void 97void
105kgdb_port_init(void) 98kgdb_port_init(void)
106{ 99{
107#if (NCOM > 0) 100#if (NCOM > 0)
108 if(!strcmp(kgdb_devname, "com")) { 101 if(!strcmp(kgdb_devname, "com")) {
109 bus_space_tag_t tag = opb_get_bus_space_tag(); 102 bus_space_tag_t tag = opb_get_bus_space_tag();
110 com_kgdb_attach(tag, comkgdbaddr, comkgdbrate, COM_FREQ * 6, 103 com_kgdb_attach(tag, comkgdbaddr, comkgdbrate, COM_FREQ * 6,
111 COM_TYPE_NORMAL, comkgdbmode); 104 COM_TYPE_NORMAL, comkgdbmode);
112 } 105 }
113#endif 106#endif
114} 107}
115#endif 108#endif