linux-mips
[Top] [All Lists]

Re: [PATCH v2] MIPS: Tell R4k SC and MC variations apart

To: "Maciej W. Rozycki" <macro@linux-mips.org>
Subject: Re: [PATCH v2] MIPS: Tell R4k SC and MC variations apart
From: Jonas Gorski <jogo@openwrt.org>
Date: Mon, 23 Sep 2013 14:41:19 +0200
Cc: Ralf Baechle <ralf@linux-mips.org>, MIPS Mailing List <linux-mips@linux-mips.org>
In-reply-to: <alpine.LFD.2.03.1309231332500.16797@linux-mips.org>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <alpine.LFD.2.03.1309222307440.16797@linux-mips.org> <CAOiHx==GRTP3FpSfPG9yUc50mZBvrzjnXnGMXA6A5WSBRXbp3g@mail.gmail.com> <alpine.LFD.2.03.1309231332500.16797@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
On Mon, Sep 23, 2013 at 2:35 PM, Maciej W. Rozycki <macro@linux-mips.org> wrote:
(snip)

> linux-mips-r4k-mc.patch
> Index: linux/arch/mips/kernel/cpu-probe.c
> ===================================================================
> --- linux.orig/arch/mips/kernel/cpu-probe.c
> +++ linux/arch/mips/kernel/cpu-probe.c
> @@ -362,13 +362,33 @@ static inline void cpu_probe_legacy(stru
>                                 __cpu_name[cpu] = "R4000PC";
>                         }
>                 } else {
> +                       int cca = read_c0_config() & CONF_CM_CMASK;
> +                       int mc;
> +
> +                       /*
> +                        * SC and MC versions can't be reliably told apart,
> +                        * but only the latter support coherent caching
> +                        * modes so assume the firmware has set the KSEG0
> +                        * coherency attribute reasonably (if uncached, we
> +                        * assume SC).
> +                        */
> +                       switch (cca) {
> +                       case CONF_CM_CACHABLE_CE:
> +                       case CONF_CM_CACHABLE_COW:
> +                       case CONF_CM_CACHABLE_CUW:
> +                               mc = 1;
> +                               break;
> +                       default:
> +                               mc = 0;
> +                               break;
> +                       }
>                         if ((c->processor_id & PRID_REV_MASK) >=
>                             PRID_REV_R4400) {
> -                               c->cputype = CPU_R4400SC;
> -                               __cpu_name[cpu] = "R4400SC";
> +                               c->cputype = mc ? CPU_R4400MC : CPU_R4400SC;
> +                               __cpu_name[cpu] = mc ? "R4400MC" : "R4400SC";
>                         } else {
> -                               c->cputype = CPU_R4000SC;
> -                               __cpu_name[cpu] = "R4000SC";
> +                               c->cputype = mc ? CPU_R4000MC : CPU_R4000SC;
> +                               __cpu_name[cpu] = mc ? "R4400MC" : "R4000SC";

You are still calling it "R4400", not "R4000" as expected.


Jonas

<Prev in Thread] Current Thread [Next in Thread>