Browse Source

Added files from BSDero

master
Kazuo Kuroi 8 months ago
parent
commit
4fe294b049
  1. 129
      Makefile
  2. BIN
      SGIUSB.gif
  3. BIN
      SGIUSB.png
  4. 55
      X11display.c
  5. 47
      X11display.h
  6. 104
      X11window.c
  7. 52
      X11window.h
  8. 73
      arrstr.c
  9. 41
      arrstr.h
  10. 235
      build.sh
  11. 41
      clean.sh
  12. 31
      config.h.in
  13. BIN
      cscope.in.out
  14. 300770
      cscope.out
  15. BIN
      cscope.po.out
  16. 263
      dma.c
  17. 133
      dumphex.c
  18. 194
      ehcireg.h
  19. 41
      fixme.c
  20. 171
      gc.c
  21. 98
      genhelp.sh
  22. 28
      kmaddr.c
  23. 208
      kutils.c
  24. 116
      kvarr.c
  25. 49
      kvarr.h
  26. 78
      list.c
  27. 54
      load_usb.sh
  28. 31
      out_uhci_enum.txt
  29. 90
      queue.c
  30. 108
      rundiag.sh
  31. 123
      testu.c
  32. 59
      trace.c
  33. 125
      uhcireg.h
  34. 55
      unload_usb.sh
  35. 194
      usb.h
  36. 4
      usb.version
  37. 58
      usb4irix.txt
  38. 50
      usb_irix.geany
  39. 1422
      usbcore.c
  40. 271
      usbd.c
  41. 1801
      usbehci.c
  42. 381
      usbhc.h
  43. 942
      usbhub.c
  44. 42
      usbio.h
  45. 740
      usbioctl.h
  46. 1771
      usbtool.c
  47. 2697
      usbuhci.c
  48. 2581
      usbuhci.c.modifix
  49. 2697
      usbuhci.c.original
  50. 2516
      usbuhci.c.working
  51. 343
      xusbnotifier.c

129
Makefile

@ -0,0 +1,129 @@
####################################################################
# USB stack and host controller driver for SGI IRIX 6.5 #
# #
# Programmed by BSDero #
# bsdero at gmail dot com #
# 2011/2012 #
# #
# #
# File: Makefile #
# Description: User binaries makefile #
# #
####################################################################
#############################################################################################
# Fixlist (Latest at top) #
#############################################################################################
# Author MM-DD-YYYY Description #
#############################################################################################
# BSDero 01-25-2013 -Added robodoc auto documentation and cscope #
# database generation #
# -Added distclean target #
# #
# BSDero 10-08-2012 -Added usbd #
# -Fixed bug with xusbnotifier #
# #
# BSDero 09-12-2012 -Added xusbnotifier #
# #
# BSDero 07-19-2012 -Initial version #
# #
#############################################################################################
CC=/usr/bin/c99
DIS=/usr/bin/dis
DISFLAGS=-f -I. -L -S -h -x -s -w
CFLAGS=-D_IRIX_ -g -I./
CLIBS=-L/usr/lib/X11 -lX11
ALL=allfiles
#############################################################
all: $(ALL)
allfiles: usbtoolfiles xusbnotifierfiles usbdfiles cscopedb
##########################################################
# usbd
usbdfiles: usbd usbd.s usbd.disam
usbd: usbd.o
$(CC) -o usbd usbd.o
usbd.s:
$(CC) $(CFLAGS) -o usbd.s usbd.c -S
usbd.disam: usbd.o
$(DIS) $(DISFLAGS) usbd.o>usbd.disam
##########################################################
# usbtool
usbtoolfiles: usbtool usbtool.s usbtool.disam
usbtool: usbtool.o kvarr.o
$(CC) -o usbtool usbtool.o kvarr.o
usbtool.s:
$(CC) $(CFLAGS) -o usbtool.s usbtool.c -S
usbtool.disam: usbtool.o
$(DIS) $(DISFLAGS) usbtool.o>usbtool.disam
##########################################################
# xusbnotifier
xusbnotifierfiles: xusbnotifier xusbnotifier.s xusbnotifier.disam
xusbnotifier: xusbnotifier.o X11display.o X11window.o arrstr.o
$(CC) -o xusbnotifier xusbnotifier.o X11display.o X11window.o arrstr.o $(CLIBS)
xusbnotifier.s:
$(CC) -o xusbnotifier.s xusbnotifier.c -S
xusbnotifier.disam: xusbnotifier.o
$(DIS) $(DISFLAGS) xusbnotifier.o>xusbnotifier.disam
##########################################################
# object files
arrstr.o: arrstr.c
$(CC) -c arrstr.c
X11display.o: X11display.c
$(CC) -c X11display.c $(CFLAGS)
X11window.o: X11window.c
$(CC) -c X11window.c $(CFLAGS)
xusbnotifier.o: xusbnotifier.c
$(CC) -c xusbnotifier.c $(CFLAGS)
usbtool.o:
$(CC) $(CFLAGS) -c usbtool.c
kvarr.o:
$(CC) $(CFLAGS) -c kvarr.c
usbd.o:
$(CC) $(CFLAGS) -c usbd.c
api.html:
robodoc --src ./ --doc api --singledoc --html
cscopedb:
cscope -R -b -q
distclean: clean
@rm -rf cscope.*
@rm -rf filelist
clean:
@rm -rf *.o
@rm -rf *.s
@rm -rf *.disam
@rm -rf usbtool
@rm -rf xusbnotifier
@rm -rf usbd
@rm -rf *.bck

BIN
SGIUSB.gif

After

Width: 167  |  Height: 80  |  Size: 590 B

BIN
SGIUSB.png

After

Width: 542  |  Height: 260  |  Size: 6.8 KiB

55
X11display.c

