Page MenuHomeFreeBSD

D29270.id85784.diff
No OneTemporary

D29270.id85784.diff

diff --git a/sys/dev/ipmi/ipmi_smbios.c b/sys/dev/ipmi/ipmi_smbios.c
--- a/sys/dev/ipmi/ipmi_smbios.c
+++ b/sys/dev/ipmi/ipmi_smbios.c
@@ -79,8 +79,6 @@
#define SPACING_32 0x1
#define SPACING_16 0x2
-typedef void (*smbios_callback_t)(struct smbios_structure_header *, void *);
-
static struct ipmi_get_info ipmi_info;
static int ipmi_probed;
static struct mtx ipmi_info_mtx;
@@ -88,8 +86,6 @@
static void ipmi_smbios_probe(struct ipmi_get_info *);
static int smbios_cksum(struct smbios_eps *);
-static void smbios_walk_table(uint8_t *, int, smbios_callback_t,
- void *);
static void smbios_ipmi_info(struct smbios_structure_header *, void *);
static void
@@ -146,31 +142,6 @@
info->iface_type = s->interface_type;
}
-static void
-smbios_walk_table(uint8_t *p, int entries, smbios_callback_t cb, void *arg)
-{
- struct smbios_structure_header *s;
-
- while (entries--) {
- s = (struct smbios_structure_header *)p;
- cb(s, arg);
-
- /*
- * Look for a double-nul after the end of the
- * formatted area of this structure.
- */
- p += s->length;
- while (!(p[0] == 0 && p[1] == 0))
- p++;
-
- /*
- * Skip over the double-nul to the start of the next
- * structure.
- */
- p += 2;
- }
-}
-
/*
* Walk the SMBIOS table looking for an IPMI (type 38) entry. If we find
* one, return the parsed data in the passed in ipmi_get_info structure and
diff --git a/sys/dev/smbios/smbios.h b/sys/dev/smbios/smbios.h
--- a/sys/dev/smbios/smbios.h
+++ b/sys/dev/smbios/smbios.h
@@ -56,12 +56,39 @@
uint32_t structure_table_address;
uint16_t number_structures;
uint8_t BCD_revision;
-};
+} __packed;
struct smbios_structure_header {
uint8_t type;
uint8_t length;
uint16_t handle;
-};
+} __packed;
+
+typedef void (*smbios_callback_t)(struct smbios_structure_header *, void *);
+
+static inline void
+smbios_walk_table(uint8_t *p, int entries, smbios_callback_t cb, void *arg)
+{
+ struct smbios_structure_header *s;
+
+ while (entries--) {
+ s = (struct smbios_structure_header *)p;
+ cb(s, arg);
+
+ /*
+ * Look for a double-nul after the end of the
+ * formatted area of this structure.
+ */
+ p += s->length;
+ while (!(p[0] == 0 && p[1] == 0))
+ p++;
+
+ /*
+ * Skip over the double-nul to the start of the next
+ * structure.
+ */
+ p += 2;
+ }
+}
#endif /* _SMBIOS_H_ */

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 4:02 AM (16 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14853993
Default Alt Text
D29270.id85784.diff (2 KB)

Event Timeline