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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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, &ppc32_maxdsiz,
+ 0, "");
+#define PPC32_MAXSSIZ (64*1024*1024)
+u_long ppc32_maxssiz = PPC32_MAXSSIZ;
+SYSCTL_ULONG(_compat_ppc32, OID_AUTO, maxssiz, CTLFLAG_RWTUN, &ppc32_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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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

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 
  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 
  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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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", &gpcipar,
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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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, &conf, 1);
+   err = ds1631_write(dev, addr, DS1631_CONTROL, &conf, sizeof(conf));
if (err < 0) {
device_printf(dev, "ds1631 write config failed: %x\n", err);
return (-1);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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, &buf, 1);
+   err = ad7417_write(dev, addr, AD7417_CONFIG2, &buf, sizeof(buf));
 
 /* Read & cache Config1 */
buf = 0;
-   err = ad7417_write(dev, addr, AD7417_CONFIG, &buf, 1);
+   err = ad7417_write(dev, addr, AD7417_CONFIG, &buf, sizeof(buf));
err = ad7417_read_1(dev, addr, AD7417_CONFIG, &buf);
adc741x_config = (uint8_t)buf;
 
/* Disable shutdown mode */
adc741x_config &= 0xfe;
buf = adc741x_config;
-   err = ad7417_write(dev, addr, AD7417_CONFIG, &buf, 1);
+   err = ad7417_write(dev, addr, AD7417_CONFIG, &buf, 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,

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->sc_fans[i],
&sc->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, f

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->sc_fans[i],
&sc->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 | C

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

2011-03-17 Thread Andreas Tobler
Author: andreast
Date: Thu Mar 17 19:44:00 2011
New Revision: 219718
URL: http://svn.freebsd.org/changeset/base/219718

Log:
  Remove duplicate definition of FIRSTARG.
  
  Approved by:  nwhitehorn (mentor)

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

Modified: head/sys/powerpc/include/frame.h
==
--- head/sys/powerpc/include/frame.hThu Mar 17 17:29:46 2011
(r219717)
+++ head/sys/powerpc/include/frame.hThu Mar 17 19:44:00 2011
(r219718)
@@ -107,9 +107,6 @@ struct callframe {
 
 /* Definitions for syscalls */
 #defineFIRSTARG3   /* first arg in 
reg 3 */
-
-/* Definitions for syscalls */
-#defineFIRSTARG3   /* first arg in 
reg 3 */
 #defineNARGREG 8   /* 8 args in 
regs */
 #defineMOREARGS(sp)((caddr_t)((uintptr_t)(sp) + \
 sizeof(struct callframe) - 3*sizeof(register_t))) /* more args go here */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2011-04-14 Thread Andreas Tobler
Author: andreast
Date: Thu Apr 14 18:14:43 2011
New Revision: 220638
URL: http://svn.freebsd.org/changeset/base/220638

Log:
  Add stoppcbs[] arrays on powerpc(64) and have each CPU save its
  current context in the IPI_STOP handler. Similar as done on other
  architectures.
  
  Approved by: nwhitehorn (mentor)

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

Modified: head/sys/powerpc/powerpc/mp_machdep.c
==
--- head/sys/powerpc/powerpc/mp_machdep.c   Thu Apr 14 17:50:26 2011
(r220637)
+++ head/sys/powerpc/powerpc/mp_machdep.c   Thu Apr 14 18:14:43 2011
(r220638)
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -62,6 +63,7 @@ volatile static u_int ap_letgo;
 volatile static u_quad_t ap_timebase;
 static u_int ipi_msg_cnt[32];
 static struct mtx ap_boot_mtx;
+struct pcb stoppcbs[MAXCPU];
 
 void
 machdep_ap_bootstrap(void)
@@ -306,6 +308,7 @@ powerpc_ipi_handler(void *arg)
 */
CTR1(KTR_SMP, "%s: IPI_STOP or IPI_STOP_HARD (stop)",
__func__);
+   savectx(&stoppcbs[PCPU_GET(cpuid)]);
self = PCPU_GET(cpumask);
savectx(PCPU_GET(curpcb));
atomic_set_int(&stopped_cpus, self);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2011-04-14 Thread Andreas Tobler
Author: andreast
Date: Thu Apr 14 18:26:50 2011
New Revision: 220639
URL: http://svn.freebsd.org/changeset/base/220639

Log:
  The macro MOEA_PVO_CHECK is empty and not used. It is a left over from the
  NetBSD import. Remove the definition and all its occurrences.
  
  Approved by: nwhitehorn (mentor)

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

Modified: head/sys/powerpc/aim/mmu_oea.c
==
--- head/sys/powerpc/aim/mmu_oea.c  Thu Apr 14 18:14:43 2011
(r220638)
+++ head/sys/powerpc/aim/mmu_oea.c  Thu Apr 14 18:26:50 2011
(r220639)
@@ -161,8 +161,6 @@ __FBSDID("$FreeBSD$");
 #defineVSID_TO_SR(vsid)((vsid) & 0xf)
 #defineVSID_TO_HASH(vsid)  (((vsid) >> 4) & 0xf)
 