@ -0,0 +1,55 @@
/*
********************************************************************
* USB stack and host controller driver for SGI IRIX 6.5 *
* *
* Programmed by BSDero *
* bsdero at gmail dot com *
* 2011/2012 *
* *
* *
* File: X11display.c *
* Description: X11 display basic functions code *
********************************************************************
*******************************************************************************************************
* FIXLIST (latest at top) *
*-----------------------------------------------------------------------------------------------------*
* Author MM-DD-YYYY Description *
*-----------------------------------------------------------------------------------------------------*
* BSDero 09-10-2012 -Initial version *
* *
*******************************************************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include "X11display.h"
int X11_display_init( X11_display_t *display){
/* First connect to the display server, as specified in the DISPLAY
environment variable. */
display->dpy = XOpenDisplay(NULL);
if (!display->dpy) {
fprintf(stderr, "unable to connect to display ");
return( -1);
}
/* these are macros that pull useful data out of the display object */
/* we use these bits of info enough to want them in their own variables */
display->screen_num = DefaultScreen(display->dpy);
display->width = DisplayWidth( display->dpy, DefaultScreen( display->dpy));
display->height = DisplayHeight( display->dpy, DefaultScreen( display->dpy));
display->cl_border = WhitePixel( display->dpy, display->screen_num);
display->cl_background = BlackPixel( display->dpy, display->screen_num);
return( 0);
}
int X11_display_close( X11_display_t *display){
XCloseDisplay(display->dpy);
return(0);
}

47
X11display.h

@ -0,0 +1,47 @@
/*
********************************************************************
* USB stack and host controller driver for SGI IRIX 6.5 *
* *
* Programmed by BSDero *
* bsdero at gmail dot com *
* 2011/2012 *
* *
* *
* File: X11display.h *
* Description: X11 display basic functions header *
********************************************************************
*******************************************************************************************************
* FIXLIST (latest at top) *
*-----------------------------------------------------------------------------------------------------*
* Author MM-DD-YYYY Description *
*-----------------------------------------------------------------------------------------------------*
* BSDero 09-10-2012 -Initial version *
* *
*******************************************************************************************************
*/
#ifndef _X11DISPLAY_H_
#define _X11DISPLAY_H_
/* first include the standard headers that we're likely to need */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include <X11/keysymdef.h>
#include <X11/cursorfont.h>
#define MOUSE_ALL_EVENTS_MASK ( ButtonPressMask | ButtonReleaseMask | PointerMotionMask | EnterWindowMask | LeaveWindowMask)
#define WINDOW_ALL_EVENTS_MASK ( StructureNotifyMask | ExposureMask | SubstructureNotifyMask)
#define KEYBOARD_ALL_EVENTS_MASK ( KeyPressMask | KeyReleaseMask )
typedef struct{
Display *dpy;
int width, height;
int screen_num;
unsigned long cl_background, cl_border;
}X11_display_t;
int X11_display_init( X11_display_t *display);
int X11_display_close( X11_display_t *display);
#endif

104
X11window.c

@ -0,0 +1,104 @@
/*
********************************************************************
* USB stack and host controller driver for SGI IRIX 6.5 *
* *
* Programmed by BSDero *
* bsdero at gmail dot com *
* 2011/2012 *
* *
* *
* File: X11window.c *
* Description: X11 windows basic functions code *
********************************************************************
*******************************************************************************************************
* FIXLIST (latest at top) *
*-----------------------------------------------------------------------------------------------------*
* Author MM-DD-YYYY Description *
*-----------------------------------------------------------------------------------------------------*
* BSDero 09-10-2012 -Initial version *
* *
*******************************************************************************************************
*/
#include "X11window.h"
#include <string.h>
int X11_window_init( X11_display_t *display, X11_window_t *window){
memset( (void *) window, 0, sizeof( X11_window_t));
window->display = display;
window->cl_border = display->cl_border;
window->cl_background = display->cl_background;
return(0);
}
int X11_window_set_geometry( X11_window_t *window, int width, int height, int posx, int posy, int border_width){
window->posx = posx;
window->posy = posy;
window->width = width;
window->height = height;
window->sz_border = border_width;
return(0);
}
int X11_window_set_colors( X11_window_t *window, unsigned long cl_border, unsigned long int cl_background){
window->cl_border = cl_border;
window->cl_background = cl_background;
return(0);
}
int X11_window_set_mask( X11_window_t *window, unsigned long mask){
window->event_mask = mask;
return(0);
}
int X11_window_display( X11_window_t *window){
window->win = XCreateSimpleWindow( window->display->dpy, DefaultRootWindow( window->display->dpy), /* display, parent */
window->posx, window->posy, /* x, y: the window manager will place the window elsewhere */
window->width, window->height, /* width, height */
window->sz_border, window->cl_border, /* border width & colour, unless you have a window manager */
window->cl_background); /* background colour */
/* tell the display server what kind of events we would like to see */
XSelectInput( window->display->dpy, window->win, window->event_mask );
/* okay, put the window on the screen, please */
XMapWindow( window->display->dpy, window->win);
XMoveWindow( window->display->dpy, window->win, window->posx, window->posy);
XFlush( window->display->dpy);
return(0);
}
int X11_window_close( X11_window_t *window){
XUnmapWindow( window->display->dpy , window->win);
return(0);
}
int X11_window_destroy( X11_window_t *window){
XDestroyWindow( window->display->dpy , window->win);
return(0);
}
unsigned long int X11_window_get_next_event( X11_window_t *window){
XNextEvent( window->display->dpy, &window->ev);
return( window->ev.type);
}
int X11_window_set_wm_name( X11_window_t *window, char *window_title){
XSizeHints xsh; /* Size hints for window manager */
xsh.flags = (PPosition|PSize);
xsh.height = window->height;
xsh.width = window->width;
xsh.x = window->posx;
xsh.y = window->posy;
XSetStandardProperties(window->display->dpy, window->win, window_title, window_title, None, NULL, 0, &xsh);
return(0);
}

52
X11window.h

