aboutsummaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/goldfish_device.h3
-rw-r--r--hw/goldfish_mmc.c17
2 files changed, 14 insertions, 6 deletions
diff --git a/hw/goldfish_device.h b/hw/goldfish_device.h
index 7eb21de..d0739b7 100644
--- a/hw/goldfish_device.h
+++ b/hw/goldfish_device.h
@@ -49,7 +49,8 @@ void goldfish_battery_display(void (* callback)(void *data, const char* string),
void goldfish_mmc_init(uint32_t base, int id);
void goldfish_mmc_insert(int id, BlockDriverState* bs);
-void goldfish_mmc_remove(int id, BlockDriverState *bs);
+void goldfish_mmc_remove(int id);
+int goldfish_mmc_is_media_inserted(int id);
void *goldfish_switch_add(char *name, uint32_t (*writefn)(void *opaque, uint32_t state), void *writeopaque, int id);
void goldfish_switch_set_state(void *opaque, uint32_t state);
diff --git a/hw/goldfish_mmc.c b/hw/goldfish_mmc.c
index 124f865..8b5c137 100644
--- a/hw/goldfish_mmc.c
+++ b/hw/goldfish_mmc.c
@@ -560,18 +560,25 @@ static void goldfish_mmc_setbs(struct goldfish_mmc_state* s, BlockDriverState* b
void goldfish_mmc_insert(int id, BlockDriverState* bs)
{
if (id >= GOLDFISH_MMC_MAX) {
- fprintf(stderr, "mmc controller %d out of range\n", id);
- return;
+ return -1;
}
goldfish_mmc_setbs(gDrvState[id], bs);
}
-void goldfish_mmc_remove(int id, BlockDriverState* bs)
+int goldfish_mmc_is_media_inserted(int id)
+{
+ if (id > GOLDFISH_MMC_MAX) {
+ return -1;
+ }
+
+ return (gDrvState[id]->bs != NULL);
+}
+
+void goldfish_mmc_remove(int id)
{
if (id >= GOLDFISH_MMC_MAX) {
- fprintf(stderr, "mmc controller %d out of range\n", id);
- return;
+ return -1;
}
goldfish_mmc_setbs(gDrvState[id], NULL);