Changeset 6870 in vbox for trunk/src/VBox/Devices/PC
- Timestamp:
- Feb 8, 2008 4:22:14 PM (17 years ago)
- Location:
- trunk/src/VBox/Devices/PC/BIOS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/logo.c
r4525 r6870 554 554 #define TMP_SEG 0x1000 555 555 556 void clear_screen() 557 { 558 // Hide cursor, clear screen and move cursor to starting position 559 ASM_START 560 push bx 561 push cx 562 push dx 563 564 mov ax, #0x100 565 mov cx, #0x1000 566 int #0x10 567 568 mov ax, #0x700 569 mov bh, #7 570 xor cx, cx 571 mov dx, #0x184f 572 int #0x10 573 574 mov ax, #0x200 575 xor bx, bx 576 xor dx, dx 577 int #0x10 578 579 pop dx 580 pop cx 581 pop bx 582 ASM_END 583 } 584 585 void print_detected_harddisks() 586 { 587 Bit16u ebda_seg=read_word(0x0040,0x000E); 588 Bit8u actual_device; 589 Bit8u detected_devices = 0; 590 Bit8u first_ctrl_printed = 0; 591 Bit8u second_ctrl_printed = 0; 592 593 for (actual_device = 0; actual_device < BX_MAX_ATA_DEVICES; actual_device++) 594 { 595 Bit8u device_position; 596 Bit8u device = read_byte(ebda_seg, &EbdaData->ata.devices[actual_device].device); 597 598 if (device == 0xff) /* logo.c is included before ATA_DEVICE_HD is defined */ 599 { 600 if ((actual_device < 4) && (first_ctrl_printed == 0)) 601 { 602 printf("IDE controller:\n"); 603 first_ctrl_printed = 1; 604 } 605 else if ((actual_device >= 4) && (second_ctrl_printed == 0)) 606 { 607 printf("AHCI controller:\n"); 608 second_ctrl_printed = 1; 609 } 610 611 detected_devices++; 612 613 printf("\n %d) ", detected_devices); 614 615 /* If actual_device bigger than or equal 4 616 * this is the next controller and 617 * the positions start at the beginning. 618 */ 619 device_position = actual_device; 620 if (actual_device >= 4) 621 device_position -= 4; 622 623 if (device_position / 2) 624 printf("Secondary "); 625 else 626 printf("Primary "); 627 628 if (device_position % 2) 629 printf("Slave"); 630 else 631 printf("Master"); 632 } 633 } 634 635 printf("\n"); 636 } 637 638 Bit8u get_boot_drive(scode) 639 Bit8u scode; 640 { 641 Bit16u ebda_seg=read_word(0x0040,0x000E); 642 Bit8u actual_device; 643 Bit8u detected_devices = 0; 644 645 for (actual_device = 0; actual_device < BX_MAX_ATA_DEVICES; actual_device++) 646 { 647 Bit8u device = read_byte(ebda_seg, &EbdaData->ata.devices[actual_device].device); 648 649 if (device == 0xff) /* logo.c is included before ATA_DEVICE_HD is defined */ 650 detected_devices++; 651 } 652 653 if ((scode-0x01) <= detected_devices) 654 return scode-0x02; 655 656 /* Scancode is higher than number of available devices */ 657 return 0x08; 658 } 659 556 660 void show_logo() 557 661 { … … 974 1078 975 1079 // Clear forced boot drive setting. 976 write_byte(ebda_seg,&EbdaData->uForceBootD rive, 0);1080 write_byte(ebda_seg,&EbdaData->uForceBootDevice, 0); 977 1081 978 1082 // Don't restore previous video mode … … 1004 1108 if (f12_pressed) 1005 1109 { 1006 // Hide cursor, clear screen and move cursor to starting position 1007 ASM_START 1008 push bx 1009 push cx 1010 push dx 1011 1012 mov ax, #0x100 1013 mov cx, #0x1000 1014 int #0x10 1015 1016 mov ax, #0x700 1017 mov bh, #7 1018 xor cx, cx 1019 mov dx, #0x184f 1020 int #0x10 1021 1022 mov ax, #0x200 1023 xor bx, bx 1024 xor dx, dx 1025 int #0x10 1026 1027 pop dx 1028 pop cx 1029 pop bx 1030 ASM_END 1110 Bit8u boot_device = 0; 1111 Bit8u boot_drive = 0; 1112 1113 clear_screen(); 1031 1114 1032 1115 // Show menu … … 1034 1117 "VirtualBox temporary boot device selection\n" 1035 1118 "\n" 1036 " 1) Floppy\n" 1037 " 2) Hard Disk\n" 1038 " 3) CD-ROM\n" 1039 " 4) LAN\n" 1119 "Detected Hard disks:\n" 1120 "\n"); 1121 print_detected_harddisks(); 1122 printf("\n" 1123 "Other boot devices:\n" 1124 " f) Floppy\n" 1125 " c) CD-ROM\n" 1126 " l) LAN\n" 1040 1127 "\n" 1041 " 0) Continue booting\n"); 1128 " b) Continue booting\n"); 1129 1130 1042 1131 1043 1132 // Wait for keystroke … … 1049 1138 } while (scode == 0); 1050 1139 1051 // Change first boot device code to selected one 1052 if (scode >= 0x02 && scode <= 0x05) 1140 if (scode == 0x30) 1053 1141 { 1054 write_byte(ebda_seg,&EbdaData->uForceBootDrive, scode-1);1142 // 'b' ... continue 1055 1143 break; 1056 1144 } 1057 1145 1058 // '0' ... continue 1059 if (scode == 0x0b) 1146 // Check if hard disk was selected 1147 if ((scode >= 0x02) && (scode <= 0x09)) 1148 { 1149 boot_drive = get_boot_drive(scode); 1150 1151 /* 1152 * We support a maximum of 8 boot drives. 1153 * If this value is bigger than 7 not all 1154 * values are used and the user pressed 1155 * and invalid key. 1156 * Wait for the next pressed key. 1157 */ 1158 if (boot_drive > 7) 1159 continue; 1160 1161 write_byte(ebda_seg, &EbdaData->uForceBootDrive, boot_drive); 1162 boot_device = 0x02; 1163 break; 1164 } 1165 1166 switch (scode) 1167 { 1168 case 0x21: 1169 // Floppy 1170 boot_device = 0x01; 1171 break; 1172 case 0x2e: 1173 // CD-ROM 1174 boot_device = 0x03; 1175 break; 1176 case 0x26: 1177 // LAN 1178 boot_device = 0x04; 1179 break; 1180 } 1181 1182 if (boot_device != 0) 1060 1183 break; 1061 1184 } 1185 1186 write_byte(ebda_seg, &EbdaData->uForceBootDevice, boot_device); 1062 1187 1063 1188 // Switch to text mode. Clears screen and enables cursor again. -
trunk/src/VBox/Devices/PC/BIOS/rombios.c
r6294 r6870 762 762 #ifdef VBOX 763 763 unsigned char uForceBootDrive; 764 unsigned char uForceBootDevice; 764 765 #endif /* VBOX */ 765 766 … … 8077 8078 #ifdef VBOX 8078 8079 bootseq|=((inb_cmos(0x3c) & 0x0f) << 12); 8079 if (read_byte(ebda_seg, &EbdaData->uForceBootD rive))8080 bootseq = read_byte(ebda_seg, &EbdaData->uForceBootD rive);8080 if (read_byte(ebda_seg, &EbdaData->uForceBootDevice)) 8081 bootseq = read_byte(ebda_seg, &EbdaData->uForceBootDevice); 8081 8082 /* Boot delay hack. */ 8082 8083 if (bseqnr == 1) … … 8095 8096 #endif /* VBOX */ 8096 8097 switch(bootseq & 0x0f) { 8097 case 0x01: bootdrv=0x00; bootcd=0; break; 8098 case 0x02: bootdrv=0x80; bootcd=0; break; 8099 case 0x03: bootdrv=0x00; bootcd=1; break; 8098 case 0x01: 8099 bootdrv=0x00; 8100 bootcd=0; 8101 break; 8102 case 0x02: 8103 { 8104 // Get the Boot drive. 8105 Bit8u boot_drive = read_byte(ebda_seg, &EbdaData->uForceBootDrive); 8106 8107 bootdrv = boot_drive + 0x80; 8108 bootcd=0; 8109 break; 8110 } 8111 case 0x03: 8112 bootdrv=0x00; 8113 bootcd=1; 8114 break; 8100 8115 #ifdef VBOX 8101 8116 case 0x04: bootlan=1; break; … … 10910 10925 call rom_scan 10911 10926 10912 call _print_bios_banner10913 10914 ;;10915 ;; Floppy setup10916 ;;10917 call floppy_drive_post10918 10919 10927 #if BX_USE_ATADRV 10920 10921 ;;10922 ;; Hard Drive setup10923 ;;10924 call hard_drive_post10925 10926 10928 ;; 10927 10929 ;; ATA/ATAPI driver setup … … 10930 10932 call _ata_detect 10931 10933 ;; 10932 #else // BX_USE_ATADRV 10934 #endif 10935 10936 call _print_bios_banner 10937 10938 ;; 10939 ;; Floppy setup 10940 ;; 10941 call floppy_drive_post 10933 10942 10934 10943 ;; … … 10936 10945 ;; 10937 10946 call hard_drive_post 10938 10939 #endif // BX_USE_ATADRV10940 10947 10941 10948 #if BX_ELTORITO_BOOT
Note:
See TracChangeset
for help on using the changeset viewer.