From owner-svn-src-all@FreeBSD.ORG Wed Jun 10 12:47:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67E9A1065672; Wed, 10 Jun 2009 12:47:55 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5629C8FC0A; Wed, 10 Jun 2009 12:47:55 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5ACltBb013491; Wed, 10 Jun 2009 12:47:55 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5ACltKW013488; Wed, 10 Jun 2009 12:47:55 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <200906101247.n5ACltKW013488@svn.freebsd.org> From: Peter Grehan Date: Wed, 10 Jun 2009 12:47:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193909 - in head/sys/powerpc: aim powerpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jun 2009 12:47:55 -0000 Author: grehan Date: Wed Jun 10 12:47:54 2009 New Revision: 193909 URL: http://svn.freebsd.org/changeset/base/193909 Log: Get the gdb/psim emulator functioning again. aim/machdep.c: - the RI status register bit needs to be set when doing the mtmsrd 64-bit instruction test - psim doesn't implement the dcbz instruction so the run-time cacheline test fails. Set the cachline size to 32 to avoid infinite loops in future calls to __syncicache() aim/platform_chrp.c: - if after iterating through / and a name property of "cpus" still isn't found, just search directly for '/cpus'. - psim doesn't put a "reg" property on it's cpu nodes, so assume 0 since it is uniprocessor-only at this point powerpc/openpic.c - the number of CPUs reported is 1 too many on psim's openpic Reviewed by: nwhitehorn MFC after: 1 week (openpic part) Modified: head/sys/powerpc/aim/machdep.c head/sys/powerpc/aim/platform_chrp.c head/sys/powerpc/powerpc/openpic.c Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Wed Jun 10 12:20:11 2009 (r193908) +++ head/sys/powerpc/aim/machdep.c Wed Jun 10 12:47:54 2009 (r193909) @@ -359,7 +359,7 @@ powerpc_init(u_int startkernel, u_int en */ msr = mfmsr(); - mtmsr(msr & ~(PSL_IR | PSL_DR)); + mtmsr((msr & ~(PSL_IR | PSL_DR)) | PSL_RI); isync(); /* @@ -380,6 +380,12 @@ powerpc_init(u_int startkernel, u_int en for (cacheline_size = 0; cacheline_size < 0x100 && cache_check[cacheline_size] == 0; cacheline_size++); + /* Work around psim bug */ + if (cacheline_size == 0) { + printf("WARNING: cacheline size undetermined, setting to 32\n"); + cacheline_size = 32; + } + /* * Figure out whether we need to use the 64 bit PMAP. This works by * executing an instruction that is only legal on 64-bit PPC (mtmsrd), Modified: head/sys/powerpc/aim/platform_chrp.c ============================================================================== --- head/sys/powerpc/aim/platform_chrp.c Wed Jun 10 12:20:11 2009 (r193908) +++ head/sys/powerpc/aim/platform_chrp.c Wed Jun 10 12:47:54 2009 (r193909) @@ -102,7 +102,7 @@ static u_long chrp_timebase_freq(platform_t plat, struct cpuref *cpuref) { phandle_t phandle; - u_long ticks = -1; + long ticks = -1; phandle = cpuref->cr_hwref; @@ -122,8 +122,14 @@ chrp_smp_fill_cpuref(struct cpuref *cpur cpuref->cr_hwref = cpu; res = OF_getprop(cpu, "reg", &cpuid, sizeof(cpuid)); - if (res < 0) - return (ENOENT); + + /* + * psim doesn't have a reg property, so assume 0 as for the + * uniprocessor case in the CHRP spec. + */ + if (res < 0) { + cpuid = 0; + } cpuref->cr_cpuid = cpuid & 0xff; return (0); @@ -145,10 +151,18 @@ chrp_smp_first_cpu(platform_t plat, stru break; dev = OF_peer(dev); } - if (dev == 0) - return (ENOENT); + if (dev == 0) { + /* + * psim doesn't have a name property on the /cpus node, + * but it can be found directly + */ + dev = OF_finddevice("/cpus"); + if (dev == 0) + return (ENOENT); + } cpu = OF_child(dev); + while (cpu != 0) { res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); if (res > 0 && strcmp(buf, "cpu") == 0) Modified: head/sys/powerpc/powerpc/openpic.c ============================================================================== --- head/sys/powerpc/powerpc/openpic.c Wed Jun 10 12:20:11 2009 (r193908) +++ head/sys/powerpc/powerpc/openpic.c Wed Jun 10 12:47:54 2009 (r193909) @@ -122,10 +122,12 @@ openpic_attach(device_t dev) OPENPIC_FEATURE_LAST_IRQ_SHIFT) + 1; /* - * PSIM seems to report 1 too many IRQs + * PSIM seems to report 1 too many IRQs and CPUs */ - if (sc->sc_psim) + if (sc->sc_psim) { sc->sc_nirq--; + sc->sc_ncpu--; + } if (bootverbose) device_printf(dev,