Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Dec 2011 03:27:20 +0300
From:      Sergey Kandaurov <pluknet@gmail.com>
To:        Sean Bruno <seanbru@yahoo-inc.com>
Cc:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject:   Re: i386 compile sys/dev/ie
Message-ID:  <CAE-mSOLDrPLkVbM8i-1q=wzMdF_Kz1FJNJqtW-4tnC0_VWvrKA@mail.gmail.com>
In-Reply-To: <1325015120.17645.7.camel@hitfishpass-lx.corp.yahoo.com>
References:  <1325015120.17645.7.camel@hitfishpass-lx.corp.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On 27 December 2011 23:45, Sean Bruno <seanbru@yahoo-inc.com> wrote:
> Doing a lot of compiles recently and keep noting this noise in
> sys/dev/ie:
>
>
>
> /dumpster/scratch/sbruno-scratch/head/sys/dev/ie/if_ie.c: In function
> 'ieget':
> /dumpster/scratch/sbruno-scratch/head/sys/dev/ie/if_ie.c:682: warning:
> passing argument 1 of 'bcopy' discards qualifiers from pointer target
> type
[snip similar]

These type of errors are because bzero takes a volatile argument but wants
a non-volatile. This can be "solved" by casting to remove volatile modifier.

> /dumpster/scratch/sbruno-scratch/head/sys/dev/ie/if_ie.c: At top level:
> /dumpster/scratch/sbruno-scratch/head/sys/dev/ie/if_ie.c:1155: warning:
> 'ee16_read_eeprom' defined but not used
> /dumpster/scratch/sbruno-scratch/head/sys/dev/ie/if_ie.c:1097: warning:
> 'find_ie_mem_size' defined but not used

These were used in probe routine and are left from the newbus rewrite.
I hacked ie a bit to build cleanly. [Not sure if I did this correctly.]

-- 
wbr,
pluknet

