"Fossies" - the Fresh Open Source Software Archive

Member "dosemu-1.4.0/src/include/pci.h" (4 May 2007, 3419 Bytes) of package /linux/misc/old/dosemu-1.4.0.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "pci.h" see the Fossies "Dox" file reference documentation.

    1 /* 
    2  * (C) Copyright 1992, ..., 2007 the "DOSEMU-Development-Team".
    3  *
    4  * for details see file COPYING.DOSEMU in the DOSEMU distribution
    5  */
    6 
    7 #ifndef DOSEMU_PCI_H
    8 #define DOSEMU_PCI_H
    9 
   10 /* definitions from the Linux kernel's linux/pci.h */
   11 #define PCI_VENDOR_ID           0x00
   12 #define PCI_VENDOR_ID_INTEL     0x8086
   13 #define PCI_VENDOR_ID_COMPAQ        0x0e11
   14 #define PCI_BASE_ADDRESS_0      0x10
   15 #define PCI_BASE_ADDRESS_5      0x24
   16 #define PCI_BASE_ADDRESS_SPACE_IO   0x01
   17 #define PCI_BASE_ADDRESS_SPACE_MEMORY   0x00
   18 #define PCI_BASE_ADDRESS_MEM_MASK   (~0x0fUL)
   19 #define PCI_BASE_ADDRESS_IO_MASK    (~0x03UL)
   20 #define PCI_ROM_ADDRESS         0x30        
   21 #define PCI_ROM_ADDRESS_MASK        (~0x7ffUL)
   22 #define PCI_CLASS_DISPLAY_VGA       0x0300
   23 #define PCI_CLASS_BRIDGE_HOST       0x0600
   24 #define PCI_CLASS_DEVICE        0x0a
   25 
   26 /* other definitions */
   27 #define PCIBIOS_PCI_FUNCTION_ID     0xb1
   28 #define PCIBIOS_PCI_BIOS_PRESENT    0xb101
   29 #define PCIBIOS_FIND_PCI_DEVICE     0xb102
   30 #define PCIBIOS_FIND_PCI_CLASS_CODE 0xb103
   31 #define PCIBIOS_GENERATE_SPECIAL_CYCLE  0xb106
   32 #define PCIBIOS_READ_CONFIG_BYTE    0xb108
   33 #define PCIBIOS_READ_CONFIG_WORD    0xb109
   34 #define PCIBIOS_READ_CONFIG_DWORD   0xb10a
   35 #define PCIBIOS_WRITE_CONFIG_BYTE   0xb10b
   36 #define PCIBIOS_WRITE_CONFIG_WORD   0xb10c
   37 #define PCIBIOS_WRITE_CONFIG_DWORD  0xb10d
   38 #define PCIBIOS_GET_IRQ_ROUTING_OPTIONS 0xb10e
   39 #define PCIBIOS_SET_PCI_IRQ             0xb10f
   40 
   41 #define PCIBIOS_STAT_SUCCESSFUL     0x00
   42 #define PCIBIOS_FUNC_NOT_SUPPORTED  0x81
   43 #define PCIBIOS_BAD_VENDOR_ID       0x83
   44 #define PCIBIOS_DEVICE_NOT_FOUND    0x86
   45 #define PCIBIOS_BAD_REGISTER_NUMBER 0x87
   46 #define PCIBIOS_SET_FAILED          0x88
   47 #define PCIBIOS_BUFFER_TOO_SMALL    0x89
   48 
   49 /* BIOS32 signature: "_32_" */
   50 #define BIOS32_SIGNATURE    (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24))
   51 
   52 /* PCI signature: "PCI " */
   53 #define PCI_SIGNATURE       (('P' << 0) + ('C' << 8) + ('I' << 16) + (' ' << 24))
   54 
   55 /* PCI service signature: "$PCI" */
   56 #define PCI_SERVICE     (('$' << 0) + ('P' << 8) + ('C' << 16) + ('I' << 24))
   57 
   58 /* Configuration mechanism 1 - two 32-bit I/O ports */
   59 
   60 #define PCI_CONF_ADDR   0xcf8
   61 #define PCI_CONF_DATA   0xcfc
   62 #define PCI_EN 0x80000000
   63 
   64 #define PCI_MODE2_FORWARD_REG 0xCFA
   65 #define PCI_MODE2_ENABLE_REG 0xCF8
   66 
   67 typedef struct _pciRec {
   68     int enabled, ext_enabled;
   69     unsigned short bdf;
   70     unsigned short vendor;
   71     unsigned short device;
   72     unsigned long class;
   73     struct {
   74         int type;
   75         unsigned long base;
   76         unsigned long size;
   77         unsigned long rawsize;
   78     } region[7];
   79     unsigned int header[16];
   80     struct _pciRec *next;
   81 } pciRec, *pciPtr;
   82 
   83 struct pci_funcs {
   84     char *name;
   85     int (*open)(unsigned char bus, unsigned char device, unsigned char fn);
   86     unsigned long (*read)(unsigned char bus, unsigned char device,
   87               unsigned char fn, unsigned long reg, int len);
   88     void (*write)(unsigned char bus, unsigned char device,
   89           unsigned char fn, unsigned long num, unsigned long val,
   90           int len);
   91     int (*read_header) (unsigned char bus, unsigned char device,
   92             unsigned char fn, unsigned int *buf);
   93     int (*check_device_present)(unsigned char bus, unsigned char device,
   94                 unsigned char fn);
   95 };
   96 
   97 void pci_bios(void);
   98 int pcibios_init(void);
   99 pciRec *pcibios_find_class(unsigned long class,  int num);
  100 pciRec *pcibios_find_bdf(unsigned short bdf);
  101 
  102 struct pci_funcs *pci_check_conf(void);
  103 extern struct pci_funcs *pciConfigType;
  104 
  105 int pci_setup (void);
  106 pciRec *pciemu_setup(unsigned long class);
  107 
  108 #endif /* DOSEMU_PCI_H */