Show
Ignore:
Timestamp:
06/27/08 18:28:34 (5 months ago)
Author:
stepan
Message:

* ICH7 SPI support
* fix some variable names in ichspi.c (Offset -> offset)
* Dump ICH7 SPI bar with -V
* Improve error message in case IOPL goes wrong. (It might not even be an IOPL)

Signed-off-by: Stefan Reinauer <stepan@…>
Acked-by: Peter Stuge <peter@…>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/util/flashrom/chipset_enable.c

    r3348 r3393  
    190190static int enable_flash_ich_dc_spi(struct pci_dev *dev, const char *name, unsigned long spibar) 
    191191{ 
    192         uint8_t old, new, bbs; 
     192        uint8_t old, new, bbs, buc; 
    193193        uint32_t tmp, gcs; 
    194194        void *rcrb; 
     
    196196        /* Read the Root Complex Base Address Register (RCBA) */ 
    197197        tmp = pci_read_long(dev, 0xf0); 
     198 
    198199        /* Calculate the Root Complex Register Block address */ 
    199200        tmp &= 0xffffc000; 
    200         printf_debug("Root Complex Register Block address = 0x%x\n", tmp); 
     201        printf_debug("\nRoot Complex Register Block address = 0x%x\n", tmp); 
    201202        rcrb = mmap(0, 0x4000, PROT_READ | PROT_WRITE, MAP_SHARED, fd_mem, (off_t)tmp); 
    202203        if (rcrb == MAP_FAILED) { 
     
    213214                     (bbs == 0x3) ? "LPC" : ((bbs == 0x2) ? "PCI" : "SPI")); 
    214215 
     216        buc = *(volatile uint8_t *)(rcrb + 0x3414); 
     217        printf_debug("Top Swap : %s\n", (buc & 1)?"enabled (A16 inverted)":"not enabled"); 
     218 
    215219        /* SPIBAR is at RCRB+0x3020 for ICH[78] and RCRB+0x3800 for ICH9. */ 
    216         printf_debug("SPIBAR = 0x%lx\n", tmp + spibar); 
    217         /* TODO: Dump the SPI config regs */ 
     220        printf_debug("SPIBAR = 0x%x + 0x%04x\n", tmp, (uint16_t)spibar); 
     221 
     222        // Assign Virtual Address 
    218223        ich_spibar =  rcrb + spibar; 
     224 
     225        if (ich7_detected) { 
     226                int i; 
     227                printf_debug("0x00: 0x%04x     (SPIS)\n", *(uint16_t *)(ich_spibar + 0)); 
     228                printf_debug("0x02: 0x%04x     (SPIC)\n", *(uint16_t *)(ich_spibar + 2)); 
     229                printf_debug("0x04: 0x%08x (SPIA)\n", *(uint32_t *)(ich_spibar + 4)); 
     230                for (i=0; i < 8; i++) { 
     231                        int offs; 
     232                        offs = 8 + (i * 8); 
     233                        printf_debug("0x%02x: 0x%08x (SPID%d)\n", offs, *(uint32_t *)(ich_spibar + offs), i); 
     234                        printf_debug("0x%02x: 0x%08x (SPID%d+4)\n", offs+4, *(uint32_t *)(ich_spibar + offs +4), i); 
     235                } 
     236                printf_debug("0x50: 0x%08x (BBAR)\n", *(uint32_t *)(ich_spibar + 0x50)); 
     237                printf_debug("0x54: 0x%04x     (PREOP)\n", *(uint16_t *)(ich_spibar + 0x54)); 
     238                printf_debug("0x56: 0x%04x     (OPTYPE)\n", *(uint16_t *)(ich_spibar + 0x56)); 
     239                printf_debug("0x58: 0x%08x (OPMENU)\n", *(uint32_t *)(ich_spibar + 0x58)); 
     240                printf_debug("0x5c: 0x%08x (OPMENU+4)\n", *(uint32_t *)(ich_spibar + 0x5c)); 
     241                for (i=0; i < 4; i++) { 
     242                        int offs; 
     243                        offs = 0x60 + (i * 4); 
     244                        printf_debug("0x%02x: 0x%08x (PBR%d)\n", offs, *(uint32_t *)(ich_spibar + offs), i); 
     245                } 
     246                printf_debug("\n"); 
     247                if ( (*(uint16_t *)ich_spibar) & (1 << 15)) { 
     248                        printf("WARNING: SPI Configuration Lockdown activated.\n"); 
     249                } 
     250        } 
    219251 
    220252        old = pci_read_byte(dev, 0xdc); 
     
    235267} 
    236268 
     269/* Flag for ICH7 SPI register block */ 
     270int ich7_detected = 0; 
     271 
    237272static int enable_flash_ich7(struct pci_dev *dev, const char *name) 
    238273{ 
     274       ich7_detected = 1; 
    239275        return enable_flash_ich_dc_spi(dev, name, 0x3020); 
    240276} 
    241277 
     278/* Flag for ICH8/ICH9 SPI register block */ 
    242279int ich9_detected = 0; 
    243280