diff options
Diffstat (limited to 'sys/arch/arm64/dev/smbios.c')
-rw-r--r-- | sys/arch/arm64/dev/smbios.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/sys/arch/arm64/dev/smbios.c b/sys/arch/arm64/dev/smbios.c index 911e056bb86..d9e9d906a63 100644 --- a/sys/arch/arm64/dev/smbios.c +++ b/sys/arch/arm64/dev/smbios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smbios.c,v 1.2 2019/08/04 10:00:37 kettenis Exp $ */ +/* $OpenBSD: smbios.c,v 1.3 2019/08/04 14:28:58 kettenis Exp $ */ /* * Copyright (c) 2006 Gordon Willem Klok <gklok@cogeco.ca> * Copyright (c) 2019 Mark Kettenis <kettenis@openbsd.org> @@ -167,9 +167,9 @@ fail: * smbios_find_table with the same arguments. */ int -smbios_find_table(u_int8_t type, struct smbtable *st) +smbios_find_table(uint8_t type, struct smbtable *st) { - u_int8_t *va, *end; + uint8_t *va, *end; struct smbtblhdr *hdr; int ret = 0, tcount = 1; @@ -184,20 +184,20 @@ smbios_find_table(u_int8_t type, struct smbtable *st) * preceding that referenced by the handle is encoded in bits 15:31. */ if ((st->cookie & 0xfff) == type && st->cookie >> 16) { - if ((u_int8_t *)st->hdr >= va && (u_int8_t *)st->hdr < end) { + if ((uint8_t *)st->hdr >= va && (uint8_t *)st->hdr < end) { hdr = st->hdr; if (hdr->type == type) { - va = (u_int8_t *)hdr + hdr->size; + va = (uint8_t *)hdr + hdr->size; for (; va + 1 < end; va++) if (*va == 0 && *(va + 1) == 0) break; - va+= 2; + va += 2; tcount = st->cookie >> 16; } } } - for (; va + sizeof(struct smbtblhdr) < end && tcount <= - smbios_entry.count; tcount++) { + for (; va + sizeof(struct smbtblhdr) < end && + tcount <= smbios_entry.count; tcount++) { hdr = (struct smbtblhdr *)va; if (hdr->type == type) { ret = 1; @@ -208,23 +208,23 @@ smbios_find_table(u_int8_t type, struct smbtable *st) } if (hdr->type == SMBIOS_TYPE_EOT) break; - va+= hdr->size; + va += hdr->size; for (; va + 1 < end; va++) if (*va == 0 && *(va + 1) == 0) break; - va+=2; + va += 2; } return ret; } char * -smbios_get_string(struct smbtable *st, u_int8_t indx, char *dest, size_t len) +smbios_get_string(struct smbtable *st, uint8_t indx, char *dest, size_t len) { - u_int8_t *va, *end; + uint8_t *va, *end; char *ret = NULL; int i; - va = (u_int8_t *)st->hdr + st->hdr->size; + va = (uint8_t *)st->hdr + st->hdr->size; end = smbios_entry.addr + smbios_entry.len; for (i = 1; va < end && i < indx && *va; i++) while (*va++) @@ -233,7 +233,7 @@ smbios_get_string(struct smbtable *st, u_int8_t indx, char *dest, size_t len) if (va + len < end) { ret = dest; memcpy(ret, va, len); - ret[len-1] = '\0'; + ret[len - 1] = '\0'; } } @@ -248,7 +248,7 @@ fixstring(char *s) for (i = 0; i < nitems(smbios_uninfo); i++) if ((strncasecmp(s, smbios_uninfo[i], - strlen(smbios_uninfo[i])))==0) + strlen(smbios_uninfo[i]))) == 0) return NULL; /* * Remove leading and trailing whitespace @@ -271,7 +271,7 @@ fixstring(char *s) } void -smbios_info(char * str) +smbios_info(char *str) { char *sminfop, sminfo[64]; struct smbtable stbl, btbl; @@ -295,11 +295,12 @@ smbios_info(char * str) if (havebb) board = (struct smbios_board *)btbl.tblhdr; /* - * Some smbios implementations have no system vendor or product strings, - * some have very uninformative data which is harder to work around - * and we must rely upon various heuristics to detect this. In both - * cases we attempt to fall back on the base board information in the - * perhaps naive belief that motherboard vendors will supply this + * Some smbios implementations have no system vendor or + * product strings, some have very uninformative data which is + * harder to work around and we must rely upon various + * heuristics to detect this. In both cases we attempt to fall + * back on the base board information in the perhaps naive + * belief that motherboard vendors will supply this * information. */ sminfop = NULL; |