svn commit: r189186 - in projects/jbuild/sys/dev: aac acpi_support acpica adb ae agp an arcmsr atkbdc bce bge bm cardbus ce cfi ciss cm cp ctau cx cxgb/ulp/iw_cxgb dcons de digi e1000 exca fxp hifn...

John Birrell jb at FreeBSD.org
Sat Feb 28 09:58:26 PST 2009


Author: jb
Date: Sat Feb 28 17:58:25 2009
New Revision: 189186
URL: http://svn.freebsd.org/changeset/base/189186

Log:
  MFC

Added:
  projects/jbuild/sys/dev/cfi/cfi_bus_ixp4xx.c
     - copied unchanged from r189173, head/sys/dev/cfi/cfi_bus_ixp4xx.c
  projects/jbuild/sys/dev/ofw/ofw_iicbus.c
     - copied unchanged from r189173, head/sys/dev/ofw/ofw_iicbus.c
Deleted:
  projects/jbuild/sys/dev/digi/con.CX-IBM.h
  projects/jbuild/sys/dev/digi/con.CX.h
  projects/jbuild/sys/dev/digi/con.EPCX.h
  projects/jbuild/sys/dev/digi/con.MBank.h
Modified:
  projects/jbuild/sys/dev/aac/aac.c
  projects/jbuild/sys/dev/aac/aac_debug.c
  projects/jbuild/sys/dev/aac/aac_pci.c
  projects/jbuild/sys/dev/aac/aacreg.h
  projects/jbuild/sys/dev/aac/aacvar.h
  projects/jbuild/sys/dev/acpi_support/acpi_panasonic.c
  projects/jbuild/sys/dev/acpica/acpi_battery.c
  projects/jbuild/sys/dev/acpica/acpi_cpu.c
  projects/jbuild/sys/dev/acpica/acpi_pcib_acpi.c
  projects/jbuild/sys/dev/adb/adb_kbd.c
  projects/jbuild/sys/dev/adb/adb_mouse.c
  projects/jbuild/sys/dev/ae/if_ae.c
  projects/jbuild/sys/dev/agp/agp.c
  projects/jbuild/sys/dev/agp/agp_amd64.c
  projects/jbuild/sys/dev/agp/agp_via.c
  projects/jbuild/sys/dev/an/if_an.c
  projects/jbuild/sys/dev/an/if_anreg.h
  projects/jbuild/sys/dev/arcmsr/arcmsr.c
  projects/jbuild/sys/dev/atkbdc/atkbdc_isa.c
  projects/jbuild/sys/dev/bce/if_bce.c
  projects/jbuild/sys/dev/bce/if_bcefw.h
  projects/jbuild/sys/dev/bce/if_bcereg.h
  projects/jbuild/sys/dev/bge/if_bge.c
  projects/jbuild/sys/dev/bm/if_bm.c
  projects/jbuild/sys/dev/cardbus/cardbus.c
  projects/jbuild/sys/dev/cardbus/cardbus_device.c
  projects/jbuild/sys/dev/ce/if_ce.c
  projects/jbuild/sys/dev/cfi/cfi_core.c
  projects/jbuild/sys/dev/cfi/cfi_dev.c
  projects/jbuild/sys/dev/cfi/cfi_reg.h
  projects/jbuild/sys/dev/cfi/cfi_var.h
  projects/jbuild/sys/dev/ciss/ciss.c
  projects/jbuild/sys/dev/cm/smc90cx6.c
  projects/jbuild/sys/dev/cp/if_cp.c
  projects/jbuild/sys/dev/ctau/if_ct.c
  projects/jbuild/sys/dev/cx/if_cx.c
  projects/jbuild/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c
  projects/jbuild/sys/dev/dcons/dcons_crom.c
  projects/jbuild/sys/dev/dcons/dcons_os.c
  projects/jbuild/sys/dev/de/if_de.c
  projects/jbuild/sys/dev/e1000/if_igb.c
  projects/jbuild/sys/dev/exca/exca.c
  projects/jbuild/sys/dev/fxp/if_fxp.c
  projects/jbuild/sys/dev/hifn/hifn7751.c
  projects/jbuild/sys/dev/hwpmc/hwpmc_core.c
  projects/jbuild/sys/dev/hwpmc/hwpmc_intel.c
  projects/jbuild/sys/dev/hwpmc/pmc_events.h
  projects/jbuild/sys/dev/ichsmb/ichsmb.c
  projects/jbuild/sys/dev/if_ndis/if_ndis.c
  projects/jbuild/sys/dev/if_ndis/if_ndis_pccard.c
  projects/jbuild/sys/dev/if_ndis/if_ndis_pci.c
  projects/jbuild/sys/dev/if_ndis/if_ndis_usb.c
  projects/jbuild/sys/dev/iicbus/ad7418.c
  projects/jbuild/sys/dev/iicbus/ds1672.c
  projects/jbuild/sys/dev/iicbus/icee.c
  projects/jbuild/sys/dev/iicbus/if_ic.c
  projects/jbuild/sys/dev/iicbus/iic.c
  projects/jbuild/sys/dev/iicbus/iic.h
  projects/jbuild/sys/dev/iicbus/iicbb.c
  projects/jbuild/sys/dev/iicbus/iicbus.c
  projects/jbuild/sys/dev/iicbus/iicsmb.c
  projects/jbuild/sys/dev/ipmi/ipmi_acpi.c
  projects/jbuild/sys/dev/ipmi/ipmi_smbios.c
  projects/jbuild/sys/dev/iscsi/initiator/isc_subr.c
  projects/jbuild/sys/dev/iwn/if_iwn.c
  projects/jbuild/sys/dev/kbdmux/kbdmux.c
  projects/jbuild/sys/dev/lmc/if_lmc.c
  projects/jbuild/sys/dev/lmc/if_lmc.h
  projects/jbuild/sys/dev/mca/mca_bus.c
  projects/jbuild/sys/dev/md/md.c
  projects/jbuild/sys/dev/mge/if_mge.c
  projects/jbuild/sys/dev/mge/if_mgevar.h
  projects/jbuild/sys/dev/mmc/mmc.c
  projects/jbuild/sys/dev/mmc/mmcreg.h
  projects/jbuild/sys/dev/mmc/mmcsd.c
  projects/jbuild/sys/dev/msk/if_msk.c
  projects/jbuild/sys/dev/msk/if_mskreg.h
  projects/jbuild/sys/dev/my/if_my.c
  projects/jbuild/sys/dev/nsp/nsp.c
  projects/jbuild/sys/dev/nve/if_nve.c
  projects/jbuild/sys/dev/ofw/ofw_bus_subr.c
  projects/jbuild/sys/dev/ofw/openfirm.c
  projects/jbuild/sys/dev/ofw/openfirm.h
  projects/jbuild/sys/dev/pccard/card_if.m
  projects/jbuild/sys/dev/pccard/pccard.c
  projects/jbuild/sys/dev/pccard/pccard_cis.c
  projects/jbuild/sys/dev/pccard/pccardvar.h
  projects/jbuild/sys/dev/pccard/pccardvarp.h
  projects/jbuild/sys/dev/pccbb/pccbb.c
  projects/jbuild/sys/dev/pccbb/pccbb_pci.c
  projects/jbuild/sys/dev/pccbb/pccbbvar.h
  projects/jbuild/sys/dev/pci/pci.c
  projects/jbuild/sys/dev/pci/pci_user.c
  projects/jbuild/sys/dev/pci/pcireg.h
  projects/jbuild/sys/dev/pcn/if_pcn.c
  projects/jbuild/sys/dev/puc/pucdata.c
  projects/jbuild/sys/dev/re/if_re.c
  projects/jbuild/sys/dev/safe/safe.c
  projects/jbuild/sys/dev/scc/scc_if.m
  projects/jbuild/sys/dev/sdhci/sdhci.c
  projects/jbuild/sys/dev/si/si.c
  projects/jbuild/sys/dev/sis/if_sis.c
  projects/jbuild/sys/dev/smbus/smb.c
  projects/jbuild/sys/dev/snp/snp.c
  projects/jbuild/sys/dev/speaker/spkr.c
  projects/jbuild/sys/dev/stg/tmc18c30.c
  projects/jbuild/sys/dev/streams/streams.c
  projects/jbuild/sys/dev/tl/if_tl.c
  projects/jbuild/sys/dev/tsec/if_tsec.c
  projects/jbuild/sys/dev/tsec/if_tsec.h
  projects/jbuild/sys/dev/tsec/if_tsec_ocp.c
  projects/jbuild/sys/dev/tsec/if_tsecreg.h
  projects/jbuild/sys/dev/tx/if_tx.c
  projects/jbuild/sys/dev/txp/3c990img.h
  projects/jbuild/sys/dev/txp/if_txp.c
  projects/jbuild/sys/dev/txp/if_txpreg.h
  projects/jbuild/sys/dev/uart/uart_bus_pci.c
  projects/jbuild/sys/dev/uart/uart_cpu_mv.c
  projects/jbuild/sys/dev/wpi/if_wpi.c
  projects/jbuild/sys/dev/xen/blkback/blkback.c
  projects/jbuild/sys/dev/xen/netback/netback.c
  projects/jbuild/sys/dev/xen/netfront/netfront.c

