acpi-fpdt.c revision cf0fbc49e67b55f8d346fc94de28c90113505297
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 Kay Sievers
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "acpi-fpdt.h"
#include "alloc-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "time-util.h"
#include "util.h"
struct acpi_table_header {
char signature[4];
char oem_id[6];
char oem_table_id[8];
char asl_compiler_id[4];
};
enum {
ACPI_FPDT_TYPE_BOOT = 0,
};
struct acpi_fpdt_header {
};
struct acpi_fpdt_boot_header {
char signature[4];
};
enum {
ACPI_FPDT_BOOT_REC = 2,
};
struct acpi_fpdt_boot {
};
struct acpi_table_header *tbl;
size_t l = 0;
struct acpi_fpdt_header *rec;
int r;
struct acpi_fpdt_boot_header hbrec;
struct acpi_fpdt_boot brec;
if (r < 0)
return r;
if (l < sizeof(struct acpi_table_header) + sizeof(struct acpi_fpdt_header))
return -EINVAL;
return -EINVAL;
return -EINVAL;
/* find Firmware Basic Boot Performance Pointer Record */
break;
continue;
continue;
break;
}
if (ptr == 0)
return -EINVAL;
/* read Firmware Basic Boot Performance Data Record */
if (fd < 0)
return -errno;
if (l != sizeof(struct acpi_fpdt_boot_header))
return -EINVAL;
return -EINVAL;
return -EINVAL;
if (l != sizeof(struct acpi_fpdt_boot))
return -EINVAL;
return -EINVAL;
return -EINVAL;
return -EINVAL;
return -EINVAL;
if (loader_start)
if (loader_exit)
return 0;
}