svn commit: r306065 - in head/sys vs. PowerMacs: Nathan's trail patch included but inappropriate? [My hack vs. Apple G4's.]

Mark Millard markmi at dsl-only.net
Wed Nov 16 00:18:38 UTC 2016


On 2016-Nov-15, at 3:01 PM, Mark Millard <markmi at dsl-only.net> wrote:


> On 2016-Nov-15, at 1:42 PM, Mark Millard <markmi at dsl-only.net> wrote:
> 
>> [Top post of an experiment with loading iicsmb.ko from the loader prompt.]
>> 
>> I stopped a PowerMac G5 "Quad Core" at the loader prompt (not
>> using /boot/loader.conf or other such) and did a:
>> 
>> load iicsmb
>> boot
>> 
>> (smbus.ko also loads --and so for my earlier "in kernel" suggestion
>> "device smbus" should also be listed in the KERNCONF file.)
>> 
>> It booted fine. Afterwards kldstat reported:
>> 
>> # kldstat
>> Id Refs Address            Size		Name
>> 1    6 0x100000	16901b0		kernel
>> 2    1 0x1792000	  14598		iicsmb.ko
>> 3    2 0x17a7000	  13f80		smbus.ko
>> 
>> Those are not the addresses that were reported at the loader prompt for
>> iicsmb and smbus:
>> 
>> .text for iccsmb was listed as at 0x28e0 if I remember right
>> .text for smbus  was listed as at 0x2800 if I remember right
>> 
>> The .data for each were listed at the loader prompt as each starting in
>> the 0x6xxx range as I remember.
> 
> One too many x's: 0x6c8 and 0x600 were the figures.
> 
>> I'm not sure that what the loader prompt context listed was actually the
>> load addresses at that time.
>> 
>> I do not know if you get similar results or not.
>> 
>> If the loader prompt loads always work and the loader.conf loads do not
>> that might also be interesting evidence about the problem(s) involved.
>> 
>> I do not know how to tell if iicsmb and smbus are working or not.
>> 
>> It may be that explicit loads from the loader prompt are another
>> workaround.
>> 
>> 
>> I have not yet tried:
>> 
>> unload
>> load iccsmb
>> boot
> 
> (typo above: iicsmb is what I loaded.)
> 
> That did not work: the kernel needs to be loaded first. . .
> 
> unload
> load kernel
> load iicsmb
> boot
> 
> did work. The kldstat then ends up being:
> 
> # kldstat
> Id Refs Address		Size		Name
> 1    6 0x100000	16901b0		kernel
> 2    1 0x1791000	14598		iicsmb.ko
> 3    2 0x17a6000	13f80		smbus.ko
> 
> (Not much different --but not identical to before for 2 of the Address values.)

Based on:

# more /boot/loader.conf
#verbose_loading="YES"
kernel="kernel"
kern.vty=vt
dumpdev="/dev/label/FBSDG5Lswap"
smbus_load="YES"
iicsmb_load="YES"

I have no trouble booting the PowerMac G5 (with my version of the boot
hack in place). (I do not use any hack for 32-bit powerpc.)



# uname -apKU
FreeBSD FBSDG5L 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r308247M: Fri Nov  4 03:18:34 PDT 2016     markmi at FreeBSDx64:/usr/obj/powerpc64vtsc_xtoolchain/powerpc.powerpc64/usr/src/sys/GENERIC64vtsc-NODBG  powerpc powerpc64 1200014 1200014

Unfortunately we then hit my odd context from doing libc++ based builds
for powerpc64, including self-hosted builds, and my experimenting with
clang.

I use devel/powerpc-xtoolchain-gcc (and so devel/powerpc64-gcc) to
buildworld buildkernel for powerpc64, be it cross compiling from amd64
or on the powerpc64 itself (self hosted cross build). (A work around is
required to get it installed on a powerpc64 FreeBSD.) I use a libc++
based build --something gcc 4.2.1 will not do.

For self hosting on powerpc64 I use lang/gcc49 as the so-called "system
compiler" and devel/powerpc64-gcc as the "cross" compiler for buildworld
buildkernel .

So my src.conf sort of content and related context is probably not like
yours (showing for self-hosted below). I list several files with details
of my buildworld buildkernel environment.

(There are long lines likely implicitly wrapped in the below --in
addition to \ end-of-line notation.)

