Subversion Repositories Kolibri OS

Rev

Rev 1628 | Rev 1633 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1628 Rev 1631
Line 1... Line -...
1
#include 
-
 
2
#include 
-
 
3
#include 
-
 
4
 
-
 
5
#ifndef __PCI_H__
1
#ifndef __PCI_H__
6
#define __PCI_H__
2
#define __PCI_H__
Line -... Line 3...
-
 
3
 
-
 
4
#include 
-
 
5
#include 
-
 
6
#include 
-
 
7
#include 
Line 7... Line 8...
7
 
8
#include 
8
 
9
 
9
/* pci_slot represents a physical slot */
10
/* pci_slot represents a physical slot */
10
struct pci_slot {
11
struct pci_slot {
Line 236... Line 237...
236
{
237
{
237
    return(PCI_MAKE_TAG(busnum,devnum,funcnum));
238
    return(PCI_MAKE_TAG(busnum,devnum,funcnum));
238
}
239
}
239
 
240
 
Line 240... Line -...
240
 
-
 
241
struct resource
-
 
242
{
-
 
243
         resource_size_t start;
-
 
244
         resource_size_t end;
-
 
245
         const char *name;
-
 
246
         unsigned long flags;
-
 
247
         struct resource *parent, *sibling, *child;
-
 
248
};
-
 
249
 
-
 
250
/* This defines the direction arg to the DMA mapping routines. */
241
/* This defines the direction arg to the DMA mapping routines. */
251
#define PCI_DMA_BIDIRECTIONAL	0
242
#define PCI_DMA_BIDIRECTIONAL	0
252
#define PCI_DMA_TODEVICE	1
243
#define PCI_DMA_TODEVICE	1
253
#define PCI_DMA_FROMDEVICE	2
244
#define PCI_DMA_FROMDEVICE	2
254
#define PCI_DMA_NONE		3
245
#define PCI_DMA_NONE		3
Line 285... Line 276...
285
};
276
};
286
 
277
 
Line 287... Line 278...
287
 
278
 
288
/*
-
 
289
 * IO resources have these defined flags.
-
 
290
 */
-
 
291
#define IORESOURCE_BITS         0x000000ff      /* Bus-specific bits */
-
 
292
 
-
 
293
#define IORESOURCE_IO           0x00000100      /* Resource type */
-
 
294
#define IORESOURCE_MEM          0x00000200
-
 
295
#define IORESOURCE_IRQ          0x00000400
-
 
296
#define IORESOURCE_DMA          0x00000800
-
 
297
 
-
 
298
#define IORESOURCE_PREFETCH     0x00001000      /* No side effects */
-
 
299
#define IORESOURCE_READONLY     0x00002000
-
 
300
#define IORESOURCE_CACHEABLE    0x00004000
-
 
301
#define IORESOURCE_RANGELENGTH  0x00008000
-
 
302
#define IORESOURCE_SHADOWABLE   0x00010000
-
 
303
#define IORESOURCE_BUS_HAS_VGA  0x00080000
-
 
304
 
-
 
305
#define IORESOURCE_DISABLED     0x10000000
-
 
306
#define IORESOURCE_UNSET        0x20000000
-
 
307
#define IORESOURCE_AUTO         0x40000000
-
 
308
#define IORESOURCE_BUSY         0x80000000      /* Driver has marked this resource busy */
-
 
309
 
-
 
310
/* ISA PnP IRQ specific bits (IORESOURCE_BITS) */
-
 
311
#define IORESOURCE_IRQ_HIGHEDGE         (1<<0)
-
 
312
#define IORESOURCE_IRQ_LOWEDGE          (1<<1)
-
 
313
#define IORESOURCE_IRQ_HIGHLEVEL        (1<<2)
-
 
314
#define IORESOURCE_IRQ_LOWLEVEL         (1<<3)
-
 
315
#define IORESOURCE_IRQ_SHAREABLE        (1<<4)
-
 
316
 
-
 
317
/* ISA PnP DMA specific bits (IORESOURCE_BITS) */
-
 
318
#define IORESOURCE_DMA_TYPE_MASK        (3<<0)
-
 
319
#define IORESOURCE_DMA_8BIT             (0<<0)
-
 
