From 94b8ad48790c23220d5b54eacac97460826d3ab4 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Tue, 30 Jun 2015 12:49:50 +0200 Subject: samsung/stumpy: implement get_write_protect_state Current vboot wants that function. Change-Id: Ie3b49aa716d9711223ec71a142878e847eedfe4e Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/10726 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Stefan Reinauer --- src/mainboard/samsung/stumpy/chromeos.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/mainboard/samsung/stumpy') diff --git a/src/mainboard/samsung/stumpy/chromeos.c b/src/mainboard/samsung/stumpy/chromeos.c index 8c24c80c95..d579c18d3f 100644 --- a/src/mainboard/samsung/stumpy/chromeos.c +++ b/src/mainboard/samsung/stumpy/chromeos.c @@ -48,9 +48,7 @@ void fill_lb_gpios(struct lb_gpios *gpios) /* Write Protect: GPIO68 = CHP3_SPI_WP */ gpios->gpios[0].port = GPIO_SPI_WP; gpios->gpios[0].polarity = ACTIVE_HIGH; - gpios->gpios[0].value = - (pci_read_config32(dev_find_slot(0, PCI_DEVFN(0x1f, 2)), - SATA_SP) >> FLAG_SPI_WP) & 1; + gpios->gpios[0].value = get_write_protect_state(); strncpy((char *)gpios->gpios[0].name,"write protect", GPIO_MAX_NAME_LENGTH); @@ -86,6 +84,17 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif +int get_write_protect_state(void) +{ + device_t dev; +#ifdef __PRE_RAM__ + dev = PCI_DEV(0, 0x1f, 2); +#else + dev = dev_find_slot(0, PCI_DEVFN(0x1f, 2)); +#endif + return (pci_read_config32(dev, SATA_SP) >> FLAG_SPI_WP) & 1; +} + int get_developer_mode_switch(void) { device_t dev; -- cgit v1.2.3