Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Aug 2003 22:58:01 -0700 (PDT)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 36472 for review
Message-ID:  <200308200558.h7K5w1Wj023451@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=36472

Change 36472 by marcel@marcel_nfs on 2003/08/19 22:57:08

	IFC @36468

Affected files ...

.. //depot/projects/uart/amd64/amd64/pmap.c#12 integrate
.. //depot/projects/uart/dev/aac/aac.c#4 integrate
.. //depot/projects/uart/dev/aac/aac_cam.c#2 integrate
.. //depot/projects/uart/dev/aac/aac_disk.c#2 integrate
.. //depot/projects/uart/dev/an/if_aironet_ieee.h#2 integrate
.. //depot/projects/uart/dev/an/if_an.c#2 integrate
.. //depot/projects/uart/dev/an/if_an_pci.c#3 integrate
.. //depot/projects/uart/dev/an/if_anreg.h#2 integrate
.. //depot/projects/uart/dev/ath/if_ath.c#7 integrate
.. //depot/projects/uart/dev/ath/if_athioctl.h#2 integrate
.. //depot/projects/uart/dev/ath/if_athvar.h#4 integrate
.. //depot/projects/uart/dev/bge/if_bge.c#7 integrate
.. //depot/projects/uart/dev/bge/if_bgereg.h#6 integrate
.. //depot/projects/uart/dev/ep/if_ep.c#3 integrate
.. //depot/projects/uart/dev/firewire/firewire.h#4 integrate
.. //depot/projects/uart/dev/firewire/fwohci.c#8 integrate
.. //depot/projects/uart/dev/firewire/fwohcireg.h#3 integrate
.. //depot/projects/uart/dev/firewire/if_fwe.c#5 integrate
.. //depot/projects/uart/dev/hifn/hifn7751.c#3 integrate
.. //depot/projects/uart/dev/mii/brgphy.c#4 integrate
.. //depot/projects/uart/dev/patm/if_patm_attach.c#2 integrate
.. //depot/projects/uart/dev/pccard/pccard_cis.c#3 integrate
.. //depot/projects/uart/dev/rndtest/rndtest.c#2 integrate
.. //depot/projects/uart/dev/safe/safe.c#3 integrate
.. //depot/projects/uart/dev/twe/twe.c#4 integrate
.. //depot/projects/uart/dev/ubsec/ubsec.c#3 integrate
.. //depot/projects/uart/dev/wi/if_wi.c#7 integrate
.. //depot/projects/uart/fs/pseudofs/pseudofs_vnops.c#3 integrate
.. //depot/projects/uart/i386/i386/busdma_machdep.c#7 integrate
.. //depot/projects/uart/i386/i386/pmap.c#12 integrate
.. //depot/projects/uart/ia64/ia64/trap.c#6 integrate
.. //depot/projects/uart/ia64/include/cpu.h#6 integrate
.. //depot/projects/uart/kern/init_main.c#3 integrate
.. //depot/projects/uart/kern/kern_fork.c#4 integrate
.. //depot/projects/uart/kern/kern_synch.c#4 integrate
.. //depot/projects/uart/kern/kern_tc.c#5 integrate
.. //depot/projects/uart/kern/kern_thread.c#9 integrate
.. //depot/projects/uart/kern/sched_4bsd.c#3 integrate
.. //depot/projects/uart/kern/sched_ule.c#4 integrate
.. //depot/projects/uart/net/bpf.c#3 integrate
.. //depot/projects/uart/net/if_ethersubr.c#3 integrate
.. //depot/projects/uart/net/radix.h#2 integrate
.. //depot/projects/uart/net80211/ieee80211_input.c#4 integrate
.. //depot/projects/uart/net80211/ieee80211_node.c#5 integrate
.. //depot/projects/uart/net80211/ieee80211_node.h#4 integrate
.. //depot/projects/uart/net80211/ieee80211_output.c#3 integrate
.. //depot/projects/uart/net80211/ieee80211_proto.h#3 integrate
.. //depot/projects/uart/net80211/ieee80211_var.h#3 integrate
.. //depot/projects/uart/netinet/ip_mroute.c#3 integrate
.. //depot/projects/uart/netinet/tcp_syncache.c#4 integrate
.. //depot/projects/uart/netinet/udp_usrreq.c#2 integrate
.. //depot/projects/uart/pci/if_dc.c#8 integrate
.. //depot/projects/uart/pci/if_sis.c#6 integrate
.. //depot/projects/uart/sparc64/conf/GENERIC#4 integrate
.. //depot/projects/uart/sys/malloc.h#2 integrate

Differences ...

==== //depot/projects/uart/amd64/amd64/pmap.c#12 (text+ko) ====

@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.432 2003/08/17 04:48:21 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.433 2003/08/20 05:09:55 alc Exp $");
 
 /*
  *	Manages physical address maps.
@@ -1016,12 +1016,14 @@
 	/*
 	 * allocate the page directory page
 	 */
+	VM_OBJECT_LOCK(pmap->pm_pteobj);
 	pml4pg = vm_page_grab(pmap->pm_pteobj, NUPDE + NUPDPE + NUPML4E,
 	    VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_WIRED | VM_ALLOC_ZERO);
 	vm_page_lock_queues();
 	vm_page_flag_clear(pml4pg, PG_BUSY);
 	pml4pg->valid = VM_PAGE_BITS_ALL;
 	vm_page_unlock_queues();
