SYSCTL_ADD_UINT - what am i doing wrong?

john at utzweb.net john at utzweb.net
Fri Jan 26 07:16:45 UTC 2007


Hello There!

I am having some gnarly grief with SYSCTL_ADD_UINT; it doesnt present the
data that i think that i have presented to it. What's strange about this
is that i use SYSCTL_ADD_STRING and it works perfectly.

Note that in the following for loop (in smbios_attach()), i use
SYSCTL_ADD_UINT, SYSCTL_ADD_STRING and my good debugging friend printf()

  for(u8IdxEntry = 0; u8IdxEntry < psmbios_structure->u8CntEntry;
u8IdxEntry++)
  {
    ssmbios_entry = pasmbios_structure_entry[u8IdxEntry];

    s_pu8Addr = smbios_entry_find( s_peps, s_pu8Addr,
psmbios_structure->u8Type,
				   ssmbios_entry.u8Offset,
				   ssmbios_entry.u8NumBytes);

    printf("Name: %s Addr: %p Val: %u\n", ssmbios_entry.acName, s_pu8Addr,
	   *s_pu8Addr);

    if(String==ssmbios_entry.etVal)

      SYSCTL_ADD_STRING( &psc->sysctl_ctx, ploid, OID_AUTO,
			 ssmbios_entry.acName, CTLFLAG_RD, s_pu8Addr, 0,
			 "");
    else
      SYSCTL_ADD_UINT( &psc->sysctl_ctx, ploid, OID_AUTO,
		       ssmbios_entry.acName, CTLFLAG_RD,
		       s_pu8Addr, 0, "");
  }


Here is the output of dmesg, note the 'Val: ' items, because these are the
correct numbers that are supposed to be there:

smbios0: <System Management BIOS> on motherboard
smbios0: Version: 2.3
smbios0: Latitude C400, Dell Computer Corporation, A12, 5PYHW11

Name: Type Addr: 0xc00f786b Val: 1
Name: Length Addr: 0xc00f786c Val: 25
Name: Handle Addr: 0xc00f786d Val: 0
Name: Manufacturer Addr: 0xc00f7884 Val: 68
Name: ProductName Addr: 0xc00f789e Val: 76
Name: Version Addr: 0xc334c63b Val: 0
Name: SerialNumber Addr: 0xc00f78bf Val: 53
Name: UUID Addr: 0xc00f7873 Val: 68
Name: Wake-upType Addr: 0xc00f7883 Val: 6
Name: SKUNumber Addr: 0xc00f7a22 Val: 18
Name: Family Addr: 0xc00f7aad Val: 182


Now, let's review the output of sysctl:

[spaz at minime /usr/home/spaz]$ sysctl hw.smbios
hw.smbios.system.Type: 16783617
hw.smbios.system.Length: 16842777
hw.smbios.system.Handle: 33620224
hw.smbios.system.Manufacturer: Dell Computer Corporation
hw.smbios.system.ProductName: Latitude C400
hw.smbios.system.Version:
hw.smbios.system.SerialNumber: 5PYHW11
hw.smbios.system.UUID: 1280066884
hw.smbios.system.Wake-upType: 1818575878
hw.smbios.system.SKUNumber: USB
hw.smbios.system.Family: ¶

The good news is that all of the *Strings* look great, but the int values
are crap; Type should be 1, Length should be 25, etc.

Can anybody offer any suggestions as to what i am doing wrong?

tnx!

johnu

ps: if i get this sorted out, then the only thing i need to do is finish
typing up the smbios structures, ie:

static struct smbios_structure_entry asmbios_entry_SYST[SMBIOS_CNT_SYST] =
{
  { "Type"             , 0x00, 1,      1 },
  { "Length"           , 0x01, 1, Varies },
  { "Handle"           , 0x02, 2, Varies },
  { "Manufacturer"     , 0x04, 0, String },
  { "ProductName"      , 0x05, 0, String },
  { "Version"          , 0x06, 0, String },
  { "SerialNumber"     , 0x07, 0, String },
  { "UUID"             , 0x08,16, Varies },
  { "Wake-upType"      , 0x18, 1, Enum   },
  { "SKUNumber"        , 0x19, 0, String },
  { "Family"           , 0x1a, 0, String }
};

and smbios.ko will be completed



More information about the freebsd-acpi mailing list