00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #include <linux/pci.h>
00056 #include <linux/config.h>
00057 #include <asm/io.h>
00058 #ifndef PCI_H
00059 #define PCI_H
00060
00061 #define PCI_COMMAND_IO 0x1
00062 #define PCI_COMMAND_MEM 0x2
00063 #define PCI_COMMAND_MASTER 0x4
00064 #define PCI_LATENCY_TIMER 0x0d
00065
00066 #define PCIBIOS_PCI_FUNCTION_ID 0xb1XX
00067 #define PCIBIOS_PCI_BIOS_PRESENT 0xb101
00068 #define PCIBIOS_FIND_PCI_DEVICE 0xb102
00069 #define PCIBIOS_FIND_PCI_CLASS_CODE 0xb103
00070 #define PCIBIOS_GENERATE_SPECIAL_CYCLE 0xb106
00071 #define PCIBIOS_READ_CONFIG_BYTE 0xb108
00072 #define PCIBIOS_READ_CONFIG_WORD 0xb109
00073 #define PCIBIOS_READ_CONFIG_DWORD 0xb10a
00074 #define PCIBIOS_WRITE_CONFIG_BYTE 0xb10b
00075 #define PCIBIOS_WRITE_CONFIG_WORD 0xb10c
00076 #define PCIBIOS_WRITE_CONFIG_DWORD 0xb10d
00077 #define PCIBIOS_SET_PCI_HW_INT 0xb10f
00078
00079 #define PCI_VENDOR_ID 0x00
00080 #define PCI_DEVICE_ID 0x02
00081 #define PCI_COMMAND 0x04
00082
00083 #define PCI_REVISION 0x08
00084 #define PCI_CLASS_CODE 0x0b
00085 #define PCI_SUBCLASS_CODE 0x0a
00086 #define PCI_HEADER_TYPE 0x0e
00087
00088 #define PCI_BASE_ADDRESS_0 0x10
00089 #define PCI_BASE_ADDRESS_1 0x14
00090 #define PCI_BASE_ADDRESS_2 0x18
00091 #define PCI_BASE_ADDRESS_3 0x1c
00092 #define PCI_BASE_ADDRESS_4 0x20
00093 #define PCI_BASE_ADDRESS_5 0x24
00094
00095 #define PCI_INTERRUPT_LINE 0x3c
00096 #define PCI_INTERRUPT_PIN 0x3d
00097
00098 #ifndef PCI_BASE_ADDRESS_IO_MASK
00099 #define PCI_BASE_ADDRESS_IO_MASK (~0x03)
00100 #endif
00101 #define PCI_BASE_ADDRESS_SPACE_IO 0x01
00102 #define PCI_ROM_ADDRESS 0x30
00103 #define PCI_ROM_ADDRESS_ENABLE 0x01
00104
00105
00106
00107 #define PCI_FUNC(devfn) ((devfn) & 0x07)
00108
00109 #define bus_number(pci_dev) ((((int)(pci_dev))>>8) & 0xff)
00110 #define devfn_number(pci_dev) (((int)(pci_dev)) & 0xff)
00111
00112
00113 #define BIOS32_SIGNATURE (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24))
00114
00115
00116 #define PCI_SIGNATURE (('P' << 0) + ('C' << 8) + ('I' << 16) + (' ' << 24))
00117
00118
00119 #define PCI_SERVICE (('$' << 0) + ('P' << 8) + ('C' << 16) + ('I' << 24))
00120
00121 union bios32 {
00122 struct {
00123 unsigned long signature;
00124 unsigned long entry;
00125 unsigned char revision;
00126 unsigned char length;
00127 unsigned char checksum;
00128 unsigned char reserved[5];
00129 } fields;
00130 char chars[16];
00131 };
00132
00133 #define KERN_CODE_SEG 0x10
00134
00135
00136 extern int rt_pcibios_read_config_byte(unsigned int bus, unsigned int device_fn,
00137 unsigned int where, unsigned char *value);
00138
00139 extern int rt_rtpcibios_write_config_byte (unsigned int bus, unsigned int device_fn,
00140 unsigned int where, unsigned char value);
00141
00142 extern int rt_pcibios_read_config_word(unsigned int bus, unsigned int device_fn,
00143 unsigned int where, unsigned short *value);
00144
00145 extern int rt_pcibios_write_config_word (unsigned int bus, unsigned int device_fn,
00146 unsigned int where, unsigned short value);
00147
00148 extern int rt_pcibios_read_config_dword(unsigned int bus, unsigned int device_fn,
00149 unsigned int where, unsigned int *value);
00150
00151 extern int rt_pcibios_write_config_dword(unsigned int bus, unsigned int device_fn,
00152 unsigned int where, unsigned int value);
00153
00154 extern int rt_pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
00155
00156 #define rt_pci_read_config_byte(pdev, where, valp)\
00157 rt_pcibios_read_config_byte(bus_number(pdev), devfn_number(pdev), where, valp)
00158 #define rt_pci_read_config_word(pdev, where, valp)\
00159 rt_pcibios_read_config_word(bus_number(pdev), devfn_number(pdev), where, valp)
00160 #define rt_pci_read_config_dword(pdev, where, valp)\
00161 rt_pcibios_read_config_dword(bus_number(pdev), devfn_number(pdev), where, valp)
00162 #define rt_pci_write_config_byte(pdev, where, val)\
00163 rt_pcibios_write_config_byte(bus_number(pdev), devfn_number(pdev), where, val)
00164 #define rt_pci_write_config_word(pdev, where, val)\
00165 rt_pcibios_write_config_word(bus_number(pdev), devfn_number(pdev), where, val)
00166 #define rt_pci_write_config_dword(pdev, where, val)\
00167 rt_pcibios_write_config_dword(bus_number(pdev), devfn_number(pdev), where, val)
00168
00169 #define rt_pci_resource_start(dev,bar) ((dev)->resource[(bar)].start)
00170 #define rt_pci_resource_end(dev,bar) ((dev)->resource[(bar)].end)
00171 #define rt_pci_resource_flags(dev,bar) ((dev)->resource[(bar)].flags)
00172 #define rt_pci_resource_len(dev,bar) \
00173 ((rt_pci_resource_start((dev),(bar)) == 0 && \
00174 rt_pci_resource_end((dev),(bar)) == \
00175 rt_pci_resource_start((dev),(bar))) ? 0 : \
00176 \
00177 (rt_pci_resource_end((dev),(bar)) - \
00178 rt_pci_resource_start((dev),(bar)) + 1))
00179
00180
00181
00182
00183 int rt_pci_set_power_state(struct pci_dev *dev, int state);
00184 int rt_pci_find_capability(struct pci_dev *dev, int cap);
00185 struct pci_dev * rt_pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *from);
00186 int rt_pci_enable_device(struct pci_dev *dev);
00187 int rt_pci_restore_state(struct pci_dev *dev, u32 *buffer);
00188 int rt_pci_enable_wake(struct pci_dev *dev, u32 state, int enable);
00189 int rt_pci_save_state(struct pci_dev *dev, u32 *buffer);
00190 #endif