Changeset 39567 in vbox for trunk/src/VBox/Devices/PC/BIOS-new
- Timestamp:
- Dec 9, 2011 1:48:57 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS-new/eltorito.c
r39565 r39567 615 615 void BIOSCALL int13_cdrom(uint16_t EHBX, disk_regs_t r) 616 616 { 617 uint16_t ebda_seg=read_word(0x0040,0x000E); 618 uint8_t device, status, locks; 619 uint8_t atacmd[12]; 620 uint32_t lba; 621 uint16_t count, segment, offset, size; 622 bio_dsk_t __far *bios_dsk; 617 uint16_t ebda_seg = read_word(0x0040,0x000E); 618 uint8_t device, status, locks; 619 uint8_t atacmd[12]; 620 uint32_t lba; 621 uint16_t count, segment, offset, size; 622 bio_dsk_t __far *bios_dsk; 623 int13ext_t __far *i13x; 624 dpt_t __far *dpt; 623 625 624 626 bios_dsk = ebda_seg :> &EbdaData->bdisk; 625 626 627 627 628 BX_DEBUG_INT13_CD("%s: AX=%04x BX=%04x CX=%04x DX=%04x ES=%04x\n", __func__, AX, BX, CX, DX, ES); … … 694 695 case 0x47: // IBM/MS extended seek 695 696 696 count = read_word(DS, SI+(uint16_t)&Int13Ext->count); 697 segment = read_word(DS, SI+(uint16_t)&Int13Ext->segment); 698 offset = read_word(DS, SI+(uint16_t)&Int13Ext->offset); 697 /* Load the I13X struct pointer. */ 698 i13x = MK_FP(DS, SI); 699 700 count = i13x->count; 701 segment = i13x->segment; 702 offset = i13x->offset; 699 703 700 704 // Can't use 64 bits lba 701 lba = read_dword(DS, SI+(uint16_t)&Int13Ext->lba2);705 lba = i13x->lba2; 702 706 if (lba != 0L) { 703 707 BX_PANIC("%s: function %02x. Can't use 64bits lba\n", __func__, GET_AH()); … … 706 710 707 711 // Get 32 bits lba 708 lba = read_dword(DS, SI+(uint16_t)&Int13Ext->lba1);712 lba = i13x->lba1; 709 713 710 714 // If verify or seek … … 731 735 732 736 count = (uint16_t)(bios_dsk->drqp.trsfbytes >> 11); 733 write_word(DS, SI+(uint16_t)&Int13Ext->count, count);737 i13x->count = count; 734 738 735 739 if (status != 0) { … … 808 812 break; 809 813 814 //@todo: Part of this should be merged with analogous code in disk.c 810 815 case 0x48: // IBM/MS get drive parameters 811 size = read_word(DS,SI+(uint16_t)&Int13Ext->size); 816 dpt = DS :> (dpt_t *)SI; 817 size = dpt->size; 812 818 813 819 // Buffer is too small 814 if (size < 0x1a)820 if (size < 0x1a) 815 821 goto int13_fail; 816 822 817 823 // EDD 1.x 818 if (size >= 0x1a) {824 if (size >= 0x1a) { 819 825 uint16_t blksize; 820 826 821 blksize 822 823 write_word(DS, SI+(uint16_t)&Int13DPT->size, 0x1a);824 write_word(DS, SI+(uint16_t)&Int13DPT->infos, 0x74); // removable, media change, lockable, max values825 write_dword(DS, SI+(uint16_t)&Int13DPT->cylinders, 0xffffffff);826 write_dword(DS, SI+(uint16_t)&Int13DPT->heads, 0xffffffff);827 write_dword(DS, SI+(uint16_t)&Int13DPT->spt, 0xffffffff);828 write_dword(DS, SI+(uint16_t)&Int13DPT->sector_count1, 0xffffffff); // FIXME should be Bit64829 write_dword(DS, SI+(uint16_t)&Int13DPT->sector_count2, 0xffffffff);830 write_word(DS, SI+(uint16_t)&Int13DPT->blksize, blksize);827 blksize = bios_dsk->devices[device].blksize; 828 829 dpt->size = 0x1a; 830 dpt->infos = 0x74; /* Removable, media change, lockable, max values */ 831 dpt->cylinders = 0xffffffff; 832 dpt->heads = 0xffffffff; 833 dpt->spt = 0xffffffff; 834 dpt->blksize = blksize; 835 dpt->sector_count1 = 0xffffffff; // FIXME should be Bit64 836 dpt->sector_count2 = 0xffffffff; 831 837 } 832 838 833 839 // EDD 2.x 834 840 if(size >= 0x1e) { 835 uint8_t channel, irq, mode, checksum, i; 836 uint16_t iobase1, iobase2, options; 837 838 write_word(DS, SI+(uint16_t)&Int13DPT->size, 0x1e); 839 840 write_word(DS, SI+(uint16_t)&Int13DPT->dpte_segment, ebda_seg); 841 write_word(DS, SI+(uint16_t)&Int13DPT->dpte_offset, (uint16_t)&EbdaData->bdisk.dpte); 841 uint8_t channel, irq, mode, checksum, i; 842 uint16_t iobase1, iobase2, options; 843 844 dpt->size = 0x1e; 845 dpt->dpte_segment = ebda_seg; 846 dpt->dpte_offset = (uint16_t)&EbdaData->bdisk.dpte; 842 847 843 848 // Fill in dpte … … 854 859 options |= (mode==ATA_MODE_PIO32?1:0<<7); 855 860 856 bios_dsk->dpte.iobase1 857 bios_dsk->dpte.iobase2 858 bios_dsk->dpte.prefix 859 bios_dsk->dpte.unused 860 bios_dsk->dpte.irq 861 bios_dsk->dpte.blkcount 862 bios_dsk->dpte.dma 863 bios_dsk->dpte.pio 864 bios_dsk->dpte.options 865 bios_dsk->dpte.reserved 866 bios_dsk->dpte.revision 861 bios_dsk->dpte.iobase1 = iobase1; 862 bios_dsk->dpte.iobase2 = iobase2; 863 bios_dsk->dpte.prefix = (0xe | (device % 2))<<4; 864 bios_dsk->dpte.unused = 0xcb; 865 bios_dsk->dpte.irq = irq; 866 bios_dsk->dpte.blkcount = 1 ; 867 bios_dsk->dpte.dma = 0; 868 bios_dsk->dpte.pio = 0; 869 bios_dsk->dpte.options = options; 870 bios_dsk->dpte.reserved = 0; 871 bios_dsk->dpte.revision = 0x11; 867 872 868 873 checksum = 0; 869 for (i =0; i<15; i++)874 for (i = 0; i < 15; ++i) 870 875 checksum += read_byte(ebda_seg, (uint16_t)&EbdaData->bdisk.dpte + i); 871 876 checksum = -checksum; … … 875 880 // EDD 3.x 876 881 if(size >= 0x42) { 877 uint8_t channel, iface, checksum, i;878 uint16_t iobase1;882 uint8_t channel, iface, checksum, i; 883 uint16_t iobase1; 879 884 880 885 channel = device / 2; … … 882 887 iobase1 = bios_dsk->channels[channel].iobase1; 883 888 884 write_word(DS, SI+(uint16_t)&Int13DPT->size, 0x42);885 write_word(DS, SI+(uint16_t)&Int13DPT->key, 0xbedd);886 write_byte(DS, SI+(uint16_t)&Int13DPT->dpi_length, 0x24);887 write_byte(DS, SI+(uint16_t)&Int13DPT->reserved1, 0);888 write_word(DS, SI+(uint16_t)&Int13DPT->reserved2, 0);889 dpt->size = 0x42; 890 dpt->key = 0xbedd; 891 dpt->dpi_length = 0x24; 892 dpt->reserved1 = 0; 893 dpt->reserved2 = 0; 889 894 890 895 if (iface == ATA_IFACE_ISA) { 891 write_byte(DS, SI+(uint16_t)&Int13DPT->host_bus[0], 'I');892 write_byte(DS, SI+(uint16_t)&Int13DPT->host_bus[1], 'S');893 write_byte(DS, SI+(uint16_t)&Int13DPT->host_bus[2], 'A');894 write_byte(DS, SI+(uint16_t)&Int13DPT->host_bus[3], 0);896 dpt->host_bus[0] = 'I'; 897 dpt->host_bus[1] = 'S'; 898 dpt->host_bus[2] = 'A'; 899 dpt->host_bus[3] = ' '; 895 900 } 896 901 else { 897 902 // FIXME PCI 898 903 } 899 write_byte(DS, SI+(uint16_t)&Int13DPT->iface_type[0], 'A'); 900 write_byte(DS, SI+(uint16_t)&Int13DPT->iface_type[1], 'T'); 901 write_byte(DS, SI+(uint16_t)&Int13DPT->iface_type[2], 'A'); 902 write_byte(DS, SI+(uint16_t)&Int13DPT->iface_type[3], 0); 903 904 if (iface==ATA_IFACE_ISA) { 905 write_word(DS, SI+(uint16_t)&Int13DPT->iface_path[0], iobase1); 906 write_word(DS, SI+(uint16_t)&Int13DPT->iface_path[2], 0); 907 write_dword(DS, SI+(uint16_t)&Int13DPT->iface_path[4], 0L); 904 dpt->iface_type[0] = 'A'; 905 dpt->iface_type[1] = 'T'; 906 dpt->iface_type[2] = 'A'; 907 dpt->iface_type[3] = ' '; 908 dpt->iface_type[4] = ' '; 909 dpt->iface_type[5] = ' '; 910 dpt->iface_type[6] = ' '; 911 dpt->iface_type[7] = ' '; 912 913 if (iface == ATA_IFACE_ISA) { 914 ((uint16_t __far *)dpt->iface_path)[0] = iobase1; 915 ((uint16_t __far *)dpt->iface_path)[1] = 0; 916 ((uint32_t __far *)dpt->iface_path)[1] = 0; 908 917 } 909 918 else { 910 919 // FIXME PCI 911 920 } 912 write_byte(DS, SI+(uint16_t)&Int13DPT->device_path[0], device%2); 913 write_byte(DS, SI+(uint16_t)&Int13DPT->device_path[1], 0); 914 write_word(DS, SI+(uint16_t)&Int13DPT->device_path[2], 0); 915 write_dword(DS, SI+(uint16_t)&Int13DPT->device_path[4], 0L); 921 ((uint16_t __far *)dpt->device_path)[0] = device & 1; 922 ((uint16_t __far *)dpt->device_path)[1] = 0; 923 ((uint32_t __far *)dpt->device_path)[1] = 0; 916 924 917 925 checksum = 0; 918 for (i =30; i<64; i++)919 checksum +=read_byte(DS, SI + i);926 for (i = 30; i < 64; ++i) 927 checksum += ((uint8_t __far *)dpt)[i]; 920 928 checksum = -checksum; 921 write_byte(DS, SI+(uint16_t)&Int13DPT->checksum, checksum);929 dpt->checksum = checksum; 922 930 } 923 931
Note:
See TracChangeset
for help on using the changeset viewer.