Subversion Repositories Kolibri OS

Rev

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

Rev 1627 Rev 1628
Line 1... Line 1...
1
#include 
1
#include 
2
#include 
2
#include 
-
 
3
#include 
Line 3... Line 4...
3
 
4
 
4
#ifndef __PCI_H__
5
#ifndef __PCI_H__
Line -... Line 6...
-
 
6
#define __PCI_H__
-
 
7
 
-
 
8
 
-
 
9
/* pci_slot represents a physical slot */
-
 
10
struct pci_slot {
-
 
11
    struct pci_bus *bus;        /* The bus this slot is on */
-
 
12
    struct list_head list;      /* node in list of slots on this bus */
-
 
13
//    struct hotplug_slot *hotplug;   /* Hotplug info (migrate over time) */
-
 
14
    unsigned char number;       /* PCI_SLOT(pci_dev->devfn) */
-
 
15
//    struct kobject kobj;
-
 
16
};
5
#define __PCI_H__
17
 
Line 6... Line 18...
6
 
18
 
7
#define PCI_ANY_ID (~0)
19
#define PCI_ANY_ID (~0)
Line 132... Line 144...
132
 
144
 
Line 133... Line 145...
133
#define PCI_CLASS_OTHERS                0xff
145
#define PCI_CLASS_OTHERS                0xff
Line 134... Line -...
134
 
-
 
135
 
-
 
136
/*
-
 
137
 * Under PCI, each device has 256 bytes of configuration address space,
-
 
138
 * of which the first 64 bytes are standardized as follows:
-
 
139
 */
-
 
140
#define PCI_VENDOR_ID                   0x000    /* 16 bits */
-
 
141
#define PCI_DEVICE_ID                   0x002    /* 16 bits */
-
 
142
#define PCI_COMMAND                     0x004    /* 16 bits */
-
 
143
#define  PCI_COMMAND_IO                 0x001    /* Enable response in I/O space */
-
 
144
#define  PCI_COMMAND_MEMORY             0x002    /* Enable response in Memory space */
-
 
145
#define  PCI_COMMAND_MASTER             0x004    /* Enable bus mastering */
-
 
146
#define  PCI_COMMAND_SPECIAL            0x008    /* Enable response to special cycles */
-
 
147
#define  PCI_COMMAND_INVALIDATE         0x010    /* Use memory write and invalidate */
-
 
148
#define  PCI_COMMAND_VGA_PALETTE        0x020    /* Enable palette snooping */
-
 
149
#define  PCI_COMMAND_PARITY             0x040    /* Enable parity checking */
-
 
150
#define  PCI_COMMAND_WAIT               0x080    /* Enable address/data stepping */
-
 
151
#define  PCI_COMMAND_SERR               0x100    /* Enable SERR */
-
 
152
#define  PCI_COMMAND_FAST_BACK          0x200    /* Enable back-to-back writes */
-
 
153
#define  PCI_COMMAND_INTX_DISABLE       0x400    /* INTx Emulation Disable */
-
 
154
 
-
 
155
#define PCI_STATUS                      0x006    /* 16 bits */
-
 
156
#define  PCI_STATUS_CAP_LIST            0x010    /* Support Capability List */
-
 
157
#define  PCI_STATUS_66MHZ               0x020    /* Support 66 Mhz PCI 2.1 bus */
-
 
158
#define  PCI_STATUS_UDF                 0x040    /* Support User Definable Features [obsolete] */
-
 
159
#define  PCI_STATUS_FAST_BACK           0x080    /* Accept fast-back to back */
-
 
160
#define  PCI_STATUS_PARITY              0x100    /* Detected parity error */
-
 
161
#define  PCI_STATUS_DEVSEL_MASK         0x600    /* DEVSEL timing */
-
 
162
#define  PCI_STATUS_DEVSEL_FAST         0x000
-
 
163
#define  PCI_STATUS_DEVSEL_MEDIUM       0x200
-
 
164
#define  PCI_STATUS_DEVSEL_SLOW         0x400
-
 
165
#define  PCI_STATUS_SIG_TARGET_ABORT    0x800    /* Set on target abort */
-
 
166
#define  PCI_STATUS_REC_TARGET_ABORT    0x1000   /* Master ack of " */
-
 
167
#define  PCI_STATUS_REC_MASTER_ABORT    0x2000   /* Set on master abort */
-
 
168
#define  PCI_STATUS_SIG_SYSTEM_ERROR    0x4000   /* Set when we drive SERR */
-
 
169
#define  PCI_STATUS_DETECTED_PARITY     0x8000   /* Set on parity error */
-
 
170
 
-
 
171
#define PCI_CLASS_REVISION               0x08    /* High 24 bits are class, low 8 revision */
-
 
172
#define PCI_REVISION_ID                  0x08    /* Revision ID */
-
 
173
#define PCI_CLASS_PROG                   0x09    /* Reg. Level Programming Interface */
-
 
174
#define PCI_CLASS_DEVICE                 0x0a    /* Device class */
-
 
175
 
-
 
176
#define PCI_CACHE_LINE_SIZE              0x0c    /* 8 bits */
-
 
177
#define PCI_LATENCY_TIMER                0x0d    /* 8 bits */
-
 
178
#define PCI_HEADER_TYPE                  0x0e    /* 8 bits */
-
 
179
#define  PCI_HEADER_TYPE_NORMAL             0
-
 
180
#define  PCI_HEADER_TYPE_BRIDGE             1
-
 
181
#define  PCI_HEADER_TYPE_CARDBUS            2
-
 
182
 
-
 
183
#define PCI_BIST                         0x0f    /* 8 bits */
-
 
184
#define  PCI_BIST_CODE_MASK              0x0f    /* Return result */
-
 
185
#define  PCI_BIST_START                  0x40    /* 1 to start BIST, 2 secs or less */
-
 
186
#define  PCI_BIST_CAPABLE                0x80    /* 1 if BIST capable */
-
 
187
 
-
 
188
/*
-
 
189
 * Base addresses specify locations in memory or I/O space.
-
 
190
 * Decoded size can be determined by writing a value of
-
 
191
 * 0xffffffff to the register, and reading it back.  Only
-
 
192
 * 1 bits are decoded.
-
 
193
 */
-
 
194
#define  PCI_BASE_ADDRESS_0             0x10    /* 32 bits */
-
 
195
#define  PCI_BASE_ADDRESS_1             0x14    /* 32 bits [htype 0,1 only] */
-
 
196
#define  PCI_BASE_ADDRESS_2             0x18    /* 32 bits [htype 0 only] */
-
 
197
#define  PCI_BASE_ADDRESS_3             0x1c    /* 32 bits */
-
 
198
#define  PCI_BASE_ADDRESS_4             0x20    /* 32 bits */
-
 
199
#define  PCI_BASE_ADDRESS_5             0x24    /* 32 bits */
-
 
200
#define  PCI_BASE_ADDRESS_SPACE         0x01    /* 0 = memory, 1 = I/O */
-
 
201
#define  PCI_BASE_ADDRESS_SPACE_IO      0x01
-
 
202
#define  PCI_BASE_ADDRESS_SPACE_MEMORY  0x00
-
 
203
#define  PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06
-
 
204
#define  PCI_BASE_ADDRESS_MEM_TYPE_32   0x00    /* 32 bit address */
-
 
205
#define  PCI_BASE_ADDRESS_MEM_TYPE_1M   0x02    /* Below 1M [obsolete] */
-
 
206
#define  PCI_BASE_ADDRESS_MEM_TYPE_64   0x04    /* 64 bit address */
-
 
207
#define  PCI_BASE_ADDRESS_MEM_PREFETCH  0x08    /* prefetchable? */
-
 
208
#define  PCI_BASE_ADDRESS_MEM_MASK      (~0x0fUL)
-
 