# more ~/sys_build_scripts.powerpc64-host/make_powerpc64vtsc_nodebug_incl_clang_xtoolchain-powerpc64-host.sh 
kldload -n filemon && \
script ~/sys_typescripts/typescript_make_powerpc64vtsc_nodebug_incl_clang_xtoolchain-powerpc64-host-$(date +%Y-%m-%d:%H:%M:%S) \
env __MAKE_CONF="/root/src.configs/make.conf" SRCCONF="/dev/null" SRC_ENV_CONF="/root/src.configs/src.conf.powerpc64-xtoolchain.powerpc64-host" \
WITH_META_MODE=yes \
MAKEOBJDIRPREFIX="/usr/obj/powerpc64vtsc_xtoolchain/powerpc.powerpc64" \
make $*


# more ~/src.configs/make.conf 
CFLAGS.gcc+= -v


# more ~/src.configs/src.conf.powerpc64-xtoolchain.powerpc64-host
TO_TYPE=powerpc64
TOOLS_TO_TYPE=${TO_TYPE}
FROM_TYPE=${TO_TYPE}
TOOLS_FROM_TYPE=${FROM_TYPE}
VERSION_CONTEXT=12.0
#
KERNCONF=GENERIC64vtsc-NODBG
TARGET=powerpc
.if ${.MAKE.LEVEL} == 0
TARGET_ARCH=${TO_TYPE}
.export TARGET_ARCH
.endif
#
WITHOUT_CROSS_COMPILER=
WITHOUT_SYSTEM_COMPILER=
#
WITH_LIBCPLUSPLUS=
WITHOUT_BINUTILS_BOOTSTRAP=
WITHOUT_CLANG_BOOTSTRAP=
WITH_CLANG=
WITH_CLANG_IS_CC=
WITH_CLANG_FULL=
WITH_CLANG_EXTRAS=
WITH_LLDB=
#
WITH_BOOT=
# powerpc64 LIB32 builds via gcc 4.9 or later variants that I've tried
# but the LIB32 does not work [crtbeginS code problem(s)]
WITHOUT_LIB32=
#
WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=
WITHOUT_GCC_BOOTSTRAP=
WITHOUT_GCC=
WITHOUT_GCC_IS_CC=
WITHOUT_GNUCXX=
#
NO_WERROR=
#WERROR=
MALLOC_PRODUCTION=
#
WITH_DEBUG_FILES=
#
#
# For TO (so-called "cross") stages . . .
# So-called-cross via ${TO_TYPE}-xtoolchain-gcc/${TO_TYPE}-gcc. . .
# TOOLS_TO_TYPE based on ${TO_TYPE}-xtoolchain-gcc related binutils. . .
#
CROSS_TOOLCHAIN=${TO_TYPE}-gcc
X_COMPILER_TYPE=gcc
CROSS_BINUTILS_PREFIX=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/
.if ${.MAKE.LEVEL} == 0
XCC=/usr/local/bin/${TOOLS_TO_TYPE}-portbld-freebsd${VERSION_CONTEXT}-gcc
XCXX=/usr/local/bin/${TOOLS_TO_TYPE}-portbld-freebsd${VERSION_CONTEXT}-g++
XCPP=/usr/local/bin/${TOOLS_TO_TYPE}-portbld-freebsd${VERSION_CONTEXT}-cpp
.export XCC
.export XCXX
.export XCPP
XAS=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/as
XAR=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ar
XLD=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ld
XNM=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/nm
XOBJCOPY=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/objcopy
XOBJDUMP=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/objdump
XRANLIB=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ranlib
XSIZE=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/size
#NO-SUCH: XSTRINGS=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/strings
XSTRINGS=/usr/local/bin/${TOOLS_TO_TYPE}-freebsd-strings
.export XAS
.export XAR
.export XLD
.export XNM
.export XOBJCOPY
.export XOBJDUMP
.export XRANLIB
.export XSIZE
.export XSTRINGS
.endif
#
#
# For FROM (host) stages . . .
# From gccXY (such as gcc49 but not xtoolchain)
# TOOLS_FROM_TYPE's appropriate binutils. . .
#
.if ${.MAKE.LEVEL} == 0
CC=env C_INCLUDE_PATH=/usr/include /usr/local/bin/gcc49 -L/usr/lib
CXX=env C_INCLUDE_PATH=/usr/include CPLUS_INCLUDE_PATH=/usr/include/c++/v1 /usr/local/bin/g++49 -std=c++11 -nostdinc++ -L/usr/lib
CPP=/usr/local/bin/cpp49
.export CC
.export CXX
.export CPP
AS=/usr/local/${TOOLS_FROM_TYPE}-portbld-freebsd${VERSION_CONTEXT}/bin/as
AR=/usr/local/${TOOLS_FROM_TYPE}-portbld-freebsd${VERSION_CONTEXT}/bin/ar
LD=/usr/local/${TOOLS_FROM_TYPE}-portbld-freebsd${VERSION_CONTEXT}/bin/ld
NM=/usr/local/${TOOLS_FROM_TYPE}-portbld-freebsd${VERSION_CONTEXT}/bin/nm
OBJCOPY=/usr/local/${TOOLS_FROM_TYPE}-portbld-freebsd${VERSION_CONTEXT}/bin/objcopy
OBJDUMP=/usr/local/${TOOLS_FROM_TYPE}-portbld-freebsd${VERSION_CONTEXT}/bin/objdump
RANLIB=/usr/local/${TOOLS_FROM_TYPE}-portbld-freebsd${VERSION_CONTEXT}/bin/ranlib
SIZE=/usr/local/${TOOLS_FROM_TYPE}-portbld-freebsd${VERSION_CONTEXT}/bin/size
#NO-SUCH: STRINGS=/usr/local/${TOOLS_FROM_TYPE}-portbld-freebsd${VERSION_CONTEXT}/bin/strings
STRINGS=/usr/local/bin/strings
.export AS
.export AR
.export LD
.export NM
.export OBJCOPY
.export OBJDUMP
.export RANLIB
.export SIZE
.export STRINGS
.endif

