rtoss - Diff between revs 78 and 79

Subversion Repositories:
Rev:
Show entire file - Ignore whitespace
Rev 78 Rev 79
Line 1949... Line 1949...
1949                 s->status = READY_STAT | SEEK_STAT; 1949                 s->status = READY_STAT | SEEK_STAT;
1950                 ide_set_irq(s->bus); 1950                 ide_set_irq(s->bus);
1951                 break; 1951                 break;
1952             case 0x03: { /* set transfer mode */ 1952             case 0x03: { /* set transfer mode */
1953                 uint8_t val = s->nsector & 0x07; 1953                 uint8_t val = s->nsector & 0x07;
-   1954                 uint16_t *identify_data = (uint16_t *)s->identify_data;
1954 1955
1955                 switch (s->nsector >> 3) { 1956                 switch (s->nsector >> 3) {
1956                     case 0x00: /* pio default */ 1957                     case 0x00: /* pio default */
1957                     case 0x01: /* pio mode */ 1958                     case 0x01: /* pio mode */
1958                         put_le16(s->identify_data + 62,0x07); -  
1959                         put_le16(s->identify_data + 63,0x07); -  
1960                         put_le16(s->identify_data + 88,0x3f); -  
-   1959                         put_le16(identify_data + 62,0x07);
-   1960                         put_le16(identify_data + 63,0x07);
-   1961                         put_le16(identify_data + 88,0x3f);
1961                         break; 1962                         break;
1962                     case 0x02: /* sigle word dma mode*/ 1963                     case 0x02: /* sigle word dma mode*/
1963                         put_le16(s->identify_data + 62,0x07 | (1 << (val + 8))); -  
1964                         put_le16(s->identify_data + 63,0x07); -  
1965                         put_le16(s->identify_data + 88,0x3f); -  
-   1964                         put_le16(identify_data + 62,0x07 | (1 << (val + 8)));
-   1965                         put_le16(identify_data + 63,0x07);
-   1966                         put_le16(identify_data + 88,0x3f);
1966                         break; 1967                         break;
1967                     case 0x04: /* mdma mode */ 1968                     case 0x04: /* mdma mode */
1968                         put_le16(s->identify_data + 62,0x07); -  
1969                         put_le16(s->identify_data + 63,0x07 | (1 << (val + 8))); -  
1970                         put_le16(s->identify_data + 88,0x3f); -  
-   1969                         put_le16(identify_data + 62,0x07);
-   1970                         put_le16(identify_data + 63,0x07 | (1 << (val + 8)));
-   1971                         put_le16(identify_data + 88,0x3f);
1971                         break; 1972                         break;
1972                     case 0x08: /* udma mode */ 1973                     case 0x08: /* udma mode */
1973                         put_le16(s->identify_data + 62,0x07); -  
1974                         put_le16(s->identify_data + 63,0x07); -  
1975                         put_le16(s->identify_data + 88,0x3f | (1 << (val + 8))); -  
-   1974                         put_le16(identify_data + 62,0x07);
-   1975                         put_le16(identify_data + 63,0x07);
-   1976                         put_le16(identify_data + 88,0x3f | (1 << (val + 8)));
1976                         break; 1977                         break;
1977                     default: 1978                     default:
1978                         goto abort_cmd; 1979                         goto abort_cmd;
1979                 } 1980                 }
1980                 s->status = READY_STAT | SEEK_STAT; 1981                 s->status = READY_STAT | SEEK_STAT;
Line 2597... Line 2598...
2597     register_ioport_read(iobase, 2, 2, ide_data_readw, bus); 2598     register_ioport_read(iobase, 2, 2, ide_data_readw, bus);
2598     register_ioport_write(iobase, 4, 4, ide_data_writel, bus); 2599     register_ioport_write(iobase, 4, 4, ide_data_writel, bus);
2599     register_ioport_read(iobase, 4, 4, ide_data_readl, bus); 2600     register_ioport_read(iobase, 4, 4, ide_data_readl, bus);
2600 } 2601 }
2601 2602
2602 /* save per IDE drive data */ -  
2603 void ide_save(QEMUFile* f, IDEState *s) -  
-   2603 static bool is_identify_set(void *opaque, int version_id)
2604 { 2604 {
2605     qemu_put_be32(f, s->mult_sectors); -  
2606     qemu_put_be32(f, s->identify_set); -  
2607     if (s->identify_set) { -  
2608         qemu_put_buffer(f, (const uint8_t *)s->identify_data, 512); -  
2609     } -  
2610     qemu_put_8s(f, &s->feature); -  
2611     qemu_put_8s(f, &s->error); -  
2612     qemu_put_be32s(f, &s->nsector); -  
2613     qemu_put_8s(f, &s->sector); -  
2614     qemu_put_8s(f, &s->lcyl); -  
2615     qemu_put_8s(f, &s->hcyl); -  
2616     qemu_put_8s(f, &s->hob_feature); -  
2617     qemu_put_8s(f, &s->hob_nsector); -  
2618     qemu_put_8s(f, &s->hob_sector); -  
2619     qemu_put_8s(f, &s->hob_lcyl); -  
2620     qemu_put_8s(f, &s->hob_hcyl); -  
2621     qemu_put_8s(f, &s->select); -  
2622     qemu_put_8s(f, &s->status); -  
2623     qemu_put_8s(f, &s->lba48); -  
-   2605     IDEState *s = opaque;
2624 2606
2625     qemu_put_8s(f, &s->sense_key); -  
2626     qemu_put_8s(f, &s->asc); -  
2627     qemu_put_8s(f, &s->cdrom_changed); -  
2628     /* XXX: if a transfer is pending, we do not save it yet */ -  
-   2607     return s->identify_set != 0;
2629 } 2608 }
2630 2609
2631 /* load per IDE drive data */ -  
2632 void ide_load(QEMUFile* f, IDEState *s, int version_id) -  
-   2610 static int ide_drive_post_load(void *opaque, int version_id)
2633 { 2611 {
2634     s->mult_sectors=qemu_get_be32(f); -  
2635     s->identify_set=qemu_get_be32(f); -  
2636     if (s->identify_set) { -  
2637         qemu_get_buffer(f, (uint8_t *)s->identify_data, 512); -  
2638     } -  
2639     qemu_get_8s(f, &s->feature); -  
2640     qemu_get_8s(f, &s->error); -  
2641     qemu_get_be32s(f, &s->nsector); -  
2642     qemu_get_8s(f, &s->sector); -  
2643     qemu_get_8s(f, &s->lcyl); -  
2644     qemu_get_8s(f, &s->hcyl); -  
2645     qemu_get_8s(f, &s->hob_feature); -  
2646     qemu_get_8s(f, &s->hob_nsector); -  
2647     qemu_get_8s(f, &s->hob_sector); -  
2648     qemu_get_8s(f, &s->hob_lcyl); -  
2649     qemu_get_8s(f, &s->hob_hcyl); -  
2650     qemu_get_8s(f, &s->select); -  
2651     qemu_get_8s(f, &s->status); -  
2652     qemu_get_8s(f, &s->lba48); -  
-   2612     IDEState *s = opaque;
2653 2613
2654     qemu_get_8s(f, &s->sense_key); -  
2655     qemu_get_8s(f, &s->asc); -  
2656     if (version_id == 3) { -  
2657         qemu_get_8s(f, &s->cdrom_changed); -  
2658     } else { -  
-   2614     if (version_id < 3) {
2659         if (s->sense_key == SENSE_UNIT_ATTENTION && 2615         if (s->sense_key == SENSE_UNIT_ATTENTION &&
2660                        s->asc == ASC_MEDIUM_MAY_HAVE_CHANGED) -  
-   2616             s->asc == ASC_MEDIUM_MAY_HAVE_CHANGED) {
2661             s->cdrom_changed = 1; 2617             s->cdrom_changed = 1;
-   2618         }
2662     } 2619     }
2663     /* XXX: if a transfer is pending, we do not save it yet */ -  
-   2620     return 0;
2664 } 2621 }
2665 2622
2666 void idebus_save(QEMUFile* f, IDEBus *bus) -  
2667 { -  
2668     qemu_put_8s(f, &bus->cmd); -  
2669     qemu_put_8s(f, &bus->unit); -  
2670 } -  
-   2623 const VMStateDescription vmstate_ide_drive = {
-   2624     .name = "ide_drive",
-   2625     .version_id = 3,
-   2626     .minimum_version_id = 0,
-   2627     .minimum_version_id_old = 0,
-   2628     .post_load = ide_drive_post_load,
-   2629     .fields      = (VMStateField []) {
-   2630         VMSTATE_INT32(mult_sectors, IDEState),
-   2631         VMSTATE_INT32(identify_set, IDEState),
-   2632         VMSTATE_BUFFER_TEST(identify_data, IDEState, is_identify_set),
-   2633         VMSTATE_UINT8(feature, IDEState),
-   2634         VMSTATE_UINT8(error, IDEState),
-   2635         VMSTATE_UINT32(nsector, IDEState),
-   2636         VMSTATE_UINT8(sector, IDEState),
-   2637         VMSTATE_UINT8(lcyl, IDEState),
-   2638         VMSTATE_UINT8(hcyl, IDEState),
-   2639         VMSTATE_UINT8(hob_feature, IDEState),
-   2640         VMSTATE_UINT8(hob_sector, IDEState),
-   2641         VMSTATE_UINT8(hob_nsector, IDEState),
-   2642         VMSTATE_UINT8(hob_lcyl, IDEState),
-   2643         VMSTATE_UINT8(hob_hcyl, IDEState),
-   2644         VMSTATE_UINT8(select, IDEState),
-   2645         VMSTATE_UINT8(status, IDEState),
-   2646         VMSTATE_UINT8(lba48, IDEState),
-   2647         VMSTATE_UINT8(sense_key, IDEState),
-   2648         VMSTATE_UINT8(asc, IDEState),
-   2649         VMSTATE_UINT8_V(cdrom_changed, IDEState, 3),
-   2650         /* XXX: if a transfer is pending, we do not save it yet */
-   2651         VMSTATE_END_OF_LIST()
-   2652     }
-   2653 };
2671 2654
2672 void idebus_load(QEMUFile* f, IDEBus *bus, int version_id) -  
2673 { -  
2674     qemu_get_8s(f, &bus->cmd); -  
2675     qemu_get_8s(f, &bus->unit); -  
2676 } -  
-   2655 const VMStateDescription vmstate_ide_bus = {
-   2656     .name = "ide_bus",
-   2657     .version_id = 1,
-   2658     .minimum_version_id = 1,
-   2659     .minimum_version_id_old = 1,
-   2660     .fields      = (VMStateField []) {
-   2661         VMSTATE_UINT8(cmd, IDEBus),
-   2662         VMSTATE_UINT8(unit, IDEBus),
-   2663         VMSTATE_END_OF_LIST()
-   2664     }
-   2665 };
2677 2666
2678 /***********************************************************/ 2667 /***********************************************************/
2679 /* PCI IDE definitions */ 2668 /* PCI IDE definitions */
2680 2669
2681 static void ide_dma_start(IDEState *s, BlockDriverCompletionFunc *dma_cb) 2670 static void ide_dma_start(IDEState *s, BlockDriverCompletionFunc *dma_cb)