Changeset 1443


Ignore:
Timestamp:
09/16/11 01:52:55 (8 months ago)
Author:
stefanct
Message:

ichspi: add ICH/PCH flash descriptor decoding via FDOC/FDOD

based on the work of Matthias 'mazzoo' Wenzel this patch adds pretty
printing of those ICH/PCH flash descriptor sections that are
cached/mapped by the chipset (and which are therefore reachable via
FDOC/FDOD registers).

this includes the following:

  • content section:

describes the image and some generic properties (number of
sections, offset of sections, PCH/ICH and MCH/PROC strap
offsets and lengths)

  • component section:

identify the different SPI flash chips and their capabilities.

  • region section

similarly to a partition table this describes the different regions.
the content of FLREG* is derived from this section.

  • master section

defines SPI master (host, ME, GbE) access rights of the
individual regions. the content of PR* is derived from this section.

this is only a part of the data included in the descriptor. other
information can be retrieved from a complete binary dump of the
descriptor region only.

this patch also adds macros and pretty printing for "Vendor Specific
Component Capabilities" registers: there are two of them: lower and
upper. they describe the properties of the address space divided by
FPBA (which allows to use multiple flash chips or partitions with
different properties). the properties of all supported flash chips
(together with their RDIDs) are stored in the same format in table
in a descriptor section (which is used by the ME apparently). a
later patch will use the macros outside of ichspi.c which is the
reason why the prettyprinting function and the register bit macros
are not defined in ichspi.c but ich_descriptors.h (else they would
be moved in the follow-up patch).

because this patch relies on (compiler) implementation-specific
layouting of bit-fields, it checks for correct layout before taking
any action on runtime.

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