+	VM_OBJECT_UNLOCK(pmap->pm_pteobj);
 
 	pmap->pm_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pml4pg));
 
@@ -1067,12 +1069,17 @@
 	vm_pindex_t ptepindex;
 {
 	vm_page_t m, pdppg, pdpg;
+	int is_object_locked;
 
 	/*
 	 * Find or fabricate a new pagetable page
 	 */
+	if (!(is_object_locked = VM_OBJECT_LOCKED(pmap->pm_pteobj)))
+		VM_OBJECT_LOCK(pmap->pm_pteobj);
 	m = vm_page_grab(pmap->pm_pteobj, ptepindex,
 	    VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY);
+	if ((m->flags & PG_ZERO) == 0)
+		pmap_zero_page(m);
 
 	KASSERT(m->queue == PQ_NONE,
 		("_pmap_allocpte: %p->queue != PQ_NONE", m));
@@ -1161,17 +1168,13 @@
 		*pd = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | PG_A | PG_M;
 	}
 
-	/*
-	 * Try to use the new mapping, but if we cannot, then
-	 * do it with the routine that maps the page explicitly.
-	 */
-	if ((m->flags & PG_ZERO) == 0)
-		pmap_zero_page(m);
 	vm_page_lock_queues();
 	m->valid = VM_PAGE_BITS_ALL;
 	vm_page_flag_clear(m, PG_ZERO);
 	vm_page_wakeup(m);
 	vm_page_unlock_queues();
+	if (!is_object_locked)
+		VM_OBJECT_UNLOCK(pmap->pm_pteobj);
 
 	return m;
 }

==== //depot/projects/uart/dev/aac/aac.c#4 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/aac/aac.c,v 1.73 2003/07/09 21:16:23 scottl Exp $
+ *	$FreeBSD: src/sys/dev/aac/aac.c,v 1.74 2003/08/19 21:31:45 scottl Exp $
  */
 
 /*
@@ -1113,7 +1113,6 @@
 	 * intermediate stage may have destroyed them.  They're left
 	 * initialised here for debugging purposes only.
 	 */
-	cm->cm_fib->Header.SenderFibAddress = (u_int32_t)cm->cm_fib;
 	cm->cm_fib->Header.ReceiverFibAddress = (u_int32_t)cm->cm_fibphys;
 	cm->cm_fib->Header.SenderData = 0;
 