Modified: projects/jbuild/sys/dev/aac/aac.c
==============================================================================
--- projects/jbuild/sys/dev/aac/aac.c	Sat Feb 28 17:58:14 2009	(r189185)
+++ projects/jbuild/sys/dev/aac/aac.c	Sat Feb 28 17:58:25 2009	(r189186)
@@ -71,6 +71,7 @@ static void	aac_startup(void *arg);
 static void	aac_add_container(struct aac_softc *sc,
 				  struct aac_mntinforesp *mir, int f);
 static void	aac_get_bus_info(struct aac_softc *sc);
+static void	aac_daemon(void *arg);
 
 /* Command Processing */
 static void	aac_timeout(struct aac_softc *sc);
@@ -292,6 +293,9 @@ aac_attach(struct aac_softc *sc)
 	TAILQ_INIT(&sc->aac_container_tqh);
 	TAILQ_INIT(&sc->aac_ev_cmfree);
 
+	/* Initialize the clock daemon callout. */
+	callout_init_mtx(&sc->aac_daemontime, &sc->aac_io_lock, 0);
+
 	/*
 	 * Initialize the adapter.
 	 */
@@ -349,9 +353,34 @@ aac_attach(struct aac_softc *sc)
 		aac_get_bus_info(sc);
 	}
 
+	mtx_lock(&sc->aac_io_lock);
+	callout_reset(&sc->aac_daemontime, 30 * 60 * hz, aac_daemon, sc);
+	mtx_unlock(&sc->aac_io_lock);
+
 	return(0);
 }
 
+static void
+aac_daemon(void *arg)
+{
+	struct timeval tv;
+	struct aac_softc *sc;
+	struct aac_fib *fib;
+
+	sc = arg;
+	mtx_assert(&sc->aac_io_lock, MA_OWNED);
+
+	if (callout_pending(&sc->aac_daemontime) ||
+	    callout_active(&sc->aac_daemontime) == 0)
+		return;
+	getmicrotime(&tv);
+	aac_alloc_sync_fib(sc, &fib);
+	*(uint32_t *)fib->data = tv.tv_sec;
+	aac_sync_fib(sc, SendHostTime, 0, fib, sizeof(uint32_t));
+	aac_release_sync_fib(sc);
+	callout_schedule(&sc->aac_daemontime, 30 * 60 * hz);
+}
+
 void
 aac_add_event(struct aac_softc *sc, struct aac_event *event)
 {
@@ -632,9 +661,12 @@ aac_free(struct aac_softc *sc)
 		bus_dma_tag_destroy(sc->aac_parent_dmat);
 
 	/* release the register window mapping */
-	if (sc->aac_regs_resource != NULL)
+	if (sc->aac_regs_res0 != NULL)
+		bus_release_resource(sc->aac_dev, SYS_RES_MEMORY,
+				     sc->aac_regs_rid0, sc->aac_regs_res0);
+	if (sc->aac_hwif == AAC_HWIF_NARK && sc->aac_regs_res1 != NULL)
 		bus_release_resource(sc->aac_dev, SYS_RES_MEMORY,
-				     sc->aac_regs_rid, sc->aac_regs_resource);
+				     sc->aac_regs_rid1, sc->aac_regs_res1);
 }
 
 /*
@@ -654,6 +686,8 @@ aac_detach(device_t dev)
 	if (sc->aac_state & AAC_STATE_OPEN)
 		return(EBUSY);
 
+	callout_drain(&sc->aac_daemontime);
+
 	/* Remove the child containers */
 	while ((co = TAILQ_FIRST(&sc->aac_container_tqh)) != NULL) {
 		error = device_delete_child(dev, co->co_disk);
@@ -834,7 +868,7 @@ aac_new_intr(void *arg)
 			}
 			index &= ~2;
 			for (i = 0; i < sizeof(struct aac_fib)/4; ++i)
-				((u_int32_t *)fib)[i] = AAC_GETREG4(sc, index + i*4);
+				((u_int32_t *)fib)[i] = AAC_MEM1_GETREG4(sc, index + i*4);
 			aac_handle_aif(sc, fib);
 			free(fib, M_AACBUF);
 
@@ -1754,26 +1788,33 @@ aac_check_firmware(struct aac_softc *sc)
 
 	/* Remap mem. resource, if required */
 	if ((sc->flags & AAC_FLAGS_NEW_COMM) &&
-		atu_size > rman_get_size(sc->aac_regs_resource)) {
+		atu_size > rman_get_size(sc->aac_regs_res1)) {
 		bus_release_resource(
 			sc->aac_dev, SYS_RES_MEMORY,
-			sc->aac_regs_rid, sc->aac_regs_resource);
-		sc->aac_regs_resource = bus_alloc_resource(
-			sc->aac_dev, SYS_RES_MEMORY, &sc->aac_regs_rid,
+			sc->aac_regs_rid1, sc->aac_regs_res1);
+		sc->aac_regs_res1 = bus_alloc_resource(
+			sc->aac_dev, SYS_RES_MEMORY, &sc->aac_regs_rid1,
 			0ul, ~0ul, atu_size, RF_ACTIVE);
-		if (sc->aac_regs_resource == NULL) {
-			sc->aac_regs_resource = bus_alloc_resource_any(
+		if (sc->aac_regs_res1 == NULL) {
+			sc->aac_regs_res1 = bus_alloc_resource_any(
 				sc->aac_dev, SYS_RES_MEMORY,
-				&sc->aac_regs_rid, RF_ACTIVE);
-			if (sc->aac_regs_resource == NULL) {
+				&sc->aac_regs_rid1, RF_ACTIVE);
+			if (sc->aac_regs_res1 == NULL) {
 				device_printf(sc->aac_dev,
 				    "couldn't allocate register window\n");
 				return (ENXIO);
 			}
 			sc->flags &= ~AAC_FLAGS_NEW_COMM;
 		}
-		sc->aac_btag = rman_get_bustag(sc->aac_regs_resource);
-		sc->aac_bhandle = rman_get_bushandle(sc->aac_regs_resource);
+		sc->aac_btag1 = rman_get_bustag(sc->aac_regs_res1);
+		sc->aac_bhandle1 = rman_get_bushandle(sc->aac_regs_res1);
+
+		if (sc->aac_hwif == AAC_HWIF_NARK) {
+			sc->aac_regs_res0 = sc->aac_regs_res1;
+			sc->aac_regs_rid0 = sc->aac_regs_rid1;
+			sc->aac_btag0 = sc->aac_btag1;
+			sc->aac_bhandle0 = sc->aac_bhandle1;
+		}
 	}
 
 	/* Read preferred settings */
@@ -1944,10 +1985,10 @@ aac_init(struct aac_softc *sc)
 	 */
 	switch (sc->aac_hwif) {
 	case AAC_HWIF_I960RX:
-		AAC_SETREG4(sc, AAC_RX_ODBR, ~0);
+		AAC_MEM0_SETREG4(sc, AAC_RX_ODBR, ~0);
 		break;
 	case AAC_HWIF_RKT:
-		AAC_SETREG4(sc, AAC_RKT_ODBR, ~0);
+		AAC_MEM0_SETREG4(sc, AAC_RKT_ODBR, ~0);
 		break;
 	default:
 		break;
@@ -2367,7 +2408,7 @@ aac_sa_get_fwstatus(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_SA_FWSTATUS));
+	return(AAC_MEM0_GETREG4(sc, AAC_SA_FWSTATUS));
 }
 
 static int
@@ -2375,7 +2416,8 @@ aac_rx_get_fwstatus(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RX_FWSTATUS));
+	return(AAC_MEM0_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
+	    AAC_RX_OMR0 : AAC_RX_FWSTATUS));
 }
 
 static int
@@ -2385,7 +2427,7 @@ aac_fa_get_fwstatus(struct aac_softc *sc
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	val = AAC_GETREG4(sc, AAC_FA_FWSTATUS);
+	val = AAC_MEM0_GETREG4(sc, AAC_FA_FWSTATUS);
 	return (val);
 }
 
@@ -2394,7 +2436,8 @@ aac_rkt_get_fwstatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RKT_FWSTATUS));
+	return(AAC_MEM0_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
+	    AAC_RKT_OMR0 : AAC_RKT_FWSTATUS));
 }
 
 /*
@@ -2406,7 +2449,7 @@ aac_sa_qnotify(struct aac_softc *sc, int
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG2(sc, AAC_SA_DOORBELL1_SET, qbit);
+	AAC_MEM0_SETREG2(sc, AAC_SA_DOORBELL1_SET, qbit);
 }
 
 static void
@@ -2414,7 +2457,7 @@ aac_rx_qnotify(struct aac_softc *sc, int
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RX_IDBR, qbit);
+	AAC_MEM0_SETREG4(sc, AAC_RX_IDBR, qbit);
 }
 
 static void
@@ -2422,7 +2465,7 @@ aac_fa_qnotify(struct aac_softc *sc, int
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG2(sc, AAC_FA_DOORBELL1, qbit);
+	AAC_MEM0_SETREG2(sc, AAC_FA_DOORBELL1, qbit);
 	AAC_FA_HACK(sc);
 }
 
@@ -2431,7 +2474,7 @@ aac_rkt_qnotify(struct aac_softc *sc, in
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RKT_IDBR, qbit);
+	AAC_MEM0_SETREG4(sc, AAC_RKT_IDBR, qbit);
 }
 
 /*
@@ -2442,7 +2485,7 @@ aac_sa_get_istatus(struct aac_softc *sc)
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG2(sc, AAC_SA_DOORBELL0));
+	return(AAC_MEM0_GETREG2(sc, AAC_SA_DOORBELL0));
 }
 
 static int
@@ -2450,7 +2493,7 @@ aac_rx_get_istatus(struct aac_softc *sc)
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RX_ODBR));
+	return(AAC_MEM0_GETREG4(sc, AAC_RX_ODBR));
 }
 
 static int
@@ -2460,7 +2503,7 @@ aac_fa_get_istatus(struct aac_softc *sc)
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	val = AAC_GETREG2(sc, AAC_FA_DOORBELL0);
+	val = AAC_MEM0_GETREG2(sc, AAC_FA_DOORBELL0);
 	return (val);
 }
 
@@ -2469,7 +2512,7 @@ aac_rkt_get_istatus(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RKT_ODBR));
+	return(AAC_MEM0_GETREG4(sc, AAC_RKT_ODBR));
 }
 
 /*
@@ -2480,7 +2523,7 @@ aac_sa_clear_istatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG2(sc, AAC_SA_DOORBELL0_CLEAR, mask);
+	AAC_MEM0_SETREG2(sc, AAC_SA_DOORBELL0_CLEAR, mask);
 }
 
 static void
@@ -2488,7 +2531,7 @@ aac_rx_clear_istatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RX_ODBR, mask);
+	AAC_MEM0_SETREG4(sc, AAC_RX_ODBR, mask);
 }
 
 static void
@@ -2496,7 +2539,7 @@ aac_fa_clear_istatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG2(sc, AAC_FA_DOORBELL0_CLEAR, mask);
+	AAC_MEM0_SETREG2(sc, AAC_FA_DOORBELL0_CLEAR, mask);
 	AAC_FA_HACK(sc);
 }
 
@@ -2505,7 +2548,7 @@ aac_rkt_clear_istatus(struct aac_softc *
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RKT_ODBR, mask);
+	AAC_MEM0_SETREG4(sc, AAC_RKT_ODBR, mask);
 }
 
 /*
@@ -2517,11 +2560,11 @@ aac_sa_set_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_SA_MAILBOX, command);
-	AAC_SETREG4(sc, AAC_SA_MAILBOX + 4, arg0);
-	AAC_SETREG4(sc, AAC_SA_MAILBOX + 8, arg1);
-	AAC_SETREG4(sc, AAC_SA_MAILBOX + 12, arg2);
-	AAC_SETREG4(sc, AAC_SA_MAILBOX + 16, arg3);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX, command);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX + 4, arg0);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX + 8, arg1);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX + 12, arg2);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX + 16, arg3);
 }
 
 static void
@@ -2530,11 +2573,11 @@ aac_rx_set_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RX_MAILBOX, command);
-	AAC_SETREG4(sc, AAC_RX_MAILBOX + 4, arg0);
-	AAC_SETREG4(sc, AAC_RX_MAILBOX + 8, arg1);
-	AAC_SETREG4(sc, AAC_RX_MAILBOX + 12, arg2);
-	AAC_SETREG4(sc, AAC_RX_MAILBOX + 16, arg3);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX, command);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX + 4, arg0);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX + 8, arg1);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX + 12, arg2);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX + 16, arg3);
 }
 
 static void
@@ -2543,15 +2586,15 @@ aac_fa_set_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_FA_MAILBOX, command);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX, command);
 	AAC_FA_HACK(sc);
-	AAC_SETREG4(sc, AAC_FA_MAILBOX + 4, arg0);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 4, arg0);
 	AAC_FA_HACK(sc);
-	AAC_SETREG4(sc, AAC_FA_MAILBOX + 8, arg1);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 8, arg1);
 	AAC_FA_HACK(sc);
-	AAC_SETREG4(sc, AAC_FA_MAILBOX + 12, arg2);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 12, arg2);
 	AAC_FA_HACK(sc);
-	AAC_SETREG4(sc, AAC_FA_MAILBOX + 16, arg3);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 16, arg3);
 	AAC_FA_HACK(sc);
 }
 
@@ -2561,11 +2604,11 @@ aac_rkt_set_mailbox(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX, command);
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX + 4, arg0);
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX + 8, arg1);
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX + 12, arg2);
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX + 16, arg3);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX, command);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX + 4, arg0);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX + 8, arg1);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX + 12, arg2);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX + 16, arg3);
 }
 
 /*
@@ -2576,7 +2619,7 @@ aac_sa_get_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_SA_MAILBOX + (mb * 4)));
+	return(AAC_MEM1_GETREG4(sc, AAC_SA_MAILBOX + (mb * 4)));
 }
 
 static int
@@ -2584,7 +2627,7 @@ aac_rx_get_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RX_MAILBOX + (mb * 4)));
+	return(AAC_MEM1_GETREG4(sc, AAC_RX_MAILBOX + (mb * 4)));
 }
 
 static int
@@ -2594,7 +2637,7 @@ aac_fa_get_mailbox(struct aac_softc *sc,
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	val = AAC_GETREG4(sc, AAC_FA_MAILBOX + (mb * 4));
+	val = AAC_MEM1_GETREG4(sc, AAC_FA_MAILBOX + (mb * 4));
 	return (val);
 }
 
@@ -2603,7 +2646,7 @@ aac_rkt_get_mailbox(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RKT_MAILBOX + (mb * 4)));
+	return(AAC_MEM1_GETREG4(sc, AAC_RKT_MAILBOX + (mb * 4)));
 }
 
 /*
@@ -2615,9 +2658,9 @@ aac_sa_set_interrupts(struct aac_softc *
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "%sable interrupts", enable ? "en" : "dis");
 
 	if (enable) {
-		AAC_SETREG2((sc), AAC_SA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
+		AAC_MEM0_SETREG2((sc), AAC_SA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
 	} else {
-		AAC_SETREG2((sc), AAC_SA_MASK0_SET, ~0);
+		AAC_MEM0_SETREG2((sc), AAC_SA_MASK0_SET, ~0);
 	}
 }
 
@@ -2628,11 +2671,11 @@ aac_rx_set_interrupts(struct aac_softc *
 
 	if (enable) {
 		if (sc->flags & AAC_FLAGS_NEW_COMM)
-			AAC_SETREG4(sc, AAC_RX_OIMR, ~AAC_DB_INT_NEW_COMM);
+			AAC_MEM0_SETREG4(sc, AAC_RX_OIMR, ~AAC_DB_INT_NEW_COMM);
 		else
-			AAC_SETREG4(sc, AAC_RX_OIMR, ~AAC_DB_INTERRUPTS);
+			AAC_MEM0_SETREG4(sc, AAC_RX_OIMR, ~AAC_DB_INTERRUPTS);
 	} else {
-		AAC_SETREG4(sc, AAC_RX_OIMR, ~0);
+		AAC_MEM0_SETREG4(sc, AAC_RX_OIMR, ~0);
 	}
 }
 
@@ -2642,10 +2685,10 @@ aac_fa_set_interrupts(struct aac_softc *
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "%sable interrupts", enable ? "en" : "dis");
 
 	if (enable) {
-		AAC_SETREG2((sc), AAC_FA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
+		AAC_MEM0_SETREG2((sc), AAC_FA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
 		AAC_FA_HACK(sc);
 	} else {
-		AAC_SETREG2((sc), AAC_FA_MASK0, ~0);
+		AAC_MEM0_SETREG2((sc), AAC_FA_MASK0, ~0);
 		AAC_FA_HACK(sc);
 	}
 }
@@ -2657,11 +2700,11 @@ aac_rkt_set_interrupts(struct aac_softc 
 
 	if (enable) {
 		if (sc->flags & AAC_FLAGS_NEW_COMM)
-			AAC_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INT_NEW_COMM);
+			AAC_MEM0_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INT_NEW_COMM);
 		else
-			AAC_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INTERRUPTS);
+			AAC_MEM0_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INTERRUPTS);
 	} else {
-		AAC_SETREG4(sc, AAC_RKT_OIMR, ~0);
+		AAC_MEM0_SETREG4(sc, AAC_RKT_OIMR, ~0);
 	}
 }
 
@@ -2675,19 +2718,19 @@ aac_rx_send_command(struct aac_softc *sc
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "send command (new comm.)");
 
-	index = AAC_GETREG4(sc, AAC_RX_IQUE);
+	index = AAC_MEM0_GETREG4(sc, AAC_RX_IQUE);
 	if (index == 0xffffffffL)
-		index = AAC_GETREG4(sc, AAC_RX_IQUE);
+		index = AAC_MEM0_GETREG4(sc, AAC_RX_IQUE);
 	if (index == 0xffffffffL)
 		return index;
 	aac_enqueue_busy(cm);
 	device = index;
-	AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys & 0xffffffffUL));
+	AAC_MEM1_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys & 0xffffffffUL));
 	device += 4;
-	AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32));
+	AAC_MEM1_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32));
 	device += 4;
-	AAC_SETREG4(sc, device, cm->cm_fib->Header.Size);
-	AAC_SETREG4(sc, AAC_RX_IQUE, index);
+	AAC_MEM1_SETREG4(sc, device, cm->cm_fib->Header.Size);
+	AAC_MEM0_SETREG4(sc, AAC_RX_IQUE, index);
 	return 0;
 }
 
@@ -2698,19 +2741,19 @@ aac_rkt_send_command(struct aac_softc *s
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "send command (new comm.)");
 
-	index = AAC_GETREG4(sc, AAC_RKT_IQUE);
+	index = AAC_MEM0_GETREG4(sc, AAC_RKT_IQUE);
 	if (index == 0xffffffffL)
-		index = AAC_GETREG4(sc, AAC_RKT_IQUE);
+		index = AAC_MEM0_GETREG4(sc, AAC_RKT_IQUE);
 	if (index == 0xffffffffL)
 		return index;
 	aac_enqueue_busy(cm);
 	device = index;
-	AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys & 0xffffffffUL));
+	AAC_MEM1_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys & 0xffffffffUL));
 	device += 4;
-	AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32));
+	AAC_MEM1_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32));
 	device += 4;
-	AAC_SETREG4(sc, device, cm->cm_fib->Header.Size);
-	AAC_SETREG4(sc, AAC_RKT_IQUE, index);
+	AAC_MEM1_SETREG4(sc, device, cm->cm_fib->Header.Size);
+	AAC_MEM0_SETREG4(sc, AAC_RKT_IQUE, index);
 	return 0;
 }
 
@@ -2722,7 +2765,7 @@ aac_rx_get_outb_queue(struct aac_softc *
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RX_OQUE));
+	return(AAC_MEM0_GETREG4(sc, AAC_RX_OQUE));
 }
 
 static int
@@ -2730,7 +2773,7 @@ aac_rkt_get_outb_queue(struct aac_softc 
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RKT_OQUE));
+	return(AAC_MEM0_GETREG4(sc, AAC_RKT_OQUE));
 }
 
 static void
@@ -2738,7 +2781,7 @@ aac_rx_set_outb_queue(struct aac_softc *
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RX_OQUE, index);
+	AAC_MEM0_SETREG4(sc, AAC_RX_OQUE, index);
 }
 
 static void
@@ -2746,7 +2789,7 @@ aac_rkt_set_outb_queue(struct aac_softc 
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RKT_OQUE, index);
+	AAC_MEM0_SETREG4(sc, AAC_RKT_OQUE, index);
 }
 
 /*

Modified: projects/jbuild/sys/dev/aac/aac_debug.c
==============================================================================
--- projects/jbuild/sys/dev/aac/aac_debug.c	Sat Feb 28 17:58:14 2009	(r189185)
+++ projects/jbuild/sys/dev/aac/aac_debug.c	Sat Feb 28 17:58:25 2009	(r189186)
@@ -134,17 +134,18 @@ aac_printstate0(void)
 	aac_print_queues(sc);
 	switch (sc->aac_hwif) {
 	case AAC_HWIF_I960RX:
+	case AAC_HWIF_NARK:
 		device_printf(sc->aac_dev, "IDBR 0x%08x  IIMR 0x%08x  "
-		    "IISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_IDBR),
-		    AAC_GETREG4(sc, AAC_RX_IIMR), AAC_GETREG4(sc, AAC_RX_IISR));
+		    "IISR 0x%08x\n", AAC_MEM0_GETREG4(sc, AAC_RX_IDBR),
+		    AAC_MEM0_GETREG4(sc, AAC_RX_IIMR), AAC_MEM0_GETREG4(sc, AAC_RX_IISR));
 		device_printf(sc->aac_dev, "ODBR 0x%08x  OIMR 0x%08x  "
-		    "OISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_ODBR),
-		    AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR));
-		AAC_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY |
+		    "OISR 0x%08x\n", AAC_MEM0_GETREG4(sc, AAC_RX_ODBR),
+		    AAC_MEM0_GETREG4(sc, AAC_RX_OIMR), AAC_MEM0_GETREG4(sc, AAC_RX_OISR));
+		AAC_MEM0_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY |
 			    AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)*/);
 		device_printf(sc->aac_dev, "ODBR 0x%08x  OIMR 0x%08x  "
-		    "OISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_ODBR),
-		    AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR));
+		    "OISR 0x%08x\n", AAC_MEM0_GETREG4(sc, AAC_RX_ODBR),
+		    AAC_MEM0_GETREG4(sc, AAC_RX_OIMR), AAC_MEM0_GETREG4(sc, AAC_RX_OISR));
 		break;
 	case AAC_HWIF_STRONGARM:
 		/* XXX implement */

