Deleted Added
full compact
sio.c (111017) sio.c (111194)
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 *
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 111017 2003-02-16 19:22:21Z phk $
33 * $FreeBSD: head/sys/pc98/cbus/sio.c 111194 2003-02-20 20:54:45Z phk $
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"

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

3998#ifndef __alpha__
3999CONS_DRIVER(sio, siocnprobe, siocninit, siocnterm, siocngetc, siocncheckc,
4000 siocnputc, NULL);
4001#endif
4002
4003/* To get the GDB related variables */
4004#if DDB > 0
4005#include <ddb/ddb.h>
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"

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

3998#ifndef __alpha__
3999CONS_DRIVER(sio, siocnprobe, siocninit, siocnterm, siocngetc, siocncheckc,
4000 siocnputc, NULL);
4001#endif
4002
4003/* To get the GDB related variables */
4004#if DDB > 0
4005#include <ddb/ddb.h>
4006struct consdev gdbconsdev;
4006#endif
4007
4008static void
4009siocntxwait(iobase)
4010 Port_t iobase;
4011{
4012 int timo;
4013

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

4207 siocniobase = iobase;
4208 siocnunit = unit;
4209 }
4210 if (COM_DEBUGGER(flags)) {
4211 printf("sio%d: gdb debugging port\n", unit);
4212 siogdbiobase = iobase;
4213 siogdbunit = unit;
4214#if DDB > 0
4007#endif
4008
4009static void
4010siocntxwait(iobase)
4011 Port_t iobase;
4012{
4013 int timo;
4014

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

4208 siocniobase = iobase;
4209 siocnunit = unit;
4210 }
4211 if (COM_DEBUGGER(flags)) {
4212 printf("sio%d: gdb debugging port\n", unit);
4213 siogdbiobase = iobase;
4214 siogdbunit = unit;
4215#if DDB > 0
4215 gdb_arg = makedev(CDEV_MAJOR, unit);
4216 gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit);
4217 gdb_arg = &gdbconsdev;
4216 gdb_getc = siocngetc;
4217 gdb_putc = siocnputc;
4218#endif
4219 }
4220 }
4221 }
4222#ifdef __i386__
4223#if DDB > 0

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

4228 */
4229 if (gdb_arg == NULL && (boothowto & RB_GDB)) {
4230 printf("Warning: no GDB port specified. Defaulting to sio%d.\n",
4231 siocnunit);
4232 printf("Set flag 0x80 on desired GDB port in your\n");
4233 printf("configuration file (currently sio only).\n");
4234 siogdbiobase = siocniobase;
4235 siogdbunit = siocnunit;
4218 gdb_getc = siocngetc;
4219 gdb_putc = siocnputc;
4220#endif
4221 }
4222 }
4223 }
4224#ifdef __i386__
4225#if DDB > 0

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

4230 */
4231 if (gdb_arg == NULL && (boothowto & RB_GDB)) {
4232 printf("Warning: no GDB port specified. Defaulting to sio%d.\n",
4233 siocnunit);
4234 printf("Set flag 0x80 on desired GDB port in your\n");
4235 printf("configuration file (currently sio only).\n");
4236 siogdbiobase = siocniobase;
4237 siogdbunit = siocnunit;
4236 gdb_arg = makedev(CDEV_MAJOR, siocnunit);
4238 gdbconsdev.cn_dev = makedev(CDEV_MAJOR, siocnunit);
4239 gdb_arg = &gdbconsdev;
4237 gdb_getc = siocngetc;
4238 gdb_putc = siocnputc;
4239 }
4240#endif
4241#endif
4242}
4243
4244static void

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

4315 int unit = 1; /* XXX random value! */
4316
4317 siogdbiobase = port;
4318 gdbdefaultrate = speed;
4319
4320 printf("sio%d: gdb debugging port\n", unit);
4321 siogdbunit = unit;
4322#if DDB > 0
4240 gdb_getc = siocngetc;
4241 gdb_putc = siocnputc;
4242 }
4243#endif
4244#endif
4245}
4246
4247static void

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

