- Don't execute cpuid to fetch the features. We already have the features

present in cpu_feature2.  Also, use CPUID2_EST rather than a magic
  number.
- Don't free the ACPI settings list in detach if we are going to fail the
  request.  Otherwise an attempt to kldunload est would free the array
  but the driver would keep trying to use it.

MFC after:	1 week
This commit is contained in:
jhb 2008-03-10 22:00:35 +00:00
parent 700cab4d41
commit e0c2a8245e

View File

@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include "cpufreq_if.h"
#include <machine/md_var.h>
#include <machine/specialreg.h>
#include <contrib/dev/acpica/acpi.h>
#include <dev/acpica/acpivar.h>
@ -946,7 +947,6 @@ static void
est_identify(driver_t *driver, device_t parent)
{
device_t child;
u_int p[4];
/* Make sure we're not being doubly invoked. */
if (device_find_child(parent, "est", -1) != NULL)
@ -958,11 +958,9 @@ est_identify(driver_t *driver, device_t parent)
return;
/*
* Read capability bits and check if the CPU supports EST.
* This is indicated by bit 7 of ECX.
* Check if the CPU supports EST.
*/
do_cpuid(1, p);
if ((p[2] & 0x80) == 0)
if (!(cpu_feature2 & CPUID2_EST))
return;
/*
@ -1033,11 +1031,13 @@ est_attach(device_t dev)
static int
est_detach(device_t dev)
{
#if 0
struct est_softc *sc;
sc = device_get_softc(dev);
if (sc->acpi_settings)
free(sc->freq_list, M_DEVBUF);
#endif
return (ENXIO);
}