ofw_console.c (133096) | ofw_console.c (136454) |
---|---|
1/* 2 * Copyright (C) 2001 Benno Rice. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> | 1/* 2 * Copyright (C) 2001 Benno Rice. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> |
27__FBSDID("$FreeBSD: head/sys/dev/ofw/ofw_console.c 133096 2004-08-04 00:21:19Z gad $"); | 27__FBSDID("$FreeBSD: head/sys/dev/ofw/ofw_console.c 136454 2004-10-12 21:23:33Z phk $"); |
28 29#include "opt_comconsole.h" 30#include "opt_ofw.h" 31 32#include <sys/param.h> 33#include <sys/kdb.h> 34#include <sys/kernel.h> 35#include <sys/systm.h> --- 54 unchanged lines hidden (view full) --- 90 struct cdev *dev; 91 92 if (ofw_consdev.cn_pri != CN_DEAD && 93 ofw_consdev.cn_name[0] != '\0') { 94 if ((options = OF_finddevice("/options")) == -1 || 95 OF_getprop(options, "output-device", output, 96 sizeof(output)) == -1) 97 return; | 28 29#include "opt_comconsole.h" 30#include "opt_ofw.h" 31 32#include <sys/param.h> 33#include <sys/kdb.h> 34#include <sys/kernel.h> 35#include <sys/systm.h> --- 54 unchanged lines hidden (view full) --- 90 struct cdev *dev; 91 92 if (ofw_consdev.cn_pri != CN_DEAD && 93 ofw_consdev.cn_name[0] != '\0') { 94 if ((options = OF_finddevice("/options")) == -1 || 95 OF_getprop(options, "output-device", output, 96 sizeof(output)) == -1) 97 return; |
98 /* 99 * XXX: This is a hack and it may result in two /dev/ttya 100 * XXX: devices on platforms where the sab driver works. 101 */ |
|
98 dev = make_dev(&ofw_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "%s", 99 output); 100 make_dev_alias(dev, "ofwcons"); 101 } 102} 103 104SYSINIT(cndev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, cn_drvinit, NULL) 105 --- 6 unchanged lines hidden (view full) --- 112 struct tty *tp; 113 int unit; 114 int error, setuptimeout; 115 116 error = 0; 117 setuptimeout = 0; 118 unit = minor(dev); 119 | 102 dev = make_dev(&ofw_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "%s", 103 output); 104 make_dev_alias(dev, "ofwcons"); 105 } 106} 107 108SYSINIT(cndev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, cn_drvinit, NULL) 109 --- 6 unchanged lines hidden (view full) --- 116 struct tty *tp; 117 int unit; 118 int error, setuptimeout; 119 120 error = 0; 121 setuptimeout = 0; 122 unit = minor(dev); 123 |
120 tp = ofw_tp = dev->si_tty = ttymalloc(ofw_tp); | 124 /* 125 * XXX: BAD, should happen at attach time 126 */ 127 if (dev->si_tty == NULL) { 128 ofw_tp = ttyalloc(); 129 dev->si_tty = ofw_tp; 130 ofw_tp->t_dev = dev; 131 } 132 tp = dev->si_tty; |
121 122 tp->t_oproc = ofw_tty_start; 123 tp->t_param = ofw_tty_param; 124 tp->t_stop = ofw_tty_stop; 125 tp->t_dev = dev; 126 127 if ((tp->t_state & TS_ISOPEN) == 0) { 128 tp->t_state |= TS_CARR_ON; --- 26 unchanged lines hidden (view full) --- 155 156static int 157ofw_dev_close(struct cdev *dev, int flag, int mode, struct thread *td) 158{ 159 int unit; 160 struct tty *tp; 161 162 unit = minor(dev); | 133 134 tp->t_oproc = ofw_tty_start; 135 tp->t_param = ofw_tty_param; 136 tp->t_stop = ofw_tty_stop; 137 tp->t_dev = dev; 138 139 if ((tp->t_state & TS_ISOPEN) == 0) { 140 tp->t_state |= TS_CARR_ON; --- 26 unchanged lines hidden (view full) --- 167 168static int 169ofw_dev_close(struct cdev *dev, int flag, int mode, struct thread *td) 170{ 171 int unit; 172 struct tty *tp; 173 174 unit = minor(dev); |
163 tp = ofw_tp; | 175 tp = dev->si_tty; |
164 165 if (unit != 0) { 166 return (ENXIO); 167 } 168 169 /* XXX Should be replaced with callout_stop(9) */ 170 untimeout(ofw_timeout, tp, ofw_timeouthandle); 171 ttyld_close(tp, flag); --- 144 unchanged lines hidden --- | 176 177 if (unit != 0) { 178 return (ENXIO); 179 } 180 181 /* XXX Should be replaced with callout_stop(9) */ 182 untimeout(ofw_timeout, tp, ofw_timeouthandle); 183 ttyld_close(tp, flag); --- 144 unchanged lines hidden --- |