209
#define  PCI_BASE_ADDRESS_IO_MASK       (~0x03UL)
-
 
210
/* bit 1 is reserved if address_space = 1 */
-
 
211
 
-
 
212
#define PCI_ROM_ADDRESS1                0x38    /* Same as PCI_ROM_ADDRESS, but for htype 1 */
-
 
213
 
-
 
214
/* Header type 0 (normal devices) */
-
 
215
#define PCI_CARDBUS_CIS                  0x28
-
 
216
#define PCI_SUBSYSTEM_VENDOR_ID          0x2c
-
 
217
#define PCI_SUBSYSTEM_ID                 0x2e
-
 
218
#define PCI_ROM_ADDRESS                  0x30    /* Bits 31..11 are address, 10..1 reserved */
-
 
219
#define  PCI_ROM_ADDRESS_ENABLE          0x01
-
 
220
#define PCI_ROM_ADDRESS_MASK             (~0x7ffUL)
-
 
221
 
-
 
222
#define PCI_INTERRUPT_LINE               0x3c    /* 8 bits */
-
 
223
#define PCI_INTERRUPT_PIN                0x3d    /* 8 bits */
-
 
224
 
-
 
225
 
-
 
226
#define PCI_CB_SUBSYSTEM_VENDOR_ID       0x40
-
 
227
#define PCI_CB_SUBSYSTEM_ID              0x42
-
 
228
 
-
 
229
#define PCI_CAPABILITY_LIST              0x34    /* Offset of first capability list entry */
-
 
230
#define PCI_CB_CAPABILITY_LIST           0x14
-
 
231
/* Capability lists */
-
 
232
 
-
 
233
#define PCI_CAP_LIST_ID                  0       /* Capability ID */
-
 
234
#define  PCI_CAP_ID_PM                   0x01    /* Power Management */
-
 
235
#define  PCI_CAP_ID_AGP                  0x02    /* Accelerated Graphics Port */
-
 
236
#define  PCI_CAP_ID_VPD                  0x03    /* Vital Product Data */
-
 
237
#define  PCI_CAP_ID_SLOTID               0x04    /* Slot Identification */
-
 
238
#define  PCI_CAP_ID_MSI                  0x05    /* Message Signalled Interrupts */
-
 
239
#define  PCI_CAP_ID_CHSWP                0x06    /* CompactPCI HotSwap */
-
 
240
#define  PCI_CAP_ID_PCIX                 0x07    /* PCI-X */
-
 
241
#define  PCI_CAP_ID_HT                   0x08    /* HyperTransport */
-
 
242
#define  PCI_CAP_ID_VNDR                 0x09    /* Vendor specific capability */
-
 
243
#define  PCI_CAP_ID_SHPC                 0x0C    /* PCI Standard Hot-Plug Controller */
-
 
244
#define  PCI_CAP_ID_EXP                  0x10    /* PCI Express */
-
 
245
#define  PCI_CAP_ID_MSIX                 0x11    /* MSI-X */
-
 
246
#define PCI_CAP_LIST_NEXT                1       /* Next capability in the list */
-
 
247
#define PCI_CAP_FLAGS                    2       /* Capability defined flags (16 bits) */
-
 
248
#define PCI_CAP_SIZEOF                   4
-
 
249
 
-
 
250
 
-
 
251
/* AGP registers */
-
 
252
 
-
 
253
#define PCI_AGP_VERSION                     2   /* BCD version number */
-
 
254
#define PCI_AGP_RFU                         3   /* Rest of capability flags */
-
 
255
#define PCI_AGP_STATUS                      4   /* Status register */
-
 
256
#define  PCI_AGP_STATUS_RQ_MASK        0xff000000  /* Maximum number of requests - 1 */
-
 
257
#define  PCI_AGP_STATUS_SBA            0x0200   /* Sideband addressing supported */
-
 
258
#define  PCI_AGP_STATUS_64BIT          0x0020   /* 64-bit addressing supported */
-
 
