Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ipmi/ipmi_smbios.c
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | |||||
#define IPMI_BAM_IRQ_POLARITY 0x02 | #define IPMI_BAM_IRQ_POLARITY 0x02 | ||||
#define IPMI_BAM_IRQ_VALID 0x08 | #define IPMI_BAM_IRQ_VALID 0x08 | ||||
#define IPMI_BAM_ADDR_LSB(bam) (((bam) & 0x10) >> 4) | #define IPMI_BAM_ADDR_LSB(bam) (((bam) & 0x10) >> 4) | ||||
#define IPMI_BAM_REG_SPACING(bam) (((bam) & 0xc0) >> 6) | #define IPMI_BAM_REG_SPACING(bam) (((bam) & 0xc0) >> 6) | ||||
#define SPACING_8 0x0 | #define SPACING_8 0x0 | ||||
#define SPACING_32 0x1 | #define SPACING_32 0x1 | ||||
#define SPACING_16 0x2 | #define SPACING_16 0x2 | ||||
typedef void (*smbios_callback_t)(struct smbios_structure_header *, void *); | |||||
static struct ipmi_get_info ipmi_info; | static struct ipmi_get_info ipmi_info; | ||||
static int ipmi_probed; | static int ipmi_probed; | ||||
static struct mtx ipmi_info_mtx; | static struct mtx ipmi_info_mtx; | ||||
MTX_SYSINIT(ipmi_info, &ipmi_info_mtx, "ipmi info", MTX_DEF); | MTX_SYSINIT(ipmi_info, &ipmi_info_mtx, "ipmi info", MTX_DEF); | ||||
static void ipmi_smbios_probe(struct ipmi_get_info *); | static void ipmi_smbios_probe(struct ipmi_get_info *); | ||||
static int smbios_cksum(struct smbios_eps *); | 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 smbios_ipmi_info(struct smbios_structure_header *, void *); | ||||
static void | static void | ||||
smbios_ipmi_info(struct smbios_structure_header *h, void *arg) | smbios_ipmi_info(struct smbios_structure_header *h, void *arg) | ||||
{ | { | ||||
struct ipmi_get_info *info; | struct ipmi_get_info *info; | ||||
struct ipmi_entry *s; | struct ipmi_entry *s; | ||||
Show All 38 Lines | smbios_ipmi_info(struct smbios_structure_header *h, void *arg) | ||||
if (s->length > offsetof(struct ipmi_entry, interrupt_number)) { | if (s->length > offsetof(struct ipmi_entry, interrupt_number)) { | ||||
if (s->interrupt_number > 15) | if (s->interrupt_number > 15) | ||||
printf("SMBIOS: Non-ISA IRQ %d for IPMI\n", | printf("SMBIOS: Non-ISA IRQ %d for IPMI\n", | ||||
s->interrupt_number); | s->interrupt_number); | ||||
else | else | ||||
info->irq = s->interrupt_number; | info->irq = s->interrupt_number; | ||||
} | } | ||||
info->iface_type = s->interface_type; | 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 | * 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 | * one, return the parsed data in the passed in ipmi_get_info structure and | ||||
* return true. If we don't find one, return false. | * return true. If we don't find one, return false. | ||||
*/ | */ | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |