svn commit: r224509 - head/sys/dev/ath/ath_hal/ar5416

2011-07-30 Thread Adrian Chadd
Author: adrian
Date: Sat Jul 30 13:18:48 2011
New Revision: 224509
URL: http://svn.freebsd.org/changeset/base/224509

Log:
  Fix the AR9280 initial AGC calibration code.
  
  It looks like this was mixed up with the AR9285 calibration code.
  This code is now more in line with what Linux ath9k and Atheros
  reference drivers do.
  
  Obtained from:Atheros
  Approved by:  re (kib)

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.cSat Jul 30 09:38:52 
2011(r224508)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.cSat Jul 30 13:18:48 
2011(r224509)
@@ -186,36 +186,22 @@ ar5416RunInitCals(struct ath_hal *ah, in
 }
 #endif
 
+
+/*
+ * AGC calibration for the AR5416, AR9130, AR9160, AR9280.
+ */
 HAL_BOOL
 ar5416InitCalHardware(struct ath_hal *ah, const struct ieee80211_channel *chan)
 {
-   if (AR_SREV_MERLIN_10_OR_LATER(ah)) {
-   /* Enable Rx Filter Cal */
-   OS_REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
-   OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
-   AR_PHY_AGC_CONTROL_FLTR_CAL);
-
-   /* Clear the carrier leak cal bit */
-   OS_REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE);
 
-   /* kick off the cal */
-   OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL);
-
-   /* Poll for offset calibration complete */
-   if (!ath_hal_wait(ah, AR_PHY_AGC_CONTROL, 
AR_PHY_AGC_CONTROL_CAL, 0)) {
-   HALDEBUG(ah, HAL_DEBUG_ANY,
-   "%s: offset calibration failed to complete in 1ms; "
-   "noisy environment?\n", __func__);
-   return AH_FALSE;
-   }
+   if (AR_SREV_MERLIN_10_OR_LATER(ah)) {
+   /* Disable ADC */
+   OS_REG_CLR_BIT(ah, AR_PHY_ADC_CTL,
+   AR_PHY_ADC_CTL_OFF_PWDADC);
 
-   /* Set the cl cal bit and rerun the cal a 2nd time */
/* Enable Rx Filter Cal */
-   OS_REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
AR_PHY_AGC_CONTROL_FLTR_CAL);
-
-   OS_REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE);
}   
 
/* Calibrate the AGC */
@@ -229,6 +215,16 @@ ar5416InitCalHardware(struct ath_hal *ah
return AH_FALSE;
}
 
+   if (AR_SREV_MERLIN_10_OR_LATER(ah)) {
+   /* Enable ADC */
+   OS_REG_SET_BIT(ah, AR_PHY_ADC_CTL,
+   AR_PHY_ADC_CTL_OFF_PWDADC);
+
+   /* Disable Rx Filter Cal */
+   OS_REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
+   AR_PHY_AGC_CONTROL_FLTR_CAL);
+   }
+
return AH_TRUE;
 }
 
