i82094aa.hh revision 6137:d3ee4e0d690c
12391SN/A/*
22391SN/A * Copyright (c) 2008 The Regents of The University of Michigan
32391SN/A * All rights reserved.
42391SN/A *
52391SN/A * Redistribution and use in source and binary forms, with or without
62391SN/A * modification, are permitted provided that the following conditions are
72391SN/A * met: redistributions of source code must retain the above copyright
82391SN/A * notice, this list of conditions and the following disclaimer;
92391SN/A * redistributions in binary form must reproduce the above copyright
102391SN/A * notice, this list of conditions and the following disclaimer in the
112391SN/A * documentation and/or other materials provided with the distribution;
122391SN/A * neither the name of the copyright holders nor the names of its
132391SN/A * contributors may be used to endorse or promote products derived from
142391SN/A * this software without specific prior written permission.
152391SN/A *
162391SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172391SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182391SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192391SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202391SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212391SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222391SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232391SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242391SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252391SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262391SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Gabe Black
292914Ssaidi@eecs.umich.edu */
302391SN/A
312391SN/A#ifndef __DEV_X86_I82094AA_HH__
322391SN/A#define __DEV_X86_I82094AA_HH__
332391SN/A
342391SN/A#include "base/bitunion.hh"
352391SN/A#include "base/range_map.hh"
362391SN/A#include "dev/io_device.hh"
372391SN/A#include "dev/x86/intdev.hh"
382391SN/A#include "params/I82094AA.hh"
392391SN/A
402391SN/A#include <map>
412391SN/A
423348Sbinkertn@umich.edunamespace X86ISA
432391SN/A{
442391SN/A
453879Ssaidi@eecs.umich.educlass I8259;
462394SN/Aclass Interrupts;
472391SN/A
482415SN/Aclass I82094AA : public PioDevice, public IntDev
493348Sbinkertn@umich.edu{
502394SN/A  public:
512391SN/A    BitUnion64(RedirTableEntry)
522423SN/A        Bitfield<63, 32> topDW;
532391SN/A        Bitfield<55, 32> topReserved;
543012Ssaidi@eecs.umich.edu        Bitfield<31, 0> bottomDW;
553012Ssaidi@eecs.umich.edu        Bitfield<31, 17> bottomReserved;
562391SN/A        Bitfield<63, 56> dest;
573012Ssaidi@eecs.umich.edu        Bitfield<16> mask;
582391SN/A        Bitfield<15> trigger;
592391SN/A        Bitfield<14> remoteIRR;
602391SN/A        Bitfield<13> polarity;
613012Ssaidi@eecs.umich.edu        Bitfield<12> deliveryStatus;
623918Ssaidi@eecs.umich.edu        Bitfield<11> destMode;
632391SN/A        Bitfield<10, 8> deliveryMode;
643012Ssaidi@eecs.umich.edu        Bitfield<7, 0> vector;
652391SN/A    EndBitUnion(RedirTableEntry)
662391SN/A
672391SN/A  protected:
682391SN/A    Tick latency;
693751Sgblack@eecs.umich.edu    Addr pioAddr;
703751Sgblack@eecs.umich.edu
713751Sgblack@eecs.umich.edu    I8259 * extIntPic;
723751Sgblack@eecs.umich.edu
733012Ssaidi@eecs.umich.edu    std::map<int, Interrupts *> localApics;
742391SN/A
752391SN/A    uint8_t regSel;
762541SN/A    uint8_t initialApicId;
772541SN/A    uint8_t id;
782541SN/A    uint8_t arbId;
792541SN/A
802541SN/A    static const uint8_t TableSize = 24;
812541SN/A    // This implementation is based on version 0x11, but 0x14 avoids having
822541SN/A    // to deal with the arbitration and APIC bus guck.
832541SN/A    static const uint8_t APICVersion = 0x14;
842391SN/A
852391SN/A    RedirTableEntry redirTable[TableSize];
863012Ssaidi@eecs.umich.edu    bool pinStates[TableSize];
873918Ssaidi@eecs.umich.edu
882416SN/A  public:
892391SN/A    typedef I82094AAParams Params;
902391SN/A
912391SN/A    const Params *
922391SN/A    params() const
932391SN/A    {
943012Ssaidi@eecs.umich.edu        return dynamic_cast<const Params *>(_params);
954040Ssaidi@eecs.umich.edu    }
962391SN/A
973012Ssaidi@eecs.umich.edu    I82094AA(Params *p);
982391SN/A
992391SN/A    Tick read(PacketPtr pkt);
1002391SN/A    Tick write(PacketPtr pkt);
1012408SN/A
1022408SN/A    void addressRanges(AddrRangeList &range_list)
1032408SN/A    {
1042409SN/A        range_list.clear();
1052409SN/A        range_list.push_back(RangeEx(pioAddr, pioAddr + 4));
1062408SN/A        range_list.push_back(RangeEx(pioAddr + 16, pioAddr + 20));
1072408SN/A    }
1083012Ssaidi@eecs.umich.edu
1093349Sbinkertn@umich.edu    void getIntAddrRange(AddrRangeList &range_list)
1103012Ssaidi@eecs.umich.edu    {
1113012Ssaidi@eecs.umich.edu        range_list.clear();
1123012Ssaidi@eecs.umich.edu        range_list.push_back(RangeEx(x86InterruptAddress(initialApicId, 0),
1132413SN/A                    x86InterruptAddress(initialApicId, 0) +
1143170Sstever@eecs.umich.edu                    PhysAddrAPICRangeSize));
1153170Sstever@eecs.umich.edu    }
1163170Sstever@eecs.umich.edu
1173170Sstever@eecs.umich.edu    void writeReg(uint8_t offset, uint32_t value);
1183170Sstever@eecs.umich.edu    uint32_t readReg(uint8_t offset);
1193170Sstever@eecs.umich.edu
1203170Sstever@eecs.umich.edu    Port *getPort(const std::string &if_name, int idx = -1)
1213170Sstever@eecs.umich.edu    {
1223170Sstever@eecs.umich.edu        if (if_name == "int_port")
1233170Sstever@eecs.umich.edu            return intPort;
1243170Sstever@eecs.umich.edu        return PioDevice::getPort(if_name, idx);
1253170Sstever@eecs.umich.edu    }
1263170Sstever@eecs.umich.edu
1273170Sstever@eecs.umich.edu    void signalInterrupt(int line);
1283170Sstever@eecs.umich.edu    void raiseInterruptPin(int number);
1293170Sstever@eecs.umich.edu    void lowerInterruptPin(int number);
1303170Sstever@eecs.umich.edu    void registerLocalApic(int id, Interrupts *localApic);
1313170Sstever@eecs.umich.edu};
1323170Sstever@eecs.umich.edu
1333170Sstever@eecs.umich.edu}; // namespace X86ISA
1343170Sstever@eecs.umich.edu
1353170Sstever@eecs.umich.edu#endif //__DEV_X86_SOUTH_BRIDGE_I8254_HH__
1363170Sstever@eecs.umich.edu