| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ofw_machdep.c,v 1.32 2022/11/24 00:07:48 macallan Exp $ */ | | 1 | /* $NetBSD: ofw_machdep.c,v 1.33 2022/11/24 00:13:54 macallan Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Tim Rightnour | | 8 | * by Tim Rightnour |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -51,27 +51,27 @@ | | | @@ -51,27 +51,27 @@ |
51 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | | 51 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR |
52 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 52 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
53 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 53 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
54 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | | 54 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | | 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
56 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | | 56 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
57 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | | 57 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
58 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | | 58 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
59 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | | 59 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
60 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 60 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
61 | */ | | 61 | */ |
62 | | | 62 | |
63 | #include <sys/cdefs.h> | | 63 | #include <sys/cdefs.h> |
64 | __KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.32 2022/11/24 00:07:48 macallan Exp $"); | | 64 | __KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.33 2022/11/24 00:13:54 macallan Exp $"); |
65 | | | 65 | |
66 | #include <sys/param.h> | | 66 | #include <sys/param.h> |
67 | #include <sys/buf.h> | | 67 | #include <sys/buf.h> |
68 | #include <sys/conf.h> | | 68 | #include <sys/conf.h> |
69 | #include <sys/device.h> | | 69 | #include <sys/device.h> |
70 | #include <sys/disk.h> | | 70 | #include <sys/disk.h> |
71 | #include <sys/disklabel.h> | | 71 | #include <sys/disklabel.h> |
72 | #include <sys/fcntl.h> | | 72 | #include <sys/fcntl.h> |
73 | #include <sys/ioctl.h> | | 73 | #include <sys/ioctl.h> |
74 | #include <sys/stat.h> | | 74 | #include <sys/stat.h> |
75 | #include <sys/systm.h> | | 75 | #include <sys/systm.h> |
76 | | | 76 | |
77 | #include <dev/cons.h> | | 77 | #include <dev/cons.h> |
| @@ -105,27 +105,28 @@ int ofw_address_cells; | | | @@ -105,27 +105,28 @@ int ofw_address_cells; |
105 | int ofw_size_cells; | | 105 | int ofw_size_cells; |
106 | | | 106 | |
107 | void ofprint(const char *blah, ...) | | 107 | void ofprint(const char *blah, ...) |
108 | { | | 108 | { |
109 | va_list va; | | 109 | va_list va; |
110 | char buf[256]; | | 110 | char buf[256]; |
111 | int len; | | 111 | int len; |
112 | | | 112 | |
113 | va_start(va, blah); | | 113 | va_start(va, blah); |
114 | len = vsnprintf(buf, sizeof(buf), blah, va); | | 114 | len = vsnprintf(buf, sizeof(buf), blah, va); |
115 | va_end(va); | | 115 | va_end(va); |
116 | OF_write(console_instance, buf, len); | | 116 | OF_write(console_instance, buf, len); |
117 | /* Apple OF only does a newline on \n, so add an explicit CR */ | | 117 | /* Apple OF only does a newline on \n, so add an explicit CR */ |
118 | OF_write(console_instance, "\r", 1); | | 118 | if ((len > 0) && (buf[len - 1] == '\n')) |
| | | 119 | OF_write(console_instance, "\r", 1); |
119 | } | | 120 | } |
120 | | | 121 | |
121 | static int | | 122 | static int |
122 | ofwbootcons_cngetc(dev_t dev) | | 123 | ofwbootcons_cngetc(dev_t dev) |
123 | { | | 124 | { |
124 | unsigned char ch = '\0'; | | 125 | unsigned char ch = '\0'; |
125 | int l; | | 126 | int l; |
126 | | | 127 | |
127 | if (ofwbootcons_suppress) { | | 128 | if (ofwbootcons_suppress) { |
128 | return ch; | | 129 | return ch; |
129 | } | | 130 | } |
130 | | | 131 | |
131 | while ((l = OF_read(ofw_stdin, &ch, 1)) != 1) { | | 132 | while ((l = OF_read(ofw_stdin, &ch, 1)) != 1) { |