[OpenBIOS] [PATCH] ppc: fix ESCC reg properties

Programmingkid programmingkidx at gmail.com
Wed Feb 3 21:36:52 CET 2016


On Feb 3, 2016, at 2:12 PM, Hervé Poussineau wrote:

> Le 03/02/2016 18:00, Programmingkid a écrit :
>> 
>> On Feb 3, 2016, at 1:29 AM, Hervé Poussineau wrote:
>> 
>>> I/O offsets were wrong in legacy mode and some were missing in non-legacy mode.
>>> This fixes serial port detection in NetBSD, which was ignoring it.
>>> This also partly fixes MacOS 9.2, which relies on them to initialize OpenTransport.
>>> 
>>> Signed-off-by: Hervé Poussineau <hpoussin at reactos.org>
>>> ---
>>> drivers/escc.c | 22 ++++++++++++----------
>>> 1 file changed, 12 insertions(+), 10 deletions(-)
>>> 
>>> diff --git a/drivers/escc.c b/drivers/escc.c
>>> index afb97fa..8f122d8 100644
>>> --- a/drivers/escc.c
>>> +++ b/drivers/escc.c
>>> @@ -384,6 +384,8 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr,
>>> {
>>>     char buf[64], tty[32];
>>>     phandle_t dnode, aliases;
>>> +    int legacy_offsets[][3] = { { 0x4, 0x6, 0xa }, { 0x0, 0x2, 0x8 } };
>>> +    int offsets[][3] = { { 0x20, 0x30, 0x50 }, { 0x00, 0x10, 0x40 } };
>>> 
>>>     cell props[10];
>>>     int offset;
>>> @@ -425,18 +427,18 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr,
>>>     set_property(dnode, "compatible", buf, 9);
>>> 
>>>     if (legacy) {
>>> -        props[0] = IO_ESCC_LEGACY_OFFSET + offset * 0x4;
>>> -        props[1] = 0x00000001;
>>> -        props[2] = IO_ESCC_LEGACY_OFFSET + offset * 0x4 + 2;
>>> -        props[3] = 0x00000001;
>>> -        props[4] = IO_ESCC_LEGACY_OFFSET + offset * 0x4 + 6;
>>> -        props[5] = 0x00000001;
>>> -        set_property(dnode, "reg", (char *)&props, 6 * sizeof(cell));
>>> +        props[0] = IO_ESCC_LEGACY_OFFSET + legacy_offsets[offset][0];
>>> +        props[2] = IO_ESCC_LEGACY_OFFSET + legacy_offsets[offset][1];
>>> +        props[4] = IO_ESCC_LEGACY_OFFSET + legacy_offsets[offset][2];
>>>     } else {
>>> -        props[0] = IO_ESCC_OFFSET + offset * 0x20;
>>> -        props[1] = 0x00000020;
>>> -        set_property(dnode, "reg", (char *)&props, 2 * sizeof(cell));
>>> +        props[0] = IO_ESCC_LEGACY_OFFSET + offsets[offset][0];
>>> +        props[2] = IO_ESCC_LEGACY_OFFSET + offsets[offset][1];
>>> +        props[4] = IO_ESCC_LEGACY_OFFSET + offsets[offset][2];
>>>     }
>>> +    props[1] = 0x00000001;
>>> +    props[3] = 0x00000001;
>>> +    props[5] = 0x00000001;
>>> +    set_property(dnode, "reg", (char *)&props, 6 * sizeof(cell));
>>> 
>>>     if (legacy) {
>>>         props[0] = addr + IO_ESCC_LEGACY_OFFSET + offset * 0x4;
>>> --
>>> 2.1.4
>>> 
>> 
>> I didn't notice anything different when I tried booting Mac OS 9.2 with and without your patch. Mac OS 9.2 always crashes on startup for me. What changes did you notice while using Mac OS 9 with your patch?
> 
> Using QEMU master (87574621b18f86eab295a2c207e0b42c77b5dfa0), with unmodified Mac OS 9.2 ISO.
> * With OpenBIOS r1377 + CR/LF patch
> MacOS 9.2 load screen is shown, then you have the rotating icon on the top left of the screen, and then QEMU crashes
> Console contains
> Trying to write invalid spr 0 (0x000) at 00f113c0
> Trying to read invalid spr 0 (0x000) at 00f113c8
> invalid/unsupported opcode: 1f - 07 - 02 (7c00488e) 00f113dc 0
> invalid/unsupported opcode: 1f - 07 - 06 (7c00498e) 00f113e4 0
> Trying to write privileged spr 955 (0x3bb) at 00f168c8
> Trying to write invalid spr 959 (0x3bf) at 00f16930
> Trying to read invalid spr 959 (0x3bf) at 00f16938
> Trying to write invalid spr 944 (0x3b0) at 00f1694c
> Trying to read invalid spr 944 (0x3b0) at 00f16954
> Trying to write invalid spr 951 (0x3b7) at 00f16960
> Trying to read invalid spr 951 (0x3b7) at 00f16968
> Trying to write privileged spr 955 (0x3bb) at 00f168c8
> Trying to write invalid spr 959 (0x3bf) at 00f16930
> Trying to read invalid spr 959 (0x3bf) at 00f16938
> Trying to write invalid spr 944 (0x3b0) at 00f1694c
> Trying to read invalid spr 944 (0x3b0) at 00f16954
> Trying to write invalid spr 951 (0x3b7) at 00f16960
> Trying to read invalid spr 951 (0x3b7) at 00f16968
> invalid/unsupported opcode: 13 - 0a - 05 (4f434154) 009e1d10 1
> invalid/unsupported opcode: 00 - 00 - 00 (00c10000) 00000000 1
> invalid/unsupported opcode: 00 - 00 - 00 (00c10000) 00000000 1
> invalid/unsupported opcode: 00 - 00 - 00 (00000000) 008c0f14 1
> invalid/unsupported opcode: 00 - 00 - 00 (00000000) 0421b81c 1
> qemu: fatal: Trying to execute code outside RAM or ROM at 0xfdfdfdfc
> 
> NIP fdfdfdfc   LR fdfdfdfd CTR ffcf0dcc XER 20000100 CPU#0
> MSR 0000f032 HID0 00810000  HF 00006000 idx 0
> TB 00000000 1615152802 DECR 00059059
> GPR00 00000000fdfdfdfd 00000000ffe55000 000000000004d280 00000000ffffffff
> GPR04 00000000ffffffff 00000000ffffffff 00000000f2ffc048 00000000f4ffc048
> GPR08 0000000000ffc048 00000000f0ffc048 00000000ffffffff 00000000f6ffc048
> GPR12 00000000fcffc048 0000000068fff400 0000000000004e94 000000000bb957ea
> GPR16 000000003f3f3f3f 0000000000000001 0000000053680000 0000000000000000
> GPR20 0000000000000001 0000000000000005 000000000bb8d12c 0000000000006807
> GPR24 000000000004ccf0 000000000bb8d130 0000000000084d38 00000000009d0eb8
> GPR28 0000000000084d38 00000000ffffffff 00000000fdfdfdfd 000000000000fdfd
> CR 82220482  [ L  E  E  E  -  G  L  E  ]             RES ffffffff
> FPR00 0000000082004000 41d2cac6a8000000 0000000000000000 41d2cac6a8000000
> FPR04 41d2cac6a8000000 bfd549b141dea8e2 bf880033ba736cfd 3fefffd039962f40
> FPR08 3faaf497f23bd4ec 4230000000000000 0000000082004000 4330000017d6dc13
> FPR12 3f847b718aeb3db1 ffffffffff3f8c5c 0000000000000000 0000000000000000
> FPR16 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> FPR20 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> FPR24 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> FPR28 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> FPSCR 82004000
> SRR0 fdfdfdfc  SRR1 4000f032    PVR 00080301 VRSAVE 00000000
> SPRG0 0fbfe000 SPRG1 ffe55000  SPRG2 fdfdfdfd  SPRG3 0fbfe420
> SPRG4 00000000 SPRG5 00000000  SPRG6 00000000  SPRG7 00000000
> SDR1 0fc0001f   DAR ffe54fd8  DSISR 0a000000
> Aborted
> 
> * With OpenBIOS r1377 + CR/LF patch + my patch
> MacOS 9.2 load screen is shown, OpenTransport icon is displayed at the bottom left on the screen, and there is an message box with "illegal instruction".
> Console contains
> Trying to write invalid spr 0 (0x000) at 00f113c0
> Trying to read invalid spr 0 (0x000) at 00f113c8
> invalid/unsupported opcode: 1f - 07 - 02 (7c00488e) 00f113dc 0
> invalid/unsupported opcode: 1f - 07 - 06 (7c00498e) 00f113e4 0
> Trying to write privileged spr 955 (0x3bb) at 00f168c8
> Trying to write invalid spr 959 (0x3bf) at 00f16930
> Trying to read invalid spr 959 (0x3bf) at 00f16938
> Trying to write invalid spr 944 (0x3b0) at 00f1694c
> Trying to read invalid spr 944 (0x3b0) at 00f16954
> Trying to write invalid spr 951 (0x3b7) at 00f16960
> Trying to read invalid spr 951 (0x3b7) at 00f16968
> Trying to write privileged spr 955 (0x3bb) at 00f168c8
> Trying to write invalid spr 959 (0x3bf) at 00f16930
> Trying to read invalid spr 959 (0x3bf) at 00f16938
> Trying to write invalid spr 944 (0x3b0) at 00f1694c
> Trying to read invalid spr 944 (0x3b0) at 00f16954
> Trying to write invalid spr 951 (0x3b7) at 00f16960
> Trying to read invalid spr 951 (0x3b7) at 00f16968
> invalid/unsupported opcode: 00 - 00 - 00 (00c10000) 00000000 1

Is it possible the invalid/unsupported opcode errors are PowerPC instructions that are not implemented?   Or do you think the processor is executing memory it should not be executing? The message "qemu: fatal: Trying to execute code outside RAM or ROM at 0xfdfdfdfc", was it shown when you used your patch? If it was then there is some kind of address calculation error possibly taking place. 


More information about the OpenBIOS mailing list