996{
999#ifndef UNIATA_CORE
1000
1002#endif
1005 ULONG SystemIoBusNumber;
1006
1007
1008
1009
1010
1011
1012
1020
1027
1028
1029
1030
1034#ifndef UNIATA_CORE
1035#ifdef UNIATA_INIT_ON_PROBE
1037#endif
1038#endif
1040
1043
1047
1050
1054
1057 } else {
1059 }
1060
1062
1064
1068 }
1069
1070 if(ConfigInfo->AdapterInterfaceType ==
Isa) {
1072 }
1075 if(
i & 0x80000000) {
1077 }
1080 } else {
1081 channel = 0;
1083 if(
BMList[
i].slotNumber == ConfigInfo->SlotNumber &&
1085 break;
1086 }
1087 }
1092 channel = 1;
1093 }
1097 goto exit_notfound;
1098 }
1099 }
1101 }
1102
1104
1106
1107 if (!deviceExtension) {
1110 }
1112
1113
1114
1115
1118
1119
1123
1124
1126
1128 SystemIoBusNumber,
1129 slotNumber,
1130 &pciData,
1132
1133#ifndef UNIATA_CORE
1136 goto exit_error;
1137 }
1138
1142 goto exit_error;
1143 }
1144#endif
1145
1146 VendorID = pciData.VendorID;
1148 BaseClass = pciData.BaseClass;
1149 SubClass = pciData.SubClass;
1150 RevID = pciData.RevisionID;
1151 dev_id = VendorID | (
DeviceID << 16);
1154
1157 deviceExtension->
DevID = dev_id;
1158 deviceExtension->
RevID = RevID;
1162
1164 "UATA%8.8x/%1.1x@%8.8x", dev_id, channel, slotNumber);
1165
1168 goto exit_notfound;
1169 }
1170
1172
1173
1174 if(VendorID !=
BMList[
i].nVendorId ||
1177 goto exit_notfound;
1178 }
1179
1181 if(!found) {
1183 goto exit_notfound;
1184 }
1185
1186 ConfigInfo->AlignmentMask = 0x00000003;
1187
1189
1190 if(MasterDev) {
1196 goto exit_notfound;
1197 }
1198 }
1199
1204 break;
1207 break;
1208 default:
1210 goto exit_error;
1211 }
1214 switch(dev_id) {
1215
1216 case 0xc6931080:
1220 } else {
1222 }
1223 break;
1224
1225
1226 default:
1227 if (found)
1228 break;
1233 } else
1237 } else {
1240 }
1242 break;
1243 }
1244
1246 if(!found) {
1248 goto exit_notfound;
1249 }
1250
1253
1254
1255
1256
1257
1259#ifndef UNIATA_CORE
1265 }
1266#endif
1269
1272 }
1273
1274 if(MasterDev) {
1276
1278 } else {
1279 if((channel==0) && ConfigInfo->AtdiskPrimaryClaimed) {
1281 goto exit_notfound;
1282 }
1283 if((channel==1) && ConfigInfo->AtdiskSecondaryClaimed) {
1285 goto exit_notfound;
1286 }
1287 }
1288 }
1291 } else
1298 }
1299 }
1300 } else {
1302
1305 }
1306
1307
1308 {
1311 if(pciData.u.type0.BaseAddresses[
j] & ~0x7) {
1312
1313
1315 }
1316 }
1317 }
1318
1320
1323 (
AtapiGetIoRange(HwDeviceExtension, ConfigInfo, &pciData, SystemIoBusNumber,
1324 4, bm_offset, MasterDev ? 0x08 : 0x10));
1325 if(BaseIoAddressBM_0) {
1327 BaseIoAddressBM_0,
1328 (*ConfigInfo->AccessRanges)[4].RangeInMemory ?
TRUE :
FALSE);
1331 if((*ConfigInfo->AccessRanges)[4].RangeInMemory) {
1333 }
1334 }
1336 }
1337
1341 }
1342
1343 if(deviceExtension->
BusMaster && !MasterDev) {
1350
1351
1352
1353
1354
1355
1356
1357 } else
1361 }
1362 }
1363 }
1364
1365
1366
1367
1368
1369
1370
1371
1372 if (dev_id == 0xc6931080 && slotData.
u.
bits.FunctionNumber > 1) {
1374 goto exit_findbm;
1375 }
1376
1377
1380
1383
1385
1386
1387
1388 if(simplexOnly) {
1391 }
1392
1393 if(simplexOnly && MasterDev) {
1397 if(BaseIoAddressBM_0) {
1399 BaseIoAddressBM_0,
1400 (*ConfigInfo->AccessRanges)[4].RangeInMemory ?
TRUE :
FALSE);
1401 }
1402 }
1403 }
1404 if((channel > 0) &&
1407 goto exit_findbm;
1408 }
1409
1410
1412 if(!ConfigInfo->InitiatorBusId[0]) {
1414 KdPrint2((
PRINT_PREFIX "set ConfigInfo->InitiatorBusId[0] = %#x\n", ConfigInfo->InitiatorBusId[0]));
1415 }
1416
1417 ConfigInfo->MaximumNumberOfTargets = (
UCHAR)(deviceExtension->
NumberLuns);
1418
1419 if (MasterDev) {
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437 if(simplexOnly) {
1438
1440
1441 if (ConfigInfo->AdapterInterfaceType ==
MicroChannel) {
1442 ConfigInfo->InterruptMode2 =
1444 } else {
1445 ConfigInfo->InterruptMode2 =
1446 ConfigInfo->InterruptMode =
Latched;
1447 }
1448 ConfigInfo->BusInterruptLevel = 14;
1449 ConfigInfo->BusInterruptLevel2 = 15;
1450 } else {
1452 if (ConfigInfo->AdapterInterfaceType ==
MicroChannel) {
1454 } else {
1455 ConfigInfo->InterruptMode =
Latched;
1456 }
1457 ConfigInfo->BusInterruptLevel = (channel == 0 ? 14 : 15);
1458 }
1459 } else {
1461 ConfigInfo->SlotNumber = slotNumber;
1462 ConfigInfo->SystemIoBusNumber = SystemIoBusNumber;
1464
1465
1466 if(!ConfigInfo->BusInterruptVector ||
1467 (ConfigInfo->BusInterruptVector != pciData.u.type0.InterruptLine)) {
1469 ConfigInfo->BusInterruptVector = pciData.u.type0.InterruptLine;
1470 if(!ConfigInfo->BusInterruptVector) {
1472 ConfigInfo->BusInterruptVector = 10;
1473 }
1474 }
1475 }
1476 ConfigInfo->MultipleRequestPerLu =
TRUE;
1477 ConfigInfo->AutoRequestSense =
TRUE;
1478 ConfigInfo->TaggedQueuing =
TRUE;
1479
1481 (ConfigInfo->Length >=
sizeof(_ConfigInfo->
comm) +
sizeof(_ConfigInfo->
nt4))) {
1485
1487
1488
1489
1491 }
1493 (ConfigInfo->Length >=
sizeof(_ConfigInfo->
comm) +
sizeof(_ConfigInfo->
nt4) +
sizeof(_ConfigInfo->
w2k))) {
1495 deviceExtension->
Host64));
1496#ifdef USE_OWN_DMA
1497
1498#else
1500#endif
1503 }
1504
1505
1509 deviceExtension->
Channel = channel;
1512 = ConfigInfo->AdapterInterfaceType;
1515
1516 KdPrint2((
PRINT_PREFIX "chan[%d] InterruptMode: %d, Level %d, Level2 %d, Vector %d, Vector2 %d\n",
1517 channel,
1518 ConfigInfo->InterruptMode,
1519 ConfigInfo->BusInterruptLevel,
1520 ConfigInfo->BusInterruptLevel2,
1521 ConfigInfo->BusInterruptVector,
1522 ConfigInfo->BusInterruptVector2
1523 ));
1524
1526
1528
1530#ifdef USE_OWN_DMA
1531 ConfigInfo->NeedPhysicalAddresses =
FALSE;
1532#else
1533 ConfigInfo->NeedPhysicalAddresses =
TRUE;
1534#endif
1535 if(!MasterDev) {
1536
1537
1538
1540 ConfigInfo->Dma32BitAddresses =
TRUE;
1541
1542 }
1543
1544
1545
1546
1547 if(AltInit) {
1548
1549
1550
1551 if(ConfigInfo->AdapterInterfaceType ==
Isa
1552) {
1554 ConfigInfo->AdapterInterfaceType =
PCIBus;
1555 }
1556 if(ConfigInfo->AdapterInterfaceType ==
PCIBus
1557) {
1559 ConfigInfo->SlotNumber = slotNumber;
1560 ConfigInfo->SystemIoBusNumber = SystemIoBusNumber;
1561 }
1562 }
1563
1564#ifndef USE_OWN_DMA
1565 ConfigInfo->Master =
TRUE;
1567#endif
1568 ConfigInfo->ScatterGather =
TRUE;
1569 }
1570 ConfigInfo->MapBuffers =
TRUE;
1571 ConfigInfo->CachesData =
TRUE;
1572
1574
1576
1578
1579 chan = &deviceExtension->
chan[
c];
1580
1582
1584
1585
1587
1590 } else
1593 } else {
1594
1595 if(MasterDev) {
1597 (*ConfigInfo->AccessRanges)[channel * 2 + 0].RangeStart =
1599 (*ConfigInfo->AccessRanges)[channel * 2 + 0].RangeLength =
ATA_IOSIZE;
1600
1601 (*ConfigInfo->AccessRanges)[channel * 2 + 1].RangeStart =
1603 (*ConfigInfo->AccessRanges)[channel * 2 + 1].RangeLength =
ATA_ALTIOSIZE;
1604 } else
1605 if(AltInit &&
1606 !(*ConfigInfo->AccessRanges)[channel * 2 + 0].RangeStart.QuadPart &&
1607 !(*ConfigInfo->AccessRanges)[channel * 2 + 1].RangeStart.QuadPart) {
1609 AtapiGetIoRange(HwDeviceExtension, ConfigInfo, &pciData, SystemIoBusNumber,
1611 AtapiGetIoRange(HwDeviceExtension, ConfigInfo, &pciData, SystemIoBusNumber,
1613 }
1614
1615 IoBasePort1 = (*ConfigInfo->AccessRanges)[channel * 2 + 0].RangeStart;
1616 IoBasePort2 = (*ConfigInfo->AccessRanges)[channel * 2 + 1].RangeStart;
1617
1618 if(!MasterDev) {
1621 continue;
1622 }
1623 }
1624
1627 SystemIoBusNumber ,
1628 IoBasePort1,
1632 continue;
1633 }
1634
1637 SystemIoBusNumber ,
1638 IoBasePort2,
1642 continue;
1643 }
1644
1646
1647
1649 if(!(MasterDev )) {
1653 }
1654 } else {
1658 }
1659
1660
1662 MasterDev ? ConfigInfo->AdapterInterfaceType :
PCIBus ,
1663 MasterDev ? ConfigInfo->SystemIoBusNumber : SystemIoBusNumber ,
1664 IoBasePort1,
1668
1669
1670 if (!ioSpace) {
1672 continue;
1673 }
1674
1675
1676
1677
1678
1679
1680
1681
1682
1684
1685
1687 MasterDev ? ConfigInfo->AdapterInterfaceType :
PCIBus ,
1688 MasterDev ? ConfigInfo->SystemIoBusNumber : SystemIoBusNumber ,
1689 IoBasePort2,
1693
1695 if(!ioSpace) {
1696
1698
1699
1701 goto exit_findbm;
1702 }
1704 }
1705
1706
1711
1713#ifdef _DEBUG
1715#endif
1716
1717#ifndef UNIATA_CORE
1718#ifdef UNIATA_INIT_ON_PROBE
1719
1720
1722
1726 skip_find_dev =
FALSE;
1728 if ((statusByte & 0xf8) == 0xf8 ||
1729 (statusByte == 0xa5)) {
1730
1735 if ((statusByte & 0xf8) == 0xf8 ||
1736 (statusByte == 0xa5)) {
1737
1739 skip_find_dev =
TRUE;
1740 }
1741 }
1742 }
1743
1744
1745 if (!skip_find_dev &&
1747 0,
1751 } else {
1753
1754
1755
1756
1757 }
1758
1759
1760#else
1762
1766
1769
1773
1775 }
1776
1780
1784 }
1785
1786#endif
1787 }
1789
1791
1792 if (MasterDev) {
1794 if (channel == 0) {
1797 ConfigInfo->AtdiskPrimaryClaimed =
TRUE;
1799
1801
1802 } else
1803 if (channel == 1) {
1806 ConfigInfo->AtdiskSecondaryClaimed =
TRUE;
1807
1809 }
1810 } else {
1815 ConfigInfo->AtdiskPrimaryClaimed =
TRUE;
1816 }
1821 ConfigInfo->AtdiskSecondaryClaimed =
TRUE;
1822 }
1823 }
1824
1826#else
1827 }
1829#endif
1830 }
1831
1832exit_findbm:
1833
1834#ifndef UNIATA_CORE
1835 if(!found) {
1837 if(BaseIoAddress1[0])
1839 BaseIoAddress1[0]);
1840 if(BaseIoAddress2[0])
1842 BaseIoAddress2[0]);
1843
1844 if(BaseIoAddress1[1])
1846 BaseIoAddress1[1]);
1847 if(BaseIoAddress2[1])
1849 BaseIoAddress2[1]);
1850
1851 if(BaseIoAddressBM_0)
1853 BaseIoAddressBM_0);
1854
1858 }
1859
1861 goto exit_notfound;
1862 } else {
1863
1865
1868
1870
1873
1874
1876
1879
1880 if( MasterDev) {
1882
1883
1884
1885
1887 (*ConfigInfo->AccessRanges)[4].RangeLength = 0;
1889 (*ConfigInfo->AccessRanges)[5].RangeLength = 0;
1890 }
1891
1895 goto exit_findbm;
1896 }
1897
1898 KdPrint2((
PRINT_PREFIX "final chan[%d] InterruptMode: %d, Level %d, Level2 %d, Vector %d, Vector2 %d\n",
1899 channel,
1900 ConfigInfo->InterruptMode,
1901 ConfigInfo->BusInterruptLevel,
1902 ConfigInfo->BusInterruptLevel2,
1903 ConfigInfo->BusInterruptVector,
1904 ConfigInfo->BusInterruptVector2
1905 ));
1906
1907
1908 }
1909#endif
1910
1912
1913
1914 if(MasterDev) {
1917 }
1918
1919 ConfigInfo->NumberOfBuses++;
1921
1922exit_error:
1925
1926exit_notfound:
1929
1930}
struct _HW_LU_EXTENSION HW_LU_EXTENSION
struct _HW_DEVICE_EXTENSION HW_DEVICE_EXTENSION
#define IDE_DEFAULT_MAX_CHAN
BOOLEAN NTAPI ScsiPortValidateRange(IN PVOID HwDeviceExtension, IN INTERFACE_TYPE BusType, IN ULONG SystemIoBusNumber, IN SCSI_PHYSICAL_ADDRESS IoAddress, IN ULONG NumberOfBytes, IN BOOLEAN InIoSpace)
UCHAR NTAPI AtapiDmaDone(IN PVOID HwDeviceExtension, IN ULONG DeviceNumber, IN ULONG lChannel, IN PSCSI_REQUEST_BLOCK Srb)
NTSTATUS NTAPI UniataChipDetect(IN PVOID HwDeviceExtension, IN PPCI_COMMON_CONFIG pciData, IN ULONG DeviceNumber, IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo, IN BOOLEAN *simplexOnly)
#define ATA_PCCARD_ALTOFFSET
struct _IDE_BUSMASTER_REGISTERS * PIDE_BUSMASTER_REGISTERS
#define BM_STATUS_SIMPLEX_ONLY
#define IsBusMaster(pciData)
VOID NTAPI AtapiDmaAlloc(IN PVOID HwDeviceExtension, IN PPORT_CONFIGURATION_INFORMATION ConfigInfo, IN ULONG lChannel)
#define GetDmaStatus(de, c)
struct _PORT_CONFIGURATION_INFORMATION_COMMON * PPORT_CONFIGURATION_INFORMATION_COMMON
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
NTSTATUS NTAPI UniataConnectIntr2(IN PVOID HwDeviceExtension)
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)
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Returns a pointer to the I/O manager's global configuration information structure.
IORES RegTranslation[IDX_MAX_REG]
#define CHAN_NOT_SPECIFIED_CHECK_CABLE
#define PCI_INVALID_VENDORID