@@ -1408,8 +1407,7 @@
 {
 	struct aac_adapter_init	*ip;
 	time_t then;
-	u_int32_t code;
-	u_int8_t *qaddr;
+	u_int32_t code, qoffset;
 	int error;
 
 	debug_called(1);
@@ -1581,12 +1579,10 @@
 	 * list manipulation functions which 'know' the size of each list by
 	 * virtue of a table.
 	 */
-	qaddr = &sc->aac_common->ac_qbuf[0] + AAC_QUEUE_ALIGN;
-	qaddr -= (u_int32_t)qaddr % AAC_QUEUE_ALIGN;
-	sc->aac_queues = (struct aac_queue_table *)qaddr;
-	ip->CommHeaderAddress = sc->aac_common_busaddr +
-				((u_int32_t)sc->aac_queues -
-				(u_int32_t)sc->aac_common);
+	qoffset = offsetof(struct aac_common, ac_qbuf) + AAC_QUEUE_ALIGN;
+	qoffset &= (AAC_QUEUE_ALIGN - 1);
+	sc->aac_queues = (struct aac_queue_table *)((uintptr_t)sc->aac_common + qoffset);
+	ip->CommHeaderAddress = sc->aac_common_busaddr + qoffset;
 
 	sc->aac_queues->qt_qindex[AAC_HOST_NORM_CMD_QUEUE][AAC_PRODUCER_INDEX] =
 		AAC_HOST_NORM_CMD_ENTRIES;
@@ -1757,7 +1753,7 @@
 	fib->Header.StructType = AAC_FIBTYPE_TFIB;
 	fib->Header.Size = sizeof(struct aac_fib) + datasize;
 	fib->Header.SenderSize = sizeof(struct aac_fib);
-	fib->Header.SenderFibAddress = (u_int32_t)fib;
+	fib->Header.SenderFibAddress = 0;	/* Not needed */
 	fib->Header.ReceiverFibAddress = sc->aac_common_busaddr +
 					 offsetof(struct aac_common,
 						  ac_sync_fib);
@@ -2383,7 +2379,7 @@
 	union aac_statrequest *as;
 	struct aac_softc *sc;
 	int error = 0;
-	int i;
+	uint32_t cookie;
 
 	debug_called(2);
 
@@ -2434,8 +2430,8 @@
 		 * Here, we give it the proc pointer of the per-adapter aif 
 		 * thread. It's only used as a sanity check in other calls.
 		 */
-		i = (int)sc->aifthread;
-		error = copyout(&i, arg, sizeof(i));
+		cookie = (uint32_t)(uintptr_t)sc->aifthread;
+		error = copyout(&cookie, arg, sizeof(cookie));
 		break;
 	case FSACTL_GET_NEXT_ADAPTER_FIB:
 		arg = *(caddr_t*)arg;
@@ -2531,7 +2527,7 @@
 		goto out;
 	size = cm->cm_fib->Header.Size + sizeof(struct aac_fib_header);
 	if (size > sizeof(struct aac_fib)) {
-		device_printf(sc->aac_dev, "incoming FIB oversized (%d > %d)\n",
+		device_printf(sc->aac_dev, "incoming FIB oversized (%d > %zd)\n",
 			      size, sizeof(struct aac_fib));
 		size = sizeof(struct aac_fib);
 	}
@@ -2554,7 +2550,7 @@
 	 */
 	size = cm->cm_fib->Header.Size;
 	if (size > sizeof(struct aac_fib)) {
-		device_printf(sc->aac_dev, "outbound FIB oversized (%d > %d)\n",
+		device_printf(sc->aac_dev, "outbound FIB oversized (%d > %zd)\n",
 			      size, sizeof(struct aac_fib));
 		size = sizeof(struct aac_fib);
 	}
@@ -2776,7 +2772,7 @@
 		/*
 		 * Check the magic number that we gave the caller.
 		 */
-		if (agf.AdapterFibContext != (int)sc->aifthread) {
+		if (agf.AdapterFibContext != (int)(uintptr_t)sc->aifthread) {
 			error = EFAULT;
 		} else {
 			error = aac_return_aif(sc, agf.AifFib);

==== //depot/projects/uart/dev/aac/aac_cam.c#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/aac/aac_cam.c,v 1.11 2003/03/26 17:50:11 scottl Exp $
+ *	$FreeBSD: src/sys/dev/aac/aac_cam.c,v 1.12 2003/08/19 21:31:45 scottl Exp $
  */
 
 /*
@@ -339,9 +339,14 @@
 			if ((ccb->ccb_h.flags & CAM_SCATTER_VALID) == 0) {
 				srb->data_len = csio->dxfer_len;
 				if (ccb->ccb_h.flags & CAM_DATA_PHYS) {
+					/*
+					 * XXX This isn't 64-bit clean.
+					 * However, this condition is not
+					 * normally used in CAM.
+					 */
 					srb->sg_map32.SgCount = 1;
 					srb->sg_map32.SgEntry[0].SgAddress =
-					    (u_int32_t)csio->data_ptr;
+					    (uint32_t)(uintptr_t)csio->data_ptr;
 					srb->sg_map32.SgEntry[0].SgByteCount =
 					    csio->dxfer_len;
 				} else {

==== //depot/projects/uart/dev/aac/aac_disk.c#2 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/aac/aac_disk.c,v 1.32 2003/06/19 01:49:04 scottl Exp $
+ *	$FreeBSD: src/sys/dev/aac/aac_disk.c,v 1.33 2003/08/19 21:31:45 scottl Exp $
  */
 
 #include "opt_aac.h"
@@ -272,7 +272,8 @@
 		size = fib->Header.Size + sizeof(struct aac_blockwrite);
 
 		if (aac_sync_fib(sc, ContainerCommand, 0, fib, size)) {
-			printf("Error dumping block 0x%x\n", physical);
+			printf("Error dumping block 0x%jx\n",
+			       (uintptr_t)physical);
 			return (EIO);
 		}
 

==== //depot/projects/uart/dev/an/if_aironet_ieee.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/an/if_aironet_ieee.h,v 1.11 2002/12/29 19:22:06 ambrisko Exp $
+ * $FreeBSD: src/sys/dev/an/if_aironet_ieee.h,v 1.12 2003/08/20 03:46:05 ambrisko Exp $
  */
 
 #ifndef _IF_AIRONET_IEEE_H
@@ -63,7 +63,7 @@
  * data, which is 240 words long, so 256 should be a safe
  * value.
  */
-#define AN_MAX_DATALEN	512
+#define AN_MAX_DATALEN	4096
 
 struct an_req {
 	u_int16_t	an_len;
@@ -261,7 +261,7 @@
 	u_int32_t		an_uptime_usecs;	/* 0x178 */
 	u_int32_t		an_uptime_secs;		/* 0x17C */
 	u_int32_t		an_lostsync_better_ap;	/* 0x180 */
-	u_int32_t		an_rsvd[10];
+	u_int32_t		an_rsvd[15];
 };
 
 /*
@@ -337,6 +337,7 @@
 	u_int8_t		an_magic_packet_action;	/* 0x98 */
 	u_int8_t		an_magic_packet_ctl;	/* 0x99 */
 	u_int16_t		an_rsvd9;
+	u_int16_t		an_spare[13];
 };
 
 #define AN_OPMODE_IBSS_ADHOC			0x0000
@@ -417,6 +418,18 @@
 	char			an_ssid3[32];
 };
 
+struct an_ltv_ssid_entry{
+	u_int16_t		an_len;
+	char			an_ssid[32];
+};
+
+#define MAX_SSIDS 25
+struct an_ltv_ssidlist_new {
+	u_int16_t		an_len;
+	u_int16_t		an_type;
+	struct an_ltv_ssid_entry an_entry[MAX_SSIDS];
+};
+
 /*
  * Valid AP list.
  */
@@ -501,7 +514,7 @@
 	u_int16_t		an_softcaps;		/* 0x7C */
 	u_int16_t		an_bootblockrev;	/* 0x7E */
 	u_int16_t		an_req_hw_support;	/* 0x80 */
-	u_int16_t		an_unknown;		/* 0x82 */
+	u_int16_t		an_unknown[31];		/* 0x82 */
 };
 
 /*
@@ -580,7 +593,7 @@
 	u_int8_t		an_avg_noise_prev_min_db;       /* 0x7D */
 	u_int8_t		an_max_noise_prev_min_pc;       /* 0x7E */
 	u_int8_t		an_max_noise_prev_min_db;       /* 0x7F */
-	u_int16_t		an_spare[5];
+	u_int16_t		an_spare[8];
 };
 
 #define AN_STATUS_OPMODE_CONFIGURED		0x0001

==== //depot/projects/uart/dev/an/if_an.c#2 (text+ko) ====

@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/an/if_an.c,v 1.51 2003/06/28 06:13:27 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/an/if_an.c,v 1.52 2003/08/20 03:46:05 ambrisko Exp $");
 
 #include "opt_inet.h"
 
@@ -313,7 +313,7 @@
 	device_t		dev;
 {
         struct an_softc *sc = device_get_softc(dev);
-	struct an_ltv_ssidlist	ssid;
+	struct an_ltv_ssidlist_new	ssid;
 	int	error;
 
 	bzero((char *)&ssid, sizeof(ssid));
@@ -339,11 +339,11 @@
 	ssid.an_type = AN_RID_SSIDLIST;
 
         /* Make sure interrupts are disabled. */
+	sc->mpi350 = 0;
         CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), 0);
         CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), 0xFFFF);
 
 	an_reset(sc);
-	/* No need for an_init_mpi350_desc since it will be done in attach */
 
 	if (an_cmd(sc, AN_CMD_READCFG, 0))
 		return(0);
@@ -352,7 +352,7 @@
 		return(0);
 
 	/* See if the ssid matches what we expect ... but doesn't have to */
-	if (strcmp(ssid.an_ssid1, AN_DEF_SSID))
+	if (strcmp(ssid.an_entry[0].an_ssid, AN_DEF_SSID))
 		return(0);
 
 	return(AN_IOSIZ);
@@ -715,7 +715,7 @@
 
 	/* Read ssid list */
 	sc->an_ssidlist.an_type = AN_RID_SSIDLIST;
-	sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist);
+	sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist_new);
 	if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_ssidlist)) {
 		printf("an%d: read record failed\n", sc->an_unit);
 		goto fail;
@@ -769,10 +769,11 @@
 	bcopy(AN_DEFAULT_NODENAME, sc->an_config.an_nodename,
 	    sizeof(AN_DEFAULT_NODENAME) - 1);
 
-	bzero(sc->an_ssidlist.an_ssid1, sizeof(sc->an_ssidlist.an_ssid1));
-	bcopy(AN_DEFAULT_NETNAME, sc->an_ssidlist.an_ssid1,
+	bzero(sc->an_ssidlist.an_entry[0].an_ssid,
+	      sizeof(sc->an_ssidlist.an_entry[0].an_ssid));
+	bcopy(AN_DEFAULT_NETNAME, sc->an_ssidlist.an_entry[0].an_ssid,
 	    sizeof(AN_DEFAULT_NETNAME) - 1);
-	sc->an_ssidlist.an_ssid1_len = strlen(AN_DEFAULT_NETNAME);
+	sc->an_ssidlist.an_entry[0].an_len = strlen(AN_DEFAULT_NETNAME);
 
 	sc->an_config.an_opmode =
 	    AN_OPMODE_INFRASTRUCTURE_STATION;
@@ -1088,7 +1089,7 @@
 	ifp->if_flags &= ~IFF_OACTIVE;
 
 	if (!sc->mpi350) {
-		id = CSR_READ_2(sc, AN_TX_CMP_FID);
+		id = CSR_READ_2(sc, AN_TX_CMP_FID(sc->mpi350));
 
 		if (status & AN_EV_TX_EXC) {
 			ifp->if_oerrors++;
@@ -1104,10 +1105,17 @@
 
 		AN_INC(sc->an_rdata.an_tx_cons, AN_TX_RING_CNT);
 	} else { /* MPI 350 */
-		AN_INC(sc->an_rdata.an_tx_cons, AN_MAX_TX_DESC);
-		if (sc->an_rdata.an_tx_prod ==
-		    sc->an_rdata.an_tx_cons)
-			sc->an_rdata.an_tx_empty = 1;
+		id = CSR_READ_2(sc, AN_TX_CMP_FID(sc->mpi350));
+		if (!sc->an_rdata.an_tx_empty){
+			if (status & AN_EV_TX_EXC) {
+				ifp->if_oerrors++;
+			} else
+				ifp->if_opackets++;
+			AN_INC(sc->an_rdata.an_tx_cons, AN_MAX_TX_DESC);
+			if (sc->an_rdata.an_tx_prod ==
+			    sc->an_rdata.an_tx_cons)
+				sc->an_rdata.an_tx_empty = 1;
+		}
 	}
 
 	return;
@@ -1179,10 +1187,10 @@
 	CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), 0);
 
 	status = CSR_READ_2(sc, AN_EVENT_STAT(sc->mpi350));
-	CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), ~AN_INTRS);
+	CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), ~AN_INTRS(sc->mpi350));
 
-	if (status & AN_EV_AWAKE) {
-		CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_AWAKE);
+	if (status & AN_EV_MIC) {
+		CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_MIC);
 	}
 
 	if (status & AN_EV_LINKSTAT) {
@@ -1199,9 +1207,16 @@
 		CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_RX);
 	}
 
