[OpenBIOS] [PATCHv2 2/6] ppc: fix ESCC reg properties

Programmingkid programmingkidx at gmail.com
Tue Feb 23 04:58:53 CET 2016


On Feb 20, 2016, at 12:18 PM, Mark Cave-Ayland 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.
> 
> Based upon an original patch from Hervé Poussineau <hpoussin at reactos.org>.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
> ---
> openbios-devel/drivers/escc.c |   43 ++++++++++++++++++++++++++++-------------
> 1 file changed, 30 insertions(+), 13 deletions(-)
> 
> diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c
> index 9b87083..44b73f0 100644
> --- a/openbios-devel/drivers/escc.c
> +++ b/openbios-devel/drivers/escc.c
> @@ -388,7 +388,20 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr,
>     cell props[10];
>     int index;
>     int legacy;
> -
> +    int reg_offsets[2][2][3] = {
> +        {
> +            /* ch-b */
> +            { 0x00, 0x10, 0x40 },
> +            /* ch-a */
> +            { 0x20, 0x30, 0x50 }
> +        },{
> +            /* legacy ch-b */
> +            { 0x0, 0x2, 0x8 },
> +            /* legacy ch-a */
> +            { 0x4, 0x6, 0xa }
> +        }
> +    };
> +    
>     switch (esnum) {
>         case 2: index = 1; legacy = 0; break;
>         case 3: index = 0; legacy = 0; break;
> @@ -425,17 +438,21 @@ 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 + index * 0x4;
> -        props[1] = 0x00000001;
> -        props[2] = IO_ESCC_LEGACY_OFFSET + index * 0x4 + 2;
> -        props[3] = 0x00000001;
> -        props[4] = IO_ESCC_LEGACY_OFFSET + index * 0x4 + 6;
> -        props[5] = 0x00000001;
> +        props[0] = IO_ESCC_LEGACY_OFFSET + reg_offsets[legacy][index][0];
> +        props[1] = 0x1;
> +        props[2] = IO_ESCC_LEGACY_OFFSET + reg_offsets[legacy][index][1];
> +        props[3] = 0x1;
> +        props[4] = IO_ESCC_LEGACY_OFFSET + reg_offsets[legacy][index][2];
> +        props[5] = 0x1;
>         set_property(dnode, "reg", (char *)&props, 6 * sizeof(cell));
>     } else {
> -        props[0] = IO_ESCC_OFFSET + index * 0x20;
> -        props[1] = 0x00000020;
> -        set_property(dnode, "reg", (char *)&props, 2 * sizeof(cell));
> +        props[0] = IO_ESCC_OFFSET + reg_offsets[legacy][index][0];
> +        props[1] = 0x1;
> +        props[2] = IO_ESCC_OFFSET + reg_offsets[legacy][index][1];
> +        props[3] = 0x1;
> +        props[4] = IO_ESCC_OFFSET + reg_offsets[legacy][index][2];
> +        props[5] = 0x1;
> +        set_property(dnode, "reg", (char *)&props, 6 * sizeof(cell));
>     }
> 
>     if (legacy) {
> @@ -446,13 +463,13 @@ escc_add_channel(const char *path, const char *node, phys_addr_t addr,
>     OLDWORLD(set_property(dnode, "AAPL,address",
>             (char *)&props, 1 * sizeof(cell)));
> 
> -    props[0] = 0x00000010 - index;
> +    props[0] = 0x10 - index;
>     OLDWORLD(set_property(dnode, "AAPL,interrupts",
>             (char *)&props, 1 * sizeof(cell)));
> 
>     props[0] = (0x24) + index;
> -    props[1] = 0;
> -    props[2] = 0;
> +    props[1] = 0x0;
> +    props[2] = 0x0;
>     NEWWORLD(set_property(dnode, "interrupts",
>              (char *)&props, 3 * sizeof(cell)));
> 
> -- 
> 1.7.10.4


I had a lot of problems applying this patch. Eventually I just applied it by hand. Testing your v2 patch set with Mac OS 9.2 ends with an Illegal Instruction error for me. When I tested Mac OS 9.0, the OS just stops booting and does nothing. It doesn't crash. I just sits there doing nothing. The mouse cursor still can move. I tried this OS again and it crashed on the second time. The third time it just sat there doing nothing like the first time. 


More information about the OpenBIOS mailing list