1/*	$NetBSD: apeivar.h,v 1.1 2024/03/20 17:11:44 riastradh Exp $	*/
2
3/*-
4 * Copyright (c) 2024 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef	_SYS_DEV_ACPI_APEIVAR_H_
30#define	_SYS_DEV_ACPI_APEIVAR_H_
31
32#include <sys/types.h>
33
34#include <sys/device.h>
35
36#include <dev/acpi/acpivar.h>
37#include <dev/acpi/apei_bertvar.h>
38#include <dev/acpi/apei_einjvar.h>
39#include <dev/acpi/apei_erstvar.h>
40#include <dev/acpi/apei_hestvar.h>
41
42struct sysctllog;
43struct sysctlnode;
44
45/*
46 * struct apei_tab
47 *
48 *	Collection of pointers to APEI-related ACPI tables.  Used
49 *	inside struct apei_softc, and by apei_match without an
50 *	apei_softc.
51 */
52struct apei_tab {
53	ACPI_TABLE_BERT	*bert;	/* Boot Error Record Table */
54	ACPI_TABLE_EINJ	*einj;	/* Error Injection Table */
55	ACPI_TABLE_ERST	*erst;	/* Error Record Serialization Table */
56	ACPI_TABLE_HEST	*hest;	/* Hardware Error Source Table */
57};
58
59/*
60 * struct apei_softc
61 *
62 *	All software state for APEI.
63 */
64struct apei_softc {
65	device_t		sc_dev;
66	struct apei_tab		sc_tab;
67
68	struct sysctllog	*sc_sysctllog;
69	const struct sysctlnode	*sc_sysctlroot;
70
71	struct apei_bert_softc	sc_bert;
72	struct apei_einj_softc	sc_einj;
73	struct apei_erst_softc	sc_erst;
74	struct apei_hest_softc	sc_hest;
75};
76
77uint32_t apei_gesb_report(struct apei_softc *,
78    const ACPI_HEST_GENERIC_STATUS *, size_t, const char *,
79    bool *);
80
81#endif	/* _SYS_DEV_ACPI_APEIVAR_H_ */
82