From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JtQ3W-00077R-Sr for qemu-devel@nongnu.org; Tue, 06 May 2008 12:30:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JtQ3U-00076S-Oj for qemu-devel@nongnu.org; Tue, 06 May 2008 12:30:18 -0400 Received: from [199.232.76.173] (port=49115 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JtQ3U-00076P-Fr for qemu-devel@nongnu.org; Tue, 06 May 2008 12:30:16 -0400 Received: from ecfrec.frec.bull.fr ([129.183.4.8]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JtQ3T-0001Z5-SI for qemu-devel@nongnu.org; Tue, 06 May 2008 12:30:16 -0400 Subject: Re: [Qemu-devel] [PATCH] fix PPC OpenHackWare for Linux 2.6 From: Laurent Vivier In-Reply-To: <4820808B.4000304@exactcode.de> References: <4820808B.4000304@exactcode.de> Content-Type: text/plain; charset=UTF-8 Date: Tue, 06 May 2008 18:30:34 +0200 Message-Id: <1210091434.4311.31.camel@frecb07144> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jocelyn Mayer , =?ISO-8859-1?Q?Ren=E9?= Rebe Nice work, Le mardi 06 mai 2008 =C3=A0 18:00 +0200, Ren=C3=A9 Rebe a =C3=A9crit : > Hi all, >=20 > after quite some debugging thru the early startup code of Linux 2.6 > I fixed some issues in the OpenHackWare "BIOS" for PPC emulation. >=20 > The diff below is against the Qemu pc-bios/ohw.diff, I can also > provide the resulting binary if interested. >=20 > First I fixed the linker script to actually work at all (actually > I also installed an old toolchain, just to find out that even that > one would not link OHW, ... >=20 > Second, Linux 2.6 flatten_device_tree stuff in arch/powerpc/kernel/prom= _init.c > check for a return value of 1, as I do not have the IEEE spec on my des= k > I assumed it means success, and with the change the flattened device > tree is no longer empty, helping a great deal continuing to boot ... >=20 > Third, when selecting a core99 machine, Linux assumes to find an NVRAM, > and panics in some init_timer if there isn't one. Though a core99 machi= ne > does not yet work perfectly, further investigation to be done. >=20 > Linewise the FB CLUT is with Linux 2.6 has some issue and the FB thus > shows false colors, but good enough to work with for now. >=20 > Oh, and last but not least with a self built prom, I hit this > "error booting from CD-ROM bug, that Jocelyn hacked around in > r3309. As that was just a binary only blob fix and there is no > newer version of OHW I just commented out the "return on error" > which allowed to boot CD images on my side. >=20 > As this is the first nightly track thru the guts of Qemu any > comment welcome: >=20 > --- qemu-svn/pc-bios/ohw.diff (revision 4353) > +++ qemu-svn/pc-bios/ohw.diff (working copy) > @@ -1,3 +1,19 @@ > +Make it link at al. > + > + - Rene Rebe > + > +--- OpenHackWare-release-0.4/src/main.ld 2005-03-31 09:23:33.000000000= +0200 > ++++ OpenHackWare-release-0.4-hacked/src/main.ld 2008-05-06 11:23:29.00= 0000000 +0200 > +@@ -49,7 +49,7 @@ > + _sdata_end =3D . ; > + . =3D ALIGN(4) ; > + _ro_start =3D . ; > +- .rodata : { *(.rodata) } > bios > ++ .rodata : { *(.rodata*) } > bios > + _ro_end =3D . ; > + . =3D ALIGN(4) ; > + _RTAS_start =3D .; > + I think you should also remove .rodata.str1.4 from .data section: @@ -35,7 +35,7 @@ .OpenFirmware : { *(.OpenFirmware) } > bios . =3D ALIGN(4) ; _data_start =3D . ; - .data : { *(.data) *(.rodata.str1.4) } > bios + .data : { *(.data) } > bios _data_end =3D . ; . =3D ALIGN(4) ; _OF_vars_start =3D . ; > diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude= '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/bios.h OpenHac= kWare-release-0.4/src/bios.h > --- OpenHackWare-release-0.4.org/src/bios.h 2005-04-06 23:20:22.00000= 0000 +0200 > +++ OpenHackWare-release-0.4/src/bios.h 2005-07-07 01:10:20.000000000= +0200 > @@ -748,24 +764,14 @@ > { > /* Hack taken 'as-is' from PearPC */ > unsigned char info[] =3D { > -@@ -1596,7 +1627,9 @@ > - OF_node_put(OF_env, brom); > +@@ -1596,6 +1627,7 @@ > OF_node_put(OF_env, rom); > } > -+#if 0 > /* From here, hardcoded hacks to get a Mac-like machine */ > -+ /* XXX: Core99 does not seem to like this NVRAM tree */ > ++ /* XXX: Not yet perfect, but Linux 2.6 does oops on boot on Core9= 9 without NVRAM node */ > /* "/nvram@fff04000" node */ > { > OF_regprop_t regs; > -@@ -1617,6 +1650,7 @@ > - OF_prop_int_new(OF_env, chs, "nvram", OF_pack_handle(OF_env, = nvr)); > - OF_node_put(OF_env, nvr); > - } > -+#endif > - /* "/pseudo-hid" : hid emulation as Apple does */ > - { > - OF_node_t *hid; > @@ -1663,7 +1697,27 @@ > } > OF_node_put(OF_env, hid); > @@ -1841,3 +1847,40 @@ > case ARCH_MAC99: > /* We are supposed to have 3 host bridges: > * - the uninorth AGP bridge at 0xF0000000 > + > + > +The 2.6 Linux kernel checks for 1, as I do not have the IEEE spec on > +my desk I can only guess it should return 1 on success, not the > +string length. > + > + - Rene Rebe > + > +--- OpenHackWare-release-0.4/src/of.c 2005-04-06 23:17:26.000000000 +0= 200 > ++++ OpenHackWare-release-0.4-hacked/src/of.c 2008-05-06 14:50:48.00000= 0000 +0200 > +@@ -3841,7 +4061,7 @@ > + OF_DPRINTF("Return property name [%s]\n", next->name); > + OF_sts(next_name, (void *)(next->name)); > + OF_DUMP_STRING(OF_env, next_name); > +- pushd(OF_env, strlen(next->name) + 1); > ++ pushd(OF_env, 1); /* ReneR: Linux 2.6 flatten_device_tree= */ > + } > + } > + } > + > + > +In qemu r3309 j_mayer did some "Quickly hack PowerPC BIOS able to boot > +on CDROM again.", as I did not feel like disassemble to find out this > +worked for me for now. > + > + - Rene Rebe > + > +--- OpenHackWare-release-0.4/src/bloc.c 2005-04-06 23:21:00.000000000 = +0200 > ++++ OpenHackWare-release-0.4-hacked/src/bloc.c 2008-05-06 14:20:10.000= 000000 +0200 > +@@ -1021,7 +1038,7 @@ > + status =3D ide_port_read(bd, 0x07); > + if (status !=3D 0x08) { > + ERROR("ATAPI TEST_UNIT_READY : status %0x !=3D 0x08\n", s= tatus); > +- return -1; > ++ /*return -1;*/ /* fails to boot from cdrom? */ > + } > + for (i =3D 0; i < 3; i++) { >=20 Regards, Laurent --=20 ------------- Laurent.Vivier@bull.net --------------- "The best way to predict the future is to invent it." - Alan Kay