[OpenBIOS] [PATCH] prep: change residual data model name to IBM PPS Model 6015

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Mon Sep 10 22:55:09 CEST 2018


On 09/09/18 19:46, Programmingkid wrote:

>> On Sep 9, 2018, at 8:42 AM, Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk> wrote:
>>
>> With the corresponding QEMU patches applied, it is now possible to change the
>> reported firmware name to that of a real 40p machine and boot to a working
>> userspace with the Linux sandalfoot zImage.
>>
>> Note that whilst guest OSs should be relying on residual data rather than the
>> OF device tree to determine the hardware, we still update the interrupt
>> properties to match the new code in QEMU for consistency.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
>> ---
>> arch/ppc/qemu/context.c |  2 +-
>> drivers/pci.c           | 24 ++++++++++++++++++++----
>> 2 files changed, 21 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/ppc/qemu/context.c b/arch/ppc/qemu/context.c
>> index 06e0122..5815895 100644
>> --- a/arch/ppc/qemu/context.c
>> +++ b/arch/ppc/qemu/context.c
>> @@ -111,7 +111,7 @@ static void *
>> residual_build(uint32_t memsize, uint32_t load_base, uint32_t load_size)
>> {
>>     residual_t *res;
>> -    const unsigned char model[] = "Qemu\0PPC\0";
>> +    const unsigned char model[] = "IBM PPS Model 6015\0";
>>     int i;
>>
>>     res = malloc(sizeof(residual_t));
>> diff --git a/drivers/pci.c b/drivers/pci.c
>> index 8f97ae1..df6d9d0 100644
>> --- a/drivers/pci.c
>> +++ b/drivers/pci.c
>> @@ -1986,10 +1986,26 @@ static phandle_t ob_pci_host_set_interrupt_map(phandle_t host)
>> static void ob_pci_host_bus_interrupt(ucell dnode, u32 *props, int *ncells, u32 addr, u32 intno)
>> {
>>     *ncells += pci_encode_phys_addr(props + *ncells, 0, 0, addr, 0, 0);
>> -    props[(*ncells)++] = intno;
>> -    props[(*ncells)++] = dnode;
>> -    props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 3];
>> -    props[(*ncells)++] = 1;
>> +
>> +    if (is_oldworld() || is_newworld()) {
>> +        /* Mac machines */
>> +        props[(*ncells)++] = intno;
>> +        props[(*ncells)++] = dnode;
>> +        props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 3];
>> +        props[(*ncells)++] = 1;
>> +    } else {
>> +        /* PReP machines */
>> +        props[(*ncells)++] = intno;
>> +        props[(*ncells)++] = dnode;
>> +
>> +        if (PCI_DEV(addr) == 1 && PCI_FN(addr) == 0) {
>> +            /* LSI SCSI has fixed routing */
>> +            props[(*ncells)++] = 2;
>> +        } else {
>> +            props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 1];
>> +        }
>> +        props[(*ncells)++] = 1;
>> +    }
>> }
>>
>> #elif defined(CONFIG_SPARC64)
> 
> I was kind of hoping we had a is_40P() or is_IBM_PReP() function we could use instead of assuming/defaulting to PReP. This way if the user were to move the OpenBIOS binary to another version of QEMU, any differences in configuration would be handled better. 

Well this isn't really something that we support, mainly because changes
in the QEMU machine wiring must also be updated in the OpenBIOS DT at
the same time.

Quite a lot of the time you can get lucky here but mixing and matching
QEMU/OpenBIOS machines comes with no guarantee.

> This is what I wish for:
> 
> if (is_oldworld() || isnewworld()) {
> ...
> } 
> 
> else if (is_IBM_6015()) {
> ...
> }
> 
> else {
> 	printf("Sorry but this computer model is not supported: %s\n", get_model_name());
> }

One other thing you will find is that if you try using OpenBIOS with
other (unsupported) PPC machines in QEMU, the initialisation fails long
before you can get anywhere close to displaying the result of printf()...


ATB,

Mark.



More information about the OpenBIOS mailing list