The Pedigree Project  0.1
Pc.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef KERNEL_MACHINE_X86_COMMON_PC_H
21 #define KERNEL_MACHINE_X86_COMMON_PC_H
22 
23 #include "Keyboard.h"
24 #include "LocalApic.h"
25 #include "Ps2Controller.h"
26 #include "Serial.h"
27 #include "Vga.h"
28 #include "pedigree/kernel/compiler.h"
29 #include "pedigree/kernel/machine/Bus.h"
30 #include "pedigree/kernel/machine/Controller.h"
31 #include "pedigree/kernel/machine/Device.h"
32 #include "pedigree/kernel/machine/Machine.h"
33 #include "pedigree/kernel/processor/types.h"
34 
35 #if defined(SMBIOS)
36 #include "SMBios.h"
37 #endif
38 
39 class IrqManager;
40 class Keyboard;
41 class SchedulerTimer;
42 class Serial;
43 class Timer;
44 class Vga;
45 
49 class Pc : public Machine
50 {
51  public:
52  inline static Pc &instance()
53  {
54  return m_Instance;
55  }
56 
57  virtual void initialise() INITIALISATION_ONLY;
58  virtual void initialise3();
59  virtual void deinitialise();
60 
61 #if defined(MULTIPROCESSOR)
62  void initialiseProcessor() INITIALISATION_ONLY;
63 #endif
64 
65  virtual void initialiseDeviceTree();
66 
67  virtual Serial *getSerial(size_t n);
68  virtual size_t getNumSerial();
69  virtual Vga *getVga(size_t n);
70  virtual size_t getNumVga();
71  virtual IrqManager *getIrqManager();
73  virtual Timer *getTimer();
74  virtual Keyboard *getKeyboard();
75  virtual void setKeyboard(Keyboard *kb);
76 
77 #if defined(APIC)
78 
80  inline LocalApic &getLocalApic()
81  {
82  return m_LocalApic;
83  }
84 #endif
85 
86 #ifdef MULTIPROCESSOR
87  virtual void stopAllOtherProcessors();
88 #endif
89 
90  private:
95  Pc(const Pc &);
96  Pc &operator=(const Pc &);
100  virtual ~Pc();
101 
102  X86Serial m_pSerial[4];
103  X86Vga m_Vga;
104  Keyboard *m_pKeyboard;
105 
106 #if defined(SMBIOS)
107  SMBios m_SMBios;
108 #endif
109 
110 #if defined(APIC)
111  LocalApic m_LocalApic;
112 #endif
113 
114  static Pc m_Instance;
115 
116  // Hardware devices.
117  X86Keyboard m_Keyboard;
118  Bus m_IsaBus;
119  Controller m_AtaMaster;
120  Controller m_AtaSlave;
121  Ps2Controller m_Ps2Controller;
122  Device m_Watchdog;
123 };
124 
125 #endif
virtual ~Pc()
Definition: Pc.cc:295
virtual void initialise3()
Called after processor startup - for thread creation etc.
Definition: Pc.cc:173
Definition: Pc.h:49
virtual void setKeyboard(Keyboard *kb)
Definition: Pc.cc:267
virtual Timer * getTimer()
Definition: Pc.cc:257
Definition: Device.h:43
virtual Serial * getSerial(size_t n)
Definition: Pc.cc:223
virtual Keyboard * getKeyboard()
Definition: Pc.cc:262
Definition: Bus.h:31
virtual SchedulerTimer * getSchedulerTimer()
Definition: Pc.cc:248
virtual size_t getNumVga()
Definition: Pc.cc:238
Pc() INITIALISATION_ONLY
Definition: Pc.cc:280
virtual size_t getNumSerial()
Definition: Pc.cc:228
virtual void initialiseDeviceTree()
Definition: Pc.cc:178
virtual Vga * getVga(size_t n)
Definition: Pc.cc:233
virtual void initialise() INITIALISATION_ONLY
Definition: Pc.cc:52