Changeset 205 for trunk


Ignore:
Timestamp:
Jan 2, 2021, 1:06:02 AM (5 years ago)
Author:
David Azarewicz
Message:

Fixed ADD RM id.

Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/ReadMe.txt

    r201 r205  
    1 AHCI Driver for OS/2 v2.07
     1AHCI Driver for OS/2 v2.08
    22
    33Introduction
     
    1616Copyright (c) 2011 thi.guten Software Development
    1717Copyright (c) 2011 Mensys B.V.
    18 Copyright (c) 2013-2018 David Azarewicz
     18Copyright (c) 2013-2021 David Azarewicz
    1919
    2020Authors: Christian Mueller, Markus Thielen
     
    388388Change Log
    389389==========
     390v.2.08 01-Nov-2020 - David Azarewicz
     391  Corrected RM ADD handle and unit.
     392
    390393v.2.07 19-May-2019 - David Azarewicz
    391394  Fixed hardware failure recovery to arm ctx hook in watchdog timer.
  • trunk/src/os2ahci/ahci.c

    r204 r205  
    1 /******************************************************************************
     1/**
    22 * ahci.c - ahci hardware access functions
    33 *
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Copyright (c) 2013-2018 David Azarewicz
     6 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    2929#include "ata.h"
    3030#include "atapi.h"
    31 
    32 /* -------------------------- macros and constants ------------------------- */
    3331
    3432/* produce ata/atapi function pointer with the given func name */
     
    3836                              ? atapi_##func : ata_##func
    3937
    40 
    41 /* ------------------------ global/static variables ------------------------ */
    4238
    4339/* Initial driver status flags indexed by the board_* constants in os2ahci.h
     
    7672static u16 irq_used[MAX_IRQ_HANDLERS]; /* IRQ level for each used IRQ */
    7773static int irq_used_cnt; /* number of IRQs used */
    78 
    79 /* ----------------------------- start of code ----------------------------- */
    8074
    8175#ifdef DEBUG
     
    680674  char dev_name[RM_MAX_PREFIX_LEN+ATA_ID_PROD_LEN+1];
    681675  char *pDevName;
    682   static u8 total_dev_cnt;
    683676
    684677  if (p >= AHCI_MAX_PORTS) return;
     
    737730  adj.AdjLength           = sizeof(adj);
    738731  adj.AdjType             = ADJ_ADD_UNIT;
    739   adj.Add_Unit.ADDHandle  = rm_drvh;
    740   adj.Add_Unit.UnitHandle = (USHORT)total_dev_cnt;
     732  adj.Add_Unit.ADDHandle  = add_handle;
     733  adj.Add_Unit.UnitHandle = iorb_unit(ad_no(ai), p, d);
    741734
    742735  /* create Resource Manager device key string;
     
    759752
    760753  RMCreateDevice(rm_drvh, &dh, &ds, ai->rm_adh, NULL);
    761 
    762   total_dev_cnt++;
    763754
    764755  /* try to detect virtualbox environment to enable a hack for IRQ routing */
     
    14201411    if (rc)
    14211412    {
    1422       DPRINTF(3," timeout for IORB %x", vIorb);
     1413      DPRINTF(3," timeout for IORB %x port=%x", vIorb, p);
    14231414      iorb_seterr(pIorb, IOERR_ADAPTER_TIMEOUT);
    14241415    }
  • trunk/src/os2ahci/ahci.h

    r196 r205  
    1 /******************************************************************************
     1/**
    22 * ahci.h - AHCI-specific constants for os2ahci.h
    33 *
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Copyright (c) 2013-2018 David Azarewicz
     6 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    2626 */
    2727
    28 /* ----------------------------- include files ----------------------------- */
    29 
    30 /* -------------------------- macros and constants ------------------------- */
    3128
    3229/******************************************************************************
     
    251248#define EM_CTL_ALHD                     (1UL << 26) /* Activity LED */
    252249
    253 /* ------------------------ typedefs and structures ------------------------ */
    254 
    255250/* Primitive types
    256251 *
  • trunk/src/os2ahci/apm.c

    r198 r205  
    1 /******************************************************************************
     1/**
    22 * apm.c - Functions to interface with the legacy APM driver, and suspend / resume functions.
    33 *
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Portions copyright (c) 2013-2018 David Azarewicz
     6 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
  • trunk/src/os2ahci/ata.c

    r204 r205  
    1 /******************************************************************************
     1/**
    22 * ata.c - ATA command processing
    33 *
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Copyright (c) 2013-2018 David Azarewicz
     6 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    2929#include "ata.h"
    3030
    31 /* -------------------------- macros and constants ------------------------- */
    32 
    33 /* ------------------------ typedefs and structures ------------------------ */
    34 
    3531/* -------------------------- function prototypes -------------------------- */
    3632
     
    4238                         ULONG sector, ULONG count, SCATGATENTRY *sg_list,
    4339                         ULONG sg_cnt, int write_through);
    44 
    45 /* ------------------------ global/static variables ------------------------ */
    46 
    47 /* ----------------------------- start of code ----------------------------- */
    4840
    4941/******************************************************************************
  • trunk/src/os2ahci/ata.h

    r196 r205  
    1 /******************************************************************************
     1/**
    22 * ata.h - ATA structures and macros for os2ahci driver
    33 *
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Copyright (c) 2013-2018 David Azarewicz
     6 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    2525 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2626 */
    27 
    28 /* -------------------------- macros and constants ------------------------- */
    2927
    3028/******************************************************************************
  • trunk/src/os2ahci/atapi.c

    r204 r205  
    1 /******************************************************************************
     1/**
    22 * atapi.c - ATAPI command processing
    33 *
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Copyright (c) 2013-2018 David Azarewicz
     6 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    3333#include <Dev32scsi.h>
    3434
    35 /* -------------------------- macros and constants ------------------------- */
    36 
    37 /* ------------------------ typedefs and structures ------------------------ */
    38 
    39 /* -------------------------- function prototypes -------------------------- */
    40 
    4135static void atapi_req_sense_pp(IORBH FAR16DATA *vIorb, IORBH *pIorb);
    4236static int atapi_pad_cdb(u8 *cmd_in, u16 cmd_in_len, u8 *cmd_out, u16 *cmd_out_len);
    43 
    44 /* ------------------------ global/static variables ------------------------ */
    45 
    46 /* ----------------------------- start of code ----------------------------- */
    4737
    4838/******************************************************************************
  • trunk/src/os2ahci/atapi.h

    r196 r205  
    1 /******************************************************************************
     1/**
    22 * atapi.h - ATAPI structures and macros for os2ahci driver
    33 *
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Copyright (c) 2013-2018 David Azarewicz
     6 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    2525 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2626 */
    27 
    28 /* -------------------------- macros and constants ------------------------- */
    2927
    3028#define ATAPI_MIN_CDB_LEN   12   /* minimum ATAPI CDB len acc to AHCI spec */
     
    104102#define ATAPI_GET_SENSE(p_) (u8)(p_->sense.sense_key & 0x0f)
    105103
    106 /* ------------------------ typedefs and structures ------------------------ */
    107 
    108104/******************************************************************************
    109105 * ATAPI_SENSE_DATA - define layout of ATAPI sense data
     
    163159
    164160
    165 /* ---------------------------- global variables --------------------------- */
    166 
    167 /* -------------------------- function prototypes -------------------------- */
    168 
    169161extern int atapi_get_geometry(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot);
    170162extern int atapi_unit_ready(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot);
  • trunk/src/os2ahci/ctxhook.c

    r204 r205  
    1 /******************************************************************************
     1/**
    22 * ctxhook.c - context hooks (kernel thread functions) for os2ahci
    33 *
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Copyright (c) 2013-2018 David Azarewicz
     6 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    2929#include "ata.h"
    3030#include "atapi.h"
    31 
    32 /* -------------------------- macros and constants ------------------------- */
    33 
    34 /* ------------------------ typedefs and structures ------------------------ */
    35 
    36 /* -------------------------- function prototypes -------------------------- */
    37 
    38 /* ------------------------ global/static variables ------------------------ */
    3931
    4032/* port restart context hook and input data */
     
    5042/* trigger engine context hook and input data */
    5143ULONG           engine_ctxhook_h;
    52 
    53 /* ----------------------------- start of code ----------------------------- */
    5444
    5545/******************************************************************************
  • trunk/src/os2ahci/ioctl.c

    r204 r205  
    1 /******************************************************************************
     1/**
    22 * ioctl.c - Generic IOCTL command processing
    33 *
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Copyright (c) 2013-2018 David Azarewicz
     6 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    3434
    3535#pragma pack(1)
    36 
    37 /* -------------------------- macros and constants ------------------------- */
    38 
    39 /* ------------------------ typedefs and structures ------------------------ */
    4036
    4137/* Memory area for IOCTLs which send IORBs downstream; currently only
     
    5854} IOCTL_CONTEXT;
    5955
    60 /* -------------------------- function prototypes -------------------------- */
    61 
    6256static USHORT do_smart(BYTE unit, BYTE sub_func, BYTE cnt, BYTE lba_l, void *buf);
    6357static int map_unit(BYTE unit, USHORT *a, USHORT *p, USHORT *d);
    6458
    6559extern IORBH FAR16DATA * (__far16 *Far16AdrOfIoctlWakeup16)(IORBH FAR16DATA*);
    66 
    67 /* ------------------------ global/static variables ------------------------ */
    68 
    69 /* ----------------------------- start of code ----------------------------- */
    7060
    7161/******************************************************************************
  • trunk/src/os2ahci/ioctl.h

    r196 r205  
    1 /******************************************************************************
     1/**
    22 * ioctl.h - IOCTL structures and constants for os2ahci driver
    33 *
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Copyright (c) 2013-2018 David Azarewicz
     6 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    2525 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2626 */
    27 
    28 /* -------------------------- macros and constants ------------------------- */
    2927
    3028/* IOCTL categories and functions */
     
    7169#define PT_WRITE            0x0001U    /* transfer direction host -> device */
    7270#define PT_ATAPI            0x0002U    /* ATAPI command (ATA if not set) */
    73 
    74 /* ------------------------ typedefs and structures ------------------------ */
    7571
    7672#ifndef VMDHL_WRITE
  • trunk/src/os2ahci/os2ahci.c

    r204 r205  
    1 /******************************************************************************
     1/**
    22 * os2ahci.c - main file for os2ahci driver
    33 *
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Copyright (c) 2013-2018 David Azarewicz
     6 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    3030#include "version.h"
    3131#include "devhdr.h"
    32 
    33 /* -------------------------- macros and constants ------------------------- */
    3432
    3533/* set two-dimensional array of port options */
     
    5553#define TYPE_KRNL_EXIT_INT13      0x0004  /* enable int13 IO */
    5654
    57 /* ------------------------ typedefs and structures ------------------------ */
    58 
    59 /* -------------------------- function prototypes -------------------------- */
    60 
    6155extern int SetPsdPutc(void);
    6256static int add_unit_info(IORB_CONFIGURATION *iorb_conf, int dt_ai, int a, int p, int d, int scsi_id);
    6357
    64 /* ------------------------ global/static variables ------------------------ */
    6558int thorough_scan = 1; /* if != 0, perform thorough PCI scan */
    6659int init_reset = 1;    /* if != 0, reset ports during init */
     
    10699
    107100char BldLevel[] = BLDLEVEL;
    108 
    109 /* ----------------------------- start of code ----------------------------- */
    110101
    111102/******************************************************************************
     
    15501541
    15511542  Timer_CancelTimer(timer_handle);
    1552   dprintf(0,"timeout for IORB %x\n", vIorb);
     1543  dprintf(0,"timeout for IORB %x port=%x\n", vIorb, p);
    15531544
    15541545  /* Move the timed-out IORB to the abort queue. Since it's possible that the
  • trunk/src/os2ahci/os2ahci.h

    r202 r205  
    1 /******************************************************************************
     1/**
    22 * os2ahci.h - main header file for os2ahci driver
    33 *
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Copyright (c) 2013-2018 David Azarewicz
     6 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    2525 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2626 */
    27 
    28 /* ----------------------------- include files ----------------------------- */
    2927
    3028/* IMPORTANT NOTE: The DDK headers require tight structure packing and this
     
    4846#include "ahci.h"
    4947#include "ahci-idc.h"
    50 
    51 /* -------------------------- macros and constants ------------------------- */
    5248
    5349#define MAX_AD 8 /* maximum number of adapters */
     
    358354                                   /* These are the four entries which correspond to the entries in the partition table. */
    359355} DLA_Table_Sector, *PDLA_Table_Sector;
    360 
    361 /* -------------------------- function prototypes -------------------------- */
    362356
    363357static inline unsigned long readl(void *a)
     
    473467
    474468
    475 /* ---------------------------- global variables --------------------------- */
    476 
    477469extern int thorough_scan; /* if != 0, perform thorough PCI scan */
    478470extern int init_reset; /* if != 0, reset ports during init */
  • trunk/src/os2ahci/pci.c

    r196 r205  
    1 /******************************************************************************
     1/**
    22 * PCI.c - PCI constants and detection code for os2ahci driver
    33 *
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Copyright (c) 2013-2018 David Azarewicz
     6 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    2828#include "os2ahci.h"
    2929
    30 /* -------------------------- macros and constants ------------------------- */
    31 
    3230/* offset of PCI base address register (BAR) in the PCI config space */
    3331#define PCI_BAR(reg)   (UCHAR) (0x10 + (reg) * sizeof(u32))
    34 
    35 /* ------------------------ typedefs and structures ------------------------ */
    36 
    37 /* -------------------------- function prototypes -------------------------- */
    3832
    3933static void  add_pci_device(PCI_ID *pci_id, USHORT BusDevFunc);
    4034static long  bar_resource(USHORT BusDevFunc, RESOURCESTRUCT *resource, int i);
    4135static char *rmerr(APIRET ret);
    42 
    43 /* ------------------------ global/static variables ------------------------ */
    4436
    4537/******************************************************************************
     
    245237};
    246238
    247 /* ----------------------------- start of code ----------------------------- */
    248 
    249239/******************************************************************************
    250240 * Add specified PCI vendor and device ID to the list of supported AHCI
  • trunk/src/os2ahci/thunk.asm

    r196 r205  
    11; Thunking for ahci32 driver
    2 ; Copyright (c) 2018 David Azarewicz
     2; Copyright (c) 2018-2021 David Azarewicz
    33; Author: David Azarewicz <david@88watts.net>
    44
  • trunk/src/os2ahci/trace.c

    r204 r205  
    1 /******************************************************************************
     1/**
    22 *
    3  * Copyright (c) 2013-2018 David Azarewicz
     3 * Copyright (c) 2013-2021 David Azarewicz <david@88watts.net>
    44 *
    55 */
     
    77#include "os2ahci.h"
    88
    9 /* -------------------------- macros and constants ------------------------- */
    10 
    11 /* ------------------------ typedefs and structures ------------------------ */
    12 
    13 /* -------------------------- function prototypes -------------------------- */
    14 
    15 /* ------------------------ global/static variables ------------------------ */
    16 
    17 /* ----------------------------- start of code ----------------------------- */
    18 
    19 /******************************************************************************
     9/**
    2010 * Create adapter/port/device list for user output.
    2111 */
  • trunk/tools/AddToFile.cmd

    r204 r205  
    5555  rc=LineOut(MyFile, '--- AddToFile.cmd '||MyCmd);
    5656  call 'AddToFile.cmd' MyCmd;
    57   MyCmd=MyFile||',#define DVMAJ,VERSIONMAJOR,1.2.3';
    58   rc=LineOut(MyFile, '--- AddToFile.cmd '||MyCmd);
    59   call 'AddToFile.cmd' MyCmd;
    60   MyCmd=MyFile||',#define DVMIN,VERSIONMINOR,1.2.3';
    61   rc=LineOut(MyFile, '--- AddToFile.cmd '||MyCmd);
    62   call 'AddToFile.cmd' MyCmd;
    63   MyCmd=MyFile||',#define DVREV,VERSIONREVISION,1.2.3';
     57  MyCmd=MyFile||',#define DVMAJ,VERSIONMAJOR,1.02.03';
     58  rc=LineOut(MyFile, '--- AddToFile.cmd '||MyCmd);
     59  call 'AddToFile.cmd' MyCmd;
     60  MyCmd=MyFile||',#define DVMIN,VERSIONMINOR,1.02.03';
     61  rc=LineOut(MyFile, '--- AddToFile.cmd '||MyCmd);
     62  call 'AddToFile.cmd' MyCmd;
     63  MyCmd=MyFile||',#define DVREV,VERSIONREVISION,1.02.03';
    6464  rc=LineOut(MyFile, '--- AddToFile.cmd '||MyCmd);
    6565  call 'AddToFile.cmd' MyCmd;
     
    9292
    9393  when (LEFT(Function,8)='BLDLEVEL') then do
     94    /*  option description,BLDLEVEL,Vendor,1.2.3,Description,Fixpack,Asd';
     95     *  String            ,Function,Parm1 ,Parm2,Parm3      ,Parm4  ,Parm5
     96     */
    9497    Type=SUBSTR(Function,9,1);
    9598
     
    111114    end
    112115
     116    /*           Vendor     TextVersion        Date/Time/Host    ASD            Revision         Fixpack      Desc */
    113117    NewStr='@#'||Parm1||':'||Parm2||'#@##1## '||ProjString||':'||Parm5||':::'||ProjVersion||'::'||Parm4||'@@'||Parm3;
    114118    if (Type='2') then do
Note: See TracChangeset for help on using the changeset viewer.