259
#define  PCI_AGP_STATUS_FW             0x0010   /* FW transfers supported */
-
 
260
#define  PCI_AGP_STATUS_RATE4          0x0004   /* 4x transfer rate supported */
-
 
261
#define  PCI_AGP_STATUS_RATE2          0x0002   /* 2x transfer rate supported */
-
 
262
#define  PCI_AGP_STATUS_RATE1          0x0001   /* 1x transfer rate supported */
-
 
263
#define PCI_AGP_COMMAND                     8   /* Control register */
-
 
264
#define  PCI_AGP_COMMAND_RQ_MASK    0xff000000  /* Master: Maximum number of requests */
-
 
265
#define  PCI_AGP_COMMAND_SBA           0x0200   /* Sideband addressing enabled */
-
 
266
#define  PCI_AGP_COMMAND_AGP           0x0100   /* Allow processing of AGP transactions */
-
 
267
#define  PCI_AGP_COMMAND_64BIT         0x0020   /* Allow processing of 64-bit addresses */
-
 
268
#define  PCI_AGP_COMMAND_FW            0x0010   /* Force FW transfers */
-
 
269
#define  PCI_AGP_COMMAND_RATE4         0x0004   /* Use 4x rate */
-
 
270
#define  PCI_AGP_COMMAND_RATE2         0x0002   /* Use 2x rate */
-
 
271
#define  PCI_AGP_COMMAND_RATE1         0x0001   /* Use 1x rate */
-
 
Line 272... Line 146...
272
#define PCI_AGP_SIZEOF                     12
146
 
273
 
147
 
274
 
148
 
Line 332... Line 206...
332
#define PCI_DEVFN(slot, func)  ((((slot) & 0x1f) << 3) | ((func) & 0x07))
206
#define PCI_DEVFN(slot, func)  ((((slot) & 0x1f) << 3) | ((func) & 0x07))
333
#define PCI_SLOT(devfn)        (((devfn) >> 3) & 0x1f)
207
#define PCI_SLOT(devfn)        (((devfn) >> 3) & 0x1f)
334
#define PCI_FUNC(devfn)        ((devfn) & 0x07)
208
#define PCI_FUNC(devfn)        ((devfn) & 0x07)
Line -... Line 209...
-
 
209
 
-
 
210
/* Ioctls for /proc/bus/pci/X/Y nodes. */
-
 
211
#define PCIIOC_BASE		('P' << 24 | 'C' << 16 | 'I' << 8)
-
 
212
#define PCIIOC_CONTROLLER	(PCIIOC_BASE | 0x00)	/* Get controller for PCI device. */
-
 
213
#define PCIIOC_MMAP_IS_IO	(PCIIOC_BASE | 0x01)	/* Set mmap state to I/O space. */
-
 
214
#define PCIIOC_MMAP_IS_MEM	(PCIIOC_BASE | 0x02)	/* Set mmap state to MEM space. */
-
 
215
#define PCIIOC_WRITE_COMBINE	(PCIIOC_BASE | 0x03)	/* Enable/disable write-combining. */
-
 
216
 
-
 
217
 
-
 
218
typedef unsigned int __bitwise pci_channel_state_t;
-
 
219
 
-
 
220
enum pci_channel_state {
-
 
221
    /* I/O channel is in normal state */
-
 
222
    pci_channel_io_normal = (__force pci_channel_state_t) 1,
-
 
223
 
-
 
224
    /* I/O to channel is blocked */
-
 
225
    pci_channel_io_frozen = (__force pci_channel_state_t) 2,
-
 
226
 
-
 
227
    /* PCI card is dead */
-
 
228
    pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
Line 335... Line 229...
335
 
229
};
Line 336... Line 230...
336
 
230
 
Line 352... Line 246...
352
         unsigned long flags;
246
         unsigned long flags;
353
         struct resource *parent, *sibling, *child;
247
         struct resource *parent, *sibling, *child;
354
};
248
};
355
 
249
 
Line -... Line 250...
-
 
