[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [PATCH 04/10] hw/sd: Add QOM bus which SD cards plug in t
From: |
Peter Maydell |
Subject: |
Re: [Qemu-arm] [PATCH 04/10] hw/sd: Add QOM bus which SD cards plug in to |
Date: |
Sun, 20 Dec 2015 17:10:03 +0000 |
On 19 December 2015 at 21:38, Peter Crosthwaite
<address@hidden> wrote:
> On Fri, Dec 11, 2015 at 04:37:05PM +0000, Peter Maydell wrote:
>> +bool sdbus_get_inserted(SDBus *sdbus)
>> +{
>> + SDState *card = get_card(sdbus);
>> +
>> + if (card) {
>> + SDClass *sc = SD_GET_CLASS(card);
>> +
>> + return sc->get_inserted(card);
>> + }
>> +
>> + return false;
>> +}
>
> This I am not sure about. Realistically, the card has no self
> awareness of its ejection state so it can't be polled for "are
> you there". The card insertion switch is implemented as a
> physical switch on the slot itself and a property of the bus.
>
> The absence on presence of a device should determine this, making me
> think this should return !!card.
>
> Unfortunately, we have the case of the block UI being able to trigger a
> card ejection from underneath the bus level. But since the SD card is already
> using qdev_get_parent_bus() the removal from the bus can be managed at the
> card level.
For user-level back compat I think we need to retain "might have
an sdcard object with no block backend, and that means
'no-card-present'". This is both for the user facing
monitor commands to manipulate the sd card, and also
for the not-yet-QOMified controllers, which will always
create an sdcard object even if there's no block backend
(which should continue to mean "no card").
thanks
-- PMM
- Re: [Qemu-arm] [PATCH 02/10] hw/sd/sd.c: QOMify, (continued)
[Qemu-arm] [PATCH 03/10] hw/sd/sd.c: Convert sd_reset() function into Device reset method, Peter Maydell, 2015/12/11
[Qemu-arm] [PATCH 07/10] hw/sd/pxa2xx_mmci: convert to SysBusDevice object, Peter Maydell, 2015/12/11
[Qemu-arm] [PATCH 09/10] hw/sd/pxa2xx_mmci: Convert to VMStateDescription, Peter Maydell, 2015/12/11