@ -0,0 +1,52 @@
/*
********************************************************************
* USB stack and host controller driver for SGI IRIX 6.5 *
* *
* Programmed by BSDero *
* bsdero at gmail dot com *
* 2011/2012 *
* *
* *
* File: X11window.h *
* Description: X11 windows basic functions header *
********************************************************************
*******************************************************************************************************
* FIXLIST (latest at top) *
*-----------------------------------------------------------------------------------------------------*
* Author MM-DD-YYYY Description *
*-----------------------------------------------------------------------------------------------------*
* BSDero 09-10-2012 -Initial version *
* *
*******************************************************************************************************
*/
#ifndef _X11WINDOW_H_
#define _X11WINDOW_H_
#include "X11display.h"
typedef struct{
X11_display_t *display;
Window win;
int posx, posy, width, height;
int sz_border;
unsigned long cl_background, cl_border;
unsigned long event_mask;
XEvent ev;
}X11_window_t;
int X11_window_init( X11_display_t *display, X11_window_t *window);
int X11_window_set_geometry( X11_window_t *window, int width, int height, int posx, int posy, int border_width);
int X11_window_set_colors( X11_window_t *window, unsigned long cl_border, unsigned long int cl_background);
int X11_window_set_mask( X11_window_t *window, unsigned long mask);
int X11_window_display( X11_window_t *window);
int X11_window_close( X11_window_t *window);
int X11_window_destroy( X11_window_t *window);
unsigned long int X11_window_get_next_event( X11_window_t *window);
int X11_window_set_wm_name( X11_window_t *window, char *window_title);
#endif

73
arrstr.c

@ -0,0 +1,73 @@
/*
********************************************************************
* USB stack and host controller driver for SGI IRIX 6.5 *
* *
* Programmed by BSDero *
* bsdero at gmail dot com *
* 2011/2012 *
* *
* *
* File: arrstr.c *
* Description: String array basic functions *
********************************************************************
*******************************************************************************************************
* FIXLIST (latest at top) *
*-----------------------------------------------------------------------------------------------------*
* Author MM-DD-YYYY Description *
*-----------------------------------------------------------------------------------------------------*
* BSDero 09-13-2012 -Initial version *
* *
*******************************************************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include "arrstr.h"
void arrstr_init( arrstr_t *arr, int max){
memset( (void *) arr, 0, sizeof( arrstr_t));
if( max >= MAX_STRINGS)
max = MAX_STRINGS;
arr->max = max;
}
void arrstr_destroy( arrstr_t *arr){
int i;
for( i = 0; i < arr->max; i++){
if( arr->str[i] != NULL)
free( arr->str[i]);
}
arrstr_init( arr, MAX_STRINGS);
}
void arrstr_add( arrstr_t *arr, char *str){
int i;
if( arr->str[0] != NULL)
free( arr->str[0]);
for( i = 0; i < ( arr->max - 1); i++){
arr->str[i] = arr->str[i + 1];
}
arr->str[i] = strdup( str);
}
void arrstr_dump( arrstr_t *arr){
int i;
printf("DUMP\n");
for( i = 0; i < arr->max; i++){
if( arr->str[i] == NULL)
printf("%d : NULL\n", i);
else
printf("%d : %s\n", i, arr->str[i]);
}
}

41
arrstr.h

@ -0,0 +1,41 @@
/*
********************************************************************
* USB stack and host controller driver for SGI IRIX 6.5 *
* *
* Programmed by BSDero *
* bsdero at gmail dot com *
* 2011/2012 *
* *
* *
* File: arrstr.h *
* Description: String array basic functions header *
********************************************************************
*******************************************************************************************************
* FIXLIST (latest at top) *
*-----------------------------------------------------------------------------------------------------*
* Author MM-DD-YYYY Description *
*-----------------------------------------------------------------------------------------------------*
* BSDero 09-13-2012 -Initial version *
* *
*******************************************************************************************************
*/
#ifndef _ARRSTR_H_
#define _ARRSTR_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_STRINGS 8
typedef struct{
int max;
char *str[MAX_STRINGS];
}arrstr_t;
void arrstr_init( arrstr_t *arr, int max);
void arrstr_destroy( arrstr_t *arr);
void arrstr_add( arrstr_t *arr, char *str);
void arrstr_dump( arrstr_t *arr);
#endif

235
build.sh