-#defineMOEA_PVO_CHECK(pvo)
-
 struct ofw_map {
vm_offset_t om_va;
vm_size_t   om_len;
@@ -1809,7 +1807,6 @@ moea_remove_all(mmu_t mmu, vm_page_t m)
for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) {
next_pvo = LIST_NEXT(pvo, pvo_vlink);
 
-   MOEA_PVO_CHECK(pvo);/* sanity check */
pmap = pvo->pvo_pmap;
PMAP_LOCK(pmap);
moea_pvo_remove(pvo, -1);
@@ -2163,7 +2160,6 @@ moea_pte_spill(vm_offset_t addr)
/*
 * We need to find a pvo entry for this address.
 */
-   MOEA_PVO_CHECK(pvo);
if (source_pvo == NULL &&
moea_pte_match(&pvo->pvo_pte.pte, sr, addr,
pvo->pvo_pte.pte.pte_hi & PTE_HID)) {
@@ -2176,7 +2172,6 @@ moea_pte_spill(vm_offset_t addr)
if (j >= 0) {
PVO_PTEGIDX_SET(pvo, j);
moea_pte_overflow--;
-   MOEA_PVO_CHECK(pvo);
mtx_unlock(&moea_table_mutex);
return (1);
}
@@ -2215,7 +2210,6 @@ moea_pte_spill(vm_offset_t addr)
 */
LIST_FOREACH(pvo, &moea_pvo_table[ptegidx ^ moea_pteg_mask],
pvo_olink) {
-   MOEA_PVO_CHECK(pvo);
/*
 * We also need the pvo entry of the victim we are
 * replacing so save the R & C bits of the PTE.
@@ -2245,9 +2239,6 @@ moea_pte_spill(vm_offset_t addr)
PVO_PTEGIDX_SET(source_pvo, i);
moea_pte_replacements++;
 
-   MOEA_PVO_CHECK(victim_pvo);
-   MOEA_PVO_CHECK(source_pvo);
-
mtx_unlock(&moea_table_mutex);
return (1);
 }
@@ -2299,7 +2290,6 @@ moea_query_bit(vm_page_t m, int ptebit)
 
vm_page_lock_queues();
LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
-   MOEA_PVO_CHECK(pvo);/* sanity check */
 
/*
 * See if we saved the bit off.  If so, cache it and return
@@ -2307,7 +2297,6 @@ moea_query_bit(vm_page_t m, int ptebit)
 */
if (pvo->pvo_pte.pte.pte_lo & ptebit) {
moea_attr_save(m, ptebit);
-   MOEA_PVO_CHECK(pvo);/* sanity check */
vm_page_unlock_queues();
return (TRUE);
}
@@ -2320,7 +2309,6 @@ moea_query_bit(vm_page_t m, int ptebit)
 */
powerpc_sync();
LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
-   MOEA_PVO_CHECK(pvo);/* sanity check */
 
/*
 * See if this pvo has a valid PTE.  if so, fetch the
@@ -2333,7 +2321,6 @@ moea_query_bit(vm_page_t m, int ptebit)
mtx_unlock(&moea_table_mutex);
if (pvo->pvo_pte.pte.pte_lo & ptebit) {
moea_attr_save(m, ptebit);
-   MOEA_PVO_CHECK(pvo);/* sanity check */
vm_page_unlock_queues();
return (TRUE);
}
@@ -2373,7 +2360,6 @@ moea_clear_bit(vm_page_t m, int ptebit)
 */
count = 0;
LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
-   MOEA_PVO_CHECK(pvo);/* sanity check */
pt = moea_pvo_to_pte(pvo, -1);
if (pt != NULL) {
moea_pte_synch(pt, &pvo->pvo_pte.pte);
@@ -2384,7 +2370,6 @@ moea_clear_bit(vm_page_t m, int ptebit)
mtx_unlock(&moea_table_mutex);
}
pvo->pvo_pte.pte.pte_lo &= ~ptebit;
-   MOEA_PVO_CHECK(pvo);/* sanity check */
}
 
vm_page_unlock_queues();

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cThu Apr 14 18:14:43 2011  

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

2011-04-14 Thread Andreas Tobler
Author: andreast
Date: Thu Apr 14 19:37:31 2011
New Revision: 220642
URL: http://svn.freebsd.org/changeset/base/220642

Log:
  Adjust debugging string to match the actual function.
  
  Approved by: nwhitehorn (mentor)

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

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cThu Apr 14 19:11:45 2011
(r220641)
+++ head/sys/powerpc/aim/mmu_oea64.cThu Apr 14 19:37:31 2011
(r220642)
@@ -936,7 +936,7 @@ moea64_late_bootstrap(mmu_t mmup, vm_off
pa = moea64_bootstrap_alloc(KSTACK_PAGES * PAGE_SIZE, PAGE_SIZE);
va = virtual_avail + KSTACK_GUARD_PAGES * PAGE_SIZE;
virtual_avail = va + KSTACK_PAGES * PAGE_SIZE;
-   CTR2(KTR_PMAP, "moea_bootstrap: kstack0 at %#x (%#x)", pa, va);
+   CTR2(KTR_PMAP, "moea64_bootstrap: kstack0 at %#x (%#x)", pa, va);
thread0.td_kstack = va;
thread0.td_kstack_pages = KSTACK_PAGES;
for (i = 0; i < KSTACK_PAGES; i++) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2011-04-19 Thread Andreas Tobler
Author: andreast
Date: Tue Apr 19 07:49:58 2011
New Revision: 220818
URL: http://svn.freebsd.org/changeset/base/220818

Log:
  Add leading zeros when printing the physical memory chunks on __powerpc64__.
  
  Approved by:  nwhitehorn (mentor)

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

Modified: head/sys/powerpc/aim/machdep.c
==
--- head/sys/powerpc/aim/machdep.c  Tue Apr 19 07:45:54 2011
(r220817)
+++ head/sys/powerpc/aim/machdep.c  Tue Apr 19 07:49:58 2011
(r220818)
@@ -202,7 +202,7 @@ cpu_startup(void *dummy)
phys_avail[indx + 1] - phys_avail[indx];
 
#ifdef __powerpc64__
-   printf("0x%16lx - 0x%16lx, %ld bytes (%ld pages)\n",
+   printf("0x%016lx - 0x%016lx, %ld bytes (%ld pages)\n",
#else
printf("0x%08x - 0x%08x, %d bytes (%ld pages)\n",
#endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r228330 - in head: include sys/sys

2011-12-08 Thread Andreas Tobler

On 07.12.11 22:17, David Chisnall wrote:

Author: theraven
Date: Wed Dec  7 21:17:50 2011
New Revision: 228330
URL: http://svn.freebsd.org/changeset/base/228330

Log:
   As per das@'s suggestion, s/__noreturn/_Noreturn/, since the latter is an
   identifier reserved for the implementation in C99 and earlier so there is
   no sensible reason for introducing yet another reserved identifier when we
   could just use the one C1x uses.

   Approved by: brooks (mentor)



Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hWed Dec  7 21:02:35 2011(r228329)
+++ head/sys/sys/cdefs.hWed Dec  7 21:17:50 2011(r228330)
@@ -220,13 +220,13 @@


  #if defined(__cplusplus)&&  __cplusplus>= 201103L
-#define__noreturn  [[noreturn]]
+#define_Noreturn   [[noreturn]]
  #elif defined(__STDC_VERSION__)&&  __STDC_VERSION__>  201000L
-#define__noreturn  _Noreturn
+/* Do nothing - _Noreturn is a keyword */
  #elif defined(__GNUC__)
-#define__noreturn  __attribute__((__noreturn__))
+#define_Noreturn   __attribute__((__noreturn__))


This and the previous commit broke bootstrapping gcc.
The problem is this:
/export/devel/build/gcc/head/objdir/./gcc/include-fixed/stdlib.h:96:1: 
error: expected unqualified-id before '[' token


Line in question is: _Noreturn void  abort(void);
Where _Noreturn gets expanded to [[noreturn]]

I helped myself with adding the below. Well. No clue if it is correct. 
But at least I can continue building gcc trunk.


Thanks,
Andreas

Index: cdefs.h
===
--- cdefs.h (revision 228352)
+++ cdefs.h (working copy)
@@ -219,7 +219,7 @@
 #endif


-#if defined(__cplusplus) && __cplusplus >= 201103L
+#if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__GNUC__)
 #define_Noreturn   [[noreturn]]
 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L
 /* Do nothing - _Noreturn is a keyword */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r228330 - in head: include sys/sys

2011-12-11 Thread Andreas Tobler

On 08.12.11 21:40, Andreas Tobler wrote:

On 07.12.11 22:17, David Chisnall wrote:

Author: theraven
Date: Wed Dec  7 21:17:50 2011
New Revision: 228330
URL: http://svn.freebsd.org/changeset/base/228330

Log:
As per das@'s suggestion, s/__noreturn/_Noreturn/, since the latter is an
identifier reserved for the implementation in C99 and earlier so there is
no sensible reason for introducing yet another reserved identifier when we
could just use the one C1x uses.

Approved by:brooks (mentor)



Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hWed Dec  7 21:02:35 2011(r228329)
+++ head/sys/sys/cdefs.hWed Dec  7 21:17:50 2011(r228330)
@@ -220,13 +220,13 @@


   #if defined(__cplusplus)&&   __cplusplus>= 201103L
-#define__noreturn  [[noreturn]]
+#define_Noreturn   [[noreturn]]
   #elif defined(__STDC_VERSION__)&&   __STDC_VERSION__>   201000L
-#define__noreturn  _Noreturn
+/* Do nothing - _Noreturn is a keyword */
   #elif defined(__GNUC__)
-#define__noreturn  __attribute__((__noreturn__))
+#define_Noreturn   __attribute__((__noreturn__))


This and the previous commit broke bootstrapping gcc.
The problem is this:
/export/devel/build/gcc/head/objdir/./gcc/include-fixed/stdlib.h:96:1:
error: expected unqualified-id before '[' token

Line in question is: _Noreturn void  abort(void);
Where _Noreturn gets expanded to [[noreturn]]

I helped myself with adding the below. Well. No clue if it is correct.
But at least I can continue building gcc trunk.


As far as I understand, GCC does not support this attribute [[noreturn]] 
yet. But it defines both, __cplusplus and __cplusplus=201103L. On 
gcc-4.7 __cplusplus=201103L is the default when we build libstdc++.


So I think we have to extend the check as below or we can reorder the 
defines that GNUC is before the __cplusplus &&  __cplusplus>= 201103L.


I'd appreciate any comments on this.

Thanks,
Andreas


Index: cdefs.h
===
--- cdefs.h (revision 228352)
+++ cdefs.h (working copy)
@@ -219,7 +219,7 @@
   #endif


-#if defined(__cplusplus)&&  __cplusplus>= 201103L
+#if defined(__cplusplus)&&  __cplusplus>= 201103L&&  !defined(__GNUC__)
   #define  _Noreturn   [[noreturn]]
   #elif defined(__STDC_VERSION__)&&  __STDC_VERSION__>  201000L
   /* Do nothing - _Noreturn is a keyword */


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


Re: svn commit: r228955 - head/include

2011-12-29 Thread Andreas Tobler

On 29.12.11 15:41, Ed Schouten wrote:

Author: ed
Date: Thu Dec 29 14:41:17 2011
New Revision: 228955
URL: http://svn.freebsd.org/changeset/base/228955

Log:
   Don't define static_assert for C++.

   Even though _Static_assert() is pretty robust for C code, it cannot work
   correctly with C++ code.  This is due to the fact that C++ template
   parameters may contain commas that are not enclosed in parentheses. For
   example:

static_assert(foo::bar == baz, "...");

   This causes _Static_assert to be called with an excessive number of
   parameters.  If you want to use static_assert in C++, just use a C++11
   compiler.

   Reported on: current@, ports@


Thank you Ed! gcc-4.6 bootstrap successful.

Andreas

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


Re: svn commit: r228955 - head/include

2011-12-29 Thread Andreas Tobler

Hi Ed,

On 29.12.11 19:32, Ed Schouten wrote:


* Andreas Tobler, 20111229 18:43:

Thank you Ed! gcc-4.6 bootstrap successful.


But it seems GCC 4.7 is still broken. I am not planning to fix that,
because it's a shortcoming of GCC. As soon as the GNU folks implement
C++11 [[noreturn]], it should work again.


Yep, gcc-trunk is still broken. I help(ed) myself with a 
!defined(__GNUC__) with this I can continue hacking on trunk...


Well, I possibly do not understand all/everything regarding this 
[[noreturn]]. But I do not see an activity in this direction on the gcc 
side.
They implemented the _Noreturn for STDC but the double-square-bracket 
notation for noreturn C++ I do not see. As said, I might simply do not 
see it.


Thanks again,
Andreas

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


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

2012-01-04 Thread Andreas Tobler
Author: andreast
Date: Wed Jan  4 16:02:52 2012
New Revision: 229494
URL: http://svn.freebsd.org/changeset/base/229494

Log:
  Introduce internal macros for __U/INT64_C to define the U/INT64_MAX/MIN
  values properly. The previous definition only worked if __STDC_LIMIT_MACROS
  and __STDC_CONSTANT_MACROS were defined at the same time.

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

Modified: head/sys/powerpc/include/_stdint.h
==
--- head/sys/powerpc/include/_stdint.h  Wed Jan  4 15:59:49 2012
(r229493)
+++ head/sys/powerpc/include/_stdint.h  Wed Jan  4 16:02:52 2012
(r229494)
@@ -65,6 +65,14 @@
 
 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
 
+#ifdef __LP64__
+#define__INT64_C(c)(c ## L)
+#define__UINT64_C(c)   (c ## UL)
+#else
+#define__INT64_C(c)(c ## LL)
+#define__UINT64_C(c)   (c ## ULL)
+#endif
+
 /*
  * ISO/IEC 9899:1999
  * 7.18.2.1 Limits of exact-width integer types
@@ -73,19 +81,19 @@
 #defineINT8_MIN(-0x7f-1)
 #defineINT16_MIN   (-0x7fff-1)
 #defineINT32_MIN   (-0x7fff-1)
-#defineINT64_MIN   (-INT64_C(0x7fff)-1)
+#defineINT64_MIN   (-__INT64_C(0x7fff)-1)
 
 /* Maximum values of exact-width signed integer types. */
 #defineINT8_MAX0x7f
 #defineINT16_MAX   0x7fff
 #defineINT32_MAX   0x7fff
-#defineINT64_MAX   INT64_C(0x7fff)
+#defineINT64_MAX   __INT64_C(0x7fff)
 
 /* Maximum values of exact-width unsigned integer types. */
 #defineUINT8_MAX   0xff
 #defineUINT16_MAX  0x
 #defineUINT32_MAX  0x
-#defineUINT64_MAX  UINT64_C(0x)
+#defineUINT64_MAX  __UINT64_C(0x)
 
 /*
  * ISO/IEC 9899:1999
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r229496 - head/sys/mips/include

2012-01-04 Thread Andreas Tobler
Author: andreast
Date: Wed Jan  4 16:07:16 2012
New Revision: 229496
URL: http://svn.freebsd.org/changeset/base/229496

Log:
  Apply the same change as in r229494.
  
  Requested by: ed

Modified:
  head/sys/mips/include/_stdint.h

Modified: head/sys/mips/include/_stdint.h
==
--- head/sys/mips/include/_stdint.h Wed Jan  4 16:04:20 2012
(r229495)
+++ head/sys/mips/include/_stdint.h Wed Jan  4 16:07:16 2012
(r229496)
@@ -66,6 +66,14 @@
 
 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
 
+#ifdef __mips_n64
+#define __INT64_C(c)  (c ## L)
+#define __UINT64_C(c) (c ## UL)
+#else
+#define __INT64_C(c)  (c ## LL)
+#define __UINT64_C(c) (c ## ULL)
+#endif
+
 /*
  * ISO/IEC 9899:1999
  * 7.18.2.1 Limits of exact-width integer types
@@ -74,19 +82,19 @@
 #defineINT8_MIN(-0x7f-1)
 #defineINT16_MIN   (-0x7fff-1)
 #defineINT32_MIN   (-0x7fff-1)
-#defineINT64_MIN   (-INT64_C(0x7fff)-1)
+#defineINT64_MIN   (-__INT64_C(0x7fff)-1)
 
 /* Maximum values of exact-width signed integer types. */
 #defineINT8_MAX0x7f
 #defineINT16_MAX   0x7fff
 #defineINT32_MAX   0x7fff
-#defineINT64_MAX   INT64_C(0x7fff)
+#defineINT64_MAX   __INT64_C(0x7fff)
 
 /* Maximum values of exact-width unsigned integer types. */
 #defineUINT8_MAX   0xff
 #defineUINT16_MAX  0x
 #defineUINT32_MAX  0x
-#defineUINT64_MAX  UINT64_C(0x)
+#defineUINT64_MAX  __UINT64_C(0x)
 
 /*
  * ISO/IEC 9899:1999
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r229660 - head/sys/powerpc/conf

2012-01-05 Thread Andreas Tobler
Author: andreast
Date: Thu Jan  5 22:06:01 2012
New Revision: 229660
URL: http://svn.freebsd.org/changeset/base/229660

Log:
  Fix build on powerpc64 too. The same as r229640.

Modified:
  head/sys/powerpc/conf/GENERIC64

Modified: head/sys/powerpc/conf/GENERIC64
==
--- head/sys/powerpc/conf/GENERIC64 Thu Jan  5 21:50:50 2012
(r229659)
+++ head/sys/powerpc/conf/GENERIC64 Thu Jan  5 22:06:01 2012
(r229660)
@@ -170,6 +170,10 @@ device cdce# Generic USB over 
Etherne
 device cue # CATC USB Ethernet
 device kue # Kawasaki LSI USB Ethernet
 
+# Wireless NIC cards
+options IEEE80211_SUPPORT_MESH
+options AH_SUPPORT_AR5416
+
 # FireWire support
 device firewire# FireWire bus code
 device sbp # SCSI over FireWire (Requires scbus and da)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-01-06 Thread Andreas Tobler
Author: andreast
Date: Fri Jan  6 09:21:40 2012
New Revision: 229693
URL: http://svn.freebsd.org/changeset/base/229693

Log:
  Use the macro WEAK_ALIAS. Tested on 32 and 64-bit.

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 Fri Jan  6 09:17:34 2012(r229692)
+++ head/lib/libc/powerpc/SYS.h Fri Jan  6 09:21:40 2012(r229693)
@@ -44,10 +44,8 @@
.align 2;   \
 2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
 ENTRY(__CONCAT(__sys_,x)); \
-   .weak   CNAME(x);   \
-   .setCNAME(x),CNAME(__CONCAT(__sys_,x)); \
-   .weak   CNAME(__CONCAT(_,x));   \
-   .setCNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
+   WEAK_ALIAS(x,__CONCAT(__sys_,x));   \
+   WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));   \
_SYSCALL(x);\
bso 2b
 
@@ -55,8 +53,7 @@ ENTRY(__CONCAT(__sys_,x));
\
.text;  \
.align 2;   \
 ENTRY(__CONCAT(__sys_,x)); \
-   .weak   CNAME(__CONCAT(_,x));   \
-   .setCNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
+   WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));   \
_SYSCALL(x);\
bnslr;  \
b   PIC_PLT(CNAME(HIDENAME(cerror)))
@@ -66,10 +63,8 @@ ENTRY(__CONCAT(__sys_,x));   
\
.align 2;   \
 2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
 ENTRY(__CONCAT(__sys_,x)); \
-   .weak   CNAME(x);   \
-   .setCNAME(x),CNAME(__CONCAT(__sys_,x)); \
-   .weak   CNAME(__CONCAT(_,x));   \
-   .setCNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
+   WEAK_ALIAS(x,__CONCAT(__sys_,x));   \
+   WEAK_ALIAS(__CONCAT(_,x), __CONCAT(__sys_,x));  \
_SYSCALL(x);\
bnslr;  \
b   PIC_PLT(CNAME(HIDENAME(cerror)))

Modified: head/lib/libc/powerpc64/SYS.h
==
--- head/lib/libc/powerpc64/SYS.h   Fri Jan  6 09:17:34 2012
(r229692)
+++ head/lib/libc/powerpc64/SYS.h   Fri Jan  6 09:21:40 2012
(r229693)
@@ -52,10 +52,8 @@
mtlr%r0;\
blr;\
 ENTRY(__CONCAT(__sys_,x)); \
-   .weak   CNAME(x);   \
-   .setCNAME(x),CNAME(__CONCAT(__sys_,x)); \
-   .weak   CNAME(__CONCAT(_,x));   \
-   .setCNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
+   WEAK_ALIAS(x,__CONCAT(__sys_,x));   \
+   WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));   \
_SYSCALL(x);\
bso 2b
 
@@ -63,8 +61,7 @@ ENTRY(__CONCAT(__sys_,x));
\
.text;  \
.align 2;   \
 ENTRY(__CONCAT(__sys_,x)); \
-   .weak   CNAME(__CONCAT(_,x));   \
-   .setCNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
+   WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));   \
_SYSCALL(x);\
bnslr;  \
mflr%r0;\
@@ -81,10 +78,8 @@ ENTRY(__CONCAT(__sys_,x));   
\
.text;  \
.align 2;   \
 ENTRY(__CONCAT(__sys_,x)); \
-   .weak   CNAME(x);   \
-   .setCNAME(x),CNAME(__CONCAT(__sys_,x)); \
-   .weak   CNAME(__CONCAT(_,x));   \
-   .setCNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
+   WEAK_ALIAS(x,__CONCAT(__sys_,x));   

svn commit: r229715 - head/contrib/gcc/config

2012-01-06 Thread Andreas Tobler
Author: andreast
Date: Fri Jan  6 18:37:49 2012
New Revision: 229715
URL: http://svn.freebsd.org/changeset/base/229715

Log:
  Silence a warning about redefinition of TARGET_ELF on powerpc.

Modified:
  head/contrib/gcc/config/freebsd.h

Modified: head/contrib/gcc/config/freebsd.h
==
--- head/contrib/gcc/config/freebsd.h   Fri Jan  6 18:29:40 2012
(r229714)
+++ head/contrib/gcc/config/freebsd.h   Fri Jan  6 18:37:49 2012
(r229715)
@@ -63,6 +63,7 @@ Boston, MA 02110-1301, USA.  */
 /* All FreeBSD Architectures support the ELF object file format.  */
 #undef  OBJECT_FORMAT_ELF
 #define OBJECT_FORMAT_ELF  1
+#undef  TARGET_ELF
 #define TARGET_ELF 1
 
 /* Don't assume anything about the header files.  */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r229693 - in head/lib/libc: powerpc powerpc64

2012-01-06 Thread Andreas Tobler

Hi Bruce,

thank you for the feedback. I wasn't aware about the fine details.

I try to understand and implement what you suggest. It may take several 
iterations until I match everything.


On 06.01.12 14:12, Bruce Evans wrote:

On Fri, 6 Jan 2012, Andreas Tobler wrote:


Log:
  Use the macro WEAK_ALIAS. Tested on 32 and 64-bit.


This API should be fixed before using it extensively.  It has the args
reversed relative to the C API __weak_reference().  Also, its name is
different, and the spelling of "=" in its implementation is different.
Perhaps the arg order makes sense for both, since for WEAK_ALIAS() the
alias is the first arg, while for __weak_reference() the symbol being
referred to to create the alias is the first arg.  But this is still
confusing.

The easiest way to fix this is to remove WEAK_ALIAS() and add an asm
API WEAK_REFERENCE().  Unfortunately, ALIAS is a better name than
REFERENCE.  __weak_reference() is not so easy to change since it is
used extensively


So, I started with a WEAK_REFERENCE macro in sys/powerpc/asm.h
It is like the WEAK_ALIAS but with reversed arguments:

+#define WEAK_REFERENCE(sym, alias) \
+   .weak alias;\
+   alias = sym
+

Here I do not have a preference for the "=" implementation, is it "=" or 
is it .set .


If we find a final version I'll be able to delete the WEAK_ALIAS.


Similarly for STRONG_ALIAS() and __strong_reference(), except
STRONG_REFERENCE() doesn't exist for most arches and __strong_reference()
didn't exist until this week, so neither is used extensively.

More details on current existence and use of these:

In the kernel, WEAK_ALIAS is not defined for amd64 or sparc64, and is
never used.

In libc, WEAK_ALIAS was only used for arm, ia64 and mips.  Now it is used
for some i386 string functions.

In the kernel, STRONG_ALIAS was only defined for mips, and was never used.
Now it is also defined for i386, and is never used.

In libc, STRONG_ALIAS was not used.  It was used for a few days in some
i386 string functions.  This was a bug.  Now WEAK_ALIAS is used instead,
and STRONG_ALIAS is not used again.  It is another bug that these
"optimized" i386 string functions (strchr/index and strrchr/rindex) even
exist.  amd64 doesn't have them.  The MI versions are not very optimal,
but neither are the i386 ones.


Modified: head/lib/libc/powerpc/SYS.h
==
--- head/lib/libc/powerpc/SYS.h Fri Jan  6 09:17:34 2012(r229692)
+++ head/lib/libc/powerpc/SYS.h Fri Jan  6 09:21:40 2012(r229693)
@@ -44,10 +44,8 @@
.align 2;   \
2:  b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
ENTRY(__CONCAT(__sys_,x));  \
-   .weak   CNAME(x);   \
-   .setCNAME(x),CNAME(__CONCAT(__sys_,x)); \
-   .weak   CNAME(__CONCAT(_,x));   \
-   .setCNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
+   WEAK_ALIAS(x,__CONCAT(__sys_,x));   \
+   WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));   \
_SYSCALL(x);\
bso 2b



The style bugs in this should be fixed someday.  This is still messed up
to support K&R.  With ancient cpp's, you had to write __CONCAT(x,y) instead
of __CONCAT(x, y) to avoid getting a space between x and y.  This was fixed
in Standard C 22 years ago, but all SYS.h files in libc except ia64's one
still use the ugly __CONCAT(x,y) in most places.  ia64 hard-codes
__CONCAT(x, y) as x ## y instead.

The missing space after the comma for the WEAK_ALIAS() parameters is even
less necessary.  For ancient cpp's, it allowed WEAK_ALIAS to format the
asm directives without a space.  With STDC cpp's, the formatting is
controlled by the macro, but it is still hard to produce nice formatting
because cpp may change whitespace.


If I get the above right, the snippet from above should look like this, 
right?


@@ -51,20 +51,17 @@
ld  %r0,16(%r1);\
mtlr%r0;\
blr;\
-ENTRY(__CONCAT(__sys_,x)); \
-   .weak   CNAME(x);   \
-   .setCNAME(x),CNAME(__CONCAT(__sys_,x)); \
-   .weak   CNAME(__CONCAT(_,x));   \
-   .setCNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
+ENTRY(__CONCAT(__sys_, x));\
+   WEAK_REFERENCE(__CONCAT(__sys_, x), x); \
+   WEAK_REFERENCE(__CONCAT(__sys_, x), __CONCAT(_, x)); 

svn commit: r229806 - in head/lib/libc: powerpc/gen powerpc64/gen

2012-01-08 Thread Andreas Tobler
Author: andreast
Date: Sun Jan  8 11:57:38 2012
New Revision: 229806
URL: http://svn.freebsd.org/changeset/base/229806

Log:
  Two other places where we can use WEAK_ALIAS.

Modified:
  head/lib/libc/powerpc/gen/setjmp.S
  head/lib/libc/powerpc64/gen/setjmp.S

Modified: head/lib/libc/powerpc/gen/setjmp.S
==
--- head/lib/libc/powerpc/gen/setjmp.S  Sun Jan  8 09:56:24 2012
(r229805)
+++ head/lib/libc/powerpc/gen/setjmp.S  Sun Jan  8 11:57:38 2012
(r229806)
@@ -69,8 +69,7 @@ ENTRY(setjmp)
li  %r3,0   /* return (0) */
blr
 
-   .weak CNAME(longjmp)
-   .set CNAME(longjmp),CNAME(__longjmp)
+   WEAK_ALIAS(longjmp, __longjmp)
 ENTRY(__longjmp)
lmw %r9,20(%r3) /* restore regs */
mr  %r6,%r4 /* save val param */

Modified: head/lib/libc/powerpc64/gen/setjmp.S
==
--- head/lib/libc/powerpc64/gen/setjmp.SSun Jan  8 09:56:24 2012
(r229805)
+++ head/lib/libc/powerpc64/gen/setjmp.SSun Jan  8 11:57:38 2012
(r229806)
@@ -93,10 +93,7 @@ ENTRY(setjmp)
li  %r3,0   /* return (0) */
blr
 
-   .weak CNAME(longjmp)
-   .set CNAME(longjmp),CNAME(__longjmp)
-   .weak CNAME(.longjmp)
-   .set CNAME(.longjmp),CNAME(.__longjmp)
+   WEAK_ALIAS(longjmp, __longjmp)
 ENTRY(__longjmp)
ld  %r9,40 + 0*8(%r3)
ld  %r10,40 + 1*8(%r3)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r230390 - head/sys/conf

2012-01-20 Thread Andreas Tobler
Author: andreast
Date: Fri Jan 20 18:49:47 2012
New Revision: 230390
URL: http://svn.freebsd.org/changeset/base/230390

Log:
  Disable GUPROF on archs other than i386/amd64 since the fine details are not
  implemented.

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

Modified: head/sys/conf/kern.pre.mk
==
--- head/sys/conf/kern.pre.mk   Fri Jan 20 17:25:15 2012(r230389)
+++ head/sys/conf/kern.pre.mk   Fri Jan 20 18:49:47 2012(r230390)
@@ -103,11 +103,14 @@ ASM_CFLAGS= -x assembler-with-cpp -DLOCO
 
 .if defined(PROFLEVEL) && ${PROFLEVEL} >= 1
 CFLAGS+=   -DGPROF -falign-functions=16
+PROF=  -pg
 .if ${PROFLEVEL} >= 2
 CFLAGS+=   -DGPROF4 -DGUPROF
-PROF=  -pg -mprofiler-epilogue
+.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
+PROF+= -mprofiler-epilogue
 .else
-PROF=  -pg
+.error "GUPROF not supported on ${MACHINE_CPUARCH}."
+.endif
 .endif
 .endif
 DEFINED_PROF=  ${PROF}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r230391 - head/sys/conf

2012-01-20 Thread Andreas Tobler
Author: andreast
Date: Fri Jan 20 18:52:31 2012
New Revision: 230391
URL: http://svn.freebsd.org/changeset/base/230391

Log:
  Add the .opd section, this is helps booting a profiled kernel.
  Adjust the OUTPUT_ARCH and use the builtin ALIGN() to adjust the data segment.

Modified:
  head/sys/conf/ldscript.powerpc64

Modified: head/sys/conf/ldscript.powerpc64
==
--- head/sys/conf/ldscript.powerpc64Fri Jan 20 18:49:47 2012
(r230390)
+++ head/sys/conf/ldscript.powerpc64Fri Jan 20 18:52:31 2012
(r230391)
@@ -1,7 +1,7 @@
 /* $FreeBSD$ */
 
 OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc", "elf64-powerpc")
-OUTPUT_ARCH(powerpc)
+OUTPUT_ARCH(powerpc:common64)
 ENTRY(__start)
 SEARCH_DIR(/usr/lib);
 PROVIDE (__stack = 0);
@@ -56,15 +56,19 @@ SECTIONS
   .sdata2: { *(.sdata2)  }
   .sbss2 : { *(.sbss2)   }
   /* Adjust the address for the data segment to the next page up. */
-  . = ((. + 0x1000) & ~(0x1000 - 1));
+  . = ALIGN(4096);
   .data:
   {
 *(.data)
 *(.gnu.linkonce.d*)
 CONSTRUCTORS
   }
-  .data1   : { *(.data1) }
-  .got1   : { *(.got1) }
+  .data1 : { *(.data1) }
+  .toc1  : ALIGN(8) { *(.toc1) }
+  .opd   : ALIGN(8) { KEEP (*(.opd)) }
+  .branch_lt : ALIGN(8) { *(.branch_lt) }
+  .got   : ALIGN(8) { *(.got .toc) }
+
   .dynamic: { *(.dynamic) }
   /* Put .ctors and .dtors next to the .got2 section, so that the pointers
  get relocated with -mrelocatable. Also put in the .fixup pointers.
@@ -81,10 +85,6 @@ SECTIONS
   .fixup  : { *(.fixup) }
 PROVIDE (_FIXUP_END_ = .);
 PROVIDE (_GOT2_END_ = .);
-PROVIDE (_GOT_START_ = .);
-  .got: { *(.got) }
-  .got.plt: { *(.got.plt) }
-PROVIDE (_GOT_END_ = .);
   /* We want the small data sections together, so single-instruction offsets
  can access them all, and initialized data all before uninitialized, so
  we can shorten the on-disk segment size.  */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r230400 - in head: lib/libc/powerpc64/sys sys/powerpc/aim sys/powerpc/include sys/powerpc/ofw sys/powerpc/powerpc

2012-01-20 Thread Andreas Tobler
Author: andreast
Date: Fri Jan 20 22:34:19 2012
New Revision: 230400
URL: http://svn.freebsd.org/changeset/base/230400

Log:
  This commit adds profiling support for powerpc64. Now we can do application
  profiling and kernel profiling. To enable kernel profiling one has to build
  kgmon(8). I will enable the build once I managed to build and test powerpc
  (32-bit) kernels with profiling support.
  
  - add a powerpc64 PROF_PROLOGUE for _mcount.
  - add macros to avoid adding the PROF_PROLOGUE in certain assembly entries.
  - apply these macros where needed.
  - add size information to the MCOUNT function.
  
  MFC after:3 weeks, together with r230291

Modified:
  head/lib/libc/powerpc64/sys/cerror.S
  head/sys/powerpc/aim/locore64.S
  head/sys/powerpc/aim/swtch64.S
  head/sys/powerpc/aim/trap_subr64.S
  head/sys/powerpc/include/asm.h
  head/sys/powerpc/include/profile.h
  head/sys/powerpc/ofw/ofwcall64.S
  head/sys/powerpc/powerpc/atomic.S
  head/sys/powerpc/powerpc/setjmp.S

Modified: head/lib/libc/powerpc64/sys/cerror.S
==
--- head/lib/libc/powerpc64/sys/cerror.SFri Jan 20 22:31:52 2012
(r230399)
+++ head/lib/libc/powerpc64/sys/cerror.SFri Jan 20 22:34:19 2012
(r230400)
@@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
 * programs and the initial threaded in threaded programs,
 * it returns a pointer to the global errno variable.
 */
-ENTRY(HIDENAME(cerror))
+ENTRY_NOPROF(HIDENAME(cerror))
mflr%r0
std %r0,16(%r1) /* save lr */
stdu%r1,-64(%r1)/* allocate new stack frame */

Modified: head/sys/powerpc/aim/locore64.S
==
--- head/sys/powerpc/aim/locore64.S Fri Jan 20 22:31:52 2012
(r230399)
+++ head/sys/powerpc/aim/locore64.S Fri Jan 20 22:34:19 2012
(r230400)
@@ -115,7 +115,7 @@ kernel_text:
  * segment!
  */
.text
-ASENTRY(__start)
+ASENTRY_NOPROF(__start)
li  8,0
li  9,0x100
mtctr   9
@@ -202,7 +202,7 @@ tocbase:
  * or the (currently used) C code optimized, so it doesn't use any non-volatile
  * registers.
  */
-ASENTRY(setfault)
+ASENTRY_NOPROF(setfault)
mflr0
mfcr12
mfsprg  4,0

Modified: head/sys/powerpc/aim/swtch64.S
==
--- head/sys/powerpc/aim/swtch64.S  Fri Jan 20 22:31:52 2012
(r230399)
+++ head/sys/powerpc/aim/swtch64.S  Fri Jan 20 22:34:19 2012
(r230400)
@@ -68,7 +68,7 @@
 /*
  * void cpu_throw(struct thread *old, struct thread *new)
  */
-ENTRY(cpu_throw)
+ENTRY_NOPROF(cpu_throw)
mr  %r13, %r4
b   cpu_switchin
 
@@ -79,7 +79,7 @@ ENTRY(cpu_throw)
  *
  * Switch to a new thread saving the current state in the old thread.
  */
-ENTRY(cpu_switch)
+ENTRY_NOPROF(cpu_switch)
ld  %r6,TD_PCB(%r3) /* Get the old thread's PCB ptr */
std %r12,PCB_CONTEXT(%r6)   /* Save the non-volatile GP regs.
   These can now be used for scratch */
@@ -237,7 +237,7 @@ blocked_loop:
  * savectx(pcb)
  * Update pcb, saving current processor state
  */
-ENTRY(savectx)
+ENTRY_NOPROF(savectx)
std %r12,PCB_CONTEXT(%r3)   /* Save the non-volatile GP regs. */
std %r13,PCB_CONTEXT+1*8(%r3)   
std %r14,PCB_CONTEXT+2*8(%r3)   
@@ -268,7 +268,8 @@ ENTRY(savectx)
  * fork_trampoline()
  * Set up the return from cpu_fork()
  */
-ENTRY(fork_trampoline)
+
+ENTRY_NOPROF(fork_trampoline)
ld  %r3,CF_FUNC(%r1)
ld  %r4,CF_ARG0(%r1)
ld  %r5,CF_ARG1(%r1)

Modified: head/sys/powerpc/aim/trap_subr64.S
==
--- head/sys/powerpc/aim/trap_subr64.S  Fri Jan 20 22:31:52 2012
(r230399)
+++ head/sys/powerpc/aim/trap_subr64.S  Fri Jan 20 22:34:19 2012
(r230400)
@@ -703,7 +703,7 @@ CNAME(asttrapexit):
 /*
  * Deliberate entry to dbtrap
  */
-ASENTRY(breakpoint)
+ASENTRY_NOPROF(breakpoint)
mtsprg1 %r1
mfmsr   %r3
mtsrr1  %r3

Modified: head/sys/powerpc/include/asm.h
==
--- head/sys/powerpc/include/asm.h  Fri Jan 20 22:31:52 2012
(r230399)
+++ head/sys/powerpc/include/asm.h  Fri Jan 20 22:34:19 2012
(r230400)
@@ -76,15 +76,35 @@
 #endif
 
 #if defined(PROF) || (defined(_KERNEL) && defined(GPROF))
-# define   _PROF_PROLOGUE  mflr 0; stw 0,4(1); bl _mcount
+# ifdef __powerpc64__
+#   define _PROF_PROLOGUE  mflr 0; \
+   std 3,48(1);\
+   std 4,56(1);\
+

Re: svn commit: r230390 - head/sys/conf

2012-01-20 Thread Andreas Tobler

On 21.01.12 03:52, Bruce Evans wrote:

On Fri, 20 Jan 2012, Andreas Tobler wrote:


Log:
  Disable GUPROF on archs other than i386/amd64 since the fine details are not
  implemented.


This was intentionally not done.  Just don't use config -pp on arches that
don't suppport it.  "profile 2" is already left out of NOTES for all
arches except amd64, i386 and powerpc.  But the configuration of "profile"
in the NOTES for these arches is broken anyway.  It doesn't exist.  Thus
even normal profiling is not tested by NOTES on these arches.


I sent this patch to -CURRENT:

http://lists.freebsd.org/pipermail/freebsd-current/2012-January/031095.html

...and got no feedback.

Is there a better place to send such patches for review?

I got positive feedback from marius regarding the sparc64 case.


Modified: head/sys/conf/kern.pre.mk
==
--- head/sys/conf/kern.pre.mk   Fri Jan 20 17:25:15 2012(r230389)
+++ head/sys/conf/kern.pre.mk   Fri Jan 20 18:49:47 2012(r230390)
@@ -103,11 +103,14 @@ ASM_CFLAGS= -x assembler-with-cpp -DLOCO

.if defined(PROFLEVEL)&&  ${PROFLEVEL}>= 1
CFLAGS+=-DGPROF -falign-functions=16
+PROF=  -pg
.if ${PROFLEVEL}>= 2
CFLAGS+=-DGPROF4 -DGUPROF
-PROF=  -pg -mprofiler-epilogue
+.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"


Style bug: unsorted tests.


Copied from here:

sys/conf/kern.post.mk: line 174




+PROF+= -mprofiler-epilogue


GUPROF is completely broken in amd64 and i386 too:
- -mprofiler-epilogue is broken in gcc-4.  It used to be possible to
work around this by building kernels with gcc-3, but I think there
are now some build problems with this.
- certain optimizations break GUPROF:
- -O2 breaks it even with gcc-3
- optimizations in gcc-4 break it further.  Especially, -funit-at-a-time
  -finline-functions-called-once.  These also break ordinary profiling,
  debugging, and stack traces in debuggers and panics.  These and -O2
  are now the defaults :-(.
- GUPROF never worked with SMP (except in my version).

OTOH, using GUPROF with SMP avoids some deadlocks on amd64 and i386.
See MCOUNT_ENTER() and MCOUNT_EXIT() on these arches.  These use an
atomic_cmpset() which deadlocks any time a trap occurs in mcount()
(since the trap code is profiled).  Tracing through mcount() always
causes such traps.  This bug is accidentally avoided by GUPROF, since
it doesn't pretend to support SMP so it doesn't do any cmpset- type
locking.  This is fixed in my version by doing more delicate locking
in mcount() for both GUPROF and !GUPROF.  All arches need this.

Other arches mostly only do intr_disable()/restore() in MCOUNT_ENTER()/
EXIT().  Thus for the SMP case they have common races instead of not-so-
common deadlocks.  These arches don't pretend to support SMP any more
than GUPROF does.  The exceptions are mips and sparc64.  mips has the
cmpsets, and sparc64 has rdpr()/wrpr() which I think are are just
lower-level forms of interrupt disabling (they mask ALL interrupts,
while intr_disable() only masks most interrupts?)  Masking of traps
too would prevent deadlocks and avoid the need for cmpsets, but is not
possible.  Important traps like NMIs and debugger traps are not
maskable.


.else
-PROF=  -pg
+.error "GUPROF not supported on ${MACHINE_CPUARCH}."


Style bug: error messages are not terminated with a "." in KNF.


+.endif
.endif
.endif
DEFINED_PROF=   ${PROF}


Do you want me to revert?

Thanks for the review.

Andreas

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


Re: svn commit: r229693 - in head/lib/libc: powerpc powerpc64

2012-01-21 Thread Andreas Tobler

I write this reply from another machine...

Here is what I have tested so far.

Is this the right approach?

Thank you in advance,
Andreas




Index: lib/libc/powerpc/SYS.h
===
--- lib/libc/powerpc/SYS.h  (revision 230383)
+++ lib/libc/powerpc/SYS.h  (working copy)
@@ -33,38 +33,38 @@
 #include 
 #include 
 
-#define _SYSCALL(x)\
-   .text;  \
-   .align 2;   \
-   li  0,(__CONCAT(SYS_,x));   \
+#define _SYSCALL(name) \
+   .text;  \
+   .align 2;   \
+   li  0,(__CONCAT(SYS_, name));   \
sc
 
-#defineSYSCALL(x)  \
-   .text;  \
-   .align 2;   \
-2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
-ENTRY(__CONCAT(__sys_,x)); \
-   WEAK_ALIAS(x,__CONCAT(__sys_,x));   \
-   WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));   \
-   _SYSCALL(x);\
+#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));  \
+   _SYSCALL(name); \
bso 2b
 
-#definePSEUDO(x)   \
-   .text;  \
-   .align 2;   \
-ENTRY(__CONCAT(__sys_,x)); \
-   WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));   \
-   _SYSCALL(x);\
-   bnslr;  \
+#definePSEUDO(name)
\
+   .text;  \
+   .align 2;   \
+ENTRY(__CONCAT(__sys_, name)); \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));  \
+   _SYSCALL(name); \
+   bnslr;  \
b   PIC_PLT(CNAME(HIDENAME(cerror)))
 