@@ -247,7 +243,8 @@ ar5416InitCal(struct ath_hal *ah, const 
 
/* Do initial chipset-specific calibration */
if (! AH5416(ah)->ah_cal_initcal(ah, chan)) {
-   HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial chipset calibration 
did "
+   HALDEBUG(ah, HAL_DEBUG_ANY,
+   "%s: initial chipset calibration did "
"not complete in time; noisy environment?\n", __func__);
return AH_FALSE;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224510 - head/sys/dev/ath/ath_hal/ar5416

2011-07-30 Thread Adrian Chadd
Author: adrian
Date: Sat Jul 30 13:21:33 2011
New Revision: 224510
URL: http://svn.freebsd.org/changeset/base/224510

Log:
  I noticed that the Merlin NICs I had (AR9220, AR9280) never completed
  the ADC calibrations if the NIC is in 5ghz 11a or 5ghz HT/20 modes.
  I've been told that the dual-ADC is only engaged in turbo/40mhz modes.
  
  Since Sowl (AR9160) seems to return valid-looking calibration data
  in 5ghz 20MHz modes, I'm only disabling it for Merlin for now.
  It may turn out I can disable it for all chipsets and only enable
  it for 40MHz modes.
  
  Approved by:  re (kib)

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.cSat Jul 30 13:18:48 
2011(r224509)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.cSat Jul 30 13:21:33 
2011(r224510)
@@ -73,8 +73,15 @@ ar5416IsCalSupp(struct ath_hal *ah, cons
case ADC_GAIN_CAL:
case ADC_DC_CAL:
/* Run ADC Gain Cal for either 5ghz any or 2ghz HT40 */
-   if (IEEE80211_IS_CHAN_5GHZ(chan))
-   return AH_TRUE;
+   /*
+* Merlin (AR9280) doesn't ever complete ADC calibrations
+* in 5ghz non-HT40 mode (ie, HT20, 11a). For now, disable
+* it for Merlin only until further information is
+* available.
+*/
+   if (! AR_SREV_MERLIN(ah))
+   if (IEEE80211_IS_CHAN_5GHZ(chan))
+   return AH_TRUE;
if (IEEE80211_IS_CHAN_HT40(chan))
return AH_TRUE;
return AH_FALSE;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224511 - in head: lib/libusbhid usr.bin/usbhidaction usr.bin/usbhidctl

2011-07-30 Thread Alexander Motin
Author: mav
Date: Sat Jul 30 13:22:44 2011
New Revision: 224511
URL: http://svn.freebsd.org/changeset/base/224511

Log:
  MFprojects/hid:
   - Fix usbhidctl and usbhidaction to handle HID devices with multiple
  report ids, such as multimedia keyboards.
   - Add collection type and report id to the `usbhidctl -r` output. They
  are important for proper device understanding and debugging.
   - Fix usbhidaction tool to properly handle items having report_count
  more then 1.
  
  Approved by:  re (kib)
  MFC after:2 weeks

Modified:
  head/lib/libusbhid/parse.c
  head/usr.bin/usbhidaction/usbhidaction.c
  head/usr.bin/usbhidctl/usbhid.c

Modified: head/lib/libusbhid/parse.c
==
--- head/lib/libusbhid/parse.c  Sat Jul 30 13:21:33 2011(r224510)
+++ head/lib/libusbhid/parse.c  Sat Jul 30 13:22:44 2011(r224511)
@@ -322,6 +322,8 @@ hid_get_item(hid_data_t s, hid_item_t *h
 * one and one item:
 */
c->report_count = 1;
+   c->usage_minimum = 0;
+   c->usage_maximum = 0;
} else {
s->ncount = 1;
}
@@ -512,13 +514,14 @@ hid_report_size(report_desc_t r, enum hi
uint32_t temp;
uint32_t hpos;
uint32_t lpos;
+   int report_id = 0;
 
hpos = 0;
lpos = 0x;
 
memset(&h, 0, sizeof h);
for (d = hid_start_parse(r, 1 << k, id); hid_get_item(d, &h); ) {
-   if (h.report_ID == id && h.kind == k) {
+   if ((h.report_ID == id || id < 0) && h.kind == k) {
/* compute minimum */
if (lpos > h.pos)
lpos = h.pos;
@@ -527,6 +530,8 @@ hid_report_size(report_desc_t r, enum hi
/* compute maximum */
if (hpos < temp)
hpos = temp;
+   if (h.report_ID != 0)
+   report_id = 1;
}
}
hid_end_parse(d);
@@ -537,11 +542,8 @@ hid_report_size(report_desc_t r, enum hi
else
temp = hpos - lpos;
 
-   if (id)
-   temp += 8;
-
/* return length in bytes rounded up */
-   return ((temp + 7) / 8);
+   return ((temp + 7) / 8 + report_id);
 }
 
 int

Modified: head/usr.bin/usbhidaction/usbhidaction.c
==
--- head/usr.bin/usbhidaction/usbhidaction.cSat Jul 30 13:21:33 2011
(r224510)
+++ head/usr.bin/usbhidaction/usbhidaction.cSat Jul 30 13:22:44 2011
(r224511)
@@ -92,12 +92,12 @@ main(int argc, char **argv)
char buf[100];
char devnamebuf[PATH_MAX];
struct command *cmd;
-   int reportid;
+   int reportid = -1;
 
demon = 1;
ignore = 0;
dieearly = 0;
-   while ((ch = getopt(argc, argv, "c:def:ip:t:v")) != -1) {
+   while ((ch = getopt(argc, argv, "c:def:ip:r:t:v")) != -1) {
switch(ch) {
case 'c':
conf = optarg;
@@ -117,6 +117,9 @@ main(int argc, char **argv)
case 'p':
pidfile = optarg;
break;
+   case 'r':
+   reportid = atoi(optarg);
+   break;
case 't':
table = optarg;
break;
@@ -146,14 +149,13 @@ main(int argc, char **argv)
fd = open(dev, O_RDWR);
if (fd < 0)
err(1, "%s", dev);
-   reportid = hid_get_report_id(fd);
repd = hid_get_report_desc(fd);
if (repd == NULL)
err(1, "hid_get_report_desc() failed");
 
commands = parse_conf(conf, repd, reportid, ignore);
 
-   sz = (size_t)hid_report_size(repd, hid_input, reportid);
+   sz = (size_t)hid_report_size(repd, hid_input, -1);
 
if (verbose)
printf("report size %zu\n", sz);
@@ -198,7 +200,23 @@ main(int argc, char **argv)
}
 #endif
for (cmd = commands; cmd; cmd = cmd->next) {
-   val = hid_get_data(buf, &cmd->item);
+   if (cmd->item.report_ID != 0 &&
+   buf[0] != cmd->item.report_ID)
+   continue;
+   if (cmd->item.flags & HIO_VARIABLE)
+   val = hid_get_data(buf, &cmd->item);
+   else {
+   uint32_t pos = cmd->item.pos;
+   for (i = 0; i < cmd->item.report_count; i++) {
+   val 

svn commit: r224512 - head/sys/dev/ath/ath_hal/ar5416

2011-07-30 Thread Adrian Chadd
Author: adrian
Date: Sat Jul 30 13:25:11 2011
New Revision: 224512
URL: http://svn.freebsd.org/changeset/base/224512

Log:
  Bring over AR5416 specific RX filter get/set routines.
  
  This in particular fixes radar PHY handling - on the AR5212
  NIC, one enables the AR_PHY_ERR_RADAR bit in AR_PHY_ERR;
  the AR5416 and later also needs a bit set in AR_RX_FILTER.
  
  A follow-up commit is needed to convert the AR5416 ANI code
  to use this particular method, as it's currently using the
  AR5212 methods directly.
  
  Obtained from:Atheros
  Approved by:  re (kib)

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416.hSat Jul 30 13:22:44 2011
(r224511)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416.hSat Jul 30 13:25:11 2011
(r224512)
@@ -218,6 +218,8 @@ extern  HAL_BOOL ar5416ResetKeyCacheEntry
 extern HAL_BOOL ar5416SetKeyCacheEntry(struct ath_hal *ah, uint16_t entry,
   const HAL_KEYVAL *k, const uint8_t *mac, int xorKey);
 
+extern uint32_t ar5416GetRxFilter(struct ath_hal *ah);
+extern void ar5416SetRxFilter(struct ath_hal *ah, uint32_t bits);
 extern void ar5416StartPcuReceive(struct ath_hal *ah);
 extern void ar5416StopPcuReceive(struct ath_hal *ah);
 extern HAL_BOOL ar5416SetupRxDesc(struct ath_hal *,

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Sat Jul 30 13:22:44 
2011(r224511)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Sat Jul 30 13:25:11 
2011(r224512)
@@ -117,6 +117,8 @@ ar5416InitState(struct ath_hal_5416 *ahp
ah->ah_resetTxQueue = ar5416ResetTxQueue;
 
/* Receive Functions */
+   ah->ah_getRxFilter  = ar5416GetRxFilter;
+   ah->ah_setRxFilter  = ar5416SetRxFilter;
ah->ah_startPcuReceive  = ar5416StartPcuReceive;
ah->ah_stopPcuReceive   = ar5416StopPcuReceive;
ah->ah_setupRxDesc  = ar5416SetupRxDesc;

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c   Sat Jul 30 13:22:44 
2011(r224511)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c   Sat Jul 30 13:25:11 
2011(r224512)
@@ -27,6 +27,46 @@
 #include "ar5416/ar5416desc.h"
 
 /*
+ * Get the receive filter.
+ */
+uint32_t
+ar5416GetRxFilter(struct ath_hal *ah)
+{
+   uint32_t bits = OS_REG_READ(ah, AR_RX_FILTER);
+   uint32_t phybits = OS_REG_READ(ah, AR_PHY_ERR);
+
+   if (phybits & AR_PHY_ERR_RADAR)
+   bits |= HAL_RX_FILTER_PHYRADAR;
+   if (phybits & (AR_PHY_ERR_OFDM_TIMING | AR_PHY_ERR_CCK_TIMING))
+   bits |= HAL_RX_FILTER_PHYERR;
+   return bits;
+}
+
+/*
+ * Set the receive filter.
+ */
+void
+ar5416SetRxFilter(struct ath_hal *ah, u_int32_t bits)
+{
+   uint32_t phybits;
+
+   OS_REG_WRITE(ah, AR_RX_FILTER, (bits & 0x));
+   phybits = 0;
+   if (bits & HAL_RX_FILTER_PHYRADAR)
+   phybits |= AR_PHY_ERR_RADAR;
+   if (bits & HAL_RX_FILTER_PHYERR)
+   phybits |= AR_PHY_ERR_OFDM_TIMING | AR_PHY_ERR_CCK_TIMING;
+   OS_REG_WRITE(ah, AR_PHY_ERR, phybits);
+   if (phybits) {
+   OS_REG_WRITE(ah, AR_RXCFG,
+   OS_REG_READ(ah, AR_RXCFG) | AR_RXCFG_ZLFDMA);
+   } else {
+   OS_REG_WRITE(ah, AR_RXCFG,
+   OS_REG_READ(ah, AR_RXCFG) &~ AR_RXCFG_ZLFDMA);
+   }
+}
+
+/*
  * Start receive at the PCU engine
  */
 void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224514 - in head/sys/dev/ath/ath_hal: ar5212 ar5416

2011-07-30 Thread Adrian Chadd
Author: adrian
Date: Sat Jul 30 13:30:24 2011
New Revision: 224514
URL: http://svn.freebsd.org/changeset/base/224514

Log:
  Fix ANI handling to work correctly when (trying) to receive radar errors.
  
  * Teach the AR5212/AR5416 ANI code to use the RX filter methods, rather
than calling the RX filter routines directly.
  
  * Make HAL_ANI_PRESENT and HAL_ANI_MODE unconditionally available,
regardless of whether ah_ani_function is masking it.
  
  * (Mostly) fully disable ANI if interference mitigation is disabled.
When disabled, the ANI code doesn't touch any ANI/PHY registers,
leaving them the default value. This is in line with what the
Atheros reference driver does.
  
  * Correctly set the ANI parameters during ANI reset, rather than
when ANI is enabled. In this way, if ANI is disabled or enabled
whilst the NIC is not active (and there's no current channel),
bogus parameters or a NULL pointer deference doesn't occur.
  
  There's still some lingering issues - notably, the MIB events/interrupts
  aren't fully disabled, so MIB interrupts still occur. I'll worry about
  that later.
  
  Approved by:  re (kib)

Modified:
  head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c
==
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.cSat Jul 30 13:28:11 
2011(r224513)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.cSat Jul 30 13:30:24 
2011(r224514)
@@ -222,7 +222,14 @@ ar5212AniControl(struct ath_hal *ah, HAL
typedef int TABLE[];
struct ath_hal_5212 *ahp = AH5212(ah);
struct ar5212AniState *aniState = ahp->ah_curani;
-   const struct ar5212AniParams *params = aniState->params;
+   const struct ar5212AniParams *params = AH_NULL;
+   
+   /*
+* This function may be called before there's a current
+* channel (eg to disable ANI.)
+*/
+   if (aniState != AH_NULL)
+   params = aniState->params;
 
OS_MARK(ah, AH_MARK_ANI_CONTROL, cmd);
 
@@ -343,8 +350,8 @@ ar5212AniControl(struct ath_hal *ah, HAL
ahp->ah_procPhyErr &= ~HAL_ANI_ENA;
/* Turn off HW counters if we have them */
ar5212AniDetach(ah);
-   ar5212SetRxFilter(ah,
-   ar5212GetRxFilter(ah) &~ HAL_RX_FILTER_PHYERR);
+   ah->ah_setRxFilter(ah,
+   ah->ah_getRxFilter(ah) &~ HAL_RX_FILTER_PHYERR);
} else {/* normal/auto mode */
/* don't mess with state if already enabled */
if (ahp->ah_procPhyErr & HAL_ANI_ENA)
@@ -358,8 +365,8 @@ ar5212AniControl(struct ath_hal *ah, HAL
ahp->ah_curani->params:
&ahp->ah_aniParams24 /*XXX*/);
} else {
-   ar5212SetRxFilter(ah,
-   ar5212GetRxFilter(ah) | 
HAL_RX_FILTER_PHYERR);
+   ah->ah_setRxFilter(ah,
+   ah->ah_getRxFilter(ah) | 
HAL_RX_FILTER_PHYERR);
}
ahp->ah_procPhyErr |= HAL_ANI_ENA;
}
@@ -609,8 +616,20 @@ ar5212AniReset(struct ath_hal *ah, const
/*
 * Turn off PHY error frame delivery while we futz with settings.
 */
-   rxfilter = ar5212GetRxFilter(ah);
-   ar5212SetRxFilter(ah, rxfilter &~ HAL_RX_FILTER_PHYERR);
+   rxfilter = ah->ah_getRxFilter(ah);
+   ah->ah_setRxFilter(ah, rxfilter &~ HAL_RX_FILTER_PHYERR);
+
+   /*
+* If ANI is disabled at this point, don't set the default
+* ANI parameter settings - leave the HAL settings there.
+* This is (currently) needed for reliable radar detection.
+*/
+   if (! ANI_ENA(ah)) {
+   HALDEBUG(ah, HAL_DEBUG_ANI, "%s: ANI disabled\n",
+   __func__);
+   goto finish;
+   }
+
/*
 * Automatic processing is done only in station mode right now.
 */
@@ -644,10 +663,15 @@ ar5212AniReset(struct ath_hal *ah, const
ar5212AniControl(ah, HAL_ANI_FIRSTEP_LEVEL, 0);
ichan->privFlags |= CHANNEL_ANI_SETUP;
}
+   /*
+* In case the counters haven't yet been setup; set them up.
+*/
+   enableAniMIBCounters(ah, ahp->ah_curani->params);
ar5212AniRestart(ah, aniState);
 
+finish:
/* restore RX filter mask */
-   ar5212SetRxFilter(ah, rxfilter);
+   ah->ah_setRxFilter(ah, rxfilter);
 }
 
 /*

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
==

svn commit: r224515 - head/sys/dev/ath/ath_hal/ar9002

2011-07-30 Thread Adrian Chadd
Author: adrian
Date: Sat Jul 30 13:31:27 2011
New Revision: 224515
URL: http://svn.freebsd.org/changeset/base/224515

Log:
  Fix the initial calibration sample count when doing ADC calibrations.
  
  Obtained from:Atheros
  Approved by:  re (kib)

Modified:
  head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c

Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
==
--- head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c Sat Jul 30 13:30:24 
2011(r224514)
+++ head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c Sat Jul 30 13:31:27 
2011(r224515)
@@ -42,14 +42,14 @@ static const HAL_PERCAL_DATA ar9280_iq_c
 static const HAL_PERCAL_DATA ar9280_adc_gain_cal = {   /* single sample */
.calName = "ADC Gain", .calType = ADC_GAIN_CAL,
.calNumSamples  = MIN_CAL_SAMPLES,
-   .calCountMax= PER_MIN_LOG_COUNT,
+   .calCountMax= PER_MAX_LOG_COUNT,
.calCollect = ar5416AdcGainCalCollect,
.calPostProc= ar5416AdcGainCalibration
 };
 static const HAL_PERCAL_DATA ar9280_adc_dc_cal = { /* single sample */
.calName = "ADC DC", .calType = ADC_DC_CAL,
.calNumSamples  = MIN_CAL_SAMPLES,
-   .calCountMax= PER_MIN_LOG_COUNT,
+   .calCountMax= PER_MAX_LOG_COUNT,
.calCollect = ar5416AdcDcCalCollect,
.calPostProc= ar5416AdcDcCalibration
 };
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224516 - in head/sys: amd64/amd64 i386/i386 pc98/pc98

2011-07-30 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Jul 30 13:33:05 2011
New Revision: 224516
URL: http://svn.freebsd.org/changeset/base/224516

Log:
  Introduce a tunable to disable the time consuming parts of bootup
  memtesting, which can easily save seconds to minutes of boot time.
  The tunable name is kept general to allow reusing the code in
  alternate frameworks.
  
  Requested by: many
  Discussed on: arch (a while a go)
  Obtained from:Sandvine Incorporated
  Reviewed by:  sbruno
  Approved by:  re (kib)
  MFC after:2 weeks

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/i386/i386/machdep.c
  head/sys/pc98/pc98/machdep.c

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Sat Jul 30 13:31:27 2011
(r224515)
+++ head/sys/amd64/amd64/machdep.c  Sat Jul 30 13:33:05 2011
(r224516)
@@ -1309,7 +1309,7 @@ getmemsize(caddr_t kmdp, u_int64_t first
 {
int i, physmap_idx, pa_indx, da_indx;
vm_paddr_t pa, physmap[PHYSMAP_SIZE];
-   u_long physmem_tunable;
+   u_long physmem_tunable, memtest, tmpul;
pt_entry_t *pte;
struct bios_smap *smapbase, *smap, *smapend;
u_int32_t smapsize;
@@ -1372,6 +1372,14 @@ getmemsize(caddr_t kmdp, u_int64_t first
Maxmem = atop(physmem_tunable);
 
/*
+* By default keep the memtest enabled.  Use a general name so that
+* one could eventually do more with the code than just disable it.
+*/
+   memtest = 1;
+   if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul))
+   memtest = tmpul;
+
+   /*
 * Don't allow MAXMEM or hw.physmem to extend the amount of memory
 * in the system.
 */
@@ -1433,6 +1441,8 @@ getmemsize(caddr_t kmdp, u_int64_t first
goto do_dump_avail;
 
page_bad = FALSE;
+   if (memtest == 0)
+   goto skip_memtest;
 
/*
 * map page into kernel: valid, read/write,non-cacheable
@@ -1470,6 +1480,7 @@ getmemsize(caddr_t kmdp, u_int64_t first
 */
*(int *)ptr = tmp;
 
+skip_memtest:
/*
 * Adjust array of valid/good pages.
 */

Modified: head/sys/i386/i386/machdep.c
==
--- head/sys/i386/i386/machdep.cSat Jul 30 13:31:27 2011
(r224515)
+++ head/sys/i386/i386/machdep.cSat Jul 30 13:33:05 2011
(r224516)
@@ -2132,7 +2132,7 @@ static void
 getmemsize(int first)
 {
int has_smap, off, physmap_idx, pa_indx, da_indx;
-   u_long physmem_tunable;
+   u_long physmem_tunable, memtest, tmpul;
vm_paddr_t physmap[PHYSMAP_SIZE];
pt_entry_t *pte;
quad_t dcons_addr, dcons_size;
@@ -2339,6 +2339,14 @@ physmap_done:
if (has_smap && Maxmem > atop(physmap[physmap_idx + 1]))
Maxmem = atop(physmap[physmap_idx + 1]);
 
+   /*
+* By default keep the memtest enabled.  Use a general name so that
+* one could eventually do more with the code than just disable it.
+*/
+   memtest = 1;
+   if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul))
+   memtest = tmpul;
+
if (atop(physmap[physmap_idx + 1]) != Maxmem &&
(boothowto & RB_VERBOSE))
printf("Physical memory use set to %ldK\n", Maxmem * 4);
@@ -2402,6 +2410,8 @@ physmap_done:
goto do_dump_avail;
 
page_bad = FALSE;
+   if (memtest == 0)
+   goto skip_memtest;
 
/*
 * map page into kernel: valid, read/write,non-cacheable
@@ -2439,6 +2449,7 @@ physmap_done:
 */
*(int *)ptr = tmp;
 
+skip_memtest:
/*
 * Adjust array of valid/good pages.
 */

Modified: head/sys/pc98/pc98/machdep.c
==
--- head/sys/pc98/pc98/machdep.cSat Jul 30 13:31:27 2011
(r224515)
+++ head/sys/pc98/pc98/machdep.cSat Jul 30 13:33:05 2011
(r224516)
@@ -1855,7 +1855,7 @@ static void
 getmemsize(int first)
 {
int off, physmap_idx, pa_indx, da_indx;
-   u_long physmem_tunable;
+   u_long physmem_tunable, memtest, tmpul;
vm_paddr_t physmap[PHYSMAP_SIZE];
pt_entry_t *pte;
quad_t dcons_addr, dcons_size;
@@ -1915,6 +1915,14 @@ getmemsize(int first)
if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable))
Maxmem = atop(physmem_tunable);
 
+   /*
+* By default keep the memtest enabled.

svn commit: r224517 - head/sys/dev/ath/ath_hal/ar5416

2011-07-30 Thread Adrian Chadd
Author: adrian
Date: Sat Jul 30 13:34:57 2011
New Revision: 224517
URL: http://svn.freebsd.org/changeset/base/224517

Log:
  Fix AR5416 radar parameter initialisation.
  
  * I messed up the order of parameter true/false; oops!
  * AR_PHY_RADAR_1 was being written at the wrong place, and was writing
potential garbage to the hardware.
  
  Approved by:  re (kib)

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c   Sat Jul 30 13:33:05 
2011(r224516)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c   Sat Jul 30 13:34:57 
2011(r224517)
@@ -670,26 +670,27 @@ ar5416EnableDfs(struct ath_hal *ah, HAL_
 
OS_REG_WRITE(ah, AR_PHY_RADAR_0, val | AR_PHY_RADAR_0_ENA);
 
-   if (pe->pe_usefir128 == 0)
-   OS_REG_SET_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_USE_FIR128);
-   else if (pe->pe_usefir128 == 1)
+   if (pe->pe_usefir128 == 1)
OS_REG_CLR_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_USE_FIR128);
+   else if (pe->pe_usefir128 == 0)
+   OS_REG_SET_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_USE_FIR128);
 
-   if (pe->pe_enmaxrssi == 0)
+   if (pe->pe_enmaxrssi == 1)
OS_REG_SET_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_MAX_RRSSI);
-   else if (pe->pe_enmaxrssi == 1)
+   else if (pe->pe_enmaxrssi == 0)
OS_REG_CLR_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_MAX_RRSSI);
 
-   if (pe->pe_blockradar == 0)
+   if (pe->pe_blockradar == 1)
OS_REG_SET_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_BLOCK_CHECK);
-   else if (pe->pe_blockradar == 1)
+   else if (pe->pe_blockradar == 0)
OS_REG_CLR_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_BLOCK_CHECK);
 
if (pe->pe_maxlen != HAL_PHYERR_PARAM_NOVAL) {
+   val = OS_REG_READ(ah, AR_PHY_RADAR_1);
val &= ~AR_PHY_RADAR_1_MAXLEN;
val |= SM(pe->pe_maxlen, AR_PHY_RADAR_1_MAXLEN);
+   OS_REG_WRITE(ah, AR_PHY_RADAR_1, val);
}
-   OS_REG_WRITE(ah, AR_PHY_RADAR_1, val);
 
/*
 * Enable HT/40 if the upper layer asks;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224518 - head/sys/dev/ath/ath_hal

2011-07-30 Thread Adrian Chadd
Author: adrian
Date: Sat Jul 30 13:37:38 2011
New Revision: 224518
URL: http://svn.freebsd.org/changeset/base/224518

Log:
  Prepare for embedded use of the AR9285/AR9287.
  
  Calibration/PCI data that's written to flash (rather than EEPROM attached
  to the NIC) is typically already in host-endian. The existing checks
  end up swapping 16 bit words incorrectly - the correct solution would be
  to read the magic value and determine the EEPROM endianness from that.
  (This is what Linux does.)
  
  This doesn't completely enable embedded use of the AR9285/AR9287 -
  notably, the EEPROM read methods need to be made generic and available
  to all EEPROM drivers. I'll worry about that later.
  
  Approved by:  re (kib)

Modified:
  head/sys/dev/ath/ath_hal/ah_eeprom_9287.c
  head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c

Modified: head/sys/dev/ath/ath_hal/ah_eeprom_9287.c
==
--- head/sys/dev/ath/ath_hal/ah_eeprom_9287.c   Sat Jul 30 13:34:57 2011
(r224517)
+++ head/sys/dev/ath/ath_hal/ah_eeprom_9287.c   Sat Jul 30 13:37:38 2011
(r224518)
@@ -298,11 +298,18 @@ ath_hal_9287EepromAttach(struct ath_hal 
uint32_t sum;
 
HALASSERT(ee == AH_NULL);
- 
-   if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
-   HALDEBUG(ah, HAL_DEBUG_ANY,
-   "%s Error reading Eeprom MAGIC\n", __func__);
-   return HAL_EEREAD;
+
+   /*
+* Don't check magic if we're supplied with an EEPROM block,
+* typically this is from Howl but it may also be from later
+* boards w/ an embedded WMAC.
+*/
+   if (ah->ah_eepromdata == NULL) {
+   if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, 
&magic)) {
+   HALDEBUG(ah, HAL_DEBUG_ANY,
+   "%s Error reading Eeprom MAGIC\n", __func__);
+   return HAL_EEREAD;
+   }
}
HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n",
__func__, magic);
@@ -328,7 +335,11 @@ ath_hal_9287EepromAttach(struct ath_hal 
}
}
/* Convert to eeprom native eeprom endian format */
-   if (isBigEndian()) {
+   /*
+* XXX this is likely incorrect but will do for now
+* XXX to get embedded boards working.
+*/
+   if (ah->ah_eepromdata == NULL && isBigEndian()) {
for (w = 0; w < NW(HAL_EEPROM_9287); w++)
eep_data[w] = __bswap16(eep_data[w]);
}

Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c
==
--- head/sys/dev/ath/ath_hal/ah_eeprom_v4k.cSat Jul 30 13:34:57 2011
(r224517)
+++ head/sys/dev/ath/ath_hal/ah_eeprom_v4k.cSat Jul 30 13:37:38 2011
(r224518)
@@ -288,11 +288,17 @@ ath_hal_v4kEepromAttach(struct ath_hal *
uint32_t sum;
 
HALASSERT(ee == AH_NULL);
- 
-   if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
-   HALDEBUG(ah, HAL_DEBUG_ANY,
-   "%s Error reading Eeprom MAGIC\n", __func__);
-   return HAL_EEREAD;
+   /*
+* Don't check magic if we're supplied with an EEPROM block,
+* typically this is from Howl but it may also be from later
+* boards w/ an embedded WMAC.
+*/
+   if (ah->ah_eepromdata == NULL) {
+   if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, 
&magic)) {
+   HALDEBUG(ah, HAL_DEBUG_ANY,
+   "%s Error reading Eeprom MAGIC\n", __func__);
+   return HAL_EEREAD;
+   }
}
HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n",
__func__, magic);
@@ -318,7 +324,11 @@ ath_hal_v4kEepromAttach(struct ath_hal *
}
}
/* Convert to eeprom native eeprom endian format */
-   if (isBigEndian()) {
+   /*
+* XXX this is likely incorrect but will do for now
+* XXX to get embedded boards working.
+*/
+   if (ah->ah_eepromdata == NULL && isBigEndian()) {
for (w = 0; w < NW(struct ar5416eeprom_4k); w++)
eep_data[w] = __bswap16(eep_data[w]);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224519 - in head/sys/dev/ath/ath_hal: . ar9002

2011-07-30 Thread Adrian Chadd
Author: adrian
Date: Sat Jul 30 13:45:12 2011
New Revision: 224519
URL: http://svn.freebsd.org/changeset/base/224519

Log:
  Introduce the FRAC_5G EEPROM parameter.
  
  This seems to indicate whether to program the NIC for fractional 5ghz
  mode (ie, 5mhz spaced channels, rather than 10 or 20mhz spacing) or not.
  The default (0) seems to mean "only program fractional mode if needed".
  A different value (eg 1) seems to always enable fractional 5ghz mode
  regardless of the frequency.
  
  Obtained from:Atheros
  Approved by:  re (kib)

Modified:
  head/sys/dev/ath/ath_hal/ah_eeprom.h
  head/sys/dev/ath/ath_hal/ah_eeprom_v14.c
  head/sys/dev/ath/ath_hal/ah_eeprom_v14.h
  head/sys/dev/ath/ath_hal/ar9002/ar9280.c

Modified: head/sys/dev/ath/ath_hal/ah_eeprom.h
==
--- head/sys/dev/ath/ath_hal/ah_eeprom.hSat Jul 30 13:37:38 2011
(r224518)
+++ head/sys/dev/ath/ath_hal/ah_eeprom.hSat Jul 30 13:45:12 2011
(r224519)
@@ -104,6 +104,7 @@ enum {
AR_EEP_PWDCLKIND,   /* uint8_t* */
AR_EEP_TEMPSENSE_SLOPE, /* int8_t* */
AR_EEP_TEMPSENSE_SLOPE_PAL_ON,  /* int8_t* */
+   AR_EEP_FRAC_N_5G,   /* uint8_t* */
 };
 
 typedef struct {

Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v14.c
==
--- head/sys/dev/ath/ath_hal/ah_eeprom_v14.cSat Jul 30 13:37:38 2011
(r224518)
+++ head/sys/dev/ath/ath_hal/ah_eeprom_v14.cSat Jul 30 13:45:12 2011
(r224519)
@@ -97,6 +97,12 @@ v14EepromGet(struct ath_hal *ah, int par
return HAL_OK;
} else
return HAL_EIO;
+   case AR_EEP_FRAC_N_5G:
+   if (IS_VERS(>=, AR5416_EEP_MINOR_VER_22)) {
+   *(uint8_t *) val = pBase->frac_n_5g;
+   } else
+   *(uint8_t *) val = 0;
+   return HAL_OK;
case AR_EEP_AMODE:
HALASSERT(val == AH_NULL);
return pBase->opCapFlags & AR5416_OPFLAGS_11A ?

Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v14.h
==
--- head/sys/dev/ath/ath_hal/ah_eeprom_v14.hSat Jul 30 13:37:38 2011
(r224518)
+++ head/sys/dev/ath/ath_hal/ah_eeprom_v14.hSat Jul 30 13:45:12 2011
(r224519)
@@ -187,7 +187,10 @@ typedef struct BaseEepHeader {
uint8_t rcChainMask;/* "1" if the card is an HB93 1x2 */
uint8_t desiredScaleCCK;
uint8_t pwr_table_offset;
-   uint8_t frac_n_5g;
+   uint8_t frac_n_5g;  /*
+* bit 0: indicates that fracN synth
+* mode applies to all 5G channels
+*/
uint8_t futureBase[21];
 } __packed BASE_EEP_HEADER; // 64 B
 

Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280.c
==
--- head/sys/dev/ath/ath_hal/ar9002/ar9280.cSat Jul 30 13:37:38 2011
(r224518)
+++ head/sys/dev/ath/ath_hal/ar9002/ar9280.cSat Jul 30 13:45:12 2011
(r224519)
@@ -76,6 +76,7 @@ ar9280SetChannel(struct ath_hal *ah, con
uint32_t freq, ndiv, channelSel = 0, channelFrac = 0, reg32 = 0;
CHAN_CENTERS centers;
uint32_t refDivA = 24;
+   uint8_t frac_n_5g;
 
OS_MARK(ah, AH_MARK_SETCHANNEL, chan->ic_freq);
 
@@ -85,6 +86,9 @@ ar9280SetChannel(struct ath_hal *ah, con
reg32 = OS_REG_READ(ah, AR_PHY_SYNTH_CONTROL);
reg32 &= 0xc000;
 
+   if (ath_hal_eepromGet(ah, AR_EEP_FRAC_N_5G, &frac_n_5g) != HAL_OK)
+   frac_n_5g = 0;
+
if (freq < 4800) { /* 2 GHz, fractional mode */
uint32_t txctl;
 
@@ -106,11 +110,16 @@ ar9280SetChannel(struct ath_hal *ah, con
bMode = 0;
fracMode = 0;
 
-   if ((freq % 20) == 0) {
-   aModeRefSel = 3;
-   } else if ((freq % 10) == 0) {
-   aModeRefSel = 2;
-   } else {
+   switch (frac_n_5g) {
+   case 0:
+   if ((freq % 20) == 0) {
+   aModeRefSel = 3;
+   } else if ((freq % 10) == 0) {
+   aModeRefSel = 2;
+   }
+   if (aModeRefSel) break;
+   case 1:
+   default:
aModeRefSel = 0;
/* Enable 2G (fractional) mode for channels which are 
5MHz spaced */
fracMode = 1;
@@ -121,6 +130,7 @@ ar9280SetChannel(struct ath_hal *ah, con
OS_A_REG_RMW_FIELD(ah, AR_AN_SYNTH9,
AR_AN_SYNTH9

svn commit: r224520 - head/sys/dev/ath/ath_dfs/null

2011-07-30 Thread Adrian Chadd
Author: adrian
Date: Sat Jul 30 13:46:41 2011
New Revision: 224520
URL: http://svn.freebsd.org/changeset/base/224520

Log:
  Fix incorrect error reporting during the dfs ioctl function.
  
  Approved by:  re (kib)

Modified:
  head/sys/dev/ath/ath_dfs/null/dfs_null.c

Modified: head/sys/dev/ath/ath_dfs/null/dfs_null.c
==
--- head/sys/dev/ath/ath_dfs/null/dfs_null.cSat Jul 30 13:45:12 2011
(r224519)
+++ head/sys/dev/ath/ath_dfs/null/dfs_null.cSat Jul 30 13:46:41 2011
(r224520)
@@ -189,7 +189,7 @@ ath_ioctl_phyerr(struct ath_softc *sc, s
switch (id) {
case DFS_SET_THRESH:
if (insize < sizeof(HAL_PHYERR_PARAM)) {
-   error = -EINVAL;
+   error = EINVAL;
break;
}
pe = (HAL_PHYERR_PARAM *) indata;
@@ -203,12 +203,12 @@ ath_ioctl_phyerr(struct ath_softc *sc, s
memcpy(pe, &peout, sizeof(*pe));
break;
default:
-   error = -EINVAL;
+   error = EINVAL;
}
if (outsize < ad->ad_out_size)
ad->ad_out_size = outsize;
if (outdata && copyout(outdata, ad->ad_out_data, ad->ad_out_size))
-   error = -EFAULT;
+   error = EFAULT;
 bad:
if ((ad->ad_id & ATH_DIAG_IN) && indata != NULL)
free(indata, M_TEMP);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224521 - head/sys/kern

2011-07-30 Thread Konstantin Belousov
Author: kib
Date: Sat Jul 30 14:12:37 2011
New Revision: 224521
URL: http://svn.freebsd.org/changeset/base/224521

Log:
  Fix the devmtx lock leak from make_dev(9) when the old device cloning
  failed due to invalid or duplicated path being generated.
  
  Reviewed by:  jh
  Approved by:  re (kensmith)
  MFC after:1 week

Modified:
  head/sys/kern/kern_conf.c

Modified: head/sys/kern/kern_conf.c
==
--- head/sys/kern/kern_conf.c   Sat Jul 30 13:46:41 2011(r224520)
+++ head/sys/kern/kern_conf.c   Sat Jul 30 14:12:37 2011(r224521)
@@ -764,7 +764,8 @@ make_dev_credv(int flags, struct cdev **
LIST_REMOVE(dev, si_list);
dev_unlock();
devfs_free(dev);
-   }
+   } else
+   dev_unlock();
return (res);
}
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224522 - head/sys/vm

2011-07-30 Thread Konstantin Belousov
Author: kib
Date: Sat Jul 30 14:13:57 2011
New Revision: 224522
URL: http://svn.freebsd.org/changeset/base/224522

Log:
  Fix a race in the device pager allocation. If another thread won and
  allocated the device pager for the given handle, then the object
  fictitious pages list and the object membership in the global object
  list still need to be initialized. Otherwise, dev_pager_dealloc() will
  traverse uninitialized pointers.
  
  Reported and tested by: pho
  Reviewed by:jhb
  Approved by:  re (kensmith)
  MFC after:  1 week

Modified:
  head/sys/vm/device_pager.c

Modified: head/sys/vm/device_pager.c
==
--- head/sys/vm/device_pager.c  Sat Jul 30 14:12:37 2011(r224521)
+++ head/sys/vm/device_pager.c  Sat Jul 30 14:13:57 2011(r224522)
@@ -147,6 +147,7 @@ dev_pager_alloc(void *handle, vm_ooffset
object1 = vm_object_allocate(OBJT_DEVICE, pindex);
object1->flags |= OBJ_COLORED;
object1->pg_color = atop(paddr) - OFF_TO_IDX(off - PAGE_SIZE);
+   TAILQ_INIT(&object1->un_pager.devp.devp_pglist);
mtx_lock(&dev_pager_mtx);
object = vm_pager_object_lookup(&dev_pager_object_list, handle);
if (object != NULL) {
@@ -159,7 +160,6 @@ dev_pager_alloc(void *handle, vm_ooffset
object = object1;
object1 = NULL;
object->handle = handle;
-   TAILQ_INIT(&object->un_pager.devp.devp_pglist);
TAILQ_INSERT_TAIL(&dev_pager_object_list, object,
pager_object_list);
}
@@ -169,7 +169,14 @@ dev_pager_alloc(void *handle, vm_ooffset
}
mtx_unlock(&dev_pager_mtx);
dev_relthread(dev, ref);
-   vm_object_deallocate(object1);
+   if (object1 != NULL) {
+   object1->handle = object1;
+   mtx_lock(&dev_pager_mtx);
+   TAILQ_INSERT_TAIL(&dev_pager_object_list, object1,
+   pager_object_list);
+   mtx_unlock(&dev_pager_mtx);
+   vm_object_deallocate(object1);
+   }
return (object);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r224496 - head/sys/cam

2011-07-30 Thread Kostik Belousov
On Fri, Jul 29, 2011 at 08:30:28PM +, Alexander Motin wrote:
> Author: mav
> Date: Fri Jul 29 20:30:28 2011
> New Revision: 224496
> URL: http://svn.freebsd.org/changeset/base/224496
> 
> Log:
>   In some cases failed SATA disks may report their presence, but don't
>   respond to any commands. I've found that because of multiple command
>   retries, each of which cause 30s timeout, bus reset and another retry or
>   requeue for many commands, it may take ages to eventually drop the
>   failed device. The odd thing is that those retries continue even after
>   XPT considered device as dead and invalidated it.
>   
>   This patch makes cam_periph_error() to block any command retries after
>   periph was marked as invalid. With that patch all activity completes in
>   1-2 minutes, just after several timeouts, required to consider device
>   death. This should make ZFS, gmirror, graid, etc. operation more robust.
>   
>   Reviewed by:mjacob@ on scsi@
>   
>   Approved by:re (kib)
> 
> Modified:
>   head/sys/cam/cam_periph.c
Amusingly, this commit makes my test machine to not boot.
This is Ibex Peak PCH, with two SATA disks on the channels 0 and 1.

It seems that geom thread 100012 owns GEOM topology lock, while sleeping
in adaclose->cam_periph_getccb() :

db> bt 100012
Tracing pid 12 tid 100012 td 0xfe00028a2000
sched_switch() at 0x8034a0c7 = sched_switch+0x157
mi_switch() at 0x803291fb = mi_switch+0x2eb
sleepq_switch() at 0x803631f3 = sleepq_switch+0x123
sleepq_wait() at 0x80363eed = sleepq_wait+0x4d
_sleep() at 0x80329b59 = _sleep+0x3b9
cam_periph_getccb() at 0x817ffc50 = cam_periph_getccb+0xa0
adaclose() at 0x8182c484 = adaclose+0xc4
g_disk_access() at 0x802bea74 = g_disk_access+0x1e4
g_access() at 0x802c519a = g_access+0x1ba
g_dev_attrchanged() at 0x802bd1f6 = g_dev_attrchanged+0x96
g_dev_taste() at 0x802bd574 = g_dev_taste+0x284
g_new_provider_event() at 0x802c4ecd = g_new_provider_event+0xad
g_run_events() at 0x802c0750 = g_run_events+0x250
fork_exit() at 0x802f0d99 = fork_exit+0x189
fork_trampoline() at 0x804ee3be = fork_trampoline+0xe
--- trap 0, rip = 0, rsp = 0xff800025fd00, rbp = 0 ---

(gdb) list *cam_periph_getccb+0xa0
0x1c50 is in cam_periph_getccb 
(/usr/home/kostik/work/build/bsd/DEV/src/sys/modules/cam/../../cam/cam_periph.c:883).
882
883 while (SLIST_FIRST(&periph->ccb_list) == NULL) {
884 if (periph->immediate_priority > priority)

Reverting the rev. or not loading ahci.ko allows machine to boot.


pgph764wUg1gN.pgp
Description: PGP signature


svn commit: r224523 - head/contrib/gcc/cp

2011-07-30 Thread Martin Matuska
Author: mm
Date: Sat Jul 30 17:27:29 2011
New Revision: 224523
URL: http://svn.freebsd.org/changeset/base/224523

Log:
  Fix invalid assertion of C++ external static data member declarations
  as anonymous namespaces are local to the current translation.
  
  GCC PR:   c++/33094
  
  Reviewed by:  uqs
  Approved by:  re (kib)
  Obtained from:gcc (branches/redhat/gcc-4_1-branch, rev. 129554, GPLv2)
  MFC after:1 week

Modified:
  head/contrib/gcc/cp/ChangeLog
  head/contrib/gcc/cp/decl.c

Modified: head/contrib/gcc/cp/ChangeLog
==
--- head/contrib/gcc/cp/ChangeLog   Sat Jul 30 14:13:57 2011
(r224522)
+++ head/contrib/gcc/cp/ChangeLog   Sat Jul 30 17:27:29 2011
(r224523)
@@ -1,3 +1,9 @@
+2007-09-29  Jason Merrill  
+
+   PR c++/33094
+   * decl.c (make_rtl_for_nonlocal_decl): It's ok for a member
+   constant to not have DECL_EXTERNAL if it's file-local.
+
 2007-08-24  Jakub Jelinek  
 
PR c++/31941

Modified: head/contrib/gcc/cp/decl.c
==
--- head/contrib/gcc/cp/decl.c  Sat Jul 30 14:13:57 2011(r224522)
+++ head/contrib/gcc/cp/decl.c  Sat Jul 30 17:27:29 2011(r224523)
@@ -4968,7 +4968,7 @@ make_rtl_for_nonlocal_decl (tree decl, t
   /* An in-class declaration of a static data member should be
 external; it is only a declaration, and not a definition.  */
   if (init == NULL_TREE)
-   gcc_assert (DECL_EXTERNAL (decl));
+   gcc_assert (DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl));
 }
 
   /* We don't create any RTL for local variables.  */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224524 - head/contrib/gcc/cp

2011-07-30 Thread Martin Matuska
Author: mm
Date: Sat Jul 30 17:40:11 2011
New Revision: 224524
URL: http://svn.freebsd.org/changeset/base/224524

Log:
  Fix accidential dos-style endings to unix-style line endings
  from last commit (r224523) to match the version approved by re@
  
  Approved by:  re (implicit)

Modified:
  head/contrib/gcc/cp/ChangeLog

Modified: head/contrib/gcc/cp/ChangeLog
==
--- head/contrib/gcc/cp/ChangeLog   Sat Jul 30 17:27:29 2011
(r224523)
+++ head/contrib/gcc/cp/ChangeLog   Sat Jul 30 17:40:11 2011
(r224524)
@@ -1,9 +1,9 @@
-2007-09-29  Jason Merrill  
-
-   PR c++/33094
-   * decl.c (make_rtl_for_nonlocal_decl): It's ok for a member
-   constant to not have DECL_EXTERNAL if it's file-local.
-
+2007-09-29  Jason Merrill  
+
+   PR c++/33094
+   * decl.c (make_rtl_for_nonlocal_decl): It's ok for a member
+   constant to not have DECL_EXTERNAL if it's file-local.
+
 2007-08-24  Jakub Jelinek  
 
PR c++/31941
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224525 - head/cddl/contrib/opensolaris/lib/libzfs/common

2011-07-30 Thread Martin Matuska
Author: mm
Date: Sat Jul 30 17:44:06 2011
New Revision: 224525
URL: http://svn.freebsd.org/changeset/base/224525

Log:
  Fix wrong initialization of "cmd" for calling the jail/unjail ioctl.
  
  Reviewed by:  pjd@, delphij@
  Approved by:  re (kib)
  MFC after:3 days

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cSat Jul 
30 17:40:11 2011(r224524)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cSat Jul 
30 17:44:06 2011(r224525)
@@ -4289,7 +4289,8 @@ zfs_jail(zfs_handle_t *zhp, int jailid, 
libzfs_handle_t *hdl = zhp->zfs_hdl;
zfs_cmd_t zc = { 0 };
char errbuf[1024];
-   int cmd, ret;
+   unsigned long cmd;
+   int ret;
 
if (attach) {
(void) snprintf(errbuf, sizeof (errbuf),
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224526 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2011-07-30 Thread Martin Matuska
Author: mm
Date: Sat Jul 30 19:00:31 2011
New Revision: 224526
URL: http://svn.freebsd.org/changeset/base/224526

Log:
  Fix serious bug in ZIL that can lead to pool corruption
  in the case of a held dataset during remount.
  
  Detailed description is available at:
  https://www.illumos.org/issues/883
  
  illumos-gate revision:13380:161b964a0e10
  
  Reviewed by:  pjd
  Approved by:  re (kib)
  Obtained from:Illumos (Bug #883)
  MFC after:3 days

Modified:
  head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c

Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==
--- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Jul 30 17:44:06 
2011(r224525)
+++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Jul 30 19:00:31 
2011(r224526)
@@ -205,6 +205,7 @@ typedef struct ztest_od {
  */
 typedef struct ztest_ds {
objset_t*zd_os;
+   rwlock_tzd_zilog_lock;
zilog_t *zd_zilog;
uint64_tzd_seq;
ztest_od_t  *zd_od; /* debugging aid */
@@ -238,6 +239,7 @@ ztest_func_t ztest_dmu_commit_callbacks;
 ztest_func_t ztest_zap;
 ztest_func_t ztest_zap_parallel;
 ztest_func_t ztest_zil_commit;
+ztest_func_t ztest_zil_remount;
 ztest_func_t ztest_dmu_read_write_zcopy;
 ztest_func_t ztest_dmu_objset_create_destroy;
 ztest_func_t ztest_dmu_prealloc;
@@ -273,6 +275,7 @@ ztest_info_t ztest_info[] = {
{ ztest_zap_parallel,   100,&zopt_always},
{ ztest_split_pool, 1,  &zopt_always},
{ ztest_zil_commit, 1,  &zopt_incessant },
+   { ztest_zil_remount,1,  &zopt_sometimes },
{ ztest_dmu_read_write_zcopy,   1,  &zopt_often },
{ ztest_dmu_objset_create_destroy,  1,  &zopt_often },
{ ztest_dsl_prop_get_set,   1,  &zopt_often },
@@ -986,6 +989,7 @@ ztest_zd_init(ztest_ds_t *zd, objset_t *
zd->zd_seq = 0;
dmu_objset_name(os, zd->zd_name);
 
+   VERIFY(rwlock_init(&zd->zd_zilog_lock, USYNC_THREAD, NULL) == 0);
VERIFY(_mutex_init(&zd->zd_dirobj_lock, USYNC_THREAD, NULL) == 0);
 
for (int l = 0; l < ZTEST_OBJECT_LOCKS; l++)
@@ -1965,6 +1969,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object
if (ztest_random(2) == 0)
io_type = ZTEST_IO_WRITE_TAG;
 
+   (void) rw_rdlock(&zd->zd_zilog_lock);
+
switch (io_type) {
 
case ZTEST_IO_WRITE_TAG:
@@ -2000,6 +2006,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object
break;
}
 
+   (void) rw_unlock(&zd->zd_zilog_lock);
+
umem_free(data, blocksize);
 }
 
@@ -2054,6 +2062,8 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_
 {
zilog_t *zilog = zd->zd_zilog;
 
+   (void) rw_rdlock(&zd->zd_zilog_lock);
+
zil_commit(zilog, ztest_random(ZTEST_OBJECTS));
 
/*
@@ -2065,6 +2075,31 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_
ASSERT(zd->zd_seq <= zilog->zl_commit_lr_seq);
zd->zd_seq = zilog->zl_commit_lr_seq;
mutex_exit(&zilog->zl_lock);
+
+   (void) rw_unlock(&zd->zd_zilog_lock);
+}
+
+/*
+ * This function is designed to simulate the operations that occur during a
+ * mount/unmount operation.  We hold the dataset across these operations in an
+ * attempt to expose any implicit assumptions about ZIL management.
+ */
+/* ARGSUSED */
+void
+ztest_zil_remount(ztest_ds_t *zd, uint64_t id)
+{
+   objset_t *os = zd->zd_os;
+
+   (void) rw_wrlock(&zd->zd_zilog_lock);
+
+   /* zfsvfs_teardown() */
+   zil_close(zd->zd_zilog);
+
+   /* zfsvfs_setup() */
+   VERIFY(zil_open(os, ztest_get_data) == zd->zd_zilog);
+   zil_replay(os, zd, ztest_replay_vector);
+
+   (void) rw_unlock(&zd->zd_zilog_lock);
 }
 
 /*

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c   Sat Jul 30 
17:44:06 2011(r224525)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c   Sat Jul 30 
19:00:31 2011(r224526)
@@ -20,6 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011 by Delphix. All rights reserved.
  */
 
 /* Portions Copyright 2010 Robert Milkowski */
@@ -567,7 +568,7 @@ zil_destroy(zilog_t *zilog, boolean_t ke
 
if (!list_is_empty(&zilog->zl_lwb_list)) {
ASSERT(zh->zh_claim_txg == 0);
-   ASSERT(!keep_first);
+   VERIFY(!keep_first);
while ((lwb = list_head(&zilog->zl_lwb_list)) != NULL) {
list_remove(&zilog->zl_lwb_list, lwb);
if (lwb->lwb_buf != NULL

Re: svn commit: r224516 - in head/sys: amd64/amd64 i386/i386 pc98/pc98

2011-07-30 Thread John Baldwin

On Jul 30, 2011, at 9:33 AM, Bjoern A. Zeeb wrote:

> Author: bz
> Date: Sat Jul 30 13:33:05 2011
> New Revision: 224516
> URL: http://svn.freebsd.org/changeset/base/224516
> 
> Log:
>  Introduce a tunable to disable the time consuming parts of bootup
>  memtesting, which can easily save seconds to minutes of boot time.
>  The tunable name is kept general to allow reusing the code in
>  alternate frameworks.

Why the 'tmpul' variable?  The TUNABLE_*_FETCH() macros will not modify the 
parameter
if the environment variable is missing or unparseable.  Lots of places depend 
on this all over
the kernel already, so you can depend on it here.

-- 
John Baldwin

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224527 - head/sys/kern

2011-07-30 Thread Andriy Gapon
Author: avg
Date: Sat Jul 30 20:29:39 2011
New Revision: 224527
URL: http://svn.freebsd.org/changeset/base/224527

Log:
  smp_rendezvous: master cpu should wait until all slaves are fully done
  
  This is a followup to r222032 and a reimplementation of it.
  While that revision fixed the race for the smp_rv_waiters[2] exit
  sentinel, it still left a possibility for a target CPU to access
  stale or wrong smp_rv_func_arg in smp_rv_teardown_func.
  To fix this race the slave CPUs signal when they are really fully
  done with the rendezvous and the master CPU waits until all slaves
  are done.
  
  Diagnosed by: kib
  Reviewed by:  jhb, mlaier, neel
  Approved by:  re (kib)
  MFC after:2 weeks

Modified:
  head/sys/kern/subr_smp.c

Modified: head/sys/kern/subr_smp.c
==
--- head/sys/kern/subr_smp.cSat Jul 30 19:00:31 2011(r224526)
+++ head/sys/kern/subr_smp.cSat Jul 30 20:29:39 2011(r224527)
@@ -109,8 +109,7 @@ static void (*volatile smp_rv_setup_func
 static void (*volatile smp_rv_action_func)(void *arg);
 static void (*volatile smp_rv_teardown_func)(void *arg);
 static void *volatile smp_rv_func_arg;
-static volatile int smp_rv_waiters[3];
-static volatile int smp_rv_generation;
+static volatile int smp_rv_waiters[4];
 
 /* 
  * Shared mutex to restrict busywaits between smp_rendezvous() and
@@ -321,7 +320,6 @@ smp_rendezvous_action(void)
void (*local_setup_func)(void*);
void (*local_action_func)(void*);
void (*local_teardown_func)(void*);
-   int generation;
 #ifdef INVARIANTS
int owepreempt;
 #endif
@@ -336,7 +334,6 @@ smp_rendezvous_action(void)
local_setup_func = smp_rv_setup_func;
local_action_func = smp_rv_action_func;
local_teardown_func = smp_rv_teardown_func;
-   generation = smp_rv_generation;
 
/*
 * Use a nested critical section to prevent any preemptions
@@ -382,32 +379,28 @@ smp_rendezvous_action(void)
if (local_action_func != NULL)
local_action_func(local_func_arg);
 
-   /*
-* Signal that the main action has been completed.  If a
-* full exit rendezvous is requested, then all CPUs will
-* wait here until all CPUs have finished the main action.
-*
-* Note that the write by the last CPU to finish the action
-* may become visible to different CPUs at different times.
-* As a result, the CPU that initiated the rendezvous may
-* exit the rendezvous and drop the lock allowing another
-* rendezvous to be initiated on the same CPU or a different
-* CPU.  In that case the exit sentinel may be cleared before
-* all CPUs have noticed causing those CPUs to hang forever.
-* Workaround this by using a generation count to notice when
-* this race occurs and to exit the rendezvous in that case.
-*/
-   MPASS(generation == smp_rv_generation);
-   atomic_add_int(&smp_rv_waiters[2], 1);
if (local_teardown_func != smp_no_rendevous_barrier) {
-   while (smp_rv_waiters[2] < smp_rv_ncpus &&
-   generation == smp_rv_generation)
+   /*
+* Signal that the main action has been completed.  If a
+* full exit rendezvous is requested, then all CPUs will
+* wait here until all CPUs have finished the main action.
+*/
+   atomic_add_int(&smp_rv_waiters[2], 1);
+   while (smp_rv_waiters[2] < smp_rv_ncpus)
cpu_spinwait();
 
if (local_teardown_func != NULL)
local_teardown_func(local_func_arg);
}
 
+   /*
+* Signal that the rendezvous is fully completed by this CPU.
+* This means that no member of smp_rv_* pseudo-structure will be
+* accessed by this target CPU after this point; in particular,
+* memory pointed by smp_rv_func_arg.
+*/
+   atomic_add_int(&smp_rv_waiters[3], 1);
+
td->td_critnest--;
KASSERT(owepreempt == td->td_owepreempt,
("rendezvous action changed td_owepreempt"));
@@ -441,8 +434,6 @@ smp_rendezvous_cpus(cpuset_t map,
 
mtx_lock_spin(&smp_ipi_mtx);
 
-   atomic_add_acq_int(&smp_rv_generation, 1);
-
/* Pass rendezvous parameters via global variables. */
smp_rv_ncpus = ncpus;
smp_rv_setup_func = setup_func;
@@ -451,6 +442,7 @@ smp_rendezvous_cpus(cpuset_t map,
smp_rv_func_arg = arg;
smp_rv_waiters[1] = 0;
smp_rv_waiters[2] = 0;
+   smp_rv_waiters[3] = 0;
atomic_store_rel_int(&smp_rv_waiters[0], 0);
 
/*
@@ -466,13 +458,13 @@ smp_rendezvous_cpus(cpuset_t map,
smp_rendezvous_action();
 
/*
-* If the caller did not request an exit barrier to be enforced
-* on each CPU, ensure that this CPU wai

svn commit: r224528 - in head: release/doc/en_US.ISO8859-1/hardware share/man/man4 tools/tools/sysdoc

2011-07-30 Thread Andriy Gapon
Author: avg
Date: Sat Jul 30 20:42:14 2011
New Revision: 224528
URL: http://svn.freebsd.org/changeset/base/224528

Log:
  update smp related documentation after recent changes
  
  Remove references to machdep.hlt_logical_cpus and
  machdep.hlt_cpus sysctls and tunables.
  Document machdep.hyperthreading_allowed and
  hint.lapic.X.disabled tunables.
  
  Prompted by:  ru
  Proofreading: bf
  Reviewed by:  jhb
  Approved by:  re (kib)

Modified:
  head/release/doc/en_US.ISO8859-1/hardware/article.sgml
  head/share/man/man4/smp.4
  head/tools/tools/sysdoc/tunables.mdoc

Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml
==
--- head/release/doc/en_US.ISO8859-1/hardware/article.sgml  Sat Jul 30 
20:29:39 2011(r224527)
+++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml  Sat Jul 30 
20:42:14 2011(r224528)
@@ -196,10 +196,8 @@
Because this naive scheduling can result in suboptimal
performance, under certain circumstances it may be useful to
disable the logical processors with the the
-   machdep.hlt_logical_cpus sysctl variable.
-   It is also possible to halt any CPU in the idle loop with the
-   machdep.hlt_cpus sysctl variable.  The
-   &man.smp.4; manual page has more details.
+   machdep.hyperthreading_allowed tunable.
+   The &man.smp.4; manual page has more details.
 
   &os; will take advantage of Physical Address Extensions
(PAE) support on CPUs that support this feature.  A kernel

Modified: head/share/man/man4/smp.4
==
--- head/share/man/man4/smp.4   Sat Jul 30 20:29:39 2011(r224527)
+++ head/share/man/man4/smp.4   Sat Jul 30 20:42:14 2011(r224528)
@@ -63,10 +63,10 @@ the read-only sysctl variable
 .Pp
 .Fx
 allows specific CPUs on a multi-processor system to be disabled.
-The sysctl variable
-.Va machdep.hlt_cpus
-is an integer bitmask denoting CPUs to halt, counting from 0.
-Setting a bit to 1 will result in the corresponding CPU being
+This can be done using the
+.Va hint.lapic.X.disabled
+tunable, where X is the APIC ID of a CPU.
+Setting this tunable to 1 will result in the corresponding CPU being
 disabled.
 .Pp
 The
@@ -122,12 +122,12 @@ tasks on CPUs that are closely grouped t
 supports hyperthreading on Intel CPU's on the i386 and AMD64 platforms.
 Since using logical CPUs can cause performance penalties under certain loads,
 the logical CPUs can be disabled by setting the
-.Va machdep.hlt_logical_cpus
-sysctl to one. 
-Note that this operation is different from the mechanism used by the
+.Va machdep.hyperthreading_allowed
+tunable to zero. 
 .Xr cpuset 1 .
 .Sh SEE ALSO
 .Xr mptable 1 ,
+.Xr loader 8 ,
 .Xr sysctl 8 ,
 .Xr condvar 9 ,
 .Xr msleep 9 ,

Modified: head/tools/tools/sysdoc/tunables.mdoc
==
--- head/tools/tools/sysdoc/tunables.mdoc   Sat Jul 30 20:29:39 2011
(r224527)
+++ head/tools/tools/sysdoc/tunables.mdoc   Sat Jul 30 20:42:14 2011
(r224528)
@@ -1233,24 +1233,12 @@ machdep.disable_mtrrs
 machdep.guessed_bootdev
 
 ---
-machdep.hlt_cpus
+machdep.hyperthreading_allowed
 bool
 
-This option will permit the halting
-of CPUs.
-For instance, to halt CPU 0,
-machdep.htl_cpus=1 can be used.
-It is possible to halt two CPUs by providing
-a comma separated list (i.e: cpu1,cpu2).
-

-machdep.hlt_logical_cpus
-bool
-
-This keeps the logical CPUs halted in the idle loop.
-By default the logical CPUs are halted at startup.
-It is also possible to halt any cpu in the idle loop now
-using machdep.hlt_cpus.
+Setting this tunable to zero disables
+the use of additional logical processors
+provided by Intel HTT technology.
 
 ---
 machdep.panic_on_nmi
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r224523 - head/contrib/gcc/cp

2011-07-30 Thread Roman Divacky
Why are we compiling our in-tree gcc with assertions enabled in the first
place?

On Sat, Jul 30, 2011 at 05:27:29PM +, Martin Matuska wrote:
> Author: mm
> Date: Sat Jul 30 17:27:29 2011
> New Revision: 224523
> URL: http://svn.freebsd.org/changeset/base/224523
> 
> Log:
>   Fix invalid assertion of C++ external static data member declarations
>   as anonymous namespaces are local to the current translation.
>   
>   GCC PR: c++/33094
>   
>   Reviewed by:uqs
>   Approved by:re (kib)
>   Obtained from:  gcc (branches/redhat/gcc-4_1-branch, rev. 129554, GPLv2)
>   MFC after:  1 week
> 
> Modified:
>   head/contrib/gcc/cp/ChangeLog
>   head/contrib/gcc/cp/decl.c
> 
> Modified: head/contrib/gcc/cp/ChangeLog
> ==
> --- head/contrib/gcc/cp/ChangeLog Sat Jul 30 14:13:57 2011
> (r224522)
> +++ head/contrib/gcc/cp/ChangeLog Sat Jul 30 17:27:29 2011
> (r224523)
> @@ -1,3 +1,9 @@
> +2007-09-29  Jason Merrill  
> +
> + PR c++/33094
> + * decl.c (make_rtl_for_nonlocal_decl): It's ok for a member
> + constant to not have DECL_EXTERNAL if it's file-local.
> +
>  2007-08-24  Jakub Jelinek  
>  
>   PR c++/31941
> 
> Modified: head/contrib/gcc/cp/decl.c
> ==
> --- head/contrib/gcc/cp/decl.cSat Jul 30 14:13:57 2011
> (r224522)
> +++ head/contrib/gcc/cp/decl.cSat Jul 30 17:27:29 2011
> (r224523)
> @@ -4968,7 +4968,7 @@ make_rtl_for_nonlocal_decl (tree decl, t
>/* An in-class declaration of a static data member should be
>external; it is only a declaration, and not a definition.  */
>if (init == NULL_TREE)
> - gcc_assert (DECL_EXTERNAL (decl));
> + gcc_assert (DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl));
>  }
>  
>/* We don't create any RTL for local variables.  */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r224496 - head/sys/cam

2011-07-30 Thread Alexander Motin
Kostik Belousov wrote:
> On Fri, Jul 29, 2011 at 08:30:28PM +, Alexander Motin wrote:
>> Author: mav
>> Date: Fri Jul 29 20:30:28 2011
>> New Revision: 224496
>> URL: http://svn.freebsd.org/changeset/base/224496
>>
>> Log:
>>   In some cases failed SATA disks may report their presence, but don't
>>   respond to any commands. I've found that because of multiple command
>>   retries, each of which cause 30s timeout, bus reset and another retry or
>>   requeue for many commands, it may take ages to eventually drop the
>>   failed device. The odd thing is that those retries continue even after
>>   XPT considered device as dead and invalidated it.
>>   
>>   This patch makes cam_periph_error() to block any command retries after
>>   periph was marked as invalid. With that patch all activity completes in
>>   1-2 minutes, just after several timeouts, required to consider device
>>   death. This should make ZFS, gmirror, graid, etc. operation more robust.
>>   
>>   Reviewed by:   mjacob@ on scsi@
>>   
>>   Approved by:   re (kib)
>>
>> Modified:
>>   head/sys/cam/cam_periph.c
> Amusingly, this commit makes my test machine to not boot.
> This is Ibex Peak PCH, with two SATA disks on the channels 0 and 1.
> 
> It seems that geom thread 100012 owns GEOM topology lock, while sleeping
> in adaclose->cam_periph_getccb() :
> 
> db> bt 100012
> Tracing pid 12 tid 100012 td 0xfe00028a2000
> sched_switch() at 0x8034a0c7 = sched_switch+0x157
> mi_switch() at 0x803291fb = mi_switch+0x2eb
> sleepq_switch() at 0x803631f3 = sleepq_switch+0x123
> sleepq_wait() at 0x80363eed = sleepq_wait+0x4d
> _sleep() at 0x80329b59 = _sleep+0x3b9
> cam_periph_getccb() at 0x817ffc50 = cam_periph_getccb+0xa0
> adaclose() at 0x8182c484 = adaclose+0xc4
> g_disk_access() at 0x802bea74 = g_disk_access+0x1e4
> g_access() at 0x802c519a = g_access+0x1ba
> g_dev_attrchanged() at 0x802bd1f6 = g_dev_attrchanged+0x96
> g_dev_taste() at 0x802bd574 = g_dev_taste+0x284
> g_new_provider_event() at 0x802c4ecd = g_new_provider_event+0xad
> g_run_events() at 0x802c0750 = g_run_events+0x250
> fork_exit() at 0x802f0d99 = fork_exit+0x189
> fork_trampoline() at 0x804ee3be = fork_trampoline+0xe
> --- trap 0, rip = 0, rsp = 0xff800025fd00, rbp = 0 ---
> 
> (gdb) list *cam_periph_getccb+0xa0
> 0x1c50 is in cam_periph_getccb 
> (/usr/home/kostik/work/build/bsd/DEV/src/sys/modules/cam/../../cam/cam_periph.c:883).
> 882
> 883 while (SLIST_FIRST(&periph->ccb_list) == NULL) {
> 884 if (periph->immediate_priority > priority)
> 
> Reverting the rev. or not loading ahci.ko allows machine to boot.

After many experiments I believe that problem is not related to this
change. I've managed to reproduce it depending on GEOM modules
registration order. After I disabled all GEOM modules and only geom_dev
left, problem became persistent. Specifics of the geom_dev is that it
opens device and closes it back without doing any I/O. That caused race
condition between CCB allocation for FLUSHCACHE execution in adaclose()
and higher-priority commands of device initialization sequence. Any I/O
scheduled before adaclose() closed that race, making problem rare. The
problem is specific to the ada, as for no other driver initialization
and payload requests may intersect in time.

Attached patch solved the problem for me. Please try it and approve
commit if it works.

-- 
Alexander Motin
--- cam/ata/ata_da.c.prev   2011-07-30 22:22:21.0 +0300
+++ cam/ata/ata_da.c2011-07-30 23:12:22.0 +0300
@@ -488,12 +488,20 @@ static void
 adaschedule(struct cam_periph *periph)
 {
struct ada_softc *softc = (struct ada_softc *)periph->softc;
+   uint32_t prio;
 
+   /* Check if cam_periph_getccb() was called. */
+   prio = periph->immediate_priority;
+
+   /* Check if we have more work to do. */
if (bioq_first(&softc->bio_queue) ||
(!softc->trim_running && bioq_first(&softc->trim_queue))) {
-   /* Have more work to do, so ensure we stay scheduled */
-   xpt_schedule(periph, CAM_PRIORITY_NORMAL);
+   prio = CAM_PRIORITY_NORMAL;
}
+
+   /* Schedule CCB if any of above is true. */
+   if (prio != CAM_PRIORITY_NONE)
+   xpt_schedule(periph, prio);
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r224529 - head/release/doc/en_US.ISO8859-1/hardware

2011-07-30 Thread Andriy Gapon
Author: avg
Date: Sat Jul 30 21:09:45 2011
New Revision: 224529
URL: http://svn.freebsd.org/changeset/base/224529

Log:
  fix a typo/tautology in the release documentation
  
  Approved by:  re (kib)
  MFC after:1 week

Modified:
  head/release/doc/en_US.ISO8859-1/hardware/article.sgml

Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml
==
--- head/release/doc/en_US.ISO8859-1/hardware/article.sgml  Sat Jul 30 
20:42:14 2011(r224528)
+++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml  Sat Jul 30 
21:09:45 2011(r224529)
@@ -195,7 +195,7 @@
resources between logical processors within the same CPU.
Because this naive scheduling can result in suboptimal
performance, under certain circumstances it may be useful to
-   disable the logical processors with the the
+   disable the logical processors with the
machdep.hyperthreading_allowed tunable.
The &man.smp.4; manual page has more details.
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r224496 - head/sys/cam

2011-07-30 Thread Andriy Gapon
on 30/07/2011 23:47 Alexander Motin said the following:
> Kostik Belousov wrote:
>> On Fri, Jul 29, 2011 at 08:30:28PM +, Alexander Motin wrote:
>>> Author: mav
>>> Date: Fri Jul 29 20:30:28 2011
>>> New Revision: 224496
>>> URL: http://svn.freebsd.org/changeset/base/224496
>>>
>>> Log:
>>>   In some cases failed SATA disks may report their presence, but don't
>>>   respond to any commands. I've found that because of multiple command
>>>   retries, each of which cause 30s timeout, bus reset and another retry or
>>>   requeue for many commands, it may take ages to eventually drop the
>>>   failed device. The odd thing is that those retries continue even after
>>>   XPT considered device as dead and invalidated it.
>>>   
>>>   This patch makes cam_periph_error() to block any command retries after
>>>   periph was marked as invalid. With that patch all activity completes in
>>>   1-2 minutes, just after several timeouts, required to consider device
>>>   death. This should make ZFS, gmirror, graid, etc. operation more robust.
>>>   
>>>   Reviewed by:  mjacob@ on scsi@
>>>   
>>>   Approved by:  re (kib)
>>>
>>> Modified:
>>>   head/sys/cam/cam_periph.c
>> Amusingly, this commit makes my test machine to not boot.
>> This is Ibex Peak PCH, with two SATA disks on the channels 0 and 1.
>>
>> It seems that geom thread 100012 owns GEOM topology lock, while sleeping
>> in adaclose->cam_periph_getccb() :
>>
>> db> bt 100012
>> Tracing pid 12 tid 100012 td 0xfe00028a2000
>> sched_switch() at 0x8034a0c7 = sched_switch+0x157
>> mi_switch() at 0x803291fb = mi_switch+0x2eb
>> sleepq_switch() at 0x803631f3 = sleepq_switch+0x123
>> sleepq_wait() at 0x80363eed = sleepq_wait+0x4d
>> _sleep() at 0x80329b59 = _sleep+0x3b9
>> cam_periph_getccb() at 0x817ffc50 = cam_periph_getccb+0xa0
>> adaclose() at 0x8182c484 = adaclose+0xc4
>> g_disk_access() at 0x802bea74 = g_disk_access+0x1e4
>> g_access() at 0x802c519a = g_access+0x1ba
>> g_dev_attrchanged() at 0x802bd1f6 = g_dev_attrchanged+0x96
>> g_dev_taste() at 0x802bd574 = g_dev_taste+0x284
>> g_new_provider_event() at 0x802c4ecd = g_new_provider_event+0xad
>> g_run_events() at 0x802c0750 = g_run_events+0x250
>> fork_exit() at 0x802f0d99 = fork_exit+0x189
>> fork_trampoline() at 0x804ee3be = fork_trampoline+0xe
>> --- trap 0, rip = 0, rsp = 0xff800025fd00, rbp = 0 ---
>>
>> (gdb) list *cam_periph_getccb+0xa0
>> 0x1c50 is in cam_periph_getccb 
>> (/usr/home/kostik/work/build/bsd/DEV/src/sys/modules/cam/../../cam/cam_periph.c:883).
>> 882
>> 883 while (SLIST_FIRST(&periph->ccb_list) == NULL) {
>> 884 if (periph->immediate_priority > priority)
>>
>> Reverting the rev. or not loading ahci.ko allows machine to boot.
> 
> After many experiments I believe that problem is not related to this
> change. I've managed to reproduce it depending on GEOM modules
> registration order. After I disabled all GEOM modules and only geom_dev
> left, problem became persistent. Specifics of the geom_dev is that it
> opens device and closes it back without doing any I/O. That caused race
> condition between CCB allocation for FLUSHCACHE execution in adaclose()
> and higher-priority commands of device initialization sequence. Any I/O
> scheduled before adaclose() closed that race, making problem rare. The
> problem is specific to the ada, as for no other driver initialization
> and payload requests may intersect in time.

Alexander,

somewhat contradicting your conclusions... can the following issue be also
caused by similar mechanics?
http://lists.freebsd.org/pipermail/freebsd-current/2010-October/020336.html

> Attached patch solved the problem for me. Please try it and approve
> commit if it works.
> 


-- 
Andriy Gapon
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224531 - head/sys/cam/ata

2011-07-30 Thread Alexander Motin
Author: mav
Date: Sat Jul 30 21:42:53 2011
New Revision: 224531
URL: http://svn.freebsd.org/changeset/base/224531

Log:
  Higher-priority initialization request can eat request scheduling done from
  adaclose(). Add immediate_priority check into adaschedule() to restore it.
  
  Approved by:  re (kib)
  MFC after:1 week

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Sat Jul 30 21:28:34 2011(r224530)
+++ head/sys/cam/ata/ata_da.c   Sat Jul 30 21:42:53 2011(r224531)
@@ -484,12 +484,20 @@ static void
 adaschedule(struct cam_periph *periph)
 {
struct ada_softc *softc = (struct ada_softc *)periph->softc;
+   uint32_t prio;
 
+   /* Check if cam_periph_getccb() was called. */
+   prio = periph->immediate_priority;
+
+   /* Check if we have more work to do. */
if (bioq_first(&softc->bio_queue) ||
(!softc->trim_running && bioq_first(&softc->trim_queue))) {
-   /* Have more work to do, so ensure we stay scheduled */
-   xpt_schedule(periph, CAM_PRIORITY_NORMAL);
+   prio = CAM_PRIORITY_NORMAL;
}
+
+   /* Schedule CCB if any of above is true. */
+   if (prio != CAM_PRIORITY_NONE)
+   xpt_schedule(periph, prio);
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r224496 - head/sys/cam

2011-07-30 Thread Alexander Motin
Andriy Gapon wrote:
> on 30/07/2011 23:47 Alexander Motin said the following:
>> After many experiments I believe that problem is not related to this
>> change. I've managed to reproduce it depending on GEOM modules
>> registration order. After I disabled all GEOM modules and only geom_dev
>> left, problem became persistent. Specifics of the geom_dev is that it
>> opens device and closes it back without doing any I/O. That caused race
>> condition between CCB allocation for FLUSHCACHE execution in adaclose()
>> and higher-priority commands of device initialization sequence. Any I/O
>> scheduled before adaclose() closed that race, making problem rare. The
>> problem is specific to the ada, as for no other driver initialization
>> and payload requests may intersect in time.
> 
> somewhat contradicting your conclusions... can the following issue be also
> caused by similar mechanics?
> http://lists.freebsd.org/pipermail/freebsd-current/2010-October/020336.html

Not sure, At least not exactly the same. cd driver keeps hold on device
until probe completes, effectively blocking cdopen(). Seems there was a
window in case of CD changers (closed month ago at r223557), but it
should not affect plain CDs. Also, as soon as cd driver sends requests
from cdopen(), not cdclose(), there would be much more chances to hit
some global problem, as it would not depend on GEOM taste order.

-- 
Alexander Motin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224532 - head/sys/fs/nfsclient

2011-07-30 Thread Rick Macklem
Author: rmacklem
Date: Sat Jul 30 22:57:38 2011
New Revision: 224532
URL: http://svn.freebsd.org/changeset/base/224532

Log:
  The new NFS client failed to vput() the new vnode if a setattr
  failed after the file was created in nfs_create(). This would
  probably only happen during a forced dismount. The old NFS client
  does have a vput() for this case. Detected by pho during recent
  testing, where an open syscall returned with a vnode still locked.
  
  Tested by:pho
  Approved by:  re (kib)
  MFC after:2 weeks

Modified:
  head/sys/fs/nfsclient/nfs_clvnops.c

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==
--- head/sys/fs/nfsclient/nfs_clvnops.c Sat Jul 30 21:42:53 2011
(r224531)
+++ head/sys/fs/nfsclient/nfs_clvnops.c Sat Jul 30 22:57:38 2011
(r224532)
@@ -1596,6 +1596,8 @@ again:
if (attrflag)
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL,
NULL, 0, 1);
+   if (error != 0)
+   vput(newvp);
}
}
if (!error) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r224516 - in head/sys: amd64/amd64 i386/i386 pc98/pc98

2011-07-30 Thread Bruce Evans

On Sat, 30 Jul 2011, John Baldwin wrote:



On Jul 30, 2011, at 9:33 AM, Bjoern A. Zeeb wrote:


Author: bz
Date: Sat Jul 30 13:33:05 2011
New Revision: 224516
URL: http://svn.freebsd.org/changeset/base/224516

Log:
 Introduce a tunable to disable the time consuming parts of bootup
 memtesting, which can easily save seconds to minutes of boot time.
 The tunable name is kept general to allow reusing the code in
 alternate frameworks.


Why the 'tmpul' variable?  The TUNABLE_*_FETCH() macros will not modify the 
parameter
if the environment variable is missing or unparseable.  Lots of places depend 
on this all over
the kernel already, so you can depend on it here.


And why do it and `memtest' have type unsigned long?  This is a strange type
for a boolean variable.

The dependency is visible on there being almost no other instances of
checking the return value of TUNABLE_*_FETCH().  E.g., in kern/*.c in
a checkout a few months ago, there are 50 lines matching TUNABLE.*FETCH.
Only 1 of these lines has an 'if (' in it.   This 1 is in sysv_shm.c and
seems to be correct since it is checking that a tunable which should
not be used (because it has been renamed) is in fact not used.  In the
whole kernel, 155 lines match TUNABLE.*FETCH and 14 of these match 'if ('.
Some of the 14 are not wrong.  About 1/3 of them are for dubious use in
memory sizing.  E.g., in amd64/machdep.c:

%   realmem = Maxmem;

The unprobed Maxmem remains in realmem for printing a confusing value later
in sysctls.

% 
% 	/*

%* Display physical memory if SMBIOS reports reasonable amount.
%*/
%   memsize = 0;
%   sysenv = getenv("smbios.memory.enabled");
%   if (sysenv != NULL) {
%   memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 10;
%   freeenv(sysenv);
%   }

First override for `memsize'.

%   if (memsize < ptoa((uintmax_t)cnt.v_free_count))
%   memsize = ptoa((uintmax_t)Maxmem);

`memsize' is normally (?) `Maxmem' in bytes, but not if SMBIOS set it.

%   printf("real memory  = %ju (%ju MB)\n", memsize, memsize >> 20);

Code doesn't match comment.  The display is unconditional, but the comment
set that it is only done if SMBIOS reports a reasonable amount.

`memsize' is not used after this point, so the only effect of the SMBIOS
check is to possibly print a value that is different from all of the
following:
- the initial Maxmem in bytes
- the final realmem in bytes (this equals the initial Maxmem in bytes)
- the final Maxmem in bytes.
The comment is also wrong in saying that SMBIOS is used.  Only an
environment string is used.  Users can easily confuse themselves by putting
garbage in this string.

The above logic is also confused by the memory size being in cnt.v_free_cnt.
If SMBIOS does't change memsize from 0, then we use Maxmem even if it is
larger than cnt.v_free_cnt.

%   /*
%* Maxmem isn't the "maximum memory", it's one larger than the
%* highest page of the physical address space.  It should be
%* called something like "Maxphyspage".  We may adjust this
%* based on ``hw.physmem'' and the results of the memory test.
%*/
%   Maxmem = atop(physmap[physmap_idx + 1]);

Here we change Maxmem to another unprobed value.  I think this value is
more closely related to cnt.v_free_cnt.

% 
% #ifdef MAXMEM

%   Maxmem = MAXMEM / 4;
% #endif

Then we optionally change MaxMem to a hard-configured value.

% 
% 	if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable))

%   Maxmem = atop(physmem_tunable);

Then we use a temporary variable, since the primary variable has
units of pages while the tunable has units of bytes.  But this can
be reorganized to:

/*
 * memsize was Maxmem in bytes, but was not maintained when Maxmem
 * was changed about.  Maintain it now.
 */
memsize = ptoa(Maxmem).
 *
 * XXX we also have a physmem variable, but this can't be used to
 * hole the result of the tunable any more than Maxmem can, since
 * it is in pages.  memsize is not quite right either, since it
 * is a uintmax_t while the following assumes that it is u_long.
 * The u_long is too small for PAE on i386, but works for amd64.
 * The uintmax_t is needed on i386, but is not needed for amd64.
 */
TUNABLE_ULONG_FETCH("hw.physmem", &memsize);  /* XXX sic */
Maxmem = atop(memsize);

%   /*
%* Don't allow MAXMEM or hw.physmem to extend the amount of memory
%* in the system.
%*/
%   if (Maxmem > atop(physmap[physmap_idx + 1]))
%   Maxmem = atop(physmap[physmap_idx + 1]);

After all these defaults and overrides for Maxmem, who knows its relationship
to the "real memory" printed originally and printed later by sysctl?  The
memory size overrides and probes exist mainly to handle cases where the
original value is wrong, so preserving the original value is a

svn commit: r224533 - head/share/man/man4

2011-07-30 Thread Joel Dahl
Author: joel (doc committer)
Date: Sat Jul 30 23:09:52 2011
New Revision: 224533
URL: http://svn.freebsd.org/changeset/base/224533

Log:
  Add a better description, a few examples and a couple of minor fixes.
  
  Reviewed by:  brueffer
  Approved by:  re (kib)

Modified:
  head/share/man/man4/pcm.4

Modified: head/share/man/man4/pcm.4
==
--- head/share/man/man4/pcm.4   Sat Jul 30 22:57:38 2011(r224532)
+++ head/share/man/man4/pcm.4   Sat Jul 30 23:09:52 2011(r224533)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 13, 2009
+.Dd July 31, 2011
 .Dt SOUND 4
 .Os
 .Sh NAME
@@ -41,7 +41,121 @@ kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "device sound"
 .Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver is the main component of the
+.Fx sound system.
+It works in conjunction with a bridge device driver on supported devices
+and provides PCM audio record and playback once it attaches.
+Each bridge device driver supports a specific set of audio chipsets and
+needs to be enabled together with the
+.Nm
+driver.
+PCI and ISA PnP audio devices identify themselves so users are usually not
+required to add anything to
+.Pa /boot/device.hints .
+.Pp
+Some of the main features of the
+.Nm
+driver are: multichannel audio, per-application
+volume control, dynamic mixing through virtual sound channels, true full
+duplex operation, bit perfect audio, rate conversion and low latency
+modes.
+.Pp
+The
+.Nm
+driver is enabled by default, along with several bridge device drivers.
+Those not enabled by default can be loaded during runtime with
+.Xr kldload 8
+or during boot via
+.Xr loader.conf 5 .
+The following bridge device drivers are available:
 .Pp
+.Bl -bullet -compact
+.It
+.Xr snd_ad1816 4
+.It
+.Xr snd_ai2s 4 (enabled by default on powerpc)
+.It
+.Xr snd_als4000 4
+.It
+.Xr snd_atiixp 4
+.It
+.Xr snd_audiocs 4 (enabled by default on sparc64)
+.It
+.Xr snd_cmi 4
+.It
+.Xr snd_cs4281 4
+.It
+.Xr snd_csa 4
+.It
+.Xr snd_davbus 4 (enabled by default on powerpc)
+.It
+.Xr snd_ds1 4
+.It
+.Xr snd_emu10k1 4
+.It
+.Xr snd_emu10kx 4
+.It
+.Xr snd_envy24 4
+.It
+.Xr snd_envy24ht 4
+.It
+.Xr snd_es137x 4 (enabled by default on amd64, i386, sparc64)
+.It
+.Xr snd_ess 4
+.It
+.Xr snd_fm801 4
+.It
+.Xr snd_gusc 4
+.It
+.Xr snd_hda 4 (enabled by default on amd64, i386)
+.It
+.Xr snd_ich 4 (enabled by default on amd64, i386)
+.It
+.Xr snd_maestro 4
+.It
+.Xr snd_maestro3 4
+.It
+.Xr snd_mss 4
+.It
+.Xr snd_neomagic 4
+.It
+snd_sb16
+.It
+snd_sb8
+.It
+.Xr snd_sbc 4
+.It
+.Xr snd_solo 4
+.It
+.Xr snd_spicds 4
+.It
+.Xr snd_t4dwave 4 (enabled by default on sparc64)
+.It
+.Xr snd_uaudio 4 (enabled by default on amd64, i386, powerpc, sparc64)
+.It
+.Xr snd_via8233 4 (enabled by default on amd64, i386)
+.It
+.Xr snd_via82c686 4
+.It
+.Xr snd_vibes 4
+.El
+.Pp
+Refer to the manual page for each bridge device driver for driver specific
+settings and information.
+.Ss Legacy Hardware
+For old legacy
+.Tn ISA
+cards, the driver looks for
+.Tn MSS
+cards at addresses
+.Dv 0x530
+and
+.Dv 0x604 .
+These values can be overridden in
+.Pa /boot/device.hints .
 Non-PnP sound cards require the following lines in
 .Xr device.hints 5 :
 .Bd -literal -offset indent
@@ -50,33 +164,6 @@ hint.pcm.0.irq="5"
 hint.pcm.0.drq="1"
 hint.pcm.0.flags="0x0"
 .Ed
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for
-.Tn PCM
-audio play and capture.
-This driver also supports various
-.Tn PCI ,
-.Tn ISA ,
-.Tn WSS/MSS
-compatible
-sound cards, AC97 mixer and High Definition Audio.
-Once the
-.Nm
-driver attaches, supported devices provide audio record and
-playback channels.
-The
-.Fx
-sound system provides dynamic mixing
-.Dq VCHAN
-and rate conversion
-.Dq soft formats .
-True full duplex operation is available on most sound cards.
-.Pp
-If the sound card is supported by a bridge driver, the
-.Nm
-driver works in conjunction with the bridge driver.
 .Pp
 Apart from the usual parameters, the flags field is used to specify
 the secondary
@@ -85,24 +172,6 @@ channel (generally used for capture in f
 Flags are set to 0 for cards not using a secondary
 .Tn DMA
 channel, or to 0x10 + C to specify channel C.
-.Pp
-The driver does its best to recognize the installed hardware and drive
-it correctly so the user is not required to add several lines in
-.Pa /boot/device.hints .
-For
-.Tn PCI
-and
-.Tn ISA
-.Tn PnP
-cards this is actually easy
-since they identify themselves.
-For legacy
-.Tn ISA
-cards, the driver looks for
-.Tn MSS
-cards at addresses 0x530 and 0x604 (unless overridden
-in
-.Pa /boot/device.hints ) .
 .Ss Boot Variables
 In general, the module
 .Pa snd_foo
@@ -119,17 +188,18 @@ utility.
 Options which can be specified in
 .Pa /boot/loader.conf
 include:
-.Bl -tag -width ".Va snd_emu10k1_load" -offset indent
+.Bl -tag -width ".Va snd_driver_load" -offset indent
 .It Va snd_driver_load
 .Pq Dq Li NO
 If set to
 .Dq Li YES ,
 this option loads all available d

Re: svn commit: r224516 - in head/sys: amd64/amd64 i386/i386 pc98/pc98

2011-07-30 Thread Bruce Evans

On Sun, 31 Jul 2011, Bruce Evans wrote:


...  In the
whole kernel, 155 lines match TUNABLE.*FETCH and 14 of these match 'if ('.
Some of the 14 are not wrong.  About 1/3 of them are for dubious use in
memory sizing.  E.g., in amd64/machdep.c:

%   realmem = Maxmem;

The unprobed Maxmem remains in realmem for printing a confusing value later
in sysctls.


Oops.  This is actually the final (probed) value of Maxmem.  I got confused
by the file order being different from the dynamic order.



% % /*
%* Display physical memory if SMBIOS reports reasonable amount.
%*/
%   memsize = 0;
%   sysenv = getenv("smbios.memory.enabled");
%   if (sysenv != NULL) {
% 		memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 
10;

%   freeenv(sysenv);
%   }

First override for `memsize'.

%   if (memsize < ptoa((uintmax_t)cnt.v_free_count))
%   memsize = ptoa((uintmax_t)Maxmem);

`memsize' is normally (?) `Maxmem' in bytes, but not if SMBIOS set it.

%   printf("real memory  = %ju (%ju MB)\n", memsize, memsize >> 20);

Code doesn't match comment.  The display is unconditional, but the comment
set that it is only done if SMBIOS reports a reasonable amount.

`memsize' is not used after this point, so the only effect of the SMBIOS
check is to possibly print a value that is different from all of the
following:
- the initial Maxmem in bytes
- the final realmem in bytes (this equals the initial Maxmem in bytes)
- the final Maxmem in bytes.
The comment is also wrong in saying that SMBIOS is used.  Only an
environment string is used.  Users can easily confuse themselves by putting
garbage in this string.

The above logic is also confused by the memory size being in cnt.v_free_cnt.
If SMBIOS does't change memsize from 0, then we use Maxmem even if it is
larger than cnt.v_free_cnt.


So realmem is the correct final value unless the SMBIOS non-call gives a
different value; in the latter case, we print this different value above
but the realmem sysctl can't recover it.


%   /*
%* Maxmem isn't the "maximum memory", it's one larger than the
%* highest page of the physical address space.  It should be
%* called something like "Maxphyspage".  We may adjust this
%* based on ``hw.physmem'' and the results of the memory test.
%*/
%   Maxmem = atop(physmap[physmap_idx + 1]);

Here we change Maxmem to another unprobed value.  I think this value is
more closely related to cnt.v_free_cnt.

% % #ifdef MAXMEM
%   Maxmem = MAXMEM / 4;
% #endif

Then we optionally change MaxMem to a hard-configured value.

% % if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable))
%   Maxmem = atop(physmem_tunable);

Then we use a temporary variable, since the primary variable has
units of pages while the tunable has units of bytes.  But this can
be reorganized to:

/*
 * memsize was Maxmem in bytes, but was not maintained when Maxmem
 * was changed about.  Maintain it now.
 */
memsize = ptoa(Maxmem).
 *
 * XXX we also have a physmem variable, but this can't be used to
 * hole the result of the tunable any more than Maxmem can, since
 * it is in pages.  memsize is not quite right either, since it
 * is a uintmax_t while the following assumes that it is u_long.
 * The u_long is too small for PAE on i386, but works for amd64.
 * The uintmax_t is needed on i386, but is not needed for amd64.
 */
TUNABLE_ULONG_FETCH("hw.physmem", &memsize);  /* XXX sic */
Maxmem = atop(memsize);

%   /*
%* Don't allow MAXMEM or hw.physmem to extend the amount of memory
%* in the system.
%*/
%   if (Maxmem > atop(physmap[physmap_idx + 1]))
%   Maxmem = atop(physmap[physmap_idx + 1]);


Now we're in the getmemsize() function, which doesn't have a memsize
variable.  It should have one instead of the physmem_tunable variable,
if only because the physmem tunable is actually for memsize in bytes
and not for physmem in pages.

Bruce
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224535 - head/usr.sbin/pw

2011-07-30 Thread Xin LI
Author: delphij
Date: Sun Jul 31 03:00:00 2011
New Revision: 224535
URL: http://svn.freebsd.org/changeset/base/224535

Log:
  Backout r223115 which potentially caused a POLA violation, by restoring
  historic behavior (create the default base directory in pw.conf) before
  I came up with a better fix for this.
  
  Requested by: nwhitehorn
  Approved by:  re (kib)

Modified:
  head/usr.sbin/pw/pw_user.c

Modified: head/usr.sbin/pw/pw_user.c
==
--- head/usr.sbin/pw/pw_user.c  Sat Jul 30 23:42:15 2011(r224534)
+++ head/usr.sbin/pw/pw_user.c  Sun Jul 31 03:00:00 2011(r224535)
@@ -163,7 +163,7 @@ pw_user(struct userconf * cnf, int mode,
 * If we'll need to use it or we're updating it,
 * then create the base home directory if necessary
 */
-   if ((arg != NULL || getarg(args, 'm') != NULL) && (getarg(args, 'd') == 
NULL)) {
+   if (arg != NULL || getarg(args, 'm') != NULL) {
int l = strlen(cnf->home);
 
if (l > 1 && cnf->home[l-1] == '/') /* Shave off any 
trailing path delimiter */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224536 - head/libexec/tftpd

2011-07-30 Thread Craig Rodrigues
Author: rodrigc
Date: Sun Jul 31 03:12:20 2011
New Revision: 224536
URL: http://svn.freebsd.org/changeset/base/224536

Log:
  In the old TFTP server, there was an undocumented behavior where
  the block counter would rollover to 0 if a file larger
  than 65535 blocks was transferred.  With the default block size
  of 512 octets per block, this is a file size of approximately 32 megabytes.
  
  The new TFTP server code would report an error and stop transferring
  the file if a file was larger than 65535 blocks.
  
  This patch restores the old TFTP server's behavior to the new
  TFTP server code.  If a TFTP client transfers a file larger
  than 65535 blocks, and does *not* specify the "rollover" option,
  then automatically rollover the block counter to 0 every time
  we reach 65535 blocks.
  
  This restores interoperability with the FreeBSD 6 TFTP client.
  Without this change, if a FreeBSD 6 TFTP client tried to
  retrieve a file larger than 65535 blocks from a FreeBSD 9 TFTP server
  , the transfer would fail.
  The same file could be retrieved successfully if the same FreeBSD 6
  TFTP client was used against a FreeBSD 6 TFTP server.
  
  Approved by:  re (kib)
  Tested by: Pawan Gupta ,
  Obtained from:  Juniper Networks

Modified:
  head/libexec/tftpd/tftp-transfer.c

Modified: head/libexec/tftpd/tftp-transfer.c
==
--- head/libexec/tftpd/tftp-transfer.c  Sun Jul 31 03:00:00 2011
(r224535)
+++ head/libexec/tftpd/tftp-transfer.c  Sun Jul 31 03:12:20 2011
(r224536)
@@ -129,14 +129,16 @@ tftp_send(int peer, uint16_t *block, str
(*block)++;
if (oldblock > *block) {
if (options[OPT_ROLLOVER].o_request == NULL) {
-   tftp_log(LOG_ERR,
-   "Block rollover but not allowed.");
-   send_error(peer, EBADOP);
-   gettimeofday(&(ts->tstop), NULL);
-   return;
+   /*
+* "rollover" option not specified in
+* tftp client.  Default to rolling block
+* counter to 0.
+*/
+   *block = 0;
+   } else {
+   *block = atoi(options[OPT_ROLLOVER].o_request);
}
 
-   *block = atoi(options[OPT_ROLLOVER].o_request);
ts->rollovers++;
}
gettimeofday(&(ts->tstop), NULL);
@@ -196,14 +198,16 @@ tftp_receive(int peer, uint16_t *block, 
(*block)++;
if (oldblock > *block) {
if (options[OPT_ROLLOVER].o_request == NULL) {
-   tftp_log(LOG_ERR,
-   "Block rollover but not allowed.");
-   send_error(peer, EBADOP);
-   gettimeofday(&(ts->tstop), NULL);
-   return;
+   /*
+* "rollover" option not specified in
+* tftp client.  Default to rolling block
+* counter to 0.
+*/
+   *block = 0;
+   } else {
+   *block = atoi(options[OPT_ROLLOVER].o_request);
}
 
-   *block = atoi(options[OPT_ROLLOVER].o_request);
ts->rollovers++;
}
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224537 - head/libexec/tftpd

2011-07-30 Thread Craig Rodrigues
Author: rodrigc
Date: Sun Jul 31 03:18:36 2011
New Revision: 224537
URL: http://svn.freebsd.org/changeset/base/224537

Log:
  Pull in some wording to the tftpd.8 man page
  from NetBSD, with some slight changes:
  
  
=
  
http://cvsweb.netbsd.org/bsdweb.cgi/src/libexec/tftpd/tftpd.8?only_with_tag=MAIN#rev1.22
  
  Revision 1.22 or diffs], Fri Jan 8 21:05:14 2010 UTC (18 months, 2 weeks ago) 
by christos
  
  Patrick Welche 
  - add -p pathsep option
  - make wrap to zero work, but produce a warning
  While here:
  - fix gcc warnings, in particular variable clobbered warnings
(compiling with fewer warnings does not really fix the problem)
  
=
  
  These wording changes clarify the default rollover behavior
  as a "kludge".  Also, the block numbers and octet counts for 65535 blocks
  and 32767 blocks are more accurate than the existing documented numbers.
  
  Requested by:   Pawan Gupta 
  Obtained from:  Juniper Networks
  Approved by:re (kib)

Modified:
  head/libexec/tftpd/tftpd.8

Modified: head/libexec/tftpd/tftpd.8
==
--- head/libexec/tftpd/tftpd.8  Sun Jul 31 03:12:20 2011(r224536)
+++ head/libexec/tftpd/tftpd.8  Sun Jul 31 03:18:36 2011(r224537)
@@ -300,8 +300,15 @@ and
 .Xr tftp 1
 code to support RFC2348.
 .Sh NOTES
-Files larger than 33488896 octets (65535 blocks) cannot be transferred
-without client and server supporting the TFTP blocksize option (RFC2348),
+Files larger than 33,553,919 octets (65535 blocks, last one <512
+octets) cannot be correctly transferred without client and server
+supporting blocksize negotiation (RFCs 2347 and 2348),
 or the non-standard TFTP rollover option.
+As a kludge,
+.Nm
+accepts a sequence of block number which wrap to zero after 65535,
+even if the rollover option is not specified.
 .Pp
-Many tftp clients will not transfer files over 1678 octets (32767 blocks).
+Many tftp clients will not transfer files over 16,776,703 octets
+(32767 blocks), as they incorrectly count the block number using
+a signed rather than unsigned 16-bit integer.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224538 - head/sys/dev/ath/ath_hal

2011-07-30 Thread Adrian Chadd
Author: adrian
Date: Sun Jul 31 03:33:02 2011
New Revision: 224538
URL: http://svn.freebsd.org/changeset/base/224538

Log:
  Add some more phyerr bits.
  
  Obtained from:Atheros
  Approved by:  re (kib)

Modified:
  head/sys/dev/ath/ath_hal/ah_desc.h

Modified: head/sys/dev/ath/ath_hal/ah_desc.h
==
--- head/sys/dev/ath/ath_hal/ah_desc.h  Sun Jul 31 03:18:36 2011
(r224537)
+++ head/sys/dev/ath/ath_hal/ah_desc.h  Sun Jul 31 03:33:02 2011
(r224538)
@@ -158,6 +158,12 @@ enum {
HAL_PHYERR_CCK_RATE_ILLEGAL = 27,   /* */
HAL_PHYERR_CCK_SERVICE  = 30,   /* */
HAL_PHYERR_CCK_RESTART  = 31,   /* */
+   HAL_PHYERR_CCK_LENGTH_ILLEGAL   = 32,   /* */
+   HAL_PHYERR_CCK_POWER_DROP   = 33,   /* */
+   /* AR5416 and later */
+   HAL_PHYERR_HT_CRC_ERROR = 34,   /* */
+   HAL_PHYERR_HT_LENGTH_ILLEGAL= 35,   /* */
+   HAL_PHYERR_HT_RATE_ILLEGAL  = 36,   /* */
 };
 
 /* value found in rs_keyix to mark invalid entries */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224539 - head/sys/dev/ath/ath_hal

2011-07-30 Thread Adrian Chadd
Author: adrian
Date: Sun Jul 31 05:01:42 2011
New Revision: 224539
URL: http://svn.freebsd.org/changeset/base/224539

Log:
  Add extra flags for the radar event API.
  (They're not used by any public code at the current time.)
  
  Approved by:  re (kib)

Modified:
  head/sys/dev/ath/ath_hal/ah.h

Modified: head/sys/dev/ath/ath_hal/ah.h
==
--- head/sys/dev/ath/ath_hal/ah.h   Sun Jul 31 03:33:02 2011
(r224538)
+++ head/sys/dev/ath/ath_hal/ah.h   Sun Jul 31 05:01:42 2011
(r224539)
@@ -747,6 +747,9 @@ typedef enum {
 } HAL_QUIET_FLAG;
 
 #defineHAL_DFS_EVENT_PRICH 0x001
+#defineHAL_DFS_EVENT_EXTCH 0x002
+#defineHAL_DFS_EVENT_EXTEARLY  0x004
+#defineHAL_DFS_EVENT_ISDC  0x008
 
 struct dfs_event {
uint64_tre_full_ts; /* 64-bit full timestamp from interrupt 
time */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224540 - head/sys/dev/ath

2011-07-30 Thread Adrian Chadd
Author: adrian
Date: Sun Jul 31 05:59:33 2011
New Revision: 224540
URL: http://svn.freebsd.org/changeset/base/224540

Log:
  Fix typo!
  
  Approved by:  re (kib)

Modified:
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_athvar.h
==
--- head/sys/dev/ath/if_athvar.hSun Jul 31 05:01:42 2011
(r224539)
+++ head/sys/dev/ath/if_athvar.hSun Jul 31 05:59:33 2011
(r224540)
@@ -651,7 +651,7 @@ voidath_intr(void *);
 #defineath_hal_gettxchainmask(_ah, _ptxchainmask) \
(ath_hal_getcapability(_ah, HAL_CAP_TX_CHAINMASK, 0, _ptxchainmask))
 #defineath_hal_split4ktrans(_ah) \
-   (ath_hal_getcapability(_ah, HAP_CAP_SPLIT_4KB_TRANS, 0, NULL) == HAL_OK)
+   (ath_hal_getcapability(_ah, HAL_CAP_SPLIT_4KB_TRANS, 0, NULL) == HAL_OK)
 #defineath_hal_self_linked_final_rxdesc(_ah) \
(ath_hal_getcapability(_ah, HAL_CAP_RXDESC_SELFLINK, 0, NULL) == HAL_OK)
 #defineath_hal_gtxto_supported(_ah) \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"