ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

hwapm.c
Go to the documentation of this file.
00001 /*
00002  *  FreeLoader
00003  *
00004  *  Copyright (C) 2004  Eric Kohl
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License along
00017  *  with this program; if not, write to the Free Software Foundation, Inc.,
00018  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00019  */
00020 
00021 #include <freeldr.h>
00022 
00023 #define NDEBUG
00024 #include <debug.h>
00025 
00026 DBG_DEFAULT_CHANNEL(HWDETECT);
00027 
00028 static BOOLEAN
00029 FindApmBios(VOID)
00030 {
00031   REGS  RegsIn;
00032   REGS  RegsOut;
00033 
00034   RegsIn.b.ah = 0x53;
00035   RegsIn.b.al = 0x00;
00036   RegsIn.w.bx = 0x0000;
00037 
00038   Int386(0x15, &RegsIn, &RegsOut);
00039 
00040   if (INT386_SUCCESS(RegsOut))
00041     {
00042       TRACE("Found APM BIOS\n");
00043       TRACE("AH: %x\n", RegsOut.b.ah);
00044       TRACE("AL: %x\n", RegsOut.b.al);
00045       TRACE("BH: %x\n", RegsOut.b.bh);
00046       TRACE("BL: %x\n", RegsOut.b.bl);
00047       TRACE("CX: %x\n", RegsOut.w.cx);
00048 
00049       return TRUE;
00050     }
00051 
00052   TRACE("No APM BIOS found\n");
00053 
00054   return FALSE;
00055 }
00056 
00057 
00058 VOID
00059 DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
00060 {
00061     PCONFIGURATION_COMPONENT_DATA BiosKey;
00062     CM_PARTIAL_RESOURCE_LIST PartialResourceList;
00063 
00064     if (FindApmBios())
00065     {
00066         /* Create 'Configuration Data' value */
00067         memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
00068         PartialResourceList.Version = 0;
00069         PartialResourceList.Revision = 0;
00070         PartialResourceList.Count = 0;
00071 
00072         /* Create new bus key */
00073         FldrCreateComponentKey(SystemKey,
00074                                AdapterClass,
00075                                MultiFunctionAdapter,
00076                                0x0,
00077                                0x0,
00078                                0xFFFFFFFF,
00079                                "APM",
00080                                &PartialResourceList,
00081                                sizeof(CM_PARTIAL_RESOURCE_LIST) -
00082                                    sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR),
00083                                &BiosKey);
00084 
00085         /* Increment bus number */
00086         (*BusNumber)++;
00087     }
00088 
00089     /* FIXME: Add configuration data */
00090 }
00091 
00092 /* EOF */

Generated on Sat May 26 2012 04:17:53 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.