Modified: projects/jbuild/sys/dev/aac/aac_pci.c
==============================================================================
--- projects/jbuild/sys/dev/aac/aac_pci.c	Sat Feb 28 17:58:14 2009	(r189185)
+++ projects/jbuild/sys/dev/aac/aac_pci.c	Sat Feb 28 17:58:25 2009	(r189186)
@@ -372,21 +372,32 @@ aac_pci_attach(device_t dev)
 	/*
 	 * Allocate the PCI register window.
 	 */
-	sc->aac_regs_rid = PCIR_BAR(0);
-	if ((sc->aac_regs_resource = bus_alloc_resource_any(sc->aac_dev,
-							    SYS_RES_MEMORY,
-							    &sc->aac_regs_rid,
-							    RF_ACTIVE)) ==
-							    NULL) {
+	sc->aac_regs_rid0 = PCIR_BAR(0);
+	if ((sc->aac_regs_res0 = bus_alloc_resource_any(sc->aac_dev,
+	    SYS_RES_MEMORY, &sc->aac_regs_rid0, RF_ACTIVE)) == NULL) {
 		device_printf(sc->aac_dev,
-			      "couldn't allocate register window\n");
+		    "couldn't allocate register window 0\n");
 		goto out;
 	}
-	sc->aac_btag = rman_get_bustag(sc->aac_regs_resource);
-	sc->aac_bhandle = rman_get_bushandle(sc->aac_regs_resource);
+	sc->aac_btag0 = rman_get_bustag(sc->aac_regs_res0);
+	sc->aac_bhandle0 = rman_get_bushandle(sc->aac_regs_res0);
 
-	/* assume failure is 'out of memory' */
-	error = ENOMEM;
+	if (sc->aac_hwif == AAC_HWIF_NARK) {
+		sc->aac_regs_rid1 = PCIR_BAR(1);
+		if ((sc->aac_regs_res1 = bus_alloc_resource_any(sc->aac_dev,
+		    SYS_RES_MEMORY, &sc->aac_regs_rid1, RF_ACTIVE)) == NULL) {
+			device_printf(sc->aac_dev,
+			    "couldn't allocate register window 1\n");
+			goto out;
+		}
+		sc->aac_btag1 = rman_get_bustag(sc->aac_regs_res1);
+		sc->aac_bhandle1 = rman_get_bushandle(sc->aac_regs_res1);
+	} else {
+		sc->aac_regs_res1 = sc->aac_regs_res0;
+		sc->aac_regs_rid1 = sc->aac_regs_rid0;
+		sc->aac_btag1 = sc->aac_btag0;
+		sc->aac_bhandle1 = sc->aac_bhandle0;
+	}
 
 	/*
 	 * Allocate the parent bus DMA tag appropriate for our PCI interface.
@@ -416,7 +427,8 @@ aac_pci_attach(device_t dev)
 	sc->aac_hwif = id->hwif;
 	switch(sc->aac_hwif) {
 	case AAC_HWIF_I960RX:
-		fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for i960Rx");
+	case AAC_HWIF_NARK:
+		fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for i960Rx/NARK");
 		sc->aac_if = aac_rx_interface;
 		break;
 	case AAC_HWIF_STRONGARM:

Modified: projects/jbuild/sys/dev/aac/aacreg.h
==============================================================================
--- projects/jbuild/sys/dev/aac/aacreg.h	Sat Feb 28 17:58:14 2009	(r189185)
+++ projects/jbuild/sys/dev/aac/aacreg.h	Sat Feb 28 17:58:25 2009	(r189186)
@@ -1468,7 +1468,7 @@ enum {
 #define	AAC_FA_FWSTATUS			0x2c	/* Mailbox 7 */
 #define	AAC_FA_INTSRC			0x900
 
