svn commit: r216045 - in head/sys/dev/usb: . serial

2010-11-29 Thread Gavin Atkinson
Author: gavin
Date: Mon Nov 29 08:17:44 2010
New Revision: 216045
URL: http://svn.freebsd.org/changeset/base/216045

Log:
  Support the Falcom Twist USB GSM/GPRS modem in uftdi(4)
  
  PR:   usb/151862
  Submitted by: Alessandro de Manzano 
  MFC after:1 week

Modified:
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/uftdi.c
==
--- head/sys/dev/usb/serial/uftdi.c Mon Nov 29 08:16:48 2010
(r216044)
+++ head/sys/dev/usb/serial/uftdi.c Mon Nov 29 08:17:44 2010
(r216045)
@@ -213,6 +213,7 @@ static struct usb_device_id uftdi_devs[]
UFTDI_DEV(ATMEL, STK541, 8U232AM),
UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, 8U232AM),
UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 8U232AM),
+   UFTDI_DEV(FALCOM, TWIST, 8U232AM),
UFTDI_DEV(FTDI, GAMMASCOUT, 8U232AM),
UFTDI_DEV(FTDI, SERIAL_8U100AX, SIO),
UFTDI_DEV(FTDI, SERIAL_2232C, 8U232AM),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsMon Nov 29 08:16:48 2010(r216044)
+++ head/sys/dev/usb/usbdevsMon Nov 29 08:17:44 2010(r216045)
@@ -1554,6 +1554,9 @@ product ETEK 1COM 0x8007  Serial
 /* Extended Systems products */
 product EXTENDED XTNDACCESS0x0100  XTNDAccess IrDA
 
+/* Falcom products */
+product FALCOM TWIST   0x0001  USB GSM/GPRS Modem
+
 /* FEIYA products */
 product FEIYA 5IN1 0x1132  5-in-1 Card Reader
 
___
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: r216047 - head/usr.sbin/kbdmap

2010-11-29 Thread Kevin Lo
Author: kevlo
Date: Mon Nov 29 09:21:26 2010
New Revision: 216047
URL: http://svn.freebsd.org/changeset/base/216047

Log:
  Fix fd leak in get_font

Modified:
  head/usr.sbin/kbdmap/kbdmap.c

Modified: head/usr.sbin/kbdmap/kbdmap.c
==
--- head/usr.sbin/kbdmap/kbdmap.c   Mon Nov 29 08:44:32 2010
(r216046)
+++ head/usr.sbin/kbdmap/kbdmap.c   Mon Nov 29 09:21:26 2010
(r216047)
@@ -229,6 +229,7 @@ get_font(void)
} else
fprintf(stderr, "Could not open %s for reading\n", sysconfig);
 
+   fclose(fp);
return fnt;
 }
 
___
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: r216049 - head/sys/compat/ndis

2010-11-29 Thread Bernhard Schmidt
Author: bschmidt
Date: Mon Nov 29 10:10:56 2010
New Revision: 216049
URL: http://svn.freebsd.org/changeset/base/216049

Log:
  Some drivers rely on the existence of certain keys. The Atheros 9xxx
  driver for example requests the NetCfgInstanceId but doesn't check the
  returned status code and will happily access random memory instead.
  
  Submitted by: Paul B Mahol 
  MFC after:2 weeks

Modified:
  head/sys/compat/ndis/kern_ndis.c

Modified: head/sys/compat/ndis/kern_ndis.c
==
--- head/sys/compat/ndis/kern_ndis.cMon Nov 29 09:24:03 2010
(r216048)
+++ head/sys/compat/ndis/kern_ndis.cMon Nov 29 10:10:56 2010
(r216049)
@@ -331,6 +331,16 @@ ndis_create_sysctls(arg)
ndis_add_sysctl(sc, "NdisVersion",
"NDIS API Version", "0x00050001", CTLFLAG_RD);
 
+   /*
+* Some miniport drivers rely on the existence of the SlotNumber,
+* NetCfgInstanceId and DriverDesc keys.
+*/
+   ndis_add_sysctl(sc, "SlotNumber", "Slot Numer", "01", CTLFLAG_RD);
+   ndis_add_sysctl(sc, "NetCfgInstanceId", "NetCfgInstanceId",
+   "{12345678-1234-5678-CAFE0-123456789ABC}", CTLFLAG_RD);
+   ndis_add_sysctl(sc, "DriverDesc", "Driver Description",
+   "NDIS Network Adapter", CTLFLAG_RD);
+
/* Bus type (PCI, PCMCIA, etc...) */
sprintf(buf, "%d", (int)sc->ndis_iftype);
ndis_add_sysctl(sc, "BusType", "Bus Type", buf, CTLFLAG_RD);
___
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: r216050 - head/sys/compat/ndis

2010-11-29 Thread Bernhard Schmidt
Author: bschmidt
Date: Mon Nov 29 10:21:45 2010
New Revision: 216050
URL: http://svn.freebsd.org/changeset/base/216050

Log:
  Add a dummy for IoOpenDeviceRegistryKey().
  
  With that change the Atheros 9xxx driver is actually usable and does not
  panic anymore.
  
  Submitted by: Paul B Mahol 
  MFC after:2 weeks

Modified:
  head/sys/compat/ndis/subr_ntoskrnl.c

Modified: head/sys/compat/ndis/subr_ntoskrnl.c
==
--- head/sys/compat/ndis/subr_ntoskrnl.cMon Nov 29 10:10:56 2010
(r216049)
+++ head/sys/compat/ndis/subr_ntoskrnl.cMon Nov 29 10:21:45 2010
(r216050)
@@ -228,6 +228,8 @@ static void srand(unsigned int);
 static void KeQuerySystemTime(uint64_t *);
 static uint32_t KeTickCount(void);
 static uint8_t IoIsWdmVersionAvailable(uint8_t, uint8_t);
+static int32_t IoOpenDeviceRegistryKey(struct device_object *, uint32_t,
+uint32_t, void **);
 static void ntoskrnl_thrfunc(void *);
 static ndis_status PsCreateSystemThread(ndis_handle *,
uint32_t, void *, ndis_handle, void *, void *, void *);
@@ -3199,6 +3201,13 @@ IoIsWdmVersionAvailable(uint8_t major, u
return (FALSE);
 }
 
+static int32_t
+IoOpenDeviceRegistryKey(struct device_object *devobj, uint32_t type,
+uint32_t mask, void **key)
+{
+   return (NDIS_STATUS_INVALID_DEVICE_REQUEST);
+}
+
 static ndis_status
 IoGetDeviceObjectPointer(name, reqaccess, fileobj, devobj)
