Date: Sat, 16 Sep 2006 17:26:57 GMT From: Matt Jacob <mjacob@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 106213 for review Message-ID: <200609161726.k8GHQvAQ080352@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=106213 Change 106213 by mjacob@newisp on 2006/09/16 17:26:27 IFC Affected files ... .. //depot/projects/newisp/compat/linux/linux_misc.c#2 integrate .. //depot/projects/newisp/contrib/pf/net/pf.c#2 integrate .. //depot/projects/newisp/crypto/via/padlock_cipher.c#2 integrate .. //depot/projects/newisp/dev/ata/ata-chipset.c#5 integrate .. //depot/projects/newisp/dev/ata/ata-disk.c#2 integrate .. //depot/projects/newisp/dev/ata/ata-raid.h#2 integrate .. //depot/projects/newisp/dev/bge/if_bge.c#4 integrate .. //depot/projects/newisp/dev/bktr/bktr_i2c.c#2 integrate .. //depot/projects/newisp/dev/cs/if_cs.c#2 integrate .. //depot/projects/newisp/dev/cs/if_csvar.h#2 integrate .. //depot/projects/newisp/dev/dc/if_dc.c#2 integrate .. //depot/projects/newisp/dev/dc/if_dcreg.h#2 integrate .. //depot/projects/newisp/dev/de/if_de.c#2 integrate .. //depot/projects/newisp/dev/de/if_devar.h#2 integrate .. //depot/projects/newisp/dev/en/if_en_pci.c#2 integrate .. //depot/projects/newisp/dev/en/midway.c#2 integrate .. //depot/projects/newisp/dev/ichsmb/ichsmb.c#2 integrate .. //depot/projects/newisp/dev/iicbus/iicsmb.c#2 integrate .. //depot/projects/newisp/dev/lge/if_lge.c#2 integrate .. //depot/projects/newisp/dev/lge/if_lgereg.h#2 integrate .. //depot/projects/newisp/dev/mxge/eth_z8e.dat.gz.uu#2 integrate .. //depot/projects/newisp/dev/mxge/ethp_z8e.dat.gz.uu#2 integrate .. //depot/projects/newisp/dev/mxge/if_mxge.c#2 integrate .. //depot/projects/newisp/dev/mxge/if_mxge_var.h#2 integrate .. //depot/projects/newisp/dev/mxge/mxge_mcp.h#2 integrate .. //depot/projects/newisp/dev/my/if_my.c#2 integrate .. //depot/projects/newisp/dev/my/if_myreg.h#2 integrate .. //depot/projects/newisp/dev/nge/if_nge.c#2 integrate .. //depot/projects/newisp/dev/nge/if_ngereg.h#2 integrate .. //depot/projects/newisp/dev/re/if_re.c#3 integrate .. //depot/projects/newisp/dev/sio/sio_pccard.c#2 integrate .. //depot/projects/newisp/dev/smbus/smb.c#2 integrate .. //depot/projects/newisp/dev/smbus/smb.h#2 integrate .. //depot/projects/newisp/dev/smbus/smbconf.c#2 integrate .. //depot/projects/newisp/dev/smbus/smbconf.h#2 integrate .. //depot/projects/newisp/dev/smbus/smbus.c#2 integrate .. //depot/projects/newisp/dev/smbus/smbus.h#2 integrate .. //depot/projects/newisp/dev/smbus/smbus_if.m#2 integrate .. //depot/projects/newisp/dev/syscons/scmouse.c#2 integrate .. //depot/projects/newisp/dev/syscons/syscons.c#2 integrate .. //depot/projects/newisp/dev/syscons/syscons.h#2 integrate .. //depot/projects/newisp/dev/ti/if_ti.c#2 integrate .. //depot/projects/newisp/fs/udf/osta.h#2 integrate .. //depot/projects/newisp/geom/eli/g_eli.h#2 integrate .. //depot/projects/newisp/geom/eli/g_eli_ctl.c#2 integrate .. //depot/projects/newisp/geom/geom.h#2 integrate .. //depot/projects/newisp/geom/geom_subr.c#2 integrate .. //depot/projects/newisp/geom/label/g_label_ufs.c#2 integrate .. //depot/projects/newisp/geom/mirror/g_mirror.c#3 integrate .. //depot/projects/newisp/geom/raid3/g_raid3.c#3 integrate .. //depot/projects/newisp/geom/raid3/g_raid3_ctl.c#2 integrate .. //depot/projects/newisp/i386/conf/NOTES#2 integrate .. //depot/projects/newisp/i386/i386/busdma_machdep.c#3 integrate .. //depot/projects/newisp/ia64/ia32/ia32_trap.c#2 integrate .. //depot/projects/newisp/ia64/ia64/trap.c#2 integrate .. //depot/projects/newisp/kern/bus_if.m#4 integrate .. //depot/projects/newisp/kern/kern_exit.c#2 integrate .. //depot/projects/newisp/kern/subr_witness.c#2 integrate .. //depot/projects/newisp/kern/uipc_socket.c#3 integrate .. //depot/projects/newisp/kern/vfs_lookup.c#2 integrate .. //depot/projects/newisp/modules/ipfw/Makefile#2 integrate .. //depot/projects/newisp/modules/pf/Makefile#2 integrate .. //depot/projects/newisp/netgraph/ng_eiface.c#2 integrate .. //depot/projects/newisp/netgraph/ng_fec.c#2 integrate .. //depot/projects/newisp/netinet/ip_fw2.c#3 integrate .. //depot/projects/newisp/netinet/tcp_input.c#4 integrate .. //depot/projects/newisp/netinet/tcp_output.c#3 integrate .. //depot/projects/newisp/netinet/tcp_syncache.c#2 integrate .. //depot/projects/newisp/netinet/tcp_var.h#4 integrate .. //depot/projects/newisp/netinet6/nd6.c#2 integrate .. //depot/projects/newisp/nfs4client/nfs4_vfsops.c#2 integrate .. //depot/projects/newisp/nfs4client/nfs4_vnops.c#2 integrate .. //depot/projects/newisp/nfsclient/nfs_node.c#2 integrate .. //depot/projects/newisp/nfsclient/nfs_subs.c#2 integrate .. //depot/projects/newisp/nfsclient/nfs_vfsops.c#2 integrate .. //depot/projects/newisp/nfsclient/nfs_vnops.c#2 integrate .. //depot/projects/newisp/nfsclient/nfsnode.h#2 integrate .. //depot/projects/newisp/pci/alpm.c#2 integrate .. //depot/projects/newisp/pci/amdpm.c#2 integrate .. //depot/projects/newisp/pci/amdsmb.c#2 integrate .. //depot/projects/newisp/pci/if_rl.c#2 integrate .. //depot/projects/newisp/pci/if_sf.c#2 integrate .. //depot/projects/newisp/pci/if_sfreg.h#2 integrate .. //depot/projects/newisp/pci/if_sis.c#2 integrate .. //depot/projects/newisp/pci/if_sisreg.h#2 integrate .. //depot/projects/newisp/pci/if_ste.c#2 integrate .. //depot/projects/newisp/pci/if_tl.c#2 integrate .. //depot/projects/newisp/pci/if_tlreg.h#2 integrate .. //depot/projects/newisp/pci/if_vr.c#2 integrate .. //depot/projects/newisp/pci/if_vrreg.h#2 integrate .. //depot/projects/newisp/pci/if_wb.c#2 integrate .. //depot/projects/newisp/pci/if_wbreg.h#2 integrate .. //depot/projects/newisp/pci/if_xl.c#2 integrate .. //depot/projects/newisp/pci/if_xlreg.h#2 integrate .. //depot/projects/newisp/pci/intpm.c#2 integrate .. //depot/projects/newisp/pci/intpmreg.h#2 integrate .. //depot/projects/newisp/pci/nfsmb.c#2 integrate .. //depot/projects/newisp/pci/viapm.c#2 integrate .. //depot/projects/newisp/powerpc/powerpc/trap.c#2 integrate .. //depot/projects/newisp/security/mac/mac_inet.c#2 integrate .. //depot/projects/newisp/security/mac_biba/mac_biba.c#2 integrate .. //depot/projects/newisp/security/mac_lomac/mac_lomac.c#2 integrate .. //depot/projects/newisp/security/mac_mls/mac_mls.c#3 integrate .. //depot/projects/newisp/sys/mac.h#2 integrate .. //depot/projects/newisp/sys/mac_policy.h#3 integrate .. //depot/projects/newisp/sys/mount.h#2 integrate Differences ... ==== //depot/projects/newisp/compat/linux/linux_misc.c#2 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.186 2006/08/25 11:02:42 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.187 2006/09/16 14:12:04 netchild Exp $"); #include "opt_compat.h" #include "opt_mac.h" @@ -1299,6 +1299,13 @@ #define REBOOT_CAD_ON 0x89abcdef #define REBOOT_CAD_OFF 0 #define REBOOT_HALT 0xcdef0123 +#define REBOOT_RESTART 0x01234567 +#define REBOOT_RESTART2 0xA1B2C3D4 +#define REBOOT_POWEROFF 0x4321FEDC +#define REBOOT_MAGIC1 0xfee1dead +#define REBOOT_MAGIC2 0x28121969 +#define REBOOT_MAGIC2A 0x05121996 +#define REBOOT_MAGIC2B 0x16041998 int linux_reboot(struct thread *td, struct linux_reboot_args *args) @@ -1309,10 +1316,37 @@ if (ldebug(reboot)) printf(ARGS(reboot, "0x%x"), args->cmd); #endif - if (args->cmd == REBOOT_CAD_ON || args->cmd == REBOOT_CAD_OFF) - return (0); - bsd_args.opt = (args->cmd == REBOOT_HALT) ? RB_HALT : 0; - return (reboot(td, &bsd_args)); + + if (args->magic1 != REBOOT_MAGIC1) + return EINVAL; + + switch (args->magic2) { + case REBOOT_MAGIC2: + case REBOOT_MAGIC2A: + case REBOOT_MAGIC2B: + break; + default: + return EINVAL; + } + + switch (args->cmd) { + case REBOOT_CAD_ON: + case REBOOT_CAD_OFF: + return suser(td); + case REBOOT_HALT: + bsd_args.opt = RB_HALT; + break; + case REBOOT_RESTART: + case REBOOT_RESTART2: + bsd_args.opt = 0; + break; + case REBOOT_POWEROFF: + bsd_args.opt = RB_POWEROFF; + break; + default: + return EINVAL; + } + return reboot(td, &bsd_args); } ==== //depot/projects/newisp/contrib/pf/net/pf.c#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/contrib/pf/net/pf.c,v 1.40 2005/12/25 23:52:00 mlaier Exp $ */ +/* $FreeBSD: src/sys/contrib/pf/net/pf.c,v 1.41 2006/09/12 04:25:11 csjp Exp $ */ /* $OpenBSD: pf.c,v 1.483 2005/03/15 17:38:43 dhartmei Exp $ */ /* @@ -42,6 +42,7 @@ #endif #ifdef __FreeBSD__ +#include "opt_mac.h" #include "opt_bpf.h" #include "opt_pf.h" @@ -78,6 +79,7 @@ #include <sys/kernel.h> #include <sys/time.h> #ifdef __FreeBSD__ +#include <sys/mac.h> #include <sys/sysctl.h> #include <sys/endian.h> #else @@ -192,7 +194,12 @@ struct pf_addr *, struct pf_addr *, u_int16_t, u_int16_t *, u_int16_t *, u_int16_t *, u_int16_t *, u_int8_t, sa_family_t); +#ifdef __FreeBSD__ +void pf_send_tcp(struct mbuf *, + const struct pf_rule *, sa_family_t, +#else void pf_send_tcp(const struct pf_rule *, sa_family_t, +#endif const struct pf_addr *, const struct pf_addr *, u_int16_t, u_int16_t, u_int32_t, u_int32_t, u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, @@ -1114,7 +1121,11 @@ cur->local_flags |= PFSTATE_EXPIRING; #endif if (cur->src.state == PF_TCPS_PROXY_DST) +#ifdef __FreeBSD__ + pf_send_tcp(NULL, cur->rule.ptr, cur->af, +#else pf_send_tcp(cur->rule.ptr, cur->af, +#endif &cur->ext.addr, &cur->lan.addr, cur->ext.port, cur->lan.port, cur->src.seqhi, cur->src.seqlo + 1, @@ -1574,7 +1585,11 @@ } void +#ifdef __FreeBSD__ +pf_send_tcp(struct mbuf *replyto, const struct pf_rule *r, sa_family_t af, +#else pf_send_tcp(const struct pf_rule *r, sa_family_t af, +#endif const struct pf_addr *saddr, const struct pf_addr *daddr, u_int16_t sport, u_int16_t dport, u_int32_t seq, u_int32_t ack, u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag, @@ -1613,6 +1628,16 @@ m = m_gethdr(M_DONTWAIT, MT_HEADER); if (m == NULL) return; +#ifdef __FreeBSD__ +#ifdef MAC + if (replyto) + mac_create_mbuf_netlayer(replyto, m); + else + mac_create_mbuf_from_firewall(m); +#else + (void)replyto; +#endif +#endif if (tag) { #ifdef __FreeBSD__ m->m_flags |= M_SKIP_FIREWALL; @@ -3146,7 +3171,11 @@ ack++; if (th->th_flags & TH_FIN) ack++; +#ifdef __FreeBSD__ + pf_send_tcp(m, r, af, pd->dst, +#else pf_send_tcp(r, af, pd->dst, +#endif pd->src, th->th_dport, th->th_sport, ntohl(th->th_ack), ack, TH_RST|TH_ACK, 0, 0, r->return_ttl, 1, pd->eh, kif->pfik_ifp); @@ -3347,7 +3376,11 @@ mss = pf_calc_mss(saddr, af, mss); mss = pf_calc_mss(daddr, af, mss); s->src.mss = mss; +#ifdef __FreeBSD__ + pf_send_tcp(NULL, r, af, daddr, saddr, th->th_dport, +#else pf_send_tcp(r, af, daddr, saddr, th->th_dport, +#endif th->th_sport, s->src.seqhi, ntohl(th->th_seq) + 1, TH_SYN|TH_ACK, 0, s->src.mss, 0, 1, NULL, NULL); REASON_SET(&reason, PFRES_SYNPROXY); @@ -4348,7 +4381,11 @@ REASON_SET(reason, PFRES_SYNPROXY); return (PF_DROP); } +#ifdef __FreeBSD__ + pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, pd->dst, +#else pf_send_tcp((*state)->rule.ptr, pd->af, pd->dst, +#endif pd->src, th->th_dport, th->th_sport, (*state)->src.seqhi, ntohl(th->th_seq) + 1, TH_SYN|TH_ACK, 0, (*state)->src.mss, 0, 1, @@ -4387,7 +4424,12 @@ (*state)->src.max_win = MAX(ntohs(th->th_win), 1); if ((*state)->dst.seqhi == 1) (*state)->dst.seqhi = htonl(arc4random()); +#ifdef __FreeBSD__ + pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, + &src->addr, +#else pf_send_tcp((*state)->rule.ptr, pd->af, &src->addr, +#endif &dst->addr, src->port, dst->port, (*state)->dst.seqhi, 0, TH_SYN, 0, (*state)->src.mss, 0, 0, NULL, NULL); @@ -4401,12 +4443,21 @@ } else { (*state)->dst.max_win = MAX(ntohs(th->th_win), 1); (*state)->dst.seqlo = ntohl(th->th_seq); +#ifdef __FreeBSD__ + pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, pd->dst, +#else pf_send_tcp((*state)->rule.ptr, pd->af, pd->dst, +#endif pd->src, th->th_dport, th->th_sport, ntohl(th->th_ack), ntohl(th->th_seq) + 1, TH_ACK, (*state)->src.max_win, 0, 0, 0, NULL, NULL); +#ifdef __FreeBSD__ + pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, + &src->addr, +#else pf_send_tcp((*state)->rule.ptr, pd->af, &src->addr, +#endif &dst->addr, src->port, dst->port, (*state)->src.seqhi + 1, (*state)->src.seqlo + 1, TH_ACK, (*state)->dst.max_win, 0, 0, 1, @@ -4685,7 +4736,11 @@ (*state)->src.state == TCPS_SYN_SENT) { /* Send RST for state mismatches during handshake */ if (!(th->th_flags & TH_RST)) +#ifdef __FreeBSD__ + pf_send_tcp(m, (*state)->rule.ptr, pd->af, +#else pf_send_tcp((*state)->rule.ptr, pd->af, +#endif pd->dst, pd->src, th->th_dport, th->th_sport, ntohl(th->th_ack), 0, TH_RST, 0, 0, ==== //depot/projects/newisp/crypto/via/padlock_cipher.c#2 (text+ko) ==== @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/crypto/via/padlock_cipher.c,v 1.4 2006/07/25 20:00:55 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/crypto/via/padlock_cipher.c,v 1.5 2006/09/15 10:44:55 pjd Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -225,7 +225,7 @@ cw->cw_direction = PADLOCK_DIRECTION_ENCRYPT; key = ses->ses_ekey; if ((enccrd->crd_flags & CRD_F_IV_EXPLICIT) != 0) - bcopy(enccrd->crd_iv, ses->ses_iv, 16); + bcopy(enccrd->crd_iv, ses->ses_iv, AES_BLOCK_LEN); if ((enccrd->crd_flags & CRD_F_IV_PRESENT) == 0) { crypto_copyback(crp->crp_flags, crp->crp_buf, @@ -247,7 +247,8 @@ enccrd->crd_len, abuf); } - padlock_cbc(abuf, abuf, enccrd->crd_len / 16, key, cw, ses->ses_iv); + padlock_cbc(abuf, abuf, enccrd->crd_len / AES_BLOCK_LEN, key, cw, + ses->ses_iv); if (allocated) { crypto_copyback(crp->crp_flags, crp->crp_buf, enccrd->crd_skip, ==== //depot/projects/newisp/dev/ata/ata-chipset.c#5 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.174 2006/09/11 19:48:30 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.175 2006/09/12 22:06:39 sos Exp $"); #include "opt_ata.h" #include <sys/param.h> @@ -4869,7 +4869,7 @@ ata_default_registers(dev); for (i = ATA_BMCMD_PORT; i <= ATA_BMDTP_PORT; i++) { ch->r_io[i].res = ctlr->r_res1; - ch->r_io[i].offset = i - ATA_BMCMD_PORT; + ch->r_io[i].offset = (i - ATA_BMCMD_PORT)+(ch->unit * ATA_BMIOSIZE); } ata_pci_hw(dev); } ==== //depot/projects/newisp/dev/ata/ata-disk.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.198 2006/08/09 18:23:47 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.199 2006/09/14 19:12:29 sos Exp $"); #include "opt_ata.h" #include <sys/param.h> @@ -105,7 +105,8 @@ } device_set_ivars(dev, adp); - if (atadev->param.atavalid & ATA_FLAG_54_58) { + if ((atadev->param.atavalid & ATA_FLAG_54_58) && + atadev->param.current_heads && atadev->param.current_sectors) { adp->heads = atadev->param.current_heads; adp->sectors = atadev->param.current_sectors; adp->total_secs = (u_int32_t)atadev->param.current_size_1 | ==== //depot/projects/newisp/dev/ata/ata-raid.h#2 (text+ko) ==== @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ata/ata-raid.h,v 1.44 2006/02/17 13:02:10 sos Exp $ + * $FreeBSD: src/sys/dev/ata/ata-raid.h,v 1.45 2006/09/12 20:37:22 sos Exp $ */ /* misc defines */ @@ -76,7 +76,7 @@ #define AR_F_SII_RAID 0x0800 #define AR_F_SIS_RAID 0x1000 #define AR_F_VIA_RAID 0x2000 -#define AR_F_FORMAT_MASK 0x1fff +#define AR_F_FORMAT_MASK 0x3fff u_int generation; u_int64_t total_sectors; ==== //depot/projects/newisp/dev/bge/if_bge.c#4 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.144 2006/09/09 03:36:57 ambrisko Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.145 2006/09/15 15:16:10 glebius Exp $"); /* * Broadcom BCM570x family gigabit ethernet driver for FreeBSD. @@ -591,7 +591,7 @@ } if (i == BGE_TIMEOUT) { - if_printf(sc->bge_ifp, "PHY read timed out\n"); + device_printf(sc->bge_dev, "PHY read timed out\n"); val = 0; goto done; } @@ -640,7 +640,7 @@ } if (i == BGE_TIMEOUT) { - if_printf(sc->bge_ifp, "PHY read timed out\n"); + device_printf(sc->bge_dev, "PHY read timed out\n"); return (0); } ==== //depot/projects/newisp/dev/bktr/bktr_i2c.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_i2c.c,v 1.27 2005/05/29 04:42:19 nyan Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_i2c.c,v 1.28 2006/09/11 20:52:40 jhb Exp $"); /* * I2C support for the bti2c chipset. @@ -119,7 +119,7 @@ return (error); } -int bti2c_smb_callback(device_t dev, int index, caddr_t *data) +int bti2c_smb_callback(device_t dev, int index, void *data) { struct bktr_softc *bktr_sc = (struct bktr_softc *)device_get_softc(dev); struct bktr_i2c_softc *sc = &bktr_sc->i2c_sc; @@ -338,4 +338,6 @@ return (0); } +DRIVER_MODULE(smbus, bktr, smbus_driver, smbus_devclass, 0, 0); + #endif /* defined(BKTR_USE_FREEBSD_SMBUS) */ ==== //depot/projects/newisp/dev/cs/if_cs.c#2 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/cs/if_cs.c,v 1.44 2006/03/10 23:50:53 philip Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/cs/if_cs.c,v 1.45 2006/09/15 15:16:10 glebius Exp $"); /* * @@ -198,7 +198,7 @@ RE_NEG_NOW | ALLOW_FDX | AUTO_NEG_ENABLE); for (i=0; cs_readreg(sc, PP_AutoNegST) & AUTO_NEG_BUSY; i++) { if (i > 40000) { - if_printf(sc->ifp, + device_printf(sc->dev, "full/half duplex auto negotiation timeout\n"); error = ETIMEDOUT; break; @@ -218,7 +218,7 @@ DELAY( 150000 ); if ((cs_readreg(sc, PP_LineST) & LINK_OK)==0) { - if_printf(sc->ifp, "failed to enable TP\n"); + device_printf(sc->dev, "failed to enable TP\n"); return (EINVAL); } @@ -279,7 +279,7 @@ (sc->line_ctl & ~AUTO_AUI_10BASET) | AUI_ONLY); if (!send_test_pkt(sc)) { - if_printf(sc->ifp, "failed to enable AUI\n"); + device_printf(sc->dev, "failed to enable AUI\n"); return (EINVAL); } return (0); @@ -297,7 +297,7 @@ (sc->line_ctl & ~AUTO_AUI_10BASET) | AUI_ONLY); if (!send_test_pkt(sc)) { - if_printf(sc->ifp, "failed to enable BNC\n"); + device_printf(sc->dev, "failed to enable BNC\n"); return (EINVAL); } return (0); @@ -586,6 +586,8 @@ struct cs_softc *sc = device_get_softc(dev);; struct ifnet *ifp; + sc->dev = dev; + ifp = sc->ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { device_printf(dev, "can not if_alloc()\n"); @@ -630,7 +632,7 @@ sc->buffer=malloc(ETHER_MAX_LEN-ETHER_CRC_LEN,M_DEVBUF,M_NOWAIT); if (sc->buffer == NULL) { - if_printf(ifp, "Couldn't allocate memory for NIC\n"); + device_printf(sc->dev, "Couldn't allocate memory for NIC\n"); return(0); } @@ -665,7 +667,7 @@ case A_CNF_MEDIA_10B_2: media = IFM_ETHER|IFM_10_2; break; case A_CNF_MEDIA_AUI: media = IFM_ETHER|IFM_10_5; break; default: - if_printf(ifp, "no media, assuming 10baseT\n"); + device_printf(sc->dev, "no media, assuming 10baseT\n"); sc->adapter_cnf |= A_CNF_10B_T; ifmedia_add(&sc->media, IFM_ETHER|IFM_10_T, 0, NULL); if (sc->chip_type != CS8900) { @@ -799,13 +801,13 @@ length = cs_inw(sc, RX_FRAME_PORT); #ifdef CS_DEBUG - if_printf(ifp, "rcvd: stat %x, len %d\n", + device_printf(sc->dev, "rcvd: stat %x, len %d\n", status, length); #endif if (!(status & RX_OK)) { #ifdef CS_DEBUG - if_printf(ifp, "bad pkt stat %x\n", status); + device_printf(sc->dev, "bad pkt stat %x\n", status); #endif ifp->if_ierrors++; return (-1); @@ -864,13 +866,13 @@ int status; #ifdef CS_DEBUG - if_printf(ifp, "Interrupt.\n"); + device_printf(sc->dev, "Interrupt.\n"); #endif while ((status=cs_inw(sc, ISQ_PORT))) { #ifdef CS_DEBUG - if_printf(ifp, "from ISQ: %04x\n", status); + device_printf(sc->dev, "from ISQ: %04x\n", status); #endif switch (status & ISQ_EVENT_MASK) { @@ -1138,7 +1140,7 @@ int s,error=0; #ifdef CS_DEBUG - if_printf(ifp, "ioctl(%lx)\n", command); + if_printf(ifp, "%s command=%lx\n", __func__, command); #endif s=splimp(); @@ -1266,7 +1268,7 @@ ~(SERIAL_RX_ON | SERIAL_TX_ON)); #ifdef CS_DEBUG - if_printf(sc->ifp, "cs_setmedia(%x)\n", media); + device_printf(sc->dev, "%s media=%x\n", __func__, media); #endif switch (IFM_SUBTYPE(media)) { ==== //depot/projects/newisp/dev/cs/if_csvar.h#2 (text+ko) ==== @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/cs/if_csvar.h,v 1.8 2006/02/11 03:50:03 imp Exp $ + * $FreeBSD: src/sys/dev/cs/if_csvar.h,v 1.9 2006/09/15 15:16:10 glebius Exp $ */ #ifndef _IF_CSVAR_H @@ -37,6 +37,7 @@ struct cs_softc { /* Ethernet common code */ struct ifnet *ifp; + device_t dev; /* Configuration words from EEPROM */ int auto_neg_cnf; /* AutoNegotitation configuration */ ==== //depot/projects/newisp/dev/dc/if_dc.c#2 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/dc/if_dc.c,v 1.184 2006/06/08 08:15:21 glebius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/dc/if_dc.c,v 1.185 2006/09/15 15:16:10 glebius Exp $"); /* * DEC "tulip" clone ethernet driver. Supports the DEC/Intel 21143 @@ -1395,7 +1395,7 @@ } if (i == DC_TIMEOUT) - if_printf(sc->dc_ifp, + device_printf(sc->dc_dev, "failed to force tx and rx to idle state\n"); } @@ -1536,7 +1536,7 @@ } if (i == DC_TIMEOUT) - if_printf(sc->dc_ifp, "reset never completed!\n"); + device_printf(sc->dc_dev, "reset never completed!\n"); /* Wait a little while for the chip to get its brains in order. */ DELAY(1000); @@ -1815,6 +1815,7 @@ u_int8_t *mac; sc = device_get_softc(dev); + sc->dc_dev = dev; mtx_init(&sc->dc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); @@ -2968,13 +2969,13 @@ DELAY(10); } if (i == DC_TIMEOUT) { - if_printf(sc->dc_ifp, + device_printf(sc->dc_dev, "failed to force tx to idle state\n"); dc_init_locked(sc); } } - if_printf(sc->dc_ifp, "TX underrun -- "); + device_printf(sc->dc_dev, "TX underrun -- "); sc->dc_txthresh += DC_TXTHRESH_INC; if (sc->dc_txthresh > DC_TXTHRESH_MAX) { printf("using store and forward mode\n"); @@ -3040,7 +3041,7 @@ dc_tx_underrun(sc); if (status & DC_ISR_BUS_ERR) { - if_printf(ifp, "dc_poll: bus error\n"); + if_printf(ifp, "%s: bus error\n", __func__); dc_reset(sc); dc_init_locked(sc); } @@ -3446,7 +3447,7 @@ /* Init circular RX list. */ if (dc_list_rx_init(sc) == ENOBUFS) { - if_printf(ifp, + device_printf(sc->dc_dev, "initialization failed: no memory for rx buffers\n"); dc_stop(sc); return; ==== //depot/projects/newisp/dev/dc/if_dcreg.h#2 (text+ko) ==== @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/dc/if_dcreg.h,v 1.51 2006/06/08 08:15:21 glebius Exp $ + * $FreeBSD: src/sys/dev/dc/if_dcreg.h,v 1.52 2006/09/15 15:16:10 glebius Exp $ */ /* @@ -717,6 +717,7 @@ struct dc_softc { struct ifnet *dc_ifp; /* interface info */ + device_t dc_dev; /* device info */ bus_space_handle_t dc_bhandle; /* bus space handle */ bus_space_tag_t dc_btag; /* bus space tag */ bus_dma_tag_t dc_ltag; /* tag for descriptor ring */ ==== //depot/projects/newisp/dev/de/if_de.c#2 (text) ==== @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/de/if_de.c,v 1.180 2006/05/12 05:04:41 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/de/if_de.c,v 1.181 2006/09/15 15:16:11 glebius Exp $"); #define TULIP_HDR_DATA @@ -436,17 +436,16 @@ static void tulip_media_print(tulip_softc_t * const sc) { - struct ifnet *ifp = sc->tulip_ifp; TULIP_LOCK_ASSERT(sc); if ((sc->tulip_flags & TULIP_LINKUP) == 0) return; if (sc->tulip_flags & TULIP_PRINTMEDIA) { - if_printf(ifp, "enabling %s port\n", - tulip_mediums[sc->tulip_media]); + device_printf(sc->tulip_dev, "enabling %s port\n", + tulip_mediums[sc->tulip_media]); sc->tulip_flags &= ~(TULIP_PRINTMEDIA|TULIP_PRINTLINKUP); } else if (sc->tulip_flags & TULIP_PRINTLINKUP) { - if_printf(ifp, "link up\n"); + device_printf(sc->tulip_dev, "link up\n"); sc->tulip_flags &= ~TULIP_PRINTLINKUP; } } @@ -495,10 +494,9 @@ continue; #if defined(TULIP_DEBUG) - if_printf(ifp, "gpr_media_sense: %s: 0x%02x & 0x%02x == 0x%02x\n", - tulip_mediums[media], - TULIP_CSR_READ(sc, csr_gp) & 0xFF, - mi->mi_actmask, mi->mi_actdata); + device_printf(sc->tulip_dev, "%s: %s: 0x%02x & 0x%02x == 0x%02x\n", + __func__, tulip_mediums[media], TULIP_CSR_READ(sc, csr_gp) & 0xFF, + mi->mi_actmask, mi->mi_actdata); #endif /* * It does! If this is the first media we detected, then @@ -519,7 +517,6 @@ static tulip_link_status_t tulip_media_link_monitor(tulip_softc_t * const sc) { - struct ifnet *ifp = sc->tulip_ifp; const tulip_media_info_t * const mi = sc->tulip_mediums[sc->tulip_media]; tulip_link_status_t linkup = TULIP_LINK_DOWN; @@ -603,7 +600,7 @@ linkup = TULIP_LINK_UP; #if defined(TULIP_DEBUG) if (sc->tulip_probe_timeout <= 0) - if_printf(ifp, "sia status = 0x%08x\n", + device_printf(sc->tulip_dev, "sia status = 0x%08x\n", TULIP_CSR_READ(sc, csr_sia_status)); #endif } else if (mi->mi_type == TULIP_MEDIAINFO_SYM) { @@ -619,7 +616,7 @@ return TULIP_LINK_UP; sc->tulip_flags &= ~TULIP_LINKUP; - if_printf(ifp, "link down: cable problem?\n"); + device_printf(sc->tulip_dev, "link down: cable problem?\n"); } #if defined(TULIP_DEBUG) sc->tulip_dbg.dbg_link_downed++; @@ -630,7 +627,6 @@ static void tulip_media_poll(tulip_softc_t * const sc, tulip_mediapoll_event_t event) { - struct ifnet *ifp = sc->tulip_ifp; TULIP_LOCK_ASSERT(sc); #if defined(TULIP_DEBUG) @@ -751,7 +747,7 @@ if (sc->tulip_probe_timeout > 0) { tulip_media_t new_probe_media = tulip_21140_gpr_media_sense(sc); #if defined(TULIP_DEBUG) - if_printf(ifp, "media_poll: gpr sensing = %s\n", + device_printf(sc->tulip_dev, "%s: gpr sensing = %s\n", __func__, tulip_mediums[new_probe_media]); #endif if (new_probe_media != TULIP_MEDIA_UNKNOWN) { @@ -838,7 +834,7 @@ if (/* event == TULIP_MEDIAPOLL_TXPROBE_FAILED || */ sc->tulip_probe_timeout <= 0) { #if defined(TULIP_DEBUG) if (sc->tulip_probe_media == TULIP_MEDIA_UNKNOWN) { - if_printf(ifp, "poll media unknown!\n"); + device_printf(sc->tulip_dev, "poll media unknown!\n"); sc->tulip_probe_media = TULIP_MEDIA_MAX; } #endif @@ -850,7 +846,8 @@ sc->tulip_probe_media -= 1; if (sc->tulip_probe_media == TULIP_MEDIA_UNKNOWN) { if (++sc->tulip_probe_passes == 3) { - if_printf(ifp, "autosense failed: cable problem?\n"); + device_printf(sc->tulip_dev, + "autosense failed: cable problem?\n"); if ((sc->tulip_ifp->if_flags & IFF_UP) == 0) { sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sc->tulip_probe_state = TULIP_PROBE_INACTIVE; @@ -866,7 +863,7 @@ || TULIP_IS_MEDIA_FD(sc->tulip_probe_media)); #if defined(TULIP_DEBUG) - if_printf(ifp, "%s: probing %s\n", + device_printf(sc->tulip_dev, "%s: probing %s\n", event == TULIP_MEDIAPOLL_TXPROBE_FAILED ? "txprobe failed" : "timeout", tulip_mediums[sc->tulip_probe_media]); #endif @@ -1194,7 +1191,7 @@ sc->tulip_flags &= ~TULIP_WANTRXACT; sc->tulip_probe_timeout = TULIP_21041_PROBE_AUIBNC_TIMEOUT; } else { - if_printf(sc->tulip_ifp, + device_printf(sc->tulip_dev, "autosense failed: cable problem?\n"); if ((sc->tulip_ifp->if_flags & IFF_UP) == 0) { sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; @@ -1512,7 +1509,7 @@ } #if defined(TULIP_DEBUG) } else { - if_printf(sc->tulip_ifp, "preset: bad media %d!\n", media); + device_printf(sc->tulip_dev, "preset: bad media %d!\n", media); } #endif } @@ -1565,7 +1562,7 @@ sc->tulip_dbg.dbg_events[event]++; #endif #if defined(DIAGNOSTIC) - if_printf(sc->tulip_ifp, "botch(media_poll) at line %d\n", __LINE__); + device_printf(sc->tulip_dev, "botch(media_poll) at line %d\n", __LINE__); #endif } @@ -2300,7 +2297,7 @@ mi->mi_phyaddr = tulip_mii_get_phyaddr(sc, 0); } if (mi->mi_phyaddr == TULIP_MII_NOPHY) { - if_printf(sc->tulip_ifp, "can't find phy 0\n"); + device_printf(sc->tulip_dev, "can't find phy 0\n"); return; } @@ -2553,7 +2550,7 @@ } if (mi->mi_phyaddr == TULIP_MII_NOPHY) { #if defined(TULIP_DEBUG) - if_printf(sc->tulip_ifp, "can't find phy %d\n", + device_printf(sc->tulip_dev, "can't find phy %d\n", phyno); #endif break; @@ -2654,7 +2651,7 @@ } if (mi->mi_phyaddr == TULIP_MII_NOPHY) { #if defined(TULIP_DEBUG) - if_printf(sc->tulip_ifp, "can't find phy %d\n", + device_printf(sc->tulip_dev, "can't find phy %d\n", phyno); #endif break; @@ -3239,7 +3236,7 @@ (*sc->tulip_boardsw->bd_media_select)(sc); #if defined(TULIP_DEBUG) if ((sc->tulip_flags & TULIP_NEEDRESET) == TULIP_NEEDRESET) - if_printf(sc->tulip_ifp, + device_printf(sc->tulip_dev, "tulip_reset: additional reset needed?!?\n"); #endif if (bootverbose) @@ -3466,7 +3463,7 @@ } #if defined(TULIP_VERBOSE) if (error != NULL && (sc->tulip_flags & TULIP_NOMESSAGES) == 0) { - if_printf(sc->tulip_ifp, "receive: %6D: %s\n", + device_printf(sc->tulip_dev, "receive: %6D: %s\n", mtod(ms, u_char *) + 6, ":", error); sc->tulip_flags |= TULIP_NOMESSAGES; @@ -3560,7 +3557,7 @@ error = bus_dmamap_load_mbuf(ri->ri_data_tag, *nextout->di_map, ms, tulip_dma_map_rxbuf, nextout->di_desc, BUS_DMA_NOWAIT); if (error) { - if_printf(sc->tulip_ifp, + device_printf(sc->tulip_dev, "unable to load rx map, error = %d\n", error); panic("tulip_rx_intr"); /* XXX */ } @@ -3649,7 +3646,7 @@ m_freem(m); #if defined(TULIP_DEBUG) } else { - if_printf(sc->tulip_ifp, + device_printf(sc->tulip_dev, "tx_intr: failed to dequeue mbuf?!?\n"); #endif } @@ -3744,7 +3741,7 @@ TULIP_LOCK_ASSERT(sc); csr &= (1 << (sizeof(tulip_status_bits)/sizeof(tulip_status_bits[0]))) - 1; - if_printf(sc->tulip_ifp, "abnormal interrupt:"); + device_printf(sc->tulip_dev, "abnormal interrupt:"); for (sep = " ", mask = 1; mask <= csr; mask <<= 1, msgp++) { if ((csr & mask) && *msgp != NULL) { printf("%s%s", sep, *msgp); @@ -3779,7 +3776,7 @@ if (sc->tulip_flags & TULIP_NOMESSAGES) { sc->tulip_flags |= TULIP_SYSTEMERROR; } else { - if_printf(sc->tulip_ifp, "system error: %s\n", + device_printf(sc->tulip_dev, "system error: %s\n", tulip_system_errors[sc->tulip_last_system_error]); } sc->tulip_flags |= TULIP_NEEDRESET; @@ -3904,7 +3901,7 @@ TULIP_LOCK_ASSERT(sc); #if defined(TULIP_DEBUG) if ((sc->tulip_cmdmode & TULIP_CMD_TXRUN) == 0) { - if_printf(sc->tulip_ifp, "txput%s: tx not running\n", + device_printf(sc->tulip_dev, "txput%s: tx not running\n", (sc->tulip_flags & TULIP_TXPROBE_ACTIVE) ? "(probe)" : ""); sc->tulip_flags |= TULIP_WANTTXSTART; sc->tulip_dbg.dbg_txput_finishes[0]++; @@ -3983,7 +3980,7 @@ segs, &nsegs, BUS_DMA_NOWAIT); } if (error != 0) { - if_printf(sc->tulip_ifp, + device_printf(sc->tulip_dev, "unable to load tx map, error = %d\n", error); #if defined(TULIP_DEBUG) sc->tulip_dbg.dbg_txput_finishes[3]++; @@ -4162,7 +4159,7 @@ #if defined(TULIP_DEBUG) if ((sc->tulip_cmdmode & TULIP_CMD_TXRUN) == 0) { - if_printf(sc->tulip_ifp, "txput_setup: tx not running\n"); + device_printf(sc->tulip_dev, "txput_setup: tx not running\n"); sc->tulip_flags |= TULIP_WANTTXSTART; return; } @@ -4427,7 +4424,7 @@ ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); - if_printf(ifp, "%s%s pass %d.%d%s\n", + device_printf(sc->tulip_dev, "%s%s pass %d.%d%s\n", sc->tulip_boardid, tulip_chipdescs[sc->tulip_chipid], (sc->tulip_revinfo & 0xF0) >> 4, @@ -4789,6 +4786,7 @@ } sc = device_get_softc(dev); >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609161726.k8GHQvAQ080352>