[syslinux] First attempt to use DMI in a com32 module

Erwan Velu erwan at seanodes.com
Mon Aug 14 11:06:44 PDT 2006


This is a first attempt to make the DMI table accessible in a com32 module.
This patch applies to the latest syslinux (3.20-pre11).

It will add some headers in com32/include/dmi and three files in
com32/modules/.
dmi.c
     This is the core program that makes the dmi tables accessible.

dmi_utils.c
     Just a small util file to display some more complicated messages

dmitest.c
    The program that show how to use the dmi inside a com32 module.

The way the API works :

dmi_interate() tells if a DMI table is present or not.
s_dmi is the structure that contains the dmi informations.
parse_dmitable(&dmi) fills a dmi structure with the elements founds in
the table.

And.... that's all ;)

So the following code is enough :

s_dmi dmi;
if (dmi_iterate()) parse_dmitable(&dmi);

Simple isn't it ?

Then, if you like to access to the elements, you just have to print them.
The s_dmi structure contains some s_system, s_bios, s_chassis,
s_base_board, s_processor structures.
They represent the content of the DMI HANDLES number 0,1,2,3,4. I was
too lazy to continue to the remaining items. Maybe later if they are
really needed in pxelinux.

So if you like to know the form factor of the running system,
dmi.chassis.type will return one of theses decribes by the DMI spec
meaning one of theses:
                 "Other", /* 0x01 */
                 "Unknown",
                 "Desktop",
                 "Low Profile Desktop",
                 "Pizza Box",
                 "Mini Tower",
                 "Tower",
                 "Portable",
                 "Laptop",
                 "Notebook",
                 "Hand Held",
                 "Docking Station",
                 "All In One",
                 "Sub Notebook",
                 "Space-saving",
                 "Lunch Box",
                 "Main Server Chassis", /* master.mif says System */
                 "Expansion Chassis",
                 "Sub Chassis",
                 "Bus Expansion Chassis",
                 "Peripheral Chassis",
                 "RAID Chassis",
                 "Rack Mount Chassis",
                 "Sealed-case PC",
                 "Multi-system" /* 0x19 */

Or for example, you can do the same with the flags of your processor like :
The boolean "dmi.processor.cpu_flags.sse2"  knows if the local processor
supports SSE2.

The dmitest.c32 program will test all of the handles currently implemented.
A simple prompt appear, just type the kind of handle you like to see.
Please tell me if its works for you.

PS: I would like to thanks the dmidecode project and the Linux kernel
project. I've been using a lot of code from this two projects to make
this possible.
Both of them are GPL, so no problems to use some code in syslinux.
PS2: Of course, my code is GPL too ;)

Erwan,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: syslinux-3.20-pre11-dmi.patch
Type: text/x-patch
Size: 48742 bytes
Desc: not available
URL: <http://www.zytor.com/pipermail/syslinux/attachments/20060814/73809565/attachment.bin>


More information about the Syslinux mailing list