POK(kernelpart)
/home/jaouen/pok_official/pok/trunk/kernel/include/arch/x86/pci.h
Go to the documentation of this file.
00001 /*
00002  *                               POK header
00003  * 
00004  * The following file is a part of the POK project. Any modification should
00005  * made according to the POK licence. You CANNOT use this file or a part of
00006  * this file is this part of a file for your own project
00007  *
00008  * For more information on the POK licence, please see our LICENCE FILE
00009  *
00010  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
00011  *
00012  *                                      Copyright (c) 2007-2009 POK team 
00013  *
00014  * Created by laurent on Mon Jun 08 11:03:02 2009 
00015  */
00016 
00017 
00018 #ifdef POK_NEEDS_PCI
00019 
00020 # ifndef __POK_x86_PCI_H__
00021 #  define __POK_X86_PCI_H__
00022 
00023 #  include <arch/x86/ioports.h>
00024 #  include <core/syscall.h>
00025 #  include <core/partition.h>
00026 
00027 /*
00028  * PCI configuration registers
00029  */
00030 #  define PCI_CONFIG_ADDRESS    0xCF8
00031 #  define PCI_CONFIG_DATA       0xCFC
00032 
00033 /*
00034  * Configuration space registers
00035  */
00036 #  define PCI_REG_VENDORID      0x00
00037 #  define PCI_REG_DEVICEID      0x02
00038 #  define PCI_REG_HEADERTYPE    0x0E
00039 #  define PCI_REG_BAR0          0x10
00040 #  define PCI_REG_IRQLINE       0x3C
00041 
00042 /*
00043  * Useful defines...
00044  */
00045 #  define PCI_BUS_MAX           8
00046 #  define PCI_DEV_MAX           32
00047 #  define PCI_FUN_MAX           8
00048 
00049 /*
00050  * Structure to holds some device information
00051  */
00052 typedef struct
00053 {
00054   uint16_t      bus;
00055   uint16_t      dev;
00056   uint16_t      fun;
00057   uint16_t      vendorid;
00058   uint16_t      deviceid;
00059   uint16_t      irq_line;
00060   uint16_t      io_range;
00061   uint32_t      bar[6];
00062   uint32_t      addr;
00063   void*         irq_handler;
00064 } s_pci_device;
00065 
00066 pok_ret_t pci_register(s_pci_device* dev, uint8_t part_id);
00067 
00068 # endif /* __POK_X86_PCI_H__ */
00069 #endif /* POK_NEEDS_PCI */