@ -0,0 +1,235 @@
#! /bin/sh
####################################################################
# USB stack and host controller driver for SGI IRIX 6.5 #
# #
# Programmed by BSDero #
# bsdero at gmail dot com #
# 2011/2012 #
# #
# #
# File: build.sh #
# Description: Build script #
####################################################################
#############################################################################################
# Fixlist (Latest at top) #
#############################################################################################
# Author MM-DD-YYYY Description #
#############################################################################################
# BSDero 07-23-2012 -Updated interpreter, now it should run with /bin/sh instead #
# /usr/nekoware/bin/bash #
# #
# BSDero 07-19-2012 -Added support for assembler and disassembled files. Now #
# core dumps should be easier to read #
# -Added clean.sh script #
# -Added Makefile support for usb tools #
# -Print warning on incorrect Irix version during builds #
# #
# BSDero 07-05-2012 -Added usbhub module build suport #
# -Added support for build output to files #
# -Fixes to on screen errors during builds. Errors #
# are easier to read now #
# #
# BSDero 06-14-2012 -Removed old tools building #
# -Added usbtool build support #
# #
# BSDero 05-13-2012 -Added usbehci/usbuhci modules build #
# #
# BSDero 03-12-2012 -Added unit tests build #
# -Added USBcore build #
# -Added config.h generation #
# #
# BSDero 01-09-2012 -Will use c99 compiler #
# #
# BSDero 01-15-2012 -Added config.h generation support #
# #
# BSDero 01-09-2012 -Will use c99 compiler #
# #
# BSDero 01-04-2012 -Initial version #
# #
#############################################################################################
echo "**************************************************************"
echo "* USB IRIX *"
echo "* USB stack for SGI Irix 6.5 *"
echo "* *"
echo "* Programmed by bsdero *"
echo "* <bsdero at gmail dot com> 2011/2012 *"
echo "**************************************************************"
echo "========================================================================"
echo "Configuring build"
OSNAME=`uname -s`
OSVERSION=`uname -r`
CPUARCH=`uname -m`
echo "OS is "$OSNAME $OSVERSION
if [ "$OSVERSION" != "6.5" ]; then
echo "Warning, $OSNAME $OSVERSION detected, these drivers has been"
echo "tested in IRIX 6.5, some errors/crashes may happen..."
fi
echo "Detected "`/sbin/hinv -c processor|grep CPU`
CPUTYPE=`/sbin/hinv -c processor|head -1|awk '{ print $4}'`
export CPUBOARD=$CPUTYPE
echo "Building for "$CPUBOARD
CC=/usr/bin/c99
DIS=/usr/bin/dis
DISFLAGS="-f -I. -L -S -h -x -s -w"
###################################################################
# GLOBAL - use these for all IRIX device drivers #
###################################################################
CFLAGS="-D_KERNEL -DMP_STREAMS -D_MP_NETLOCKS -DMRSP_AS_MR \
-fullwarn -non_shared -G 0 -TARG:force_jalr \
-TENV:kernel -OPT:space -OPT:Olimit=0 -CG:unique_exit=on \
-TENV:X=1 align_aggregate -OPT:IEEE_arithmetic=1 -OPT:roundoff=0 \
-OPT:wrap_around_unsafe_opt=off -g"
###################################################################
# 32-bit - for device drivers on 32-bit systems #
###################################################################
if [[ "$CPUBOARD" == "IP20" || "$CPUBOARD" == "IP22" || "$CPUBOARD" == "IP32" ]]; then
CFLAGS+=" -n32 -D_PAGESZ=4096"
###################################################################
# 64-bit - for device drivers on 64-bit systems #
###################################################################
#else /* !(IP20||IP22||IP32) */
else
CFLAGS=$CFLAGS" -64 -D_PAGESZ=16384 -D_MIPS3_ADDRSPACE "
fi
#/* IP20||IP22||IP32 */
###################################################################
# Platform specific - for device drivers on the indicated machine #
###################################################################
if [ "$CPUBOARD" == "IP19" ]; then
CFLAGS+=" -DIP19 -DEVEREST -DMP -DR4000"
fi
if [ "$CPUBOARD" == "IP20" ]; then
CFLAGS+=" -DIP20 -DR4000 -DJUMP_WAR -DBADVA_WAR"
fi
if [ "$CPUBOARD" == "IP21" ]; then
CFLAGS+=" -DIP21 -DEVEREST -DMP -DTFP -TARG:processor=r8000"
fi
if [ "$CPUBOARD" == "IP22" ]; then
CFLAGS+=" -DIP22 -DR4000 -DJUMP_WAR -DBADVA_WAR -DTRITON"
fi
if [ "$CPUBOARD" == "IP25" ]; then
CFLAGS+=" -DIP25 -DEVEREST -DMP -DR10000 -TARG:processor=r10000"
fi
if [ "$CPUBOARD" == "IP26" ]; then
CFLAGS+=" -DIP26 -DTFP -TARG:sync=off -TARG:processor=r8000"
fi
if [ "$CPUBOARD" == "IP27" ]; then
CFLAGS+=" -DIP27 -DR10000 -DMP -DSN0 -DSN \
-DMAPPED_KERNEL -DLARGE_CPU_COUNT -DPTE_64BIT -DULI -DCKPT -DMIPS4_ISA \
-DR10K_LLSC_WAR -DNUMA_BASE -DNUMA_PM -DNUMA_TBORROW -DNUMA_MIGR_CONTROL \
-DNUMA_REPLICATION -DNUMA_REPL_CONTROL -DNUMA_SCHED -DCELL_PREPARE \
-DBHV_PREPARE -TARG:processor=r10000"
fi
if [ "$CPUBOARD" == "IP28" ]; then
# All Indigo2 10000 kernel modules must be built with the t5_no_spec_stores
# option to the C compiler and assembler.
CFLAGS+=" -DIP28 -DR10000 -DSCACHE_SET_ASSOC=2 -D_NO_UNCACHED_MEM_WAR \
-DR10000_SPECULATION_WAR \
-TARG:processor=r10000 -TARG:t5_no_spec_stores "
fi
if [ "$CPUBOARD" == "IP30" ]; then
CFLAGS+=" -DIP30 -DR10000 -DMP -DCELL_PREPARE -DBHV_PREPARE \
-TARG:processor=r10000 "
fi
#O2
if [ "$CPUBOARD" == "IP32" ]; then
CFLAGS+=" -DIP32 -DR4000 -DR10000 -DTRITON -DUSE_PCI_PIO -c99 "
fi
if [ "$CPUBOARD" == "IP35" ]; then
CFLAGS=$CFLAGS" -DIP35 -DR10000 -DMP -DSN1 -DSN \
-DMAPPED_KERNEL -DLARGE_CPU_COUNT -DPTE_64BIT -DULI -DCKPT -DMIPS4_ISA \
-DNUMA_BASE -DNUMA_PM -DNUMA_TBORROW -DNUMA_MIGR_CONTROL \
-DNUMA_REPLICATION -DNUMA_REPL_CONTROL -DNUMA_SCHED -DCELL_PREPARE \
-DBHV_PREPARE -TARG:processor=r10000 "
fi
##################################################################################
# Clean files
##################################################################################
./clean.sh
##################################################################################
# Creation of config.h
##################################################################################
DESCRIPTION_FILE="usb.version"
CONFIG_H_IN_FILE="config.h.in"
CONFIG_H_FILE="config.h"
SHORTNAME=`cat $DESCRIPTION_FILE|grep SHORTNAME|awk -F= '{print $2}'|sed "s/\n//g"`
LONGNAME=`cat $DESCRIPTION_FILE|grep LONGNAME|awk -F= '{print $2}'|sed "s/\n//g"`
VERSION=`cat $DESCRIPTION_FILE|grep VERSION|awk -F= '{print $2}'|sed "s/\n//g"`
SHORTVERSION=`echo $VERSION|sed "s/\.//g"|sed "s/\n//g"`
SEQ=`date "+%H%M%S%m%d%Y"`
BUILDDATE=`date "+%c"`
cat $CONFIG_H_IN_FILE>$CONFIG_H_FILE
echo "#define USBCORE_DRV_SHORT_NAME \"$SHORTNAME\"">>$CONFIG_H_FILE
echo "#define USBCORE_DRV_LONG_NAME \"$LONGNAME\"">>$CONFIG_H_FILE
echo "#define USBCORE_DRV_VERSION \"$VERSION\"">>$CONFIG_H_FILE
echo "#define USBCORE_DRV_SHORT_VERSION \"$SHORTVERSION\"">>$CONFIG_H_FILE
echo "#define USBCORE_DRV_SEQ \"$SEQ\"">>$CONFIG_H_FILE
echo "#define USBCORE_DRV_BUILD_DATE \"$BUILDDATE\"">>$CONFIG_H_FILE
echo >>$CONFIG_H_FILE
echo >>$CONFIG_H_FILE
echo "========================================================================"
echo "Building kernel modules"
DRIVER_MODULES="usbcore usbhub usbehci usbuhci"
for MODULE in $DRIVER_MODULES; do
SRC=$MODULE".c"
echo "========================================================================"
echo "Building $MODULE"
# echo "$CC $CFLAGS -c $SRC"
echo "$CC $CFLAGS -c $SRC" > $MODULE".build.output"
$CC $CFLAGS -c $SRC >> $MODULE".build.output" 2>&1
ERRORS=`grep "detected in the compilation of" $MODULE".build.output"`
if [ "$ERRORS" != "" ]; then
echo $ERRORS
grep -n ERROR $MODULE".build.output"| awk -F: '{ print $1+5}' | while read n; do
head -n $n $MODULE".build.output"| tail -6
echo "---------------------------------------------------"
done
else
echo $MODULE".o" "created"
$CC $CFLAGS -S $SRC 2>/dev/null
echo $MODULE".s" "created"
$DIS $DISFLAGS $MODULE".o" > $MODULE."disam"
echo $MODULE".disam" "created"
fi
done
echo "========================================================================"
echo "Building user programs"
make
echo "Build complete"

