2023-07-19 19:00:27 +01:00
|
|
|
#ifndef AML_PARSER_H_
|
|
|
|
|
#define AML_PARSER_H_
|
|
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
|
|
struct acpi_namespace;
|
|
|
|
|
|
|
|
|
|
enum parse_status {
|
|
|
|
|
PARSE_OK = 0,
|
|
|
|
|
PARSE_EOF = -1,
|
|
|
|
|
PARSE_NOMEM = -2,
|
|
|
|
|
PARSE_BADSTRING = -3,
|
|
|
|
|
PARSE_UNKNOWNOP = -4,
|
|
|
|
|
PARSE_BADTYPE = -5,
|
|
|
|
|
PARSE_BADREF = -6,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct aml_parser_scope {
|
|
|
|
|
struct acpi_object *scope_object;
|
|
|
|
|
size_t scope_end;
|
|
|
|
|
struct aml_parser_scope *next;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct aml_parser {
|
2023-07-20 19:46:00 +01:00
|
|
|
int revision;
|
2023-07-19 19:00:27 +01:00
|
|
|
unsigned char *start, *end;
|
|
|
|
|
unsigned char *ptr, *saved_ptr;
|
|
|
|
|
struct acpi_namespace *ns;
|
|
|
|
|
struct aml_parser_scope *cur_scope;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern void aml_parser_init(struct aml_parser *parser, void *p, size_t len);
|
|
|
|
|
extern void aml_parser_set_namespace(struct aml_parser *parser, struct acpi_namespace *ns);
|
|
|
|
|
extern int aml_parser_peek(struct aml_parser *parser);
|
|
|
|
|
extern int aml_parser_peek_next(struct aml_parser *parser);
|
|
|
|
|
extern int aml_parser_advance(struct aml_parser *parser);
|
|
|
|
|
extern unsigned int aml_parser_cursorpos(struct aml_parser *parser);
|
|
|
|
|
extern void aml_parser_save_cursor(struct aml_parser *parser);
|
|
|
|
|
extern void aml_parser_load_cursor(struct aml_parser *parser);
|
|
|
|
|
extern void aml_parser_add_object(struct aml_parser *parser, struct acpi_object *object);
|
|
|
|
|
extern void aml_parser_push_scope(struct aml_parser *parser, struct acpi_object *object);
|
|
|
|
|
extern void aml_parser_pop_scope(struct aml_parser *parser);
|
|
|
|
|
|
|
|
|
|
extern enum parse_status aml_parser_parse_into_namespace(struct aml_parser *parser, struct acpi_namespace *ns);
|
|
|
|
|
extern struct acpi_object *aml_parser_resolve_path(struct aml_parser *parser, const char *path);
|
|
|
|
|
|
|
|
|
|
extern const char *parse_status_string(enum parse_status status);
|
|
|
|
|
|
|
|
|
|
#endif
|