From owner-svn-src-head@freebsd.org Sat Jan 13 15:04:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77EC1E6D77A for ; Sat, 13 Jan 2018 15:04:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic302-35.consmr.mail.gq1.yahoo.com (sonic302-35.consmr.mail.gq1.yahoo.com [98.137.68.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F72268D36 for ; Sat, 13 Jan 2018 15:04:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1515855847; bh=Yxmxw+15H3urifUvE8WdrAXawTgyy4sj0j25Zx/QrYo=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=YVe2NYwhO+p8WdSWwrKPlYkBSyqlFBYHSlG1M1wq0aH41rK/bTgH10eJG/CK/UxpbZ45I6QTJPfPLSJIs4VBSl+vSQzA1PlIyRbpRh7vn+mKnj1dpSqdnPGqkU+gdRf9mhd5yZrAz5wqAVzgCGuFYSb8brCtcoWXvg9q/2pHmtS7LbGxrMrG6A3IoSQCmSkzRqxP9+Pu272CIMkmiJygOMjB78oEtkZNf3W4ZNtkiBkL+icRpkh6ngfz6oPvCPK081qZ9gn1kqV5FrxOeHFflU7P+Y12fS/JBOS8HgXMWCAP96NZlH7Fr9NR3pBuWbdOec3gu5wWBI+bMX7EuiTMEQ== X-YMail-OSG: _V4LkeYVM1n4o26SVaiMSiN5tC0YFGPxpZj6SJNgeav5DYc5NPUJfIpkUl7bjvv 5V8FtZUo3rKcRWkDvmMPszPfrjpDyshj4ItbLOIQ839zZQ4wSb.cDsYNa0mzsj2hcJggyaN695jb 4042JwZoO8UnD79dKd2dGxT9qFF16q6fzbE.keI4ETIs6sTH770IMyQn4XSr90UAlr9A5aVSNvJy ZqrxBGf_SOMlndgkkv2.VJLM4amJyDNr9VixMOD7bDlALhl3wI9V7hRA1odn0XSJ_ROKscW9IxL1 MAJfR.P_a9rygLssaQTY4w73A4wAiW86O_kBtw1vyTpA56IL_iEozQP0B8BOUqopV7YjwsU3AQKp 2AjrC_tiwQ440fhphwnh6JsDx3I2wuVGOM1DKCizoDeVmRuz32jBJ35Y_5QpDPyxDCtmyVdpbqjG RNiXM.S5hUT4I4rJrA2VFA5lgkimSzah9ElY98WFEXw0a.zqf7YqpJwA_iffN4N0JSXSQiBCT Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Sat, 13 Jan 2018 15:04:07 +0000 Received: from smtpgate104.mail.gq1.yahoo.com (EHLO [192.168.0.8]) ([10.215.136.172]) by smtp415.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID c6059abbb4b6d80597dfb2aa1b7eec8c; Sat, 13 Jan 2018 15:04:05 +0000 (UTC) Subject: Re: svn commit: r327906 - in head/sys: conf powerpc/mpc85xx To: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801130136.w0D1abhS054355@repo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <40f39e41-f051-0758-fe15-55c1dab64c9c@FreeBSD.org> Date: Sat, 13 Jan 2018 10:04:05 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801130136.w0D1abhS054355@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jan 2018 15:04:09 -0000 On 12/01/2018 20:36, Justin Hibbits wrote: > Author: jhibbits > Date: Sat Jan 13 01:36:37 2018 > New Revision: 327906 > URL: https://svnweb.freebsd.org/changeset/base/327906 > ... > > Added: head/sys/powerpc/mpc85xx/mpc85xx_cache.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/powerpc/mpc85xx/mpc85xx_cache.c Sat Jan 13 01:36:37 2018 (r327906) > @@ -0,0 +1,129 @@ > +/*- > + * Copyright (c) 2018 Justin Hibbits > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + Can we please add SPDX ID tags, specially on new code? I had them added to the guidelines: https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/pref-license.html It is just not fun for me anymore to go hunting for untagged files and they keep appearing ;). Pedro. > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +/* > + * From the P1022 manual, sequence for writing to L2CTL is: > + * - mbar > + * - isync > + * - write > + * - read > + * - mbar > + */ > +#define L2_CTL 0x0 > +#define L2CTL_L2E 0x80000000 > +#define L2CTL_L2I 0x40000000 > +struct mpc85xx_cache_softc { > + struct resource *sc_mem; > +}; > + > +static int > +mpc85xx_cache_probe(device_t dev) > +{ > + > + if (!ofw_bus_is_compatible(dev, "cache")) > + return (ENXIO); > + > + device_set_desc(dev, "MPC85xx L2 cache"); > + return (0); > +} > + > +static int > +mpc85xx_cache_attach(device_t dev) > +{ > + struct mpc85xx_cache_softc *sc = device_get_softc(dev); > + int rid; > + int cache_line_size, cache_size; > + > + /* Map registers. */ > + rid = 0; > + sc->sc_mem = bus_alloc_resource_any(dev, > + SYS_RES_MEMORY, &rid, RF_ACTIVE); > + if (sc->sc_mem == NULL) > + return (ENOMEM); > + > + /* Enable cache and flash invalidate. */ > + __asm __volatile ("mbar; isync" ::: "memory"); > + bus_write_4(sc->sc_mem, L2_CTL, L2CTL_L2E | L2CTL_L2I); > + bus_read_4(sc->sc_mem, L2_CTL); > + __asm __volatile ("mbar" ::: "memory"); > + > + cache_line_size = 0; > + cache_size = 0; > + OF_getencprop(ofw_bus_get_node(dev), "cache-size", &cache_size, > + sizeof(cache_size)); > + OF_getencprop(ofw_bus_get_node(dev), "cache-line-size", > + &cache_line_size, sizeof(cache_line_size)); > + > + if (cache_line_size != 0 && cache_size != 0) > + device_printf(dev, > + "L2 cache size: %dKB, cache line size: %d bytes\n", > + cache_size / 1024, cache_line_size); > + > + return (0); > +} > + > +static device_method_t mpc85xx_cache_methods[] = { > + /* device methods */ > + DEVMETHOD(device_probe, mpc85xx_cache_probe), > + DEVMETHOD(device_attach, mpc85xx_cache_attach), > + > + DEVMETHOD_END > +}; > + > +static driver_t mpc85xx_cache_driver = { > + "cache", > + mpc85xx_cache_methods, > + sizeof(struct mpc85xx_cache_softc), > +}; > +static devclass_t mpc85xx_cache_devclass; > + > +EARLY_DRIVER_MODULE(mpc85xx_cache, simplebus, mpc85xx_cache_driver, > + mpc85xx_cache_devclass, NULL, NULL, > + BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); >