On Fri, Apr 22, 2016 at 02:25:06PM +0300, Joonas Lahtinen wrote:
> Move the better constructs/comments from i915_gem_stolen.c to
> early-quirks.c and increase readability in preparation of only
> having one set of functions.
> 
> - intel_stolen_base -> gen3_stolen_base
> - use phys_addr_t instead of u32 for address for future proofing
> 
> Cc: Chris Wilson <[email protected]>
> Cc: Mika Kuoppala <[email protected]>
> Cc: Ville Syrjälä <[email protected]>
> Cc: Tvrtko Ursulin <[email protected]>
> Signed-off-by: Joonas Lahtinen <[email protected]>

Looks like a fairly mechanical change, so
Reviewed-by: Chris Wilson <[email protected]>

>  static size_t __init i830_stolen_size(int num, int slot, int func)
>  {
> -     size_t stolen_size;
>       u16 gmch_ctrl;
> +     u16 gms;
>  
>       gmch_ctrl = read_pci_config_16(0, 0, 0, I830_GMCH_CTRL);
> -
> -     switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
> -     case I830_GMCH_GMS_STOLEN_512:
> -             stolen_size = KB(512);
> -             break;
> -     case I830_GMCH_GMS_STOLEN_1024:
> -             stolen_size = MB(1);
> -             break;
> -     case I830_GMCH_GMS_STOLEN_8192:
> -             stolen_size = MB(8);
> -             break;
> -     case I830_GMCH_GMS_LOCAL:
> -             /* local memory isn't part of the normal address space */
> -             stolen_size = 0;
> -             break;
> +     gms = gmch_ctrl & I830_GMCH_GMS_MASK;
> +
> +     switch (gms) {
> +     case I830_GMCH_GMS_STOLEN_512:  return KB(512);
> +     case I830_GMCH_GMS_STOLEN_1024: return MB(1);
> +     case I830_GMCH_GMS_STOLEN_8192: return MB(8);
> +     /* local memory isn't part of the normal address space */
> +     case I830_GMCH_GMS_LOCAL:       return 0;
>       default:
> -             return 0;
> +             WARN(1, "Unknown register value!\n");

When adding a warn try to include the pertinent information:

WARN(1, "Unknown I830_GMCH_CTRL value: %x!\n", gms);
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to