HI!
"sudo flashrom" doesn't cause any problems now.
"sudo flashrom -r BACKUP.ROM" works also tho the created file is
smaller than the downloaded file.
-rw-r--r-- 1 root root 524288 2010-04-12 00:36 BACKUP.ROM
-rw-r--r-- 1 magnus magnus 525894 2004-10-19 09:32 ZI5_3C23.WPH
That might not be so strange if the downloaded file also contains
information about "magic bits".
/Magnus
2010/4/12 Michael Karcher <flashrom(a)mkarcher.dialup.fu-berlin.de>:
> BE WARNED: FLASHROM COMES WITH NO WARRANTY! THIS IS ESPECIALLY TRUE FOR
> LAPTOPS, AND ESPECIALLY ESPECIALLY TRUE FOR LAPTOPS WITH SHARED EC.
> Nevertheless, I think that trying to *read* flash contents with this patch
> is not more unsafe than reading without this patch. Be warned that a crashed
> EC might mean no fan control. Don't even *THINK* about erase/write until
> read works fine!
>
> This is the first system with EC sleep support in flashrom, and the first
> user of the register_shutdown infrastructure.
>
> PCI match uses one out of many chips with subsystem ID Acer:0x0057, and
> also the northbridge (with bogus subsystem ID). DMI match added just for
> safety, as fiddling with the KBC is dangerous.
>
> Signed-off-by: Michael Karcher <flashrom(a)mkarcher.dialup.fu-berlin.de>
> ---
> Â board_enable.c | Â 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Â 1 files changed, 100 insertions(+), 0 deletions(-)
>
> diff --git a/board_enable.c b/board_enable.c
> index f1f7953..ce82131 100644
> --- a/board_enable.c
> +++ b/board_enable.c
> @@ -29,6 +29,66 @@
> Â #include "flash.h"
>
> Â /*
> + * Functions for EC/KBC communication
> + * Â port = 0x60 for KBC, port = 0x62 (typically) for EC
> + */
> +static int wait_uc_writebuf_empty(uint16_t port)
> +{
> + Â Â Â int count;
> + Â Â Â for (count = 0; count < 50; count++)
> + Â Â Â {
> + Â Â Â Â Â Â Â /* quit if OBF bit clear */
> + Â Â Â Â Â Â Â if (!(INB(port + 4) & 2))
> + Â Â Â Â Â Â Â Â Â Â Â return 0;
> + Â Â Â Â Â Â Â usleep(10000);
> + Â Â Â }
> + Â Â Â return -1;
> +}
> +
> +static int wait_uc_readbuf_full(uint16_t port)
> +{
> + Â Â Â int count;
> + Â Â Â for (count = 0; count < 50; count++)
> + Â Â Â {
> + Â Â Â Â Â Â Â /* quit if IBF bit set */
> + Â Â Â Â Â Â Â if (INB(port + 4) & 1)
> + Â Â Â Â Â Â Â Â Â Â Â return 0;
> + Â Â Â Â Â Â Â usleep(10000);
> + Â Â Â }
> + Â Â Â return -1;
> +}
> +
> +static int uc_send_command(uint16_t port, uint8_t command)
> +{
> + Â Â Â if (wait_uc_writebuf_empty(port) != 0)
> + Â Â Â Â Â Â Â return -1;
> + Â Â Â OUTB(command, port + 4);
> + Â Â Â return 0;
> +}
> +
> +#if 0
> +static int uc_send_data(uint16_t port, uint8_t command)
> +{
> + Â Â Â if (wait_uc_writebuf_empty(port) != 0)
> + Â Â Â Â Â Â Â return -1;
> + Â Â Â OUTB(command, port);
> + Â Â Â return 0;
> +}
> +#endif
> +
> +static int uc_read_data(uint16_t port)
> +{
> + Â Â Â if (wait_uc_readbuf_full(port) != 0)
> + Â Â Â Â Â Â Â return -1;
> + Â Â Â return INB(port);
> +}
> +
> +static void uc_flush_data(uint16_t port)
> +{
> + Â Â Â INB(port);
> +}
> +
> +/*
> Â * Helper functions for many Winbond Super I/Os of the W836xx range.
> Â */
> Â /* Enter extended functions */
> @@ -1307,6 +1367,45 @@ static int it8712f_gpio3_1_raise(const char *name)
> Â Â Â Â return it8712f_gpio_set(32, 1);
> Â }
>
> +static void send_kbc_command(void * cmdptr)
> +{
> + Â Â Â uc_send_command(0x60, *(uint8_t*)cmdptr);
> +}
> +
> +static int board_acer_ferrari3400(const char *name)
> +{
> + Â Â Â static uint8_t enable_command = 0xAA;
> + Â Â Â uint16_t pmio_base;
> + Â Â Â struct pci_dev * dev;
> +
> + Â Â Â dev = pci_dev_find(0x1106, 0x3177);
> + Â Â Â if (!dev)
> + Â Â Â {
> + Â Â Â Â Â Â Â fprintf(stderr, "ERROR: %s - Can't find VT8235\n", name);
> + Â Â Â Â Â Â Â return -1;
> + Â Â Â }
> + Â Â Â pmio_base = pci_read_word(dev, 0x88) & 0xFF80;
> + Â Â Â if (pmio_base == 0 || pmio_base == 0xFF80)
> + Â Â Â {
> + Â Â Â Â Â Â Â fprintf(stderr, "ERROR: %s - invalid PMIO base %04x\n",
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â name, pmio_base);
> + Â Â Â Â Â Â Â return -1;
> + Â Â Â }
> +
> + Â Â Â usleep(100000); /* Give the user a fair chance to release enter
> + Â Â Â Â Â Â Â Â Â Â Â Â Â before killing keyboard/mouse */
> +
> + Â Â Â Â uc_flush_data(0x60);
> + Â Â Â register_shutdown(send_kbc_command, &enable_command);
> + Â Â Â if (INB(pmio_base + 4) & 1)
> + Â Â Â Â Â Â Â uc_send_command(0x60, 0xE5); Â Â /* ACPI mode */
> + Â Â Â else
> + Â Â Â Â Â Â Â uc_send_command(0x60, 0xD8); Â Â /* APM/legacy mode */
> +
> + Â Â Â uc_read_data(0x60); Â Â Â Â Â Â /* wait for EC shutdown */
> + Â Â Â return 0;
> +}
> +
> Â /**
> Â * Below is the list of boards which need a special "board enable" code in
> Â * flashrom before their ROM chip can be accessed/written to.
> @@ -1356,6 +1455,7 @@ struct board_pciid_enable board_pciid_enables[] = {
> Â Â Â Â {0x10de, 0x0050, 0x147b, 0x1c1a, Â Â Â 0, Â Â Â 0, Â Â Â 0, Â Â Â 0, NULL, Â Â Â Â Â NULL, Â Â Â Â NULL, Â Â Â Â Â "Abit", Â Â Â Â "KN8 Ultra", Â Â Â Â Â Â 0, Â NT, nvidia_mcp_gpio2_lower},
> Â Â Â Â {0x10de, 0x01e0, 0x147b, 0x1c00, Â 0x10de, 0x0060, 0x147B, 0x1c00, NULL, Â Â Â Â Â NULL, Â Â Â Â NULL, Â Â Â Â Â "Abit", Â Â Â Â "NF7-S", Â Â Â Â Â Â Â Â 0, Â OK, nvidia_mcp_gpio8_raise},
> Â Â Â Â {0x1106, 0x0691, Â Â Â 0, Â Â Â 0, Â 0x1106, 0x3057, Â Â Â 0, Â Â Â 0, NULL, Â Â Â Â Â "abit", Â Â Â "vt6x4", Â Â Â "Abit", Â Â Â Â "VT6X4", Â Â Â Â Â Â Â Â 0, Â OK, via_apollo_gpo4_lower},
> + Â Â Â {0x1106, 0x3177, 0x1025, 0x0057, Â 0x1106, 0x3188, 0x1106, 0x3188, "^Ferrari 3400", NULL, Â Â Â NULL, Â Â Â Â Â "Acer", Â Â Â Â "Ferrari 3400", Â Â Â Â Â 0, Â OK, board_acer_ferrari3400},
> Â Â Â Â {0x105a, 0x0d30, 0x105a, 0x4d33, Â 0x8086, 0x1130, 0x8086, Â Â Â 0, NULL, Â Â Â Â Â NULL, Â Â Â Â NULL, Â Â Â Â Â "Acorp", Â Â Â "6A815EPD", Â Â Â Â Â Â Â 0, Â OK, board_acorp_6a815epd},
> Â Â Â Â {0x8086, 0x24D4, 0x1849, 0x24D0, Â 0x8086, 0x24D5, 0x1849, 0x9739, NULL, Â Â Â Â Â NULL, Â Â Â Â NULL, Â Â Â Â Â "ASRock", Â Â Â "P4i65GV", Â Â Â Â Â Â Â 0, Â OK, intel_ich_gpio23_raise},
> Â Â Â Â {0x1022, 0x746B, Â Â Â 0, Â Â Â 0, Â Â Â 0, Â Â Â 0, Â Â Â 0, Â Â Â 0, NULL, Â Â Â Â Â "AGAMI", Â Â Â "ARUMA", Â Â Â "agami", Â Â Â "Aruma", Â Â Â Â Â Â Â Â 0, Â OK, w83627hf_gpio24_raise_2e},
> --
> 1.7.0
>
>