centralize the dialout/call unit macros.

This commit is contained in:
christos 2014-11-15 19:18:18 +00:00
parent cf8ac13ddd
commit 6ca6d5d665
13 changed files with 74 additions and 73 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd18xxvar.h,v 1.4 2012/10/27 17:18:19 chs Exp $ */ /* $NetBSD: cd18xxvar.h,v 1.5 2014/11/15 19:18:18 christos Exp $ */
/* /*
* Copyright (c) 1998, 2001 Matthew R. Green * Copyright (c) 1998, 2001 Matthew R. Green
@ -150,10 +150,10 @@ void cd18xx_attach(struct cd18xx_softc *);
* the first 3 bits of the unit are the channel number inside a single * the first 3 bits of the unit are the channel number inside a single
* cd18xx instance, and the remaining bits indicate the instance number. * cd18xx instance, and the remaining bits indicate the instance number.
*/ */
#define CD18XX_TTY(x) (minor(x) & 0x7ffff) #define CD18XX_TTY(x) TTUNIT(x)
#define CD18XX_CHANNEL(x) (minor(x) & 7) #define CD18XX_CHANNEL(x) (TTUNIT(x) & 7)
#define CD18XX_INSTANCE(x) ((minor(x) >> 3) & 0xffff) #define CD18XX_INSTANCE(x) (TTUNIT(x) >> 3)
#define CD18XX_DIALOUT(x) ((minor(x) & 0x80000) != 0) #define CD18XX_DIALOUT(x) TTDIALOUT(x)
/* short helpers for read/write */ /* short helpers for read/write */
#define cd18xx_read(sc, o) \ #define cd18xx_read(sc, o) \

View File

@ -1,4 +1,4 @@
/* $NetBSD: clmpcc.c,v 1.50 2014/10/18 08:33:27 snj Exp $ */ /* $NetBSD: clmpcc.c,v 1.51 2014/11/15 19:18:18 christos Exp $ */
/*- /*-
* Copyright (c) 1999 The NetBSD Foundation, Inc. * Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clmpcc.c,v 1.50 2014/10/18 08:33:27 snj Exp $"); __KERNEL_RCSID(0, "$NetBSD: clmpcc.c,v 1.51 2014/11/15 19:18:18 christos Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
@ -75,9 +75,9 @@ static void clmpcc_set_params(struct clmpcc_chan *);
static void clmpcc_start(struct tty *); static void clmpcc_start(struct tty *);
static int clmpcc_modem_control(struct clmpcc_chan *, int, int); static int clmpcc_modem_control(struct clmpcc_chan *, int, int);
#define CLMPCCUNIT(x) (minor(x) & 0x7fffc) #define CLMPCCUNIT(x) (TTUNIT(x) & ~0x3) // XXX >> 2?
#define CLMPCCCHAN(x) (minor(x) & 0x00003) #define CLMPCCCHAN(x) (TTUNIT(x) & 0x3)
#define CLMPCCDIALOUT(x) (minor(x) & 0x80000) #define CLMPCCDIALOUT(x) TTDIALOUT(x)
/* /*
* These should be in a header file somewhere... * These should be in a header file somewhere...

View File

@ -1,4 +1,4 @@
/* $NetBSD: com.c,v 1.327 2014/08/10 16:44:35 tls Exp $ */ /* $NetBSD: com.c,v 1.328 2014/11/15 19:18:18 christos Exp $ */
/*- /*-
* Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc. * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@ -66,7 +66,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.327 2014/08/10 16:44:35 tls Exp $"); __KERNEL_RCSID(0, "$NetBSD: com.c,v 1.328 2014/11/15 19:18:18 christos Exp $");
#include "opt_com.h" #include "opt_com.h"
#include "opt_ddb.h" #include "opt_ddb.h"
@ -270,11 +270,10 @@ const bus_size_t com_std_map[16] = COM_REG_16550;
#endif /* COM_16750 */ #endif /* COM_16750 */
#endif /* COM_REGMAP */ #endif /* COM_REGMAP */
#define COMUNIT_MASK 0x7ffff #define COMDIALOUT_MASK TTDIALOUT_MASK
#define COMDIALOUT_MASK 0x80000
#define COMUNIT(x) (minor(x) & COMUNIT_MASK) #define COMUNIT(x) TTUNIT(x)
#define COMDIALOUT(x) (minor(x) & COMDIALOUT_MASK) #define COMDIALOUT(x) TTDIALOUT(x)
#define COM_ISALIVE(sc) ((sc)->enabled != 0 && \ #define COM_ISALIVE(sc) ((sc)->enabled != 0 && \
device_is_active((sc)->sc_dev)) device_is_active((sc)->sc_dev))

