Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

acpi.h

Go to the documentation of this file.
00001 
00007 /*
00008  *  Copyright (C) 2004 Bregmasoft
00009  * 
00010  * This program is free software; you can redistribute it and/or modify it under
00011  * the terms of the GNU General Public License as published by the Free Software
00012  * Foundation; either version 2 of the License, or (at your option) any later
00013  * version.
00014  * 
00015  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
00016  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
00017  * PARTICULAR PURPOSE. See the GNU General Public License for more details.
00018  * 
00019  * You should have received a copy of the GNU General Public License along with
00020  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021  * Place, Suite 330, Boston, MA 02111-1307 USA
00022  */
00023 #ifndef ZYGOMA_IA32_ACPI_H_ 
00024 #define ZYGOMA_IA32_ACPI_H_ 
00025 
00026 #include <config.h>
00027 #include <iterator>
00028 #include <types.h>
00029 
00030 namespace Zygoma
00031 {
00032   namespace ia32
00033   {
00034     namespace Acpi
00035     {
00055       class RootSystemDescriptionTable;
00056 
00066       class RootSystemDescriptionPointer
00067       {
00068       public:
00075         static const RootSystemDescriptionPointer*
00076         locateRSDT();
00077 
00083         RootSystemDescriptionTable*
00084         rsdtAddress() const
00085         { return reinterpret_cast<RootSystemDescriptionTable*>(m_rsdtAddress); }
00086 
00087         static const int kSIGNATURE_LENGTH = 8;
00088         static const u08 kSIGNATURE[kSIGNATURE_LENGTH];
00089 
00090       public:
00091         u08 m_signature[kSIGNATURE_LENGTH];
00092         u08 m_checksum;
00093         u08 m_oemId[6];
00094         u08 m_revision;
00095         u32 m_rsdtAddress;
00096         u08 m_length[4];
00097         u08 m_xsdtAddress[8];
00098         u08 m_extendedChecksum;
00099         u08 m_reserved[3];
00100       } ZYGOMA_PACKED;
00101 
00102 
00107       struct SystemDescriptionTableHeader
00108       {
00109         static const int kSIGNATURE_LENGTH = 4;
00110 
00111         u08 m_signature[kSIGNATURE_LENGTH];
00112         u32 m_length;
00113         u08 m_revision;
00114         u08 m_checksum;
00115         u08 m_oemId[6];
00116         u08 m_oemTableId[8];
00117         u32 m_oemRevision;
00118         u32 m_creatorId;
00119         u32 m_creatorRevision;
00120       } ZYGOMA_PACKED;
00121 
00122 
00131       class ConfigTableIterator
00132       : public std::iterator<std::forward_iterator_tag,
00133                              const SystemDescriptionTableHeader>
00134       {
00135       public:
00136         explicit ConfigTableIterator(SystemDescriptionTableHeader**);
00137 
00144         reference
00145         operator*() const;
00146 
00152         pointer
00153         operator->() const;
00154 
00158         ConfigTableIterator&
00159         operator++();
00160 
00164         ConfigTableIterator&
00165         operator++(int);
00166 
00170         bool
00171         equals(const ConfigTableIterator& rhs) const
00172         { return m_curEntry == rhs.m_curEntry; }
00173 
00174       private:
00175         SystemDescriptionTableHeader** m_curEntry;
00176       };
00177 
00178 
00187       inline bool
00188       operator==(const ConfigTableIterator& lhs, const ConfigTableIterator& rhs)
00189       { return lhs.equals(rhs); }
00190 
00191 
00197       inline bool
00198       operator!=(const ConfigTableIterator& lhs, const ConfigTableIterator& rhs)
00199       { return !lhs.equals(rhs); }
00200 
00201 
00216       class RootSystemDescriptionTable : public SystemDescriptionTableHeader {
00217         static const u08 kSIGNATURE[kSIGNATURE_LENGTH];
00218 
00219       public:
00220         typedef SystemDescriptionTableHeader*        value_type;
00221         typedef SystemDescriptionTableHeader**       pointer;
00222         typedef SystemDescriptionTableHeader*&       reference;
00223         typedef const SystemDescriptionTableHeader*& const_reference;
00224         typedef ConfigTableIterator                  iterator;
00225         typedef std::ptrdiff_t                       difference_type;
00226         typedef std::size_t                          size_type;
00227 
00228       public:
00233         iterator
00234         begin()
00235         { return iterator(reinterpret_cast<pointer>(&m_entry[0])); }
00236 
00241         iterator
00242         end()
00243         { return iterator(reinterpret_cast<pointer>(&m_entry[size()])); }
00244 
00253         size_type
00254         size() const
00255         {
00256           return (m_length - sizeof(SystemDescriptionTableHeader))
00257                   / sizeof(value_type);
00258         }
00259 
00267         bool
00268         empty() const
00269         { return size() == 0; }
00270 
00271       private:
00272         u32 m_entry[1];
00273       } ZYGOMA_PACKED;
00274 
00275       class DifferentiatedSystemDescriptionTable;
00276 
00277 
00283       class FixedAcpiDescriptionTable
00284       : public SystemDescriptionTableHeader
00285       {
00286       public:
00287         u32 m_firmwareControl;
00288         u32 m_dsdt;
00289         u08 m_reserved1;
00290         u08 m_preferredPowerProfile;
00291         u16 m_sciInterrupt;
00292         u32 m_smiCommand;
00293         u08 m_acpiEnable;
00294         u08 m_acpiDisable;
00295         u08 m_s4biosRequest;
00296         u08 m_pstateControl;
00297         u32 m_PM1aEventBlock;
00298         u32 m_PM1bEventBlock;
00299         u32 m_PM1aControlBlock;
00300         u32 m_PM1bControlBlock;
00301         u32 m_PM2ControlBlock;
00302         u32 m_PMTimerBlock;
00303         u32 m_GPE0Block;
00304         u32 m_GPE1Block;
00305         u08 m_pm1EventLength;
00306         u08 m_pm1CountLength;
00307         u08 m_pm2CountLength;
00308         u08 m_pmTimerLength;
00309         u08 m_GPE0BlockLength;
00310         u08 m_GPE1BlockLength;
00311         u08 m_GPE1BaseOffset;
00312         u08 m_CstCnt;
00313         u16 m_level2Latency;
00314         u16 m_level3Latency;
00315         u16 m_flushSize;
00316         u16 m_flushStride;
00317         u08 m_dutyOffset;
00318         u08 m_dutyWidth;
00319         u08 m_dayAlarm;
00320         u08 m_monthAlarm;
00321         u08 m_century;
00322         u16 m_hasLegacyDevices:1;
00323         u16 m_has842keyboard:1;
00324         u16 m_reserved110:14;
00325         u08 m_reserved111;
00326         u32 m_flags;
00327         u08 m_resetRegister[12];
00328         u08 m_resetValue;
00329         u08 m_reserved129[3];
00330         u08 m_xFirmwareControl[8];
00331         u08 m_xDsdt[8];
00332         u08 m_xPM1aEventBlock[12];
00333         u08 m_xPM1bEventBlock[12];
00334         u08 m_xPM1aControlBlock[12];
00335         u08 m_xPM1bControlBlock[12];
00336         u08 m_xPM2ControlBlock[12];
00337         u08 m_xPMTimerBlock[12];
00338         u08 m_xGPE0Block[12];
00339         u08 m_xGPE1Block[12];
00340       } ZYGOMA_PACKED;
00341 
00342 
00350       class DifferentiatedSystemDescriptionTable
00351       : public SystemDescriptionTableHeader
00352       {
00353       public:
00354         typedef u08            value_type;
00355         typedef u08*           pointer;
00356         typedef u08&           reference;
00357         typedef const u08&     const_reference;
00358         typedef u08*           iterator;
00359         typedef std::ptrdiff_t difference_type;
00360         typedef std::size_t    size_type;
00361 
00362       public:
00366         iterator
00367         begin()
00368         { return m_aml; }
00369 
00374         iterator
00375         end()
00376         { return m_aml + size(); }
00377 
00382         size_type
00383         size() const
00384         {
00385           return m_length - sizeof(SystemDescriptionTableHeader);
00386         }
00387 
00391         bool
00392         empty() const
00393         { return size() == 0; }
00394 
00395       private:
00396         value_type m_aml[1];
00397       } ZYGOMA_PACKED;
00398 
00399 
00400     } // namespace Acpi
00401   } // namespace ia32
00402 } // namespace Zygoma
00403 
00404 #endif // ZYGOMA_IA32_ACPI_H

Generated on Fri Sep 2 10:44:36 2005 for zygoma by doxygen 1.4.2