malta_cchip.cc revision 11321
15222Sksewell@umich.edu/* 25222Sksewell@umich.edu * Copyright (c) 2004-2005 The Regents of The University of Michigan 35222Sksewell@umich.edu * All rights reserved. 45222Sksewell@umich.edu * 55222Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without 65222Sksewell@umich.edu * modification, are permitted provided that the following conditions are 75222Sksewell@umich.edu * met: redistributions of source code must retain the above copyright 85222Sksewell@umich.edu * notice, this list of conditions and the following disclaimer; 95222Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright 105222Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the 115222Sksewell@umich.edu * documentation and/or other materials provided with the distribution; 125222Sksewell@umich.edu * neither the name of the copyright holders nor the names of its 135222Sksewell@umich.edu * contributors may be used to endorse or promote products derived from 145222Sksewell@umich.edu * this software without specific prior written permission. 155222Sksewell@umich.edu * 165222Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 175222Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 185222Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 195222Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 205222Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 215222Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 225222Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235222Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 245222Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255222Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 265222Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 275222Sksewell@umich.edu * 285222Sksewell@umich.edu * Authors: Ali Saidi 295222Sksewell@umich.edu * Rick Strong 305222Sksewell@umich.edu */ 315222Sksewell@umich.edu 325222Sksewell@umich.edu/** @file 335222Sksewell@umich.edu * Emulation of the Malta CChip CSRs 345222Sksewell@umich.edu */ 355222Sksewell@umich.edu 365222Sksewell@umich.edu#include <deque> 375222Sksewell@umich.edu#include <string> 385222Sksewell@umich.edu#include <vector> 395222Sksewell@umich.edu 405222Sksewell@umich.edu#include "base/trace.hh" 416658Snate@binkert.org#include "config/the_isa.hh" 425222Sksewell@umich.edu#include "cpu/intr_control.hh" 435222Sksewell@umich.edu#include "cpu/thread_context.hh" 448739Sgblack@eecs.umich.edu#include "debug/Malta.hh" 455222Sksewell@umich.edu#include "dev/mips/malta.hh" 465222Sksewell@umich.edu#include "dev/mips/malta_cchip.hh" 475222Sksewell@umich.edu#include "dev/mips/maltareg.h" 485222Sksewell@umich.edu#include "mem/packet.hh" 495222Sksewell@umich.edu#include "mem/packet_access.hh" 505222Sksewell@umich.edu#include "mem/port.hh" 515222Sksewell@umich.edu#include "params/MaltaCChip.hh" 525222Sksewell@umich.edu#include "sim/system.hh" 535222Sksewell@umich.edu 545222Sksewell@umich.eduusing namespace std; 555222Sksewell@umich.eduusing namespace TheISA; 565222Sksewell@umich.edu 575222Sksewell@umich.eduMaltaCChip::MaltaCChip(Params *p) 589808Sstever@gmail.com : BasicPioDevice(p, 0xfffffff), malta(p->malta) 595222Sksewell@umich.edu{ 606658Snate@binkert.org warn("MaltaCCHIP::MaltaCChip() not implemented."); 615222Sksewell@umich.edu 625222Sksewell@umich.edu //Put back pointer in malta 635222Sksewell@umich.edu malta->cchip = this; 645222Sksewell@umich.edu 655222Sksewell@umich.edu} 665222Sksewell@umich.edu 675222Sksewell@umich.eduTick 685222Sksewell@umich.eduMaltaCChip::read(PacketPtr pkt) 695222Sksewell@umich.edu{ 705222Sksewell@umich.edu panic("MaltaCCHIP::read() not implemented."); 715222Sksewell@umich.edu return pioDelay; 725222Sksewell@umich.edu /* 735222Sksewell@umich.edu DPRINTF(Malta, "read va=%#x size=%d\n", pkt->getAddr(), pkt->getSize()); 745222Sksewell@umich.edu 755222Sksewell@umich.edu assert(pkt->result == Packet::Unknown); 765222Sksewell@umich.edu assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize); 775222Sksewell@umich.edu 785222Sksewell@umich.edu Addr regnum = (pkt->getAddr() - pioAddr) >> 6; 795222Sksewell@umich.edu Addr daddr = (pkt->getAddr() - pioAddr); 805222Sksewell@umich.edu 815222Sksewell@umich.edu switch (pkt->getSize()) { 825222Sksewell@umich.edu 835222Sksewell@umich.edu case sizeof(uint64_t): 845222Sksewell@umich.edu if (daddr & TSDEV_CC_BDIMS) 855222Sksewell@umich.edu { 865222Sksewell@umich.edu pkt->set(dim[(daddr >> 4) & 0x3F]); 875222Sksewell@umich.edu break; 885222Sksewell@umich.edu } 895222Sksewell@umich.edu 905222Sksewell@umich.edu if (daddr & TSDEV_CC_BDIRS) 915222Sksewell@umich.edu { 925222Sksewell@umich.edu pkt->set(dir[(daddr >> 4) & 0x3F]); 935222Sksewell@umich.edu break; 945222Sksewell@umich.edu } 955222Sksewell@umich.edu 965222Sksewell@umich.edu switch(regnum) { 975222Sksewell@umich.edu case TSDEV_CC_CSR: 985222Sksewell@umich.edu pkt->set(0x0); 995222Sksewell@umich.edu break; 1005222Sksewell@umich.edu case TSDEV_CC_MTR: 1015222Sksewell@umich.edu panic("TSDEV_CC_MTR not implemeted\n"); 1025222Sksewell@umich.edu break; 1035222Sksewell@umich.edu case TSDEV_CC_MISC: 1045222Sksewell@umich.edu pkt->set((ipint << 8) & 0xF | (itint << 4) & 0xF | 1055714Shsul@eecs.umich.edu (pkt->req->contextId() & 0x3)); 1065222Sksewell@umich.edu break; 1075222Sksewell@umich.edu case TSDEV_CC_AAR0: 1085222Sksewell@umich.edu case TSDEV_CC_AAR1: 1095222Sksewell@umich.edu case TSDEV_CC_AAR2: 1105222Sksewell@umich.edu case TSDEV_CC_AAR3: 1115222Sksewell@umich.edu pkt->set(0); 1125222Sksewell@umich.edu break; 1135222Sksewell@umich.edu case TSDEV_CC_DIM0: 1145222Sksewell@umich.edu pkt->set(dim[0]); 1155222Sksewell@umich.edu break; 1165222Sksewell@umich.edu case TSDEV_CC_DIM1: 1175222Sksewell@umich.edu pkt->set(dim[1]); 1185222Sksewell@umich.edu break; 1195222Sksewell@umich.edu case TSDEV_CC_DIM2: 1205222Sksewell@umich.edu pkt->set(dim[2]); 1215222Sksewell@umich.edu break; 1225222Sksewell@umich.edu case TSDEV_CC_DIM3: 1235222Sksewell@umich.edu pkt->set(dim[3]); 1245222Sksewell@umich.edu break; 1255222Sksewell@umich.edu case TSDEV_CC_DIR0: 1265222Sksewell@umich.edu pkt->set(dir[0]); 1275222Sksewell@umich.edu break; 1285222Sksewell@umich.edu case TSDEV_CC_DIR1: 1295222Sksewell@umich.edu pkt->set(dir[1]); 1305222Sksewell@umich.edu break; 1315222Sksewell@umich.edu case TSDEV_CC_DIR2: 1325222Sksewell@umich.edu pkt->set(dir[2]); 1335222Sksewell@umich.edu break; 1345222Sksewell@umich.edu case TSDEV_CC_DIR3: 1355222Sksewell@umich.edu pkt->set(dir[3]); 1365222Sksewell@umich.edu break; 1375222Sksewell@umich.edu case TSDEV_CC_DRIR: 1385222Sksewell@umich.edu pkt->set(drir); 1395222Sksewell@umich.edu break; 1405222Sksewell@umich.edu case TSDEV_CC_PRBEN: 1415222Sksewell@umich.edu panic("TSDEV_CC_PRBEN not implemented\n"); 1425222Sksewell@umich.edu break; 1435222Sksewell@umich.edu case TSDEV_CC_IIC0: 1445222Sksewell@umich.edu case TSDEV_CC_IIC1: 1455222Sksewell@umich.edu case TSDEV_CC_IIC2: 1465222Sksewell@umich.edu case TSDEV_CC_IIC3: 1475222Sksewell@umich.edu panic("TSDEV_CC_IICx not implemented\n"); 1485222Sksewell@umich.edu break; 1495222Sksewell@umich.edu case TSDEV_CC_MPR0: 1505222Sksewell@umich.edu case TSDEV_CC_MPR1: 1515222Sksewell@umich.edu case TSDEV_CC_MPR2: 1525222Sksewell@umich.edu case TSDEV_CC_MPR3: 1535222Sksewell@umich.edu panic("TSDEV_CC_MPRx not implemented\n"); 1545222Sksewell@umich.edu break; 1555222Sksewell@umich.edu case TSDEV_CC_IPIR: 1565222Sksewell@umich.edu pkt->set(ipint); 1575222Sksewell@umich.edu break; 1585222Sksewell@umich.edu case TSDEV_CC_ITIR: 1595222Sksewell@umich.edu pkt->set(itint); 1605222Sksewell@umich.edu break; 1615222Sksewell@umich.edu default: 1625222Sksewell@umich.edu panic("default in cchip read reached, accessing 0x%x\n"); 1635222Sksewell@umich.edu } // uint64_t 1645222Sksewell@umich.edu 1655222Sksewell@umich.edu break; 1665222Sksewell@umich.edu case sizeof(uint32_t): 1675222Sksewell@umich.edu case sizeof(uint16_t): 1685222Sksewell@umich.edu case sizeof(uint8_t): 1695222Sksewell@umich.edu default: 1705222Sksewell@umich.edu panic("invalid access size(?) for malta register!\n"); 1715222Sksewell@umich.edu } 1725222Sksewell@umich.edu DPRINTF(Malta, "Malta CChip: read regnum=%#x size=%d data=%lld\n", 1735222Sksewell@umich.edu regnum, pkt->getSize(), pkt->get<uint64_t>()); 1745222Sksewell@umich.edu 1755222Sksewell@umich.edu pkt->result = Packet::Success; 1765222Sksewell@umich.edu return pioDelay; 1775222Sksewell@umich.edu */ 1785222Sksewell@umich.edu} 1795222Sksewell@umich.edu 1805222Sksewell@umich.eduTick 1815222Sksewell@umich.eduMaltaCChip::write(PacketPtr pkt) 1825222Sksewell@umich.edu{ 1835222Sksewell@umich.edu panic("MaltaCCHIP::write() not implemented."); 1845222Sksewell@umich.edu return pioDelay; 1855222Sksewell@umich.edu /* 1865222Sksewell@umich.edu assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize); 1875222Sksewell@umich.edu Addr daddr = pkt->getAddr() - pioAddr; 1885222Sksewell@umich.edu Addr regnum = (pkt->getAddr() - pioAddr) >> 6 ; 1895222Sksewell@umich.edu 1905222Sksewell@umich.edu 1915222Sksewell@umich.edu assert(pkt->getSize() == sizeof(uint64_t)); 1925222Sksewell@umich.edu 1935222Sksewell@umich.edu DPRINTF(Malta, "write - addr=%#x value=%#x\n", pkt->getAddr(), pkt->get<uint64_t>()); 1945222Sksewell@umich.edu 1955222Sksewell@umich.edu bool supportedWrite = false; 1965222Sksewell@umich.edu 1975222Sksewell@umich.edu 1985222Sksewell@umich.edu if (daddr & TSDEV_CC_BDIMS) 1995222Sksewell@umich.edu { 2005222Sksewell@umich.edu int number = (daddr >> 4) & 0x3F; 2015222Sksewell@umich.edu 2025222Sksewell@umich.edu uint64_t bitvector; 2035222Sksewell@umich.edu uint64_t olddim; 2045222Sksewell@umich.edu uint64_t olddir; 2055222Sksewell@umich.edu 2065222Sksewell@umich.edu olddim = dim[number]; 2075222Sksewell@umich.edu olddir = dir[number]; 2085222Sksewell@umich.edu dim[number] = pkt->get<uint64_t>(); 2095222Sksewell@umich.edu dir[number] = dim[number] & drir; 21011321Ssteve.reinhardt@amd.com for (int x = 0; x < Malta::Max_CPUs; x++) 2115222Sksewell@umich.edu { 2125222Sksewell@umich.edu bitvector = ULL(1) << x; 2135222Sksewell@umich.edu // Figure out which bits have changed 2145222Sksewell@umich.edu if ((dim[number] & bitvector) != (olddim & bitvector)) 2155222Sksewell@umich.edu { 2165222Sksewell@umich.edu // The bit is now set and it wasn't before (set) 21711321Ssteve.reinhardt@amd.com if ((dim[number] & bitvector) && (dir[number] & bitvector)) 2185222Sksewell@umich.edu { 2195222Sksewell@umich.edu malta->intrctrl->post(number, TheISA::INTLEVEL_IRQ1, x); 2205222Sksewell@umich.edu DPRINTF(Malta, "dim write resulting in posting dir" 2215222Sksewell@umich.edu " interrupt to cpu %d\n", number); 2225222Sksewell@umich.edu } 2235222Sksewell@umich.edu else if ((olddir & bitvector) && 2245222Sksewell@umich.edu !(dir[number] & bitvector)) 2255222Sksewell@umich.edu { 2265222Sksewell@umich.edu // The bit was set and now its now clear and 2275222Sksewell@umich.edu // we were interrupting on that bit before 2285222Sksewell@umich.edu malta->intrctrl->clear(number, TheISA::INTLEVEL_IRQ1, x); 2295222Sksewell@umich.edu DPRINTF(Malta, "dim write resulting in clear" 2305222Sksewell@umich.edu " dir interrupt to cpu %d\n", number); 2315222Sksewell@umich.edu 2325222Sksewell@umich.edu } 2335222Sksewell@umich.edu 2345222Sksewell@umich.edu 2355222Sksewell@umich.edu } 2365222Sksewell@umich.edu } 2375222Sksewell@umich.edu } else { 2385222Sksewell@umich.edu switch(regnum) { 2395222Sksewell@umich.edu case TSDEV_CC_CSR: 2405222Sksewell@umich.edu panic("TSDEV_CC_CSR write\n"); 2415222Sksewell@umich.edu case TSDEV_CC_MTR: 2425222Sksewell@umich.edu panic("TSDEV_CC_MTR write not implemented\n"); 2435222Sksewell@umich.edu case TSDEV_CC_MISC: 2445222Sksewell@umich.edu uint64_t ipreq; 2455222Sksewell@umich.edu ipreq = (pkt->get<uint64_t>() >> 12) & 0xF; 2465222Sksewell@umich.edu //If it is bit 12-15, this is an IPI post 2475222Sksewell@umich.edu if (ipreq) { 2485222Sksewell@umich.edu reqIPI(ipreq); 2495222Sksewell@umich.edu supportedWrite = true; 2505222Sksewell@umich.edu } 2515222Sksewell@umich.edu 2525222Sksewell@umich.edu //If it is bit 8-11, this is an IPI clear 2535222Sksewell@umich.edu uint64_t ipintr; 2545222Sksewell@umich.edu ipintr = (pkt->get<uint64_t>() >> 8) & 0xF; 2555222Sksewell@umich.edu if (ipintr) { 2565222Sksewell@umich.edu clearIPI(ipintr); 2575222Sksewell@umich.edu supportedWrite = true; 2585222Sksewell@umich.edu } 2595222Sksewell@umich.edu 2605222Sksewell@umich.edu //If it is the 4-7th bit, clear the RTC interrupt 2615222Sksewell@umich.edu uint64_t itintr; 2625222Sksewell@umich.edu itintr = (pkt->get<uint64_t>() >> 4) & 0xF; 2635222Sksewell@umich.edu if (itintr) { 2645222Sksewell@umich.edu clearITI(itintr); 2655222Sksewell@umich.edu supportedWrite = true; 2665222Sksewell@umich.edu } 2675222Sksewell@umich.edu 2685222Sksewell@umich.edu // ignore NXMs 2695222Sksewell@umich.edu if (pkt->get<uint64_t>() & 0x10000000) 2705222Sksewell@umich.edu supportedWrite = true; 2715222Sksewell@umich.edu 27211321Ssteve.reinhardt@amd.com if (!supportedWrite) 2735222Sksewell@umich.edu panic("TSDEV_CC_MISC write not implemented\n"); 2745222Sksewell@umich.edu 2755222Sksewell@umich.edu break; 2765222Sksewell@umich.edu case TSDEV_CC_AAR0: 2775222Sksewell@umich.edu case TSDEV_CC_AAR1: 2785222Sksewell@umich.edu case TSDEV_CC_AAR2: 2795222Sksewell@umich.edu case TSDEV_CC_AAR3: 2805222Sksewell@umich.edu panic("TSDEV_CC_AARx write not implemeted\n"); 2815222Sksewell@umich.edu case TSDEV_CC_DIM0: 2825222Sksewell@umich.edu case TSDEV_CC_DIM1: 2835222Sksewell@umich.edu case TSDEV_CC_DIM2: 2845222Sksewell@umich.edu case TSDEV_CC_DIM3: 2855222Sksewell@umich.edu int number; 28611321Ssteve.reinhardt@amd.com if (regnum == TSDEV_CC_DIM0) 2875222Sksewell@umich.edu number = 0; 28811321Ssteve.reinhardt@amd.com else if (regnum == TSDEV_CC_DIM1) 2895222Sksewell@umich.edu number = 1; 29011321Ssteve.reinhardt@amd.com else if (regnum == TSDEV_CC_DIM2) 2915222Sksewell@umich.edu number = 2; 2925222Sksewell@umich.edu else 2935222Sksewell@umich.edu number = 3; 2945222Sksewell@umich.edu 2955222Sksewell@umich.edu uint64_t bitvector; 2965222Sksewell@umich.edu uint64_t olddim; 2975222Sksewell@umich.edu uint64_t olddir; 2985222Sksewell@umich.edu 2995222Sksewell@umich.edu olddim = dim[number]; 3005222Sksewell@umich.edu olddir = dir[number]; 3015222Sksewell@umich.edu dim[number] = pkt->get<uint64_t>(); 3025222Sksewell@umich.edu dir[number] = dim[number] & drir; 30311321Ssteve.reinhardt@amd.com for (int x = 0; x < 64; x++) 3045222Sksewell@umich.edu { 3055222Sksewell@umich.edu bitvector = ULL(1) << x; 3065222Sksewell@umich.edu // Figure out which bits have changed 3075222Sksewell@umich.edu if ((dim[number] & bitvector) != (olddim & bitvector)) 3085222Sksewell@umich.edu { 3095222Sksewell@umich.edu // The bit is now set and it wasn't before (set) 31011321Ssteve.reinhardt@amd.com if ((dim[number] & bitvector) && (dir[number] & bitvector)) 3115222Sksewell@umich.edu { 3125222Sksewell@umich.edu malta->intrctrl->post(number, TheISA::INTLEVEL_IRQ1, x); 3135222Sksewell@umich.edu DPRINTF(Malta, "posting dir interrupt to cpu 0\n"); 3145222Sksewell@umich.edu } 3155222Sksewell@umich.edu else if ((olddir & bitvector) && 3165222Sksewell@umich.edu !(dir[number] & bitvector)) 3175222Sksewell@umich.edu { 3185222Sksewell@umich.edu // The bit was set and now its now clear and 3195222Sksewell@umich.edu // we were interrupting on that bit before 3205222Sksewell@umich.edu malta->intrctrl->clear(number, TheISA::INTLEVEL_IRQ1, x); 3215222Sksewell@umich.edu DPRINTF(Malta, "dim write resulting in clear" 3225222Sksewell@umich.edu " dir interrupt to cpu %d\n", 3235222Sksewell@umich.edu x); 3245222Sksewell@umich.edu 3255222Sksewell@umich.edu } 3265222Sksewell@umich.edu 3275222Sksewell@umich.edu 3285222Sksewell@umich.edu } 3295222Sksewell@umich.edu } 3305222Sksewell@umich.edu break; 3315222Sksewell@umich.edu case TSDEV_CC_DIR0: 3325222Sksewell@umich.edu case TSDEV_CC_DIR1: 3335222Sksewell@umich.edu case TSDEV_CC_DIR2: 3345222Sksewell@umich.edu case TSDEV_CC_DIR3: 3355222Sksewell@umich.edu panic("TSDEV_CC_DIR write not implemented\n"); 3365222Sksewell@umich.edu case TSDEV_CC_DRIR: 3375222Sksewell@umich.edu panic("TSDEV_CC_DRIR write not implemented\n"); 3385222Sksewell@umich.edu case TSDEV_CC_PRBEN: 3395222Sksewell@umich.edu panic("TSDEV_CC_PRBEN write not implemented\n"); 3405222Sksewell@umich.edu case TSDEV_CC_IIC0: 3415222Sksewell@umich.edu case TSDEV_CC_IIC1: 3425222Sksewell@umich.edu case TSDEV_CC_IIC2: 3435222Sksewell@umich.edu case TSDEV_CC_IIC3: 3445222Sksewell@umich.edu panic("TSDEV_CC_IICx write not implemented\n"); 3455222Sksewell@umich.edu case TSDEV_CC_MPR0: 3465222Sksewell@umich.edu case TSDEV_CC_MPR1: 3475222Sksewell@umich.edu case TSDEV_CC_MPR2: 3485222Sksewell@umich.edu case TSDEV_CC_MPR3: 3495222Sksewell@umich.edu panic("TSDEV_CC_MPRx write not implemented\n"); 3505222Sksewell@umich.edu case TSDEV_CC_IPIR: 3515222Sksewell@umich.edu clearIPI(pkt->get<uint64_t>()); 3525222Sksewell@umich.edu break; 3535222Sksewell@umich.edu case TSDEV_CC_ITIR: 3545222Sksewell@umich.edu clearITI(pkt->get<uint64_t>()); 3555222Sksewell@umich.edu break; 3565222Sksewell@umich.edu case TSDEV_CC_IPIQ: 3575222Sksewell@umich.edu reqIPI(pkt->get<uint64_t>()); 3585222Sksewell@umich.edu break; 3595222Sksewell@umich.edu default: 3605222Sksewell@umich.edu panic("default in cchip read reached, accessing 0x%x\n"); 3615222Sksewell@umich.edu } // swtich(regnum) 3625222Sksewell@umich.edu } // not BIG_TSUNAMI write 3635222Sksewell@umich.edu pkt->result = Packet::Success; 3645222Sksewell@umich.edu return pioDelay; 3655222Sksewell@umich.edu */ 3665222Sksewell@umich.edu} 3675222Sksewell@umich.edu 3685222Sksewell@umich.eduvoid 3695222Sksewell@umich.eduMaltaCChip::clearIPI(uint64_t ipintr) 3705222Sksewell@umich.edu{ 3715222Sksewell@umich.edu panic("MaltaCCHIP::clear() not implemented."); 3725222Sksewell@umich.edu /* 3735222Sksewell@umich.edu int numcpus = malta->intrctrl->cpu->system->threadContexts.size(); 3745222Sksewell@umich.edu assert(numcpus <= Malta::Max_CPUs); 3755222Sksewell@umich.edu 3765222Sksewell@umich.edu if (ipintr) { 3775222Sksewell@umich.edu for (int cpunum=0; cpunum < numcpus; cpunum++) { 3785222Sksewell@umich.edu // Check each cpu bit 3795222Sksewell@umich.edu uint64_t cpumask = ULL(1) << cpunum; 3805222Sksewell@umich.edu if (ipintr & cpumask) { 3815222Sksewell@umich.edu // Check if there is a pending ipi 3825222Sksewell@umich.edu if (ipint & cpumask) { 3835222Sksewell@umich.edu ipint &= ~cpumask; 3845222Sksewell@umich.edu malta->intrctrl->clear(cpunum, TheISA::INTLEVEL_IRQ3, 0); 3855222Sksewell@umich.edu DPRINTF(IPI, "clear IPI IPI cpu=%d\n", cpunum); 3865222Sksewell@umich.edu } 3875222Sksewell@umich.edu else 3885222Sksewell@umich.edu warn("clear IPI for CPU=%d, but NO IPI\n", cpunum); 3895222Sksewell@umich.edu } 3905222Sksewell@umich.edu } 3915222Sksewell@umich.edu } 3925222Sksewell@umich.edu else 3935222Sksewell@umich.edu panic("Big IPI Clear, but not processors indicated\n"); 3945222Sksewell@umich.edu */ 3955222Sksewell@umich.edu} 3965222Sksewell@umich.edu 3975222Sksewell@umich.eduvoid 3985222Sksewell@umich.eduMaltaCChip::clearITI(uint64_t itintr) 3995222Sksewell@umich.edu{ 4005222Sksewell@umich.edu panic("MaltaCCHIP::clearITI() not implemented."); 4015222Sksewell@umich.edu /* 4025222Sksewell@umich.edu int numcpus = malta->intrctrl->cpu->system->threadContexts.size(); 4035222Sksewell@umich.edu assert(numcpus <= Malta::Max_CPUs); 4045222Sksewell@umich.edu 4055222Sksewell@umich.edu if (itintr) { 4065222Sksewell@umich.edu for (int i=0; i < numcpus; i++) { 4075222Sksewell@umich.edu uint64_t cpumask = ULL(1) << i; 4085222Sksewell@umich.edu if (itintr & cpumask & itint) { 4095222Sksewell@umich.edu malta->intrctrl->clear(i, TheISA::INTLEVEL_IRQ2, 0); 4105222Sksewell@umich.edu itint &= ~cpumask; 4115222Sksewell@umich.edu DPRINTF(Malta, "clearing rtc interrupt to cpu=%d\n", i); 4125222Sksewell@umich.edu } 4135222Sksewell@umich.edu } 4145222Sksewell@umich.edu } 4155222Sksewell@umich.edu else 4165222Sksewell@umich.edu panic("Big ITI Clear, but not processors indicated\n"); 4175222Sksewell@umich.edu */ 4185222Sksewell@umich.edu} 4195222Sksewell@umich.edu 4205222Sksewell@umich.eduvoid 4215222Sksewell@umich.eduMaltaCChip::reqIPI(uint64_t ipreq) 4225222Sksewell@umich.edu{ 4235222Sksewell@umich.edu panic("MaltaCCHIP::reqIPI() not implemented."); 4245222Sksewell@umich.edu 4255222Sksewell@umich.edu /* 4265222Sksewell@umich.edu int numcpus = malta->intrctrl->cpu->system->threadContexts.size(); 4275222Sksewell@umich.edu assert(numcpus <= Malta::Max_CPUs); 4285222Sksewell@umich.edu 4295222Sksewell@umich.edu if (ipreq) { 4305222Sksewell@umich.edu for (int cpunum=0; cpunum < numcpus; cpunum++) { 4315222Sksewell@umich.edu // Check each cpu bit 4325222Sksewell@umich.edu uint64_t cpumask = ULL(1) << cpunum; 4335222Sksewell@umich.edu if (ipreq & cpumask) { 4345222Sksewell@umich.edu // Check if there is already an ipi (bits 8:11) 4355222Sksewell@umich.edu if (!(ipint & cpumask)) { 4365222Sksewell@umich.edu ipint |= cpumask; 4375222Sksewell@umich.edu malta->intrctrl->post(cpunum, TheISA::INTLEVEL_IRQ3, 0); 4385222Sksewell@umich.edu DPRINTF(IPI, "send IPI cpu=%d\n", cpunum); 4395222Sksewell@umich.edu } 4405222Sksewell@umich.edu else 4415222Sksewell@umich.edu warn("post IPI for CPU=%d, but IPI already\n", cpunum); 4425222Sksewell@umich.edu } 4435222Sksewell@umich.edu } 4445222Sksewell@umich.edu } 4455222Sksewell@umich.edu else 4465222Sksewell@umich.edu panic("Big IPI Request, but not processors indicated\n"); 4475222Sksewell@umich.edu */ 4485222Sksewell@umich.edu 4495222Sksewell@umich.edu} 4505222Sksewell@umich.edu 4515222Sksewell@umich.edu 4525222Sksewell@umich.eduvoid 4535222Sksewell@umich.eduMaltaCChip::postRTC() 4545222Sksewell@umich.edu{ 4555222Sksewell@umich.edu panic("MaltaCCHIP::postRTC() not implemented."); 4565222Sksewell@umich.edu 4575222Sksewell@umich.edu /* 4585222Sksewell@umich.edu int size = malta->intrctrl->cpu->system->threadContexts.size(); 4595222Sksewell@umich.edu assert(size <= Malta::Max_CPUs); 4605222Sksewell@umich.edu 4615222Sksewell@umich.edu for (int i = 0; i < size; i++) { 4625222Sksewell@umich.edu uint64_t cpumask = ULL(1) << i; 4635222Sksewell@umich.edu if (!(cpumask & itint)) { 4645222Sksewell@umich.edu itint |= cpumask; 4655222Sksewell@umich.edu malta->intrctrl->post(i, TheISA::INTLEVEL_IRQ2, 0); 4665222Sksewell@umich.edu DPRINTF(Malta, "Posting RTC interrupt to cpu=%d", i); 4675222Sksewell@umich.edu } 4685222Sksewell@umich.edu } 4695222Sksewell@umich.edu */ 4705222Sksewell@umich.edu 4715222Sksewell@umich.edu} 4725222Sksewell@umich.edu 4735222Sksewell@umich.eduvoid 4745222Sksewell@umich.eduMaltaCChip::postIntr(uint32_t interrupt) 4755222Sksewell@umich.edu{ 4765222Sksewell@umich.edu uint64_t size = sys->threadContexts.size(); 4775222Sksewell@umich.edu assert(size <= Malta::Max_CPUs); 4785222Sksewell@umich.edu 47911321Ssteve.reinhardt@amd.com for (int i=0; i < size; i++) { 4805222Sksewell@umich.edu //Note: Malta does not use index, but this was added to use the pre-existing implementation 4815222Sksewell@umich.edu malta->intrctrl->post(i, interrupt, 0); 4825222Sksewell@umich.edu DPRINTF(Malta, "posting interrupt to cpu %d," 4835222Sksewell@umich.edu "interrupt %d\n",i, interrupt); 4845222Sksewell@umich.edu } 4855222Sksewell@umich.edu 4865222Sksewell@umich.edu} 4875222Sksewell@umich.edu 4885222Sksewell@umich.eduvoid 4895222Sksewell@umich.eduMaltaCChip::clearIntr(uint32_t interrupt) 4905222Sksewell@umich.edu{ 4915222Sksewell@umich.edu uint64_t size = sys->threadContexts.size(); 4925222Sksewell@umich.edu assert(size <= Malta::Max_CPUs); 4935222Sksewell@umich.edu 49411321Ssteve.reinhardt@amd.com for (int i=0; i < size; i++) { 4955222Sksewell@umich.edu //Note: Malta does not use index, but this was added to use the pre-existing implementation 4965222Sksewell@umich.edu malta->intrctrl->clear(i, interrupt, 0); 4975222Sksewell@umich.edu DPRINTF(Malta, "clearing interrupt to cpu %d," 4985222Sksewell@umich.edu "interrupt %d\n",i, interrupt); 4995222Sksewell@umich.edu } 5005222Sksewell@umich.edu} 5015222Sksewell@umich.edu 5025222Sksewell@umich.edu 5035222Sksewell@umich.eduvoid 50410905Sandreas.sandberg@arm.comMaltaCChip::serialize(CheckpointOut &cp) const 5055222Sksewell@umich.edu{ 5065222Sksewell@umich.edu // SERIALIZE_ARRAY(dim, Malta::Max_CPUs); 5075222Sksewell@umich.edu //SERIALIZE_ARRAY(dir, Malta::Max_CPUs); 5085222Sksewell@umich.edu //SERIALIZE_SCALAR(ipint); 5095222Sksewell@umich.edu //SERIALIZE_SCALAR(itint); 5105222Sksewell@umich.edu //SERIALIZE_SCALAR(drir); 5115222Sksewell@umich.edu} 5125222Sksewell@umich.edu 5135222Sksewell@umich.eduvoid 51410905Sandreas.sandberg@arm.comMaltaCChip::unserialize(CheckpointIn &cp) 5155222Sksewell@umich.edu{ 5165222Sksewell@umich.edu //UNSERIALIZE_ARRAY(dim, Malta::Max_CPUs); 5175222Sksewell@umich.edu //UNSERIALIZE_ARRAY(dir, Malta::Max_CPUs); 5185222Sksewell@umich.edu //UNSERIALIZE_SCALAR(ipint); 5195222Sksewell@umich.edu //UNSERIALIZE_SCALAR(itint); 5205222Sksewell@umich.edu //UNSERIALIZE_SCALAR(drir); 5215222Sksewell@umich.edu} 5225222Sksewell@umich.edu 5235222Sksewell@umich.eduMaltaCChip * 5245222Sksewell@umich.eduMaltaCChipParams::create() 5255222Sksewell@umich.edu{ 5265222Sksewell@umich.edu return new MaltaCChip(this); 5275222Sksewell@umich.edu} 5285222Sksewell@umich.edu 529