NetBSD Problem Report #56091

From martin@aprisoft.de  Fri Apr  2 09:12:06 2021
Return-Path: <martin@aprisoft.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 20A7C1A9217
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  2 Apr 2021 09:12:06 +0000 (UTC)
Message-Id: <20210402091156.32F915CC7A0@emmas.aprisoft.de>
Date: Fri,  2 Apr 2021 11:11:56 +0200 (CEST)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: zscninit() is never called on G5
X-Send-Pr-Version: 3.95

>Number:         56091
>Category:       port-macppc
>Synopsis:       zscninit() is never called on G5
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-macppc-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 02 09:15:00 +0000 2021
>Closed-Date:    Sun Feb 13 12:28:47 +0000 2022
>Last-Modified:  Sun Feb 13 12:28:47 +0000 2022
>Originator:     Martin Husemann
>Release:        NetBSD 9.99.81
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD big-apple.aprisoft.de 9.99.81 NetBSD 9.99.81 (POWERMAC_G5.MP) #12: Fri Apr 2 08:55:57 CEST 2021 martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/macppc/compile/POWERMAC_G5.MP macppc
Architecture: powerpc
Machine: macppc
>Description:

Serial console on my G5 mac does not work (yes, I am strange - but I got
a very nice Stealth serial port for this new toy and will usually run the
machine headless).

Problem is that zs_conschannel is -1 at zs0 attach time, so its 
ZS_HWFLAG_CONSOLE is never set. This used to work fine in my G4 quicksilver.

I tried to add panics/debugger calls in zscnprobe/zscninit but neither
seem to be ever called.

The problem is in ofwoea_cnprobe(), where we abort for G5 macs:

#ifdef PMAC_G5
                /* The MMU hasn't been initialized yet, use failsafe for now */
                extern struct consdev failsafe_cons;
                selected_serial_consdev = &failsafe_cons;
                aprint_verbose("Early G5 console selected\n");
                return;
#endif /* PMAC_G5 */

right before the magic to make zs console work:

#if (NZSTTY > 0) && !defined(MAMBO)
                OF_getprop(console_node, "name", name, sizeof(name));
                if (strcmp(name, "ch-a") == 0 || strcmp(name, "ch-b") == 0) {
                        selected_serial_consdev = &consdev_zs;
                }
                return;
#endif /* NZTTY */ 

... and here I need more background info form ppc mmu experts ;-)

Forcing zs console on works a tiny bit, but makes the machine die early
once all cpus are up and interrupts enabled.



Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
    2018, 2019, 2020, 2021 The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 9.99.81 (POWERMAC_G5.MP) #12: Fri Apr  2 08:55:57 CEST 2021
	martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/macppc/compile/POWERMAC_G5.MP