+	if (sc->mpi350 && status & AN_EV_TX_CPY) {
+		an_txeof(sc, status);
+		CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), 
+		    AN_EV_TX_CPY);
+	}
+
 	if (status & AN_EV_TX) {
 		an_txeof(sc, status);
-		CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_TX);
+		CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), 
+		    AN_EV_TX);
 	}
 
 	if (status & AN_EV_TX_EXC) {
@@ -1213,7 +1228,7 @@
 		CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_ALLOC);
 
 	/* Re-enable interrupts. */
-	CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), AN_INTRS);
+	CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), AN_INTRS(sc->mpi350));
 
 	if ((ifp->if_flags & IFF_UP) && (ifp->if_snd.ifq_head != NULL))
 		an_start(ifp);
@@ -1238,6 +1253,7 @@
 		} else
 			break;
 	}
+
 	if( i == AN_TIMEOUT) {
 		printf("BUSY\n");
 		return(ETIMEDOUT);
@@ -1260,7 +1276,8 @@
 	reply->an_status = CSR_READ_2(sc, AN_STATUS(sc->mpi350));
 
 	if (CSR_READ_2(sc, AN_COMMAND(sc->mpi350)) & AN_CMD_BUSY)
-		CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_CLR_STUCK_BUSY);
+		CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), 
+		    AN_EV_CLR_STUCK_BUSY);
 
 	/* Ack the command */
 	CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_CMD);
@@ -1728,7 +1745,7 @@
 	struct ifaddr		*ifa;
 	struct ifnet		*ifp;
 	struct an_ltv_genconfig	*cfg;
-	struct an_ltv_ssidlist	*ssid;
+	struct an_ltv_ssidlist_new	*ssid;
 	struct an_ltv_aplist	*ap;
 	struct an_ltv_gen	*sp;
 
@@ -1748,9 +1765,9 @@
 			sizeof(struct an_ltv_genconfig));
 		break;
 	case AN_RID_SSIDLIST:
-		ssid = (struct an_ltv_ssidlist *)areq;
+		ssid = (struct an_ltv_ssidlist_new *)areq;
 		bcopy((char *)ssid, (char *)&sc->an_ssidlist,
-			sizeof(struct an_ltv_ssidlist));
+			sizeof(struct an_ltv_ssidlist_new));
 		break;
 	case AN_RID_APLIST:
 		ap = (struct an_ltv_aplist *)areq;
@@ -1783,6 +1800,8 @@
 	case AN_RID_WEP_PERM:
 	case AN_RID_LEAPUSERNAME:
 	case AN_RID_LEAPPASSWORD:
+		an_init(sc);
+
 		/* Disable the MAC. */
 		an_cmd(sc, AN_CMD_DISABLE, 0);
 
@@ -1859,7 +1878,7 @@
 {
 	int			error = 0;
 	int			len;
-	int			i;
+	int			i, max;
 	struct an_softc		*sc;
 	struct ifreq		*ifr;
 	struct thread		*td = curthread;
@@ -1869,7 +1888,7 @@
 	struct an_ltv_genconfig	*config;
 	struct an_ltv_key	*key;
 	struct an_ltv_status	*status;
-	struct an_ltv_ssidlist	*ssids;
+	struct an_ltv_ssidlist_new	*ssids;
 	int			mode;
 	struct aironet_ioctl	l_ioctl;
 
@@ -1881,7 +1900,7 @@
 	config = (struct an_ltv_genconfig *)&sc->areq;
 	key = (struct an_ltv_key *)&sc->areq;
 	status = (struct an_ltv_status *)&sc->areq;
-	ssids = (struct an_ltv_ssidlist *)&sc->areq;
+	ssids = (struct an_ltv_ssidlist_new *)&sc->areq;
 
 	if (sc->an_gone) {
 		error = ENODEV;
@@ -2004,18 +2023,20 @@
 					error = EINVAL;
 					break;
 				}
-				if (ireq->i_val == 0) {
-					len = ssids->an_ssid1_len;
-					tmpptr = ssids->an_ssid1;
-				} else if (ireq->i_val == 1) {
-					len = ssids->an_ssid2_len;
-					tmpptr = ssids->an_ssid2;
-				} else if (ireq->i_val == 2) {
-					len = ssids->an_ssid3_len;
-					tmpptr = ssids->an_ssid3;
-				} else {
+				max = (sc->areq.an_len - 4)
+				    / sizeof(struct an_ltv_ssid_entry);
+				if ( max > MAX_SSIDS ) {
+					printf("To many SSIDs only using "
+					    "%d of %d\n",
+					    MAX_SSIDS, max);
+					max = MAX_SSIDS;
+				}
+				if (ireq->i_val > max) {
 					error = EINVAL;
 					break;
+				} else {
+					len = ssids->an_entry[ireq->i_val].an_len;
+					tmpptr = ssids->an_entry[ireq->i_val].an_ssid;
 				}
 			} else {
 				error = EINVAL;
@@ -2032,7 +2053,22 @@
 			    IEEE80211_NWID_LEN);
 			break;
 		case IEEE80211_IOC_NUMSSIDS:
-			ireq->i_val = 3;
+			sc->areq.an_len = sizeof(sc->areq);
+			sc->areq.an_type = AN_RID_SSIDLIST;
+			if (an_read_record(sc,
+			    (struct an_ltv_gen *)&sc->areq)) {
+				error = EINVAL;
+				break;
+			}
+			max = (sc->areq.an_len - 4)
+			    / sizeof(struct an_ltv_ssid_entry);
+			if ( max > MAX_SSIDS ) {
+				printf("To many SSIDs only using "
+				    "%d of %d\n",
+				    MAX_SSIDS, max);
+				max = MAX_SSIDS;
+			}
+			ireq->i_val = max;
 			break;
 		case IEEE80211_IOC_WEP:
 			sc->areq.an_type = AN_RID_ACTUALCFG;
@@ -2228,6 +2264,7 @@
 		}
 		switch (ireq->i_type) {
 		case IEEE80211_IOC_SSID:
+			sc->areq.an_len = sizeof(sc->areq);
 			sc->areq.an_type = AN_RID_SSIDLIST;
 			if (an_read_record(sc,
 			    (struct an_ltv_gen *)&sc->areq)) {
@@ -2238,25 +2275,24 @@
 				error = EINVAL;
 				break;
 			}
-			switch (ireq->i_val) {
-			case 0:
-				error = copyin(ireq->i_data,
-				    ssids->an_ssid1, ireq->i_len);
-				ssids->an_ssid1_len = ireq->i_len;
+			max = (sc->areq.an_len - 4)
+			    / sizeof(struct an_ltv_ssid_entry);
+			if ( max > MAX_SSIDS ) {
+				printf("To many SSIDs only using "
+				    "%d of %d\n",
+				    MAX_SSIDS, max);
+				max = MAX_SSIDS;
+			}
+			if (ireq->i_val > max) {
+				error = EINVAL;
 				break;
-			case 1:
+			} else {
 				error = copyin(ireq->i_data,
-				    ssids->an_ssid2, ireq->i_len);
-				ssids->an_ssid2_len = ireq->i_len;
+				    ssids->an_entry[ireq->i_val].an_ssid, 
+				    ireq->i_len);
+				ssids->an_entry[ireq->i_val].an_len 
+				    = ireq->i_len;
 				break;
-			case 2:
-				error = copyin(ireq->i_data,
-				    ssids->an_ssid3, ireq->i_len);
-				ssids->an_ssid3_len = ireq->i_len;
-				break;
-			default:
-				error = EINVAL;
-				break;
 			}
 			break;
 		case IEEE80211_IOC_WEP:
@@ -2512,7 +2548,7 @@
 
 	/* Set the ssid list */
 	sc->an_ssidlist.an_type = AN_RID_SSIDLIST;
-	sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist);
+	sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist_new);
 	if (an_write_record(sc, (struct an_ltv_gen *)&sc->an_ssidlist)) {
 		printf("an%d: failed to set ssid list\n", sc->an_unit);
 		AN_UNLOCK(sc);
@@ -2548,7 +2584,7 @@
 		an_cmd(sc, AN_CMD_SET_MODE, 0xffff);
 
 	/* enable interrupts */
-	CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), AN_INTRS);
+	CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), AN_INTRS(sc->mpi350));
 
 	ifp->if_flags |= IFF_RUNNING;
 	ifp->if_flags &= ~IFF_OACTIVE;
