26 #include <linux/types.h>
27 #include <linux/pci.h>
28 #include <linux/kernel.h>
35 #ifdef CONFIG_HYPERTRANSPORT
61 bus = device->
bus->number;
67 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
70 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
82 static int titan_ht_config_read_word(
struct pci_dev *device,
89 bus = device->
bus->number;
95 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
98 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
103 if ((offset & 0x3) == 0)
115 u32 longswap(
unsigned long l)
117 unsigned char b1, b2, b3, b4;
124 return ((b1<<24) + (b2<<16) + (b3<<8) + b4);
128 static int titan_ht_config_read_byte(
struct pci_dev *device,
136 bus = device->
bus->number;
142 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
145 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
152 if ((offset & 0x3) == 0) {
155 if ((offset & 0x3) == 1) {
158 if ((offset & 0x3) == 2) {
161 if ((offset & 0x3) == 3) {
170 static int titan_ht_config_write_dword(
struct pci_dev *device,
177 bus = device->
bus->number;
183 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
186 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
197 static int titan_ht_config_write_word(
struct pci_dev *device,
204 bus = device->
bus->number;
210 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
213 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
218 if ((offset & 0x3) == 0)
229 static int titan_ht_config_write_byte(
struct pci_dev *device,
237 bus = device->
bus->number;
243 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
246 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
253 if ((offset & 0x3) == 0) {
256 if ((offset & 0x3) == 1) {
259 if ((offset & 0x3) == 2) {
262 if ((offset & 0x3) == 3) {
271 static void titan_pcibios_set_master(
struct pci_dev *dev)
274 int bus = dev->
bus->number;
276 if (check_titan_htlink())
281 if (check_titan_htlink())
292 int bus = dev->
bus->number;
294 if (check_titan_htlink())
298 for (idx = 0; idx < 6; idx++) {
302 "PCI: Device %s not available because of "
303 "resource collisions\n", pci_name(dev));
311 if (cmd != old_cmd) {
312 if (check_titan_htlink())
316 if (check_titan_htlink())
324 if (check_titan_htlink())
327 if (check_titan_htlink())
330 if (tmp1 < 32 || tmp1 == 0xff) {
335 if (check_titan_htlink())
359 " (%ld bytes)\n", pci_name(dev),
363 start = (start + 1024 - 1) & ~(1024 - 1);
370 titan_ht_config_read_byte,
371 titan_ht_config_read_word,
372 titan_ht_config_read_dword,
373 titan_ht_config_write_byte,
374 titan_ht_config_write_word,
375 titan_ht_config_write_dword