a9scu.cc revision 8282
16657Snate@binkert.org/* 26657Snate@binkert.org * Copyright (c) 2010 ARM Limited 36657Snate@binkert.org * All rights reserved 46657Snate@binkert.org * 56657Snate@binkert.org * The license below extends only to copyright in the software and shall 66657Snate@binkert.org * not be construed as granting a license to any other intellectual 76657Snate@binkert.org * property including but not limited to intellectual property relating 86657Snate@binkert.org * to a hardware implementation of the functionality of the software 96657Snate@binkert.org * licensed hereunder. You may use the software subject to the license 106657Snate@binkert.org * terms below provided that you ensure that this notice is replicated 116657Snate@binkert.org * unmodified and in its entirety in all distributions of the software, 126657Snate@binkert.org * modified or unmodified, in source code or in binary form. 136657Snate@binkert.org * 146657Snate@binkert.org * Redistribution and use in source and binary forms, with or without 156657Snate@binkert.org * modification, are permitted provided that the following conditions are 166657Snate@binkert.org * met: redistributions of source code must retain the above copyright 176657Snate@binkert.org * notice, this list of conditions and the following disclaimer; 186657Snate@binkert.org * redistributions in binary form must reproduce the above copyright 196657Snate@binkert.org * notice, this list of conditions and the following disclaimer in the 206657Snate@binkert.org * documentation and/or other materials provided with the distribution; 216657Snate@binkert.org * neither the name of the copyright holders nor the names of its 226657Snate@binkert.org * contributors may be used to endorse or promote products derived from 236657Snate@binkert.org * this software without specific prior written permission. 246657Snate@binkert.org * 256657Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 266657Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 276657Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 286999Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 296657Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 306657Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 316657Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 326657Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 338189SLisa.Hsu@amd.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 346657Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 356882SBrad.Beckmann@amd.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 367055Snate@binkert.org * 376882SBrad.Beckmann@amd.com * Authors: Ali Saidi 386882SBrad.Beckmann@amd.com */ 398191SLisa.Hsu@amd.com 406882SBrad.Beckmann@amd.com#include "base/intmath.hh" 416882SBrad.Beckmann@amd.com#include "base/trace.hh" 426882SBrad.Beckmann@amd.com#include "dev/arm/a9scu.hh" 436888SBrad.Beckmann@amd.com#include "mem/packet.hh" 446882SBrad.Beckmann@amd.com#include "mem/packet_access.hh" 456882SBrad.Beckmann@amd.com#include "sim/system.hh" 466657Snate@binkert.org 476657Snate@binkert.orgA9SCU::A9SCU(Params *p) 486657Snate@binkert.org : BasicPioDevice(p) 496657Snate@binkert.org{ 506657Snate@binkert.org pioSize = 0x60; 517839Snilay@cs.wisc.edu} 526657Snate@binkert.org 536882SBrad.Beckmann@amd.comTick 546882SBrad.Beckmann@amd.comA9SCU::read(PacketPtr pkt) 556882SBrad.Beckmann@amd.com{ 566882SBrad.Beckmann@amd.com assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize); 576882SBrad.Beckmann@amd.com assert(pkt->getSize() == 4); 586882SBrad.Beckmann@amd.com Addr daddr = pkt->getAddr() - pioAddr; 596657Snate@binkert.org pkt->allocate(); 606657Snate@binkert.org 616657Snate@binkert.org switch(daddr) { 626657Snate@binkert.org case Control: 636657Snate@binkert.org pkt->set(1); // SCU already enabled 646657Snate@binkert.org break; 656657Snate@binkert.org case Config: 666657Snate@binkert.org assert(sys->numContexts() <= 4); 676657Snate@binkert.org int smp_bits, core_cnt; 687839Snilay@cs.wisc.edu smp_bits = power(2,sys->numContexts()) - 1; 697839Snilay@cs.wisc.edu core_cnt = sys->numContexts() - 1; 706657Snate@binkert.org pkt->set(smp_bits << 4 | core_cnt); 716657Snate@binkert.org break; 726657Snate@binkert.org default: 736657Snate@binkert.org // Only configuration register is implemented 746657Snate@binkert.org panic("Tried to read SCU at offset %#x\n", daddr); 756657Snate@binkert.org break; 766657Snate@binkert.org } 776657Snate@binkert.org pkt->makeAtomicResponse(); 786657Snate@binkert.org return pioDelay; 796657Snate@binkert.org 806657Snate@binkert.org} 816657Snate@binkert.org 826657Snate@binkert.orgTick 836657Snate@binkert.orgA9SCU::write(PacketPtr pkt) 846657Snate@binkert.org{ 856657Snate@binkert.org assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize); 866657Snate@binkert.org 876657Snate@binkert.org Addr daddr = pkt->getAddr() - pioAddr; 886657Snate@binkert.org switch (daddr) { 896657Snate@binkert.org default: 906779SBrad.Beckmann@amd.com // Nothing implemented at this point 916657Snate@binkert.org panic("Tried to write SCU at offset %#x\n", daddr); 926657Snate@binkert.org break; 936657Snate@binkert.org } 946657Snate@binkert.org pkt->makeAtomicResponse(); 956657Snate@binkert.org return pioDelay; 966657Snate@binkert.org} 976657Snate@binkert.org 986657Snate@binkert.orgA9SCU * 996657Snate@binkert.orgA9SCUParams::create() 1006657Snate@binkert.org{ 1016657Snate@binkert.org return new A9SCU(this); 1026657Snate@binkert.org} 1036657Snate@binkert.org