summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2011-05-06 22:45:33 +0000
committerattilio <attilio@FreeBSD.org>2011-05-06 22:45:33 +0000
commita0b51ba62fa86f5faf7bbd81e0b91ba497fec05a (patch)
treeb6f763bb2e3a9eaf32a3ee9adca98cc9e867998c /sys
parent8534b0c2951283889da00ca8a244058185638240 (diff)
downloadFreeBSD-src-a0b51ba62fa86f5faf7bbd81e0b91ba497fec05a.zip
FreeBSD-src-a0b51ba62fa86f5faf7bbd81e0b91ba497fec05a.tar.gz
MFC
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/mp_machdep.c27
-rw-r--r--sys/amd64/include/specialreg.h2
-rw-r--r--sys/boot/i386/boot2/Makefile3
-rw-r--r--sys/dev/ahci/ahci.c1
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416.h1
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_misc.c19
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_reset.c7
-rw-r--r--sys/dev/bm/if_bm.c34
-rw-r--r--sys/dev/coretemp/coretemp.c9
-rw-r--r--sys/dev/cxgbe/t4_main.c2
-rw-r--r--sys/dev/e1000/if_em.c4
-rw-r--r--sys/dev/xl/if_xl.c235
-rw-r--r--sys/fs/nfs/nfs.h2
-rw-r--r--sys/fs/nfsclient/nfs_clvfsops.c2
-rw-r--r--sys/fs/nfsserver/nfs_nfsdport.c17
-rw-r--r--sys/geom/geom_map.c455
-rw-r--r--sys/i386/i386/mp_machdep.c27
-rw-r--r--sys/i386/include/specialreg.h2
-rw-r--r--sys/ia64/isa/isa.c22
-rw-r--r--sys/isa/isa_common.c4
-rw-r--r--sys/isa/isa_common.h6
-rw-r--r--sys/mips/atheros/ar71xx_gpio.c15
-rw-r--r--sys/mips/atheros/ar71xx_gpiovar.h2
-rw-r--r--sys/mips/atheros/ar724xreg.h2
-rw-r--r--sys/mips/atheros/ar91xxreg.h2
-rw-r--r--sys/net/if_tun.c20
-rw-r--r--sys/netinet/ipfw/ip_dn_glue.c2
-rw-r--r--sys/netinet/ipfw/ip_dummynet.c1
-rw-r--r--sys/netinet/sctp_auth.h4
-rw-r--r--sys/nfsclient/nfs_bio.c2
-rw-r--r--sys/nfsclient/nfs_kdtrace.c2
-rw-r--r--sys/nfsclient/nfs_kdtrace.h120
-rw-r--r--sys/nfsclient/nfs_subs.c2
-rw-r--r--sys/nfsclient/nfs_vnops.c2
-rw-r--r--sys/powerpc/conf/GENERIC2
-rw-r--r--sys/powerpc/mpc85xx/isa.c17
-rw-r--r--sys/powerpc/powermac/macio.c31
-rw-r--r--sys/powerpc/powermac/maciovar.h10
-rw-r--r--sys/sparc64/isa/isa.c23
-rw-r--r--sys/sys/stdint.h51
-rw-r--r--sys/sys/types.h46
-rw-r--r--sys/x86/isa/isa.c22
-rw-r--r--sys/x86/x86/local_apic.c38
43 files changed, 573 insertions, 724 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 57e91a8..9e20f95 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -177,11 +177,34 @@ mem_range_AP_init(void)
static void
topo_probe_amd(void)
{
+ int core_id_bits;
+ int id;
/* AMD processors do not support HTT. */
- cpu_cores = (amd_feature2 & AMDID2_CMP) != 0 ?
- (cpu_procinfo2 & AMDID_CMP_CORES) + 1 : 1;
cpu_logical = 1;
+
+ if ((amd_feature2 & AMDID2_CMP) == 0) {
+ cpu_cores = 1;
+ return;
+ }
+
+ core_id_bits = (cpu_procinfo2 & AMDID_COREID_SIZE) >>
+ AMDID_COREID_SIZE_SHIFT;
+ if (core_id_bits == 0) {
+ cpu_cores = (cpu_procinfo2 & AMDID_CMP_CORES) + 1;
+ return;
+ }
+
+ /* Fam 10h and newer should get here. */
+ for (id = 0; id <= MAX_APIC_ID; id++) {
+ /* Check logical CPU availability. */
+ if (!cpu_info[id].cpu_present || cpu_info[id].cpu_disabled)
+ continue;
+ /* Check if logical CPU has the same package ID. */
+ if ((id >> core_id_bits) != (boot_cpu_id >> core_id_bits))
+ continue;
+ cpu_cores++;
+ }
}
/*
diff --git a/sys/amd64/include/specialreg.h b/sys/amd64/include/specialreg.h
index 9428dd9..ac52063 100644
--- a/sys/amd64/include/specialreg.h
+++ b/sys/amd64/include/specialreg.h
@@ -228,6 +228,8 @@
* AMD extended function 8000_0008h ecx info
*/
#define AMDID_CMP_CORES 0x000000ff
+#define AMDID_COREID_SIZE 0x0000f000
+#define AMDID_COREID_SIZE_SHIFT 12
/*
* CPUID manufacturers identifiers
diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
index 6dc27d2..9568c1c1 100644
--- a/sys/boot/i386/boot2/Makefile
+++ b/sys/boot/i386/boot2/Makefile
@@ -43,7 +43,8 @@ CFLAGS= -Os \
-Winline --param max-inline-insns-single=100
.if ${CC:T:Mclang} == "clang"
-CFLAGS+= -mllvm -stack-alignment=8 -mllvm -inline-threshold=3
+CFLAGS+= -mllvm -stack-alignment=8 -mllvm -inline-threshold=3 \
+ -mllvm -enable-load-pre=false
# XXX: clang integrated-as doesn't grok .codeNN directives yet
CFLAGS+= ${.IMPSRC:T:Mboot1.S:C/^.+$/-no-integrated-as/}
.endif
diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c
index b4d0652..f26bf3b 100644
--- a/sys/dev/ahci/ahci.c
+++ b/sys/dev/ahci/ahci.c
@@ -184,6 +184,7 @@ static struct {
{0x91201b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS|AHCI_Q_NOBSYRES},
{0x91231b4b, 0x11, "Marvell 88SE912x", AHCI_Q_NOBSYRES},
{0x91231b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS|AHCI_Q_SATA2|AHCI_Q_NOBSYRES},
+ {0x91821b4b, 0x00, "Marvell 88SE9182", AHCI_Q_NOBSYRES},
{0x06201103, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES},
{0x06201b4b, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES},
{0x06221103, 0x00, "HighPoint RocketRAID 622", AHCI_Q_NOBSYRES},
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416.h b/sys/dev/ath/ath_hal/ar5416/ar5416.h
index 38a346e..3738aaf 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416.h
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416.h
@@ -199,6 +199,7 @@ extern HAL_STATUS ar5416GetCapability(struct ath_hal *ah,
extern HAL_BOOL ar5416GetDiagState(struct ath_hal *ah, int request,
const void *args, uint32_t argsize,
void **result, uint32_t *resultsize);
+extern HAL_BOOL ar5416SetRifsDelay(struct ath_hal *ah, HAL_BOOL enable);
extern HAL_BOOL ar5416SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode,
int setChip);
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c b/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
index aa31824..087bf92 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
@@ -368,6 +368,25 @@ typedef struct {
uint8_t qcu_complete_state;
} hal_mac_hang_check_t;
+HAL_BOOL
+ar5416SetRifsDelay(struct ath_hal *ah, HAL_BOOL enable)
+{
+ uint32_t val;
+
+ /* Only support disabling RIFS delay for now */
+ HALASSERT(enable == AH_FALSE);
+
+ if (enable == AH_TRUE)
+ return AH_FALSE;
+
+ /* Change RIFS init delay to 0 */
+ val = OS_REG_READ(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS);
+ val &= ~AR_PHY_RIFS_INIT_DELAY;
+ OS_REG_WRITE(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS, val);
+
+ return AH_TRUE;
+}
+
static HAL_BOOL
ar5416CompareDbgHang(struct ath_hal *ah, const mac_dbg_regs_t *regs,
const hal_mac_hang_check_t *check)
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
index 4917caa..12f30f1 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
@@ -2520,11 +2520,8 @@ ar5416OverrideIni(struct ath_hal *ah, const struct ieee80211_channel *chan)
* Disable RIFS search on some chips to avoid baseband
* hang issues.
*/
- if (AR_SREV_HOWL(ah) || AR_SREV_SOWL(ah)) {
- val = OS_REG_READ(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS);
- val &= ~AR_PHY_RIFS_INIT_DELAY;
- OS_REG_WRITE(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS, val);
- }
+ if (AR_SREV_HOWL(ah) || AR_SREV_SOWL(ah))
+ (void) ar5416SetRifsDelay(ah, AH_FALSE);
}
struct ini {
diff --git a/sys/dev/bm/if_bm.c b/sys/dev/bm/if_bm.c
index ded2b42..481d7cb 100644
--- a/sys/dev/bm/if_bm.c
+++ b/sys/dev/bm/if_bm.c
@@ -558,6 +558,7 @@ bm_attach(device_t dev)
}
/* alloc interrupt */
+ bm_disable_interrupts(sc);
sc->sc_txdmairqid = BM_TXDMA_INTERRUPT;
sc->sc_txdmairq = bus_alloc_resource_any(dev, SYS_RES_IRQ,
@@ -591,9 +592,6 @@ bm_attach(device_t dev)
eaddr = sc->sc_enaddr;
OF_getprop(node, "local-mac-address", eaddr, ETHER_ADDR_LEN);
- /* reset the adapter */
- bm_chip_setup(sc);
-
/*
* Setup MII
* On Apple BMAC controllers, we end up in a weird state of
@@ -608,6 +606,9 @@ bm_attach(device_t dev)
return (error);
}
+ /* reset the adapter */
+ bm_chip_setup(sc);
+
sc->sc_mii = device_get_softc(sc->sc_miibus);
if_initname(ifp, device_get_name(sc->sc_dev),
@@ -1129,31 +1130,26 @@ bm_chip_setup(struct bm_softc *sc)
{
uint16_t reg;
uint16_t *eaddr_sect;
- char path[128];
- ihandle_t bmac_ih;
+ struct mii_data *mii;
+ struct mii_softc *miisc;
eaddr_sect = (uint16_t *)(sc->sc_enaddr);
+ dbdma_stop(sc->sc_txdma);
+ dbdma_stop(sc->sc_rxdma);
- /*
- * Enable BMAC cell by opening and closing its OF node. This enables
- * the cell in macio as a side effect. We should probably directly
- * twiddle the FCR bits, but we lack a good interface for this at the
- * present time.
- */
-
- OF_package_to_path(ofw_bus_get_node(sc->sc_dev), path, sizeof(path));
- bmac_ih = OF_open(path);
- if (bmac_ih == -1) {
- device_printf(sc->sc_dev,
- "Enabling BMAC cell failed! Hoping it's already active.\n");
- } else {
- OF_close(bmac_ih);
+ /* Reset MII */
+ mii = device_get_softc(sc->sc_miibus);
+ LIST_FOREACH(miisc, &mii->mii_phys, mii_list) {
+ PHY_RESET(miisc);
+ PHY_WRITE(miisc, MII_BMCR, PHY_READ(miisc, MII_BMCR) &
+ ~BMCR_ISO);
}
/* Reset chip */
CSR_WRITE_2(sc, BM_RX_RESET, 0x0000);
CSR_WRITE_2(sc, BM_TX_RESET, 0x0001);
do {
+ DELAY(10);
reg = CSR_READ_2(sc, BM_TX_RESET);
} while (reg & 0x0001);
diff --git a/sys/dev/coretemp/coretemp.c b/sys/dev/coretemp/coretemp.c
index 777a591..411b9ee 100644
--- a/sys/dev/coretemp/coretemp.c
+++ b/sys/dev/coretemp/coretemp.c
@@ -197,6 +197,15 @@ coretemp_attach(device_t dev)
default: /* Unknown stepping */
break;
}
+ } else if (cpu_model == 0x1c) {
+ switch (cpu_stepping) {
+ case 0xa: /* 45nm Atom D400, N400 and D500 series */
+ sc->sc_tjmax = 100;
+ break;
+ default:
+ sc->sc_tjmax = 90;
+ break;
+ }
} else {
/*
* Attempt to get Tj(max) from MSR IA32_TEMPERATURE_TARGET.
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 9037318..929f31b 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -415,7 +415,7 @@ t4_attach(device_t dev)
/* These are total (sum of all ports) limits for a bus driver */
rc = -t4_cfg_pfvf(sc, sc->mbox, sc->pf, 0,
- 64, /* max # of egress queues */
+ 128, /* max # of egress queues */
64, /* max # of egress Ethernet or control queues */
64, /* max # of ingress queues with fl/interrupt */
0, /* max # of ingress queues without interrupt */
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index fb6ed67..156f8b2 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -3901,7 +3901,7 @@ em_setup_receive_ring(struct rx_ring *rxr)
struct adapter *adapter = rxr->adapter;
struct em_buffer *rxbuf;
bus_dma_segment_t seg[1];
- int i, j, nsegs, error;
+ int i, j, nsegs, error = 0;
/* Clear the ring contents */
@@ -3919,7 +3919,7 @@ em_setup_receive_ring(struct rx_ring *rxr)
if (++j == adapter->num_rx_desc)
j = 0;
- while(j != rxr->next_to_check) {
+ while (j != rxr->next_to_check) {
rxbuf = &rxr->rx_buffers[i];
rxbuf->m_head = m_getjcl(M_DONTWAIT, MT_DATA,
M_PKTHDR, adapter->rx_mbuf_sz);
diff --git a/sys/dev/xl/if_xl.c b/sys/dev/xl/if_xl.c
index 1db6ece..004b511 100644
--- a/sys/dev/xl/if_xl.c
+++ b/sys/dev/xl/if_xl.c
@@ -263,10 +263,11 @@ static void xl_mii_send(struct xl_softc *, u_int32_t, int);
static int xl_mii_readreg(struct xl_softc *, struct xl_mii_frame *);
static int xl_mii_writereg(struct xl_softc *, struct xl_mii_frame *);
+static void xl_rxfilter(struct xl_softc *);
+static void xl_rxfilter_90x(struct xl_softc *);
+static void xl_rxfilter_90xB(struct xl_softc *);
static void xl_setcfg(struct xl_softc *);
static void xl_setmode(struct xl_softc *, int);
-static void xl_setmulti(struct xl_softc *);
-static void xl_setmulti_hash(struct xl_softc *);
static void xl_reset(struct xl_softc *);
static int xl_list_rx_init(struct xl_softc *);
static int xl_list_tx_init(struct xl_softc *);
@@ -701,101 +702,133 @@ xl_read_eeprom(struct xl_softc *sc, caddr_t dest, int off, int cnt, int swap)
return (err ? 1 : 0);
}
+static void
+xl_rxfilter(struct xl_softc *sc)
+{
+
+ if (sc->xl_type == XL_TYPE_905B)
+ xl_rxfilter_90xB(sc);
+ else
+ xl_rxfilter_90x(sc);
+}
+
/*
* NICs older than the 3c905B have only one multicast option, which
* is to enable reception of all multicast frames.
*/
static void
-xl_setmulti(struct xl_softc *sc)
+xl_rxfilter_90x(struct xl_softc *sc)
{
- struct ifnet *ifp = sc->xl_ifp;
+ struct ifnet *ifp;
struct ifmultiaddr *ifma;
u_int8_t rxfilt;
- int mcnt = 0;
XL_LOCK_ASSERT(sc);
+ ifp = sc->xl_ifp;
+
XL_SEL_WIN(5);
rxfilt = CSR_READ_1(sc, XL_W5_RX_FILTER);
+ rxfilt &= ~(XL_RXFILTER_ALLFRAMES | XL_RXFILTER_ALLMULTI |
+ XL_RXFILTER_BROADCAST | XL_RXFILTER_INDIVIDUAL);
- if (ifp->if_flags & IFF_ALLMULTI) {
- rxfilt |= XL_RXFILTER_ALLMULTI;
- CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt);
- return;
- }
-
- if_maddr_rlock(ifp);
- TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
- mcnt++;
- if_maddr_runlock(ifp);
+ /* Set the individual bit to receive frames for this host only. */
+ rxfilt |= XL_RXFILTER_INDIVIDUAL;
+ /* Set capture broadcast bit to capture broadcast frames. */
+ if (ifp->if_flags & IFF_BROADCAST)
+ rxfilt |= XL_RXFILTER_BROADCAST;
- if (mcnt)
- rxfilt |= XL_RXFILTER_ALLMULTI;
- else
- rxfilt &= ~XL_RXFILTER_ALLMULTI;
+ /* If we want promiscuous mode, set the allframes bit. */
+ if (ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) {
+ if (ifp->if_flags & IFF_PROMISC)
+ rxfilt |= XL_RXFILTER_ALLFRAMES;
+ if (ifp->if_flags & IFF_ALLMULTI)
+ rxfilt |= XL_RXFILTER_ALLMULTI;
+ } else {
+ if_maddr_rlock(ifp);
+ TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+ if (ifma->ifma_addr->sa_family != AF_LINK)
+ continue;
+ rxfilt |= XL_RXFILTER_ALLMULTI;
+ break;
+ }
+ if_maddr_runlock(ifp);
+ }
- CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt);
+ CSR_WRITE_2(sc, XL_COMMAND, rxfilt | XL_CMD_RX_SET_FILT);
+ XL_SEL_WIN(7);
}
/*
* 3c905B adapters have a hash filter that we can program.
*/
static void
-xl_setmulti_hash(struct xl_softc *sc)
+xl_rxfilter_90xB(struct xl_softc *sc)
{
- struct ifnet *ifp = sc->xl_ifp;
- int h = 0, i;
+ struct ifnet *ifp;
struct ifmultiaddr *ifma;
+ int i, mcnt;
+ u_int16_t h;
u_int8_t rxfilt;
- int mcnt = 0;
XL_LOCK_ASSERT(sc);
+ ifp = sc->xl_ifp;
+
XL_SEL_WIN(5);
rxfilt = CSR_READ_1(sc, XL_W5_RX_FILTER);
+ rxfilt &= ~(XL_RXFILTER_ALLFRAMES | XL_RXFILTER_ALLMULTI |
+ XL_RXFILTER_BROADCAST | XL_RXFILTER_INDIVIDUAL |
+ XL_RXFILTER_MULTIHASH);
- if (ifp->if_flags & IFF_ALLMULTI) {
- rxfilt |= XL_RXFILTER_ALLMULTI;
- CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt);
- return;
- } else
- rxfilt &= ~XL_RXFILTER_ALLMULTI;
-
- /* first, zot all the existing hash bits */
- for (i = 0; i < XL_HASHFILT_SIZE; i++)
- CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_HASH|i);
+ /* Set the individual bit to receive frames for this host only. */
+ rxfilt |= XL_RXFILTER_INDIVIDUAL;
+ /* Set capture broadcast bit to capture broadcast frames. */
+ if (ifp->if_flags & IFF_BROADCAST)
+ rxfilt |= XL_RXFILTER_BROADCAST;
- /* now program new ones */
- if_maddr_rlock(ifp);
- TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
- /*
- * Note: the 3c905B currently only supports a 64-bit hash
- * table, which means we really only need 6 bits, but the
- * manual indicates that future chip revisions will have a
- * 256-bit hash table, hence the routine is set up to
- * calculate 8 bits of position info in case we need it some
- * day.
- * Note II, The Sequel: _CURRENT_ versions of the 3c905B have
- * a 256 bit hash table. This means we have to use all 8 bits
- * regardless. On older cards, the upper 2 bits will be
- * ignored. Grrrr....
- */
- h = ether_crc32_be(LLADDR((struct sockaddr_dl *)
- ifma->ifma_addr), ETHER_ADDR_LEN) & 0xFF;
- CSR_WRITE_2(sc, XL_COMMAND,
- h | XL_CMD_RX_SET_HASH | XL_HASH_SET);
- mcnt++;
+ /* If we want promiscuous mode, set the allframes bit. */
+ if (ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) {
+ if (ifp->if_flags & IFF_PROMISC)
+ rxfilt |= XL_RXFILTER_ALLFRAMES;
+ if (ifp->if_flags & IFF_ALLMULTI)
+ rxfilt |= XL_RXFILTER_ALLMULTI;
+ } else {
+ /* First, zot all the existing hash bits. */
+ for (i = 0; i < XL_HASHFILT_SIZE; i++)
+ CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_HASH | i);
+
+ /* Now program new ones. */
+ mcnt = 0;
+ if_maddr_rlock(ifp);
+ TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+ if (ifma->ifma_addr->sa_family != AF_LINK)
+ continue;
+ /*
+ * Note: the 3c905B currently only supports a 64-bit
+ * hash table, which means we really only need 6 bits,
+ * but the manual indicates that future chip revisions
+ * will have a 256-bit hash table, hence the routine
+ * is set up to calculate 8 bits of position info in
+ * case we need it some day.
+ * Note II, The Sequel: _CURRENT_ versions of the
+ * 3c905B have a 256 bit hash table. This means we have
+ * to use all 8 bits regardless. On older cards, the
+ * upper 2 bits will be ignored. Grrrr....
+ */
+ h = ether_crc32_be(LLADDR((struct sockaddr_dl *)
+ ifma->ifma_addr), ETHER_ADDR_LEN) & 0xFF;
+ CSR_WRITE_2(sc, XL_COMMAND,
+ h | XL_CMD_RX_SET_HASH | XL_HASH_SET);
+ mcnt++;
+ }
+ if_maddr_runlock(ifp);
+ if (mcnt > 0)
+ rxfilt |= XL_RXFILTER_MULTIHASH;
}
- if_maddr_runlock(ifp);
-
- if (mcnt)
- rxfilt |= XL_RXFILTER_MULTIHASH;
- else
- rxfilt &= ~XL_RXFILTER_MULTIHASH;
CSR_WRITE_2(sc, XL_COMMAND, rxfilt | XL_CMD_RX_SET_FILT);
+ XL_SEL_WIN(7);
}
static void
@@ -2485,8 +2518,7 @@ xl_encap(struct xl_softc *sc, struct xl_chain *c, struct mbuf **m_head)
htole32(sc->xl_cdata.xl_tx_segs[i].ds_len);
total_len += sc->xl_cdata.xl_tx_segs[i].ds_len;
}
- c->xl_ptr->xl_frag[nseg - 1].xl_len =
- htole32(sc->xl_cdata.xl_tx_segs[nseg - 1].ds_len | XL_LAST_FRAG);
+ c->xl_ptr->xl_frag[nseg - 1].xl_len |= htole32(XL_LAST_FRAG);
c->xl_ptr->xl_status = htole32(total_len);
c->xl_ptr->xl_next = 0;
@@ -2611,8 +2643,7 @@ xl_start_locked(struct ifnet *ifp)
* get an interrupt once for the whole chain rather than
* once for each packet.
*/
- cur_tx->xl_ptr->xl_status = htole32(le32toh(cur_tx->xl_ptr->xl_status) |
- XL_TXSTAT_DL_INTR);
+ cur_tx->xl_ptr->xl_status |= htole32(XL_TXSTAT_DL_INTR);
bus_dmamap_sync(sc->xl_ldata.xl_tx_tag, sc->xl_ldata.xl_tx_dmamap,
BUS_DMASYNC_PREWRITE);
@@ -2628,8 +2659,8 @@ xl_start_locked(struct ifnet *ifp)
sc->xl_cdata.xl_tx_tail->xl_ptr->xl_next =
htole32(start_tx->xl_phys);
status = sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status;
- sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status =
- htole32(le32toh(status) & ~XL_TXSTAT_DL_INTR);
+ sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status &=
+ htole32(~XL_TXSTAT_DL_INTR);
sc->xl_cdata.xl_tx_tail = cur_tx;
} else {
sc->xl_cdata.xl_tx_head = start_tx;
@@ -2733,8 +2764,7 @@ xl_start_90xB_locked(struct ifnet *ifp)
* get an interrupt once for the whole chain rather than
* once for each packet.
*/
- cur_tx->xl_ptr->xl_status = htole32(le32toh(cur_tx->xl_ptr->xl_status) |
- XL_TXSTAT_DL_INTR);
+ cur_tx->xl_ptr->xl_status |= htole32(XL_TXSTAT_DL_INTR);
bus_dmamap_sync(sc->xl_ldata.xl_tx_tag, sc->xl_ldata.xl_tx_dmamap,
BUS_DMASYNC_PREWRITE);
@@ -2763,7 +2793,6 @@ xl_init_locked(struct xl_softc *sc)
{
struct ifnet *ifp = sc->xl_ifp;
int error, i;
- u_int16_t rxfilt = 0;
struct mii_data *mii = NULL;
XL_LOCK_ASSERT(sc);
@@ -2862,39 +2891,7 @@ xl_init_locked(struct xl_softc *sc)
}
/* Set RX filter bits. */
- XL_SEL_WIN(5);
- rxfilt = CSR_READ_1(sc, XL_W5_RX_FILTER);
-
- /* Set the individual bit to receive frames for this host only. */
- rxfilt |= XL_RXFILTER_INDIVIDUAL;
-
- /* If we want promiscuous mode, set the allframes bit. */
- if (ifp->if_flags & IFF_PROMISC) {
- rxfilt |= XL_RXFILTER_ALLFRAMES;
- CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt);
- } else {
- rxfilt &= ~XL_RXFILTER_ALLFRAMES;
- CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt);
- }
-
- /*
- * Set capture broadcast bit to capture broadcast frames.
- */
- if (ifp->if_flags & IFF_BROADCAST) {
- rxfilt |= XL_RXFILTER_BROADCAST;
- CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt);
- } else {
- rxfilt &= ~XL_RXFILTER_BROADCAST;
- CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt);
- }
-
- /*
- * Program the multicast filter, if necessary.
- */
- if (sc->xl_type == XL_TYPE_905B)
- xl_setmulti_hash(sc);
- else
- xl_setmulti(sc);
+ xl_rxfilter(sc);
/*
* Load the address of the RX list. We have to
@@ -3123,30 +3120,16 @@ xl_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
struct ifreq *ifr = (struct ifreq *) data;
int error = 0, mask;
struct mii_data *mii = NULL;
- u_int8_t rxfilt;
switch (command) {
case SIOCSIFFLAGS:
XL_LOCK(sc);
-
- XL_SEL_WIN(5);
- rxfilt = CSR_READ_1(sc, XL_W5_RX_FILTER);
if (ifp->if_flags & IFF_UP) {
if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
- ifp->if_flags & IFF_PROMISC &&
- !(sc->xl_if_flags & IFF_PROMISC)) {
- rxfilt |= XL_RXFILTER_ALLFRAMES;
- CSR_WRITE_2(sc, XL_COMMAND,
- XL_CMD_RX_SET_FILT|rxfilt);
- XL_SEL_WIN(7);
- } else if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
- !(ifp->if_flags & IFF_PROMISC) &&
- sc->xl_if_flags & IFF_PROMISC) {
- rxfilt &= ~XL_RXFILTER_ALLFRAMES;
- CSR_WRITE_2(sc, XL_COMMAND,
- XL_CMD_RX_SET_FILT|rxfilt);
- XL_SEL_WIN(7);
- } else
+ (ifp->if_flags ^ sc->xl_if_flags) &
+ (IFF_PROMISC | IFF_ALLMULTI))
+ xl_rxfilter(sc);
+ else
xl_init_locked(sc);
} else {
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
@@ -3154,18 +3137,14 @@ xl_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
}
sc->xl_if_flags = ifp->if_flags;
XL_UNLOCK(sc);
- error = 0;
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
/* XXX Downcall from if_addmulti() possibly with locks held. */
XL_LOCK(sc);
- if (sc->xl_type == XL_TYPE_905B)
- xl_setmulti_hash(sc);
- else
- xl_setmulti(sc);
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ xl_rxfilter(sc);
XL_UNLOCK(sc);
- error = 0;
break;
case SIOCGIFMEDIA:
case SIOCSIFMEDIA:
diff --git a/sys/fs/nfs/nfs.h b/sys/fs/nfs/nfs.h
index 0bf0f74..c8bb0d6 100644
--- a/sys/fs/nfs/nfs.h
+++ b/sys/fs/nfs/nfs.h
@@ -39,7 +39,7 @@
*/
#define NFS_MAXIOVEC 34
-#define NFS_TICKINTVL 10 /* Desired time for a tick (msec) */
+#define NFS_TICKINTVL 500 /* Desired time for a tick (msec) */
#define NFS_HZ (hz / nfscl_ticks) /* Ticks/sec */
#define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */
#define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */
diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c
index 8b4fc6a..b11160b 100644
--- a/sys/fs/nfsclient/nfs_clvfsops.c
+++ b/sys/fs/nfsclient/nfs_clvfsops.c
@@ -1224,7 +1224,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
if ((argp->flags & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) == 0)
nmp->nm_maxfilesize = 0xffffffffLL;
else
- nmp->nm_maxfilesize = (u_int64_t)0x80000000 * DEV_BSIZE - 1;
+ nmp->nm_maxfilesize = OFF_MAX;
nmp->nm_timeo = NFS_TIMEO;
nmp->nm_retry = NFS_RETRANS;
diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c
index 90e7d4f..9ea077d 100644
--- a/sys/fs/nfsserver/nfs_nfsdport.c
+++ b/sys/fs/nfsserver/nfs_nfsdport.c
@@ -1280,8 +1280,23 @@ nfsvno_fsync(struct vnode *vp, u_int64_t off, int cnt, struct ucred *cred,
int
nfsvno_statfs(struct vnode *vp, struct statfs *sf)
{
+ int error;
- return (VFS_STATFS(vp->v_mount, sf));
+ error = VFS_STATFS(vp->v_mount, sf);
+ if (error == 0) {
+ /*
+ * Since NFS handles these values as unsigned on the
+ * wire, there is no way to represent negative values,
+ * so set them to 0. Without this, they will appear
+ * to be very large positive values for clients like
+ * Solaris10.
+ */
+ if (sf->f_bavail < 0)
+ sf->f_bavail = 0;
+ if (sf->f_ffree < 0)
+ sf->f_ffree = 0;
+ }
+ return (error);
}
/*
diff --git a/sys/geom/geom_map.c b/sys/geom/geom_map.c
index 5acaefb..7f1b240 100644
--- a/sys/geom/geom_map.c
+++ b/sys/geom/geom_map.c
@@ -43,81 +43,73 @@ __FBSDID("$FreeBSD$");
#include <sys/bio.h>
#include <sys/lock.h>
#include <sys/mutex.h>
-
#include <sys/sbuf.h>
+
#include <geom/geom.h>
#include <geom/geom_slice.h>
-#define MAP_CLASS_NAME "MAP"
-
-struct map_desc {
- uint8_t name [16]; /* null-terminated name */
- uint32_t offset; /* offset in flash */
- uint32_t addr; /* address in memory */
- uint32_t size; /* image size in bytes */
- uint32_t entry; /* offset in image for entry point */
- uint32_t dsize; /* data size in bytes */
-};
-
+#define MAP_CLASS_NAME "MAP"
#define MAP_MAXSLICE 64
+#define MAP_MAX_MARKER_LEN 64
struct g_map_softc {
- uint32_t entry [MAP_MAXSLICE];
- uint32_t dsize [MAP_MAXSLICE];
- uint8_t readonly[MAP_MAXSLICE];
- g_access_t *parent_access;
+ off_t offset[MAP_MAXSLICE]; /* offset in flash */
+ off_t size[MAP_MAXSLICE]; /* image size in bytes */
+ off_t entry[MAP_MAXSLICE];
+ off_t dsize[MAP_MAXSLICE];
+ uint8_t readonly[MAP_MAXSLICE];
+ g_access_t *parent_access;
};
static int
-g_map_ioctl(struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread *td)
-{
- return (ENOIOCTL);
-}
-
-static int
g_map_access(struct g_provider *pp, int dread, int dwrite, int dexcl)
{
- struct g_geom *gp = pp->geom;
- struct g_slicer *gsp = gp->softc;
- struct g_map_softc *sc = gsp->softc;
+ struct g_geom *gp;
+ struct g_slicer *gsp;
+ struct g_map_softc *sc;
+
+ gp = pp->geom;
+ gsp = gp->softc;
+ sc = gsp->softc;
if (dwrite > 0 && sc->readonly[pp->index])
return (EPERM);
+
return (sc->parent_access(pp, dread, dwrite, dexcl));
- /*
- * no (sc->parent_access(pp, dread, dwrite, dexcl));,
- * We need to have way for update flash
- */
}
static int
g_map_start(struct bio *bp)
{
struct g_provider *pp;
- struct g_geom *gp;
+ struct g_geom *gp;
struct g_map_softc *sc;
struct g_slicer *gsp;
- int idx;
+ int idx;
pp = bp->bio_to;
idx = pp->index;
gp = pp->geom;
gsp = gp->softc;
sc = gsp->softc;
+
if (bp->bio_cmd == BIO_GETATTR) {
if (g_handleattr_int(bp, MAP_CLASS_NAME "::entry",
- sc->entry[idx]))
+ sc->entry[idx])) {
return (1);
+ }
if (g_handleattr_int(bp, MAP_CLASS_NAME "::dsize",
- sc->dsize[idx]))
+ sc->dsize[idx])) {
return (1);
+ }
}
+
return (0);
}
static void
g_map_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
- struct g_consumer *cp __unused, struct g_provider *pp)
+ struct g_consumer *cp __unused, struct g_provider *pp)
{
struct g_map_softc *sc;
struct g_slicer *gsp;
@@ -127,45 +119,237 @@ g_map_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
g_slice_dumpconf(sb, indent, gp, cp, pp);
if (pp != NULL) {
if (indent == NULL) {
- sbuf_printf(sb, " entry %d", sc->entry[pp->index]);
- sbuf_printf(sb, " dsize %d", sc->dsize[pp->index]);
+ sbuf_printf(sb, " entry %lld", sc->entry[pp->index]);
+ sbuf_printf(sb, " dsize %lld", sc->dsize[pp->index]);
} else {
- sbuf_printf(sb, "%s<entry>%d</entry>\n", indent,
- sc->entry[pp->index]);
- sbuf_printf(sb, "%s<dsize>%d</dsize>\n", indent,
- sc->dsize[pp->index]);
+ sbuf_printf(sb, "%s<entry>%lld</entry>\n", indent,
+ sc->entry[pp->index]);
+ sbuf_printf(sb, "%s<dsize>%lld</dsize>\n", indent,
+ sc->dsize[pp->index]);
}
}
}
-#include <sys/ctype.h>
+static int
+find_marker(struct g_consumer *cp, const char *line, off_t *offset)
+{
+ off_t search_start, search_offset, search_step;
+ size_t sectorsize;
+ uint8_t *buf;
+ char *op, key[MAP_MAX_MARKER_LEN], search_key[MAP_MAX_MARKER_LEN];
+ int ret, c;
+
+ /* Try convert to numeric first */
+ *offset = strtouq(line, &op, 0);
+ if (*op == '\0')
+ return (0);
+
+ bzero(search_key, MAP_MAX_MARKER_LEN);
+ sectorsize = cp->provider->sectorsize;
+
+ ret = sscanf(line, "search:%qi:%qi:%63c",
+ &search_start, &search_step, search_key);
+ if (ret < 3)
+ return (1);
+
+ if (bootverbose) {
+ printf("MAP: search key \"%s\" from 0x%llx, step 0x%llx\n",
+ search_key, search_start, search_step);
+ }
+
+ /* error if search_key is empty */
+ if (strlen(search_key) < 1)
+ return (1);
+
+ /* sscanf successful, and we start marker search */
+ for (search_offset = search_start;
+ search_offset < cp->provider->mediasize;
+ search_offset += search_step) {
+
+ g_topology_unlock();
+ buf = g_read_data(cp, rounddown(search_offset, sectorsize),
+ roundup(strlen(search_key), sectorsize), NULL);
+ g_topology_lock();
+
+ /* Wildcard, replace '.' with byte from data */
+ /* TODO: add support wildcard escape '\.' */
+
+ strncpy(key, search_key, MAP_MAX_MARKER_LEN);
+
+ for (c = 0; c < MAP_MAX_MARKER_LEN && key[c]; c++) {
+ if (key[c] == '.') {
+ key[c] = ((char *)(buf +
+ (search_offset % sectorsize)))[c];
+ }
+ }
+
+ if (buf != NULL && strncmp(buf + search_offset % sectorsize,
+ key, strlen(search_key)) == 0) {
+ g_free(buf);
+ /* Marker found, so return their offset */
+ *offset = search_offset;
+ return (0);
+ }
+ g_free(buf);
+ }
+
+ /* Marker not found */
+ return (1);
+}
+
+static int
+g_map_parse_part(struct g_class *mp, struct g_provider *pp,
+ struct g_consumer *cp, struct g_geom *gp, struct g_map_softc *sc, int i)
+{
+ const char *value, *name;
+ char *op;
+ off_t start, end, offset, size, dsize;
+ int readonly, ret;
+
+ /* hint.map.0.at="cfid0" - bind to cfid0 media */
+ if (resource_string_value("map", i, "at", &value) != 0)
+ return (1);
+
+ /* Check if this correct provider */
+ if (strcmp(pp->name, value) != 0)
+ return (1);
+
+ /*
+ * hint.map.0.name="uboot" - name of partition, will be available
+ * as "/dev/map/uboot"
+ */
+ if (resource_string_value("map", i, "name", &name) != 0) {
+ if (bootverbose)
+ printf("MAP: hint.map.%d has no name\n", i);
+ return (1);
+ }
+
+ /*
+ * hint.map.0.start="0x00010000" - partition start at 0x00010000
+ * or hint.map.0.start="search:0x00010000:0x200:marker text" -
+ * search for text "marker text", begin at 0x10000, step 0x200
+ * until we found marker or end of media reached
+ */
+ if (resource_string_value("map", i, "start", &value) != 0) {
+ if (bootverbose)
+ printf("MAP: \"%s\" has no start value\n", name);
+ return (1);
+ }
+ if (find_marker(cp, value, &start) != 0) {
+ if (bootverbose) {
+ printf("MAP: \"%s\" can't parse/use start value\n",
+ name);
+ }
+ return (1);
+ }
+
+ /* like "start" */
+ if (resource_string_value("map", i, "end", &value) != 0) {
+ if (bootverbose)
+ printf("MAP: \"%s\" has no end value\n", name);
+ return (1);
+ }
+ if (find_marker(cp, value, &end) != 0) {
+ if (bootverbose) {
+ printf("MAP: \"%s\" can't parse/use start value\n",
+ name);
+ }
+ return (1);
+ }
+ /* variable readonly optional, disable write access */
+ if (resource_int_value("map", i, "readonly", &readonly) != 0)
+ readonly = 0;
+
+ /* offset of partition data, from partition begin */
+ if (resource_string_value("map", i, "offset", &value) == 0) {
+ offset = strtouq(value, &op, 0);
+ if (*op != '\0') {
+ if (bootverbose) {
+ printf("MAP: \"%s\" can't parse offset\n",
+ name);
+ }
+ return (1);
+ }
+ } else {
+ offset = 0;
+ }
+
+ /* partition data size */
+ if (resource_string_value("map", i, "dsize", &value) == 0) {
+ dsize = strtouq(value, &op, 0);
+ if (*op != '\0') {
+ if (bootverbose) {
+ printf("MAP: \"%s\" can't parse dsize\n",
+ name);
+ }
+ return (1);
+ }
+ } else {
+ dsize = 0;
+ }
+
+ size = end - start;
+ if (dsize == 0)
+ dsize = size - offset;
+
+ /* end is 0 or size is 0, No MAP - so next */
+ if (end < start) {
+ if (bootverbose) {
+ printf("MAP: \"%s\", \"end\" less than "
+ "\"start\"\n", name);
+ }
+ return (1);
+ }
+
+ if (offset + dsize > size) {
+ if (bootverbose) {
+ printf("MAP: \"%s\", \"dsize\" bigger than "
+ "partition - offset\n", name);
+ }
+ return (1);
+ }
+
+ ret = g_slice_config(gp, i, G_SLICE_CONFIG_SET, start + offset,
+ dsize, cp->provider->sectorsize, "map/%s", name);
+ if (ret != 0) {
+ if (bootverbose) {
+ printf("MAP: g_slice_config returns %d for \"%s\"\n",
+ ret, name);
+ }
+ return (1);
+ }
+
+ if (bootverbose) {
+ printf("MAP: %llxx%llx, data=%llxx%llx "
+ "\"/dev/map/%s\"\n",
+ start, size, offset, dsize, name);
+ }
+
+ sc->offset[i] = start;
+ sc->size[i] = size;
+ sc->entry[i] = offset;
+ sc->dsize[i] = dsize;
+ sc->readonly[i] = readonly ? 1 : 0;
+
+ return (0);
+}
static struct g_geom *
-g_map_taste(struct g_class *mp, struct g_provider *pp, int insist)
+g_map_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
{
- struct g_geom *gp;
- struct g_consumer *cp;
struct g_map_softc *sc;
- int error , sectorsize, i, ret;
- struct map_desc *head;
- u_int32_t start = 0, end = 0, size = 0, off, readonly;
- const char *name;
- const char *at;
- const char *search;
- int search_start = 0, search_end = 0;
- u_char *buf;
- uint32_t offmask;
- u_int blksize;/* NB: flash block size stored as stripesize */
- off_t offset;
+ struct g_consumer *cp;
+ struct g_geom *gp;
+ int i;
g_trace(G_T_TOPOLOGY, "map_taste(%s,%s)", mp->name, pp->name);
g_topology_assert();
- if (!strcmp(pp->geom->class->name, MAP_CLASS_NAME))
+ if (strcmp(pp->geom->class->name, MAP_CLASS_NAME) == 0)
return (NULL);
gp = g_slice_new(mp, MAP_MAXSLICE, pp, &cp, &sc, sizeof(*sc),
- g_map_start);
+ g_map_start);
if (gp == NULL)
return (NULL);
@@ -173,160 +357,14 @@ g_map_taste(struct g_class *mp, struct g_provider *pp, int insist)
sc->parent_access = gp->access;
gp->access = g_map_access;
- sectorsize = cp->provider->sectorsize;
- blksize = cp->provider->stripesize;
- if (powerof2(cp->provider->mediasize))
- offmask = cp->provider->mediasize - 1;
- else
- offmask = 0xffffffff; /* XXX */
-
- g_topology_unlock();
- head = NULL;
- offset = cp->provider->mediasize - blksize;
- g_topology_lock();
-
- for (i = 0; i < MAP_MAXSLICE; i++) {
- search_start = search_end = start = end = off = readonly = 0;
-
- ret = resource_string_value("map", i, "at", &at);
- if (ret)
- continue;
-
- /* Check if my provider */
- if (strncmp(pp->name, at, strlen(at)))
- continue;
-
- ret = resource_string_value("map", i, "start", &search);
-
- if (!ret && strncmp(search, "search", 6) == 0) {
- uint32_t search_offset, search_start = 0;
- uint32_t search_step = 0;
- const char *search_key;
- char key[255];
- int c;
-
- ret = resource_int_value("map", i, "searchstart",
- &search_start);
- ret = resource_int_value("map", i, "searchstep",
- &search_step);
- if (ret)
- search_step = 0x10000U;
- ret = resource_string_value("map", i, "searchkey", &search_key);
- if (ret)
- continue;
-
- printf("GEOM_MAP: searchkey=\"%s\"\n", search_key);
- for (search_offset = search_start;
- search_offset < cp->provider->mediasize && start == 0;
- search_offset += search_step) {
- buf = g_read_data(cp,
- rounddown(search_offset, sectorsize),
- roundup(strlen(search_key), sectorsize),
- NULL);
-
- /* Wildcard, replace '.' with byte from data */
- strncpy(key, search_key, 255);
- for (c = 0; c < 255 && key[c]; c++)
- if (key[c] == '.')
- key[c] = ((char *)(buf + search_offset % sectorsize))[c];
-
- if (buf != NULL && strncmp(
- buf + search_offset % sectorsize,
- key, strlen(search_key)) == 0)
- start = search_offset;
- g_free(buf);
- }
- if (!start)
- continue;
- } else {
- ret = resource_int_value("map", i, "start", &start);
- if (ret)
- continue;
- }
+ for (i = 0; i < MAP_MAXSLICE; i++)
+ g_map_parse_part(mp, pp, cp, gp, sc, i);
- ret = resource_string_value("map", i, "end", &search);
-
- if (!ret && strncmp(search, "search", 6) == 0) {
- uint32_t search_offset, search_start = 0, search_step = 0;
- const char *search_key;
- char key[255];
- int c;
-
- ret = resource_int_value("map", i, "searchstart", &search_start);
- ret = resource_int_value("map", i, "searchstep", &search_step);
- if (ret)
- search_step = 0x10000U;
- ret = resource_string_value("map", i, "searchkey", &search_key);
- if (ret)
- continue;
-
- for (search_offset = search_start;
- search_offset < cp->provider->mediasize && end == 0;
- search_offset += search_step) {
- buf = g_read_data(cp,
- rounddown(search_offset, sectorsize),
- roundup(strlen(search_key), sectorsize),
- NULL);
-
- /* Wildcard, replace '.' with byte from data */
- strncpy(key, search_key, 255);
- for (c = 0; c < 255 && key[c]; c++)
- if (key[c] == '.')
- key[c] = ((char *)(buf + search_offset % sectorsize))[c];
-
- if (buf != NULL && strncmp(
- buf + search_offset % sectorsize,
- key, strlen(search_key)) == 0)
- end = search_offset;
- g_free(buf);
- }
- if (!end)
- continue;
- } else {
- ret = resource_int_value("map", i, "end", &end);
- if (ret)
- continue;
- }
- size = end - start;
-
- /* end is 0 or size is 0, No MAP - so next */
- if (end == 0 || size == 0)
- continue;
- ret = resource_int_value("map", i, "offset", &off);
- ret = resource_int_value("map", i, "readonly", &readonly);
- ret = resource_string_value("map", i, "name", &name);
- /* No name or error read name */
- if (ret)
- continue;
-
- if (off > size)
- printf("%s: off(%d) > size(%d) for \"%s\"\n",
- __func__, off, size, name);
-
- error = g_slice_config(gp, i, G_SLICE_CONFIG_SET, start + off,
- size - off, sectorsize, "map/%s", name);
- printf("MAP: %08x-%08x, offset=%08x \"map/%s\"\n",
- (uint32_t) start,
- (uint32_t) size,
- (uint32_t) off,
- name
- );
-
- if (error)
- printf("%s g_slice_config returns %d for \"%s\"\n",
- __func__, error, name);
-
- sc->entry[i] = off;
- sc->dsize[i] = size - off;
- sc->readonly[i] = readonly ? 1 : 0;
- }
-
-
- if (i == 0)
- return (NULL);
g_access(cp, -1, 0, 0);
if (LIST_EMPTY(&gp->provider)) {
+ if (bootverbose)
+ printf("MAP: No valid partition found at %s\n", pp->name);
g_slice_spoiled(cp);
return (NULL);
}
@@ -336,7 +374,7 @@ g_map_taste(struct g_class *mp, struct g_provider *pp, int insist)
static void
g_map_config(struct gctl_req *req, struct g_class *mp, const char *verb)
{
- struct g_geom *gp;
+ struct g_geom *gp;
g_topology_assert();
gp = gctl_get_geom(req, mp, "geom");
@@ -351,6 +389,5 @@ static struct g_class g_map_class = {
.taste = g_map_taste,
.dumpconf = g_map_dumpconf,
.ctlreq = g_map_config,
- .ioctl = g_map_ioctl,
};
DECLARE_GEOM_CLASS(g_map_class, g_map);
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index dfe6434..966e46e 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -224,11 +224,34 @@ mem_range_AP_init(void)
static void
topo_probe_amd(void)
{
+ int core_id_bits;
+ int id;
/* AMD processors do not support HTT. */
- cpu_cores = (amd_feature2 & AMDID2_CMP) != 0 ?
- (cpu_procinfo2 & AMDID_CMP_CORES) + 1 : 1;
cpu_logical = 1;
+
+ if ((amd_feature2 & AMDID2_CMP) == 0) {
+ cpu_cores = 1;
+ return;
+ }
+
+ core_id_bits = (cpu_procinfo2 & AMDID_COREID_SIZE) >>
+ AMDID_COREID_SIZE_SHIFT;
+ if (core_id_bits == 0) {
+ cpu_cores = (cpu_procinfo2 & AMDID_CMP_CORES) + 1;
+ return;
+ }
+
+ /* Fam 10h and newer should get here. */
+ for (id = 0; id <= MAX_APIC_ID; id++) {
+ /* Check logical CPU availability. */
+ if (!cpu_info[id].cpu_present || cpu_info[id].cpu_disabled)
+ continue;
+ /* Check if logical CPU has the same package ID. */
+ if ((id >> core_id_bits) != (boot_cpu_id >> core_id_bits))
+ continue;
+ cpu_cores++;
+ }
}
/*
diff --git a/sys/i386/include/specialreg.h b/sys/i386/include/specialreg.h
index cfb205f..adccaf4 100644
--- a/sys/i386/include/specialreg.h
+++ b/sys/i386/include/specialreg.h
@@ -227,6 +227,8 @@
* AMD extended function 8000_0008h ecx info
*/
#define AMDID_CMP_CORES 0x000000ff
+#define AMDID_COREID_SIZE 0x0000f000
+#define AMDID_COREID_SIZE_SHIFT 12
/*
* CPUID manufacturers identifiers
diff --git a/sys/ia64/isa/isa.c b/sys/ia64/isa/isa.c
index 6467237..cdb93cc 100644
--- a/sys/ia64/isa/isa.c
+++ b/sys/ia64/isa/isa.c
@@ -135,25 +135,3 @@ isa_release_resource(device_t bus, device_t child, int type, int rid,
struct resource_list *rl = &idev->id_resources;
return resource_list_release(rl, bus, child, type, rid, r);
}
-
-/*
- * We can't use the bus_generic_* versions of these methods because those
- * methods always pass the bus param as the requesting device, and we need
- * to pass the child (the i386 nexus knows about this and is prepared to
- * deal).
- */
-int
-isa_setup_intr(device_t bus, device_t child, struct resource *r, int flags,
- driver_filter_t filter, void (*ihand)(void *), void *arg,
- void **cookiep)
-{
- return (BUS_SETUP_INTR(device_get_parent(bus), child, r, flags,
- filter, ihand, arg, cookiep));
-}
-
-int
-isa_teardown_intr(device_t bus, device_t child, struct resource *r,
- void *cookie)
-{
- return (BUS_TEARDOWN_INTR(device_get_parent(bus), child, r, cookie));
-}
diff --git a/sys/isa/isa_common.c b/sys/isa/isa_common.c
index 1d1a13a..9e10320 100644
--- a/sys/isa/isa_common.c
+++ b/sys/isa/isa_common.c
@@ -1071,8 +1071,8 @@ static device_method_t isa_methods[] = {
DEVMETHOD(bus_write_ivar, isa_write_ivar),
DEVMETHOD(bus_child_detached, isa_child_detached),
DEVMETHOD(bus_driver_added, isa_driver_added),
- DEVMETHOD(bus_setup_intr, isa_setup_intr),
- DEVMETHOD(bus_teardown_intr, isa_teardown_intr),
+ DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
+ DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
DEVMETHOD(bus_get_resource_list,isa_get_resource_list),
DEVMETHOD(bus_alloc_resource, isa_alloc_resource),
diff --git a/sys/isa/isa_common.h b/sys/isa/isa_common.h
index 340ad17..a6702f4 100644
--- a/sys/isa/isa_common.h
+++ b/sys/isa/isa_common.h
@@ -73,11 +73,5 @@ extern struct resource *isa_alloc_resource(device_t bus, device_t child,
extern int isa_release_resource(device_t bus, device_t child,
int type, int rid, struct resource *r);
-extern int isa_setup_intr(device_t bus, device_t child, struct resource *r,
- int flags, driver_filter_t *filter, void (*ihand)(void *), void *arg,
- void **cookiep);
-extern int isa_teardown_intr(device_t bus, device_t child, struct resource *r,
- void *cookie);
-
extern driver_t isa_driver;
extern devclass_t isa_devclass;
diff --git a/sys/mips/atheros/ar71xx_gpio.c b/sys/mips/atheros/ar71xx_gpio.c
index 866c72b..09b4d50 100644
--- a/sys/mips/atheros/ar71xx_gpio.c
+++ b/sys/mips/atheros/ar71xx_gpio.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/resource.h>
#include <mips/atheros/ar71xxreg.h>
+#include <mips/atheros/ar71xx_setup.h>
#include <mips/atheros/ar71xx_gpiovar.h>
#include "gpio_if.h"
@@ -144,7 +145,19 @@ static int
ar71xx_gpio_pin_max(device_t dev, int *maxpin)
{
- *maxpin = AR71XX_GPIO_PINS - 1;
+ switch (ar71xx_soc) {
+ case AR71XX_SOC_AR9130:
+ case AR71XX_SOC_AR9132:
+ *maxpin = AR91XX_GPIO_PINS - 1;
+ break;
+ case AR71XX_SOC_AR7240:
+ case AR71XX_SOC_AR7241:
+ case AR71XX_SOC_AR7242:
+ *maxpin = AR724X_GPIO_PINS - 1;
+ break;
+ default:
+ *maxpin = AR71XX_GPIO_PINS - 1;
+ }
return (0);
}
diff --git a/sys/mips/atheros/ar71xx_gpiovar.h b/sys/mips/atheros/ar71xx_gpiovar.h
index a9ed7e0..3489f5a 100644
--- a/sys/mips/atheros/ar71xx_gpiovar.h
+++ b/sys/mips/atheros/ar71xx_gpiovar.h
@@ -52,6 +52,8 @@
GPIO_WRITE(sc, reg, GPIO_READ(sc, (reg)) & ~(bits))
#define AR71XX_GPIO_PINS 12
+#define AR724X_GPIO_PINS 18
+#define AR91XX_GPIO_PINS 22
struct ar71xx_gpio_softc {
device_t dev;
diff --git a/sys/mips/atheros/ar724xreg.h b/sys/mips/atheros/ar724xreg.h
index eaceb1d..73e20af 100644
--- a/sys/mips/atheros/ar724xreg.h
+++ b/sys/mips/atheros/ar724xreg.h
@@ -105,6 +105,4 @@
#define AR724X_GPIO_FUNC_UART_EN (1 >> 1)
#define AR724X_GPIO_FUNC_JTAG_DISABLE (1 >> 0)
-#define AR724X_GPIO_COUNT 18
-
#endif
diff --git a/sys/mips/atheros/ar91xxreg.h b/sys/mips/atheros/ar91xxreg.h
index 729d9ff..2dfaeb5 100644
--- a/sys/mips/atheros/ar91xxreg.h
+++ b/sys/mips/atheros/ar91xxreg.h
@@ -81,6 +81,4 @@
#define AR91XX_GPIO_FUNC_UART_EN (1 << 8)
#define AR91XX_GPIO_FUNC_USB_CLK_EN (1 << 4)
-#define AR91XX_GPIO_COUNT 22
-
#endif
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 7c01ebe..4e727d9 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -228,8 +228,8 @@ tunclone(void *arg, struct ucred *cred, char *name, int namelen,
i = clone_create(&tunclones, &tun_cdevsw, &u, dev, 0);
if (i) {
if (append_unit) {
- namelen = snprintf(devname, sizeof(devname), "%s%d", name,
- u);
+ namelen = snprintf(devname, sizeof(devname), "%s%d",
+ name, u);
name = devname;
}
/* No preexisting struct cdev *, create one */
@@ -577,11 +577,8 @@ tunifioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
* tunoutput - queue packets from higher level ready to put out.
*/
static int
-tunoutput(
- struct ifnet *ifp,
- struct mbuf *m0,
- struct sockaddr *dst,
- struct route *ro)
+tunoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
+ struct route *ro)
{
struct tun_softc *tp = ifp->if_softc;
u_short cached_tun_flags;
@@ -661,10 +658,8 @@ tunoutput(
}
error = (ifp->if_transmit)(ifp, m0);
- if (error) {
- ifp->if_collisions++;
+ if (error)
return (ENOBUFS);
- }
ifp->if_opackets++;
return (0);
}
@@ -673,7 +668,8 @@ tunoutput(
* the cdevsw interface is now pretty minimal.
*/
static int
-tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
+tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag,
+ struct thread *td)
{
int error;
struct tun_softc *tp = dev->si_drv1;
@@ -995,7 +991,7 @@ tunkqfilter(struct cdev *dev, struct knote *kn)
ifp->if_xname, dev2unit(dev));
kn->kn_fop = &tun_write_filterops;
break;
-
+
default:
TUNDEBUG(ifp, "%s kqfilter: invalid filter, minor = %#x\n",
ifp->if_xname, dev2unit(dev));
diff --git a/sys/netinet/ipfw/ip_dn_glue.c b/sys/netinet/ipfw/ip_dn_glue.c
index 3f968df..9fc6b23 100644
--- a/sys/netinet/ipfw/ip_dn_glue.c
+++ b/sys/netinet/ipfw/ip_dn_glue.c
@@ -624,7 +624,7 @@ dn_c_copy_pipe(struct dn_schk *s, struct copy_args *a, int nq)
/* These 4 field are the same in pipe7 and pipe8 */
pipe7->next.sle_next = (struct dn_pipe7 *)DN_IS_PIPE;
pipe7->bandwidth = l->bandwidth;
- pipe7->delay = l->delay;
+ pipe7->delay = l->delay * 1000 / hz;
pipe7->pipe_nr = l->link_nr - DN_MAX_ID;
if (!is7) {
diff --git a/sys/netinet/ipfw/ip_dummynet.c b/sys/netinet/ipfw/ip_dummynet.c
index d44fd10..ba6e892 100644
--- a/sys/netinet/ipfw/ip_dummynet.c
+++ b/sys/netinet/ipfw/ip_dummynet.c
@@ -808,6 +808,7 @@ copy_obj(char **start, char *end, void *_o, const char *msg, int i)
/* Adjust burst parameter for link */
struct dn_link *l = (struct dn_link *)*start;
l->burst = div64(l->burst, 8 * hz);
+ l->delay = l->delay * 1000 / hz;
} else if (o->type == DN_SCH) {
/* Set id->id to the number of instances */
struct dn_schk *s = _o;
diff --git a/sys/netinet/sctp_auth.h b/sys/netinet/sctp_auth.h
index 653620d..9406ce8 100644
--- a/sys/netinet/sctp_auth.h
+++ b/sys/netinet/sctp_auth.h
@@ -89,7 +89,7 @@ typedef struct sctp_hmaclist {
} sctp_hmaclist_t;
/* authentication info */
-typedef struct sctp_authinfo {
+typedef struct sctp_authinformation {
sctp_key_t *random; /* local random key (concatenated) */
uint32_t random_len; /* local random number length for param */
sctp_key_t *peer_random;/* peer's random key (concatenated) */
@@ -98,7 +98,7 @@ typedef struct sctp_authinfo {
uint16_t active_keyid; /* active send keyid */
uint16_t assoc_keyid; /* current send keyid (cached) */
uint16_t recv_keyid; /* last recv keyid (cached) */
-} sctp_authinfo_t;
+} sctp_authinfo_t;
diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c
index 047df94..9a777c8 100644
--- a/sys/nfsclient/nfs_bio.c
+++ b/sys/nfsclient/nfs_bio.c
@@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
#include <nfsclient/nfs.h>
#include <nfsclient/nfsmount.h>
#include <nfsclient/nfsnode.h>
-#include <nfsclient/nfs_kdtrace.h>
+#include <nfs/nfs_kdtrace.h>
static struct buf *nfs_getcacheblk(struct vnode *vp, daddr_t bn, int size,
struct thread *td);
diff --git a/sys/nfsclient/nfs_kdtrace.c b/sys/nfsclient/nfs_kdtrace.c
index 3a478e0..429dbc3 100644
--- a/sys/nfsclient/nfs_kdtrace.c
+++ b/sys/nfsclient/nfs_kdtrace.c
@@ -539,4 +539,4 @@ DEV_MODULE(dtnfsclient, dtnfsclient_modevent, NULL);
MODULE_VERSION(dtnfsclient, 1);
MODULE_DEPEND(dtnfsclient, dtrace, 1, 1, 1);
MODULE_DEPEND(dtnfsclient, opensolaris, 1, 1, 1);
-MODULE_DEPEND(dtnfsclient, nfs, 1, 1, 1);
+MODULE_DEPEND(dtnfsclient, oldnfs, 1, 1, 1);
diff --git a/sys/nfsclient/nfs_kdtrace.h b/sys/nfsclient/nfs_kdtrace.h
deleted file mode 100644
index d29aa68..0000000
--- a/sys/nfsclient/nfs_kdtrace.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*-
- * Copyright (c) 2009 Robert N. M. Watson
- * All rights reserved.
- *
- * This software was developed at the University of Cambridge Computer
- * Laboratory with support from a grant from Google, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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$
- */
-
-#ifndef _NFSCLIENT_NFS_KDTRACE_H_
-#define _NFSCLIENT_NFS_KDTRACE_H_
-
-#ifdef KDTRACE_HOOKS
-#include <sys/dtrace_bsd.h>
-
-/*
- * Definitions for NFS access cache probes.
- */
-extern uint32_t nfsclient_accesscache_flush_done_id;
-extern uint32_t nfsclient_accesscache_get_hit_id;
-extern uint32_t nfsclient_accesscache_get_miss_id;
-extern uint32_t nfsclient_accesscache_load_done_id;
-
-#define KDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp) do { \
- if (dtrace_nfsclient_accesscache_flush_done_probe != NULL) \
- (dtrace_nfsclient_accesscache_flush_done_probe)( \
- nfsclient_accesscache_flush_done_id, (vp)); \
-} while (0)
-
-#define KDTRACE_NFS_ACCESSCACHE_GET_HIT(vp, uid, mode) do { \
- if (dtrace_nfsclient_accesscache_get_hit_probe != NULL) \
- (dtrace_nfsclient_accesscache_get_hit_probe)( \
- nfsclient_accesscache_get_hit_id, (vp), (uid), \
- (mode)); \
-} while (0)
-
-#define KDTRACE_NFS_ACCESSCACHE_GET_MISS(vp, uid, mode) do { \
- if (dtrace_nfsclient_accesscache_get_miss_probe != NULL) \
- (dtrace_nfsclient_accesscache_get_miss_probe)( \
- nfsclient_accesscache_get_miss_id, (vp), (uid), \
- (mode)); \
-} while (0)
-
-#define KDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, uid, rmode, error) do { \
- if (dtrace_nfsclient_accesscache_load_done_probe != NULL) \
- (dtrace_nfsclient_accesscache_load_done_probe)( \
- nfsclient_accesscache_load_done_id, (vp), (uid), \
- (rmode), (error)); \
-} while (0)
-
-/*
- * Definitions for NFS attribute cache probes.
- */
-extern uint32_t nfsclient_attrcache_flush_done_id;
-extern uint32_t nfsclient_attrcache_get_hit_id;
-extern uint32_t nfsclient_attrcache_get_miss_id;
-extern uint32_t nfsclient_attrcache_load_done_id;
-
-#define KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp) do { \
- if (dtrace_nfsclient_attrcache_flush_done_probe != NULL) \
- (dtrace_nfsclient_attrcache_flush_done_probe)( \
- nfsclient_attrcache_flush_done_id, (vp)); \
-} while (0)
-
-#define KDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap) do { \
- if (dtrace_nfsclient_attrcache_get_hit_probe != NULL) \
- (dtrace_nfsclient_attrcache_get_hit_probe)( \
- nfsclient_attrcache_get_hit_id, (vp), (vap)); \
-} while (0)
-
-#define KDTRACE_NFS_ATTRCACHE_GET_MISS(vp) do { \
- if (dtrace_nfsclient_attrcache_get_miss_probe != NULL) \
- (dtrace_nfsclient_attrcache_get_miss_probe)( \
- nfsclient_attrcache_get_miss_id, (vp)); \
-} while (0)
-
-#define KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, error) do { \
- if (dtrace_nfsclient_attrcache_load_done_probe != NULL) \
- (dtrace_nfsclient_attrcache_load_done_probe)( \
- nfsclient_attrcache_load_done_id, (vp), (vap), \
- (error)); \
-} while (0)
-
-#else /* !KDTRACE_HOOKS */
-
-#define KDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp)
-#define KDTRACE_NFS_ACCESSCACHE_GET_HIT(vp, uid, mode)
-#define KDTRACE_NFS_ACCESSCACHE_GET_MISS(vp, uid, mode)
-#define KDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, uid, rmode, error)
-
-#define KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp)
-#define KDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap)
-#define KDTRACE_NFS_ATTRCACHE_GET_MISS(vp)
-#define KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, error)
-
-#endif /* KDTRACE_HOOKS */
-
-#endif /* !_NFSCLIENT_NFS_KDTRACE_H_ */
diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c
index e1ecd19..fe4f5cc 100644
--- a/sys/nfsclient/nfs_subs.c
+++ b/sys/nfsclient/nfs_subs.c
@@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$");
#include <nfs/nfsproto.h>
#include <nfsclient/nfs.h>
#include <nfsclient/nfsnode.h>
-#include <nfsclient/nfs_kdtrace.h>
+#include <nfs/nfs_kdtrace.h>
#include <nfs/xdr_subs.h>
#include <nfsclient/nfsm_subs.h>
#include <nfsclient/nfsmount.h>
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c
index 33506a4..fb3a746 100644
--- a/sys/nfsclient/nfs_vnops.c
+++ b/sys/nfsclient/nfs_vnops.c
@@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$");
#include <nfsclient/nfs.h>
#include <nfsclient/nfsnode.h>
#include <nfsclient/nfsmount.h>
-#include <nfsclient/nfs_kdtrace.h>
+#include <nfs/nfs_kdtrace.h>
#include <nfs/nfs_lock.h>
#include <nfs/xdr_subs.h>
#include <nfsclient/nfsm_subs.h>
diff --git a/sys/powerpc/conf/GENERIC b/sys/powerpc/conf/GENERIC
index 2459988..d221a97 100644
--- a/sys/powerpc/conf/GENERIC
+++ b/sys/powerpc/conf/GENERIC
@@ -77,7 +77,7 @@ options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed
options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
# To make an SMP kernel, the next line is needed
-#options SMP # Symmetric MultiProcessor Kernel
+options SMP # Symmetric MultiProcessor Kernel
# CPU frequency control
device cpufreq
diff --git a/sys/powerpc/mpc85xx/isa.c b/sys/powerpc/mpc85xx/isa.c
index a1715ef..1020e77 100644
--- a/sys/powerpc/mpc85xx/isa.c
+++ b/sys/powerpc/mpc85xx/isa.c
@@ -82,20 +82,3 @@ isa_release_resource(device_t bus, device_t child, int type, int rid,
return (resource_list_release(rl, bus, child, type, rid, r));
}
-
-int
-isa_setup_intr(device_t bus, device_t child, struct resource *r, int flags,
- driver_filter_t filter, void (*ihand)(void *), void *arg, void **cookiep)
-{
-
- return (BUS_SETUP_INTR(device_get_parent(bus), child, r, flags,
- filter, ihand, arg, cookiep));
-}
-
-int
-isa_teardown_intr(device_t bus, device_t child, struct resource *r,
- void *cookie)
-{
-
- return (BUS_TEARDOWN_INTR(device_get_parent(bus), child, r, cookie));
-}
diff --git a/sys/powerpc/powermac/macio.c b/sys/powerpc/powermac/macio.c
index 5ca0089..7b38060 100644
--- a/sys/powerpc/powermac/macio.c
+++ b/sys/powerpc/powermac/macio.c
@@ -65,6 +65,10 @@ struct macio_softc {
vm_offset_t sc_base;
vm_offset_t sc_size;
struct rman sc_mem_rman;
+
+ /* FCR registers */
+ int sc_memrid;
+ struct resource *sc_memr;
};
static MALLOC_DEFINE(M_MACIO, "macio", "macio device information");
@@ -296,6 +300,10 @@ macio_attach(device_t dev)
sc->sc_base = reg[2];
sc->sc_size = MACIO_REG_SIZE;
+ sc->sc_memrid = PCIR_BAR(0);
+ sc->sc_memr = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
+ &sc->sc_memrid, RF_ACTIVE);
+
sc->sc_mem_rman.rm_type = RMAN_ARRAY;
sc->sc_mem_rman.rm_descr = "MacIO Device Memory";
error = rman_init(&sc->sc_mem_rman);
@@ -347,6 +355,29 @@ macio_attach(device_t dev)
continue;
}
device_set_ivars(cdev, dinfo);
+
+ /* Set FCRs to enable some devices */
+ if (sc->sc_memr == NULL)
+ continue;
+
+ if (strcmp(ofw_bus_get_name(cdev), "bmac") == 0 ||
+ strcmp(ofw_bus_get_compat(cdev), "bmac+") == 0) {
+ uint32_t fcr;
+
+ fcr = bus_read_4(sc->sc_memr, HEATHROW_FCR);
+
+ fcr |= FCR_ENET_ENABLE & ~FCR_ENET_RESET;
+ bus_write_4(sc->sc_memr, HEATHROW_FCR, fcr);
+ DELAY(50000);
+ fcr |= FCR_ENET_RESET;
+ bus_write_4(sc->sc_memr, HEATHROW_FCR, fcr);
+ DELAY(50000);
+ fcr &= ~FCR_ENET_RESET;
+ bus_write_4(sc->sc_memr, HEATHROW_FCR, fcr);
+ DELAY(50000);
+
+ bus_write_4(sc->sc_memr, HEATHROW_FCR, fcr);
+ }
}
return (bus_generic_attach(dev));
diff --git a/sys/powerpc/powermac/maciovar.h b/sys/powerpc/powermac/maciovar.h
index c1ff391..ea0a029 100644
--- a/sys/powerpc/powermac/maciovar.h
+++ b/sys/powerpc/powermac/maciovar.h
@@ -38,6 +38,16 @@
#define MACIO_REG_SIZE 0x7ffff
/*
+ * Feature Control Registers (FCR)
+ */
+#define HEATHROW_FCR 0x38
+#define KEYLARGO_FCR0 0x38
+#define KEYLARGO_FCR1 0x3c
+
+#define FCR_ENET_ENABLE 0x60000000
+#define FCR_ENET_RESET 0x80000000
+
+/*
* Format of a macio reg property entry.
*/
struct macio_reg {
diff --git a/sys/sparc64/isa/isa.c b/sys/sparc64/isa/isa.c
index 9159cda..6e22133 100644
--- a/sys/sparc64/isa/isa.c
+++ b/sys/sparc64/isa/isa.c
@@ -359,26 +359,3 @@ isa_release_resource(device_t bus, device_t child, int type, int rid,
return (bus_generic_rl_release_resource(bus, child, type, rid, res));
}
-
-int
-isa_setup_intr(device_t dev, device_t child, struct resource *irq, int flags,
- driver_filter_t *filter, driver_intr_t *intr, void *arg, void **cookiep)
-{
-
- /*
- * Just pass through. This is going to be handled by either
- * one of the parent PCI buses or the nexus device.
- * The interrupt had been routed before it was added to the
- * resource list of the child.
- */
- return (bus_generic_setup_intr(dev, child, irq, flags, filter, intr,
- arg, cookiep));
-}
-
-int
-isa_teardown_intr(device_t dev, device_t child, struct resource *irq,
- void *cookie)
-{
-
- return (bus_generic_teardown_intr(dev, child, irq, cookie));
-}
diff --git a/sys/sys/stdint.h b/sys/sys/stdint.h
index 27f6dae..d5d92a5 100644
--- a/sys/sys/stdint.h
+++ b/sys/sys/stdint.h
@@ -33,46 +33,7 @@
#include <sys/_types.h>
#include <machine/_stdint.h>
-
-#ifndef _INT8_T_DECLARED
-typedef __int8_t int8_t;
-#define _INT8_T_DECLARED
-#endif
-
-#ifndef _INT16_T_DECLARED
-typedef __int16_t int16_t;
-#define _INT16_T_DECLARED
-#endif
-
-#ifndef _INT32_T_DECLARED
-typedef __int32_t int32_t;
-#define _INT32_T_DECLARED
-#endif
-
-#ifndef _INT64_T_DECLARED
-typedef __int64_t int64_t;
-#define _INT64_T_DECLARED
-#endif
-
-#ifndef _UINT8_T_DECLARED
-typedef __uint8_t uint8_t;
-#define _UINT8_T_DECLARED
-#endif
-
-#ifndef _UINT16_T_DECLARED
-typedef __uint16_t uint16_t;
-#define _UINT16_T_DECLARED
-#endif
-
-#ifndef _UINT32_T_DECLARED
-typedef __uint32_t uint32_t;
-#define _UINT32_T_DECLARED
-#endif
-
-#ifndef _UINT64_T_DECLARED
-typedef __uint64_t uint64_t;
-#define _UINT64_T_DECLARED
-#endif
+#include <sys/_stdint.h>
typedef __int_least8_t int_least8_t;
typedef __int_least16_t int_least16_t;
@@ -94,13 +55,13 @@ typedef __uint_fast16_t uint_fast16_t;
typedef __uint_fast32_t uint_fast32_t;
typedef __uint_fast64_t uint_fast64_t;
+#ifndef _INTMAX_T_DECLARED
typedef __intmax_t intmax_t;
+#define _INTMAX_T_DECLARED
+#endif
+#ifndef _UINTMAX_T_DECLARED
typedef __uintmax_t uintmax_t;
-
-#ifndef _INTPTR_T_DECLARED
-typedef __intptr_t intptr_t;
-typedef __uintptr_t uintptr_t;
-#define _INTPTR_T_DECLARED
+#define _UINTMAX_T_DECLARED
#endif
#endif /* !_SYS_STDINT_H_ */
diff --git a/sys/sys/types.h b/sys/sys/types.h
index 5cc005d..cb513af 100644
--- a/sys/sys/types.h
+++ b/sys/sys/types.h
@@ -60,51 +60,7 @@ typedef unsigned int uint; /* Sys V compatibility */
/*
* XXX POSIX sized integrals that should appear only in <sys/stdint.h>.
*/
-#ifndef _INT8_T_DECLARED
-typedef __int8_t int8_t;
-#define _INT8_T_DECLARED
-#endif
-
-#ifndef _INT16_T_DECLARED
-typedef __int16_t int16_t;
-#define _INT16_T_DECLARED
-#endif
-
-#ifndef _INT32_T_DECLARED
-typedef __int32_t int32_t;
-#define _INT32_T_DECLARED
-#endif
-
-#ifndef _INT64_T_DECLARED
-typedef __int64_t int64_t;
-#define _INT64_T_DECLARED
-#endif
-
-#ifndef _UINT8_T_DECLARED
-typedef __uint8_t uint8_t;
-#define _UINT8_T_DECLARED
-#endif
-
-#ifndef _UINT16_T_DECLARED
-typedef __uint16_t uint16_t;
-#define _UINT16_T_DECLARED
-#endif
-
-#ifndef _UINT32_T_DECLARED
-typedef __uint32_t uint32_t;
-#define _UINT32_T_DECLARED
-#endif
-
-#ifndef _UINT64_T_DECLARED
-typedef __uint64_t uint64_t;
-#define _UINT64_T_DECLARED
-#endif
-
-#ifndef _INTPTR_T_DECLARED
-typedef __intptr_t intptr_t;
-typedef __uintptr_t uintptr_t;
-#define _INTPTR_T_DECLARED
-#endif
+#include <sys/_stdint.h>
typedef __uint8_t u_int8_t; /* unsigned integrals (deprecated) */
typedef __uint16_t u_int16_t;
diff --git a/sys/x86/isa/isa.c b/sys/x86/isa/isa.c
index 7b2982a..1a57137 100644
--- a/sys/x86/isa/isa.c
+++ b/sys/x86/isa/isa.c
@@ -238,28 +238,6 @@ isa_release_resource(device_t bus, device_t child, int type, int rid,
}
/*
- * We can't use the bus_generic_* versions of these methods because those
- * methods always pass the bus param as the requesting device, and we need
- * to pass the child (the i386 nexus knows about this and is prepared to
- * deal).
- */
-int
-isa_setup_intr(device_t bus, device_t child, struct resource *r, int flags,
- driver_filter_t *filter, void (*ihand)(void *), void *arg,
- void **cookiep)
-{
- return (BUS_SETUP_INTR(device_get_parent(bus), child, r, flags,
- filter, ihand, arg, cookiep));
-}
-
-int
-isa_teardown_intr(device_t bus, device_t child, struct resource *r,
- void *cookie)
-{
- return (BUS_TEARDOWN_INTR(device_get_parent(bus), child, r, cookie));
-}
-
-/*
* On this platform, isa can also attach to the legacy bus.
*/
DRIVER_MODULE(isa, legacy, isa_driver, isa_devclass, 0, 0);
diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index e81d2fe..dfef3a7 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -159,9 +159,8 @@ static struct eventtimer lapic_et;
static void lapic_enable(void);
static void lapic_resume(struct pic *pic);
-static void lapic_timer_enable_intr(void);
-static void lapic_timer_oneshot(u_int count);
-static void lapic_timer_periodic(u_int count);
+static void lapic_timer_oneshot(u_int count, int enable_int);
+static void lapic_timer_periodic(u_int count, int enable_int);
static void lapic_timer_stop(void);
static void lapic_timer_set_divisor(u_int divisor);
static uint32_t lvt_mode(struct lapic *la, u_int pin, uint32_t value);
@@ -379,13 +378,11 @@ lapic_setup(int boot)
if (la->la_timer_mode != 0) {
KASSERT(la->la_timer_period != 0, ("lapic%u: zero divisor",
lapic_id()));
- lapic_timer_stop();
lapic_timer_set_divisor(lapic_timer_divisor);
- lapic_timer_enable_intr();
if (la->la_timer_mode == 1)
- lapic_timer_periodic(la->la_timer_period);
+ lapic_timer_periodic(la->la_timer_period, 1);
else
- lapic_timer_oneshot(la->la_timer_period);
+ lapic_timer_oneshot(la->la_timer_period, 1);
}
/* Program error LVT and clear any existing errors. */
@@ -496,7 +493,7 @@ lapic_et_start(struct eventtimer *et,
/* Try to calibrate the local APIC timer. */
do {
lapic_timer_set_divisor(lapic_timer_divisor);
- lapic_timer_oneshot(APIC_TIMER_MAX_COUNT);
+ lapic_timer_oneshot(APIC_TIMER_MAX_COUNT, 0);
DELAY(1000000);
value = APIC_TIMER_MAX_COUNT - lapic->ccr_timer;
if (value != APIC_TIMER_MAX_COUNT)
@@ -516,9 +513,7 @@ lapic_et_start(struct eventtimer *et,
et->et_max_period.frac =
((0xfffffffeLLU << 32) / et->et_frequency) << 32;
}
- lapic_timer_stop();
lapic_timer_set_divisor(lapic_timer_divisor);
- lapic_timer_enable_intr();
la = &lapics[lapic_id()];
if (period != NULL) {
la->la_timer_mode = 1;
@@ -526,14 +521,14 @@ lapic_et_start(struct eventtimer *et,
(et->et_frequency * (period->frac >> 32)) >> 32;
if (period->sec != 0)
la->la_timer_period += et->et_frequency * period->sec;
- lapic_timer_periodic(la->la_timer_period);
+ lapic_timer_periodic(la->la_timer_period, 1);
} else {
la->la_timer_mode = 2;
la->la_timer_period =
(et->et_frequency * (first->frac >> 32)) >> 32;
if (first->sec != 0)
la->la_timer_period += et->et_frequency * first->sec;
- lapic_timer_oneshot(la->la_timer_period);
+ lapic_timer_oneshot(la->la_timer_period, 1);
}
return (0);
}
@@ -838,25 +833,29 @@ lapic_timer_set_divisor(u_int divisor)
}
static void
-lapic_timer_oneshot(u_int count)
+lapic_timer_oneshot(u_int count, int enable_int)
{
u_int32_t value;
value = lapic->lvt_timer;
value &= ~APIC_LVTT_TM;
value |= APIC_LVTT_TM_ONE_SHOT;
+ if (enable_int)
+ value &= ~APIC_LVT_M;
lapic->lvt_timer = value;
lapic->icr_timer = count;
}
static void
-lapic_timer_periodic(u_int count)
+lapic_timer_periodic(u_int count, int enable_int)
{
u_int32_t value;
value = lapic->lvt_timer;
value &= ~APIC_LVTT_TM;
value |= APIC_LVTT_TM_PERIODIC;
+ if (enable_int)
+ value &= ~APIC_LVT_M;
lapic->lvt_timer = value;
lapic->icr_timer = count;
}
@@ -870,17 +869,6 @@ lapic_timer_stop(void)
value &= ~APIC_LVTT_TM;
value |= APIC_LVT_M;
lapic->lvt_timer = value;
- lapic->icr_timer = 0;
-}
-
-static void
-lapic_timer_enable_intr(void)
-{
- u_int32_t value;
-
- value = lapic->lvt_timer;
- value &= ~APIC_LVT_M;
- lapic->lvt_timer = value;
}
void
OpenPOWER on IntegriCloud