Changeset 1389


Ignore:
Timestamp:
07/26/11 00:44:09 (10 months ago)
Author:
hailfinger
Message:

Fix ICH FWH IDSEL setting with the fwh_idsel= internal programmer
parameter.
The code took 32 bits of input and wrote them to an 48 bit register,
duplicating some values.
Document the fwh_idsel= parameter in the man page.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@…>
Acked-by: Stefan Tauner <stefan.tauner@…>

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/chipset_enable.c

    r1386 r1389  
    3131#include <string.h> 
    3232#include <unistd.h> 
     33#include <inttypes.h> 
     34#include <errno.h> 
    3335#include "flash.h" 
    3436#include "programmer.h" 
     
    312314        idsel = extract_programmer_param("fwh_idsel"); 
    313315        if (idsel && strlen(idsel)) { 
    314                 fwh_conf = (uint32_t)strtoul(idsel, NULL, 0); 
    315  
    316                 /* FIXME: Need to undo this on shutdown. */ 
    317                 msg_pinfo("\nSetting IDSEL=0x%x for top 16 MB", fwh_conf); 
    318                 rpci_write_long(dev, 0xd0, fwh_conf); 
    319                 rpci_write_word(dev, 0xd4, fwh_conf); 
     316                uint64_t fwh_idsel_old; 
     317                uint64_t fwh_idsel; 
     318                errno = 0; 
     319                /* Base 16, nothing else makes sense. */ 
     320                fwh_idsel = (uint64_t)strtoull(idsel, NULL, 16); 
     321                if (errno) { 
     322                        msg_perr("Error: fwh_idsel= specified, but value could " 
     323                                 "not be converted.\n"); 
     324                        goto idsel_garbage_out; 
     325                } 
     326                if (fwh_idsel & 0xffff000000000000ULL) { 
     327                        msg_perr("Error: fwh_idsel= specified, but value had " 
     328                                 "unusued bits set.\n"); 
     329                        goto idsel_garbage_out; 
     330                } 
     331                fwh_idsel_old = pci_read_long(dev, 0xd0); 
     332                fwh_idsel_old <<= 16; 
     333                fwh_idsel_old |= pci_read_word(dev, 0xd4); 
     334                msg_pdbg("\nSetting IDSEL from 0x%012" PRIx64 " to " 
     335                         "0x%012" PRIx64 " for top 16 MB.", fwh_idsel_old, 
     336                         fwh_idsel); 
     337                rpci_write_long(dev, 0xd0, (fwh_idsel >> 16) & 0xffffffff); 
     338                rpci_write_word(dev, 0xd4, fwh_idsel & 0xffff); 
    320339                /* FIXME: Decode settings are not changed. */ 
    321340        } else if (idsel) { 
    322                 msg_perr("Error: idsel= specified, but no number given.\n"); 
     341                msg_perr("Error: fwh_idsel= specified, but no value given.\n"); 
     342idsel_garbage_out:       
    323343                free(idsel); 
    324344                /* FIXME: Return failure here once internal_init() starts 
  • trunk/flashrom.8

    r1387 r1389  
    300300report so we can diagnose the problem. 
    301301.sp 
     302If you have an Intel chipset with an ICH6 or later southbridge and if you want 
     303to set specific IDSEL values for a non-default flash chip or an embedded 
     304controller (EC), you can use the 
     305.sp 
     306.B "  flashrom \-p internal:fwh_idsel=value" 
     307.sp 
     308syntax where value is the 48-bit hexadecimal raw value to be written in the 
     309IDSEL registers of the Intel southbridge. The upper 32 bits use one hex digit 
     310each per 512 kB range between 0xffc00000 and 0xffffffff, and the lower 16 bits 
     311use one hex digit each per 1024 kB range between 0xff400000 and 0xff7fffff. 
     312The rightmost hex digit corresponds with the lowest address range. All address 
     313ranges have a corresponding sister range 4 MB below with identical IDSEL 
     314settings. The default value for ICH7 is given in the example below. 
     315.sp 
     316Example: 
     317.B "flashrom \-p internal:fwh_idsel=0x001122334567" 
     318.sp 
    302319Using flashrom on laptops is dangerous and may easily make your hardware 
    303320unusable (see also the 
Note: See TracChangeset for help on using the changeset viewer.