[-- Attachment #2 --]
diff -urpN sys/dev/ie.orig/if_ie.c sys/dev/ie/if_ie.c
--- sys/dev/ie.orig/if_ie.c	2011-12-28 02:00:19.000000000 +0400
+++ sys/dev/ie/if_ie.c	2011-12-28 04:05:36.000000000 +0400
@@ -169,17 +169,12 @@ static void	iestart_locked		(struct ifne
 
 static __inline void
 		ee16_interrupt_enable	(struct ie_softc *);
-static void	ee16_eeprom_outbits	(struct ie_softc *, int, int);
-static void	ee16_eeprom_clock	(struct ie_softc *, int);
-static u_short	ee16_read_eeprom	(struct ie_softc *, int);
-static int	ee16_eeprom_inbits	(struct ie_softc *);
 
 static __inline void
 		ie_ack			(struct ie_softc *, u_int);
 static void	iereset			(struct ie_softc *);
 static void	ie_readframe		(struct ie_softc *, int);
 static void	ie_drop_packet_buffer	(struct ie_softc *);
-static void	find_ie_mem_size	(struct ie_softc *);
 static int	command_and_wait	(struct ie_softc *,
 					 int, void volatile *, int);
 static void	run_tdr			(struct ie_softc *,
@@ -300,12 +295,12 @@ ie_attach(device_t dev)
 	}
 	sc->rbuffs =
 	    (volatile struct ie_recv_buf_desc **)&sc->rframes[sc->nframes];
-	sc->cbuffs = (volatile u_char **)&sc->rbuffs[sc->nrxbufs];
+	sc->cbuffs = __DEVOLATILE(u_char **, &sc->rbuffs[sc->nrxbufs]);
 	sc->xmit_cmds =
 	    (volatile struct ie_xmit_cmd **)&sc->cbuffs[sc->nrxbufs];
 	sc->xmit_buffs =
 	    (volatile struct ie_xmit_buf **)&sc->xmit_cmds[sc->ntxbufs];
-	sc->xmit_cbuffs = (volatile u_char **)&sc->xmit_buffs[sc->ntxbufs];
+	sc->xmit_cbuffs = __DEVOLATILE(u_char **, &sc->xmit_buffs[sc->ntxbufs]);
 
 	if (bootverbose)
 		device_printf(sc->dev, "hardware type %s, revision %d\n",
@@ -771,7 +766,7 @@ ieget(struct ie_softc *sc, struct mbuf *
 		if (thislen > m->m_len - thismboff) {
 			int	newlen = m->m_len - thismboff;
 
-			bcopy((v_caddr_t) (sc->cbuffs[head] + offset),
+			bcopy(sc->cbuffs[head] + offset,
 			      mtod(m, caddr_t) +thismboff, (unsigned) newlen);
 			/* ignore cast-qual warning */
 			m = m->m_next;
@@ -788,7 +783,7 @@ ieget(struct ie_softc *sc, struct mbuf *
 		 * pointers, and so on.
 		 */
 		if (thislen < m->m_len - thismboff) {
-			bcopy((v_caddr_t) (sc->cbuffs[head] + offset),
+			bcopy(sc->cbuffs[head] + offset,
 			    mtod(m, caddr_t) +thismboff, (unsigned) thislen);
 			thismboff += thislen;	/* we are this far into the
 						 * mbuf */
@@ -800,7 +795,7 @@ ieget(struct ie_softc *sc, struct mbuf *
 		 * buffer's contents into the current mbuf.  Do the
 		 * combination of the above actions.
 		 */
-		bcopy((v_caddr_t) (sc->cbuffs[head] + offset),
+		bcopy(sc->cbuffs[head] + offset,
 		      mtod(m, caddr_t) + thismboff, (unsigned) thislen);
 		m = m->m_next;
 		thismboff = 0;		/* new mbuf, start at the beginning */
@@ -846,7 +841,7 @@ ie_readframe(struct ie_softc *sc, int	nu
 	struct ether_header *eh;
 #endif
 
-	bcopy((v_caddr_t) (sc->rframes[num]), &rfd,
+	bcopy(__DEVOLATILE(caddr_t, sc->rframes[num]), &rfd,
 	      sizeof(struct ie_recv_frame_desc));
 
 	/*
@@ -936,7 +931,7 @@ iestart_locked(struct ifnet *ifp)
 {
 	struct	 ie_softc *sc = ifp->if_softc;
 	struct	 mbuf *m0, *m;
-	volatile unsigned char *buffer;
+	unsigned char *buffer;
 	u_short	 len;
 
 	/*
@@ -1023,7 +1018,7 @@ check_ie_present(struct ie_softc *sc)
 
 	scp = (volatile struct ie_sys_conf_ptr *) (uintptr_t)
 	      (realbase + IE_SCP_ADDR);
-	bzero((volatile char *) scp, sizeof *scp);
+	bzero(__DEVOLATILE(void *, scp), sizeof *scp);
 
 	/*
 	 * First we put the ISCP at the bottom of memory; this tests to make
@@ -1032,10 +1027,10 @@ check_ie_present(struct ie_softc *sc)
 	 * operation.
 	 */
 	iscp = (volatile struct ie_int_sys_conf_ptr *) sc->iomembot;
-	bzero((volatile char *)iscp, sizeof *iscp);
+	bzero(__DEVOLATILE(char *, iscp), sizeof *iscp);
 
 	scb = (volatile struct ie_sys_ctl_block *) sc->iomembot;
-	bzero((volatile char *)scb, sizeof *scb);
+	bzero(__DEVOLATILE(char *, scb), sizeof *scb);
 
 	scp->ie_bus_use = sc->bus_use;	/* 8-bit or 16-bit */
 	scp->ie_iscp_ptr = (caddr_t) (uintptr_t)
@@ -1059,7 +1054,7 @@ check_ie_present(struct ie_softc *sc)
 	iscp = (void *) Align((caddr_t) (uintptr_t)
 			      (realbase + IE_SCP_ADDR -
 			       sizeof(struct ie_int_sys_conf_ptr)));
-	bzero((volatile char *) iscp, sizeof *iscp);	/* ignore cast-qual */
+	bzero(__DEVOLATILE(char *, iscp), sizeof *iscp);	/* ignore cast-qual */
 
 	scp->ie_iscp_ptr = (caddr_t) (uintptr_t)
 	    ((volatile char *) iscp - (volatile char *) (uintptr_t) realbase);
@@ -1088,26 +1083,6 @@ check_ie_present(struct ie_softc *sc)
 	return (1);
 }
 
-/*
- * Divine the memory size of ie board UNIT.
- * Better hope there's nothing important hiding just below the ie card...
- */
-static void
-find_ie_mem_size(struct ie_softc *sc)
-{
-	unsigned size;
-
-	sc->iosize = 0;
-
-	for (size = 65536; size >= 8192; size -= 8192) {
-		if (check_ie_present(sc)) {
-			return;
-		}
-	}
-
-	return;
-}
-
 void
 el_reset_586(struct ie_softc *sc)
 {
@@ -1150,82 +1125,6 @@ ee16_chan_attn(struct ie_softc *sc)
 	outb(PORT(sc) + IEE16_ATTN, 0);
 }
 
-u_short
-ee16_read_eeprom(struct ie_softc *sc, int location)
-{
-	int	ectrl, edata;
-
-	ectrl = inb(sc->port + IEE16_ECTRL);
-	ectrl &= IEE16_ECTRL_MASK;
-	ectrl |= IEE16_ECTRL_EECS;
-	outb(sc->port + IEE16_ECTRL, ectrl);
-
-	ee16_eeprom_outbits(sc, IEE16_EEPROM_READ, IEE16_EEPROM_OPSIZE1);
-	ee16_eeprom_outbits(sc, location, IEE16_EEPROM_ADDR_SIZE);
-	edata = ee16_eeprom_inbits(sc);
-	ectrl = inb(sc->port + IEE16_ECTRL);
-	ectrl &= ~(IEE16_RESET_ASIC | IEE16_ECTRL_EEDI | IEE16_ECTRL_EECS);
-	outb(sc->port + IEE16_ECTRL, ectrl);
-	ee16_eeprom_clock(sc, 1);
-	ee16_eeprom_clock(sc, 0);
-	return edata;
-}
-
-static void
-ee16_eeprom_outbits(struct ie_softc *sc, int edata, int count)
-{
-	int	ectrl, i;
-
-	ectrl = inb(sc->port + IEE16_ECTRL);
-	ectrl &= ~IEE16_RESET_ASIC;
-	for (i = count - 1; i >= 0; i--) {
-		ectrl &= ~IEE16_ECTRL_EEDI;
-		if (edata & (1 << i)) {
-			ectrl |= IEE16_ECTRL_EEDI;
-		}
-		outb(sc->port + IEE16_ECTRL, ectrl);
-		DELAY(1);	/* eeprom data must be setup for 0.4 uSec */
-		ee16_eeprom_clock(sc, 1);
-		ee16_eeprom_clock(sc, 0);
-	}
-	ectrl &= ~IEE16_ECTRL_EEDI;
-	outb(sc->port + IEE16_ECTRL, ectrl);
-	DELAY(1);		/* eeprom data must be held for 0.4 uSec */
-}
-
-static int
-ee16_eeprom_inbits(struct ie_softc *sc)
-{
-	int	ectrl, edata, i;
-
-	ectrl = inb(sc->port + IEE16_ECTRL);
-	ectrl &= ~IEE16_RESET_ASIC;
-	for (edata = 0, i = 0; i < 16; i++) {
-		edata = edata << 1;
-		ee16_eeprom_clock(sc, 1);
-		ectrl = inb(sc->port + IEE16_ECTRL);
-		if (ectrl & IEE16_ECTRL_EEDO) {
-			edata |= 1;
-		}
-		ee16_eeprom_clock(sc, 0);
-	}
-	return (edata);
-}
-
-static void
-ee16_eeprom_clock(struct ie_softc *sc, int state)
-{
-	int	ectrl;
-
-	ectrl = inb(sc->port + IEE16_ECTRL);
-	ectrl &= ~(IEE16_RESET_ASIC | IEE16_ECTRL_EESK);
-	if (state) {
-		ectrl |= IEE16_ECTRL_EESK;
-	}
-	outb(sc->port + IEE16_ECTRL, ectrl);
-	DELAY(9);		/* EESK must be stable for 8.38 uSec */
-}
-
 static __inline void
 ee16_interrupt_enable(struct ie_softc *sc)
 {
@@ -1384,7 +1283,7 @@ setup_rfa(struct ie_softc *sc, v_caddr_t
 	/* First lay them out */
 	for (i = 0; i < sc->nframes; i++) {
 		sc->rframes[i] = rfd;
-		bzero((volatile char *) rfd, sizeof *rfd);	/* ignore cast-qual */
+		bzero(__DEVOLATILE(char *, rfd), sizeof *rfd);	/* ignore cast-qual */
 		rfd++;
 	}
 
@@ -1408,11 +1307,11 @@ setup_rfa(struct ie_softc *sc, v_caddr_t
 
 	for (i = 0; i < sc->nrxbufs; i++) {
 		sc->rbuffs[i] = rbd;
-		bzero((volatile char *)rbd, sizeof *rbd);
+		bzero(__DEVOLATILE(char *, rbd), sizeof *rbd);
 		ptr = Alignvol(ptr + sizeof *rbd);
 		rbd->ie_rbd_length = IE_RBUF_SIZE;
 		rbd->ie_rbd_buffer = MK_24(MEM(sc), ptr);
-		sc->cbuffs[i] = (volatile void *) ptr;
+		sc->cbuffs[i] = __DEVOLATILE(void *, ptr);
 		ptr += IE_RBUF_SIZE;
 		rbd = (volatile void *) ptr;
 	}
@@ -1448,14 +1347,14 @@ setup_rfa(struct ie_softc *sc, v_caddr_t
 static int
 mc_setup(struct ie_softc *sc)
 {
-	volatile struct ie_mcast_cmd *cmd = (volatile void *)sc->xmit_cbuffs[0];
+	struct ie_mcast_cmd *cmd = (void *)sc->xmit_cbuffs[0];
 
 	cmd->com.ie_cmd_status = 0;
 	cmd->com.ie_cmd_cmd = IE_CMD_MCAST | IE_CMD_LAST;
 	cmd->com.ie_cmd_link = 0xffff;
 
 	/* ignore cast-qual */
-	bcopy((v_caddr_t) sc->mcast_addrs, (v_caddr_t) cmd->ie_mcast_addrs,
+	bcopy((caddr_t) sc->mcast_addrs, (caddr_t) cmd->ie_mcast_addrs,
 	      sc->mcast_count * sizeof *sc->mcast_addrs);
 
 	cmd->ie_mcast_bytes = sc->mcast_count * 6;	/* grrr... */
@@ -1491,7 +1390,7 @@ ieinit_locked(struct ie_softc *sc)
 {
 	struct ifnet *ifp = sc->ifp;
 	volatile struct ie_sys_ctl_block *scb = sc->scb;
-	caddr_t ptr;
+	v_caddr_t ptr;
 	int	i;
 
 	ptr = Alignvol((volatile char *) scb + sizeof *scb);
@@ -1500,7 +1399,7 @@ ieinit_locked(struct ie_softc *sc)
 	 * Send the configure command first.
 	 */
 	{
-		volatile struct ie_config_cmd *cmd = (volatile void *) ptr;
+		struct ie_config_cmd *cmd = __DEVOLATILE(void *, ptr);
 
 		ie_setup_config(cmd, sc->promisc,
 				sc->hard_type == IE_STARLAN10);
@@ -1520,14 +1419,14 @@ ieinit_locked(struct ie_softc *sc)
 	 * Now send the Individual Address Setup command.
 	 */
 	{
-		volatile struct ie_iasetup_cmd *cmd = (volatile void *) ptr;
+		struct ie_iasetup_cmd *cmd = __DEVOLATILE(void *, ptr);
 
 		cmd->com.ie_cmd_status = 0;
 		cmd->com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST;
 		cmd->com.ie_cmd_link = 0xffff;
 
-		bcopy((volatile char *)IF_LLADDR(ifp),
-		      (volatile char *)&cmd->ie_address, sizeof cmd->ie_address);
+		bcopy((char *)IF_LLADDR(ifp),
+		      (char *)&cmd->ie_address, sizeof cmd->ie_address);
 		scb->ie_command_list = MK_16(MEM(sc), cmd);
 		if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL)
 		    || !(cmd->com.ie_cmd_status & IE_STAT_OK)) {
@@ -1569,15 +1468,15 @@ ieinit_locked(struct ie_softc *sc)
 
 	/* transmit buffers */
 	for (i = 0; i < sc->ntxbufs - 1; i++) {
-		sc->xmit_cbuffs[i] = (volatile void *)ptr;
+		sc->xmit_cbuffs[i] = __DEVOLATILE(void *, ptr);
 		ptr += IE_BUF_LEN;
 		ptr = Alignvol(ptr);
 	}
-	sc->xmit_cbuffs[sc->ntxbufs - 1] = (volatile void *) ptr;
+	sc->xmit_cbuffs[sc->ntxbufs - 1] = __DEVOLATILE(void *, ptr);
 
 	for (i = 1; i < sc->ntxbufs; i++) {
-		bzero((v_caddr_t) sc->xmit_cmds[i], sizeof *sc->xmit_cmds[i]);
-		bzero((v_caddr_t) sc->xmit_buffs[i], sizeof *sc->xmit_buffs[i]);
+		bzero(__DEVOLATILE(caddr_t, sc->xmit_cmds[i]), sizeof *sc->xmit_cmds[i]);
+		bzero(__DEVOLATILE(caddr_t, sc->xmit_buffs[i]), sizeof *sc->xmit_buffs[i]);
 	}
 
 	/*
diff -urpN sys/dev/ie.orig/if_ievar.h sys/dev/ie/if_ievar.h
--- sys/dev/ie.orig/if_ievar.h	2011-12-28 02:03:14.000000000 +0400
+++ sys/dev/ie/if_ievar.h	2011-12-28 02:41:13.000000000 +0400
@@ -55,12 +55,12 @@ struct ie_softc {
 	volatile struct ie_sys_ctl_block *scb;
 	volatile struct ie_recv_frame_desc **rframes;	/* nframes worth */
 	volatile struct ie_recv_buf_desc **rbuffs;	/* nrxbufs worth */
-	volatile u_char **cbuffs;			/* nrxbufs worth */
+	u_char **cbuffs;			/* nrxbufs worth */
 	int	 rfhead, rftail, rbhead, rbtail;
 
 	volatile struct ie_xmit_cmd **xmit_cmds;	/* ntxbufs worth */
 	volatile struct ie_xmit_buf **xmit_buffs;	/* ntxbufs worth */
-	volatile u_char	 **xmit_cbuffs;			/* ntxbufs worth */
+	u_char	 **xmit_cbuffs;			/* ntxbufs worth */
 	int	 xmit_count;
 
 	struct	 ie_en_addr mcast_addrs[MAXMCAST + 1];

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSOLDrPLkVbM8i-1q=wzMdF_Kz1FJNJqtW-4tnC0_VWvrKA>