320
#define IORESOURCE_DMA_8AND16BIT        (1<<0)
-
 
321
#define IORESOURCE_DMA_16BIT            (2<<0)
-
 
322
 
-
 
323
#define IORESOURCE_DMA_MASTER           (1<<2)
-
 
324
#define IORESOURCE_DMA_BYTE             (1<<3)
-
 
325
#define IORESOURCE_DMA_WORD             (1<<4)
-
 
326
 
-
 
327
#define IORESOURCE_DMA_SPEED_MASK       (3<<6)
-
 
328
#define IORESOURCE_DMA_COMPATIBLE       (0<<6)
-
 
329
#define IORESOURCE_DMA_TYPEA            (1<<6)
-
 
330
#define IORESOURCE_DMA_TYPEB            (2<<6)
-
 
331
#define IORESOURCE_DMA_TYPEF            (3<<6)
-
 
332
 
-
 
333
/* ISA PnP memory I/O specific bits (IORESOURCE_BITS) */
-
 
334
#define IORESOURCE_MEM_WRITEABLE        (1<<0)  /* dup: IORESOURCE_READONLY */
-
 
335
#define IORESOURCE_MEM_CACHEABLE        (1<<1)  /* dup: IORESOURCE_CACHEABLE */
-
 
336
#define IORESOURCE_MEM_RANGELENGTH      (1<<2)  /* dup: IORESOURCE_RANGELENGTH */
-
 
337
#define IORESOURCE_MEM_TYPE_MASK        (3<<3)
-
 
338
#define IORESOURCE_MEM_8BIT             (0<<3)
-
 
339
#define IORESOURCE_MEM_16BIT            (1<<3)
-
 
340
#define IORESOURCE_MEM_8AND16BIT        (2<<3)
-
 
341
#define IORESOURCE_MEM_32BIT            (3<<3)
-
 
342
#define IORESOURCE_MEM_SHADOWABLE       (1<<5)  /* dup: IORESOURCE_SHADOWABLE */
-
 
343
#define IORESOURCE_MEM_EXPANSIONROM     (1<<6)
-
 
344
 
-
 
345
/* PCI ROM control bits (IORESOURCE_BITS) */
-
 
346
#define IORESOURCE_ROM_ENABLE           (1<<0)  /* ROM is enabled, same as PCI_ROM_ADDRESS_ENABLE */
-
 
347
#define IORESOURCE_ROM_SHADOW           (1<<1)  /* ROM is copy at C000:0 */
-
 
348
#define IORESOURCE_ROM_COPY             (1<<2)  /* ROM is alloc'd copy, resource field overlaid */
-
 
349
#define IORESOURCE_ROM_BIOS_COPY        (1<<3)  /* ROM is BIOS copy, resource field overlaid */
-
 
350
 
-
 
351
/* PCI control bits.  Shares IORESOURCE_BITS with above PCI ROM.  */
-
 
352
#define IORESOURCE_PCI_FIXED            (1<<4)  /* Do not move resource */
-
 
353
 
-
 
354
 
-
 
355
 
-
 
356
 
-
 
357
/*
279
/*
358
 *  For PCI devices, the region numbers are assigned this way:
280
 *  For PCI devices, the region numbers are assigned this way:
359
 *
281
 *
360
 *      0-5     standard PCI regions
282
 *      0-5     standard PCI regions
361
 *      6       expansion ROM
283
 *      6       expansion ROM
Line 386... Line 308...
386
#define PCI_D3cold  ((pci_power_t __force) 4)
308
#define PCI_D3cold  ((pci_power_t __force) 4)
387
#define PCI_UNKNOWN ((pci_power_t __force) 5)
309
#define PCI_UNKNOWN ((pci_power_t __force) 5)
388
#define PCI_POWER_ERROR ((pci_power_t __force) -1)
310
#define PCI_POWER_ERROR ((pci_power_t __force) -1)
389
 
311
 
Line -... Line 312...
-
 
312
 
-
 
313
enum pci_bar_type {
-
 
314
    pci_bar_unknown,    /* Standard PCI BAR probe */
-
 
315
    pci_bar_io,         /* An io port BAR */
-
 
316
    pci_bar_mem32,      /* A 32-bit memory BAR */
-
 
317
    pci_bar_mem64,      /* A 64-bit memory BAR */
