intmessage.hh revision 6046
14120Sgblack@eecs.umich.edu/* 28839Sandreas.hansson@arm.com * Copyright (c) 2008 The Regents of The University of Michigan 38839Sandreas.hansson@arm.com * All rights reserved. 48839Sandreas.hansson@arm.com * 58839Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without 68839Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are 78839Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright 88839Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer; 98839Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright 108839Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the 118839Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution; 128839Sandreas.hansson@arm.com * neither the name of the copyright holders nor the names of its 138839Sandreas.hansson@arm.com * contributors may be used to endorse or promote products derived from 144120Sgblack@eecs.umich.edu * this software without specific prior written permission. 154120Sgblack@eecs.umich.edu * 164120Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 177087Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 187087Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 197087Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 207087Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 217087Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 227087Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 237087Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 247087Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254120Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 267087Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 277087Snate@binkert.org * 287087Snate@binkert.org * Authors: Gabe Black 297087Snate@binkert.org */ 307087Snate@binkert.org 317087Snate@binkert.org#ifndef __ARCH_X86_INTMESSAGE_HH__ 327087Snate@binkert.org#define __ARCH_X86_INTMESSAGE_HH__ 337087Snate@binkert.org 344120Sgblack@eecs.umich.edu#include "arch/x86/x86_traits.hh" 357087Snate@binkert.org#include "base/bitunion.hh" 364120Sgblack@eecs.umich.edu#include "mem/packet.hh" 374120Sgblack@eecs.umich.edu#include "mem/packet_access.hh" 384120Sgblack@eecs.umich.edu#include "mem/request.hh" 394120Sgblack@eecs.umich.edu#include "sim/host.hh" 404120Sgblack@eecs.umich.edu 414120Sgblack@eecs.umich.edunamespace X86ISA 424120Sgblack@eecs.umich.edu{ 434120Sgblack@eecs.umich.edu BitUnion32(TriggerIntMessage) 444120Sgblack@eecs.umich.edu Bitfield<7, 0> destination; 454120Sgblack@eecs.umich.edu Bitfield<15, 8> vector; 464120Sgblack@eecs.umich.edu Bitfield<18, 16> deliveryMode; 474120Sgblack@eecs.umich.edu Bitfield<19> destMode; 484120Sgblack@eecs.umich.edu Bitfield<20> level; 494120Sgblack@eecs.umich.edu Bitfield<21> trigger; 508839Sandreas.hansson@arm.com EndBitUnion(TriggerIntMessage) 514120Sgblack@eecs.umich.edu 524120Sgblack@eecs.umich.edu namespace DeliveryMode 534120Sgblack@eecs.umich.edu { 544120Sgblack@eecs.umich.edu enum IntDeliveryMode { 554120Sgblack@eecs.umich.edu Fixed = 0, 568229Snate@binkert.org LowestPriority = 1, 575086Sgblack@eecs.umich.edu SMI = 2, 585655Sgblack@eecs.umich.edu NMI = 4, 595654Sgblack@eecs.umich.edu INIT = 5, 605086Sgblack@eecs.umich.edu ExtInt = 7, 618229Snate@binkert.org NumModes 625648Sgblack@eecs.umich.edu }; 635647Sgblack@eecs.umich.edu 645647Sgblack@eecs.umich.edu static const char * const names[NumModes] = { 655647Sgblack@eecs.umich.edu "Fixed", "LowestPriority", "SMI", "Reserved", 665647Sgblack@eecs.umich.edu "NMI", "INIT", "Reserved", "ExtInt" 675810Sgblack@eecs.umich.edu }; 684120Sgblack@eecs.umich.edu 699554Sandreas.hansson@arm.com static inline bool 709554Sandreas.hansson@arm.com isReserved(int mode) 715704Snate@binkert.org { 725086Sgblack@eecs.umich.edu return mode == 3 || mode == 6; 739554Sandreas.hansson@arm.com } 749554Sandreas.hansson@arm.com } 7514293Sgabeblack@google.com 765086Sgblack@eecs.umich.edu static const Addr TriggerIntOffset = 0; 775647Sgblack@eecs.umich.edu 785654Sgblack@eecs.umich.edu static inline PacketPtr 795647Sgblack@eecs.umich.edu prepIntRequest(const uint8_t id, Addr offset, Addr size) 805654Sgblack@eecs.umich.edu { 815691Sgblack@eecs.umich.edu RequestPtr req = new Request(x86InterruptAddress(id, offset), 825691Sgblack@eecs.umich.edu size, Request::UNCACHEABLE); 835691Sgblack@eecs.umich.edu PacketPtr pkt = new Packet(req, MemCmd::MessageReq, Packet::Broadcast); 845691Sgblack@eecs.umich.edu pkt->allocate(); 855691Sgblack@eecs.umich.edu return pkt; 865691Sgblack@eecs.umich.edu } 875691Sgblack@eecs.umich.edu 885691Sgblack@eecs.umich.edu template<class T> 895691Sgblack@eecs.umich.edu PacketPtr 905691Sgblack@eecs.umich.edu buildIntRequest(const uint8_t id, T payload, Addr offset, Addr size) 915691Sgblack@eecs.umich.edu { 925654Sgblack@eecs.umich.edu PacketPtr pkt = prepIntRequest(id, offset, size); 935654Sgblack@eecs.umich.edu pkt->set<T>(payload); 945654Sgblack@eecs.umich.edu return pkt; 9512124Sspwilson2@wisc.edu } 9612124Sspwilson2@wisc.edu 975647Sgblack@eecs.umich.edu static inline PacketPtr 985654Sgblack@eecs.umich.edu buildIntRequest(const uint8_t id, TriggerIntMessage payload) 995655Sgblack@eecs.umich.edu { 1005655Sgblack@eecs.umich.edu return buildIntRequest(id, payload, TriggerIntOffset, 1015655Sgblack@eecs.umich.edu sizeof(TriggerIntMessage)); 1025655Sgblack@eecs.umich.edu } 1035691Sgblack@eecs.umich.edu 1045655Sgblack@eecs.umich.edu static inline PacketPtr 1055691Sgblack@eecs.umich.edu buildIntResponse() 1065655Sgblack@eecs.umich.edu { 1075691Sgblack@eecs.umich.edu panic("buildIntResponse not implemented.\n"); 1085655Sgblack@eecs.umich.edu } 1095691Sgblack@eecs.umich.edu} 1106050Sgblack@eecs.umich.edu 1116050Sgblack@eecs.umich.edu#endif 1126066Sgblack@eecs.umich.edu