41
clean.sh

@ -0,0 +1,41 @@
#! /bin/sh
####################################################################
# USB stack and host controller driver for SGI IRIX 6.5 #
# #
# Programmed by BSDero #
# bsdero at gmail dot com #
# 2011/2012 #
# #
# #
# File: clean.sh #
# Description: Clean script #
####################################################################
#############################################################################################
# Fixlist (Latest at top) #
#############################################################################################
# Author MM-DD-YYYY Description #
#############################################################################################
# BSDero 09-12-2012 -Added diaginfo directory removal #
# -Added help.txt file removal #
# #
# BSDero 07-23-2012 -Updated interpreter, now it should run with /bin/sh instead #
# /usr/nekoware/bin/bash #
# #
# BSDero 07-19-2012 -Initial version #
# #
#############################################################################################
##################################################################################
# Clean files
##################################################################################
echo "Cleaning files..."
if [ -e config.h ]; then
rm config.h
fi
make clean
rm -rf *.o *.disam *.s *.build.output
rm -rf diaginfo
rm -rf help.txt
echo "done"

31
config.h.in

@ -0,0 +1,31 @@
/*
********************************************************************
* USB Device Driver for Irix 6.5 *
* *
* Programmed by BSDero *
* bsdero at gmail dot com *
* 2011/2012 *
* *
* *
* File: config.h *
* Description: Build values defines *
* *
* *
********************************************************************
*******************************************************************************************************
* FIXLIST (latest at top) *
*-----------------------------------------------------------------------------------------------------*
* Author MM-DD-YYYY Description *
*-----------------------------------------------------------------------------------------------------*
* BSDero 01-05-2012 -Initial version *
* *
*******************************************************************************************************
WARNING!!!!
DO NOT EDIT THIS FILE, IS AUTOGENERATED!!
*/

BIN
cscope.in.out

300770
cscope.out
File diff suppressed because it is too large
View File

BIN
cscope.po.out

263
dma.c