4318 int unit = 1; /* XXX random value! */
4319
4320 siogdbiobase = port;
4321 gdbdefaultrate = speed;
4322
4323 printf("sio%d: gdb debugging port\n", unit);
4324 siogdbunit = unit;
4325#if DDB > 0
4323 gdb_arg = makedev(CDEV_MAJOR, unit);
4326 gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit);
4327 gdb_arg = &gdbconsdev;
4324 gdb_getc = siocngetc;
4325 gdb_putc = siocnputc;
4326#endif
4327
4328 s = spltty();
4329
4330 /*
4331 * Initialize the divisor latch. We can't rely on

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

4347 splx(s);
4348
4349 return (0);
4350}
4351
4352#endif
4353
4354static int
4328 gdb_getc = siocngetc;
4329 gdb_putc = siocnputc;
4330#endif
4331
4332 s = spltty();
4333
4334 /*
4335 * Initialize the divisor latch. We can't rely on

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

4351 splx(s);
4352
4353 return (0);
4354}
4355
4356#endif
4357
4358static int
4355siocncheckc(dev)
4356 dev_t dev;
4359siocncheckc(struct consdev *cd)
4357{
4358 int c;
4360{
4361 int c;
4362 dev_t dev;
4359 Port_t iobase;
4360 int s;
4361 struct siocnstate sp;
4362 speed_t speed;
4363
4363 Port_t iobase;
4364 int s;
4365 struct siocnstate sp;
4366 speed_t speed;
4367
4368 dev = cd->cn_dev;
4364 if (minor(dev) == siocnunit) {
4365 iobase = siocniobase;
4366 speed = comdefaultrate;
4367 } else {
4368 iobase = siogdbiobase;
4369 speed = gdbdefaultrate;
4370 }
4371 s = spltty();

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

4376 c = -1;
4377 siocnclose(&sp, iobase);
4378 splx(s);
4379 return (c);
4380}
4381
4382
4383static int
4369 if (minor(dev) == siocnunit) {
4370 iobase = siocniobase;
4371 speed = comdefaultrate;
4372 } else {
4373 iobase = siogdbiobase;
4374 speed = gdbdefaultrate;
4375 }
4376 s = spltty();

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

4381 c = -1;
4382 siocnclose(&sp, iobase);
4383 splx(s);
4384 return (c);
4385}
4386
4387
4388static int
4384siocngetc(dev)
4385 dev_t dev;
4389siocngetc(struct consdev *cd)
4386{
4387 int c;
4390{
4391 int c;
4392 dev_t dev;
4388 Port_t iobase;
4389 int s;
4390 struct siocnstate sp;
4391 speed_t speed;
4392
4393 Port_t iobase;
4394 int s;
4395 struct siocnstate sp;
4396 speed_t speed;
4397
4398 dev = cd->cn_dev;
4393 if (minor(dev) == siocnunit) {
4394 iobase = siocniobase;
4395 speed = comdefaultrate;
4396 } else {
4397 iobase = siogdbiobase;
4398 speed = gdbdefaultrate;
4399 }
4400 s = spltty();
4401 siocnopen(&sp, iobase, speed);
4402 while (!(inb(iobase + com_lsr) & LSR_RXRDY))
4403 ;
4404 c = inb(iobase + com_data);
4405 siocnclose(&sp, iobase);
4406 splx(s);
4407 return (c);
4408}
4409
4410static void
4399 if (minor(dev) == siocnunit) {
4400 iobase = siocniobase;
4401 speed = comdefaultrate;
4402 } else {
4403 iobase = siogdbiobase;
4404 speed = gdbdefaultrate;
4405 }
4406 s = spltty();
4407 siocnopen(&sp, iobase, speed);
4408 while (!(inb(iobase + com_lsr) & LSR_RXRDY))
4409 ;
4410 c = inb(iobase + com_data);
4411 siocnclose(&sp, iobase);
4412 splx(s);
4413 return (c);
4414}
4415
4416static void
4411siocnputc(dev, c)
4412 dev_t dev;
4413 int c;
4417siocnputc(struct consdev *cd, int c)
4414{
4415 int need_unlock;
4416 int s;
4418{
4419 int need_unlock;
4420 int s;
4421 dev_t dev;
4417 struct siocnstate sp;
4418 Port_t iobase;
4419 speed_t speed;
4420
4422 struct siocnstate sp;
4423 Port_t iobase;
4424 speed_t speed;
4425
4426 dev = cd->cn_dev;
4421 if (minor(dev) == siocnunit) {
4422 iobase = siocniobase;
4423 speed = comdefaultrate;
4424 } else {
4425 iobase = siogdbiobase;
4426 speed = gdbdefaultrate;
4427 }
4428 s = spltty();

--- 675 unchanged lines hidden ---
4427 if (minor(dev) == siocnunit) {
4428 iobase = siocniobase;
4429 speed = comdefaultrate;
4430 } else {
4431 iobase = siogdbiobase;
4432 speed = gdbdefaultrate;
4433 }
4434 s = spltty();

--- 675 unchanged lines hidden ---