- Timestamp:
- Nov 26, 2018, 3:15:43 PM (7 years ago)
- Location:
- trunk/src/os2ahci
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os2ahci/Makefile
r196 r198 12 12 # Define default build version if not specified in environment 13 13 BLD_MAJOR=2 14 BLD_MINOR=0 5# must be 2 digits14 BLD_MINOR=06 # must be 2 digits 15 15 BLD_REV=0 # not used at this time 16 16 -
trunk/src/os2ahci/ReadMe.txt
r196 r198 1 AHCI Driver for OS/2 v2.0 51 AHCI Driver for OS/2 v2.06 2 2 3 3 Introduction … … 123 123 Otherwise, ignore the current port on the current adapter. 124 124 125 /U Check for usable disks and ignore disks that are not 126 usable. To be usable a disk must be an MBR disk or wiped. 127 (default = on) Can be turned off with /!U. 128 125 129 Port-specific Options 126 130 … … 164 168 - Disable NCQ for hard disk on adapter #0, port #5 165 169 - Disable NCQ for all hard disks on adapter #1 170 171 Another example: 172 173 BASEDEV=OS2AHCI.ADD /A:0 /P:0 /I 174 175 Means to ingore the disk plugged into port 0 on adapeter 0. 166 176 167 177 … … 379 389 ========== 380 390 391 v.2.06 19-Sep-2018 - David Azarewicz 392 Added Usable Disk check to ignore non-usable (e.g. non-MBR) disks. 393 Added /U switch to enable/disable Usable Disk check. 394 381 395 v.2.05 05-Apr-2018 - David Azarewicz 382 396 Changes to debug output for debug versions. -
trunk/src/os2ahci/ahci.c
r196 r198 38 38 ? atapi_##func : ata_##func 39 39 40 41 /* ------------------------ typedefs and structures ------------------------ */42 43 /* -------------------------- function prototypes -------------------------- */44 45 static void ahci_setup_device(AD_INFO *ai, int p, int d, u16 *id_buf);46 40 47 41 /* ------------------------ global/static variables ------------------------ */ … … 531 525 532 526 /****************************************************************************** 527 * Complete initialization of adapter. This includes restarting all active 528 * ports and initializing interrupt processing. This is called when receiving 529 * the IOCM_COMPLETE_INIT request. 530 */ 531 int ahci_complete_init(AD_INFO *ai) 532 { 533 int rc; 534 u32 p; 535 int i; 536 537 DPRINTF(1,"ahci_complete_init: completing initialization of adapter #%d\n", ad_no(ai)); 538 539 if (!ai->int_set) 540 { 541 /* register IRQ handler; each IRQ level is registered only once */ 542 p = 1; /* int count */ 543 if (!(ai->flags & AHCI_HFLAG_NO_MSI)) 544 { 545 if (PsdMsiAlloc(ai->bus_dev_func, &p, &ai->irq)) p = 1; /* shared flag */ 546 else 547 { 548 /* we have an msi interrupt */ 549 ai->irq_pin = 0; 550 p = 0; /* exclusive flag */ 551 } 552 } 553 for (i = 0; i < irq_used_cnt; i++) 554 { 555 if (irq_used[i] == ai->irq) break; /* we already have this IRQ registered */ 556 } 557 if (i >= irq_used_cnt) 558 { 559 if (i >= MAX_IRQ_HANDLERS) return -1; /* no more handlers available */ 560 DPRINTF(2,"registering interrupt #%d\n", ai->irq); 561 562 rc = Dev32Help_SetIRQ(ahci_intr, ai->irq, p, ai->irq); 563 if (rc && p) /* if failed and was shared */ 564 { 565 p = 0; /* try exclusive */ 566 rc = Dev32Help_SetIRQ(ahci_intr, ai->irq, p, ai->irq); 567 } 568 if (rc) 569 { 570 dprintf(0,"failed to register interrupt %d\n", ai->irq); 571 return(-1); 572 } 573 irq_used[irq_used_cnt++] = ai->irq; 574 ai->int_set = 1; 575 RmUpdateAddIrq(rm_drvh, ai->rm_adh, ai->irq, ai->irq_pin, p?RS_IRQ_SHARED:RS_IRQ_EXCLUSIVE); 576 } 577 } 578 579 /* enable AHCI mode */ 580 if ((rc = ahci_enable_ahci(ai)) != 0) return(rc); 581 582 /* Start all ports. The main purpose is to set the command list and FIS 583 * receive area addresses properly and to enable port-level interrupts; we 584 * don't really care about the return status because we'll find out soon 585 * enough if a previously detected device has problems. 586 */ 587 for (p = 0; p <= ai->port_max; p++) 588 { 589 if (ai->port_map & (1UL << p)) 590 { 591 if (init_reset) 592 { 593 DPRINTF(3,"ahci_complete_init: resetting port %d\n", p); 594 ahci_reset_port(ai, p, 1); 595 } 596 else 597 { 598 DPRINTF(3,"ahci_complete_init: restarting port #%d\n", p); 599 ahci_stop_port(ai, p); 600 ahci_start_port(ai, p, 1); 601 } 602 } 603 } 604 605 /* clear pending interrupt status */ 606 writel(ai->mmio + HOST_IRQ_STAT, readl(ai->mmio + HOST_IRQ_STAT)); 607 readl(ai->mmio + HOST_IRQ_STAT); /* flush */ 608 609 /* enable adapter-level interrupts */ 610 writel(ai->mmio + HOST_CTL, readl(ai->mmio + HOST_CTL) | HOST_IRQ_EN); 611 readl(ai->mmio + HOST_CTL); /* flush */ 612 613 /* enable interrupts on PCI-level (PCI 2.3 added a feature to disable INTs) */ 614 /* pci_enable_int(ai->bus, ai->dev_func); */ 615 616 DPRINTF(1,"ahci_complete_init: done\n"); 617 return(0); 618 } 619 620 static int IsUsableDisk(AD_INFO *ai, int p, int d) 621 { 622 union { 623 u8 b[512]; 624 u16 w[256]; 625 u32 l[128]; 626 } *pSector0; 627 int iRetVal; 628 629 if (!use_mbr_test) return 1; 630 if (ai->ports[p].devs[d].removable) return 1; 631 632 do 633 { 634 iRetVal = 0; 635 pSector0 = MemAlloc(512); 636 if (!pSector0) break; 637 638 if (ahci_exec_polled_cmd(ai, p, 0, 500, ATA_CMD_READ, 639 AP_SECTOR_28, 0, 640 AP_COUNT, 1, 641 AP_VADDR, (void *)pSector0, 512, 642 AP_DEVICE, 0x40, 643 AP_END)) break; 644 645 DHEXDUMP(5, pSector0, 512, "Sector0:\n"); 646 647 /* check for wiped disk */ 648 if ((pSector0->l[0] == 0) && (pSector0->l[127] == 0)) 649 { 650 iRetVal = 1; 651 break; 652 } 653 654 /* check for a valid MBR */ 655 if (pSector0->w[255] != 0xaa55) break; /* Not valid if no MBR signature */ 656 if (pSector0->b[0x1c2] == 0xee) break; /* Not valid if guard partition */ 657 if (pSector0->b[0x1d2] == 0xee) break; /* Not valid if guard partition */ 658 if (pSector0->b[0x1e2] == 0xee) break; /* Not valid if guard partition */ 659 if (pSector0->b[0x1f2] == 0xee) break; /* Not valid if guard partition */ 660 iRetVal = 1; 661 } while (0); 662 663 if (pSector0) MemFree(pSector0); 664 return iRetVal; 665 } 666 667 /****************************************************************************** 668 * Set up device attached to the specified port based on ATA_IDENTFY_DEVICE or 669 * ATA_IDENTFY_PACKET_DEVICE data. 670 * 671 * NOTE: Port multipliers are not supported, yet, thus the device number is 672 * expected to be 0 for the time being. 673 */ 674 static void ahci_setup_device(AD_INFO *ai, int p, int d, u16 *id_buf) 675 { 676 DEVICESTRUCT ds; 677 ADJUNCT adj; 678 HDEVICE dh; 679 char dev_name[RM_MAX_PREFIX_LEN+ATA_ID_PROD_LEN+1]; 680 char *pDevName; 681 static u8 total_dev_cnt; 682 683 if (p >= AHCI_MAX_PORTS) return; 684 if (d >= AHCI_MAX_DEVS) return; 685 686 if (ai->port_max < p) ai->port_max = p; 687 if (ai->ports[p].dev_max < d) ai->ports[p].dev_max = d; 688 memset(ai->ports[p].devs + d, 0x00, sizeof(*ai->ports[p].devs)); 689 690 /* set generic device information (assuming an ATA disk device for now) */ 691 ai->ports[p].devs[d].present = 1; 692 ai->ports[p].devs[d].removable = (id_buf[ATA_ID_CONFIG] & 0x0080U) != 0; 693 ai->ports[p].devs[d].dev_type = UIB_TYPE_DISK; 694 pDevName = ai->ports[p].devs[d].dev_name; 695 strlcpy(pDevName, ata_dev_name(id_buf), sizeof(ai->ports[0].devs[0].dev_name)); 696 697 if (id_buf[ATA_ID_CONFIG] & 0x8000U) 698 { 699 /* this is an ATAPI device; augment device information */ 700 ai->ports[p].devs[d].atapi = 1; 701 ai->ports[p].devs[d].atapi_16 = (id_buf[ATA_ID_CONFIG] & 0x0001U) != 0; 702 ai->ports[p].devs[d].dev_type = (id_buf[ATA_ID_CONFIG] & 0x1f00U) >> 8; 703 ai->ports[p].devs[d].ncq_max = 1; 704 705 } 706 else 707 { 708 /* complete ATA-specific device information */ 709 if (enable_ncq[ad_no(ai)][p]) 710 { 711 ai->ports[p].devs[d].ncq_max = id_buf[ATA_ID_QUEUE_DEPTH] & 0x001fU; 712 } 713 if (ai->ports[p].devs[d].ncq_max < 1) 714 { 715 /* NCQ not enabled for this device, or device doesn't support NCQ */ 716 ai->ports[p].devs[d].ncq_max = 1; 717 } 718 if (id_buf[ATA_ID_CFS_ENABLE_2] & 0x0400U) 719 { 720 ai->ports[p].devs[d].lba48 = 1; 721 } 722 } 723 724 DPRINTF(2,"found device %d.%d.%d: removable=%d dev_type=%d atapi=%d ncq_max=%d\n", 725 ad_no(ai), p, d, 726 ai->ports[p].devs[d].removable, 727 ai->ports[p].devs[d].dev_type, 728 ai->ports[p].devs[d].atapi, 729 ai->ports[p].devs[d].ncq_max); 730 731 /* add device to resource manager; we don't really care about errors here */ 732 memset(&ds, 0x00, sizeof(ds)); 733 memset(&adj, 0x00, sizeof(adj)); 734 735 adj.pNextAdj = NULL; 736 adj.AdjLength = sizeof(adj); 737 adj.AdjType = ADJ_ADD_UNIT; 738 adj.Add_Unit.ADDHandle = rm_drvh; 739 adj.Add_Unit.UnitHandle = (USHORT)total_dev_cnt; 740 741 /* create Resource Manager device key string; 742 * we distinguish only HDs and CD drives for now 743 */ 744 if (ai->ports[p].devs[d].removable) 745 { 746 snprintf(dev_name, sizeof(dev_name), RM_CD_PREFIX "%s", p, d, pDevName); 747 } 748 else 749 { 750 snprintf(dev_name, sizeof(dev_name), RM_HD_PREFIX "%s", p, d, pDevName); 751 } 752 753 ds.DevDescriptName = dev_name; 754 ds.DevFlags = (ai->ports[p].devs[d].removable) ? DS_REMOVEABLE_MEDIA 755 : DS_FIXED_LOGICALNAME; 756 ds.DevType = ai->ports[p].devs[d].dev_type; 757 ds.pAdjunctList = &adj; 758 759 RMCreateDevice(rm_drvh, &dh, &ds, ai->rm_adh, NULL); 760 761 total_dev_cnt++; 762 763 /* try to detect virtualbox environment to enable a hack for IRQ routing */ 764 if (ai == ad_infos && ai->pci_vendor == 0x8086 && ai->pci_device == 0x2829 && 765 !memcmp(pDevName, "VBOX HARDDISK", 13)) 766 { 767 /* running inside virtualbox */ 768 pci_hack_virtualbox(); 769 } 770 } 771 772 /****************************************************************************** 533 773 * Scan all ports for connected devices and fill in the corresponding device 534 774 * information. … … 546 786 * the corresponding adapter's busy flag set. It will aquire the spinlock 547 787 * temporarily to allocate/free memory for the ATA identify buffer. 788 * 789 * Called from iocm_device_table() 548 790 */ 549 791 int ahci_scan_ports(AD_INFO *ai) … … 564 806 565 807 /* perform port scan */ 566 DPRINTF(1, "ahci_scan_ports: scanning ports on adapter %d\n", ad_no(ai));808 DPRINTF(1,__func__": scanning ports on adapter %d\n", ad_no(ai)); 567 809 for (p = 0; p < AHCI_MAX_PORTS; p++) 568 810 { … … 572 814 // DAZ allocate port structure here 573 815 574 DPRINTF(3, "ahci_scan_ports: Wait till not busy on port %d\n", p);816 DPRINTF(3,__func__": Wait till not busy on port %d\n", p); 575 817 /* wait until all active commands have completed on this port */ 576 818 TimerInit(&Timer, 250); … … 592 834 else 593 835 { 594 DPRINTF(3, "ahci_scan_ports: (re)starting port %d\n", p);836 DPRINTF(3,__func__": (re)starting port %d\n", p); 595 837 ahci_stop_port(ai, p); 596 838 rc = ahci_start_port(ai, p, 0); … … 600 842 { 601 843 /* this port seems to have a device attached and ready for commands */ 602 DPRINTF(1, "ahci_scan_ports: port %d seems to be attached to a device; probing...\n", p);844 DPRINTF(1,__func__": port %d seems to be attached to a device; probing...\n", p); 603 845 604 846 #ifdef DAZ_NEW_CODE … … 633 875 DHEXDUMP(5,id_buf, ATA_ID_WORDS * sizeof(u16), "ATA_IDENTIFY%s results:\n", (is_ata) ? "" : "_PACKET"); 634 876 ahci_setup_device(ai, p, 0, id_buf); 877 if (!IsUsableDisk(ai, p, 0)) ai->ports[p].devs[0].ignored = 1; 635 878 } 636 879 else … … 653 896 } 654 897 MemFree(id_buf); 655 return(0);656 }657 658 /******************************************************************************659 * Complete initialization of adapter. This includes restarting all active660 * ports and initializing interrupt processing. This is called when receiving661 * the IOCM_COMPLETE_INIT request.662 */663 int ahci_complete_init(AD_INFO *ai)664 {665 int rc;666 u32 p;667 int i;668 669 DPRINTF(1,"ahci_complete_init: completing initialization of adapter #%d\n", ad_no(ai));670 671 if (!ai->int_set)672 {673 /* register IRQ handler; each IRQ level is registered only once */674 p = 1; /* int count */675 if (!(ai->flags & AHCI_HFLAG_NO_MSI))676 {677 if (PsdMsiAlloc(ai->bus_dev_func, &p, &ai->irq)) p = 1; /* shared flag */678 else679 {680 /* we have an msi interrupt */681 ai->irq_pin = 0;682 p = 0; /* exclusive flag */683 }684 }685 for (i = 0; i < irq_used_cnt; i++)686 {687 if (irq_used[i] == ai->irq) break; /* we already have this IRQ registered */688 }689 if (i >= irq_used_cnt)690 {691 if (i >= MAX_IRQ_HANDLERS) return -1; /* no more handlers available */692 DPRINTF(2,"registering interrupt #%d\n", ai->irq);693 694 rc = Dev32Help_SetIRQ(ahci_intr, ai->irq, p, ai->irq);695 if (rc && p) /* if failed and was shared */696 {697 p = 0; /* try exclusive */698 rc = Dev32Help_SetIRQ(ahci_intr, ai->irq, p, ai->irq);699 }700 if (rc)701 {702 dprintf(0,"failed to register interrupt %d\n", ai->irq);703 return(-1);704 }705 irq_used[irq_used_cnt++] = ai->irq;706 ai->int_set = 1;707 RmUpdateAddIrq(rm_drvh, ai->rm_adh, ai->irq, ai->irq_pin, p?RS_IRQ_SHARED:RS_IRQ_EXCLUSIVE);708 }709 }710 711 /* enable AHCI mode */712 if ((rc = ahci_enable_ahci(ai)) != 0) return(rc);713 714 /* Start all ports. The main purpose is to set the command list and FIS715 * receive area addresses properly and to enable port-level interrupts; we716 * don't really care about the return status because we'll find out soon717 * enough if a previously detected device has problems.718 */719 for (p = 0; p <= ai->port_max; p++)720 {721 if (ai->port_map & (1UL << p))722 {723 if (init_reset)724 {725 DPRINTF(3,"ahci_complete_init: resetting port %d\n", p);726 ahci_reset_port(ai, p, 1);727 }728 else729 {730 DPRINTF(3,"ahci_complete_init: restarting port #%d\n", p);731 ahci_stop_port(ai, p);732 ahci_start_port(ai, p, 1);733 }734 }735 }736 737 /* clear pending interrupt status */738 writel(ai->mmio + HOST_IRQ_STAT, readl(ai->mmio + HOST_IRQ_STAT));739 readl(ai->mmio + HOST_IRQ_STAT); /* flush */740 741 /* enable adapter-level interrupts */742 writel(ai->mmio + HOST_CTL, readl(ai->mmio + HOST_CTL) | HOST_IRQ_EN);743 readl(ai->mmio + HOST_CTL); /* flush */744 745 /* enable interrupts on PCI-level (PCI 2.3 added a feature to disable INTs) */746 /* pci_enable_int(ai->bus, ai->dev_func); */747 748 DPRINTF(1,"ahci_complete_init: done\n");749 898 return(0); 750 899 } … … 1768 1917 } 1769 1918 1770 /******************************************************************************1771 * Set up device attached to the specified port based on ATA_IDENTFY_DEVICE or1772 * ATA_IDENTFY_PACKET_DEVICE data.1773 *1774 * NOTE: Port multipliers are not supported, yet, thus the device number is1775 * expected to be 0 for the time being.1776 */1777 static void ahci_setup_device(AD_INFO *ai, int p, int d, u16 *id_buf)1778 {1779 DEVICESTRUCT ds;1780 ADJUNCT adj;1781 HDEVICE dh;1782 char dev_name[RM_MAX_PREFIX_LEN+ATA_ID_PROD_LEN+1];1783 char *pDevName;1784 static u8 total_dev_cnt;1785 1786 if (p >= AHCI_MAX_PORTS) return;1787 if (d >= AHCI_MAX_DEVS) return;1788 1789 if (ai->port_max < p) ai->port_max = p;1790 if (ai->ports[p].dev_max < d) ai->ports[p].dev_max = d;1791 memset(ai->ports[p].devs + d, 0x00, sizeof(*ai->ports[p].devs));1792 1793 /* set generic device information (assuming an ATA disk device for now) */1794 ai->ports[p].devs[d].present = 1;1795 ai->ports[p].devs[d].removable = (id_buf[ATA_ID_CONFIG] & 0x0080U) != 0;1796 ai->ports[p].devs[d].dev_type = UIB_TYPE_DISK;1797 pDevName = ai->ports[p].devs[d].dev_name;1798 strlcpy(pDevName, ata_dev_name(id_buf), sizeof(ai->ports[0].devs[0].dev_name));1799 1800 if (id_buf[ATA_ID_CONFIG] & 0x8000U)1801 {1802 /* this is an ATAPI device; augment device information */1803 ai->ports[p].devs[d].atapi = 1;1804 ai->ports[p].devs[d].atapi_16 = (id_buf[ATA_ID_CONFIG] & 0x0001U) != 0;1805 ai->ports[p].devs[d].dev_type = (id_buf[ATA_ID_CONFIG] & 0x1f00U) >> 8;1806 ai->ports[p].devs[d].ncq_max = 1;1807 1808 }1809 else1810 {1811 /* complete ATA-specific device information */1812 if (enable_ncq[ad_no(ai)][p])1813 {1814 ai->ports[p].devs[d].ncq_max = id_buf[ATA_ID_QUEUE_DEPTH] & 0x001fU;1815 }1816 if (ai->ports[p].devs[d].ncq_max < 1)1817 {1818 /* NCQ not enabled for this device, or device doesn't support NCQ */1819 ai->ports[p].devs[d].ncq_max = 1;1820 }1821 if (id_buf[ATA_ID_CFS_ENABLE_2] & 0x0400U)1822 {1823 ai->ports[p].devs[d].lba48 = 1;1824 }1825 }1826 1827 DPRINTF(2,"found device %d.%d.%d: removable=%d dev_type=%d atapi=%d ncq_max=%d\n",1828 ad_no(ai), p, d,1829 ai->ports[p].devs[d].removable,1830 ai->ports[p].devs[d].dev_type,1831 ai->ports[p].devs[d].atapi,1832 ai->ports[p].devs[d].ncq_max);1833 1834 /* add device to resource manager; we don't really care about errors here */1835 memset(&ds, 0x00, sizeof(ds));1836 memset(&adj, 0x00, sizeof(adj));1837 1838 adj.pNextAdj = NULL;1839 adj.AdjLength = sizeof(adj);1840 adj.AdjType = ADJ_ADD_UNIT;1841 adj.Add_Unit.ADDHandle = rm_drvh;1842 adj.Add_Unit.UnitHandle = (USHORT)total_dev_cnt;1843 1844 /* create Resource Manager device key string;1845 * we distinguish only HDs and CD drives for now1846 */1847 if (ai->ports[p].devs[d].removable)1848 {1849 snprintf(dev_name, sizeof(dev_name), RM_CD_PREFIX "%s", p, d, pDevName);1850 }1851 else1852 {1853 snprintf(dev_name, sizeof(dev_name), RM_HD_PREFIX "%s", p, d, pDevName);1854 }1855 1856 ds.DevDescriptName = dev_name;1857 ds.DevFlags = (ai->ports[p].devs[d].removable) ? DS_REMOVEABLE_MEDIA1858 : DS_FIXED_LOGICALNAME;1859 ds.DevType = ai->ports[p].devs[d].dev_type;1860 ds.pAdjunctList = &adj;1861 1862 RMCreateDevice(rm_drvh, &dh, &ds, ai->rm_adh, NULL);1863 1864 total_dev_cnt++;1865 1866 /* try to detect virtualbox environment to enable a hack for IRQ routing */1867 if (ai == ad_infos && ai->pci_vendor == 0x8086 && ai->pci_device == 0x2829 &&1868 !memcmp(pDevName, "VBOX HARDDISK", 13))1869 {1870 /* running inside virtualbox */1871 pci_hack_virtualbox();1872 }1873 }1874 -
trunk/src/os2ahci/apm.c
r196 r198 122 122 123 123 /* flush cache on all attached devices */ 124 for (d = 0; d <= ai->ports[p].dev_max; d++) { 125 if (ai->ports[p].devs[d].present) { 124 for (d = 0; d <= ai->ports[p].dev_max; d++) 125 { 126 if (ai->ports[p].devs[d].present && !ai->ports[p].devs[d].ignored) 127 { 126 128 ahci_flush_cache(ai, p, d); 127 129 } … … 250 252 for (d = 0; d <= ai->ports[p].dev_max; d++) 251 253 { 252 if (ai->ports[p].devs[d].present )254 if (ai->ports[p].devs[d].present && !ai->ports[p].devs[d].ignored) 253 255 { 254 256 ahci_flush_cache(ai, p, d); -
trunk/src/os2ahci/ata.c
r196 r198 546 546 DHEXDUMP(5,pDLA, sizeof(DLA_Table_Sector), "DLA sector %d:\n", sector-1); 547 547 548 if ((pDLA->DLA_Signature1 == DLA_TABLE_SIGNATURE1) && (pDLA->DLA_Signature2 == DLA_TABLE_SIGNATURE2)) { 549 DPRINTF(3,"is_lvm_geometry found at sector %d\n", sector-1); 548 if ((pDLA->DLA_Signature1 == DLA_TABLE_SIGNATURE1) && (pDLA->DLA_Signature2 == DLA_TABLE_SIGNATURE2)) 549 { 550 DPRINTF(3,__func__": DLA found at sector %d\n", sector-1); 550 551 geometry->TotalCylinders = pDLA->Cylinders; 551 552 geometry->NumHeads = pDLA->Heads_Per_Cylinder; … … 571 572 if (init_complete) return 0; /* We cannot use ahci_exec_polled_cmd() after init_complete */ 572 573 573 if (use_lvm_info) 574 { 575 #ifdef DEBUG 576 AD_INFO *ai = ad_infos + iorb_unit_adapter(pIorb); 577 int p = iorb_unit_port(pIorb); 578 int d = iorb_unit_device(pIorb); 579 DPRINTF(3,"is_lvm_geometry (%d.%d.%d)\n", ad_no(ai), p, d); 580 #endif 581 582 /* First check the sector reported by the hardware */ 583 if (check_lvm(pIorb, geometry->SectorsPerTrack)) return 1; 584 585 for (sector = 255; sector >= 63; sector >>= 1) 586 { 587 if (sector == geometry->SectorsPerTrack) continue; 588 if (check_lvm(pIorb, sector)) return 1; 589 } 574 #ifdef DEBUG 575 AD_INFO *ai = ad_infos + iorb_unit_adapter(pIorb); 576 int p = iorb_unit_port(pIorb); 577 int d = iorb_unit_device(pIorb); 578 DPRINTF(3,__func__" (%d.%d.%d)\n", ad_no(ai), p, d); 579 #endif 580 581 /* First check the sector reported by the hardware */ 582 if (check_lvm(pIorb, geometry->SectorsPerTrack)) return 1; 583 584 for (sector = 255; sector >= 63; sector >>= 1) 585 { 586 if (sector == geometry->SectorsPerTrack) continue; 587 if (check_lvm(pIorb, sector)) return 1; 590 588 } 591 589 … … 632 630 * difference. Maybe there's something in later DDKs that allows more than 633 631 * 32 bits? 632 * 633 * Warning: Do not change the algorithm for calculating disk geometry without 634 * fully understaing the consequences. Side effects of even slight changes 635 * can be unexpected and catastrophic. 634 636 */ 635 637 memset(geometry, 0x00, geometry_len); -
trunk/src/os2ahci/ioctl.c
r196 r198 98 98 for (d = 0; d <= pi->dev_max; d++) 99 99 { 100 if (pi->devs[d].present )100 if (pi->devs[d].present && !pi->devs[d].ignored) 101 101 { 102 102 /* add this device to the device list */ … … 148 148 p = req->port; 149 149 d = req->device; 150 if (a >= ad_info_cnt || p > ad_infos[a].port_max || 151 d > ad_infos[a].ports[p].dev_max || !ad_infos[a].ports[p].devs[d].present) 150 if (a >= ad_info_cnt || p > ad_infos[a].port_max 151 || d > ad_infos[a].ports[p].dev_max 152 || !ad_infos[a].ports[p].devs[d].present 153 || ad_infos[a].ports[p].devs[d].ignored) 152 154 { 153 155 return(RPDONE | RPERR_UNIT); … … 545 547 for (_d = 0; _d <= pi->dev_max; _d++) 546 548 { 547 if (pi->devs[_d].present )549 if (pi->devs[_d].present && !pi->devs[_d].ignored) 548 550 { 549 551 if (unit-- == 0) -
trunk/src/os2ahci/os2ahci.c
r196 r198 67 67 int force_write_cache; /* if != 0, force write cache */ 68 68 int verbosity = 0; /* default is quiet. 1=show sign on banner, >1=show adapter info during boot */ 69 int use_ lvm_info= 1;69 int use_mbr_test = 1; 70 70 long com_baud = 0; 71 71 … … 383 383 } 384 384 385 if (ArgCmp(pszCmdLine, " Z"))385 if (ArgCmp(pszCmdLine, "U")) 386 386 { 387 387 pszCmdLine++; 388 /* Specify to not use the LVM information. There is no reason why anyone would 389 * want to do this, but previous versions of this driver did not have LVM capability, 390 * so this switch is here temporarily just in case. 388 /* Specify to use the MBR test to ignore non-MBR disks. 389 * Default is on. 391 390 */ 392 use_ lvm_info= !iInvertOption;391 use_mbr_test = !iInvertOption; 393 392 continue; 394 393 } … … 1128 1127 for (d = 0; d <= ad_info->ports[p].dev_max; d++) 1129 1128 { 1130 if (ad_info->ports[p].devs[d].present )1129 if (ad_info->ports[p].devs[d].present && !ad_info->ports[p].devs[d].ignored) 1131 1130 { 1132 1131 if (ad_info->ports[p].devs[d].atapi && emulate_scsi[dta][p]) … … 1167 1166 for (d = 0; d <= ad_info->ports[p].dev_max; d++) 1168 1167 { 1169 if (ad_info->ports[p].devs[d].present && ad_info->ports[p].devs[d].atapi && emulate_scsi[a][p]) 1168 if (ad_info->ports[p].devs[d].present && !ad_info->ports[p].devs[d].ignored 1169 && ad_info->ports[p].devs[d].atapi && emulate_scsi[a][p]) 1170 1170 { 1171 1171 if (add_unit_info(pIorb_conf, dta, a, p, d, scsi_id++)) -
trunk/src/os2ahci/os2ahci.h
r196 r198 262 262 unsigned dev_type :5; /* device type (UIB_TYPE_* in iorb.h) */ 263 263 unsigned ncq_max :5; /* maximum tag number for queued commands */ 264 unsigned ignored :1; /* if != 0, device is not MBR */ 264 265 UNITINFO *unit_info; /* pointer to modified unit info */ 265 266 DEV_INFO dev_info; … … 477 478 extern int force_write_cache; /* if != 0, force write cache */ 478 479 extern int verbosity; /* if != 0, show some info during boot */ 479 extern int use_ lvm_info;480 extern int use_mbr_test; 480 481 481 482 extern HDRIVER rm_drvh; /* resource manager driver handle */ -
trunk/src/os2ahci/trace.c
r196 r198 58 58 pi->devs[d].dev_info.TotalSectors/2048, pi->devs[d].dev_info.Method); 59 59 } 60 if (pi->devs[d].ignored) dprintf(0," Not a usable disk"); 60 61 dprintf(0,"\n"); 61 62 dprintf(0," Model: %s\n", pi->devs[d].dev_name);
Note:
See TracChangeset
for help on using the changeset viewer.