i82094aa.hh revision 9294
15643Sgblack@eecs.umich.edu/*
25643Sgblack@eecs.umich.edu * Copyright (c) 2008 The Regents of The University of Michigan
35643Sgblack@eecs.umich.edu * All rights reserved.
45643Sgblack@eecs.umich.edu *
55643Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
65643Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are
75643Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright
85643Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
95643Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
105643Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
115643Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution;
125643Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its
135643Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
145643Sgblack@eecs.umich.edu * this software without specific prior written permission.
155643Sgblack@eecs.umich.edu *
165643Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
175643Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
185643Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
195643Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
205643Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
215643Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
225643Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
235643Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
245643Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
255643Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
265643Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
275643Sgblack@eecs.umich.edu *
285643Sgblack@eecs.umich.edu * Authors: Gabe Black
295643Sgblack@eecs.umich.edu */
305643Sgblack@eecs.umich.edu
315643Sgblack@eecs.umich.edu#ifndef __DEV_X86_I82094AA_HH__
325643Sgblack@eecs.umich.edu#define __DEV_X86_I82094AA_HH__
335643Sgblack@eecs.umich.edu
348229Snate@binkert.org#include <map>
358229Snate@binkert.org
365643Sgblack@eecs.umich.edu#include "base/bitunion.hh"
378229Snate@binkert.org#include "dev/x86/intdev.hh"
385643Sgblack@eecs.umich.edu#include "dev/io_device.hh"
395643Sgblack@eecs.umich.edu#include "params/I82094AA.hh"
405643Sgblack@eecs.umich.edu
415643Sgblack@eecs.umich.edunamespace X86ISA
425643Sgblack@eecs.umich.edu{
435643Sgblack@eecs.umich.edu
445657Sgblack@eecs.umich.educlass I8259;
456137Sgblack@eecs.umich.educlass Interrupts;
465657Sgblack@eecs.umich.edu
475643Sgblack@eecs.umich.educlass I82094AA : public PioDevice, public IntDev
485643Sgblack@eecs.umich.edu{
495643Sgblack@eecs.umich.edu  public:
505643Sgblack@eecs.umich.edu    BitUnion64(RedirTableEntry)
515643Sgblack@eecs.umich.edu        Bitfield<63, 32> topDW;
525643Sgblack@eecs.umich.edu        Bitfield<55, 32> topReserved;
535643Sgblack@eecs.umich.edu        Bitfield<31, 0> bottomDW;
545643Sgblack@eecs.umich.edu        Bitfield<31, 17> bottomReserved;
555643Sgblack@eecs.umich.edu        Bitfield<63, 56> dest;
565643Sgblack@eecs.umich.edu        Bitfield<16> mask;
575643Sgblack@eecs.umich.edu        Bitfield<15> trigger;
585643Sgblack@eecs.umich.edu        Bitfield<14> remoteIRR;
595643Sgblack@eecs.umich.edu        Bitfield<13> polarity;
605643Sgblack@eecs.umich.edu        Bitfield<12> deliveryStatus;
615643Sgblack@eecs.umich.edu        Bitfield<11> destMode;
625643Sgblack@eecs.umich.edu        Bitfield<10, 8> deliveryMode;
635643Sgblack@eecs.umich.edu        Bitfield<7, 0> vector;
645643Sgblack@eecs.umich.edu    EndBitUnion(RedirTableEntry)
655643Sgblack@eecs.umich.edu
665643Sgblack@eecs.umich.edu  protected:
675643Sgblack@eecs.umich.edu    Tick latency;
685643Sgblack@eecs.umich.edu    Addr pioAddr;
695643Sgblack@eecs.umich.edu
705657Sgblack@eecs.umich.edu    I8259 * extIntPic;
715657Sgblack@eecs.umich.edu
725643Sgblack@eecs.umich.edu    uint8_t regSel;
736136Sgblack@eecs.umich.edu    uint8_t initialApicId;
745643Sgblack@eecs.umich.edu    uint8_t id;
755643Sgblack@eecs.umich.edu    uint8_t arbId;
765643Sgblack@eecs.umich.edu
776139Sgblack@eecs.umich.edu    uint64_t lowestPriorityOffset;
786139Sgblack@eecs.umich.edu
795643Sgblack@eecs.umich.edu    static const uint8_t TableSize = 24;
805643Sgblack@eecs.umich.edu    // This implementation is based on version 0x11, but 0x14 avoids having
815643Sgblack@eecs.umich.edu    // to deal with the arbitration and APIC bus guck.
825643Sgblack@eecs.umich.edu    static const uint8_t APICVersion = 0x14;
835643Sgblack@eecs.umich.edu
845643Sgblack@eecs.umich.edu    RedirTableEntry redirTable[TableSize];
855827Sgblack@eecs.umich.edu    bool pinStates[TableSize];
865643Sgblack@eecs.umich.edu
875643Sgblack@eecs.umich.edu  public:
885643Sgblack@eecs.umich.edu    typedef I82094AAParams Params;
895643Sgblack@eecs.umich.edu
905643Sgblack@eecs.umich.edu    const Params *
915643Sgblack@eecs.umich.edu    params() const
925643Sgblack@eecs.umich.edu    {
935643Sgblack@eecs.umich.edu        return dynamic_cast<const Params *>(_params);
945643Sgblack@eecs.umich.edu    }
955643Sgblack@eecs.umich.edu
965643Sgblack@eecs.umich.edu    I82094AA(Params *p);
975643Sgblack@eecs.umich.edu
987913SBrad.Beckmann@amd.com    void init();
997913SBrad.Beckmann@amd.com
1005643Sgblack@eecs.umich.edu    Tick read(PacketPtr pkt);
1015643Sgblack@eecs.umich.edu    Tick write(PacketPtr pkt);
1025643Sgblack@eecs.umich.edu
1039090Sandreas.hansson@arm.com    AddrRangeList getAddrRanges() const
1045643Sgblack@eecs.umich.edu    {
1058711Sandreas.hansson@arm.com        AddrRangeList ranges;
1068711Sandreas.hansson@arm.com        ranges.push_back(RangeEx(pioAddr, pioAddr + 4));
1078711Sandreas.hansson@arm.com        ranges.push_back(RangeEx(pioAddr + 16, pioAddr + 20));
1088711Sandreas.hansson@arm.com        return ranges;
1095643Sgblack@eecs.umich.edu    }
1105643Sgblack@eecs.umich.edu
1119090Sandreas.hansson@arm.com    AddrRangeList getIntAddrRange() const
1125651Sgblack@eecs.umich.edu    {
1138711Sandreas.hansson@arm.com        AddrRangeList ranges;
1148711Sandreas.hansson@arm.com        ranges.push_back(RangeEx(x86InterruptAddress(initialApicId, 0),
1158711Sandreas.hansson@arm.com                                 x86InterruptAddress(initialApicId, 0) +
1168711Sandreas.hansson@arm.com                                 PhysAddrAPICRangeSize));
1178711Sandreas.hansson@arm.com        return ranges;
1185651Sgblack@eecs.umich.edu    }
1195651Sgblack@eecs.umich.edu
1205643Sgblack@eecs.umich.edu    void writeReg(uint8_t offset, uint32_t value);
1215643Sgblack@eecs.umich.edu    uint32_t readReg(uint8_t offset);
1225643Sgblack@eecs.umich.edu
1239294Sandreas.hansson@arm.com    BaseMasterPort &getMasterPort(const std::string &if_name,
1249294Sandreas.hansson@arm.com                                  PortID idx = InvalidPortID)
1255651Sgblack@eecs.umich.edu    {
1268839Sandreas.hansson@arm.com        if (if_name == "int_master")
1278922Swilliam.wang@arm.com            return intMasterPort;
1288922Swilliam.wang@arm.com        return PioDevice::getMasterPort(if_name, idx);
1295651Sgblack@eecs.umich.edu    }
1305651Sgblack@eecs.umich.edu
1315643Sgblack@eecs.umich.edu    void signalInterrupt(int line);
1325827Sgblack@eecs.umich.edu    void raiseInterruptPin(int number);
1335827Sgblack@eecs.umich.edu    void lowerInterruptPin(int number);
1347903Shestness@cs.utexas.edu
1357903Shestness@cs.utexas.edu    virtual void serialize(std::ostream &os);
1367903Shestness@cs.utexas.edu    virtual void unserialize(Checkpoint *cp, const std::string &section);
1375643Sgblack@eecs.umich.edu};
1385643Sgblack@eecs.umich.edu
1397811Ssteve.reinhardt@amd.com} // namespace X86ISA
1405643Sgblack@eecs.umich.edu
1415643Sgblack@eecs.umich.edu#endif //__DEV_X86_SOUTH_BRIDGE_I8254_HH__
142