i82094aa.hh revision 11168
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
479807Sstever@gmail.comclass I82094AA : public BasicPioDevice, public IntDevice
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:
675657Sgblack@eecs.umich.edu    I8259 * extIntPic;
685657Sgblack@eecs.umich.edu
695643Sgblack@eecs.umich.edu    uint8_t regSel;
706136Sgblack@eecs.umich.edu    uint8_t initialApicId;
715643Sgblack@eecs.umich.edu    uint8_t id;
725643Sgblack@eecs.umich.edu    uint8_t arbId;
735643Sgblack@eecs.umich.edu
746139Sgblack@eecs.umich.edu    uint64_t lowestPriorityOffset;
756139Sgblack@eecs.umich.edu
765643Sgblack@eecs.umich.edu    static const uint8_t TableSize = 24;
775643Sgblack@eecs.umich.edu    // This implementation is based on version 0x11, but 0x14 avoids having
785643Sgblack@eecs.umich.edu    // to deal with the arbitration and APIC bus guck.
795643Sgblack@eecs.umich.edu    static const uint8_t APICVersion = 0x14;
805643Sgblack@eecs.umich.edu
815643Sgblack@eecs.umich.edu    RedirTableEntry redirTable[TableSize];
825827Sgblack@eecs.umich.edu    bool pinStates[TableSize];
835643Sgblack@eecs.umich.edu
845643Sgblack@eecs.umich.edu  public:
855643Sgblack@eecs.umich.edu    typedef I82094AAParams Params;
865643Sgblack@eecs.umich.edu
875643Sgblack@eecs.umich.edu    const Params *
885643Sgblack@eecs.umich.edu    params() const
895643Sgblack@eecs.umich.edu    {
905643Sgblack@eecs.umich.edu        return dynamic_cast<const Params *>(_params);
915643Sgblack@eecs.umich.edu    }
925643Sgblack@eecs.umich.edu
935643Sgblack@eecs.umich.edu    I82094AA(Params *p);
945643Sgblack@eecs.umich.edu
957913SBrad.Beckmann@amd.com    void init();
967913SBrad.Beckmann@amd.com
975643Sgblack@eecs.umich.edu    Tick read(PacketPtr pkt);
985643Sgblack@eecs.umich.edu    Tick write(PacketPtr pkt);
995643Sgblack@eecs.umich.edu
1009805Sstever@gmail.com    AddrRangeList getIntAddrRange() const;
1015651Sgblack@eecs.umich.edu
1025643Sgblack@eecs.umich.edu    void writeReg(uint8_t offset, uint32_t value);
1035643Sgblack@eecs.umich.edu    uint32_t readReg(uint8_t offset);
1045643Sgblack@eecs.umich.edu
1059294Sandreas.hansson@arm.com    BaseMasterPort &getMasterPort(const std::string &if_name,
1069805Sstever@gmail.com                                  PortID idx = InvalidPortID);
1075651Sgblack@eecs.umich.edu
10811168Sandreas.hansson@arm.com    Tick recvResponse(PacketPtr pkt) override;
10911144Sjthestness@gmail.com
1105643Sgblack@eecs.umich.edu    void signalInterrupt(int line);
1115827Sgblack@eecs.umich.edu    void raiseInterruptPin(int number);
1125827Sgblack@eecs.umich.edu    void lowerInterruptPin(int number);
1137903Shestness@cs.utexas.edu
11411168Sandreas.hansson@arm.com    void serialize(CheckpointOut &cp) const override;
11511168Sandreas.hansson@arm.com    void unserialize(CheckpointIn &cp) override;
1165643Sgblack@eecs.umich.edu};
1175643Sgblack@eecs.umich.edu
1187811Ssteve.reinhardt@amd.com} // namespace X86ISA
1195643Sgblack@eecs.umich.edu
1205643Sgblack@eecs.umich.edu#endif //__DEV_X86_SOUTH_BRIDGE_I8254_HH__
121