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/dev/sio/sio.c 111017 2003-02-16 19:22:21Z phk $ | 33 * $FreeBSD: head/sys/dev/sio/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" --- 2726 unchanged lines hidden (view full) --- 2768#ifndef __alpha__ 2769CONS_DRIVER(sio, siocnprobe, siocninit, siocnterm, siocngetc, siocncheckc, 2770 siocnputc, NULL); 2771#endif 2772 2773/* To get the GDB related variables */ 2774#if DDB > 0 2775#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" --- 2726 unchanged lines hidden (view full) --- 2768#ifndef __alpha__ 2769CONS_DRIVER(sio, siocnprobe, siocninit, siocnterm, siocngetc, siocncheckc, 2770 siocnputc, NULL); 2771#endif 2772 2773/* To get the GDB related variables */ 2774#if DDB > 0 2775#include <ddb/ddb.h> |
2776static struct consdev gdbconsdev; 2777 |
|
2776#endif 2777 2778static void 2779siocntxwait(iobase) 2780 Port_t iobase; 2781{ 2782 int timo; 2783 --- 193 unchanged lines hidden (view full) --- 2977 siocniobase = iobase; 2978 siocnunit = unit; 2979 } 2980 if (COM_DEBUGGER(flags)) { 2981 printf("sio%d: gdb debugging port\n", unit); 2982 siogdbiobase = iobase; 2983 siogdbunit = unit; 2984#if DDB > 0 | 2778#endif 2779 2780static void 2781siocntxwait(iobase) 2782 Port_t iobase; 2783{ 2784 int timo; 2785 --- 193 unchanged lines hidden (view full) --- 2979 siocniobase = iobase; 2980 siocnunit = unit; 2981 } 2982 if (COM_DEBUGGER(flags)) { 2983 printf("sio%d: gdb debugging port\n", unit); 2984 siogdbiobase = iobase; 2985 siogdbunit = unit; 2986#if DDB > 0 |
2985 gdb_arg = makedev(CDEV_MAJOR, unit); | 2987 gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit); 2988 gdb_arg = &gdbconsdev; |
2986 gdb_getc = siocngetc; 2987 gdb_putc = siocnputc; 2988#endif 2989 } 2990 } 2991 } 2992#ifdef __i386__ 2993#if DDB > 0 --- 4 unchanged lines hidden (view full) --- 2998 */ 2999 if (gdb_arg == NULL && (boothowto & RB_GDB)) { 3000 printf("Warning: no GDB port specified. Defaulting to sio%d.\n", 3001 siocnunit); 3002 printf("Set flag 0x80 on desired GDB port in your\n"); 3003 printf("configuration file (currently sio only).\n"); 3004 siogdbiobase = siocniobase; 3005 siogdbunit = siocnunit; | 2989 gdb_getc = siocngetc; 2990 gdb_putc = siocnputc; 2991#endif 2992 } 2993 } 2994 } 2995#ifdef __i386__ 2996#if DDB > 0 --- 4 unchanged lines hidden (view full) --- 3001 */ 3002 if (gdb_arg == NULL && (boothowto & RB_GDB)) { 3003 printf("Warning: no GDB port specified. Defaulting to sio%d.\n", 3004 siocnunit); 3005 printf("Set flag 0x80 on desired GDB port in your\n"); 3006 printf("configuration file (currently sio only).\n"); 3007 siogdbiobase = siocniobase; 3008 siogdbunit = siocnunit; |
3006 gdb_arg = makedev(CDEV_MAJOR, siocnunit); | 3009 gdbconsdev.cn_dev = makedev(CDEV_MAJOR, siocnunit); 3010 gdb_arg = &gdbconsdev; |
3007 gdb_getc = siocngetc; 3008 gdb_putc = siocnputc; 3009 } 3010#endif 3011#endif 3012} 3013 3014static void --- 70 unchanged lines hidden (view full) --- 3085 int unit = 1; /* XXX random value! */ 3086 3087 siogdbiobase = port; 3088 gdbdefaultrate = speed; 3089 3090 printf("sio%d: gdb debugging port\n", unit); 3091 siogdbunit = unit; 3092#if DDB > 0 | 3011 gdb_getc = siocngetc; 3012 gdb_putc = siocnputc; 3013 } 3014#endif 3015#endif 3016} 3017 3018static void --- 70 unchanged lines hidden (view full) --- 3089 int unit = 1; /* XXX random value! */ 3090 3091 siogdbiobase = port; 3092 gdbdefaultrate = speed; 3093 3094 printf("sio%d: gdb debugging port\n", unit); 3095 siogdbunit = unit; 3096#if DDB > 0 |
3093 gdb_arg = makedev(CDEV_MAJOR, unit); | 3097 gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit); 3098 gdb_arg = &gdbconsdev; |
3094 gdb_getc = siocngetc; 3095 gdb_putc = siocnputc; 3096#endif 3097 3098 s = spltty(); 3099 3100 /* 3101 * Initialize the divisor latch. We can't rely on --- 15 unchanged lines hidden (view full) --- 3117 splx(s); 3118 3119 return (0); 3120} 3121 3122#endif 3123 3124static int | 3099 gdb_getc = siocngetc; 3100 gdb_putc = siocnputc; 3101#endif 3102 3103 s = spltty(); 3104 3105 /* 3106 * Initialize the divisor latch. We can't rely on --- 15 unchanged lines hidden (view full) --- 3122 splx(s); 3123 3124 return (0); 3125} 3126 3127#endif 3128 3129static int |
3125siocncheckc(dev) 3126 dev_t dev; | 3130siocncheckc(struct consdev *cd) |
3127{ 3128 int c; | 3131{ 3132 int c; |
3133 dev_t dev; |
|
3129 Port_t iobase; 3130 int s; 3131 struct siocnstate sp; 3132 speed_t speed; | 3134 Port_t iobase; 3135 int s; 3136 struct siocnstate sp; 3137 speed_t speed; |
3133 | 3138 3139 dev = cd->cn_dev; |
3134 if (minor(dev) == siocnunit) { 3135 iobase = siocniobase; 3136 speed = comdefaultrate; 3137 } else { 3138 iobase = siogdbiobase; 3139 speed = gdbdefaultrate; 3140 } 3141 s = spltty(); --- 4 unchanged lines hidden (view full) --- 3146 c = -1; 3147 siocnclose(&sp, iobase); 3148 splx(s); 3149 return (c); 3150} 3151 3152 3153static int | 3140 if (minor(dev) == siocnunit) { 3141 iobase = siocniobase; 3142 speed = comdefaultrate; 3143 } else { 3144 iobase = siogdbiobase; 3145 speed = gdbdefaultrate; 3146 } 3147 s = spltty(); --- 4 unchanged lines hidden (view full) --- 3152 c = -1; 3153 siocnclose(&sp, iobase); 3154 splx(s); 3155 return (c); 3156} 3157 3158 3159static int |
3154siocngetc(dev) 3155 dev_t dev; | 3160siocngetc(struct consdev *cd) |
3156{ 3157 int c; | 3161{ 3162 int c; |
3163 dev_t dev; |
|
3158 Port_t iobase; 3159 int s; 3160 struct siocnstate sp; 3161 speed_t speed; 3162 | 3164 Port_t iobase; 3165 int s; 3166 struct siocnstate sp; 3167 speed_t speed; 3168 |
3169 dev = cd->cn_dev; |
|
3163 if (minor(dev) == siocnunit) { 3164 iobase = siocniobase; 3165 speed = comdefaultrate; 3166 } else { 3167 iobase = siogdbiobase; 3168 speed = gdbdefaultrate; 3169 } 3170 s = spltty(); 3171 siocnopen(&sp, iobase, speed); 3172 while (!(inb(iobase + com_lsr) & LSR_RXRDY)) 3173 ; 3174 c = inb(iobase + com_data); 3175 siocnclose(&sp, iobase); 3176 splx(s); 3177 return (c); 3178} 3179 3180static void | 3170 if (minor(dev) == siocnunit) { 3171 iobase = siocniobase; 3172 speed = comdefaultrate; 3173 } else { 3174 iobase = siogdbiobase; 3175 speed = gdbdefaultrate; 3176 } 3177 s = spltty(); 3178 siocnopen(&sp, iobase, speed); 3179 while (!(inb(iobase + com_lsr) & LSR_RXRDY)) 3180 ; 3181 c = inb(iobase + com_data); 3182 siocnclose(&sp, iobase); 3183 splx(s); 3184 return (c); 3185} 3186 3187static void |
3181siocnputc(dev, c) 3182 dev_t dev; 3183 int c; | 3188siocnputc(struct consdev *cd, int c) |
3184{ 3185 int need_unlock; 3186 int s; | 3189{ 3190 int need_unlock; 3191 int s; |
3192 dev_t dev; |
|
3187 struct siocnstate sp; 3188 Port_t iobase; 3189 speed_t speed; 3190 | 3193 struct siocnstate sp; 3194 Port_t iobase; 3195 speed_t speed; 3196 |
3197 dev = cd->cn_dev; |
|
3191 if (minor(dev) == siocnunit) { 3192 iobase = siocniobase; 3193 speed = comdefaultrate; 3194 } else { 3195 iobase = siogdbiobase; 3196 speed = gdbdefaultrate; 3197 } 3198 s = spltty(); --- 67 unchanged lines hidden --- | 3198 if (minor(dev) == siocnunit) { 3199 iobase = siocniobase; 3200 speed = comdefaultrate; 3201 } else { 3202 iobase = siogdbiobase; 3203 speed = gdbdefaultrate; 3204 } 3205 s = spltty(); --- 67 unchanged lines hidden --- |