Message ID | 1450733465-13192-4-git-send-email-Andrew.Baumann@microsoft.com |
---|---|
State | New |
Headers | show |
On Mon, Dec 21, 2015 at 1:31 PM, Andrew Baumann <Andrew.Baumann@microsoft.com> wrote: > This is needed for a quirk of the Raspberry Pi (bcm2835/6) MMC > controller, where the card insert bit is documented as unimplemented > (always reads zero, doesn't generate interrupts) but is in fact > observed on hardware as set at power on, but is cleared (and remains > clear) on subsequent controller resets. > > Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com> > Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> > --- > hw/sd/sdhci.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c > index dd83e89..61f919b 100644 > --- a/hw/sd/sdhci.c > +++ b/hw/sd/sdhci.c > @@ -193,7 +193,9 @@ static void sdhci_reset(SDHCIState *s) > * initialization */ > memset(&s->sdmasysad, 0, (uintptr_t)&s->capareg - (uintptr_t)&s->sdmasysad); > > - sd_set_cb(s->card, s->ro_cb, s->eject_cb); > + if (!s->noeject_quirk) { > + sd_set_cb(s->card, s->ro_cb, s->eject_cb); > + } > s->data_count = 0; > s->stopped_state = sdhc_not_stopped; > } > @@ -1208,6 +1210,7 @@ const VMStateDescription sdhci_vmstate = { > VMSTATE_UINT16(data_count, SDHCIState), > VMSTATE_UINT64(admasysaddr, SDHCIState), > VMSTATE_UINT8(stopped_state, SDHCIState), > + VMSTATE_BOOL(noeject_quirk, SDHCIState), Sorry, one small thing I missed, static props should not be in the VMSD. I think you just need to drop the VMSTATE_ addition here. Otherwise you would need a VMSD version bump. Is the patch missing the corresponding header change to add the new field? Regards, Peter > VMSTATE_VBUFFER_UINT32(fifo_buffer, SDHCIState, 1, NULL, 0, buf_maxsz), > VMSTATE_TIMER_PTR(insert_timer, SDHCIState), > VMSTATE_TIMER_PTR(transfer_timer, SDHCIState), > @@ -1276,6 +1279,7 @@ static Property sdhci_sysbus_properties[] = { > DEFINE_PROP_UINT32("capareg", SDHCIState, capareg, > SDHC_CAPAB_REG_DEFAULT), > DEFINE_PROP_UINT32("maxcurr", SDHCIState, maxcurr, 0), > + DEFINE_PROP_BOOL("noeject-quirk", SDHCIState, noeject_quirk, false), > DEFINE_PROP_END_OF_LIST(), > }; > > -- > 2.5.3 >
> From: Peter Crosthwaite [mailto:crosthwaitepeter@gmail.com] > Sent: Monday, 21 December 2015 13:42 > On Mon, Dec 21, 2015 at 1:31 PM, Andrew Baumann > <Andrew.Baumann@microsoft.com> wrote: > > This is needed for a quirk of the Raspberry Pi (bcm2835/6) MMC > > controller, where the card insert bit is documented as unimplemented > > (always reads zero, doesn't generate interrupts) but is in fact > > observed on hardware as set at power on, but is cleared (and remains > > clear) on subsequent controller resets. > > @@ -1208,6 +1210,7 @@ const VMStateDescription sdhci_vmstate = { > > VMSTATE_UINT16(data_count, SDHCIState), > > VMSTATE_UINT64(admasysaddr, SDHCIState), > > VMSTATE_UINT8(stopped_state, SDHCIState), > > + VMSTATE_BOOL(noeject_quirk, SDHCIState), > > Sorry, one small thing I missed, static props should not be in the > VMSD. I think you just need to drop the VMSTATE_ addition here. > Otherwise you would need a VMSD version bump. Yes we can drop the VMSTATE addition here. > Is the patch missing the corresponding header change to add the new field? Aargh. You're right, sorry, my mistake -- I've been breaking up all the changes into different branches to get them submitted, and missed the header file here. Will resend. Andrew
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index dd83e89..61f919b 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -193,7 +193,9 @@ static void sdhci_reset(SDHCIState *s) * initialization */ memset(&s->sdmasysad, 0, (uintptr_t)&s->capareg - (uintptr_t)&s->sdmasysad); - sd_set_cb(s->card, s->ro_cb, s->eject_cb); + if (!s->noeject_quirk) { + sd_set_cb(s->card, s->ro_cb, s->eject_cb); + } s->data_count = 0; s->stopped_state = sdhc_not_stopped; } @@ -1208,6 +1210,7 @@ const VMStateDescription sdhci_vmstate = { VMSTATE_UINT16(data_count, SDHCIState), VMSTATE_UINT64(admasysaddr, SDHCIState), VMSTATE_UINT8(stopped_state, SDHCIState), + VMSTATE_BOOL(noeject_quirk, SDHCIState), VMSTATE_VBUFFER_UINT32(fifo_buffer, SDHCIState, 1, NULL, 0, buf_maxsz), VMSTATE_TIMER_PTR(insert_timer, SDHCIState), VMSTATE_TIMER_PTR(transfer_timer, SDHCIState), @@ -1276,6 +1279,7 @@ static Property sdhci_sysbus_properties[] = { DEFINE_PROP_UINT32("capareg", SDHCIState, capareg, SDHC_CAPAB_REG_DEFAULT), DEFINE_PROP_UINT32("maxcurr", SDHCIState, maxcurr, 0), + DEFINE_PROP_BOOL("noeject-quirk", SDHCIState, noeject_quirk, false), DEFINE_PROP_END_OF_LIST(), };