summaryrefslogtreecommitdiffstats
path: root/ich_descriptors.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2011-10-20 12:57:14 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2011-10-20 12:57:14 +0000
commitd0c5dc23e25f33439dd6166a5798ffbcaabf67f8 (patch)
tree46817260e91768863e9815741486d0f1b0a804bc /ich_descriptors.c
parent836b26a423c5dad86646bc6bc24560d444181405 (diff)
downloadast2050-flashrom-d0c5dc23e25f33439dd6166a5798ffbcaabf67f8.zip
ast2050-flashrom-d0c5dc23e25f33439dd6166a5798ffbcaabf67f8.tar.gz
ichspi: add (partially) dead support code for Intel Hardware Sequencing
This was done to ease the review. Another patch will hook up (and explain) this code later. Corresponding to flashrom svn r1452. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'ich_descriptors.c')
-rw-r--r--ich_descriptors.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/ich_descriptors.c b/ich_descriptors.c
index da1326e..125077c 100644
--- a/ich_descriptors.c
+++ b/ich_descriptors.c
@@ -213,6 +213,34 @@ void prettyprint_ich_descriptor_master(const struct ich_desc_master *mstr)
msg_pdbg2("\n");
}
+/** Returns the integer representation of the component density with index
+idx in bytes or 0 if a correct size can not be determined. */
+int getFCBA_component_density(const struct ich_descriptors *desc, uint8_t idx)
+{
+ uint8_t size_enc;
+
+ switch(idx) {
+ case 0:
+ size_enc = desc->component.comp1_density;
+ break;
+ case 1:
+ if (desc->content.NC == 0)
+ return 0;
+ size_enc = desc->component.comp2_density;
+ break;
+ default:
+ msg_perr("Only ICH SPI component index 0 or 1 are supported "
+ "yet.\n");
+ return 0;
+ }
+ if (size_enc > 5) {
+ msg_perr("Density of ICH SPI component with index %d is "
+ "invalid. Encoded density is 0x%x.\n", idx, size_enc);
+ return 0;
+ }
+ return (1 << (19 + size_enc));
+}
+
static uint32_t read_descriptor_reg(uint8_t section, uint16_t offset, void *spibar)
{
uint32_t control = 0;
OpenPOWER on IntegriCloud