⬢ DragonFlyBSD Kernel Audit
DF-2591 / pana_shim.c
← back to finding ↓ download raw
/*
 * pana_shim.c -- build glue ONLY (not part of the audited source).
 *
 * Purpose: compile the VERBATIM
 * sys/dev/acpica/acpi_panasonic/acpi_panasonic.c (pushed as
 * acpi_panasonic_verbatim.c, sha256-gated by build.sh:
 * 23e49741027f53dcedd05423f7c5eacd1be0dada1c46277dde0be6694b8d0912)
 * into the kernel with every ACPI external it calls renamed at the
 * preprocessor level to the panasim_* interpositions defined in
 * panasim.c.  The prelude below replicates the verbatim file's own
 * #include list so those includes become no-ops inside it; the
 * #defines are then active for exactly the verbatim driver body.
 *
 * Everything NOT renamed runs for real: newbus probe/attach/detach/
 * shutdown dispatch, the sysctl framework, ACPI_SERIAL_* locking
 * (including ACPI_SERIAL_ASSERT), device_printf, EVENTHANDLER.
 *
 * Renamed (fabricated firmware world): AcpiEvaluateObject,
 * AcpiOsFree, AcpiInstallNotifyHandler, AcpiRemoveNotifyHandler,
 * AcpiFormatException, ACPI_ID_PROBE, acpi_disabled, acpi_UserNotify,
 * acpi_event_sleep_button_sleep, power_profile_get_state.
 *
 * NOT renamed (real): acpi_get_handle (an ACPI-ivar accessor -- the
 * rig sets the child's handle ivar to ACPI_ROOT_OBJECT, a real,
 * always-valid ACPICA object), acpi_device_get_parent_softc (the fake
 * child's parent is the REAL acpi0, so the driver builds its sysctls
 * under the real hw.acpi tree exactly as on hardware).
 */

#include "opt_acpi.h"
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/power.h>

#include "acpi.h"

#include <dev/acpica/acpivar.h>
/* acpivar.h pulls in acpi_if.h, providing the ACPI_ID_PROBE inline
 * kobj dispatcher used below. */

#include "panasim.h"	/* prototypes of the panasim_* interpositions */

/* ---- interposition renames: active ONLY for the verbatim body ---- */
#undef	ACPI_ID_PROBE
#define	AcpiEvaluateObject			panasim_AcpiEvaluateObject
#define	AcpiOsFree				panasim_AcpiOsFree
#define	AcpiInstallNotifyHandler		panasim_AcpiInstallNotifyHandler
#define	AcpiRemoveNotifyHandler			panasim_AcpiRemoveNotifyHandler
#define	AcpiFormatException			panasim_AcpiFormatException
#define	acpi_disabled				panasim_acpi_disabled
#define	acpi_UserNotify				panasim_acpi_UserNotify
#define	acpi_event_sleep_button_sleep		panasim_acpi_event_sleep_button_sleep
#define	power_profile_get_state			panasim_power_profile_get_state
#define	ACPI_ID_PROBE(bus, dev, ids)		panasim_id_probe(bus, dev, ids)
/* ------------------------------------------------------------------ */

#include "acpi_panasonic_verbatim.c"