]> Git Repo - qemu.git/blobdiff - hw/nand.c
KVM: Coalesced MMIO support
[qemu.git] / hw / nand.c
index 925583ae456ca02180830d7ec5923134676e1ef9..11f8efca282f73c296c3663a91e661b913ddc223 100644 (file)
--- a/hw/nand.c
+++ b/hw/nand.c
@@ -106,7 +106,7 @@ struct nand_flash_s {
 # include "nand.c"
 
 /* Information based on Linux drivers/mtd/nand/nand_ids.c */
-struct nand_info_s {
+static const struct nand_info_s {
     int size;
     int width;
     int page_shift;
@@ -319,8 +319,6 @@ static int nand_load(QEMUFile *f, void *opaque, int version_id)
     return 0;
 }
 
-static int nand_iid = 0;
-
 /*
  * Chip inputs are CLE, ALE, CE, WP, GND and eight I/O pins.  Chip
  * outputs are R/B and eight I/O pins.
@@ -444,6 +442,7 @@ struct nand_flash_s *nand_init(int manf_id, int chip_id)
 {
     int pagesize;
     struct nand_flash_s *s;
+    int index;
 
     if (nand_flash_ids[chip_id].size == 0) {
         cpu_abort(cpu_single_env, "%s: Unsupported NAND chip ID.\n",
@@ -451,7 +450,9 @@ struct nand_flash_s *nand_init(int manf_id, int chip_id)
     }
 
     s = (struct nand_flash_s *) qemu_mallocz(sizeof(struct nand_flash_s));
-    s->bdrv = mtd_bdrv;
+    index = drive_get_index(IF_MTD, 0, 0);
+    if (index != -1)
+        s->bdrv = drives_table[index].bdrv;
     s->manf_id = manf_id;
     s->chip_id = chip_id;
     s->size = nand_flash_ids[s->chip_id].size << 20;
@@ -492,7 +493,7 @@ struct nand_flash_s *nand_init(int manf_id, int chip_id)
         s->storage = (uint8_t *) memset(qemu_malloc(s->pages * pagesize),
                         0xff, s->pages * pagesize);
 
-    register_savevm("nand", nand_iid ++, 0, nand_save, nand_load, s);
+    register_savevm("nand", -1, 0, nand_save, nand_load, s);
 
     return s;
 }
This page took 0.025895 seconds and 4 git commands to generate.