@@ -2570,7 +2606,6 @@
 	int			id, idx, i;
 	unsigned char           txcontrol;
 	struct an_card_tx_desc an_tx_desc;
-	u_int8_t		*ptr;
 	u_int8_t		*buf;
 
 	sc = ifp->if_softc;
@@ -2650,8 +2685,34 @@
 				printf("an%d: xmit failed\n", sc->an_unit);
 
 			AN_INC(idx, AN_TX_RING_CNT);
+
+			/*
+			 * Set a timeout in case the chip goes out to lunch.
+			 */
+			ifp->if_timer = 5;
 		}
 	} else { /* MPI-350 */
+/* HACK */
+		{
+			struct an_command	cmd_struct;
+			struct an_reply		reply;
+			/*
+			 * Allocate TX descriptor
+			 */
+			
+			bzero(&reply,sizeof(reply));
+			cmd_struct.an_cmd   = AN_CMD_ALLOC_DESC;
+			cmd_struct.an_parm0 = AN_DESCRIPTOR_TX;
+			cmd_struct.an_parm1 = AN_TX_DESC_OFFSET;
+			cmd_struct.an_parm2 = AN_MAX_TX_DESC;
+			if (an_cmd_struct(sc, &cmd_struct, &reply)) {
+				printf("an%d: failed to allocate TX "
+				    "descriptor\n", 
+				    sc->an_unit);
+				return;
+			}
+		}
+/* HACK */
 		while (sc->an_rdata.an_tx_empty ||
 		    idx != sc->an_rdata.an_tx_cons) {
 			IF_DEQUEUE(&ifp->if_snd, m0);
@@ -2697,12 +2758,15 @@
 			an_tx_desc.an_eoc = 1;
 			an_tx_desc.an_valid = 1;
 			an_tx_desc.an_len =  0x44 +
-				tx_frame_802_3.an_tx_802_3_payload_len;
-			an_tx_desc.an_phys = sc->an_tx_buffer[idx].an_dma_paddr;
-			ptr = (u_int8_t*)&an_tx_desc;
-			for (i = 0; i < sizeof(an_tx_desc); i++) {
-				CSR_MEM_AUX_WRITE_1(sc, AN_TX_DESC_OFFSET + i,
-						    ptr[i]);
+			    tx_frame_802_3.an_tx_802_3_payload_len;
+			an_tx_desc.an_phys 
+			    = sc->an_tx_buffer[idx].an_dma_paddr;
+			for (i = 0; i < sizeof(an_tx_desc) / 4 ; i++) {
+				CSR_MEM_AUX_WRITE_4(sc, AN_TX_DESC_OFFSET
+				    /* zero for now */ 
+				    + (0 * sizeof(an_tx_desc))
+				    + (i * 4),
+				    ((u_int32_t*)&an_tx_desc)[i]);
 			}
 
 			/*
@@ -2713,11 +2777,14 @@
 
 			m_freem(m0);
 			m0 = NULL;
-
+			AN_INC(idx, AN_MAX_TX_DESC);
+			sc->an_rdata.an_tx_empty = 0;
 			CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), AN_EV_ALLOC);
 
-			AN_INC(idx, AN_MAX_TX_DESC);
-			sc->an_rdata.an_tx_empty = 0;
+			/*
+			 * Set a timeout in case the chip goes out to lunch.
+			 */
+			ifp->if_timer = 5;
 		}
 	}
 
@@ -2726,11 +2793,6 @@
 
 	sc->an_rdata.an_tx_prod = idx;
 
-	/*
-	 * Set a timeout in case the chip goes out to lunch.
-	 */
-	ifp->if_timer = 5;
-
 	return;
 }
 
@@ -3069,13 +3131,10 @@
 	int otype = sc->an_config.an_opmode;
 	int orate = sc->an_tx_rate;
 
-	if ((sc->an_ifmedia.ifm_cur->ifm_media & IFM_IEEE80211_ADHOC) != 0)
-		sc->an_config.an_opmode = AN_OPMODE_IBSS_ADHOC;
-	else
-		sc->an_config.an_opmode = AN_OPMODE_INFRASTRUCTURE_STATION;
-
 	sc->an_tx_rate = ieee80211_media2rate(
 		IFM_SUBTYPE(sc->an_ifmedia.ifm_cur->ifm_media));
+	if (sc->an_tx_rate < 0)
+		sc->an_tx_rate = 0;
 
 	if (orate != sc->an_tx_rate) {
 		/* Read the current configuration */
@@ -3093,6 +3152,11 @@
 		sc->an_config.an_len = sizeof(struct an_ltv_genconfig);
 	}
 
+	if ((sc->an_ifmedia.ifm_cur->ifm_media & IFM_IEEE80211_ADHOC) != 0)
+		sc->an_config.an_opmode &= ~AN_OPMODE_INFRASTRUCTURE_STATION;
+	else
+		sc->an_config.an_opmode |= AN_OPMODE_INFRASTRUCTURE_STATION;
+
 	if (otype != sc->an_config.an_opmode || 
 	    orate != sc->an_tx_rate)
 		an_init(sc);

==== //depot/projects/uart/dev/an/if_an_pci.c#3 (text+ko) ====

@@ -51,7 +51,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/an/if_an_pci.c,v 1.21 2003/07/01 15:51:53 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/an/if_an_pci.c,v 1.22 2003/08/20 03:46:05 ambrisko Exp $");
 
 #include "opt_inet.h"
 
@@ -198,7 +198,7 @@
 		/* Allocate aux. memory */
 		sc->mem_aux_rid = PCIR_MAPS + 8;
 		error = an_alloc_aux_memory(dev, sc->mem_aux_rid, 
-		    AN_AUXMEMSIZE);
+		    AN_AUX_MEM_SIZE);
 		if (error) {
 			printf("an%d: couldn't map aux memory\n", unit);
 			goto fail;

==== //depot/projects/uart/dev/an/if_anreg.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/an/if_anreg.h,v 1.17 2003/02/08 04:41:17 ambrisko Exp $
+ * $FreeBSD: src/sys/dev/an/if_anreg.h,v 1.18 2003/08/20 03:46:05 ambrisko Exp $
  */
 
 #define AN_TIMEOUT	65536
@@ -95,7 +95,7 @@
 /*
  * Size of aux. memory space ... probably not needed DJA 
  */
-#define AN_AUXMEMSIZE		(256 * 1024)
+#define AN_AUX_MEM_SIZE		(256 * 1024)
 
 /*
  * Hermes register definitions and what little I know about them.
@@ -181,10 +181,11 @@
 	u_int64_t	an_phys;
 };
 
-#define AN_RID_BUFFER_SIZE	2048
-#define AN_RX_BUFFER_SIZE	1840
-#define AN_TX_BUFFER_SIZE	1840
-#define AN_HOST_DESC_OFFSET 0x8
+#define AN_RID_BUFFER_SIZE	AN_MAX_DATALEN
+#define AN_RX_BUFFER_SIZE	AN_HOSTBUFSIZ
+#define AN_TX_BUFFER_SIZE	AN_HOSTBUFSIZ
+/*#define AN_HOST_DESC_OFFSET	0xC sort of works */
+#define AN_HOST_DESC_OFFSET	0x800
 #define AN_RX_DESC_OFFSET  (AN_HOST_DESC_OFFSET + \
     sizeof(struct an_card_rid_desc))
 #define AN_TX_DESC_OFFSET (AN_RX_DESC_OFFSET + \
@@ -243,7 +244,7 @@
 /* memory handle management registers */
 #define AN_RX_FID		0x20
 #define AN_ALLOC_FID		0x22
-#define AN_TX_CMP_FID		0x24
+#define AN_TX_CMP_FID(x)	(x ? 0x1a : 0x24)
 
 /*
  * Buffer Access Path (BAP) registers.
@@ -276,16 +277,23 @@
 /* Events */
 #define AN_EV_CLR_STUCK_BUSY	0x4000	/* clear stuck busy bit */
 #define AN_EV_WAKEREQUEST	0x2000	/* awaken from PSP mode */
