diff options
author | Robert Mustacchi <rm@fingolfin.org> | 2019-12-26 04:28:10 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@fingolfin.org> | 2020-01-11 07:43:21 +0000 |
commit | 1d77dcda79ea31b52efaac166328f8a7f7359d5a (patch) | |
tree | b88651b4832626cec6a717aba4eacee6252b78c5 | |
parent | 176a9270a1856e0e2fddcbc3c7d35aa1f750c6b9 (diff) | |
download | illumos-joyent-1d77dcda79ea31b52efaac166328f8a7f7359d5a.tar.gz |
12138 Want smbios pointer device decoding
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/cmd/smbios/smbios.c | 21 | ||||
-rw-r--r-- | usr/src/common/smbios/mktables.sh | 2 | ||||
-rw-r--r-- | usr/src/common/smbios/smb_info.c | 24 | ||||
-rw-r--r-- | usr/src/lib/libsmbios/common/mapfile-vers | 3 | ||||
-rw-r--r-- | usr/src/uts/common/sys/smbios.h | 36 | ||||
-rw-r--r-- | usr/src/uts/common/sys/smbios_impl.h | 7 |
6 files changed, 93 insertions, 0 deletions
diff --git a/usr/src/cmd/smbios/smbios.c b/usr/src/cmd/smbios/smbios.c index 0a82c56ff3..2c0c844674 100644 --- a/usr/src/cmd/smbios/smbios.c +++ b/usr/src/cmd/smbios/smbios.c @@ -1467,6 +1467,23 @@ print_processor_info(smbios_hdl_t *shp, id_t id, FILE *fp) } static void +print_pointdev(smbios_hdl_t *shp, id_t id, FILE *fp) +{ + smbios_pointdev_t pd; + + if (smbios_info_pointdev(shp, id, &pd) != 0) { + smbios_warn(shp, "failed to read pointer device information"); + return; + } + + desc_printf(smbios_pointdev_type_desc(pd.smbpd_type), + fp, " Type: %u", pd.smbpd_type); + desc_printf(smbios_pointdev_iface_desc(pd.smbpd_iface), + fp, " Interface: %u", pd.smbpd_iface); + oprintf(fp, " Buttons: %u\n", pd.smbpd_nbuttons); +} + +static void print_extprocessor(smbios_hdl_t *shp, id_t id, FILE *fp) { int i; @@ -1661,6 +1678,10 @@ print_struct(smbios_hdl_t *shp, const smbios_struct_t *sp, void *fp) oprintf(fp, "\n"); print_memdevmap(shp, sp->smbstr_id, fp); break; + case SMB_TYPE_POINTDEV: + oprintf(fp, "\n"); + print_pointdev(shp, sp->smbstr_id, fp); + break; case SMB_TYPE_SECURITY: oprintf(fp, "\n"); print_hwsec(shp, fp); diff --git a/usr/src/common/smbios/mktables.sh b/usr/src/common/smbios/mktables.sh index d946029626..bb6c077791 100644 --- a/usr/src/common/smbios/mktables.sh +++ b/usr/src/common/smbios/mktables.sh @@ -99,6 +99,8 @@ SMB_MDR_ smbios_memdevice_rank_desc uint_t SMB_MTECH_ smbios_memdevice_memtech_desc uint_t SMB_MOMC_ smbios_memdevice_op_capab_desc uint_t SMB_OBT_ smbios_onboard_type_desc uint_t +SMB_PDI_ smbios_pointdev_iface_desc uint_t +SMB_PDT_ smbios_pointdev_type_desc uint_t SMB_POC_ smbios_port_conn_desc uint_t SMB_POT_ smbios_port_type_desc uint_t SMB_PRC_ smbios_processor_core_flag_desc uint_t diff --git a/usr/src/common/smbios/smb_info.c b/usr/src/common/smbios/smb_info.c index d22f20aa0e..c4376fd081 100644 --- a/usr/src/common/smbios/smb_info.c +++ b/usr/src/common/smbios/smb_info.c @@ -1674,3 +1674,27 @@ smbios_info_processor_riscv(smbios_hdl_t *shp, id_t id, return (0); } + +int +smbios_info_pointdev(smbios_hdl_t *shp, id_t id, smbios_pointdev_t *pd) +{ + const smb_struct_t *stp = smb_lookup_id(shp, id); + smb_pointdev_t point; + + if (stp->smbst_hdr->smbh_type != SMB_TYPE_POINTDEV) { + return (smb_set_errno(shp, ESMB_TYPE)); + } + + if (stp->smbst_hdr->smbh_len < sizeof (point)) { + return (smb_set_errno(shp, ESMB_SHORT)); + } + + bzero(pd, sizeof (*pd)); + smb_info_bcopy(stp->smbst_hdr, &point, sizeof (point)); + + pd->smbpd_type = point.smbpdev_type; + pd->smbpd_iface = point.smbpdev_iface; + pd->smbpd_nbuttons = point.smbpdev_nbuttons; + + return (0); +} diff --git a/usr/src/lib/libsmbios/common/mapfile-vers b/usr/src/lib/libsmbios/common/mapfile-vers index 1ac11a038e..dd09785fe3 100644 --- a/usr/src/lib/libsmbios/common/mapfile-vers +++ b/usr/src/lib/libsmbios/common/mapfile-vers @@ -101,6 +101,7 @@ SYMBOL_VERSION SUNWprivate_1.1 { smbios_info_memdevmap; smbios_info_obdevs; smbios_info_obdevs_ext; + smbios_info_pointdev; smbios_info_port; smbios_info_extport; smbios_info_powersup; @@ -139,6 +140,8 @@ SYMBOL_VERSION SUNWprivate_1.1 { smbios_memdevice_rank_desc; smbios_open; smbios_onboard_type_desc; + smbios_pointdev_iface_desc; + smbios_pointdev_type_desc; smbios_port_conn_desc; smbios_port_type_desc; smbios_powersup_flag_desc; diff --git a/usr/src/uts/common/sys/smbios.h b/usr/src/uts/common/sys/smbios.h index c6117665c3..82a81b5a28 100644 --- a/usr/src/uts/common/sys/smbios.h +++ b/usr/src/uts/common/sys/smbios.h @@ -1347,6 +1347,38 @@ typedef struct smbios_memdevmap { } smbios_memdevmap_t; /* + * SMBIOS Builtin Pointing Device (SMB_TYPE_POINTDEV). See DSP0134 Sectin 7.22 + * for more information. + */ +typedef struct smbios_pointdev { + uint16_t smbpd_type; /* device type */ + uint16_t smbpd_iface; /* device information */ + uint8_t smbpd_nbuttons; /* number of buttons */ +} smbios_pointdev_t; + +#define SMB_PDT_OTHER 0x01 /* Other */ +#define SMB_PDT_UNKNOWN 0x02 /* Unknown */ +#define SMB_PDT_MOUSE 0x03 /* Mouse */ +#define SMB_PDT_TRBALL 0x04 /* Track Ball */ +#define SMB_PDT_TRPOINT 0x05 /* Track Point */ +#define SMB_PDT_GLPOINT 0x06 /* Glide Point */ +#define SMB_PDT_TOPAD 0x07 /* Touch Pad */ +#define SMB_PDT_TOSCREEN 0x08 /* Touch Screen */ +#define SMB_PDT_OPTSENSE 0x09 /* Optical Sensor */ + +#define SMB_PDI_OTHER 0x01 /* Other */ +#define SMB_PDI_UNKNOWN 0x02 /* Unknown */ +#define SMB_PDI_SERIAL 0x03 /* Serial */ +#define SMB_PDI_PS2 0x04 /* PS/2 */ +#define SMB_PDI_INFRARED 0x05 /* Infrared */ +#define SMB_PDI_HPHIL 0x06 /* HP-HIL */ +#define SMB_PDI_BUSM 0x07 /* Bus mouse */ +#define SMB_PDI_ADB 0x08 /* ADB (Apple Desktop Bus) */ +#define SMB_PDI_BUSM_DB9 0xA0 /* Bus mouse DB-9 */ +#define SMB_PDI_BUSM_UDIN 0xA1 /* Bus mouse micro-DIN */ +#define SMB_PDI_BUSM_USB 0xA2 /* USB */ + +/* * SMBIOS Hardware Security Settings. See DSP0134 Section 7.25 for more * information. Only one such record will be present in the SMBIOS. */ @@ -1834,6 +1866,7 @@ extern int smbios_info_processor(smbios_hdl_t *, id_t, smbios_processor_t *); extern int smbios_info_extprocessor(smbios_hdl_t *, id_t, smbios_processor_ext_t *); extern int smbios_info_cache(smbios_hdl_t *, id_t, smbios_cache_t *); +extern int smbios_info_pointdev(smbios_hdl_t *, id_t, smbios_pointdev_t *); extern int smbios_info_port(smbios_hdl_t *, id_t, smbios_port_t *); extern int smbios_info_extport(smbios_hdl_t *, id_t, smbios_port_ext_t *); extern int smbios_info_slot(smbios_hdl_t *, id_t, smbios_slot_t *); @@ -1950,6 +1983,9 @@ extern const char *smbios_memdevice_op_capab_desc(uint_t); extern const char *smbios_onboard_type_desc(uint_t); +extern const char *smbios_pointdev_iface_desc(uint_t); +extern const char *smbios_pointdev_type_desc(uint_t); + extern const char *smbios_port_conn_desc(uint_t); extern const char *smbios_port_type_desc(uint_t); diff --git a/usr/src/uts/common/sys/smbios_impl.h b/usr/src/uts/common/sys/smbios_impl.h index 5e6a1c3761..69ca79e94f 100644 --- a/usr/src/uts/common/sys/smbios_impl.h +++ b/usr/src/uts/common/sys/smbios_impl.h @@ -389,6 +389,13 @@ typedef struct smb_memdevmap { uint64_t smbdmap_extend; /* extended ending address */ } smb_memdevmap_t; +typedef struct smb_pointdev { + smb_header_t smbpdev_hdr; /* structure header */ + uint8_t smbpdev_type; /* device type */ + uint8_t smbpdev_iface; /* device interface */ + uint8_t smbpdev_nbuttons; /* number of buttons */ +} smb_pointdev_t; + /* * SMBIOS implementation structure for SMB_TYPE_BATTERY. */ |