# more /usr/src/sys/powerpc/conf/GENERIC64vtsc-NODBG 
#
# GENERIC -- Custom configuration for the powerpc/powerpc64
#

include "GENERIC64"

ident   GENERIC64vtsc-NODGB

makeoptions     DEBUG=-g                # Build kernel with gdb(1) debug symbols

nooptions       PS3                     # Sony Playstation 3               HACK!!! to allow sc

options         KDB                     # Enable kernel debugger support

# For minimum debugger support (stable branch) use:
options         KDB_TRACE               # Print a stack trace for a panic
options         DDB                     # Enable the kernel debugger
options         GDB                     # HACK!!! ...

# Extra stuff:
#options        VERBOSE_SYSINIT         # Enable verbose sysinit messages
#options        BOOTVERBOSE=1
#options        BOOTHOWTO=RB_VERBOSE
#options        KTR
#options        KTR_MASK=KTR_TRAP
##options       KTR_CPUMASK=0xF
#options        KTR_VERBOSE

# HACK!!! to allow sc for 2560x1440 display on Radeon X1950 that vt historically mishandled during booting
device          sc
#device                 kbdmux          # HACK: already listed by vt
options         SC_OFWFB        # OFW frame buffer
options         SC_DFLT_FONT    # compile font in
makeoptions     SC_DFLT_FONT=cp437

# Disable any extra checking for. . .
nooptions       DEADLKRES               # Enable the deadlock resolver
nooptions       INVARIANTS              # Enable calls of extra sanity checking
nooptions       INVARIANT_SUPPORT       # Extra sanity checks of internal structures, required by INVARIANTS
nooptions       WITNESS                 # Enable checks to detect deadlocks and cycles
nooptions       WITNESS_SKIPSPIN        # Don't run witness on spinlocks for speed
nooptions       DIAGNOSTIC
nooptions       MALLOC_DEBUG_MAXZONES   # Separate malloc(9) zones


# svnlite diff /usr/src/sys/powerpc/ofw/ofw_machdep.c 
Index: /usr/src/sys/powerpc/ofw/ofw_machdep.c
===================================================================
--- /usr/src/sys/powerpc/ofw/ofw_machdep.c	(revision 308247)
+++ /usr/src/sys/powerpc/ofw/ofw_machdep.c	(working copy)
@@ -111,6 +111,24 @@
 	 * Assume that interrupt are disabled at this point, or
 	 * SPRG1-3 could be trashed
 	 */
+#if defined(AIM) && defined(__powerpc64__)
+/* HACK: PowerMac G5 specific code to avoid demonstrated hangs in
+ *       the early boot time frame: avoid mtsprg0 use.
+ *       This would need a live test for PowerMac vs. not in order
+ *       to remove HACK status --but without calling into
+ *       OpenFirmware or the problem would be recreated.
+ */
+	if (1)
+		__asm __volatile("mfsprg0 %0\n\t"
+				 "mtsprg1 %1\n\t"
+				 "mtsprg2 %2\n\t"
+				 "mtsprg3 %3\n\t"
+				 : "=&r"(ofw_sprg0_save)
+				 : "r"(ofmsr[2]),
+				 "r"(ofmsr[3]),
+				 "r"(ofmsr[4]));
+	else
+#endif
 	__asm __volatile("mfsprg0 %0\n\t"
 			 "mtsprg0 %1\n\t"
 	    		 "mtsprg1 %2\n\t"




You have not sent out such materials for anyone to look at
so I've no clue what all the differences might be in what
you have.

===
Mark Millard
markmi at dsl-only.net



More information about the freebsd-ppc mailing list