儲存庫 vbox 的更動 48123
- 時間撮記:
- 2013-8-28 上午11:57:34 (11 年 以前)
- 位置:
- trunk/src/VBox/Devices/PC/BIOS
- 檔案:
-
- 修改 15 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/PC/BIOS/ahci.c
r44529 r48123 345 345 /* Lock memory needed for DMA. */ 346 346 ahci->edds.num_avail = NUM_EDDS_SG; 347 DBG_AHCI("AHCI: S/G list for %lu bytes (skip %u)\n", 347 DBG_AHCI("AHCI: S/G list for %lu bytes (skip %u)\n", 348 348 (uint32_t)n_sect * sectsz, bios_dsk->drqp.skip_a); 349 349 vds_build_sg_list(&ahci->edds, bios_dsk->drqp.buffer, (uint32_t)n_sect * sectsz); … … 484 484 * 485 485 * @returns status code. 486 * @param bios_dsk Pointer to disk request packet (in the 486 * @param bios_dsk Pointer to disk request packet (in the 487 487 * EBDA). 488 488 */ … … 515 515 * 516 516 * @returns status code. 517 * @param bios_dsk Pointer to disk request packet (in the 517 * @param bios_dsk Pointer to disk request packet (in the 518 518 * EBDA). 519 519 */ … … 544 544 #define ATA_DATA_OUT 0x02 545 545 546 uint16_t ahci_cmd_packet(uint16_t device_id, uint8_t cmdlen, char __far *cmdbuf, 546 uint16_t ahci_cmd_packet(uint16_t device_id, uint8_t cmdlen, char __far *cmdbuf, 547 547 uint16_t skip_b, uint32_t length, uint8_t inout, char __far *buffer) 548 548 { … … 566 566 567 567 DBG_AHCI("%s: reading %lu bytes, skip %u/%u, device %d, port %d\n", __func__, 568 length, bios_dsk->drqp.skip_b, bios_dsk->drqp.skip_a, 568 length, bios_dsk->drqp.skip_b, bios_dsk->drqp.skip_a, 569 569 device_id, bios_dsk->ahcidev[device_id].port); 570 570 DBG_AHCI("%s: reading %u %u-byte sectors\n", __func__, … … 732 732 hdcount = read_byte(0x40, 0x75); 733 733 hdcount++; 734 write_byte(0x40, 0x75, hdcount); 734 write_byte(0x40, 0x75, hdcount); 735 735 } 736 736 else if (val == 0xeb140101) … … 807 807 bio_dsk_t __far *bios_dsk; 808 808 ahci_t __far *ahci; 809 809 810 810 811 811 ebda_seg = read_word(0x0040, 0x000E); … … 824 824 return 0; 825 825 } 826 DBG_AHCI("AHCI: ahci_seg=%04x, size=%04x, pointer at EBDA:%04x (EBDA size=%04x)\n", 826 DBG_AHCI("AHCI: ahci_seg=%04x, size=%04x, pointer at EBDA:%04x (EBDA size=%04x)\n", 827 827 ahci_seg, sizeof(ahci_t), (uint16_t)&EbdaData->bdisk.ahci_seg, sizeof(ebda_data_t)); 828 828 -
trunk/src/VBox/Devices/PC/BIOS/apm.c
r42935 r48123 219 219 // @todo: error should be different if interface not connected + engaged 220 220 SET_AH(APM_ERR_NO_EVENTS); /* PM events don't happen. */ 221 SET_CF(); 221 SET_CF(); 222 222 break; 223 223 default: -
trunk/src/VBox/Devices/PC/BIOS/ata.c
r44692 r48123 83 83 uint8_t channel, device; 84 84 bio_dsk_t __far *bios_dsk; 85 85 86 86 bios_dsk = read_word(0x0040, 0x000E) :> &EbdaData->bdisk; 87 87 88 88 // Channels info init. 89 89 for (channel=0; channel<BX_MAX_ATA_INTERFACES; channel++) { … … 93 93 bios_dsk->channels[channel].irq = 0; 94 94 } 95 95 96 96 // Devices info init. 97 97 for (device=0; device<BX_MAX_ATA_DEVICES; device++) { … … 111 111 bios_dsk->devices[device].sectors = 0; 112 112 } 113 113 114 114 // hdidmap and cdidmap init. 115 115 for (device=0; device<BX_MAX_STORAGE_DEVICES; device++) { … … 117 117 bios_dsk->cdidmap[device] = BX_MAX_STORAGE_DEVICES; 118 118 } 119 119 120 120 bios_dsk->hdcount = 0; 121 121 bios_dsk->cdcount = 0; … … 135 135 uint16_t pdelay; 136 136 bio_dsk_t __far *bios_dsk; 137 137 138 138 bios_dsk = read_word(0x0040, 0x000E) :> &EbdaData->bdisk; 139 139 channel = device / 2; 140 140 slave = device % 2; 141 141 142 142 iobase1 = bios_dsk->channels[channel].iobase1; 143 143 iobase2 = bios_dsk->channels[channel].iobase2; … … 185 185 while(--max>0) { 186 186 uint8_t status = inb(iobase1+ATA_CB_STAT); 187 if ((status & ATA_CB_STAT_RDY) != 0) 187 if ((status & ATA_CB_STAT_RDY) != 0) 188 188 break; 189 189 } 190 190 191 191 // Enable interrupts 192 192 outb(iobase2+ATA_CB_DC, ATA_CB_DC_HD15); … … 236 236 blksize >>= 1; 237 237 } 238 238 239 239 status = inb(iobase1 + ATA_CB_STAT); 240 240 if (status & ATA_CB_STAT_BSY) … … 272 272 head = ((uint16_t) (lba & 0x0000000fL)) | 0x40; 273 273 } 274 274 275 275 outb(iobase2 + ATA_CB_DC, ATA_CB_DC_HD15 | ATA_CB_DC_NIEN); 276 276 outb(iobase1 + ATA_CB_FR, 0x00); … … 281 281 outb(iobase1 + ATA_CB_DH, (slave ? ATA_CB_DH_DEV1 : ATA_CB_DH_DEV0) | (uint8_t) head ); 282 282 outb(iobase1 + ATA_CB_CMD, command); 283 283 284 284 if (command == ATA_CMD_READ_MULTIPLE || command == ATA_CMD_READ_MULTIPLE_EXT) { 285 285 mult_blk_cnt = count; … … 288 288 mult_blk_cnt = 1; 289 289 } 290 290 291 291 while (1) { 292 292 status = inb(iobase1 + ATA_CB_STAT); … … 294 294 break; 295 295 } 296 296 297 297 if (status & ATA_CB_STAT_ERR) { 298 298 BX_DEBUG_ATA("%s: read error\n", __func__); … … 306 306 return 3; 307 307 } 308 308 309 309 // FIXME : move seg/off translation here 310 310 311 311 int_enable(); // enable higher priority interrupts 312 312 313 313 while (1) { 314 314 315 315 // adjust if there will be an overrun. 2K max sector size 316 316 if (FP_OFF(buffer) >= 0xF800) 317 317 buffer = MK_FP(FP_SEG(buffer) + 0x80, FP_OFF(buffer) - 0x800); 318 318 319 319 if (mode == ATA_MODE_PIO32) { 320 320 buffer = rep_insd(buffer, blksize, iobase1); … … 365 365 uint8_t buffer[0x0200]; 366 366 bio_dsk_t __far *bios_dsk; 367 367 368 368 bios_dsk = ebda_seg :> &EbdaData->bdisk; 369 369 … … 405 405 uint8_t channel, slave; 406 406 uint8_t sc, sn, cl, ch, st; 407 407 408 408 channel = device / 2; 409 409 slave = device % 2; 410 410 411 411 iobase1 = bios_dsk->channels[channel].iobase1; 412 412 iobase2 = bios_dsk->channels[channel].iobase2; 413 413 414 414 // Disable interrupts 415 415 outb(iobase2+ATA_CB_DC, ATA_CB_DC_HD15 | ATA_CB_DC_NIEN); 416 416 417 417 // Look for device 418 418 outb(iobase1+ATA_CB_DH, slave ? ATA_CB_DH_DEV1 : ATA_CB_DH_DEV0); … … 423 423 outb(iobase1+ATA_CB_SC, 0x55); 424 424 outb(iobase1+ATA_CB_SN, 0xaa); 425 425 426 426 // If we found something 427 427 sc = inb(iobase1+ATA_CB_SC); … … 616 616 if (*(model+i) == 0x20) 617 617 *(model+i) = 0x00; 618 else 618 else 619 619 break; 620 620 } … … 692 692 uint8_t channel, slave; 693 693 uint8_t status, mode; 694 694 695 695 device = bios_dsk->drqp.dev_id; 696 696 channel = device / 2; 697 697 slave = device % 2; 698 698 699 699 iobase1 = bios_dsk->channels[channel].iobase1; 700 700 iobase2 = bios_dsk->channels[channel].iobase2; … … 705 705 else 706 706 blksize >>= 1; 707 707 708 708 status = inb(iobase1 + ATA_CB_STAT); 709 709 if (status & ATA_CB_STAT_BSY) … … 740 740 head = ((uint16_t) (lba & 0x0000000fL)) | 0x40; 741 741 } 742 742 743 743 outb(iobase2 + ATA_CB_DC, ATA_CB_DC_HD15 | ATA_CB_DC_NIEN); 744 744 outb(iobase1 + ATA_CB_FR, 0x00); … … 749 749 outb(iobase1 + ATA_CB_DH, (slave ? ATA_CB_DH_DEV1 : ATA_CB_DH_DEV0) | (uint8_t) head ); 750 750 outb(iobase1 + ATA_CB_CMD, command); 751 751 752 752 while (1) { 753 753 status = inb(iobase1 + ATA_CB_STAT); … … 755 755 break; 756 756 } 757 757 758 758 if (status & ATA_CB_STAT_ERR) { 759 759 BX_DEBUG_ATA("%s: write error\n", __func__); … … 767 767 return 3; 768 768 } 769 769 770 770 // FIXME : move seg/off translation here 771 771 772 772 int_enable(); // enable higher priority interrupts 773 773 774 774 while (1) { 775 775 776 776 // adjust if there will be an overrun. 2K max sector size 777 777 if (FP_OFF(buffer) >= 0xF800) 778 778 buffer = MK_FP(FP_SEG(buffer) + 0x80, FP_OFF(buffer) - 0x800); 779 779 780 780 if (mode == ATA_MODE_PIO32) { 781 781 buffer = rep_outsd(buffer, blksize, iobase1); … … 783 783 buffer = rep_outsw(buffer, blksize, iobase1); 784 784 } 785 785 786 786 bios_dsk->drqp.trsfsectors++; 787 787 count--; … … 822 822 * 823 823 * @returns status code. 824 * @param bios_dsk Pointer to disk request packet (in the 824 * @param bios_dsk Pointer to disk request packet (in the 825 825 * EBDA). 826 826 */ … … 856 856 * 857 857 * @returns status code. 858 * @param bios_dsk Pointer to disk request packet (in the 858 * @param bios_dsk Pointer to disk request packet (in the 859 859 * EBDA). 860 860 */ … … 887 887 // 3 : error 888 888 // 4 : not ready 889 uint16_t ata_cmd_packet(uint16_t device, uint8_t cmdlen, char __far *cmdbuf, 889 uint16_t ata_cmd_packet(uint16_t device, uint8_t cmdlen, char __far *cmdbuf, 890 890 uint16_t header, uint32_t length, uint8_t inout, char __far *buffer) 891 891 { … … 907 907 return 1; 908 908 } 909 909 910 910 // The header length must be even 911 911 if (header & 1) { … … 913 913 return 1; 914 914 } 915 915 916 916 iobase1 = bios_dsk->channels[channel].iobase1; 917 917 iobase2 = bios_dsk->channels[channel].iobase2; 918 918 mode = bios_dsk->devices[device].mode; 919 919 transfer = 0L; 920 920 921 921 if (cmdlen < 12) 922 922 cmdlen = 12; … … 924 924 cmdlen = 16; 925 925 cmdlen >>= 1; 926 926 927 927 // Reset count of transferred data 928 928 // @todo: clear in calling code? 929 929 bios_dsk->drqp.trsfsectors = 0; 930 930 bios_dsk->drqp.trsfbytes = 0; 931 931 932 932 status = inb(iobase1 + ATA_CB_STAT); 933 933 if (status & ATA_CB_STAT_BSY) 934 934 return 2; 935 935 936 936 outb(iobase2 + ATA_CB_DC, ATA_CB_DC_HD15 | ATA_CB_DC_NIEN); 937 937 // outb(iobase1 + ATA_CB_FR, 0x00); … … 942 942 outb(iobase1 + ATA_CB_DH, slave ? ATA_CB_DH_DEV1 : ATA_CB_DH_DEV0); 943 943 outb(iobase1 + ATA_CB_CMD, ATA_CMD_PACKET); 944 944 945 945 // Device should ok to receive command 946 946 while (1) { … … 948 948 if ( !(status & ATA_CB_STAT_BSY) ) break; 949 949 } 950 950 951 951 if (status & ATA_CB_STAT_CHK) { 952 952 BX_DEBUG_ATA("%s: error, status is %02x\n", __func__, status); … … 960 960 return 4; 961 961 } 962 962 963 963 int_enable(); // enable higher priority interrupts 964 964 965 965 // Normalize address 966 966 BX_DEBUG_ATA("acp1 buffer ptr: %04x:%04x wlen %04x\n", FP_SEG(cmdbuf), FP_OFF(cmdbuf), cmdlen); … … 968 968 // cmdseg += (cmdoff / 16); 969 969 // cmdoff %= 16; 970 970 971 971 // Send command to device 972 972 rep_outsw(cmdbuf, cmdlen, iobase1); 973 973 974 974 if (inout == ATA_DATA_NO) { 975 975 status = inb(iobase1 + ATA_CB_STAT); … … 977 977 else { 978 978 while (1) { 979 979 980 980 while (1) { 981 981 status = inb(iobase1 + ATA_CB_STAT); 982 if ( !(status & ATA_CB_STAT_BSY) ) 982 if ( !(status & ATA_CB_STAT_BSY) ) 983 983 break; 984 984 } 985 985 986 986 // Check if command completed 987 987 if ( (status & (ATA_CB_STAT_BSY | ATA_CB_STAT_DRQ) ) ==0 ) 988 988 break; 989 989 990 990 if (status & ATA_CB_STAT_CHK) { 991 991 BX_DEBUG_ATA("%s: error (status %02x)\n", __func__, status); … … 994 994 return 3; 995 995 } 996 996 997 997 // Device must be ready to send data 998 998 if ( (status & (ATA_CB_STAT_BSY | ATA_CB_STAT_RDY | ATA_CB_STAT_DRQ | ATA_CB_STAT_CHK) ) … … 1003 1003 return 4; 1004 1004 } 1005 1005 1006 1006 // Normalize address 1007 1007 BX_DEBUG_ATA("acp2 buffer ptr: %04x:%04x\n", FP_SEG(buffer), FP_OFF(buffer)); … … 1009 1009 // bufseg += (bufoff / 16); 1010 1010 // bufoff %= 16; 1011 1011 1012 1012 // Get the byte count 1013 1013 lcount = ((uint16_t)(inb(iobase1 + ATA_CB_CH))<<8)+inb(iobase1 + ATA_CB_CL); 1014 1014 1015 1015 // adjust to read what we want 1016 1016 if (header>lcount) { … … 1024 1024 lcount -= lbefore; 1025 1025 } 1026 1026 1027 1027 if (lcount>length) { 1028 1028 lafter = lcount - length; … … 1034 1034 length -= lcount; 1035 1035 } 1036 1036 1037 1037 // Save byte count 1038 1038 count = lcount; 1039 1039 1040 1040 BX_DEBUG_ATA("Trying to read %04x bytes (%04x %04x %04x) ",lbefore+lcount+lafter,lbefore,lcount,lafter); 1041 1041 BX_DEBUG_ATA("to 0x%04x:0x%04x\n",FP_SEG(buffer),FP_OFF(buffer)); 1042 1042 1043 1043 // If counts not dividable by 4, use 16bits mode 1044 1044 lmode = mode; … … 1049 1049 if (lafter & 0x03) 1050 1050 lmode = ATA_MODE_PIO16; 1051 1051 1052 1052 // adds an extra byte if count are odd. before is always even 1053 1053 if (lcount & 0x01) { … … 1057 1057 } 1058 1058 } 1059 1059 1060 1060 if (lmode == ATA_MODE_PIO32) { 1061 1061 lcount >>= 2; … … 1068 1068 lafter >>= 1; 1069 1069 } 1070 1070 1071 1071 if (lmode == ATA_MODE_PIO32) { 1072 1072 if (lbefore) … … 1082 1082 insw_discard(lafter, iobase1); 1083 1083 } 1084 1085 1084 1085 1086 1086 // Compute new buffer address 1087 1087 buffer += count; 1088 1088 1089 1089 // Save transferred bytes count 1090 1090 transfer += count; … … 1092 1092 } 1093 1093 } 1094 1094 1095 1095 // Final check, device must be ready 1096 1096 if ( (status & (ATA_CB_STAT_BSY | ATA_CB_STAT_RDY | ATA_CB_STAT_DF | ATA_CB_STAT_DRQ | ATA_CB_STAT_CHK) ) … … 1101 1101 return 4; 1102 1102 } 1103 1103 1104 1104 // Enable interrupts 1105 1105 outb(iobase2+ATA_CB_DC, ATA_CB_DC_HD15); … … 1132 1132 outb(iobase1 + ATA_CB_DH, slave ? ATA_CB_DH_DEV1 : ATA_CB_DH_DEV0); 1133 1133 outb(iobase1 + ATA_CB_CMD, ATA_CMD_DEVICE_RESET); 1134 1134 1135 1135 /* Wait for the device to clear BSY. */ 1136 1136 while (1) { … … 1138 1138 if ( !(status & ATA_CB_STAT_BSY) ) break; 1139 1139 } 1140 1140 1141 1141 /* Final check, device must be ready */ 1142 1142 if ( (status & (ATA_CB_STAT_BSY | ATA_CB_STAT_RDY | ATA_CB_STAT_DF | ATA_CB_STAT_DRQ | ATA_CB_STAT_CHK) ) … … 1147 1147 return 1; 1148 1148 } 1149 1149 1150 1150 /* Enable interrupts */ 1151 1151 outb(iobase2+ATA_CB_DC, ATA_CB_DC_HD15); -
trunk/src/VBox/Devices/PC/BIOS/biosint.h
r44528 r48123 238 238 #define BX_PANIC(...) bios_printf(BIOS_PRINTF_DEBHALT, __VA_ARGS__) 239 239 240 /* Because we don't tell the recompiler when guest physical memory 240 /* Because we don't tell the recompiler when guest physical memory 241 241 * is written, it can incorrectly cache guest code overwritten by 242 242 * DMA (bus master or not). We just re-write the memory block to flush -
trunk/src/VBox/Devices/PC/BIOS/boot.c
r44528 r48123 92 92 { 93 93 int i; 94 94 95 95 // cdboot contains 0 if lan/floppy/harddisk, 1 otherwise 96 96 // lanboot contains 0 if floppy/harddisk, 1 otherwise 97 97 // drive contains real/emulated boot drive 98 98 99 99 if(cdboot)i=2; // CD-Rom 100 100 else if(lanboot)i=3; // LAN … … 102 102 else if((drive&0x0080)==0x80)i=1; // Hard drive 103 103 else return; 104 104 105 105 BX_INFO("Booting from %s...\n",drivetypes[i]); 106 106 } … … 111 111 //-------------------------------------------------------------------------- 112 112 //@todo: pass inputs as bit flags rather than bytes? 113 void print_boot_failure(uint8_t cdboot, uint8_t lanboot, uint8_t drive, 113 void print_boot_failure(uint8_t cdboot, uint8_t lanboot, uint8_t drive, 114 114 uint8_t reason, uint8_t lastdrive) 115 115 { 116 116 uint16_t drivenum = drive&0x7f; 117 117 118 118 // cdboot: 1 if boot from cd, 0 otherwise 119 119 // lanboot: 1 if boot from lan, 0 otherwise … … 121 121 // reason: 0 signature check failed, 1 read error 122 122 // lastdrive: 1 boot drive is the last one in boot sequence 123 123 124 124 if (cdboot) 125 125 BX_INFO("Boot from %s failed\n",drivetypes[2]); … … 130 130 else 131 131 BX_INFO("Boot from %s %d failed\n", drivetypes[0],drivenum); 132 132 133 133 if (lastdrive==1) { 134 134 if (reason==0) … … 162 162 uint16_t status; 163 163 uint8_t lastdrive=0; 164 164 165 165 // if BX_ELTORITO_BOOT is not defined, old behavior 166 166 // check bit 5 in CMOS reg 0x2d. load either 0x00 or 0x80 into DL … … 181 181 // 0x04 : local area network 182 182 // else : boot failure 183 183 184 184 // Get the boot sequence 185 185 #if BX_ELTORITO_BOOT … … 192 192 if (bseqnr == 1) 193 193 delay_boot((inb_cmos(0x3c) & 0xf0) >> 4); /* Implemented in logo.c */ 194 194 195 195 if (bseqnr==2) bootseq >>= 4; 196 196 if (bseqnr==3) bootseq >>= 8; … … 199 199 bootdrv=0x00; bootcd=0; 200 200 bootlan=0; 201 BX_INFO("Boot : bseqnr=%d, bootseq=%x\r\n",bseqnr, bootseq); 202 201 BX_INFO("Boot : bseqnr=%d, bootseq=%x\r\n",bseqnr, bootseq); 202 203 203 switch(bootseq & 0x0f) { 204 204 case 0x01: … … 210 210 // Get the Boot drive. 211 211 uint8_t boot_drive = read_byte(ebda_seg, (uint16_t)&EbdaData->uForceBootDrive); 212 212 213 213 bootdrv = boot_drive + 0x80; 214 214 bootcd=0; … … 224 224 #else 225 225 bootseq=inb_cmos(0x2d); 226 226 227 227 if (bseqnr==2) { 228 228 bootseq ^= 0x20; … … 232 232 if((bootseq&0x20)==0) bootdrv=0x80; 233 233 #endif // BX_ELTORITO_BOOT 234 234 235 235 #if BX_ELTORITO_BOOT 236 236 // We have to boot from cd 237 237 if (bootcd != 0) { 238 238 status = cdrom_boot(); 239 239 240 240 // If failure 241 241 if ( (status & 0x00ff) !=0 ) { … … 244 244 return 0x00000000; 245 245 } 246 246 247 247 bootseg = read_word(ebda_seg,(uint16_t)&EbdaData->cdemu.load_segment); 248 248 bootdrv = (uint8_t)(status>>8); 249 249 } 250 250 251 251 #endif // BX_ELTORITO_BOOT 252 252 253 253 // Check for boot from LAN first 254 254 if (bootlan == 1) { … … 271 271 netboot_entry = (void __far *)(fplan + 6); 272 272 netboot_entry(); 273 } 273 } 274 274 else 275 275 { … … 282 282 } 283 283 } 284 284 285 285 // boot from LAN will not return if successful. 286 286 print_boot_failure(bootcd, bootlan, bootdrv, 1, lastdrive); … … 291 291 if (bootcd == 0 && bootlan == 0) { 292 292 bootseg=0x07c0; 293 293 294 294 status = read_boot_sec(bootdrv,bootseg); 295 295 if (status != 0) { … … 298 298 } 299 299 } 300 300 301 301 // There is *no* requirement whatsoever for a valid floppy boot sector 302 302 // to have a 55AAh signature. UNIX boot floppies typically have no such … … 310 310 if (bootdrv != 0) bootchk = 0; 311 311 else bootchk = 1; /* disable 0x55AA signature check on drive A: */ 312 312 313 313 #if BX_ELTORITO_BOOT 314 314 // if boot from cd, no signature check … … 316 316 bootchk = 1; 317 317 #endif // BX_ELTORITO_BOOT 318 318 319 319 if (read_word(bootseg,0) == read_word(bootseg,2) 320 320 || (bootchk == 0 && read_word(bootseg,0x1fe) != 0xaa55)) … … 323 323 return 0x00000000; 324 324 } 325 325 326 326 #if BX_ELTORITO_BOOT 327 327 // Print out the boot string … … 330 330 print_boot_device(0, bootlan, bootdrv); 331 331 #endif // BX_ELTORITO_BOOT 332 332 333 333 // return the boot segment 334 334 return (((uint32_t)bootdrv) << 16) + bootseg; -
trunk/src/VBox/Devices/PC/BIOS/ebda.h
r44692 r48123 217 217 extern uint16_t ahci_cmd_packet(uint16_t device_id, uint8_t cmdlen, char __far *cmdbuf, 218 218 uint16_t header, uint32_t length, uint8_t inout, char __far *buffer); 219 extern uint16_t scsi_cmd_packet(uint16_t device, uint8_t cmdlen, char __far *cmdbuf, 219 extern uint16_t scsi_cmd_packet(uint16_t device, uint8_t cmdlen, char __far *cmdbuf, 220 220 uint16_t header, uint32_t length, uint8_t inout, char __far *buffer); 221 extern uint16_t ata_cmd_packet(uint16_t device, uint8_t cmdlen, char __far *cmdbuf, 221 extern uint16_t ata_cmd_packet(uint16_t device, uint8_t cmdlen, char __far *cmdbuf, 222 222 uint16_t header, uint32_t length, uint8_t inout, char __far *buffer); 223 223 -
trunk/src/VBox/Devices/PC/BIOS/keyboard.c
r44528 r48123 167 167 // If you're getting a 993 keyboard panic here, 168 168 // please see the comment in keyboard_init 169 169 170 170 BX_PANIC("Keyboard error:%u\n",status); 171 171 } … … 313 313 { 314 314 uint16_t buffer_start, buffer_end, buffer_head, buffer_tail, temp_tail; 315 315 316 316 #if BX_CPU < 2 317 317 buffer_start = 0x001E; … … 321 321 buffer_end = read_word(0x0040, 0x0082); 322 322 #endif 323 323 324 324 buffer_head = read_word(0x0040, 0x001A); 325 325 buffer_tail = read_word(0x0040, 0x001C); 326 326 327 327 temp_tail = buffer_tail; 328 328 buffer_tail += 2; 329 329 if (buffer_tail >= buffer_end) 330 330 buffer_tail = buffer_start; 331 331 332 332 if (buffer_tail == buffer_head) 333 333 return(0); 334 334 335 335 write_byte(0x0040, temp_tail, ascii_code); 336 336 write_byte(0x0040, temp_tail+1, scan_code); … … 347 347 uint8_t scancode, asciicode, shift_flags; 348 348 uint8_t mf2_flags, mf2_state, flag; 349 349 350 350 // 351 351 // DS has been set to F000 before call 352 352 // 353 354 353 354 355 355 scancode = GET_AL(); 356 356 357 357 if (scancode == 0) { 358 358 BX_INFO("KBD: int09 handler: AL=0\n"); 359 359 return; 360 360 } 361 362 361 362 363 363 shift_flags = read_byte(0x0040, 0x17); 364 364 mf2_flags = read_byte(0x0040, 0x18); 365 365 mf2_state = read_byte(0x0040, 0x96); 366 366 asciicode = 0; 367 367 368 368 switch (scancode) { 369 369 case 0x3a: /* Caps Lock press */ … … 419 419 } 420 420 break; 421 421 422 422 case 0x38: /* Alt press */ 423 423 shift_flags |= 0x08; … … 442 442 } 443 443 break; 444 444 445 445 case 0x45: /* Num Lock press */ 446 446 if ((mf2_state & 0x03) == 0) { … … 457 457 } 458 458 break; 459 459 460 460 case 0x46: /* Scroll Lock press */ 461 461 mf2_flags |= 0x10; … … 464 464 write_byte(0x0040, 0x17, shift_flags); 465 465 break; 466 466 467 467 case 0xc6: /* Scroll Lock release */ 468 468 mf2_flags &= ~0x10; 469 469 write_byte(0x0040, 0x18, mf2_flags); 470 470 break; 471 471 472 472 case 0x53: /* Del press */ 473 473 if ((shift_flags & 0x0c) == 0x0c) 474 474 jmp_post(); 475 475 /* fall through */ 476 476 477 477 default: 478 478 if (scancode & 0x80) { … … 496 496 /* check if lock state should be ignored 497 497 * because a SHIFT key are pressed */ 498 498 499 499 if (shift_flags & scan_to_scanascii[scancode].lock_flags) { 500 500 asciicode = scan_to_scanascii[scancode].normal; … … 531 531 uint16_t buffer_start, buffer_end, buffer_head, buffer_tail; 532 532 uint8_t acode, scode; 533 533 534 534 #if BX_CPU < 2 535 535 buffer_start = 0x001E; … … 539 539 buffer_end = read_word(0x0040, 0x0082); 540 540 #endif 541 541 542 542 buffer_head = read_word(0x0040, 0x001a); 543 543 buffer_tail = read_word(0x0040, 0x001c); 544 544 545 545 if (buffer_head != buffer_tail) { 546 546 acode = read_byte(0x0040, buffer_head); … … 581 581 uint8_t scan_code, ascii_code, shift_flags, led_flags, count; 582 582 uint16_t kbd_code, max; 583 583 584 584 BX_DEBUG_INT16("int16: AX=%04x BX=%04x CX=%04x DX=%04x \n", AX, BX, CX, DX); 585 585 586 586 shift_flags = read_byte(0x0040, 0x17); 587 587 led_flags = read_byte(0x0040, 0x97); … … 601 601 int_enable(); 602 602 } 603 603 604 604 switch (GET_AH()) { 605 605 case 0x00: /* read keyboard input */ … … 613 613 AX = (scan_code << 8) | ascii_code; 614 614 break; 615 615 616 616 case 0x01: /* check keyboard status */ 617 617 SET_IF(); /* Enable interrupts. Some callers depend on that! */ … … 627 627 CLEAR_ZF(); 628 628 break; 629 629 630 630 case 0x02: /* get shift flag status */ 631 631 shift_flags = read_byte(0x0040, 0x17); 632 632 SET_AL(shift_flags); 633 633 break; 634 634 635 635 case 0x05: /* store key-stroke into buffer */ 636 636 if ( !enqueue_key(GET_CH(), GET_CL()) ) { … … 641 641 } 642 642 break; 643 643 644 644 case 0x09: /* GET KEYBOARD FUNCTIONALITY */ 645 645 // bit Bochs Description … … 655 655 SET_AL(0x30); 656 656 break; 657 657 658 658 case 0x0A: /* GET KEYBOARD ID */ 659 659 count = 2; … … 681 681 BX=kbd_code; 682 682 break; 683 683 684 684 case 0x10: /* read MF-II keyboard input */ 685 685 if ( !dequeue_key(&scan_code, &ascii_code, 1) ) { … … 690 690 AX = (scan_code << 8) | ascii_code; 691 691 break; 692 692 693 693 case 0x11: /* check MF-II keyboard status */ 694 694 SET_IF(); … … 702 702 CLEAR_ZF(); 703 703 break; 704 704 705 705 case 0x12: /* get extended keyboard status */ 706 706 shift_flags = read_byte(0x0040, 0x17); … … 711 711 BX_DEBUG_INT16("int16: func 12 sending %04x\n",AX); 712 712 break; 713 713 714 714 case 0x92: /* keyboard capability check called by DOS 5.0+ keyb */ 715 715 SET_AH(0x80); // function int16 ah=0x10-0x12 supported 716 716 break; 717 717 718 718 case 0xA2: /* 122 keys capability check called by DOS 5.0+ keyb */ 719 719 // don't change AH : function int16 ah=0x20-0x22 NOT supported 720 720 break; 721 721 722 722 //@todo: what's the point of handling this?? 723 723 #if 0 … … 726 726 SET_AH(0x02); // unsupported, aka normal keyboard 727 727 #endif 728 728 729 729 default: 730 730 BX_INFO("KBD: unsupported int 16h function %02x\n", GET_AH()); -
trunk/src/VBox/Devices/PC/BIOS/parallel.c
r44528 r48123 50 50 51 51 int_enable(); 52 52 53 53 addr = read_word(0x0040, (regs.u.r16.dx << 1) + 8); 54 54 if ((regs.u.r8.ah < 3) && (regs.u.r16.dx < 3) && (addr > 0)) { -
trunk/src/VBox/Devices/PC/BIOS/pciutil.c
r39366 r48123 102 102 "xchg cx, dx" \ 103 103 "shl ecx, 16" \ 104 "mov cx, dx" \ 104 "mov cx, dx" \ 105 105 "int 0x1a" \ 106 106 parm [ax] [bx] [di] [dx cx]; -
trunk/src/VBox/Devices/PC/BIOS/print.c
r45401 r48123 153 153 int i; 154 154 uint16_t arg, nibble, hibyte, format_width, hexadd; 155 va_list args; 156 155 va_list args; 156 157 157 va_start( args, s ); 158 158 159 159 in_format = 0; 160 160 format_width = 0; 161 161 162 162 if ((action & BIOS_PRINTF_DEBHALT) == BIOS_PRINTF_DEBHALT) { 163 163 bios_printf (BIOS_PRINTF_SCREEN, "FATAL: "); -
trunk/src/VBox/Devices/PC/BIOS/ps2mouse.c
r38832 r48123 80 80 while ((inb(0x64) & 0x21) != 0x21 && retries) 81 81 --retries; 82 82 83 83 if (!retries) 84 84 return(1); … … 93 93 if (inb(0x64) & 0x02) 94 94 BX_PANIC(panic_msg_keyb_buffer_full,"setkbdcomm"); 95 95 96 96 outb(0x64, 0x60); // write command byte 97 97 outb(0x60, command_byte); … … 105 105 uint8_t in_byte, index, package_count; 106 106 uint8_t mouse_flags_1, mouse_flags_2; 107 107 108 108 BX_DEBUG_INT74("entering int74_function\n"); 109 109 make_farcall = 0; 110 110 111 111 in_byte = inb(0x64); 112 112 if ( (in_byte & 0x21) != 0x21 ) { … … 115 115 in_byte = inb(0x60); 116 116 BX_DEBUG_INT74("int74: read byte %02x\n", in_byte); 117 117 118 118 mouse_flags_1 = read_byte(ebda_seg, 0x0026); 119 119 mouse_flags_2 = read_byte(ebda_seg, 0x0027); 120 120 121 121 if ( (mouse_flags_2 & 0x80) != 0x80 ) { 122 122 return; 123 123 } 124 124 125 125 package_count = mouse_flags_2 & 0x07; 126 126 index = mouse_flags_1 & 0x07; 127 127 write_byte(ebda_seg, 0x28 + index, in_byte); 128 128 129 129 if ( index >= package_count ) { 130 130 BX_DEBUG_INT74("int74_function: make_farcall=1\n"); … … 165 165 // 05: cannot enable mouse, since no far call has been installed 166 166 // 80/86: mouse service not implemented 167 167 168 168 if (regs.u.r8.al > 7) { 169 169 BX_DEBUG_INT15_MS("unsupported subfn\n"); … … 173 173 return; 174 174 } 175 175 176 176 // Valid subfn; disable AUX input and IRQ12, assume no error 177 177 set_kbd_command_byte(0x65); 178 178 CLEAR_CF(); 179 179 regs.u.r8.ah = 0; 180 180 181 181 switch (regs.u.r8.al) { 182 182 case 0: // Disable/Enable Mouse … … 203 203 mouse_cmd = 0xF4; // enable mouse command 204 204 } 205 205 206 206 ret = send_to_mouse_ctrl(mouse_cmd); // disable mouse command 207 207 if (ret == 0) { … … 212 212 } 213 213 } 214 214 215 215 // interface error 216 216 SET_CF(); 217 217 regs.u.r8.ah = 3; 218 218 break; 219 219 220 220 case 5: // Initialize Mouse 221 221 // Valid package sizes are 1 to 8 … … 229 229 write_byte(ebda_seg, 0x0027, mouse_flags_2); 230 230 // fall through! 231 231 232 232 case 1: // Reset Mouse 233 233 BX_DEBUG_INT15_MS("case 1 or 5:\n"); … … 260 260 } 261 261 } 262 262 263 263 // interface error 264 264 SET_CF(); 265 265 regs.u.r8.ah = 3; 266 266 break; 267 267 268 268 case 2: // Set Sample Rate 269 269 BX_DEBUG_INT15_MS("case 2:\n"); … … 296 296 } 297 297 break; 298 298 299 299 case 3: // Set Resolution 300 300 BX_DEBUG_INT15_MS("case 3:\n"); … … 326 326 } 327 327 break; 328 328 329 329 case 4: // Get Device ID 330 330 BX_DEBUG_INT15_MS("case 4:\n"); … … 341 341 } 342 342 break; 343 343 344 344 case 6: // Return Status & Set Scaling Factor... 345 345 BX_DEBUG_INT15_MS("case 6:\n"); … … 368 368 } 369 369 } 370 370 371 371 // interface error 372 372 SET_CF(); 373 373 regs.u.r8.ah = 3; 374 374 break; 375 375 376 376 case 1: // Set Scaling Factor to 1:1 377 377 case 2: // Set Scaling Factor to 2:1 … … 391 391 } 392 392 break; 393 393 394 394 default: 395 395 BX_PANIC("INT 15h C2 AL=6, BH=%02x\n", (unsigned) regs.u.r8.bh); … … 399 399 } 400 400 break; 401 401 402 402 case 7: // Set Mouse Handler Address 403 403 BX_DEBUG_INT15_MS("case 7:\n"); … … 419 419 write_byte(ebda_seg, 0x0027, mouse_flags_2); 420 420 break; 421 421 422 422 default: 423 423 BX_PANIC("INT 15h C2 default case entered\n"); -
trunk/src/VBox/Devices/PC/BIOS/scsi.c
r46241 r48123 94 94 while (status & VBSCSI_BUSY); 95 95 96 96 97 97 sizes = ((length >> 12) & 0xF0) | cbCDB; 98 98 outb(io_base + VBSCSI_REGISTER_COMMAND, target_id); /* Write the target ID. */ … … 100 100 outb(io_base + VBSCSI_REGISTER_COMMAND, sizes); /* Write CDB size and top bufsize bits. */ 101 101 outb(io_base + VBSCSI_REGISTER_COMMAND, length); /* Write the buffer size. */ 102 outb(io_base + VBSCSI_REGISTER_COMMAND, (length >> 8)); 102 outb(io_base + VBSCSI_REGISTER_COMMAND, (length >> 8)); 103 103 for (i = 0; i < cbCDB; i++) /* Write the CDB. */ 104 104 outb(io_base + VBSCSI_REGISTER_COMMAND, aCDB[i]); … … 136 136 while (status & VBSCSI_BUSY); 137 137 138 138 139 139 sizes = ((length >> 12) & 0xF0) | cbCDB; 140 140 outb(io_base + VBSCSI_REGISTER_COMMAND, target_id); /* Write the target ID. */ … … 171 171 * 172 172 * @returns status code. 173 * @param bios_dsk Pointer to disk request packet (in the 173 * @param bios_dsk Pointer to disk request packet (in the 174 174 * EBDA). 175 175 */ … … 203 203 count, device_id, bios_dsk->scsidev[device_id].target_id); 204 204 205 rc = scsi_cmd_data_in(io_base, target_id, (void __far *)&cdb, 10, 205 rc = scsi_cmd_data_in(io_base, target_id, (void __far *)&cdb, 10, 206 206 bios_dsk->drqp.buffer, (count * 512L)); 207 207 … … 220 220 * 221 221 * @returns status code. 222 * @param bios_dsk Pointer to disk request packet (in the 222 * @param bios_dsk Pointer to disk request packet (in the 223 223 * EBDA). 224 224 */ … … 274 274 * 275 275 * @returns status code. 276 * @param bios_dsk Pointer to disk request packet (in the 276 * @param bios_dsk Pointer to disk request packet (in the 277 277 * EBDA). 278 278 */ 279 uint16_t scsi_cmd_packet(uint16_t device_id, uint8_t cmdlen, char __far *cmdbuf, 279 uint16_t scsi_cmd_packet(uint16_t device_id, uint8_t cmdlen, char __far *cmdbuf, 280 280 uint16_t before, uint32_t length, uint8_t inout, char __far *buffer) 281 281 { … … 440 440 } 441 441 442 /* We need to calculate the geometry for the disk. From 443 * the BusLogic driver in the Linux kernel. 442 /* We need to calculate the geometry for the disk. From 443 * the BusLogic driver in the Linux kernel. 444 444 */ 445 445 if (sectors >= (uint32_t)4 * 1024 * 1024) -
trunk/src/VBox/Devices/PC/BIOS/serial.c
r44528 r48123 50 50 51 51 int_enable(); 52 52 53 53 addr = read_word(0x0040, (regs.u.r16.dx << 1)); 54 54 timeout = read_byte(0x0040, 0x007C + regs.u.r16.dx); -
trunk/src/VBox/Devices/PC/BIOS/timepci.c
r44528 r48123 81 81 // The count I use below guarantees coverage or more than 82 82 // this time, with any reasonable IPS setting. 83 83 84 84 uint16_t iter; 85 85 86 86 iter = 25000; 87 87 while (--iter != 0) { … … 103 103 // INT 70h: IRQ 8 - CMOS RTC interrupt from periodic or alarm modes 104 104 uint8_t registerB = 0, registerC = 0; 105 105 106 106 // Check which modes are enabled and have occurred. 107 107 registerB = inb_cmos( 0xB ); 108 108 registerC = inb_cmos( 0xC ); 109 109 110 110 if( ( registerB & 0x60 ) != 0 ) { 111 111 if( ( registerC & 0x20 ) != 0 ) { … … 117 117 if( ( registerC & 0x40 ) != 0 ) { 118 118 // Handle Periodic Interrupt. 119 119 120 120 if( read_byte( 0x40, 0xA0 ) != 0 ) { 121 121 // Wait Interval (Int 15, AH=83) active. 122 122 uint32_t time; 123 123 124 124 time = read_dword( 0x40, 0x9C ); // Time left in microseconds. 125 125 if( time < 0x3D1 ) { 126 126 // Done waiting. 127 127 uint16_t segment, offset; 128 128 129 129 segment = read_word( 0x40, 0x98 ); 130 130 offset = read_word( 0x40, 0x9A ); … … 150 150 uint8_t val8; 151 151 152 BX_DEBUG_INT1A("int1a: AX=%04x BX=%04x CX=%04x DX=%04x DS=%04x\n", 152 BX_DEBUG_INT1A("int1a: AX=%04x BX=%04x CX=%04x DX=%04x DS=%04x\n", 153 153 regs.u.r16.ax, regs.u.r16.bx, regs.u.r16.cx, regs.u.r16.dx, ds); 154 int_enable(); 155 154 int_enable(); 155 156 156 switch (regs.u.r8.ah) { 157 157 case 0: // get current clock count … … 165 165 ClearCF(iret_addr.flags); // OK 166 166 break; 167 167 168 168 case 1: // Set Current Clock Count 169 169 int_disable(); … … 175 175 ClearCF(iret_addr.flags); // OK 176 176 break; 177 177 178 178 case 2: // Read CMOS Time 179 179 if (rtc_updating()) { … … 181 181 break; 182 182 } 183 183 184 184 regs.u.r8.dh = inb_cmos(0x00); // Seconds 185 185 regs.u.r8.cl = inb_cmos(0x02); // Minutes … … 190 190 ClearCF(iret_addr.flags); // OK 191 191 break; 192 192 193 193 case 3: // Set CMOS Time 194 194 // Using a debugger, I notice the following masking/setting … … 217 217 ClearCF(iret_addr.flags); // OK 218 218 break; 219 219 220 220 case 4: // Read CMOS Date 221 221 regs.u.r8.ah = 0; … … 231 231 ClearCF(iret_addr.flags); // OK 232 232 break; 233 233 234 234 case 5: // Set CMOS Date 235 235 // Using a debugger, I notice the following masking/setting … … 258 258 ClearCF(iret_addr.flags); // OK 259 259 break; 260 260 261 261 case 6: // Set Alarm Time in CMOS 262 262 // Using a debugger, I notice the following masking/setting … … 289 289 ClearCF(iret_addr.flags); // OK 290 290 break; 291 291 292 292 case 7: // Turn off Alarm 293 293 // Using a debugger, I notice the following masking/setting … … 308 308 ClearCF(iret_addr.flags); // OK 309 309 break; 310 310 311 311 default: 312 312 BX_DEBUG_INT1A("int1a: AX=%04x unsupported\n", regs.u.r16.ax); -
trunk/src/VBox/Devices/PC/BIOS/vds.c
r39559 r48123 61 61 62 62 /* 63 * Convert a real mode 16:16 segmented address to a simple 32-bit 64 * linear address. 63 * Convert a real mode 16:16 segmented address to a simple 32-bit 64 * linear address. 65 65 */ 66 66 uint32_t vds_real_to_lin( void __far *ptr )
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器