blob: 9dc9675bd68ad888cb00741564aa40d3fe67b5c5 [file] [log] [blame]
Rudolf Marek293b5f52009-02-01 18:35:15 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2009 Rudolf Marek <r.marek@assembler.cz>
5 *
6 * This program is free software; you can redistribute it and/or modify
Uwe Hermannc70e9fc2010-02-15 23:10:19 +00007 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
Rudolf Marek293b5f52009-02-01 18:35:15 +00009 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
Uwe Hermannc70e9fc2010-02-15 23:10:19 +000019
Rudolf Marek293b5f52009-02-01 18:35:15 +000020#ifndef LIBACPI_H
21#define LIBACPI_H
Uwe Hermannc70e9fc2010-02-15 23:10:19 +000022
Rudolf Marek293b5f52009-02-01 18:35:15 +000023#include <assert.h>
24#include <stdlib.h>
25#include <stdint.h>
26
Sven Schnelle0b86c762011-10-21 21:46:47 +020027struct cst_entry {
28 int type;
29 int width;
30 int offset;
31 int addrsize;
32 u64 address;
33 int ctype;
34 int latency;
35 int power;
36};
37
Rudolf Marek293b5f52009-02-01 18:35:15 +000038void acpigen_patch_len(int len);
39void acpigen_set_current(char *curr);
40char *acpigen_get_current(void);
41int acpigen_write_package(int nr_el);
42int acpigen_write_byte(unsigned int data);
43int acpigen_emit_byte(unsigned char data);
Myles Watson3fe6b702009-10-09 20:13:43 +000044int acpigen_emit_stream(const char *data, int size);
45int acpigen_emit_namestring(const char *namepath);
Rudolf Marek293b5f52009-02-01 18:35:15 +000046int acpigen_write_dword(unsigned int data);
Carl-Daniel Hailfingerd58671c2009-02-17 21:38:51 +000047int acpigen_write_qword(uint64_t data);
Myles Watson3fe6b702009-10-09 20:13:43 +000048int acpigen_write_name(const char *name);
49int acpigen_write_name_dword(const char *name, uint32_t val);
50int acpigen_write_name_qword(const char *name, uint64_t val);
51int acpigen_write_name_byte(const char *name, uint8_t val);
52int acpigen_write_scope(const char *name);
Rudolf Marekf997b552009-02-14 15:40:23 +000053int acpigen_write_PPC(u8 nr);
54int acpigen_write_empty_PCT(void);
55int acpigen_write_PSS_package(u32 coreFreq, u32 power, u32 transLat, u32 busmLat,
56 u32 control, u32 status);
Patrick Georgidf444bf2009-04-21 20:34:36 +000057typedef enum { SW_ALL=0xfc, SW_ANY=0xfd, HW_ALL=0xfe } PSD_coord;
58int acpigen_write_PSD_package(u32 domain, u32 numprocs, PSD_coord coordtype);
Sven Schnelle0b86c762011-10-21 21:46:47 +020059int acpigen_write_CST_package(struct cst_entry *entry, int nentries);
Rudolf Marekf997b552009-02-14 15:40:23 +000060int acpigen_write_processor(u8 cpuindex, u32 pblock_addr, u8 pblock_len);
Tobias Diedrich0fe6e9a2010-11-17 16:27:06 +000061int acpigen_write_mem32fixed(int readwrite, u32 base, u32 size);
62int acpigen_write_io16(u16 min, u16 max, u8 align, u8 len, u8 decode16);
Sven Schnelle0b86c762011-10-21 21:46:47 +020063int acpigen_write_register(int type, int width, int offset, int addrsize, u64 address);
Tobias Diedrich0fe6e9a2010-11-17 16:27:06 +000064int acpigen_write_resourcetemplate_header(void);
65int acpigen_write_resourcetemplate_footer(int len);
66int acpigen_write_mainboard_resource_template(void);
67int acpigen_write_mainboard_resources(const char *scope, const char *name);
Uwe Hermannc70e9fc2010-02-15 23:10:19 +000068
Sven Schnelle8d846132011-12-23 10:29:09 +010069int get_cst_entries(struct cst_entry **);
Sven Schnelle54600972011-10-22 13:41:16 +020070
Rudolf Marek293b5f52009-02-01 18:35:15 +000071#endif