250
/* This defines the direction arg to the DMA mapping routines. */
-
 
251
#define PCI_DMA_BIDIRECTIONAL	0
-
 
252
#define PCI_DMA_TODEVICE	1
-
 
253
#define PCI_DMA_FROMDEVICE	2
-
 
254
#define PCI_DMA_NONE		3
Line 356... Line 255...
356
 
255
 
357
/*
256
/*
358
 *  For PCI devices, the region numbers are assigned this way:
257
 *  For PCI devices, the region numbers are assigned this way:
359
 */
258
 */
Line 452... Line 351...
452
/* PCI control bits.  Shares IORESOURCE_BITS with above PCI ROM.  */
351
/* PCI control bits.  Shares IORESOURCE_BITS with above PCI ROM.  */
453
#define IORESOURCE_PCI_FIXED            (1<<4)  /* Do not move resource */
352
#define IORESOURCE_PCI_FIXED            (1<<4)  /* Do not move resource */
Line -... Line 353...
-
 
353
 
-
 
354
 
454
 
355
 
455
 
356
 
456
/*
357
/*
457
 *  For PCI devices, the region numbers are assigned this way:
358
 *  For PCI devices, the region numbers are assigned this way:
458
 *
359
 *
Line 470... Line 371...
470
#endif
371
#endif
471
 
372
 
Line 472... Line 373...
472
#define DEVICE_COUNT_RESOURCE   12
373
#define DEVICE_COUNT_RESOURCE   12
Line -... Line 374...
-
 
374
 
-
 
375
 
-
 
376
#define PCI_CFG_SPACE_SIZE      256
-
 
377
#define PCI_CFG_SPACE_EXP_SIZE  4096
-
 
378
 
-
 
379
 
-
 
380
typedef int __bitwise pci_power_t;
-
 
381
 
-
 
382
#define PCI_D0      ((pci_power_t __force) 0)
-
 
383
#define PCI_D1      ((pci_power_t __force) 1)
-
 
384
#define PCI_D2      ((pci_power_t __force) 2)
-
 
385
#define PCI_D3hot   ((pci_power_t __force) 3)
-
 
386
#define PCI_D3cold  ((pci_power_t __force) 4)
-
 
387
#define PCI_UNKNOWN ((pci_power_t __force) 5)
-
 
388
#define PCI_POWER_ERROR ((pci_power_t __force) -1)
473
 
389
 
474
/*
390
/*
475
 * The pci_dev structure is used to describe PCI devices.
391
 * The pci_dev structure is used to describe PCI devices.
476
 */
392
 */
