# pci.h

Go to the documentation of this file.

    00001 /*****************************************************************************************
    00002  Copyright (c) 2002-2004 The UbixOS Project
    00003  All rights reserved.
    00004
    00005  Redistribution and use in source and binary forms, with or without modification, are
    00006  permitted provided that the following conditions are met:
    00007
    00008  Redistributions of source code must retain the above copyright notice, this list of
    00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
    00010  form must reproduce the above copyright notice, this list of conditions, the following
    00011  disclaimer and the list of authors in the documentation and/or other materials provided
    00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
    00013  contributors may be used to endorse or promote products derived from this software
    00014  without specific prior written permission.
    00015
    00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
    00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
    00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
    00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
    00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00025
    00026  $Id: pci_8h-source.html 88 2016-01-12 00:11:29Z reddawg $
    00027
    00028 *****************************************************************************************/
    00029
    00030 #ifndef _PCI_H
    00031 #define _PCI_H
    00032
    00033 #include <ubixos/types.h>
    00034
    00035
    00036 struct pciConfig {
    00037   uInt16 vendorId;
    00038   uInt16 deviceId;
    00039
    00040   uInt16 command;
    00041   uInt16 status;
    00042
    00043   uInt8  revisionId;
    00044   uInt8  interface;
    00045   uInt8  subClass;
    00046   uInt8  baseClass;
    00047
    00048   uInt8  cacheLineSize;
    00049   uInt8  latencyTimer;
    00050   uInt8  headerType;
    00051   uInt8  bist;
    00052
    00053   /* device info */
    00054   uInt8  bus;
    00055   uInt8  dev;
    00056   uInt8  func;
    00057   uInt8  irq;
    00058
    00059   /* base registers */
    00060   uInt32 base[6];
    00061   uInt32 size[6];
    00062
    00063   uInt16 subsysVendor;
    00064   uInt16 subsys;
    00065
    00066   };
    00067
    00068 struct confadd {
    00069   uInt8 reg:8;
    00070   uInt8 func:3;
    00071   uInt8 dev:5;
    00072   uInt8 bus:8;
    00073   uInt8 rsvd:7;
    00074   uInt8 enable:1;
    00075   };
    00076
    00077 #define countof(a)     (sizeof(a) / sizeof(a[0]))
    00078
    00079 int pci_init();
    00080
    00081
    00082 bool pciProbe(int bus,int dev,int func,struct pciConfig *cfg);
    00083 uInt32 pciRead(int bus, int dev, int func, int reg, int bytes);
    00084 void pciWrite(int bus,int dev,int func,int reg,uInt32 v,int bytes);
    00085
    00086 #endif
    00087
    00088 /***
    00089  $Log: pci_8h-source.html,v $
    00089  Revision 1.7  2006/12/15 17:47:06  reddawg
    00089  Updates
    00089
    00090  Revision 1.1.1.1  2006/06/01 12:46:14  reddawg
    00091  ubix2
    00092
    00093  Revision 1.2  2005/10/12 00:13:37  reddawg
    00094  Removed
    00095
    00096  Revision 1.1.1.1  2005/09/26 17:23:51  reddawg
    00097  no message
    00098
    00099  Revision 1.3  2004/08/20 16:49:11  reddawg
    00100  PCI Updates - More to follow as PCI system gets revamped
    00101
    00102  Revision 1.2  2004/05/21 15:05:07  reddawg
    00103  Cleaned up
    00104
    00105
    00106  END
    00107  ***/