Re: CVS commit: src/sys

2010-06-25 Thread Paul Goyette

On Fri, 25 Jun 2010, Izumi Tsutsui wrote:


Module Name:src
Committed By:   tsutsui
Date:   Fri Jun 25 15:10:43 UTC 2010

Modified Files:
src/sys/kern: init_main.c subr_autoconf.c
src/sys/sys: device.h

Log Message:
Add config_mountroot(9), which defers device configuration
after mountroot(), like config_interrupt(9) that defers
configuration after interrupts are enabled.
This will be used for devices that require firmware loaded
from the root file system by firmload(9) to complete device
initialization (getting MAC address etc).


This could also possibly help us move forward with modularizing some 
device drivers which might need to be loaded from the file system.



-
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:   |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com|
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |  | pgoyette at netbsd.org  |
-


Re: CVS commit: src/sys/dev/pci

2010-06-25 Thread David Young
On Fri, Jun 25, 2010 at 01:10:13PM +0900, masan...@iij.ad.jp wrote:
 
 From: SAITOH Masanobu msai...@netbsd.org
 Subject: CVS commit: src/sys/dev/pci
 Date: Fri, 25 Jun 2010 03:47:58 +
 
  Module Name:src
  Committed By:   msaitoh
  Date:   Fri Jun 25 03:47:57 UTC 2010
  
  Modified Files:
  src/sys/dev/pci: if_wmreg.h
  
  Log Message:
  The GIO master enable bit in STATUS register is not bit 16 but bit 18.
  It will fix a problem on 82580 SGMII system.
 
 This is wrong. I've cvs admined with the following message:
 
   The GIO master enable bit in STATUS register is not bit 16 but bit 18.
   It will fix a problem in the reset sequence on PCI-e chips.

Is it 18 or 19?

-#defineSTATUS_GIO_M_ENA (1U  16) /* PCIX master enable */
+#defineSTATUS_GIO_M_ENA (1U  19) /* GIO master enable */

Use __BIT(3) ?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys/arch/hpcarm/conf

2010-06-25 Thread Valeriy E. Ushakov
On Fri, Jun 25, 2010 at 17:40:33 +, Izumi Tsutsui wrote:

 Module Name:  src
 Committed By: tsutsui
 Date: Fri Jun 25 17:40:33 UTC 2010
 
 Modified Files:
   src/sys/arch/hpcarm/conf: WZERO3
 
 Log Message:
 Set options RTC_OFFSET=-540 since Windows Mobile stores localtime
 into the RTC and we can assume most W-ZERO3 users live in JST timezone.
 
 XXX: Probably it would be better to allow a kernel getting RTC_OFFSET value
 XXX: via bootinfo set by boot(8) or boot.cfg(5).

Hmm, hpcboot does pass rtc offset in bootinfo-timezone.
See e.g. hpcsh/machdep.c 

SY, Uwe
-- 
u...@stderr.spb.ru   |   Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/  |   Ist zu Grunde gehen


Re: CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2010-06-25 Thread Christos Zoulas
In article 20100625183016.ac0be17...@cvs.netbsd.org,
Alistair G. Crooks source-changes-d@NetBSD.org wrote:
-=-=-=-=-=-

Module Name:   src
Committed By:  agc
Date:  Fri Jun 25 18:30:16 UTC 2010

Modified Files:
   src/crypto/external/bsd/netpgp/dist/src/lib: misc.c

Log Message:
Fix build problems on LP64 platforms - thanks to Paul Goyette for the nudge.

That should be %zu really; it is more readable.

christos