477
struct pci_dev {
393
struct pci_dev {
478
//    struct list_head bus_list;  /* node in per-bus list */
394
    struct list_head bus_list;  /* node in per-bus list */
479
//    struct pci_bus  *bus;       /* bus this device is on */
395
    struct pci_bus  *bus;       /* bus this device is on */
Line 480... Line 396...
480
//    struct pci_bus  *subordinate;   /* bus this device bridges to */
396
    struct pci_bus  *subordinate;   /* bus this device bridges to */
481
 
397
 
482
//    void        *sysdata;       /* hook for sys-specific extension */
398
    void        *sysdata;       /* hook for sys-specific extension */
483
//    struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */
399
//    struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */
484
//    struct pci_slot *slot;      /* Physical slot this device is in */
400
    struct pci_slot *slot;      /* Physical slot this device is in */
485
    u32_t        bus;
401
    u32_t        busnr;
486
    u32_t        devfn;          /* encoded device & function index */
402
	unsigned int	devfn;		/* encoded device & function index */
487
    u16_t        vendor;
403
	unsigned short	vendor;
488
    u16_t        device;
404
	unsigned short	device;
489
    u16_t        subsystem_vendor;
405
	unsigned short	subsystem_vendor;
490
    u16_t        subsystem_device;
406
	unsigned short	subsystem_device;
491
    u32_t        class;         /* 3 bytes: (base,sub,prog-if) */
407
	unsigned int	class;		/* 3 bytes: (base,sub,prog-if) */
-
 
408
	u8		revision;	/* PCI revision, low byte of class word */
492
    uint8_t      revision;      /* PCI revision, low byte of class word */
409
	u8		hdr_type;	/* PCI header type (`multi' flag masked out) */
493
    uint8_t      hdr_type;      /* PCI header type (`multi' flag masked out) */
410
	u8		pcie_cap;	/* PCI-E capability offset */
494
    uint8_t      pcie_type;     /* PCI-E device/port type */
411
    u8           pcie_type;     /* PCI-E device/port type */
Line 495... Line 412...
495
    uint8_t      rom_base_reg;   /* which config register controls the ROM */
412
	u8		rom_base_reg;	/* which config register controls the ROM */
496
    uint8_t      pin;           /* which interrupt pin this device uses */
413
	u8		pin;  		/* which interrupt pin this device uses */
497
 
414
 
498
 //   struct pci_driver *driver;  /* which driver has allocated this device */
415
 //   struct pci_driver *driver;  /* which driver has allocated this device */
499
    uint64_t     dma_mask;   /* Mask of the bits of bus address this
416
	u64		dma_mask;	/* Mask of the bits of bus address this
500
                       device implements.  Normally this is
417
                       device implements.  Normally this is
Line 501... Line 418...
501
                       0xffffffff.  You only need to change
418
                       0xffffffff.  You only need to change
Line 502... Line 419...
502
                       this if your device has broken DMA
419
                       this if your device has broken DMA
503
                       or supports 64-bit transfers.  */
420
                       or supports 64-bit transfers.  */
504
 
421
 
505
 //   struct device_dma_parameters dma_parms;
422
 //   struct device_dma_parameters dma_parms;
506
 
423
 
507
//    pci_power_t     current_state;  /* Current operating state. In ACPI-speak,
424
    pci_power_t     current_state;  /* Current operating state. In ACPI-speak,
508
 //                      this is D0-D3, D0 being fully functional,
425
                                       this is D0-D3, D0 being fully functional,
-
 
426
                                       and D3 being off. */
509
//                       and D3 being off. */
427
    int     pm_cap;     /* PM capability offset in the
510
//    int     pm_cap;     /* PM capability offset in the
428
                           configuration space */
511
//                       configuration space */
429
    unsigned int    pme_support:5;  /* Bitmask of states from which PME#
-
 
430
                       can be generated */
-
 
431
	unsigned int	pme_interrupt:1;
-
 
432
    unsigned int    d1_support:1;   /* Low power state D1 is supported */
-
 
433
    unsigned int    d2_support:1;   /* Low power state D2 is supported */
Line 512... Line 434...
512
    unsigned int    pme_support:5;  /* Bitmask of states from which PME#
434
    unsigned int    no_d1d2:1;  /* Only allow D0 and D3 */
513
                       can be generated */
435
	unsigned int	mmio_always_on:1;	/* disallow turning off io/mem
Line 514... Line 436...
514
    unsigned int    d1_support:1;   /* Low power state D1 is supported */
436
						   decoding during bar sizing */
Line 515... Line 437...
515
    unsigned int    d2_support:1;   /* Low power state D2 is supported */
437
	unsigned int	wakeup_prepared:1;
516
    unsigned int    no_d1d2:1;  /* Only allow D0 and D3 */
438
	unsigned int	d3_delay;	/* D3->D0 transition time in ms */
517
 
439
 
518
//    pci_channel_state_t error_state;    /* current connectivity state */
440
    pci_channel_state_t error_state;    /* current connectivity state */
Line 540... Line 462...
540
    unsigned int    msi_enabled:1;
462
    unsigned int    msi_enabled:1;
541
    unsigned int    msix_enabled:1;
463
    unsigned int    msix_enabled:1;
542
    unsigned int    ari_enabled:1;  /* ARI forwarding */
464
    unsigned int    ari_enabled:1;  /* ARI forwarding */
543
    unsigned int    is_managed:1;
465
    unsigned int    is_managed:1;
544
    unsigned int    is_pcie:1;
466
	unsigned int	is_pcie:1;	/* Obsolete. Will be removed.
-
 
467
					   Use pci_is_pcie() instead */
545
    unsigned int    state_saved:1;
468
	unsigned int    needs_freset:1; /* Dev requires fundamental reset */
-
 
469
    unsigned int    state_saved:1;
546
    unsigned int    is_physfn:1;
470
    unsigned int    is_physfn:1;
547
    unsigned int    is_virtfn:1;
471
    unsigned int    is_virtfn:1;
548
//    pci_dev_flags_t dev_flags;
472
	unsigned int	reset_fn:1;
-
 
473
	unsigned int    is_hotplug_bridge:1;
549
//    atomic_t    enable_cnt;   /* pci_enable_device has been called */
474
	unsigned int    __aer_firmware_first_valid:1;
550
 
475
	unsigned int	__aer_firmware_first:1;
-
 
476
 
-
 
477
 
Line 551... Line 478...
551
//    u32     saved_config_space[16]; /* config space saved at suspend time */
478
//    u32     saved_config_space[16]; /* config space saved at suspend time */
552
//    struct hlist_head saved_cap_space;
479
//    struct hlist_head saved_cap_space;
553
//    struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
480
//    struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
554
//    int rom_attr_enabled;       /* has display of the rom attribute been enabled? */
481
//    int rom_attr_enabled;       /* has display of the rom attribute been enabled? */
Line 604... Line 531...
604
    int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val);
531
    int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val);
