Re: svn commit: r223307 - head/sys/vm

2011-06-23 Thread Adrian Chadd
On 23 June 2011 13:28, Alan Cox a...@rice.edu wrote:
 On 06/22/2011 21:36, Adrian Chadd wrote:

 Can this commit please be reverted whilst the kinks are worked out for
 MIPS?

 I've reverted the MIPS-specific code.

Thanks!


Adrian
___
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: r223465 - in head/sys/dev/ath/ath_hal: ar5212 ar5416

2011-06-23 Thread Adrian Chadd
Author: adrian
Date: Thu Jun 23 06:53:13 2011
New Revision: 223465
URL: http://svn.freebsd.org/changeset/base/223465

Log:
  Fix indenting issues introduced by the previous commit.

Modified:
  head/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c
==
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c Thu Jun 23 05:23:59 
2011(r223464)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c Thu Jun 23 06:53:13 
2011(r223465)
@@ -84,9 +84,9 @@ ar5212BeaconInit(struct ath_hal *ah,
case HAL_M_HOSTAP:
case HAL_M_IBSS:
bt.bt_nextdba = (next_beacon -
-   ah-ah_config.ah_dma_beacon_response_time)  3; /* 1/8 
TU */
+   ah-ah_config.ah_dma_beacon_response_time)  3; /* 1/8 TU 
*/
bt.bt_nextswba = (next_beacon -
-ah-ah_config.ah_sw_beacon_response_time)  3;/* 1/8 TU */
+   ah-ah_config.ah_sw_beacon_response_time)  3; /* 1/8 
TU */
break;
}
/*

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c Thu Jun 23 05:23:59 
2011(r223464)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c Thu Jun 23 06:53:13 
2011(r223465)
@@ -93,9 +93,9 @@ ar5416BeaconInit(struct ath_hal *ah,
/* fall thru... */
case HAL_M_HOSTAP:
bt.bt_nextdba = (next_beacon -
-   ah-ah_config.ah_dma_beacon_response_time)  3;
/* 1/8 TU */
+   ah-ah_config.ah_dma_beacon_response_time)  3;/* 1/8 
TU */
bt.bt_nextswba = (next_beacon -
-ah-ah_config.ah_sw_beacon_response_time)  3;/* 1/8 TU */
+   ah-ah_config.ah_sw_beacon_response_time)  3; /* 1/8 
TU */
bt.bt_flags |= AR_TIMER_MODE_TBTT
|  AR_TIMER_MODE_DBA
|  AR_TIMER_MODE_SWBA;
___
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: r223466 - in head/sys/dev/ath/ath_hal: . ar5210 ar5211 ar5212 ar5312 ar5416 ar9001 ar9002

2011-06-23 Thread Adrian Chadd
Author: adrian
Date: Thu Jun 23 06:55:29 2011
New Revision: 223466
URL: http://svn.freebsd.org/changeset/base/223466

Log:
  Re-introduce a global ath_hal_debug again for now, whilst I figure out what
  to do about the few cases where the HAL state isn't available (regdomain)
  or isn't yet setup (probe/attach.)
  
  The global ath_hal_debug now affects all instances of the HAL.
  
  This also restores the ability for probe/attach debugging to work; as
  the sysctl tree may not be attached at that point. Users can just set
  the global hw.ath.hal.debug to a suitable value to enable probe/attach
  related debugging.

Modified:
  head/sys/dev/ath/ath_hal/ah_internal.h
  head/sys/dev/ath/ath_hal/ah_regdomain.c
  head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
  head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
  head/sys/dev/ath/ath_hal/ar5212/ar5112.c
  head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
  head/sys/dev/ath/ath_hal/ar5312/ar5312_attach.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  head/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c
  head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c
  head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
  head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c
  head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c

Modified: head/sys/dev/ath/ath_hal/ah_internal.h
==
--- head/sys/dev/ath/ath_hal/ah_internal.h  Thu Jun 23 06:53:13 2011
(r223465)
+++ head/sys/dev/ath/ath_hal/ah_internal.h  Thu Jun 23 06:55:29 2011
(r223466)
@@ -498,10 +498,29 @@ externvoid ath_hal_free(void *);
 /* common debugging interfaces */
 #ifdef AH_DEBUG
 #include ah_debug.h
+extern int ath_hal_debug;  /* Global debug flags */
+
+/*
+ * This is used for global debugging, when ahp doesn't yet have the
+ * related debugging state. For example, during probe/attach.
+ */
+#defineHALDEBUG_G(_ah, __m, ...) \
+   do {\
+   if ((__m) == HAL_DEBUG_UNMASKABLE ||\
+   ath_hal_debug  (__m)) {\
+   DO_HALDEBUG((_ah), (__m), __VA_ARGS__); \
+   }   \
+   } while (0);
+
+/*
+ * This is used for local debugging, when ahp isn't NULL and
+ * thus may have debug flags set.
+ */
 #defineHALDEBUG(_ah, __m, ...) \
