Changeset 25


Ignore:
Timestamp:
Sep 23, 2010, 4:39:43 PM (15 years ago)
Author:
markus
Message:

watcom calling conventions...

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/include/devhelp.h

    r21 r25  
    11/* DEVHELP.H - DevHelp header file for Watcom-based device drivers
     2 *
     3 * Markus Thielen 09/2010:
     4 *    some modifications for OpenWatcom/os2ahci.add
     5 *
    26*/
    37
     
    59#define DEVHELP_INCLUDED
    610
    7 #ifdef __WATCOMC__ 
     11#ifdef __WATCOMC__
    812
    913#ifndef OS2_INCLUDED
     
    242246
    243247typedef struct _SELDESCINFO {
    244   UCHAR    Type;                       
    245   UCHAR    Granularity;                 
    246   LIN      BaseAddr;                   
    247   ULONG    Limit;                       
    248 } SELDESCINFO, __far *PSELDESCINFO; 
    249                                        
    250 typedef struct _GATEDESCINFO {         
    251   UCHAR    Type;                       
    252   UCHAR    ParmCount;                   
    253   SEL      Selector;                   
    254   USHORT   Reserved_1;                 
    255   ULONG    Offset;                     
     248  UCHAR    Type;
     249  UCHAR    Granularity;
     250  LIN      BaseAddr;
     251  ULONG    Limit;
     252} SELDESCINFO, __far *PSELDESCINFO;
     253
     254typedef struct _GATEDESCINFO {
     255  UCHAR    Type;
     256  UCHAR    ParmCount;
     257  SEL      Selector;
     258  USHORT   Reserved_1;
     259  ULONG    Offset;
    256260} GATEDESCINFO, __far *PGATEDESCINFO;
    257261
     
    383387
    384388/* DevHelp_MonWrite has one change compared to the original specification.
    385    The DataRecord parameter was originally a far (16:16) pointer.  It has 
     389   The DataRecord parameter was originally a far (16:16) pointer.  It has
    386390   been changed to a near pointer because DS must point to the default data
    387    segment and therefore the DataRecord parameter must be near.  This 
     391   segment and therefore the DataRecord parameter must be near.  This
    388392   allows the compiler to catch the error.
    389393*/
     
    443447   modify exact [ax cx dx di];
    444448
    445 /* NOTE: After the DevHelp call, SI contains the modified selector. However, 
     449/* NOTE: After the DevHelp call, SI contains the modified selector. However,
    446450   the C interface has no provisions for returning this value to the caller.
    447451   You can, however, use the _SI() inline function defined in include.h.
     
    913917USHORT DevHelp_VirtToPhys(PVOID SelOffset, PULONG PhysAddr);
    914918#pragma aux DevHelp_VirtToPhys = \
     919   "int 3" \
    915920   "push ds" \
    916921   "mov  dl,16h" \
     
    939944#define VMDHA_RESERVE           0x0100                               /*@V76282*/
    940945#define VMDHA_USEHIGHMEM        0x0800                               /*@V76282*/
    941  
     946
    942947USHORT DevHelp_VMAlloc(ULONG Flags, ULONG Size, ULONG PhysAddr, PLIN LinearAddr, PPVOID SelOffset);
    943948#pragma aux DevHelp_VMAlloc = \
  • trunk/src/os2ahci/ahci.c

    r14 r25  
    103103#define call_ahci_intr(i)   return(ahci_intr(irq_map[i]) >> 1)
    104104
    105 static USHORT _far irq_handler_00(void)  { call_ahci_intr(0); }
    106 static USHORT _far irq_handler_01(void)  { call_ahci_intr(1); }
    107 static USHORT _far irq_handler_02(void)  { call_ahci_intr(2); }
    108 static USHORT _far irq_handler_03(void)  { call_ahci_intr(3); }
    109 static USHORT _far irq_handler_04(void)  { call_ahci_intr(4); }
    110 static USHORT _far irq_handler_05(void)  { call_ahci_intr(5); }
    111 static USHORT _far irq_handler_06(void)  { call_ahci_intr(6); }
    112 static USHORT _far irq_handler_07(void)  { call_ahci_intr(7); }
     105static USHORT _far APIENTRY irq_handler_00(void)  { call_ahci_intr(0); }
     106static USHORT _far APIENTRY irq_handler_01(void)  { call_ahci_intr(1); }
     107static USHORT _far APIENTRY irq_handler_02(void)  { call_ahci_intr(2); }
     108static USHORT _far APIENTRY irq_handler_03(void)  { call_ahci_intr(3); }
     109static USHORT _far APIENTRY irq_handler_04(void)  { call_ahci_intr(4); }
     110static USHORT _far APIENTRY irq_handler_05(void)  { call_ahci_intr(5); }
     111static USHORT _far APIENTRY irq_handler_06(void)  { call_ahci_intr(6); }
     112static USHORT _far APIENTRY irq_handler_07(void)  { call_ahci_intr(7); }
    113113
    114114PFN irq_handlers[] = {
     
    185185        if (val & HOST_CAP2_NVMHCI)    printf(" nvmhci");
    186186        if (val & HOST_CAP2_APST)      printf(" apst");
    187      
     187
    188188      }
    189189      printf("\n");
     
    427427    goto exit_port_scan;
    428428  }
    429  
     429
    430430  /* perform port scan */
    431431  dprintf("scanning ports on adapter #%d\n", ad_no(ai));
     
    456456      /* this port has a device attached and is ready to accept commands */
    457457      ddprintf("port #%d seems to be attached to a device; probing...\n", p);
    458       rc = ahci_exec_polled_cmd(ai, p, 0, 500, ATA_CMD_ID_ATA, 
     458      rc = ahci_exec_polled_cmd(ai, p, 0, 500, ATA_CMD_ID_ATA,
    459459                                AP_VADDR, (void _far *) id_buf, 512,
    460460                                AP_END);
     
    865865    if (aws->is_ncq && port->reg_cmds == 0 || !aws->is_ncq && port->ncq_cmds == 0) {
    866866
    867       /* Find next available command slot. We use a simple round-robin 
     867      /* Find next available command slot. We use a simple round-robin
    868868       * algorithm for this to prevent commands with higher slot indexes
    869869       * from stalling when new commands are coming in frequently.
     
    954954    goto restore_bios_config;
    955955  }
    956  
     956
    957957  /* save port configuration */
    958958  if ((pc = ahci_save_port_config(ai, p)) == NULL) {
     
    11321132  u32 active_cmds;
    11331133  u32 done_mask;
    1134  
     1134
    11351135  ddprintf("port interrupt for adapter #%d, port #%d\n", ad_no(ai), p);
    11361136  memset(&done_queue, 0x00, sizeof(done_queue));
     
    11401140  writel(port_mmio + PORT_IRQ_STAT, irq_stat);
    11411141  readl(port_mmio + PORT_IRQ_STAT); /* flush */
    1142  
     1142
    11431143  if (irq_stat & PORT_IRQ_ERROR) {
    11441144    /* this is an error interrupt */
     
    12581258    /* no point analyzing device errors after a reset... */
    12591259    return;
    1260   } 
     1260  }
    12611261
    12621262  /* Handle device-specific errors. Those errors typically involve restarting
     
    12691269  }
    12701270}
    1271    
     1271
    12721272/******************************************************************************
    12731273 * Get device or media geometry. Device and media geometry are expected to be
     
    13041304
    13051305  ahci_exec_iorb(iorb, 1, cmd_func(iorb, read));
    1306 } 
     1306}
    13071307
    13081308/******************************************************************************
     
    13441344        ((IORB_ADAPTER_PASSTHRU _far *) iorb)->ControllerCmdLen,
    13451345        "ahci_execute_cdb(%d.%d.%d)", a, p, d);
    1346  
     1346
    13471347  if (ad_infos[a].ports[p].devs[d].atapi) {
    13481348    ahci_exec_iorb(iorb, 0, atapi_execute_cdb);
     
    13611361  int p = iorb_unit_port(iorb);
    13621362  int d = iorb_unit_device(iorb);
    1363  
     1363
    13641364  dphex(((IORB_ADAPTER_PASSTHRU _far *) iorb)->pControllerCmd,
    13651365        ((IORB_ADAPTER_PASSTHRU _far *) iorb)->ControllerCmdLen,
    13661366        "ahci_execute_cdb(%d.%d.%d)", a, p, d);
    1367  
     1367
    13681368  if (ad_infos[a].ports[p].devs[d].atapi) {
    13691369    iorb_seterr(iorb, IOERR_CMD_NOT_SUPPORTED);
  • trunk/src/os2ahci/libc.c

    r14 r25  
    4545/* -------------------------- function prototypes -------------------------- */
    4646
    47 static void      long_to_asc            (long val, char _far *buf, int base,
    48                                          int zero, int flen);
    49 static void _far mdelay_timer_callback  (ULONG timer_handle, ULONG parm1,
    50                                          ULONG parm2);
    51 static int       mdelay_cal_end         (void);
     47static void                long_to_asc            (long val,
     48                                                   char _far *buf,
     49                                                   int base,
     50                                                   int zero, int flen);
     51static void APIENTRY  _far  mdelay_timer_callback  (ULONG timer_handle,
     52                                                   ULONG parm1,
     53                                                   ULONG parm2);
     54static int                 mdelay_cal_end         (void);
    5255
    5356/* ------------------------ global/static variables ------------------------ */
     
    140143        }
    141144      }
    142      
     145
    143146      /* data type modifiers */
    144147      lmod = (*fmt == 'l') ? 1 : 0;
     
    161164
    162165      case 'c':
    163         *(buf++) = (char) va_arg(va, int); 
     166        *(buf++) = (char) va_arg(va, int);
    164167        break;
    165168
     
    246249     * definitions, it's safer and easier to put the whole thing
    247250     * into an _asm block.
    248      * 
     251     *
    249252     * The C equivalent would look like this:
    250253     *
     
    279282{
    280283  va_list va;
    281  
     284
    282285  va_start(va, fmt);
    283286  vprintf(fmt, va);
     
    296299  va_list va;
    297300  size_t len;
    298  
     301
    299302  va_start(va, fmt);
    300303  vsprintf(buf, fmt, va);
     
    476479        return(heap_buf + (n - units) * HEAP_UNIT);
    477480      }
    478      
     481
    479482      /* keep searching... */
    480483      i = n;
     
    536539
    537540  dprintf("calibrating delay loop... ");
     541
     542  _asm int 3;
    538543
    539544  mdelay_loops_per_ms = 100000;
     
    727732 * Timer callback handler for 'mdelay_calibrate()'
    728733 */
    729 static void _far mdelay_timer_callback(ULONG timer_handle, ULONG parm1,
    730                                        ULONG parm2)
     734static void APIENTRY  _far mdelay_timer_callback(ULONG timer_handle,
     735                                                ULONG parm1,
     736                                                ULONG parm2)
    731737{
    732738  mdelay_cal_status = MD_CALIBRATION_END;
  • trunk/src/os2ahci/os2ahci.c

    r24 r25  
    9494 */
    9595USHORT _cdecl c_strat(RPH _far *req)
    96 { 
     96{
    9797  u16 rc;
    9898
     
    237237      goto init_fail;
    238238    }
    239    
     239
    240240    /* allocate context hooks */
    241241    if (DevHelp_AllocateCtxHook(mk_NPFN(restart_hook), &restart_ctxhook_h) != 0 ||
     
    285285 *       details.
    286286 */
    287 void _far _loadds add_entry(IORBH _far *first_iorb)
     287void _far APIENTRY _loadds add_entry(IORBH _far *first_iorb)
    288288{
    289289  IORBH _far *iorb;
     
    315315      int p = iorb_unit_port(iorb);
    316316      int d = iorb_unit_device(iorb);
    317      
     317
    318318      if (a >= ad_info_cnt ||
    319319          p > ad_infos[a].port_max ||
     
    559559
    560560  switch (iorb->CommandModifier) {
    561  
     561
    562562  case IOCM_ABORT:
    563563    /* abort all pending commands on specified port and device */
     
    577577    DevHelp_ArmCtxHook(0, reset_ctxhook_h);
    578578    break;
    579    
     579
    580580  case IOCM_SUSPEND:
    581581  case IOCM_RESUME:
     
    842842    ahci_write(iorb);
    843843    break;
    844    
     844
    845845  default:
    846846    iorb_seterr(iorb, IOERR_CMD_NOT_SUPPORTED);
     
    952952  return(!found);
    953953}
    954        
     954
    955955/******************************************************************************
    956956 * Set the error code in the specified IORB
    957  * 
     957 *
    958958 * NOTE: This function does *not* call iorb_done(). It merely sets the IORB
    959959 *       status to the specified error code.
     
    10231023
    10241024/******************************************************************************
    1025  * small_code_ - this dummy func resolves the undefined reference linker 
     1025 * small_code_ - this dummy func resolves the undefined reference linker
    10261026 * error that occurrs when linking WATCOM objects with DDK's link.exe
    10271027 */
  • trunk/src/os2ahci/os2ahci.h

    r24 r25  
    164164 *  mapping                   comment
    165165 *  -----------------------------------------------------------------------
    166  *  4 bits for the adapter    current max is 8 adapters 
     166 *  4 bits for the adapter    current max is 8 adapters
    167167 *  4 bits for the port       AHCI spec defines up to 32 ports
    168168 *  4 bits for the device     SATA spec defines up to 15 devices behind PMP
     
    350350/* os2ahci.c */
    351351extern USHORT  init_drv               (RPINITIN _far *req);
    352 extern void _far _loadds add_entry    (IORBH _far *iorb);
     352extern void _far APIENTRY _loadds add_entry    (IORBH _far *iorb);
    353353extern void    trigger_engine         (void);
    354354extern int     trigger_engine_1       (void);
Note: See TracChangeset for help on using the changeset viewer.