Location:
trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile

    r1427 r1443  
    350350PROGRAMMER_OBJS += processor_enable.o chipset_enable.o board_enable.o cbtable.o dmi.o internal.o 
    351351ifeq ($(ARCH),"x86") 
    352 PROGRAMMER_OBJS += it87spi.o it85spi.o ichspi.o sb600spi.o wbsio_spi.o mcp6x_spi.o 
     352PROGRAMMER_OBJS += it87spi.o it85spi.o sb600spi.o wbsio_spi.o mcp6x_spi.o 
     353PROGRAMMER_OBJS += ichspi.o ich_descriptors.o 
    353354else 
    354355endif 
  • trunk/ichspi.c

    r1414 r1443  
    3030#include "programmer.h" 
    3131#include "spi.h" 
     32#include "ich_descriptors.h" 
    3233 
    3334/* ICH9 controller register definition */ 
     
    119120#define ICH9_REG_BBAR           0xA0    /* 32 Bits BIOS Base Address Configuration */ 
    120121#define BBAR_MASK       0x00ffff00              /* 8-23: Bottom of System Flash */ 
     122 
     123#define ICH8_REG_VSCC           0xC1    /* 32 Bits Vendor Specific Component Capabilities */ 
     124#define ICH9_REG_LVSCC          0xC4    /* 32 Bits Host Lower Vendor Specific Component Capabilities */ 
     125#define ICH9_REG_UVSCC          0xC8    /* 32 Bits Host Upper Vendor Specific Component Capabilities */ 
     126/* The individual fields of the VSCC registers are defined in the file 
     127 * ich_descriptors.h. The reason is that the same layout is also used in the 
     128 * flash descriptor to define the properties of the different flash chips 
     129 * supported. The BIOS (or the ME?) is responsible to populate the ICH registers 
     130 * with the information from the descriptor on startup depending on the actual 
     131 * chip(s) detected. */ 
    121132 
    122133#define ICH9_REG_FPB            0xD0    /* 32 Bits Flash Partition Boundary */ 
     
    11301141#define ICH_BRRA(x)  ((x >>  0) & 0xff) 
    11311142 
    1132 #define ICH_FREG_BASE(x)  ((x >>  0) & 0x1fff) 
    1133 #define ICH_FREG_LIMIT(x) ((x >> 16) & 0x1fff) 
    1134  
    11351143static void do_ich9_spi_frap(uint32_t frap, int i) 
    11361144{ 
     
    11591167        } 
    11601168 
    1161         msg_pdbg("0x%08x-0x%08x is %s\n", 
    1162                     (base << 12), (limit << 12) | 0x0fff, 
    1163                     access_names[rwperms]); 
     1169        msg_pdbg("0x%08x-0x%08x is %s\n", base, (limit | 0x0fff), 
     1170                 access_names[rwperms]); 
    11641171} 
    11651172 
     
    11911198        uint16_t spibar_offset, tmp2; 
    11921199        uint32_t tmp; 
     1200        int ichspi_desc = 0; 
    11931201 
    11941202        switch (ich_generation) { 
     
    12621270                        ichspi_lock = 1; 
    12631271                } 
     1272                if (tmp2 & HSFS_FDV) 
     1273                        ichspi_desc = 1; 
    12641274 
    12651275                tmp2 = mmio_readw(ich_spibar + ICH9_REG_HSFC); 
     
    13091319                msg_pdbg("0x9C: 0x%08x (OPMENU+4)\n", 
    13101320                             mmio_readl(ich_spibar + ICH9_REG_OPMENU + 4)); 
    1311                 ichspi_bbar = mmio_readl(ich_spibar + ICH9_REG_BBAR); 
    1312                 msg_pdbg("0xA0: 0x%08x (BBAR)\n", 
    1313                              ichspi_bbar); 
    1314                 tmp = mmio_readl(ich_spibar + ICH9_REG_FPB); 
    1315                 msg_pdbg("0xD0: 0x%08x (FPB)\n", tmp); 
    1316  
     1321                if (ich_generation == 8) { 
     1322                        tmp = mmio_readl(ich_spibar + ICH8_REG_VSCC); 
     1323                        msg_pdbg("0xC1: 0x%08x (VSCC)\n", tmp); 
     1324                        msg_pdbg("VSCC: "); 
     1325                        prettyprint_ich_reg_vscc(tmp, MSG_DEBUG); 
     1326                } else { 
     1327                        ichspi_bbar = mmio_readl(ich_spibar + ICH9_REG_BBAR); 
     1328                        msg_pdbg("0xA0: 0x%08x (BBAR)\n", 
     1329                                     ichspi_bbar); 
     1330 
     1331                        tmp = mmio_readl(ich_spibar + ICH9_REG_LVSCC); 
     1332                        msg_pdbg("0xC4: 0x%08x (LVSCC)\n", tmp); 
     1333                        msg_pdbg("LVSCC: "); 
     1334                        prettyprint_ich_reg_vscc(tmp, MSG_DEBUG); 
     1335 
     1336                        tmp = mmio_readl(ich_spibar + ICH9_REG_UVSCC); 
     1337                        msg_pdbg("0xC8: 0x%08x (UVSCC)\n", tmp); 
     1338                        msg_pdbg("UVSCC: "); 
     1339                        prettyprint_ich_reg_vscc(tmp, MSG_DEBUG); 
     1340 
     1341                        tmp = mmio_readl(ich_spibar + ICH9_REG_FPB); 
     1342                        msg_pdbg("0xD0: 0x%08x (FPB)\n", tmp); 
     1343                } 
     1344 
     1345                msg_pdbg("\n"); 
     1346                if (ichspi_desc) { 
     1347                        struct ich_descriptors desc = {{ 0 }}; 
     1348                        if (read_ich_descriptors_via_fdo(ich_spibar, &desc) == 
     1349                            ICH_RET_OK) 
     1350                                prettyprint_ich_descriptors(CHIPSET_ICH_UNKNOWN, 
     1351                                                            &desc); 
     1352                } 
    13171353                ich_init_opcodes(); 
    13181354                break; 
Note: See TracChangeset for help on using the changeset viewer.