POK(kernelpart)
pci.h
Go to the documentation of this file.
1 /*
2  * POK header
3  *
4  * The following file is a part of the POK project. Any modification should
5  * made according to the POK licence. You CANNOT use this file or a part of
6  * this file is this part of a file for your own project
7  *
8  * For more information on the POK licence, please see our LICENCE FILE
9  *
10  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
11  *
12  * Copyright (c) 2007-2009 POK team
13  *
14  * Created by laurent on Mon Jun 08 11:03:02 2009
15  */
16 
17 
18 #ifdef POK_NEEDS_PCI
19 
20 # ifndef __POK_x86_PCI_H__
21 # define __POK_X86_PCI_H__
22 
23 # include <arch/x86/ioports.h>
24 # include <core/syscall.h>
25 # include <core/partition.h>
26 
27 /*
28  * PCI configuration registers
29  */
30 # define PCI_CONFIG_ADDRESS 0xCF8
31 # define PCI_CONFIG_DATA 0xCFC
32 
33 /*
34  * Configuration space registers
35  */
36 # define PCI_REG_VENDORID 0x00
37 # define PCI_REG_DEVICEID 0x02
38 # define PCI_REG_HEADERTYPE 0x0E
39 # define PCI_REG_BAR0 0x10
40 # define PCI_REG_IRQLINE 0x3C
41 
42 /*
43  * Useful defines...
44  */
45 # define PCI_BUS_MAX 8
46 # define PCI_DEV_MAX 32
47 # define PCI_FUN_MAX 8
48 
49 /*
50  * Structure to holds some device information
51  */
52 typedef struct
53 {
54  uint16_t bus;
55  uint16_t dev;
56  uint16_t fun;
57  uint16_t vendorid;
58  uint16_t deviceid;
59  uint16_t irq_line;
60  uint16_t io_range;
61  uint32_t bar[6];
62  uint32_t addr;
63  void* irq_handler;
64 } s_pci_device;
65 
66 pok_ret_t pci_register(s_pci_device* dev, uint8_t part_id);
67 
68 # endif /* __POK_X86_PCI_H__ */
69 #endif /* POK_NEEDS_PCI */