- Timestamp:
- Dec 20, 2016, 9:35:27 PM (9 years ago)
- Location:
- trunk/src/os2ahci
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os2ahci/Makefile
r184 r185 156 156 cd .. 157 157 158 release: $(O)\os2ahci.add $(O)\os2ahci.sym.symbolic158 release: .symbolic 159 159 @if exist $(WPIFILE) @del $(WPIFILE) 160 160 @!rm -rf $(ZIPDIR) … … 163 163 164 164 @md $(ZIPDIR)\pkg1 165 @copy /b $(ROOT)\src\os2ahci\$(O)\os2ahci.add $(ZIPDIR)\pkg1 >NUL166 @copy /b $(ROOT)\src\os2ahci\$(O)\os2ahci.sym $(ZIPDIR)\pkg1 >NUL165 copy /b $(ROOT)\src\os2ahci\$(O)\os2ahci.add $(ZIPDIR)\pkg1 >NUL 166 copy /b $(ROOT)\src\os2ahci\$(O)\os2ahci.sym $(ZIPDIR)\pkg1 >NUL 167 167 168 168 @md $(ZIPDIR)\pkg2 -
trunk/src/os2ahci/ReadMe.txt
r180 r185 118 118 [Intel] AHCI controller was found to be 119 119 initialized by the BIOS in SATA mode, ports will 120 always be reset even when /!R was specified120 always be reset even when /!R is specified 121 121 122 122 /A:n Set adapter to n for adapter-specific options -
trunk/src/os2ahci/ahci.c
r184 r185 295 295 /* more ports in port_map than in HOST_CAP & 0x1f */ 296 296 ports = ai->hw_ports; 297 DPRINTF(1,"implemented port map (0x%x) contains more ports than nr_ports (%d), using nr_ports\n", ai->port_map, ports);297 DPRINTF(1,"implemented port map (0x%x) contains more ports than hw_ports (%d), using hw_ports\n", ai->port_map, ports); 298 298 ai->port_map = (1UL << ports) - 1UL; 299 299 } … … 371 371 int p; 372 372 373 for (p = 0; p < AHCI_MAX_PORTS; p++)373 for (p = 0; p <= ai->port_max; p++) 374 374 { 375 375 if (ai->port_map & (1UL << p)) … … 729 729 * enough if a previously detected device has problems. 730 730 */ 731 for (p = 0; p < AHCI_MAX_PORTS; p++)731 for (p = 0; p <= ai->port_max; p++) 732 732 { 733 733 if (ai->port_map & (1UL << p)) … … 1791 1791 HDEVICE dh; 1792 1792 char dev_name[RM_MAX_PREFIX_LEN+ATA_ID_PROD_LEN+1]; 1793 char *pDevName; 1793 1794 static u8 total_dev_cnt; 1794 1795 … … 1804 1805 ai->ports[p].devs[d].removable = (id_buf[ATA_ID_CONFIG] & 0x0080U) != 0; 1805 1806 ai->ports[p].devs[d].dev_type = UIB_TYPE_DISK; 1807 pDevName = ai->ports[p].devs[d].dev_name; 1808 strncpy(pDevName, ata_dev_name(id_buf), sizeof(ai->ports[0].devs[0].dev_name)); 1806 1809 1807 1810 if (id_buf[ATA_ID_CONFIG] & 0x8000U) … … 1847 1850 adj.AdjType = ADJ_ADD_UNIT; 1848 1851 adj.Add_Unit.ADDHandle = rm_drvh; 1849 adj.Add_Unit.UnitHandle = (USHORT) 1852 adj.Add_Unit.UnitHandle = (USHORT)total_dev_cnt; 1850 1853 1851 1854 /* create Resource Manager device key string; … … 1854 1857 if (ai->ports[p].devs[d].removable) 1855 1858 { 1856 sprintf(dev_name, RM_CD_PREFIX "%s", p, d, ata_dev_name(id_buf));1859 sprintf(dev_name, RM_CD_PREFIX "%s", p, d, pDevName); 1857 1860 } 1858 1861 else 1859 1862 { 1860 sprintf(dev_name, RM_HD_PREFIX "%s", p, d, ata_dev_name(id_buf));1863 sprintf(dev_name, RM_HD_PREFIX "%s", p, d, pDevName); 1861 1864 } 1862 1865 … … 1873 1876 /* try to detect virtualbox environment to enable a hack for IRQ routing */ 1874 1877 if (ai == ad_infos && ai->pci_vendor == 0x8086 && ai->pci_device == 0x2829 && 1875 !memcmp( ata_dev_name(id_buf), "VBOX HARDDISK", 13))1878 !memcmp(pDevName, "VBOX HARDDISK", 13)) 1876 1879 { 1877 1880 /* running inside virtualbox */ -
trunk/src/os2ahci/ahci.h
r183 r185 59 59 #define AHCI_PCI_BAR 5 60 60 #define AHCI_MAX_PORTS 16 /* Spec says 32, but we only support 16 */ 61 #define AHCI_MAX_DEVS 861 #define AHCI_MAX_DEVS 1 /* was 8. we only support 1 drive per port */ 62 62 #define AHCI_MAX_SG 48 /* hardware max is 64K */ 63 63 #define AHCI_MAX_SG_ELEMENT_LEN (1UL << 22) 64 64 #define AHCI_MAX_CMDS 32 65 65 #define AHCI_RX_FIS_SZ 256 66 #define AHCI_DEV_NAME_LEN 40 66 67 67 68 /* port-specific DMA scratch buffer aligned to 1024 bytes */ -
trunk/src/os2ahci/ata.c
r184 r185 272 272 if ((sg_addr & 1) || (chunk & 1)) 273 273 { 274 dprintf( 0,"error: ata_cmd() called with unaligned S/G element(s)\n");274 dprintf(1,"error: ata_cmd() called with unaligned S/G element(s)\n"); 275 275 return(ATA_CMD_UNALIGNED_ADDR); 276 276 } -
trunk/src/os2ahci/ata.h
r178 r185 491 491 /* -------------------------- function prototypes -------------------------- */ 492 492 493 extern int ata_cmd (AD_INFO *ai, int port, int device, 494 int slot, int cmd, ...); 495 extern int v_ata_cmd (AD_INFO *ai, int port, int device, 496 int slot, int cmd, va_list va); 497 extern void ata_cmd_to_fis (u8 *fis, ATA_CMD *cmd, 498 int device); 499 extern USHORT ata_get_sg_indx (IORB_EXECUTEIO *io); 500 extern void ata_max_sg_cnt (IORB_EXECUTEIO *io, 501 USHORT sg_indx, USHORT sg_max, 502 USHORT *sg_cnt, 503 USHORT *sector_cnt); 493 extern int ata_cmd(AD_INFO *ai, int port, int device, int slot, int cmd, ...); 494 extern int v_ata_cmd(AD_INFO *ai, int port, int device, int slot, int cmd, va_list va); 495 extern void ata_cmd_to_fis(u8 *fis, ATA_CMD *cmd, int device); 496 extern USHORT ata_get_sg_indx(IORB_EXECUTEIO *io); 497 extern void ata_max_sg_cnt(IORB_EXECUTEIO *io, USHORT sg_indx, USHORT sg_max, USHORT *sg_cnt, USHORT *sector_cnt); 504 498 505 499 extern int ata_get_geometry(IORBH FAR16DATA *iorb, IORBH *pIorb, int slot); … … 517 511 extern int ata_req_sense(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot); 518 512 519 extern char *ata_dev_name(u16 *id_buf);520 513 extern char *ata_dev_name(u16 *id_buf); 514 -
trunk/src/os2ahci/os2ahci.c
r184 r185 1366 1366 if (_vIorb == vIorb) 1367 1367 { 1368 1369 1368 /* found the IORB to be removed */ 1370 1369 if (_vPrev != NULL) -
trunk/src/os2ahci/os2ahci.h
r184 r185 243 243 /* port information structure */ 244 244 typedef struct { 245 IORB_QUEUE iorb_queue; /* IORB queue for this port */246 unsigned dev_max : 4; /* maximum device number on this port (0..AHCI_MAX_DEVS-1) */247 unsigned cmd_slot : 5; /* current command slot index (using round-248 * robin indexes to prevent starvation) */249 250 volatile u32 ncq_cmds; /* bitmap for NCQ commands issued */251 volatile u32 reg_cmds; /* bitmap for regular commands issued */252 u32 dma_buf_phys; /* physical address of DMA scratch buffer */253 u8 *dma_buf; /* DMA scatch buffers */254 255 struct { 245 IORB_QUEUE iorb_queue; /* 00 IORB queue for this port */ 246 unsigned dev_max : 4; /* 08 maximum device number on this port (0..AHCI_MAX_DEVS-1) */ 247 unsigned cmd_slot : 5; /* current command slot index (using round- 248 * robin indexes to prevent starvation) */ 249 250 volatile u32 ncq_cmds; /* 0c bitmap for NCQ commands issued */ 251 volatile u32 reg_cmds; /* 10 bitmap for regular commands issued */ 252 u32 dma_buf_phys; /* 14 physical address of DMA scratch buffer */ 253 u8 *dma_buf; /* 18 DMA scatch buffers */ 254 255 struct { /* 1c */ 256 256 unsigned allocated :1; /* if != 0, device is allocated */ 257 257 unsigned present :1; /* if != 0, device is present */ … … 264 264 UNITINFO *unit_info; /* pointer to modified unit info */ 265 265 DEV_INFO dev_info; 266 char dev_name[AHCI_DEV_NAME_LEN]; 266 267 } devs[AHCI_MAX_DEVS]; 267 268 … … 272 273 /* adapter information structure */ 273 274 typedef struct { 274 PCI_ID *pci; /* pointer to corresponding PCI ID */ 275 276 unsigned port_max : 5; /* maximum port number (0..AHCI_MAX_PORTS-1) */ 277 unsigned cmd_max : 5; /* maximum cmd slot number (0-31) */ 278 unsigned port_scan_done : 1; /* if != 0, port scan already done */ 279 unsigned busy : 1; /* if != 0, adapter is busy */ 280 281 unsigned hw_ports : 6; /* number of ports as reported by the hardware */ 282 283 u32 port_map; /* bitmap of active ports */ 284 u16 pci_vendor; 285 u16 pci_device; 275 PCI_ID *pci; /* 00 pointer to corresponding PCI ID */ 276 277 unsigned port_max : 5; /* 04 maximum port number (0..AHCI_MAX_PORTS-1) */ 278 unsigned cmd_max : 5; /* maximum cmd slot number (0-31) */ 279 unsigned port_scan_done : 1; /* if != 0, port scan already done */ 280 unsigned busy : 1; /* if != 0, adapter is busy */ 281 unsigned hw_ports : 6; /* number of ports as reported by the hardware */ 282 283 u32 port_map; /* 08 bitmap of active ports */ 284 u16 pci_vendor; /* 0c */ 285 u16 pci_device; /* 0e */ 286 286 287 287 /* initial adapter configuration from BIOS */ 288 u32 bios_config[HOST_CAP2 / sizeof(u32) + 1]; 289 290 u32 cap; /* working copy of CAP register */291 u32 cap2; /* working copy of CAP2 register */292 u32 flags; /* adapter flags */293 294 HRESOURCE rm_adh; /* resource handle for adapter */295 HRESOURCE rm_bars[6]; /* resource handle for MMIO and I/O BARs */296 HRESOURCE rm_irq; /* resource handle for IRQ */297 298 u16 bus_dev_func; /* PCI bus number PCI device and function number */299 u16 irq; /* interrupt number */300 301 u32 mmio_phys; /* physical address of MMIO region */302 u32 mmio_size; /* size of MMIO region */303 u8 *mmio; /* pointer to this adapter's MMIO region */304 305 P_INFO ports[AHCI_MAX_PORTS]; /* SATA ports on this adapter */288 u32 bios_config[HOST_CAP2 / sizeof(u32) + 1]; /* 10 0x24 / 4 + 1 = 0x0a dwords = 0x28 bytes*/ 289 290 u32 cap; /* 38 working copy of CAP register */ 291 u32 cap2; /* 3c working copy of CAP2 register */ 292 u32 flags; /* 40 adapter flags */ 293 294 HRESOURCE rm_adh; /* 44 resource handle for adapter */ 295 HRESOURCE rm_bars[6]; /* 48 resource handle for MMIO and I/O BARs */ 296 HRESOURCE rm_irq; /* 60 resource handle for IRQ */ 297 298 u16 bus_dev_func; /* 64 PCI bus number PCI device and function number */ 299 u16 irq; /* 66 interrupt number */ 300 301 u32 mmio_phys; /* 68 physical address of MMIO region */ 302 u32 mmio_size; /* 6c size of MMIO region */ 303 u8 *mmio; /* 70 pointer to this adapter's MMIO region */ 304 305 P_INFO ports[AHCI_MAX_PORTS]; /* 74 SATA ports on this adapter */ 306 306 } AD_INFO; 307 307 -
trunk/src/os2ahci/pci.c
r184 r185 631 631 #ifndef DAZ_NEW_CODE 632 632 /* fill in DMA scratch buffer addresses in adapter info */ 633 for (i = 0; i < ad_info->hw_ports; i++) 634 { 633 for (i = 0; i < AHCI_MAX_PORTS; i++) 634 { 635 if (!(ad_info->port_map & (1UL << i))) continue; 636 635 637 ad_info->ports[i].dma_buf = MemAllocAlign(AHCI_PORT_PRIV_DMA_SZ, 1024); 636 638 ad_info->ports[i].dma_buf_phys = MemPhysAdr(ad_info->ports[i].dma_buf); -
trunk/src/os2ahci/trace.c
r184 r185 1 1 /****************************************************************************** 2 * trace.c - code for our internal trace ring buffer3 2 * 4 * Copyright (c) 2011 thi.guten Software Development5 * Copyright (c) 2011 Mensys B.V.6 3 * Copyright (c) 2013-2016 David Azarewicz 7 4 * 8 * Authors: Christian Mueller, Markus Thielen9 *10 * Parts copied from/inspired by the Linux AHCI driver;11 * those parts are (c) Linux AHCI/ATA maintainers12 *13 * This program is free software; you can redistribute it and/or modify14 * it under the terms of the GNU General Public License as published by15 * the Free Software Foundation; either version 2 of the License, or16 * (at your option) any later version.17 *18 * This program is distributed in the hope that it will be useful,19 * but WITHOUT ANY WARRANTY; without even the implied warranty of20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the21 * GNU General Public License for more details.22 *23 * You should have received a copy of the GNU General Public License24 * along with this program; if not, write to the Free Software25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA26 5 */ 27 6 … … 58 37 ai->bios_config[HOST_VERSION / sizeof(u32)]); 59 38 60 for (p = 0; p < ai->hw_ports; p++)39 for (p = 0; p <= ai->port_max; p++) 61 40 { 62 41 P_INFO *pi = &ai->ports[p]; … … 80 59 } 81 60 dprintf(0,"\n"); 61 dprintf(0," Model: %s\n", pi->devs[d].dev_name); 82 62 } /* if */ 83 63 } /* for d */
Note:
See TracChangeset
for help on using the changeset viewer.