Re: [Qemu-devel] [PATCH V2 01/10] hw/sd.c: convert wp_groups in SDState to bitfield

2012-04-11 Thread Paul Brook
> >> 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

Re: [Qemu-devel] [PATCH V2 01/10] hw/sd.c: convert wp_groups in SDState to bitfield

2012-04-11 Thread Peter Maydell
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

Re: [Qemu-devel] [PATCH V2 01/10] hw/sd.c: convert wp_groups in SDState to bitfield

2012-04-11 Thread Igor Mitsyanko
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

Re: [Qemu-devel] [PATCH V2 01/10] hw/sd.c: convert wp_groups in SDState to bitfield

2012-04-11 Thread Peter Maydell
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)]; > +  

[Qemu-devel] [PATCH V2 01/10] hw/sd.c: convert wp_groups in SDState to bitfield

2012-04-05 Thread Igor Mitsyanko
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