arm: support Allwinner A20 Ethernet

2016-02-27 Thread Patrick Wildt
Hi,

the Allwinner A10 and A20 SoC include an EMAC, but it's only used in
few devices like the Cubieboard.  The A20, like the A31 and A80, contain
a GMAC, which is a Synopsys Designware controller.  This is commonly
used on the Banana Pi, Lamobo R1, Cubieboard 2 and more.  This diff
is the complete diff I worked on to support the GMAC.  It's based on
NetBSD's DWC driver plus some glue code.

Unfortunately this diff currently (probably) only works on the
Cubieboard 2, or devices similarly wired.  Not every device is wired
the same, and we currently have no way to distinguish A20 based devices.
Once we are able to parse a device tree it will be much easier to set up
the clock and tx delay per board.

Patrick

diff --git sys/arch/armv7/conf/GENERIC sys/arch/armv7/conf/GENERIC
index b55771d..6858d75 100644
--- sys/arch/armv7/conf/GENERIC
+++ sys/arch/armv7/conf/GENERIC
@@ -93,6 +93,7 @@ sxidog*   at sunxi?   # watchdog timer
 sxirtc*at sunxi?   # Real Time Clock
 sxiuart*   at sunxi?   # onboard UARTs
 sxie*  at sunxi?
+awge*  at sunxi?
 ahci*  at sunxi?   # AHCI/SATA (shim)
 ehci*  at sunxi?   # EHCI (shim)
 usb*   at ehci?#flags 0x1
diff --git sys/arch/armv7/conf/RAMDISK sys/arch/armv7/conf/RAMDISK
index 8c0c22b..d857d2b 100644
--- sys/arch/armv7/conf/RAMDISK
+++ sys/arch/armv7/conf/RAMDISK
@@ -91,6 +91,7 @@ sxidog*   at sunxi?   # watchdog timer
 sxirtc*at sunxi?   # Real Time Clock
 sxiuart*   at sunxi?   # onboard UARTs
 sxie*  at sunxi?
+awge*  at sunxi?
 ahci*  at sunxi?   # AHCI/SATA (shim)
 ehci*  at sunxi?   # EHCI (shim)
 usb*   at ehci?#flags 0x1
diff --git sys/arch/armv7/sunxi/files.sunxi sys/arch/armv7/sunxi/files.sunxi
index 80c4ba4..96f8832 100644
--- sys/arch/armv7/sunxi/files.sunxi
+++ sys/arch/armv7/sunxi/files.sunxi
@@ -48,3 +48,7 @@ file  arch/armv7/sunxi/sxiuart.c  sxiuart
 device sxie: ether, ifnet, mii, ifmedia
 attach sxie at sunxi
 file   arch/armv7/sunxi/sxie.c sxie
+
+# A20 GMAC
+attach awge at sunxi with sxige
+file   arch/armv7/sunxi/sxige.csxige
diff --git sys/arch/armv7/sunxi/sun7i.c sys/arch/armv7/sunxi/sun7i.c
index 53978f3..73ecd24 100644
--- sys/arch/armv7/sunxi/sun7i.c
+++ sys/arch/armv7/sunxi/sun7i.c
@@ -100,12 +100,11 @@ struct armv7_dev sxia20_devs[] = {
  .irq = { UART7_IRQ }
},
 
