CMOS: Add set_option and rework get_option.
authorLuc Verhaegen <libv@skynet.be>
Wed, 3 Jun 2009 10:47:19 +0000 (10:47 +0000)
committerLuc Verhaegen <libv@skynet.be>
Wed, 3 Jun 2009 10:47:19 +0000 (10:47 +0000)
commit9ceae905f10a555835db0af072c3adfff98b3a7b
tree1ea238ee0dbf2b4c4ed206326ed4bf2457f9a018
parenta922b3195b77a3cc82bafad20dd3dfcfd2a61bc0
CMOS: Add set_option and rework get_option.

To ease some of my debugging pain on the unichrome, i decided i needed to
move FB size selection into cmos, so i could test a size and then reset it
to the default after loading this value so that the next reboot uses the
(working) default again. This meant implementing set_option in parallel to
get_option.

get_option was then found to have inversed argument ordering (like outb) and
passing char * and then depending on the cmos layout length, which made me
feel quite uncomfortable. Since we either have reserved space (which we
shouldn't do anything with in these two functions), an enum or a
hexadecimal value, unsigned int seemed like the way to go. So all users of
get_option now have their arguments inversed and switched from using ints
to unsigned ints now.

The way get_cmos_value was implemented forced us to not overlap byte and to
have multibyte values be byte aligned. This logic is now adapted to do a
full uint32_t read (when needed) at any offset and any length up to 32, and
the shifting all happens inside an uint32_t as well. set_cmos_value was
implemented similarly. Both routines have been extensively tested in a
quick separate little program as it is not easy to get this stuff right.

build_opt_tbl.c was altered to function correctly within these new
parameters. The enum value retrieval has been changed strol(..., NULL, 10)
to stroul(..., NULL, 0), so that we not only are able to use unsigned ints
now but so that we also interprete hex values correctly. The 32bit limit
gets imposed on all entries not marked reserved, an unused "user_data" field
that appeared in a lot of cmos.layouts has been changed to reserved as well.

Signed-off-by: Luc Verhaegen <libv@skynet.be>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4332 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
81 files changed:
src/console/console.c
src/console/printk.c
src/console/uart8250_console.c
src/cpu/amd/dualcore/amd_sibling.c
src/cpu/amd/model_fxx/model_fxx_init.c
src/cpu/amd/quadcore/amd_sibling.c
src/cpu/intel/hyperthreading/intel_sibling.c
src/include/console/console.h
src/include/pc80/mc146818rtc.h
src/mainboard/amd/dbm690t/cmos.layout
src/mainboard/amd/pistachio/cmos.layout
src/mainboard/amd/serengeti_cheetah/cmos.layout
src/mainboard/amd/serengeti_cheetah_fam10/cmos.layout
src/mainboard/arima/hdama/cmos.layout
src/mainboard/asus/a8n_e/cmos.layout
src/mainboard/asus/a8v-e_se/cmos.layout
src/mainboard/asus/m2v-mx_se/cmos.layout
src/mainboard/broadcom/blast/cmos.layout
src/mainboard/dell/s1850/cmos.layout
src/mainboard/gigabyte/ga_2761gxdk/cmos.layout
src/mainboard/gigabyte/m57sli/cmos.layout
src/mainboard/hp/dl145_g3/cmos.layout
src/mainboard/ibm/e325/cmos.layout
src/mainboard/ibm/e326/cmos.layout
src/mainboard/intel/jarrell/cmos.layout
src/mainboard/iwill/dk8_htx/cmos.layout
src/mainboard/iwill/dk8s2/cmos.layout
src/mainboard/iwill/dk8x/cmos.layout
src/mainboard/msi/ms7135/cmos.layout
src/mainboard/msi/ms7260/cmos.layout
src/mainboard/msi/ms9185/cmos.layout
src/mainboard/msi/ms9282/cmos.layout
src/mainboard/newisys/khepri/cmos.layout
src/mainboard/nvidia/l1_2pvv/cmos.layout
src/mainboard/sunw/ultra40/cmos.layout
src/mainboard/supermicro/h8dme/cmos.layout
src/mainboard/supermicro/h8dmr/cmos.layout
src/mainboard/supermicro/x6dai_g/cmos.layout
src/mainboard/supermicro/x6dhe_g/cmos.layout
src/mainboard/supermicro/x6dhe_g2/cmos.layout
src/mainboard/supermicro/x6dhr_ig/cmos.layout
src/mainboard/supermicro/x6dhr_ig2/cmos.layout
src/mainboard/technexion/tim8690/cmos.layout
src/mainboard/tyan/s2735/cmos.layout
src/mainboard/tyan/s2850/cmos.layout
src/mainboard/tyan/s2875/cmos.layout
src/mainboard/tyan/s2880/cmos.layout
src/mainboard/tyan/s2881/cmos.layout
src/mainboard/tyan/s2882/cmos.layout
src/mainboard/tyan/s2885/cmos.layout
src/mainboard/tyan/s2891/cmos.layout
src/mainboard/tyan/s2892/cmos.layout
src/mainboard/tyan/s2895/cmos.layout
src/mainboard/tyan/s2912/cmos.layout
src/mainboard/tyan/s2912_fam10/cmos.layout
src/mainboard/tyan/s4880/cmos.layout
src/mainboard/tyan/s4882/cmos.layout
src/northbridge/amd/amdfam10/misc_control.c
src/northbridge/amd/amdfam10/northbridge.c
src/northbridge/amd/amdk8/misc_control.c
src/northbridge/amd/amdk8/northbridge.c
src/pc80/mc146818rtc.c
src/southbridge/amd/amd8111/amd8111_acpi.c
src/southbridge/amd/amd8111/amd8111_lpc.c
src/southbridge/amd/amd8131/amd8131_bridge.c
src/southbridge/amd/sb600/sb600_sm.c
src/southbridge/broadcom/bcm5785/bcm5785_sb_pci_main.c
src/southbridge/intel/esb6300/esb6300_lpc.c
src/southbridge/intel/i3100/i3100_lpc.c
src/southbridge/intel/i82801ca/i82801ca_lpc.c
src/southbridge/intel/i82801dbm/i82801dbm_lpc.c
src/southbridge/intel/i82801er/i82801er_lpc.c
src/southbridge/intel/i82801gx/i82801gx_lpc.c
src/southbridge/intel/i82801xx/i82801xx_lpc.c
src/southbridge/intel/pxhd/pxhd_bridge.c
src/southbridge/nvidia/ck804/ck804_lpc.c
src/southbridge/nvidia/mcp55/mcp55_lpc.c
src/southbridge/sis/sis966/sis966_lpc.c
src/superio/winbond/w83627ehg/superio.c
src/superio/winbond/w83627hf/superio.c
util/options/build_opt_tbl.c