comparison loadtools/flash.h @ 976:ff4ce8d5ece4

fc-loadtool flash: definitions for AMD sector lock architecture
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 01 Dec 2023 06:43:21 +0000
parents 44cdfc4fed4c
children c5133c3c11b1
comparison
equal deleted inserted replaced
975:343552c6c621 976:ff4ce8d5ece4
34 struct cfi_check { 34 struct cfi_check {
35 int offset; 35 int offset;
36 uint8_t expect_val; 36 uint8_t expect_val;
37 }; 37 };
38 38
39 /*
40 * In order to examine non-volatile sector lock state of AMD-style flash
41 * chips, we need to know how their sectors are grouped for the purpose
42 * of locking: aggregation of sectors into groups that can only be locked
43 * or unlocked as a unit, and also grouping into independent-read partitions
44 * where each partition needs its own Autoselect sequence.
45 */
46
47 struct lock_group_desc {
48 uint32_t block_size;
49 unsigned nblocks;
50 int is_group;
51 int part_begin;
52 int part_end;
53 };
54
55 #define MAX_AMD_LOCK_GROUPS 8
56
57 struct amd_lock_info {
58 unsigned ngroups;
59 struct lock_group_desc groups[MAX_AMD_LOCK_GROUPS];
60 int have_status_word_3;
61 int have_status_word_7;
62 int have_mode_lock_bits;
63 int have_pln_lock_reg;
64 };
65
39 struct flash_device { 66 struct flash_device {
40 char *name; 67 char *name;
41 struct cfi_check *cfi_table; 68 struct cfi_check *cfi_table;
42 int required_global_config; 69 int required_global_config;
43 struct flash_geom *bank_geom[2]; 70 struct flash_geom *bank_geom[2];
44 struct flash_cmdset *cmdset; 71 struct flash_cmdset *cmdset;
72 struct amd_lock_info *lock_info[2];
45 }; 73 };
46 74
47 /* the following structures describe flash banks as accessible to us */ 75 /* the following structures describe flash banks as accessible to us */
48 76
49 struct sector_info { 77 struct sector_info {
68 struct flash_bank_info { 96 struct flash_bank_info {
69 uint32_t base_addr; 97 uint32_t base_addr;
70 struct flash_device *device; 98 struct flash_device *device;
71 struct flash_geom *geom; 99 struct flash_geom *geom;
72 struct flash_cmdset *ops; 100 struct flash_cmdset *ops;
101 struct amd_lock_info *amd_lock;
73 struct sector_info *sectors; 102 struct sector_info *sectors;
74 int detect_done; 103 int detect_done;
75 }; 104 };