395
397
/* Read in the IDENTIFY buffer and check registers */
396
398
data = inb(IDE_BASE + reg_device);
397
g_assert_cmpint(data & 0x10, ==, 0);
399
g_assert_cmpint(data & DEV, ==, 0);
399
401
for (i = 0; i < 256; i++) {
400
402
data = inb(IDE_BASE + reg_status);
428
static void test_flush(void)
434
"-drive file=blkdebug::%s,if=ide,cache=writeback",
437
/* Delay the completion of the flush request until we explicitly do it */
438
qmp("{'execute':'human-monitor-command', 'arguments': { "
439
"'command-line': 'qemu-io ide0-hd0 \"break flush_to_os A\"'} }");
441
/* FLUSH CACHE command on device 0*/
442
outb(IDE_BASE + reg_device, 0);
443
outb(IDE_BASE + reg_command, CMD_FLUSH_CACHE);
445
/* Check status while request is in flight*/
446
data = inb(IDE_BASE + reg_status);
447
assert_bit_set(data, BSY | DRDY);
448
assert_bit_clear(data, DF | ERR | DRQ);
450
/* Complete the command */
451
qmp("{'execute':'human-monitor-command', 'arguments': { "
452
"'command-line': 'qemu-io ide0-hd0 \"resume A\"'} }");
454
/* Check registers */
455
data = inb(IDE_BASE + reg_device);
456
g_assert_cmpint(data & DEV, ==, 0);
459
data = inb(IDE_BASE + reg_status);
460
} while (data & BSY);
462
assert_bit_set(data, DRDY);
463
assert_bit_clear(data, BSY | DF | ERR | DRQ);
426
468
int main(int argc, char **argv)
428
470
const char *arch = qtest_get_arch();
453
495
qtest_add_func("/ide/bmdma/long_prdt", test_bmdma_long_prdt);
454
496
qtest_add_func("/ide/bmdma/teardown", test_bmdma_teardown);
498
qtest_add_func("/ide/flush", test_flush);
456
500
ret = g_test_run();