-#define AAC_FA_HACK(sc)	(void)AAC_GETREG4(sc, AAC_FA_INTSRC)
+#define AAC_FA_HACK(sc)	(void)AAC_MEM0_GETREG4(sc, AAC_FA_INTSRC)
 
 /*
  * Register definitions for the Adaptec AAC-364 'Jalapeno I/II' adapters, based
@@ -1495,6 +1495,8 @@ enum {
  * and other related adapters.
  */
 
+#define AAC_RX_OMR0		0x18	/* outbound message register 0 */
+#define AAC_RX_OMR1		0x1c	/* outbound message register 1 */
 #define AAC_RX_IDBR		0x20	/* inbound doorbell register */
 #define AAC_RX_IISR		0x24	/* inbound interrupt status register */
 #define AAC_RX_IIMR		0x28	/* inbound interrupt mask register */
@@ -1512,6 +1514,8 @@ enum {
  * Unsurprisingly, it's quite similar to the i960!
  */
 
+#define AAC_RKT_OMR0		0x18	/* outbound message register 0 */
+#define AAC_RKT_OMR1		0x1c	/* outbound message register 1 */
 #define AAC_RKT_IDBR		0x20	/* inbound doorbell register */
 #define AAC_RKT_IISR		0x24	/* inbound interrupt status register */
 #define AAC_RKT_IIMR		0x28	/* inbound interrupt mask register */

Modified: projects/jbuild/sys/dev/aac/aacvar.h
==============================================================================
--- projects/jbuild/sys/dev/aac/aacvar.h	Sat Feb 28 17:58:14 2009	(r189185)
+++ projects/jbuild/sys/dev/aac/aacvar.h	Sat Feb 28 17:58:25 2009	(r189186)
@@ -30,6 +30,7 @@
  */
 
 #include <sys/bio.h>
+#include <sys/callout.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/taskqueue.h>
@@ -259,18 +260,31 @@ extern struct aac_interface	aac_rkt_inte
 #define AAC_GET_OUTB_QUEUE(sc)		((sc)->aac_if.aif_get_outb_queue((sc)))
 #define AAC_SET_OUTB_QUEUE(sc, idx)	((sc)->aac_if.aif_set_outb_queue((sc), (idx)))
 
-#define AAC_SETREG4(sc, reg, val)	bus_space_write_4(sc->aac_btag, \
-					sc->aac_bhandle, reg, val)
-#define AAC_GETREG4(sc, reg)		bus_space_read_4 (sc->aac_btag, \
-					sc->aac_bhandle, reg)
-#define AAC_SETREG2(sc, reg, val)	bus_space_write_2(sc->aac_btag, \
-					sc->aac_bhandle, reg, val)
-#define AAC_GETREG2(sc, reg)		bus_space_read_2 (sc->aac_btag, \
-					sc->aac_bhandle, reg)
-#define AAC_SETREG1(sc, reg, val)	bus_space_write_1(sc->aac_btag, \
-					sc->aac_bhandle, reg, val)
-#define AAC_GETREG1(sc, reg)		bus_space_read_1 (sc->aac_btag, \
-					sc->aac_bhandle, reg)
+#define AAC_MEM0_SETREG4(sc, reg, val)	bus_space_write_4(sc->aac_btag0, \
+					sc->aac_bhandle0, reg, val)
+#define AAC_MEM0_GETREG4(sc, reg)	bus_space_read_4(sc->aac_btag0, \
+					sc->aac_bhandle0, reg)
+#define AAC_MEM0_SETREG2(sc, reg, val)	bus_space_write_2(sc->aac_btag0, \
+					sc->aac_bhandle0, reg, val)
+#define AAC_MEM0_GETREG2(sc, reg)	bus_space_read_2(sc->aac_btag0, \
+					sc->aac_bhandle0, reg)
+#define AAC_MEM0_SETREG1(sc, reg, val)	bus_space_write_1(sc->aac_btag0, \
+					sc->aac_bhandle0, reg, val)
+#define AAC_MEM0_GETREG1(sc, reg)	bus_space_read_1(sc->aac_btag0, \
+					sc->aac_bhandle0, reg)
+
+#define AAC_MEM1_SETREG4(sc, reg, val)	bus_space_write_4(sc->aac_btag1, \
+					sc->aac_bhandle1, reg, val)
+#define AAC_MEM1_GETREG4(sc, reg)	bus_space_read_4(sc->aac_btag1, \
+					sc->aac_bhandle1, reg)
+#define AAC_MEM1_SETREG2(sc, reg, val)	bus_space_write_2(sc->aac_btag1, \
+					sc->aac_bhandle1, reg, val)
+#define AAC_MEM1_GETREG2(sc, reg)	bus_space_read_2(sc->aac_btag1, \
+					sc->aac_bhandle1, reg)
+#define AAC_MEM1_SETREG1(sc, reg, val)	bus_space_write_1(sc->aac_btag1, \
+					sc->aac_bhandle1, reg, val)
+#define AAC_MEM1_GETREG1(sc, reg)	bus_space_read_1(sc->aac_btag1, \
+					sc->aac_bhandle1, reg)
 
 /* fib context (IOCTL) */
 struct aac_fib_context {
@@ -287,11 +301,10 @@ struct aac_softc 
 {
 	/* bus connections */
 	device_t		aac_dev;
-	struct resource		*aac_regs_resource;	/* register interface
-							 * window */
-	int			aac_regs_rid;		/* resource ID */
-	bus_space_handle_t	aac_bhandle;		/* bus space handle */
-	bus_space_tag_t		aac_btag;		/* bus space tag */
+	struct resource		*aac_regs_res0, *aac_regs_res1; /* reg. if. window */
+	int			aac_regs_rid0, aac_regs_rid1;		/* resource ID */
+	bus_space_handle_t	aac_bhandle0, aac_bhandle1;		/* bus space handle */
+	bus_space_tag_t		aac_btag0, aac_btag1;		/* bus space tag */
 	bus_dma_tag_t		aac_parent_dmat;	/* parent DMA tag */
 	bus_dma_tag_t		aac_buffer_dmat;	/* data buffer/command
 							 * DMA tag */
@@ -315,6 +328,7 @@ struct aac_softc 
 #define AAC_HWIF_STRONGARM	1
 #define AAC_HWIF_FALCON		2
 #define AAC_HWIF_RKT		3
+#define	AAC_HWIF_NARK		4
 #define AAC_HWIF_UNKNOWN	-1
 	bus_dma_tag_t		aac_common_dmat;	/* common structure
 							 * DMA tag */
@@ -398,6 +412,8 @@ struct aac_softc 
 	u_int32_t		scsi_method_id;
 	TAILQ_HEAD(,aac_sim)	aac_sim_tqh;
 
+	struct callout	aac_daemontime;		/* clock daemon callout */
+
 	u_int32_t	aac_max_fibs;           /* max. FIB count */
 	u_int32_t	aac_max_fibs_alloc;		/* max. alloc. per alloc_commands() */
 	u_int32_t	aac_max_fib_size;		/* max. FIB size */

Modified: projects/jbuild/sys/dev/acpi_support/acpi_panasonic.c
==============================================================================
--- projects/jbuild/sys/dev/acpi_support/acpi_panasonic.c	Sat Feb 28 17:58:14 2009	(r189185)
+++ projects/jbuild/sys/dev/acpi_support/acpi_panasonic.c	Sat Feb 28 17:58:25 2009	(r189186)
@@ -79,7 +79,7 @@ typedef int hkey_fn_t(ACPI_HANDLE, int, 
 static int	acpi_panasonic_probe(device_t dev);
 static int	acpi_panasonic_attach(device_t dev);
 static int	acpi_panasonic_detach(device_t dev);
-static void	acpi_panasonic_shutdown(device_t dev);
+static int	acpi_panasonic_shutdown(device_t dev);
 static int	acpi_panasonic_sysctl(SYSCTL_HANDLER_ARGS);
 static ACPI_INTEGER acpi_panasonic_sinf(ACPI_HANDLE h, ACPI_INTEGER index);
 static void	acpi_panasonic_sset(ACPI_HANDLE h, ACPI_INTEGER index,
@@ -220,7 +220,7 @@ acpi_panasonic_detach(device_t dev)
 	return (0);
 }
 
-static void
+static int
 acpi_panasonic_shutdown(device_t dev)
 {
 	struct acpi_panasonic_softc *sc;
@@ -230,6 +230,7 @@ acpi_panasonic_shutdown(device_t dev)
 	sc = device_get_softc(dev);
 	mute = 1;
 	hkey_sound_mute(sc->handle, HKEY_SET, &mute);
+	return (0);
 }
 
 static int

Modified: projects/jbuild/sys/dev/acpica/acpi_battery.c
==============================================================================
--- projects/jbuild/sys/dev/acpica/acpi_battery.c	Sat Feb 28 17:58:14 2009	(r189185)
+++ projects/jbuild/sys/dev/acpica/acpi_battery.c	Sat Feb 28 17:58:25 2009	(r189186)
@@ -197,7 +197,7 @@ acpi_battery_get_battinfo(device_t dev, 
 	 * is 0 (due to some error reading the battery), skip this
 	 * conversion.
 	 */
-	if (bif->units == ACPI_BIF_UNITS_MA && bif->dvol != 0) {
+	if (bif->units == ACPI_BIF_UNITS_MA && bif->dvol != 0 && dev == NULL) {
 	    bst[i].rate = (bst[i].rate * bif->dvol) / 1000;
 	    bst[i].cap = (bst[i].cap * bif->dvol) / 1000;
 	    bif->lfcap = (bif->lfcap * bif->dvol) / 1000;

Modified: projects/jbuild/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- projects/jbuild/sys/dev/acpica/acpi_cpu.c	Sat Feb 28 17:58:14 2009	(r189185)
+++ projects/jbuild/sys/dev/acpica/acpi_cpu.c	Sat Feb 28 17:58:25 2009	(r189186)
@@ -1082,6 +1082,10 @@ acpi_cpu_quirks(void)
 	 *
 	 * Also, make sure that all interrupts cause a "Stop Break"
 	 * event to exit from C2 state.
+	 * Also, BRLD_EN_BM (ACPI_BITREG_BUS_MASTER_RLD in ACPI-speak)
+	 * should be set to zero, otherwise it causes C2 to short-sleep.
+	 * PIIX4 doesn't properly support C3 and bus master activity
+	 * need not break out of C2.
 	 */
 	case PCI_REVISION_A_STEP:
 	case PCI_REVISION_B_STEP:
@@ -1094,10 +1098,16 @@ acpi_cpu_quirks(void)
 	    val = pci_read_config(acpi_dev, PIIX4_DEVACTB_REG, 4);
 	    if ((val & PIIX4_STOP_BREAK_MASK) != PIIX4_STOP_BREAK_MASK) {
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-		    "PIIX4: enabling IRQs to generate Stop Break\n"));
+		    "acpi_cpu: PIIX4: enabling IRQs to generate Stop Break\n"));
 	    	val |= PIIX4_STOP_BREAK_MASK;
 		pci_write_config(acpi_dev, PIIX4_DEVACTB_REG, val, 4);
 	    }
+	    AcpiGetRegister(ACPI_BITREG_BUS_MASTER_RLD, &val);
+	    if (val) {
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+		    "acpi_cpu: PIIX4: reset BRLD_EN_BM\n"));
+		AcpiSetRegister(ACPI_BITREG_BUS_MASTER_RLD, 0);
+	    }
 	    break;
 	default:
 	    break;