Re: CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2010-06-25 Thread Alistair Crooks
On Fri, Jun 25, 2010 at 08:40:26PM +, Christos Zoulas wrote:
 In article 20100625183016.ac0be17...@cvs.netbsd.org,
 Alistair G. Crooks source-changes-d@NetBSD.org wrote:
 -=-=-=-=-=-
 
 Module Name: src
 Committed By:agc
 Date:Fri Jun 25 18:30:16 UTC 2010
 
 Modified Files:
  src/crypto/external/bsd/netpgp/dist/src/lib: misc.c
 
 Log Message:
 Fix build problems on LP64 platforms - thanks to Paul Goyette for the nudge.
 
 That should be %zu really; it is more readable.

%zu is more readble, but it's C99, and even some C99 implementations
don't define it (I have in my mind Microsoft from the time that I brought
up the iSCSI target on Windows, but I may be wrong there)

The following quote is apt:

C99 adds a 'z' modifier specifically for size_t:

printf(Total buffer size: %zu bytes\n, buffer_size);

but many printf implementations don't support it. (Even if your
compiler supports C99 and defines __STDC_VERSION__ appropriately,
that's not, practically speaking, a guarantee that the library also
conforms to C99.)

Even in C99, the %lu method will work unless size_t is bigger than
unsigned long *and* the value being printed exceeds ULONG_MAX, which
is unlikely to happen in practice.

--
Keith Thompson (The_Other_Keith) ks...@mib.org 
http://www.ghoti.net/~kst
San Diego Supercomputer Center * http://users.sdsc.edu/~kst

referenced in:


http://bytes.com/topic/c/answers/221867-portable-way-printf-size_t-instance

Oh, and yes, this is not a we need to conform to c89 as LCD post -
this is 2010 after all - it's an I want netpgp to be as portable as
possible post.

Regards,
Alistair


Re: CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2010-06-25 Thread Joerg Sonnenberger
On Fri, Jun 25, 2010 at 11:54:32PM +0200, Alistair Crooks wrote:
   Even in C99, the %lu method will work unless size_t is bigger than
   unsigned long *and* the value being printed exceeds ULONG_MAX, which
   is unlikely to happen in practice.

Actually, it doesn't. This method breaks as soon as size_t != u_long and
might only work in a few edge cases like the size_t being the last
argument and the byte order is Little Endian. This is worse because IIRC
Microsoft decided to use IL32LLP64 or something similarly fancy.

A more portable approach with autoconf can be found in pkg_install, look
for MISSING_SIZE_T_SUPPORT and the corresponding AC_CHECK_SIZEOF calls
in configure.ac.

Joerg


Re: CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2010-06-25 Thread Alistair Crooks
On Sat, Jun 26, 2010 at 01:32:05AM +0200, Joerg Sonnenberger wrote:
 On Fri, Jun 25, 2010 at 11:54:32PM +0200, Alistair Crooks wrote:
  Even in C99, the %lu method will work unless size_t is bigger than
  unsigned long *and* the value being printed exceeds ULONG_MAX, which
  is unlikely to happen in practice.

Please get the attributions right - I was quoting that text.
 
 Actually, it doesn't. This method breaks as soon as size_t != u_long and
 might only work in a few edge cases like the size_t being the last
 argument and the byte order is Little Endian. This is worse because IIRC
 Microsoft decided to use IL32LLP64 or something similarly fancy.

Can you give us a reference to this, please?
 
 A more portable approach with autoconf can be found in pkg_install, look
 for MISSING_SIZE_T_SUPPORT and the corresponding AC_CHECK_SIZEOF calls
 in configure.ac.

Hmmm, I see this in configure.ac -

AC_CHECK_SIZEOF(int)  
AC_CHECK_SIZEOF(long)   
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(size_t, [#include stdlib.h])

and

case $host in
*-*-hpux*)
AC_DEFINE(MISSING_SIZE_T_SUPPORT)
AH_TEMPLATE([MISSING_SIZE_T_SUPPORT], [ 
Define to 1 if the `z' modifider for printf is missing.
])
;;
esac

and

#ifndef MISSING_SIZE_T_SUPPORT
#  define PRIzu zu
#elif SIZEOF_SIZE_T == SIZEOF_INT
#  define PRIzu u
#elif SIZEOF_SIZE_T == SIZEOF_LONG
#  define PRIzu lu
#elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
#  define PRIzu llu
#else
#  errror Unknown size_t size
#endif

Not quite what I'd been expecting, though, from the glowing description
above.

Am I missing a revision of that file or something? It took me ages to
find it, since I was looking under src/external first of all - and cvs
status does say it's up to date.

Thanks,
Alistair


Re: CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2010-06-25 Thread M. Warner Losh
In message: 20100626032531.ga14...@britannica.bec.de
Joerg Sonnenberger jo...@britannica.bec.de writes:
: On Sat, Jun 26, 2010 at 05:11:39AM +0200, Alistair Crooks wrote:
:  On Sat, Jun 26, 2010 at 01:32:05AM +0200, Joerg Sonnenberger wrote:
:   On Fri, Jun 25, 2010 at 11:54:32PM +0200, Alistair Crooks wrote:
:Even in C99, the %lu method will work unless size_t is bigger 
than
:unsigned long *and* the value being printed exceeds ULONG_MAX, 
which
:is unlikely to happen in practice.
:  
:  Please get the attributions right - I was quoting that text.
:   
:   Actually, it doesn't. This method breaks as soon as size_t != u_long and
:   might only work in a few edge cases like the size_t being the last
:   argument and the byte order is Little Endian. This is worse because IIRC
:   Microsoft decided to use IL32LLP64 or something similarly fancy.
:  
:  Can you give us a reference to this, please?
: 
: E.g.
: 
http://stackoverflow.com/questions/384502/what-is-the-bit-size-of-long-on-64-bit-windows
: and the MSDN reference inside.
: 
:   A more portable approach with autoconf can be found in pkg_install, look
:   for MISSING_SIZE_T_SUPPORT and the corresponding AC_CHECK_SIZEOF calls
:   in configure.ac.
:  
:  Hmmm, I see this in configure.ac -
:  
:  AC_CHECK_SIZEOF(int)  
:  AC_CHECK_SIZEOF(long)   
:  AC_CHECK_SIZEOF(long long)
:  AC_CHECK_SIZEOF(size_t, [#include stdlib.h])
: 
: ...compute the sizes to not depend on SIZE_MAX (which would simplify the
: logic a lot).
: 
:  and
:  
:  case $host in
:  *-*-hpux*)
:  AC_DEFINE(MISSING_SIZE_T_SUPPORT)
:  AH_TEMPLATE([MISSING_SIZE_T_SUPPORT], [ 
:  Define to 1 if the `z' modifider for printf is missing.
:  ])
:  ;;
:  esac
: 
: The only platform for pkgsrc purposes ATM which lacks the %z support.
: 
:  and
:  
:  #ifndef MISSING_SIZE_T_SUPPORT
:  #  define PRIzu zu
:  #elif SIZEOF_SIZE_T == SIZEOF_INT
:  #  define PRIzu u
:  #elif SIZEOF_SIZE_T == SIZEOF_LONG
:  #  define PRIzu lu
:  #elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
:  #  define PRIzu llu
:  #else
:  #  errror Unknown size_t size
:  #endif
:  
:  Not quite what I'd been expecting, though, from the glowing description
:  above.
: 
: It would be simpler if SIZE_MAX support can be assumed. In that case it
: would boil down to
: #if SIZE_MAX == INT_MAX
: #define PRIzu u
: #elif SIZE_MAX == LONG_MAX
: #define PRIzu lu
: #else SIZE_MAX == LLONG_MAX
: #define PRIzu llu
: #endif

You could easily enough have something like the following in autoconf
to generate that:

#include stdlib.h
#include stdio.h

int main(int argc, char **argv)
{
size_t foo = ~0;
printf(#ifndef SIZE_MAX\n#define SIZE_MAX %llu\n#endif\n,
(unsigned long long)foo);
return (0);
}

Warner