-#defineRSYSCALL(x) \
-   .text;  \
-   .align 2;   \
-2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
-ENTRY(__CONCAT(__sys_,x)); \
-   WEAK_ALIAS(x,__CONCAT(__sys_,x));   \
-   WEAK_ALIAS(__CONCAT(_,x), __CONCAT(__sys_,x));  \
-   _SYSCALL(x);\
-   bnslr;  \
+#defineRSYSCALL(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));  \
+   _SYSCALL(name); \
+   bnslr;  \
b   PIC_PLT(CNAME(HIDENAME(cerror)))
Index: lib/libc/powerpc/gen/setjmp.S
===
--- lib/libc/powerpc/gen/setjmp.S   (revision 230383)
+++ lib/libc/powerpc/gen/setjmp.S   (working copy)
@@ -69,7 +69,7 @@
li  %r3,0   /* return (0) */
blr
 
-   WEAK_ALIAS(longjmp, __longjmp)
+   WEAK_REFERENCE(CNAME(__longjmp), longjmp)
 ENTRY(__longjmp)
lmw %r9,20(%r3) /* restore regs */
mr  %r6,%r4   

svn commit: r230422 - head/sys/conf

2012-01-21 Thread Andreas Tobler
Author: andreast
Date: Sat Jan 21 11:42:40 2012
New Revision: 230422
URL: http://svn.freebsd.org/changeset/base/230422

Log:
  Revert r230390.

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

Modified: head/sys/conf/kern.pre.mk
==
--- head/sys/conf/kern.pre.mk   Sat Jan 21 08:26:41 2012(r230421)
+++ head/sys/conf/kern.pre.mk   Sat Jan 21 11:42:40 2012(r230422)
@@ -103,14 +103,11 @@ ASM_CFLAGS= -x assembler-with-cpp -DLOCO
 
 .if defined(PROFLEVEL) && ${PROFLEVEL} >= 1
 CFLAGS+=   -DGPROF -falign-functions=16
-PROF=  -pg
 .if ${PROFLEVEL} >= 2
 CFLAGS+=   -DGPROF4 -DGUPROF
-.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
-PROF+= -mprofiler-epilogue
+PROF=  -pg -mprofiler-epilogue
 .else
-.error "GUPROF not supported on ${MACHINE_CPUARCH}."
-.endif
+PROF=  -pg
 .endif
 .endif
 DEFINED_PROF=  ${PROF}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r229693 - in head/lib/libc: powerpc powerpc64

2012-01-21 Thread Andreas Tobler

On 01/21/12 12:46, Bruce Evans wrote:

On Sat, 21 Jan 2012, Andreas Tobler wrote:


I write this reply from another machine...

Here is what I have tested so far.

Is this the right approach?


Seems mostly what I want. I wouldn't change the right-justification
of the backslashes, since most places don't need it and it gives
unreadable diffs. More later.


Ok, removed right-justification.

Would you like to see the ALIGN_TEXT in the same diff/commit or do you 
agree if I do two steps?


Thanks again for the review. I appreciate your input!

Andreas


Index: sys/powerpc/include/asm.h
===
--- sys/powerpc/include/asm.h   (revision 230401)
+++ sys/powerpc/include/asm.h   (working copy)
@@ -116,9 +116,9 @@
 #define __FBSDID(s)/* nothing */
 #endif /* not lint and not STRIP_FBSDID */
 
-#defineWEAK_ALIAS(alias,sym)   \
+#define WEAK_REFERENCE(sym, alias) \
.weak alias;\
-   alias = sym
+   .equ alias, sym
 
 #ifdef __STDC__
 #defineWARN_REFERENCES(_sym,_msg)  \
Index: lib/libc/powerpc/SYS.h
===
--- lib/libc/powerpc/SYS.h  (revision 230383)
+++ lib/libc/powerpc/SYS.h  (working copy)
@@ -33,38 +33,38 @@
 #include 
 #include 
 
-#define _SYSCALL(x)\
+#define_SYSCALL(name)  \
.text;  \
.align 2;   \
-   li  0,(__CONCAT(SYS_,x));   \
+   li  0,(__CONCAT(SYS_, name));   \
sc
 
-#defineSYSCALL(x)  \
+#defineSYSCALL(name)   \
.text;  \
.align 2;   \
 2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
-ENTRY(__CONCAT(__sys_,x)); \
-   WEAK_ALIAS(x,__CONCAT(__sys_,x));   \
-   WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));   \
-   _SYSCALL(x);\
+ENTRY(__CONCAT(__sys_, name)); \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), name);   \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\
+   _SYSCALL(name); \
bso 2b
 
-#definePSEUDO(x)   \
+#definePSEUDO(name)\
.text;  \
.align 2;   \
-ENTRY(__CONCAT(__sys_,x)); \
-   WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x));   \
-   _SYSCALL(x);\
+ENTRY(__CONCAT(__sys_, name)); \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\
+   _SYSCALL(name); \
bnslr;  \
b   PIC_PLT(CNAME(HIDENAME(cerror)))
 
-#defineRSYSCALL(x) \
+#defineRSYSCALL(name)  \
.text;  \
.align 2;   \
 2: b   PIC_PLT(CNAME(HIDENAME(cerror)));   \
-ENTRY(__CONCAT(__sys_,x)); \
-   WEAK_ALIAS(x,__CONCAT(__sys_,x));   \
-   WEAK_ALIAS(__CONCAT(_,x), __CONCAT(__sys_,x));  \
-   _SYSCALL(x);\
+ENTRY(__CONCAT(__sys_, name)); \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), name);   \
+   WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\
+   _SYSCALL(name); \
bnslr;  \
b   PIC_PLT(CNAME(HIDENAME(cerror)))
Index: lib/libc/powerpc/gen/setjmp.S
===
--- lib/libc/powerpc/gen/setjmp.S   (revision 230383)
+++ lib/libc/powerpc/gen/setjmp.S   (working copy)
@@ -69,7 +69,7 @@
li  %r3,0   /* return (0) */
blr
 
-   WEAK_ALIAS(longjmp, __longjmp)
+   WEAK_REFERENCE(CNAME(__longjmp), longjmp)
 ENTRY(__longjmp)
lmw %r9,20(%r3) /* re

Re: svn commit: r230353 - head/usr.sbin/makefs

2012-01-24 Thread Andreas Tobler

Hi Eitan,

On 20.01.12 02:38, Eitan Adler wrote:

Author: eadler
Date: Fri Jan 20 01:38:21 2012
New Revision: 230353
URL: http://svn.freebsd.org/changeset/base/230353

Log:
   Fix warning when compiling with gcc46:
   error: variable 'temp' set but not used

   Approved by: dim
   Approved by: cperciva (mentor, blanket for pre-mentorship already-approved 
commits)
   MFC after:   3 days


I do not know which of the makefs commits it was:

[andreast@neon] /export/home/andreast/>  makefs -t cd9660 -o chrp-boot 
-o rockridge -o label=pseries -B4321 p.iso /data1/netboot/powerpc64/

Segmentation fault (core dumped)

[neon:~] andreast% uname -ra
FreeBSD neon.andreas.nets 10.0-CURRENT FreeBSD 10.0-CURRENT #11 
r230469M: Mon Jan 23 02:53:05 CET 2012 
andre...@neon.andreas.nets:/usr/obj/export/devel/fbsd/head/src/sys/NEON 
 amd64


Reverting to 230352 lets me create an iso.

I compile makefs with the base compiler.

I'll do some more investigations tomorrow, late night here.

if you have an idea, would be great.

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


Re: svn commit: r230353 - head/usr.sbin/makefs

2012-01-24 Thread Andreas Tobler

On 25.01.12 01:40, Hiroki Sato wrote:

Andreas Tobler  wrote
   in<4f1f3585.8060...@freebsd.org>:

an>  Hi Eitan,
an>
an>  On 20.01.12 02:38, Eitan Adler wrote:
an>  >  Author: eadler
an>  >  Date: Fri Jan 20 01:38:21 2012
an>  >  New Revision: 230353
an>  >  URL: http://svn.freebsd.org/changeset/base/230353
an>  >
an>  >  Log:
an>  > Fix warning when compiling with gcc46:
an>  > error: variable 'temp' set but not used
an>  >
an>  > Approved by:   dim
an>  > Approved by: cperciva (mentor, blanket for pre-mentorship
an>  > already-approved commits)
an>  > MFC after: 3 days
an>
an>  I do not know which of the makefs commits it was:
an>
an>  [andreast@neon] /export/home/andreast/>  makefs -t cd9660 -o chrp-boot
an>  -o rockridge -o label=pseries -B4321 p.iso /data1/netboot/powerpc64/
an>  Segmentation fault (core dumped)
an>
an>  [neon:~] andreast% uname -ra
an>  FreeBSD neon.andreas.nets 10.0-CURRENT FreeBSD 10.0-CURRENT #11
an>  r230469M: Mon Jan 23 02:53:05 CET 2012
an>  andre...@neon.andreas.nets:/usr/obj/export/devel/fbsd/head/src/sys/NEON
an>  amd64
an>
an>  Reverting to 230352 lets me create an iso.
an>
an>  I compile makefs with the base compiler.
an>
an>  I'll do some more investigations tomorrow, late night here.

  I got the same symptom and am investigating it.  Can you rebuild the
  binary with a debug option like this:

  % cd /usr/src/usr.sbin/makefs
  % make clean
  % make DEBUG_FLAGS=-g
  % make DEBUG_FLAGS=-g install

  and then send me the output of the following command?

  % printf "run -t cd9660 -o chrp-boot -o rockridge -o label=pseries -B4321 p.iso 
/data1/netboot/powerpc64/\nbt\nf 1\n f 2\n" | gdb -x /dev/stdin -batch 
/usr/sbin/makefs

  In my environment both the old and the new version could reproduce
  it.  I am not sure if mine is the same as yours at this moment,
  though.


It is actually r230354, this is the commit which shows the failure.
And I reverted back to 230353 and onfirmed that it 'works'.

I additionally built with -O0 -g, see below.

If you need more details, I'll be out the next 15h but later on I can 
continue.


Thank you very much!
Andreas

Here the output from the binary built with "-g":
--
[andreast@tcx58] /export/home/andreast/> printf "run -t cd9660 -o 
chrp-boot -o rockridge -o label=pseries -B4321 p.iso 
/export/netboot/powerpc64/\nbt\nf 1\n f 2\n" | gdb -x /dev/stdin -batch 
/usr/sbin/makefs


Program received signal SIGSEGV, Segmentation fault.
0x000800b781d6 in memcpy () from /lib/libc.so.7
#0  0x000800b781d6 in memcpy () from /lib/libc.so.7
#1  0x004045f8 in cd9660_rename_filename (iter=0x0, num=36,
delete_chars=2) at /export/devel/fbsd/src/usr.sbin/makefs/cd9660.c:1120
#2  0x004044bb in cd9660_handle_collisions (colliding=0x801ba9ec0,
past=35) at /export/devel/fbsd/src/usr.sbin/makefs/cd9660.c:1042
#3  0x00404f13 in cd9660_convert_structure (root=0x8013929c0,
parent_node=0x801ba9ec0, level=5, numDirectories=0x7fffd864,
error=0x7fffd860)
at /export/devel/fbsd/src/usr.sbin/makefs/cd9660.c:1462
#4  0x00404e42 in cd9660_convert_structure (root=0x801378e70,
parent_node=0x801b894c0, level=4, numDirectories=0x7fffd864,
error=0x7fffd860)
at /export/devel/fbsd/src/usr.sbin/makefs/cd9660.c:1419
#5  0x00404e42 in cd9660_convert_structure (root=0x80123fa60,
parent_node=0x8016f2280, level=3, numDirectories=0x7fffd864,
error=0x7fffd860)
at /export/devel/fbsd/src/usr.sbin/makefs/cd9660.c:1419
#6  0x00404e42 in cd9660_convert_structure (root=0x80110cec0,
parent_node=0x801552100, level=2, numDirectories=0x7fffd864,
error=0x7fffd860)
---Type  to continue, or q  to quit---at 
/export/devel/fbsd/src/usr.sbin/makefs/cd9660.c:1419

#7  0x00404e42 in cd9660_convert_structure (root=0x80104c0b0,
parent_node=0x801007140, level=1, numDirectories=0x7fffd864,
error=0x7fffd860)
at /export/devel/fbsd/src/usr.sbin/makefs/cd9660.c:1419
#8  0x004036f1 in cd9660_makefs (image=0x7fffdd45 "p.iso",
dir=0x7fffdd4b "/export/netboot/powerpc64/", root=0x80104c060,
fsopts=0x7fffd920)
at /export/devel/fbsd/src/usr.sbin/makefs/cd9660.c:505
#9  0x0040bb58 in main (argc=2, argv=0x7fffda90)
at /export/devel/fbsd/src/usr.sbin/makefs/makefs.c:291
#1  0x004045f8 in cd9660_rename_filename (iter=0x0, num=36,
delete_chars=2) at /export/devel/fbsd/src/usr.sbin/makefs/cd9660.c:1120
1120memcpy(tmp, (iter->o_name), numbts);
#2  0x004044bb in cd9660_handle_collisions (colliding=0x801ba9ec0,
past=35) at /export/devel/fbsd/src/usr.sbin/makefs/cd9660.c:1042
1042  

Re: svn commit: r230353 - head/usr.sbin/makefs

2012-01-24 Thread Andreas Tobler

On 25.01.12 06:50, Garrett Cooper wrote:

On Tue, Jan 24, 2012 at 9:35 PM, Andreas Tobler  wrote:




...


It is actually r230354, this is the commit which shows the failure.
And I reverted back to 230353 and onfirmed that it 'works'.

I additionally built with -O0 -g, see below.

If you need more details, I'll be out the next 15h but later on I can
continue.

Thank you very much!
Andreas

Here the output from the binary built with "-g":
--
[andreast@tcx58] /export/home/andreast/>  printf "run -t cd9660 -o chrp-boot
-o rockridge -o label=pseries -B4321 p.iso /export/netboot/powerpc64/\nbt\nf
1\n f 2\n" | gdb -x /dev/stdin -batch /usr/sbin/makefs


...


delete_chars);


 1. What does 'list' say for that frame (the line numbers are misleading)?
 2. What compiler are you using to compile the binary?


1.)

Starting program: /usr/sbin/makefs -t cd9660 -o chrp-boot -o rockridge 
-o label=pseries -B4321 p.iso /export/netboot/powerpc64


Program received signal SIGSEGV, Segmentation fault.
0x000800b781d6 in memcpy () from /lib/libc.so.7
(gdb) l
85  struct stat  sb;
86  struct timeval   start;
87  fstype_t*fstype;
88  fsinfo_t fsoptions;
89  fsnode  *root;
90  int  ch, len;
91  char*subtree;
92  char*specfile;
93  
94  setprogname(argv[0]);
(gdb) up
#1  0x004045f8 in cd9660_rename_filename (iter=0x0, num=36,
delete_chars=2) at /export/devel/fbsd/src/usr.sbin/makefs/cd9660.c:1120
1120memcpy(tmp, (iter->o_name), numbts);
(gdb) l
1115}
1116}
1117*/
1118
1119/* (copying just the filename before the '.' */
1120memcpy(tmp, (iter->o_name), numbts);
1121
1122/* adding the appropriate number following the name */
1123temp = i;
1124while (digits > 0) {

2.)
gcc -v
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.1 20070831 patched [FreeBSD]

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


Re: svn commit: r230353 - head/usr.sbin/makefs

2012-01-24 Thread Andreas Tobler

On 25.01.12 07:03, Hiroki Sato wrote:

Andreas Tobler  wrote
   in<4f1f94b3.6020...@freebsd.org>:

