26 #include <linux/types.h>
27 #include <linux/pci.h>
28 #include <linux/kernel.h>
34 static int titan_ht_config_read_dword(
struct pci_bus *
bus,
unsigned int devfn,
42 address = (busno << 16) | (devfn << 8) | (offset & 0xfc) | 0x80000000;
52 *(
volatile int32_t *) 0xfb0000f0 |= 0x2;
56 *(
volatile int32_t *) 0xfb0006f8 = address;
61 * (
volatile int32_t *) 0xfb0000f0 |= 0x2;
66 static int titan_ht_config_read(
struct pci_bus *bus,
unsigned int devfn,
71 titan_ht_config_read_dword(bus, devfn, offset, &dword);
73 dword >>= ((offset & 3) << 3);
74 dword &= (0xffffffff
U >> ((4 -
size) << 8));
79 static inline int titan_ht_config_write_dword(
struct pci_bus *bus,
80 unsigned int devfn,
int offset,
u32 val)
87 address = (busno << 16) | (devfn << 8) | (offset & 0xfc) | 0x80000000;
91 *(
volatile int32_t *) 0xfb0000f0 |= 0x2;
95 *(
volatile int32_t *) 0xfb0006f8 = address;
96 *(
volatile int32_t *) 0xfb0006fc = val;
100 *(
volatile int32_t *) 0xfb0000f0 |= 0x2;
105 static int titan_ht_config_write(
struct pci_bus *bus,
unsigned int devfn,
110 titan_ht_config_read_dword(bus, devfn, offset, &val2);
112 val1 = val << ((offset & 3) << 3);
113 mask = ~(0xffffffff
U >> ((4 -
size) << 8));
114 val2 &= ~(
mask << ((offset & 3) << 8));
116 titan_ht_config_write_dword(bus, devfn, offset, val1 | val2);
122 .read = titan_ht_config_read,
123 .write = titan_ht_config_write,