346{
350 ULONG VendorID = deviceExtension->
DevID & 0xffff;
366
369
371
375 }
376
377
378 BaseIoAddressBM = pciData->u.type0.BaseAddresses[4] & ~0x07;
380 ConfigInfo->MaximumTransferLength =
DEV_BSIZE*256;
382
385
389 } else {
390unknown_dev:
393
398 }
400 }
404
407 }
410 }
412 }
413
425
430
432
433
439
443
444
445
446
453 };
454
472
482 };
483
490 };
491
493
494 switch(VendorID) {
495
497
498
499
500
506 }
507 goto for_ugly_chips;
508
511
518 break;
519 }
521
522
526
527
528
532 }
538 }
539 goto for_ugly_chips;
540
541 default:
542
543
544 break;
545
546#if 0
548
550
551 switch(deviceExtension->
DevID) {
552
553
554 case 0xc6931080:
556 break;
557
558 case 0x000116ca:
560 break;
561
562
563
564
565 case 0x01021078:
567 break;
568
569 case 0x06401039:
570 case 0x06011039:
572
573
574
575 case 0x10001042:
576 case 0x10011042:
577
581
585 break;
586
587 case 0x81721283:
590 break;
591
592 default:
594 }
596#endif
597 }
598
600for_ugly_chips:
603 goto unknown_dev;
604
605 }
608
610
613 deviceExtension->
HwFlags = tmp32;
614
617 deviceExtension->
HwFlags |= tmp32;
618
623 }
624
627 if(tmp32 != 0xffffffff) {
630 }
631
635 }
636
637
638
639
640
643
644
646
647
648
649
650 switch(VendorID) {
656 ChipFlags &= ~UNIATA_AHCI;
657 deviceExtension->
HwFlags &= ~UNIATA_AHCI;
658 }
659 break;
660 default:
663 ChipFlags &= ~UNIATA_AHCI;
664 deviceExtension->
HwFlags &= ~UNIATA_AHCI;
665 }
666 break;
667 }
668 }
669
671
676 }
677
678 } else
681 }
682
685 }
686
687 switch(VendorID) {
691 BaseIoAddress1 =
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
692 0, 0, 0x10);
693 BaseIoAddress2 =
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
694 1, 0, 0x10);
695 BaseIoAddressBM =
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
698
700 chan = &deviceExtension->
chan[
c];
701
704 }
707
710 }
711
712
713
714
715
716
717
719 }
720 }
721 break;
725 BaseMemAddress =
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
726 5, 0, ((ChipFlags &
NV4OFF) ? 0x400 : 0) + 0x40*2);
728 if(!BaseMemAddress) {
730 }
731 if((*ConfigInfo->AccessRanges)[5].RangeInMemory) {
734 }
737 chan = &deviceExtension->
chan[
c];
738
742
744 }
745 }
746 break;
748
749 if(ChipType !=
PRMIO) {
750 break;
751 }
752 if(!pciData) {
753 break;
754 }
756
757
758 BaseMemAddress =
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
759 4, 0, 0x4000);
761 if(!BaseMemAddress) {
763 }
764 if((*ConfigInfo->AccessRanges)[4].RangeInMemory) {
767 }
769
770
771 BaseMemAddress =
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
772 3, 0, 0xd0000);
774 if(!BaseMemAddress) {
776 }
777 if((*ConfigInfo->AccessRanges)[3].RangeInMemory) {
780 }
782
785
788 ((reg48 & 0x02) ? 1 : 0) +
789 2;
791 }
792
794
795
797
798 chan = &deviceExtension->
chan[
c];
799
802
805 }
807
809
813
814 if((ChipFlags &
PRSATA) ||
815 ((ChipFlags &
PRCMBO) &&
c<2)) {
817
821
823 } else {
826 }
827 }
828 break;
829
836 chan = &deviceExtension->
chan[0];
838 }
839 break;
840 }
841
843
845 }
847 break;
848 }
849 if(!pciData) {
850 break;
851 }
852
855 } else {
857 }
858
860
861 BaseMemAddress =
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
862 5, 0, 0x800);
864 if(!BaseMemAddress) {
866 }
867 if((*ConfigInfo->AccessRanges)[5].RangeInMemory) {
870 }
872
876
877 chan = &deviceExtension->
chan[
c];
878
882 }
885
891 }
892
894
896 } else
901
903 }
904 }
905 break; }
906
908
910 break;
911 }
912 if(!pciData) {
913 break;
914 }
915
917
919 BaseMemAddress =
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
920 5, 0, 0x400);
922 if(!BaseMemAddress) {
924 }
925 if((*ConfigInfo->AccessRanges)[5].RangeInMemory) {
928 }
930
933
934 chan = &deviceExtension->
chan[
c];
937 }
940
944
948
950 }
951 break; }
952
954
956
959
960 break;
961 }
962
971
972
974 } else {
977
979 };
980
991
995 if(SiSSouthAdapters[
i].nDeviceId == 0x1182 ||
996 SiSSouthAdapters[
i].nDeviceId == 0x1183) {
999 }
1000 }
1001 } else {
1002
1006 } else {
1007
1009 }
1010 }
1011 }
1012
1015
1018
1019 BaseMemAddress =
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
1020 5, 0, 0x400);
1022 if(BaseMemAddress) {
1023 if((*ConfigInfo->AccessRanges)[5].RangeInMemory) {
1026 }
1028
1030 ULONG offs =
c << (SIS_182 ? 5 : 6);
1031
1032 chan = &deviceExtension->
chan[
c];
1036
1038 }
1039 }
1040 }
1041 }
1042
1043 break; }
1044
1046
1048
1049
1051 break;
1052 }
1054
1056 BaseMemAddress = 0;
1057
1059 case 0x3149:
1061 IoSize = 0x80;
1062 break;
1063 case 0x3249:
1065 IoSize = 0x40;
1066 break;
1067 }
1068 if(IoSize) {
1070 BaseMemAddress =
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
1072 if(BaseMemAddress && (*ConfigInfo->AccessRanges)[5].RangeInMemory) {
1075 }
1077 }
1078 if(BaseMemAddress) {
1081
1082 ULONG BaseIoAddressBM_0;
1084
1086 BaseIoAddressBM_0 =
1087 AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber, 4, 0,
1091
1092 chan = &deviceExtension->
chan[
c];
1093
1095
1098 }
1101
1104 }
1105
1106 }
1107 }
1109 chan = &deviceExtension->
chan[
c];
1110 if((ChipFlags &
VIABAR) && (
c==2)) {
1111
1114 }
1115 break;
1116 }
1120
1122 }
1123
1124 }
1125 }
1126 break; }
1128
1130 break;
1131 }
1132
1133
1136
1138 BaseMemAddress =
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
1139 0, 0, 0x0c00);
1140 if(!BaseMemAddress) {
1142 }
1143 if((*ConfigInfo->AccessRanges)[0].RangeInMemory) {
1146 }
1149
1151 ULONG offs = 0x200 +
c*0x200;
1152
1153 chan = &deviceExtension->
chan[
c];
1156 }
1157
1159
1163
1165
1169
1173
1175 }
1176
1177 break;
1178 }
1180
1182
1185
1189 if(tmp8 & 0xc0) {
1190
1191
1194 break;
1195 }
1197 deviceExtension->
HwFlags &= ~UNIATA_AHCI;
1198 }
1199 BaseIoAddressBM =
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
1201 if(BaseIoAddressBM) {
1203
1204 if((*ConfigInfo->AccessRanges)[4].RangeInMemory) {
1207 }
1209
1212
1215
1216 if(tmp8 == 0xff) {
1218 break;
1219 }
1220 }
1226 }
1227 }
1228 deviceExtension->
HwFlags &= ~UNIATA_AHCI;
1229
1231
1232 if(OrigAHCI) {
1233
1235 BaseMemAddress = 0;
1236 } else
1237 if(deviceExtension->
DevID == 0x28288086 &&
1238 pciData->u.type0.SubVendorID == 0x106b) {
1239
1241 BaseMemAddress = 0;
1242 } else {
1243 BaseMemAddress =
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, pciData, SystemIoBusNumber,
1244 5, 0, 0x10);
1245 if(BaseMemAddress && (*ConfigInfo->AccessRanges)[5].RangeInMemory) {
1248 }
1249 }
1251
1253 chan = &deviceExtension->
chan[
c];
1256 if(ChipFlags &
ICH5) {
1258 if ((tmp8 & 0x04) == 0) {
1260 } else if ((tmp8 & 0x02) == 0) {
1263
1264 }
1265 } else if ((tmp8 & 0x02) != 0) {
1268
1269 }
1270 }
1271 } else
1272 if(ChipFlags &
I6CH2) {
1275 } else {
1277 switch(tmp8 & 0x03) {
1278 case 2:
1280
1282 }
1283 break;
1284 case 1:
1286
1288 }
1289 break;
1290 }
1291 }
1292
1293 if(IsPata) {
1296 } else {
1297
1298 if(!(ChipFlags &
ICH7) && BaseMemAddress) {
1302 }
1303 if((ChipFlags &
ICH5) || BaseMemAddress) {
1304
1306
1308 deviceExtension->
HwFlags &= ~CHIPTYPE_MASK;
1309 deviceExtension->
HwFlags |= ChipType;
1310
1311 if(ChipFlags &
ICH7) {
1313 }
1317 }
1318 }
1319
1320 }
1321
1322
1323
1324 }
1325 break; }
1327
1328 if(deviceExtension->
DevID == 0x01021078) {
1329 ConfigInfo->AlignmentMask = 0x0f;
1331 }
1332 break;
1334
1336 if(tmp8 & 0x40) {
1337 KdPrint((
" Check JMicron AHCI\n"));
1341 } else {
1342 KdPrint((
" JMicron PATA/SATA\n"));
1343 }
1344 } else {
1345#if 0
1346
1349#endif
1350
1351 KdPrint((
" JMicron Combined\n"));
1352
1353 }
1354 break;
1355 }
1356
1358
1359}
BUSMASTER_CONTROLLER_INFORMATION_BASE const BusMasterAdapters[]
#define UNIATA_SIMPLEX_ONLY
#define NUM_BUSMASTER_ADAPTERS
struct _BUSMASTER_CONTROLLER_INFORMATION_BASE * PBUSMASTER_CONTROLLER_INFORMATION_BASE
__inline ULONG Ata_is_dev_listed(IN PBUSMASTER_CONTROLLER_INFORMATION_BASE BusMasterAdapters, ULONG VendorId, ULONG DeviceId, ULONG RevId, ULONG lim)
#define PCI_DEV_HW_SPEC_BM(idhi, idlo, rev, mode, name, flags)
#define Ata_is_ahci_dev(pciData)
#define BMLIST_TERMINATOR
VOID NTAPI ScsiPortFreeDeviceBase(IN PVOID HwDeviceExtension, IN PVOID MappedAddress)
#define SetPciConfig4(offs, op)
ULONG NTAPI AtapiFindListedDev(PBUSMASTER_CONTROLLER_INFORMATION_BASE BusMasterAdapters, ULONG lim, IN PVOID HwDeviceExtension, IN ULONG BusNumber, IN ULONG SlotNumber, OUT PCI_SLOT_NUMBER *_slotData)
#define IDX_SATA_SControl
ULONGIO_PTR NTAPI AtapiGetIoRange(IN PVOID HwDeviceExtension, IN PPORT_CONFIGURATION_INFORMATION ConfigInfo, IN PPCI_COMMON_CONFIG pciData, IN ULONG SystemIoBusNumber, IN ULONG rid, IN ULONG offset, IN ULONG length)
#define PCI_DEV_SUBCLASS_IDE
#define PCISLOTNUM_NOT_SPECIFIED
#define ScsiPortConvertPhysicalAddressToUlong(Address)
#define IDX_IO1_o_Feature
#define IDX_IO1_o_Command
#define IDX_IO2_o_Control
BOOLEAN NTAPI UniataAllocateLunExt(PHW_DEVICE_EXTENSION deviceExtension, ULONG NewNumberChannels)
VOID UniataInitIoRes(IN PHW_CHANNEL chan, IN ULONG idx, IN ULONG addr, IN BOOLEAN MemIo, IN BOOLEAN Proc)
VOID NTAPI AtapiSetupLunPtrs(IN PHW_CHANNEL chan, IN PHW_DEVICE_EXTENSION deviceExtension, IN ULONG c)
BOOLEAN NTAPI UniataChipDetectChannels(IN PVOID HwDeviceExtension, IN PPCI_COMMON_CONFIG pciData, IN ULONG DeviceNumber, IN PPORT_CONFIGURATION_INFORMATION ConfigInfo)
VOID UniataInitIoResEx(IN PIORES IoRes, IN ULONG addr, IN BOOLEAN MemIo, IN BOOLEAN Proc)
VOID NTAPI UniataInitSyncBaseIO(IN PHW_CHANNEL chan)
BOOLEAN NTAPI UniataAhciDetect(IN PVOID HwDeviceExtension, IN PPCI_COMMON_CONFIG pciData, IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo)
ULONG MaximumDmaTransferLength
ULONG DmaSegmentAlignmentMask
#define STATUS_UNSUCCESSFUL
#define ATA_MODE_NOT_SPEC
#define IDX_IO2_AltStatus