Commit 5e65a31037e03c9ccbc4df156ddb11b36108a0a6
1 parent
c701b35b
Add rigid and flexible disk geometry page support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4821 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
70 additions
and
1 deletions
hw/scsi-disk.c
... | ... | @@ -532,7 +532,76 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, |
532 | 532 | outbuf[2] = 0x80; /* Readonly. */ |
533 | 533 | } |
534 | 534 | p += 4; |
535 | - if ((page == 8 || page == 0x3f)) { | |
535 | + if (page == 4) { | |
536 | + int cylinders, heads, secs; | |
537 | + | |
538 | + /* Rigid disk device geometry page. */ | |
539 | + p[0] = 4; | |
540 | + p[1] = 0x16; | |
541 | + /* if a geometry hint is available, use it */ | |
542 | + bdrv_get_geometry_hint(s->bdrv, &cylinders, &heads, &secs); | |
543 | + p[2] = (cylinders >> 16) & 0xff; | |
544 | + p[3] = (cylinders >> 8) & 0xff; | |
545 | + p[4] = cylinders & 0xff; | |
546 | + p[5] = heads & 0xff; | |
547 | + /* Write precomp start cylinder, disabled */ | |
548 | + p[6] = (cylinders >> 16) & 0xff; | |
549 | + p[7] = (cylinders >> 8) & 0xff; | |
550 | + p[8] = cylinders & 0xff; | |
551 | + /* Reduced current start cylinder, disabled */ | |
552 | + p[9] = (cylinders >> 16) & 0xff; | |
553 | + p[10] = (cylinders >> 8) & 0xff; | |
554 | + p[11] = cylinders & 0xff; | |
555 | + /* Device step rate [ns], 200ns */ | |
556 | + p[12] = 0; | |
557 | + p[13] = 200; | |
558 | + /* Landing zone cylinder */ | |
559 | + p[14] = 0xff; | |
560 | + p[15] = 0xff; | |
561 | + p[16] = 0xff; | |
562 | + /* Medium rotation rate [rpm], 5400 rpm */ | |
563 | + p[20] = (5400 >> 8) & 0xff; | |
564 | + p[21] = 5400 & 0xff; | |
565 | + p += 0x16; | |
566 | + } else if (page == 5) { | |
567 | + int cylinders, heads, secs; | |
568 | + | |
569 | + /* Flexible disk device geometry page. */ | |
570 | + p[0] = 5; | |
571 | + p[1] = 0x1e; | |
572 | + /* Transfer rate [kbit/s], 5Mbit/s */ | |
573 | + p[2] = 5000 >> 8; | |
574 | + p[3] = 5000 & 0xff; | |
575 | + /* if a geometry hint is available, use it */ | |
576 | + bdrv_get_geometry_hint(s->bdrv, &cylinders, &heads, &secs); | |
577 | + p[4] = heads & 0xff; | |
578 | + p[5] = secs & 0xff; | |
579 | + p[6] = s->cluster_size * 2; | |
580 | + p[8] = (cylinders >> 8) & 0xff; | |
581 | + p[9] = cylinders & 0xff; | |
582 | + /* Write precomp start cylinder, disabled */ | |
583 | + p[10] = (cylinders >> 8) & 0xff; | |
584 | + p[11] = cylinders & 0xff; | |
585 | + /* Reduced current start cylinder, disabled */ | |
586 | + p[12] = (cylinders >> 8) & 0xff; | |
587 | + p[13] = cylinders & 0xff; | |
588 | + /* Device step rate [100us], 100us */ | |
589 | + p[14] = 0; | |
590 | + p[15] = 1; | |
591 | + /* Device step pulse width [us], 1us */ | |
592 | + p[16] = 1; | |
593 | + /* Device head settle delay [100us], 100us */ | |
594 | + p[17] = 0; | |
595 | + p[18] = 1; | |
596 | + /* Motor on delay [0.1s], 0.1s */ | |
597 | + p[19] = 1; | |
598 | + /* Motor off delay [0.1s], 0.1s */ | |
599 | + p[20] = 1; | |
600 | + /* Medium rotation rate [rpm], 5400 rpm */ | |
601 | + p[28] = (5400 >> 8) & 0xff; | |
602 | + p[29] = 5400 & 0xff; | |
603 | + p += 0x1e; | |
604 | + } else if ((page == 8 || page == 0x3f)) { | |
536 | 605 | /* Caching page. */ |
537 | 606 | memset(p,0,20); |
538 | 607 | p[0] = 8; | ... | ... |