total memory = 2048 MB
oea_startup: failed to allocate DEAD ZONE: error=12
avail memory = 1960 MB
timecounter: Timecounters tick every 10.000 msec
found openpic PIC at 80040000
OpenPIC Version 1.2: Supports 4 CPUs and 120 interrupt sources.
bootpath: /ht@0,f2000000/pci@6/ethernet@f:192.168.111.42,nbsd.g5
mainbus0 (root)
cpu0 at mainbus0: 970FX (Revision 3.0), ID 0 (primary)
cpu0: HID0 0x513081<NAP,DPM,NHR,TBCTRL,EXTBEN,ENATTN> 0x80000000<EMCP>, powersave: 1
cpu1 at mainbus0: 970FX (Revision 3.0), ID 1
cpu1: HID0 0x513081<NAP,DPM,NHR,TBCTRL,EXTBEN,ENATTN> 0x80000000<EMCP>, powersave: 1
memory0 at mainbus0: len=1024
spdmem0 at memory0
spdmem0: DDR SDRAM, no parity or ECC, 1GB, 400MHz (PC-3200)
spdmem0: 13 rows, 11 cols, 2 ranks, 4 banks/chip, 5.0ns cycle time
spdmem0: tAA-tRCD-tRP-tRAS: 2-3-3-8
spdmem0: voltage SSTL 2.5V, refresh time 7.8us (self-refreshing)
spdmem1 at memory0
spdmem1: DDR SDRAM, no parity or ECC, 1GB, 400MHz (PC-3200)
spdmem1: 13 rows, 11 cols, 2 ranks, 4 banks/chip, 5.0ns cycle time
spdmem1: tAA-tRCD-tRP-tRAS: 2-3-3-8
spdmem1: voltage SSTL 2.5V, refresh time 7.8us (self-refreshing)
spdmem2 at memory0
spdmem2: DDR SDRAM, no parity or ECC, 1GB, 400MHz (PC-3200)
spdmem2: 13 rows, 11 cols, 2 ranks, 4 banks/chip, 5.0ns cycle time
spdmem2: tAA-tRCD-tRP-tRAS: 2-3-3-8
spdmem2: voltage SSTL 2.5V, refresh time 7.8us (self-refreshing)
spdmem3 at memory0
spdmem3: DDR SDRAM, no parity or ECC, 1GB, 400MHz (PC-3200)
spdmem3: 13 rows, 11 cols, 2 ranks, 4 banks/chip, 5.0ns cycle time
spdmem3: tAA-tRCD-tRP-tRAS: 2-3-3-8
spdmem3: voltage SSTL 2.5V, refresh time 7.8us (self-refreshing)
spdmem4 at memory0
spdmem4: DDR SDRAM, no parity or ECC, 1GB, 400MHz (PC-3200)
spdmem4: 13 rows, 11 cols, 2 ranks, 4 banks/chip, 5.0ns cycle time
spdmem4: tAA-tRCD-tRP-tRAS: 2-3-3-8
spdmem4: voltage SSTL 2.5V, refresh time 7.8us (self-refreshing)
spdmem5 at memory0
spdmem5: DDR SDRAM, no parity or ECC, 1GB, 400MHz (PC-3200)
spdmem5: 13 rows, 11 cols, 2 ranks, 4 banks/chip, 5.0ns cycle time
spdmem5: tAA-tRCD-tRP-tRAS: 2-3-3-8
spdmem5: voltage SSTL 2.5V, refresh time 7.8us (self-refreshing)
spdmem6 at memory0
spdmem6: DDR SDRAM, no parity or ECC, 1GB, 400MHz (PC-3200)
spdmem6: 13 rows, 11 cols, 2 ranks, 4 banks/chip, 5.0ns cycle time
spdmem6: tAA-tRCD-tRP-tRAS: 2-3-3-8
spdmem6: voltage SSTL 2.5V, refresh time 7.8us (self-refreshing)
spdmem7 at memory0
spdmem7: DDR SDRAM, no parity or ECC, 1GB, 400MHz (PC-3200)
spdmem7: 13 rows, 11 cols, 2 ranks, 4 banks/chip, 5.0ns cycle time
spdmem7: tAA-tRCD-tRP-tRAS: 2-3-3-8
spdmem7: voltage SSTL 2.5V, refresh time 7.8us (self-refreshing)
uni_n0 at mainbus0 address 0xf8000000
uni_n0: found EEPROM data for CPU 0
uni_n0: found EEPROM data for CPU 1
ki2c0 at uni_n0 address 0xf8001000
iic0 at ki2c0: I2C bus
i2c-hwclock at iic0 addr 0x6a not configured
lmtemp0 at iic0 addr 0x4a: temp-monitor DS75 Temperature Sensor
admtemp0 at iic0 addr 0x4c: MAX6690 temperature sensor: id. 0x4d, rev. 0x09
dstemp0 at iic0 addr 0x4b: DS1361
fcu0 at iic0 addr 0xaf: Fan Control Unit
i2c-cpu-voltage at iic0 addr 0x18 not configured
adadc0 at iic0 addr 0x2c: AD7417
cpuid at iic0 addr 0x50 not configured
i2c-cpu-voltage at iic0 addr 0x19 not configured
adadc1 at iic0 addr 0x2d: AD7417
cpuid at iic0 addr 0x51 not configured
cereal at iic0 addr 0xe0 not configured
dart at uni_n0 address 0xf8033000 not configured
mpic at uni_n0 address 0xf8040000 not configured
uninorth0 at mainbus0
pci0 at uninorth0 bus 0
pci0: i/o space, memory space enabled
pchb0 at pci0 dev 11 function 0
pchb0: vendor 106b product 0059 (rev. 0x00)
radeonfb0 at pci0 dev 16 function 0: vendor 1002 product 4150 (rev. 0x00)
trying to read disabled BIOS...
radeonfb0: No video BIOS, using default clocks
radeonfb0: refclk = 27.000 MHz, refdiv = 12 minpll = 125000, maxpll = 400000
radeonfb0: 64 MB aperture at 0xb0000000, 64 KB registers at 0xa0000000
radeonfb0: display 0: initial virtual resolution 1920x1080 at 8 bpp
radeonfb0: using 32 MB per display
radeonfb0: port 0: physical 1920x1080 60Hz
radeonfb0: port 1: physical 1920x1080 60Hz
wsdisplay0 at radeonfb0 kbdmux 1: console (fb, vt100 emulation)
wsmux1: connecting to wsdisplay0
drm at radeonfb0 not configured
ibmcpc0 at mainbus0
Mapping in config space @ pa 0xf2000000, size: 0x02800000
pci1 at ibmcpc0 bus 6
pci1: i/o space, memory space enabled
siisata0 at pci1 dev 3 function 0: vendor 1095 product 3124 (rev. 0x02)
siisata0: interrupting at irq 53
siisata0: SiI3124, 3.0Gb/s
siisata0: 64-bit 100MHz PCI-X
atabus0 at siisata0 channel 0
atabus1 at siisata0 channel 1
atabus2 at siisata0 channel 2
atabus3 at siisata0 channel 3
pci2 at ibmcpc0 bus 7
pci2: i/o space, memory space enabled
pci3 at ibmcpc0 bus 1
pci3: i/o space, memory space enabled
obio0 at pci3 dev 7 function 0: addr 0x80000000
mpic at obio0 offset 0x40000 not configured
zsc0 at obio0 irq 22,23
zstty0 at zsc0 channel 0
zstty1 at zsc0 channel 1
ki2c1 at obio0
iic1 at ki2c1: I2C bus
cereal at iic1 addr 0xe0 not configured
deq0 at iic1 addr 0x35 Audio Codec (tas3004)
snapper0 at obio0 offset 0x10000: irq 30,1,2
pmu0 at obio0 offset 0x16000 irq 25:  rev. 12
pmu0: initializing IIC bus
iic2 at pmu0: I2C bus
pmu0: initializing RTC
pmu0: power-mgt not configured
fans at obio0 offset 0x4c not configured
model PowerMac7,3
snapper0: codec: TAS3004
audio0 at snapper0: playback, capture, full duplex
audio0: slinear_be:16 -> slinear_be:16 2ch 48000Hz, blk 12288 bytes (64ms) for playback
audio0: slinear_be:16 <- slinear_be:16 2ch 48000Hz, blk 12288 bytes (64ms) for recording
spkr0 at audio0: PC Speaker (synthesized)
wsbell0 at spkr0 mux 1
ohci0 at pci3 dev 8 function 0: vendor 106b product 0040 (rev. 0x00)
ohci0: interrupting at irq 27
ohci0: OHCI version 1.0, legacy support
usb0 at ohci0: USB revision 1.0
ohci1 at pci3 dev 9 function 0: vendor 106b product 0040 (rev. 0x00)
ohci1: interrupting at irq 28
ohci1: OHCI version 1.0, legacy support
usb1 at ohci1: USB revision 1.0
pci4 at ibmcpc0 bus 2
pci4: i/o space, memory space enabled
vendor 14e4 product 4320 (miscellaneous network, revision 0x03) at pci4 dev 1 function 0 not configured
ohci2 at pci4 dev 11 function 0: vendor 1033 product 0035 (rev. 0x43)
ohci2: interrupting at irq 63
ohci2: OHCI version 1.0
usb2 at ohci2: USB revision 1.0
ohci3 at pci4 dev 11 function 1: vendor 1033 product 0035 (rev. 0x43)
ohci3: interrupting at irq 63
ohci3: OHCI version 1.0
usb3 at ohci3: USB revision 1.0
ehci0 at pci4 dev 11 function 2: vendor 1033 product 00e0 (rev. 0x04)
ehci0: interrupting at irq 63
ehci0: EHCI version 1.0
ehci0: 2 companion controllers, 3 ports each: ohci2 ohci3
usb4 at ehci0: USB revision 2.0
pci5 at ibmcpc0 bus 3
pci5: i/o space, memory space enabled
wdc0 at pci5 dev 13 function 0: interrupting at irq 39
atabus4 at wdc0 channel 0
vendor 106b product 0042 (IEEE1394 serial bus, OpenHCI) at pci5 dev 14 function 0 not configured
pci6 at ibmcpc0 bus 4
pci6: i/o space, memory space enabled
gem0 at pci6 dev 15 function 0: vendor 106b product 004c (rev. 0x00)
gem0: interrupting at irq 41
brgphy0 at gem0 phy 1: BCM54K2 1000BASE-T media interface, rev. 0
brgphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
gem0: Ethernet address 00:11:24:72:b5:b8, 10KB RX fifo, 4KB TX fifo
pci7 at ibmcpc0 bus 5
pci7: i/o space, memory space enabled
svwsata0 at pci7 dev 12 function 0: ServerWorks K2 SATA Controller (rev. 0x00)
svwsata0: bus-master DMA support present
svwsata0: using irq 0 for native-PCI interrupt
svwsata0: primary channel wired to native-PCI mode
atabus5 at svwsata0 channel 0
svwsata0: secondary channel wired to native-PCI mode
atabus6 at svwsata0 channel 1
svwsata0: secondary channel wired to compatibility mode
atabus7 at svwsata0 channel 2
svwsata0: secondary channel configured to compatibility mode
atabus8 at svwsata0 channel 3
svwsata1 at pci7 dev 12 function 1: ServerWorks K2 SATA Controller (rev. 0x00)

