Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: wpce775x.c

Issue 6897014: Do not call EC programmer shutdown functions explicitly. (Closed) Base URL: svn://coreboot.org/flashrom/trunk
Patch Set: rename shutdown() to flashrom_shutdown() to avoid conflict with shutdown(2) Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« programmer.h ('K') | « programmer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of the flashrom project. 2 * This file is part of the flashrom project.
3 * 3 *
4 * Copyright (C) 2010 Google, Inc. 4 * Copyright (C) 2010 Google, Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * Redistributions of source code must retain the above copyright 10 * Redistributions of source code must retain the above copyright
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include <time.h> 45 #include <time.h>
46 #include <unistd.h> 46 #include <unistd.h>
47 #include <stdlib.h> 47 #include <stdlib.h>
48 #include "flash.h" 48 #include "flash.h"
49 #include "chipdrivers.h" 49 #include "chipdrivers.h"
50 #include "flashchips.h" 50 #include "flashchips.h"
51 #include "programmer.h" 51 #include "programmer.h"
52 #include "spi.h" 52 #include "spi.h"
53 #include "writeprotect.h" 53 #include "writeprotect.h"
54 54
55 void wpce775x_shutdown(void *);
56
55 /** 57 /**
56 * Definition of WPCE775X WCB (Write Command Buffer), as known as Shared Access 58 * Definition of WPCE775X WCB (Write Command Buffer), as known as Shared Access
57 * Window 2. 59 * Window 2.
58 * 60 *
59 * The document name is "WPCE775X Software User Guide Revision 1.2". 61 * The document name is "WPCE775X Software User Guide Revision 1.2".
60 * 62 *
61 * Assume the host is little endian. 63 * Assume the host is little endian.
62 */ 64 */
63 __attribute__((packed)) 65 __attribute__((packed))
64 struct wpce775x_wcb { 66 struct wpce775x_wcb {
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 msg_pdbg("get fwh_id: 0x%02x\n", fwh_id); 592 msg_pdbg("get fwh_id: 0x%02x\n", fwh_id);
591 593
592 /* TODO: set fwh_idsel of chipset. 594 /* TODO: set fwh_idsel of chipset.
593 Currently, we employ "-p internal:fwh_idsel=0x0000223e". */ 595 Currently, we employ "-p internal:fwh_idsel=0x0000223e". */
594 596
595 /* Enter flash update mode unconditionally. This is required even 597 /* Enter flash update mode unconditionally. This is required even
596 for reading. */ 598 for reading. */
597 if (EnterFlashUpdate()) return 1; 599 if (EnterFlashUpdate()) return 1;
598 600
599 spi_controller = SPI_CONTROLLER_WPCE775X; 601 spi_controller = SPI_CONTROLLER_WPCE775X;
602 register_shutdown(wpce775x_shutdown, NULL);
600 msg_pdbg("%s(): successfully initialized wpce775x\n", __func__); 603 msg_pdbg("%s(): successfully initialized wpce775x\n", __func__);
601 return 0; 604 return 0;
602
603 } 605 }
604 606
605 int wpce775x_shutdown(void) 607 void wpce775x_shutdown(void *data)
606 { 608 {
607 if (spi_controller != SPI_CONTROLLER_WPCE775X) 609 if (spi_controller != SPI_CONTROLLER_WPCE775X)
608 » » return 0; 610 » » return;
609 611
610 msg_pdbg("%s(): firmware %s\n", __func__, 612 msg_pdbg("%s(): firmware %s\n", __func__,
611 firmware_changed ? "changed" : "not changed"); 613 firmware_changed ? "changed" : "not changed");
612 614
613 msg_pdbg("%s: in_flash_update_mode: %d\n", __func__, in_flash_update_mod e); 615 msg_pdbg("%s: in_flash_update_mode: %d\n", __func__, in_flash_update_mod e);
614 if (in_flash_update_mode) { 616 if (in_flash_update_mode) {
615 if (firmware_changed) 617 if (firmware_changed)
616 ExitFlashUpdateFirmwareChanged(); 618 ExitFlashUpdateFirmwareChanged();
617 else 619 else
618 ExitFlashUpdateFirmwareNoChange(); 620 ExitFlashUpdateFirmwareNoChange();
619 621
620 in_flash_update_mode = 0; 622 in_flash_update_mode = 0;
621 } 623 }
622 624
623 if (initflash_cfg) 625 if (initflash_cfg)
624 free(initflash_cfg); 626 free(initflash_cfg);
625 else 627 else
626 msg_perr("%s(): No initflash_cfg to free?!?\n", __func__); 628 msg_perr("%s(): No initflash_cfg to free?!?\n", __func__);
627
628 return 0;
629 } 629 }
630 630
631 /* Called by internal_init() */ 631 /* Called by internal_init() */
632 int wpce775x_probe_spi_flash(const char *name) 632 int wpce775x_probe_spi_flash(const char *name)
633 { 633 {
634 int ret; 634 int ret;
635 635
636 if (!(buses_supported & CHIP_BUSTYPE_FWH)) { 636 if (!(buses_supported & CHIP_BUSTYPE_FWH)) {
637 msg_pdbg("%s():%d buses not support FWH\n", __func__, __LINE__); 637 msg_pdbg("%s():%d buses not support FWH\n", __func__, __LINE__);
638 return 1; 638 return 1;
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 /* unsupported opcodes */ 976 /* unsupported opcodes */
977 msg_pdbg("unsupported SPI opcode: %02x\n", opcode); 977 msg_pdbg("unsupported SPI opcode: %02x\n", opcode);
978 rc = 1; 978 rc = 1;
979 break; 979 break;
980 } 980 }
981 981
982 msg_pdbg("%s: opcode: 0x%02x\n", __func__, opcode); 982 msg_pdbg("%s: opcode: 0x%02x\n", __func__, opcode);
983 return rc; 983 return rc;
984 } 984 }
985 #endif 985 #endif
OLDNEW
« programmer.h ('K') | « programmer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698