MCPcopy Create free account
hub / github.com/F-Stack/f-stack / smbios_attach

Function smbios_attach

freebsd/x86/bios/smbios.c:144–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144static int
145smbios_attach (device_t dev)
146{
147 struct smbios_softc *sc;
148 int error;
149
150 sc = device_get_softc(dev);
151 error = 0;
152
153 sc->dev = dev;
154 sc->rid = 0;
155 sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rid,
156 RF_ACTIVE);
157 if (sc->res == NULL) {
158 device_printf(dev, "Unable to allocate memory resource.\n");
159 error = ENOMEM;
160 goto bad;
161 }
162 sc->eps = RES2EPS(sc->res);
163
164 device_printf(dev, "Version: %u.%u",
165 sc->eps->major_version, sc->eps->minor_version);
166 if (bcd2bin(sc->eps->BCD_revision))
167 printf(", BCD Revision: %u.%u",
168 bcd2bin(sc->eps->BCD_revision >> 4),
169 bcd2bin(sc->eps->BCD_revision & 0x0f));
170 printf("\n");
171
172 return (0);
173bad:
174 if (sc->res)
175 bus_release_resource(dev, SYS_RES_MEMORY, sc->rid, sc->res);
176 return (error);
177}
178
179static int
180smbios_detach (device_t dev)

Callers

nothing calls this directly

Calls 6

device_get_softcFunction · 0.85
bus_alloc_resource_anyFunction · 0.85
device_printfFunction · 0.85
bus_release_resourceFunction · 0.85
bcd2binFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected