Changeset 133 for trunk


Ignore:
Timestamp:
May 16, 2012, 10:19:24 AM (13 years ago)
Author:
Markus Thielen
Message:
  • (#13) added IDC entry point to allow switching back to BIOS mode
  • added IDCTEST driver and program for testing the IDC entry point
  • fixed bug in IOCTL handling (missing 'break')
Location:
trunk/src
Files:
8 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/Makefile

    r125 r133  
    5050!endif
    5151
    52 CC_INCLUDE   = -I$(DDK)\base\h \
     52CC_INCLUDE   = -I..\include \
     53               -I$(DDK)\base\h \
    5354               -I$(DDK)\base\ibmh \
    5455               -I$(DDK)\base\src\dev\dasd\diskh \
     
    7879           ctxhook.obj apm.obj ioctl.obj trace.obj
    7980
    80 INCS     = os2ahci.h ahci.h version.h
     81INCS     = os2ahci.h ahci.h version.h ioctl.h ..\include\ahci-idc.h
    8182
    8283
     
    122123        etags.exe $(SRCS) $(INCS) $(DDK)\base\src\dev\dasd\diskh\dhcalls.h \
    123124        $(DDK)\base\src\dev\dasd\diskh\iorb.h \
    124         $(DDK)\base\h\bsedos16.h
     125        $(DDK)\base\h\bsedos16.h \
     126        $(DDK)\base\h\devcmd.h \
     127        $(DDK)\base\h\reqpkt.h
    125128
    126129bldday.h:
  • trunk/src/os2ahci/init.asm

    r128 r133  
    66
    77; -----------------------------------------------------------------------------
     8; Constants
     9                DEV_IDC  EQU    0400h        ;  IDC bit for ADD flags
     10       
     11; -----------------------------------------------------------------------------
    812; Public symbols
    913
    1014                PUBLIC  _asm_strat           ; low-level strategy routine
     15                PUBLIC  _asm_idc_entry       ; low-level IDC entry point
    1116                PUBLIC  _readl               ; MMIO read (32 bits)
    1217                PUBLIC  _writel              ; MMIO write (32 bits)
     
    2934DEVHDR          SEGMENT WORD PUBLIC 'DATA'
    3035_dev_hdr        dd      _legacy_hdr             ; next device header
    31                 dw      DEVLEV_3 + DEV_CHAR_DEV ; flags for ADD drivers
     36                dw      DEVLEV_3 + DEV_CHAR_DEV + DEV_IDC ; flags for ADD drivers
    3237                dw      OFFSET _asm_strat       ; strategy routine
    33                 dw      0                       ; no IDC routine
     38                dw      OFFSET _asm_idc_entry   ; IDC entry point
    3439                db      "OS2AHCI$"              ; name of character device
    3540                dq      0                       ; 8 reserved bytes
     
    4045                dw      DEVLEV_3 + DEV_CHAR_DEV ; flags for ADD drivers
    4146                dw      OFFSET _asm_strat       ; strategy routine
    42                 dw      0                       ; no IDC routine
     47                dw      0                       ; IDC entry point
    4348                db      "IBMS506$"              ; name of character device
    4449                dq      0                       ; 8 reserved bytes
     
    129134                RET
    130135_asm_strat      ENDP
     136
     137
     138; IDC entry point (Assembler stub)
     139_asm_idc_entry  PROC    FAR
     140       
     141                ; push request packet address
     142                PUSH    ES
     143                PUSH    BX
     144                CLD
     145
     146                ; call C IDC entry point - which is the strategy routine
     147                CALL    _c_strat
     148
     149                POP     BX
     150                POP     ES
     151                MOV     WORD PTR ES:[BX+3], AX
     152                RET
     153_asm_idc_entry  ENDP
    131154
    132155                .386
  • trunk/src/os2ahci/os2ahci.c

    r131 r133  
    124124 * for initialization purposes; all other calls go directly to the adapter
    125125 * device driver's strategy function.
     126 *
     127 * NOTE: this is also used as the IDC entry point. We expect an IOCTL request
     128 *       packet for IDC calls, so they can be handled by gen_ioctl.
    126129 */
    127130USHORT _cdecl c_strat(RPH _far *req)
     
    247250      case 'r':
    248251        /* reset ports during initialization */
    249         init_reset = 1;
     252        init_reset = 1;
    250253        break;
    251254
     
    427430
    428431    }
     432    break;
     433
     434  case OS2AHCI_IDC_CATEGORY:
     435    switch (ioctl->Function) {
     436
     437    case OS2AHCI_IDC_BIOSMODE:
     438      /* reconfigure adapters in BIOS/int13 mode; needed for generating
     439       * trap dumps on some machines. This is called by ACPI.PSD.
     440       *
     441       * To enter BIOS mode, we flush all write caches, turn off interrupts
     442       * and restore the BIOS configuration. This is exactly what
     443       * apm_suspend() does.
     444       */
     445      apm_suspend();
     446      return(STDON);
     447
     448    case OS2AHCI_IDC_BEEP:
     449      /* IOCTL for IDC testing - just beep */
     450      DevHelp_Beep(2000, 100);
     451      return(STDON);
     452    }
     453    break;
    429454
    430455  case DSKSP_CAT_GENERIC:
  • trunk/src/os2ahci/os2ahci.h

    r125 r133  
    6363
    6464#include "ahci.h"
     65#include "ahci-idc.h"
    6566#include "version.h"
    6667
  • trunk/src/os2ahci/version.h

    r128 r133  
    1414
    1515
    16 #define VERSION            122       /* driver version (2 implied decimals) */
     16#define VERSION            123       /* driver version (2 implied decimals) */
    1717
Note: See TracChangeset for help on using the changeset viewer.