an>  On 25.01.12 01:40, Hiroki Sato wrote:
an>  >  Andreas Tobler   wrote
an>  > in<4f1f3585.8060...@freebsd.org>:
an>  >
an>  >  an>   Hi Eitan,
an>  >  an>
an>  >  an>   On 20.01.12 02:38, Eitan Adler wrote:
an>  >  an>   >   Author: eadler
an>  >  an>   >   Date: Fri Jan 20 01:38:21 2012
an>  >  an>   >   New Revision: 230353
an>  >  an>   >   URL: http://svn.freebsd.org/changeset/base/230353
an>  >  an>   >
an>  >  an>   >   Log:
an>  >  an>   >  Fix warning when compiling with gcc46:
an>  >  an>   >  error: variable 'temp' set but not used
an>  >  an>   >
an>  >  an>   >  Approved by:   dim
an>  >  an>   >  Approved by: cperciva (mentor, blanket for pre-mentorship
an>  >  an>   >  already-approved commits)
an>  >  an>   >  MFC after: 3 days
an>  >  an>
an>  >  an>   I do not know which of the makefs commits it was:
an>  >  an>
an>  >  an>  [andreast@neon] /export/home/andreast/>  makefs -t cd9660 -o
an>  >  chrp-boot
an>  >  an>  -o rockridge -o label=pseries -B4321 p.iso
an>  >  /data1/netboot/powerpc64/
an>  >  an>   Segmentation fault (core dumped)
an>  >  an>
an>  >  an>   [neon:~] andreast% uname -ra
an>  >  an>   FreeBSD neon.andreas.nets 10.0-CURRENT FreeBSD 10.0-CURRENT #11
an>  >  an>   r230469M: Mon Jan 23 02:53:05 CET 2012
an>  >  an>
an>  >  andre...@neon.andreas.nets:/usr/obj/export/devel/fbsd/head/src/sys/NEON
an>  >  an>   amd64
an>  >  an>
an>  >  an>   Reverting to 230352 lets me create an iso.
an>  >  an>
an>  >  an>   I compile makefs with the base compiler.
an>  >  an>
an>  >  an>   I'll do some more investigations tomorrow, late night here.
an>  >
an>  >I got the same symptom and am investigating it.  Can you rebuild the
an>  >binary with a debug option like this:
an>  >
an>  >% cd /usr/src/usr.sbin/makefs
an>  >% make clean
an>  >% make DEBUG_FLAGS=-g
an>  >% make DEBUG_FLAGS=-g install
an>  >
an>  >and then send me the output of the following command?
an>  >
an>  >% printf "run -t cd9660 -o chrp-boot -o rockridge -o label=pseries
an>  >% -B4321 p.iso /data1/netboot/powerpc64/\nbt\nf 1\n f 2\n" | gdb -x
an>  >% /dev/stdin -batch /usr/sbin/makefs
an>  >
an>  >In my environment both the old and the new version could reproduce
an>  >it.  I am not sure if mine is the same as yours at this moment,
an>  >though.
an>
an>  It is actually r230354, this is the commit which shows the failure.
an>  And I reverted back to 230353 and onfirmed that it 'works'.

  Thank you!  I will investigating it.  Actually my test data set can
  make SIGSEGV in both of the versions for some reason.  I have to
  narrow down the cause, anyway.

  I guess your /data1/netboot/powerpc64/ is quite large, but can I
  receive the tarball of it in some way?  It would be helpful.


It is a powerpc64 crossbuild installation, built on amd64. It is around 
650MB unzipped, 230MB zipped. I can upload it to freefall later this 
evening.


Thanks,
Andreas

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


Re: svn commit: r230353 - head/usr.sbin/makefs

2012-01-25 Thread Andreas Tobler
- Original Message 
From: Hiroki Sato 
To: andre...@freebsd.org 
Cc: ead...@freebsd.org, src-committ...@freebsd.org, svn-src-...@freebsd.org,
svn-src-head@FreeBSD.org
Subject: Re: svn commit: r230353 - head/usr.sbin/makefs
Date: 25/01/12 10:21

> Hiroki Sato <h...@freebsd.org> wrote
>   in <20120125.151236.688056751317619770@allbsd.org>:
> 
> hr> Andreas Tobler <andre...@freebsd.org> wrote
> hr>   in <4f1f9cd1.9070...@freebsd.org>:
> hr>
> hr> an> It is a powerpc64 crossbuild installation, built on amd64.
It is
> hr> an> around 650MB unzipped, 230MB zipped. I can upload it to
freefall later
> hr> an> this evening.
> hr>
> hr>  Thanks!
> 
>  After this I could reproduce the problem in a smaller data set and
>  identify the cause.  I committed a fix in r230529.  Please try it.

I can confirm, it works with this rev.

Thank you very much!
Andreas


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


Re: svn commit: r221550 - head/sys/powerpc/conf

2011-05-08 Thread Andreas Tobler

On 08.05.11 00:17, Attilio Rao wrote:

2011/5/6 Attilio Rao:

2011/5/6 Nathan Whitehorn:

Author: nwhitehorn
Date: Fri May  6 20:43:02 2011
New Revision: 221550
URL: http://svn.freebsd.org/changeset/base/221550

Log:
  SMP has worked perfectly for a very long time on 32-bit PowerPC on both
  UP and SMP hardware. Enable it in GENERIC.



While working on largeSMP, I think there is a breakage in atomic.h.
More specifically, atomic_store_rel_long() (and related functions) are
not going to properly work because powerpc defines them as:

atomic_store_rel_long ->  atomic_store_rel_32(volatile u_int *p, u_int v)

while this should really follow the long arguments.

This happens because powerpc doesn't follow the other architectures
semantic on defining the "similar" atomic operations.
Other arches define an hardcode version of _type version of the
function and than make a macro the _32 (or whatever) version.
In other words this is what they do:

void
atomic_store_rel_32()
{
...
}

#define atomic_store_rel_int atomic_store_rel_32

which si clearly dangerous for cases as reported above. Maybe that
could be fixed by passing sized types, rather than simply int or long
in numbered version, but I'd really prefer to follow the semantic by
other architectures and then have:

void
atomic_store_rel_int()
{
...
}

#define atomic_store_rel_32 atomic_store_rel_int

I fixed the ATOMIC_STORE_LOAD case in my code, because I needed it,
but the final cleanup is much bigger.
I can make a patch tomorrow if you can test it.



Can you please test and review this patch?:
http://www.freebsd.org/~attilio/largeSMP/atomic-powerpc.diff

Unfortunately I'm having issues with the toolchains in atm, so I can't
really neither test compile it.


I built kernel and world on both, on a 32-bit system and on a 64-bit 
system with 32-bit compat support.


The 32-bit world failed due to type punning issues from umtx.h:121ff

Attached my try to workaround these issues. With my try I can build 
both, kernel and world. Right now I have a world running with it (32-bit).
I do not know if my try is correct. Even less after reading the comments 
from Bruce.
But I think if it is on a somehow correct way, then we need something 
similar for the other _long functions on 32-bit where we go from the 
u_long to u_int. (e.g, atomic_add_long etc.)


I'm ready for more testing.

Gruss,
Andreas
--- atomic.h.attilio2011-05-08 11:00:42.0 +0200
+++ atomic.h.andreas2011-05-08 14:01:00.0 +0200
@@ -651,16 +651,27 @@
 #defineatomic_cmpset_rel_ptr(dst, old, new)
\
atomic_cmpset_rel_long((volatile u_long *)(dst), (u_long)(old), \
(u_long)(new))
-#else
-#defineatomic_cmpset_long(dst, old, new)   
\
-   atomic_cmpset_int((volatile u_int *)(dst), (u_int)(old),\
-   (u_int)(new))
-#defineatomic_cmpset_acq_long(dst, old, new)   
\
-   atomic_cmpset_acq_int((volatile u_int *)(dst), (u_int)(old),\
-   (u_int)(new))
-#defineatomic_cmpset_rel_long(dst, old, new)   
\
-   atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old),\
-   (u_int)(new))
+#else  /* __powerpc64__  */
+static __inline int
+atomic_cmpset_long(volatile u_long *dst, u_long old, u_long new)
+{
+   return (atomic_cmpset_int((volatile u_int *)dst, (u_int)old, 
+ (u_int)new));
+}
+
+static __inline int
+atomic_cmpset_acq_long(volatile u_long *dst, u_long old, u_long new)
+{
+   return (atomic_cmpset_acq_int((volatile u_int *)dst, (u_int)old, 
+ (u_int)new));
+}
+
+static __inline int
+atomic_cmpset_rel_long(volatile u_long *dst, u_long old, u_long new)
+{
+   return (atomic_cmpset_rel_int((volatile u_int *)dst, (u_int)old, 
+ (u_int)new));
+}
 
 #defineatomic_cmpset_ptr(dst, old, new)
\
atomic_cmpset_int((volatile u_int *)(dst), (u_int)(old),\
@@ -671,7 +682,7 @@
 #defineatomic_cmpset_rel_ptr(dst, old, new)
\
atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old),\
(u_int)(new))
-#endif
+#endif  /* __powerpc64__  */
 
 static __inline u_int
 atomic_fetchadd_int(volatile u_int *p, u_int v)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r221550 - head/sys/powerpc/conf

2011-05-09 Thread Andreas Tobler

On 09.05.11 00:15, Attilio Rao wrote:

2011/5/8 Andreas Tobler:

On 08.05.11 00:17, Attilio Rao wrote:


2011/5/6 Attilio Rao:


2011/5/6 Nathan Whitehorn:


Author: nwhitehorn
Date: Fri May  6 20:43:02 2011
New Revision: 221550
URL: http://svn.freebsd.org/changeset/base/221550

Log:
  SMP has worked perfectly for a very long time on 32-bit PowerPC on both
  UP and SMP hardware. Enable it in GENERIC.



While working on largeSMP, I think there is a breakage in atomic.h.
More specifically, atomic_store_rel_long() (and related functions) are
not going to properly work because powerpc defines them as:

atomic_store_rel_long ->atomic_store_rel_32(volatile u_int *p, u_int v)

while this should really follow the long arguments.

This happens because powerpc doesn't follow the other architectures
semantic on defining the "similar" atomic operations.
Other arches define an hardcode version of _type version of the
function and than make a macro the _32 (or whatever) version.
In other words this is what they do:

void
atomic_store_rel_32()
{
...
}

#define atomic_store_rel_int atomic_store_rel_32

which si clearly dangerous for cases as reported above. Maybe that
could be fixed by passing sized types, rather than simply int or long
in numbered version, but I'd really prefer to follow the semantic by
other architectures and then have:

void
atomic_store_rel_int()
{
...
}

#define atomic_store_rel_32 atomic_store_rel_int

I fixed the ATOMIC_STORE_LOAD case in my code, because I needed it,
but the final cleanup is much bigger.
I can make a patch tomorrow if you can test it.



Can you please test and review this patch?:
http://www.freebsd.org/~attilio/largeSMP/atomic-powerpc.diff

Unfortunately I'm having issues with the toolchains in atm, so I can't
really neither test compile it.


I built kernel and world on both, on a 32-bit system and on a 64-bit system
with 32-bit compat support.

The 32-bit world failed due to type punning issues from umtx.h:121ff

Attached my try to workaround these issues. With my try I can build both,
kernel and world. Right now I have a world running with it (32-bit).
I do not know if my try is correct. Even less after reading the comments
from Bruce.
But I think if it is on a somehow correct way, then we need something
similar for the other _long functions on 32-bit where we go from the u_long
to u_int. (e.g, atomic_add_long etc.)

I'm ready for more testing.


So based on your and Bruce's feedbacks I've reworked the patch a bit:
http://www.freebsd.org/~attilio/largeSMP/atomic-powerpc2.diff

This should make type-pun correctly and avoid auto-casting on _ptr functions.

I'm sorry I couldn't even test-compile it, but I'm confident you can
fix edge cases alone.
Let me know.


Both builds ok and booted.

Thanks,
Andreas


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


svn commit: r222449 - in head/sys: conf dev/iicbus powerpc/conf

2011-05-29 Thread Andreas Tobler
Author: andreast
Date: Sun May 29 14:25:42 2011
New Revision: 222449
URL: http://svn.freebsd.org/changeset/base/222449

Log:
  Add a new driver, the ad7417, to read temperatures and voltages on some
  PowerMac's.
  
  Approved by:  nwhitehorn (mentor)

Added:
  head/sys/dev/iicbus/ad7417.c   (contents, props changed)
Modified:
  head/sys/conf/files.powerpc
  head/sys/powerpc/conf/GENERIC
  head/sys/powerpc/conf/GENERIC64
  head/sys/powerpc/conf/NOTES

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Sun May 29 12:15:49 2011(r222448)
+++ head/sys/conf/files.powerpc Sun May 29 14:25:42 2011(r222449)
@@ -27,6 +27,7 @@ dev/cfi/cfi_bus_fdt.c optionalcfi fdt
 dev/fb/fb.coptionalsc
 dev/fdt/fdt_powerpc.c  optionalfdt
 dev/hwpmc/hwpmc_powerpc.c  optionalhwpmc
+dev/iicbus/ad7417.coptionalad7417 powermac
 dev/iicbus/ds1775.coptionalds1775 powermac
 dev/iicbus/max6690.c   optionalmax6690 powermac
 dev/kbd/kbd.c  optionalsc

