Re: f486b352470e - main - LinuxKPI: add struct dmi_header and unsupported dmi_walk()

From: Ravi Pokala <rpokala_at_freebsd.org>
Date: Mon, 26 Sep 2022 19:57:21 UTC
-----Original Message-----
From: <owner-src-committers@freebsd.org> on behalf of "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: 2022-09-26, Monday at 12:42
To: <src-committers@FreeBSD.org>, <dev-commits-src-all@FreeBSD.org>, <dev-commits-src-main@FreeBSD.org>
Subject: git: f486b352470e - main - LinuxKPI: add struct dmi_header and unsupported dmi_walk()

    The branch main has been updated by bz:

    URL: https://cgit.FreeBSD.org/src/commit/?id=f486b352470edc82142766c2f3da2b8220774b7f

    commit f486b352470edc82142766c2f3da2b8220774b7f
    Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
    AuthorDate: 2022-09-23 22:21:06 +0000
    Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
    CommitDate: 2022-09-26 19:40:49 +0000

        LinuxKPI: add struct dmi_header and unsupported dmi_walk()

        Add a structure definition as well as a dummy dmi_walk for now
        which returns an error as not supported.  Our current dmi implementation
        is special but does not give access to all details but rather only
        information from kenv which does not suffice all use cases.

It seems to me that if we do a proper implementation of DMI parsing, it should probably be in smbios(4). Right?

-Ravi (rpokala@)

        MFC after:      1 week
        Reviewed by:    hselasky
        Differential Revision: https://reviews.freebsd.org/D36687
    ---
     sys/compat/linuxkpi/common/include/linux/dmi.h | 13 +++++++++++++
     1 file changed, 13 insertions(+)

    diff --git a/sys/compat/linuxkpi/common/include/linux/dmi.h b/sys/compat/linuxkpi/common/include/linux/dmi.h
    index 339f622f89b2..a3514c66f9cd 100644
    --- a/sys/compat/linuxkpi/common/include/linux/dmi.h
    +++ b/sys/compat/linuxkpi/common/include/linux/dmi.h
    @@ -34,6 +34,12 @@
     #include <sys/types.h>
     #include <linux/mod_devicetable.h>

    +struct dmi_header {
    +	uint8_t		type;
    +	uint8_t		length;
    +	uint16_t	handle;
    +};
    +
     int linux_dmi_check_system(const struct dmi_system_id *);
     bool linux_dmi_match(enum dmi_field, const char *);
     const struct dmi_system_id *linux_dmi_first_match(const struct dmi_system_id *);
    @@ -44,4 +50,11 @@ const char *linux_dmi_get_system_info(int);
     #define	dmi_first_match(sysid)	linux_dmi_first_match(sysid)
     #define	dmi_get_system_info(sysid)	linux_dmi_get_system_info(sysid)

    +static inline int
    +dmi_walk(void (*callbackf)(const struct dmi_header *, void *), void *arg)
    +{
    +
    +	return (-ENXIO);
    +}
    +
     #endif	/* __LINUXKPI_LINUX_DMI_H__ */