gem5  v22.1.0.0
pc.cc
Go to the documentation of this file.
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;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
33 #include "dev/x86/pc.hh"
34 
35 #include "arch/x86/intmessage.hh"
36 #include "arch/x86/x86_traits.hh"
37 #include "dev/x86/i82094aa.hh"
38 #include "dev/x86/i8254.hh"
39 #include "dev/x86/i8259.hh"
40 #include "dev/x86/south_bridge.hh"
41 #include "sim/system.hh"
42 
43 namespace gem5
44 {
45 
46 Pc::Pc(const Params &p) : Platform(p), southBridge(p.south_bridge)
47 {}
48 
49 void
51 {
52  assert(southBridge);
53 
54  /*
55  * Initialize the timer.
56  */
57  auto &timer = *southBridge->pit;
58  //Timer 0, mode 2, no bcd, 16 bit count
59  timer.writeControl(0x34);
60  //Timer 0, latch command
61  timer.writeControl(0x00);
62  //Write a 16 bit count of 0
63  timer.writeCounter(0, 0);
64  timer.writeCounter(0, 0);
65 
66  /*
67  * Initialize the I/O APIC.
68  */
70  X86ISA::I82094AA::RedirTableEntry entry = 0;
71  entry.mask = 1;
72  entry.deliveryMode = X86ISA::delivery_mode::ExtInt;
73  entry.vector = 0x20;
74  ioApic.writeReg(0x10, entry.bottomDW);
75  ioApic.writeReg(0x11, entry.topDW);
76  entry.deliveryMode = X86ISA::delivery_mode::Fixed;
77  entry.vector = 0x24;
78  ioApic.writeReg(0x18, entry.bottomDW);
79  ioApic.writeReg(0x19, entry.topDW);
80  entry.vector = 0x21;
81  ioApic.writeReg(0x12, entry.bottomDW);
82  ioApic.writeReg(0x13, entry.topDW);
83  entry.vector = 0x20;
84  ioApic.writeReg(0x14, entry.bottomDW);
85  ioApic.writeReg(0x15, entry.topDW);
86  entry.vector = 0x28;
87  ioApic.writeReg(0x20, entry.bottomDW);
88  ioApic.writeReg(0x21, entry.topDW);
89  entry.vector = 0x2C;
90  ioApic.writeReg(0x28, entry.bottomDW);
91  ioApic.writeReg(0x29, entry.topDW);
92  entry.vector = 0x2E;
93  ioApic.writeReg(0x2C, entry.bottomDW);
94  ioApic.writeReg(0x2D, entry.topDW);
95  entry.vector = 0x30;
96  ioApic.writeReg(0x30, entry.bottomDW);
97  ioApic.writeReg(0x31, entry.topDW);
98 
99  /*
100  * Mask the PICs. I'm presuming the BIOS/bootloader would have cleared
101  * these out and masked them before passing control to the OS.
102  */
105 }
106 
107 void
109 {
112 }
113 
114 void
116 {
117  warn_once("Don't know what interrupt to clear for console.\n");
118  //panic("Need implementation\n");
119 }
120 
121 void
122 Pc::postPciInt(int line)
123 {
125 }
126 
127 void
129 {
130  warn_once("Tried to clear PCI interrupt %d\n", line);
131 }
132 
133 } // namespace gem5
void postConsoleInt() override
Definition: pc.cc:108
void clearConsoleInt() override
Definition: pc.cc:115
PcParams Params
Definition: pc.hh:52
void clearPciInt(int line) override
Definition: pc.cc:128
void postPciInt(int line) override
Definition: pc.cc:122
Pc(const Params &p)
Definition: pc.cc:46
SouthBridge * southBridge
Definition: pc.hh:49
void init() override
Do platform initialization stuff.
Definition: pc.cc:50
X86ISA::I8259 * pic1
Definition: south_bridge.hh:53
X86ISA::I8254 * pit
Definition: south_bridge.hh:52
X86ISA::I8259 * pic2
Definition: south_bridge.hh:54
X86ISA::I82094AA * ioApic
Definition: south_bridge.hh:57
void requestInterrupt(int line)
Definition: i82094aa.cc:181
void writeReg(uint8_t offset, uint32_t value)
Definition: i82094aa.cc:131
Bitfield< 16 > mask
Definition: i82094aa.hh:58
void writeControl(uint8_t val)
Definition: i8254.hh:114
void signalInterrupt(int line)
Definition: i8259.cc:282
#define warn_once(...)
Definition: logging.hh:250
Bitfield< 54 > p
Definition: pagetable.hh:70
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Declaration of top level class for PC platform components.

Generated on Wed Dec 21 2022 10:22:35 for gem5 by doxygen 1.9.1