Modified: projects/jbuild/sys/dev/acpica/acpi_pcib_acpi.c
==============================================================================
--- projects/jbuild/sys/dev/acpica/acpi_pcib_acpi.c	Sat Feb 28 17:58:14 2009	(r189185)
+++ projects/jbuild/sys/dev/acpica/acpi_pcib_acpi.c	Sat Feb 28 17:58:25 2009	(r189186)
@@ -68,10 +68,11 @@ static int		acpi_pcib_read_ivar(device_t
 			    int which, uintptr_t *result);
 static int		acpi_pcib_write_ivar(device_t dev, device_t child,
 			    int which, uintptr_t value);
-static uint32_t		acpi_pcib_read_config(device_t dev, int bus, int slot,
-			    int func, int reg, int bytes);
-static void		acpi_pcib_write_config(device_t dev, int bus, int slot,
-			    int func, int reg, uint32_t data, int bytes);
+static uint32_t		acpi_pcib_read_config(device_t dev, u_int bus,
+			    u_int slot, u_int func, u_int reg, int bytes);
+static void		acpi_pcib_write_config(device_t dev, u_int bus,
+			    u_int slot, u_int func, u_int reg, uint32_t data,
+			    int bytes);
 static int		acpi_pcib_acpi_route_interrupt(device_t pcib,
 			    device_t dev, int pin);
 static int		acpi_pcib_alloc_msi(device_t pcib, device_t dev,
@@ -297,15 +298,15 @@ acpi_pcib_write_ivar(device_t dev, devic
 }
 
 static uint32_t
-acpi_pcib_read_config(device_t dev, int bus, int slot, int func, int reg,
-    int bytes)
+acpi_pcib_read_config(device_t dev, u_int bus, u_int slot, u_int func,
+    u_int reg, int bytes)
 {
     return (pci_cfgregread(bus, slot, func, reg, bytes));
 }
 
 static void
-acpi_pcib_write_config(device_t dev, int bus, int slot, int func, int reg,
-    uint32_t data, int bytes)
+acpi_pcib_write_config(device_t dev, u_int bus, u_int slot, u_int func,
+    u_int reg, uint32_t data, int bytes)
 {
     pci_cfgregwrite(bus, slot, func, reg, data, bytes);
 }

Modified: projects/jbuild/sys/dev/adb/adb_kbd.c
==============================================================================
--- projects/jbuild/sys/dev/adb/adb_kbd.c	Sat Feb 28 17:58:14 2009	(r189185)
+++ projects/jbuild/sys/dev/adb/adb_kbd.c	Sat Feb 28 17:58:25 2009	(r189186)
@@ -72,6 +72,9 @@ struct adb_kbd_softc {
 	int have_led_control;
 
 	uint8_t buffer[8];
+#ifdef AKBD_EMULATE_ATKBD
+	uint8_t at_buffered_char[2];
+#endif
 	volatile int buffers;
 
 	struct callout sc_repeater;
@@ -105,6 +108,17 @@ static devclass_t adb_kbd_devclass;
 
 DRIVER_MODULE(akbd, adb, adb_kbd_driver, adb_kbd_devclass, 0, 0);
 
+#ifdef AKBD_EMULATE_ATKBD
+
+#define	SCAN_PRESS		0x000
+#define	SCAN_RELEASE		0x080
+#define	SCAN_PREFIX_E0		0x100
+#define	SCAN_PREFIX_E1		0x200
+#define	SCAN_PREFIX_CTL		0x400
+#define	SCAN_PREFIX_SHIFT	0x800
+#define	SCAN_PREFIX		(SCAN_PREFIX_E0 | SCAN_PREFIX_E1 |	\
+				SCAN_PREFIX_CTL | SCAN_PREFIX_SHIFT)
+
 static const uint8_t adb_to_at_scancode_map[128] = { 30, 31, 32, 33, 35, 34, 
 	44, 45, 46, 47, 0, 48, 16, 17, 18, 19, 21, 20, 2, 3, 4, 5, 7, 6, 13, 
 	10, 8, 12, 9, 11, 27, 24, 22, 26, 23, 25, 28, 38, 36, 40, 37, 39, 43, 
@@ -114,6 +128,47 @@ static const uint8_t adb_to_at_scancode_
 	66, 67, 0, 87, 0, 105, 0, 70, 0, 68, 0, 88, 0, 107, 102, 94, 96, 103, 
 	62, 99, 60, 101, 59, 54, 93, 90, 0, 0 };
 
+static int
+keycode2scancode(int keycode, int shift, int up)
+{
+	static const int scan[] = {
+		/* KP enter, right ctrl, KP divide */
+		0x1c , 0x1d , 0x35 ,
+		/* print screen */
+		0x37 | SCAN_PREFIX_SHIFT,
+		/* right alt, home, up, page up, left, right, end */
+		0x38, 0x47, 0x48, 0x49, 0x4b, 0x4d, 0x4f,
+		/* down, page down, insert, delete */
+		0x50, 0x51, 0x52, 0x53,
+		/* pause/break (see also below) */
+		0x46,
+		/*
+		 * MS: left window, right window, menu
+		 * also Sun: left meta, right meta, compose
+		 */
+		0x5b, 0x5c, 0x5d,
+		/* Sun type 6 USB */
+		/* help, stop, again, props, undo, front, copy */
+		0x68, 0x5e, 0x5f, 0x60,	0x61, 0x62, 0x63,
+		/* open, paste, find, cut, audiomute, audiolower, audioraise */
+		0x64, 0x65, 0x66, 0x67, 0x25, 0x1f, 0x1e,
+		/* power */
+		0x20
+	};
+	int scancode;
+
+	scancode = keycode;
+	if ((keycode >= 89) && (keycode < 89 + sizeof(scan) / sizeof(scan[0])))
+	scancode = scan[keycode - 89] | SCAN_PREFIX_E0;
+	/* pause/break */
+	if ((keycode == 104) && !(shift & CTLS))
+		scancode = 0x45 | SCAN_PREFIX_E1 | SCAN_PREFIX_CTL;
+	if (shift & SHIFTS)
+		scancode &= ~SCAN_PREFIX_SHIFT;
+	return (scancode | (up ? SCAN_RELEASE : SCAN_PRESS));
+}
+#endif
+
 /* keyboard driver declaration */
 static int              akbd_configure(int flags);
 static kbd_probe_t      akbd_probe;
@@ -468,6 +523,13 @@ akbd_check(keyboard_t *kbd) 
 	sc = (struct adb_kbd_softc *)(kbd);
 
 	mtx_lock(&sc->sc_mutex);
+#ifdef AKBD_EMULATE_ATKBD
+		if (sc->at_buffered_char[0]) {
+			mtx_unlock(&sc->sc_mutex);
+			return (TRUE);
+		}
+#endif
+
 		if (sc->buffers > 0) {
 			mtx_unlock(&sc->sc_mutex);
 			return (TRUE); 
@@ -481,36 +543,89 @@ static u_int 
 akbd_read_char(keyboard_t *kbd, int wait) 
 {
 	struct adb_kbd_softc *sc;
-	uint8_t adb_code, final_scancode;
+	uint16_t key;
+	uint8_t adb_code;
 	int i;
 
 	sc = (struct adb_kbd_softc *)(kbd);
 
 	mtx_lock(&sc->sc_mutex);
-		if (!sc->buffers && wait)
-			cv_wait(&sc->sc_cv,&sc->sc_mutex);
 
-		if (!sc->buffers) {
-			mtx_unlock(&sc->sc_mutex);
-			return (0);
+#if defined(AKBD_EMULATE_ATKBD)
+	if (sc->sc_mode == K_RAW && sc->at_buffered_char[0]) {
+		key = sc->at_buffered_char[0];
+		if (key & SCAN_PREFIX) {
+			sc->at_buffered_char[0] = key & ~SCAN_PREFIX;
+			key = (key & SCAN_PREFIX_E0) ? 0xe0 : 0xe1;
+		} else {
+			sc->at_buffered_char[0] = sc->at_buffered_char[1];
+			sc->at_buffered_char[1] = 0;
 		}
 
-		adb_code = sc->buffer[0];
+		mtx_unlock(&sc->sc_mutex);
 
-		for (i = 1; i < sc->buffers; i++)
-			sc->buffer[i-1] = sc->buffer[i];
+		return (key);
+	}
+#endif
 
-		sc->buffers--;
-	mtx_unlock(&sc->sc_mutex);
+	if (!sc->buffers && wait)
+		cv_wait(&sc->sc_cv,&sc->sc_mutex);
+
+	if (!sc->buffers) {
+		mtx_unlock(&sc->sc_mutex);
+		return (0);
+	}
+
+	adb_code = sc->buffer[0];
+
+	for (i = 1; i < sc->buffers; i++)
+		sc->buffer[i-1] = sc->buffer[i];
+
+	sc->buffers--;
 
 	#ifdef AKBD_EMULATE_ATKBD
-		final_scancode = adb_to_at_scancode_map[adb_code & 0x7f];
-		final_scancode |= adb_code & 0x80;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list