Chromium Code Reviews| OLD | NEW |
|---|---|
| 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) 2000 Silicon Integrated System Corporation | 4 * Copyright (C) 2000 Silicon Integrated System Corporation |
| 5 * Copyright (C) 2004 Tyan Corp <yhlu@tyan.com> | 5 * Copyright (C) 2004 Tyan Corp <yhlu@tyan.com> |
| 6 * Copyright (C) 2005-2008 coresystems GmbH | 6 * Copyright (C) 2005-2008 coresystems GmbH |
| 7 * Copyright (C) 2008,2009 Carl-Daniel Hailfinger | 7 * Copyright (C) 2008,2009 Carl-Daniel Hailfinger |
| 8 * | 8 * |
| 9 * This program is free software; you can redistribute it and/or modify | 9 * This program is free software; you can redistribute it and/or modify |
| 10 * it under the terms of the GNU General Public License as published by | 10 * it under the terms of the GNU General Public License as published by |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 unsigned long flashbase; | 117 unsigned long flashbase; |
| 118 | 118 |
| 119 /* Is writing allowed with this programmer? */ | 119 /* Is writing allowed with this programmer? */ |
| 120 int programmer_may_write; | 120 int programmer_may_write; |
| 121 | 121 |
| 122 const struct programmer_entry programmer_table[] = { | 122 const struct programmer_entry programmer_table[] = { |
| 123 #if CONFIG_INTERNAL == 1 | 123 #if CONFIG_INTERNAL == 1 |
| 124 { | 124 { |
| 125 .name = "internal", | 125 .name = "internal", |
| 126 .init = internal_init, | 126 .init = internal_init, |
| 127 » » .shutdown» » = internal_shutdown, | 127 » » /* called implicitly using shutdown callback */ |
| 128 //» » .shutdown» » = internal_shutdown, | |
|
Louis
2011/04/26 10:06:06
This line should be restored. See programmer_shutd
| |
| 128 .map_flash_region = physmap, | 129 .map_flash_region = physmap, |
| 129 .unmap_flash_region = physunmap, | 130 .unmap_flash_region = physunmap, |
| 130 .chip_readb = internal_chip_readb, | 131 .chip_readb = internal_chip_readb, |
| 131 .chip_readw = internal_chip_readw, | 132 .chip_readw = internal_chip_readw, |
| 132 .chip_readl = internal_chip_readl, | 133 .chip_readl = internal_chip_readl, |
| 133 .chip_readn = internal_chip_readn, | 134 .chip_readn = internal_chip_readn, |
| 134 .chip_writeb = internal_chip_writeb, | 135 .chip_writeb = internal_chip_writeb, |
| 135 .chip_writew = internal_chip_writew, | 136 .chip_writew = internal_chip_writew, |
| 136 .chip_writel = internal_chip_writel, | 137 .chip_writel = internal_chip_writel, |
| 137 .chip_writen = fallback_chip_writen, | 138 .chip_writen = fallback_chip_writen, |
| 138 .delay = internal_delay, | 139 .delay = internal_delay, |
| 139 }, | 140 }, |
| 140 #endif | 141 #endif |
| 141 | 142 |
| 142 #if CONFIG_DUMMY == 1 | 143 #if CONFIG_DUMMY == 1 |
| 143 { | 144 { |
| 144 .name = "dummy", | 145 .name = "dummy", |
| 145 .init = dummy_init, | 146 .init = dummy_init, |
| 146 .shutdown = dummy_shutdown, | 147 .shutdown = dummy_shutdown, |
|
Louis
2011/04/26 10:06:06
Those (below) shutdown functions are no longer cal
| |
| 147 .map_flash_region = dummy_map, | 148 .map_flash_region = dummy_map, |
| 148 .unmap_flash_region = dummy_unmap, | 149 .unmap_flash_region = dummy_unmap, |
| 149 .chip_readb = dummy_chip_readb, | 150 .chip_readb = dummy_chip_readb, |
| 150 .chip_readw = dummy_chip_readw, | 151 .chip_readw = dummy_chip_readw, |
| 151 .chip_readl = dummy_chip_readl, | 152 .chip_readl = dummy_chip_readl, |
| 152 .chip_readn = dummy_chip_readn, | 153 .chip_readn = dummy_chip_readn, |
| 153 .chip_writeb = dummy_chip_writeb, | 154 .chip_writeb = dummy_chip_writeb, |
| 154 .chip_writew = dummy_chip_writew, | 155 .chip_writew = dummy_chip_writew, |
| 155 .chip_writel = dummy_chip_writel, | 156 .chip_writel = dummy_chip_writel, |
| 156 .chip_writen = dummy_chip_writen, | 157 .chip_writen = dummy_chip_writen, |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 | 569 |
| 569 while (chip_restore_fn_count > 0) { | 570 while (chip_restore_fn_count > 0) { |
| 570 int i = --chip_restore_fn_count; | 571 int i = --chip_restore_fn_count; |
| 571 rc |= chip_restore_fn[i].func(chip_restore_fn[i].flash, | 572 rc |= chip_restore_fn[i].func(chip_restore_fn[i].flash, |
| 572 chip_restore_fn[i].status); | 573 chip_restore_fn[i].status); |
| 573 } | 574 } |
| 574 | 575 |
| 575 return rc; | 576 return rc; |
| 576 } | 577 } |
| 577 | 578 |
| 578 int programmer_shutdown(void) | 579 int flashrom_shutdown(void) |
|
Louis
2011/04/26 10:06:06
We don't need to change to flashrom_shutdown. prog
dhendrix
2011/04/27 02:08:06
Agreed. That was a bit ambitious of me :-)
Revert
| |
| 579 { | 580 { |
| 581 msg_gdbg("%s: carrying out %d shutdown callbacks\n", | |
| 582 __func__, shutdown_fn_count); | |
| 580 /* Registering shutdown functions is no longer allowed. */ | 583 /* Registering shutdown functions is no longer allowed. */ |
|
Louis
2011/04/26 10:06:06
Could you add the following code to avoid flashrom
dhendrix
2011/04/27 02:08:06
Good idea, however may_register_shutdown is set by
| |
| 581 may_register_shutdown = 0; | 584 may_register_shutdown = 0; |
| 582 while (shutdown_fn_count > 0) { | 585 while (shutdown_fn_count > 0) { |
| 583 int i = --shutdown_fn_count; | 586 int i = --shutdown_fn_count; |
| 584 shutdown_fn[i].func(shutdown_fn[i].data); | 587 shutdown_fn[i].func(shutdown_fn[i].data); |
| 585 } | 588 } |
| 586 » return programmer_table[programmer].shutdown(); | 589 » return 0; |
|
Louis
2011/04/26 10:06:06
We still need programmer_table[programmer].shutdow
dhendrix
2011/04/27 02:08:06
Hmm, the reason I removed programmer_table[program
Louis
2011/04/27 02:25:33
Sorry that I didn't say my comment very clearly. M
dhendrix
2011/04/27 20:07:29
Ah! That makes more sense. Thanks for the detailed
| |
| 587 } | 590 } |
| 588 | 591 |
| 589 void *programmer_map_flash_region(const char *descr, unsigned long phys_addr, | 592 void *programmer_map_flash_region(const char *descr, unsigned long phys_addr, |
| 590 size_t len) | 593 size_t len) |
| 591 { | 594 { |
| 592 return programmer_table[programmer].map_flash_region(descr, | 595 return programmer_table[programmer].map_flash_region(descr, |
| 593 phys_addr, len); | 596 phys_addr, len); |
| 594 } | 597 } |
| 595 | 598 |
| 596 void programmer_unmap_flash_region(void *virt_addr, size_t len) | 599 void programmer_unmap_flash_region(void *virt_addr, size_t len) |
| (...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2001 if (ret && write_it) | 2004 if (ret && write_it) |
| 2002 emergency_help_message(); | 2005 emergency_help_message(); |
| 2003 } | 2006 } |
| 2004 | 2007 |
| 2005 out: | 2008 out: |
| 2006 free(oldcontents); | 2009 free(oldcontents); |
| 2007 free(newcontents); | 2010 free(newcontents); |
| 2008 out_nofree: | 2011 out_nofree: |
| 2009 chip_restore(); /* must be done before programmer_shutdown() */ | 2012 chip_restore(); /* must be done before programmer_shutdown() */ |
| 2010 /* | 2013 /* |
| 2011 » * programmer_shutdown() call is moved to cli_mfg() in chromium os | 2014 » * flashrom_shutdown() call is moved to cli_mfg() in chromium os |
| 2012 * tree. This is because some operations, such as write protection, | 2015 * tree. This is because some operations, such as write protection, |
| 2013 * requires programmer_shutdown() but does not call doit(). | 2016 * requires programmer_shutdown() but does not call doit(). |
| 2014 */ | 2017 */ |
| 2015 //» programmer_shutdown(); | 2018 //» flashrom_shutdown(); |
| 2016 return ret; | 2019 return ret; |
| 2017 } | 2020 } |
| OLD | NEW |