vmmask 397e0000 schedmask 3ffe0000 highmask 7ffe0000
entropy: WARNING: extracting entropy too early
timecounter: Timecounter "mftb" frequency 33333333 Hz quality 100
timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
cpu1 started
uhub0 at usb0: NetBSD (0x0000) OHCI root hub (0x0000), class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhub1 at usb1: NetBSD (0x0000) OHCI root hub (0x0000), class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
uhub2 at usb2: NetBSD (0x0000) OHCI root hub (0x0000), class 9/0, rev 1.00/1.00, addr 1
uhub2: 3 ports with 3 removable, self powered
uhub3 at usb3: NetBSD (0x0000) OHCI root hub (0x0000), class 9/0, rev 1.00/1.00, addr 1
uhub3: 2 ports with 2 removable, self powered
uhub4 at usb4: NetBSD (0x0000) EHCI root hub (0x0000), class 9/0, rev 2.00/1.00, addr 1
uhub4: 5 ports with 5 removable, self powered
aes: BearSSL aes_ct
aes_ccm: self-test passed
chacha: Portable C ChaCha
blake2s: self-test passed
siisata0 port 0: device present, speed: 3.0Gb/s
wd0 at atabus0 drive 0
wd0: <Samsung SSD 860 PRO 512GB>
wd0: drive supports 1-sector PIO transfers, LBA48 addressing
wd0: 476 GB, 992277 cyl, 16 head, 63 sec, 512 bytes/sect x 1000215216 sectors
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133), WRITE DMA FUA, NCQ (32 tags)
wd0(siisata0:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133) (using DMA), NCQ (30 tags)
svwsata0 port 1: device present, speed: 1.5Gb/s
ehci0: handing over low speed device on port 1 to ohci2
svwsata0 port 3: PHY offline
atapibus0 at atabus4: 2 targets
cd0 at atapibus0 drive 0: <SONY DVD RW DW-U21A, , AADB> cdrom removable
svwsata0 port 0: PHY offline
svwsata0 port 2: PHY offline
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 4 (Ultra/66)
cd0(wdc0:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 4 (Ultra/66) (using DMA)
wd1 at atabus6 drive 0
wd1: <Intenso SSD SATAIII>
wd1: drive supports 1-sector PIO transfers, LBA48 addressing
wd1: 111 GB, 232581 cyl, 16 head, 63 sec, 512 bytes/sect x 234441648 sectors
wd1: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133), WRITE DMA FUA, NCQ (32 tags)
wd1(svwsata0:1:0): using PIO mode 4, Ultra-DMA mode 6 (Ultra/133) (using DMA), WRITE DMA FUA EXT
WARNING: 2 errors while detecting hardware; check system log.
boot device: gem0
root on gem0
nfs_boot: trying DHCP/BOOTP
uhidev0 at uhub2 port 1 configuration 1 interface 0
uhidev0: Dell (0x413c) Dell USB Keyboard (0x2105), rev 1.10/3.52, addr 2, iclass 3/1
ukbd0 at uhidev0
wskbd0 at ukbd0: console keyboard, using wsdisplay0
nfs_boot: DHCP next-server: 192.168.111.42
nfs_boot: my_domain=aprisoft.de
nfs_boot: my_addr=192.168.111.67
nfs_boot: my_mask=255.255.255.0
nfs_boot: gateway=192.168.111.42
root on 192.168.111.42:/nelly/g5
root file system type: nfs
kern.module.path=/stand/macppc/9.99.81/modules

>How-To-Repeat:
s/a

>Fix:
n/a

>Release-Note:

>Audit-Trail:
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56091 CVS commit: src/sys/arch
Date: Sun, 13 Feb 2022 12:24:25 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Feb 13 12:24:25 UTC 2022

 Modified Files:
 	src/sys/arch/macppc/dev: zs.c
 	src/sys/arch/powerpc/include: ofw_cons.h
 	src/sys/arch/powerpc/oea: ofw_consinit.c

 Log Message:
 PR port-macppc/56091: on G5 macs we currently can not easily make
 early serial console work, so keep the OF based "failsafe" console
 but note that we would like to switch over.
 Once zs attaches, use the new device mapping and do a belated init
 of the zs console globals, and then switch over to real zs based
 serial console.


 To generate a diff of this commit:
 cvs rdiff -u -r1.54 -r1.55 src/sys/arch/macppc/dev/zs.c
 cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/include/ofw_cons.h
 cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/oea/ofw_consinit.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Sun, 13 Feb 2022 12:28:47 +0000
State-Changed-Why:
Serial console now works on G5


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.