/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef GRUB_DSDT_TEST
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#endif
#ifndef GRUB_DSDT_TEST
#endif
static inline grub_uint32_t
{
int num_bytes, i;
if (*ptr < 64)
{
if (numlen)
*numlen = 1;
return *ptr;
}
if (numlen)
ptr++;
for (i = 0; i < num_bytes; i++)
{
ptr++;
}
return ret;
}
static inline grub_uint32_t
{
ptr++;
switch (*ptr)
{
case '.':
ptr++;
ptr += 8;
break;
case '/':
ptr++;
break;
case 0:
ptr++;
break;
default:
ptr += 4;
break;
}
}
static inline grub_uint32_t
{
switch (*ptr)
{
case GRUB_ACPI_OPCODE_PACKAGE:
case GRUB_ACPI_OPCODE_ZERO:
case GRUB_ACPI_OPCODE_ONES:
case GRUB_ACPI_OPCODE_ONE:
return 1;
return 2;
return 3;
return 5;
default:
return 0;
}
}
static inline grub_uint32_t
{
int add;
switch (*ptr)
{
ptr++;
ptr++;
break;
ptr++;
ptr++;
if (!add)
return 0;
if (!add)
return 0;
break;
ptr++;
break;
default:
return 0;
}
}
static int
{
{
int add;
switch (*ptr)
{
case GRUB_ACPI_OPCODE_EXTOP:
ptr++;
if (!add)
return -1;
break;
case GRUB_ACPI_OPCODE_NAME:
ptr++;
{
int ll;
if (*ptr2 != 0x12)
{
return -1;
}
ptr2++;
ptr2++;
switch (*ptr2)
{
case GRUB_ACPI_OPCODE_ZERO:
sleep_type = 0;
break;
case GRUB_ACPI_OPCODE_ONE:
sleep_type = 1;
break;
break;
default:
return -1;
}
}
if (!add)
return -1;
if (!add)
return -1;
break;
case GRUB_ACPI_OPCODE_SCOPE:
case GRUB_ACPI_OPCODE_IF:
case GRUB_ACPI_OPCODE_METHOD:
{
ptr++;
break;
}
}
}
return sleep_type;
}
#ifdef GRUB_DSDT_TEST
int
{
FILE *f;
unsigned char *buf;
if (argc < 2)
if (!f)
{
printf ("Couldn't open file\n");
return 1;
}
if (!buf)
{
printf ("Couldn't malloc buffer\n");
fclose (f);
return 2;
}
{
printf ("Read failed\n");
fclose (f);
return 2;
}
fclose (f);
return 0;
}
#else
void
grub_acpi_halt (void)
{
rsdp2 = grub_acpi_get_rsdpv2 ();
if (rsdp2)
else
rsdp1 = grub_acpi_get_rsdpv1 ();
if (!rsdp1)
return;
entry_ptr++)
{
{
break;
break;
sleep_type, port);
}
}
grub_millisleep (1500);
}
#endif