Deleted Added
sdiff udiff text old ( 119525 ) new ( 120491 )
full compact
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
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

--- 16 unchanged lines hidden (view full) ---

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $FreeBSD: head/sys/pc98/cbus/sio.c 119525 2003-08-28 11:20:54Z nyan $
34 * from: @(#)com.c 7.5 (Berkeley) 5/16/91
35 * from: i386/isa sio.c,v 1.234
36 */
37
38#include "opt_comconsole.h"
39#include "opt_compat.h"
40#include "opt_ddb.h"
41#include "opt_sio.h"

--- 3916 unchanged lines hidden (view full) ---

3958struct siocnstate {
3959 u_char dlbl;
3960 u_char dlbh;
3961 u_char ier;
3962 u_char cfcr;
3963 u_char mcr;
3964};
3965
3966#ifndef __alpha__
3967static speed_t siocngetspeed(Port_t, u_long rclk);
3968#endif
3969static void siocnclose(struct siocnstate *sp, Port_t iobase);
3970static void siocnopen(struct siocnstate *sp, Port_t iobase, int speed);
3971static void siocntxwait(Port_t iobase);
3972
3973#ifdef __alpha__

--- 206 unchanged lines hidden (view full) ---

4180 outb(iobase + com_dlbl, divisor & 0xff);
4181 outb(iobase + com_dlbh, divisor >> 8);
4182 outb(iobase + com_cfcr, cfcr);
4183
4184 siocnopen(&sp, iobase, comdefaultrate);
4185
4186 splx(s);
4187 if (COM_CONSOLE(flags) && !COM_LLCONSOLE(flags)) {
4188 cp->cn_dev = makedev(CDEV_MAJOR, unit);
4189 cp->cn_pri = COM_FORCECONSOLE(flags)
4190 || boothowto & RB_SERIAL
4191 ? CN_REMOTE : CN_NORMAL;
4192 siocniobase = iobase;
4193 siocnunit = unit;
4194 }
4195 if (COM_DEBUGGER(flags)) {
4196 printf("sio%d: gdb debugging port\n", unit);
4197 siogdbiobase = iobase;
4198 siogdbunit = unit;
4199#if DDB > 0
4200 gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit);
4201 gdb_arg = &gdbconsdev;
4202 gdb_getc = siocngetc;
4203 gdb_putc = siocnputc;
4204#endif
4205 }
4206 }
4207 }
4208#ifdef __i386__

--- 5 unchanged lines hidden (view full) ---

4214 */
4215 if (gdb_arg == NULL && (boothowto & RB_GDB)) {
4216 printf("Warning: no GDB port specified. Defaulting to sio%d.\n",
4217 siocnunit);
4218 printf("Set flag 0x80 on desired GDB port in your\n");
4219 printf("configuration file (currently sio only).\n");
4220 siogdbiobase = siocniobase;
4221 siogdbunit = siocnunit;
4222 gdbconsdev.cn_dev = makedev(CDEV_MAJOR, siocnunit);
4223 gdb_arg = &gdbconsdev;
4224 gdb_getc = siocngetc;
4225 gdb_putc = siocnputc;
4226 }
4227#endif
4228#endif
4229}
4230
4231static void
4232siocninit(cp)
4233 struct consdev *cp;
4234{
4235 comconsole = DEV_TO_UNIT(cp->cn_dev);
4236}
4237
4238static void
4239siocnterm(cp)
4240 struct consdev *cp;
4241{
4242 comconsole = -1;
4243}

--- 14 unchanged lines hidden (view full) ---

4258 u_int divisor;
4259 struct siocnstate sp;
4260 int unit = 0; /* XXX random value! */
4261
4262 siocniobase = port;
4263 siocnunit = unit;
4264 comdefaultrate = speed;
4265 sio_consdev.cn_pri = CN_NORMAL;
4266 sio_consdev.cn_dev = makedev(CDEV_MAJOR, unit);
4267
4268 s = spltty();
4269
4270 /*
4271 * Initialize the divisor latch. We can't rely on
4272 * siocnopen() to do this the first time, since it
4273 * avoids writing to the latch if the latch appears
4274 * to have the correct value. Also, if we didn't

--- 27 unchanged lines hidden (view full) ---

4302 int unit = 1; /* XXX random value! */
4303
4304 siogdbiobase = port;
4305 gdbdefaultrate = speed;
4306
4307 printf("sio%d: gdb debugging port\n", unit);
4308 siogdbunit = unit;
4309#if DDB > 0
4310 gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit);
4311 gdb_arg = &gdbconsdev;
4312 gdb_getc = siocngetc;
4313 gdb_putc = siocnputc;
4314#endif
4315
4316 s = spltty();
4317
4318 /*

--- 19 unchanged lines hidden (view full) ---

4338}
4339
4340#endif
4341
4342static int
4343siocncheckc(struct consdev *cd)
4344{
4345 int c;
4346 dev_t dev;
4347 Port_t iobase;
4348 int s;
4349 struct siocnstate sp;
4350 speed_t speed;
4351
4352 dev = cd->cn_dev;
4353 if (minor(dev) == siocnunit) {
4354 iobase = siocniobase;
4355 speed = comdefaultrate;
4356 } else {
4357 iobase = siogdbiobase;
4358 speed = gdbdefaultrate;
4359 }
4360 s = spltty();
4361 siocnopen(&sp, iobase, speed);
4362 if (inb(iobase + com_lsr) & LSR_RXRDY)
4363 c = inb(iobase + com_data);
4364 else
4365 c = -1;
4366 siocnclose(&sp, iobase);
4367 splx(s);
4368 return (c);
4369}
4370
4371
4372static int
4373siocngetc(struct consdev *cd)
4374{
4375 int c;
4376 dev_t dev;
4377 Port_t iobase;
4378 int s;
4379 struct siocnstate sp;
4380 speed_t speed;
4381
4382 dev = cd->cn_dev;
4383 if (minor(dev) == siocnunit) {
4384 iobase = siocniobase;
4385 speed = comdefaultrate;
4386 } else {
4387 iobase = siogdbiobase;
4388 speed = gdbdefaultrate;
4389 }
4390 s = spltty();
4391 siocnopen(&sp, iobase, speed);

--- 5 unchanged lines hidden (view full) ---

4397 return (c);
4398}
4399
4400static void
4401siocnputc(struct consdev *cd, int c)
4402{
4403 int need_unlock;
4404 int s;
4405 dev_t dev;
4406 struct siocnstate sp;
4407 Port_t iobase;
4408 speed_t speed;
4409
4410 dev = cd->cn_dev;
4411 if (minor(dev) == siocnunit) {
4412 iobase = siocniobase;
4413 speed = comdefaultrate;
4414 } else {
4415 iobase = siogdbiobase;
4416 speed = gdbdefaultrate;
4417 }
4418 s = spltty();
4419 need_unlock = 0;

--- 674 unchanged lines hidden ---