Ignore:
Timestamp:
Jul 6, 2011, 10:02:47 AM (14 years ago)
Author:
Markus Thielen
Message:
  • removed RAS calls (tracing to OS/2 kernel trace buffer was unreliable)
  • added private trace ring buffer implementation
  • support read from OS2AHCI$ character device
  • contents of trace ring buffer are accesible via OS2AHCI$ character device
  • updated WATCOM makefile; WATCOM build still produces a non-working driver
  • code cleanup (unused variables etc.)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/libc.c

    r111 r112  
    5858                                                ULONG parm2);
    5959static int              mdelay_cal_end         (void);
    60 static int              trace_enabled          (void);
    6160
    6261/* ------------------------ global/static variables ------------------------ */
     
    6766static char  hex_digits[] = "0123456789abcdef";
    6867static ULONG mem_lock;
    69 static ULONG com_lock;
     68ULONG com_lock;
    7069
    7170/* message table for DosHelp_Save_Message() which prints the first string */
     
    283282
    284283   if (com_base == 0) {
    285     /* write debug message to trace buffer, not COM port */
    286     trace(debug, len, buf);
    287     spin_unlock(com_lock);
    288     return;
    289   }
     284     /* write debug message to trace buffer, not COM port */
     285     trace_write(buf, len);
     286     spin_unlock(com_lock);
     287     return;
     288   }
    290289
    291290  /* write debug message to serial port */
     
    367366 * Print hex buffer to COM port.
    368367 */
    369 void phex(const void _far *p, int len, u16 trace_minor_code, const char *fmt, ...)
     368void phex(const void _far *p, int len, const char *fmt, ...)
    370369{
    371370  va_list va;
     
    374373
    375374  if (!debug) {
    376     return;
    377   }
    378 
    379   if (!com_base) {
    380     /* dump to kernel trace buffer, not serial port;
    381      * just dump the buffer, it is formatted by TRACEFMT
    382      *
    383      * NOTE: writing the header to the trace buffer causes
    384      *       the trace facility to hick up and swallow the
    385      *       binary data that follows...
    386      */
    387     trace(trace_minor_code, len, buf);
    388375    return;
    389376  }
     
    866853}
    867854
    868 /******************************************************************************
    869  * is_trace_enabled - checks if kernel tracing is enabled
    870  */
    871 int is_trace_enabled(void)
    872 {
    873   int ret = 1; /* if global info seg is not present/known,
    874                 * we enable tracing for now */
    875 
    876   /* check global info segment's trace enabled bitmap if our
    877    * major trace code is enabled
    878    */
    879   if (gis) {
    880     u8 trace_bitmap = gis->amecRAS[AHCI_TRACE_MAJOR / 8];
    881     if (trace_bitmap & (0x80 >> (AHCI_TRACE_MAJOR % 8))) {
    882       ret = 1;
    883     } else {
    884       ret = 0;
    885     }
    886   }
    887 
    888   return ret;
    889 }
    890 
    891 /******************************************************************************
    892  * trace - write a buffer to the kernel trace buffer
    893  */
    894 void trace(u16 minor_code, u16 cb_buf, const char _far *buf)
    895 {
    896   if (!is_trace_enabled()) {
    897     return;
    898   }
    899 
    900   DevHelp_RAS(AHCI_TRACE_MAJOR, minor_code, cb_buf, (PBYTE) buf);
    901 }
    902 
Note: See TracChangeset for help on using the changeset viewer.