ipmi_smbios.c (6d67af5f8e66218ab0b3d927837fe00903c2feac) ipmi_smbios.c (f689cb23b2782d0d0f586bcfabbad68f728ed1df)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2006 IronPort Systems Inc. <ambrisko@ironport.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 65 unchanged lines hidden (view full) ---

74#define IPMI_BAM_IRQ_POLARITY 0x02
75#define IPMI_BAM_IRQ_VALID 0x08
76#define IPMI_BAM_ADDR_LSB(bam) (((bam) & 0x10) >> 4)
77#define IPMI_BAM_REG_SPACING(bam) (((bam) & 0xc0) >> 6)
78#define SPACING_8 0x0
79#define SPACING_32 0x1
80#define SPACING_16 0x2
81
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2006 IronPort Systems Inc. <ambrisko@ironport.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 65 unchanged lines hidden (view full) ---

74#define IPMI_BAM_IRQ_POLARITY 0x02
75#define IPMI_BAM_IRQ_VALID 0x08
76#define IPMI_BAM_ADDR_LSB(bam) (((bam) & 0x10) >> 4)
77#define IPMI_BAM_REG_SPACING(bam) (((bam) & 0xc0) >> 6)
78#define SPACING_8 0x0
79#define SPACING_32 0x1
80#define SPACING_16 0x2
81
82typedef void (*smbios_callback_t)(struct smbios_structure_header *, void *);
83
84static struct ipmi_get_info ipmi_info;
85static int ipmi_probed;
86static struct mtx ipmi_info_mtx;
87MTX_SYSINIT(ipmi_info, &ipmi_info_mtx, "ipmi info", MTX_DEF);
88
89static void ipmi_smbios_probe(struct ipmi_get_info *);
90static int smbios_cksum(struct smbios_eps *);
82static struct ipmi_get_info ipmi_info;
83static int ipmi_probed;
84static struct mtx ipmi_info_mtx;
85MTX_SYSINIT(ipmi_info, &ipmi_info_mtx, "ipmi info", MTX_DEF);
86
87static void ipmi_smbios_probe(struct ipmi_get_info *);
88static int smbios_cksum(struct smbios_eps *);
91static void smbios_walk_table(uint8_t *, int, smbios_callback_t,
92 void *);
93static void smbios_ipmi_info(struct smbios_structure_header *, void *);
94
95static void
96smbios_ipmi_info(struct smbios_structure_header *h, void *arg)
97{
98 struct ipmi_get_info *info;
99 struct ipmi_entry *s;
100

--- 40 unchanged lines hidden (view full) ---

141 printf("SMBIOS: Non-ISA IRQ %d for IPMI\n",
142 s->interrupt_number);
143 else
144 info->irq = s->interrupt_number;
145 }
146 info->iface_type = s->interface_type;
147}
148
89static void smbios_ipmi_info(struct smbios_structure_header *, void *);
90
91static void
92smbios_ipmi_info(struct smbios_structure_header *h, void *arg)
93{
94 struct ipmi_get_info *info;
95 struct ipmi_entry *s;
96

--- 40 unchanged lines hidden (view full) ---

137 printf("SMBIOS: Non-ISA IRQ %d for IPMI\n",
138 s->interrupt_number);
139 else
140 info->irq = s->interrupt_number;
141 }
142 info->iface_type = s->interface_type;
143}
144
149static void
150smbios_walk_table(uint8_t *p, int entries, smbios_callback_t cb, void *arg)
151{
152 struct smbios_structure_header *s;
153
154 while (entries--) {
155 s = (struct smbios_structure_header *)p;
156 cb(s, arg);
157
158 /*
159 * Look for a double-nul after the end of the
160 * formatted area of this structure.
161 */
162 p += s->length;
163 while (!(p[0] == 0 && p[1] == 0))
164 p++;
165
166 /*
167 * Skip over the double-nul to the start of the next
168 * structure.
169 */
170 p += 2;
171 }
172}
173
174/*
175 * Walk the SMBIOS table looking for an IPMI (type 38) entry. If we find
176 * one, return the parsed data in the passed in ipmi_get_info structure and
177 * return true. If we don't find one, return false.
178 */
179static void
180ipmi_smbios_probe(struct ipmi_get_info *info)
181{

--- 88 unchanged lines hidden ---
145/*
146 * Walk the SMBIOS table looking for an IPMI (type 38) entry. If we find
147 * one, return the parsed data in the passed in ipmi_get_info structure and
148 * return true. If we don't find one, return false.
149 */
150static void
151ipmi_smbios_probe(struct ipmi_get_info *info)
152{

--- 88 unchanged lines hidden ---