605
    int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val);
532
    int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val);
606
};
533
};
607
 
534
 
Line -... Line 535...
-
 
535
/*
-
 
536
 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
-
 
537
 * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-
 
538
 * buses below host bridges or subtractive decode bridges) go in the list.
-
 
539
 * Use pci_bus_for_each_resource() to iterate through all the resources.
-
 
540
 */
-
 
541
 
-
 
542
/*
-
 
543
 * PCI_SUBTRACTIVE_DECODE means the bridge forwards the window implicitly
-
 
544
 * and there's no way to program the bridge with the details of the window.
-
 
545
 * This does not apply to ACPI _CRS windows, even with the _DEC subtractive-
-
 
546
 * decode bit set, because they are explicit and can be programmed with _SRS.
-
 
547
 */
-
 
548
#define PCI_SUBTRACTIVE_DECODE	0x1
-
 
549
 
-
 
550
struct pci_bus_resource {
-
 
551
	struct list_head list;
-
 
552
	struct resource *res;
-
 
553
	unsigned int flags;
-
 
554
};
-
 
555
 
-
 
556
#define PCI_REGION_FLAG_MASK	0x0fU	/* These bits of resource flags tell us the PCI region flags */
Line 608... Line 557...
608
 
557
 
609
struct pci_bus {
558
struct pci_bus {
610
    struct list_head node;      /* node in list of buses */
559
    struct list_head node;      /* node in list of buses */
611
    struct pci_bus  *parent;    /* parent bus this bridge is on */
560
    struct pci_bus  *parent;    /* parent bus this bridge is on */
Line 636... Line 585...
636
};
585
};
637
 
586
 
Line 638... Line 587...
638
#define pci_bus_b(n)    list_entry(n, struct pci_bus, node)
587
#define pci_bus_b(n)    list_entry(n, struct pci_bus, node)
639
#define to_pci_bus(n)   container_of(n, struct pci_bus, dev)
588
#define to_pci_bus(n)   container_of(n, struct pci_bus, dev)
-
 
589
#define pci_dev_b(n)    list_entry(n, struct pci_dev, bus_list)
-
 
590
#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
-
 
591
#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
Line 640... Line 592...
640
 
592
 
641
 
593
 
642
static inline int pci_domain_nr(struct pci_bus *bus)
594
static inline int pci_domain_nr(struct pci_bus *bus)
643
{
595
{
644
    struct pci_sysdata *sd = bus->sysdata;
596
    struct pci_sysdata *sd = bus->sysdata;
-
 
597
    return sd->domain;
-
 
598
}
-
 
599
static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false; }
-
 
600
 
-
 
601
/*
-
 
602
 * Error values that may be returned by PCI functions.
-
 
603
 */
-
 
604
#define PCIBIOS_SUCCESSFUL		0x00
-
 
605
#define PCIBIOS_FUNC_NOT_SUPPORTED	0x81
-
 
606
#define PCIBIOS_BAD_VENDOR_ID		0x83
-
 
607
#define PCIBIOS_DEVICE_NOT_FOUND	0x86
-
 
608
#define PCIBIOS_BAD_REGISTER_NUMBER	0x87
-
 
609
#define PCIBIOS_SET_FAILED		0x88
-
 
610
#define PCIBIOS_BUFFER_TOO_SMALL	0x89
-
 
611
 
-
 
612
/* Low-level architecture-dependent routines */
-
 
613
 
-
 
614
struct pci_bus_region {
-
 
615
	resource_size_t start;
-
 
616
	resource_size_t end;
-
 
617
};
-
 
618
 
-
 
619
 
-
 
620
 
-
 
621
 
Line 645... Line 622...
645
    return sd->domain;
622
 
Line 646... Line 623...
646
}
623
 
Line 656... Line 633...
656
int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
633
int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
Line 657... Line 634...
657
 
634
 
658
struct pci_bus * pci_create_bus(int bus, struct pci_ops *ops, void *sysdata);
635
struct pci_bus * pci_create_bus(int bus, struct pci_ops *ops, void *sysdata);
-
 
636
struct pci_bus * pci_find_bus(int domain, int busnr);
-
 
637
int pci_find_capability(struct pci_dev *dev, int cap);
-
 
638
int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
-
 
639
int pci_find_ext_capability(struct pci_dev *dev, int cap);
-
 
640
int pci_bus_find_ext_capability(struct pci_bus *bus, unsigned int devfn,
-
 
641
				int cap);
659
struct pci_bus * pci_find_bus(int domain, int busnr);
642
int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
Line -... Line 643...
-
 
643
struct pci_bus * pci_find_next_bus(const struct pci_bus *from);
-
 
644
 
-
 
645
static inline bool pci_is_root_bus(struct pci_bus *pbus)
-
 
646
{
-
 
647
    return !(pbus->parent);
-
 
648
}
-
 
649
 
-
 
650
/**
-
 
651
 * pci_pcie_cap - get the saved PCIe capability offset
-
 
652
 * @dev: PCI device
-
 
653
 *
-
 
654
 * PCIe capability offset is calculated at PCI device initialization
-
 
655
 * time and saved in the data structure. This function returns saved
-
 
656
 * PCIe capability offset. Using this instead of pci_find_capability()
-
 
657
 * reduces unnecessary search in the PCI configuration space. If you
-
 
658
 * need to calculate PCIe capability offset from raw device for some
-
 
659
 * reasons, please use pci_find_capability() instead.
-
 
660
 */
-
 
661
static inline int pci_pcie_cap(struct pci_dev *dev)
-
 
662
{
Line -... Line 663...
-
 
663
    return dev->pcie_cap;
-
 
664
}
-
 
665
 
-
 
666
/**
-
 
667
 * pci_is_pcie - check if the PCI device is PCI Express capable
-
 
668
 * @dev: PCI device
-
 
669
 *
-
 
670
 * Retrun true if the PCI device is PCI Express capable, false otherwise.
-
 
671
 */
-
 
672
static inline bool pci_is_pcie(struct pci_dev *dev)
Line 660... Line 673...
660
struct pci_bus * pci_find_next_bus(const struct pci_bus *from);
673
{
Line 661... Line 674...
661
 
674
    return !!pci_pcie_cap(dev);