svn commit: r361985 - head/sys/arm/freescale/imx

2020-06-09 Thread Andreas Tobler
Author: andreast
Date: Tue Jun  9 20:27:35 2020
New Revision: 361985
URL: https://svnweb.freebsd.org/changeset/base/361985

Log:
  Fix boot of wandquad after DTS update
  
  In the recent dts sync the name of the aips-bus@ changed to bus@. Reflect
  this change and add an additional OF_finddevice in fix_fdt_interrupt_data()
  and in fix_fdt_iomuxc_data() with bus@ only. Iow, keep the old naming for
  compatibility.
  
  Discussed with:   ian@

Modified:
  head/sys/arm/freescale/imx/imx6_machdep.c

Modified: head/sys/arm/freescale/imx/imx6_machdep.c
==
--- head/sys/arm/freescale/imx/imx6_machdep.c   Tue Jun  9 20:19:11 2020
(r361984)
+++ head/sys/arm/freescale/imx/imx6_machdep.c   Tue Jun  9 20:27:35 2020
(r361985)
@@ -134,6 +134,8 @@ fix_fdt_interrupt_data(void)
if (gpcnode == -1)
gpcnode = OF_finddevice("/soc/aips-bus@200/gpc@20dc000");
if (gpcnode == -1)
+   gpcnode = OF_finddevice("/soc/bus@200/gpc@20dc000");
+   if (gpcnode == -1)
return;
result = OF_getencprop(gpcnode, "interrupt-parent", ,
sizeof(gpcipar));
@@ -172,6 +174,8 @@ fix_fdt_iomuxc_data(void)
 * uses for register access.
 */
node = OF_finddevice("/soc/aips-bus@200/iomuxc-gpr@20e");
+   if (node == -1)
+   node = OF_finddevice("/soc/bus@200/iomuxc-gpr@20e");
if (node != -1)
OF_setprop(node, "status", "disabled", sizeof("disabled"));
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358725 - head/sys/powerpc/powermac

2020-03-06 Thread Andreas Tobler
Author: andreast
Date: Fri Mar  6 23:01:49 2020
New Revision: 358725
URL: https://svnweb.freebsd.org/changeset/base/358725

Log:
  Revert

Modified:
  head/sys/powerpc/powermac/fcu.c

Modified: head/sys/powerpc/powermac/fcu.c
==
--- head/sys/powerpc/powermac/fcu.c Fri Mar  6 21:51:28 2020
(r358724)
+++ head/sys/powerpc/powermac/fcu.c Fri Mar  6 23:01:49 2020
(r358725)
@@ -2,6 +2,7 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2010 Andreas Tobler
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -151,7 +152,7 @@ fcu_write(device_t dev, uint32_t addr, uint8_t reg, ui
 
for (;;)
{
-   if (iicbus_transfer(dev, msg, nitems(msg)) == 0)
+   if (iicbus_transfer(dev, msg, 1) == 0)
return (0);
 
if (++try > 5) {
@@ -175,7 +176,7 @@ fcu_read_1(device_t dev, uint32_t addr, uint8_t reg, u
 
for (;;)
{
- err = iicbus_transfer(dev, msg, nitems(msg));
+ err = iicbus_transfer(dev, msg, 2);
  if (err != 0)
  goto retry;
 
@@ -249,8 +250,8 @@ fcu_start(void *xdev)
sc = device_get_softc(dev);
 
/* Start the fcu device. */
-   fcu_write(sc->sc_dev, sc->sc_addr, 0xe, buf, sizeof(buf));
-   fcu_write(sc->sc_dev, sc->sc_addr, 0x2e, buf, sizeof(buf));
+   fcu_write(sc->sc_dev, sc->sc_addr, 0xe, buf, 1);
+   fcu_write(sc->sc_dev, sc->sc_addr, 0x2e, buf, 1);
fcu_read_1(sc->sc_dev, sc->sc_addr, 0, buf);
fcu_rpm_shift = (buf[0] == 1) ? 2 : 3;
 
@@ -289,7 +290,7 @@ fcu_fan_set_rpm(struct fcu_fan *fan, int rpm)
buf[0] = rpm >> (8 - fcu_rpm_shift);
buf[1] = rpm << fcu_rpm_shift;
 
-   if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, sizeof(buf)) < 0)
+   if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2) < 0)
return (EIO);
 
return (0);
@@ -322,7 +323,7 @@ fcu_fan_get_rpm(struct fcu_fan *fan)
return (-1);
if ((fail & (1 << fan->id)) != 0) {
device_printf(fan->dev,
-   "RPM Fan failed ID: %d %#x\n", fan->id, fail);
+   "RPM Fan failed ID: %d\n", fan->id);
return (-1);
}
/* Check if fan is active. */
@@ -355,7 +356,7 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int pwm)
 {
uint8_t reg;
struct fcu_softc *sc;
-   uint8_t buf[1];
+   uint8_t buf[2];
 
sc = device_get_softc(fan->dev);
 
@@ -377,7 +378,7 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int pwm)
 
buf[0] = (pwm * 2550) / 1000;
 
-   if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, sizeof(buf)) < 0)
+   if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 1) < 0)
return (EIO);
return (0);
 }
@@ -631,9 +632,8 @@ fcu_attach_fans(device_t dev)
   "Maximum allowed RPM");
/* I use i to pass the fan id. */
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
-   "rpm", CTLTYPE_INT | CTLFLAG_RW |
-   CTLFLAG_MPSAFE, dev, i,
-   fcu_fanrpm_sysctl, "I", "Fan RPM");
+   "rpm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
+   dev, i, fcu_fanrpm_sysctl, "I", "Fan RPM");
} else {
fcu_fan_get_pwm(dev, >sc_fans[i],
>sc_fans[i].setpoint,
@@ -654,14 +654,13 @@ fcu_attach_fans(device_t dev)
 * of info I want to display/modify.
 */
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
-   "pwm", CTLTYPE_INT | CTLFLAG_RW |
-   CTLFLAG_MPSAFE, dev,
-   FCU_PWM_SYSCTL_PWM | i,
-   fcu_fanrpm_sysctl, "I", "Fan PWM in %");
-   "rpm", CTLTYPE_INT | CTLFLAG_RD |
-   CTLFLAG_MPSAFE, dev,
-   FCU_PWM_SYSCTL_RPM | i,
-   fcu_fanrpm_sysctl, "I", "Fan RPM");
+   "pwm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
+ 

svn commit: r358724 - head/sys/powerpc/powermac

2020-03-06 Thread Andreas Tobler
Author: andreast
Date: Fri Mar  6 21:51:28 2020
New Revision: 358724
URL: https://svnweb.freebsd.org/changeset/base/358724

Log:
  Drop 'All rights reserved'
  Replace hardcoded sizes by nitems and sizeof
  Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE, I run this driver since a few
  years with CTLFLAG_MPSAFE w/o issues.

Modified:
  head/sys/powerpc/powermac/fcu.c

Modified: head/sys/powerpc/powermac/fcu.c
==
--- head/sys/powerpc/powermac/fcu.c Fri Mar  6 21:32:42 2020
(r358723)
+++ head/sys/powerpc/powermac/fcu.c Fri Mar  6 21:51:28 2020
(r358724)
@@ -2,7 +2,6 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2010 Andreas Tobler
- * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -152,7 +151,7 @@ fcu_write(device_t dev, uint32_t addr, uint8_t reg, ui
 
for (;;)
{
-   if (iicbus_transfer(dev, msg, 1) == 0)
+   if (iicbus_transfer(dev, msg, nitems(msg)) == 0)
return (0);
 
if (++try > 5) {
@@ -176,7 +175,7 @@ fcu_read_1(device_t dev, uint32_t addr, uint8_t reg, u
 
for (;;)
{
- err = iicbus_transfer(dev, msg, 2);
+ err = iicbus_transfer(dev, msg, nitems(msg));
  if (err != 0)
  goto retry;
 
@@ -250,8 +249,8 @@ fcu_start(void *xdev)
sc = device_get_softc(dev);
 
/* Start the fcu device. */
-   fcu_write(sc->sc_dev, sc->sc_addr, 0xe, buf, 1);
-   fcu_write(sc->sc_dev, sc->sc_addr, 0x2e, buf, 1);
+   fcu_write(sc->sc_dev, sc->sc_addr, 0xe, buf, sizeof(buf));
+   fcu_write(sc->sc_dev, sc->sc_addr, 0x2e, buf, sizeof(buf));
fcu_read_1(sc->sc_dev, sc->sc_addr, 0, buf);
fcu_rpm_shift = (buf[0] == 1) ? 2 : 3;
 
@@ -290,7 +289,7 @@ fcu_fan_set_rpm(struct fcu_fan *fan, int rpm)
buf[0] = rpm >> (8 - fcu_rpm_shift);
buf[1] = rpm << fcu_rpm_shift;
 
-   if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2) < 0)
+   if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, sizeof(buf)) < 0)
return (EIO);
 
return (0);
@@ -323,7 +322,7 @@ fcu_fan_get_rpm(struct fcu_fan *fan)
return (-1);
if ((fail & (1 << fan->id)) != 0) {
device_printf(fan->dev,
-   "RPM Fan failed ID: %d\n", fan->id);
+   "RPM Fan failed ID: %d %#x\n", fan->id, fail);
return (-1);
}
/* Check if fan is active. */
@@ -356,7 +355,7 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int pwm)
 {
uint8_t reg;
struct fcu_softc *sc;
-   uint8_t buf[2];
+   uint8_t buf[1];
 
sc = device_get_softc(fan->dev);
 
@@ -378,7 +377,7 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int pwm)
 
buf[0] = (pwm * 2550) / 1000;
 
-   if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 1) < 0)
+   if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, sizeof(buf)) < 0)
return (EIO);
return (0);
 }
@@ -632,8 +631,9 @@ fcu_attach_fans(device_t dev)
   "Maximum allowed RPM");