Added: head/sys/dev/iicbus/ad7417.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/iicbus/ad7417.cSun May 29 14:25:42 2011
(r222449)
@@ -0,0 +1,457 @@
+/*-
+ * 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
+ * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#define FCU_ZERO_C_TO_K 2732
+
+/* CPU A/B sensors, temp and adc: AD7417. */
+
+#define AD7417_TEMP 0x00
+#define AD7417_CONFIG   0x01
+#define AD7417_ADC  0x04
+#define AD7417_CONFIG2  0x05
+#define AD7417_CONFMASK 0xe0
+
+uint8_t adc741x_config;
+
+struct ad7417_sensor {
+   int id;
+   charlocation[32];
+   enum {
+   ADC7417_TEMP_SENSOR,
+   ADC7417_ADC_SENSOR
+   } type;
+};
+
+/* Regular bus attachment functions */
+static int ad7417_probe(device_t);
+static int ad7417_attach(device_t);
+
+/* Utility functions */
+static int ad7417_sensor_sysctl(SYSCTL_HANDLER_ARGS);
+static int ad7417_write(device_t dev, uint32_t addr, uint8_t reg,
+   uint8_t *buf, int len);
+static int ad7417_read_1(device_t dev, uint32_t addr, uint8_t reg,
+uint8_t *data);
+static int ad7417_read_2(device_t dev, uint32_t addr, uint8_t reg,
+uint16_t *data);
+
+struct ad7417_softc {
+   device_tsc_dev;
+   uint32_tsc_addr;
+   struct ad7417_sensor*sc_sensors;
+   int sc_nsensors;
+};
+static device_method_t  ad7417_methods[] = {
+   /* Device interface */
+   DEVMETHOD(device_probe, ad7417_probe),
+   DEVMETHOD(device_attach,ad7417_attach),
+   { 0, 0 },
+};
+
+static driver_t ad7417_driver = {
+   "ad7417",
+   ad7417_methods,
+   sizeof(struct ad7417_softc)
+};
+
+static devclass_t ad7417_devclass;
+
+DRIVER_MODULE(ad7417, iicbus, ad7417_driver, ad7417_devclass, 0, 0);
+MALLOC_DEFINE(M_AD7417, "ad7417", "Supply-Monitor AD7417");
+
+
+static int
+ad7417_write(device_t dev, uint32_t addr, uint8_t reg, uint8_t *buff, int len)
+{
+   unsigned char buf[4];
+   struct iic

svn commit: r222450 - head/sys/boot/powerpc/ofw

2011-05-29 Thread Andreas Tobler
Author: andreast
Date: Sun May 29 14:27:11 2011
New Revision: 222450
URL: http://svn.freebsd.org/changeset/base/222450

Log:
  Add some missing files. Without we hang in the OF prompt asking for 
screen.4th.
  
  Approved by:  nwhitehorn (mentor)

Modified:
  head/sys/boot/powerpc/ofw/Makefile

Modified: head/sys/boot/powerpc/ofw/Makefile
==
--- head/sys/boot/powerpc/ofw/Makefile  Sun May 29 14:25:42 2011
(r222449)
+++ head/sys/boot/powerpc/ofw/Makefile  Sun May 29 14:27:11 2011
(r222450)
@@ -103,6 +103,7 @@ loader.help: help.common help.ofw
 
 .PATH: ${.CURDIR}/../../forth
 FILES= loader.help loader.4th support.4th loader.conf
+FILES+=screen.4th frames.4th
 FILES+=beastie.4th brand.4th check-password.4th color.4th delay.4th
 FILES+=menu.4th menu-commands.4th shortcuts.4th version.4th
 FILESDIR_loader.conf=  /boot/defaults
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2011-06-03 Thread Andreas Tobler
Author: andreast
Date: Fri Jun  3 18:58:32 2011
New Revision: 222658
URL: http://svn.freebsd.org/changeset/base/222658

Log:
  - Improve error handling.
  - Add a retry loop for the i2c sensor reading.
  - Update the sensor handling for sensors which do not have a location
  entry. [1]
  
  Submitted by: [1] Justin Hibbits.
  Approved by:  nwhitehorn (mentor)

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

Modified: head/sys/dev/iicbus/ds1775.c
==
--- head/sys/dev/iicbus/ds1775.cFri Jun  3 18:18:54 2011
(r222657)
+++ head/sys/dev/iicbus/ds1775.cFri Jun  3 18:58:32 2011
(r222658)
@@ -95,20 +95,28 @@ static int
 ds1775_read_2(device_t dev, uint32_t addr, uint8_t reg, uint16_t *data)
 {
uint8_t buf[4];
+   int err, try = 0;
 
struct iic_msg msg[2] = {
{ addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® },
{ addr, IIC_M_RD, 2, buf },
};
 
-   if (iicbus_transfer(dev, msg, 2) != 0) {
-   device_printf(dev, "iicbus read failed\n");
-   return (EIO);
+   for (;;)
+   {
+   err = iicbus_transfer(dev, msg, 2);
+   if (err != 0)
+   goto retry;
+
+   *data = *((uint16_t*)buf);
+   return (0);
+   retry:
+   if (++try > 5) {
+   device_printf(dev, "iicbus read failed\n");
+   return (-1);
+   }
+   pause("ds1775_read_2", hz);
}
-
-   *data = *((uint16_t*)buf);
-
-   return (0);
 }
 
 static int
@@ -182,7 +190,10 @@ ds1775_start(void *xdev)
ctx = device_get_sysctl_ctx(dev);
sensroot_oid = device_get_sysctl_tree(dev);
 
-   OF_getprop(child, "hwsensor-zone", &sc->sc_sensor.zone, sizeof(int));
+   if (OF_getprop(child, "hwsensor-zone", &sc->sc_sensor.zone,
+  sizeof(int)) < 0)
+   sc->sc_sensor.zone = 0;
+
plen = OF_getprop(child, "hwsensor-location", sc->sc_sensor.name,
  sizeof(sc->sc_sensor.name));
units = "C";
@@ -199,8 +210,14 @@ ds1775_start(void *xdev)
}
 
/* Make up target temperatures. These are low, for the drive bay. */
-   sc->sc_sensor.target_temp = 300 + FCU_ZERO_C_TO_K;
-   sc->sc_sensor.max_temp = 600 + FCU_ZERO_C_TO_K;
+   if (sc->sc_sensor.zone == 0) {
+   sc->sc_sensor.target_temp = 500 + FCU_ZERO_C_TO_K;
+   sc->sc_sensor.max_temp = 600 + FCU_ZERO_C_TO_K;
+   }
+   else {
+   sc->sc_sensor.target_temp = 300 + FCU_ZERO_C_TO_K;
+   sc->sc_sensor.max_temp = 600 + FCU_ZERO_C_TO_K;
+   }
 
sc->sc_sensor.read =
(int (*)(struct pmac_therm *sc))(ds1775_sensor_read);
@@ -220,8 +237,11 @@ ds1775_sensor_read(struct ds1775_softc *
 {
uint16_t buf[2];
uint16_t read;
+   int err;
 
-   ds1775_read_2(sc->sc_dev, sc->sc_addr, DS1775_TEMP, buf);
+   err = ds1775_read_2(sc->sc_dev, sc->sc_addr, DS1775_TEMP, buf);
+   if (err < 0)
+   return (-1);
 
read = *((int16_t *)buf);
 
@@ -243,6 +263,8 @@ ds1775_sensor_sysctl(SYSCTL_HANDLER_ARGS
sc = device_get_softc(dev);
 
temp = ds1775_sensor_read(sc);
+   if (temp < 0)
+   return (EIO);
 
error = sysctl_handle_int(oidp, &temp, 0, req);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2011-06-03 Thread Andreas Tobler
Author: andreast
Date: Fri Jun  3 20:43:12 2011
New Revision: 222659
URL: http://svn.freebsd.org/changeset/base/222659

Log:
  - Introduce a define for ZERO_C_TO_K.
  - Fix the printing of the temperature when we exceed the critical value.
  
  Approved by:  nwhitehorn (mentor)

Modified:
  head/sys/powerpc/powermac/powermac_thermal.c
  head/sys/powerpc/powermac/powermac_thermal.h

Modified: head/sys/powerpc/powermac/powermac_thermal.c
==
--- head/sys/powerpc/powermac/powermac_thermal.cFri Jun  3 18:58:32 
2011(r222658)
+++ head/sys/powerpc/powermac/powermac_thermal.cFri Jun  3 20:43:12 
2011(r222659)
@@ -109,9 +109,10 @@ pmac_therm_manage_fans(void)
printf("WARNING: Current temperature (%s: %d.%d C) "
"exceeds critical temperature (%d.%d C)! "
"Shutting down!\n", sensor->sensor->name,
-   sensor->last_val / 10, sensor->last_val % 10,
-   sensor->sensor->max_temp / 10,
-   sensor->sensor->max_temp % 10);
+  (sensor->last_val - ZERO_C_TO_K) / 10,
+  (sensor->last_val - ZERO_C_TO_K) % 10,
+  (sensor->sensor->max_temp - ZERO_C_TO_K) / 10,
+  (sensor->sensor->max_temp - ZERO_C_TO_K) % 10);
shutdown_nice(RB_POWEROFF);
}
}

Modified: head/sys/powerpc/powermac/powermac_thermal.h
==
--- head/sys/powerpc/powermac/powermac_thermal.hFri Jun  3 18:58:32 
2011(r222658)
+++ head/sys/powerpc/powermac/powermac_thermal.hFri Jun  3 20:43:12 
2011(r222659)
@@ -29,6 +29,8 @@
 #ifndef _POWERPC_POWERMAC_POWERMAC_THERMAL_H
 #define _POWERPC_POWERMAC_POWERMAC_THERMAL_H
 
+#define ZERO_C_TO_K 2732
+
 struct pmac_fan {
int min_rpm, max_rpm, default_rpm;

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


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

2011-06-04 Thread Andreas Tobler
Author: andreast
Date: Sat Jun  4 09:19:53 2011
New Revision: 222673
URL: http://svn.freebsd.org/changeset/base/222673

Log:
  Replace the FCU_ZERO_C_TO_K with the ZERO_C_TO_K from powermac_thermal.h.
  
  Approved by:  nwhitehorn (mentor)

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

Modified: head/sys/dev/iicbus/ds1775.c
==
--- head/sys/dev/iicbus/ds1775.cSat Jun  4 08:24:58 2011
(r222672)
+++ head/sys/dev/iicbus/ds1775.cSat Jun  4 09:19:53 2011
(r222673)
@@ -51,8 +51,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#define FCU_ZERO_C_TO_K 2732
-
 /* Drivebay sensor: LM75/DS1775. */
 #define DS1775_TEMP 0x0
 
@@ -211,12 +209,12 @@ ds1775_start(void *xdev)
 
/* Make up target temperatures. These are low, for the drive bay. */
if (sc->sc_sensor.zone == 0) {
-   sc->sc_sensor.target_temp = 500 + FCU_ZERO_C_TO_K;
-   sc->sc_sensor.max_temp = 600 + FCU_ZERO_C_TO_K;
+   sc->sc_sensor.target_temp = 500 + ZERO_C_TO_K;
+   sc->sc_sensor.max_temp = 600 + ZERO_C_TO_K;
}
else {
-   sc->sc_sensor.target_temp = 300 + FCU_ZERO_C_TO_K;
-   sc->sc_sensor.max_temp = 600 + FCU_ZERO_C_TO_K;
+   sc->sc_sensor.target_temp = 300 + ZERO_C_TO_K;
+   sc->sc_sensor.max_temp = 600 + ZERO_C_TO_K;
}
 
sc->sc_sensor.read =
@@ -248,7 +246,7 @@ ds1775_sensor_read(struct ds1775_softc *
/* The default mode of the ADC is 9 bit, the resolution is 0.5 C per
   bit. The temperature is in tenth kelvin.
*/
-   return (((int16_t)(read) >> 7) * 5 + FCU_ZERO_C_TO_K);
+   return (((int16_t)(read) >> 7) * 5 + ZERO_C_TO_K);
 }
 
 static int
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2011-06-04 Thread Andreas Tobler
Author: andreast
Date: Sat Jun  4 09:23:54 2011
New Revision: 222674
URL: http://svn.freebsd.org/changeset/base/222674

Log:
  - Improve error handling.
  - Add a retry loop for the i2c sensor reading.
  - Check on busy status of the chip and on invalid values.
  - Fix a typo in a comment.
  - Replace the constant 2732 with the ZERO_C_TO_K macro.
  
  Approved by:  nwhitehorn (mentor)

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

Modified: head/sys/dev/iicbus/max6690.c
==
--- head/sys/dev/iicbus/max6690.c   Sat Jun  4 09:19:53 2011
(r222673)
+++ head/sys/dev/iicbus/max6690.c   Sat Jun  4 09:23:54 2011
(r222674)
@@ -51,12 +51,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#define FCU_ZERO_C_TO_K 2732
-
 /* Inlet, Backside, U3 Heatsink sensor: MAX6690. */
 
 #define MAX6690_INT_TEMP0x0
 #define MAX6690_EXT_TEMP0x1
+#define MAX6690_RSL_STATUS  0x2
 #define MAX6690_EEXT_TEMP   0x10
 #define MAX6690_IEXT_TEMP   0x11
 #define MAX6690_TEMP_MASK   0xe0
@@ -76,8 +75,8 @@ static int  max6690_attach(device_t);
 static int  max6690_sensor_read(struct max6690_sensor *sens);
 static int  max6690_sensor_sysctl(SYSCTL_HANDLER_ARGS);
 static void max6690_start(void *xdev);
-static int  max6690_read_1(device_t dev, uint32_t addr, uint8_t reg,
-  uint8_t *data);
+static int  max6690_read(device_t dev, uint32_t addr, uint8_t reg,
+uint8_t *data);
 
 struct max6690_softc {
device_tsc_dev;
@@ -105,23 +104,43 @@ DRIVER_MODULE(max6690, iicbus, max6690_d
 MALLOC_DEFINE(M_MAX6690, "max6690", "Temp-Monitor MAX6690");
 
 static int
-max6690_read_1(device_t dev, uint32_t addr, uint8_t reg, uint8_t *data)
+max6690_read(device_t dev, uint32_t addr, uint8_t reg, uint8_t *data)
 {
uint8_t buf[4];
+   uint8_t busy[1], rsl;
+   int err, try = 0;
 
-   struct iic_msg msg[2] = {
+   /* Busy register RSL. */
+   rsl = MAX6690_RSL_STATUS;
+   /* first read the status register, 0x2. If busy, retry. */
+   struct iic_msg msg[4] = {
+   { addr, IIC_M_WR | IIC_M_NOSTOP, 1, &rsl },
+   { addr, IIC_M_RD, 1, busy },
{ addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® },
{ addr, IIC_M_RD, 1, buf },
};
 
-   if (iicbus_transfer(dev, msg, 2) != 0) {
-   device_printf(dev, "iicbus read failed\n");
-   return (EIO);
+   for (;;)
+   {
+   err = iicbus_transfer(dev, msg, 4);
+   if (err != 0)
+   goto retry;
+   if (busy[0] & 0x80)
+   goto retry;
+   /* Check for invalid value and retry. */
+   if (buf[0] == 0xff)
+   goto retry;
+
+   *data = *((uint8_t*)buf);
+   return (0);
+
+   retry:
+   if (++try > 5) {
+   device_printf(dev, "iicbus read failed\n");
+   return (-1);
+   }
+   pause("max6690_read", hz);
}
-
-   *data = *((uint8_t*)buf);
-
-   return (0);
 }
 
 static int
@@ -193,8 +212,8 @@ max6690_fill_sensor_prop(device_t dev)
for (j = 0; j < i; j++) {
sc->sc_sensors[j].dev = dev;
 
-   sc->sc_sensors[j].therm.target_temp = 400 + 2732;
-   sc->sc_sensors[j].therm.max_temp = 800 + 2732;
+   sc->sc_sensors[j].therm.target_temp = 400 + ZERO_C_TO_K;
+   sc->sc_sensors[j].therm.max_temp = 800 + ZERO_C_TO_K;
 
sc->sc_sensors[j].therm.read =
(int (*)(struct pmac_therm *))(max6690_sensor_read);
@@ -302,14 +321,15 @@ static int
 max6690_sensor_read(struct max6690_sensor *sens)
 {
uint8_t reg_int = 0, reg_ext = 0;
-   uint8_t integer;
-   uint8_t fraction;
-   int temp;
+   uint8_t integer = 0;
+   uint8_t fraction = 0;
+   int err, temp;
+
struct max6690_softc *sc;
 
sc = device_get_softc(sens->dev);
 
-   /* The internal sensor id's are even, the external ar odd. */
+   /* The internal sensor id's are even, the external are odd. */
if ((sens->id % 2) == 0) {
reg_int = MAX6690_INT_TEMP;
reg_ext = MAX6690_IEXT_TEMP;
@@ -318,9 +338,11 @@ max6690_sensor_read(struct max6690_senso
reg_ext = MAX6690_EEXT_TEMP;
}
 
-   max6690_read_1(sc->sc_dev, sc->sc_addr, reg_int, &integer);
+   err = max6690_read(sc->sc_dev, sc->sc_addr, reg_int, &integer);
+   err = max6690_read(sc->sc_dev, sc->sc_addr, reg_ext, &fraction);
 
-   max6690_read_1(sc->sc_dev, sc->sc_addr, reg_ext, &fraction);
+   if (err < 0)
+   return (-1);
 
fraction &= MAX6690_TEMP_MASK;
 
@@ -329,7 +351,7 @@ max6690_sensor_read(struct max6690_senso
*/
temp = (integer * 10) + (fraction >> 5) * 10 / 8;
 

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

2011-06-04 Thread Andreas Tobler
Author: andreast
Date: Sat Jun  4 09:25:59 2011
New Revision: 222675
URL: http://svn.freebsd.org/changeset/base/222675

Log:
  - Improve error handling.
  - Add retry loops for the i2c read/write functions.
  
  Approved by:  nwhitehorn (mentor)

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

Modified: head/sys/powerpc/powermac/fcu.c
==
--- head/sys/powerpc/powermac/fcu.c Sat Jun  4 09:23:54 2011
(r222674)
+++ head/sys/powerpc/powermac/fcu.c Sat Jun  4 09:25:59 2011
(r222675)
@@ -138,6 +138,8 @@ fcu_write(device_t dev, uint32_t addr, u
  int len)
 {
unsigned char buf[4];
+   int try = 0;
+
struct iic_msg msg[] = {
{ addr, IIC_M_WR, 0, buf }
};
@@ -145,33 +147,46 @@ fcu_write(device_t dev, uint32_t addr, u
msg[0].len = len + 1;
buf[0] = reg;
memcpy(buf + 1, buff, len);
-   if (iicbus_transfer(dev, msg, 1) != 0) {
-   device_printf(dev, "iicbus write failed\n");
-   return (EIO);
-   }
 
-   return (0);
+   for (;;)
+   {
+   if (iicbus_transfer(dev, msg, 1) == 0)
+   return (0);
 
+   if (++try > 5) {
+   device_printf(dev, "iicbus write failed\n");
+   return (-1);
+   }
+   pause("fcu_write", hz);
+   }
 }
 
 static int
 fcu_read_1(device_t dev, uint32_t addr, uint8_t reg, uint8_t *data)
 {
uint8_t buf[4];
+   int err, try = 0;
 
struct iic_msg msg[2] = {
{ addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® },
{ addr, IIC_M_RD, 1, buf },
};
 
-   if (iicbus_transfer(dev, msg, 2) != 0) {
-   device_printf(dev, "iicbus read failed\n");
-   return (EIO);
+   for (;;)
+   {
+ err = iicbus_transfer(dev, msg, 2);
+ if (err != 0)
+ goto retry;
+
+ *data = *((uint8_t*)buf);
+ return (0);
+   retry:
+ if (++try > 5) {
+ device_printf(dev, "iicbus read failed\n");
+ return (-1);
+ }
+ pause("fcu_read_1", hz);
}
-
-   *data = *((uint8_t*)buf);
-
-   return (0);
 }
 
 static int
@@ -267,13 +282,14 @@ fcu_fan_set_rpm(struct fcu_fan *fan, int
fan->setpoint = rpm;
} else {
device_printf(fan->dev, "Unknown fan type: %d\n", fan->type);
-   return (EIO);
+   return (-1);
}
 
buf[0] = rpm >> (8 - fcu_rpm_shift);
buf[1] = rpm << fcu_rpm_shift;
 
-   fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2);
+   if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2) < 0)
+   return (-1);
 
return (0);
 }
@@ -292,7 +308,8 @@ fcu_fan_get_rpm(struct fcu_fan *fan)
if (fan->type == FCU_FAN_RPM) {
/* Check if the fan is available. */
reg = FCU_RPM_AVAILABLE;
-   fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &avail);
+   if (fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &avail) < 0)
+   return (-1);
if ((avail & (1 << fan->id)) == 0) {
device_printf(fan->dev,
"RPM Fan not available ID: %d\n", fan->id);
@@ -300,7 +317,8 @@ fcu_fan_get_rpm(struct fcu_fan *fan)
}
/* Check if we have a failed fan. */
reg = FCU_RPM_FAIL;
-   fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &fail);
+   if (fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &fail) < 0)
+   return (-1);
if ((fail & (1 << fan->id)) != 0) {
device_printf(fan->dev,
"RPM Fan failed ID: %d\n", fan->id);
@@ -308,7 +326,8 @@ fcu_fan_get_rpm(struct fcu_fan *fan)
}
/* Check if fan is active. */
reg = FCU_RPM_ACTIVE;
-   fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &active);
+   if (fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &active) < 0)
+   return (-1);
if ((active & (1 << fan->id)) == 0) {
device_printf(fan->dev, "RPM Fan not active ID: %d\n",
  fan->id);
@@ -322,7 +341,8 @@ fcu_fan_get_rpm(struct fcu_fan *fan)
}
 
/* It seems that we can read the fans rpm. */
-   fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buff);
+   if (fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buff) < 0)
+   return (-1);
 
rpm = (buff[0] << (8 - fcu_rpm_shift)) | buff[1] >> fcu_rpm_shift;
 
@@ -356,8 +376,8 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int
 
buf[0] = (pwm * 2550) / 1000;
 
-   fcu_write(sc->sc_dev, sc->sc_addr, reg,

Re: svn commit: r222449 - in head/sys: conf dev/iicbus powerpc/conf

2011-06-04 Thread Andreas Tobler

Hi,

sorry for the delay.

On 29.05.11 17:10, Henrik Brix Andersen wrote:

Hi,

On May 29, 2011, at 16:25, Andreas Tobler wrote:

Author: andreast
Date: Sun May 29 14:25:42 2011
New Revision: 222449
URL: http://svn.freebsd.org/changeset/base/222449

Log:
  Add a new driver, the ad7417, to read temperatures and voltages on some
  PowerMac's.

  Approved by:  nwhitehorn (mentor)

Added:
  head/sys/dev/iicbus/ad7417.c   (contents, props changed)
Modified:
  head/sys/conf/files.powerpc
  head/sys/powerpc/conf/GENERIC
  head/sys/powerpc/conf/GENERIC64
  head/sys/powerpc/conf/NOTES


Since this driver is powerpc-only (the chip is not powerpc-specific - but this 
driver depends on OFW?) shouldn't it live somewhere under sys/powerpc/ instead 
of the generic sys/dev/iicbus/?

Or perhaps be rewritten to a more generic form?



The chip itself is not PowerMac specific. It contains four times the 
functionality of the ad7418 which is already in there. (dev/iicbus)


The ofw is only needed to detect the chip and to wire the sensor place 
to the right fan property. I think this could be refactored that it is 
PowerMac only and others could benefit from the driver too.


The same would apply for the ds1775.c and the max6690.c. Those chips are 
not PowerMac only, they are simple i2c temp sensors.


To get there, it would really be helpful if there are other people with 
non PowerMac hardware who would have an interest in these drivers.
Then we could sit together, refactor and test. W/o the corresponding 
hardware it seems a bit difficult for me to test.


A few months ago I asked on hackers@ how I could combine those two 
drivers. I got no feedback.


Now we're heading towards 9.0 and we (nwhitehorn@) wanted to get this 
driver in. We need these drivers to run certain G5 PowerMac's in a 
silent mode.

W/o we have a swarm of bees which makes it very hard to concentrate ;)

Gruss,
Andreas

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


svn commit: r222686 - in head/sys: conf powerpc/conf powerpc/powermac

2011-06-04 Thread Andreas Tobler
Author: andreast
Date: Sat Jun  4 15:17:35 2011
New Revision: 222686
URL: http://svn.freebsd.org/changeset/base/222686

Log:
  Add new fan controller driver for the G4 MDD PowerMac. Submitted and tested
  by Justin Hibbits.
  
  Approved by:  nwhitehorn (mentor)

Added:
  head/sys/powerpc/powermac/windtunnel.c   (contents, props changed)
Modified:
  head/sys/conf/files.powerpc
  head/sys/powerpc/conf/GENERIC
  head/sys/powerpc/conf/NOTES

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Sat Jun  4 15:15:42 2011(r222685)
+++ head/sys/conf/files.powerpc Sat Jun  4 15:17:35 2011(r222686)
@@ -162,6 +162,7 @@ powerpc/powermac/smusat.c   optionalpower
 powerpc/powermac/uninorth.coptionalpowermac
 powerpc/powermac/uninorthpci.c optionalpowermac pci
 powerpc/powermac/vcoregpio.c   optionalpowermac 
+powerpc/powermac/windtunnel.c  optionalpowermac windtunnel
 powerpc/powerpc/altivec.c  optionalaim
 powerpc/powerpc/atomic.S   standard
 powerpc/powerpc/autoconf.c standard

Modified: head/sys/powerpc/conf/GENERIC
==
--- head/sys/powerpc/conf/GENERIC   Sat Jun  4 15:15:42 2011
(r222685)
+++ head/sys/powerpc/conf/GENERIC   Sat Jun  4 15:17:35 2011
(r222686)
@@ -180,6 +180,7 @@ device  fcu # Apple Fan Control Unit
 device max6690 # PowerMac7,2 temperature sensor
 device powermac_nvram  # Open Firmware configuration NVRAM
 device smu # Apple System Management Unit
+device windtunnel  # Apple G4 MDD fan controller
 
 # ADB support
 device adb

Modified: head/sys/powerpc/conf/NOTES
==
--- head/sys/powerpc/conf/NOTES Sat Jun  4 15:15:42 2011(r222685)
+++ head/sys/powerpc/conf/NOTES Sat Jun  4 15:17:35 2011(r222686)
@@ -47,6 +47,7 @@ devicepmu # Apple Power 
Management Un
 device smu # Apple System Management Unit
 device snd_ai2s# Apple I2S Audio
 device snd_davbus  # Apple Davbus Audio
+device windtunnel  # Apple G4 MDD fan controller
 
 
 #

Added: head/sys/powerpc/powermac/windtunnel.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/powerpc/powermac/windtunnel.c  Sat Jun  4 15:17:35 2011
(r222686)
@@ -0,0 +1,216 @@
+/*-
+ * Copyright (c) 2011 Justin Hibbits
+ * 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
+ * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+struct adm1030_softc {
+   struct pmac_fan fan;
+   device_tsc_dev;
+   struct intr_config_hook enum_hook;
+   uint32_tsc_addr;
+   phandle_t   sc_thermostat_phandle;
+   device_tsc_thermostat_dev;
+};
+
+/* Regular bus attachment functions */
+static int adm1030_probe(device_t);
+static int adm1030_attach(device_t);
+
+/* Utility functions */
+static voidadm1030_start(void *xdev);
+static int adm1030_write_byte(device_t dev, uint32_t addr, uint8

Re: svn commit: r222666 - head/sys/powerpc/aim

2011-06-05 Thread Andreas Tobler

On 04.06.11 05:22, Nathan Whitehorn wrote:

Author: nwhitehorn
Date: Sat Jun  4 03:22:16 2011
New Revision: 222666
URL: http://svn.freebsd.org/changeset/base/222666

Log:
   Fix a typo derived from a mismerge from mmu_oea that would cause
   pmap_sync_icache() to sync random (possibly uncached or nonexisting!)
   memory, causing kernel page faults or machine checks, most easily
   triggered by using GDB. While here, add an additional safeguard to only
   sync cacheable memory.


A big, big thank you!!!

The core is working now! Next is fine tuning.

[bohrium:head/objdir/gdb] andreast% ./gdb -v
GNU gdb (GDB) 7.3.50.20110605-cvs
This GDB was configured as "powerpc64-unknown-freebsd9.0".


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


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

2011-06-08 Thread Andreas Tobler
Author: andreast
Date: Wed Jun  8 16:00:30 2011
New Revision: 222860
URL: http://svn.freebsd.org/changeset/base/222860

Log:
  - Improve error handling.
  - Add retry loops in the i2c read/write functions.
  - Combied the ADC channel selection and readout of the value into
one iicbus_transfer to avoid possible races.
  
  Reviewed by: nwhitehorn

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

Modified: head/sys/dev/iicbus/ad7417.c
==
--- head/sys/dev/iicbus/ad7417.cWed Jun  8 13:23:35 2011
(r222859)
+++ head/sys/dev/iicbus/ad7417.cWed Jun  8 16:00:30 2011
(r222860)
@@ -51,8 +51,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#define FCU_ZERO_C_TO_K 2732
-
 /* CPU A/B sensors, temp and adc: AD7417. */
 
 #define AD7417_TEMP 0x00
@@ -73,6 +71,16 @@ struct ad7417_sensor {
} type;
 };
 
+struct write_data {
+   uint8_t reg;
+   uint8_t val;
+};
+
+struct read_data {
+   uint8_t reg;
+   uint16_t val;
+};
+
 /* Regular bus attachment functions */
 static int ad7417_probe(device_t);
 static int ad7417_attach(device_t);
@@ -85,6 +93,8 @@ static int ad7417_read_1(device_t dev, u
 uint8_t *data);
 static int ad7417_read_2(device_t dev, uint32_t addr, uint8_t reg,
 uint16_t *data);
+static int ad7417_write_read(device_t dev, uint32_t addr,
+struct write_data out, struct read_data *in);
 static int ad7417_diode_read(struct ad7417_sensor *sens);
 static int ad7417_adc_read(struct ad7417_sensor *sens);
 static int ad7417_sensor_read(struct ad7417_sensor *sens);
@@ -118,6 +128,8 @@ static int
 ad7417_write(device_t dev, uint32_t addr, uint8_t reg, uint8_t *buff, int len)
 {
unsigned char buf[4];
+   int try = 0;
+
struct iic_msg msg[] = {
{ addr, IIC_M_WR, 0, buf }
};
@@ -126,76 +138,134 @@ ad7417_write(device_t dev, uint32_t addr
buf[0] = reg;
memcpy(buf + 1, buff, len);
 
-   if (iicbus_transfer(dev, msg, 1) != 0) {
-   device_printf(dev, "iicbus write failed\n");
-   return (EIO);
+   for (;;)
+   {
+   if (iicbus_transfer(dev, msg, 1) == 0)
+   return (0);
+
+   if (++try > 5) {
+   device_printf(dev, "iicbus write failed\n");
+   return (-1);
+   }
+   pause("ad7417_write", hz);
}
-
-   return (0);
-
 }
 
 static int
 ad7417_read_1(device_t dev, uint32_t addr, uint8_t reg, uint8_t *data)
 {
uint8_t buf[4];
+   int err, try = 0;
 
struct iic_msg msg[2] = {
{ addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® },
{ addr, IIC_M_RD, 1, buf },
};
 
-   if (iicbus_transfer(dev, msg, 2) != 0) {
-   device_printf(dev, "iicbus read failed\n");
-   return (EIO);
+   for (;;)
+   {
+   err = iicbus_transfer(dev, msg, 2);
+   if (err != 0)
+   goto retry;
+
+   *data = *((uint8_t*)buf);
+   return (0);
+   retry:
+   if (++try > 5) {
+   device_printf(dev, "iicbus read failed\n");
+   return (-1);
+   }
+   pause("ad7417_read_1", hz);
}
-
-   *data = *((uint8_t*)buf);
-
-   return (0);
 }
 
 static int
 ad7417_read_2(device_t dev, uint32_t addr, uint8_t reg, uint16_t *data)
 {
uint8_t buf[4];
+   int err, try = 0;
 
struct iic_msg msg[2] = {
{ addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® },
{ addr, IIC_M_RD, 2, buf },
};
 
-   if (iicbus_transfer(dev, msg, 2) != 0) {
-   device_printf(dev, "iicbus read failed\n");
-   return (EIO);
+   for (;;)
+   {
+   err = iicbus_transfer(dev, msg, 2);
+   if (err != 0)
+   goto retry;
+
+   *data = *((uint16_t*)buf);
+   return (0);
+   retry:
+   if (++try > 5) {
+   device_printf(dev, "iicbus read failed\n");
+   return (-1);
+   }
+   pause("ad7417_read_2", hz);
}
+}
 
-   *data = *((uint16_t*)buf);
+static int
+ad7417_write_read(device_t dev, uint32_t addr, struct write_data out,
+ struct read_data *in)
+{
+   uint8_t buf[4];
+   int err, try = 0;
 
-   return (0);
+   /* Do a combined write/read. */
+   struct iic_msg msg[3] = {
+   { addr, IIC_M_WR, 2, buf },
+   { addr, IIC_M_WR | IIC_M_NOSTOP, 1, &in->reg },
+   { addr, IIC_M_RD, 2, buf },
+   };
+
+   /* Prepare the write msg. */
+   buf[0] = out.reg;
+   buf[1] = out.val & 0xff;
+
+   for (;;)
+   {
+   err = iicbus_transfer(dev, msg, 3)

svn commit: r223082 - head/contrib/gdb/gdb

2011-06-14 Thread Andreas Tobler
Author: andreast
Date: Tue Jun 14 15:20:30 2011
New Revision: 223082
URL: http://svn.freebsd.org/changeset/base/223082

Log:
  - Check on target wordsize instead of compile time define if we build on
64-bit PowerPC or 32-bit PowerPC.
  - Make gdb work on powerpc64, the code for this is obtained from
ppc-linux-tdep.c.
  - Remove non-elf core read functionality. Implement core read functionality
similar like other FreeBSD targets.
  - Set long double limitations.

Modified:
  head/contrib/gdb/gdb/ppcfbsd-tdep.c

Modified: head/contrib/gdb/gdb/ppcfbsd-tdep.c
==
--- head/contrib/gdb/gdb/ppcfbsd-tdep.c Tue Jun 14 14:53:17 2011
(r223081)
+++ head/contrib/gdb/gdb/ppcfbsd-tdep.c Tue Jun 14 15:20:30 2011
(r223082)
@@ -27,7 +27,9 @@
 #include "target.h"
 #include "breakpoint.h"
 #include "value.h"
+#include "gdb_string.h"
 #include "osabi.h"
+#include "regset.h"
 
 #include "ppc-tdep.h"
 #include "ppcfbsd-tdep.h"
@@ -80,6 +82,17 @@ ppcfbsd_supply_reg (char *regs, int regn
 regcache_raw_supply (current_regcache, PC_REGNUM,
 regs + REG_PC_OFFSET);
 }
+static void
+ppcfbsd_supply_gregset (const struct regset *regset,
+   struct regcache *regcache,
+   int regnum, void *gregs, size_t size)
+{
+  ppcfbsd_supply_reg (gregs, -1);
+}
+
+static struct regset ppcfbsd_gregset = {
+  NULL, (void*)ppcfbsd_supply_gregset
+};
 
 void
 ppcfbsd_fill_reg (char *regs, int regno)
@@ -144,6 +157,20 @@ ppcfbsd_supply_fpreg (char *fpregs, int 
 fpregs + FPREG_FPSCR_OFFSET);
 }
 
+static void
+ppcfbsd_supply_fpregset (const struct regset *regset,
+struct regcache * regcache,
+int regnum, void *fpset, size_t size)
+{
+  ppcfbsd_supply_fpreg (fpset, -1);
+}
+
+
+static struct regset ppcfbsd_fpregset =
+{
+  NULL, (void*)ppcfbsd_supply_fpregset
+};
+
 void
 ppcfbsd_fill_fpreg (char *fpregs, int regno)
 {
@@ -174,69 +201,285 @@ ppcfbsd_fill_fpreg (char *fpregs, int re
  fpregs + FPREG_FPSCR_OFFSET);
 }
 
-static void
-fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
-  CORE_ADDR ignore)
+/* Return the appropriate register set for the core section identified
+   by SECT_NAME and SECT_SIZE.  */
+
+const struct regset *
+ppcfbsd_regset_from_core_section (struct gdbarch *gdbarch,
+   const char *sect_name, size_t sect_size)
 {
-  char *regs, *fpregs;
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  if (strcmp (sect_name, ".reg") == 0 && sect_size >= SIZEOF_STRUCT_REG)
+return &ppcfbsd_gregset;
+
+  if (strcmp (sect_name, ".reg2") == 0 && sect_size >= SIZEOF_STRUCT_FPREG)
+return &ppcfbsd_fpregset;
 
-  /* We get everything from one section.  */
-  if (which != 0)
-return;
+  return NULL;
+}
 
-  regs = core_reg_sect;
-  fpregs = core_reg_sect + SIZEOF_STRUCT_REG;
 
-  /* Integer registers.  */
-  ppcfbsd_supply_reg (regs, -1);
+/* Macros for matching instructions.  Note that, since all the
+   operands are masked off before they're or-ed into the instruction,
+   you can use -1 to make masks.  */
+
+#define insn_d(opcd, rts, ra, d)\
+  opcd) & 0x3f) << 26)  \
+   | (((rts) & 0x1f) << 21) \
+   | (((ra) & 0x1f) << 16)  \
+   | ((d) & 0x))
+
+#define insn_ds(opcd, rts, ra, d, xo)   \
+  opcd) & 0x3f) << 26)  \
+   | (((rts) & 0x1f) << 21) \
+   | (((ra) & 0x1f) << 16)  \
+   | ((d) & 0xfffc) \
+   | ((xo) & 0x3))
+
+#define insn_xfx(opcd, rts, spr, xo)\
+  opcd) & 0x3f) << 26)  \
+   | (((rts) & 0x1f) << 21) \
+   | (((spr) & 0x1f) << 16) \
+   | (((spr) & 0x3e0) << 6) \
+   | (((xo) & 0x3ff) << 1))
+
+/* Read a PPC instruction from memory.  PPC instructions are always
+   big-endian, no matter what endianness the program is running in, so
+   we can't use read_memory_integer or one of its friends here.  */
+static unsigned int
+read_insn (CORE_ADDR pc)
+{
+  unsigned char buf[4];
 
-  /* Floating point registers.  */
-  ppcfbsd_supply_fpreg (fpregs, -1);
+  read_memory (pc, buf, 4);
+  return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
 }
 