View File

@ -1,4 +1,4 @@
/* $NetBSD: cy.c,v 1.59 2014/07/25 08:10:37 dholland Exp $ */ /* $NetBSD: cy.c,v 1.60 2014/11/15 19:18:18 christos Exp $ */
/* /*
* cy.c * cy.c
@ -16,7 +16,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cy.c,v 1.59 2014/07/25 08:10:37 dholland Exp $"); __KERNEL_RCSID(0, "$NetBSD: cy.c,v 1.60 2014/11/15 19:18:18 christos Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
@ -246,8 +246,8 @@ cy_attach(struct cy_softc *sc)
CY_CLEAR_INTR << sc->sc_bustype, 0); CY_CLEAR_INTR << sc->sc_bustype, 0);
} }
#define CYDIALOUT_MASK 0x80000 #define CY_UNIT(dev) TTUNIT(dev)
#define CY_DIALOUT(dev) (minor(dev) & CYDIALOUT_MASK) #define CY_DIALOUT(dev) TTDIALOUT(dev)
#define CY_PORT(dev) cy_getport((dev)) #define CY_PORT(dev) cy_getport((dev))
#define CY_BOARD(cy) ((cy)->cy_softc) #define CY_BOARD(cy) ((cy)->cy_softc)
@ -255,7 +255,7 @@ cy_attach(struct cy_softc *sc)
static struct cy_port * static struct cy_port *
cy_getport(dev_t dev) cy_getport(dev_t dev)
{ {
int i, j, k, u = minor(dev) & ~CYDIALOUT_MASK; int i, j, k, u = CY_UNIT(dev);
struct cy_softc *sc; struct cy_softc *sc;
for (i = 0, j = 0; i < cy_cd.cd_ndevs; i++) { for (i = 0, j = 0; i < cy_cd.cd_ndevs; i++) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: z8530tty.c,v 1.130 2014/07/25 08:10:37 dholland Exp $ */ /* $NetBSD: z8530tty.c,v 1.131 2014/11/15 19:18:18 christos Exp $ */
/*- /*-
* Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999 * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999
@ -137,7 +137,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.130 2014/07/25 08:10:37 dholland Exp $"); __KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.131 2014/11/15 19:18:18 christos Exp $");
#include "opt_kgdb.h" #include "opt_kgdb.h"
#include "opt_ntp.h" #include "opt_ntp.h"
@ -285,8 +285,8 @@ static void zstty_txint (struct zs_chanstate *);
static void zstty_softint(struct zs_chanstate *); static void zstty_softint(struct zs_chanstate *);
static void zstty_softint1(struct zs_chanstate *); static void zstty_softint1(struct zs_chanstate *);
#define ZSUNIT(x) (minor(x) & 0x7ffff) #define ZSUNIT(x) TTUNIT(x)
#define ZSDIALOUT(x) (minor(x) & 0x80000) #define ZSDIALOUT(x) TTDIALOUT(x)
struct tty *zstty_get_tty_from_dev(device_t); struct tty *zstty_get_tty_from_dev(device_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: gtmpsc.c,v 1.45 2014/07/25 08:10:37 dholland Exp $ */ /* $NetBSD: gtmpsc.c,v 1.46 2014/11/15 19:18:18 christos Exp $ */
/* /*
* Copyright (c) 2009 KIYOHARA Takashi * Copyright (c) 2009 KIYOHARA Takashi
* All rights reserved. * All rights reserved.
@ -29,7 +29,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: gtmpsc.c,v 1.45 2014/07/25 08:10:37 dholland Exp $"); __KERNEL_RCSID(0, "$NetBSD: gtmpsc.c,v 1.46 2014/11/15 19:18:18 christos Exp $");
#include "opt_kgdb.h" #include "opt_kgdb.h"
@ -82,11 +82,8 @@ unsigned int gtmpsc_debug = 0;
# define DPRINTF(x) # define DPRINTF(x)
#endif #endif
#define GTMPSCUNIT_MASK 0x7ffff #define GTMPSCUNIT(x) TTUNIT(x)
#define GTMPSCDIALOUT_MASK 0x80000 #define GTMPSCDIALOUT(x) TTDIALOUT(x)
#define GTMPSCUNIT(x) (minor(x) & GTMPSCUNIT_MASK)
#define GTMPSCDIALOUT(x) (minor(x) & GTMPSCDIALOUT_MASK)
#define CLEANUP_AND_RETURN_RXDMA(sc, ix) \ #define CLEANUP_AND_RETURN_RXDMA(sc, ix) \
do { \ do { \

View File

@ -1,4 +1,4 @@
# $NetBSD: files.mii,v 1.49 2014/02/26 04:13:44 ozaki-r Exp $ # $NetBSD: files.mii,v 1.50 2014/11/15 19:18:18 christos Exp $
defflag opt_mii.h MIIVERBOSE defflag opt_mii.h MIIVERBOSE
@ -77,10 +77,16 @@ device lxtphy: mii_phy, ukphy_subr
attach lxtphy at mii attach lxtphy at mii
file dev/mii/lxtphy.c lxtphy file dev/mii/lxtphy.c lxtphy
# Old
device makphy: mii_phy device makphy: mii_phy
attach makphy at mii attach makphy at mii
file dev/mii/makphy.c makphy file dev/mii/makphy.c makphy
# New
device e1000phy: mii_phy
attach e1000phy at mii
file dev/mii/e1000phy.c e1000phy
device icsphy: mii_phy device icsphy: mii_phy
attach icsphy at mii attach icsphy at mii
file dev/mii/icsphy.c icsphy file dev/mii/icsphy.c icsphy

View File

@ -1,4 +1,4 @@
/* $NetBSD: cz.c,v 1.60 2014/07/25 08:10:38 dholland Exp $ */ /* $NetBSD: cz.c,v 1.61 2014/11/15 19:18:19 christos Exp $ */
/*- /*-
* Copyright (c) 2000 Zembu Labs, Inc. * Copyright (c) 2000 Zembu Labs, Inc.
@ -73,7 +73,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cz.c,v 1.60 2014/07/25 08:10:38 dholland Exp $"); __KERNEL_RCSID(0, "$NetBSD: cz.c,v 1.61 2014/11/15 19:18:19 christos Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -846,9 +846,8 @@ cz_wait_pci_doorbell(struct cz_softc *cz, const char *wstring)
* Cyclades-Z TTY code starts here... * Cyclades-Z TTY code starts here...
*****************************************************************************/ *****************************************************************************/
#define CZTTYDIALOUT_MASK 0x80000 #define CZTTY_DIALOUT(dev) TTDIALOUT(dev)
#define CZTTY_UNIT(dev) TTUNIT(dev)
#define CZTTY_DIALOUT(dev) (minor((dev)) & CZTTYDIALOUT_MASK)
#define CZTTY_CZ(sc) ((sc)->sc_parent) #define CZTTY_CZ(sc) ((sc)->sc_parent)
#define CZTTY_SOFTC(dev) cztty_getttysoftc(dev) #define CZTTY_SOFTC(dev) cztty_getttysoftc(dev)
@ -856,7 +855,7 @@ cz_wait_pci_doorbell(struct cz_softc *cz, const char *wstring)
static struct cztty_softc * static struct cztty_softc *
cztty_getttysoftc(dev_t dev) cztty_getttysoftc(dev_t dev)
{ {
int i, j, k = 0, u = minor(dev) & ~CZTTYDIALOUT_MASK; int i, j, k = 0, u = CZTTY_UNIT(dev);
struct cz_softc *cz = NULL; struct cz_softc *cz = NULL;
for (i = 0, j = 0; i < cz_cd.cd_ndevs; i++) { for (i = 0, j = 0; i < cz_cd.cd_ndevs; i++) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: magmareg.h,v 1.17 2012/10/27 17:18:37 chs Exp $ */ /* $NetBSD: magmareg.h,v 1.18 2014/11/15 19:18:19 christos Exp $ */
/*- /*-
* Copyright (c) 1998 Iain Hibbert * Copyright (c) 1998 Iain Hibbert
@ -40,7 +40,7 @@
* | | | | | | | | * | | | | | | | |
* | | | | +---+---+---+---> port number * | | | | +---+---+---+---> port number
* | | | | * | | | |
* | | | +-------------------> dialout (on tty ports) * | | | +-------------------> unused
* | | | * | | |
* | | +-----------------------> unused * | | +-----------------------> unused
* | | * | |
@ -54,10 +54,10 @@
#define MAGMA_MAX_CD1400 4 #define MAGMA_MAX_CD1400 4
#define MAGMA_MAX_CD1190 2 #define MAGMA_MAX_CD1190 2
#define MAGMA_CARD(x) ((minor(x) >> 6) & 0x03) #define MAGMA_CARD(x) ((TTUNIT(x) >> 6) & 0x03)
#define MAGMA_PORT(x) (minor(x) & 0x0f) #define MAGMA_PORT(x) (TTUNIT(x) & 0x0f)
#define MTTY_DIALOUT(x) (minor(x) & 0x10) #define MTTY_DIALOUT(x) TTDIALOUT(x)
/* /*
* Supported Card Types * Supported Card Types

View File

@ -1,4 +1,4 @@
/* $NetBSD: spifreg.h,v 1.4 2009/05/12 14:43:59 cegger Exp $ */ /* $NetBSD: spifreg.h,v 1.5 2014/11/15 19:18:19 christos Exp $ */
/* $OpenBSD: spifreg.h,v 1.5 2003/06/02 18:32:41 jason Exp $ */ /* $OpenBSD: spifreg.h,v 1.5 2003/06/02 18:32:41 jason Exp $ */
/* /*
@ -325,7 +325,7 @@
* | | | | | * | | | | |
* | | | | +---------------> unused * | | | | +---------------> unused
* | | | | * | | | |
* | | | +-------------------> dialout (on tty ports) * | | | +-------------------> unused
* | | | * | | |
* | | +-----------------------> unused * | | +-----------------------> unused
* | | * | |
@ -339,9 +339,9 @@
/* /*
* device selectors * device selectors
*/ */
#define SPIF_CARD(x) ((minor(x) >> 6) & 0x03) #define SPIF_CARD(x) ((TTUNIT(x) >> 6) & 0x03)
#define SPIF_PORT(x) (minor(x) & 0x07) #define SPIF_PORT(x) (TTUNIT(x) & 0x07)
#define STTY_DIALOUT(x) (minor(x) & 0x10) #define STTY_DIALOUT(x) TTDIALOUT(x)
#define STTY_RX_FIFO_THRESHOLD 4 #define STTY_RX_FIFO_THRESHOLD 4
#define STTY_RX_DTR_THRESHOLD 7 #define STTY_RX_DTR_THRESHOLD 7

View File

@ -1,4 +1,4 @@
/* $NetBSD: ucom.c,v 1.107 2014/08/10 16:44:36 tls Exp $ */ /* $NetBSD: ucom.c,v 1.108 2014/11/15 19:18:19 christos Exp $ */
/* /*
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.107 2014/08/10 16:44:36 tls Exp $"); __KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.108 2014/11/15 19:18:19 christos Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -76,13 +76,13 @@ int ucomdebug = 0;
#endif #endif
#define DPRINTF(x) DPRINTFN(0, x) #define DPRINTF(x) DPRINTFN(0, x)
#define UCOMUNIT_MASK 0x3ffff #define UCOMCALLUNIT_MASK TTCALLUNIT_MASK
#define UCOMDIALOUT_MASK 0x80000 #define UCOMUNIT_MASK TTUNIT_MASK
#define UCOMCALLUNIT_MASK 0x40000 #define UCOMDIALOUT_MASK TTDIALOUT_MASK
#define UCOMUNIT(x) (minor(x) & UCOMUNIT_MASK) #define UCOMCALLUNIT(x) TTCALLUNIT(x)
#define UCOMDIALOUT(x) (minor(x) & UCOMDIALOUT_MASK) #define UCOMUNIT(x) TTUNIT(x)
#define UCOMCALLUNIT(x) (minor(x) & UCOMCALLUNIT_MASK) #define UCOMDIALOUT(x) TTDIALOUT(x)
/* /*
* XXX: We can submit multiple input/output buffers to the usb stack * XXX: We can submit multiple input/output buffers to the usb stack

View File

@ -1,4 +1,4 @@
/* $NetBSD: ucycom.c,v 1.39 2014/07/25 08:10:39 dholland Exp $ */ /* $NetBSD: ucycom.c,v 1.40 2014/11/15 19:18:19 christos Exp $ */
/* /*
* Copyright (c) 2005 The NetBSD Foundation, Inc. * Copyright (c) 2005 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ucycom.c,v 1.39 2014/07/25 08:10:39 dholland Exp $"); __KERNEL_RCSID(0, "$NetBSD: ucycom.c,v 1.40 2014/11/15 19:18:19 christos Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -74,13 +74,13 @@ int ucycomdebug = 20;
#endif #endif
#define UCYCOMUNIT_MASK 0x3ffff #define UCYCCALLUNIT_MASK TTCALLUNIT_MASK
#define UCYCOMDIALOUT_MASK 0x80000 #define UCYCUNIT_MASK TTUNIT_MASK
#define UCYCOMCALLUNIT_MASK 0x40000 #define UCYCDIALOUT_MASK TTDIALOUT_MASK
#define UCYCOMUNIT(x) (minor(x) & UCYCOMUNIT_MASK) #define UCYCCALLUNIT(x) TTCALLUNIT(x)
#define UCYCOMDIALOUT(x) (minor(x) & UCYCOMDIALOUT_MASK) #define UCYCUNIT(x) TTUNIT(x)
#define UCYCOMCALLUNIT(x) (minor(x) & UCYCOMCALLUNIT_MASK) #define UCYCDIALOUT(x) TTDIALOUT(x)
/* Configuration Byte */ /* Configuration Byte */
#define UCYCOM_RESET 0x80 #define UCYCOM_RESET 0x80

View File

@ -1,4 +1,4 @@
/* $NetBSD: uhso.c,v 1.16 2014/07/25 08:10:39 dholland Exp $ */ /* $NetBSD: uhso.c,v 1.17 2014/11/15 19:18:19 christos Exp $ */
/*- /*-
* Copyright (c) 2009 Iain Hibbert * Copyright (c) 2009 Iain Hibbert
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uhso.c,v 1.16 2014/07/25 08:10:39 dholland Exp $"); __KERNEL_RCSID(0, "$NetBSD: uhso.c,v 1.17 2014/11/15 19:18:19 christos Exp $");
#ifdef _KERNEL_OPT #ifdef _KERNEL_OPT
#include "opt_inet.h" #include "opt_inet.h"
@ -400,14 +400,14 @@ Static void uhso_tty_start(struct tty *);
Static int uhso_tty_param(struct tty *, struct termios *); Static int uhso_tty_param(struct tty *, struct termios *);
Static int uhso_tty_control(struct uhso_port *, u_long, int); Static int uhso_tty_control(struct uhso_port *, u_long, int);
#define UHSO_UNIT_MASK 0x0fff0 #define UHSO_UNIT_MASK TTUNIT_MASK
#define UHSO_PORT_MASK 0x0000f #define UHSO_PORT_MASK 0x0000f
#define UHSO_DIALOUT_MASK 0x80000 #define UHSO_DIALOUT_MASK TTDIALOUT_MASK
#define UHSO_CALLUNIT_MASK 0x40000 #define UHSO_CALLUNIT_MASK TTCALLUNIT_MASK
#define UHSOUNIT(x) ((minor(x) & UHSO_UNIT_MASK) >> 4) #define UHSOUNIT(x) (TTUNIT(x) >> 4)
#define UHSOPORT(x) (minor(x) & UHSO_PORT_MASK) #define UHSOPORT(x) (TTUNIT(x) & UHSO_PORT_MASK)
#define UHSODIALOUT(x) (minor(x) & UHSO_DIALOUT_MASK) #define UHSODIALOUT(x) TTDIALOUT(x)
#define UHSOMINOR(u, p) ((((u) << 4) & UHSO_UNIT_MASK) | ((p) & UHSO_UNIT_MASK)) #define UHSOMINOR(u, p) ((((u) << 4) & UHSO_UNIT_MASK) | ((p) & UHSO_UNIT_MASK))
Static void uhso_ifnet_attach(struct uhso_softc *, usbd_interface_handle, int); Static void uhso_ifnet_attach(struct uhso_softc *, usbd_interface_handle, int);