do {\
if ((__m) == HAL_DEBUG_UNMASKABLE ||\
-   ((_ah != AH_NULL)  (((struct 
ath_hal*)_ah)-ah_config.ah_debug  (__m {   \
+   ath_hal_debug  (__m) ||\
+   (_ah)-ah_config.ah_debug  (__m)) {\
DO_HALDEBUG((_ah), (__m), __VA_ARGS__); \
}   \
} while(0);

Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c
==
--- head/sys/dev/ath/ath_hal/ah_regdomain.c Thu Jun 23 06:53:13 2011
(r223465)
+++ head/sys/dev/ath/ath_hal/ah_regdomain.c Thu Jun 23 06:55:29 2011
(r223466)
@@ -167,7 +167,7 @@ isEepromValid(struct ath_hal *ah)
if (regDomainPairs[i].regDmnEnum == rd)
return AH_TRUE;
}
-   HALDEBUG(ah, HAL_DEBUG_REGDOMAIN,
+   HALDEBUG_G(ah, HAL_DEBUG_REGDOMAIN,
%s: invalid regulatory domain/country code 0x%x\n, __func__, rd);
return AH_FALSE;
 }
@@ -609,7 +609,7 @@ ath_hal_mapgsm(int sku, int freq)
return 1544 + freq;
if (sku == SKU_SR9)
return 3344 - freq;
-   HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+   HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
%s: cannot map freq %u unknown gsm sku %u\n,
__func__, freq, sku);
return freq;

Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
==
--- head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Thu Jun 23 06:53:13 
2011(r223465)
+++ head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Thu Jun 23 06:55:29 
2011(r223466)
@@ -181,14 +181,14 @@ ar5210Attach(uint16_t devid, HAL_SOFTC s
HAL_STATUS ecode;
int i;
 
-   HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH,
+   HALDEBUG_G(AH_NULL, HAL_DEBUG_ATTACH,
%s: devid 0x%x sc %p st %p sh %p\n, __func__, devid,
sc, (void*) st, (void*) sh);
 
/* NB: memory is returned zero'd */
ahp = ath_hal_malloc(sizeof (struct ath_hal_5210));
if (ahp == AH_NULL) {
-   HALDEBUG(AH_NULL, HAL_DEBUG_ANY,
+   HALDEBUG_G(AH_NULL, HAL_DEBUG_ANY,
%s: no memory for state block\n, __func__);
ecode = HAL_ENOMEM;

svn commit: r223467 - in head/sys: conf dev/usb dev/usb/template modules/usb/template

2011-06-23 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Jun 23 07:54:03 2011
New Revision: 223467
URL: http://svn.freebsd.org/changeset/base/223467

Log:
  - Add more USB templates for various USB device classes
  - Add basic template support for USB 3.0
  - Export definition of template sysctl numbers through usb_ioctl.h
  
  MFC after:7 days

Added:
  head/sys/dev/usb/template/usb_template_audio.c   (contents, props changed)
  head/sys/dev/usb/template/usb_template_kbd.c   (contents, props changed)
  head/sys/dev/usb/template/usb_template_modem.c   (contents, props changed)
  head/sys/dev/usb/template/usb_template_mouse.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/usb/template/usb_template.c   (contents, props changed)
  head/sys/dev/usb/template/usb_template.h
  head/sys/dev/usb/template/usb_template_cdce.c   (contents, props changed)
  head/sys/dev/usb/template/usb_template_msc.c   (contents, props changed)
  head/sys/dev/usb/template/usb_template_mtp.c   (contents, props changed)
  head/sys/dev/usb/usb_ioctl.h
  head/sys/modules/usb/template/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Jun 23 06:55:29 2011(r223466)
+++ head/sys/conf/files Thu Jun 23 07:54:03 2011(r223467)
@@ -1991,8 +1991,12 @@ dev/usb/quirk/usb_quirk.coptional usb
 #
 # USB templates
 #
-dev/usb/template/usb_template.coptional usb_template
+dev/usb/template/usb_template.coptional usb_template
+dev/usb/template/usb_template_audio.c  optional usb_template
 dev/usb/template/usb_template_cdce.c   optional usb_template
+dev/usb/template/usb_template_kbd.coptional usb_template
+dev/usb/template/usb_template_modem.c  optional usb_template
+dev/usb/template/usb_template_mouse.c  optional usb_template
 dev/usb/template/usb_template_msc.coptional usb_template
 dev/usb/template/usb_template_mtp.coptional usb_template
 #

Modified: head/sys/dev/usb/template/usb_template.c
==
--- head/sys/dev/usb/template/usb_template.cThu Jun 23 06:55:29 2011
(r223466)
+++ head/sys/dev/usb/template/usb_template.cThu Jun 23 07:54:03 2011
(r223467)
@@ -49,6 +49,7 @@
 #include sys/priv.h
 
 #include dev/usb/usb.h
+#include dev/usb/usb_ioctl.h
 #include dev/usb/usbdi.h
 #include dev/usb/usbdi_util.h
 #include usbdevs.h
@@ -141,6 +142,31 @@ usb_make_raw_desc(struct usb_temp_setup 
ud-bSlaveInterface[0] +=
temp-bInterfaceNumber;
}
+
+   /* check if we have got an interface association 
descriptor */
+
+   if ((raw[0] = sizeof(struct 
usb_interface_assoc_descriptor)) 
+   (raw[1] == UDESC_IFACE_ASSOC)) {
+   struct usb_interface_assoc_descriptor *iad = 
(void *)dst;
+
+   /* update the interface number */
+
+   iad-bFirstInterface +=
+   temp-bInterfaceNumber;
+   }
+
+   /* check if we have got a call management descriptor */
+
+   if ((raw[0] = sizeof(struct usb_cdc_cm_descriptor)) 
+   (raw[1] == UDESC_CS_INTERFACE) 
+   (raw[2] == UDESCSUB_CDC_CM)) {
+   struct usb_cdc_cm_descriptor *ccd = (void *)dst;
+
+   /* update the interface number */
+
+   ccd-bDataInterface +=
+   temp-bInterfaceNumber;
+   }
}
temp-size += len;
}
@@ -476,6 +502,10 @@ usb_make_device_desc(struct usb_temp_set
USETW(utd-udd.bcdUSB, 0x0250);
utd-udd.bMaxPacketSize = 255;  /* 512 bytes */
break;
+   case USB_SPEED_SUPER:
+   USETW(utd-udd.bcdUSB, 0x0300);
+   utd-udd.bMaxPacketSize = 9;/* 2**9 = 512 bytes */
+   break;
default:
temp-err = USB_ERR_INVAL;
break;
@@ -1303,15 +1333,27 @@ usb_temp_setup_by_index(struct usb_devic
usb_error_t err;
 
switch (index) {
-   case 0:
+   case USB_TEMP_MSC:
err = usb_temp_setup(udev, usb_template_msc);
break;
-   case 1:
+   case USB_TEMP_CDCE:
err = usb_temp_setup(udev, usb_template_cdce);
break;
-   case 2:
+   case USB_TEMP_MTP:
err = usb_temp_setup(udev, usb_template_mtp);
break;
+   case USB_TEMP_MODEM:
+   err = usb_temp_setup(udev, usb_template_modem);
+   break;
+   

Re: svn commit: r223464 - head/sys/vm

2011-06-23 Thread Bjoern A. Zeeb

On Jun 23, 2011, at 5:24 AM, Alan Cox wrote:

 Author: alc
 Date: Thu Jun 23 05:23:59 2011
 New Revision: 223464
 URL: http://svn.freebsd.org/changeset/base/223464
 
 Log:
  Revert to using the page queues lock in vm_page_clear_dirty_mask() on
  MIPS.  (At present, although atomic_clear_char() is defined by atomic.h
  on MIPS, it is not actually implemented by support.S.)

Thanks,
and good catch on the atomics even if not planned, just in time for 9.0:)

/bz

-- 
Bjoern A. Zeeb You have to have visions!
 Stop bit received. Insert coin for new address family.

___
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: r223469 - head/sys/netgraph

2011-06-23 Thread Gleb Smirnoff
Author: glebius
Date: Thu Jun 23 09:42:41 2011
New Revision: 223469
URL: http://svn.freebsd.org/changeset/base/223469

Log:
  Be consistent with r160968: keep autoSrcAddr flag untouched when
  node receives NGM_SHUTDOWN.
  
  Submitted by: pluknet

Modified:
  head/sys/netgraph/ng_ether.c

Modified: head/sys/netgraph/ng_ether.c
==
--- head/sys/netgraph/ng_ether.cThu Jun 23 09:40:46 2011
(r223468)
+++ head/sys/netgraph/ng_ether.cThu Jun 23 09:42:41 2011
(r223469)
@@ -718,7 +718,6 @@ ng_ether_shutdown(node_p node)
(void)ifpromisc(priv-ifp, 0);
priv-promisc = 0;
}
-   priv-autoSrcAddr = 1;  /* reset auto-src-addr flag */
NG_NODE_REVIVE(node);   /* Signal ng_rmnode we are persisant */
 
return (0);
___
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: r223470 - head/sys/powerpc/powerpc

2011-06-23 Thread Andreas Tobler
Author: andreast
Date: Thu Jun 23 09:43:53 2011
New Revision: 223470
URL: http://svn.freebsd.org/changeset/base/223470

Log:
  Add leading zeros when printing the stackframe on __powerpc64__.

Modified:
  head/sys/powerpc/powerpc/db_trace.c

Modified: head/sys/powerpc/powerpc/db_trace.c
==
--- head/sys/powerpc/powerpc/db_trace.c Thu Jun 23 09:42:41 2011
(r223469)
+++ head/sys/powerpc/powerpc/db_trace.c Thu Jun 23 09:43:53 2011
(r223470)
@@ -200,7 +200,7 @@ db_backtrace(struct thread *td, db_addr_
}
 
#ifdef __powerpc64__
-   db_printf(0x%16lx: , stackframe);
+   db_printf(0x%016lx: , stackframe);
#else
db_printf(0x%08x: , stackframe);
#endif
___
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: r223471 - head/sys/powerpc/aim

2011-06-23 Thread Andreas Tobler
Author: andreast
Date: Thu Jun 23 09:46:12 2011
New Revision: 223471
URL: http://svn.freebsd.org/changeset/base/223471

Log:
  Fix merge typo.

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cThu Jun 23 09:43:53 2011
(r223470)
+++ head/sys/powerpc/aim/mmu_oea64.cThu Jun 23 09:46:12 2011
(r223471)
@@ -1715,7 +1715,7 @@ moea64_kextract(mmu_t mmu, vm_offset_t v
pvo = moea64_pvo_find_va(kernel_pmap, va);
KASSERT(pvo != NULL, (moea64_kextract: no addr found for %# PRIxPTR,
va));
-   pa = (pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN) + (va - PVO_VADDR(pvo));
+   pa = (pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN) | (va - PVO_VADDR(pvo));
PMAP_UNLOCK(kernel_pmap);
return (pa);
 }
___
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: r223472 - head/sys/dev/usb/template

2011-06-23 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Jun 23 10:35:45 2011
New Revision: 223472
URL: http://svn.freebsd.org/changeset/base/223472

Log:
  - Add some comments about the origin of some USB descriptors.
  
  MFC after:7 days

Modified:
  head/sys/dev/usb/template/usb_template_audio.c
  head/sys/dev/usb/template/usb_template_kbd.c
  head/sys/dev/usb/template/usb_template_mouse.c

Modified: head/sys/dev/usb/template/usb_template_audio.c
==
--- head/sys/dev/usb/template/usb_template_audio.c  Thu Jun 23 09:46:12 
2011(r223471)
+++ head/sys/dev/usb/template/usb_template_audio.c  Thu Jun 23 10:35:45 
2011(r223472)
@@ -95,7 +95,12 @@ USB_MAKE_STRING_DESC(STRING_AUDIO_PRODUC
 
 /* prototypes */
 
-/* Audio Mixer description structures */
+/*
+ * Audio Mixer description structures
+ *
+ * Some of the audio descriptors were dumped
+ * from a Creative Labs USB audio device.
+ */
 
 static const uint8_t audio_raw_desc_0[] = {
0x0a, 0x24, 0x01, 0x00, 0x01, 0xa9, 0x00, 0x02,

Modified: head/sys/dev/usb/template/usb_template_kbd.c
==
--- head/sys/dev/usb/template/usb_template_kbd.cThu Jun 23 09:46:12 
2011(r223471)
+++ head/sys/dev/usb/template/usb_template_kbd.cThu Jun 23 10:35:45 
2011(r223472)
@@ -94,6 +94,8 @@ static const struct usb_temp_interval ke
.bInterval[USB_SPEED_HIGH] = 2 * 8,
 };
 
+/* The following HID descriptor was dumped from a HP keyboard. */
+
 static uint8_t keyboard_hid_descriptor[] = {
0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07,
0x19, 0xe0, 0x29, 0xe7, 0x15, 0x00, 0x25, 0x01,

Modified: head/sys/dev/usb/template/usb_template_mouse.c
==
--- head/sys/dev/usb/template/usb_template_mouse.c  Thu Jun 23 09:46:12 
2011(r223471)
+++ head/sys/dev/usb/template/usb_template_mouse.c  Thu Jun 23 10:35:45 
2011(r223472)
@@ -82,6 +82,8 @@ USB_MAKE_STRING_DESC(STRING_PRODUCT, str
 
 /* prototypes */
 
+/* The following HID descriptor was dumped from a HP mouse. */
+
 static uint8_t mouse_hid_descriptor[] = {
0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x09, 0x01,
0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x03,
___
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: r223473 - head/share/man/man4

2011-06-23 Thread Gleb Smirnoff
Author: glebius
Date: Thu Jun 23 10:43:36 2011
New Revision: 223473
URL: http://svn.freebsd.org/changeset/base/223473

Log:
  Document that autoSrcAddr isn't re-enabled on NGM_SHUTDOWN.
  
  Submitted by: Vadim Goncharov vadim_nuclight mail.ru

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

Modified: head/share/man/man4/ng_ether.4
==
--- head/share/man/man4/ng_ether.4  Thu Jun 23 10:35:45 2011
(r223472)
+++ head/share/man/man4/ng_ether.4  Thu Jun 23 10:43:36 2011
(r223473)
@@ -34,7 +34,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd August 4, 2006
+.Dd June 23, 2011
 .Dt NG_ETHER 4
 .Os
 .Sh NAME
@@ -183,7 +183,6 @@ Detach from underlying Ethernet interfac
 Upon receipt of the
 .Dv NGM_SHUTDOWN
 control message, all hooks are disconnected, promiscuous mode is disabled,
-and the source address override flag is re-enabled,
 but the node is not removed.
 Node can be shut down only using
 .Dv NGM_ETHER_DETACH
___
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: r223474 - head/sys/dev/ath/ath_hal

2011-06-23 Thread Adrian Chadd
Author: adrian
Date: Thu Jun 23 12:11:43 2011
New Revision: 223474
URL: http://svn.freebsd.org/changeset/base/223474

Log:
  add missing #define for the non-debug case.

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

Modified: head/sys/dev/ath/ath_hal/ah_internal.h
==
--- head/sys/dev/ath/ath_hal/ah_internal.h  Thu Jun 23 10:43:36 2011
(r223473)
+++ head/sys/dev/ath/ath_hal/ah_internal.h  Thu Jun 23 12:11:43 2011
(r223474)
@@ -529,6 +529,7 @@ extern  void DO_HALDEBUG(struct ath_hal *
__printflike(3,4);
 #else
 #define HALDEBUG(_ah, __m, _fmt, ...)
+#define HALDEBUG_G(_ah, __m, _fmt, ...)
 #endif /* AH_DEBUG */
 
 /*
___
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: r223475 - head/sys/cam/ata

2011-06-23 Thread Alexander Motin
Author: mav
Date: Thu Jun 23 15:10:44 2011
New Revision: 223475
URL: http://svn.freebsd.org/changeset/base/223475

Log:
  Fix ATAPI breakage introduced by r223443. It made SCSI commands to ATAPI
  device to never complete, that caused probe process (system boot) stuck.

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

Modified: head/sys/cam/ata/ata_xpt.c
==
--- head/sys/cam/ata/ata_xpt.c  Thu Jun 23 12:11:43 2011(r223474)
+++ head/sys/cam/ata/ata_xpt.c  Thu Jun 23 15:10:44 2011(r223475)
@@ -1678,7 +1678,8 @@ ata_action(union ccb *start_ccb)
xpt_done(start_ccb);
break;
}
-   /* FALLTHROUGH */
+   xpt_action_default(start_ccb);
+   break;
}
case XPT_DEV_ADVINFO:
{
___
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: r223426 - in head/sys: dev/acpica kern sys x86/x86

2011-06-23 Thread Marcel Moolenaar

On Jun 22, 2011, at 6:36 PM, Alexander Motin wrote:

 Marcel Moolenaar wrote:
 On Jun 22, 2011, at 5:30 PM, Alexander Motin wrote:
 Marcel Moolenaar wrote:
 On Jun 22, 2011, at 4:24 PM, Jung-uk Kim wrote:
 I just realized kern_clocksource.c was excluded for arm and ia64.  
 Here is updated patch.  Please ignore the previous one.
 Any reason why we're not adding kern_clocksource.c for them?
 Their event timers code still waits for refactoring. I have neither
 documentation nor hardware for them. Help would be appreciated.
 
 Can you give me a pointer to a document orpage that describes
 what is being refactored, why and how?
 
 In short, timer management code was unified and formalized. Instead of
 direct programming periodic timers from MD code and calling hard-/
 stat-/ profclock() from there, timer hardware should be exposed to the
 MI kernel using sys/timeet.h API to allow kern_clocksource.c manage it.
 Last require calling its cpu_initclocks_bsp() and cpu_initclocks_ap()
 callbacks from MD initialization code, and cpu_idleclock() and
 cpu_activeclock() from MD cpu_idle().
 
 Here is some references:
 man 4 eventtimers
 http://wiki.freebsd.org/201010DevSummit?action=AttachFiledo=viewtarget=timers.pdf
 http://svnweb.freebsd.org/base?view=revisionrevision=209371
 http://svnweb.freebsd.org/base?view=revisionrevision=212541
 
 All architectures except ia64 and non-Marvell arm are already done, so
 you may took any of them as reference. Ask me if you have any questions.

Can you give a quick outline of how all the various clock
related initializations and support code relate, interact
or even conflict? It's getting rather convoluted and want
to make sure I get the ordering and timing right.

Also: The ITC on ia64 is a per-CPU, one short and periodic
timer that has a fixed frequency. Though the architecture
does not guarantee that counters are synchronized, nor
that all CPUs in a system run at the same frequency which
means that the ITCs may not all run at the same frequency.
Does the et code work with that or do I need to impose a
restriction on what hardware configurations to support
and/or revert to having the ITC be a global timer and run
only on the BSP?

Thanks,

-- 
Marcel Moolenaar
mar...@xcllnt.net


___
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: r223477 - head/sys/boot/i386/zfsboot

2011-06-23 Thread John Baldwin
Author: jhb
Date: Thu Jun 23 15:53:17 2011
New Revision: 223477
URL: http://svn.freebsd.org/changeset/base/223477

Log:
  The recent change to increase the zfsboot size to 64k made a few BIOSes
  unhappy (probably they don't handle crossing the 64k boundary, etc.).
  Fix this by changing zfsldr to use a loop reading from the disk one
  sector at a time.  To avoid trashing the saved copy of the MBR which is
  used for disk I/O, read zfsboot2 at address 0x9000.  This has the
  advantage that BTX no longer needs to be relocated as it is read into
  the correct location.  However, the loop to relocate zfsboot2.bin can
  now cross a 64k boundary, so change it to use relative segments instead.
  (This will need further work if zfsboot2.bin ever exceeds 64k.)
  
  While here, stop storing a relocated copy of zfsldr at 0x700.  This was
  only used by the xread hack which has recently been removed (and even
  that use was dubious).  Also, include the BIOS error code as hex when
  reporting read errors to aid in debugging.
  
  Much thanks to Henri Hennebert for patiently testing various iterations
  of the patch as well as fixing the zfsboot2.bin relocation to use
  relative segments.
  
  MFC after:1 week

Modified:
  head/sys/boot/i386/zfsboot/zfsldr.S

Modified: head/sys/boot/i386/zfsboot/zfsldr.S
==
--- head/sys/boot/i386/zfsboot/zfsldr.S Thu Jun 23 15:28:54 2011
(r223476)
+++ head/sys/boot/i386/zfsboot/zfsldr.S Thu Jun 23 15:53:17 2011
(r223477)
@@ -16,7 +16,6 @@
  */
 
 /* Memory Locations */
-   .set MEM_REL,0x700  # Relocation address
.set MEM_ARG,0x900  # Arguments
.set MEM_ORG,0x7c00 # Origin
.set MEM_BUF,0x8000 # Load area
@@ -91,26 +90,18 @@ main:   cld # 
String ops inc
mov %cx,%ss # Set up
mov $start,%sp  #  stack
 /*
- * Relocate ourself to MEM_REL.  Since %cx == 0, the inc %ch sets
- * %cx == 0x100.
- */
-   mov %sp,%si # Source
-   mov $MEM_REL,%di# Destination
-   incb %ch# Word count
-   rep # Copy
-   movsw   #  code
-/*
  * If we are on a hard drive, then load the MBR and look for the first
  * FreeBSD slice.  We use the fake partition entry below that points to
  * the MBR when we call nread.  The first pass looks for the first active
  * FreeBSD slice.  The second pass looks for the first non-active FreeBSD
  * slice if the first one fails.
  */
-   mov $part4,%si  # Partition
+   mov $part4,%si  # Dummy partition
cmpb $0x80,%dl  # Hard drive?
jb main.4   # No
-   movb $0x1,%dh   # Block count
-   callw nread # Read MBR
+   xor %eax,%eax   # Read MBR
+   movl $MEM_BUF,%ebx  #  from first
+   callw nread #  sector
mov $0x1,%cx# Two passes
 main.1:mov $MEM_BUF+PRT_OFF,%si# Partition table
movb $0x1,%dh   # Partition
@@ -139,52 +130,51 @@ main.4:   xor %dx,%dx # 
Partition:drive
 /*
  * Ok, we have a slice and drive in %dx now, so use that to locate and
  * load boot2.  %si references the start of the slice we are looking
- * for, so go ahead and load up the 64 sectors starting at sector 1024
+ * for, so go ahead and load up the 128 sectors starting at sector 1024
  * (i.e. after the two vdev labels).  We don't have do anything fancy
  * here to allow for an extra copy of boot1 and a partition table
  * (compare to this section of the UFS bootstrap) so we just load it
- * all at 0x8000. The first part of boot2 is BTX, which wants to run
+ * all at 0x9000. The first part of boot2 is BTX, which wants to run
  * at 0x9000. The boot2.bin binary starts right after the end of BTX,
  * so we have to figure out where the start of it is and then move the
- * binary to 0xc000. After we have moved the client, we relocate BTX
- * itself to 0x9000 - doing it in this order means that none of the
- * memcpy regions overlap which would corrupt the copy.  Normally, BTX
- * clients start at MEM_USR, or 0xa000, but when we use btxld to
- * create zfsboot2, we use an entry point of 0x2000.  That entry point is
- * relative to MEM_USR; thus boot2.bin starts at 0xc000.
+ * binary to 0xc000.  Normally, BTX clients start at MEM_USR, or 0xa000,
+ * but when we use btxld to create zfsboot2, we use an entry point of
+ * 0x2000.  That entry point is relative to MEM_USR; thus 

Re: svn commit: r223475 - head/sys/cam/ata

2011-06-23 Thread Andrey Chernov
On Thu, Jun 23, 2011 at 03:10:44PM +, Alexander Motin wrote:
 Author: mav
 Date: Thu Jun 23 15:10:44 2011
 New Revision: 223475
 URL: http://svn.freebsd.org/changeset/base/223475
 
 Log:
   Fix ATAPI breakage introduced by r223443. It made SCSI commands to ATAPI
   device to never complete, that caused probe process (system boot) stuck.

With that commit I have no more those run_interrupt_driven_hooks:... 
messages, but still have hang at boot related to DVD (no hang if DVDs are 
physically unplugged). Moreover, I have only 1 of 2 plain ATA DVDs 
detected in probe messages as cd1 (no cd0 there). DDB's ps show sleep in 
the xpt_thrd (xpt_scanner_thread) at ccb_scan and sleep at caplck, no 
locks are shown by 'show lock'.

-- 
http://ache.vniz.net/
___
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: r223478 - head/sys/ia64/ia64

2011-06-23 Thread Marcel Moolenaar
Author: marcel
Date: Thu Jun 23 16:21:43 2011
New Revision: 223478
URL: http://svn.freebsd.org/changeset/base/223478

Log:
  Unblock the outgoing thread after we performed pmap_switch() to
  switch the region registers. pmap_switch() returns the pmap for
  which the region register are currently programmed, which needs
  to be re-programmed on the CPU the ougoing thread gets switched
  in.  This change does not noticibly change anything or fix known
  bugs, but does give me a warm fuzzy feeling by being more
  correct.

Modified:
  head/sys/ia64/ia64/machdep.c

Modified: head/sys/ia64/ia64/machdep.c
==
--- head/sys/ia64/ia64/machdep.cThu Jun 23 15:53:17 2011
(r223477)
+++ head/sys/ia64/ia64/machdep.cThu Jun 23 16:21:43 2011
(r223478)
@@ -470,12 +470,12 @@ cpu_switch(struct thread *old, struct th
if (PCPU_GET(fpcurthread) == old)
old-td_frame-tf_special.psr |= IA64_PSR_DFH;
if (!savectx(oldpcb)) {
-   atomic_store_rel_ptr(old-td_lock, mtx);
-
newpcb = new-td_pcb;
oldpcb-pcb_current_pmap =
pmap_switch(newpcb-pcb_current_pmap);
 
+   atomic_store_rel_ptr(old-td_lock, mtx);
+
 #if defined(SCHED_ULE)  defined(SMP)
while (atomic_load_acq_ptr(new-td_lock) == blocked_lock)
cpu_spinwait();
___
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: r223475 - head/sys/cam/ata

2011-06-23 Thread Andrey Chernov
On Thu, Jun 23, 2011 at 08:00:10PM +0400, Andrey Chernov wrote:
 On Thu, Jun 23, 2011 at 03:10:44PM +, Alexander Motin wrote:
  Author: mav
  Date: Thu Jun 23 15:10:44 2011
  New Revision: 223475
  URL: http://svn.freebsd.org/changeset/base/223475
  
  Log:
Fix ATAPI breakage introduced by r223443. It made SCSI commands to ATAPI
device to never complete, that caused probe process (system boot) stuck.
 
 With that commit I have no more those run_interrupt_driven_hooks:... 
 messages, but still have hang at boot related to DVD (no hang if DVDs are 
 physically unplugged). Moreover, I have only 1 of 2 plain ATA DVDs 
 detected in probe messages as cd1 (no cd0 there). DDB's ps show sleep in 
 the xpt_thrd (xpt_scanner_thread) at ccb_scan and sleep at caplck, no 
 locks are shown by 'show lock'.
 
More about caplck: it was cdopen() who calls cam_periph_hold() and 
sleeps there forever.

-- 
http://ache.vniz.net/
___
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: r223479 - head/sys/powerpc/aim

2011-06-23 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Jun 23 16:34:41 2011
New Revision: 223479
URL: http://svn.freebsd.org/changeset/base/223479

Log:
  Clear any outstanding atomic reservations when traps are taken. This fixes
  some interesting bugs (mostly on SMP systems) with atomic operations
  silently failing in interrupt heavy situations, especially when using
  overflow pages.

Modified:
  head/sys/powerpc/aim/trap_subr32.S
  head/sys/powerpc/aim/trap_subr64.S

Modified: head/sys/powerpc/aim/trap_subr32.S
==
--- head/sys/powerpc/aim/trap_subr32.S  Thu Jun 23 16:21:43 2011
(r223478)
+++ head/sys/powerpc/aim/trap_subr32.S  Thu Jun 23 16:34:41 2011
(r223479)
@@ -748,6 +748,8 @@ k_trap:
 /* Call C interrupt dispatcher: */
 trapagain:
addi%r3,%r1,8
+   addi%r4,%r1,-4  /* Clear any existing reservations */
+   stwcx.  %r3,0,%r4   
bl  CNAME(powerpc_interrupt)
.globl  CNAME(trapexit) /* backtrace code sentinel */
 CNAME(trapexit):

Modified: head/sys/powerpc/aim/trap_subr64.S
==
--- head/sys/powerpc/aim/trap_subr64.S  Thu Jun 23 16:21:43 2011
(r223478)
+++ head/sys/powerpc/aim/trap_subr64.S  Thu Jun 23 16:34:41 2011
(r223479)
@@ -508,6 +508,8 @@ trapagain:
lis %r3,tocbase@ha
ld  %r2,tocbase@l(%r3)
addi%r3,%r1,48
+   addi%r4,%r1,-8  /* Clear any existing reservations */
+   stdcx.  %r3,0,%r4   
bl  CNAME(powerpc_interrupt)
nop
 
___
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: r223426 - in head/sys: dev/acpica kern sys x86/x86

2011-06-23 Thread Alexander Motin
Marcel Moolenaar wrote:
 On Jun 22, 2011, at 6:36 PM, Alexander Motin wrote:
 Marcel Moolenaar wrote:
 On Jun 22, 2011, at 5:30 PM, Alexander Motin wrote:
 Marcel Moolenaar wrote:
 On Jun 22, 2011, at 4:24 PM, Jung-uk Kim wrote:
 I just realized kern_clocksource.c was excluded for arm and ia64.  
 Here is updated patch.  Please ignore the previous one.
 Any reason why we're not adding kern_clocksource.c for them?
 Their event timers code still waits for refactoring. I have neither
 documentation nor hardware for them. Help would be appreciated.
 Can you give me a pointer to a document orpage that describes
 what is being refactored, why and how?
 In short, timer management code was unified and formalized. Instead of
 direct programming periodic timers from MD code and calling hard-/
 stat-/ profclock() from there, timer hardware should be exposed to the
 MI kernel using sys/timeet.h API to allow kern_clocksource.c manage it.
 Last require calling its cpu_initclocks_bsp() and cpu_initclocks_ap()
 callbacks from MD initialization code, and cpu_idleclock() and
 cpu_activeclock() from MD cpu_idle().

 Here is some references:
 man 4 eventtimers
 http://wiki.freebsd.org/201010DevSummit?action=AttachFiledo=viewtarget=timers.pdf
 http://svnweb.freebsd.org/base?view=revisionrevision=209371
 http://svnweb.freebsd.org/base?view=revisionrevision=212541

 All architectures except ia64 and non-Marvell arm are already done, so
 you may took any of them as reference. Ask me if you have any questions.
 
 Can you give a quick outline of how all the various clock
 related initializations and support code relate, interact
 or even conflict? It's getting rather convoluted and want
 to make sure I get the ordering and timing right.

During probe, every event timer driver initializes hardware and calls
et_register(). After probe done, on SI_SUB_CLOCKS SYSINIT stage MI
cpu_initclocks_bsp() called from MD cpu_initclocks() chooses the best
timer, chooses best hz, stathz and profhz values according to timer
capabilities and starts timer. If timer is per-CPU, it starts only BSP
one. Later, on SMP APs startup, when each CPU launched,
cpu_initclocks_ap() is called to start per-CPU timers there.

MI code no longer calls hard-/stat-/profclock(). Instead it calls
registered callback function. Callback function expects to be called in
hardware interrupt context: td_intr_nesting_level should be incremented
and td_intr_frame should contain interrupt trapframe pointer. You may
see lapic_handle_timer() in x86/x86/local_apic.c as workaround example,
if needed.

cpu_startprofclock() and cpu_stopprofclock() are MI now and should be
removed from MD code.

MI cpu_idleclock() and cpu_activeclock() should be called from MD
cpu_idle() on per-CPU basis to reprogram timer when CPU enters/exits
sleep state. They should be called within critical section to delay
context switch on wakeup until all skipped during sleep time events are
handled (by the cpu_activeclock()).

Timer calls are serialized by caller by holding spin lock (per-CPU locks
for per-CPU timers). Due to disabled interrupts, you are not allowed to
sleep, wait for IPIs delivery or do anything else, that may cause
deadlock with other CPUs.

Depending on hardware implementation, you may need to take care to not
loose events on short time intervals. It is especially important in
one-shot mode, as timer won't be reloaded in that case.

 Also: The ITC on ia64 is a per-CPU, one short and periodic
 timer that has a fixed frequency. Though the architecture
 does not guarantee that counters are synchronized, nor
 that all CPUs in a system run at the same frequency which
 means that the ITCs may not all run at the same frequency.
 Does the et code work with that or do I need to impose a
 restriction on what hardware configurations to support
 and/or revert to having the ITC be a global timer and run
 only on the BSP?

Event timer API operates in terms of bintime time intervals. It doesn't
depend on timer base frequency. kern_clocksource.c uses that frequency
only to calculate more suitable hz/stathz/profhz values. It will survive
wrong value there, or even zero, if frequency is unknown. If base
frequency differs between CPUs, event timer driver should just properly
handle requested bintime value, using proper base frequency when
programming timer. In one-shot mode kern_clocksource.c doesn't depend on
timer precision. In periodic mode it does, but some drift between CPUs
is acceptable.

-- 
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


Re: svn commit: r223475 - head/sys/cam/ata

2011-06-23 Thread Andrey Chernov
Here is old cd0 probe message with old kernel when it was probed, just in 
case it helps (nothing unusual with it, and it still works under Win7):
cd0 at ata2 bus 0 scbus2 target 0 lun 0
cd0: ASUS DVD-E616A 1.08 Removable CD-ROM SCSI-0 device
cd0: 100.000MB/s transfers (UDMA5, ATAPI 12bytes, PIO 65534bytes)
cd0: Attempt to query device size failed: NOT READY, Medium not present - tray 
closed

On Thu, Jun 23, 2011 at 08:24:58PM +0400, Andrey Chernov wrote:
 On Thu, Jun 23, 2011 at 08:00:10PM +0400, Andrey Chernov wrote:
  On Thu, Jun 23, 2011 at 03:10:44PM +, Alexander Motin wrote:
   Author: mav
   Date: Thu Jun 23 15:10:44 2011
   New Revision: 223475
   URL: http://svn.freebsd.org/changeset/base/223475
   
   Log:
 Fix ATAPI breakage introduced by r223443. It made SCSI commands to ATAPI
 device to never complete, that caused probe process (system boot) stuck.
  
  With that commit I have no more those run_interrupt_driven_hooks:... 
  messages, but still have hang at boot related to DVD (no hang if DVDs are 
  physically unplugged). Moreover, I have only 1 of 2 plain ATA DVDs 
  detected in probe messages as cd1 (no cd0 there). DDB's ps show sleep in 
  the xpt_thrd (xpt_scanner_thread) at ccb_scan and sleep at caplck, no 
  locks are shown by 'show lock'.
  
 More about caplck: it was cdopen() who calls cam_periph_hold() and 
 sleeps there forever.
 
 -- 
 http://ache.vniz.net/


-- 
http://ache.vniz.net/
___
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: r223482 - head/sys/dev/e1000

2011-06-23 Thread Jack F Vogel
Author: jfv
Date: Thu Jun 23 17:42:27 2011
New Revision: 223482
URL: http://svn.freebsd.org/changeset/base/223482

Log:
  Put back the global for rx processing due to popular demand.

Modified:
  head/sys/dev/e1000/if_igb.c

Modified: head/sys/dev/e1000/if_igb.c
==
--- head/sys/dev/e1000/if_igb.c Thu Jun 23 17:30:34 2011(r223481)
+++ head/sys/dev/e1000/if_igb.c Thu Jun 23 17:42:27 2011(r223482)
@@ -346,6 +346,10 @@ TUNABLE_INT(hw.igb.hdr_split, igb_hea
 static int igb_num_queues = 0;
 TUNABLE_INT(hw.igb.num_queues, igb_num_queues);
 
+/* How many packets rxeof tries to clean at a time */
+static int igb_rx_process_limit = 100;
+TUNABLE_INT(hw.igb.rx_process_limit, igb_rx_process_limit);
+
 /*
  *  Device identification routine
  *
@@ -465,7 +469,7 @@ igb_attach(device_t dev)
/* Sysctl for limiting the amount of work done in the taskqueue */
igb_set_sysctl_value(adapter, rx_processing_limit,
max number of rx packets to process,
-   adapter-rx_process_limit, 100);
+   adapter-rx_process_limit, igb_rx_process_limit);
 
/*
 * Validate number of transmit and receive descriptors. It
___
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: r223464 - head/sys/vm

2011-06-23 Thread Warner Losh

On Jun 23, 2011, at 2:17 AM, Bjoern A. Zeeb wrote:

 
 On Jun 23, 2011, at 5:24 AM, Alan Cox wrote:
 
 Author: alc
 Date: Thu Jun 23 05:23:59 2011
 New Revision: 223464
 URL: http://svn.freebsd.org/changeset/base/223464
 
 Log:
 Revert to using the page queues lock in vm_page_clear_dirty_mask() on
 MIPS.  (At present, although atomic_clear_char() is defined by atomic.h
 on MIPS, it is not actually implemented by support.S.)
 
 Thanks,
 and good catch on the atomics even if not planned, just in time for 9.0:)

Yea, there's some work there to fix them...  Not sure we can even fix some of 
them atomically...

Warner___
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: r223464 - head/sys/vm

2011-06-23 Thread Alan Cox

On 6/23/2011 1:30 PM, Warner Losh wrote:

On Jun 23, 2011, at 2:17 AM, Bjoern A. Zeeb wrote:


On Jun 23, 2011, at 5:24 AM, Alan Cox wrote:


Author: alc
Date: Thu Jun 23 05:23:59 2011
New Revision: 223464
URL: http://svn.freebsd.org/changeset/base/223464

Log:
Revert to using the page queues lock in vm_page_clear_dirty_mask() on
MIPS.  (At present, although atomic_clear_char() is defined by atomic.h
on MIPS, it is not actually implemented by support.S.)

Thanks,
and good catch on the atomics even if not planned, just in time for 9.0:)

Yea, there's some work there to fix them...  Not sure we can even fix some of 
them atomically...



I'm not sure that I understand what you mean by the second statement.  
Can you elaborate?  The 8- and 16-bit operations should be no less 
atomic than the 32- and 64-bit operations.  In general, regardless of 
the size of the operation, the sc instruction may fail and the whole 
operation has to be restarted if another processor (or I/O device) 
performs a concurrent, cache coherent store to the same location (or 
even cache line) as the ll and sc instructions are operating on.  On 
the other hand, if the sc instruction succeeds, whether you used it to 
change all of the 32 bits or just 8 of the 32 bits, it should appear as 
an atomic change to any other processor.


Alan



Warner


___
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: r223483 - in head/sys/modules: cxgbe/if_cxgbe nfscl nfscommon

2011-06-23 Thread Ulrich Spoerlein
Author: uqs
Date: Thu Jun 23 20:31:52 2011
New Revision: 223483
URL: http://svn.freebsd.org/changeset/base/223483

Log:
  Fix make buildworld -DMODULES_WITH_WORLD
  Sort opt_ srcs

Modified:
  head/sys/modules/cxgbe/if_cxgbe/Makefile
  head/sys/modules/nfscl/Makefile
  head/sys/modules/nfscommon/Makefile

Modified: head/sys/modules/cxgbe/if_cxgbe/Makefile
==
--- head/sys/modules/cxgbe/if_cxgbe/MakefileThu Jun 23 17:42:27 2011
(r223482)
+++ head/sys/modules/cxgbe/if_cxgbe/MakefileThu Jun 23 20:31:52 2011
(r223483)
@@ -10,6 +10,7 @@ SRCS = t4_main.c t4_sge.c t4_l2t.c
 SRCS+= t4_hw.c
 SRCS+= device_if.h bus_if.h pci_if.h
 SRCS+= opt_inet.h
+SRCS+= opt_ofed.h
 
 CFLAGS+= -I${CXGBE}
 

Modified: head/sys/modules/nfscl/Makefile
==
--- head/sys/modules/nfscl/Makefile Thu Jun 23 17:42:27 2011
(r223482)
+++ head/sys/modules/nfscl/Makefile Thu Jun 23 20:31:52 2011
(r223483)
@@ -14,13 +14,14 @@ SRCS=   vnode_if.h \
nfs_clsubs.c \
nfs_clvfsops.c \
nfs_clvnops.c \
+   opt_bootp.h \
opt_inet.h \
opt_inet6.h \
-   opt_bootp.h \
-   opt_nfsroot.h \
+   opt_kdtrace.h \
+   opt_kgssapi.h \
opt_nfs.h \
-   opt_ufs.h \
-   opt_kgssapi.h
+   opt_nfsroot.h \
+   opt_ufs.h
 
 .if !defined(KERNBUILDDIR)
 NFS_INET?= 1   # 0/1 - requires INET to be configured in kernel

Modified: head/sys/modules/nfscommon/Makefile
==
--- head/sys/modules/nfscommon/Makefile Thu Jun 23 17:42:27 2011
(r223482)
+++ head/sys/modules/nfscommon/Makefile Thu Jun 23 20:31:52 2011
(r223483)
@@ -7,9 +7,10 @@ SRCS=  vnode_if.h \
nfs_commonkrpc.c \
nfs_commonport.c \
nfs_commonsubs.c \
-   opt_kgssapi.h \
-   opt_ufs.h \
opt_inet6.h \
-   opt_nfs.h
+   opt_kdtrace.h \
+   opt_kgssapi.h \
+   opt_nfs.h \
+   opt_ufs.h
 
 .include bsd.kmod.mk
___
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: r223484 - head/contrib/binutils/gas/config

2011-06-23 Thread Dimitry Andric
Author: dim
Date: Thu Jun 23 20:54:44 2011
New Revision: 223484
URL: http://svn.freebsd.org/changeset/base/223484

Log:
  Make GNU as recognize the ARM 'rrx' mnemonic, which can be generated by
  clang for certain expressions.  Code taken from Apple cctools (GPLv2).
  
  Submitted by: damjan.mar...@gmail.com

Modified:
  head/contrib/binutils/gas/config/tc-arm.c

Modified: head/contrib/binutils/gas/config/tc-arm.c
==
--- head/contrib/binutils/gas/config/tc-arm.c   Thu Jun 23 20:31:52 2011
(r223483)
+++ head/contrib/binutils/gas/config/tc-arm.c   Thu Jun 23 20:54:44 2011
(r223484)
@@ -9974,6 +9974,13 @@ do_t_rbit (void)
 }
 
 static void
+do_t_rd_rm (void)
+{
+  inst.instruction |= inst.operands[0].reg  8;
+  inst.instruction |= inst.operands[1].reg;
+}
+
+static void
 do_t_rev (void)
 {
   if (inst.operands[0].reg = 7  inst.operands[1].reg = 7
@@ -14901,6 +14908,9 @@ static const struct asm_opcode insns[] =
  TCE(rsb,  060, ebc0, 3, (RR, oRR, SH), arit, t_rsb),
  TC3(rsbs, 070, ebd0, 3, (RR, oRR, SH), arit, t_rsb),
 
+ TCE(rrx,  1a00060, ea4f0030, 2, (RR, RR),  rd_rm, t_rd_rm),
+ TCE(rrxs, 1b00060, ea5f0030, 2, (RR, RR),  rd_rm, t_rd_rm),
+
 #undef THUMB_VARIANT
 #define THUMB_VARIANT arm_ext_v6
  TCE(cpy,   1a0, 4600, 2, (RR, RR),  rd_rm, t_cpy),
___
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: r223485 - in head/sys/powerpc: aim booke include ofw powerpc

2011-06-23 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Jun 23 22:21:28 2011
New Revision: 223485
URL: http://svn.freebsd.org/changeset/base/223485

Log:
  Use the ABI-mandated thread pointer register (r2 for ppc32, r13 for ppc64)
  instead of a PCPU field for curthread. This averts a race on SMP systems
  with a high interrupt rate where the thread looking up the value of
  curthread could be preempted and migrated between obtaining the PCPU
  pointer and reading the value of pc_curthread, resulting in curthread being
  observed to be the current thread on the thread's original CPU. This played
  merry havoc with the system, in particular with mutexes. Many thanks to
  jhb for helping me work this one out.
  
  Note that Book-E is in principle susceptible to the same problem, but has
  not been modified yet due to lack of Book-E hardware.
  
  MFC after:2 weeks

Modified:
  head/sys/powerpc/aim/copyinout.c
  head/sys/powerpc/aim/locore32.S
  head/sys/powerpc/aim/locore64.S
  head/sys/powerpc/aim/machdep.c
  head/sys/powerpc/aim/mp_cpudep.c
  head/sys/powerpc/aim/swtch32.S
  head/sys/powerpc/aim/swtch64.S
  head/sys/powerpc/aim/trap.c
  head/sys/powerpc/aim/trap_subr32.S
  head/sys/powerpc/aim/trap_subr64.S
  head/sys/powerpc/booke/copyinout.c
  head/sys/powerpc/booke/interrupt.c
  head/sys/powerpc/booke/trap.c
  head/sys/powerpc/include/pcpu.h
  head/sys/powerpc/ofw/ofwcall32.S
  head/sys/powerpc/powerpc/mp_machdep.c

Modified: head/sys/powerpc/aim/copyinout.c
==
--- head/sys/powerpc/aim/copyinout.cThu Jun 23 20:54:44 2011
(r223484)
+++ head/sys/powerpc/aim/copyinout.cThu Jun 23 22:21:28 2011
(r223485)
@@ -142,7 +142,7 @@ copyout(const void *kaddr, void *udaddr,
char*up, *p;
size_t  l;
 
-   td = PCPU_GET(curthread);
+   td = curthread;
pm = td-td_proc-p_vmspace-vm_pmap;
 
if (setfault(env)) {
@@ -183,7 +183,7 @@ copyin(const void *udaddr, void *kaddr, 
char*kp, *p;
size_t  l;
 
-   td = PCPU_GET(curthread);
+   td = curthread;
pm = td-td_proc-p_vmspace-vm_pmap;
 
if (setfault(env)) {
@@ -225,7 +225,7 @@ copyinstr(const void *udaddr, void *kadd
size_t  l;
int rv, c;
 
-   td = PCPU_GET(curthread);
+   td = curthread;
pm = td-td_proc-p_vmspace-vm_pmap;
 
if (setfault(env)) {
@@ -267,7 +267,7 @@ subyte(void *addr, int byte)
faultbufenv;
char*p;
 
-   td = PCPU_GET(curthread);
+   td = curthread;
pm = td-td_proc-p_vmspace-vm_pmap;
p = (char *)(USER_ADDR + ((uintptr_t)addr  ~SEGMENT_MASK));
 
@@ -293,7 +293,7 @@ suword32(void *addr, int word)
faultbufenv;
int *p;
 
-   td = PCPU_GET(curthread);
+   td = curthread;
pm = td-td_proc-p_vmspace-vm_pmap;
p = (int *)(USER_ADDR + ((uintptr_t)addr  ~SEGMENT_MASK));
 
@@ -319,7 +319,7 @@ suword(void *addr, long word)
faultbufenv;
long*p;
 
-   td = PCPU_GET(curthread);
+   td = curthread;
pm = td-td_proc-p_vmspace-vm_pmap;
p = (long *)(USER_ADDR + ((uintptr_t)addr  ~SEGMENT_MASK));
 
@@ -359,7 +359,7 @@ fubyte(const void *addr)
u_char  *p;
int val;
 
-   td = PCPU_GET(curthread);
+   td = curthread;
pm = td-td_proc-p_vmspace-vm_pmap;
p = (u_char *)(USER_ADDR + ((uintptr_t)addr  ~SEGMENT_MASK));
 
@@ -385,7 +385,7 @@ fuword32(const void *addr)
faultbufenv;
int32_t *p, val;
 
-   td = PCPU_GET(curthread);
+   td = curthread;
pm = td-td_proc-p_vmspace-vm_pmap;
p = (int32_t *)(USER_ADDR + ((uintptr_t)addr  ~SEGMENT_MASK));
 
@@ -411,7 +411,7 @@ fuword(const void *addr)
faultbufenv;
long*p, val;
 
-   td = PCPU_GET(curthread);
+   td = curthread;
pm = td-td_proc-p_vmspace-vm_pmap;
p = (long *)(USER_ADDR + ((uintptr_t)addr  ~SEGMENT_MASK));
 
@@ -444,7 +444,7 @@ casuword32(volatile uint32_t *addr, uint
faultbuf env;
uint32_t *p, val;
 
-   td = PCPU_GET(curthread);
+   td = curthread;
pm = td-td_proc-p_vmspace-vm_pmap;
p = (uint32_t *)(USER_ADDR + ((uintptr_t)addr  ~SEGMENT_MASK));
 
@@ -489,7 +489,7 @@ casuword(volatile u_long *addr, u_long o
faultbuf env;
u_long *p, val;
 
-   td = PCPU_GET(curthread);
+   td = curthread;
pm = td-td_proc-p_vmspace-vm_pmap;
p = (u_long *)(USER_ADDR + ((uintptr_t)addr  ~SEGMENT_MASK));
 

Modified: head/sys/powerpc/aim/locore32.S
==
--- head/sys/powerpc/aim/locore32.S Thu Jun 23 20:54:44 2011
(r223484)
+++ head/sys/powerpc/aim/locore32.S Thu Jun 23 22:21:28 2011

svn commit: r223486 - in head: sys/dev/sound/usb sys/dev/usb sys/dev/usb/input sys/dev/usb/net sys/dev/usb/serial sys/dev/usb/storage sys/dev/usb/wlan sys/netgraph/bluetooth/drivers/ubt sys/netgrap...

2011-06-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun 24 02:30:02 2011
New Revision: 223486
URL: http://svn.freebsd.org/changeset/base/223486

Log:
  - Move all USB device ID arrays into so-called sections,
sorted according to the mode which they support:
host, device or dual mode
  - Add generic tool to extract these data:
tools/bus_autoconf
  
  Discussed with:   imp
  Suggested by: Robert Millan r...@debian.org
  PR:   misc/157903
  MFC after:14 days

Added:
  head/tools/tools/bus_autoconf/
  head/tools/tools/bus_autoconf/Makefile   (contents, props changed)
  head/tools/tools/bus_autoconf/bus_autoconf.c   (contents, props changed)
  head/tools/tools/bus_autoconf/bus_autoconf.h   (contents, props changed)
  head/tools/tools/bus_autoconf/bus_autoconf.sh   (contents, props changed)
Modified:
  head/sys/dev/sound/usb/uaudio.c
  head/sys/dev/usb/input/atp.c
  head/sys/dev/usb/input/uhid.c
  head/sys/dev/usb/net/if_aue.c
  head/sys/dev/usb/net/if_axe.c
  head/sys/dev/usb/net/if_cdce.c
  head/sys/dev/usb/net/if_cue.c
  head/sys/dev/usb/net/if_ipheth.c
  head/sys/dev/usb/net/if_kue.c
  head/sys/dev/usb/net/if_mos.c
  head/sys/dev/usb/net/if_rue.c
  head/sys/dev/usb/net/if_udav.c
  head/sys/dev/usb/net/uhso.c
  head/sys/dev/usb/serial/u3g.c
  head/sys/dev/usb/serial/uark.c
  head/sys/dev/usb/serial/ubsa.c
  head/sys/dev/usb/serial/uchcom.c
  head/sys/dev/usb/serial/ucycom.c
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/serial/ugensa.c
  head/sys/dev/usb/serial/uipaq.c
  head/sys/dev/usb/serial/ulpt.c
  head/sys/dev/usb/serial/umcs.c
  head/sys/dev/usb/serial/umct.c
  head/sys/dev/usb/serial/umodem.c
  head/sys/dev/usb/serial/umoscom.c
  head/sys/dev/usb/serial/uplcom.c
  head/sys/dev/usb/serial/uslcom.c
  head/sys/dev/usb/serial/uvisor.c
  head/sys/dev/usb/serial/uvscom.c
  head/sys/dev/usb/storage/umass.c
  head/sys/dev/usb/usbdi.h
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_uath.c
  head/sys/dev/usb/wlan/if_upgt.c
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_urtw.c
  head/sys/dev/usb/wlan/if_zyd.c
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
  head/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c

Modified: head/sys/dev/sound/usb/uaudio.c
==
--- head/sys/dev/sound/usb/uaudio.c Thu Jun 23 22:21:28 2011
(r223485)
+++ head/sys/dev/sound/usb/uaudio.c Fri Jun 24 02:30:02 2011
(r223486)
@@ -531,6 +531,15 @@ static driver_t uaudio_driver = {
.size = sizeof(struct uaudio_softc),
 };
 
+static const STRUCT_USB_HOST_ID __used uaudio_devs[] = {
+   /* Generic USB audio class match */
+   {USB_IFACE_CLASS(UICLASS_AUDIO),
+USB_IFACE_SUBCLASS(UISUBCLASS_AUDIOCONTROL),},
+   /* Generic USB MIDI class match */
+   {USB_IFACE_CLASS(UICLASS_AUDIO),
+USB_IFACE_SUBCLASS(UISUBCLASS_MIDISTREAM),},
+};
+
 static int
 uaudio_probe(device_t dev)
 {

Modified: head/sys/dev/usb/input/atp.c
==
--- head/sys/dev/usb/input/atp.cThu Jun 23 22:21:28 2011
(r223485)
+++ head/sys/dev/usb/input/atp.cFri Jun 24 02:30:02 2011
(r223486)
@@ -240,7 +240,7 @@ struct atp_dev_params {
},
 };
 
-static const struct usb_device_id atp_devs[] = {
+static const STRUCT_USB_HOST_ID atp_devs[] = {
/* Core Duo MacBook  MacBook Pro */
{ USB_VPI(USB_VENDOR_APPLE, 0x0217, ATP_DEV_PARAMS_0) },
{ USB_VPI(USB_VENDOR_APPLE, 0x0218, ATP_DEV_PARAMS_0) },

Modified: head/sys/dev/usb/input/uhid.c
==
--- head/sys/dev/usb/input/uhid.c   Thu Jun 23 22:21:28 2011
(r223485)
+++ head/sys/dev/usb/input/uhid.c   Fri Jun 24 02:30:02 2011
(r223486)
@@ -607,29 +607,33 @@ uhid_ioctl(struct usb_fifo *fifo, u_long
return (error);
 }
 
+static const STRUCT_USB_HOST_ID uhid_devs[] = {
+   /* generic HID class */
+   {USB_IFACE_CLASS(UICLASS_HID),},
+   /* the Xbox 360 gamepad doesn't use the HID class */
+   {USB_IFACE_CLASS(UICLASS_VENDOR),
+USB_IFACE_SUBCLASS(UISUBCLASS_XBOX360_CONTROLLER),
+USB_IFACE_PROTOCOL(UIPROTO_XBOX360_GAMEPAD),},
+};
+
 static int
 uhid_probe(device_t dev)
 {
struct usb_attach_arg *uaa = device_get_ivars(dev);
+   int error;
 
DPRINTFN(11, \n);
 
-   if (uaa-usb_mode != USB_MODE_HOST) {
+   if (uaa-usb_mode != USB_MODE_HOST)
return (ENXIO);
-   }
-   if (uaa-info.bInterfaceClass != UICLASS_HID) {
 
-   /* the Xbox 360 gamepad doesn't use the HID class */
+   error = usbd_lookup_id_by_uaa(uhid_devs, sizeof(uhid_devs), uaa);
+   if (error)
+   return (error);
 
-   if ((uaa-info.bInterfaceClass != UICLASS_VENDOR) ||
-   (uaa-info.bInterfaceSubClass 

svn commit: r223487 - head/libexec/tftpd

2011-06-23 Thread Craig Rodrigues
Author: rodrigc
Date: Fri Jun 24 02:56:24 2011
New Revision: 223487
URL: http://svn.freebsd.org/changeset/base/223487

Log:
  Bring back synchnet() implementation from older
  tftp implementation.  The synchnet() function
  was converted to a no-op when the new TFTP implementation
  was committed to FreeBSD.  However, this function, as it was
  in the older code, is needed
  in order to synchronize between the tftpd server and tftp clients,
  which may be buggy.
  
  Specifically, we had a buggy TFTP client which would send
  TFTP ACK packets for non-TFTP packets, which would cause
  the count of packets to get out of whack, causing transfers
  to fail with the new TFTPD implementation.
  
  Obtained from:  Juniper Networks
  Submitted by: Santhanakrishnan Balraj sbalraj at juniper dot net

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

Modified: head/libexec/tftpd/tftp-file.c
==
--- head/libexec/tftpd/tftp-file.c  Fri Jun 24 02:30:02 2011
(r223486)
+++ head/libexec/tftpd/tftp-file.c  Fri Jun 24 02:56:24 2011
(r223487)
@@ -27,6 +27,8 @@
 __FBSDID($FreeBSD$);
 
 #include sys/types.h
+#include sys/ioctl.h
+#include sys/socket.h
 #include sys/stat.h
 
 #include netinet/in.h
@@ -249,9 +251,34 @@ read_close(void)
 }
 
 
+/* When an error has occurred, it is possible that the two sides
+ * are out of synch.  Ie: that what I think is the other side's
+ * response to packet N is really their response to packet N-1.
+ *
+ * So, to try to prevent that, we flush all the input queued up
+ * for us on the network connection on our host.
+ *
+ * We return the number of packets we flushed (mostly for reporting
+ * when trace is active).
+ */
+
 int
-synchnet(int peer __unused)
+synchnet(int peer) /* socket to flush */
 {
-
-   return 0;
+   int i, j = 0;
+   char rbuf[MAXPKTSIZE];
+   struct sockaddr_storage from;
+   socklen_t fromlen;
+
+   while (1) {
+   (void) ioctl(peer, FIONREAD, i);
+   if (i) {
+   j++;
+   fromlen = sizeof from;
+   (void) recvfrom(peer, rbuf, sizeof (rbuf), 0,
+   (struct sockaddr *)from, fromlen);
+   } else {
+   return(j);
+   }
+   }
 }
___
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: r223464 - head/sys/vm

2011-06-23 Thread Jayachandran C.
On Fri, Jun 24, 2011 at 1:33 AM, Alan Cox a...@rice.edu wrote:
 On 6/23/2011 1:30 PM, Warner Losh wrote:

 On Jun 23, 2011, at 2:17 AM, Bjoern A. Zeeb wrote:

 On Jun 23, 2011, at 5:24 AM, Alan Cox wrote:

 Author: alc
 Date: Thu Jun 23 05:23:59 2011
 New Revision: 223464
 URL: http://svn.freebsd.org/changeset/base/223464

 Log:
 Revert to using the page queues lock in vm_page_clear_dirty_mask() on
 MIPS.  (At present, although atomic_clear_char() is defined by atomic.h
 on MIPS, it is not actually implemented by support.S.)

 Thanks,
 and good catch on the atomics even if not planned, just in time for 9.0:)

 Yea, there's some work there to fix them...  Not sure we can even fix some
 of them atomically...


 I'm not sure that I understand what you mean by the second statement.  Can
 you elaborate?  The 8- and 16-bit operations should be no less atomic than
 the 32- and 64-bit operations.  In general, regardless of the size of the
 operation, the sc instruction may fail and the whole operation has to be
 restarted if another processor (or I/O device) performs a concurrent, cache
 coherent store to the same location (or even cache line) as the ll and
 sc instructions are operating on.  On the other hand, if the sc
 instruction succeeds, whether you used it to change all of the 32 bits or
 just 8 of the 32 bits, it should appear as an atomic change to any other
 processor.

I will try out an implementation and see if this works on XLR, if so
this is something we can add to support.S

JC.
___
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: r223488 - head/lib/libstand

2011-06-23 Thread Craig Rodrigues
Author: rodrigc
Date: Fri Jun 24 03:50:54 2011
New Revision: 223488
URL: http://svn.freebsd.org/changeset/base/223488

Log:
  Fixes to newer tftp code in libstand:
   (1) Coding style changes.
   (2) If the server does not acknowledge any blocksize option,
   revert to the default blocksize of 512 bytes.
   (3) Send ACK if the first packet happens to be the last packet.
   (4) Do not accept blocksize greater than what was requested.
   (5) Drop any unwanted OACK received if a tftp transfer is already
   in progress.
   (6) Terminate incomplete transfers with a special no-error ERROR packet.
   Otherwise we rely on the tftp server to time out, which it does
   eventually, after re-sending the last packet several times and spamming
   the system log about it every time.  This idea is borrowed from the
   PXE client, which does exactly that.
  
  Submitted by:  Alexander Kabaev k...@freebsd.org
  Reviewed and Tested by: Santhanakrishnan Balraj sbalraj at juniper dot net

Modified:
  head/lib/libstand/tftp.c

Modified: head/lib/libstand/tftp.c
==
--- head/lib/libstand/tftp.cFri Jun 24 02:56:24 2011(r223487)
+++ head/lib/libstand/tftp.cFri Jun 24 03:50:54 2011(r223488)
@@ -64,13 +64,13 @@ struct tftp_handle;
 
 static int tftp_open(const char *path, struct open_file *f);
 static int tftp_close(struct open_file *f);
-static voidtftp_parse_oack(struct tftp_handle *h, char *buf, size_t len);
+static int tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len);
 static int tftp_read(struct open_file *f, void *buf, size_t size, size_t 
*resid);
 static int tftp_write(struct open_file *f, void *buf, size_t size, size_t 
*resid);
 static off_t   tftp_seek(struct open_file *f, off_t offset, int where);
 static int tftp_set_blksize(struct tftp_handle *h, const char *str);
 static int tftp_stat(struct open_file *f, struct stat *sb);
-static ssize_t sendrecv_tftp(struct tftp_handle *h, 
+static ssize_t sendrecv_tftp(struct tftp_handle *h,
 ssize_t (*sproc)(struct iodesc *, void *, size_t),
 void *sbuf, size_t ssize,
 ssize_t (*rproc)(struct tftp_handle *h, void *, ssize_t, time_t, unsigned 
short *),
@@ -93,7 +93,7 @@ static int  tftpport = 2000;
 static int is_open = 0;
 
 /*
- * The legacy TFTP_BLKSIZE value was 512.
+ * The legacy TFTP_BLKSIZE value was SEGSIZE(512).
  * TFTP_REQUESTED_BLKSIZE of 1428 is (Ethernet MTU, less the TFTP, UDP and
  * IP header lengths).
  */
@@ -102,7 +102,7 @@ static int  is_open = 0;
 /*
  * Choose a blksize big enough so we can test with Ethernet
  * Jumbo frames in the future.
- */ 
+ */
 #define TFTP_MAX_BLKSIZE 9008
 
 struct tftp_handle {
@@ -113,7 +113,7 @@ struct tftp_handle {
int off;
char   *path;   /* saved for re-requests */
unsigned inttftp_blksize;
-   unsigned long   tftp_tsize; 
+   unsigned long   tftp_tsize;
struct {
u_char header[HEADER_SIZE];
struct tftphdr t;
@@ -121,7 +121,8 @@ struct tftp_handle {
} __packed __aligned(4) lastdata;
 };
 
-static const int tftperrors[8] = {
+#defineTFTP_MAX_ERRCODE EOPTNEG
+static const int tftperrors[TFTP_MAX_ERRCODE + 1] = {
0,  /* ??? */
ENOENT,
EPERM,
@@ -129,10 +130,57 @@ static const int tftperrors[8] = {
EINVAL, /* ??? */
EINVAL, /* ??? */
EEXIST,
-   EINVAL  /* ??? */
+   EINVAL, /* ??? */
+   EINVAL, /* Option negotiation failed. */
 };
 
-static ssize_t 
+static int  tftp_getnextblock(struct tftp_handle *h);
+
+/* send error message back. */
+static void
+tftp_senderr(struct tftp_handle *h, u_short errcode, const char *msg)
+{
+   struct {
+   u_char header[HEADER_SIZE];
+   struct tftphdr  t;
+   u_char space[63]; /* +1 from t */
+   } __packed __aligned(4) wbuf;
+   char   *wtail;
+   int len;
+
+   len = strlen(msg);
+   if (len  sizeof(wbuf.space))
+   len = sizeof(wbuf.space);
+
+   wbuf.t.th_opcode = htons((u_short) ERROR);
+   wbuf.t.th_code   = htons(errcode);
+
+   wtail = wbuf.t.th_msg;
+   bcopy(msg, wtail, len);
+   wtail[len] = '\0';
+   wtail += len + 1;
+
+   sendudp(h-iodesc, wbuf.t, wtail - (char *) wbuf.t);
+}
+
+static void
+tftp_sendack(struct tftp_handle *h)
+{
+   struct {
+   u_char header[HEADER_SIZE];
+   struct tftphdr  t;
+   } __packed __aligned(4) wbuf;
+   char   *wtail;
+
+   wbuf.t.th_opcode = htons((u_short) ACK);
+   wtail = (char *) wbuf.t.th_block;
+   wbuf.t.th_block = htons((u_short) h-currblock);
+   wtail += 2;
+
+   sendudp(h-iodesc, wbuf.t, wtail - (char *) 

svn commit: r223489 - in head: sys/dev/usb tools/tools/bus_autoconf

2011-06-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun 24 04:16:06 2011
New Revision: 223489
URL: http://svn.freebsd.org/changeset/base/223489

Log:
  - Add additional information to the PnP info of USB HUBs children which
is now required by bus_autoconf.
  - Allow interface class matching even if device class is vendor specific.
  - Update bus_autoconf tool to not generate system and subsystem match lines
for the nomatch event.
  
  PR:   misc/157903
  MFC after:14 days

Modified:
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/usb_lookup.c
  head/tools/tools/bus_autoconf/bus_autoconf.c

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Fri Jun 24 03:50:54 2011(r223488)
+++ head/sys/dev/usb/usb_hub.c  Fri Jun 24 04:16:06 2011(r223489)
@@ -1334,15 +1334,19 @@ uhub_child_pnpinfo_string(device_t paren
devclass=0x%02x devsubclass=0x%02x 
sernum=\%s\ 
release=0x%04x 
-   intclass=0x%02x intsubclass=0x%02x %s%s,
+   mode=%s 
+   intclass=0x%02x intsubclass=0x%02x 
+   intprotocol=0x%02x  %s%s,
UGETW(res.udev-ddesc.idVendor),
UGETW(res.udev-ddesc.idProduct),
res.udev-ddesc.bDeviceClass,
res.udev-ddesc.bDeviceSubClass,
usb_get_serial(res.udev),
UGETW(res.udev-ddesc.bcdDevice),
+   (res.udev-flags.usb_mode == USB_MODE_HOST) ? host : 
device,
iface-idesc-bInterfaceClass,
iface-idesc-bInterfaceSubClass,
+   iface-idesc-bInterfaceProtocol,
iface-pnpinfo ?   : ,
iface-pnpinfo ? iface-pnpinfo : );
} else {

Modified: head/sys/dev/usb/usb_lookup.c
==
--- head/sys/dev/usb/usb_lookup.c   Fri Jun 24 03:50:54 2011
(r223488)
+++ head/sys/dev/usb/usb_lookup.c   Fri Jun 24 04:16:06 2011
(r223489)
@@ -105,13 +105,6 @@ usbd_lookup_id_by_info(const struct usb_
(id-bDeviceProtocol != info-bDeviceProtocol)) {
continue;
}
-   if ((info-bDeviceClass == 0xFF) 
-   (!(id-match_flag_vendor)) 
-   ((id-match_flag_int_class) ||
-   (id-match_flag_int_subclass) ||
-   (id-match_flag_int_protocol))) {
-   continue;
-   }
if ((id-match_flag_int_class) 
(id-bInterfaceClass != info-bInterfaceClass)) {
continue;

Modified: head/tools/tools/bus_autoconf/bus_autoconf.c
==
--- head/tools/tools/bus_autoconf/bus_autoconf.cFri Jun 24 03:50:54 
2011(r223488)
+++ head/tools/tools/bus_autoconf/bus_autoconf.cFri Jun 24 04:16:06 
2011(r223489)
@@ -148,15 +148,8 @@ usb_dump(struct usb_device_id *id, uint3
 
usb_dump_sub(id, info);
 
-   if (info.is_iface) {
+   if (info.is_any) {
printf(nomatch 10 {\n
-  match \system\ \USB\;\n
-  match \subsystem\ \INTERFACE\;\n
-  match \mode\ \%s\;\n, mode);
-   } else if (info.is_any) {
-   printf(nomatch 10 {\n
-  match \system\ \USB\;\n
-  match \subsystem\ \DEVICE\;\n
   match \mode\ \%s\;\n, mode);
} else {
return (n);
___
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: r223490 - head/tools/tools/bus_autoconf

2011-06-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun 24 04:35:58 2011
New Revision: 223490
URL: http://svn.freebsd.org/changeset/base/223490

Log:
  - Make sure we don't match the wrong device by adding
  a match for the bus the device belongs to.
  
  PR:   misc/157903
  MFC after:14 days

Modified:
  head/tools/tools/bus_autoconf/bus_autoconf.c

Modified: head/tools/tools/bus_autoconf/bus_autoconf.c
==
--- head/tools/tools/bus_autoconf/bus_autoconf.cFri Jun 24 04:16:06 
2011(r223489)
+++ head/tools/tools/bus_autoconf/bus_autoconf.cFri Jun 24 04:35:58 
2011(r223490)
@@ -150,6 +150,7 @@ usb_dump(struct usb_device_id *id, uint3
 
if (info.is_any) {
printf(nomatch 10 {\n
+  match \bus\ \uhub[0-9]+\;\n
   match \mode\ \%s\;\n, mode);
} else {
return (n);
___
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: r223491 - in head: libexec/tftpd usr.bin/tftp

2011-06-23 Thread Craig Rodrigues
Author: rodrigc
Date: Fri Jun 24 05:41:38 2011
New Revision: 223491
URL: http://svn.freebsd.org/changeset/base/223491

Log:
  Acknowledge Edwin Groothuis for the major rewrite he
  did of the tftpd and tftp code to support TFTP blocksize.

Modified:
  head/libexec/tftpd/tftpd.8
  head/usr.bin/tftp/tftp.1

Modified: head/libexec/tftpd/tftpd.8
==
--- head/libexec/tftpd/tftpd.8  Fri Jun 24 04:35:58 2011(r223490)
+++ head/libexec/tftpd/tftpd.8  Fri Jun 24 05:41:38 2011(r223491)
@@ -293,6 +293,12 @@ was introduced in
 support for the TFTP Blocksize Option (RFC2348) and the blksize2 option
 was introduced in
 .Fx 7.4 .
+.Pp
+Edwin Groothuis ed...@freebsd.org performed a major rewrite of the
+.Nm
+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),

Modified: head/usr.bin/tftp/tftp.1
==
--- head/usr.bin/tftp/tftp.1Fri Jun 24 04:35:58 2011(r223490)
+++ head/usr.bin/tftp/tftp.1Fri Jun 24 05:41:38 2011(r223491)
@@ -218,7 +218,7 @@ Toggle packet tracing.
 Toggle verbose mode.
 .El
 .Sh SEE ALSO
-.Xr tftp 1
+.Xr tftpd 8
 .Pp
 The following RFC's are supported:
 .Rs
@@ -256,6 +256,12 @@ The
 .Nm
 command appeared in
 .Bx 4.3 .
+.Pp
+Edwin Groothuis ed...@freebsd.org performed a major rewrite of the
+.Xr tftpd 8
+and
+.Nm
+code to support RFC2348.
 .Sh NOTES
 Because there is no user-login or validation within
 the
___
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