-   /* EMAC */
-   { .name = "sxie",
+   /* GMAC */
+   { .name = "awge",
  .unit = 0,
- .mem = {  { EMAC_ADDR, EMAC_SIZE },
-   { SXIESRAM_ADDR, SXIESRAM_SIZE } },
- .irq = { EMAC_IRQ}
+ .mem = { { GMAC_ADDR, GMAC_SIZE } },
+ .irq = { GMAC_IRQ }
},
 
/* SATA/AHCI */
diff --git sys/arch/armv7/sunxi/sunxi.c sys/arch/armv7/sunxi/sunxi.c
index dac0348..256169e 100644
--- sys/arch/armv7/sunxi/sunxi.c
+++ sys/arch/armv7/sunxi/sunxi.c
@@ -77,7 +77,7 @@ struct board_dev sun7i_devs[] = {
{ "sxiuart",5 },
{ "sxiuart",6 },
{ "sxiuart",7 },
-   { "sxie",   0 },
+   { "awge",   0 },
{ "ahci",   0 },
{ "ehci",   0 },
{ "ehci",   1 },
diff --git sys/arch/armv7/sunxi/sxiccmu.c sys/arch/armv7/sunxi/sxiccmu.c
index ddfc415..16481a1 100644
--- sys/arch/armv7/sunxi/sxiccmu.c
+++ sys/arch/armv7/sunxi/sxiccmu.c
@@ -64,6 +64,24 @@
 #defineCCMU_AHB_GATING_EMAC(1 << 17)
 #defineCCMU_AHB_GATING_SATA(1 << 25)
 
+#defineCCMU_AHB_GATING10x64
+#defineCCMU_AHB_GATING_MALI400 (1 << 20)
+#defineCCMU_AHB_GATING_MP  (1 << 18)
+#defineCCMU_AHB_GATING_GMAC(1 << 17)
+#defineCCMU_AHB_GATING_DE_FE1  (1 << 15)
+#defineCCMU_AHB_GATING_DE_FE0  (1 << 14)
+#defineCCMU_AHB_GATING_DE_BE1  (1 << 13)
+#defineCCMU_AHB_GATING_DE_BE0  (1 << 12)
+#defineCCMU_AHB_GATING_HDMI(1 << 11)
+#defineCCMU_AHB_GATING_CSI1(1 << 9)
+#defineCCMU_AHB_GATING_CSI0(1 << 8)
+#defineCCMU_AHB_GATING_LCD1(1 << 5)
+#defineCCMU_AHB_GATING_LCD0(1 << 4)
+#defineCCMU_AHB_GATING_TVE1(1 << 3)
+#defineCCMU_AHB_GATING_TVE0(1 << 2)
+#defineCCMU_AHB_GATING_TVD (1 << 1)
+#defineCCMU_AHB_GATING_VE  (1 << 0)
+
 #defineCCMU_APB_GATING00x68
 #defineCCMU_APB_GATING_PIO (1 << 5)
 #defineCCMU_APB_GATING10x6c
@@ -89,6 +107,20 @@
 #defineCCMU_USB1_RESET (1 << 1)
 #defineCCMU_USB0_RESET (1 << 0)
 
+#def

Re: arm: support Allwinner A20 Ethernet

2016-03-02 Thread Daniel Bolgheroni
On Sat, Feb 27, 2016 at 11:09:10PM +0100, Patrick Wildt wrote:
> Hi,
> 
> the Allwinner A10 and A20 SoC include an EMAC, but it's only used in
> few devices like the Cubieboard.  The A20, like the A31 and A80, contain
> a GMAC, which is a Synopsys Designware controller.  This is commonly
> used on the Banana Pi, Lamobo R1, Cubieboard 2 and more.  This diff
> is the complete diff I worked on to support the GMAC.  It's based on
> NetBSD's DWC driver plus some glue code.
> 
> Unfortunately this diff currently (probably) only works on the
> Cubieboard 2, or devices similarly wired.  Not every device is wired
> the same, and we currently have no way to distinguish A20 based devices.
> Once we are able to parse a device tree it will be much easier to set up
> the clock and tx delay per board.

Cubieboard 2, also with the workaround patch from arm@.

Thank you.

 dmesg 
OpenBSD/sunxi booting ...
arg0 0x0 arg1 0x10bb arg2 0x4100
atag core flags 0 pagesize 0 rootdev 0
atag serial 0x16516616:0b01944c
atag mem start 0x4000 size 0x4000
bootfile:
bootargs:
memory size derived from u-boot
bootconf.mem[0].address = 4000 pages 262144/0x4000
Allocating page tables
freestart = 0x40774000, free_pages = 260236 (0x0003f88c)
IRQ stack: p0x407a2000 v0xc07a2000
ABT stack: p0x407a3000 v0xc07a3000
UND stack: p0x407a4000 v0xc07a4000
SVC stack: p0x407a5000 v0xc07a5000
Creating L1 page table at 0x40774000
Mapping kernel
Constructing L2 page tables
undefined page pmap [ using 398344 bytes of bsd ELF symbol table ]
board type: 4283
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2016 OpenBSD. All rights reserved.  http://www.OpenBSD.org

OpenBSD 5.9-current (GENERIC) #2: Mon Feb 29 01:35:57 BRT 2016
dbolgher...@bbb.my.domain:/usr/src/sys/arch/armv7/compile/GENERIC
real mem  = 1073741824 (1024MB)
avail mem = 1044967424 (996MB)
warning: no entropy supplied by boot loader
mainbus0 at root
cortex0 at mainbus0
ampintc0 at cortex0 nirq 160
agtimer0 at cortex0: tick rate 24000 KHz
cpu0 at mainbus0: ARM Cortex A7 rev 4 (ARMv7 core)
cpu0: DC enabled IC enabled WB disabled EABT branch prediction enabled
cpu0: 32KB(32b/l,2way) I-cache, 32KB(64b/l,4way) wr-back D-cache
sunxi0 at mainbus0: Allwinner A20
sxipio0 at sunxi0
sxiccmu0 at sunxi0
sxidog0 at sunxi0
sxirtc0 at sunxi0
sxiuart0 at sunxi0: console
sxiuart1 at sunxi0
sxiuart2 at sunxi0
sxiuart3 at sunxi0
sxiuart4 at sunxi0
sxiuart5 at sunxi0
sxiuart6 at sunxi0
sxiuart7 at sunxi0
awge0 at sunxi0
awge0: Ethernet address: 02:16:0b:01:94:4c
rlphy0 at awge0 phy 1: RTL8201L 10/100 PHY, rev. 1
ahci0 at sunxi0 AHCI 1.1
ahci0: port 0: 1.5Gb/s
scsibus0 at ahci0: 32 targets
sd0 at scsibus0 targ 0 lun 0:  SCSI3 0/direct 
fixed naa.5393138822a0
sd0: 305245MB, 512 bytes/sector, 625142448 sectors
ehci0 at sunxi0
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Allwinner EHCI root hub" rev 2.00/1.00 addr 1
ehci1 at sunxi0
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 "Allwinner EHCI root hub" rev 2.00/1.00 addr 1
gpio0 at sxipio0: 18 pins
gpio1 at sxipio0: 24 pins
gpio2 at sxipio0: 25 pins
gpio3 at sxipio0: 28 pins
gpio4 at sxipio0: 12 pins
gpio5 at sxipio0: 6 pins
gpio6 at sxipio0: 12 pins
gpio7 at sxipio0: 28 pins
gpio8 at sxipio0: 22 pins
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
boot device: lookup '' failed.
root device: sd0a
swap device (default sd0b):
root on sd0a swap on sd0b dump on sd0b
WARNING: preposterous time in file system
WARNING: CHECK AND RESET THE DATE!
Automatic boot in progress: starting file system checks.
/dev/sd0a (0d3d29f19b4e9e54.a): file system is clean; not checking
/dev/sd0l (0d3d29f19b4e9e54.l): file system is clean; not checking
/dev/sd0d (0d3d29f19b4e9e54.d): file system is clean; not checking
/dev/sd0f (0d3d29f19b4e9e54.f): file system is clean; not checking
/dev/sd0g (0d3d29f19b4e9e54.g): file system is clean; not checking
/dev/sd0h (0d3d29f19b4e9e54.h): file system is clean; not checking
/dev/sd0k (0d3d29f19b4e9e54.k): file system is clean; not checking
/dev/sd0j (0d3d29f19b4e9e54.j): file system is clean; not checking
/dev/sd0e (0d3d29f19b4e9e54.e): file system is clean; not checking
setting tty flags
pf enabled
starting network
DHCPDISCOVER on awge0 - interval 3
DHCPOFFER from 192.168.1.1 (14:cc:20:de:4b:cc)
DHCPREQUEST on awge0 to 255.255.255.255
DHCPACK from 192.168.1.1 (14:cc:20:de:4b:cc)
bound to 192.168.1.69 -- renewal in 3600 seconds.
starting early daemons: syslogd pflogd ntpd.
starting RPC daemons:.
savecore: no core dump
checking quotas: done.
clearing /tmp
kern.securelevel: 0 -> 1
creating runtime link editor directory cache.
preserving editor files.
starting network daemons: sshd smtpd sndiod.
starting local daemons: cron.
Thu Jan  1 07:47:54 BRT 1970

OpenBSD/armv7 (cb2.my.domain) (console)

login:

 ddb 
ddb> trace
panic+0x18
scp=0xc03c44c0 rlv=0xc0537eb8 (_bus_dmamap_

Re: arm: support Allwinner A20 Ethernet

2016-03-02 Thread Patrick Wildt
Nice, glad to hear that!

Looks like you're in a DDB panic?  What happened?  Can you
do "show panic" in DDB?

Patrick

On Wed, Mar 02, 2016 at 01:08:55PM -0300, Daniel Bolgheroni wrote:
> On Sat, Feb 27, 2016 at 11:09:10PM +0100, Patrick Wildt wrote:
> > Hi,
> > 
> > the Allwinner A10 and A20 SoC include an EMAC, but it's only used in
> > few devices like the Cubieboard.  The A20, like the A31 and A80, contain
> > a GMAC, which is a Synopsys Designware controller.  This is commonly
> > used on the Banana Pi, Lamobo R1, Cubieboard 2 and more.  This diff
> > is the complete diff I worked on to support the GMAC.  It's based on
> > NetBSD's DWC driver plus some glue code.
> > 
> > Unfortunately this diff currently (probably) only works on the
> > Cubieboard 2, or devices similarly wired.  Not every device is wired
> > the same, and we currently have no way to distinguish A20 based devices.
> > Once we are able to parse a device tree it will be much easier to set up
> > the clock and tx delay per board.
> 
> Cubieboard 2, also with the workaround patch from arm@.
> 
> Thank you.
> 
>  dmesg 
> OpenBSD/sunxi booting ...
> arg0 0x0 arg1 0x10bb arg2 0x4100
> atag core flags 0 pagesize 0 rootdev 0
> atag serial 0x16516616:0b01944c
> atag mem start 0x4000 size 0x4000
> bootfile:
> bootargs:
> memory size derived from u-boot
> bootconf.mem[0].address = 4000 pages 262144/0x4000
> Allocating page tables
> freestart = 0x40774000, free_pages = 260236 (0x0003f88c)
> IRQ stack: p0x407a2000 v0xc07a2000
> ABT stack: p0x407a3000 v0xc07a3000
> UND stack: p0x407a4000 v0xc07a4000
> SVC stack: p0x407a5000 v0xc07a5000
> Creating L1 page table at 0x40774000
> Mapping kernel
> Constructing L2 page tables
> undefined page pmap [ using 398344 bytes of bsd ELF symbol table ]
> board type: 4283
> Copyright (c) 1982, 1986, 1989, 1991, 1993
> The Regents of the University of California.  All rights reserved.
> Copyright (c) 1995-2016 OpenBSD. All rights reserved.  http://www.OpenBSD.org
> 
> OpenBSD 5.9-current (GENERIC) #2: Mon Feb 29 01:35:57 BRT 2016
> dbolgher...@bbb.my.domain:/usr/src/sys/arch/armv7/compile/GENERIC
> real mem  = 1073741824 (1024MB)
> avail mem = 1044967424 (996MB)
> warning: no entropy supplied by boot loader
> mainbus0 at root
> cortex0 at mainbus0
> ampintc0 at cortex0 nirq 160
> agtimer0 at cortex0: tick rate 24000 KHz
> cpu0 at mainbus0: ARM Cortex A7 rev 4 (ARMv7 core)
> cpu0: DC enabled IC enabled WB disabled EABT branch prediction enabled
> cpu0: 32KB(32b/l,2way) I-cache, 32KB(64b/l,4way) wr-back D-cache
> sunxi0 at mainbus0: Allwinner A20
> sxipio0 at sunxi0
> sxiccmu0 at sunxi0
> sxidog0 at sunxi0
> sxirtc0 at sunxi0
> sxiuart0 at sunxi0: console
> sxiuart1 at sunxi0
> sxiuart2 at sunxi0
> sxiuart3 at sunxi0
> sxiuart4 at sunxi0
> sxiuart5 at sunxi0
> sxiuart6 at sunxi0
> sxiuart7 at sunxi0
> awge0 at sunxi0
> awge0: Ethernet address: 02:16:0b:01:94:4c
> rlphy0 at awge0 phy 1: RTL8201L 10/100 PHY, rev. 1
> ahci0 at sunxi0 AHCI 1.1
> ahci0: port 0: 1.5Gb/s
> scsibus0 at ahci0: 32 targets
> sd0 at scsibus0 targ 0 lun 0:  SCSI3 0/direct 
> fixed naa.5393138822a0
> sd0: 305245MB, 512 bytes/sector, 625142448 sectors
> ehci0 at sunxi0
> usb0 at ehci0: USB revision 2.0
> uhub0 at usb0 "Allwinner EHCI root hub" rev 2.00/1.00 addr 1
> ehci1 at sunxi0
> usb1 at ehci1: USB revision 2.0
> uhub1 at usb1 "Allwinner EHCI root hub" rev 2.00/1.00 addr 1
> gpio0 at sxipio0: 18 pins
> gpio1 at sxipio0: 24 pins
> gpio2 at sxipio0: 25 pins
> gpio3 at sxipio0: 28 pins
> gpio4 at sxipio0: 12 pins
> gpio5 at sxipio0: 6 pins
> gpio6 at sxipio0: 12 pins
> gpio7 at sxipio0: 28 pins
> gpio8 at sxipio0: 22 pins
> vscsi0 at root
> scsibus1 at vscsi0: 256 targets
> softraid0 at root
> scsibus2 at softraid0: 256 targets
> boot device: lookup '' failed.
> root device: sd0a
> swap device (default sd0b):
> root on sd0a swap on sd0b dump on sd0b
> WARNING: preposterous time in file system
> WARNING: CHECK AND RESET THE DATE!
> Automatic boot in progress: starting file system checks.
> /dev/sd0a (0d3d29f19b4e9e54.a): file system is clean; not checking
> /dev/sd0l (0d3d29f19b4e9e54.l): file system is clean; not checking
> /dev/sd0d (0d3d29f19b4e9e54.d): file system is clean; not checking
> /dev/sd0f (0d3d29f19b4e9e54.f): file system is clean; not checking
> /dev/sd0g (0d3d29f19b4e9e54.g): file system is clean; not checking
> /dev/sd0h (0d3d29f19b4e9e54.h): file system is clean; not checking
> /dev/sd0k (0d3d29f19b4e9e54.k): file system is clean; not checking
> /dev/sd0j (0d3d29f19b4e9e54.j): file system is clean; not checking
> /dev/sd0e (0d3d29f19b4e9e54.e): file system is clean; not checking
> setting tty flags
> pf enabled
> starting network
> DHCPDISCOVER on awge0 - interval 3
> DHCPOFFER from 192.168.1.1 (14:cc:20:de:4b:cc)
> DHCPREQUEST on awge0 to 255.255.255.255
> DHCPACK from 192.168.1.1 (14:cc:20:de:4b:cc)
> bound to 192.168.1.69 -- renewal in 3600 seconds.
> starting early daemons: syslogd p

Re: arm: support Allwinner A20 Ethernet

2016-03-02 Thread Daniel Bolgheroni
On Wed, Mar 02, 2016 at 05:22:50PM +0100, Patrick Wildt wrote:
> Nice, glad to hear that!
> 
> Looks like you're in a DDB panic?  What happened?  Can you
> do "show panic" in DDB?

Yes, it's in ddb. There is a trace in the previous message also, but here it is
a new one. This happens everytime when ssh'ing to something, maybe in other
cases also. The previous one was within a cvs update.

After the ssh command is entered, the console freezes, but I can still receive
the replies from ping for 2 to 4 minutes. Then, it panics.

Hope this helps.
Thank you.

# ssh 192.168.1.5
panic: _bus_dmamap_sync: bad length
Stopped at  Debugger+0x4:   ldrbr15, [r15, r15, ror r15]!
   TIDPIDUID PRFLAGS PFLAGS  CPU  COMMAND
*16145  16145  0 0x14000  0x2100  softnet
panic+0x18
scp=0xc03c44c0 rlv=0xc0537eb8 (_bus_dmamap_sync+0xb8)
rsp=0xcc3d2db0 rfp=0xcc3d2df4
_bus_dmamap_sync+0xc
scp=0xc0537e0c rlv=0xc030edb4 (dwc_gmac_txdesc_sync+0xa8)
rsp=0xcc3d2df8 rfp=0xcc3d2e1c
r10=0x r9=0x00ff r8=0xc54c119c r7=0xc0537e00
r6=0x0005 r5=0x r4=0xc54c1000
dwc_gmac_txdesc_sync+0x10
scp=0xc030ed1c rlv=0xc0310a38 (dwc_gmac_start+0xec)
rsp=0xcc3d2e20 rfp=0xcc3d2e4c
r7=0xc54c1000 r6=0xc54c103c r5=0x r4=0x
dwc_gmac_start+0x10
scp=0xc031095c rlv=0xc040c278 (if_start_locked+0x34)
rsp=0xcc3d2e50 rfp=0xcc3d2e6c
r10=0xc54c129c r9=0x r8=0x r7=0x0062
r6=0xc069274c r5=0x0003 r4=0xc54c103c
if_start_locked+0xc
scp=0xc040c250 rlv=0xc0410168 (if_enqueue+0x98)
rsp=0xcc3d2e70 rfp=0xcc3d2e94
r6=0x0002 r5=0xc54c103c r4=0x
if_enqueue+0x10
scp=0xc04100e0 rlv=0xc0411cf4 (ether_output+0x188)
rsp=0xcc3d2e98 rfp=0xcc3d2ecc
r8=0xcc3d2e9e r7=0x0008 r6=0xca4ba400 r5=0xc54c103c
r4=0xca4ba456
ether_output+0xc
scp=0xc0411b78 rlv=0xc0467ea8 (ip_output+0x6d0)
rsp=0xcc3d2ed0 rfp=0xcc3d2f40
r10=0x r8=0xc54c103c r7=0xcc3d2f04 r6=0xcc3d2efc
r5=0xc068e658 r4=0xca4ba464
ip_output+0xc
scp=0xc04677e4 rlv=0xc04613a4 (ip_send+0x80)
rsp=0xcc3d2f44 rfp=0xcc3d2f78
r10=0xc06e6190 r9=0x r8=0xc06e632c r7=0xcc3d2f7c
r6=0xc069274c r5=0x r4=0xcc3d2f50
ip_send+0x48
scp=0xc046136c rlv=0xc03b7770 (taskq_thread+0x90)
rsp=0xcc3d2f7c rfp=0xcc3d2fb0
r6=0x0001 r5=0xc53dc040 r4=0xc03b7648
taskq_thread+0xc
scp=0xc03b76ec rlv=0xc0538878 (proc_trampoline+0x18)
rsp=0xcc3d2fb4 rfp=0xc07a6edc
r7=0x r6=0x r5=0xc53dc040 r4=0xc03b76e0
Bad frame pointer: 0xc07a6edc
http://www.openbsd.org/ddb.html describes the minimum info required in bug
reports.  Insufficient info makes it difficult to find and fix bugs.
ddb> ps
   TID   PPID   PGRPUID  S   FLAGS  WAIT  COMMAND
 18687   6725  18687  0  30x83  selectssh
  6725  1   6725  0  30x10008b  pause ksh
 13129  1  13129  0  30x100098  poll  cron
   145  1145 99  30x100090  poll  sndiod
 29303  1  29303110  30x100090  poll  sndiod
  4161   1012   1012 95  30x100090  kqreadsmtpd
 28657   1012   1012 95  30x100090  kqreadsmtpd
 14144   1012   1012 95  30x100090  kqreadsmtpd
  1517   1012   1012 95  30x100090  kqreadsmtpd
 23185   1012   1012 95  30x100090  kqreadsmtpd
   475   1012   1012103  30x100090  kqreadsmtpd
  1012  1   1012  0  30x100080  kqreadsmtpd
 10113  1  10113  0  30x80  selectsshd
   631   4499  24054 83  30x100090  poll  ntpd
  4499  24054  24054 83  30x100090  poll  ntpd
 24054  1  24054  0  30x100080  poll  ntpd
 24258  17591  17591 74  30x100090  bpf   pflogd
 17591  1  17591  0  30x80  netio pflogd
  6153  26767  26767 73  30x100090  kqreadsyslogd
 26767  1  26767  0  30x100080  netio syslogd
  5764  1   5764 77  30x100090  poll  dhclient
  9406  1   9406  0  30x80  poll  dhclient
 19407  0  0  0  3 0x14200  pgzerozerothread
  7013  0  0  0  3 0x14200  aiodoned  aiodoned
  3359  0  0  0  3 0x14200  syncerupdate
  4092  0  0  0  3 0x14200  cleaner   cleaner
  2344  0  0  0  3 0x14200  reaperreaper
  7077  0  0  0  3 0x14200  pgdaemon  pagedaemon
 29027  0  0  0  3 0x14200  bored crypto
  6851  0  0  0  3 0x14200  pftm  pfpurge
 24135  0  0  0  3 0x14200  usbtskusbtask
  6548  0  0  0  3 0x

Re: arm: support Allwinner A20 Ethernet

2016-03-04 Thread Daniel Bolgheroni
On Sat, Feb 27, 2016 at 11:09:10PM +0100, Patrick Wildt wrote:
> 
> + /* print interrupt state */
> + snprintb(buf, sizeof(buf), "\177\20"
> + "b\x10""NI\0"
> + "b\x0f""AI\0"
> + "b\x0e""ER\0"
> + "b\x0d""FB\0"
> + "b\x0a""ET\0"
> + "b\x09""RW\0"
> + "b\x08""RS\0"
> + "b\x07""RU\0"
> + "b\x06""RI\0"
> + "b\x05""UN\0"
> + "b\x04""OV\0"
> + "b\x03""TJ\0"
> + "b\x02""TU\0"
> + "b\x01""TS\0"
> + "b\x00""TI\0"
> + "\0", dma_status);

> + /* print filter setup */
> + snprintb(buf, sizeof(buf), "\177\20"
> + "b\x1f""RA\0"
> + "b\x0a""HPF\0"
> + "b\x09""SAF\0"
> + "b\x08""SAIF\0"
> + "b\x05""DBF\0"
> + "b\x04""PM\0"
> + "b\x03""DAIF\0"
> + "b\x02""HMC\0"
> + "b\x01""HUC\0"
> + "b\x00""PR\0"
> + "\0", ffilt);

Hi Patrick,

I don't have a quick solution for this too, but it's worth noticing that
snprintb() is NetBSD-specific.

Thank you.

-- 
db



Re: arm: support Allwinner A20 Ethernet

2016-03-04 Thread Patrick Wildt
On Fri, Mar 04, 2016 at 11:19:37AM -0300, Daniel Bolgheroni wrote:
> On Sat, Feb 27, 2016 at 11:09:10PM +0100, Patrick Wildt wrote:
> > 
> > +   /* print interrupt state */
> > +   snprintb(buf, sizeof(buf), "\177\20"
> > +   "b\x10""NI\0"
> > +   "b\x0f""AI\0"
> > +   "b\x0e""ER\0"
> > +   "b\x0d""FB\0"
> > +   "b\x0a""ET\0"
> > +   "b\x09""RW\0"
> > +   "b\x08""RS\0"
> > +   "b\x07""RU\0"
> > +   "b\x06""RI\0"
> > +   "b\x05""UN\0"
> > +   "b\x04""OV\0"
> > +   "b\x03""TJ\0"
> > +   "b\x02""TU\0"
> > +   "b\x01""TS\0"
> > +   "b\x00""TI\0"
> > +   "\0", dma_status);
> 
> > +   /* print filter setup */
> > +   snprintb(buf, sizeof(buf), "\177\20"
> > +   "b\x1f""RA\0"
> > +   "b\x0a""HPF\0"
> > +   "b\x09""SAF\0"
> > +   "b\x08""SAIF\0"
> > +   "b\x05""DBF\0"
> > +   "b\x04""PM\0"
> > +   "b\x03""DAIF\0"
> > +   "b\x02""HMC\0"
> > +   "b\x01""HUC\0"
> > +   "b\x00""PR\0"
> > +   "\0", ffilt);
> 
> Hi Patrick,
> 
> I don't have a quick solution for this too, but it's worth noticing that
> snprintb() is NetBSD-specific.
> 
> Thank you.
> 
> -- 
> db

That's correct.  So far it's in an ifdef DEBUG.  I could've just removed
all that code but thought it was better to keep it in for now.



Re: arm: support Allwinner A20 Ethernet

2016-03-04 Thread Theo de Raadt
> On Fri, Mar 04, 2016 at 11:19:37AM -0300, Daniel Bolgheroni wrote:
> > On Sat, Feb 27, 2016 at 11:09:10PM +0100, Patrick Wildt wrote:
> > > 
> > > + /* print interrupt state */
> > > + snprintb(buf, sizeof(buf), "\177\20"
> > > + "b\x10""NI\0"
...
> > I don't have a quick solution for this too, but it's worth noticing that
> > snprintb() is NetBSD-specific.
...
> That's correct.  So far it's in an ifdef DEBUG.  I could've just removed
> all that code but thought it was better to keep it in for now.

Like every BSD since 4.1, the kernel printf functions support %b,
and we never went down the road of adding a different function just
to please a compiler that whines.