UbixOS V2  2.0
pci.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2002-2018 The UbixOS Project.
3  * All rights reserved.
4  *
5  * This was developed by Christopher W. Olsen for the UbixOS Project.
6  *
7  * Redistribution and use in source and binary forms, with or without modification, are permitted
8  * provided that the following conditions are met:
9  *
10  * 1) Redistributions of source code must retain the above copyright notice, this list of
11  * conditions, the following disclaimer and the list of authors.
12  * 2) Redistributions in binary form must reproduce the above copyright notice, this list of
13  * conditions, the following disclaimer and the list of authors in the documentation and/or
14  * other materials provided with the distribution.
15  * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to
16  * endorse or promote products derived from this software without specific prior written
17  * permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
20  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef _PCI_H
30 #define _PCI_H
31 
32 #include <sys/types.h>
33 
34 struct pciConfig {
37 
40 
45 
50 
52 
54 
57 
59 
62 
64 
69 
70  /* device info */
71  //uint8_t bus;
72  //uint8_t dev;
73  //uint8_t func;
74  //uint8_t irq;
75  //uint8_t irqLine;
76  /* base registers */
77  //uInt32 base[6];
78  //uInt32 size[6];
79  //uint16_t subsysVendor;
80  //uint16_t subsys;
81  /* Device Info */
82  //Move this to anotther struct eventually
86 
87 };
88 
89 struct confadd {
96 };
97 
98 #define countof(a) (sizeof(a) / sizeof(a[0]))
99 
100 int pci_init();
101 
102 uint32_t pciProbe(int bus, int dev, int func);
103 uInt32 pciRead(int bus, int dev, int func, int reg, int bytes);
104 void pciWrite(int bus, int dev, int func, int reg, uInt32 v, int bytes);
105 
106 #endif
pciConfig::latencyTimer
uint8_t latencyTimer
Definition: pci.h:47
pciConfig::progIf
uint8_t progIf
Definition: pci.h:42
confadd
Definition: pci.h:89
pciConfig::cbPointer
uint32_t cbPointer
Definition: pci.h:53
uInt32
unsigned long int uInt32
Definition: objgfx30.h:49
pciConfig::minGrant
uint8_t minGrant
Definition: pci.h:67
pciConfig::intPin
uint8_t intPin
Definition: pci.h:66
pciRead
uInt32 pciRead(int bus, int dev, int func, int reg, int bytes)
Definition: pci.c:76
pciConfig::bus
uint8_t bus
Definition: pci.h:83
pciConfig::vendorID
uint16_t vendorID
Definition: pci.h:35
pciWrite
void pciWrite(int bus, int dev, int func, int reg, uInt32 v, int bytes)
Definition: pci.c:108
pciConfig::deviceID
uint16_t deviceID
Definition: pci.h:36
pciConfig::bist
uint8_t bist
Definition: pci.h:49
confadd::bus
uint8_t bus
Definition: pci.h:93
confadd::enable
uint8_t enable
Definition: pci.h:95
pciConfig::bar
uint32_t bar[6]
Definition: pci.h:51
types.h
pciConfig::maxLatency
uint8_t maxLatency
Definition: pci.h:68
uint16_t
__uint16_t uint16_t
Definition: types.h:45
pciConfig::capabilites
uint16_t capabilites
Definition: pci.h:60
pciConfig::status
uint16_t status
Definition: pci.h:39
pci_init
int pci_init()
Definition: pci.c:244
confadd::dev
uint8_t dev
Definition: pci.h:92
uint32_t
__uint32_t uint32_t
Definition: types.h:46
pciConfig::headerType
uint8_t headerType
Definition: pci.h:48
pciConfig::command
uint16_t command
Definition: pci.h:38
pciConfig::epromAddr
uint32_t epromAddr
Definition: pci.h:58
pciConfig::subsysVendorID
uint16_t subsysVendorID
Definition: pci.h:55
pciConfig::classCode
uint8_t classCode
Definition: pci.h:44
confadd::rsvd
uint8_t rsvd
Definition: pci.h:94
pciConfig::subsysID
uint16_t subsysID
Definition: pci.h:56
pciConfig::subClass
uint8_t subClass
Definition: pci.h:43
confadd::func
uint8_t func
Definition: pci.h:91
pciConfig::func
uint8_t func
Definition: pci.h:85
confadd::reg
uint8_t reg
Definition: pci.h:90
pciProbe
uint32_t pciProbe(int bus, int dev, int func)
Definition: pci.c:139
pciConfig::res2
uint32_t res2
Definition: pci.h:63
pciConfig::cacheLineSize
uint8_t cacheLineSize
Definition: pci.h:46
pciConfig::revisionID
uint8_t revisionID
Definition: pci.h:41
uint8_t
__uint8_t uint8_t
Definition: types.h:44
pciConfig::intLine
uint8_t intLine
Definition: pci.h:65
pciConfig
Definition: pci.h:34
pciConfig::dev
uint8_t dev
Definition: pci.h:84
pciConfig::res1
uint16_t res1
Definition: pci.h:61