@ -0,0 +1,263 @@
/*
********************************************************************
* USB stack and host controller driver for SGI IRIX 6.5 *
* *
* Programmed by BSDero *
* bsdero at gmail dot com *
* 2011/2012 *
* *
* *
* File: dma.c *
* Description: DMA utilities *
* *
* *
********************************************************************
*******************************************************************************************************
* FIXLIST (latest at top) *
*-----------------------------------------------------------------------------------------------------*
* Author MM-DD-YYYY Description *
*-----------------------------------------------------------------------------------------------------*
* BSDero 01-29-2013 -Use kmem_zalloc instead kmem_alloc *
* *
* BSDero 02-26-2012 -Separated node information from DMA chunk *
* *
* BSDero 02-24-2012 -Fixed crashed passing a invalid pointer to pciio_dmamap_done() *
* *
* BSDero 01-23-2012 -Removed delays for trace calls *
* *
* BSDero 01-19-2012 -Changed printf calls for TRACE calls *
* *
* BSDero 01-15-2012 -Fixed bugs and crashes *
* *
* BSDero 01-05-2012 -Initial version *
* *
*******************************************************************************************************
*/
typedef uint64_t pciaddr_t;
#define dma_list_init(ptr) gc_list_init(ptr)
#define dma_list_empty(l) gc_list_empty(l)
#define dma_node_get_data_addr(node) (node + sizeof(dma_node_t))
#define offset_of(st, m) ((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
#define kaddr_2_daddr( daddr,kaddr,ofs) (uint32_t) (daddr + ((uint64_t)ofs - (uint64_t)kaddr))
typedef gc_list_t dma_list_t;
typedef struct{
iopaddr_t paddr; /* starting phys addr */
caddr_t kaddr; /* starting kern addr */
pciio_dmamap_t map; /* mapping resources (ugh!) */
pciaddr_t daddr; /* starting pci addr */
size_t bytes; /* size of block in bytes */
uchar_t *mem; /* memory address */
char spaces[12]; /* fill up memory space */
}dma_node_t;
extern int pci_user_dma_max_pages;
dma_node_t *dma_alloc( vertex_hdl_t vhdl, dma_list_t *dma_list, size_t size);
void dma_drain( dma_node_t *dma_node);
void dma_done( dma_node_t *dma_node);
void dma_mark( dma_node_t *dma_node);
void dma_free( dma_node_t *dma_node);
void dma_list_sweep( dma_list_t *dma_list);
void dma_list_destroy( dma_list_t *dma_list);
void dma_list_dump( dma_list_t *dma_list);
void dma_node_dump( dma_node_t *dma_node);
dma_node_t *dma_alloc( vertex_hdl_t vhdl, dma_list_t *dma_list, size_t size){
dma_node_t *dma_node;
void *kaddr = 0;
iopaddr_t paddr;
pciio_dmamap_t dmamap = 0;
size_t bytes = size;
pciaddr_t daddr;
int err = 0;
uchar_t *mem; /* memory address */
unsigned flags = 0;
TRACE( TRC_GC_DMA, 12, "enter", NULL);
/* alloc DMA memory descriptor */
TRACE( TRC_GC_DMA, 12, "user wants 0x%x bytes of DMA, flags 0x%x, sizeof(dma_node_t)=%d",
bytes, flags, sizeof( dma_node_t));
TRACE( TRC_GC_DMA, 12, "allocating descriptor", "");
dma_node = (dma_node_t *) gc_malloc( dma_list, sizeof(dma_node_t));
if( dma_node == NULL){
TRACE( TRC_GC_DMA, 12, "dma descriptor not allocated, return NULL", NULL);
TRACE( TRC_GC_DMA, 12, "exit dma_node=0x%x", dma_node);
return( NULL);
}
bzero( (void *) dma_node, sizeof( dma_node_t));
/* alloc DMA chunk */
mem = ( uchar_t *) kmem_zalloc( size, KM_CACHEALIGN | KM_PHYSCONTIG | KM_SLEEP);
if( mem == NULL){
goto dma_alloc_exit;
}
kaddr = (void *) mem;
TRACE( TRC_GC_DMA, 12, "kaddr = 0x%x, mem = 0x%x", kaddr, mem);
/* conver to physical address */
paddr = kvtophys( kaddr);
/* translate to a pciio_map */
daddr = pciio_dmatrans_addr( vhdl, 0, paddr, size, PCIIO_WORD_VALUES);
/* daddr is the address to pass to device */
if (daddr == 0) { /* "no direct path available" */
TRACE( TRC_GC_DMA, 12, "dmatrans failed, trying dmamap", NULL);
dmamap = pciio_dmamap_alloc( vhdl, 0, size, PCIIO_WORD_VALUES);
if (dmamap == 0) {
TRACE( TRC_GC_DMA, 12, "unable to allocate dmamap", NULL);
kmem_free( (void *) mem, size);
err = 1;
goto dma_alloc_exit; /* "out of mapping resources" */
}
daddr = pciio_dmamap_addr(dmamap, paddr, size);
if (daddr == 0) {
TRACE( TRC_GC_DMA, 12, "dmamap_addr failed", NULL);
kmem_free( (void *) mem, size);
err = 1;
goto dma_alloc_exit; /* "can't get there from here" */
}
}
TRACE( TRC_GC_DMA, 12, "daddr is 0x%08x", daddr);
dma_node->bytes = size;
dma_node->paddr = paddr;
dma_node->kaddr = kaddr;
dma_node->map = dmamap;
dma_node->daddr = daddr;
dma_node->mem = mem;
TRACE( TRC_GC_DMA, 12, "dmap=0x%x kaddr=0x%x bytes=0x%x paddr=0x%x daddr=0x%x",
dmamap, kaddr, bytes, paddr, daddr);
dma_alloc_exit:
if( err == 1){
gc_mark( (void *) dma_node);
dma_node = NULL;
}
TRACE( TRC_GC_DMA, 12, "exit dma_node=0x%x", dma_node);
return( dma_node);
}
void dma_drain( dma_node_t *dma_node){
/* pciio_dmamap_drain( pciio_dmamap_t *map) */
/* TRACE( TRC_GC_DMA, 12, "enter", NULL);*/
pciio_dmamap_drain( &dma_node->map);
/* TRACE( TRC_GC_DMA, 12, "exit ", NULL); */
}
void dma_done( dma_node_t *dma_node){
/* pciio_dmamap_done(pciio_dmamap_t map)*/
TRACE( TRC_GC_DMA, 12, "enter", NULL);
pciio_dmamap_done( dma_node->map);
TRACE( TRC_GC_DMA, 12, "exit ", NULL);
}
void dma_mark( dma_node_t *dma_node){
TRACE( TRC_GC_DMA, 12, "enter ", NULL);
dma_drain( dma_node);
dma_done( dma_node);
gc_mark( (void *) dma_node);
TRACE( TRC_GC_DMA, 12, "exit ", NULL);
}
void dma_node_dump( dma_node_t *dma_node){
TRACE( TRC_GC_DMA, 07, "enter", NULL);
TRACE( TRC_GC_DMA, 7, "dma_node=0x%x", dma_node);
TRACE( TRC_GC_DMA, 7, " paddr = 0x%x", dma_node->paddr);
TRACE( TRC_GC_DMA, 7, " kaddr = 0x%x", dma_node->kaddr);
TRACE( TRC_GC_DMA, 7, " mem = 0x%x", dma_node->mem);
TRACE( TRC_GC_DMA, 7, " map = 0x%x", dma_node->map);
TRACE( TRC_GC_DMA, 7, " daddr = 0x%x", dma_node->daddr);
TRACE( TRC_GC_DMA, 7, " bytes = 0x%x", dma_node->bytes );
TRACE( TRC_GC_DMA, 7, "exit ", NULL);
}
void dma_free( dma_node_t *dma_node){
/*void pciio_dmamap_free(pciio_dmamap_t map) */
TRACE( TRC_GC_DMA, 12, "enter", NULL);
if( dma_node->map != NULL){
pciio_dmamap_free( dma_node->map);
}
kmem_free( (void *) dma_node->mem, dma_node->bytes);
gc_free( (void *) dma_node);
TRACE( TRC_GC_DMA, 12, "exit ", NULL);
}
void dma_list_sweep( dma_list_t *dma_list){
list_t *l, *i, *tmp;
TRACE( TRC_GC_DMA, 12, "enter ", NULL);
l = (list_t *) dma_list;
list_for_each_safe( i, tmp, l){
if( ( (gc_node_t *) i)->mark == 1)
dma_free( (void *) gc_get_data_ptr( (void *)i) );
}
TRACE( TRC_GC_DMA, 12, "exit ", NULL);
}
void dma_list_dump( dma_list_t *dma_list){
list_t *l, *i, *tmp;
dma_node_t *dma_node;
TRACE( TRC_GC_DMA, 12, "enter ", NULL);
l = (list_t *) dma_list;
list_for_each_safe( i, tmp, l){
dma_node = gc_get_data_ptr( (void *)i);
TRACE( TRC_GC_DMA, 7, "dma_node = 0x%x", dma_node);
dma_node_dump( dma_node);
}
TRACE( TRC_GC_DMA, 12, "exit ", NULL);
}
void dma_list_destroy( dma_list_t *dma_list){
list_t *l, *i, *tmp;
dma_node_t *dma_node;
TRACE( TRC_GC_DMA, 12, "enter", NULL);
l = (list_t *) dma_list;
list_for_each_safe( i, tmp, l){
dma_node = gc_get_data_ptr( (void *)i);
TRACE( TRC_GC_DMA, 12, "dma_node = 0x%x", dma_node);
dma_free( dma_node);
}
dma_list_init( dma_list);
TRACE( TRC_GC_DMA, 12, "exit ", NULL);
}

