Deleted Added
sdiff udiff text old ( 9524:d6ffa982a68b ) new ( 9805:a4339e26b429 )
full compact
1/*
2 * Copyright (c) 2008 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 24 unchanged lines hidden (view full) ---

33#include "cpu/base.hh"
34#include "debug/I82094AA.hh"
35#include "dev/x86/i82094aa.hh"
36#include "dev/x86/i8259.hh"
37#include "mem/packet.hh"
38#include "mem/packet_access.hh"
39#include "sim/system.hh"
40
41X86ISA::I82094AA::I82094AA(Params *p) : PioDevice(p),
42 IntDev(this, p->int_latency),
43 latency(p->pio_latency), pioAddr(p->pio_addr),
44 extIntPic(p->external_int_pic), lowestPriorityOffset(0)
45{
46 // This assumes there's only one I/O APIC in the system and since the apic
47 // id is stored in a 8-bit field with 0xff meaning broadcast, the id must
48 // be less than 0xff
49
50 assert(p->apic_id < 0xff);
51 initialApicId = id = p->apic_id;
52 arbId = id;
53 regSel = 0;
54 RedirTableEntry entry = 0;
55 entry.mask = 1;
56 for (int i = 0; i < TableSize; i++) {
57 redirTable[i] = entry;
58 pinStates[i] = false;
59 }
60}
61
62void
63X86ISA::I82094AA::init()
64{
65 // The io apic must register its address ranges on both its pio port
66 // via the piodevice init() function and its int port that it inherited
67 // from IntDev. Note IntDev is not a SimObject itself.
68
69 PioDevice::init();
70 IntDev::init();
71}
72
73Tick
74X86ISA::I82094AA::read(PacketPtr pkt)
75{
76 assert(pkt->getSize() == 4);
77 Addr offset = pkt->getAddr() - pioAddr;
78 switch(offset) {
79 case 0:
80 pkt->set<uint32_t>(regSel);
81 break;
82 case 16:
83 pkt->set<uint32_t>(readReg(regSel));
84 break;
85 default:
86 panic("Illegal read from I/O APIC.\n");
87 }
88 pkt->makeAtomicResponse();
89 return latency;
90}
91
92Tick
93X86ISA::I82094AA::write(PacketPtr pkt)
94{
95 assert(pkt->getSize() == 4);
96 Addr offset = pkt->getAddr() - pioAddr;
97 switch(offset) {
98 case 0:
99 regSel = pkt->get<uint32_t>();
100 break;
101 case 16:
102 writeReg(regSel, pkt->get<uint32_t>());
103 break;
104 default:
105 panic("Illegal write to I/O APIC.\n");
106 }
107 pkt->makeAtomicResponse();
108 return latency;
109}
110
111void
112X86ISA::I82094AA::writeReg(uint8_t offset, uint32_t value)
113{
114 if (offset == 0x0) {
115 id = bits(value, 31, 24);
116 } else if (offset == 0x1) {

--- 162 unchanged lines hidden ---