-static void
-fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, int 
which,
- CORE_ADDR ignore)
+
+/* An instruction to match.  */
+struct insn_pattern
 {
-  switch (which)
+  unsigned int mask;/* mask the insn with this... */
+  unsigned int data;/* ...and see if it matches this. */
+  int optional; /* If non-zero, this insn may be absent.  */
+};
+
+/* Return non-zero if the ins

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

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

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

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

Modified: head/sys/powerpc/powerpc/db_trace.c
==
--- head/sys/powerpc/powerpc/db_trace.c Thu Jun 23 09:42:41 2011
(r223469)
+++ head/sys/powerpc/powerpc/db_trace.c Thu Jun 23 09:43:53 2011
(r223470)
@@ -200,7 +200,7 @@ db_backtrace(struct thread *td, db_addr_
}
 
#ifdef __powerpc64__
-   db_printf("0x%16lx: ", stackframe);
+   db_printf("0x%016lx: ", stackframe);
#else
db_printf("0x%08x: ", stackframe);
#endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

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

Log:
  Fix merge typo.

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

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cThu Jun 23 09:43:53 2011
(r223470)
+++ head/sys/powerpc/aim/mmu_oea64.cThu Jun 23 09:46:12 2011
(r223471)
@@ -1715,7 +1715,7 @@ moea64_kextract(mmu_t mmu, vm_offset_t v
pvo = moea64_pvo_find_va(kernel_pmap, va);
KASSERT(pvo != NULL, ("moea64_kextract: no addr found for %#" PRIxPTR,
va));
-   pa = (pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) + (va - PVO_VADDR(pvo));
+   pa = (pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) | (va - PVO_VADDR(pvo));
PMAP_UNLOCK(kernel_pmap);
return (pa);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r212260 - in head: share/misc usr.bin/calendar/calendars

2010-09-06 Thread Andreas Tobler
Author: andreast
Date: Mon Sep  6 19:00:00 2010
New Revision: 212260
URL: http://svn.freebsd.org/changeset/base/212260

Log:
  Add myself to calendar.freebsd and committers-src.dot.
  
  Approved by:  nwhitehorn  (mentor)

Modified:
  head/share/misc/committers-src.dot
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Mon Sep  6 16:33:46 2010
(r212259)
+++ head/share/misc/committers-src.dot  Mon Sep  6 19:00:00 2010
(r212260)
@@ -58,6 +58,7 @@ akiyama [label="Shunsuke Akiyama\nakiyam
 ambrisko [label="Doug ambrisko\nambri...@freebsd.org\n2001/12/19"]
 anchie [label="Ana kukec\nanc...@freebsd.org\n2010/04/14"]
 andre [label="Andre oppermann\nan...@freebsd.org\n2003/11/12"]
+andreast [label="Andreas tobler\nandre...@freebsd.org\n2010/09/05"]
 andrew [label="Andrew turner\nand...@freebsd.org\n2010/07/19"]
 anholt [label="Eric anholt\nanh...@freebsd.org\n2002/04/22"]
 antoine [label="Antoine brodin\nanto...@freebsd.org\n2008/02/03"]

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdMon Sep  6 16:33:46 
2010(r212259)
+++ head/usr.bin/calendar/calendars/calendar.freebsdMon Sep  6 19:00:00 
2010(r212260)
@@ -180,6 +180,7 @@
 06/19  Charlie Root  born in Portland, Oregon, United 
States, 1993
 06/21  Ganbold Tsagaankhuu  born in Ulaanbaatar, 
Mongolia, 1971
 06/21  Niels Heinen  born in Markelo, the Netherlands, 1978
+06/22  Andreas Tobler  born in Heiden, Switzerland, 1968
 06/24  Chris Faulhaber  born in Springfield, Illinois, 
United States, 1971
 06/26  Brian Somers  born in Dundrum, Dublin, Ireland, 1967
 06/28  Mark Santcroos  born in Rotterdam, the Netherlands, 
1979
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r212261 - head/share/misc

2010-09-06 Thread Andreas Tobler
Author: andreast
Date: Mon Sep  6 20:16:10 2010
New Revision: 212261
URL: http://svn.freebsd.org/changeset/base/212261

Log:
  Point out who is my mentor.
  
  Approved by:  nwhitehorn  (mentor)

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Mon Sep  6 19:00:00 2010
(r212260)
+++ head/share/misc/committers-src.dot  Mon Sep  6 20:16:10 2010
(r212261)
@@ -411,6 +411,8 @@ njl -> philip
 njl -> rpaulo
 njl -> sepotvin
 
+nwhitehorn -> andreast
+
 obrien -> benno
 obrien -> groudier
 obrien -> gshapiro
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2010-09-15 Thread Andreas Tobler
Author: andreast
Date: Wed Sep 15 19:08:41 2010
New Revision: 212687
URL: http://svn.freebsd.org/changeset/base/212687

Log:
  Increase register access delay to deal with the high-latency I2C
  chipset found in some models of Powermac G5.
  
  Approved by:  nwhitehorn (mentor)

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

Modified: head/sys/powerpc/powermac/kiic.c
==
--- head/sys/powerpc/powermac/kiic.cWed Sep 15 18:51:15 2010
(r212686)
+++ head/sys/powerpc/powermac/kiic.cWed Sep 15 19:08:41 2010
(r212687)
@@ -250,7 +250,7 @@ static void
 kiic_writereg(struct kiic_softc *sc, u_int reg, u_int val)
 {
bus_write_4(sc->sc_reg, sc->sc_regstep * reg, val);
-   DELAY(10); /* register access delay */
+   DELAY(100); /* register access delay */
 }
 
 static u_int
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r213098 - in head/sys: amd64/conf i386/conf pc98/conf powerpc/conf sparc64/conf

2010-09-25 Thread Andreas Tobler

Hi!

On 24.09.10 11:04, David Xu wrote:

Author: davidxu
Date: Fri Sep 24 09:04:16 2010
New Revision: 213098
URL: http://svn.freebsd.org/changeset/base/213098

Log:
   Now userland POSIX semaphore is based on umtx. The kernel module
   is only used to support binary compatible, if want to run old
   binary, you need to kldload the module.


I guess this is also valid for powerpc/GENERIC64, right? Or do we need 
some work here?


Thanks,
Andreas



Modified:
   head/sys/amd64/conf/GENERIC
   head/sys/i386/conf/GENERIC
   head/sys/pc98/conf/GENERIC
   head/sys/powerpc/conf/GENERIC


Index: sys/powerpc/conf/GENERIC64
===
--- sys/powerpc/conf/GENERIC64  (revision 213168)
+++ sys/powerpc/conf/GENERIC64  (working copy)
@@ -59,7 +59,6 @@
 optionsSYSVSHM #SYSV-style shared memory
 optionsSYSVMSG #SYSV-style message queues
 optionsSYSVSEM #SYSV-style semaphores
-optionsP1003_1B_SEMAPHORES # POSIX-style semaphores
 options_KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions
 optionsHWPMC_HOOKS # Necessary kernel hooks for hwpmc(4)
 optionsAUDIT   # Security event auditing

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


svn commit: r213904 - in head/sys: conf dev/iicbus powerpc/conf powerpc/powermac

2010-10-15 Thread Andreas Tobler
Author: andreast
Date: Fri Oct 15 20:08:16 2010
New Revision: 213904
URL: http://svn.freebsd.org/changeset/base/213904

Log:
  Add three new drivers for fan control and temperature reading on the
  PowerMac7,2.
  
  - The fcu driver lets us read and write the fan RPMs for all fans in the
PowerMac7,2. This driver is PowerMac specific.
  - The ds1775 is a driver to read the temperature for the drive bay sensor.
  - The max6690 is another driver to read temperatures. Here it is used to
read the inlet, the backside and the U3 heatsink temperature.
  
  An additional driver, the ad7417, will follow later.
  
  Thanks to nwhitehorn for guiding me through this driver development.
  
  Approved by:  nwhitehorn (mentor)

Added:
  head/sys/dev/iicbus/ds1775.c   (contents, props changed)
  head/sys/dev/iicbus/max6690.c   (contents, props changed)
  head/sys/powerpc/powermac/fcu.c   (contents, props changed)
Modified:
  head/sys/conf/files.powerpc
  head/sys/powerpc/conf/GENERIC
  head/sys/powerpc/conf/GENERIC64
  head/sys/powerpc/conf/NOTES

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Fri Oct 15 20:01:35 2010(r213903)
+++ head/sys/conf/files.powerpc Fri Oct 15 20:08:16 2010(r213904)
@@ -26,6 +26,8 @@ dev/cfi/cfi_bus_fdt.c optionalcfi fdt
 dev/fb/fb.coptionalsc
 dev/fdt/fdt_powerpc.c  optionalfdt
 dev/hwpmc/hwpmc_powerpc.c  optionalhwpmc
+dev/iicbus/ds1775.coptionalds1775 powermac
+dev/iicbus/max6690.c   optionalmax6690 powermac
 dev/kbd/kbd.c  optionalsc
 dev/mem/memutil.c  optionalmem
 dev/ofw/openfirm.c optionalaim | fdt
@@ -138,6 +140,7 @@ powerpc/powermac/ata_dbdma.coptionalpo
 powerpc/powermac/cuda.coptionalpowermac cuda
 powerpc/powermac/cpcht.c   optionalpowermac pci
 powerpc/powermac/dbdma.c   optionalpowermac pci
+powerpc/powermac/fcu.c optionalpowermac fcu
 powerpc/powermac/grackle.c optionalpowermac pci
 powerpc/powermac/hrowpic.c optionalpowermac pci
 powerpc/powermac/kiic.coptionalpowermac kiic

Added: head/sys/dev/iicbus/ds1775.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/iicbus/ds1775.cFri Oct 15 20:08:16 2010
(r213904)
@@ -0,0 +1,255 @@
+/*-
+ * 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
+ * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#define FCU_ZERO_C_TO_K 2732
+
+/* Drivebay sensor: LM75/DS1775. */
+#define DS1775_TEMP 0x0
+
+struct ds1775_sensor {
+   charlocation[32];
+};
+
+/* Regular bus attachment functions */
+static int  ds1775_probe(device_t);
+static int  ds1775_attach(device_t);
+
+/* Utility functions */
+static int  ds1775_sensor_sysctl(SYSCTL_HANDLER_ARGS);
+static void ds1775_start(void *xdev);
+static int  ds1775_read_2(device_t dev, uint32_t addr, uint8_t reg,
+ uint16_t *data);
+
+struct ds1775_softc {
+   device_tsc_dev;
+   struct intr_config_hook enum_hook;
+   uint32_tsc_addr;
+   struct ds1775_sensor*sc_sensors;
+
+};
+st

svn commit: r215435 - head/sys/boot/powerpc/ofw

2010-11-17 Thread Andreas Tobler
Author: andreast
Date: Wed Nov 17 19:25:37 2010
New Revision: 215435
URL: http://svn.freebsd.org/changeset/base/215435

Log:
  Load the full 16k stack space.
  
  Approved by:  nwhitehorn (mentor)

Modified:
  head/sys/boot/powerpc/ofw/start.c

Modified: head/sys/boot/powerpc/ofw/start.c
==
--- head/sys/boot/powerpc/ofw/start.c   Wed Nov 17 18:55:12 2010
(r215434)
+++ head/sys/boot/powerpc/ofw/start.c   Wed Nov 17 19:25:37 2010
(r215435)
@@ -48,7 +48,7 @@ stack:\n\
 _start:\n\
lis %r1,st...@ha\n\
addi%r1,%r1,st...@l \n\
-   addi%r1,%r1,8192\n\
+   addi%r1,%r1,16384   \n\
\n\
b   startup \n\
 ");
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r215436 - head/sys/boot/powerpc/ofw

2010-11-17 Thread Andreas Tobler
Author: andreast
Date: Wed Nov 17 19:28:48 2010
New Revision: 215436
URL: http://svn.freebsd.org/changeset/base/215436

Log:
  Make sure the .bss is cleared at the beginning. The pSeries OF ELF loader does
  not clear .bss automatically.
  
  Approved by:  nwhitehorn (mentor)

Modified:
  head/sys/boot/powerpc/ofw/start.c

Modified: head/sys/boot/powerpc/ofw/start.c
==
--- head/sys/boot/powerpc/ofw/start.c   Wed Nov 17 19:25:37 2010
(r215435)
+++ head/sys/boot/powerpc/ofw/start.c   Wed Nov 17 19:28:48 2010
(r215436)
@@ -50,7 +50,20 @@ _start:  \n\
addi%r1,%r1,st...@l \n\
addi%r1,%r1,16384   \n\
\n\
-   b   startup \n\
+   /* Clear the .bss!!! */ \n\
+   li  %r0,0   \n\
+   lis %r8,_ed...@ha   \n\
+   addi%r8,%r8,_ed...@l\n\
+   lis %r9,_...@ha \n\
+   addi%r9,%r9,_...@l  \n\
+   \n\
+1: cmpw0,%r8,%r9   \n\
+   bge 2f  \n\
+   stw %r0,0(%r8)  \n\
+   addi%r8,%r8,4   \n\
+   b   1b  \n\
+   \n\
+2: b   startup \n\
 ");
 
 void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r215437 - head/sys/boot/ofw/libofw

2010-11-17 Thread Andreas Tobler
Author: andreast
Date: Wed Nov 17 19:31:48 2010
New Revision: 215437
URL: http://svn.freebsd.org/changeset/base/215437

Log:
  Move the declaration of the eh struct (used only when debugging is enabled)
  from ofwn_put into the debug section.
  
  Approved by:  nwhitehorn (mentor)

Modified:
  head/sys/boot/ofw/libofw/ofw_net.c