133
dumphex.c

@ -0,0 +1,133 @@
/*
********************************************************************
* USB stack and host controller driver for SGI IRIX 6.5 *
* *
* Programmed by BSDero *
* bsdero at gmail dot com *
* 2011/2012 *
* *
* *
* File: dumphex.c *
* Description: Byte dump utility function *
* *
* *
********************************************************************
*******************************************************************************************************
* FIXLIST (latest at top) *
*-----------------------------------------------------------------------------------------------------*
* Author MM-DD-YYYY Description *
*-----------------------------------------------------------------------------------------------------*
* BSDero 08-02-2012 -Fixes in appearance of hex digits. Now dumps looks way better *
* *
* BSDero 05-09-2012 -Much better dump appearance *
* *
* BSDero 01-16-2012 -Fixes for better dump appearance *
* *
* BSDero 01-05-2012 -Initial version *
* *
*******************************************************************************************************
*/
int dumphex( uint64_t class, uchar_t level, unsigned char *s, size_t len);
void dump_uint32( uint64_t class, uchar_t level, uint32_t *u32, size_t size);
void dump_uint32( uint64_t class, uchar_t level, uint32_t *u32, size_t size){
int i, j;
unsigned char *p;
char s1[128], s2[128];
if( global_trace_class.level < level)
return;
if((class & global_trace_class.class) == 0)
return;
size /= 4;
printf("-------- ------------ ----\n");
for( i = 0; i < size; i++){
INT2HEX16X( s1, i);
INT2HEX32X( s2, u32[i]);
printf("[%s] [%s] ", s1, s2);
p = (unsigned char *) &u32[i];
for( j = 0; j < 4; j++ ){
if( isprint( *p)){
printf("%c", *p);
}else{
printf(".");
}
p++;
}
printf("\n");
}
}
int dumphex( uint64_t class, uchar_t level, unsigned char *p, size_t size){
unsigned int i, l, m;
char s[128];
if( global_trace_class.level < level)
return(0);
if((class & global_trace_class.class) == 0)
return(0);
printf(" _0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F 01234567 89ABCDEF\n");
printf(" ----------------------- ----------------------- -------- --------\n");
m = l = 0;
do{
INT2HEX16X( s, l);
printf("%s ", s);
for( i = 0; i < 8; i++, l++){
if( l < size){
INT2HEX8( s, p[i] );
printf("%s ", s);
}else{
printf(" ");
}
}
printf(" ");
for( ; i < 16; i++, l++){
if( l < size){
INT2HEX8( s, p[i] );
printf("%s ", s);
}else{
printf(" ");
}
}
printf(" ");
for( i = 0; i < 8; i++, m++){
if( m < size)
if( isprint( p[i] ))
printf("%c", p[i]);
else
printf(".");
else
printf(" ");
}
printf(" ");
for( ; i < 16; i++, m++){
if( m < size)
if( isprint( p[i] ))
printf("%c", p[i]);
else
printf(".");
else
printf(" ");
}
p = p + 16;
printf("\n");
}while( l < size);
printf("\n");
return(0);
}

194
ehcireg.h

