00001 /************************************************************************************** 00002 Copyright (c) 2002 The UbixOS Project 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 00006 00007 Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors. 00008 Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors 00009 in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project nor the names of its 00010 contributors may be used to endorse or promote products derived from this software without specific prior written permission. 00011 00012 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED 00013 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00014 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00015 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00016 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00017 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00018 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00019 00020 $Id$ 00021 00022 **************************************************************************************/ 00023 00024 #ifndef _PCI_H 00025 #define _PCI_H 00026 00027 #include <ubixos/types.h> 00028 00029 00030 struct pciConfig { 00031 uInt16 vendorId; 00032 uInt16 deviceId; 00033 00034 uInt16 command; 00035 uInt16 status; 00036 00037 uInt8 revisionId; 00038 uInt8 interface; 00039 uInt8 subClass; 00040 uInt8 baseClass; 00041 00042 uInt8 cacheLineSize; 00043 uInt8 latencyTimer; 00044 uInt8 headerType; 00045 uInt8 bist; 00046 00047 /* device info */ 00048 uInt8 bus; 00049 uInt8 dev; 00050 uInt8 func; 00051 uInt8 irq; 00052 00053 /* base registers */ 00054 uInt32 base[6]; 00055 uInt32 size[6]; 00056 00057 uInt16 subsysVendor; 00058 uInt16 subsys; 00059 00060 }; 00061 00062 struct confadd { 00063 uInt8 reg:8; 00064 uInt8 func:3; 00065 uInt8 dev:5; 00066 uInt8 bus:8; 00067 uInt8 rsvd:7; 00068 uInt8 enable:1; 00069 }; 00070 00071 #define countof(a) (sizeof(a) / sizeof(a[0])) 00072 00073 int pciInit(); 00074 bool pciProbe(int bus,int dev,int func,struct pciConfig *cfg); 00075 uInt32 pciRead(int bus, int dev, int func, int reg, int bytes); 00076 void pciWrite(int bus,int dev,int func,int reg,uInt32 v,int bytes); 00077 00078 #endif 00079