Modified: head/sys/boot/ofw/libofw/ofw_net.c
==
--- head/sys/boot/ofw/libofw/ofw_net.c  Wed Nov 17 19:28:48 2010
(r215436)
+++ head/sys/boot/ofw/libofw/ofw_net.c  Wed Nov 17 19:31:48 2010
(r215437)
@@ -90,11 +90,11 @@ ofwn_probe(struct netif *nif, void *mach
 static int
 ofwn_put(struct iodesc *desc, void *pkt, size_t len)
 {
-   struct ether_header *eh;
size_t  sendlen;
ssize_t rv;
 
 #if defined(NETIF_DEBUG)
+   struct ether_header *eh;
printf("netif_put: desc=0x%x pkt=0x%x len=%d\n", desc, pkt, len);
eh = pkt;
printf("dst: %s ", ether_sprintf(eh->ether_dhost));
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r215438 - head/sys/boot/ofw/libofw

2010-11-17 Thread Andreas Tobler
Author: andreast
Date: Wed Nov 17 19:35:56 2010
New Revision: 215438
URL: http://svn.freebsd.org/changeset/base/215438

Log:
  Check the real-mode? OF property to find out whether we operate in real or
  virtual mode. In virtual mode we have to do memory mapping. On PowerMacs it is
  usually false while on pSeries we have found that it is true. The real-mode?
  property is not available on sparc64.
  
  Approved by:  nwhitehorn (mentor)

Modified:
  head/sys/boot/ofw/libofw/ofw_copy.c
  head/sys/boot/ofw/libofw/openfirm.c
  head/sys/boot/ofw/libofw/openfirm.h

Modified: head/sys/boot/ofw/libofw/ofw_copy.c
==
--- head/sys/boot/ofw/libofw/ofw_copy.c Wed Nov 17 19:31:48 2010
(r215437)
+++ head/sys/boot/ofw/libofw/ofw_copy.c Wed Nov 17 19:35:56 2010
(r215438)
@@ -91,16 +91,22 @@ ofw_mapmem(vm_offset_t dest, const size_
 return (ENOMEM);
 }
 
-if (OF_call_method("claim", mmu, 3, 1, destp, dlen, 0, &addr) == -1) {
-printf("ofw_mapmem: virtual claim failed\n");
-return (ENOMEM);
-}
-
-if (OF_call_method("map", mmu, 4, 0, destp, destp, dlen, 0) == -1) {
-printf("ofw_mapmem: map failed\n");
-return (ENOMEM);
-}
+   /*
+* We only do virtual memory management when real_mode is false.
+*/
+   if (real_mode == 0) {
+   if (OF_call_method("claim", mmu, 3, 1, destp, dlen, 0, &addr)
+   == -1) {
+   printf("ofw_mapmem: virtual claim failed\n");
+   return (ENOMEM);
+   }
 
+   if (OF_call_method("map", mmu, 4, 0, destp, destp, dlen, 0)
+   == -1) {
+   printf("ofw_mapmem: map failed\n");
+   return (ENOMEM);
+   }
+   }
 last_dest = (vm_offset_t) destp;
 last_len  = dlen;
 

Modified: head/sys/boot/ofw/libofw/openfirm.c
==
--- head/sys/boot/ofw/libofw/openfirm.c Wed Nov 17 19:31:48 2010
(r215437)
+++ head/sys/boot/ofw/libofw/openfirm.c Wed Nov 17 19:35:56 2010
(r215438)
@@ -69,12 +69,15 @@ int (*openfirmware)(void *);
 phandle_t chosen;
 ihandle_t mmu;
 ihandle_t memory;
+int  real_mode = 0;
 
 /* Initialiser */
 
 void
 OF_init(int (*openfirm)(void *))
 {
+   phandle_t options;
+   char  mode[8];
 
openfirmware = openfirm;
 
@@ -89,6 +92,15 @@ OF_init(int (*openfirm)(void *))
}
if (OF_getprop(chosen, "mmu", &mmu, sizeof(mmu)) == -1)
OF_exit();
+
+   /* 
+* Check if we run in real mode. If so, we do not need to map
+* memory later on.
+*/
+   options = OF_finddevice("/options");
+   OF_getprop(options, "real-mode?", mode, sizeof(mode));
+   if (strncmp(mode, "true", 4) == 0)
+   real_mode = 1;
 }
 
 /*

Modified: head/sys/boot/ofw/libofw/openfirm.h
==
--- head/sys/boot/ofw/libofw/openfirm.h Wed Nov 17 19:31:48 2010
(r215437)
+++ head/sys/boot/ofw/libofw/openfirm.h Wed Nov 17 19:35:56 2010
(r215438)
@@ -72,6 +72,7 @@ typedef unsigned long int cell_t;
 extern int (*openfirmware)(void *);
 extern phandle_t   chosen;
 extern ihandle_t   memory, mmu;
+extern int real_mode;
 
 /*
  * This isn't actually an Open Firmware function, but it seemed like the right
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r215441 - head/sys/boot/powerpc/ofw

2010-11-17 Thread Andreas Tobler
Author: andreast
Date: Wed Nov 17 20:37:16 2010
New Revision: 215441
URL: http://svn.freebsd.org/changeset/base/215441

Log:
  Revert r215435. We need to figure out the exact value to be loaded.
  
  Approved by:  nwhitehorn (mentor)

Modified:
  head/sys/boot/powerpc/ofw/start.c

Modified: head/sys/boot/powerpc/ofw/start.c
==
--- head/sys/boot/powerpc/ofw/start.c   Wed Nov 17 20:21:10 2010
(r215440)
+++ head/sys/boot/powerpc/ofw/start.c   Wed Nov 17 20:37:16 2010
(r215441)
@@ -48,7 +48,7 @@ stack:\n\
 _start:\n\
lis %r1,st...@ha\n\
addi%r1,%r1,st...@l \n\
-   addi%r1,%r1,16384   \n\
+   addi%r1,%r1,8192\n\
\n\
/* Clear the .bss!!! */ \n\
li  %r0,0   \n\
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r215577 - head/sys/boot/ofw/libofw

2010-11-20 Thread Andreas Tobler
Author: andreast
Date: Sat Nov 20 19:23:16 2010
New Revision: 215577
URL: http://svn.freebsd.org/changeset/base/215577

Log:
  Check the OF_getprop() return value before proceeding. Allocate only as
  much space as needed for the mode buffer. Use strcmp, relying on OF giving
  back NULL terminated strings.
  
  Submitted by: marius
  Approved by:  nwhitehorn (mentor)

Modified:
  head/sys/boot/ofw/libofw/openfirm.c

Modified: head/sys/boot/ofw/libofw/openfirm.c
==
--- head/sys/boot/ofw/libofw/openfirm.c Sat Nov 20 18:40:50 2010
(r215576)
+++ head/sys/boot/ofw/libofw/openfirm.c Sat Nov 20 19:23:16 2010
(r215577)
@@ -77,7 +77,7 @@ void
 OF_init(int (*openfirm)(void *))
 {
phandle_t options;
-   char  mode[8];
+   char  mode[sizeof("true")];
 
openfirmware = openfirm;
 
@@ -93,13 +93,13 @@ OF_init(int (*openfirm)(void *))
if (OF_getprop(chosen, "mmu", &mmu, sizeof(mmu)) == -1)
OF_exit();
 
-   /* 
+   /*
 * Check if we run in real mode. If so, we do not need to map
 * memory later on.
 */
options = OF_finddevice("/options");
-   OF_getprop(options, "real-mode?", mode, sizeof(mode));
-   if (strncmp(mode, "true", 4) == 0)
+   if (OF_getprop(options, "real-mode?", mode, sizeof(mode)) > 0 &&
+   strcmp(mode, "true") == 0)
real_mode = 1;
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2010-12-10 Thread Andreas Tobler
Author: andreast
Date: Fri Dec 10 20:27:50 2010
New Revision: 216360
URL: http://svn.freebsd.org/changeset/base/216360

Log:
  On the Xserve G5 we find the LM75 instead of the DS1775. The core
  functionality is the same, a difference is that the DS1775 has a better
  precision than the LM75. But we do not use it in our setup. Make the
  LM75 work the same as the DS1775.
  
  Fix a typo in device_set_desc.
  
  Tested by: Paul Mather 
  
  Approved by:  nwhitehorn (mentor)

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

Modified: head/sys/dev/iicbus/ds1775.c
==
--- head/sys/dev/iicbus/ds1775.cFri Dec 10 15:37:54 2010
(r216359)
+++ head/sys/dev/iicbus/ds1775.cFri Dec 10 20:27:50 2010
(r216360)
@@ -127,14 +127,15 @@ ds1775_probe(device_t dev)
return (ENXIO);
 
if (strcmp(name, "temp-monitor") != 0 ||
-   strcmp(compatible, "ds1775") != 0)
+   (strcmp(compatible, "ds1775") != 0 &&
+strcmp(compatible, "lm75") != 0))
return (ENXIO);
 
sc = device_get_softc(dev);
sc->sc_dev = dev;
sc->sc_addr = iicbus_get_addr(dev);
 
-   device_set_desc(dev, "Temp-Monitor DS1755");
+   device_set_desc(dev, "Temp-Monitor DS1775");
 
return (0);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2011-01-05 Thread Andreas Tobler
Author: andreast
Date: Wed Jan  5 21:38:02 2011
New Revision: 217027
URL: http://svn.freebsd.org/changeset/base/217027

Log:
  Fix null string handling in ofw_real_nextprop function. Pass the right
  length to ofw_real_map in case of a null string.
  This makes ofwdump(8) work correctly when trying to print all properties
  with ofwdump -p.
  
  Approved by:  nwhitehorn (mentor)

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

Modified: head/sys/powerpc/ofw/ofw_real.c
==
--- head/sys/powerpc/ofw/ofw_real.c Wed Jan  5 21:23:26 2011
(r217026)
+++ head/sys/powerpc/ofw/ofw_real.c Wed Jan  5 21:38:02 2011
(r217027)
@@ -266,7 +266,11 @@ ofw_real_map(const void *buf, size_t len
return 0;
}
 
-   memcpy(of_bounce_virt + of_bounce_offset, buf, len);
+   if (buf != NULL)
+   memcpy(of_bounce_virt + of_bounce_offset, buf, len);
+   else
+   return (0);
+
phys = of_bounce_phys + of_bounce_offset;
 
of_bounce_offset += len;
@@ -282,6 +286,9 @@ ofw_real_unmap(cell_t physaddr, void *bu
if (of_bounce_virt == NULL)
return;
 
+   if (physaddr == 0)
+   return;
+
memcpy(buf,of_bounce_virt + (physaddr - of_bounce_phys),len);
 }
 
@@ -546,11 +553,10 @@ ofw_real_nextprop(ofw_t ofw, phandle_t p
ofw_real_start();
 
args.package = package;
-   args.previous = ofw_real_map(previous, strlen(previous) + 1);
+   args.previous = ofw_real_map(previous, (previous != NULL) ? 
(strlen(previous) + 1) : 0);
args.buf = ofw_real_map(buf, size);
argsptr = ofw_real_map(&args, sizeof(args));
-   if (args.previous == 0 || args.buf == 0 ||
-   openfirmware((void *)argsptr) == -1) {
+   if (args.buf == 0 || openfirmware((void *)argsptr) == -1) {
ofw_real_stop();
return (-1);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r217065 - in head/sys/powerpc: aim cpufreq powermac

2011-01-06 Thread Andreas Tobler
Author: andreast
Date: Thu Jan  6 20:19:01 2011
New Revision: 217065
URL: http://svn.freebsd.org/changeset/base/217065

Log:
  Remove unused variables. Spotted by a cppcheck
  (devel/cppcheck, http://sourceforge.net/projects/cppcheck) run.
  
  Approved by: nwhitehorn (mentor)

Modified:
  head/sys/powerpc/aim/nexus.c
  head/sys/powerpc/aim/vm_machdep.c
  head/sys/powerpc/cpufreq/dfs.c
  head/sys/powerpc/cpufreq/pcr.c
  head/sys/powerpc/powermac/macgpio.c
  head/sys/powerpc/powermac/uninorth.c

Modified: head/sys/powerpc/aim/nexus.c
==
--- head/sys/powerpc/aim/nexus.cThu Jan  6 20:05:24 2011
(r217064)
+++ head/sys/powerpc/aim/nexus.cThu Jan  6 20:19:01 2011
(r217065)
@@ -340,7 +340,6 @@ static int
 nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
 driver_filter_t *filter, driver_intr_t *ihand, void *arg, void **cookiep)
 {
-   driver_t*driver;
int error;
 
/* somebody tried to setup an irq that failed to allocate! */
@@ -351,8 +350,6 @@ nexus_setup_intr(device_t dev, device_t 
if ((rman_get_flags(res) & RF_SHAREABLE) == 0)
flags |= INTR_EXCL;
 
-   driver = device_get_driver(child);
-
/*
 * We depend here on rman_activate_resource() being idempotent.
 */

Modified: head/sys/powerpc/aim/vm_machdep.c
==
--- head/sys/powerpc/aim/vm_machdep.c   Thu Jan  6 20:05:24 2011
(r217064)
+++ head/sys/powerpc/aim/vm_machdep.c   Thu Jan  6 20:19:01 2011
(r217065)
@@ -143,7 +143,6 @@ extern uintptr_t tocbase;
 void
 cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
 {
-   struct  proc *p1;
struct  trapframe *tf;
struct  callframe *cf;
struct  pcb *pcb;
@@ -156,8 +155,6 @@ cpu_fork(struct thread *td1, struct proc
if ((flags & RFPROC) == 0)
return;
 
-   p1 = td1->td_proc;
-
pcb = (struct pcb *)((td2->td_kstack +
td2->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb)) & ~0x2fUL);
td2->td_pcb = pcb;

Modified: head/sys/powerpc/cpufreq/dfs.c
==
--- head/sys/powerpc/cpufreq/dfs.c  Thu Jan  6 20:05:24 2011
(r217064)
+++ head/sys/powerpc/cpufreq/dfs.c  Thu Jan  6 20:19:01 2011
(r217065)
@@ -165,12 +165,10 @@ dfs_settings(device_t dev, struct cf_set
 static int
 dfs_set(device_t dev, const struct cf_setting *set)
 {
-   struct dfs_softc *sc;
register_t hid1;

if (set == NULL)
return (EINVAL);
-   sc = device_get_softc(dev);
 
hid1 = mfspr(SPR_HID1);
hid1 &= ~(HID1_DFS2 | HID1_DFS4);

Modified: head/sys/powerpc/cpufreq/pcr.c
==
--- head/sys/powerpc/cpufreq/pcr.c  Thu Jan  6 20:05:24 2011
(r217064)
+++ head/sys/powerpc/cpufreq/pcr.c  Thu Jan  6 20:19:01 2011
(r217065)
@@ -305,12 +305,10 @@ pcr_set(device_t dev, const struct cf_se
 static int
 pcr_get(device_t dev, struct cf_setting *set)
 {
-   struct pcr_softc *sc;
uint64_t psr;
 
if (set == NULL)
return (EINVAL);
-   sc = device_get_softc(dev);
 
memset(set, CPUFREQ_VAL_UNKNOWN, sizeof(*set));
 

Modified: head/sys/powerpc/powermac/macgpio.c
==
--- head/sys/powerpc/powermac/macgpio.c Thu Jan  6 20:05:24 2011
(r217064)
+++ head/sys/powerpc/powermac/macgpio.c Thu Jan  6 20:19:01 2011
(r217065)
@@ -264,10 +264,8 @@ static struct resource *
 macgpio_alloc_resource(device_t bus, device_t child, int type, int *rid,
 u_long start, u_long end, u_long count, u_int flags)
 {
-   struct macgpio_softc *sc;
struct macgpio_devinfo *dinfo;
 
-   sc = device_get_softc(bus);
dinfo = device_get_ivars(child);
 
if (type != SYS_RES_IRQ)

Modified: head/sys/powerpc/powermac/uninorth.c
==
--- head/sys/powerpc/powermac/uninorth.cThu Jan  6 20:05:24 2011
(r217064)
+++ head/sys/powerpc/powermac/uninorth.cThu Jan  6 20:19:01 2011
(r217065)
@@ -530,11 +530,8 @@ static int
 unin_chip_activate_resource(device_t bus, device_t child, int type, int rid,
struct resource *res)
 {
-   struct unin_chip_softc *sc;
void*p;
 
-   sc = device_get_softc(bus);
-
if (type == SYS_RES_IRQ)
 return (bus_activate_resource(bus, type, rid, res));
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/s

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

2011-01-11 Thread Andreas Tobler
Author: andreast
Date: Tue Jan 11 21:18:29 2011
New Revision: 217286
URL: http://svn.freebsd.org/changeset/base/217286

Log:
  Add new functions, fcu_fan_set_pwm and fcu_fan_get_pwm, to set and get
  the pwm values. We can now set the fan's speed of a PWM controlled fan
  with % numbers between 30 and 100 % instead of trying to model a
  % number based on rpm.
  The fcu chip offers both, the dutycycle and the rpm value of the PWM
  controlled fans. I added the rpm value to the list of information
  available via sysctl(8).
  
  Tested by: Paul Mather 
  
  Approved by: nwhitehorn (mentor)

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

Modified: head/sys/powerpc/powermac/fcu.c
==
--- head/sys/powerpc/powermac/fcu.c Tue Jan 11 21:05:21 2011
(r217285)
+++ head/sys/powerpc/powermac/fcu.c Tue Jan 11 21:18:29 2011
(r217286)
@@ -62,19 +62,20 @@ __FBSDID("$FreeBSD$");
 #define FCU_PWM_FAIL  0x2b
 #define FCU_PWM_AVAILABLE 0x2c
 #define FCU_PWM_ACTIVE0x2d
-#define FCU_PWM_READ(x)   0x31 + (x) * 2
-#define FCU_PWM_SET(x)0x30 + (x) * 2
+#define FCU_PWM_RPM(x)0x31 + (x) * 2 /* Get RPM. */
+#define FCU_PWM_SGET(x)   0x30 + (x) * 2 /* Set or get PWM. */
 
 struct fcu_fan {
int id;
-   cell_t  min_rpm;
-   cell_t  max_rpm;
+   cell_t  min;
+   cell_t  max;
charlocation[32];
enum {
FCU_FAN_RPM,
FCU_FAN_PWM
} type;
int setpoint;
+   int rpm;
 };
 
 struct fcu_softc {
@@ -85,6 +86,14 @@ struct fcu_softc {
int sc_nfans;
 };
 
+/* We can read the PWM and the RPM from a PWM controlled fan.
+ * Offer both values via sysctl.
+ */
+enum {
+   FCU_PWM_SYSCTL_PWM   = 1 << 8,
+   FCU_PWM_SYSCTL_RPM   = 2 << 8
+};
+
 static int fcu_rpm_shift;
 
 /* Regular bus attachment functions */
@@ -96,6 +105,9 @@ static void fcu_attach_fans(device_t dev
 static int  fcu_fill_fan_prop(device_t dev);
 static int  fcu_fan_set_rpm(device_t dev, struct fcu_fan *fan, int rpm);
 static int  fcu_fan_get_rpm(device_t dev, struct fcu_fan *fan, int *rpm);
+static int  fcu_fan_set_pwm(device_t dev, struct fcu_fan *fan, int pwm);
+static int  fcu_fan_get_pwm(device_t dev, struct fcu_fan *fan, int *pwm,
+   int *rpm);
 static int  fcu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS);
 static void fcu_start(void *xdev);
 static int  fcu_write(device_t dev, uint32_t addr, uint8_t reg, uint8_t *buf,
@@ -246,34 +258,21 @@ fcu_fan_set_rpm(device_t dev, struct fcu
sc = device_get_softc(dev);
 
/* Clamp to allowed range */
-   rpm = max(fan->min_rpm, rpm);
-   rpm = min(fan->max_rpm, rpm);
+   rpm = max(fan->min, rpm);
+   rpm = min(fan->max, rpm);
 
if (fan->type == FCU_FAN_RPM) {
reg = FCU_RPM_SET(fan->id);
fan->setpoint = rpm;
-   } else if (fan->type == FCU_FAN_PWM) {
-   reg = FCU_PWM_SET(fan->id);
-   if (rpm > 3500)
-   rpm = 3500;
-   if (rpm < 500)
-   rpm = 500;
-   fan->setpoint = rpm;
-   /* PWM 30: 550 rpm, PWM 255: 3400 rpm.  */
-   rpm = (rpm * 255) / 3500;
} else {
device_printf(dev, "Unknown fan type: %d\n", fan->type);
return (EIO);
}
 
-   if (fan->type == FCU_FAN_RPM) {
-   buf[0] = rpm >> (8 - fcu_rpm_shift);
-   buf[1] = rpm << fcu_rpm_shift;
-   fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2);
-   } else {
-   buf[0] = rpm;
-   fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 1);
-   }
+   buf[0] = rpm >> (8 - fcu_rpm_shift);
+   buf[1] = rpm << fcu_rpm_shift;
+
+   fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2);
 
return (0);
 }
@@ -313,7 +312,63 @@ fcu_fan_get_rpm(device_t dev, struct fcu
return (ENXIO);
}
reg = FCU_RPM_READ(fan->id);
-   } else if (fan->type == FCU_FAN_PWM) {
+
+   } else {
+   device_printf(dev, "Unknown fan type: %d\n", fan->type);
+   return (EIO);
+   }
+
+   /* It seems that we can read the fans rpm. */
+   fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buff);
+
+   *rpm = (buff[0] << (8 - fcu_rpm_shift)) | buff[1] >> fcu_rpm_shift;
+
+   return (0);
+}
+
+static int
+fcu_fan_set_pwm(device_t dev, struct fcu_fan *fan, int pwm)
+{
+   uint8_t reg;
+   struct fcu_softc *sc;
+   uint8_t buf[2];
+
+   sc = device_get_softc(dev);
+
+   /* Clamp to allowed range */
+   pwm = max(fan->min, pwm);
+   pwm = min(fan->max, pwm);
+
+   if (fan->type == FCU_FAN_PWM) {
+   reg = FCU_PWM_SGET(fan->id);
+   if (pwm > 100)
+   pwm = 100;
+   if (pwm < 30)
+ 

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

2011-01-15 Thread Andreas Tobler
Author: andreast
Date: Sat Jan 15 19:16:05 2011
New Revision: 217451
URL: http://svn.freebsd.org/changeset/base/217451

Log:
  Remove unused variables. Spotted by a cppcheck
  (devel/cppcheck, http://sourceforge.net/projects/cppcheck) run.
  
  Approved by: nwhitehorn (mentor)

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

Modified: head/sys/powerpc/aim/slb.c
==
--- head/sys/powerpc/aim/slb.c  Sat Jan 15 19:05:06 2011(r217450)
+++ head/sys/powerpc/aim/slb.c  Sat Jan 15 19:16:05 2011(r217451)
@@ -200,9 +200,7 @@ make_intermediate(uint64_t esid, struct 
 uint64_t
 kernel_va_to_slbv(vm_offset_t va)
 {
-   uint64_t esid, slbv;
-
-   esid = (uintptr_t)va >> ADDR_SR_SHFT;
+   uint64_t slbv;
 
/* Set kernel VSID to deterministic value */
slbv = (KERNEL_VSID((uintptr_t)va >> ADDR_SR_SHFT)) << SLBV_VSID_SHIFT;
@@ -485,18 +483,11 @@ slb_uma_real_alloc(uma_zone_t zone, int 
static vm_offset_t realmax = 0;
void *va;
vm_page_t m;
-   int pflags;
 
if (realmax == 0)
realmax = platform_real_maxaddr();
 
*flags = UMA_SLAB_PRIV;
-   if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
-   pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED;
-   else
-   pflags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED;
-   if (wait & M_ZERO)
-   pflags |= VM_ALLOC_ZERO;
 
for (;;) {
m = vm_phys_alloc_contig(1, 0, realmax, PAGE_SIZE,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2011-01-15 Thread Andreas Tobler
Author: andreast
Date: Sat Jan 15 19:16:56 2011
New Revision: 217452
URL: http://svn.freebsd.org/changeset/base/217452

Log:
  Remove unused variable. Spotted by a cppcheck
  (devel/cppcheck, http://sourceforge.net/projects/cppcheck) run.
  
  Approved by: nwhitehorn (mentor)

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

Modified: head/sys/dev/iicbus/max6690.c
==
--- head/sys/dev/iicbus/max6690.c   Sat Jan 15 19:16:05 2011
(r217451)
+++ head/sys/dev/iicbus/max6690.c   Sat Jan 15 19:16:56 2011
(r217452)
@@ -209,7 +209,6 @@ max6690_attach(device_t dev)
 static void
 max6690_start(void *xdev)
 {
-   phandle_t child;
struct max6690_softc *sc;
struct sysctl_oid *oid, *sensroot_oid;
struct sysctl_ctx_list *ctx;
@@ -222,8 +221,6 @@ max6690_start(void *xdev)
 
sc->sc_nsensors = 0;
 
-   child = ofw_bus_get_node(dev);
-
/* Count the actual number of sensors. */
sc->sc_nsensors = max6690_fill_sensor_prop(dev);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2011-01-18 Thread Andreas Tobler
Author: andreast
Date: Tue Jan 18 21:47:30 2011
New Revision: 217560
URL: http://svn.freebsd.org/changeset/base/217560

Log:
  There are PowerMacs which do not have a hwsensor-location property
  for this sensor. Instead of leaving this location empty we use here
  the default name 'sensor'.
  
  Submitted by: Justin Hibbits 
  Approved by: nwhitehorn (mentor)

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

Modified: head/sys/dev/iicbus/ds1775.c
==
--- head/sys/dev/iicbus/ds1775.cTue Jan 18 21:36:51 2011
(r217559)
+++ head/sys/dev/iicbus/ds1775.cTue Jan 18 21:47:30 2011
(r217560)
@@ -172,6 +172,7 @@ ds1775_start(void *xdev)
struct ds1775_sensor *sens;
struct sysctl_oid *sensroot_oid;
struct sysctl_ctx_list *ctx;
+   ssize_t plen;
int i;
char sysctl_name[40], sysctl_desc[40];
const char *units;
@@ -190,16 +191,20 @@ ds1775_start(void *xdev)
ctx = device_get_sysctl_ctx(dev);
sensroot_oid = device_get_sysctl_tree(dev);
 
-   OF_getprop(child, "hwsensor-location", sens->location,
-  sizeof(sens->location));
+   plen = OF_getprop(child, "hwsensor-location", sens->location,
+ sizeof(sens->location));
units = "C";
 
-   for (i = 0; i < strlen(sens->location); i++) {
-   sysctl_name[i] = tolower(sens->location[i]);
-   if (isspace(sysctl_name[i]))
-   sysctl_name[i] = '_';
+   if (plen == -1) {
+   strcpy(sysctl_name, "sensor");
+   } else {
+   for (i = 0; i < strlen(sens->location); i++) {
+   sysctl_name[i] = tolower(sens->location[i]);
+   if (isspace(sysctl_name[i]))
+   sysctl_name[i] = '_';
+   }
+   sysctl_name[i] = 0;
}
-   sysctl_name[i] = 0;
 
sprintf(sysctl_desc,"%s (%s)", sens->location, units);
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensroot_oid), OID_AUTO,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2011-01-20 Thread Andreas Tobler
Author: andreast
Date: Thu Jan 20 20:22:19 2011
New Revision: 217658
URL: http://svn.freebsd.org/changeset/base/217658

Log:
  Correct parsing of the grackle and uninorthpci ranges property.
  
  Approved by: nwhitehorn (mentor)

Modified:
  head/sys/powerpc/powermac/grackle.c
  head/sys/powerpc/powermac/gracklevar.h
  head/sys/powerpc/powermac/uninorthpci.c
  head/sys/powerpc/powermac/uninorthvar.h

Modified: head/sys/powerpc/powermac/grackle.c
==
--- head/sys/powerpc/powermac/grackle.c Thu Jan 20 19:26:28 2011
(r217657)
+++ head/sys/powerpc/powermac/grackle.c Thu Jan 20 20:22:19 2011
(r217658)
@@ -199,11 +199,14 @@ grackle_attach(device_t dev)
return (ENXIO);
}
 
+   sc->sc_nrange /= sizeof(sc->sc_range[0]);
+
sc->sc_range[6].pci_hi = 0;
io = NULL;
nmem = 0;
 
-   for (rp = sc->sc_range; rp->pci_hi != 0; rp++) {
+   for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange &&
+  rp->pci_hi != 0; rp++) {
switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) {
case OFW_PCI_PHYS_HI_SPACE_CONFIG:
break;

Modified: head/sys/powerpc/powermac/gracklevar.h
==
--- head/sys/powerpc/powermac/gracklevar.h  Thu Jan 20 19:26:28 2011
(r217657)
+++ head/sys/powerpc/powermac/gracklevar.h  Thu Jan 20 20:22:19 2011
(r217658)
@@ -45,7 +45,7 @@ struct grackle_softc {
vm_offset_t sc_addr;
vm_offset_t sc_data;
int sc_bus;
-   struct  grackle_range sc_range[6];
+   struct  grackle_range sc_range[7];
int sc_nrange;
int sc_iostart;
struct  rman sc_io_rman;

Modified: head/sys/powerpc/powermac/uninorthpci.c
==
--- head/sys/powerpc/powermac/uninorthpci.c Thu Jan 20 19:26:28 2011
(r217657)
+++ head/sys/powerpc/powermac/uninorthpci.c Thu Jan 20 20:22:19 2011
(r217658)
@@ -231,11 +231,14 @@ uninorth_attach(device_t dev)
return (ENXIO);
}
 
+   sc->sc_nrange /= sizeof(sc->sc_range[0]);
+
sc->sc_range[6].pci_hi = 0;
io = NULL;
nmem = 0;
 
-   for (rp = sc->sc_range; rp->pci_hi != 0; rp++) {
+   for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange &&
+  rp->pci_hi != 0; rp++) {
switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) {
case OFW_PCI_PHYS_HI_SPACE_CONFIG:
break;

Modified: head/sys/powerpc/powermac/uninorthvar.h
==
--- head/sys/powerpc/powermac/uninorthvar.h Thu Jan 20 19:26:28 2011
(r217657)
+++ head/sys/powerpc/powermac/uninorthvar.h Thu Jan 20 20:22:19 2011
(r217658)
@@ -53,7 +53,7 @@ struct uninorth_softc {
vm_offset_t sc_addr;
vm_offset_t sc_data;
int sc_bus;
-   struct  uninorth_range sc_range[6];
+   struct  uninorth_range sc_range[7];
int sc_nrange;
int sc_iostart;
struct  rman sc_io_rman;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2011-01-20 Thread Andreas Tobler
Author: andreast
Date: Thu Jan 20 20:23:03 2011
New Revision: 217659
URL: http://svn.freebsd.org/changeset/base/217659

Log:
  Remove unused variables. Spotted by a cppcheck
  (devel/cppcheck, http://sourceforge.net/projects/cppcheck) run.
  
  Approved by: nwhitehorn (mentor)

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

Modified: head/sys/powerpc/powermac/cpcht.c
==
--- head/sys/powerpc/powermac/cpcht.c   Thu Jan 20 20:22:19 2011
(r217658)
+++ head/sys/powerpc/powermac/cpcht.c   Thu Jan 20 20:23:03 2011
(r217659)
@@ -475,10 +475,6 @@ cpcht_write_config(device_t dev, u_int b
 static int
 cpcht_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
 {
-   struct  cpcht_softc *sc;
-
-   sc = device_get_softc(dev);
-
switch (which) {
case PCIB_IVAR_DOMAIN:
*result = device_get_unit(dev);
@@ -514,13 +510,12 @@ cpcht_alloc_resource(device_t bus, devic
struct  cpcht_softc *sc;
struct  resource *rv;
struct  rman *rm;
-   int needactivate, err;
+   int needactivate;
 
needactivate = flags & RF_ACTIVE;
flags &= ~RF_ACTIVE;
 
sc = device_get_softc(bus);
-   err = 0;
 
switch (type) {
case SYS_RES_IOPORT:
@@ -569,9 +564,6 @@ cpcht_activate_resource(device_t bus, de
 struct resource *res)
 {
void*p;
-   struct  cpcht_softc *sc;
-
-   sc = device_get_softc(bus);
 
if (type == SYS_RES_IRQ)
return (bus_activate_resource(bus, type, rid, res));
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r224216 - in head/sys: ia64/ia64 mips/mips powerpc/aim sparc64/sparc64

2011-07-25 Thread Andreas Tobler

On 24.07.11 23:35, Nathan Whitehorn wrote:

On 07/19/11 07:41, Attilio Rao wrote:

Author: attilio
Date: Tue Jul 19 12:41:57 2011
New Revision: 224216
URL: http://svn.freebsd.org/changeset/base/224216

Log:
On 64 bit architectures size_t is 8 bytes, thus it should use an 8 bytes
storage.
Fix the sintrcnt/sintrnames specification.

No MFC is previewed for this patch.



These also need to be .long on 32-bit PowerPC, otherwise this change
triggers kernel panics and faults in sysctl. Please change it as quickly
as possible.


Like the below?

I'll test and I could commit if ok. (Build and approval)

Gruss,
Andreas

Index: locore32.S
===
--- locore32.S  (revision 224326)
+++ locore32.S  (working copy)
@@ -91,13 +91,13 @@
 GLOBAL(intrnames)
.space  INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
 GLOBAL(sintrnames)
-   .word   INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
+   .long   INTRCNT_COUNT * (MAXCOMLEN + 1) * 2

.align 4
 GLOBAL(intrcnt)
.space  INTRCNT_COUNT * 4 * 2
 GLOBAL(sintrcnt)
-   .word   INTRCNT_COUNT * 4 * 2
+   .long   INTRCNT_COUNT * 4 * 2

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


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

2011-07-25 Thread Andreas Tobler
Author: andreast
Date: Mon Jul 25 20:10:01 2011
New Revision: 224400
URL: http://svn.freebsd.org/changeset/base/224400

Log:
  This a follow up commit from r224216 for powerpc 32-bit. Increase
  the storage size for sintrcnt/sintrnames to .long.
  
  Reviewed by: nwhitehorn
  Approved by: re (kib)

Modified:
  head/sys/powerpc/aim/locore32.S

Modified: head/sys/powerpc/aim/locore32.S
==
--- head/sys/powerpc/aim/locore32.S Mon Jul 25 20:09:09 2011
(r224399)
+++ head/sys/powerpc/aim/locore32.S Mon Jul 25 20:10:01 2011
(r224400)
@@ -91,13 +91,13 @@ GLOBAL(esym)
 GLOBAL(intrnames)
.space  INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
 GLOBAL(sintrnames)
-   .word   INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
+   .long   INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
 
.align 4
 GLOBAL(intrcnt)
.space  INTRCNT_COUNT * 4 * 2
 GLOBAL(sintrcnt)
-   .word   INTRCNT_COUNT * 4 * 2
+   .long   INTRCNT_COUNT * 4 * 2
 
.text
.globl  btext
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r224216 - in head/sys: ia64/ia64 mips/mips powerpc/aim sparc64/sparc64

2011-07-29 Thread Andreas Tobler

On 28.07.11 04:59, Attilio Rao wrote:

I think that the following patch may better reflect the definition of size_t:
http://www.freebsd.org/~attilio/sintrcnt-fixup32.diff

Do you think you can test it out?


PowerPC 32-bit built, booted and completed a buildworld.

Thanks,
Andreas

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


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

2011-11-16 Thread Andreas Tobler
Author: andreast
Date: Wed Nov 16 21:22:51 2011
New Revision: 227586
URL: http://svn.freebsd.org/changeset/base/227586

Log:
  Copy over the ASM_DECLARE_FUNCTION_SIZE macro from linux64.h. This macro
  declares the proper size of a function. Without this macro recent GNU as will
  complain about with:
  'Error: .size expression for main does not evaluate to a constant.'
  
  Up to now we produce this:
  
  .L.main:

.size   main, .-main
  
  With the macro defined the output is this:
  
  .L.main:

.size   main,.-.L.main
  
  This affects only the 64-bit compiler.
  Tested with world and kernel on both, 32 and 64-bit powerpc.

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

Modified: head/contrib/gcc/config/rs6000/freebsd.h
==
--- head/contrib/gcc/config/rs6000/freebsd.hWed Nov 16 20:18:25 2011
(r227585)
+++ head/contrib/gcc/config/rs6000/freebsd.hWed Nov 16 21:22:51 2011
(r227586)
@@ -253,3 +253,22 @@ extern int dot_symbols;
 
 #undef NEED_INDICATE_EXEC_STACK
 #define NEED_INDICATE_EXEC_STACK 1
+
+/* This is how to declare the size of a function.  */
+#undef  ASM_DECLARE_FUNCTION_SIZE
+#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)\
+  do\
+{   \
+  if (!flag_inhibit_size_directive) \
+{   \
+  fputs ("\t.size\t", (FILE));  \
+  if (TARGET_64BIT && DOT_SYMBOLS)  \
+putc ('.', (FILE)); \
+  assemble_name ((FILE), (FNAME));  \
+  fputs (",.-", (FILE));\
+  rs6000_output_function_entry (FILE, FNAME);   \
+  putc ('\n', (FILE));  \
+}   \
+}   \
+  while (0)
+
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r227739 - in head: . contrib/binutils/ld/emulparams contrib/gcc/config/rs6000 contrib/llvm/tools/clang/lib/Driver gnu/usr.bin/binutils/ld sys/boot/ofw sys/boot/powerpc sys/boot/uboot

2011-11-19 Thread Andreas Tobler
Author: andreast
Date: Sat Nov 19 19:25:57 2011
New Revision: 227739
URL: http://svn.freebsd.org/changeset/base/227739

Log:
  Rename the linker emulation name for powerpc and powerc64. This is needed that
  we can also use the upstream binutils linker where we have to have a unique
  name for the FreeBSD emulation.

Added:
  head/contrib/binutils/ld/emulparams/elf64ppc_fbsd.sh   (contents, props 
changed)
Modified:
  head/Makefile.inc1
  head/contrib/gcc/config/rs6000/freebsd.h
  head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
  head/gnu/usr.bin/binutils/ld/Makefile.powerpc
  head/gnu/usr.bin/binutils/ld/Makefile.powerpc64
  head/sys/boot/ofw/Makefile.inc
  head/sys/boot/powerpc/Makefile.inc
  head/sys/boot/uboot/Makefile.inc

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sat Nov 19 19:06:08 2011(r227738)
+++ head/Makefile.inc1  Sat Nov 19 19:25:57 2011(r227739)
@@ -291,7 +291,7 @@ LIB32CPUFLAGS=  -mcpu=powerpc
 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
 .endif
 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc \
-   LD="${LD} -m elf32ppc"
+   LD="${LD} -m elf32ppc_fbsd"
 .endif
 
 

Added: head/contrib/binutils/ld/emulparams/elf64ppc_fbsd.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/binutils/ld/emulparams/elf64ppc_fbsd.shSat Nov 19 
19:25:57 2011(r227739)
@@ -0,0 +1,3 @@
+. ${srcdir}/emulparams/elf64ppc.sh
+. ${srcdir}/emulparams/elf_fbsd.sh
+

Modified: head/contrib/gcc/config/rs6000/freebsd.h
==
--- head/contrib/gcc/config/rs6000/freebsd.hSat Nov 19 19:06:08 2011
(r227738)
+++ head/contrib/gcc/config/rs6000/freebsd.hSat Nov 19 19:25:57 2011
(r227739)
@@ -193,7 +193,7 @@ extern int dot_symbols;
 #undef LINK_OS_FREEBSD_SPEC
 #defineASM_DEFAULT_SPEC"-mppc%{!m32:64}"
 #defineASM_SPEC"%{m32:-a32}%{!m32:-a64} " SVR4_ASM_SPEC
-#defineLINK_OS_FREEBSD_SPEC"%{m32:-melf32ppc}%{!m32:-melf64ppc} " 
LINK_OS_FREEBSD_SPEC_DEF
+#defineLINK_OS_FREEBSD_SPEC
"%{m32:-melf32ppc_fbsd}%{!m32:-melf64ppc_fbsd} " LINK_OS_FREEBSD_SPEC_DEF
 #endif
 
 /* _init and _fini functions are built from bits spread across many

Modified: head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
==
--- head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp  Sat Nov 19 19:06:08 
2011(r227738)
+++ head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp  Sat Nov 19 19:25:57 
2011(r227739)
@@ -3926,7 +3926,7 @@ void freebsd::Link::ConstructJob(Compila
 
   if (getToolChain().getArchName() == "powerpc") {
 CmdArgs.push_back("-m");
-CmdArgs.push_back("elf32ppc");
+CmdArgs.push_back("elf32ppc_fbsd");
   }
 
   if (Output.isFilename()) {

Modified: head/gnu/usr.bin/binutils/ld/Makefile.powerpc
==
--- head/gnu/usr.bin/binutils/ld/Makefile.powerpc   Sat Nov 19 19:06:08 
2011(r227738)
+++ head/gnu/usr.bin/binutils/ld/Makefile.powerpc   Sat Nov 19 19:25:57 
2011(r227739)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-NATIVE_EMULATION=  elf32ppc
+NATIVE_EMULATION=  elf32ppc_fbsd
 
 SRCS+= e${NATIVE_EMULATION}.c
 CLEANFILES+=   e${NATIVE_EMULATION}.c

Modified: head/gnu/usr.bin/binutils/ld/Makefile.powerpc64
==
--- head/gnu/usr.bin/binutils/ld/Makefile.powerpc64 Sat Nov 19 19:06:08 
2011(r227738)
+++ head/gnu/usr.bin/binutils/ld/Makefile.powerpc64 Sat Nov 19 19:25:57 
2011(r227739)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-NATIVE_EMULATION=  elf64ppc
+NATIVE_EMULATION=  elf64ppc_fbsd
 
 SRCS+= e${NATIVE_EMULATION}.c
 CLEANFILES+=   e${NATIVE_EMULATION}.c
@@ -11,7 +11,7 @@ e${NATIVE_EMULATION}.c: emulparams/${NAT
${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
${NATIVE_EMULATION} ""  no ${NATIVE_EMULATION} ${TARGET_TUPLE}
 
-PPC32_EMULATION= elf32ppc
+PPC32_EMULATION= elf32ppc_fbsd
 _ppc32_path=   \"${TOOLS_PREFIX}/usr/lib32\"
 EMS+=  ${PPC32_EMULATION}
 .for ext in ${ELF_SCR_EXT}

Modified: head/sys/boot/ofw/Makefile.inc
==
--- head/sys/boot/ofw/Makefile.inc  Sat Nov 19 19:06:08 2011
(r227738)
+++ head/sys/boot/ofw/Makefile.inc  Sat Nov 19 19:25:57 2011
(r227739)
@@ -2,7 +2,7 @@
 
 .if ${MACHINE_ARCH} == "powerpc64"
 CFLAGS+=   -m32 -mcpu=powerpc
-LDFLAGS+=  -m elf32ppc
+LDFLAGS+=  -m elf32ppc_fbsd
 .endif
 
 .include "../Makefile.inc"

Modified: head/sys/boot/powerpc/Makefile.inc
===

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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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(&tid, NULL, f, NULL)) != 0) {
fprintf(stderr, "pthread_create: %s\n", strerror(err));
}
if ((err = pthread_join(tid, &res)) != 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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(&tid, NULL, f, NULL)) != 0) {
fprintf(stderr, "pthread_create: %s\n", strerror(err));
}
if ((err = pthread_join(tid, &res)) != 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 appreci

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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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 mailto:l...@pix.net>> 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
mailto:kab...@gmail.com>
>> 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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
mailto:jason.harmen...@gmail.com>> 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


  1   2   3   >