@ -0,0 +1,194 @@
/*
********************************************************************
* USB stack and host controller driver for SGI IRIX 6.5 *
* *
* Programmed by BSDero *
* bsdero at gmail dot com *
* 2011/2012 *
* *
* *
* File: ehcireg.h *
* Description: Definitions and macros for EHCI registers handling *
* and programming *
* *
********************************************************************
*******************************************************************************************************
* FIXLIST (latest at top) *
*-----------------------------------------------------------------------------------------------------*
* Author MM-DD-YYYY Description *
*-----------------------------------------------------------------------------------------------------*
* BSDero 09-10-2011 -Initial version, rippen from NetBSD source code *
* *
*******************************************************************************************************
*/
/* $FreeBSD: src/sys/dev/usb/controller/ehcireg.h,v 1.1.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Lennart Augustsson (lennart@augustsson.net).
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _EHCIREG_H_
#define _EHCIREG_H_
/* PCI config registers */
#define PCI_CBMEM 0x10 /* configuration base MEM */
#define PCI_INTERFACE_EHCI 0x20
#define PCI_USBREV 0x60 /* RO USB protocol revision */
#define PCI_USB_REV_MASK 0xff
#define PCI_USB_REV_PRE_1_0 0x00
#define PCI_USB_REV_1_0 0x10
#define PCI_USB_REV_1_1 0x11
#define PCI_USB_REV_2_0 0x20
#define PCI_EHCI_FLADJ 0x61 /* RW Frame len adj, SOF=59488+6*fladj */
#define PCI_EHCI_PORTWAKECAP 0x62 /* RW Port wake caps (opt) */
/* EHCI Extended Capabilities */
#define EHCI_EC_LEGSUP 0x01
#define EHCI_EECP_NEXT(x) (((x) >> 8) & 0xff)
#define EHCI_EECP_ID(x) ((x) & 0xff)
/* Legacy support extended capability */
#define EHCI_LEGSUP_BIOS_SEM 0x02
#define EHCI_LEGSUP_OS_SEM 0x03
#define EHCI_LEGSUP_USBLEGCTLSTS 0x04
/* EHCI capability registers */
#define EHCI_CAPLEN_HCIVERSION 0x00 /* RO Capability register length
* (least-significant byte) and
* interface version number (two
* most significant)
*/
#define EHCI_CAPLENGTH(x) ((x) & 0xff)
#define EHCI_HCIVERSION(x) (((x) >> 16) & 0xffff)
#define EHCI_HCSPARAMS 0x04 /* RO Structural parameters */
#define EHCI_HCS_DEBUGPORT(x) (((x) >> 20) & 0xf)
#define EHCI_HCS_P_INDICATOR(x) ((x) & 0x10000)
#define EHCI_HCS_N_CC(x) (((x) >> 12) & 0xf) /* # of companion ctlrs */
#define EHCI_HCS_N_PCC(x) (((x) >> 8) & 0xf) /* # of ports per comp. */
#define EHCI_HCS_PPC(x) ((x) & 0x10) /* port power control */
#define EHCI_HCS_N_PORTS(x) ((x) & 0xf) /* # of ports */
#define EHCI_HCCPARAMS 0x08 /* RO Capability parameters */
#define EHCI_HCC_EECP(x) (((x) >> 8) & 0xff) /* extended ports caps */
#define EHCI_HCC_IST(x) (((x) >> 4) & 0xf) /* isoc sched threshold */
#define EHCI_HCC_ASPC(x) ((x) & 0x4) /* async sched park cap */
#define EHCI_HCC_PFLF(x) ((x) & 0x2) /* prog frame list flag */
#define EHCI_HCC_64BIT(x) ((x) & 0x1) /* 64 bit address cap */
#define EHCI_HCSP_PORTROUTE 0x0c /* RO Companion port route description */
/* EHCI operational registers. Offset given by EHCI_CAPLENGTH register */
#define EHCI_USBCMD 0x00 /* RO, RW, WO Command register */
#define EHCI_CMD_ITC_M 0x00ff0000 /* RW interrupt threshold ctrl */
#define EHCI_CMD_ITC_1 0x00010000
#define EHCI_CMD_ITC_2 0x00020000
#define EHCI_CMD_ITC_4 0x00040000
#define EHCI_CMD_ITC_8 0x00080000
#define EHCI_CMD_ITC_16 0x00100000
#define EHCI_CMD_ITC_32 0x00200000
#define EHCI_CMD_ITC_64 0x00400000
#define EHCI_CMD_ASPME 0x00000800 /* RW/RO async park enable */
#define EHCI_CMD_ASPMC 0x00000300 /* RW/RO async park count */
#define EHCI_CMD_LHCR 0x00000080 /* RW light host ctrl reset */
#define EHCI_CMD_IAAD 0x00000040 /* RW intr on async adv door bell */
#define EHCI_CMD_ASE 0x00000020 /* RW async sched enable */
#define EHCI_CMD_PSE 0x00000010 /* RW periodic sched enable */
#define EHCI_CMD_FLS_M 0x0000000c /* RW/RO frame list size */
#define EHCI_CMD_FLS(x) (((x) >> 2) & 3) /* RW/RO frame list size */
#define EHCI_CMD_HCRESET 0x00000002 /* RW reset */
#define EHCI_CMD_RS 0x00000001 /* RW run/stop */
#define EHCI_USBSTS 0x04 /* RO, RW, RWC Status register */
#define EHCI_STS_ASS 0x00008000 /* RO async sched status */
#define EHCI_STS_PSS 0x00004000 /* RO periodic sched status */
#define EHCI_STS_REC 0x00002000 /* RO reclamation */
#define EHCI_STS_HCH 0x00001000 /* RO host controller halted */
#define EHCI_STS_IAA 0x00000020 /* RWC interrupt on async adv */
#define EHCI_STS_HSE 0x00000010 /* RWC host system error */
#define EHCI_STS_FLR 0x00000008 /* RWC frame list rollover */
#define EHCI_STS_PCD 0x00000004 /* RWC port change detect */
#define EHCI_STS_ERRINT 0x00000002 /* RWC error interrupt */
#define EHCI_STS_INT 0x00000001 /* RWC interrupt */
#define EHCI_STS_INTRS(x) ((x) & 0x3f)
/*
* NOTE: the doorbell interrupt is enabled, but the doorbell is never
* used! SiS chipsets require this.
*/
#define EHCI_NORMAL_INTRS (EHCI_STS_IAA | EHCI_STS_HSE | \
EHCI_STS_PCD | EHCI_STS_ERRINT | EHCI_STS_INT)
#define EHCI_USBINTR 0x08 /* RW Interrupt register */
#define EHCI_INTR_IAAE 0x00000020 /* interrupt on async advance
* ena */
#define EHCI_INTR_HSEE 0x00000010 /* host system error ena */
#define EHCI_INTR_FLRE 0x00000008 /* frame list rollover ena */
#define EHCI_INTR_PCIE 0x00000004 /* port change ena */
#define EHCI_INTR_UEIE 0x00000002 /* USB error intr ena */
#define EHCI_INTR_UIE 0x00000001 /* USB intr ena */
#define EHCI_FRINDEX 0x0c /* RW Frame Index register */
#define EHCI_CTRLDSSEGMENT 0x10 /* RW Control Data Structure Segment */
#define EHCI_PERIODICLISTBASE 0x14 /* RW Periodic List Base */
#define EHCI_ASYNCLISTADDR 0x18 /* RW Async List Base */
#define EHCI_CONFIGFLAG 0x40 /* RW Configure Flag register */
#define EHCI_CONF_CF 0x00000001 /* RW configure flag */
#define EHCI_PORTSC(n) (0x40+(4*(n))) /* RO, RW, RWC Port Status reg */
#define EHCI_PS_WKOC_E 0x00400000 /* RW wake on over current ena */
#define EHCI_PS_WKDSCNNT_E 0x00200000 /* RW wake on disconnect ena */
#define EHCI_PS_WKCNNT_E 0x00100000 /* RW wake on connect ena */
#define EHCI_PS_PTC 0x000f0000 /* RW port test control */
#define EHCI_PS_PIC 0x0000c000 /* RW port indicator control */
#define EHCI_PS_PO 0x00002000 /* RW port owner */
#define EHCI_PS_PP 0x00001000 /* RW,RO port power */
#define EHCI_PS_LS 0x00000c00 /* RO line status */
#define EHCI_PS_IS_LOWSPEED(x) (((x) & EHCI_PS_LS) == 0x00000400)
#define EHCI_PS_PR 0x00000100 /* RW port reset */
#define EHCI_PS_SUSP 0x00000080 /* RW suspend */
#define EHCI_PS_FPR 0x00000040 /* RW force port resume */
#define EHCI_PS_OCC 0x00000020 /* RWC over current change */
#define EHCI_PS_OCA 0x00000010 /* RO over current active */
#define EHCI_PS_PEC 0x00000008 /* RWC port enable change */
#define EHCI_PS_PE 0x00000004 /* RW port enable */