/* I use i to pass the fan id. */
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
-   "rpm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
-   dev, i, fcu_fanrpm_sysctl, "I", "Fan RPM");
+   "rpm", CTLTYPE_INT | CTLFLAG_RW |
+   CTLFLAG_MPSAFE, dev, i,
+   fcu_fanrpm_sysctl, "I", "Fan RPM");
} else {
fcu_fan_get_pwm(dev, >sc_fans[i],
>sc_fans[i].setpoint,
@@ -654,13 +654,14 @@ fcu_attach_fans(device_t dev)
 * of info I want to display/modify.
 */
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
-   "pwm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
-   dev, FCU_PWM_SYSCTL_PWM | i, fcu_fanrpm_sysctl, "I",
-   "Fan PWM in %");
-   SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
-   "rpm", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
-   dev, FCU_PWM_SYSCTL_RPM | i, fcu_fanrpm_sysctl, 

svn commit: r358723 - head/sys/dev/iicbus

2020-03-06 Thread Andreas Tobler
Author: andreast
Date: Fri Mar  6 21:32:42 2020
New Revision: 358723
URL: https://svnweb.freebsd.org/changeset/base/358723

Log:
  Drop 'All rights reserved'
  Replace hardcoded sizes by nitems and sizeof
  Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE, I run this driver since a few
  years with CTLFLAG_MPSAFE w/o issues.
  Add a HACK to handle a special case for a sensor location.

Modified:
  head/sys/dev/iicbus/ad7417.c

Modified: head/sys/dev/iicbus/ad7417.c
==
--- head/sys/dev/iicbus/ad7417.cFri Mar  6 21:26:35 2020
(r358722)
+++ head/sys/dev/iicbus/ad7417.cFri Mar  6 21:32:42 2020
(r358723)
@@ -2,7 +2,6 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2010 Andreas Tobler
- * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -143,7 +142,7 @@ ad7417_write(device_t dev, uint32_t addr, uint8_t reg,
 
for (;;)
{
-   if (iicbus_transfer(dev, msg, 1) == 0)
+   if (iicbus_transfer(dev, msg, nitems(msg)) == 0)
return (0);
 
if (++try > 5) {
@@ -167,7 +166,7 @@ ad7417_read_1(device_t dev, uint32_t addr, uint8_t reg
 
for (;;)
{
-   err = iicbus_transfer(dev, msg, 2);
+   err = iicbus_transfer(dev, msg, nitems(msg));
if (err != 0)
goto retry;
 
@@ -195,7 +194,7 @@ ad7417_read_2(device_t dev, uint32_t addr, uint8_t reg
 
for (;;)
{
-   err = iicbus_transfer(dev, msg, 2);
+   err = iicbus_transfer(dev, msg, nitems(msg));
if (err != 0)
goto retry;
 
@@ -230,7 +229,7 @@ ad7417_write_read(device_t dev, uint32_t addr, struct 
 
for (;;)
{
-   err = iicbus_transfer(dev, msg, 3);
+   err = iicbus_transfer(dev, msg, nitems(msg));
if (err != 0)
goto retry;
 
@@ -258,18 +257,18 @@ ad7417_init_adc(device_t dev, uint32_t addr)
/* Clear Config2 */
buf = 0;
 
-   err = ad7417_write(dev, addr, AD7417_CONFIG2, , 1);
+   err = ad7417_write(dev, addr, AD7417_CONFIG2, , sizeof(buf));
 
 /* Read & cache Config1 */
buf = 0;
-   err = ad7417_write(dev, addr, AD7417_CONFIG, , 1);
+   err = ad7417_write(dev, addr, AD7417_CONFIG, , sizeof(buf));
err = ad7417_read_1(dev, addr, AD7417_CONFIG, );
adc741x_config = (uint8_t)buf;
 
/* Disable shutdown mode */
adc741x_config &= 0xfe;
buf = adc741x_config;
-   err = ad7417_write(dev, addr, AD7417_CONFIG, , 1);
+   err = ad7417_write(dev, addr, AD7417_CONFIG, , sizeof(buf));
if (err < 0)
return (-1);
 
@@ -310,7 +309,7 @@ ad7417_probe(device_t dev)
 static int
 ad7417_fill_sensor_prop(device_t dev)
 {
-   phandle_t child;
+   phandle_t child, node;
struct ad7417_softc *sc;
u_int id[10];
char location[96];
@@ -359,13 +358,27 @@ ad7417_fill_sensor_prop(device_t dev)
for (j = 0; j < i; j++)
sc->sc_sensors[j].therm.zone = id[j];
 
+   /* Some PowerMac's have the real location of the sensors on
+  child nodes of the hwsensor-location node. Check for and
+  fix the name if needed.
+  This is needed to apply the below HACK with the diode.
+   */
+   j = 0;
+   for (node = OF_child(child); node != 0; node = OF_peer(node)) {
+   
+   OF_getprop(node, "location", location, sizeof(location));
+   strcpy(sc->sc_sensors[i].therm.name, location);
+   j++; 
+   }
+
/* Finish setting up sensor properties */
for (j = 0; j < i; j++) {
sc->sc_sensors[j].dev = dev;

/* HACK: Apple wired a random diode to the ADC line */
-   if (strstr(sc->sc_sensors[j].therm.name, "DIODE TEMP")
-   != NULL) {
+   if ((strstr(sc->sc_sensors[j].therm.name, "DIODE TEMP")
+   != NULL)
+   || (strstr(sc->sc_sensors[j].therm.name, "AD1") != NULL)) {
sc->sc_sensors[j].type = ADC7417_TEMP_SENSOR;
sc->sc_sensors[j].therm.read =
(int (*)(struct pmac_therm *))(ad7417_diode_read);
@@ -444,10 +457,10 @@ ad7417_attach(device_t dev)
}
/* I use i to pass the sensor id. */
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
-   unit, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, dev,
-   i, ad7417_sensor_sysctl,
-   sc->sc_sensors[i].type == ADC7417_TE

svn commit: r358722 - head/sys/dev/iicbus

2020-03-06 Thread Andreas Tobler
Author: andreast
Date: Fri Mar  6 21:26:35 2020
New Revision: 358722
URL: https://svnweb.freebsd.org/changeset/base/358722

Log:
  Drop 'All rights reserved'
  Replace hardcoded size by nitems

Modified:
  head/sys/dev/iicbus/ds1775.c

Modified: head/sys/dev/iicbus/ds1775.c
==
--- head/sys/dev/iicbus/ds1775.cFri Mar  6 21:24:09 2020
(r358721)
+++ head/sys/dev/iicbus/ds1775.cFri Mar  6 21:26:35 2020
(r358722)
@@ -2,7 +2,6 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2010 Andreas Tobler
- * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -104,7 +103,7 @@ ds1775_read_2(device_t dev, uint32_t addr, uint8_t reg
 
for (;;)
{
-   err = iicbus_transfer(dev, msg, 2);
+   err = iicbus_transfer(dev, msg, nitems(msg));
if (err != 0)
goto retry;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r358720 - head/sys/dev/iicbus

2020-03-06 Thread Andreas Tobler

On 06.03.20 22:21, Andreas Tobler wrote:

Author: andreast
Date: Fri Mar  6 21:21:01 2020
New Revision: 358720
URL: https://svnweb.freebsd.org/changeset/base/358720

Log:
   - Drop 'All rights reserved'
   - Replace hardcoded size by nitems


The CTLFLAG_MPSAFE I forgot to mention since I have it since years in my 
tree. Sorry.

Andreas



Modified:
   head/sys/dev/iicbus/max6690.c

Modified: head/sys/dev/iicbus/max6690.c
==
--- head/sys/dev/iicbus/max6690.c   Fri Mar  6 21:15:25 2020
(r358719)
+++ head/sys/dev/iicbus/max6690.c   Fri Mar  6 21:21:01 2020
(r358720)
@@ -2,7 +2,6 @@
   * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
   *
   * Copyright (c) 2010 Andreas Tobler
- * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
@@ -124,7 +123,7 @@ max6690_read(device_t dev, uint32_t addr, uint8_t reg,
  
  	for (;;)

{
-   err = iicbus_transfer(dev, msg, 4);
+   err = iicbus_transfer(dev, msg, nitems(msg));
if (err != 0)
goto retry;
if (busy[0] & 0x80)
@@ -302,8 +301,9 @@ max6690_start(void *xdev)
"Sensor Information");
/* I use i to pass the sensor id. */
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "temp",
-   CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, dev, i % 2,
-   max6690_sensor_sysctl, "IK", sysctl_desc);
+   CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
+   dev, i % 2,
+   max6690_sensor_sysctl, "IK", sysctl_desc);
  
  	}

/* Dump sensor location & ID. */



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


svn commit: r358721 - head/sys/dev/iicbus

2020-03-06 Thread Andreas Tobler
Author: andreast
Date: Fri Mar  6 21:24:09 2020
New Revision: 358721
URL: https://svnweb.freebsd.org/changeset/base/358721

Log:
  Drop 'All rights reserved'
  Replace hardcoded sizes by nitems and sizeof

Modified:
  head/sys/dev/iicbus/ds1631.c

Modified: head/sys/dev/iicbus/ds1631.c
==
--- head/sys/dev/iicbus/ds1631.cFri Mar  6 21:21:01 2020
(r358720)
+++ head/sys/dev/iicbus/ds1631.cFri Mar  6 21:24:09 2020
(r358721)
@@ -2,7 +2,6 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2012 Andreas Tobler
- * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -135,7 +134,7 @@ ds1631_write(device_t dev, uint32_t addr, uint8_t reg,
 
for (;;)
{
-   if (iicbus_transfer(dev, msg, 1) == 0)
+   if (iicbus_transfer(dev, msg, nitems(msg)) == 0)
return (0);
if (++try > 5) {
device_printf(dev, "iicbus write failed\n");
@@ -158,7 +157,7 @@ ds1631_read_1(device_t dev, uint32_t addr, uint8_t reg
 
for (;;)
{
-   err = iicbus_transfer(dev, msg, 2);
+   err = iicbus_transfer(dev, msg, nitems(msg));
if (err != 0)
goto retry;
 
@@ -186,7 +185,7 @@ ds1631_read_2(device_t dev, uint32_t addr, uint8_t reg
 
for (;;)
{
-   err = iicbus_transfer(dev, msg, 2);
+   err = iicbus_transfer(dev, msg, nitems(msg));
if (err != 0)
goto retry;
 
@@ -275,7 +274,7 @@ ds1631_init(device_t dev, uint32_t addr)
 */
conf = DS1631_CONTROL_10BIT;
 
-   err = ds1631_write(dev, addr, DS1631_CONTROL, , 1);
+   err = ds1631_write(dev, addr, DS1631_CONTROL, , sizeof(conf));
if (err < 0) {
device_printf(dev, "ds1631 write config failed: %x\n", err);
return (-1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358720 - head/sys/dev/iicbus

2020-03-06 Thread Andreas Tobler
Author: andreast
Date: Fri Mar  6 21:21:01 2020
New Revision: 358720
URL: https://svnweb.freebsd.org/changeset/base/358720

Log:
  - Drop 'All rights reserved'
  - Replace hardcoded size by nitems

Modified:
  head/sys/dev/iicbus/max6690.c

Modified: head/sys/dev/iicbus/max6690.c
==
--- head/sys/dev/iicbus/max6690.c   Fri Mar  6 21:15:25 2020
(r358719)
+++ head/sys/dev/iicbus/max6690.c   Fri Mar  6 21:21:01 2020
(r358720)
@@ -2,7 +2,6 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2010 Andreas Tobler
- * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -124,7 +123,7 @@ max6690_read(device_t dev, uint32_t addr, uint8_t reg,
 
for (;;)
{
-   err = iicbus_transfer(dev, msg, 4);
+   err = iicbus_transfer(dev, msg, nitems(msg));
if (err != 0)
goto retry;
if (busy[0] & 0x80)
@@ -302,8 +301,9 @@ max6690_start(void *xdev)
"Sensor Information");
/* I use i to pass the sensor id. */
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "temp",
-   CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, dev, i % 2,
-   max6690_sensor_sysctl, "IK", sysctl_desc);
+   CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
+   dev, i % 2,
+   max6690_sensor_sysctl, "IK", sysctl_desc);
 
}
/* Dump sensor location & ID. */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2020-02-03 Thread Andreas Tobler

On 03.02.20 20:29, Mark Johnston wrote:

Author: markj
Date: Mon Feb  3 19:29:02 2020
New Revision: 357463
URL: https://svnweb.freebsd.org/changeset/base/357463

Log:
   Disable the smallest UMA bucket size on 32-bit platforms.
   
   With r357314, sizeof(struct uma_bucket) grew to 16 bytes on 32-bit

   platforms, so BUCKET_SIZE(4) is 0.  This resulted in the creation of a
   bucket zone for buckets with zero capacity.  A more general fix is
   planned, but for now this bandaid allows 32-bit platforms to boot again.


Thanks, my wandquad is back to life.
Andreas
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341405 - head/sys/arm64/conf

2018-12-02 Thread Andreas Tobler
Author: andreast
Date: Sun Dec  2 19:36:20 2018
New Revision: 341405
URL: https://svnweb.freebsd.org/changeset/base/341405

Log:
  Build the dtb for the rock64 board.
  
  Reviewed by:  manu@

Modified:
  head/sys/arm64/conf/GENERIC

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Sun Dec  2 19:35:22 2018(r341404)
+++ head/sys/arm64/conf/GENERIC Sun Dec  2 19:36:20 2018(r341405)
@@ -285,4 +285,4 @@ options FDT
 device acpi
 
 # DTBs
-makeoptionsMODULES_EXTRA="dtb/allwinner"
+makeoptionsMODULES_EXTRA="dtb/allwinner dtb/rockchip"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341404 - head/sys/modules/dtb/rockchip

2018-12-02 Thread Andreas Tobler
Author: andreast
Date: Sun Dec  2 19:35:22 2018
New Revision: 341404
URL: https://svnweb.freebsd.org/changeset/base/341404

Log:
  Add rule to build the dtb for the rock64 board.
  
  Reviewed by:  manu@

Added:
  head/sys/modules/dtb/rockchip/
  head/sys/modules/dtb/rockchip/Makefile   (contents, props changed)

Added: head/sys/modules/dtb/rockchip/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/dtb/rockchip/Makefile  Sun Dec  2 19:35:22 2018
(r341404)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+# For now only for rk3328-rock64 dts file.
+
+DTS=   \
+   rockchip/rk3328-rock64.dts
+
+.include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r339350 - head/contrib/elftoolchain/elfcopy

2018-10-19 Thread Andreas Tobler

On 19.10.18 15:54, Gerald Pfeifer wrote:

On Thu, 18 Oct 2018, Ed Maste wrote:

I think this is probably the right approach, although I also have an
ELF Tool Chain fix in D17596 which is waiting on the code freeze to
end.


I'm a little confused:  This was broken most recently (as the mail
bomb that my inbox received from the pkg cluster and others indicates),
so at this point in the release cycle shouldn't
  (a) the change causing all this be reverted, *or*
  (b) a follow-up patch committed immediately,
whatever looks less risky?



Good to know, then I can stop investigating the bootstrap comparison 
failures.


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


svn commit: r339173 - head/share/mk

2018-10-03 Thread Andreas Tobler
Author: andreast
Date: Wed Oct  3 19:09:09 2018
New Revision: 339173
URL: https://svnweb.freebsd.org/changeset/base/339173

Log:
  Set the default loader for powerpc64 back to to forth too.
  The commit from r338893 covered only the powerpc build.
  
  Approved by:  re (kib)

Modified:
  head/share/mk/src.opts.mk

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Wed Oct  3 17:57:37 2018(r339172)
+++ head/share/mk/src.opts.mk   Wed Oct  3 19:09:09 2018(r339173)
@@ -360,7 +360,7 @@ BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
 .endif
 # Lua in loader currently cause boot failures on powerpc.
 # Further debugging is required.
-.if ${__T} == "powerpc"
+.if ${__T} == "powerpc" || ${__T} == "powerpc64"
 BROKEN_OPTIONS+=LOADER_LUA
 .endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339072 - head/libexec/rtld-elf/powerpc

2018-10-01 Thread Andreas Tobler
Author: andreast
Date: Mon Oct  1 18:46:35 2018
New Revision: 339072
URL: https://svnweb.freebsd.org/changeset/base/339072

Log:
  This commit reverts 338930. The approach was wrong.
  
  Fix the issue with subtracting the TLS_TCB_SIZE too when we are trying to get
  the 'where' in the R_PPC_TPREL32 case. At allocation time we added an offset
  and the TLS_TCB_SIZE. This has to be subtracted as well.
  
  Now all the issues reported are fixed. Tests were done on G4 and G5 
PowerMac's.
  Additionally I ran the tls tests from the gcc test suite and made sure the
  results are as good as pre 338486.
  
  Thanks to tuexen for reporting the malfunction and for patient testing.
  Also testing thanks goes to jhibbits.
  
  Reported by:  tuexen
  Discussed with:   jhibbits, nwhitehorn
  Approved by:  re (gjb)
  Pointyhat to: andreast

Modified:
  head/libexec/rtld-elf/powerpc/reloc.c
  head/libexec/rtld-elf/powerpc/rtld_machdep.h

Modified: head/libexec/rtld-elf/powerpc/reloc.c
==
--- head/libexec/rtld-elf/powerpc/reloc.c   Mon Oct  1 18:26:41 2018
(r339071)
+++ head/libexec/rtld-elf/powerpc/reloc.c   Mon Oct  1 18:46:35 2018
(r339072)
@@ -258,7 +258,7 @@ reloc_nonplt_object(Obj_Entry *obj_rtld, Obj_Entry *ob
 
*(Elf_Addr **)where = *where * sizeof(Elf_Addr)
+ (Elf_Addr *)(def->st_value + rela->r_addend 
-   + defobj->tlsoffset - TLS_TP_OFFSET);
+   + defobj->tlsoffset - TLS_TP_OFFSET - TLS_TCB_SIZE);

break;


Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h
==
--- head/libexec/rtld-elf/powerpc/rtld_machdep.hMon Oct  1 18:26:41 
2018(r339071)
+++ head/libexec/rtld-elf/powerpc/rtld_machdep.hMon Oct  1 18:46:35 
2018(r339072)
@@ -69,12 +69,12 @@ void _rtld_powerpc_pltcall(void);
 
 #define TLS_TP_OFFSET  0x7000
 #define TLS_DTV_OFFSET 0x8000
-#define TLS_TCB_SIZE   16
+#define TLS_TCB_SIZE   8
 
 #define round(size, align) \
 (((size) + (align) - 1) & ~((align) - 1))
 #define calculate_first_tls_offset(size, align) \
-round(8, align)
+TLS_TCB_SIZE
 #define calculate_tls_offset(prev_offset, prev_size, size, align) \
 round(prev_offset + prev_size, align)
 #define calculate_tls_end(off, size)((off) + (size))
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r338930 - head/libexec/rtld-elf/powerpc

2018-09-28 Thread Andreas Tobler

On 28.09.18 01:12, Konstantin Belousov wrote:

On Thu, Sep 27, 2018 at 09:37:31PM +0200, Andreas Tobler wrote:

On 27.09.18 20:48, Michael Tuexen wrote:

On 25. Sep 2018, at 21:29, Andreas Tobler  wrote:

Author: andreast
Date: Tue Sep 25 19:29:35 2018
New Revision: 338930
URL: https://svnweb.freebsd.org/changeset/base/338930

Log:
   Bring the 32-bit powerpc (PowerMac) back to live. The commit 338486 reworked
   some TLS bits. This broke operation on the PowerMac. Namely one could not 
login.
   At login the screen/shell was giving back lots of backslashes and the login
   shell dumped core.

   The fix to this issue is to revert the powerpc commit from 338486 and to
   increase the TLS_TCB_SIZE to 16.
   Reverting only did not help, login was possible but userland applications
   aborted with strange messages.

   I tested this patch with world/kernel builds and with port upgrades.
   Additionally a full gcc8 bootstrap was successfully completed.

   Reviewed by: jhibbits@
   Approved by: re (Glen)

Modified:
   head/libexec/rtld-elf/powerpc/rtld_machdep.h

Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h
==
--- head/libexec/rtld-elf/powerpc/rtld_machdep.hTue Sep 25 18:54:18 
2018(r338929)
+++ head/libexec/rtld-elf/powerpc/rtld_machdep.hTue Sep 25 19:29:35 
2018(r338930)
@@ -69,12 +69,12 @@ void _rtld_powerpc_pltcall(void);

#define TLS_TP_OFFSET   0x7000
#define TLS_DTV_OFFSET  0x8000
-#define TLS_TCB_SIZE   8
+#define TLS_TCB_SIZE   16

#define round(size, align) \
  (((size) + (align) - 1) & ~((align) - 1))
#define calculate_first_tls_offset(size, align) \
-TLS_TCB_SIZE
+round(8, align)
#define calculate_tls_offset(prev_offset, prev_size, size, align) \
  round(prev_offset + prev_size, align)
#define calculate_tls_end(off, size)((off) + (size))


After performing a buildworld/buildkernel and running r338956 on a 32-bit 
powerpc machine (G4 Mac Mini),
the following program:

#include 
#include 
#include 

void *
f(void * arg)
{
return (arg);
}

int
main(void)
{
void *res;
pthread_t tid;
int err;

if ((err = pthread_create(, NULL, f, NULL)) != 0) {
fprintf(stderr, "pthread_create: %s\n", strerror(err));
}
if ((err = pthread_join(tid, )) != 0) {
fprintf(stderr, "pthread_join: %s\n", strerror(err));
}
return (0);
}

is killed:

tuexen@bsd5:~ % ./test
ld-elf.so.1: assert failed: /usr/home/tuexen/head/libexec/rtld-elf/rtld.c:4753
Abort (core dumped)

gdb shows:

tuexen@bsd5:~ % gdb -c test.core test
GNU gdb (GDB) 8.1 [GDB v8.1 for FreeBSD]
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "powerpc-portbld-freebsd12.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from test...done.
[New LWP 100112]
Core was generated by `./test'.
Program terminated with signal SIGABRT, Aborted.
#0  0x41829a58 in thr_kill () at thr_kill.S:3
3   RSYSCALL(thr_kill)
(gdb) bt
#0  0x41829a58 in thr_kill () at thr_kill.S:3
#1  0x41829378 in __raise (s=6)
  at /usr/home/tuexen/head/lib/libc/gen/raise.c:52
#2  0x41823b84 in abort () at /usr/home/tuexen/head/lib/libc/stdlib/abort.c:67
#3  0x41813f58 in allocate_tls (objs=0x41843000, oldtcb=,
  tcbsize=8, tcbalign=)
  at /usr/home/tuexen/head/libexec/rtld-elf/rtld.c:4753
#4  0x41813fc0 in _rtld_allocate_tls (oldtls=0x0, tcbsize=8, tcbalign=16)
  at /usr/home/tuexen/head/libexec/rtld-elf/rtld.c:5030
#5  0x41877438 in _tcb_ctor (thread=0x41a8d300, initial=)
  at /usr/home/tuexen/head/lib/libthr/thread/thr_ctrdtr.c:45
#6  0x41876ebc in _thr_alloc (curthread=0x41a8d000)
  at /usr/home/tuexen/head/lib/libthr/thread/thr_list.c:172
#7  0x41867118 in _pthread_create (thread=0xdc10, attr=0x0,
  start_routine=0x180073c , arg=0x0)
  at /usr/home/tuexen/head/lib/libthr/thread/thr_create.c:81
#8  0x01800798 in main ()
(gdb) quit

Any idea what is wrong?


TLS is broken on powerpc ;)

I see the same.

Would you mind reverting my commit and see if it is better/different and
how different?

For me the commit was an improvement, but I agree this is not enough.

I try to analyze what is going on. Any help is appreciated.


The cause is

Re: svn commit: r338930 - head/libexec/rtld-elf/powerpc

2018-09-27 Thread Andreas Tobler

On 27.09.18 20:48, Michael Tuexen wrote:

On 25. Sep 2018, at 21:29, Andreas Tobler  wrote:

Author: andreast
Date: Tue Sep 25 19:29:35 2018
New Revision: 338930
URL: https://svnweb.freebsd.org/changeset/base/338930

Log:
  Bring the 32-bit powerpc (PowerMac) back to live. The commit 338486 reworked
  some TLS bits. This broke operation on the PowerMac. Namely one could not 
login.
  At login the screen/shell was giving back lots of backslashes and the login
  shell dumped core.

  The fix to this issue is to revert the powerpc commit from 338486 and to
  increase the TLS_TCB_SIZE to 16.
  Reverting only did not help, login was possible but userland applications
  aborted with strange messages.

  I tested this patch with world/kernel builds and with port upgrades.
  Additionally a full gcc8 bootstrap was successfully completed.

  Reviewed by: jhibbits@
  Approved by: re (Glen)

Modified:
  head/libexec/rtld-elf/powerpc/rtld_machdep.h

Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h
==
--- head/libexec/rtld-elf/powerpc/rtld_machdep.hTue Sep 25 18:54:18 
2018(r338929)
+++ head/libexec/rtld-elf/powerpc/rtld_machdep.hTue Sep 25 19:29:35 
2018(r338930)
@@ -69,12 +69,12 @@ void _rtld_powerpc_pltcall(void);

#define TLS_TP_OFFSET   0x7000
#define TLS_DTV_OFFSET  0x8000
-#define TLS_TCB_SIZE   8
+#define TLS_TCB_SIZE   16

#define round(size, align) \
 (((size) + (align) - 1) & ~((align) - 1))
#define calculate_first_tls_offset(size, align) \
-TLS_TCB_SIZE
+round(8, align)
#define calculate_tls_offset(prev_offset, prev_size, size, align) \
 round(prev_offset + prev_size, align)
#define calculate_tls_end(off, size)((off) + (size))


After performing a buildworld/buildkernel and running r338956 on a 32-bit 
powerpc machine (G4 Mac Mini),
the following program:

#include 
#include 
#include 

void *
f(void * arg)
{
return (arg);
}

int
main(void)
{
void *res;
pthread_t tid;
int err;

if ((err = pthread_create(, NULL, f, NULL)) != 0) {
fprintf(stderr, "pthread_create: %s\n", strerror(err));
}
if ((err = pthread_join(tid, )) != 0) {
fprintf(stderr, "pthread_join: %s\n", strerror(err));
}
return (0);
}

is killed:

tuexen@bsd5:~ % ./test
ld-elf.so.1: assert failed: /usr/home/tuexen/head/libexec/rtld-elf/rtld.c:4753
Abort (core dumped)

gdb shows:

tuexen@bsd5:~ % gdb -c test.core test
GNU gdb (GDB) 8.1 [GDB v8.1 for FreeBSD]
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "powerpc-portbld-freebsd12.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from test...done.
[New LWP 100112]
Core was generated by `./test'.
Program terminated with signal SIGABRT, Aborted.
#0  0x41829a58 in thr_kill () at thr_kill.S:3
3   RSYSCALL(thr_kill)
(gdb) bt
#0  0x41829a58 in thr_kill () at thr_kill.S:3
#1  0x41829378 in __raise (s=6)
 at /usr/home/tuexen/head/lib/libc/gen/raise.c:52
#2  0x41823b84 in abort () at /usr/home/tuexen/head/lib/libc/stdlib/abort.c:67
#3  0x41813f58 in allocate_tls (objs=0x41843000, oldtcb=,
 tcbsize=8, tcbalign=)
 at /usr/home/tuexen/head/libexec/rtld-elf/rtld.c:4753
#4  0x41813fc0 in _rtld_allocate_tls (oldtls=0x0, tcbsize=8, tcbalign=16)
 at /usr/home/tuexen/head/libexec/rtld-elf/rtld.c:5030
#5  0x41877438 in _tcb_ctor (thread=0x41a8d300, initial=)
 at /usr/home/tuexen/head/lib/libthr/thread/thr_ctrdtr.c:45
#6  0x41876ebc in _thr_alloc (curthread=0x41a8d000)
 at /usr/home/tuexen/head/lib/libthr/thread/thr_list.c:172
#7  0x41867118 in _pthread_create (thread=0xdc10, attr=0x0,
 start_routine=0x180073c , arg=0x0)
 at /usr/home/tuexen/head/lib/libthr/thread/thr_create.c:81
#8  0x01800798 in main ()
(gdb) quit

Any idea what is wrong?


TLS is broken on powerpc ;)

I see the same.

Would you mind reverting my commit and see if it is better/different and 
how different?


For me the commit was an improvement, but I agree this is not enough.

I try to analyze what is going on. Any help is appreciated.

Thanks for the report.
Andreas

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


svn commit: r338930 - head/libexec/rtld-elf/powerpc

2018-09-25 Thread Andreas Tobler
Author: andreast
Date: Tue Sep 25 19:29:35 2018
New Revision: 338930
URL: https://svnweb.freebsd.org/changeset/base/338930

Log:
  Bring the 32-bit powerpc (PowerMac) back to live. The commit 338486 reworked
  some TLS bits. This broke operation on the PowerMac. Namely one could not 
login.
  At login the screen/shell was giving back lots of backslashes and the login
  shell dumped core.
  
  The fix to this issue is to revert the powerpc commit from 338486 and to
  increase the TLS_TCB_SIZE to 16.
  Reverting only did not help, login was possible but userland applications
  aborted with strange messages.
  
  I tested this patch with world/kernel builds and with port upgrades.
  Additionally a full gcc8 bootstrap was successfully completed.
  
  Reviewed by: jhibbits@
  Approved by: re (Glen)

Modified:
  head/libexec/rtld-elf/powerpc/rtld_machdep.h

Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h
==
--- head/libexec/rtld-elf/powerpc/rtld_machdep.hTue Sep 25 18:54:18 
2018(r338929)
+++ head/libexec/rtld-elf/powerpc/rtld_machdep.hTue Sep 25 19:29:35 
2018(r338930)
@@ -69,12 +69,12 @@ void _rtld_powerpc_pltcall(void);
 
 #define TLS_TP_OFFSET  0x7000
 #define TLS_DTV_OFFSET 0x8000
-#define TLS_TCB_SIZE   8
+#define TLS_TCB_SIZE   16
 
 #define round(size, align) \
 (((size) + (align) - 1) & ~((align) - 1))
 #define calculate_first_tls_offset(size, align) \
-TLS_TCB_SIZE
+round(8, align)
 #define calculate_tls_offset(prev_offset, prev_size, size, align) \
 round(prev_offset + prev_size, align)
 #define calculate_tls_end(off, size)((off) + (size))
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r338486 - in head/libexec/rtld-elf: . aarch64 arm mips powerpc powerpc64 riscv

2018-09-24 Thread Andreas Tobler

On 23.09.18 22:41, Andreas Tobler wrote:

Hi Brooks,

On 06.09.18 01:23, Brooks Davis wrote:

Author: brooks
Date: Wed Sep  5 23:23:16 2018
New Revision: 338486
URL: https://svnweb.freebsd.org/changeset/base/338486

Log:
Rework rtld's TLS Variant I implementation to match r326794

The above commit fixed handling overaligned TLS segments in libc's

TLS Variant I implementation, but rtld provides its own implementation
for dynamically-linked executables which lacks these fixes.  Thus,
port these changes to rtld.

This was previously commited as r337978 and reverted in r338149 due to

exposing a bug the ARM rtld.  This bug was fixed in r338317 by mmel.

Submitted by:	James Clarke

Approved by:re (kib)
Reviewed by:kbowling
Testing by: kbowling (powerpc64), br (riscv), kevans (armv7)


And no testing on powerpc?

This patch breaks ppc-32. It makes the system unusable, one can not even
login. Neither on the console nor via ssh. After entering the user I get
flooded with backslashes and the login shell dumps core. (Only visible
if I netboot)

I'm testing now a fix and see if it survives world and kernel build.


Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h
==
--- head/libexec/rtld-elf/powerpc/rtld_machdep.hWed Sep  5 21:47:22 
2018(r338485)
+++ head/libexec/rtld-elf/powerpc/rtld_machdep.hWed Sep  5 23:23:16 
2018(r338486)
@@ -74,10 +74,11 @@ void _rtld_powerpc_pltcall(void);
   #define round(size, align) \
   (((size) + (align) - 1) & ~((align) - 1))
   #define calculate_first_tls_offset(size, align) \
-round(8, align)
+TLS_TCB_SIZE


Here, if I revert to 'round(8, align)', I can login again. But the fix
I'm testing now, is to increase the TLS_TCB_SIZE to 16 as suggested by
Justin.

I'll let you know how it goes.


So, here the feedback.

Additional testing showed that increasing the TLS_TCB_SIZE is not 
enough. I have the below snippet which lets me build world/kernel and do 
some portmaster updates.


If I use TLS_TCB_SIZE in calculate_first_tls_offset I get a system where 
I can login, but when I try to run 'portmaster' with arguments I get 
'operator expected' on a option which works on other archs.


Putting in round(8, align) instead of TLS_TCB_SIZE makes portmaster work 
again.


And if I leave TLS_TCB_SIZE with 8, and only bring back round(8, align) 
is also not sufficient.


I rebuild a few things again and then I propose the below for -CURRENT 
to re@. Unless someone else has a better idea.


Regards,
Andreas

Index: libexec/rtld-elf/powerpc/rtld_machdep.h
===
--- libexec/rtld-elf/powerpc/rtld_machdep.h (revision 338919)
+++ libexec/rtld-elf/powerpc/rtld_machdep.h (working copy)
@@ -69,12 +69,12 @@

 #define TLS_TP_OFFSET  0x7000
 #define TLS_DTV_OFFSET 0x8000
-#define TLS_TCB_SIZE   8
+#define TLS_TCB_SIZE   16

 #define round(size, align) \
 (((size) + (align) - 1) & ~((align) - 1))
 #define calculate_first_tls_offset(size, align) \
-TLS_TCB_SIZE
+round(8, align)
 #define calculate_tls_offset(prev_offset, prev_size, size, align) \
 round(prev_offset + prev_size, align)
 #define calculate_tls_end(off, size)((off) + (size))

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


Re: svn commit: r338486 - in head/libexec/rtld-elf: . aarch64 arm mips powerpc powerpc64 riscv

2018-09-23 Thread Andreas Tobler

Hi Brooks,

On 06.09.18 01:23, Brooks Davis wrote:

Author: brooks
Date: Wed Sep  5 23:23:16 2018
New Revision: 338486
URL: https://svnweb.freebsd.org/changeset/base/338486

Log:
   Rework rtld's TLS Variant I implementation to match r326794
   
   The above commit fixed handling overaligned TLS segments in libc's

   TLS Variant I implementation, but rtld provides its own implementation
   for dynamically-linked executables which lacks these fixes.  Thus,
   port these changes to rtld.
   
   This was previously commited as r337978 and reverted in r338149 due to

   exposing a bug the ARM rtld.  This bug was fixed in r338317 by mmel.
   
   Submitted by:	James Clarke

   Approved by: re (kib)
   Reviewed by: kbowling
   Testing by:  kbowling (powerpc64), br (riscv), kevans (armv7)


And no testing on powerpc?

This patch breaks ppc-32. It makes the system unusable, one can not even 
login. Neither on the console nor via ssh. After entering the user I get 
flooded with backslashes and the login shell dumps core. (Only visible 
if I netboot)


I'm testing now a fix and see if it survives world and kernel build.


Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h
==
--- head/libexec/rtld-elf/powerpc/rtld_machdep.hWed Sep  5 21:47:22 
2018(r338485)
+++ head/libexec/rtld-elf/powerpc/rtld_machdep.hWed Sep  5 23:23:16 
2018(r338486)
@@ -74,10 +74,11 @@ void _rtld_powerpc_pltcall(void);
  #define round(size, align) \
  (((size) + (align) - 1) & ~((align) - 1))
  #define calculate_first_tls_offset(size, align) \
-round(8, align)
+TLS_TCB_SIZE


Here, if I revert to 'round(8, align)', I can login again. But the fix 
I'm testing now, is to increase the TLS_TCB_SIZE to 16 as suggested by 
Justin.


I'll let you know how it goes.
Andreas

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


svn commit: r338893 - head/share/mk

2018-09-22 Thread Andreas Tobler
Author: andreast
Date: Sat Sep 22 20:58:43 2018
New Revision: 338893
URL: https://svnweb.freebsd.org/changeset/base/338893

Log:
  Set the default loader for powerpc(32- and 64-bit) back to to forth.
  There are some issues with the lua-loader. To be on the safe side, use a well
  known and working loader.
  
  Approved by: re (glen)

Modified:
  head/share/mk/src.opts.mk

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Sat Sep 22 17:05:49 2018(r338892)
+++ head/share/mk/src.opts.mk   Sat Sep 22 20:58:43 2018(r338893)
@@ -358,6 +358,11 @@ BROKEN_OPTIONS+=LOADER_UBOOT
 .if ${__T} == "sparc64"
 BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
 .endif
+# Lua in loader currently cause boot failures on powerpc.
+# Further debugging is required.
+.if ${__T} == "powerpc"
+BROKEN_OPTIONS+=LOADER_LUA
+.endif
 
 .if ${__T:Mmips64*}
 # profiling won't work on MIPS64 because there is only assembly for o32
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r333919 - in head/contrib/file: . doc magic magic/Magdir python src tests

2018-05-21 Thread Andreas Tobler

Hi Eitan,

On 20.05.18 07:06, Eitan Adler wrote:

Author: eadler
Date: Sun May 20 05:06:42 2018
New Revision: 333919
URL: https://svnweb.freebsd.org/changeset/base/333919

Log:
   MFV: file 5.33
   
   Merge the latest file(1) in.
   
   Relevent Changelog:

   - extend the support for ${x?:} expansions for magic descriptions
   - add support for ${x?:} in mime types to handle pie binaries.
   - add support for negative offsets (offsets from the end of file)
   - close the file on error when writing magic
   
   Relnotes:	yes


I bissected this commit as the one which breaks my ports build.
The one before, 333916 lets me build ports w/o problems.
This and the following one (333922) which fixed compilation leaves me 
with a weird situation.


For example, when I try to build x11-servers/xorg-server I do not find 
the libpciaccess.so lib, then the build tries to build the missing 
library and complains about the library is already there. Force 
installing it doesn't help, the configure step still complains about a 
libpciaccess.so which was not found.


Another example is a gccX build where it complains about libgmp.so not 
found.


This happens on amd64, two different machines, and also on armv7. I 
didn't try on other archs.


Stepping between the two revisions solves/exposes the issue.

Do you have an idea what happens here?

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


svn commit: r333743 - head/sys/dev/usb/net

2018-05-17 Thread Andreas Tobler
Author: andreast
Date: Thu May 17 17:57:41 2018
New Revision: 333743
URL: https://svnweb.freebsd.org/changeset/base/333743

Log:
  Fix build if USB_DEBUG is defined.

Modified:
  head/sys/dev/usb/net/if_muge.c

Modified: head/sys/dev/usb/net/if_muge.c
==
--- head/sys/dev/usb/net/if_muge.c  Thu May 17 17:45:47 2018
(r333742)
+++ head/sys/dev/usb/net/if_muge.c  Thu May 17 17:57:41 2018
(r333743)
@@ -126,7 +126,7 @@ static const struct usb_device_id lan78xx_devs[] = {
 };
 
 #ifdef USB_DEBUG
-#define lan78xx_dbg_printf(sc, fmt, args...) \
+#define muge_dbg_printf(sc, fmt, args...) \
 do { \
if (muge_debug > 0) \
device_printf((sc)->sc_ue.ue_dev, "debug: " fmt, ##args); \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r327530 - in head/sys/powerpc: include powerpc

2018-01-03 Thread Andreas Tobler
Author: andreast
Date: Wed Jan  3 20:20:43 2018
New Revision: 327530
URL: https://svnweb.freebsd.org/changeset/base/327530

Log:
  The recent bump of MAXDSIZ made 32-bit binary execution on 64-bit powerpc 
fail.
  The data segement was too big.
  
  Add a fix-up function like on ia32 for MAXDSIZ.
  
  While here, bring also the MAXSSIZ closer to amd64 and add an equal fix-up
  function for MAXSSIZ.
  
  Reviewed by:  jhibbits@
  Obtained from:  jhibbits@
  Differential Revision:https://reviews.freebsd.org/D13753

Modified:
  head/sys/powerpc/include/vmparam.h
  head/sys/powerpc/powerpc/elf32_machdep.c

Modified: head/sys/powerpc/include/vmparam.h
==
--- head/sys/powerpc/include/vmparam.h  Wed Jan  3 19:28:13 2018
(r327529)
+++ head/sys/powerpc/include/vmparam.h  Wed Jan  3 20:20:43 2018
(r327530)
@@ -60,7 +60,11 @@
 #endif
 
 #ifndefMAXSSIZ
+#ifdef __powerpc64__
+#defineMAXSSIZ (512*1024*1024) /* max stack size */
+#else
 #defineMAXSSIZ (64*1024*1024)  /* max stack size */
+#endif
 #endif
 
 #ifdef AIM

Modified: head/sys/powerpc/powerpc/elf32_machdep.c
==
--- head/sys/powerpc/powerpc/elf32_machdep.cWed Jan  3 19:28:13 2018
(r327529)
+++ head/sys/powerpc/powerpc/elf32_machdep.cWed Jan  3 20:20:43 2018
(r327530)
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -60,6 +61,18 @@
 #include 
 
 extern const char *freebsd32_syscallnames[];
+static void ppc32_fixlimit(struct rlimit *rl, int which);
+
+static SYSCTL_NODE(_compat, OID_AUTO, ppc32, CTLFLAG_RW, 0, "32-bit mode");
+
+#define PPC32_MAXDSIZ (1024*1024*1024)
+static u_long ppc32_maxdsiz = PPC32_MAXDSIZ;
+SYSCTL_ULONG(_compat_ppc32, OID_AUTO, maxdsiz, CTLFLAG_RWTUN, _maxdsiz,
+ 0, "");
+#define PPC32_MAXSSIZ (64*1024*1024)
+u_long ppc32_maxssiz = PPC32_MAXSSIZ;
+SYSCTL_ULONG(_compat_ppc32, OID_AUTO, maxssiz, CTLFLAG_RWTUN, _maxssiz,
+ 0, "");
 #endif
 
 struct sysentvec elf32_freebsd_sysvec = {
@@ -91,6 +104,7 @@ struct sysentvec elf32_freebsd_sysvec = {
.sv_copyout_strings = freebsd32_copyout_strings,
.sv_setregs = ppc32_setregs,
.sv_syscallnames = freebsd32_syscallnames,
+   .sv_fixlimit= ppc32_fixlimit,
 #else
.sv_maxuser = VM_MAXUSER_ADDRESS,
.sv_usrstack= USRSTACK,
@@ -98,8 +112,8 @@ struct sysentvec elf32_freebsd_sysvec = {
.sv_copyout_strings = exec_copyout_strings,
.sv_setregs = exec_setregs,
.sv_syscallnames = syscallnames,
-#endif
.sv_fixlimit= NULL,
+#endif
.sv_maxssiz = NULL,
.sv_flags   = SV_ABI_FREEBSD | SV_ILP32 | SV_SHP,
.sv_set_syscall_retval = cpu_set_syscall_retval,
@@ -319,5 +333,30 @@ elf_cpu_unload_file(linker_file_t lf __unused)
 {
 
return (0);
+}
+#endif
+
+#ifdef __powerpc64__
+static void
+ppc32_fixlimit(struct rlimit *rl, int which)
+{
+   switch (which) {
+   case RLIMIT_DATA:
+   if (ppc32_maxdsiz != 0) {
+   if (rl->rlim_cur > ppc32_maxdsiz)
+   rl->rlim_cur = ppc32_maxdsiz;
+   if (rl->rlim_max > ppc32_maxdsiz)
+   rl->rlim_max = ppc32_maxdsiz;
+   }
+   break;
+   case RLIMIT_STACK:
+   if (ppc32_maxssiz != 0) {
+   if (rl->rlim_cur > ppc32_maxssiz)
+   rl->rlim_cur = ppc32_maxssiz;
+   if (rl->rlim_max > ppc32_maxssiz)
+   rl->rlim_max = ppc32_maxssiz;
+   }
+   break;
+   }
 }
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r324125 - head/sbin/mdmfs

2017-09-30 Thread Andreas Tobler
Author: andreast
Date: Sat Sep 30 17:51:10 2017
New Revision: 324125
URL: https://svnweb.freebsd.org/changeset/base/324125

Log:
  Initialize mdsize to make gcc happy again. This fixes buildworld on powerpc.
  
  Reviewed by:  ian@

Modified:
  head/sbin/mdmfs/mdmfs.c

Modified: head/sbin/mdmfs/mdmfs.c
==
--- head/sbin/mdmfs/mdmfs.c Sat Sep 30 17:30:22 2017(r324124)
+++ head/sbin/mdmfs/mdmfs.c Sat Sep 30 17:51:10 2017(r324125)
@@ -117,6 +117,7 @@ main(int argc, char **argv)
mdtype = MD_SWAP;
mdname = MD_NAME;
mdnamelen = strlen(mdname);
+   mdsize = 0;
/*
 * Can't set these to NULL.  They may be passed to the
 * respective programs without modification.  I.e., we may not
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-09-17 Thread Andreas Tobler

On 17.09.17 00:28, Mark Johnston wrote:

On Sat, Sep 16, 2017 at 09:01:56PM +0200, Andreas Tobler wrote:

On 14.09.17 22:32, Mark Johnston wrote:

On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote:

Hi Mark,

On 07.09.17 23:43, Mark Johnston wrote:

Author: markj
Date: Thu Sep  7 21:43:39 2017
New Revision: 323290
URL: https://svnweb.freebsd.org/changeset/base/323290

Log:
 Speed up vm_page_array initialization.
 
 We currently initialize the vm_page array in three passes: one to zero

 the array, one to initialize the "order" field of each page (necessary
 when inserting them into the vm_phys buddy allocator one-by-one), and
 one to initialize the remaining non-zero fields and individually insert
 each page into the allocator.
 
 Merge the three passes into one following a suggestion from alc:

 initialize vm_page fields in a single pass, and use vm_phys_free_contig()
 to efficiently insert physical memory segments into the buddy allocator.
 This reduces the initialization time to a third or a quarter of what it
 was before on most systems that I tested.
 
 Reviewed by:	alc, kib

 MFC after: 3 weeks
 Differential Revision: https://reviews.freebsd.org/D12248

Modified:
 head/sys/vm/vm_page.c
 head/sys/vm/vm_phys.c
 head/sys/vm/vm_phys.h


I just found out that this commit breaks booting my powerpc64 Quad G5.
It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue].

Sometimes it hangs earlier when the kbd is not there yet (usb), then I
can't get the process/task where it hangs.

Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD)

Any ideas how to find out what's wrong?


Are you able to break into DDB when the hang occurs? If so, the output
of "show page" would be helpful.


Unfortunately not from the beginning. The keyboard is usb and it gets
installed late. Once it survives the loading of the kbd and co, I can
enter into ddb. But it is a trial and error. So far I didn't succeed to
come that far.


Are you running with INVARIANTS configured? If not, please try that.


The above was w/o INVARIANTS. With invariants the kernel panics
immediately after boot, see pic.


Thanks. Could you please try applying the patch at the end of this email
and see if that fixes the issue? I have not yet tried to compile it,
sorry.


Excellent! I can confirm the two platforms, 32- and 64-bit powerpc, are 
back to life. Both are running since a few hours and perfom ports 
rebuild now.


Thank you very much for your prompt response and help.

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


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

2017-09-16 Thread Andreas Tobler

On 16.09.17 22:32, Justin Hibbits wrote:



On Sep 16, 2017 14:02, "Andreas Tobler" <andre...@freebsd.org 
<mailto:andre...@freebsd.org>> wrote:


On 14.09.17 22:32, Mark Johnston wrote:

On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote:

Hi Mark,

On 07.09.17 23:43, Mark Johnston wrote:

Author: markj
Date: Thu Sep  7 21:43:39 2017
New Revision: 323290
URL: https://svnweb.freebsd.org/changeset/base/323290
<https://svnweb.freebsd.org/changeset/base/323290>

Log:
     Speed up vm_page_array initialization.
         We currently initialize the vm_page array in
three passes: one to zero
     the array, one to initialize the "order" field of
each page (necessary
     when inserting them into the vm_phys buddy
allocator one-by-one), and
     one to initialize the remaining non-zero fields and
individually insert
     each page into the allocator.
         Merge the three passes into one following a
suggestion from alc:
     initialize vm_page fields in a single pass, and use
vm_phys_free_contig()
     to efficiently insert physical memory segments into
the buddy allocator.
     This reduces the initialization time to a third or
a quarter of what it
     was before on most systems that I tested.
         Reviewed by:    alc, kib
     MFC after:  3 weeks
     Differential Revision:
https://reviews.freebsd.org/D12248
<https://reviews.freebsd.org/D12248>

Modified:
     head/sys/vm/vm_page.c
     head/sys/vm/vm_phys.c
     head/sys/vm/vm_phys.h


I just found out that this commit breaks booting my
powerpc64 Quad G5.
It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue].

Sometimes it hangs earlier when the kbd is not there yet
(usb), then I
can't get the process/task where it hangs.

Note, this kernel is compiled with the default gcc
(4.2.1-FreeBSD)

Any ideas how to find out what's wrong?


Are you able to break into DDB when the hang occurs? If so, the
output
of "show page" would be helpful.


Unfortunately not from the beginning. The keyboard is usb and it
gets installed late. Once it survives the loading of the kbd and co,
I can enter into ddb. But it is a trial and error. So far I didn't
succeed to come that far.


What about using dcons? That's saved me many times when I couldn't break 
into ddb from the console.


Might be worth a try, but as you might have seen on the pic, the panic 
happens immediately after printing the banner. At that time no driver is 
available. It might work when I try w/o invariants and have luck and get 
past the fwohci init.


Thx,
Andreas

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

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

2017-09-16 Thread Andreas Tobler

On 14.09.17 22:32, Mark Johnston wrote:

On Thu, Sep 14, 2017 at 09:51:17PM +0200, Andreas Tobler wrote:

Hi Mark,

On 07.09.17 23:43, Mark Johnston wrote:

Author: markj
Date: Thu Sep  7 21:43:39 2017
New Revision: 323290
URL: https://svnweb.freebsd.org/changeset/base/323290

Log:
Speed up vm_page_array initialization.

We currently initialize the vm_page array in three passes: one to zero

the array, one to initialize the "order" field of each page (necessary
when inserting them into the vm_phys buddy allocator one-by-one), and
one to initialize the remaining non-zero fields and individually insert
each page into the allocator.

Merge the three passes into one following a suggestion from alc:

initialize vm_page fields in a single pass, and use vm_phys_free_contig()
to efficiently insert physical memory segments into the buddy allocator.
This reduces the initialization time to a third or a quarter of what it
was before on most systems that I tested.

Reviewed by:	alc, kib

MFC after:  3 weeks
Differential Revision:  https://reviews.freebsd.org/D12248

Modified:
head/sys/vm/vm_page.c
head/sys/vm/vm_phys.c
head/sys/vm/vm_phys.h


I just found out that this commit breaks booting my powerpc64 Quad G5.
It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue].

Sometimes it hangs earlier when the kbd is not there yet (usb), then I
can't get the process/task where it hangs.

Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD)

Any ideas how to find out what's wrong?


Are you able to break into DDB when the hang occurs? If so, the output
of "show page" would be helpful.


Unfortunately not from the beginning. The keyboard is usb and it gets 
installed late. Once it survives the loading of the kbd and co, I can 
enter into ddb. But it is a trial and error. So far I didn't succeed to 
come that far.



Are you running with INVARIANTS configured? If not, please try that.


The above was w/o INVARIANTS. With invariants the kernel panics 
immediately after boot, see pic.



The previous revision, r323289 seems stable, at least it survived
several kernel builds.


Could you apply the patch below and capture the first page or so of
output from after the kernel starts booting?


I applied this diff and you see its output on the pic:

https://people.freebsd.org/~andreast/r323290_generic64_with_dbg_patch.jpg

I try now to get that far that I have a kbd and capture a 'show page'.

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


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

2017-09-14 Thread Andreas Tobler

Hi Mark,

On 07.09.17 23:43, Mark Johnston wrote:

Author: markj
Date: Thu Sep  7 21:43:39 2017
New Revision: 323290
URL: https://svnweb.freebsd.org/changeset/base/323290

Log:
   Speed up vm_page_array initialization.
   
   We currently initialize the vm_page array in three passes: one to zero

   the array, one to initialize the "order" field of each page (necessary
   when inserting them into the vm_phys buddy allocator one-by-one), and
   one to initialize the remaining non-zero fields and individually insert
   each page into the allocator.
   
   Merge the three passes into one following a suggestion from alc:

   initialize vm_page fields in a single pass, and use vm_phys_free_contig()
   to efficiently insert physical memory segments into the buddy allocator.
   This reduces the initialization time to a third or a quarter of what it
   was before on most systems that I tested.
   
   Reviewed by:	alc, kib

   MFC after:   3 weeks
   Differential Revision:   https://reviews.freebsd.org/D12248

Modified:
   head/sys/vm/vm_page.c
   head/sys/vm/vm_phys.c
   head/sys/vm/vm_phys.h


I just found out that this commit breaks booting my powerpc64 Quad G5.
It hangs, pressing ctrl-t shows: cmd: sh [*vm active pagequeue].

Sometimes it hangs earlier when the kbd is not there yet (usb), then I 
can't get the process/task where it hangs.


Note, this kernel is compiled with the default gcc (4.2.1-FreeBSD)

Any ideas how to find out what's wrong?
The previous revision, r323289 seems stable, at least it survived 
several kernel builds.


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


Re: svn commit: r320043 - in head: contrib/netbsd-tests/kernel/kqueue lib/libc/include lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys tests/sys/kqueue/libkqueue usr.bin/truss

2017-06-27 Thread Andreas Tobler

On 27.06.17 22:43, Konstantin Belousov wrote:

On Tue, Jun 27, 2017 at 10:21:42PM +0200, Andreas Tobler wrote:

Hi Kib,

On 17.06.17 02:57, Konstantin Belousov wrote:

Author: kib
Date: Sat Jun 17 00:57:26 2017
New Revision: 320043
URL: https://svnweb.freebsd.org/changeset/base/320043

Log:
Add abstime kqueue(2) timers and expand struct kevent members.

This change implements NOTE_ABSTIME flag for EVFILT_TIMER, which

specifies that the data field contains absolute time to fire the
event.

To make this useful, data member of the struct kevent must be extended

to 64bit.  Using the opportunity, I also added ext members.  This
changes struct kevent almost to Apple struct kevent64, except I did
not changed type of ident and udata, the later would cause serious API
incompatibilities.

The type of ident was kept uintptr_t since EVFILT_AIO returns a

pointer in this field, and e.g. CHERI is sensitive to the type
(discussed with brooks, jhb).

Unlike Apple kevent64, symbol versioning allows us to claim ABI

compatibility and still name the new syscall kevent(2).  Compat shims
are provided for both host native and compat32.

Requested by:	bapt

Reviewed by:bapt, brooks, ngie (previous version)
Sponsored by:   The FreeBSD Foundation
Differential revision:  https://reviews.freebsd.org/D11025


This, or one of the following commits breaks my nfs mounts on powerpc64.
With the following I mean, 320044-46. The last working revision is 320038.

With this revision I get this error:

RPCPROG_NFS: RPC: Port mapper failure - RPC: Unable to receive

Boot is ok beside not having nfs.

Right now I build the latest trunk to be sure to test against jhibbit's
latest commit in this area. But I do not expect a change.

Any idea where to look for suspects?


Start with ktrace-ing the mount command, assuming the direct invocation of
mount_nfs(8) fails.


Hm, if you could give me some hands-on? How do I do that?


Did you rebuilt the world after the update ?  It should work both ways,
but knowing the answer trims half of the change for suspect.


I built world and kernel in a clean env. rm -rf the obj part.
The whole boot is done via nfs. I do boot the tree via netboot, 
crossbuilt on amd64. The machine is shot I can not boot from disk atm.


With the r320421, the picture is the same, as expected.


Can you run the ktrace tests on ppc ?
cd tests/sys/kqueue/libkqueue/
make
./kqtest


This is chicken and egg, my src is on the nfs drive :(

I'll check-out a src tree on this machine tomorrow and do test build/run.

Thx for the feedback!
Andreas

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


Re: svn commit: r320043 - in head: contrib/netbsd-tests/kernel/kqueue lib/libc/include lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys tests/sys/kqueue/libkqueue usr.bin/truss

2017-06-27 Thread Andreas Tobler

Hi Kib,

On 17.06.17 02:57, Konstantin Belousov wrote:

Author: kib
Date: Sat Jun 17 00:57:26 2017
New Revision: 320043
URL: https://svnweb.freebsd.org/changeset/base/320043

Log:
   Add abstime kqueue(2) timers and expand struct kevent members.
   
   This change implements NOTE_ABSTIME flag for EVFILT_TIMER, which

   specifies that the data field contains absolute time to fire the
   event.
   
   To make this useful, data member of the struct kevent must be extended

   to 64bit.  Using the opportunity, I also added ext members.  This
   changes struct kevent almost to Apple struct kevent64, except I did
   not changed type of ident and udata, the later would cause serious API
   incompatibilities.
   
   The type of ident was kept uintptr_t since EVFILT_AIO returns a

   pointer in this field, and e.g. CHERI is sensitive to the type
   (discussed with brooks, jhb).
   
   Unlike Apple kevent64, symbol versioning allows us to claim ABI

   compatibility and still name the new syscall kevent(2).  Compat shims
   are provided for both host native and compat32.
   
   Requested by:	bapt

   Reviewed by: bapt, brooks, ngie (previous version)
   Sponsored by:The FreeBSD Foundation
   Differential revision:   https://reviews.freebsd.org/D11025


This, or one of the following commits breaks my nfs mounts on powerpc64. 
With the following I mean, 320044-46. The last working revision is 320038.


With this revision I get this error:

RPCPROG_NFS: RPC: Port mapper failure - RPC: Unable to receive

Boot is ok beside not having nfs.

Right now I build the latest trunk to be sure to test against jhibbit's 
latest commit in this area. But I do not expect a change.


Any idea where to look for suspects?

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


Re: svn commit: r319722 - in head: sys/cam/ctl sys/dev/iscsi sys/kern sys/netgraph sys/netgraph/bluetooth/socket sys/netinet sys/ofed/drivers/infiniband/core sys/ofed/drivers/infiniband/ulp/sdp sys/rp

2017-06-15 Thread Andreas Tobler

On 15.06.17 07:00, Gleb Smirnoff wrote:

   Hi,

On Wed, Jun 14, 2017 at 09:59:50AM +0200, Andreas Tobler wrote:
A> with this revision I get either a kernel panic or a hang. This happens
A> on powerpc (32-bit). The powerpc64 looks stable.
A>
A> Here you can see the backtrace in case of the panic:
A> https://people.freebsd.org/~andreast/r319722_ppc32_1.jpg
A>
A> In the source code I see a comment with XXXGL...
A> Is this powerpc specific or do you think that there are some issues in
A> the uipc_socket.c code?

The comment has nothing to do with arch or 32-bit. Is
it possible to understand what is the actual instruction
at soisconnected()+0x21c ?



(gdb) p /x 0x5a5808 + 0x21c
$2 = 0x5a5a24

005a5808 :
  5a5808:   94 21 ff c0 stwur1,-64(r1)
  5a580c:   7c 08 02 a6 mflrr0
  5a5810:   93 01 00 20 stw r24,32(r1)



  5a5a0c:   39 40 00 00 li  r10,0
  5a5a10:   2f 8a 00 00 cmpwi   cr7,r10,0
  5a5a14:   40 9e 00 0c bne cr7,5a5a20 <soisconnected+0x218>
  5a5a18:   38 7c 00 10 addir3,r28,16
  5a5a1c:   4b f1 c4 61 bl  4c1e7c <__mtx_unlock_sleep>
  5a5a20:   7f 63 db 78 mr  r3,r27
->5a5a24:   4b ff f5 9d bl  5a4fc0 
  5a5a28:   48 00 04 80 b   5a5ea8 <soisconnected+0x6a0>
  5a5a2c:   7c 45 13 78 mr  r5,r2
  5a5a30:   39 20 00 04 li  r9,4


I'm going to stress test before 319722 to see if I can confirm Mark's 
comment.


Thanks!
Andreas
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r319722 - in head: sys/cam/ctl sys/dev/iscsi sys/kern sys/netgraph sys/netgraph/bluetooth/socket sys/netinet sys/ofed/drivers/infiniband/core sys/ofed/drivers/infiniband/ulp/sdp sys/rp

2017-06-14 Thread Andreas Tobler

Hi Gleb,

with this revision I get either a kernel panic or a hang. This happens 
on powerpc (32-bit). The powerpc64 looks stable.


Here you can see the backtrace in case of the panic:
https://people.freebsd.org/~andreast/r319722_ppc32_1.jpg

In the source code I see a comment with XXXGL...
Is this powerpc specific or do you think that there are some issues in 
the uipc_socket.c code?


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


Re: svn commit: r314843 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf modules/linuxkpi

2017-03-08 Thread Andreas Tobler

Hi Hans Petter,

On 07.03.17 13:09, Hans Petter Selasky wrote:

Author: hselasky
Date: Tue Mar  7 12:09:14 2017
New Revision: 314843
URL: https://svnweb.freebsd.org/changeset/base/314843

Log:
  LinuxKPI workqueue cleanup.

  This change makes the workqueue implementation behave more like in
  Linux, both functionality wise and structure wise.

  All workqueue code has been moved to linux_work.c

  Add an atomic based statemachine to the work_struct to ensure proper
  operation. Prior to this change struct_work was directly mapped to a
  FreeBSD task. When a taskqueue has multiple threads the same task may
  end up being executed on more than one worker thread simultaneously.
  This might cause problems with code coming from Linux, which expects
  serial behaviour, similar to Linux tasklets.

  Move all global workqueue function names into the linux_xxx domain to
  avoid symbol name clashes in the future.

  Implement a few more workqueue related functions and macros.

  Create two multithreaded taskqueues for the LinuxKPI during module
  load, one for time-consuming callbacks and one for non-time consuming
  callbacks.

  MFC after:1 week
  Sponsored by: Mellanox Technologies

Added:
  head/sys/compat/linuxkpi/common/src/linux_work.c   (contents, props changed)


/export/devel/fbsd/src/sys/compat/linuxkpi/common/src/linux_work.c:68: 
warning: type qualifiers ignored on function return type [-Wreturn-type]
/export/devel/fbsd/src/sys/compat/linuxkpi/common/src/linux_work.c:89: 
warning: type qualifiers ignored on function return type [-Wreturn-type]

*** Error code 1

For powerpc64, cross kernel build: amd64 -> powerpc64.

How about this?

Regards,
Andreas

Index: sys/compat/linuxkpi/common/src/linux_work.c
===
--- sys/compat/linuxkpi/common/src/linux_work.c (revision 314900)
+++ sys/compat/linuxkpi/common/src/linux_work.c (working copy)
@@ -63,7 +63,7 @@
  * This function atomically updates the work state and returns the
  * previous state at the time of update.
  */
-static const uint8_t
+static int
 linux_update_state(atomic_t *v, const uint8_t *pstate)
 {
int c, old;
@@ -84,7 +84,7 @@
  * again. Without this extra hint LinuxKPI tasks cannot be serialized
  * accross multiple worker threads.
  */
-static const bool
+static bool
 linux_work_exec_unblock(struct work_struct *work)
 {
struct workqueue_struct *wq;

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


Re: svn commit: r313761 - in head/lib/msun: . src

2017-02-16 Thread Andreas Tobler

On 15.02.17 17:08, Ed Maste wrote:

On 15 February 2017 at 02:59, Mahdi Mokhtari  wrote:

Author: mmokhi (ports committer)
Date: Wed Feb 15 07:59:54 2017
New Revision: 313761
URL: https://svnweb.freebsd.org/changeset/base/313761

Log:
  Add casinl() cacosl() catanl() casinhl() cacoshl() catanhl() APIs to msun
  to improve C11 conformance.


This breaks the build on at least mips:

/scratch/tmp/emaste/freebsd/lib/msun/src/catrigl.c:48:21: error:
invtrig.h: No such file or directory
/scratch/tmp/emaste/freebsd/lib/msun/src/catrigl.c:85:2: error: #error
"Unsupported long double format"
...


+2 on powerpc and powerpc64.

Andreas

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


Re: svn commit: r313037 - in head/sys: amd64/include kern mips/include net powerpc/include sparc64/include

2017-02-05 Thread Andreas Tobler

On 05.02.17 19:59, Jason Harmening wrote:

Actually attaching the patch this time ( gmail client)

On Sun, Feb 5, 2017 at 10:58 AM, Jason Harmening
> wrote:

Hmm, it's a good idea to consider the possibility of a barrier
issue.  It wouldn't be the first time we've had such a problem on a
weakly-ordered architecture. That said, I don't see a problem in
this case.  smp_rendezvous_cpus() takes a spinlock and then issues
atomic_store_rel_int()  to ensure the rendezvous params are visible
to other cpus.  The latter corresponds to lwsync on powerpc, which
AFAIK should be sufficient to ensure visibility of prior stores.

For now I'm going with the simpler explanation that I made a bad
assumption  in the powerpc get_pcpu() and there is some context in
which the read of sprg0 doesn't return a consistent pointer value.
Unfortunately I don't see where that might be right now.

On the mips side, Kurt/Alexander can you test the attached patch?
It contains a simple fix to ensure get_pcpu() returns the consistent
per-cpu pointer.



Here the panic I received with the latest patch you sent. World & kernel 
are on 313286 + patch.


https://people.freebsd.org/~andreast/pcpu/

It is the same panic, pic 2 is with a try to get a core 

The load issue was a gmake -j8 bootstrap of todays gcc trunk sources. 
The machine has 2 physical CPU's, two threads pre cpu :)


I revert now and see if the situation becomes stable again or if there 
is something else.


Andreas

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


Re: svn commit: r313037 - in head/sys: amd64/include kern mips/include net powerpc/include sparc64/include

2017-02-04 Thread Andreas Tobler

On 04.02.17 20:54, Jason Harmening wrote:

I suspect this broke rmlocks for mips because the rmlock implementation
takes the address of the per-CPU pc_rm_queue when building tracker
lists.  That address may be later accessed from another CPU and will
then translate to the wrong physical region if the address was taken
relative to the globally-constant pcpup VA used on mips.

Regardless, for mips get_pcpup() should be implemented as
pcpu_find(curcpu) since returning an address that may mean something
different depending on the CPU seems like a big POLA violation if
nothing else.

I'm more concerned about the report of powerpc breakage.  For powerpc we
simply take each pcpu pointer from the pc_allcpu list (which is the same
value stored in the cpuid_to_pcpu array) and pass it through the ap_pcpu
global to each AP's startup code, which then stores it in sprg0.  It
should be globally unique and won't have the variable-translation issues
seen on mips.   Andreas, are you certain this change was responsible the
breakage you saw, and was it the same sort of hang observed on mips?


I'm really sure. 313036 booted fine, allowed me to execute heavy 
compilation jobs, np. 313037 on the other side gave me various patterns 
of panics. During startup, but I also succeeded to get into multiuser 
and then the panic happend during port building.


I have no deeper inside where pcpu data is used. Justin mentioned netisr?

Andreas

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


Re: svn commit: r313037 - in head/sys: amd64/include kern mips/include net powerpc/include sparc64/include

2017-02-04 Thread Andreas Tobler

On 04.02.17 07:27, Jason Harmening wrote:

It's hard to argue with that:)  I've backed it out until we can figure
out what's going on.
Sorry for the breakage.



For the record, powerpc64 was also affected.

Andreas


On Fri, Feb 3, 2017 at 9:54 PM, Kurt Lidl > wrote:

Having just spent a couple of hours bisecting what broke the kernel on
my mips64 machine, I can definitively state it was this commit.

With this commit in place, the kernel hangs early in the
autoconfiguration:

gcc version 4.2.1 20070831 patched [FreeBSD]
Preloaded elf kernel "kernel" at 0x80aa96a0.
real memory  = 523239424 (510976K bytes)
Physical memory chunk(s):
0x00bf3000 - 0x080d5fff, 122564608 bytes (29923 pages)
0x08101000 - 0x0ff00fff, 132120576 bytes (32256 pages)
0x41000 - 0x41f196fff, 253325312 bytes (61847 pages)
avail memory = 504360960 (480MB)
Create COP2 context zone
AP #1 started!
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
 hangs here 

-Kurt

On 2/4/17 12:29 AM, Jason Harmening wrote:

Hi,

I'm a bit confused as to how this change breaks MIPS.  The new
function,
get_pcpu() is intended to be used only to access the per-cpu data
pointer locally.  It returns pcpup, which is the per-cpu pointer
wired
into the local TLB to translate to the local CPU's physical data
region,
correct?

This is the same value used by the per-CPU accessors such as
PCPU_ADD
and PCPU_GET.  The MI portions of this change only use get_pcpu() to
access  the local CPU's data, e.g. under a critical section in the
rmlock.  It is not intended to be used for iterating all CPUs.

If I've missed something and MIPS is truly broken by this, then I'll
gladly revert, but (maybe because it's late) I'm not seeing
where this
goes wrong on MIPS.

Thanks,
Jason

On Fri, Feb 3, 2017 at 8:12 PM, Alexander Kabaev

>> wrote:

On Wed, 1 Feb 2017 03:32:49 + (UTC)
"Jason A. Harmening"  wrote:

> Author: jah
> Date: Wed Feb  1 03:32:49 2017
> New Revision: 313037
> URL: https://svnweb.freebsd.org/changeset/base/313037

>
>
> Log:
>   Implement get_pcpu() for the remaining architectures and
use it to
>   replace pcpu_find(curcpu) in MI code.
>
> Modified:
>   head/sys/amd64/include/pcpu.h
>   head/sys/kern/kern_rmlock.c
>   head/sys/mips/include/pcpu.h
>   head/sys/net/netisr.c
>   head/sys/powerpc/include/cpufunc.h
>   head/sys/powerpc/include/pcpu.h
>   head/sys/sparc64/include/pcpu.h
>

Hi,

this change was not reviewed nor testing was thought for all
architectures it touches. The change happens to break MIPS quite
thoroughly, since MIPS is using different pointers when
accessing PCPU
area locally and when doing iterations using cpu_to_cpuid
array. I
therefore officially am requesting this change to be
reverted until
reasonable solution is found to unbreak architectures that
use wired
TLBs to access local per-CPU data.

--
Alexander Kabaev






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


Re: svn commit: r308725 - in head/sys: conf dev/hyperv/pcib modules/hyperv/pcib

2016-11-17 Thread Andreas Tobler

On 16.11.16 10:25, Dexuan Cui wrote:

Author: dexuan
Date: Wed Nov 16 09:25:00 2016
New Revision: 308725
URL: https://svnweb.freebsd.org/changeset/base/308725



Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Wed Nov 16 09:08:32 2016(r308724)
+++ head/sys/conf/files.amd64   Wed Nov 16 09:25:00 2016(r308725)
@@ -292,6 +292,7 @@ dev/hwpmc/hwpmc_uncore.coptionalhwpmc
 dev/hwpmc/hwpmc_piv.c  optionalhwpmc
 dev/hwpmc/hwpmc_tsc.c  optionalhwpmc
 dev/hwpmc/hwpmc_x86.c  optionalhwpmc
+dev/hyperv/pcib/pcib.c optionalhyperv


I'd say, for both, files.amd64 and files.i386

-dev/hyperv/pcib/pcib.c optionalhyperv
+dev/hyperv/pcib/pcib.c optionalhyperv pci

Fixes the build on trunk.

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


Re: svn commit: r306272 - head/sys/sys

2016-09-23 Thread Andreas Tobler

On 23.09.16 22:03, Mateusz Guzik wrote:

On Fri, Sep 23, 2016 at 09:59:32PM +0200, Andreas Tobler wrote:

On 23.09.16 18:47, Mateusz Guzik wrote:

Author: mjg
Date: Fri Sep 23 16:47:12 2016
New Revision: 306272
URL: https://svnweb.freebsd.org/changeset/base/306272

Log:
 fd: hide fd_modified under CAPABILITIES

 It has no use without it and is now less error prone.

Modified:
 head/sys/sys/filedesc.h

Modified: head/sys/sys/filedesc.h
==
--- head/sys/sys/filedesc.h Fri Sep 23 16:22:03 2016(r306271)
+++ head/sys/sys/filedesc.h Fri Sep 23 16:47:12 2016(r306272)
@@ -229,12 +229,14 @@ fdeget_locked(struct filedesc *fdp, int
return (fde);
}

+#ifdef CAPABILITIES
static __inline bool
fd_modified(struct filedesc *fdp, int fd, seq_t seq)
{

return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq));
}
+#endif

/* cdir/rdir/jdir manipulation functions. */
voidpwd_chdir(struct thread *td, struct vnode *vp);


I think this breaks kernel builds:

/usr/src/sys/modules/cloudabi/../../compat/cloudabi/cloudabi_fd.c:482:14:
error: implicit declaration of function 'fd_modified' is invalid in
C99 [-Werror,-Wimplicit-function-declaration]
modified = fd_modified(fdp, uap->fd, seq);
   ^
1 error generated.
*** [cloudabi_fd.o] Error code 1



Ye indeed, I hacked up a fix:
https://people.freebsd.org/~mjg/patches/cloudabi-fd_modified.diff

if ed@ does not respond soon acking the patch, I'll temporarily reviert
this change.



Thanks, I reverted locally to continue my work. So no hurry.

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


Re: svn commit: r306272 - head/sys/sys

2016-09-23 Thread Andreas Tobler

On 23.09.16 18:47, Mateusz Guzik wrote:

Author: mjg
Date: Fri Sep 23 16:47:12 2016
New Revision: 306272
URL: https://svnweb.freebsd.org/changeset/base/306272

Log:
  fd: hide fd_modified under CAPABILITIES

  It has no use without it and is now less error prone.

Modified:
  head/sys/sys/filedesc.h

Modified: head/sys/sys/filedesc.h
==
--- head/sys/sys/filedesc.h Fri Sep 23 16:22:03 2016(r306271)
+++ head/sys/sys/filedesc.h Fri Sep 23 16:47:12 2016(r306272)
@@ -229,12 +229,14 @@ fdeget_locked(struct filedesc *fdp, int
return (fde);
 }

+#ifdef CAPABILITIES
 static __inline bool
 fd_modified(struct filedesc *fdp, int fd, seq_t seq)
 {

return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq));
 }
+#endif

 /* cdir/rdir/jdir manipulation functions. */
 void   pwd_chdir(struct thread *td, struct vnode *vp);


I think this breaks kernel builds:

/usr/src/sys/modules/cloudabi/../../compat/cloudabi/cloudabi_fd.c:482:14: 
error: implicit declaration of function 'fd_modified' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]

modified = fd_modified(fdp, uap->fd, seq);
   ^
1 error generated.
*** [cloudabi_fd.o] Error code 1

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


Re: svn commit: r300943 - in head: . lib/libc++ lib/libcxxrt share/mk

2016-06-12 Thread Andreas Tobler

Hi Bryan,

On 29.05.16 08:20, Bryan Drewery wrote:

Author: bdrewery
Date: Sun May 29 06:20:15 2016
New Revision: 300943
URL: https://svnweb.freebsd.org/changeset/base/300943

Log:
  GCC External: Revert r300886, r300904, r300917, r300918

  The fix in r300873 is mostly enough.  A fix for lib32 will be
  committed.separately.


Did this commit already happen?

I still suffer a broken buildworld on powerpc64 for 32-bit with internal 
tools.


Unknown option -std=c++11...

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


svn commit: r293062 - head/sys/powerpc/aim

2016-01-02 Thread Andreas Tobler
Author: andreast
Date: Sat Jan  2 22:04:37 2016
New Revision: 293062
URL: https://svnweb.freebsd.org/changeset/base/293062

Log:
  Fix booting of 32-bit kernels on 64-bit G5 hardware.
  
  For rs6000, most memory insns and addi/addis do not allow GPR0 for RA
  (they use literal zero there instead). So use a 'b' constraint to make
  sure to have a base register other than GPR0.
  GCC-4.7 and up handles this with allocating r9 instead of r0.

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

Modified: head/sys/powerpc/aim/mp_cpudep.c
==
--- head/sys/powerpc/aim/mp_cpudep.cSat Jan  2 22:00:52 2016
(r293061)
+++ head/sys/powerpc/aim/mp_cpudep.cSat Jan  2 22:04:37 2016
(r293062)
@@ -77,10 +77,10 @@ cpudep_ap_early_bootstrap(void)
 #else
__asm __volatile("ld %0, 16(%2); sync; isync;   \
mtspr %1, %0; sync; isync;"
-   : "=r"(reg) : "K"(SPR_HID4), "r"(bsp_state));
+   : "=r"(reg) : "K"(SPR_HID4), "b"(bsp_state));
__asm __volatile("ld %0, 24(%2); sync; isync;   \
mtspr %1, %0; sync; isync;"
-   : "=r"(reg) : "K"(SPR_HID5), "r"(bsp_state));
+   : "=r"(reg) : "K"(SPR_HID5), "b"(bsp_state));
 #endif
powerpc_sync();
break;
@@ -324,10 +324,10 @@ cpudep_ap_setup()
mfspr   %0, %1; mfspr   %0, %1; mfspr   %0, %1; \
mfspr   %0, %1; mfspr   %0, %1; mfspr   %0, %1; \
sync; isync" 
-   : "=r"(reg) : "K"(SPR_HID0), "r"(bsp_state));
+   : "=r"(reg) : "K"(SPR_HID0), "b"(bsp_state));
__asm __volatile("ld %0, 8(%2); sync; isync;\
mtspr %1, %0; mtspr %1, %0; sync; isync"
-   : "=r"(reg) : "K"(SPR_HID1), "r"(bsp_state));
+   : "=r"(reg) : "K"(SPR_HID1), "b"(bsp_state));
#endif
 
powerpc_sync();
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r292627 - head/contrib/gcc/config/rs6000

2015-12-22 Thread Andreas Tobler
Author: andreast
Date: Tue Dec 22 21:26:50 2015
New Revision: 292627
URL: https://svnweb.freebsd.org/changeset/base/292627

Log:
  Silence a boring warning.

Modified:
  head/contrib/gcc/config/rs6000/sysv4.h

Modified: head/contrib/gcc/config/rs6000/sysv4.h
==
--- head/contrib/gcc/config/rs6000/sysv4.h  Tue Dec 22 21:07:33 2015
(r292626)
+++ head/contrib/gcc/config/rs6000/sysv4.h  Tue Dec 22 21:26:50 2015
(r292627)
@@ -282,7 +282,9 @@ do {
\
 #define RESTORE_FP_SUFFIX "_l"
 
 /* Type used for ptrdiff_t, as a string used in a declaration.  */
+#ifndef PTRDIFF_TYPE
 #define PTRDIFF_TYPE "int"
+#endif
 
 /* Type used for wchar_t, as a string used in a declaration.  */
 /* Override svr4.h definition.  */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290557 - head/sys/dev/ofw

2015-11-08 Thread Andreas Tobler
Author: andreast
Date: Sun Nov  8 21:06:51 2015
New Revision: 290557
URL: https://svnweb.freebsd.org/changeset/base/290557

Log:
  Improve r290373, do a runtime check rather than a compile time switch. I
  learned that the Power8 and the PS3 have a mix of OFW and FDT. Both have AIM
  defined. But currently they are not affected. They have no I2C devices under
  OFW.
  
  This version was tested on a Quad G5 and build tested for armv6*.
  
  Discussed withnwhitehorn@
  Reviewed by:  ian@

Modified:
  head/sys/dev/ofw/ofw_iicbus.c

Modified: head/sys/dev/ofw/ofw_iicbus.c
==
--- head/sys/dev/ofw/ofw_iicbus.c   Sun Nov  8 20:56:04 2015
(r290556)
+++ head/sys/dev/ofw/ofw_iicbus.c   Sun Nov  8 21:06:51 2015
(r290557)
@@ -101,9 +101,13 @@ ofw_iicbus_attach(device_t dev)
 {
struct iicbus_softc *sc = IICBUS_SOFTC(dev);
struct ofw_iicbus_devinfo *dinfo;
-   phandle_t child, node;
+   phandle_t child, node, root;
pcell_t freq, paddr;
device_t childdev;
+   ssize_t compatlen;
+   char compat[255];
+   char *curstr;
+   u_int iic_addr_8bit = 0;
 
sc->dev = dev;
mtx_init(>lock, "iicbus", NULL, MTX_DEF);
@@ -125,6 +129,21 @@ ofw_iicbus_attach(device_t dev)
bus_enumerate_hinted_children(dev);
 
/*
+* Check if we're running on a PowerMac, needed for the I2C
+* address below.
+*/
+   root = OF_peer(0);
+   compatlen = OF_getprop(root, "compatible", compat,
+   sizeof(compat));
+   if (compatlen != -1) {
+   for (curstr = compat; curstr < compat + compatlen;
+   curstr += strlen(curstr) + 1) {
+   if (strncmp(curstr, "MacRISC", 7) == 0)
+   iic_addr_8bit = 1;
+   }
+   }
+
+   /*
 * Attach those children represented in the device tree.
 */
for (child = OF_child(node); child != 0; child = OF_peer(child)) {
@@ -153,11 +172,11 @@ ofw_iicbus_attach(device_t dev)
 * Linux FDT data contains 7-bit values, so shift them up to
 * 8-bit format.
 */
-#ifdef AIM
-   dinfo->opd_dinfo.addr = paddr;
-#else
-   dinfo->opd_dinfo.addr = paddr << 1;
-#endif
+   if (iic_addr_8bit)
+   dinfo->opd_dinfo.addr = paddr;
+   else
+   dinfo->opd_dinfo.addr = paddr << 1;
+
if (ofw_bus_gen_setup_devinfo(>opd_obdinfo, child) !=
0) {
free(dinfo, M_DEVBUF);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r290373 - head/sys/dev/ofw

2015-11-05 Thread Andreas Tobler

On 05.11.15 22:47, Nathan Whitehorn wrote:

On 11/05/15 13:24, Andreas Tobler wrote:

Hi Nathan, Warner,

first, I had the feeling that I have to provide a fast solution which
makes PowerMacs usable again. I am aware that the committed version
doesn't win a prize.


Thank you!


Also, I didn't know that we have AIM & FDT, Nathan which one?


PS3 and POWER8 systems are AIM+FDT. Neither of these have I2C busses in
their FDTs, so the impact is low for now, but it makes me a little nervous.


Ah, maybe I have luck to convince my son to handover the PS3 to me. He 
has a PS4 too...


About the POWER8, well, far away from my budget.


On 05.11.15 21:26, Warner Losh wrote:

I'd suggested that this be driven off a global quirk like

u_int fdt_quirks;
#define FDT_QUIRK_8BIT_IIC_ADDR 1
...


In openfirm.h?


I'd really prefer an explicit platform check in ofw_iicbus.c for this by
looking at the compatible property of the root node. If this ever comes
up on another system, we can modify it, but I think it won't.


Attached a working proposal.
It does work with the Apple 8-bit I2C addresses and the fan regulation 
works.


But I need a kind soul to test this on an arm board with Linux based FDT 
I2C devices which have 7-bit addresses.


Ian?

Thanks in advance,
Andreas


if (fdt_quirks & FDT_QUIRK_8BIT_IIC_ADDR)
dinfo->opd_dinfo.addr = paddr;
else
dinfo->opd_dinfo.addr = paddr << 1;

And the platform code, whatever that means, would set it when it "knows"
this is the case.


If I get that right, I'd have to set the fdt_quirk in each I2C parent,
like kiic.c and smu.c?


On Thu, Nov 5, 2015 at 12:56 PM, Nathan Whitehorn
<nwhiteh...@freebsd.org <mailto:nwhiteh...@freebsd.org>> wrote:

 I'm not sure this is the best way to do this: we have AIM systems
 that use FDT, for example. Can we make it a quirk in the host-bus
 driver? Or do a run-time check to see if the root node has MacRISC
 in its compatible property?


The 'compatible property' approach would be limited/isolated to one
file (ofw_iicbus.c) in comparison to the quirk approach where I'd have
to adapt at least (known now) four files.

I can go either way, just my thoughts.



Index: sys/dev/ofw/ofw_iicbus.c
===
--- sys/dev/ofw/ofw_iicbus.c(revision 290373)
+++ sys/dev/ofw/ofw_iicbus.c(working copy)
@@ -101,9 +101,13 @@
 {
struct iicbus_softc *sc = IICBUS_SOFTC(dev);
struct ofw_iicbus_devinfo *dinfo;
-   phandle_t child, node;
+   phandle_t child, node, root;
pcell_t freq, paddr;
device_t childdev;
+   ssize_t compatlen;
+   char compat[255];
+   char *curstr;
+   u_int iic_addr_8bit = 0;
 
sc->dev = dev;
mtx_init(>lock, "iicbus", NULL, MTX_DEF);
@@ -125,6 +129,21 @@
bus_enumerate_hinted_children(dev);
 
/*
+* Check if we're running on a PowerMac, needed for the I2C
+* address below.
+*/
+   root = OF_peer(0);
+   compatlen = OF_getprop(root, "compatible", compat,
+   sizeof(compat));
+   if (compatlen != -1) {
+   for (curstr = compat; curstr < compat + compatlen;
+   curstr += strlen(curstr) + 1) {
+   if (strncmp(curstr, "MacRISC", 7) == 0)
+   iic_addr_8bit = 1;
+   }
+   }
+
+   /*
 * Attach those children represented in the device tree.
 */
for (child = OF_child(node); child != 0; child = OF_peer(child)) {
@@ -153,11 +172,11 @@
 * Linux FDT data contains 7-bit values, so shift them up to
 * 8-bit format.
 */
-#ifdef AIM
-   dinfo->opd_dinfo.addr = paddr;
-#else
-   dinfo->opd_dinfo.addr = paddr << 1;
-#endif
+   if (iic_addr_8bit)
+   dinfo->opd_dinfo.addr = paddr;
+   else
+   dinfo->opd_dinfo.addr = paddr << 1;
+
if (ofw_bus_gen_setup_devinfo(>opd_obdinfo, child) !=
0) {
free(dinfo, M_DEVBUF);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r290373 - head/sys/dev/ofw

2015-11-05 Thread Andreas Tobler

Hi Nathan, Warner,

first, I had the feeling that I have to provide a fast solution which 
makes PowerMacs usable again. I am aware that the committed version 
doesn't win a prize.


Also, I didn't know that we have AIM & FDT, Nathan which one?

On 05.11.15 21:26, Warner Losh wrote:

I'd suggested that this be driven off a global quirk like

u_int fdt_quirks;
#define FDT_QUIRK_8BIT_IIC_ADDR 1
...


In openfirm.h?


if (fdt_quirks & FDT_QUIRK_8BIT_IIC_ADDR)
dinfo->opd_dinfo.addr = paddr;
else
dinfo->opd_dinfo.addr = paddr << 1;

And the platform code, whatever that means, would set it when it "knows"
this is the case.


If I get that right, I'd have to set the fdt_quirk in each I2C parent, 
like kiic.c and smu.c?



On Thu, Nov 5, 2015 at 12:56 PM, Nathan Whitehorn
> wrote:

I'm not sure this is the best way to do this: we have AIM systems
that use FDT, for example. Can we make it a quirk in the host-bus
driver? Or do a run-time check to see if the root node has MacRISC
in its compatible property?


The 'compatible property' approach would be limited/isolated to one file 
(ofw_iicbus.c) in comparison to the quirk approach where I'd have to 
adapt at least (known now) four files.


I can go either way, just my thoughts.

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


svn commit: r290373 - head/sys/dev/ofw

2015-11-04 Thread Andreas Tobler
Author: andreast
Date: Wed Nov  4 22:46:30 2015
New Revision: 290373
URL: https://svnweb.freebsd.org/changeset/base/290373

Log:
  Add a compile time switch to distinguish between 7-bit and 8-bit I2C address
  usage. The comment in the code should explain the situation.
  
  Discussed with:ian@

Modified:
  head/sys/dev/ofw/ofw_iicbus.c

Modified: head/sys/dev/ofw/ofw_iicbus.c
==
--- head/sys/dev/ofw/ofw_iicbus.c   Wed Nov  4 19:09:42 2015
(r290372)
+++ head/sys/dev/ofw/ofw_iicbus.c   Wed Nov  4 22:46:30 2015
(r290373)
@@ -148,10 +148,16 @@ ofw_iicbus_attach(device_t dev)
if (dinfo == NULL)
continue;
/*
-* OFW uses 7-bit I2C address format (see ePAPR),
-* but system expect 8-bit.
+* FreeBSD drivers expect I2C addresses to be expressed as
+* 8-bit values.  Apple OFW data contains 8-bit values, but
+* Linux FDT data contains 7-bit values, so shift them up to
+* 8-bit format.
 */
+#ifdef AIM
+   dinfo->opd_dinfo.addr = paddr;
+#else
dinfo->opd_dinfo.addr = paddr << 1;
+#endif
if (ofw_bus_gen_setup_devinfo(>opd_obdinfo, child) !=
0) {
free(dinfo, M_DEVBUF);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282320 - head/sys/boot/sparc64/loader

2015-05-01 Thread Andreas Tobler
Author: andreast
Date: Fri May  1 20:35:09 2015
New Revision: 282320
URL: https://svnweb.freebsd.org/changeset/base/282320

Log:
  Fix the loader for sparc64.
  The commit from r279799 missed the adaptation of md_load in
  sparc64/loader/main.c. This resulted in Memory Address Align issues at the
  early boot stage.
  
  Tested on a netbooted Fire 120.

Modified:
  head/sys/boot/sparc64/loader/main.c

Modified: head/sys/boot/sparc64/loader/main.c
==
--- head/sys/boot/sparc64/loader/main.c Fri May  1 20:25:47 2015
(r282319)
+++ head/sys/boot/sparc64/loader/main.c Fri May  1 20:35:09 2015
(r282320)
@@ -101,7 +101,7 @@ static inline u_long itlb_get_data_sun4u
 static int itlb_enter_sun4u(u_int, u_long data, vm_offset_t);
 static vm_offset_t itlb_va_to_pa_sun4u(vm_offset_t);
 static void itlb_relocate_locked0_sun4u(void);
-extern vm_offset_t md_load(char *, vm_offset_t *);
+extern vm_offset_t md_load(char *, vm_offset_t *, vm_offset_t *);
 static int sparc64_autoload(void);
 static ssize_t sparc64_readin(const int, vm_offset_t, const size_t);
 static ssize_t sparc64_copyin(const void *, vm_offset_t, size_t);
@@ -340,7 +340,7 @@ static int
 __elfN(exec)(struct preloaded_file *fp)
 {
struct file_metadata *fmp;
-   vm_offset_t mdp;
+   vm_offset_t mdp, dtbp;
Elf_Addr entry;
Elf_Ehdr *e;
int error;
@@ -349,7 +349,7 @@ __elfN(exec)(struct preloaded_file *fp)
return (EFTYPE);
e = (Elf_Ehdr *)fmp-md_data;
 
-   if ((error = md_load(fp-f_args, mdp)) != 0)
+   if ((error = md_load(fp-f_args, mdp, dtbp)) != 0)
return (error);
 
printf(jumping to kernel entry at %#lx.\n, e-e_entry);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r281083 - head/sys/modules/i2c/iicbb

2015-04-04 Thread Andreas Tobler
Author: andreast
Date: Sat Apr  4 20:30:20 2015
New Revision: 281083
URL: https://svnweb.freebsd.org/changeset/base/281083

Log:
  Fix build race on armv6* and powerpc*.
  Tested with cross builds amd64 - armv6(hf) and powerpc(64).
  
  Suggested by: andrew@

Modified:
  head/sys/modules/i2c/iicbb/Makefile

Modified: head/sys/modules/i2c/iicbb/Makefile
==
--- head/sys/modules/i2c/iicbb/Makefile Sat Apr  4 20:22:12 2015
(r281082)
+++ head/sys/modules/i2c/iicbb/Makefile Sat Apr  4 20:30:20 2015
(r281083)
@@ -1,8 +1,11 @@
 # $FreeBSD$
 
 .PATH: ${.CURDIR}/../../../dev/iicbus
+.if ${MACHINE_CPUARCH} == arm || ${MACHINE_CPUARCH} == powerpc
+ofw_bus_if=ofw_bus_if.h
+.endif
 KMOD   = iicbb
 SRCS   = device_if.h bus_if.h iicbus_if.h \
- iicbb_if.h iicbb_if.c iicbb.c opt_platform.h
+ iicbb_if.h iicbb_if.c iicbb.c ${ofw_bus_if} opt_platform.h
 
 .include bsd.kmod.mk
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r279330 - head/bin/sh

2015-02-26 Thread Andreas Tobler

On 26.02.15 21:59, Nathan Whitehorn wrote:

Author: nwhitehorn
Date: Thu Feb 26 20:59:18 2015
New Revision: 279330
URL: https://svnweb.freebsd.org/changeset/base/279330

Log:
   Fix unitialized variable that broke sh on PowerPC starting with r278826.


Thanks Nathan!

Andreas

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


svn commit: r275683 - head/sys/powerpc/aim

2014-12-10 Thread Andreas Tobler
Author: andreast
Date: Wed Dec 10 18:13:14 2014
New Revision: 275683
URL: https://svnweb.freebsd.org/changeset/base/275683

Log:
  Fix build for powerpc(32|64) kernels.

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

Modified: head/sys/powerpc/aim/trap.c
==
--- head/sys/powerpc/aim/trap.c Wed Dec 10 14:50:57 2014(r275682)
+++ head/sys/powerpc/aim/trap.c Wed Dec 10 18:13:14 2014(r275683)
@@ -46,6 +46,7 @@ __FBSDID($FreeBSD$);
 #include sys/syscall.h
 #include sys/sysent.h
 #include sys/systm.h
+#include sys/kernel.h
 #include sys/uio.h
 #include sys/signalvar.h
 #include sys/vmmeter.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r275686 - head/sys/powerpc/booke

2014-12-10 Thread Andreas Tobler
Author: andreast
Date: Wed Dec 10 20:23:19 2014
New Revision: 275686
URL: https://svnweb.freebsd.org/changeset/base/275686

Log:
  Fix kernel build for booke.

Modified:
  head/sys/powerpc/booke/trap.c

Modified: head/sys/powerpc/booke/trap.c
==
--- head/sys/powerpc/booke/trap.c   Wed Dec 10 19:24:42 2014
(r275685)
+++ head/sys/powerpc/booke/trap.c   Wed Dec 10 20:23:19 2014
(r275686)
@@ -48,6 +48,7 @@ __FBSDID($FreeBSD$);
 #include sys/syscall.h
 #include sys/sysent.h
 #include sys/systm.h
+#include sys/kernel.h
 #include sys/uio.h
 #include sys/signalvar.h
 #include sys/vmmeter.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r272209 - in head/sys/arm: arm include

2014-09-29 Thread Andreas Tobler

Hi Andrew,

On 27.09.14 11:57, Andrew Turner wrote:

Author: andrew
Date: Sat Sep 27 09:57:34 2014
New Revision: 272209
URL: http://svnweb.freebsd.org/changeset/base/272209

Log:
   Add machine/sysreg.h to simplify accessing the system control coprocessor
   registers and use it in the ARMv7 CPU functions.

   The sysreg.h file has been checked by hand, however it may contain errors
   with the comments on when a register was first introduced. The ARMv7 cpu
   functions have been checked by compiling both the previous and this version
   and comparing the md5 of the object files.

   Submitted by:Svatopluk Kraus onwahe at gmail.com
   Submitted by:Michal Meloun meloun at miracle.cz
   Reviewed by: ian, rpaulo
   Differential Revision: https://reviews.freebsd.org/D795

Added:
   head/sys/arm/include/sysreg.h   (contents, props changed)


This one breaks kernel build with gcc-4.2.1.

__ARM_ARCH not defined. On gcc-4.2.1 there is no __ARM_ARCH builtin.
Later gcc do have it.

The include below fixes the build.

Andreas

Index: sys/arm/arm/cpufunc_asm_armv7.S
===
--- sys/arm/arm/cpufunc_asm_armv7.S (revision 272282)
+++ sys/arm/arm/cpufunc_asm_armv7.S (working copy)
@@ -33,6 +33,7 @@
 #include machine/asm.h
 __FBSDID($FreeBSD$);

+#include machine/acle-compat.h
 #include machine/sysreg.h

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


svn commit: r270829 - head/sys/kern

2014-08-29 Thread Andreas Tobler
Author: andreast
Date: Fri Aug 29 21:50:32 2014
New Revision: 270829
URL: http://svnweb.freebsd.org/changeset/base/270829

Log:
  Rename shm_dict_init to shm_init to fix a compiler warning.
  
  Reviewed by:  jhb

Modified:
  head/sys/kern/uipc_shm.c

Modified: head/sys/kern/uipc_shm.c
==
--- head/sys/kern/uipc_shm.cFri Aug 29 21:25:47 2014(r270828)
+++ head/sys/kern/uipc_shm.cFri Aug 29 21:50:32 2014(r270829)
@@ -109,7 +109,7 @@ static dev_t shm_dev_ino;
 
 static int shm_access(struct shmfd *shmfd, struct ucred *ucred, int flags);
 static struct shmfd *shm_alloc(struct ucred *ucred, mode_t mode);
-static voidshm_dict_init(void *arg);
+static voidshm_init(void *arg);
 static voidshm_drop(struct shmfd *shmfd);
 static struct shmfd *shm_hold(struct shmfd *shmfd);
 static voidshm_insert(char *path, Fnv32_t fnv, struct shmfd *shmfd);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-07-31 Thread Andreas Tobler

On 31.07.14 06:35, Alan Cox wrote:

On 07/30/2014 16:26, Andreas Tobler wrote:

On 30.07.14 23:17, Alan Cox wrote:

On 07/30/2014 15:15, Andreas Tobler wrote:

On 30.07.14 21:54, Alan Cox wrote:

On 07/30/2014 14:46, Alan Cox wrote:

On 07/30/2014 13:58, Andreas Tobler wrote:

Hi Alan,

On 26.07.14 20:10, Alan Cox wrote:

Author: alc
Date: Sat Jul 26 18:10:18 2014
New Revision: 269134
URL: http://svnweb.freebsd.org/changeset/base/269134

Log:
  When unwiring a region of an address space, do not assume that
the
  underlying physical pages are mapped by the pmap.  If, for
example, the
  application has performed an mprotect(..., PROT_NONE) on
any part
of the
  wired region, then those pages will no longer be mapped by the
pmap.
  So, using the pmap to lookup the wired pages in order to
unwire them
  doesn't always work, and when it doesn't work wired pages are
leaked.

  To avoid the leak, introduce and use a new function
vm_object_unwire()
  that locates the wired pages by traversing the object and its
backing
  objects.

  At the same time, switch from using pmap_change_wiring() to
the
recently
  introduced function pmap_unwire() for unwiring the region's
mappings.
  pmap_unwire() is faster, because it operates a range of
virtual
addresses
  rather than a single virtual page at a time.  Moreover, by
operating on
  a range, it is superpage friendly.  It doesn't waste time
performing
  unnecessary demotions.

  Reported by:markj
  Reviewed by:kib
  Tested by:pho, jmg (arm)
  Sponsored by:EMC / Isilon Storage Division

This commit brings my 32- and 64-bit PowerMac's into panic.
Unfortunately I'm not able to give you a backtrace in the form of a
textdump nor of a core dump.

The only thing I have is this picture:

http://people.freebsd.org/~andreast/r269134_panic.jpg

Exactly this revision gives a panic and breaks the textdump/coredump
facility.

How can I help debugging?


It appears to me that moea64_pvo_enter() had a pre-existing bug that
got
tickled by this change.  Specifically, moea64_pvo_enter() doesn't set
the PVO_WIRED flag when an unwired mapping already exists.  It just
returns with the mapping still in an unwired state.  Consequently,
when
pmap_unwire() finally runs, it doesn't find a wired mapping.

Try this:

Index: powerpc/aim/mmu_oea64.c
===
--- powerpc/aim/mmu_oea64.c (revision 269127)
+++ powerpc/aim/mmu_oea64.c (working copy)
@@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm,
uma_zone_t
   if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
   if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN)
== pa 
   (pvo-pvo_pte.lpte.pte_lo 
(LPTE_NOEXEC |
LPTE_PP))
-   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
+   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
+   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED)) {
   if (!(pvo-pvo_pte.lpte.pte_hi 
LPTE_VALID)) {
   /* Re-insert if spilled */
   i = MOEA64_PTE_INSERT(mmu,
ptegidx,



The new conditional test needs to be inverted.  Try this instead:

Index: powerpc/aim/mmu_oea64.c
===
--- powerpc/aim/mmu_oea64.c (revision 269127)
+++ powerpc/aim/mmu_oea64.c (working copy)
@@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm,
uma_zone_t
   if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
   if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN)
== pa 
   (pvo-pvo_pte.lpte.pte_lo 
(LPTE_NOEXEC |
LPTE_PP))
-   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
+   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
+   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED) ==
0) {
   if (!(pvo-pvo_pte.lpte.pte_hi 
LPTE_VALID)) {
   /* Re-insert if spilled */
   i = MOEA64_PTE_INSERT(mmu,
ptegidx,




The panic stays, but the message is different:

panic: moea64_pvo_to_pte: pvo 0x10147ea0 has invalid pte 0xb341180 in
moea64_pteg_table but valid in pvo.



My attempted fix is doing something else wrong.  Do you have a stack
trace?


iPhone sei Dank:

http://people.freebsd.org/~andreast/r269134-1_panic.jpg


Ok, this patch should fix both the original panic and the new one.  They
are two distinct problems.


Yep, thank you!

Additionally I tried to adapt the 32-bit path and successfully booted 
the below, ok?


Again, thanks a lot!
Andreas

Index: powerpc/aim/mmu_oea.c
===
--- powerpc/aim/mmu_oea.c   (revision 269326)
+++ powerpc/aim

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

2014-07-31 Thread Andreas Tobler

On 31.07.14 20:34, Alan Cox wrote:


Here is a better fix for the problem in moea64_pvo_enter().  The
original fix destroys and recreates the PTE in order to wire it.  This
new fix simply updates the PTE.

In the case of moea_pvo_enter(), there is also no need to destroy and
recreate the PTE.


Awesome! All with no runtime tests?

Nothing to say beside it works, on PowerMac G5 (64-bit)(2/4-CPU's) and 
MacMini G4 (32-bit)(1-CPU).


Thank you again!
Andreas

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


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

2014-07-30 Thread Andreas Tobler

Hi Alan,

On 26.07.14 20:10, Alan Cox wrote:

Author: alc
Date: Sat Jul 26 18:10:18 2014
New Revision: 269134
URL: http://svnweb.freebsd.org/changeset/base/269134

Log:
   When unwiring a region of an address space, do not assume that the
   underlying physical pages are mapped by the pmap.  If, for example, the
   application has performed an mprotect(..., PROT_NONE) on any part of the
   wired region, then those pages will no longer be mapped by the pmap.
   So, using the pmap to lookup the wired pages in order to unwire them
   doesn't always work, and when it doesn't work wired pages are leaked.

   To avoid the leak, introduce and use a new function vm_object_unwire()
   that locates the wired pages by traversing the object and its backing
   objects.

   At the same time, switch from using pmap_change_wiring() to the recently
   introduced function pmap_unwire() for unwiring the region's mappings.
   pmap_unwire() is faster, because it operates a range of virtual addresses
   rather than a single virtual page at a time.  Moreover, by operating on
   a range, it is superpage friendly.  It doesn't waste time performing
   unnecessary demotions.

   Reported by: markj
   Reviewed by: kib
   Tested by:   pho, jmg (arm)
   Sponsored by:EMC / Isilon Storage Division


This commit brings my 32- and 64-bit PowerMac's into panic.
Unfortunately I'm not able to give you a backtrace in the form of a 
textdump nor of a core dump.


The only thing I have is this picture:

http://people.freebsd.org/~andreast/r269134_panic.jpg

Exactly this revision gives a panic and breaks the textdump/coredump 
facility.


How can I help debugging?

TIA,
Andreas


Modified:
   head/sys/vm/vm_extern.h
   head/sys/vm/vm_fault.c
   head/sys/vm/vm_map.c
   head/sys/vm/vm_object.c
   head/sys/vm/vm_object.h

Modified: head/sys/vm/vm_extern.h
==
--- head/sys/vm/vm_extern.h Sat Jul 26 17:59:25 2014(r269133)
+++ head/sys/vm/vm_extern.h Sat Jul 26 18:10:18 2014(r269134)
@@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse
  int fault_flags, vm_page_t *m_hold);
  int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, vm_size_t len,
  vm_prot_t prot, vm_page_t *ma, int max_count);
-void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
  int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
  int vm_forkproc(struct thread *, struct proc *, struct thread *, struct 
vmspace *, int);
  void vm_waitproc(struct proc *);

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Sat Jul 26 17:59:25 2014(r269133)
+++ head/sys/vm/vm_fault.c  Sat Jul 26 18:10:18 2014(r269134)
@@ -106,6 +106,7 @@ __FBSDID($FreeBSD$);
  #define PFFOR 4

  static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t *, int *);
+static void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);

  #define   VM_FAULT_READ_BEHIND8
  #define   VM_FAULT_READ_MAX   (1 + VM_FAULT_READ_AHEAD_MAX)
@@ -1186,7 +1187,7 @@ vm_fault_wire(vm_map_t map, vm_offset_t
   *
   *Unwire a range of virtual addresses in a map.
   */
-void
+static void
  vm_fault_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end,
  boolean_t fictitious)
  {

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cSat Jul 26 17:59:25 2014(r269133)
+++ head/sys/vm/vm_map.cSat Jul 26 18:10:18 2014(r269134)
@@ -132,6 +132,7 @@ static void _vm_map_init(vm_map_t map, p
  vm_offset_t max);
  static void vm_map_entry_deallocate(vm_map_entry_t entry, boolean_t 
system_map);
  static void vm_map_entry_dispose(vm_map_t map, vm_map_entry_t entry);
+static void vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry);
  #ifdef INVARIANTS
  static void vm_map_zdtor(void *mem, int size, void *arg);
  static void vmspace_zdtor(void *mem, int size, void *arg);
@@ -2393,16 +2394,10 @@ done:
(entry-eflags  MAP_ENTRY_USER_WIRED))) {
if (user_unwire)
entry-eflags = ~MAP_ENTRY_USER_WIRED;
-   entry-wired_count--;
-   if (entry-wired_count == 0) {
-   /*
-* Retain the map lock.
-*/
-   vm_fault_unwire(map, entry-start, entry-end,
-   entry-object.vm_object != NULL 
-   (entry-object.vm_object-flags 
-   OBJ_FICTITIOUS) != 0);
-   }
+   if (entry-wired_count == 1)
+   vm_map_entry_unwire(map, entry);
+   else

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

2014-07-30 Thread Andreas Tobler

On 30.07.14 21:54, Alan Cox wrote:

On 07/30/2014 14:46, Alan Cox wrote:

On 07/30/2014 13:58, Andreas Tobler wrote:

Hi Alan,

On 26.07.14 20:10, Alan Cox wrote:

Author: alc
Date: Sat Jul 26 18:10:18 2014
New Revision: 269134
URL: http://svnweb.freebsd.org/changeset/base/269134

Log:
When unwiring a region of an address space, do not assume that the
underlying physical pages are mapped by the pmap.  If, for
example, the
application has performed an mprotect(..., PROT_NONE) on any part
of the
wired region, then those pages will no longer be mapped by the pmap.
So, using the pmap to lookup the wired pages in order to unwire them
doesn't always work, and when it doesn't work wired pages are leaked.

To avoid the leak, introduce and use a new function
vm_object_unwire()
that locates the wired pages by traversing the object and its backing
objects.

At the same time, switch from using pmap_change_wiring() to the
recently
introduced function pmap_unwire() for unwiring the region's mappings.
pmap_unwire() is faster, because it operates a range of virtual
addresses
rather than a single virtual page at a time.  Moreover, by
operating on
a range, it is superpage friendly.  It doesn't waste time performing
unnecessary demotions.

Reported by:markj
Reviewed by:kib
Tested by:pho, jmg (arm)
Sponsored by:EMC / Isilon Storage Division

This commit brings my 32- and 64-bit PowerMac's into panic.
Unfortunately I'm not able to give you a backtrace in the form of a
textdump nor of a core dump.

The only thing I have is this picture:

http://people.freebsd.org/~andreast/r269134_panic.jpg

Exactly this revision gives a panic and breaks the textdump/coredump
facility.

How can I help debugging?


It appears to me that moea64_pvo_enter() had a pre-existing bug that got
tickled by this change.  Specifically, moea64_pvo_enter() doesn't set
the PVO_WIRED flag when an unwired mapping already exists.  It just
returns with the mapping still in an unwired state.  Consequently, when
pmap_unwire() finally runs, it doesn't find a wired mapping.

Try this:

Index: powerpc/aim/mmu_oea64.c
===
--- powerpc/aim/mmu_oea64.c (revision 269127)
+++ powerpc/aim/mmu_oea64.c (working copy)
@@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t
 if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
 if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN) == pa 
 (pvo-pvo_pte.lpte.pte_lo  (LPTE_NOEXEC |
LPTE_PP))
-   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
+   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
+   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED)) {
 if (!(pvo-pvo_pte.lpte.pte_hi 
LPTE_VALID)) {
 /* Re-insert if spilled */
 i = MOEA64_PTE_INSERT(mmu, ptegidx,



The new conditional test needs to be inverted.  Try this instead:

Index: powerpc/aim/mmu_oea64.c
===
--- powerpc/aim/mmu_oea64.c (revision 269127)
+++ powerpc/aim/mmu_oea64.c (working copy)
@@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t
 if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
 if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN) == pa 
 (pvo-pvo_pte.lpte.pte_lo  (LPTE_NOEXEC |
LPTE_PP))
-   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
+   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
+   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED) == 0) {
 if (!(pvo-pvo_pte.lpte.pte_hi 
LPTE_VALID)) {
 /* Re-insert if spilled */
 i = MOEA64_PTE_INSERT(mmu, ptegidx,




The panic stays, but the message is different:

panic: moea64_pvo_to_pte: pvo 0x10147ea0 has invalid pte 0xb341180 in 
moea64_pteg_table but valid in pvo.


Andreas

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


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

2014-07-30 Thread Andreas Tobler

On 30.07.14 23:17, Alan Cox wrote:

On 07/30/2014 15:15, Andreas Tobler wrote:

On 30.07.14 21:54, Alan Cox wrote:

On 07/30/2014 14:46, Alan Cox wrote:

On 07/30/2014 13:58, Andreas Tobler wrote:

Hi Alan,

On 26.07.14 20:10, Alan Cox wrote:

Author: alc
Date: Sat Jul 26 18:10:18 2014
New Revision: 269134
URL: http://svnweb.freebsd.org/changeset/base/269134

Log:
 When unwiring a region of an address space, do not assume that
the
 underlying physical pages are mapped by the pmap.  If, for
example, the
 application has performed an mprotect(..., PROT_NONE) on any part
of the
 wired region, then those pages will no longer be mapped by the
pmap.
 So, using the pmap to lookup the wired pages in order to
unwire them
 doesn't always work, and when it doesn't work wired pages are
leaked.

 To avoid the leak, introduce and use a new function
vm_object_unwire()
 that locates the wired pages by traversing the object and its
backing
 objects.

 At the same time, switch from using pmap_change_wiring() to the
recently
 introduced function pmap_unwire() for unwiring the region's
mappings.
 pmap_unwire() is faster, because it operates a range of virtual
addresses
 rather than a single virtual page at a time.  Moreover, by
operating on
 a range, it is superpage friendly.  It doesn't waste time
performing
 unnecessary demotions.

 Reported by:markj
 Reviewed by:kib
 Tested by:pho, jmg (arm)
 Sponsored by:EMC / Isilon Storage Division

This commit brings my 32- and 64-bit PowerMac's into panic.
Unfortunately I'm not able to give you a backtrace in the form of a
textdump nor of a core dump.

The only thing I have is this picture:

http://people.freebsd.org/~andreast/r269134_panic.jpg

Exactly this revision gives a panic and breaks the textdump/coredump
facility.

How can I help debugging?


It appears to me that moea64_pvo_enter() had a pre-existing bug that
got
tickled by this change.  Specifically, moea64_pvo_enter() doesn't set
the PVO_WIRED flag when an unwired mapping already exists.  It just
returns with the mapping still in an unwired state.  Consequently, when
pmap_unwire() finally runs, it doesn't find a wired mapping.

Try this:

Index: powerpc/aim/mmu_oea64.c
===
--- powerpc/aim/mmu_oea64.c (revision 269127)
+++ powerpc/aim/mmu_oea64.c (working copy)
@@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t
  if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
  if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN)
== pa 
  (pvo-pvo_pte.lpte.pte_lo  (LPTE_NOEXEC |
LPTE_PP))
-   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
+   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
+   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED)) {
  if (!(pvo-pvo_pte.lpte.pte_hi 
LPTE_VALID)) {
  /* Re-insert if spilled */
  i = MOEA64_PTE_INSERT(mmu,
ptegidx,



The new conditional test needs to be inverted.  Try this instead:

Index: powerpc/aim/mmu_oea64.c
===
--- powerpc/aim/mmu_oea64.c (revision 269127)
+++ powerpc/aim/mmu_oea64.c (working copy)
@@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t
  if (pvo-pvo_pmap == pm  PVO_VADDR(pvo) == va) {
  if ((pvo-pvo_pte.lpte.pte_lo  LPTE_RPGN)
== pa 
  (pvo-pvo_pte.lpte.pte_lo  (LPTE_NOEXEC |
LPTE_PP))
-   == (pte_lo  (LPTE_NOEXEC | LPTE_PP))) {
+   == (pte_lo  (LPTE_NOEXEC | LPTE_PP)) 
+   ((pvo-pvo_vaddr ^ flags)  PVO_WIRED) ==
0) {
  if (!(pvo-pvo_pte.lpte.pte_hi 
LPTE_VALID)) {
  /* Re-insert if spilled */
  i = MOEA64_PTE_INSERT(mmu,
ptegidx,




The panic stays, but the message is different:

panic: moea64_pvo_to_pte: pvo 0x10147ea0 has invalid pte 0xb341180 in
moea64_pteg_table but valid in pvo.



My attempted fix is doing something else wrong.  Do you have a stack trace?


iPhone sei Dank:

http://people.freebsd.org/~andreast/r269134-1_panic.jpg

Thanks!
Andreas


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


svn commit: r269143 - head/usr.bin/elfdump

2014-07-26 Thread Andreas Tobler
Author: andreast
Date: Sat Jul 26 19:44:45 2014
New Revision: 269143
URL: http://svnweb.freebsd.org/changeset/base/269143

Log:
  Further improvements on elfdump, to follow up r269092:
  
  - Add ARM specific section header types.
  - Add SHT_GNU_HASH section header type.
  - Improve reporting of undefined tags in d_tags.
  - Add DT_GNU_HASH tag.
  
  Reviewed by:  emaste

Modified:
  head/usr.bin/elfdump/elfdump.c

Modified: head/usr.bin/elfdump/elfdump.c
==
--- head/usr.bin/elfdump/elfdump.c  Sat Jul 26 19:27:34 2014
(r269142)
+++ head/usr.bin/elfdump/elfdump.c  Sat Jul 26 19:44:45 2014
(r269143)
@@ -167,7 +167,10 @@ static int elf64_offsets[] = {
 
 /* http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#tag_encodings */
 static const char *
-d_tags(u_int64_t tag) {
+d_tags(u_int64_t tag)
+{
+   static char unknown_tag[48];
+
switch (tag) {
case 0: return DT_NULL;
case 1: return DT_NEEDED;
@@ -215,6 +218,7 @@ d_tags(u_int64_t tag) {
case 0x6dfe: return DT_SYMINSZ;
case 0x6dff: return DT_SYMINENT (DT_VALRNGHI);
case 0x6e00: return DT_ADDRRNGLO;
+   case 0x6ef5: return DT_GNU_HASH;
case 0x6ef8: return DT_GNU_CONFLICT;
case 0x6ef9: return DT_GNU_LIBLIST;
case 0x6efa: return DT_SUNW_CONFIG;
@@ -236,8 +240,10 @@ d_tags(u_int64_t tag) {
case 0x7ffd: return DT_SUNW_AUXILIARY;
case 0x7ffe: return DT_SUNW_USED;
case 0x7fff: return DT_SUNW_FILTER;
-   default: return ERROR: TAG NOT DEFINED;
}
+   snprintf(unknown_tag, sizeof(unknown_tag),
+   ERROR: TAG NOT DEFINED -- tag 0x%jx, (uintmax_t)tag);
+   return (unknown_tag);
 }
 
 static const char *
@@ -334,6 +340,7 @@ sh_types(uint64_t machine, uint64_t sht)
switch (sht) {
case 0x6ff0: return XXX:VERSYM;
case 0x6ff4: return SHT_SUNW_dof;
+   case 0x6ff6: return SHT_GNU_HASH;
case 0x6ff7: return SHT_GNU_LIBLIST;
case 0x6ffc: return XXX:VERDEF;
case 0x6ffd: return SHT_SUNW(GNU)_verdef;
@@ -347,6 +354,15 @@ sh_types(uint64_t machine, uint64_t sht)
} else if (sht  0x8000) {
/* 0x7000-0x7fff processor-specific semantics */
switch (machine) {
+   case EM_ARM:
+   switch (sht) {
+   case 0x7001: return SHT_ARM_EXIDX;
+   case 0x7002: return SHT_ARM_PREEMPTMAP;
+   case 0x7003: return SHT_ARM_ATTRIBUTES;
+   case 0x7004: return SHT_ARM_DEBUGOVERLAY;
+   case 0x7005: return SHT_ARM_OVERLAYSECTION;
+   }
+   break;
case EM_MIPS:
switch (sht) {
case 0x700d: return SHT_MIPS_OPTIONS;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r269143 - head/usr.bin/elfdump

2014-07-26 Thread Andreas Tobler

On 26.07.14 22:00, Ian Lepore wrote:

On Sat, 2014-07-26 at 19:44 +, Andreas Tobler wrote:

Author: andreast
Date: Sat Jul 26 19:44:45 2014
New Revision: 269143
URL: http://svnweb.freebsd.org/changeset/base/269143

Log:
   Further improvements on elfdump, to follow up r269092:

   - Add ARM specific section header types.
   - Add SHT_GNU_HASH section header type.
   - Improve reporting of undefined tags in d_tags.
   - Add DT_GNU_HASH tag.

   Reviewed by: emaste

Modified:
   head/usr.bin/elfdump/elfdump.c

Modified: head/usr.bin/elfdump/elfdump.c
==
--- head/usr.bin/elfdump/elfdump.c  Sat Jul 26 19:27:34 2014
(r269142)
+++ head/usr.bin/elfdump/elfdump.c  Sat Jul 26 19:44:45 2014
(r269143)
@@ -167,7 +167,10 @@ static int elf64_offsets[] = {

  /* http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#tag_encodings */
  static const char *
-d_tags(u_int64_t tag) {
+d_tags(u_int64_t tag)
+{
+   static char unknown_tag[48];
+
switch (tag) {
case 0: return DT_NULL;
case 1: return DT_NEEDED;
@@ -215,6 +218,7 @@ d_tags(u_int64_t tag) {
case 0x6dfe: return DT_SYMINSZ;
case 0x6dff: return DT_SYMINENT (DT_VALRNGHI);
case 0x6e00: return DT_ADDRRNGLO;
+   case 0x6ef5: return DT_GNU_HASH;
case 0x6ef8: return DT_GNU_CONFLICT;
case 0x6ef9: return DT_GNU_LIBLIST;
case 0x6efa: return DT_SUNW_CONFIG;
@@ -236,8 +240,10 @@ d_tags(u_int64_t tag) {
case 0x7ffd: return DT_SUNW_AUXILIARY;
case 0x7ffe: return DT_SUNW_USED;
case 0x7fff: return DT_SUNW_FILTER;
-   default: return ERROR: TAG NOT DEFINED;
}
+   snprintf(unknown_tag, sizeof(unknown_tag),
+   ERROR: TAG NOT DEFINED -- tag 0x%jx, (uintmax_t)tag);
+   return (unknown_tag);
  }

  static const char *
@@ -334,6 +340,7 @@ sh_types(uint64_t machine, uint64_t sht)
switch (sht) {
case 0x6ff0: return XXX:VERSYM;
case 0x6ff4: return SHT_SUNW_dof;
+   case 0x6ff6: return SHT_GNU_HASH;
case 0x6ff7: return SHT_GNU_LIBLIST;
case 0x6ffc: return XXX:VERDEF;
case 0x6ffd: return SHT_SUNW(GNU)_verdef;
@@ -347,6 +354,15 @@ sh_types(uint64_t machine, uint64_t sht)
} else if (sht  0x8000) {
/* 0x7000-0x7fff processor-specific semantics */
switch (machine) {
+   case EM_ARM:
+   switch (sht) {
+   case 0x7001: return SHT_ARM_EXIDX;
+   case 0x7002: return SHT_ARM_PREEMPTMAP;
+   case 0x7003: return SHT_ARM_ATTRIBUTES;
+   case 0x7004: return SHT_ARM_DEBUGOVERLAY;
+   case 0x7005: return SHT_ARM_OVERLAYSECTION;
+   }
+   break;
case EM_MIPS:
switch (sht) {
case 0x700d: return SHT_MIPS_OPTIONS;



I'm curious why this code is all full of 0x numbers when there
are named constants defined for all this stuff.


No clue. I continued the used pattern.
It would make more sense to use the defines from elf_common.h, less 
error prone.


Andreas

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


svn commit: r268330 - head/sys/cam/ctl

2014-07-06 Thread Andreas Tobler
Author: andreast
Date: Sun Jul  6 20:09:23 2014
New Revision: 268330
URL: http://svnweb.freebsd.org/changeset/base/268330

Log:
  Make gcc happy, init idlen2.

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Sun Jul  6 18:16:04 2014(r268329)
+++ head/sys/cam/ctl/ctl.c  Sun Jul  6 20:09:23 2014(r268330)
@@ -4336,7 +4336,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
struct scsi_vpd_id_t10 *t10id;
const char *scsiname, *vendor;
int lun_number, i, lun_malloced;
-   int devidlen, idlen1, idlen2, len;
+   int devidlen, idlen1, idlen2 = 0, len;
 
if (be_lun == NULL)
return (EINVAL);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r264982 - head/sys/dev/usb/wlan

2014-04-26 Thread Andreas Tobler
Author: andreast
Date: Sat Apr 26 19:30:04 2014
New Revision: 264982
URL: http://svnweb.freebsd.org/changeset/base/264982

Log:
  Fix gcc build, initialize off variable.

Modified:
  head/sys/dev/usb/wlan/if_urtwn.c

Modified: head/sys/dev/usb/wlan/if_urtwn.c
==
--- head/sys/dev/usb/wlan/if_urtwn.cSat Apr 26 17:56:39 2014
(r264981)
+++ head/sys/dev/usb/wlan/if_urtwn.cSat Apr 26 19:30:04 2014
(r264982)
@@ -1302,6 +1302,7 @@ urtwn_r88e_read_rom(struct urtwn_softc *
uint8_t off, msk, tmp;
int i;
 
+   off = 0;
urtwn_efuse_switch_power(sc);
 
/* Read full ROM image. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r264375 - in stable/10/sys: modules/sound/driver/ai2s powerpc/include powerpc/powermac

2014-04-12 Thread Andreas Tobler
Author: andreast
Date: Sat Apr 12 19:57:15 2014
New Revision: 264375
URL: http://svnweb.freebsd.org/changeset/base/264375

Log:
  MFC r260607, r260610, r260934:
  
  r260607:
  The onyx codec works also as module, so add it.
  
  r260610:
  Described in the man page but not implemented. Here it comes,
  atomic_swap_32/64. The latter only for powerpc64.
  
  r260934:
  Fix the resource information for the i2s-a node on certain G5 PowerMacs.
  This is the first step needed to get the snapper codec working on those
  machines.
  The second step is to enable the corresponding I2S device and its clock.
  
  Tested on machines where the snapper codec was already working, a G4 PowerBook
  and a PowerMac9,1 with a Shasta based macio.
  The PowerMac7,2/7,3 with a K2 based macio can now also play sound.

Modified:
  stable/10/sys/modules/sound/driver/ai2s/Makefile
  stable/10/sys/powerpc/include/atomic.h
  stable/10/sys/powerpc/powermac/macio.c
  stable/10/sys/powerpc/powermac/maciovar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/modules/sound/driver/ai2s/Makefile
==
--- stable/10/sys/modules/sound/driver/ai2s/MakefileSat Apr 12 18:01:25 
2014(r264374)
+++ stable/10/sys/modules/sound/driver/ai2s/MakefileSat Apr 12 19:57:15 
2014(r264375)
@@ -5,6 +5,6 @@
 KMOD=  snd_ai2s
 SRCS=  device_if.h bus_if.h ofw_bus_if.h
 SRCS+= channel_if.h feeder_if.h mixer_if.h
-SRCS+= snapper.c tumbler.c aoa.c i2s.c
+SRCS+= onyx.c snapper.c tumbler.c aoa.c i2s.c
 
 .include bsd.kmod.mk

Modified: stable/10/sys/powerpc/include/atomic.h
==
--- stable/10/sys/powerpc/include/atomic.h  Sat Apr 12 18:01:25 2014
(r264374)
+++ stable/10/sys/powerpc/include/atomic.h  Sat Apr 12 19:57:15 2014
(r264375)
@@ -684,10 +684,47 @@ atomic_fetchadd_long(volatile u_long *p,
return (value);
 }
 
+static __inline u_int
+atomic_swap_32(volatile u_int *p, u_int v)
+{
+   u_int prev;
+
+   __asm __volatile(
+   1: lwarx   %0,0,%2\n
+  stwcx.  %3,0,%2\n
+  bne-1b\n
+   : =r (prev), +m (*(volatile u_int *)p)
+   : r (p), r (v)
+   : cc, memory);
+
+   return (prev);
+}
+
+#ifdef __powerpc64__
+static __inline u_long
+atomic_swap_64(volatile u_long *p, u_long v)
+{
+   u_long prev;
+
+   __asm __volatile(
+   1: ldarx   %0,0,%2\n
+  stdcx.  %3,0,%2\n
+  bne-1b\n
+   : =r (prev), +m (*(volatile u_long *)p)
+   : r (p), r (v)
+   : cc, memory);
+
+   return (prev);
+}
+#endif
+
 #defineatomic_fetchadd_32  atomic_fetchadd_int
+#defineatomic_swap_int atomic_swap_32
 
 #ifdef __powerpc64__
 #defineatomic_fetchadd_64  atomic_fetchadd_long
+#defineatomic_swap_longatomic_swap_64
+#defineatomic_swap_ptr atomic_swap_64
 #endif
 
 #undef __ATOMIC_REL

Modified: stable/10/sys/powerpc/powermac/macio.c
==
--- stable/10/sys/powerpc/powermac/macio.c  Sat Apr 12 18:01:25 2014
(r264374)
+++ stable/10/sys/powerpc/powermac/macio.c  Sat Apr 12 19:57:15 2014
(r264375)
@@ -236,13 +236,45 @@ macio_add_intr(phandle_t devnode, struct
 static void
 macio_add_reg(phandle_t devnode, struct macio_devinfo *dinfo)
 {
-   struct  macio_reg *reg;
-   int i, nreg;
+   struct  macio_reg *reg, *regp;
+   phandle_t   child;
+   charbuf[8];
+   int i, layout_id = 0, nreg, res;
 
nreg = OF_getprop_alloc(devnode, reg, sizeof(*reg), (void **)reg);
if (nreg == -1)
return;
 
+/*
+ *  Some G5's have broken properties in the i2s-a area. If so we try
+ *  to fix it. Right now we know of two different cases, one for
+ *  sound layout-id 36 and the other one for sound layout-id 76.
+ *  What is missing is the base address for the memory addresses.
+ *  We take them from the parent node (i2s) and use the size
+ *  information from the child. 
+ */
+
+if (reg[0].mr_base == 0) {
+   child = OF_child(devnode);
+   while (child != 0) {
+   res = OF_getprop(child, name, buf, sizeof(buf));
+   if (res  0  strcmp(buf, sound) == 0)
+   break;
+   child = OF_peer(child);
+   }
+
+res = OF_getprop(child, layout-id, layout_id,
+   sizeof(layout_id));
+
+if (res  0  (layout_id == 36 || layout_id == 76)) {
+res = OF_getprop_alloc(OF_parent(devnode), reg,
+   sizeof(*regp), (void **)regp);
+ 

svn commit: r264376 - stable/9/sys/powerpc/include

2014-04-12 Thread Andreas Tobler
Author: andreast
Date: Sat Apr 12 19:58:31 2014
New Revision: 264376
URL: http://svnweb.freebsd.org/changeset/base/264376

Log:
  MFC r260610:
  Described in the man page but not implemented. Here it comes,
  atomic_swap_32/64. The latter only for powerpc64.

Modified:
  stable/9/sys/powerpc/include/atomic.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/powerpc/include/atomic.h
==
--- stable/9/sys/powerpc/include/atomic.h   Sat Apr 12 19:57:15 2014
(r264375)
+++ stable/9/sys/powerpc/include/atomic.h   Sat Apr 12 19:58:31 2014
(r264376)
@@ -666,10 +666,47 @@ atomic_fetchadd_long(volatile u_long *p,
return (value);
 }
 
+static __inline u_int
+atomic_swap_32(volatile u_int *p, u_int v)
+{
+   u_int prev;
+
+   __asm __volatile(
+   1: lwarx   %0,0,%2\n
+  stwcx.  %3,0,%2\n
+  bne-1b\n
+   : =r (prev), +m (*(volatile u_int *)p)
+   : r (p), r (v)
+   : cc, memory);
+
+   return (prev);
+}
+
+#ifdef __powerpc64__
+static __inline u_long
+atomic_swap_64(volatile u_long *p, u_long v)
+{
+   u_long prev;
+
+   __asm __volatile(
+   1: ldarx   %0,0,%2\n
+  stdcx.  %3,0,%2\n
+  bne-1b\n
+   : =r (prev), +m (*(volatile u_long *)p)
+   : r (p), r (v)
+   : cc, memory);
+
+   return (prev);
+}
+#endif
+
 #defineatomic_fetchadd_32  atomic_fetchadd_int
+#defineatomic_swap_int atomic_swap_32
 
 #ifdef __powerpc64__
 #defineatomic_fetchadd_64  atomic_fetchadd_long
+#defineatomic_swap_longatomic_swap_64
+#defineatomic_swap_ptr atomic_swap_64
 #endif
 
 #endif /* ! _MACHINE_ATOMIC_H_ */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r260934 - head/sys/powerpc/powermac

2014-01-20 Thread Andreas Tobler
Author: andreast
Date: Mon Jan 20 21:54:05 2014
New Revision: 260934
URL: http://svnweb.freebsd.org/changeset/base/260934

Log:
  Fix the resource information for the i2s-a node on certain G5 PowerMacs.
  This is the first step needed to get the snapper codec working on those
  machines.
  The second step is to enable the corresponding I2S device and its clock.
  
  Tested on machines where the snapper codec was already working, a G4 PowerBook
  and a PowerMac9,1 with a Shasta based macio.
  The PowerMac7,2/7,3 with a K2 based macio can now also play sound.
  
  MFC after:1 month

Modified:
  head/sys/powerpc/powermac/macio.c
  head/sys/powerpc/powermac/maciovar.h

Modified: head/sys/powerpc/powermac/macio.c
==
--- head/sys/powerpc/powermac/macio.c   Mon Jan 20 21:52:00 2014
(r260933)
+++ head/sys/powerpc/powermac/macio.c   Mon Jan 20 21:54:05 2014
(r260934)
@@ -236,13 +236,45 @@ macio_add_intr(phandle_t devnode, struct
 static void
 macio_add_reg(phandle_t devnode, struct macio_devinfo *dinfo)
 {
-   struct  macio_reg *reg;
-   int i, nreg;
+   struct  macio_reg *reg, *regp;
+   phandle_t   child;
+   charbuf[8];
+   int i, layout_id = 0, nreg, res;
 
nreg = OF_getprop_alloc(devnode, reg, sizeof(*reg), (void **)reg);
if (nreg == -1)
return;
 
+/*
+ *  Some G5's have broken properties in the i2s-a area. If so we try
+ *  to fix it. Right now we know of two different cases, one for
+ *  sound layout-id 36 and the other one for sound layout-id 76.
+ *  What is missing is the base address for the memory addresses.
+ *  We take them from the parent node (i2s) and use the size
+ *  information from the child. 
+ */
+
+if (reg[0].mr_base == 0) {
+   child = OF_child(devnode);
+   while (child != 0) {
+   res = OF_getprop(child, name, buf, sizeof(buf));
+   if (res  0  strcmp(buf, sound) == 0)
+   break;
+   child = OF_peer(child);
+   }
+
+res = OF_getprop(child, layout-id, layout_id,
+   sizeof(layout_id));
+
+if (res  0  (layout_id == 36 || layout_id == 76)) {
+res = OF_getprop_alloc(OF_parent(devnode), reg,
+   sizeof(*regp), (void **)regp);
+reg[0] = regp[0];
+reg[1].mr_base = regp[1].mr_base;
+reg[2].mr_base = regp[1].mr_base + reg[1].mr_size;
+}
+} 
+
for (i = 0; i  nreg; i++) {
resource_list_add(dinfo-mdi_resources, SYS_RES_MEMORY, i,
reg[i].mr_base, reg[i].mr_base + reg[i].mr_size,
@@ -284,6 +316,7 @@ macio_attach(device_t dev)
phandle_t  subchild;
 device_t cdev;
 u_int reg[3];
+   char compat[32];
int error, quirks;
 
sc = device_get_softc(dev);
@@ -297,6 +330,9 @@ macio_attach(device_t dev)
return (ENXIO);
}
 
+   /* Used later to see if we have to enable the I2S part. */
+   OF_getprop(root, compatible, compat, sizeof(compat));
+
sc-sc_base = reg[2];
sc-sc_size = MACIO_REG_SIZE;
 
@@ -378,6 +414,21 @@ macio_attach(device_t dev)

bus_write_4(sc-sc_memr, HEATHROW_FCR, fcr);
}
+
+   /*
+* Make sure the I2S0 and the I2S0_CLK are enabled.
+* On certain G5's they are not.
+*/
+   if ((strcmp(ofw_bus_get_name(cdev), i2s) == 0) 
+   (strcmp(compat, K2-Keylargo) == 0)) {
+
+   uint32_t fcr1;
+
+   fcr1 = bus_read_4(sc-sc_memr, KEYLARGO_FCR1);
+   fcr1 |= FCR1_I2S0_CLK_ENABLE | FCR1_I2S0_ENABLE;
+   bus_write_4(sc-sc_memr, KEYLARGO_FCR1, fcr1);
+   }
+
}
 
return (bus_generic_attach(dev));

Modified: head/sys/powerpc/powermac/maciovar.h
==
--- head/sys/powerpc/powermac/maciovar.hMon Jan 20 21:52:00 2014
(r260933)
+++ head/sys/powerpc/powermac/maciovar.hMon Jan 20 21:54:05 2014
(r260934)
@@ -48,6 +48,9 @@
 #define FCR_ENET_ENABLE0x6000
 #define FCR_ENET_RESET 0x8000
 
+#define FCR1_I2S0_CLK_ENABLE   0x1000
+#define FCR1_I2S0_ENABLE   0x2000
+
 /* Used only by macio_enable_wireless() for now. */
 #define KEYLARGO_GPIO_BASE 0x6a
 #define KEYLARGO_EXTINT_GPIO_REG_BASE  0x58
___
svn-src-all@freebsd.org mailing list

svn commit: r260607 - head/sys/modules/sound/driver/ai2s

2014-01-13 Thread Andreas Tobler
Author: andreast
Date: Mon Jan 13 21:44:17 2014
New Revision: 260607
URL: http://svnweb.freebsd.org/changeset/base/260607

Log:
  The onyx codec works also as module, so add it.
  
  MFC after:1 month

Modified:
  head/sys/modules/sound/driver/ai2s/Makefile

Modified: head/sys/modules/sound/driver/ai2s/Makefile
==
--- head/sys/modules/sound/driver/ai2s/Makefile Mon Jan 13 21:29:34 2014
(r260606)
+++ head/sys/modules/sound/driver/ai2s/Makefile Mon Jan 13 21:44:17 2014
(r260607)
@@ -5,6 +5,6 @@
 KMOD=  snd_ai2s
 SRCS=  device_if.h bus_if.h ofw_bus_if.h
 SRCS+= channel_if.h feeder_if.h mixer_if.h
-SRCS+= snapper.c tumbler.c aoa.c i2s.c
+SRCS+= onyx.c snapper.c tumbler.c aoa.c i2s.c
 
 .include bsd.kmod.mk
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r260610 - head/sys/powerpc/include

2014-01-13 Thread Andreas Tobler
Author: andreast
Date: Mon Jan 13 22:21:29 2014
New Revision: 260610
URL: http://svnweb.freebsd.org/changeset/base/260610

Log:
  Described in the man page but not implemented. Here it comes,
  atomic_swap_32/64. The latter only for powerpc64.
  
  MFC after:1 month

Modified:
  head/sys/powerpc/include/atomic.h

Modified: head/sys/powerpc/include/atomic.h
==
--- head/sys/powerpc/include/atomic.h   Mon Jan 13 22:15:57 2014
(r260609)
+++ head/sys/powerpc/include/atomic.h   Mon Jan 13 22:21:29 2014
(r260610)
@@ -684,10 +684,47 @@ atomic_fetchadd_long(volatile u_long *p,
return (value);
 }
 
+static __inline u_int
+atomic_swap_32(volatile u_int *p, u_int v)
+{
+   u_int prev;
+
+   __asm __volatile(
+   1: lwarx   %0,0,%2\n
+  stwcx.  %3,0,%2\n
+  bne-1b\n
+   : =r (prev), +m (*(volatile u_int *)p)
+   : r (p), r (v)
+   : cc, memory);
+
+   return (prev);
+}
+
+#ifdef __powerpc64__
+static __inline u_long
+atomic_swap_64(volatile u_long *p, u_long v)
+{
+   u_long prev;
+
+   __asm __volatile(
+   1: ldarx   %0,0,%2\n
+  stdcx.  %3,0,%2\n
+  bne-1b\n
+   : =r (prev), +m (*(volatile u_long *)p)
+   : r (p), r (v)
+   : cc, memory);
+
+   return (prev);
+}
+#endif
+
 #defineatomic_fetchadd_32  atomic_fetchadd_int
+#defineatomic_swap_int atomic_swap_32
 
 #ifdef __powerpc64__
 #defineatomic_fetchadd_64  atomic_fetchadd_long
+#defineatomic_swap_longatomic_swap_64
+#defineatomic_swap_ptr atomic_swap_64
 #endif
 
 #undef __ATOMIC_REL
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r260375 - in head/sys/arm: arm include

2014-01-06 Thread Andreas Tobler
Author: andreast
Date: Mon Jan  6 17:16:27 2014
New Revision: 260375
URL: http://svnweb.freebsd.org/changeset/base/260375

Log:
  Fix arm build.
  
  Reviewed by:  ian, zbb

Modified:
  head/sys/arm/arm/trap.c
  head/sys/arm/include/intr.h
  head/sys/arm/include/psl.h

Modified: head/sys/arm/arm/trap.c
==
--- head/sys/arm/arm/trap.c Mon Jan  6 16:57:22 2014(r260374)
+++ head/sys/arm/arm/trap.c Mon Jan  6 17:16:27 2014(r260375)
@@ -85,6 +85,7 @@
 __FBSDID($FreeBSD$);
 
 #include sys/param.h
+#include sys/bus.h
 #include sys/systm.h
 #include sys/proc.h
 #include sys/kernel.h

Modified: head/sys/arm/include/intr.h
==
--- head/sys/arm/include/intr.h Mon Jan  6 16:57:22 2014(r260374)
+++ head/sys/arm/include/intr.h Mon Jan  6 17:16:27 2014(r260375)
@@ -67,8 +67,6 @@
 #define NIRQ   32
 #endif
 
-#include machine/psl.h
-#include sys/bus.h
 
 int arm_get_next_irq(int);
 void arm_mask_irq(uintptr_t);

Modified: head/sys/arm/include/psl.h
==
--- head/sys/arm/include/psl.h  Mon Jan  6 16:57:22 2014(r260374)
+++ head/sys/arm/include/psl.h  Mon Jan  6 17:16:27 2014(r260375)
@@ -46,7 +46,6 @@
 
 #ifndef _MACHINE_PSL_H_
 #define _MACHINE_PSL_H_
-#include machine/intr.h
 
 /*
  * These are the different SPL states
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r260161 - in head/sys/arm: arm include

2014-01-06 Thread Andreas Tobler
On 06.01.14 15:34, Ian Lepore wrote:
 On Mon, 2014-01-06 at 13:07 +0100, Zbigniew Bodek wrote:
 2014/1/6 Andreas Tobler andre...@freebsd.org:
 On 06.01.14 03:55, Ian Lepore wrote:
 On Wed, 2014-01-01 at 20:03 +, Zbigniew Bodek wrote:
 Author: zbb
 Date: Wed Jan  1 20:03:48 2014
 New Revision: 260161
 URL: http://svnweb.freebsd.org/changeset/base/260161

 Log:
   Add polarity and level support to ARM GIC

   Add suport for setting triggering level and polarity in GIC.
   New function pointer was added to nexus which corresponds
   to the function which sets level/sense in the hardware (GIC).

   Submitted by:  Wojciech Macek w...@semihalf.com
   Obtained from: Semihalf

 Modified:
   head/sys/arm/arm/gic.c
   head/sys/arm/arm/intr.c
   head/sys/arm/arm/nexus.c
   head/sys/arm/include/intr.h

 [...]
 Modified: head/sys/arm/include/intr.h
 ==
 --- head/sys/arm/include/intr.h  Wed Jan  1 19:38:15 2014
 (r260160)
 +++ head/sys/arm/include/intr.h  Wed Jan  1 20:03:48 2014
 (r260161)
 @@ -68,6 +68,7 @@
  #endif

  #include machine/psl.h
 +#include sys/bus.h

  int arm_get_next_irq(int);
  void arm_mask_irq(uintptr_t);
 @@ -77,6 +78,8 @@ void arm_setup_irqhandler(const char *,
  void *, int, int, void **);
  int arm_remove_irqhandler(int, void *);
  extern void (*arm_post_filter)(void *);
 +extern int (*arm_config_irq)(int irq, enum intr_trigger trig,
 +enum intr_polarity pol);

  void gic_init_secondary(void);


 It turns out that the new #include in this change is causing the current
 arm tinderbox failures.  Enums can't have forward decls anymore, so the
 fix for this may not be easy.

 I posted my try to fix this here:

 http://lists.freebsd.org/pipermail/freebsd-current/2014-January/047694.html

 Rebuilt 260333 successfully with it.

 Andreas


 Hello.

 Thank you very much. Can this be committed or are there any objections?

 Best regards
 zbb
 
 It looks good to me.
 
 It's odd that the tinderbox has been failing for several days on this,
 but I've been doing universe-kernel builds all weekend without running
 into it.  I wonder what's different between tinderbox and universe in
 this regard?

Thanks.

Committed as r260375.
As it is not my home base I wanted to have an ack from an arm dev.

Andreas

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


Re: svn commit: r260161 - in head/sys/arm: arm include

2014-01-05 Thread Andreas Tobler
On 06.01.14 03:55, Ian Lepore wrote:
 On Wed, 2014-01-01 at 20:03 +, Zbigniew Bodek wrote:
 Author: zbb
 Date: Wed Jan  1 20:03:48 2014
 New Revision: 260161
 URL: http://svnweb.freebsd.org/changeset/base/260161

 Log:
   Add polarity and level support to ARM GIC
   
   Add suport for setting triggering level and polarity in GIC.
   New function pointer was added to nexus which corresponds
   to the function which sets level/sense in the hardware (GIC).
   
   Submitted by:  Wojciech Macek w...@semihalf.com
   Obtained from: Semihalf

 Modified:
   head/sys/arm/arm/gic.c
   head/sys/arm/arm/intr.c
   head/sys/arm/arm/nexus.c
   head/sys/arm/include/intr.h

 [...]
 Modified: head/sys/arm/include/intr.h
 ==
 --- head/sys/arm/include/intr.h  Wed Jan  1 19:38:15 2014
 (r260160)
 +++ head/sys/arm/include/intr.h  Wed Jan  1 20:03:48 2014
 (r260161)
 @@ -68,6 +68,7 @@
  #endif
  
  #include machine/psl.h
 +#include sys/bus.h
  
  int arm_get_next_irq(int);
  void arm_mask_irq(uintptr_t);
 @@ -77,6 +78,8 @@ void arm_setup_irqhandler(const char *, 
  void *, int, int, void **);
  int arm_remove_irqhandler(int, void *);
  extern void (*arm_post_filter)(void *);
 +extern int (*arm_config_irq)(int irq, enum intr_trigger trig,
 +enum intr_polarity pol);
  
  void gic_init_secondary(void);
  
 
 It turns out that the new #include in this change is causing the current
 arm tinderbox failures.  Enums can't have forward decls anymore, so the
 fix for this may not be easy.

I posted my try to fix this here:

http://lists.freebsd.org/pipermail/freebsd-current/2014-January/047694.html

Rebuilt 260333 successfully with it.

Andreas

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


Re: svn commit: r260073 - in head/contrib/gcc: . cp

2014-01-02 Thread Andreas Tobler
Hi Pedro,

Happy new Year!

On 30.12.13 03:52, Pedro F. Giffuni wrote:
 Author: pfg
 Date: Mon Dec 30 02:52:43 2013
 New Revision: 260073
 URL: http://svnweb.freebsd.org/changeset/base/260073
 
 Log:
   gcc: small diff reduction wrt gcc43 and Apple GCC.
   
   Obtained from:  gcc 4.3 (rev. 121464, 122528, 124106; GPLv2)
   MFC after:  3 weeks
 
 Modified:
   head/contrib/gcc/ChangeLog.gcc43
   head/contrib/gcc/cp/ChangeLog
   head/contrib/gcc/cp/g++spec.c
   head/contrib/gcc/libgcc2.c
   head/contrib/gcc/libgcc2.h
   head/contrib/gcc/loop-init.c
   head/contrib/gcc/toplev.c
   head/contrib/gcc/tree-ssa-address.c

May I ask you to revert this commit? It causes an ICE on powerpc(64) and
sparc64 while compiling dev/trm/trm.c. Tinderbox also showed this one a
few days ago. It should pop up again soon.

--
/export/devel/fbsd/src/sys/modules/trm/../../dev/trm/trm.c:3522:
internal compiler error: in create_mem_ref, at tree-ssa-address.c:606
Please submit a full bug report,
with preprocessed source if appropriate.
--


Thank you,

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


Re: svn commit: r259619 - in head/contrib/gcc: . cp doc

2013-12-20 Thread Andreas Tobler
On 19.12.13 19:27, Pedro F. Giffuni wrote:
 Author: pfg
 Date: Thu Dec 19 18:27:32 2013
 New Revision: 259619
 URL: http://svnweb.freebsd.org/changeset/base/259619
 
 Log:
   gcc: backport upstream fix for issue with C++'s placement new
   
   Fixes GCC libstdc++/29286
   
   Obtained from:  gcc 4.3 (rev. 125603, 125653; GPLv2)
   MFC after:  2 weeks

Pedro,

is this commit complete? If so, please revert. I get a compiler on
powerpc64 which immediately segfaults.

Thanks,
Andreas

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


Re: svn commit: r259609 - head/sys/kern

2013-12-19 Thread Andreas Tobler
On 19.12.13 18:00, Stefan Esser wrote:

 I'd replace the two occurances of LLONG_MAX with INT64_MAX and add the
 missing empty line:
 
 static __inline sbintime_t
 timer2sbintime(intptr_t data)
 {
 
 if (data  INT64_MAX / SBT_1MS)
 return INT64_MAX;
 return (SBT_1MS * data);
 }
 
 If you can show evidence that a limit of INT64_MAX/2 is more appropriate
 (2^30 seconds or 34 years), the limit could be of course be reduced to
 that value.
 
 I could not find any code that would not tolerate INT64_MAX, though ...

Aehm, what about 32-bit systems where intptr_t == __int32_t?


cc1: warnings being treated as errors
/export/devel/fbsd/src/sys/kern/kern_event.c: In function 'timer2sbintime':
/export/devel/fbsd/src/sys/kern/kern_event.c:529: warning: comparison is
always false due to limited range of data type

Andreas

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


Re: svn commit: r259016 - in head/sys: conf dev/drm2 dev/drm2/i915 dev/drm2/radeon dev/fb dev/vt kern modules/drm2/i915kms modules/drm2/radeonkms sparc64/sparc64 sys teken

2013-12-18 Thread Andreas Tobler
On 18.12.13 01:24, Baptiste Daroussin wrote:
 On Wed, Dec 18, 2013 at 02:21:56AM +0200, Aleksandr Rybalko wrote:
 On Tue, 10 Dec 2013 23:49:38 +0100
 Andreas Tobler andre...@freebsd.org wrote:

 On 10.12.13 14:43, Tijl Coosemans wrote:
 On Tue, 10 Dec 2013 15:31:44 +0200 Aleksandr Rybalko wrote:
 That keyboards have no Shift key for that? :)
 I will be glad to apply your changes, but I have to know how it
 should be controlled.

 RU and UA PC keyboards have same 3 symbols '2', '', '@'
 To get '2' i have to press only '2'
 To get '@' I have to press Shift+'2'
 To get '' I have to switch to UA or RU and press Shift+'2'

 Ahh, or use some called Third-Level (IIRC) in Xorg terms. Temporary
 lang switch. Which commonly mapped to one of Alt. Right?
 So R-Alt+Shift+'2'?

 https://en.wikipedia.org/wiki/AltGr

 Thanks Tijl!

 To get the @ I have to press AltGr + '2'.
 There are combinations where I have to press AltGr+Shift. e.g to get
 the 'broken bar, ¦', AltGr+Shift+'7'.

 Andreas


 Hello Andreas and Tijl!

 Since I think not a whole world have AltGr key (read as not most
 keyboards on the Earth) :)
 Think it is OK to use R.Alt as an Alt by default, and enable AltGr with
 sysctl kern.vt.enable_altgr.

 I tend to disagree with you, lots of keyboards mapping are concerned here.

Hi Aleksandr,

It is at least a step forward. But I do not like it.
Don't get me wrong, I think we have to be very careful when it comes to
keyboard mapping. A status quo should be kept, the one from syscons.

Looking back the past 20 years of Linux and FreeBSD experience I always
had to touch the keyboards section to make it fit my needs. A nasty
hurdle, in the beginning it was ok, but after the sixth time adjusting
the native language keyboard it gets boring. And I guess it is not only me.

In the meantime I would not need a swiss keyboard anymore, I more or
less know the native mapping out of my mind :)

I do not yet understand the fine keyboard details from syscons but I
think we have to keep and adapt them to vt.

My two Rp.

Thanks for your time!
Andreas
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r259485 - in stable/9/sys: . amd64/include/xen boot boot/forth boot/i386/efi boot/i386/gptboot boot/ia64/efi boot/ia64/ski boot/powerpc/boot1.chrp boot/powerpc/ofw cddl/contrib/opensola...

2013-12-16 Thread Andreas Tobler
Author: andreast
Date: Mon Dec 16 22:07:49 2013
New Revision: 259485
URL: http://svnweb.freebsd.org/changeset/base/259485

Log:
  Fix the outstanding mergeinfo part of r249374.

Modified:
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/forth/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/i386/gptboot/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/isp/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/dev/puc/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)
  stable/9/sys/modules/ixgbe/   (props changed)
  stable/9/sys/net/   (props changed)
  stable/9/sys/sys/   (props changed)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r259255 - stable/10/sys/dev/ofw

2013-12-12 Thread Andreas Tobler
Author: andreast
Date: Thu Dec 12 12:17:20 2013
New Revision: 259255
URL: http://svnweb.freebsd.org/changeset/base/259255

Log:
  MFC:  r256932, r256938, r256953
  
  r256932:
  Add a new function (OF_getencprop()) that undoes the transformation applied
  by encode-int. Specifically, it takes a set of 32-bit cell values and
  changes them to host byte order. Most non-string instances of OF_getprop()
  should be using this function, which is a no-op on big-endian platforms.
  
  r256938:
  A few other common cases for encode-int decoding: OF_getencprop_alloc()
  and OF_searchencprop(). I thought about using the element size parameter
  to OF_getprop_alloc() to do endian-switching automatically, but it breaks
  use with structs and a *lot* of FDT code (which can hopefully be moved to
  these new APIs).
  
  r256953:
  Fix build.

Modified:
  stable/10/sys/dev/ofw/openfirm.c
  stable/10/sys/dev/ofw/openfirm.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ofw/openfirm.c
==
--- stable/10/sys/dev/ofw/openfirm.cThu Dec 12 11:05:48 2013
(r259254)
+++ stable/10/sys/dev/ofw/openfirm.cThu Dec 12 12:17:20 2013
(r259255)
@@ -64,6 +64,7 @@ __FBSDID($FreeBSD$);
 #include sys/kernel.h
 #include sys/malloc.h
 #include sys/systm.h
+#include sys/endian.h
 
 #include machine/stdarg.h
 
@@ -280,6 +281,21 @@ OF_getprop(phandle_t package, const char
return (OFW_GETPROP(ofw_obj, package, propname, buf, buflen));
 }
 
+ssize_t
+OF_getencprop(phandle_t node, const char *propname, pcell_t *buf, size_t len)
+{
+   ssize_t retval;
+   int i;
+
+   KASSERT(len % 4 == 0, (Need a multiple of 4 bytes));
+
+   retval = OF_getprop(node, propname, buf, len);
+   for (i = 0; i  len/4; i++)
+   buf[i] = be32toh(buf[i]);
+
+   return (retval);
+}
+
 /*
  * Recursively search the node and its parent for the given property, working
  * downward from the node to the device tree root.  Returns the value of the
@@ -296,6 +312,17 @@ OF_searchprop(phandle_t node, const char
return (-1);
 }
 
+ssize_t
+OF_searchencprop(phandle_t node, const char *propname, void *buf, size_t len)
+{
+   ssize_t rv;
+
+   for (; node != 0; node = OF_parent(node))
+   if ((rv = OF_getencprop(node, propname, buf, len)) != -1)
+   return (rv);
+   return (-1);
+}
+
 /*
  * Store the value of a property of a package into newly allocated memory
  * (using the M_OFWPROP malloc pool and M_WAITOK).  elsz is the size of a
@@ -320,6 +347,26 @@ OF_getprop_alloc(phandle_t package, cons
return (len / elsz);
 }
 
+ssize_t
+OF_getencprop_alloc(phandle_t package, const char *name, int elsz, void **buf)
+{
+   ssize_t retval;
+   pcell_t *cell;
+   int i;
+
+   KASSERT(elsz % 4 == 0, (Need a multiple of 4 bytes));
+
+   retval = OF_getprop_alloc(package, name, elsz, buf);
+   if (retval == -1)
+   return (retval);
+
+   cell = *buf;
+   for (i = 0; i  retval*elsz/4; i++)
+   cell[i] = be32toh(cell[i]);
+
+   return (retval);
+}
+
 /* Get the next property of a package. */
 int
 OF_nextprop(phandle_t package, const char *previous, char *buf, size_t size)

Modified: stable/10/sys/dev/ofw/openfirm.h
==
--- stable/10/sys/dev/ofw/openfirm.hThu Dec 12 11:05:48 2013
(r259254)
+++ stable/10/sys/dev/ofw/openfirm.hThu Dec 12 12:17:20 2013
(r259255)
@@ -105,11 +105,17 @@ phandle_t OF_parent(phandle_t node);
 ssize_tOF_getproplen(phandle_t node, const char *propname);
 ssize_tOF_getprop(phandle_t node, const char *propname, void 
*buf,
size_t len);
+ssize_tOF_getencprop(phandle_t node, const char *prop, pcell_t 
*buf,
+   size_t len); /* Same as getprop, but maintains endianness */
 intOF_hasprop(phandle_t node, const char *propname);
 ssize_tOF_searchprop(phandle_t node, const char *propname, 
void *buf,
size_t len);
+ssize_tOF_searchencprop(phandle_t node, const char *propname,
+   void *buf, size_t len);
 ssize_tOF_getprop_alloc(phandle_t node, const char *propname,
int elsz, void **buf);
+ssize_tOF_getencprop_alloc(phandle_t node, const char 
*propname,
+   int elsz, void **buf);
 intOF_nextprop(phandle_t node, const char *propname, char *buf,
size_t len);
 intOF_setprop(phandle_t node, const char *name, const void *buf,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r259256 - stable/10/sys/powerpc/powerpc

2013-12-12 Thread Andreas Tobler
Author: andreast
Date: Thu Dec 12 12:29:35 2013
New Revision: 259256
URL: http://svnweb.freebsd.org/changeset/base/259256

Log:
  MFC:  r258722, r258757
  
  r258722:
  Give some output about the CPU clock on IBMPOWER machines, currently read
  from OF. Linux does it similar, means they also read the OF values and
  display them.
  r258757:
  Use the Open Firmware-based CPU frequency determination as a generic
  fallback if we can't measure CPU frequency. This is also useful on a
  variety of embedded systems using FDT.

Modified:
  stable/10/sys/powerpc/powerpc/cpu.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/powerpc/powerpc/cpu.c
==
--- stable/10/sys/powerpc/powerpc/cpu.c Thu Dec 12 12:17:20 2013
(r259255)
+++ stable/10/sys/powerpc/powerpc/cpu.c Thu Dec 12 12:29:35 2013
(r259256)
@@ -74,6 +74,8 @@
 #include machine/smp.h
 #include machine/spr.h
 
+#include dev/ofw/openfirm.h
+
 static voidcpu_6xx_setup(int cpuid, uint16_t vers);
 static voidcpu_970_setup(int cpuid, uint16_t vers);
 static voidcpu_booke_setup(int cpuid, uint16_t vers);
@@ -273,6 +275,9 @@ cpu_est_clockrate(int cpu_id, uint64_t *
 {
uint16_tvers;
register_t  msr;
+   phandle_t   cpu, dev, root;
+   int res  = 0;
+   charbuf[8];
 
vers = mfpvr()  16;
msr = mfmsr();
@@ -316,9 +321,40 @@ cpu_est_clockrate(int cpu_id, uint64_t *
 
mtmsr(msr);
return (0);
+
+   default:
+   root = OF_peer(0);
+   if (root == 0)
+   return (ENXIO);
+
+   dev = OF_child(root);
+   while (dev != 0) {
+   res = OF_getprop(dev, name, buf, sizeof(buf));
+   if (res  0  strcmp(buf, cpus) == 0)
+   break;
+   dev = OF_peer(dev);
+   }
+   cpu = OF_child(dev);
+   while (cpu != 0) {
+   res = OF_getprop(cpu, device_type, buf,
+   sizeof(buf));
+   if (res  0  strcmp(buf, cpu) == 0)
+   break;
+   cpu = OF_peer(cpu);
+   }
+   if (cpu == 0)
+   return (ENOENT);
+   if (OF_getprop(cpu, ibm,extended-clock-frequency,
+   cps, sizeof(*cps)) = 0) {
+   return (0);
+   } else if (OF_getprop(cpu, clock-frequency, cps, 
+   sizeof(cell_t)) = 0) {
+   *cps = 32;
+   return (0);
+   } else {
+   return (ENOENT);
+   }
}
-   
-   return (ENXIO);
 }
 
 void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r259257 - in stable/10/sys: conf powerpc/ofw powerpc/pseries

2013-12-12 Thread Andreas Tobler
Author: andreast
Date: Thu Dec 12 12:36:40 2013
New Revision: 259257
URL: http://svnweb.freebsd.org/changeset/base/259257

Log:
  MFC:  r258051, r258052
  
  r258052:
  Following the approach with ACPI DMAR on x86, split IOMMU handling into
  a variant PCI bus instead of trying to shoehorn it into the PCI host bridge
  adapter. Besides matching better the architecture on other platforms, this
  also allows systems with multiple partitionable endpoints per PCI host
  bridge to work correctly.
  
  r258051:
  Actually add IOMMU domain to the list of known mappings. This fixes a bug
  where multiple devices in the same IOMMU domain would be allocated
  conflicting mappings unless they also shared a DMA tag.

Added:
  stable/10/sys/powerpc/ofw/ofw_pcibus.h
 - copied unchanged from r258052, head/sys/powerpc/ofw/ofw_pcibus.h
  stable/10/sys/powerpc/pseries/plpar_pcibus.c
 - copied unchanged from r258052, head/sys/powerpc/pseries/plpar_pcibus.c
Modified:
  stable/10/sys/conf/files.powerpc
  stable/10/sys/powerpc/ofw/ofw_pcibus.c
  stable/10/sys/powerpc/pseries/plpar_iommu.c
  stable/10/sys/powerpc/pseries/rtas_pci.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/conf/files.powerpc
==
--- stable/10/sys/conf/files.powerpcThu Dec 12 12:29:35 2013
(r259256)
+++ stable/10/sys/conf/files.powerpcThu Dec 12 12:36:40 2013
(r259257)
@@ -232,6 +232,7 @@ powerpc/pseries/phyp_llan.c optionallla
 powerpc/pseries/phyp_vscsi.c   optionalpseries powerpc64 scbus
 powerpc/pseries/platform_chrp.coptionalpseries
 powerpc/pseries/plpar_iommu.c  optionalpseries powerpc64
+powerpc/pseries/plpar_pcibus.c optionalpseries powerpc64 pci
 powerpc/pseries/rtas_dev.c optionalpseries
 powerpc/pseries/rtas_pci.c optionalpseries pci
 powerpc/pseries/vdevice.c  optionalpseries powerpc64

Modified: stable/10/sys/powerpc/ofw/ofw_pcibus.c
==
--- stable/10/sys/powerpc/ofw/ofw_pcibus.c  Thu Dec 12 12:29:35 2013
(r259256)
+++ stable/10/sys/powerpc/ofw/ofw_pcibus.c  Thu Dec 12 12:36:40 2013
(r259257)
@@ -50,6 +50,7 @@ __FBSDID($FreeBSD$);
 #include dev/pci/pcivar.h
 #include dev/pci/pci_private.h
 
+#include ofw_pcibus.h
 #include pcib_if.h
 #include pci_if.h
 
@@ -85,12 +86,7 @@ static device_method_t ofw_pcibus_method
DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node),
DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type),
 
-   { 0, 0 }
-};
-
-struct ofw_pcibus_devinfo {
-   struct pci_devinfo  opd_dinfo;
-   struct ofw_bus_devinfo  opd_obdinfo;
+   DEVMETHOD_END
 };
 
 static devclass_t pci_devclass;
@@ -195,6 +191,7 @@ ofw_pcibus_enum_devtree(device_t dev, u_
pci_freecfg((struct pci_devinfo *)dinfo);
continue;
}
+   dinfo-opd_dma_tag = NULL;
pci_add_child(dev, (struct pci_devinfo *)dinfo);
 
/*
@@ -274,6 +271,7 @@ ofw_pcibus_enum_bus(device_t dev, u_int 
if (dinfo == NULL)
continue;
 
+   dinfo-opd_dma_tag = NULL;
dinfo-opd_obdinfo.obd_node = -1;
 
dinfo-opd_obdinfo.obd_name = NULL;

Copied: stable/10/sys/powerpc/ofw/ofw_pcibus.h (from r258052, 
head/sys/powerpc/ofw/ofw_pcibus.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/sys/powerpc/ofw/ofw_pcibus.h  Thu Dec 12 12:36:40 2013
(r259257, copy of r258052, head/sys/powerpc/ofw/ofw_pcibus.h)
@@ -0,0 +1,51 @@
+/*-
+ * Copyright (c) 2011 Nathan Whitehorn
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 

svn commit: r259258 - in stable/10/sys/powerpc: ofw pseries

2013-12-12 Thread Andreas Tobler
Author: andreast
Date: Thu Dec 12 13:00:07 2013
New Revision: 259258
URL: http://svnweb.freebsd.org/changeset/base/259258

Log:
  MFC:  r258427, r258694
  
  r258694:
  Make RTAS calls, which call setfault() to recover from machine checks,
  preserve any existing fault buffer. RTAS calls are meant to be safe from
  interrupt context (and are indeed used there to implement the xics PIC
  driver). Without this, calling into RTAS in interrupt context would have
  the effect of clearing any existing onfault state of the interrupted
  thread, potentially leading to a panic.
  
  r258427:
  For PCI-PCI bridges, #address-cells may be 3. Allow this when parsing the
  ibm,dma-window properties. This is especially a concern when
  #ibm,dma-address-cells is not specified and we have to use the regular
  #address-cells property.

Modified:
  stable/10/sys/powerpc/ofw/rtas.c
  stable/10/sys/powerpc/pseries/plpar_iommu.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/powerpc/ofw/rtas.c
==
--- stable/10/sys/powerpc/ofw/rtas.cThu Dec 12 12:36:40 2013
(r259257)
+++ stable/10/sys/powerpc/ofw/rtas.cThu Dec 12 13:00:07 2013
(r259258)
@@ -192,7 +192,7 @@ int
 rtas_call_method(cell_t token, int nargs, int nreturns, ...)
 {
vm_offset_t argsptr;
-   faultbuf env;
+   faultbuf env, *oldfaultbuf;
va_list ap;
struct {
cell_t token;
@@ -221,6 +221,7 @@ rtas_call_method(cell_t token, int nargs
 
/* Get rid of any stale machine checks that have been waiting.  */
__asm __volatile (sync; isync);
+   oldfaultbuf = curthread-td_pcb-pcb_onfault;
 if (!setfault(env)) {
__asm __volatile (sync);
result = rtascall(argsptr, rtas_private_data);
@@ -228,7 +229,7 @@ rtas_call_method(cell_t token, int nargs
} else {
result = RTAS_HW_ERROR;
}
-   curthread-td_pcb-pcb_onfault = 0;
+   curthread-td_pcb-pcb_onfault = oldfaultbuf;
__asm __volatile (sync);
 
rtas_real_unmap(argsptr, args, sizeof(args));

Modified: stable/10/sys/powerpc/pseries/plpar_iommu.c
==
--- stable/10/sys/powerpc/pseries/plpar_iommu.c Thu Dec 12 12:36:40 2013
(r259257)
+++ stable/10/sys/powerpc/pseries/plpar_iommu.c Thu Dec 12 13:00:07 2013
(r259258)
@@ -73,8 +73,9 @@ phyp_iommu_set_dma_tag(device_t dev, dev
 {
device_t p;
phandle_t node;
-   cell_t dma_acells, dma_scells, dmawindow[5];
+   cell_t dma_acells, dma_scells, dmawindow[6];
struct iommu_map *i;
+   int cell;
 
for (p = child; p != NULL; p = device_get_parent(p)) {
if (ofw_bus_has_prop(p, ibm,my-dma-window))
@@ -104,16 +105,17 @@ phyp_iommu_set_dma_tag(device_t dev, dev
 
struct dma_window *window = malloc(sizeof(struct dma_window),
M_PHYPIOMMU, M_WAITOK);
-   if (dma_acells == 1)
-   window-start = dmawindow[1];
-   else
-   window-start = ((uint64_t)(dmawindow[1])  32) | dmawindow[2];
-   if (dma_scells == 1)
-   window-end = window-start + dmawindow[dma_acells + 1];
-   else
-   window-end = window-start +
-   (((uint64_t)(dmawindow[dma_acells + 1])  32) |
-   dmawindow[dma_acells + 2]);
+   window-start = 0;
+   for (cell = 1; cell  1 + dma_acells; cell++) {
+   window-start = 32;
+   window-start |= dmawindow[cell];
+   }
+   window-end = 0;
+   for (; cell  1 + dma_acells + dma_scells; cell++) {
+   window-end = 32;
+   window-end |= dmawindow[cell];
+   }
+   window-end += window-start;
 
if (bootverbose)
device_printf(dev, Mapping IOMMU domain %#x\n, dmawindow[0]);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r259227 - stable/10/sys/powerpc/pseries

2013-12-11 Thread Andreas Tobler
Author: andreast
Date: Wed Dec 11 20:56:23 2013
New Revision: 259227
URL: http://svnweb.freebsd.org/changeset/base/259227

Log:
  MFC   r258503
  
  Limit the large page size to 16MB for now.

Modified:
  stable/10/sys/powerpc/pseries/mmu_phyp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/powerpc/pseries/mmu_phyp.c
==
--- stable/10/sys/powerpc/pseries/mmu_phyp.cWed Dec 11 19:30:27 2013
(r259226)
+++ stable/10/sys/powerpc/pseries/mmu_phyp.cWed Dec 11 20:56:23 2013
(r259227)
@@ -165,6 +165,11 @@ mphyp_bootstrap(mmu_t mmup, vm_offset_t 
nptlp--;
}
}
+
+   /* For now we allow shift only to be = 0x18. */
+   if (shift = 0x18)
+   shift = 0x18;
+
moea64_large_page_shift = shift;
moea64_large_page_size = 1  shift;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r259230 - stable/10/sys/powerpc/pseries

2013-12-11 Thread Andreas Tobler
Author: andreast
Date: Wed Dec 11 21:37:32 2013
New Revision: 259230
URL: http://svnweb.freebsd.org/changeset/base/259230

Log:
  MFC   r258615
  
  Take care to handle the full 16 byte buffer in the get/put routines. Also,
  skip the VTERM header once when receiving data from the hypervisor call when
  we have a HVTERMPROT connection.

Modified:
  stable/10/sys/powerpc/pseries/phyp_console.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/powerpc/pseries/phyp_console.c
==
--- stable/10/sys/powerpc/pseries/phyp_console.cWed Dec 11 21:21:03 
2013(r259229)
+++ stable/10/sys/powerpc/pseries/phyp_console.cWed Dec 11 21:37:32 
2013(r259230)
@@ -286,6 +286,7 @@ static int
 uart_phyp_get(struct uart_phyp_softc *sc, void *buffer, size_t bufsize)
 {
int err;
+   int hdr = 0;
 
uart_lock(sc-sc_mtx);
if (sc-inbuflen == 0) {
@@ -296,6 +297,7 @@ uart_phyp_get(struct uart_phyp_softc *sc
uart_unlock(sc-sc_mtx);
return (-1);
}
+   hdr = 1; 
}
 
if (sc-inbuflen == 0) {
@@ -305,6 +307,14 @@ uart_phyp_get(struct uart_phyp_softc *sc
 
if (bufsize  sc-inbuflen)
bufsize = sc-inbuflen;
+
+   if ((sc-protocol == HVTERMPROT)  (hdr == 1)) {
+   sc-inbuflen = sc-inbuflen - 4;
+   /* The VTERM protocol has a 4 byte header, skip it here. */
+   memmove(sc-phyp_inbuf.str[0], sc-phyp_inbuf.str[4],
+   sc-inbuflen);
+   }
+
memcpy(buffer, sc-phyp_inbuf.str, bufsize);
sc-inbuflen -= bufsize;
if (sc-inbuflen  0)
@@ -320,32 +330,40 @@ uart_phyp_put(struct uart_phyp_softc *sc
 {
uint16_t seqno;
uint64_t len = 0;
+   int err;
+
union {
-   uint64_t u64;
-   char bytes[8];
+   uint64_t u64[2];
+   char bytes[16];
} cbuf;
 
uart_lock(sc-sc_mtx);
switch (sc-protocol) {
case HVTERM1:
-   if (bufsize  8)
-   bufsize = 8;
+   if (bufsize  16)
+   bufsize = 16;
memcpy(cbuf, buffer, bufsize);
len = bufsize;
break;
case HVTERMPROT:
-   if (bufsize  4)
-   bufsize = 4;
+   if (bufsize  12)
+   bufsize = 12;
seqno = sc-outseqno++;
cbuf.bytes[0] = VS_DATA_PACKET_HEADER;
-   cbuf.bytes[1] = 4 + bufsize; /* total length */
+   cbuf.bytes[1] = 4 + bufsize; /* total length, max 16 bytes */
cbuf.bytes[2] = (seqno  8)  0xff;
cbuf.bytes[3] = seqno  0xff;
memcpy(cbuf.bytes[4], buffer, bufsize);
len = 4 + bufsize;
break;
}
-   phyp_hcall(H_PUT_TERM_CHAR, sc-vtermid, len, cbuf.u64, 0);
+
+   do {
+   err = phyp_hcall(H_PUT_TERM_CHAR, sc-vtermid, len, cbuf.u64[0],
+   cbuf.u64[1]);
+   DELAY(100);
+   } while (err == H_BUSY);
+
uart_unlock(sc-sc_mtx);
 
return (bufsize);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r259231 - stable/10/sys/powerpc/ofw

2013-12-11 Thread Andreas Tobler
Author: andreast
Date: Wed Dec 11 21:41:21 2013
New Revision: 259231
URL: http://svnweb.freebsd.org/changeset/base/259231

Log:
  MFC   r258778
  
  Add a printf to inform about the logical memory block size which is in use
  by the system. This might give a hint why a pSeries system is not booting.

Modified:
  stable/10/sys/powerpc/ofw/ofw_machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/powerpc/ofw/ofw_machdep.c
==
--- stable/10/sys/powerpc/ofw/ofw_machdep.c Wed Dec 11 21:37:32 2013
(r259230)
+++ stable/10/sys/powerpc/ofw/ofw_machdep.c Wed Dec 11 21:41:21 2013
(r259231)
@@ -282,6 +282,7 @@ parse_drconf_memory(int *msz, int *asz, 
res = OF_getprop(phandle, ibm,lmb-size, lmb_size, sizeof(lmb_size));
if (res == -1)
return (0);
+   printf(Logical Memory Block size: %d MB\n, lmb_size[1]  20);
 
/* Parse the /ibm,dynamic-memory.
   The first position gives the # of entries. The next two words
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r259233 - stable/10/sys/powerpc/include

2013-12-11 Thread Andreas Tobler
Author: andreast
Date: Wed Dec 11 22:00:03 2013
New Revision: 259233
URL: http://svnweb.freebsd.org/changeset/base/259233

Log:
  MFC   r259007
  
  Increase PHYS_AVAIL_SZ because on pSeries machines we can have many logical
  regions which represent the total amount of memory. The size of these regions
  is not the physical size of the chip but it is a logical one and it is given
  by the OpenFirmware, it is selectable at boot time and varies between 16MB and
  256MB in my case. There is an 'automatic' option which would select the size 
as
  64MB in case you have around 16GB of RAM.
  To make sure we can allocate RAM with the automatic option bump this value
  of PHYS_AVAIL_SZ to 256.

Modified:
  stable/10/sys/powerpc/include/pmap.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/powerpc/include/pmap.h
==
--- stable/10/sys/powerpc/include/pmap.hWed Dec 11 21:48:04 2013
(r259232)
+++ stable/10/sys/powerpc/include/pmap.hWed Dec 11 22:00:03 2013
(r259233)
@@ -240,7 +240,11 @@ boolean_t  pmap_mmu_install(char *name, i
 
 #definevtophys(va) pmap_kextract((vm_offset_t)(va))
 
-#define PHYS_AVAIL_SZ  128
+#define PHYS_AVAIL_SZ  256 /* Allows up to 16GB Ram on pSeries with
+* logical memory block size of 64MB.
+* For more Ram increase the lmb or this value.
+*/
+
 extern vm_offset_t phys_avail[PHYS_AVAIL_SZ];
 extern vm_offset_t virtual_avail;
 extern vm_offset_t virtual_end;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r259235 - in stable/10/sys: conf dev/tsec powerpc/aim powerpc/include powerpc/ofw

2013-12-11 Thread Andreas Tobler
Author: andreast
Date: Wed Dec 11 22:36:20 2013
New Revision: 259235
URL: http://svnweb.freebsd.org/changeset/base/259235

Log:
  MFC r257991, r257992, 257993, 258504
  
  r257991:
Consolidate Apple firmware hacks and improve them by switching on the
presence of mac-io devices in the tree, which uniquely identifies Apple
hardware.
  
  r257992:
Allow OF_decode_addr() to also be able to map resources on big-endian
devices. To this end, make PCI device detection rely on the device_type
field rather than name, as per the standard.
  
  r257993:
  
Make tsec work with the device tree present on the RB800. The previous code
assumed that the MDIO bus was a direct child of the Ethernet interface. It
may not be and indeed on many device trees is not. While here, add proper
locking for MII transactions, which may be on a bus shared by several MACs.
  
  r258504:
  
Save and restore the trap vectors when doing OF calls on pSeries machines.
  
It turned out that on pSeries machines the call into OF modified the trap
vectors and this made further behaviour unpredictable.
  
With this commit I'm now able to boot multi user on a network booted
environment on my IntelliStation 285. This is a POWER5+ machine.

Modified:
  stable/10/sys/conf/files.powerpc
  stable/10/sys/dev/tsec/if_tsec.c
  stable/10/sys/dev/tsec/if_tsec.h
  stable/10/sys/dev/tsec/if_tsec_fdt.c
  stable/10/sys/dev/tsec/if_tsecreg.h
  stable/10/sys/powerpc/aim/machdep.c
  stable/10/sys/powerpc/include/ofw_machdep.h
  stable/10/sys/powerpc/ofw/ofw_machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/conf/files.powerpc
==
--- stable/10/sys/conf/files.powerpcWed Dec 11 22:26:09 2013
(r259234)
+++ stable/10/sys/conf/files.powerpcWed Dec 11 22:36:20 2013
(r259235)
@@ -140,7 +140,7 @@ powerpc/mpc85xx/mpc85xx.c   optionalmpc85
 powerpc/mpc85xx/nexus.coptionalmpc85xx
 powerpc/mpc85xx/pci_fdt.c  optionalpci mpc85xx
 powerpc/ofw/ofw_cpu.c  optionalaim
-powerpc/ofw/ofw_machdep.c  optionalaim
+powerpc/ofw/ofw_machdep.c  standard
 powerpc/ofw/ofw_pci.c  optionalpci aim
 powerpc/ofw/ofw_pcibus.c   optionalpci aim
 powerpc/ofw/ofw_pcib_pci.c optionalpci aim

Modified: stable/10/sys/dev/tsec/if_tsec.c
==
--- stable/10/sys/dev/tsec/if_tsec.cWed Dec 11 22:26:09 2013
(r259234)
+++ stable/10/sys/dev/tsec/if_tsec.cWed Dec 11 22:36:20 2013
(r259235)
@@ -111,6 +111,8 @@ DRIVER_MODULE(miibus, tsec, miibus_drive
 MODULE_DEPEND(tsec, ether, 1, 1, 1);
 MODULE_DEPEND(tsec, miibus, 1, 1, 1);
 
+struct mtx tsec_phy_mtx;
+
 int
 tsec_attach(struct tsec_softc *sc)
 {
@@ -121,6 +123,10 @@ tsec_attach(struct tsec_softc *sc)
int error = 0;
int i;
 
+   /* Initialize global (because potentially shared) MII lock */
+   if (!mtx_initialized(tsec_phy_mtx))
+   mtx_init(tsec_phy_mtx, tsec mii, NULL, MTX_DEF);
+
/* Reset all TSEC counters */
TSEC_TX_RX_COUNTERS_INIT(sc);
 
@@ -406,21 +412,24 @@ tsec_init_locked(struct tsec_softc *sc)
 */
TSEC_WRITE(sc, TSEC_REG_TBIPA, 5);
 
+   TSEC_PHY_LOCK(sc);
+
/* Step 6: Reset the management interface */
-   TSEC_WRITE(sc-phy_sc, TSEC_REG_MIIMCFG, TSEC_MIIMCFG_RESETMGMT);
+   TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCFG, TSEC_MIIMCFG_RESETMGMT);
 
/* Step 7: Setup the MII Mgmt clock speed */
-   TSEC_WRITE(sc-phy_sc, TSEC_REG_MIIMCFG, TSEC_MIIMCFG_CLKDIV28);
+   TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCFG, TSEC_MIIMCFG_CLKDIV28);
 
/* Step 8: Read MII Mgmt indicator register and check for Busy = 0 */
timeout = TSEC_READ_RETRY;
-   while (--timeout  (TSEC_READ(sc-phy_sc, TSEC_REG_MIIMIND) 
+   while (--timeout  (TSEC_PHY_READ(sc, TSEC_REG_MIIMIND) 
TSEC_MIIMIND_BUSY))
DELAY(TSEC_READ_DELAY);
if (timeout == 0) {
if_printf(ifp, tsec_init_locked(): Mgmt busy timeout\n);
return;
}
+   TSEC_PHY_UNLOCK(sc);
 
/* Step 9: Setup the MII Mgmt */
mii_mediachg(sc-tsec_mii);
@@ -1561,22 +1570,27 @@ tsec_miibus_readreg(device_t dev, int ph
 {
struct tsec_softc *sc;
uint32_t timeout;
+   int rv;
 
sc = device_get_softc(dev);
 
-   TSEC_WRITE(sc-phy_sc, TSEC_REG_MIIMADD, (phy  8) | reg);
-   TSEC_WRITE(sc-phy_sc, TSEC_REG_MIIMCOM, 0);
-   TSEC_WRITE(sc-phy_sc, TSEC_REG_MIIMCOM, TSEC_MIIMCOM_READCYCLE);
+   TSEC_PHY_LOCK();
+   TSEC_PHY_WRITE(sc, TSEC_REG_MIIMADD, (phy  8) | reg);
+   TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCOM, 0);
+   TSEC_PHY_WRITE(sc, TSEC_REG_MIIMCOM, TSEC_MIIMCOM_READCYCLE);
 
timeout = 

Re: svn commit: r259016 - in head/sys: conf dev/drm2 dev/drm2/i915 dev/drm2/radeon dev/fb dev/vt kern modules/drm2/i915kms modules/drm2/radeonkms sparc64/sparc64 sys teken

2013-12-10 Thread Andreas Tobler
On 10.12.13 14:43, Tijl Coosemans wrote:
 On Tue, 10 Dec 2013 15:31:44 +0200 Aleksandr Rybalko wrote:
 That keyboards have no Shift key for that? :)
 I will be glad to apply your changes, but I have to know how it should
 be controlled.

 RU and UA PC keyboards have same 3 symbols '2', '', '@'
 To get '2' i have to press only '2'
 To get '@' I have to press Shift+'2'
 To get '' I have to switch to UA or RU and press Shift+'2'

 Ahh, or use some called Third-Level (IIRC) in Xorg terms. Temporary
 lang switch. Which commonly mapped to one of Alt. Right?
 So R-Alt+Shift+'2'?
 
 https://en.wikipedia.org/wiki/AltGr

Thanks Tijl!

To get the @ I have to press AltGr + '2'.
There are combinations where I have to press AltGr+Shift. e.g to get the
'broken bar, ¦', AltGr+Shift+'7'.

Andreas

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


Re: svn commit: r259016 - in head/sys: conf dev/drm2 dev/drm2/i915 dev/drm2/radeon dev/fb dev/vt kern modules/drm2/i915kms modules/drm2/radeonkms sparc64/sparc64 sys teken

2013-12-08 Thread Andreas Tobler
Hi Aleksandr,

On 08.12.13 00:59, Aleksandr Rybalko wrote:
 Andreas Tobler andre...@freebsd.org написав(ла):
 On 05.12.13 23:38, Aleksandr Rybalko wrote:
 Author: ray
 Date: Thu Dec  5 22:38:53 2013
 New Revision: 259016
 URL: http://svnweb.freebsd.org/changeset/base/259016

 Log:
   Merge VT(9) project (a.k.a. newcons).
   
   Reviewed by:  nwhitehorn
   MFC_to_10_after:  re approval
   
   Sponsored by: The FreeBSD Foundation

 Great! Thanks, gives a new look  feel on the console :)
 Have it running on amd64/i386 and PowerMac(32/64-bit).
 The only thing I need to figure is the mapping of the AltGr or in Mac
 world, the alt key mapping. Iow, the third level mapping of the keys.
 e.g. the @ here is on altgr-2...

 Again, thanks!
 Andreas
 

 I'm glad to fix that, but I've to understand how it is should work :-)

Hehe :)

So do I. I was playing a bit while comparing to syscons.c

And with the below diff I'm able to get what I want. At least when I
press RALT (Altgr) key I get the third symbol printed on my keyboard.
I have a couple of Thinkpads here where I play with. (The PowerMac's are
currently to loud)

For example, on the '2' I have the '' as the second symbol and the '@'
as third symbol. Yeah, these are european keyboards

Now I do not prepend the 0x1b and then my RALT behaves as used to, at
least for me.

I do not know the fine details but LALT and RALT are different.

What do you think, others?

For me this is a really important thing since all the 'special' keys are
not accesible w/o the 'hack' below. If I want the pipe (|), or writing
code ({}, [], ...) I have to remote login to get the characters I need.
But I guess I do not need to explain that ;)

TIA,
Andreas

Index: vt_core.c
===
--- vt_core.c   (revision 259095)
+++ vt_core.c   (working copy)
@@ -408,6 +408,7 @@
} else {
switch (c  ~RELKEY) {
case (SPCLKEY | RALT):
+   break;
case (SPCLKEY | LALT):
vd-vd_kbstate |= ALKED;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org

Re: svn commit: r259016 - in head/sys: conf dev/drm2 dev/drm2/i915 dev/drm2/radeon dev/fb dev/vt kern modules/drm2/i915kms modules/drm2/radeonkms sparc64/sparc64 sys teken

2013-12-07 Thread Andreas Tobler
On 05.12.13 23:38, Aleksandr Rybalko wrote:
 Author: ray
 Date: Thu Dec  5 22:38:53 2013
 New Revision: 259016
 URL: http://svnweb.freebsd.org/changeset/base/259016
 
 Log:
   Merge VT(9) project (a.k.a. newcons).
   
   Reviewed by:nwhitehorn
   MFC_to_10_after:re approval
   
   Sponsored by:   The FreeBSD Foundation

Great! Thanks, gives a new look  feel on the console :)
Have it running on amd64/i386 and PowerMac(32/64-bit).
The only thing I need to figure is the mapping of the AltGr or in Mac
world, the alt key mapping. Iow, the third level mapping of the keys.
e.g. the @ here is on altgr-2...

Again, thanks!
Andreas

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


svn commit: r259006 - head/sys/powerpc/powerpc

2013-12-05 Thread Andreas Tobler
Author: andreast
Date: Thu Dec  5 21:25:56 2013
New Revision: 259006
URL: http://svnweb.freebsd.org/changeset/base/259006

Log:
  In case we have many continous regions without gaps we have to make soure that
  we collapse them into one region. The previous version missed to go back one
  step and do it again.

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

Modified: head/sys/powerpc/powerpc/platform.c
==
--- head/sys/powerpc/powerpc/platform.c Thu Dec  5 21:22:51 2013
(r259005)
+++ head/sys/powerpc/powerpc/platform.c Thu Dec  5 21:25:56 2013
(r259006)
@@ -148,6 +148,7 @@ mem_regions(struct mem_region **phys, in
memcpy(aregions[i], aregions[i+1],
(naregions - i - 1)*sizeof(*aregions));
naregions--;
+   i--;
}
}
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r259007 - head/sys/powerpc/include

2013-12-05 Thread Andreas Tobler
Author: andreast
Date: Thu Dec  5 21:34:33 2013
New Revision: 259007
URL: http://svnweb.freebsd.org/changeset/base/259007

Log:
  Increase PHYS_AVAIL_SZ because on pSeries machines we can have many logical
  regions which represent the total amount of memory. The size of these regions
  is not the physical size of the chip but it is a logical one and it is given
  by the OpenFirmware, it is selectable at boot time and varies between 16MB and
  256MB in my case. There is an 'automatic' option which would select the size 
as
  64MB in case you have around 16GB of RAM.
  To make sure we can allocate RAM with the automatic option bump this value
  of PHYS_AVAIL_SZ to 256.

Modified:
  head/sys/powerpc/include/pmap.h

Modified: head/sys/powerpc/include/pmap.h
==
--- head/sys/powerpc/include/pmap.h Thu Dec  5 21:25:56 2013
(r259006)
+++ head/sys/powerpc/include/pmap.h Thu Dec  5 21:34:33 2013
(r259007)
@@ -240,7 +240,11 @@ boolean_t  pmap_mmu_install(char *name, i
 
 #definevtophys(va) pmap_kextract((vm_offset_t)(va))
 
-#define PHYS_AVAIL_SZ  128
+#define PHYS_AVAIL_SZ  256 /* Allows up to 16GB Ram on pSeries with
+* logical memory block size of 64MB.
+* For more Ram increase the lmb or this value.
+*/
+
 extern vm_offset_t phys_avail[PHYS_AVAIL_SZ];
 extern vm_offset_t virtual_avail;
 extern vm_offset_t virtual_end;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r259008 - head/sys/powerpc/pseries

2013-12-05 Thread Andreas Tobler
Author: andreast
Date: Thu Dec  5 21:35:52 2013
New Revision: 259008
URL: http://svnweb.freebsd.org/changeset/base/259008

Log:
  Do some cosmetic fixes.

Modified:
  head/sys/powerpc/pseries/platform_chrp.c

Modified: head/sys/powerpc/pseries/platform_chrp.c
==
--- head/sys/powerpc/pseries/platform_chrp.cThu Dec  5 21:34:33 2013
(r259007)
+++ head/sys/powerpc/pseries/platform_chrp.cThu Dec  5 21:35:52 2013
(r259008)
@@ -158,14 +158,14 @@ chrp_attach(platform_t plat)
 }
 
 static int
-parse_drconf_memory(int *msz, int *asz, struct mem_region *ofmem,
-   struct mem_region *ofavail)
+parse_drconf_memory(struct mem_region *ofmem, int *msz,
+   struct mem_region *ofavail, int *asz)
 {
phandle_t phandle;
vm_offset_t base;
int i, idx, len, lasz, lmsz, res;
-   uint32_t lmb_size[2];
-   unsigned long *dmem, flags;
+   uint32_t flags, lmb_size[2];
+   uint64_t *dmem;
 
lmsz = *msz;
lasz = *asz;
@@ -208,8 +208,8 @@ parse_drconf_memory(int *msz, int *asz, 
/* Number of elements */
idx = arr[0];
 
-   /* First address. */
-   dmem = (void*)arr[1];
+   /* First address, in arr[1], arr[2]*/
+   dmem = (uint64_t*)arr[1];

for (i = 0; i  idx; i++) {
base = *dmem;
@@ -242,7 +242,7 @@ chrp_mem_regions(platform_t plat, struct
int i;
 
ofw_mem_regions(phys, physsz, avail, availsz);
-   parse_drconf_memory(physsz, availsz, phys, avail);
+   parse_drconf_memory(phys, physsz, avail, availsz);
 
/*
 * On some firmwares (SLOF), some memory may be marked available that
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r258778 - head/sys/powerpc/ofw

2013-11-30 Thread Andreas Tobler
Author: andreast
Date: Sat Nov 30 21:54:55 2013
New Revision: 258778
URL: http://svnweb.freebsd.org/changeset/base/258778

Log:
  Add a printf to inform about the logical memory block size which is in use
  by the system. This might give a hint why a pSeries system is not booting.

Modified:
  head/sys/powerpc/ofw/ofw_machdep.c

Modified: head/sys/powerpc/ofw/ofw_machdep.c
==
--- head/sys/powerpc/ofw/ofw_machdep.c  Sat Nov 30 21:29:34 2013
(r258777)
+++ head/sys/powerpc/ofw/ofw_machdep.c  Sat Nov 30 21:54:55 2013
(r258778)
@@ -309,6 +309,7 @@ parse_drconf_memory(int *msz, int *asz, 
res = OF_getprop(phandle, ibm,lmb-size, lmb_size, sizeof(lmb_size));
if (res == -1)
return (0);
+   printf(Logical Memory Block size: %d MB\n, lmb_size[1]  20);
 
/* Parse the /ibm,dynamic-memory.
   The first position gives the # of entries. The next two words
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r258753 - head/sys/conf

2013-11-29 Thread Andreas Tobler
Author: andreast
Date: Fri Nov 29 20:19:00 2013
New Revision: 258753
URL: http://svnweb.freebsd.org/changeset/base/258753

Log:
  Fix typo.

Modified:
  head/sys/conf/kern.pre.mk

Modified: head/sys/conf/kern.pre.mk
==
--- head/sys/conf/kern.pre.mk   Fri Nov 29 20:14:26 2013(r258752)
+++ head/sys/conf/kern.pre.mk   Fri Nov 29 20:19:00 2013(r258753)
@@ -194,7 +194,7 @@ MKMODULESENV+=  WITHOUT_MODULES=${WITHOU
 MKMODULESENV+= DEBUG_FLAGS=${DEBUG}
 .endif
 
-# Detect knerel config options that force stack frames to be turned on.
+# Detect kernel config options that force stack frames to be turned on.
 DDB_ENABLED!=  grep DDB opt_ddb.h || true ; echo
 DTR_ENABLED!=  grep KDTRACE_FRAME opt_kdtrace.h || true ; echo
 HWPMC_ENABLED!=grep HWPMC opt_hwpmc_hooks.h || true ; echo
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r258722 - head/sys/powerpc/powerpc

2013-11-28 Thread Andreas Tobler
Author: andreast
Date: Thu Nov 28 21:57:17 2013
New Revision: 258722
URL: http://svnweb.freebsd.org/changeset/base/258722

Log:
  Give some output about the CPU clock on IBMPOWER machines, currently read
  from OF. Linux does it similar, means they also read the OF values and
  display them.
  
  Tested under qemu and real hardware:
  
cpu0: IBM POWER5+ revision 2.0, 1898.10 MHz

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

Modified: head/sys/powerpc/powerpc/cpu.c
==
--- head/sys/powerpc/powerpc/cpu.c  Thu Nov 28 19:55:07 2013
(r258721)
+++ head/sys/powerpc/powerpc/cpu.c  Thu Nov 28 21:57:17 2013
(r258722)
@@ -74,6 +74,8 @@
 #include machine/smp.h
 #include machine/spr.h
 
+#include dev/ofw/openfirm.h
+
 static voidcpu_6xx_setup(int cpuid, uint16_t vers);
 static voidcpu_970_setup(int cpuid, uint16_t vers);
 static voidcpu_booke_setup(int cpuid, uint16_t vers);
@@ -273,6 +275,10 @@ cpu_est_clockrate(int cpu_id, uint64_t *
 {
uint16_tvers;
register_t  msr;
+   phandle_t   cpu, dev, root;
+   uint32_tfreq[2];
+   int res  = 0;
+   charbuf[8];
 
vers = mfpvr()  16;
msr = mfmsr();
@@ -316,6 +322,41 @@ cpu_est_clockrate(int cpu_id, uint64_t *
 
mtmsr(msr);
return (0);
+
+   case IBMPOWER5:
+   case IBMPOWER5PLUS:
+   case IBMPOWER6:
+   case IBMPOWER7:
+   case IBMPOWER7PLUS:
+   case IBMPOWER8:
+   root = OF_peer(0);
+   dev = OF_child(root);
+   while (dev != 0) {
+   res = OF_getprop(dev, name, buf, sizeof(buf));
+   if (res  0  strcmp(buf, cpus) == 0)
+   break;
+   dev = OF_peer(dev);
+   }
+   cpu = OF_child(dev);
+   while (cpu != 0) {
+   res = OF_getprop(cpu, device_type, buf,
+   sizeof(buf));
+   if (res  0  strcmp(buf, cpu) == 0)
+   break;
+   cpu = OF_peer(cpu);
+   }
+   if (cpu == 0)
+   return (ENOENT);
+   if (OF_getprop(cpu, clock-frequency, freq[0],
+   sizeof(freq[0])))
+   *cps = freq[0];
+   else if (OF_getprop(cpu, ibm,extended-clock-frequency,
+   freq, sizeof(freq)))
+   *cps = freq[1];
+   else
+   *cps = 0;
+
+   return(0);  
}

return (ENXIO);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r258615 - head/sys/powerpc/pseries

2013-11-25 Thread Andreas Tobler
Author: andreast
Date: Tue Nov 26 05:26:10 2013
New Revision: 258615
URL: http://svnweb.freebsd.org/changeset/base/258615

Log:
  Take care to handle the full 16 byte buffer in the get/put routines. Also,
  skip the VTERM header once when receiving data from the hypervisor call when
  we have a HVTERMPROT connection.
  
  MFC after:1 week

Modified:
  head/sys/powerpc/pseries/phyp_console.c

Modified: head/sys/powerpc/pseries/phyp_console.c
==
--- head/sys/powerpc/pseries/phyp_console.c Tue Nov 26 03:00:54 2013
(r258614)
+++ head/sys/powerpc/pseries/phyp_console.c Tue Nov 26 05:26:10 2013
(r258615)
@@ -286,6 +286,7 @@ static int
 uart_phyp_get(struct uart_phyp_softc *sc, void *buffer, size_t bufsize)
 {
int err;
+   int hdr = 0;
 
uart_lock(sc-sc_mtx);
if (sc-inbuflen == 0) {
@@ -296,6 +297,7 @@ uart_phyp_get(struct uart_phyp_softc *sc
uart_unlock(sc-sc_mtx);
return (-1);
}
+   hdr = 1; 
}
 
if (sc-inbuflen == 0) {
@@ -305,6 +307,14 @@ uart_phyp_get(struct uart_phyp_softc *sc
 
if (bufsize  sc-inbuflen)
bufsize = sc-inbuflen;
+
+   if ((sc-protocol == HVTERMPROT)  (hdr == 1)) {
+   sc-inbuflen = sc-inbuflen - 4;
+   /* The VTERM protocol has a 4 byte header, skip it here. */
+   memmove(sc-phyp_inbuf.str[0], sc-phyp_inbuf.str[4],
+   sc-inbuflen);
+   }
+
memcpy(buffer, sc-phyp_inbuf.str, bufsize);
sc-inbuflen -= bufsize;
if (sc-inbuflen  0)
@@ -320,32 +330,40 @@ uart_phyp_put(struct uart_phyp_softc *sc
 {
uint16_t seqno;
uint64_t len = 0;
+   int err;
+
union {
-   uint64_t u64;
-   char bytes[8];
+   uint64_t u64[2];
+   char bytes[16];
} cbuf;
 
uart_lock(sc-sc_mtx);
switch (sc-protocol) {
case HVTERM1:
-   if (bufsize  8)
-   bufsize = 8;
+   if (bufsize  16)
+   bufsize = 16;
memcpy(cbuf, buffer, bufsize);
len = bufsize;
break;
case HVTERMPROT:
-   if (bufsize  4)
-   bufsize = 4;
+   if (bufsize  12)
+   bufsize = 12;
seqno = sc-outseqno++;
cbuf.bytes[0] = VS_DATA_PACKET_HEADER;
-   cbuf.bytes[1] = 4 + bufsize; /* total length */
+   cbuf.bytes[1] = 4 + bufsize; /* total length, max 16 bytes */
cbuf.bytes[2] = (seqno  8)  0xff;
cbuf.bytes[3] = seqno  0xff;
memcpy(cbuf.bytes[4], buffer, bufsize);
len = 4 + bufsize;
break;
}
-   phyp_hcall(H_PUT_TERM_CHAR, sc-vtermid, len, cbuf.u64, 0);
+
+   do {
+   err = phyp_hcall(H_PUT_TERM_CHAR, sc-vtermid, len, cbuf.u64[0],
+   cbuf.u64[1]);
+   DELAY(100);
+   } while (err == H_BUSY);
+
uart_unlock(sc-sc_mtx);
 
return (bufsize);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r258502 - in head/lib/libc: powerpc powerpc64

2013-11-23 Thread Andreas Tobler
Author: andreast
Date: Sat Nov 23 18:50:43 2013
New Revision: 258502
URL: http://svnweb.freebsd.org/changeset/base/258502

Log:
  Get rid of the CONCAT macro.

Modified:
  head/lib/libc/powerpc/SYS.h
  head/lib/libc/powerpc64/SYS.h

Modified: head/lib/libc/powerpc/SYS.h
==
--- head/lib/libc/powerpc/SYS.h Sat Nov 23 18:32:53 2013(r258501)
+++ head/lib/libc/powerpc/SYS.h Sat Nov 23 18:50:43 2013(r258502)
@@ -36,24 +36,24 @@
 #define_SYSCALL(name)  \
.text;  \
.align 2;   \
-   li  0,(__CONCAT(SYS_, name));   \
+   li  0,(SYS_##name); \
sc
 
 #defineSYSCALL(name)   \
.text;  \
.align 2;   \
 2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
-ENTRY(__CONCAT(__sys_, name)); \
-   WEAK_REFERENCE(__CONCAT(__sys_, name), name);   \
-   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\
+ENTRY(__sys_##name);   \
+   WEAK_REFERENCE(__sys_##name, name); \
+   WEAK_REFERENCE(__sys_##name, _##name);  \
_SYSCALL(name); \
bso 2b
 
 #definePSEUDO(name)\
.text;  \
.align 2;   \
-ENTRY(__CONCAT(__sys_, name)); \
-   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\
+ENTRY(__sys_##name);   \
+   WEAK_REFERENCE(__sys_##name, _##name);  \
_SYSCALL(name); \
bnslr;  \
b   PIC_PLT(CNAME(HIDENAME(cerror)))
@@ -62,9 +62,9 @@ ENTRY(__CONCAT(__sys_, name));
\
.text;  \
.align 2;   \
 2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
-ENTRY(__CONCAT(__sys_, name)); \
-   WEAK_REFERENCE(__CONCAT(__sys_, name), name);   \
-   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\
+ENTRY(__sys_##name);   \
+   WEAK_REFERENCE(__sys_##name, name); \
+   WEAK_REFERENCE(__sys_##name, _##name);  \
_SYSCALL(name); \
bnslr;  \
b   PIC_PLT(CNAME(HIDENAME(cerror)))

Modified: head/lib/libc/powerpc64/SYS.h
==
--- head/lib/libc/powerpc64/SYS.h   Sat Nov 23 18:32:53 2013
(r258501)
+++ head/lib/libc/powerpc64/SYS.h   Sat Nov 23 18:50:43 2013
(r258502)
@@ -36,7 +36,7 @@
 #define_SYSCALL(name)  \
.text;  \
.align 2;   \
-   li  0,(__CONCAT(SYS_, name));   \
+   li  0,(SYS_##name); \
sc
 
 #defineSYSCALL(name)   \
@@ -51,17 +51,17 @@
ld  %r0,16(%r1);\
mtlr%r0;\
blr;\
-ENTRY(__CONCAT(__sys_, name)); \
-   WEAK_REFERENCE(__CONCAT(__sys_, name), name);   \
-   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));  \
-   _SYSCALL(name); \
+ENTRY(__sys_##name);   \
+   WEAK_REFERENCE(__sys_##name, name); \
+   WEAK_REFERENCE(__sys_##name, _##name);  \
+   _SYSCALL(name); \
bso 2b
 
 #definePSEUDO(name)\
.text;  \
.align 2;   \
-ENTRY(__CONCAT(__sys_, name)); \
-   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));   \

svn commit: r258503 - head/sys/powerpc/pseries

2013-11-23 Thread Andreas Tobler
Author: andreast
Date: Sat Nov 23 18:52:14 2013
New Revision: 258503
URL: http://svnweb.freebsd.org/changeset/base/258503

Log:
  Limit the large page size to 16MB for now.
  
  MFC after:1 week

Modified:
  head/sys/powerpc/pseries/mmu_phyp.c

Modified: head/sys/powerpc/pseries/mmu_phyp.c
==
--- head/sys/powerpc/pseries/mmu_phyp.c Sat Nov 23 18:50:43 2013
(r258502)
+++ head/sys/powerpc/pseries/mmu_phyp.c Sat Nov 23 18:52:14 2013
(r258503)
@@ -165,6 +165,11 @@ mphyp_bootstrap(mmu_t mmup, vm_offset_t 
nptlp--;
}
}
+
+   /* For now we allow shift only to be = 0x18. */
+   if (shift = 0x18)
+   shift = 0x18;
+
moea64_large_page_shift = shift;
moea64_large_page_size = 1ULL  shift;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r258504 - in head/sys/powerpc: aim include ofw

2013-11-23 Thread Andreas Tobler
Author: andreast
Date: Sat Nov 23 18:58:17 2013
New Revision: 258504
URL: http://svnweb.freebsd.org/changeset/base/258504

Log:
  Save and restore the trap vectors when doing OF calls on pSeries machines.
  
  It turned out that on pSeries machines the call into OF modified the trap
  vectors and this made further behaviour unpredictable.
  
  With this commit I'm now able to boot multi user on a network booted
  environment on my IntelliStation 285. This is a POWER5+ machine.
  
  Discussed with:   nwhitehorn
  MFC after:1 week

Modified:
  head/sys/powerpc/aim/machdep.c
  head/sys/powerpc/include/ofw_machdep.h
  head/sys/powerpc/ofw/ofw_machdep.c

Modified: head/sys/powerpc/aim/machdep.c
==
--- head/sys/powerpc/aim/machdep.c  Sat Nov 23 18:52:14 2013
(r258503)
+++ head/sys/powerpc/aim/machdep.c  Sat Nov 23 18:58:17 2013
(r258504)
@@ -123,6 +123,7 @@ __FBSDID($FreeBSD$);
 #include machine/spr.h
 #include machine/trap.h
 #include machine/vmparam.h
+#include machine/ofw_machdep.h
 
 #include ddb/ddb.h
 
@@ -249,6 +250,7 @@ extern void *dblow, *dbsize;
 extern void*imisstrap, *imisssize;
 extern void*dlmisstrap, *dlmisssize;
 extern void*dsmisstrap, *dsmisssize;
+char   save_trap_init[0x2f00]; /* EXC_LAST */
 
 uintptr_t
 powerpc_init(vm_offset_t startkernel, vm_offset_t endkernel,
@@ -273,6 +275,9 @@ powerpc_init(vm_offset_t startkernel, vm
trap_offset = 0;
cacheline_warn = 0;
 
+   /* Save trap vectors. */
+   ofw_save_trap_vec(save_trap_init);
+
 #ifdef WII
/*
 * The Wii loader doesn't pass us any environment so, mdp

Modified: head/sys/powerpc/include/ofw_machdep.h
==
--- head/sys/powerpc/include/ofw_machdep.h  Sat Nov 23 18:52:14 2013
(r258503)
+++ head/sys/powerpc/include/ofw_machdep.h  Sat Nov 23 18:58:17 2013
(r258504)
@@ -47,5 +47,6 @@ void OF_reboot(void);
 
 void ofw_mem_regions(struct mem_region **, int *, struct mem_region **, int *);
 void ofw_quiesce(void); /* Must be called before VM is up! */
+void ofw_save_trap_vec(char *);
 
 #endif /* _MACHINE_OFW_MACHDEP_H_ */

Modified: head/sys/powerpc/ofw/ofw_machdep.c
==
--- head/sys/powerpc/ofw/ofw_machdep.c  Sat Nov 23 18:52:14 2013
(r258503)
+++ head/sys/powerpc/ofw/ofw_machdep.c  Sat Nov 23 18:58:17 2013
(r258504)
@@ -59,6 +59,7 @@ __FBSDID($FreeBSD$);
 #include machine/md_var.h
 #include machine/platform.h
 #include machine/ofw_machdep.h
+#include machine/trap.h
 
 static struct mem_region OFmem[PHYS_AVAIL_SZ], OFavail[PHYS_AVAIL_SZ];
 static struct mem_region OFfree[PHYS_AVAIL_SZ];
@@ -70,10 +71,31 @@ extern register_t ofmsr[5];
 extern void*openfirmware_entry;
 static void*fdt;
 intofw_real_mode;
+extern char save_trap_init[0x2f00];  /* EXC_LAST */
+charsave_trap_of[0x2f00];/* EXC_LAST */
 
 intofwcall(void *);
 static int openfirmware(void *args);
 
+__inline void
+ofw_save_trap_vec(char *save_trap_vec)
+{
+   if (apple_hacks)
+return;
+
+   bcopy((void *)EXC_RST, save_trap_vec, EXC_LAST - EXC_RST);
+}
+
+static __inline void
+ofw_restore_trap_vec(char *restore_trap_vec)
+{
+   if (apple_hacks)
+return;
+
+   bcopy(restore_trap_vec, (void *)EXC_RST, EXC_LAST - EXC_RST);
+   __syncicache(EXC_RSVD, EXC_LAST - EXC_RSVD);
+}
+
 /*
  * Saved SPRG0-3 from OpenFirmware. Will be restored prior to the callback.
  */
@@ -524,6 +546,12 @@ openfirmware_core(void *args)
 
ofw_sprg_prepare();
 
+   /* Save trap vectors */
+   ofw_save_trap_vec(save_trap_of);
+
+   /* Restore initially saved trap vectors */
+   ofw_restore_trap_vec(save_trap_init);
+
 #if defined(AIM)  !defined(__powerpc64__)
/*
 * Clear battable[] translations
@@ -535,6 +563,10 @@ openfirmware_core(void *args)
 #endif
 
result = ofwcall(args);
+
+   /* Restore trap vecotrs */
+   ofw_restore_trap_vec(save_trap_of);
+
ofw_sprg_restore();
 
intr_restore(oldmsr);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r258451 - in head: lib/libc/i386 lib/libc/i386/gen lib/libc/i386/string lib/libc/i386/sys lib/libkse/arch/i386/i386 sys/i386/include

2013-11-21 Thread Andreas Tobler
Author: andreast
Date: Thu Nov 21 22:31:18 2013
New Revision: 258451
URL: http://svnweb.freebsd.org/changeset/base/258451

Log:
  Replace the WEAK_ALIAS() alias with the WEAK_REFERENCE() alias. Use it and
  get rid of the __CONCAT and CNAME macros.
  
  Reviewed by:  bde, kib

Modified:
  head/lib/libc/i386/SYS.h
  head/lib/libc/i386/gen/_setjmp.S
  head/lib/libc/i386/gen/setjmp.S
  head/lib/libc/i386/gen/sigsetjmp.S
  head/lib/libc/i386/string/strchr.S
  head/lib/libc/i386/string/strrchr.S
  head/lib/libc/i386/sys/Ovfork.S
  head/lib/libc/i386/sys/getcontext.S
  head/lib/libkse/arch/i386/i386/thr_getcontext.S
  head/sys/i386/include/asm.h

Modified: head/lib/libc/i386/SYS.h
==
--- head/lib/libc/i386/SYS.hThu Nov 21 22:17:55 2013(r258450)
+++ head/lib/libc/i386/SYS.hThu Nov 21 22:31:18 2013(r258451)
@@ -36,22 +36,19 @@
 #include sys/syscall.h
 #include machine/asm.h
 
-#defineSYSCALL(x)  ENTRY(__CONCAT(__sys_,x));  
\
-   .weak CNAME(x); \
-   .set CNAME(x),CNAME(__CONCAT(__sys_,x));\
-   .weak CNAME(__CONCAT(_,x)); \
-   .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
-   mov __CONCAT($SYS_,x),%eax; KERNCALL;   \
-   jb HIDENAME(cerror)
+#defineSYSCALL(name)   ENTRY(__sys_##name);
\
+   WEAK_REFERENCE(__sys_##name, name); \
+   WEAK_REFERENCE(__sys_##name, _##name);  \
+   mov $SYS_##name,%eax; KERNCALL; \
+   jb HIDENAME(cerror)
 
-#defineRSYSCALL(x) SYSCALL(x); ret; END(__CONCAT(__sys_,x))
+#defineRSYSCALL(name)  SYSCALL(name); ret; END(__sys_##name)
 
-#definePSEUDO(x)   ENTRY(__CONCAT(__sys_,x));  
\
-   .weak CNAME(__CONCAT(_,x)); \
-   .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
-   mov __CONCAT($SYS_,x),%eax; KERNCALL;   \
-   jb HIDENAME(cerror); ret; \
-   END(__CONCAT(__sys_,x))
+#definePSEUDO(name)ENTRY(__sys_##name);
\
+   WEAK_REFERENCE(__sys_##name, _##name);  \
+   mov $SYS_##name,%eax; KERNCALL; \
+   jb HIDENAME(cerror); ret;   \
+   END(__sys_##name)
 
 /* gas messes up offset -- although we don't currently need it, do for BCS */
 #defineLCALL(x,y)  .byte 0x9a ; .long y; .word x

Modified: head/lib/libc/i386/gen/_setjmp.S
==
--- head/lib/libc/i386/gen/_setjmp.SThu Nov 21 22:17:55 2013
(r258450)
+++ head/lib/libc/i386/gen/_setjmp.SThu Nov 21 22:31:18 2013
(r258451)
@@ -60,8 +60,7 @@ ENTRY(_setjmp)
ret
 END(_setjmp)
 
-   .weak   CNAME(_longjmp)
-   .setCNAME(_longjmp),CNAME(___longjmp)
+   WEAK_REFERENCE(___longjmp, _longjmp)
 ENTRY(___longjmp)
movl4(%esp),%edx
movl8(%esp),%eax

Modified: head/lib/libc/i386/gen/setjmp.S
==
--- head/lib/libc/i386/gen/setjmp.S Thu Nov 21 22:17:55 2013
(r258450)
+++ head/lib/libc/i386/gen/setjmp.S Thu Nov 21 22:31:18 2013
(r258451)
@@ -78,8 +78,7 @@ ENTRY(setjmp)
ret
 END(setjmp)
 
-   .weak CNAME(longjmp)
-   .set CNAME(longjmp),CNAME(__longjmp)
+   WEAK_REFERENCE(__longjmp, longjmp)
 ENTRY(__longjmp)
movl4(%esp),%edx
PIC_PROLOGUE

Modified: head/lib/libc/i386/gen/sigsetjmp.S
==
--- head/lib/libc/i386/gen/sigsetjmp.S  Thu Nov 21 22:17:55 2013
(r258450)
+++ head/lib/libc/i386/gen/sigsetjmp.S  Thu Nov 21 22:31:18 2013
(r258451)
@@ -87,8 +87,7 @@ ENTRY(sigsetjmp)
ret
 END(sigsetjmp)
 
-   .weak CNAME(siglongjmp);
-   .set CNAME(siglongjmp),CNAME(__siglongjmp)
+   WEAK_REFERENCE(__siglongjmp, siglongjmp)
 ENTRY(__siglongjmp)
movl4(%esp),%edx
cmpl$0,44(%edx)

Modified: head/lib/libc/i386/string/strchr.S
==
--- head/lib/libc/i386/string/strchr.S  Thu Nov 21 22:17:55 2013
(r258450)
+++ head/lib/libc/i386/string/strchr.S  Thu Nov 21 22:31:18 2013
(r258451)
@@ -63,6 +63,6 @@ L2:
ret
 END(strchr)
 
-WEAK_ALIAS(index, strchr)
+WEAK_REFERENCE(strchr, index)
 
.section .note.GNU-stack,,%progbits

Modified: 

svn commit: r258447 - in head: lib/libc/amd64 lib/libc/amd64/gen lib/libc/amd64/sys sys/amd64/include

2013-11-21 Thread Andreas Tobler
Author: andreast
Date: Thu Nov 21 21:25:58 2013
New Revision: 258447
URL: http://svnweb.freebsd.org/changeset/base/258447

Log:
  Introduce a WEAK_REFERENCE() alias and use it. Get rid of the CNAME and the
  CONCAT macros in SYS.h.
  
  Reviewed by:  bde, kib

Modified:
  head/lib/libc/amd64/SYS.h
  head/lib/libc/amd64/gen/_setjmp.S
  head/lib/libc/amd64/gen/setjmp.S
  head/lib/libc/amd64/gen/sigsetjmp.S
  head/lib/libc/amd64/sys/getcontext.S
  head/lib/libc/amd64/sys/pipe.S
  head/lib/libc/amd64/sys/reboot.S
  head/lib/libc/amd64/sys/setlogin.S
  head/lib/libc/amd64/sys/vfork.S
  head/sys/amd64/include/asm.h

Modified: head/lib/libc/amd64/SYS.h
==
--- head/lib/libc/amd64/SYS.h   Thu Nov 21 21:19:01 2013(r258446)
+++ head/lib/libc/amd64/SYS.h   Thu Nov 21 21:25:58 2013(r258447)
@@ -36,20 +36,17 @@
 #include sys/syscall.h
 #include machine/asm.h
 
-#defineRSYSCALL(x) ENTRY(__CONCAT(__sys_,x));  
\
-   .weak CNAME(x); \
-   .set CNAME(x),CNAME(__CONCAT(__sys_,x));\
-   .weak CNAME(__CONCAT(_,x)); \
-   .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
-   mov __CONCAT($SYS_,x),%eax; KERNCALL;   \
+#defineRSYSCALL(name)  ENTRY(__sys_##name);
\
+   WEAK_REFERENCE(__sys_##name, name); \
+   WEAK_REFERENCE(__sys_##name, _##name);  \
+   mov $SYS_##name,%eax; KERNCALL; \
jb HIDENAME(cerror); ret;   \
-   END(__CONCAT(__sys_,x))
+   END(__sys_##name)
 
-#definePSEUDO(x)   ENTRY(__CONCAT(__sys_,x));  
\
-   .weak CNAME(__CONCAT(_,x)); \
-   .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
-   mov __CONCAT($SYS_,x),%eax; KERNCALL;   \
+#definePSEUDO(name)ENTRY(__sys_##name);
\
+   WEAK_REFERENCE(__sys_##name, _##name);  \
+   mov $SYS_##name,%eax; KERNCALL; \
jb HIDENAME(cerror); ret;   \
-   END(__CONCAT(__sys_,x))
+   END(__sys_##name)
 
-#define KERNCALL   movq %rcx, %r10; syscall
+#defineKERNCALLmovq %rcx, %r10; syscall

Modified: head/lib/libc/amd64/gen/_setjmp.S
==
--- head/lib/libc/amd64/gen/_setjmp.S   Thu Nov 21 21:19:01 2013
(r258446)
+++ head/lib/libc/amd64/gen/_setjmp.S   Thu Nov 21 21:25:58 2013
(r258447)
@@ -63,8 +63,7 @@ ENTRY(_setjmp)
ret
 END(_setjmp)
 
-   .weak   CNAME(_longjmp)
-   .setCNAME(_longjmp),CNAME(___longjmp)
+   WEAK_REFERENCE(___longjmp, _longjmp)
 ENTRY(___longjmp)
movq%rdi,%rdx
/* Restore the mxcsr, but leave exception flags intact. */

Modified: head/lib/libc/amd64/gen/setjmp.S
==
--- head/lib/libc/amd64/gen/setjmp.SThu Nov 21 21:19:01 2013
(r258446)
+++ head/lib/libc/amd64/gen/setjmp.SThu Nov 21 21:25:58 2013
(r258447)
@@ -73,8 +73,7 @@ ENTRY(setjmp)
ret
 END(setjmp)
 
-   .weak CNAME(longjmp)
-   .set CNAME(longjmp),CNAME(__longjmp)
+   WEAK_REFERENCE(__longjmp, longjmp)
 ENTRY(__longjmp)
pushq   %rdi
pushq   %rsi

Modified: head/lib/libc/amd64/gen/sigsetjmp.S
==
--- head/lib/libc/amd64/gen/sigsetjmp.S Thu Nov 21 21:19:01 2013
(r258446)
+++ head/lib/libc/amd64/gen/sigsetjmp.S Thu Nov 21 21:25:58 2013
(r258447)
@@ -80,8 +80,7 @@ ENTRY(sigsetjmp)
ret
 END(sigsetjmp)
 
-   .weak CNAME(siglongjmp)
-   .set CNAME(siglongjmp),CNAME(__siglongjmp)
+   WEAK_REFERENCE(__siglongjmp, siglongjmp)
 ENTRY(__siglongjmp)
cmpl$0,88(%rdi)
jz  2f

Modified: head/lib/libc/amd64/sys/getcontext.S
==
--- head/lib/libc/amd64/sys/getcontext.SThu Nov 21 21:19:01 2013
(r258446)
+++ head/lib/libc/amd64/sys/getcontext.SThu Nov 21 21:25:58 2013
(r258447)
@@ -34,10 +34,8 @@ __FBSDID($FreeBSD$);
  * Otherwise, the setcontext() syscall will return here and we'll
  * pop off the return address and go to the *setcontext* call.
  */
-   .weak   _getcontext
-   .set_getcontext,__sys_getcontext
-   .weak   getcontext
-   .setgetcontext,__sys_getcontext
+

  1   2   3   >