qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [PATCH 1/3] uninorth: create new uninorth device


From: Programmingkid
Subject: Re: [Qemu-ppc] [PATCH 1/3] uninorth: create new uninorth device
Date: Thu, 3 May 2018 19:44:37 -0400

> Commit 4e46dcdbd3 "PPC: Newworld: Add uninorth token register" added a TODO
> which was to convert the uninorth registers hack to a proper device. Move
> these registers to a new uninorth device, removing the old hacks from
> mac_newworld.c.
> 
> Signed-off-by: Mark Cave-Ayland <address@hidden>
> Reviewed-by: Philippe Mathieu-Daud? <address@hidden>

<snip>

> +
> +static uint64_t unin_read(void *opaque, hwaddr addr, unsigned size)
> +{
> +    uint32_t value;
> +
> +    value = 0;
> +    switch (addr) {
> +    case 0:
> +        value = *(int *)opaque;
> +    }

This code caught my attention. Is it possible that values other than zero could 
be passed as the address?

If keeping the switch statement is a must, perhaps a default case should be 
added that alerts the user an unprogrammed response was detected.

Also I think "case 0" might not be descriptive enough. Could the zero be 
replaced with a macro that describes what this case is?

> +
> +    trace_unin_read(addr, value);
> +
> +    return value;
> +}
> +
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]