Changeset 1447 for trunk


Ignore:
Timestamp:
09/18/11 00:21:55 (8 months ago)
Author:
stefanct
Message:

ichspi: unlock PR register restrictions on ICH8+ if not locked down

Tested-by: Shailendra Sodhi
(predecessor/proof of concept patch)
http://www.flashrom.org/pipermail/flashrom/2011-August/007717.html

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ichspi.c

    r1446 r1447  
    12011201} 
    12021202 
     1203/* Set/Clear the read and write protection enable bits of PR register @i 
     1204 * according to @read_prot and @write_prot. */ 
     1205static void ich9_set_pr(int i, int read_prot, int write_prot) 
     1206{ 
     1207        void *addr = ich_spibar + ICH9_REG_PR0 + (i * 4); 
     1208        uint32_t old = mmio_readl(addr); 
     1209        uint32_t new; 
     1210 
     1211        msg_gspew("PR%u is 0x%08x", i, old); 
     1212        new = old & ~((1 << PR_RP_OFF) | (1 << PR_WP_OFF)); 
     1213        if (read_prot) 
     1214                new |= (1 << PR_RP_OFF); 
     1215        if (write_prot) 
     1216                new |= (1 << PR_WP_OFF); 
     1217        if (old == new) { 
     1218                msg_gspew(" already.\n"); 
     1219                return; 
     1220        } 
     1221        msg_gspew(", trying to set it to 0x%08x ", new); 
     1222        rmmio_writel(new, addr); 
     1223        msg_gspew("resulted in 0x%08x.\n", mmio_readl(addr)); 
     1224} 
     1225 
    12031226static const struct spi_programmer spi_programmer_ich7 = { 
    12041227        .type = SPI_CONTROLLER_ICH7, 
     
    13211344                        do_ich9_spi_frap(tmp, i); 
    13221345 
     1346                /* try to disable PR locks before printing them */ 
     1347                if (!ichspi_lock) 
     1348                        for(i = 0; i < 5; i++) 
     1349                                ich9_set_pr(i, 0, 0); 
    13231350                for(i = 0; i < 5; i++) 
    13241351                        prettyprint_ich9_reg_pr(i); 
Note: See TracChangeset for help on using the changeset viewer.