aboutsummaryrefslogtreecommitdiffstats
path: root/hw/android_arm.c
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2009-12-05 09:54:44 -0800
committerSan Mehat <san@google.com>2009-12-07 14:48:32 -0800
commit68a8f7b5ed6ee2bbbc7b67070b9c401c2276426f (patch)
tree59d93e62f0ee5789b80986b347cc1c52dbefb21a /hw/android_arm.c
parentdc3dd741551c323bb853782656c0d693db98ecdc (diff)
downloadexternal_qemu-68a8f7b5ed6ee2bbbc7b67070b9c401c2276426f.zip
external_qemu-68a8f7b5ed6ee2bbbc7b67070b9c401c2276426f.tar.gz
external_qemu-68a8f7b5ed6ee2bbbc7b67070b9c401c2276426f.tar.bz2
qemu: android: Add support for multiple SD cards
Add commandline support for an additional SD card, and plumb support to the MMC emulation layer. This patch also reworks the way the hw emulation layer registers devices. Previously, the mmc virtual hardware was only created if the sdcard image existed. Now, two virtual MMC controllers are *always* created as on real hardware. When a request is made to one of our controllers which has no image file bound to it, a new interrupt status indicating a command timeout is sent to the guest driver, as is standard with MMC controllers. This patch also sets the stage for supporting hot-add / hot-remove. Signed-off-by: San Mehat <san@google.com> qemu: android: Integrate card detect into the virtual mmc hardware and wire it up to the STATE_CHANGE irq status Signed-off-by: San Mehat <san@google.com> fixups from review - mmc now works with legacy drivers Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'hw/android_arm.c')
-rw-r--r--hw/android_arm.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/hw/android_arm.c b/hw/android_arm.c
index 32f6925..4ef4a10 100644
--- a/hw/android_arm.c
+++ b/hw/android_arm.c
@@ -42,7 +42,18 @@ static struct goldfish_device nand_device = {
/* Board init. */
-#define TEST_SWITCH 1
+static void goldfish_sdcard_init(int n, unsigned base)
+{
+ int idx = drive_get_index( IF_IDE, 0, n );
+
+ goldfish_mmc_init(base, n);
+
+ if (idx >= 0) {
+ goldfish_mmc_insert(n, drives_table[idx].bdrv);
+ }
+}
+
+// #define TEST_SWITCH 1
#if TEST_SWITCH
uint32_t switch_test_write(void *opaque, uint32_t state)
{
@@ -113,11 +124,9 @@ static void android_arm_init_(ram_addr_t ram_size,
#ifdef HAS_AUDIO
goldfish_audio_init(0xff004000, 0, audio_input_source);
#endif
- {
- int idx = drive_get_index( IF_IDE, 0, 0 );
- if (idx >= 0)
- goldfish_mmc_init(0xff005000, 0, drives_table[idx].bdrv);
- }
+
+ goldfish_sdcard_init(0, 0xff005000);
+ goldfish_sdcard_init(1, 0xff007000);
goldfish_memlog_init(0xff006000);