Revert back wrong changes, because port have strange

infrastructure: patch-aa and patch-ac both patch the same
file: ${WRKSRC}/sys/dev/ltmdm/ltmdmsio.c.
This commit is contained in:
Sergey A. Osokin 2004-07-22 10:29:26 +00:00
parent 106486ea35
commit 9659373f55
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=114422
2 changed files with 177 additions and 242 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= ltmdm PORTNAME= ltmdm
PORTVERSION= 1.4 PORTVERSION= 1.4
PORTREVISION= 8 PORTREVISION= 7
CATEGORIES= comms CATEGORIES= comms
MASTER_SITES= http://www.dons.net.au/~darius/ \ MASTER_SITES= http://www.dons.net.au/~darius/ \
http://soupnazi.org/FreeBSD/ports/distfiles/ http://soupnazi.org/FreeBSD/ports/distfiles/

View file

@ -1,261 +1,196 @@
--- sys/dev/ltmdm/ltmdmsio.c.orig Thu Jul 22 13:05:17 2004 --- sys/dev/ltmdm/ltmdmsio.c.orig Mon Mar 11 18:47:31 2002
+++ sys/dev/ltmdm/ltmdmsio.c Thu Jul 22 13:06:49 2004 +++ sys/dev/ltmdm/ltmdmsio.c Sat Feb 21 20:56:45 2004
@@ -245,7 +245,9 @@ @@ -60,7 +60,9 @@
u_char last_modem_status; /* last MSR read by intr handler */ #include <sys/proc.h>
u_char prev_modem_status; /* last MSR handled by high level */ #include <sys/module.h>
#include <sys/conf.h>
+#if __FreeBSD_version < 502119 +#if __FreeBSD_version < 500101
u_char hotchar; /* ldisc-specific char to be handled ASAP */ #include <sys/dkstat.h>
+#endif +#endif
u_char *ibuf; /* start of input buffer */ #include <sys/fcntl.h>
u_char *ibufend; /* end of input buffer */ #include <sys/interrupt.h>
u_char *ibufold; /* old input buffer, to be freed */ #include <sys/kernel.h>
@@ -285,7 +287,11 @@ @@ -69,12 +71,21 @@
struct resource *iores[6]; #include <machine/bus.h>
struct resource *irqres; #include <sys/rman.h>
void *cookie; #if __FreeBSD_version >= 500000
+#if __FreeBSD_version > 502115 +#if __FreeBSD_version < 500034 /* < 20020426 */
+ struct cdev *devs[6]; #include <sys/timetc.h>
#endif
+#endif
+#ifdef ENABLE_PPS
#include <sys/timepps.h>
+#endif
+#if __FreeBSD_version >= 500000
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#else +#else
dev_t devs[6]; #include <pci/pcireg.h>
#include <pci/pcivar.h>
+#endif
#include <machine/clock.h>
@@ -88,7 +99,9 @@
#include <machine/resource.h>
-#if __FreeBSD_version >= 500027 /* >= 20011022 */
+#if __FreeBSD_version >= 501107 /* >= 20030917 */
+#include <dev/ic/ns16550.h>
+#elif __FreeBSD_version >= 500027 /* >= 20011022 */
#include <dev/sio/sioreg.h>
#else
#include <isa/sioreg.h>
@@ -124,9 +137,11 @@
#endif
#if __FreeBSD_version >= 500023 /* >= 20010912 */
-#define proc thread /* temporary hack: struct proc -> stuct thread */
+#define proc thread /* XXX struct proc -> stuct thread */
+#if __FreeBSD_version < 500033 /* < 20020401 */
#define suser(p) suser_td(p)
#endif
+#endif
#define LOTS_OF_EVENTS 64 /* helps separate urgent events from input */
@@ -256,7 +271,9 @@
bool_t do_dcd_timestamp;
struct timeval timestamp;
struct timeval dcd_timestamp;
+#ifdef ENABLE_PPS
struct pps_state pps;
+#endif
u_long bytes_in; /* statistics */
u_long bytes_out;
@@ -352,6 +369,7 @@
#endif
static struct cdevsw sio_cdevsw = {
+#if __FreeBSD_version < 500105
/* open */ sioopen,
/* close */ sioclose,
/* read */ sioread,
@@ -361,7 +379,11 @@
/* mmap */ nommap,
/* strategy */ nostrategy,
/* name */ driver_name,
+#ifdef MAJOR_AUTO
+ /* maj */ MAJOR_AUTO,
+#else
/* maj */ CDEV_MAJOR,
+#endif
/* dump */ nodump,
/* psize */ nopsize,
#if __FreeBSD_version < 430000
@@ -373,10 +395,30 @@
/* bmaj */ -1,
/* kqfilter */ ttykqfilter,
#else /* __FreeBSD_version >= 500000 */
- /* flags */ D_TTY | D_KQFILTER,
+ /* flags */ D_TTY,
/* kqfilter */ ttykqfilter,
#endif
#endif
+#else
+ .d_open = sioopen,
+ .d_close = sioclose,
+ .d_read = sioread,
+ .d_write = siowrite,
+ .d_ioctl = sioioctl,
+ .d_name = driver_name,
+#ifdef MAJOR_AUTO
+ .d_maj = MAJOR_AUTO,
+#else
+ .d_maj = CDEV_MAJOR,
+#endif
+ .d_kqfilter = ttykqfilter,
+#if __FreeBSD_version >= 502102
+ .d_flags = D_TTY | D_NEEDGIANT,
+ .d_version = D_VERSION
+#else
+ .d_poll = ttypoll,
+#endif
+#endif
};
static u_int com_events; /* input chars + weighted output completions */
@@ -1295,8 +1337,11 @@
DPRINTF(1,(" x_chip_version = %d\n", x_chip_version));
com->flags = flags;
+
+#ifdef ENABLE_PPS
com->pps.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR;
pps_init(&com->pps);
+#endif +#endif
/* /*
* Data area for output buffers. Someday we should build the output * initialize the device registers as follows:
@@ -1478,11 +1484,17 @@ @@ -1685,7 +1730,9 @@
s = splfunc(); s = splfunc();
if (tp) { com->do_timestamp = FALSE;
+#if __FreeBSD_version > 502112 com->do_dcd_timestamp = FALSE;
+ (*linesw[tp->t_line]->l_close)(tp, FNONBLOCK); +#ifdef ENABLE_PPS
+#else com->pps.ppsparam.mode = 0;
(*linesw[tp->t_line].l_close)(tp, FNONBLOCK); +#endif
write_vuart_port(UART_CFCR, com->cfcr_image &= ~CFCR_SBREAK);
{
write_vuart_port(UART_IER, 0);
@@ -1894,23 +1941,34 @@
u_char recv_data;
u_char int_ctl;
u_char int_ctl_new;
+#ifdef ENABLE_PPS
+#if __FreeBSD_version < 500034
struct timecounter *tc;
u_int count;
+#endif +#endif
disc_optim(tp, &tp->t_termios, com);
comstop(tp, FREAD | FWRITE);
comhardclose(com);
+#if __FreeBSD_version > 502122
ttyclose(tp);
+#endif +#endif
}
vxdPortClose();
siosettimeout();
@@ -1515,7 +1527,11 @@
}
static int int_ctl = read_vuart_port(UART_IER);
+#if __FreeBSD_version > 502115 int_ctl_new = int_ctl;
+sioopen(struct cdev *dev, int flag, int mode, struct proc *p)
+#else
sioopen(dev_t dev, int flag, int mode, struct proc *p)
+#endif
{
struct com_s *com;
int error;
@@ -1655,7 +1671,11 @@
* the true carrier.
*/
if (com->prev_modem_status & MSR_DCD || mynor & CALLOUT_MASK)
+#if __FreeBSD_version > 502112
+ (*linesw[tp->t_line]->l_modem)(tp, 1);
+#else
(*linesw[tp->t_line].l_modem)(tp, 1);
+#endif
}
/*
* Wait for DCD if necessary.
@@ -1671,7 +1691,11 @@
goto out;
goto open_top;
}
+#if __FreeBSD_version > 502112
+ error = (*linesw[tp->t_line]->l_open)(dev, tp);
+#else
error = (*linesw[tp->t_line].l_open)(dev, tp);
+#endif
disc_optim(tp, &tp->t_termios, com);
if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK)
com->active_out = TRUE;
@@ -1684,7 +1708,11 @@
}
static int while (!com->gone) {
+#if __FreeBSD_version > 502115 +#ifdef ENABLE_PPS
+sioclose(struct cdev *dev, int flag, int mode, struct proc *p) if (com->pps.ppsparam.mode & PPS_CAPTUREBOTH) {
modem_status = read_vuart_port(UART_MSR);
if ((modem_status ^ com->last_modem_status) & MSR_DCD) {
+#if __FreeBSD_version < 500034
tc = timecounter;
count = tc->tc_get_timecount(tc);
pps_event(&com->pps, tc, count,
+#else +#else
sioclose(dev_t dev, int flag, int mode, struct proc *p) + pps_capture(&com->pps);
+ pps_event(&com->pps,
+#endif +#endif
{ (modem_status & MSR_DCD) ?
struct com_s *com; PPS_CAPTUREASSERT : PPS_CAPTURECLEAR);
int mynor;
@@ -1699,11 +1727,17 @@
return (ENODEV);
tp = com->tp;
s = splfunc();
+#if __FreeBSD_version > 502112
+ (*linesw[tp->t_line]->l_close)(tp, flag);
+#else
(*linesw[tp->t_line].l_close)(tp, flag);
+#endif
disc_optim(tp, &tp->t_termios, com);
comstop(tp, FREAD | FWRITE);
comhardclose(com);
+#if __FreeBSD_version > 502122
ttyclose(tp);
+#endif
siosettimeout();
splx(s);
if (com->gone) {
@@ -1771,7 +1805,11 @@
}
static int
+#if __FreeBSD_version > 502115
+sioread(struct cdev *dev, struct uio *uio, int flag)
+#else
sioread(dev_t dev, struct uio *uio, int flag)
+#endif
{
int mynor;
struct com_s *com;
@@ -1782,11 +1820,19 @@
com = com_addr(MINOR_TO_UNIT(mynor));
if (com == NULL || com->gone)
return (ENODEV);
+#if __FreeBSD_version > 502112
+ return ((*linesw[com->tp->t_line]->l_read)(com->tp, uio, flag));
+#else
return ((*linesw[com->tp->t_line].l_read)(com->tp, uio, flag));
+#endif
}
static int
+#if __FreeBSD_version > 502115
+siowrite(struct cdev *dev, struct uio *uio, int flag)
+#else
siowrite(dev_t dev, struct uio *uio, int flag)
+#endif
{
int mynor;
struct com_s *com;
@@ -1801,7 +1847,11 @@
if (com == NULL || com->gone)
return (ENODEV);
+#if __FreeBSD_version > 502112
+ return ((*linesw[com->tp->t_line]->l_write)(com->tp, uio, flag));
+#else
return ((*linesw[com->tp->t_line].l_write)(com->tp, uio, flag));
+#endif
}
static void
@@ -1907,7 +1957,11 @@
if (line_status & LSR_PE)
recv_data |= TTY_PE;
} }
+#if __FreeBSD_version > 502112 }
+ (*linesw[tp->t_line]->l_rint)(recv_data, tp);
+#else
(*linesw[tp->t_line].l_rint)(recv_data, tp);
+#endif +#endif
lt_disable_intr(); line_status = read_vuart_port(UART_LSR);
} while (buf < com->iptr);
}
@@ -2006,7 +2060,11 @@
recv_data = 0;
}
++com->bytes_in;
+#if __FreeBSD_version > 502118
+ if (com->tp->t_hotchar != 0 && recv_data == com->tp->t_hotchar)
+#else
if (com->hotchar != 0 && recv_data == com->hotchar)
+#endif
setsofttty();
ioptr = com->iptr;
if (ioptr >= com->ibufend)
@@ -2111,7 +2169,11 @@
}
static int /* input event? (check first to help avoid overruns) */
+#if __FreeBSD_version > 502115 @@ -2195,7 +2253,9 @@
+sioioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+#else
sioioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+#endif
{
struct com_s *com;
int error;
@@ -2192,7 +2254,11 @@
if (lt->c_ospeed != 0)
dt->c_ospeed = tp->t_ospeed;
}
+#if __FreeBSD_version > 502112
+ error = (*linesw[tp->t_line]->l_ioctl)(tp, cmd, data, flag, p);
+#else
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
+#endif
if (error != ENOIOCTL)
return (error);
s = splfunc();
@@ -2247,10 +2313,12 @@
com->do_timestamp = TRUE;
*(struct timeval *)data = com->timestamp;
break; break;
+#if __FreeBSD_version < 502119
case TIOCDCDTIMESTAMP:
com->do_dcd_timestamp = TRUE;
*(struct timeval *)data = com->dcd_timestamp;
break;
+#endif
default: default:
splx(s); splx(s);
#ifdef ENABLE_PPS +#ifdef ENABLE_PPS
@@ -2317,8 +2385,13 @@ error = pps_ioctl(cmd, data, &com->pps);
com->state &= ~CS_CHECKMSR;
lt_enable_intr();
if (delta_modem_status & MSR_DCD)
+#if __FreeBSD_version > 502112
+ (*linesw[tp->t_line]->l_modem)
+ (tp, com->prev_modem_status & MSR_DCD);
+#else
(*linesw[tp->t_line].l_modem)
(tp, com->prev_modem_status & MSR_DCD);
+#endif +#endif
} if (error == ENODEV)
if (com->state & CS_ODONE) { error = ENOTTY;
lt_disable_intr(); return (error);
@@ -2330,7 +2403,11 @@ @@ -2796,7 +2856,7 @@
sio_busycheck_handle = timeout(siobusycheck, com, hz / 100); #endif
com->extra_state |= CSE_BUSYCHECK;
}
+#if __FreeBSD_version > 502112
+ (*linesw[tp->t_line]->l_start)(tp);
+#else
(*linesw[tp->t_line].l_start)(tp);
+#endif
}
if (com_events == 0)
break;
@@ -2829,11 +2906,21 @@
&& (!(t->c_iflag & PARMRK)
|| (t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK))
&& !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN))
+#if __FreeBSD_version > 502112
+ && linesw[tp->t_line]->l_rint == ttyinput)
+#else
&& linesw[tp->t_line].l_rint == ttyinput)
+#endif
tp->t_state |= TS_CAN_BYPASS_L_RINT;
else
tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
+#if __FreeBSD_version > 502112
+#if __FreeBSD_version < 502119
+ com->hotchar = linesw[tp->t_line]->l_hotchar;
+#endif
+#else
com->hotchar = linesw[tp->t_line].l_hotchar;
+#endif
}
#ifdef KLD_MODULE DRIVER_MODULE(ltmdm, pci, ltmdm_pci_driver, ltmdm_devclass, ltmdm_event, 0);
-#if 0
+#if 1
#if __FreeBSD_version >= 500000
DRIVER_MODULE(ltmdm, cardbus, ltmdm_pci_driver, ltmdm_devclass, ltmdm_event, 0);
#endif