unicode_string  *name;
@@ -4378,6 +4387,7 @@ image_patch_table ntoskrnl_functbl[] = {
IMPORT_SFUNC(MmUnmapIoSpace, 2),
IMPORT_SFUNC(KeInitializeSpinLock, 1),
IMPORT_SFUNC(IoIsWdmVersionAvailable, 2),
+   IMPORT_SFUNC(IoOpenDeviceRegistryKey, 4),
IMPORT_SFUNC(IoGetDeviceObjectPointer, 4),
IMPORT_SFUNC(IoGetDeviceProperty, 5),
IMPORT_SFUNC(IoAllocateWorkItem, 1),
___
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: r216052 - head/usr.sbin/sysinstall

2010-11-29 Thread Bruce Cran
Author: brucec
Date: Mon Nov 29 11:28:31 2010
New Revision: 216052
URL: http://svn.freebsd.org/changeset/base/216052

Log:
  Update the serial port device names. They changed in 8.0 because the default
  driver is now uart(4).
  
  PR:   bin/140887
  Submitted by: Joe Barbish 
  MFC after:3 days

Modified:
  head/usr.sbin/sysinstall/devices.c
  head/usr.sbin/sysinstall/menus.c

Modified: head/usr.sbin/sysinstall/devices.c
==
--- head/usr.sbin/sysinstall/devices.c  Mon Nov 29 10:22:45 2010
(r216051)
+++ head/usr.sbin/sysinstall/devices.c  Mon Nov 29 11:28:31 2010
(r216052)
@@ -91,7 +91,7 @@ static struct _devname {
 DISK("ipsd%d", "IBM ServeRAID RAID array", 4),
 DISK("mfid%d", "LSI MegaRAID SAS array",   4),
 FLOPPY("fd%d", "floppy drive unit A",  4),
-SERIAL("cuad%d",   "%s on device %s (COM%d)",  16),
+SERIAL("cuau%d",   "%s on device %s (COM%d)",  16),
 USB("da%da",   "USB Mass Storage Device",  16),
 NETWORK("ae",  "Attansic/Atheros L2 Fast Ethernet"),
 NETWORK("age", "Attansic/Atheros L1 Gigabit Ethernet"),

Modified: head/usr.sbin/sysinstall/menus.c
==
--- head/usr.sbin/sysinstall/menus.cMon Nov 29 10:22:45 2010
(r216051)
+++ head/usr.sbin/sysinstall/menus.cMon Nov 29 11:28:31 2010
(r216052)
@@ -426,10 +426,10 @@ DMenu MenuMousePort = {
 {
   { "1 BusMouse",  "PC-98x1 bus mouse (/dev/mse0)", 
dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/mse0" },
-  { "2 COM1",  "Serial mouse on COM1 (/dev/cuad0)",
-   dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuad0" },
-  { "3 COM2",  "Serial mouse on COM2 (/dev/cuad1)",
-   dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuad1" },
+  { "2 COM1",  "Serial mouse on COM1 (/dev/cuau0)",
+   dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuau0" },
+  { "3 COM2",  "Serial mouse on COM2 (/dev/cuau1)",
+   dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuau1" },
   { NULL } },
 };
 #else
@@ -442,14 +442,14 @@ DMenu MenuMousePort = {
 NULL,
 { { "1 PS/2",  "PS/2 style mouse (/dev/psm0)", 
dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/psm0" },
-  { "2 COM1",  "Serial mouse on COM1 (/dev/cuad0)",
-   dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuad0" },
-  { "3 COM2",  "Serial mouse on COM2 (/dev/cuad1)",
-   dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuad1" },
-  { "4 COM3",  "Serial mouse on COM3 (/dev/cuad2)",
-   dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuad2" },
-  { "5 COM4",  "Serial mouse on COM4 (/dev/cuad3)", 
-   dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuad3" },
+  { "2 COM1",  "Serial mouse on COM1 (/dev/cuau0)",
+   dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuau0" },
+  { "3 COM2",  "Serial mouse on COM2 (/dev/cuau1)",
+   dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuau1" },
+  { "4 COM3",  "Serial mouse on COM3 (/dev/cuau2)",
+   dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuau2" },
+  { "5 COM4",  "Serial mouse on COM4 (/dev/cuau3)", 
+   dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuau3" },
   { "6 BusMouse",  "Logitech, ATI or MS bus mouse (/dev/mse0)", 
dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/mse0" },
   { NULL } },
___
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: r216053 - head/usr.sbin/sysinstall

2010-11-29 Thread Bruce Cran
Author: brucec
Date: Mon Nov 29 11:55:17 2010
New Revision: 216053
URL: http://svn.freebsd.org/changeset/base/216053

Log:
  If no floppy drive is installed kldBrowser() can generate an error early on.
  Initialize menu and count so the cleanup code doesn't try and use their
  uninitialized values.
  
  PR:   bin/152270
  Submitted by: Remi LAURENT 
  MFC after:3 days

Modified:
  head/usr.sbin/sysinstall/modules.c

Modified: head/usr.sbin/sysinstall/modules.c
==
--- head/usr.sbin/sysinstall/modules.c  Mon Nov 29 11:28:31 2010
(r216052)
+++ head/usr.sbin/sysinstall/modules.c  Mon Nov 29 11:55:17 2010
(r216053)
@@ -123,13 +123,14 @@ driverFloppyCheck(void)
 int
 kldBrowser(dialogMenuItem *self)
 {
-DMenu  *menu;
+DMenu  *menu = NULL;
 inti, what = DITEM_SUCCESS, msize, count;
 DIR*dir;
 struct dirent *de;
 char   *err;
 
 err = NULL;
+count = 0;
 
 if (DITEM_STATUS(mediaSetFloppy(NULL)) == DITEM_FAILURE) {
err = "Unable to set media device to floppy.";
@@ -142,7 +143,6 @@ kldBrowser(dialogMenuItem *self)
 }
 
 msize = sizeof(DMenu) + (sizeof(dialogMenuItem) * 2);
-count = 0;
 if ((menu = malloc(msize)) == NULL) {
err = "Failed to allocate memory for menu";
goto errout;
___
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: r216057 - in head: share/man/man4 sys/dev/usb sys/dev/usb/wlan

2010-11-29 Thread MIHIRA Sanpei Yoshiro
Author: sanpei
Date: Mon Nov 29 15:08:18 2010
New Revision: 216057
URL: http://svn.freebsd.org/changeset/base/216057

Log:
  Add new device ids.
Buffalo (Melco Inc.) WLI-UC-G
  
  PR:   141777

Modified:
  head/share/man/man4/rum.4
  head/sys/dev/usb/usbdevs
  head/sys/dev/usb/wlan/if_rum.c

Modified: head/share/man/man4/rum.4
==
--- head/share/man/man4/rum.4   Mon Nov 29 14:47:59 2010(r216056)
+++ head/share/man/man4/rum.4   Mon Nov 29 15:08:18 2010(r216057)
@@ -93,6 +93,7 @@ including:
 .It "Buffalo WLI-U2-SG54HP" Ta USB
 .It "Buffalo WLI-U2-SG54HG" Ta USB
 .It "Buffalo WLI-U2-G54HP" Ta USB
+.It "Buffalo WLI-UC-G" Ta USB
 .It "CNet CWD-854 ver F" Ta USB
 .It "Conceptronic C54RU ver 2" Ta USB
 .It "Corega CG-WLUSB2GO" Ta USB

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsMon Nov 29 14:47:59 2010(r216056)
+++ head/sys/dev/usb/usbdevsMon Nov 29 15:08:18 2010(r216057)
@@ -2140,6 +2140,7 @@ product MELCO SG54HG  0x00f4  WLI-U2-SG54
 product MELCO WLRUCG   0x0116  WLR-UC-G
 product MELCO WLRUCGAOSS   0x0119  WLR-UC-G-AOSS
 product MELCO WLIUCAG300N  0x012e  WLI-UC-AG300N
+product MELCO WLIUCG   0x0137  WLI-UC-G
 product MELCO RT2870_1 0x0148  RT2870
 product MELCO RT2870_2 0x0150  RT2870
 product MELCO WLIUCGN  0x015d  WLI-UC-GN

Modified: head/sys/dev/usb/wlan/if_rum.c
==
--- head/sys/dev/usb/wlan/if_rum.c  Mon Nov 29 14:47:59 2010
(r216056)
+++ head/sys/dev/usb/wlan/if_rum.c  Mon Nov 29 15:08:18 2010
(r216057)
@@ -118,6 +118,7 @@ static const struct usb_device_id rum_de
 RUM_DEV(HUAWEI3COM, WUB320G),
 RUM_DEV(MELCO, G54HP),
 RUM_DEV(MELCO, SG54HP),
+RUM_DEV(MELCO, WLIUCG),
 RUM_DEV(MELCO, WLRUCG),
 RUM_DEV(MELCO, WLRUCGAOSS),
 RUM_DEV(MSI, RT2573_1),
___
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: r216058 - head/sys/kern

2010-11-29 Thread Matthew D Fleming
Author: mdf
Date: Mon Nov 29 18:17:53 2010
New Revision: 216058
URL: http://svn.freebsd.org/changeset/base/216058

Log:
  Use the SYSCTL_CHILDREN macro in kern_sysctl.c to help de-obfuscate the
  code.
  
  MFC after:3 days

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Mon Nov 29 15:08:18 2010(r216057)
+++ head/sys/kern/kern_sysctl.c Mon Nov 29 18:17:53 2010(r216058)
@@ -676,7 +676,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS)
if (oid->oid_handler)
break;
 
-   lsp2 = (struct sysctl_oid_list *)oid->oid_arg1;
+   lsp2 = SYSCTL_CHILDREN(oid);
break;
}
lsp = lsp2;
@@ -707,7 +707,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_
if (oidp->oid_handler) 
/* We really should call the handler here...*/
return (0);
-   lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
+   lsp = SYSCTL_CHILDREN(oidp);
if (!sysctl_sysctl_next_ls(lsp, 0, 0, next+1, 
len, level+1, oidpp))
return (0);
@@ -722,7 +722,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_
return (0);
if (oidp->oid_handler)
return (0);
-   lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
+   lsp = SYSCTL_CHILDREN(oidp);
if (!sysctl_sysctl_next_ls(lsp, name+1, namelen-1, 
next+1, len, level+1, oidpp))
return (0);
@@ -734,7 +734,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_
if (oidp->oid_handler)
continue;
 
-   lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
+   lsp = SYSCTL_CHILDREN(oidp);
if (!sysctl_sysctl_next_ls(lsp, name+1, namelen-1, next+1, 
len, level+1, oidpp))
return (0);
@@ -812,7 +812,7 @@ name2oid(char *name, int *oid, int *len,
if (oidp->oid_handler)
break;
 
-   lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
+   lsp = SYSCTL_CHILDREN(oidp);
oidp = SLIST_FIRST(lsp);
name = p+1;
for (p = name; *p && *p != '.'; p++) 
@@ -1322,8 +1322,7 @@ sysctl_find_oid(int *name, u_int namelen
*nindx = indx;
return (0);
}
-   oid = SLIST_FIRST(
-   (struct sysctl_oid_list *)oid->oid_arg1);
+   oid = SLIST_FIRST(SYSCTL_CHILDREN(oid));
} else if (indx == namelen) {
*noid = oid;
if (nindx != NULL)
___
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: r216059 - head/sys/kern

2010-11-29 Thread Matthew D Fleming
Author: mdf
Date: Mon Nov 29 18:18:00 2010
New Revision: 216059
URL: http://svn.freebsd.org/changeset/base/216059

Log:
  Slightly modify the logic in sysctl_find_oid to reduce the indentation.
  There should be no functional change.
  
  MFC after:3 days

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Mon Nov 29 18:17:53 2010(r216058)
+++ head/sys/kern/kern_sysctl.c Mon Nov 29 18:18:00 2010(r216059)
@@ -1303,36 +1303,39 @@ int
 sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid,
 int *nindx, struct sysctl_req *req)
 {
+   struct sysctl_oid_list *lsp;
struct sysctl_oid *oid;
int indx;
 
SYSCTL_ASSERT_LOCKED();
-   oid = SLIST_FIRST(&sysctl__children);
+   lsp = &sysctl__children;
indx = 0;
-   while (oid && indx < CTL_MAXNAME) {
-   if (oid->oid_number == name[indx]) {
-   indx++;
-   if (oid->oid_kind & CTLFLAG_NOLOCK)
-   req->lock = REQ_UNLOCKED;
-   if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
-   if (oid->oid_handler != NULL ||
-   indx == namelen) {
-   *noid = oid;
-   if (nindx != NULL)
-   *nindx = indx;
-   return (0);
-   }
-   oid = SLIST_FIRST(SYSCTL_CHILDREN(oid));
-   } else if (indx == namelen) {
+   while (indx < CTL_MAXNAME) {
+   SLIST_FOREACH(oid, lsp, oid_link) {
+   if (oid->oid_number == name[indx])
+   break;
+   }
+   if (oid == NULL)
+   return (ENOENT);
+
+   indx++;
+   if (oid->oid_kind & CTLFLAG_NOLOCK)
+   req->lock = REQ_UNLOCKED;
+   if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
+   if (oid->oid_handler != NULL || indx == namelen) {
*noid = oid;
if (nindx != NULL)
*nindx = indx;
return (0);
-   } else {
-   return (ENOTDIR);
}
+   lsp = SYSCTL_CHILDREN(oid);
+   } else if (indx == namelen) {
+   *noid = oid;
+   if (nindx != NULL)
+   *nindx = indx;
+   return (0);
} else {
-   oid = SLIST_NEXT(oid, oid_link);
+   return (ENOTDIR);
}
}
return (ENOENT);
___
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: r216060 - in head/sys: kern sys

2010-11-29 Thread Matthew D Fleming
Author: mdf
Date: Mon Nov 29 18:18:07 2010
New Revision: 216060
URL: http://svn.freebsd.org/changeset/base/216060

Log:
  Do not hold the sysctl lock across a call to the handler.  This fixes a
  general LOR issue where the sysctl lock had no good place in the
  hierarchy.  One specific instance is #284 on
  http://sources.zabbadoz.net/freebsd/lor.html .
  
  Reviewed by:  jhb
  MFC after:1 month
  X-MFC-note:   split oid_refcnt field for oid_running to preserve KBI

Modified:
  head/sys/kern/kern_sysctl.c
  head/sys/sys/sysctl.h

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Mon Nov 29 18:18:00 2010(r216059)
+++ head/sys/kern/kern_sysctl.c Mon Nov 29 18:18:07 2010(r216060)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_ktrace.h"
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -86,13 +87,12 @@ static MALLOC_DEFINE(M_SYSCTLTMP, "sysct
 static struct sx sysctllock;
 static struct sx sysctlmemlock;
 
-#defineSYSCTL_SLOCK()  sx_slock(&sysctllock)
-#defineSYSCTL_SUNLOCK()sx_sunlock(&sysctllock)
 #defineSYSCTL_XLOCK()  sx_xlock(&sysctllock)
 #defineSYSCTL_XUNLOCK()sx_xunlock(&sysctllock)
 #defineSYSCTL_ASSERT_XLOCKED() sx_assert(&sysctllock, SA_XLOCKED)
-#defineSYSCTL_ASSERT_LOCKED()  sx_assert(&sysctllock, SA_LOCKED)
 #defineSYSCTL_INIT()   sx_init(&sysctllock, "sysctl lock")
+#defineSYSCTL_SLEEP(ch, wmesg, timo)   
\
+   sx_sleep(ch, &sysctllock, 0, wmesg, timo)
 
 static int sysctl_root(SYSCTL_HANDLER_ARGS);
 
@@ -106,7 +106,7 @@ sysctl_find_oidname(const char *name, st
 {
struct sysctl_oid *oidp;
 
-   SYSCTL_ASSERT_LOCKED();
+   SYSCTL_ASSERT_XLOCKED();
SLIST_FOREACH(oidp, list, oid_link) {
if (strcmp(oidp->oid_name, name) == 0) {
return (oidp);
@@ -313,7 +313,7 @@ sysctl_ctx_entry_find(struct sysctl_ctx_
 {
struct sysctl_ctx_entry *e;
 
-   SYSCTL_ASSERT_LOCKED();
+   SYSCTL_ASSERT_XLOCKED();
if (clist == NULL || oidp == NULL)
return(NULL);
TAILQ_FOREACH(e, clist, link) {
@@ -409,6 +409,16 @@ sysctl_remove_oid_locked(struct sysctl_o
}
sysctl_unregister_oid(oidp);
if (del) {
+   /*
+* Wait for all threads running the handler to drain.
+* This preserves the previous behavior when the
+* sysctl lock was held across a handler invocation,
+* and is necessary for module unload correctness.
+*/
+   while (oidp->oid_running > 0) {
+   oidp->oid_kind |= CTLFLAG_DYING;
+   SYSCTL_SLEEP(&oidp->oid_running, "oidrm", 0);
+   }
if (oidp->oid_descr)
free((void *)(uintptr_t)(const void 
*)oidp->oid_descr, M_SYSCTLOID);
free((void *)(uintptr_t)(const void *)oidp->oid_name,
@@ -581,7 +591,7 @@ sysctl_sysctl_debug_dump_node(struct sys
int k;
struct sysctl_oid *oidp;
 
-   SYSCTL_ASSERT_LOCKED();
+   SYSCTL_ASSERT_XLOCKED();
SLIST_FOREACH(oidp, l, oid_link) {
 
for (k=0; ktd, PRIV_SYSCTL_DEBUG);
if (error)
return (error);
+   SYSCTL_XLOCK();
sysctl_sysctl_debug_dump_node(&sysctl__children, 0);
+   SYSCTL_XUNLOCK();
return (ENOENT);
 }
 
@@ -640,7 +652,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS)
struct sysctl_oid_list *lsp = &sysctl__children, *lsp2;
char buf[10];
 
-   SYSCTL_ASSERT_LOCKED();
+   SYSCTL_XLOCK();
while (namelen) {
if (!lsp) {
snprintf(buf,sizeof(buf),"%d",*name);
@@ -649,7 +661,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS)
if (!error)
error = SYSCTL_OUT(req, buf, strlen(buf));
if (error)
-   return (error);
+   goto out;
namelen--;
name++;
continue;
@@ -665,7 +677,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS)
error = SYSCTL_OUT(req, oid->oid_name,
strlen(oid->oid_name));
if (error)
-   return (error);
+   goto out;
 
namelen--;
name++;
@@ -681,7 +693,10 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS)
}
lsp = lsp2;
}
-   return (SYSCTL_OUT(

Re: svn commit: r216016 - head/sys/sparc64/include

2010-11-29 Thread Max Khon
Marius,

On Mon, Nov 29, 2010 at 1:45 AM, Marius Strobl wrote:

On Sun, Nov 28, 2010 at 07:26:20PM +, Max Khon wrote:
> > Author: fjoe
> > Date: Sun Nov 28 19:26:20 2010
> > New Revision: 216016
> > URL: http://svn.freebsd.org/changeset/base/216016
> >
> > Log:
> >   Define VM_KMEM_SIZE_MAX on sparc64. Otherwise kernel built with
> >   DEBUG_MEMGUARD panics early in kmeminit() with the message
> >   "kmem_suballoc: bad status return of 1" because of zero "size" argument
> >   passed to kmem_suballoc() due to "vm_kmem_size_max" being zero.
> >
> >   The problem also exists on ia64.
> >
> > Modified:
> >   head/sys/sparc64/include/vmparam.h
> >
> > Modified: head/sys/sparc64/include/vmparam.h
> >
> ==
> > --- head/sys/sparc64/include/vmparam.hSun Nov 28 18:59:52 2010
>  (r216015)
> > +++ head/sys/sparc64/include/vmparam.hSun Nov 28 19:26:20 2010
>  (r216016)
> > @@ -237,6 +237,14 @@
> >  #endif
> >
> >  /*
> > + * Ceiling on amount of kmem_map kva space.
> > + */
> > +#ifndef VM_KMEM_SIZE_MAX
> > +#define  VM_KMEM_SIZE_MAX((VM_MAX_KERNEL_ADDRESS - \
> > +VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5)
> > +#endif
> > +
> > +/*
> >   * Initial pagein size of beginning of executable file.
> >   */
> >  #ifndef  VM_INITIAL_PAGEIN
>
> How was that value determined?
>

I've just copied it from amd64 to be non-zero for now. Do you have a better
idea of what it should look like?

Max
___
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: r216016 - head/sys/sparc64/include

2010-11-29 Thread Marius Strobl
On Tue, Nov 30, 2010 at 12:31:31AM +0600, Max Khon wrote:
> Marius,
> 
> On Mon, Nov 29, 2010 at 1:45 AM, Marius Strobl 
> wrote:
> 
> On Sun, Nov 28, 2010 at 07:26:20PM +, Max Khon wrote:
> > > Author: fjoe
> > > Date: Sun Nov 28 19:26:20 2010
> > > New Revision: 216016
> > > URL: http://svn.freebsd.org/changeset/base/216016
> > >
> > > Log:
> > >   Define VM_KMEM_SIZE_MAX on sparc64. Otherwise kernel built with
> > >   DEBUG_MEMGUARD panics early in kmeminit() with the message
> > >   "kmem_suballoc: bad status return of 1" because of zero "size" argument
> > >   passed to kmem_suballoc() due to "vm_kmem_size_max" being zero.
> > >
> > >   The problem also exists on ia64.
> > >
> > > Modified:
> > >   head/sys/sparc64/include/vmparam.h
> > >
> > > Modified: head/sys/sparc64/include/vmparam.h
> > >
> > ==
> > > --- head/sys/sparc64/include/vmparam.hSun Nov 28 18:59:52 2010
> >  (r216015)
> > > +++ head/sys/sparc64/include/vmparam.hSun Nov 28 19:26:20 2010
> >  (r216016)
> > > @@ -237,6 +237,14 @@
> > >  #endif
> > >
> > >  /*
> > > + * Ceiling on amount of kmem_map kva space.
> > > + */
> > > +#ifndef VM_KMEM_SIZE_MAX
> > > +#define  VM_KMEM_SIZE_MAX((VM_MAX_KERNEL_ADDRESS - \
> > > +VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5)
> > > +#endif
> > > +
> > > +/*
> > >   * Initial pagein size of beginning of executable file.
> > >   */
> > >  #ifndef  VM_INITIAL_PAGEIN
> >
> > How was that value determined?
> >
> 
> I've just copied it from amd64 to be non-zero for now. Do you have a better
> idea of what it should look like?
> 

Well, on sparc64 VM_MAX_KERNEL_ADDRESS already is dynamically adjusted
to the maximum appropriate for the specific CPU during the early cycles
of the kernel so I'd think one could just use VM_MAX_KERNEL_ADDRESS -
VM_MIN_KERNEL_ADDRESS for VM_KMEM_SIZE_MAX there, I'm not sure what
the intention of the ceiling provided by that macro actually is though
In any case, the commit message of r180210 which changed the amd64
version to the current one talks about limiting the kmem map to 3.6GB
and while it also fails to explain where that value comes from it
looks rather amd64 specific and the formula used by the macro will
result in a different ceiling on sparc64 and thus inappropriate. I've
CC'ed alc@ who hopefully can shed some light on this.
Apart from this the actual bug here seems to be that memguard_fudge()
can't deal with a km_max being zero or that zero is passed to it as
kmeminit() allows for VM_KMEM_SIZE_MAX not being defined.

Marius

___
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: r216016 - head/sys/sparc64/include

2010-11-29 Thread Marius Strobl
On Mon, Nov 29, 2010 at 08:23:08PM +0100, Marius Strobl wrote:
> On Tue, Nov 30, 2010 at 12:31:31AM +0600, Max Khon wrote:
> > Marius,
> > 
> > On Mon, Nov 29, 2010 at 1:45 AM, Marius Strobl 
> > wrote:
> > 
> > On Sun, Nov 28, 2010 at 07:26:20PM +, Max Khon wrote:
> > > > Author: fjoe
> > > > Date: Sun Nov 28 19:26:20 2010
> > > > New Revision: 216016
> > > > URL: http://svn.freebsd.org/changeset/base/216016
> > > >
> > > > Log:
> > > >   Define VM_KMEM_SIZE_MAX on sparc64. Otherwise kernel built with
> > > >   DEBUG_MEMGUARD panics early in kmeminit() with the message
> > > >   "kmem_suballoc: bad status return of 1" because of zero "size" 
> > > > argument
> > > >   passed to kmem_suballoc() due to "vm_kmem_size_max" being zero.
> > > >
> > > >   The problem also exists on ia64.
> > > >
> > > > Modified:
> > > >   head/sys/sparc64/include/vmparam.h
> > > >
> > > > Modified: head/sys/sparc64/include/vmparam.h
> > > >
> > > ==
> > > > --- head/sys/sparc64/include/vmparam.hSun Nov 28 18:59:52 2010
> > >  (r216015)
> > > > +++ head/sys/sparc64/include/vmparam.hSun Nov 28 19:26:20 2010
> > >  (r216016)
> > > > @@ -237,6 +237,14 @@
> > > >  #endif
> > > >
> > > >  /*
> > > > + * Ceiling on amount of kmem_map kva space.
> > > > + */
> > > > +#ifndef VM_KMEM_SIZE_MAX
> > > > +#define  VM_KMEM_SIZE_MAX((VM_MAX_KERNEL_ADDRESS - \
> > > > +VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5)
> > > > +#endif
> > > > +
> > > > +/*
> > > >   * Initial pagein size of beginning of executable file.
> > > >   */
> > > >  #ifndef  VM_INITIAL_PAGEIN
> > >
> > > How was that value determined?
> > >
> > 
> > I've just copied it from amd64 to be non-zero for now. Do you have a better
> > idea of what it should look like?
> > 
> 
> Well, on sparc64 VM_MAX_KERNEL_ADDRESS already is dynamically adjusted
> to the maximum appropriate for the specific CPU during the early cycles
> of the kernel so I'd think one could just use VM_MAX_KERNEL_ADDRESS -
> VM_MIN_KERNEL_ADDRESS for VM_KMEM_SIZE_MAX there, I'm not sure what
> the intention of the ceiling provided by that macro actually is though
> In any case, the commit message of r180210 which changed the amd64
> version to the current one talks about limiting the kmem map to 3.6GB
> and while it also fails to explain where that value comes from it
> looks rather amd64 specific and the formula used by the macro will
> result in a different ceiling on sparc64 and thus inappropriate. I've
> CC'ed alc@ who hopefully can shed some light on this.
> Apart from this the actual bug here seems to be that memguard_fudge()
> can't deal with a km_max being zero or that zero is passed to it as
> kmeminit() allows for VM_KMEM_SIZE_MAX not being defined.
> 

Oops, forgot to actually CC a...@.

Marius

___
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: r211463 - head/usr.bin/grep

2010-11-29 Thread David Schultz
On Wed, Aug 18, 2010, Dimitry Andric wrote:
> On 2010-08-18 22:48, m...@freebsd.org wrote:
> >>  - Refactor file reading code to use pure syscalls and an internal buffer
> >>instead of stdio.  This gives BSD grep a very big performance boost,
> >>its speed is now almost comparable to GNU grep.
> > 
> > I didn't read all of the details in the profiling mails in the thread,
> > but does this mean that work on stdio would give a performance boost
> > to many apps?  Or is there something specific about how grep(1) is
> > using its input that makes it a horse of a different color?
> 
> Originally, it was reading files 1 character at a time, using fgetc(3),
> the locking version even.  This is usually not the fastest way to read
> a large file with stdio. :)
> 
> If grep did not have to support .gz or .bz2 files, we could just have
> plugged in stdio's fgetln(3).  I tried this approach first on some
> non-compressed files, and it performed much better than fgetc'ing.
> 
> The reading code that was now committed, is basically the same algorithm
> as fgetln() uses internally, but it can handle gzip and bzip2 input too.

The gzip limitations you refer to could perhaps be worked around
with a simple application of funopen(3).  IIRC, the overhead
inherent in using fgetln(3) or getline(3) on reasonably long lines
is very small; if it's not, we should look at ways to improve stdio.

There's still a locking operation and memcpy() that can't really
be avoided with stdio, though. With getline(), you'd be able to
delete most of file.c, but it would never be quite as fast.
___
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: r213852 - in head: lib/libusb sys/dev/usb

2010-11-29 Thread Andrew Thompson
On 17 October 2010 02:27, Kostik Belousov  wrote:
> On Sat, Oct 16, 2010 at 01:30:31PM +0200, Hans Petter Selasky wrote:
>> On Saturday 16 October 2010 12:12:43 Hans Petter Selasky wrote:
>> > On Saturday 16 October 2010 12:00:51 Kostik Belousov wrote:
>> > > > USB has some shared memory structures which are used in both user-land
>> > > > and  kernel, which are not part of IOCTLs. Your approach means that
>> > > > there are two sets of IOCTL's of all kinds, one for 32-bit and one for
>> > > > 64-bit?
>> > >
>> > > For all kinds of structures that are not ABI-invariant, yes.
>> >
>>
>> Hi,
>>
>> I've committed a patch to fix the buildworld breakage after feedback from
>> Andreas Tobler.
>>
>> http://svn.freebsd.org/changeset/base/213920
>>
>> > The approach that was discussed by me and Andrew earlier this year, was to
>> > use uint64_t instead of "void *" in shared memory structures. The only
>> > disadvantage is that this will force you to recompile libusb when you
>> > update the kernel, and so we kind of put that approach aside to keep
>> > seamless upgrade compatibility.
>>
>> This will also break the ABI on 8-stable and that was the main reason for
>> going the other route. However, most applications access USB via libusb, so
>> the breakage would probably be minimal. Do you have any opinions here? Should
>> we make an exception for the general rule to not change the ABI within a
>> stable branch?
>>
>> I'm attaching the other approach, which allows both 32 and 64 bit 
>> applications
>> to use USB using the same IOCTL's.
>>
>> See thread: [FreeBSD 8/9] [64-bit IOCTL] Using the USB stack from a 32-bit
>> application under a 64-bit kernel.
>>
> This is a choice of the poison :).
>
> Ideally, you would switch to the new ABI and keep old ABI shims around
> for binary compatibility. In essence, this is equivalent to the proper
> 32bit compat shims.

Is this change something that could be merged to 8.2? libusb consumers
should not be affected but I do not know if any other applications
would be affected.


Andrew
___
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: r216064 - head/sys/mips/cavium/octe

2010-11-29 Thread Juli Mallett
Author: jmallett
Date: Mon Nov 29 21:04:00 2010
New Revision: 216064
URL: http://svn.freebsd.org/changeset/base/216064

Log:
  Don't free the work queue entry that we're using to hold the scatter-gather
  list on exit from the transmit path.  The scatter-gather list itself can be
  asynchronously DMAed to the transmit hardware, and we could actually lock up
  the transmitter if any of a number of races around this were lost.
  
  Instead, let the PKO free the scatter-gather list when it is done with it, and
  use the "i" bit in each segment of the packet to avoid having them go into the
  FPA.
  
  This fixes an unrecoverable transmit stall under transmit load.
  
  MFC after:3 days

Modified:
  head/sys/mips/cavium/octe/ethernet-tx.c

Modified: head/sys/mips/cavium/octe/ethernet-tx.c
==
--- head/sys/mips/cavium/octe/ethernet-tx.c Mon Nov 29 20:43:06 2010
(r216063)
+++ head/sys/mips/cavium/octe/ethernet-tx.c Mon Nov 29 21:04:00 2010
(r216064)
@@ -143,6 +143,7 @@ int cvm_oct_xmit(struct mbuf *m, struct 
/* Build the PKO command */
pko_command.u64 = 0;
pko_command.s.segs = 1;
+   pko_command.s.dontfree = 1; /* Do not put this buffer into the 
FPA.  */
 
work = NULL;
} else {
@@ -164,6 +165,7 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 
/* Build the PKO buffer pointer */
hw_buffer.u64 = 0;
+   hw_buffer.s.i = 1; /* Do not put this buffer into the 
FPA.  */
hw_buffer.s.addr = cvmx_ptr_to_phys(n->m_data);
hw_buffer.s.pool = 0;
hw_buffer.s.size = n->m_len;
@@ -182,12 +184,11 @@ int cvm_oct_xmit(struct mbuf *m, struct 
pko_command.u64 = 0;
pko_command.s.segs = segs;
pko_command.s.gather = 1;
+   pko_command.s.dontfree = 0; /* Put the WQE above back into the 
FPA.  */
}
 
/* Finish building the PKO command */
pko_command.s.n2 = 1; /* Don't pollute L2 with the outgoing packet */
-   pko_command.s.dontfree = 1;
-   pko_command.s.reg0 = priv->fau+qos*4;
pko_command.s.reg0 = priv->fau+qos*4;
pko_command.s.total_bytes = m->m_pkthdr.len;
pko_command.s.size0 = CVMX_FAU_OP_SIZE_32;
@@ -200,6 +201,11 @@ int cvm_oct_xmit(struct mbuf *m, struct 
pko_command.s.ipoffp1 = ETHER_HDR_LEN + 1;
}
 
+   /*
+* XXX
+* Could use a different free queue (and different FAU address) per
+* core instead of per QoS, to reduce contention here.
+*/
IF_LOCK(&priv->tx_free_queue[qos]);
if (USE_ASYNC_IOBDMA) {
/* Get the number of mbufs in use by the hardware */
@@ -242,8 +248,6 @@ int cvm_oct_xmit(struct mbuf *m, struct 
/* Pass it to any BPF listeners.  */
ETHER_BPF_MTAP(ifp, m);
}
-   if (work != NULL)
-   cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1));
 
/* Free mbufs not in use by the hardware */
if (_IF_QLEN(&priv->tx_free_queue[qos]) > in_use) {
___
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: r216065 - head/share/man/man4

2010-11-29 Thread Doug Barton
Author: dougb
Date: Mon Nov 29 21:31:25 2010
New Revision: 216065
URL: http://svn.freebsd.org/changeset/base/216065

Log:
  Update the description of green_saver.ko
  
  Improvements to my suggested text from: jhb

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

Modified: head/share/man/man4/splash.4
==
--- head/share/man/man4/splash.4Mon Nov 29 21:04:00 2010
(r216064)
+++ head/share/man/man4/splash.4Mon Nov 29 21:31:25 2010
(r216065)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 7, 2010
+.Dd November 29, 2010
 .Dt SPLASH 4
 .Os
 .Sh NAME
@@ -114,7 +114,10 @@ The screen will gradually fade away.
 .It Pa fire_saver.ko
 A fire which becomes higher as load increases.
 .It Pa green_saver.ko
-If the monitor supports power saving mode, it will be turned off.
+The screen will be blanked, similar to
+.Pa blank_saver.ko .
+If the monitor and the video card's BIOS support it
+the screen will also be powered off.
 .It Pa logo_saver.ko
 Animated graphical
 .Fx
___
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: r216066 - head/sys/kern

2010-11-29 Thread Matthew D Fleming
Author: mdf
Date: Mon Nov 29 21:53:21 2010
New Revision: 216066
URL: http://svn.freebsd.org/changeset/base/216066

Log:
  Fix uninitialized variable warning that shows on Tinderbox but not my
  setup. (??)
  
  Submitted by: Michael Butler 

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Mon Nov 29 21:31:25 2010(r216065)
+++ head/sys/kern/kern_sysctl.c Mon Nov 29 21:53:21 2010(r216066)
@@ -845,7 +845,7 @@ static int
 sysctl_sysctl_name2oid(SYSCTL_HANDLER_ARGS)
 {
char *p;
-   int error, oid[CTL_MAXNAME], len;
+   int error, oid[CTL_MAXNAME], len = 0;
struct sysctl_oid *op = 0;
 
if (!req->newlen) 
___
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: r216067 - head/sys/dev/syscons

2010-11-29 Thread Jung-uk Kim
Author: jkim
Date: Mon Nov 29 22:19:19 2010
New Revision: 216067
URL: http://svn.freebsd.org/changeset/base/216067

Log:
  Honor font size for the video mode when default fonts are compiled in kernel
  and VESA mode is enabled from loader.

Modified:
  head/sys/dev/syscons/syscons.c

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Mon Nov 29 21:53:21 2010
(r216066)
+++ head/sys/dev/syscons/syscons.c  Mon Nov 29 22:19:19 2010
(r216067)
@@ -348,7 +348,9 @@ static void
 sc_set_vesa_mode(scr_stat *scp, sc_softc_t *sc, int unit)
 {
video_info_t info;
+   u_char *font;
int depth;
+   int font_size;
int i;
int vmode;
 
@@ -377,9 +379,37 @@ sc_set_vesa_mode(scr_stat *scp, sc_softc
vidd_get_info(sc->adp, vmode, &info);
}
 
+#if !defined(SC_NO_FONT_LOADING) && defined(SC_DFLT_FONT)
+   font_size = info.vi_cheight;
+#else
+   font_size = 16;
+#endif
+   if (font_size < 14)
+   font_size = 8;
+   else if (font_size >= 16)
+   font_size = 16;
+   else
+   font_size = 14;
 #ifndef SC_NO_FONT_LOADING
-   if ((sc->fonts_loaded & FONT_16) == 0)
-   return;
+   switch (font_size) {
+   case 8:
+   if ((sc->fonts_loaded & FONT_8) == 0)
+   return;
+   font = sc->font_8;
+   break;
+   case 14:
+   if ((sc->fonts_loaded & FONT_14) == 0)
+   return;
+   font = sc->font_14;
+   break;
+   case 16:
+   if ((sc->fonts_loaded & FONT_16) == 0)
+   return;
+   font = sc->font_16;
+   break;
+   }
+#else
+   font = NULL;
 #endif
 #ifdef DEV_SPLASH
if ((sc->flags & SC_SPLASH_SCRN) != 0)
@@ -398,16 +428,12 @@ sc_set_vesa_mode(scr_stat *scp, sc_softc
scp->xpixel = info.vi_width;
scp->ypixel = info.vi_height;
scp->xsize = scp->xpixel / 8;
-   scp->ysize = scp->ypixel / 16;
+   scp->ysize = scp->ypixel / font_size;
scp->xpos = 0;
scp->ypos = scp->ysize - 1;
scp->xoff = scp->yoff = 0;
-#ifndef SC_NO_FONT_LOADING
-   scp->font = sc->font_16;
-#else
-   scp->font = NULL;
-#endif
-   scp->font_size = 16;
+   scp->font = font;
+   scp->font_size = font_size;
scp->font_width = 8;
scp->start = scp->xsize * scp->ysize - 1;
scp->end = 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: r216068 - head/sys/dev/syscons

2010-11-29 Thread Jung-uk Kim
Author: jkim
Date: Mon Nov 29 22:20:44 2010
New Revision: 216068
URL: http://svn.freebsd.org/changeset/base/216068

Log:
  Clean up code a bit to make it more readable.

Modified:
  head/sys/dev/syscons/syscons.c

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Mon Nov 29 22:19:19 2010
(r216067)
+++ head/sys/dev/syscons/syscons.c  Mon Nov 29 22:20:44 2010
(r216068)
@@ -3119,27 +3119,18 @@ init_scp(sc_softc_t *sc, int vty, scr_st
scp->ypixel = scp->ysize*info.vi_cheight;
 }
 
-   scp->font_size = info.vi_cheight;
-   scp->font_width = info.vi_cwidth;
-   if (info.vi_cheight < 14) {
+scp->font_size = info.vi_cheight;
+scp->font_width = info.vi_cwidth;
 #ifndef SC_NO_FONT_LOADING
-   scp->font = sc->font_8;
-#else
-   scp->font = NULL;
-#endif
-   } else if (info.vi_cheight >= 16) {
-#ifndef SC_NO_FONT_LOADING
-   scp->font = sc->font_16;
-#else
-   scp->font = NULL;
-#endif
-   } else {
-#ifndef SC_NO_FONT_LOADING
-   scp->font = sc->font_14;
+if (info.vi_cheight < 14)
+   scp->font = sc->font_8;
+else if (info.vi_cheight >= 16)
+   scp->font = sc->font_16;
+else
+   scp->font = sc->font_14;
 #else
-   scp->font = NULL;
+scp->font = NULL;
 #endif
-   }
 
 sc_vtb_init(&scp->vtb, VTB_MEMORY, 0, 0, NULL, FALSE);
 #ifndef __sparc64__
___
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: r216069 - head/sys/mips/cavium

2010-11-29 Thread Juli Mallett
Author: jmallett
Date: Tue Nov 30 01:27:54 2010
New Revision: 216069
URL: http://svn.freebsd.org/changeset/base/216069

Log:
  Display some Octeon 2 features and a feature for distinguishing between PCIe
  implementations.

Modified:
  head/sys/mips/cavium/octeon_machdep.c

Modified: head/sys/mips/cavium/octeon_machdep.c
==
--- head/sys/mips/cavium/octeon_machdep.c   Mon Nov 29 22:20:44 2010
(r216068)
+++ head/sys/mips/cavium/octeon_machdep.c   Tue Nov 30 01:27:54 2010
(r216069)
@@ -97,7 +97,9 @@ static const struct octeon_feature_descr
{ OCTEON_FEATURE_SAAD,  "SAAD" },
{ OCTEON_FEATURE_ZIP,   "ZIP" },
{ OCTEON_FEATURE_CRYPTO,"CRYPTO" },
+   { OCTEON_FEATURE_DORM_CRYPTO,   "DORM_CRYPTO" },
{ OCTEON_FEATURE_PCIE,  "PCIE" },
+   { OCTEON_FEATURE_SRIO,  "SRIO" },
{ OCTEON_FEATURE_KEY_MEMORY,"KEY_MEMORY" },
{ OCTEON_FEATURE_LED_CONTROLLER,"LED_CONTROLLER" },
{ OCTEON_FEATURE_TRA,   "TRA" },
@@ -107,6 +109,7 @@ static const struct octeon_feature_descr
{ OCTEON_FEATURE_NO_WPTR,   "NO_WPTR" },
{ OCTEON_FEATURE_DFA,   "DFA" },
{ OCTEON_FEATURE_MDIO_CLAUSE_45,"MDIO_CLAUSE_45" },
+   { OCTEON_FEATURE_NPEI,  "NPEI" },
{ 0,NULL }
 };
 
___
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: r216070 - head/sys/kern

2010-11-29 Thread Warner Losh
Author: imp
Date: Tue Nov 30 05:54:21 2010
New Revision: 216070
URL: http://svn.freebsd.org/changeset/base/216070

Log:
  Remove redundant (and bogus) insertion of pnp info when announcing new
  and retiring devices.  That's already inserted elsewhere.
  
  Submitted by: n_hibma
  MFC after:3 days

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cTue Nov 30 01:27:54 2010(r216069)
+++ head/sys/kern/subr_bus.cTue Nov 30 05:54:21 2010(r216070)
@@ -708,25 +708,7 @@ bad:
 static void
 devadded(device_t dev)
 {
-   char *pnp = NULL;
-   char *tmp = NULL;
-
-   pnp = malloc(1024, M_BUS, M_NOWAIT);
-   if (pnp == NULL)
-   goto fail;
-   tmp = malloc(1024, M_BUS, M_NOWAIT);
-   if (tmp == NULL)
-   goto fail;
-   *pnp = '\0';
-   bus_child_pnpinfo_str(dev, pnp, 1024);
-   snprintf(tmp, 1024, "%s %s", device_get_nameunit(dev), pnp);
-   devaddq("+", tmp, dev);
-fail:
-   if (pnp != NULL)
-   free(pnp, M_BUS);
-   if (tmp != NULL)
-   free(tmp, M_BUS);
-   return;
+   devaddq("+", device_get_nameunit(dev), dev);
 }
 
 /*
@@ -736,24 +718,7 @@ fail:
 static void
 devremoved(device_t dev)
 {
-   char *pnp = NULL;
-   char *tmp = NULL;
-
-   pnp = malloc(1024, M_BUS, M_NOWAIT);
-   if (pnp == NULL)
-   goto fail;
-   tmp = malloc(1024, M_BUS, M_NOWAIT);
-   if (tmp == NULL)
-   goto fail;
-   *pnp = '\0';
-   bus_child_pnpinfo_str(dev, pnp, 1024);
-   snprintf(tmp, 1024, "%s %s", device_get_nameunit(dev), pnp);
-   devaddq("-", tmp, dev);
-fail:
-   if (pnp != NULL)
-   free(pnp, M_BUS);
-   if (tmp != NULL)
-   free(tmp, M_BUS);
+   devaddq("+", device_get_nameunit(dev), dev);
return;
 }
 
___
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: r216071 - head/sys/mips/cavium/octe

2010-11-29 Thread Juli Mallett
Author: jmallett
Date: Tue Nov 30 07:14:05 2010
New Revision: 216071
URL: http://svn.freebsd.org/changeset/base/216071

Log:
  Run all poll requests through a single function that can either do the generic
  link state polling or media-specific ones, while avoidiing changing link state
  on interfaces that use miibus; this substantially speeds up link time on
  interface (re)initialization.

Modified:
  head/sys/mips/cavium/octe/ethernet-common.c
  head/sys/mips/cavium/octe/ethernet-common.h
  head/sys/mips/cavium/octe/ethernet-rgmii.c
  head/sys/mips/cavium/octe/ethernet-sgmii.c
  head/sys/mips/cavium/octe/ethernet-xaui.c
  head/sys/mips/cavium/octe/ethernet.c
  head/sys/mips/cavium/octe/octe.c

Modified: head/sys/mips/cavium/octe/ethernet-common.c
==
--- head/sys/mips/cavium/octe/ethernet-common.c Tue Nov 30 05:54:21 2010
(r216070)
+++ head/sys/mips/cavium/octe/ethernet-common.c Tue Nov 30 07:14:05 2010
(r216071)
@@ -188,7 +188,10 @@ int cvm_oct_common_open(struct ifnet *if
gmx_cfg.s.en = 1;
cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
 
-if (!octeon_is_simulation()) {
+   /*
+* Set the link state unless we are using MII.
+*/
+if (!octeon_is_simulation() && priv->miibus == NULL) {
  link_info = cvmx_helper_link_get(priv->port);
  if (!link_info.s.link_up)  
if_link_state_change(ifp, LINK_STATE_DOWN);
@@ -224,6 +227,30 @@ void cvm_oct_common_poll(struct ifnet *i
cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
cvmx_helper_link_info_t link_info;
 
+   /*
+* If this is a simulation, do nothing.
+*/
+   if (octeon_is_simulation())
+   return;
+
+   /*
+* If there is a device-specific poll method, use it.
+*/
+   if (priv->poll != NULL) {
+   priv->poll(ifp);
+   return;
+   }
+
+   /*
+* If an MII bus is attached, don't use the Simple Executive's link
+* state routines.
+*/
+   if (priv->miibus != NULL)
+   return;
+
+   /*
+* Use the Simple Executive's link state routines.
+*/
link_info = cvmx_helper_link_get(priv->port);
if (link_info.u64 == priv->link_info)
return;

Modified: head/sys/mips/cavium/octe/ethernet-common.h
==
--- head/sys/mips/cavium/octe/ethernet-common.h Tue Nov 30 05:54:21 2010
(r216070)
+++ head/sys/mips/cavium/octe/ethernet-common.h Tue Nov 30 07:14:05 2010
(r216071)
@@ -48,8 +48,6 @@ void cvm_oct_cleanup_module(void);
 int cvm_oct_rgmii_init(struct ifnet *ifp);
 void cvm_oct_rgmii_uninit(struct ifnet *ifp);
 int cvm_oct_sgmii_init(struct ifnet *ifp);
-void cvm_oct_sgmii_uninit(struct ifnet *ifp);
 int cvm_oct_spi_init(struct ifnet *ifp);
 void cvm_oct_spi_uninit(struct ifnet *ifp);
 int cvm_oct_xaui_init(struct ifnet *ifp);
-void cvm_oct_xaui_uninit(struct ifnet *ifp);

Modified: head/sys/mips/cavium/octe/ethernet-rgmii.c
==
--- head/sys/mips/cavium/octe/ethernet-rgmii.c  Tue Nov 30 05:54:21 2010
(r216070)
+++ head/sys/mips/cavium/octe/ethernet-rgmii.c  Tue Nov 30 07:14:05 2010
(r216071)
@@ -134,9 +134,11 @@ static void cvm_oct_rgmii_poll(struct if
cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(index, interface), 
gmxx_rxx_int_reg.u64);
}
 
-   link_info = cvmx_helper_link_autoconf(priv->port);
-   priv->link_info = link_info.u64;
-   priv->need_link_update = 1;
+   if (priv->miibus == NULL) {
+   link_info = cvmx_helper_link_autoconf(priv->port);
+   priv->link_info = link_info.u64;
+   priv->need_link_update = 1;
+   }
mtx_unlock_spin(&global_register_lock);
 }
 
@@ -206,42 +208,6 @@ static int cvm_oct_rgmii_rml_interrupt(v
 }
 
 
-static int cvm_oct_rgmii_open(struct ifnet *ifp)
-{
-   cvmx_gmxx_prtx_cfg_t gmx_cfg;
-   cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
-   int interface = INTERFACE(priv->port);
-   int index = INDEX(priv->port);
-   cvmx_helper_link_info_t link_info;
-
-   gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-   gmx_cfg.s.en = 1;
-   cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
-
-if (!octeon_is_simulation()) {
- link_info = cvmx_helper_link_get(priv->port);
- if (!link_info.s.link_up)
-   if_link_state_change(ifp, LINK_STATE_DOWN);
-else
-   if_link_state_change(ifp, LINK_STATE_UP);
-}
-
-   return 0;
-}
-
-static int cvm_oct_rgmii_stop(struct ifnet *ifp)
-{
-   cvmx_gmxx_prtx_cfg_t gmx_cfg;
-   cvm_oct_private_t *pri