Commit 68720c7b authored by Rudolf Marek's avatar Rudolf Marek
Browse files

This patch adds support for BIOS flashing on the all SiliconImage SATA controllers


It was easy because

1) flashrom has now nice API 2) documentation is public on the web site

Corresponding to flashrom svn r527.
Signed-off-by: default avatarRudolf Marek <r.marek@assembler.cz>
Acked-by: default avatarUwe Hermann <uwe@hermann-uwe.de>
parent e186da6b
...@@ -33,7 +33,7 @@ OBJS = chipset_enable.o board_enable.o udelay.o jedec.o stm50flw0x0x.o \ ...@@ -33,7 +33,7 @@ OBJS = chipset_enable.o board_enable.o udelay.o jedec.o stm50flw0x0x.o \
sst49lfxxxc.o sst_fwhub.o layout.o cbtable.o flashchips.o physmap.o \ sst49lfxxxc.o sst_fwhub.o layout.o cbtable.o flashchips.o physmap.o \
flashrom.o w39v080fa.o sharplhf00l04.o w29ee011.o spi.o it87spi.o \ flashrom.o w39v080fa.o sharplhf00l04.o w29ee011.o spi.o it87spi.o \
ichspi.o w39v040c.o sb600spi.o wbsio_spi.o m29f002.o internal.o \ ichspi.o w39v040c.o sb600spi.o wbsio_spi.o m29f002.o internal.o \
dummyflasher.o pcidev.o nic3com.o dummyflasher.o pcidev.o nic3com.o sata_sii.o
all: pciutils dep $(PROGRAM) all: pciutils dep $(PROGRAM)
......
...@@ -83,6 +83,7 @@ extern int programmer; ...@@ -83,6 +83,7 @@ extern int programmer;
#define PROGRAMMER_INTERNAL 0x00 #define PROGRAMMER_INTERNAL 0x00
#define PROGRAMMER_DUMMY 0x01 #define PROGRAMMER_DUMMY 0x01
#define PROGRAMMER_NIC3COM 0x02 #define PROGRAMMER_NIC3COM 0x02
#define PROGRAMMER_SATASII 0x03
struct programmer_entry { struct programmer_entry {
const char *vendor; const char *vendor;
...@@ -559,6 +560,8 @@ void myusec_calibrate_delay(void); ...@@ -559,6 +560,8 @@ void myusec_calibrate_delay(void);
/* pcidev.c */ /* pcidev.c */
#define PCI_OK 0 #define PCI_OK 0
#define PCI_NT 1 /* Not tested */ #define PCI_NT 1 /* Not tested */
#define PCI_IO_BASE_ADDRESS 0x10
extern uint32_t io_base_addr; extern uint32_t io_base_addr;
extern struct pci_access *pacc; extern struct pci_access *pacc;
extern struct pci_filter filter; extern struct pci_filter filter;
...@@ -658,6 +661,16 @@ void nic3com_chip_writeb(uint8_t val, chipaddr addr); ...@@ -658,6 +661,16 @@ void nic3com_chip_writeb(uint8_t val, chipaddr addr);
uint8_t nic3com_chip_readb(const chipaddr addr); uint8_t nic3com_chip_readb(const chipaddr addr);
extern struct pcidev_status nics_3com[]; extern struct pcidev_status nics_3com[];
/* satasii.c */
int satasii_init(void);
int satasii_shutdown(void);
void *satasii_map(const char *descr, unsigned long phys_addr, size_t len);
void satasii_unmap(void *virt_addr, size_t len);
void satasii_chip_writeb(uint8_t val, chipaddr addr);
uint8_t satasii_chip_readb(const chipaddr addr);
extern struct pcidev_status satas_sii[];
/* flashrom.c */ /* flashrom.c */
extern int verbose; extern int verbose;
#define printf_debug(x...) { if (verbose) printf(x); } #define printf_debug(x...) { if (verbose) printf(x); }
......
...@@ -74,6 +74,19 @@ const struct programmer_entry programmer_table[] = { ...@@ -74,6 +74,19 @@ const struct programmer_entry programmer_table[] = {
.chip_writel = fallback_chip_writel, .chip_writel = fallback_chip_writel,
}, },
{
.init = satasii_init,
.shutdown = satasii_shutdown,
.map_flash_region = satasii_map,
.unmap_flash_region = satasii_unmap,
.chip_readb = satasii_chip_readb,
.chip_readw = fallback_chip_readw,
.chip_readl = fallback_chip_readl,
.chip_writeb = satasii_chip_writeb,
.chip_writew = fallback_chip_writew,
.chip_writel = fallback_chip_writel,
},
{}, {},
}; };
...@@ -503,6 +516,10 @@ int main(int argc, char *argv[]) ...@@ -503,6 +516,10 @@ int main(int argc, char *argv[])
programmer = PROGRAMMER_NIC3COM; programmer = PROGRAMMER_NIC3COM;
if (optarg[7] == '=') if (optarg[7] == '=')
pcidev_bdf = strdup(optarg + 8); pcidev_bdf = strdup(optarg + 8);
} else if (strncmp(optarg, "satasii", 7) == 0) {
programmer = PROGRAMMER_SATASII;
if (optarg[7] == '=')
pcidev_bdf = strdup(optarg + 8);
} else { } else {
printf("Error: Unknown programmer.\n"); printf("Error: Unknown programmer.\n");
exit(1); exit(1);
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <errno.h> #include <errno.h>
#include "flash.h" #include "flash.h"
#define PCI_IO_BASE_ADDRESS 0x10
uint32_t io_base_addr; uint32_t io_base_addr;
struct pci_access *pacc; struct pci_access *pacc;
struct pci_filter filter; struct pci_filter filter;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment