[Skiboot] [PATCH 2/3] external/common: Add default erase chip implmentation
Cyril Bur
cyril.bur at au1.ibm.com
Mon Nov 7 17:28:50 AEDT 2016
Just blocklevel_erase() from zero to sizeof.
Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
external/common/arch_flash_common.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/external/common/arch_flash_common.c b/external/common/arch_flash_common.c
index ba06fb2..b6c87af 100644
--- a/external/common/arch_flash_common.c
+++ b/external/common/arch_flash_common.c
@@ -13,15 +13,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <stdlib.h>
#include <libflash/blocklevel.h>
#include "arch_flash.h"
/* Default implmentations */
+
+/*
+ * This just assumes that an erase from zero to total size is
+ * 'correct'.
+ * This is true for both powerpc and x86 and ARM has its own
+ * implmentation.
+ */
int __attribute__((weak)) arch_flash_erase_chip(struct blocklevel_device *bl)
{
- return -1;
+ int rc;
+ uint64_t total_size;
+
+ rc = blocklevel_get_info(bl, NULL, &total_size, NULL);
+ if (rc)
+ return rc;
+
+ return blocklevel_erase(bl, 0, total_size);
}
int __attribute__((weak)) arch_flash_4b_mode(struct blocklevel_device *bl, int set_4b)
--
2.10.2
More information about the Skiboot
mailing list