> >> static uint32_t addr_to_wpnum(uint64_t addr) {
> >> return addr>> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT);
> >> }
> >
> > This implicitly limits max address to 0x << (HWBLOCK_SHIFT +
> > SECTOR_SHIFT + WPGROUP_SHIFT), have you done this on purpose?
>
> You could argue for
On 11 April 2012 12:57, Igor Mitsyanko wrote:
> On 04/11/2012 02:12 PM, Peter Maydell wrote:
>>
>> On 5 April 2012 16:48, Igor Mitsyanko wrote:
>>>
>>> @@ -536,8 +541,8 @@ static void sd_function_switch(SDState *sd, uint32_t
>>> arg)
>>>
>>> static inline int sd_wp_addr(SDState *sd, uint32_t add
On 04/11/2012 02:12 PM, Peter Maydell wrote:
On 5 April 2012 16:48, Igor Mitsyanko wrote:
@@ -536,8 +541,8 @@ static void sd_function_switch(SDState *sd, uint32_t arg)
static inline int sd_wp_addr(SDState *sd, uint32_t addr)
{
I've just noticed that it truncates addr to 32 bits... And te
On 5 April 2012 16:48, Igor Mitsyanko wrote:
> @@ -536,8 +541,8 @@ static void sd_function_switch(SDState *sd, uint32_t arg)
>
> static inline int sd_wp_addr(SDState *sd, uint32_t addr)
> {
> - return sd->wp_groups[addr >>
> - (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)];
> +
Representing each group write protection flag with only one bit instead of int
variable significantly reduces memory consumption.
Signed-off-by: Igor Mitsyanko
---
hw/sd.c | 33 +++--
1 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/hw/sd.c b/hw/sd.c