+#define AN_EV_MIC		0x1000	/* Message Integrity Check*/
 #define AN_EV_AWAKE		0x0100	/* station woke up from PSP mode*/
 #define AN_EV_LINKSTAT		0x0080	/* link status available */
 #define AN_EV_CMD		0x0010	/* command completed */
 #define AN_EV_ALLOC		0x0008	/* async alloc/reclaim completed */
+#define AN_EV_TX_CPY		0x0400
 #define AN_EV_TX_EXC		0x0004	/* async xmit completed with failure */
 #define AN_EV_TX		0x0002	/* async xmit completed succesfully */
 #define AN_EV_RX		0x0001	/* async rx completed */
 
-#define AN_INTRS	\
-	(AN_EV_RX|AN_EV_TX|AN_EV_TX_EXC|AN_EV_ALLOC|AN_EV_LINKSTAT)
+#define AN_INTRS(x)	\
+	( x ? (AN_EV_RX|AN_EV_TX|AN_EV_TX_EXC|AN_EV_TX_CPY|AN_EV_ALLOC \
+	       |AN_EV_LINKSTAT|AN_EV_MIC) \
+	  : \
+	      (AN_EV_RX|AN_EV_TX|AN_EV_TX_EXC|AN_EV_ALLOC \
+	       |AN_EV_LINKSTAT|AN_EV_MIC) \
+	      )
 
 /* Host software registers */
 #define AN_SW0(x)		(x ? 0x50 : 0x28)
@@ -458,7 +466,7 @@
 	bus_dma_tag_t		an_dtag;
 	struct an_ltv_genconfig	an_config;
 	struct an_ltv_caps	an_caps;
-	struct an_ltv_ssidlist	an_ssidlist;
+	struct an_ltv_ssidlist_new	an_ssidlist;
 	struct an_ltv_aplist	an_aplist;
         struct an_ltv_key	an_temp_keys[4];
 	int			an_tx_rate;

==== //depot/projects/uart/dev/ath/if_ath.c#7 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.6 2003/08/13 21:29:35 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.12 2003/08/19 22:17:03 sam Exp $");
 
 /*
  * Driver for the Atheros Wireless LAN controller.
@@ -70,10 +70,6 @@
 #include <net/ethernet.h>
 #include <net/if_llc.h>
 
-#include <net80211/ieee80211.h>
-#include <net80211/ieee80211_crypto.h>
-#include <net80211/ieee80211_node.h>
-#include <net80211/ieee80211_proto.h>
 #include <net80211/ieee80211_var.h>
 
 #include <net/bpf.h>
@@ -230,8 +226,8 @@
 		if_printf(ifp, "failed to allocate descriptors: %d\n", error);
 		goto bad;
 	}
-	callout_init(&sc->sc_scan_ch, 0);
-	callout_init(&sc->sc_cal_ch, 0);
+	callout_init(&sc->sc_scan_ch, CALLOUT_MPSAFE);
+	callout_init(&sc->sc_cal_ch, CALLOUT_MPSAFE);
 
 	mtx_init(&sc->sc_txbuflock,
 		device_get_nameunit(sc->sc_dev), "xmit buf q", MTX_DEF);
@@ -695,7 +691,7 @@
 			/*
 			 * Encapsulate the packet in prep for transmission.
 			 */
-			m = ieee80211_encap(ifp, m);
+			m = ieee80211_encap(ifp, m, &ni);
 			if (m == NULL) {
 				DPRINTF(("ath_start: encapsulation failure\n"));
 				sc->sc_stats.ast_tx_encap++;
@@ -705,6 +701,18 @@
 			if (ic->ic_flags & IEEE80211_F_WEPON)
 				wh->i_fc[1] |= IEEE80211_FC1_WEP;
 		} else {
+			/*
+			 * Hack!  The referenced node pointer is in the
+			 * rcvif field of the packet header.  This is
+			 * placed there by ieee80211_mgmt_output because
+			 * we need to hold the reference with the frame
+			 * and there's no other way (other than packet
+			 * tags which we consider too expensive to use)
+			 * to pass it along.
+			 */
+			ni = (struct ieee80211_node *) m->m_pkthdr.rcvif;
+			m->m_pkthdr.rcvif = NULL;
+
 			wh = mtod(m, struct ieee80211_frame *);
 			if ((wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) ==
 			    IEEE80211_FC0_SUBTYPE_PROBE_RESP) {
@@ -724,26 +732,6 @@
 		if (ic->ic_rawbpf)
 			bpf_mtap(ic->ic_rawbpf, m);
 
-		if (ic->ic_opmode != IEEE80211_M_STA) {
-			ni = ieee80211_find_node(ic, wh->i_addr1);
-			if (ni == NULL) {
-				/*
-				 * When not in station mode the destination
-				 * address should always be in the node table
-				 * unless this is a multicast/broadcast frame.
-				 */
-				if (!IEEE80211_IS_MULTICAST(wh->i_addr1) &&
-				    (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
-				    IEEE80211_FC0_TYPE_DATA) {
-					m_freem(m);
-					sc->sc_stats.ast_tx_nonode++;
-					goto bad;
-				}
-				ni = ic->ic_bss;
-			}

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200308200558.h7K5w1Wj023451>