Changeset 1446


Ignore:
Timestamp:
09/17/11 23:21:48 (8 months ago)
Author:
stefanct
Message:

ichspi: add prettyprinting for PR registers on ICH8+

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

    r1445 r1446  
    7171 
    7272#define ICH9_REG_PR0            0x74    /* 32 Bytes Protected Range 0 */ 
    73 #define ICH9_REG_PR1            0x78    /* 32 Bytes Protected Range 1 */ 
    74 #define ICH9_REG_PR2            0x7c    /* 32 Bytes Protected Range 2 */ 
    75 #define ICH9_REG_PR3            0x80    /* 32 Bytes Protected Range 3 */ 
    76 #define ICH9_REG_PR4            0x84    /* 32 Bytes Protected Range 4 */ 
     73#define PR_WP_OFF               31      /* 31: write protection enable */ 
     74#define PR_RP_OFF               15      /* 15: read protection enable */ 
    7775 
    7876#define ICH9_REG_SSFS           0x90    /* 08 Bits */ 
     
    11771175} 
    11781176 
     1177        /* In contrast to FRAP and the master section of the descriptor the bits 
     1178         * in the PR registers have an inverted meaning. The bits in FRAP 
     1179         * indicate read and write access _grant_. Here they indicate read 
     1180         * and write _protection_ respectively. If both bits are 0 the address 
     1181         * bits are ignored. 
     1182         */ 
     1183#define ICH_PR_PERMS(pr)        (((~((pr) >> PR_RP_OFF) & 1) << 0) | \ 
     1184                                 ((~((pr) >> PR_WP_OFF) & 1) << 1)) 
     1185 
     1186static void prettyprint_ich9_reg_pr(int i) 
     1187{ 
     1188        static const char *const access_names[4] = { 
     1189                "locked", "read-only", "write-only", "read-write" 
     1190        }; 
     1191        uint8_t off = ICH9_REG_PR0 + (i * 4); 
     1192        uint32_t pr = mmio_readl(ich_spibar + off); 
     1193        int rwperms = ICH_PR_PERMS(pr); 
     1194 
     1195        msg_pdbg2("0x%02X: 0x%08x (PR%u", off, pr, i); 
     1196        if (rwperms != 0x3) 
     1197                msg_pdbg2(")\n0x%08x-0x%08x is %s\n", ICH_FREG_BASE(pr), 
     1198                         ICH_FREG_LIMIT(pr) | 0x0fff, access_names[rwperms]); 
     1199        else 
     1200                msg_pdbg2(", unused)\n"); 
     1201} 
     1202 
    11791203static const struct spi_programmer spi_programmer_ich7 = { 
    11801204        .type = SPI_CONTROLLER_ICH7, 
     
    12971321                        do_ich9_spi_frap(tmp, i); 
    12981322 
    1299                 msg_pdbg("0x74: 0x%08x (PR0)\n", 
    1300                              mmio_readl(ich_spibar + ICH9_REG_PR0)); 
    1301                 msg_pdbg("0x78: 0x%08x (PR1)\n", 
    1302                              mmio_readl(ich_spibar + ICH9_REG_PR1)); 
    1303                 msg_pdbg("0x7C: 0x%08x (PR2)\n", 
    1304                              mmio_readl(ich_spibar + ICH9_REG_PR2)); 
    1305                 msg_pdbg("0x80: 0x%08x (PR3)\n", 
    1306                              mmio_readl(ich_spibar + ICH9_REG_PR3)); 
    1307                 msg_pdbg("0x84: 0x%08x (PR4)\n", 
    1308                              mmio_readl(ich_spibar + ICH9_REG_PR4)); 
     1323                for(i = 0; i < 5; i++) 
     1324                        prettyprint_ich9_reg_pr(i); 
    13091325 
    13101326                tmp = mmio_readl(ich_spibar + ICH9_REG_SSFS); 
Note: See TracChangeset for help on using the changeset viewer.