VirtualBox

source: vbox/trunk/src/VBox/Main/include/SATAControllerImpl.h@ 7556

Last change on this file since 7556 was 7556, checked in by vboxsync, 17 years ago

AHCI/Main/VBoxManage: Add configuration parameter to set the number of ports on the sata controller. FreeBSD cannot handle more than 8 and would crash otherwise. Also adds the previously forgotten BIOS configuration parameters for booting from SATA

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 4.3 KB
Line 
1/* $Id: SATAControllerImpl.h 7556 2008-03-25 16:05:17Z vboxsync $ */
2
3/** @file
4 *
5 * VBox SATAController COM Class declaration.
6 */
7
8/*
9 * Copyright (C) 2008 innotek GmbH
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20#ifndef ____H_SATACONTROLLERIMPL
21#define ____H_SATACONTROLLERIMPL
22
23#include "VirtualBoxBase.h"
24
25#include <list>
26
27class Machine;
28
29class ATL_NO_VTABLE SATAController :
30 public VirtualBoxBaseWithChildrenNEXT,
31 public VirtualBoxSupportErrorInfoImpl <SATAController, ISATAController>,
32 public VirtualBoxSupportTranslation <SATAController>,
33 public ISATAController
34{
35private:
36
37 struct Data
38 {
39 /* Constructor. */
40 Data() : mEnabled (FALSE),
41 mPortCount (30),
42 mPortIde0Master (0),
43 mPortIde0Slave (1),
44 mPortIde1Master (2),
45 mPortIde1Slave (3) { }
46
47 bool operator== (const Data &that) const
48 {
49 return this == &that || ((mEnabled == that.mEnabled) &&
50 (mPortCount == mPortCount) &&
51 (mPortIde0Master == that.mPortIde0Master) &&
52 (mPortIde0Slave == that.mPortIde0Slave) &&
53 (mPortIde1Master == that.mPortIde1Master) &&
54 (mPortIde1Slave == that.mPortIde1Slave));
55 }
56
57 /** Enabled indicator. */
58 BOOL mEnabled;
59 /** Number of usable ports. */
60 ULONG mPortCount;
61 /** Port which acts as primary master for ide emulation. */
62 ULONG mPortIde0Master;
63 /** Port which acts as primary slave for ide emulation. */
64 ULONG mPortIde0Slave;
65 /** Port which acts as secondary master for ide emulation. */
66 ULONG mPortIde1Master;
67 /** Port which acts as secondary slave for ide emulation. */
68 ULONG mPortIde1Slave;
69 };
70
71public:
72
73 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (SATAController)
74
75 DECLARE_NOT_AGGREGATABLE (SATAController)
76
77 DECLARE_PROTECT_FINAL_CONSTRUCT()
78
79 BEGIN_COM_MAP(SATAController)
80 COM_INTERFACE_ENTRY (ISupportErrorInfo)
81 COM_INTERFACE_ENTRY (ISATAController)
82 END_COM_MAP()
83
84 NS_DECL_ISUPPORTS
85
86 DECLARE_EMPTY_CTOR_DTOR (SATAController)
87
88 HRESULT FinalConstruct();
89 void FinalRelease();
90
91 // public initializer/uninitializer for internal purposes only
92 HRESULT init (Machine *aParent);
93 HRESULT init (Machine *aParent, SATAController *aThat);
94 HRESULT initCopy (Machine *aParent, SATAController *aThat);
95 void uninit();
96
97 // ISATAController properties
98 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
99 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
100 STDMETHOD(COMGETTER(PortCount)) (ULONG *aPortCount);
101 STDMETHOD(COMSETTER(PortCount)) (ULONG aPortCount);
102
103 // ISATAController methods
104 STDMETHOD(GetIDEEmulationPort) (LONG DevicePosition, LONG *aPortNumber);
105 STDMETHOD(SetIDEEmulationPort) (LONG DevicePosition, LONG aPortNumber);
106
107 // public methods only for internal purposes
108
109 HRESULT loadSettings (const settings::Key &aMachineNode);
110 HRESULT saveSettings (settings::Key &aMachineNode);
111
112 bool isModified();
113 bool isReallyModified();
114 bool rollback();
115 void commit();
116 void copyFrom (SATAController *aThat);
117
118 HRESULT onMachineRegistered (BOOL aRegistered);
119
120 // public methods for internal purposes only
121 // (ensure there is a caller and a read lock before calling them!)
122
123 /** @note this doesn't require a read lock since mParent is constant. */
124 const ComObjPtr <Machine, ComWeakRef> &parent() { return mParent; };
125
126 const Backupable<Data> &data() { return mData; }
127
128 // for VirtualBoxSupportErrorInfoImpl
129 static const wchar_t *getComponentName() { return L"SATAController"; }
130
131private:
132
133 void printList();
134
135 /** Parent object. */
136 const ComObjPtr<Machine, ComWeakRef> mParent;
137 /** Peer object. */
138 const ComObjPtr <SATAController> mPeer;
139 /** Data. */
140 Backupable <Data> mData;
141
142};
143
144#endif //!____H_SATACONTROLLERIMPL
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette