dev/ic/tpm: Tidy up headers.

- Add include guards.
- Add necessary includes.
- Sort includes.
- Use _BYTE_ORDER, not BYTE_ORDER, for public header.
This commit is contained in:
riastradh 2021-01-04 18:22:19 +00:00
parent 983a72cbb8
commit e05111c27e
3 changed files with 33 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tpm.c,v 1.16 2019/10/09 14:03:58 maxv Exp $ */
/* $NetBSD: tpm.c,v 1.17 2021/01/04 18:22:19 riastradh Exp $ */
/*
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@ -48,17 +48,19 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.16 2019/10/09 14:03:58 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.17 2021/01/04 18:22:19 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/types.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/device.h>
#include <sys/conf.h>
#include <sys/bus.h>
#include <sys/pmf.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <dev/ic/tpmreg.h>
#include <dev/ic/tpmvar.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: tpmreg.h,v 1.6 2019/10/09 07:30:58 maxv Exp $ */
/* $NetBSD: tpmreg.h,v 1.7 2021/01/04 18:22:19 riastradh Exp $ */
/*
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@ -29,7 +29,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#if (BYTE_ORDER == LITTLE_ENDIAN)
#ifndef DEV_IC_TPMREG_H
#define DEV_IC_TPMREG_H
#include <sys/types.h>
#include <sys/cdefs.h>
#include <sys/endian.h>
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
#define TPM_BE16(a) bswap16(a)
#define TPM_BE32(a) bswap32(a)
#else
@ -105,3 +113,5 @@ struct tpm_header {
* Five localities, 4K per locality.
*/
#define TPM_SPACE_SIZE 0x5000
#endif /* DEV_IC_TPMREG_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: tpmvar.h,v 1.7 2019/10/09 14:03:58 maxv Exp $ */
/* $NetBSD: tpmvar.h,v 1.8 2021/01/04 18:22:19 riastradh Exp $ */
/*
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@ -29,6 +29,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DEV_IC_TPMVAR_H
#define DEV_IC_TPMVAR_H
#include <sys/types.h>
#define TPM_API_VERSION 1
enum tpm_version {
@ -54,6 +59,10 @@ struct tpm_ioc_getinfo {
#ifdef _KERNEL
#include <sys/bus.h>
#include <sys/device_if.h>
#include <sys/mutex.h>
struct tpm_softc;
struct tpm_intf {
@ -88,3 +97,5 @@ bool tpm_suspend(device_t, const pmf_qual_t *);
bool tpm_resume(device_t, const pmf_qual_t *);
#endif
#endif /* DEV_IC_TPMVAR_H */