intmessage.hh revision 13229
12SN/A/* 21762SN/A * Copyright (c) 2008 The Regents of The University of Michigan 32SN/A * All rights reserved. 42SN/A * 52SN/A * Redistribution and use in source and binary forms, with or without 62SN/A * modification, are permitted provided that the following conditions are 72SN/A * met: redistributions of source code must retain the above copyright 82SN/A * notice, this list of conditions and the following disclaimer; 92SN/A * redistributions in binary form must reproduce the above copyright 102SN/A * notice, this list of conditions and the following disclaimer in the 112SN/A * documentation and/or other materials provided with the distribution; 122SN/A * neither the name of the copyright holders nor the names of its 132SN/A * contributors may be used to endorse or promote products derived from 142SN/A * this software without specific prior written permission. 152SN/A * 162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Gabe Black 292665Ssaidi@eecs.umich.edu */ 302SN/A 312SN/A#ifndef __ARCH_X86_INTMESSAGE_HH__ 322SN/A#define __ARCH_X86_INTMESSAGE_HH__ 332SN/A 342SN/A#include "arch/x86/x86_traits.hh" 352SN/A#include "base/bitunion.hh" 361354SN/A#include "base/types.hh" 371354SN/A#include "mem/packet.hh" 382SN/A#include "mem/packet_access.hh" 392SN/A#include "mem/request.hh" 405501Snate@binkert.org 415546Snate@binkert.orgnamespace X86ISA 427004Snate@binkert.org{ 432SN/A BitUnion32(TriggerIntMessage) 442SN/A Bitfield<7, 0> destination; 4556SN/A Bitfield<15, 8> vector; 465769Snate@binkert.org Bitfield<18, 16> deliveryMode; 472361SN/A Bitfield<19> destMode; 481354SN/A Bitfield<20> level; 496216Snate@binkert.org Bitfield<21> trigger; 5056SN/A EndBitUnion(TriggerIntMessage) 512SN/A 525543Ssaidi@eecs.umich.edu namespace DeliveryMode 532SN/A { 541354SN/A enum IntDeliveryMode { 551354SN/A Fixed = 0, 562SN/A LowestPriority = 1, 572SN/A SMI = 2, 582SN/A NMI = 4, 592SN/A INIT = 5, 605501Snate@binkert.org SIPI = 6, 615501Snate@binkert.org ExtInt = 7, 622SN/A NumModes 63395SN/A }; 642SN/A 652SN/A static const char * const names[NumModes] = { 662SN/A "Fixed", "LowestPriority", "SMI", "Reserved", 675769Snate@binkert.org "NMI", "INIT", "Startup", "ExtInt" 685769Snate@binkert.org }; 695769Snate@binkert.org 705769Snate@binkert.org static inline bool 717059Snate@binkert.org isReserved(int mode) 727059Snate@binkert.org { 737059Snate@binkert.org return mode == 3; 747059Snate@binkert.org } 757059Snate@binkert.org } 767059Snate@binkert.org 777059Snate@binkert.org static const Addr TriggerIntOffset = 0; 787059Snate@binkert.org 797059Snate@binkert.org static inline PacketPtr 807059Snate@binkert.org prepIntRequest(const uint8_t id, Addr offset, Addr size) 817059Snate@binkert.org { 827059Snate@binkert.org RequestPtr req = std::make_shared<Request>( 837059Snate@binkert.org x86InterruptAddress(id, offset), 847059Snate@binkert.org size, Request::UNCACHEABLE, 857059Snate@binkert.org Request::intMasterId); 867059Snate@binkert.org 875769Snate@binkert.org PacketPtr pkt = new Packet(req, MemCmd::MessageReq); 887058Snate@binkert.org pkt->allocate(); 897058Snate@binkert.org return pkt; 907058Snate@binkert.org } 912SN/A 925502Snate@binkert.org template<class T> 935502Snate@binkert.org PacketPtr 945502Snate@binkert.org buildIntRequest(const uint8_t id, T payload, Addr offset, Addr size) 955503Snate@binkert.org { 965503Snate@binkert.org PacketPtr pkt = prepIntRequest(id, offset, size); 975502Snate@binkert.org pkt->setRaw<T>(payload); 985502Snate@binkert.org return pkt; 995502Snate@binkert.org } 1005502Snate@binkert.org 1015502Snate@binkert.org static inline PacketPtr 1025502Snate@binkert.org buildIntRequest(const uint8_t id, TriggerIntMessage payload) 1035502Snate@binkert.org { 1045602Snate@binkert.org return buildIntRequest(id, payload, TriggerIntOffset, 1055602Snate@binkert.org sizeof(TriggerIntMessage)); 1065501Snate@binkert.org } 1075543Ssaidi@eecs.umich.edu 1087058Snate@binkert.org static inline PacketPtr 1095769Snate@binkert.org buildIntResponse() 1104016Sstever@eecs.umich.edu { 1114016Sstever@eecs.umich.edu panic("buildIntResponse not implemented.\n"); 1124016Sstever@eecs.umich.edu } 1134016Sstever@eecs.umich.edu} 1144016Sstever@eecs.umich.edu 1154016Sstever@eecs.umich.edu#endif 1164016Sstever@eecs.umich.edu