-
 
318
};
-
 
319
 
390
/*
320
/*
391
 * The pci_dev structure is used to describe PCI devices.
321
 * The pci_dev structure is used to describe PCI devices.
392
 */
322
 */
393
struct pci_dev {
323
struct pci_dev {
394
    struct list_head bus_list;  /* node in per-bus list */
324
    struct list_head bus_list;  /* node in per-bus list */
Line 477... Line 407...
477
 
407
 
478
//    u32     saved_config_space[16]; /* config space saved at suspend time */
408
//    u32     saved_config_space[16]; /* config space saved at suspend time */
479
//    struct hlist_head saved_cap_space;
409
//    struct hlist_head saved_cap_space;
480
//    struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
410
//    struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
481
//    int rom_attr_enabled;       /* has display of the rom attribute been enabled? */
411
    int rom_attr_enabled;       /* has display of the rom attribute been enabled? */
482
//    struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
412
//    struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
483
//    struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */
413
//    struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */
Line 484... Line 414...
484
};
414
};
Line -... Line 550...
-
 
550
 
Line 620... Line 551...
620
 
551
 
Line 621... Line 552...
621
 
552
 
Line 640... Line 571...
640
int pci_bus_find_ext_capability(struct pci_bus *bus, unsigned int devfn,
571
int pci_bus_find_ext_capability(struct pci_bus *bus, unsigned int devfn,
641
				int cap);
572
				int cap);
642
int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
573
int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
643
struct pci_bus * pci_find_next_bus(const struct pci_bus *from);
574
struct pci_bus * pci_find_next_bus(const struct pci_bus *from);
644
 
575
unsigned int pci_scan_child_bus(struct pci_bus *bus);
-
 
576
void pcibios_fixup_bus(struct pci_bus *b);
-
 
577
 
-
 
578
 
Line 645... Line 579...
645
static inline bool pci_is_root_bus(struct pci_bus *pbus)
579
static inline bool pci_is_root_bus(struct pci_bus *pbus)
646
{
580
{
647
    return !(pbus->parent);
581
    return !(pbus->parent);
648
}
582
}
Line 673... Line 607...
673
{
607
{
674
    return !!pci_pcie_cap(dev);
608
    return !!pci_pcie_cap(dev);
675
}
609
}
676
 
610
 
Line -... Line 611...
-
 
611
 
-
 
612
int pci_read_config_dyte(struct pci_dev *dev, int where, u16 *val);
-
 
613
int pci_read_config_word(struct pci_dev *dev, int where, u16 *val);
-
 
614
int pci_read_config_dword(struct pci_dev *dev, int where, u32 *val);
-
 
615
 
-
 
616
 
-
 
617
static inline int pci_iov_init(struct pci_dev *dev)
-
 
618
{
-
 
619
    return -ENODEV;
-
 
620
}
-
 
621
static inline void pci_iov_release(struct pci_dev *dev)
-
 
622
 
-
 
623
{
-
 
624
}
-
 
625
static inline int pci_iov_resource_bar(struct pci_dev *dev, int resno,
-
 
626
                       enum pci_bar_type *type)
-
 
627
{
-
 
628
    return 0;
-
 
629
}
-
 
630
static inline void pci_restore_iov_state(struct pci_dev *dev)
-
 
631
{
-
 
632
}
-
 
633
static inline int pci_iov_bus_range(struct pci_bus *bus)
-
 
634
{
-
 
635
    return 0;
-
 
636
}
-
 
637
 
-
 
638
static inline int pci_enable_ats(struct pci_dev *dev, int ps)
-
 
639
{
-
 
640
    return -ENODEV;
-
 
641
}
-
 
642
static inline void pci_disable_ats(struct pci_dev *dev)
-
 
643
{
-
 
644
}
-
 
645
static inline int pci_ats_queue_depth(struct pci_dev *dev)
-
 
646
{
-
 
647
    return -ENODEV;
-
 
648
}
-
 
649
static inline int pci_ats_enabled(struct pci_dev *dev)
-
 
650
{
-
 
651
    return 0;
-
 
652
}
-
 
653
 
677
#define pci_name(x) "radeon"
654
#define pci_name(x) "radeon"
Line 678... Line 655...
678
 
655