Changeset 125 for trunk/src/os2ahci/ata.c
- Timestamp:
- Oct 8, 2011, 10:28:48 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os2ahci/ata.c
r121 r125 234 234 * 22 bits into 2 AHCI_SG elements. 235 235 * 236 * - The S/G element size for AHCI is what the spec calls "'0' based"236 * - The S/G element size for AHCI is what the spec calls '0'-based 237 237 * (i.e. 0 means 1 bytes). On top of that, the spec requires S/G transfer 238 238 * sizes to be even in the context of 16-bit transfers, thus bit '1' … … 248 248 * of this function will indicate how many OS/2 S/G entries were 249 249 * successfully mapped. 250 *251 250 */ 252 251 for (i = n = 0; i < sg_cnt; i++) { … … 891 890 AP_END); 892 891 892 if (rc == 0) { 893 add_workspace(iorb)->ppfunc = ata_execute_ata_pp; 894 } 895 893 896 return(rc); 897 } 898 899 /****************************************************************************** 900 * Post processing function for ata_execute_ata(); the main purpose of this 901 * function is to copy the received D2H FIS (i.e. the device registers after 902 * command completion) back to the ATA command structure. 903 * 904 * See ata_cmd_to_fis() for an explanation of the mapping. 905 */ 906 void ata_execute_ata_pp(IORBH _far *iorb) 907 { 908 AHCI_PORT_DMA _far *dma_base; 909 ATA_CMD _far *cmd; 910 AD_INFO *ai; 911 u8 _far *fis; 912 int p; 913 914 /* get address of D2H FIS */ 915 ai = ad_infos + iorb_unit_adapter(iorb); 916 p = iorb_unit_port(iorb); 917 dma_base = port_dma_base(ai, p); 918 fis = dma_base->rx_fis + 0x40; 919 920 if (fis[0] != 0x34) { 921 /* this is not a D2H FIS - give up silently */ 922 ddprintf("ata_execute_ata_pp(): D2H FIS type incorrect: %d\n", fis[0]); 923 add_workspace(iorb)->complete = 1; 924 return; 925 } 926 927 /* map D2H FIS to the original ATA controller command structure */ 928 cmd = (ATA_CMD _far *) ((IORB_ADAPTER_PASSTHRU _far *) iorb)->pControllerCmd; 929 930 cmd->cmd = fis[2]; 931 cmd->device = fis[7]; 932 cmd->features = ((u16) fis[3]) 933 | ((u16) fis[11]); 934 cmd->lba_l = ((u32) fis[4]) 935 | ((u32) fis[5] << 8) 936 | ((u32) fis[6] << 16) 937 | ((u32) fis[8] << 24); 938 cmd->lba_h = ((u16) fis[9]) 939 | ((u16) fis[10] << 8); 940 cmd->count = ((u16) fis[12]) 941 | ((u16) fis[13] << 8); 942 943 dphex(cmd, sizeof(*cmd), "ahci_execute_ata_pp(): cmd after completion:\n"); 944 945 /* signal completion to interrupt handler */ 946 add_workspace(iorb)->complete = 1; 894 947 } 895 948 … … 1036 1089 AP_SECTOR_48, (u32) sector, (u16) 0, 1037 1090 AP_FEATURES, (u16) count, 1038 AP_COUNT, (u16) (slot << 3), /* tag = slot */ 1091 /* tag = slot */ 1092 AP_COUNT, (u16) (slot << 3), 1039 1093 AP_SGLIST, sg_list, (u16) sg_cnt, 1040 1094 AP_DEVICE, 0x40, 1041 AP_DEVICE, (write_through) ? 0x80 : 0, /* force unit access */ 1095 /* force unit access */ 1096 AP_DEVICE, (write_through && !force_write_cache) ? 0x80 : 0, 1042 1097 AP_WRITE, 1, 1043 1098 AP_END);
Note:
See TracChangeset
for help on using the changeset viewer.