Rev 5056 | Rev 6082 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5056 | Rev 5270 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | */ |
15 | */ |
16 | #ifndef LINUX_PCI_H |
16 | #ifndef LINUX_PCI_H |
17 | #define LINUX_PCI_H |
17 | #define LINUX_PCI_H |
Line 18... | Line 18... | ||
18 | 18 | ||
19 | #include |
19 | #include |
- | 20 | #include |
|
- | 21 | #include |
|
- | 22 | #include |
|
- | 23 | #include |
|
20 | #include |
24 | |
21 | #include |
25 | #include |
Line 22... | Line 26... | ||
22 | #include |
26 | #include |
23 | 27 | ||
Line 309... | Line 313... | ||
309 | enum pci_bus_flags { |
313 | enum pci_bus_flags { |
310 | PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1, |
314 | PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1, |
311 | PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, |
315 | PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, |
312 | }; |
316 | }; |
Line -... | Line 317... | ||
- | 317 | ||
- | 318 | /* These values come from the PCI Express Spec */ |
|
- | 319 | enum pcie_link_width { |
|
- | 320 | PCIE_LNK_WIDTH_RESRV = 0x00, |
|
- | 321 | PCIE_LNK_X1 = 0x01, |
|
- | 322 | PCIE_LNK_X2 = 0x02, |
|
- | 323 | PCIE_LNK_X4 = 0x04, |
|
- | 324 | PCIE_LNK_X8 = 0x08, |
|
- | 325 | PCIE_LNK_X12 = 0x0C, |
|
- | 326 | PCIE_LNK_X16 = 0x10, |
|
- | 327 | PCIE_LNK_X32 = 0x20, |
|
- | 328 | PCIE_LNK_WIDTH_UNKNOWN = 0xFF, |
|
- | 329 | }; |
|
313 | 330 | ||
314 | /* Based on the PCI Hotplug Spec, but some values are made up by us */ |
331 | /* Based on the PCI Hotplug Spec, but some values are made up by us */ |
315 | enum pci_bus_speed { |
332 | enum pci_bus_speed { |
316 | PCI_SPEED_33MHz = 0x00, |
333 | PCI_SPEED_33MHz = 0x00, |
317 | PCI_SPEED_66MHz = 0x01, |
334 | PCI_SPEED_66MHz = 0x01, |
Line 336... | Line 353... | ||
336 | PCIE_SPEED_5_0GT = 0x15, |
353 | PCIE_SPEED_5_0GT = 0x15, |
337 | PCIE_SPEED_8_0GT = 0x16, |
354 | PCIE_SPEED_8_0GT = 0x16, |
338 | PCI_SPEED_UNKNOWN = 0xff, |
355 | PCI_SPEED_UNKNOWN = 0xff, |
339 | }; |
356 | }; |
Line -... | Line 357... | ||
- | 357 | ||
- | 358 | struct pci_cap_saved_data { |
|
- | 359 | u16 cap_nr; |
|
- | 360 | bool cap_extended; |
|
- | 361 | unsigned int size; |
|
- | 362 | u32 data[0]; |
|
- | 363 | }; |
|
- | 364 | ||
- | 365 | struct pci_cap_saved_state { |
|
- | 366 | struct hlist_node next; |
|
- | 367 | struct pci_cap_saved_data cap; |
|
- | 368 | }; |
|
- | 369 | ||
- | 370 | struct pcie_link_state; |
|
- | 371 | struct pci_vpd; |
|
- | 372 | struct pci_sriov; |
|
- | 373 | struct pci_ats; |
|
340 | 374 | ||
341 | /* |
375 | /* |
342 | * The pci_dev structure is used to describe PCI devices. |
376 | * The pci_dev structure is used to describe PCI devices. |
343 | */ |
377 | */ |
344 | struct pci_dev { |
378 | struct pci_dev { |
Line 347... | Line 381... | ||
347 | struct pci_bus *subordinate; /* bus this device bridges to */ |
381 | struct pci_bus *subordinate; /* bus this device bridges to */ |
Line 348... | Line 382... | ||
348 | 382 | ||
349 | void *sysdata; /* hook for sys-specific extension */ |
383 | void *sysdata; /* hook for sys-specific extension */ |
350 | // struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */ |
384 | // struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */ |
351 | struct pci_slot *slot; /* Physical slot this device is in */ |
385 | struct pci_slot *slot; /* Physical slot this device is in */ |
352 | u32_t busnr; |
386 | u32 busnr; |
353 | unsigned int devfn; /* encoded device & function index */ |
387 | unsigned int devfn; /* encoded device & function index */ |
354 | unsigned short vendor; |
388 | unsigned short vendor; |
355 | unsigned short device; |
389 | unsigned short device; |
356 | unsigned short subsystem_vendor; |
390 | unsigned short subsystem_vendor; |
Line 363... | Line 397... | ||
363 | u8 rom_base_reg; /* which config register controls the ROM */ |
397 | u8 rom_base_reg; /* which config register controls the ROM */ |
364 | u8 pin; /* which interrupt pin this device uses */ |
398 | u8 pin; /* which interrupt pin this device uses */ |
365 | u16 pcie_flags_reg; /* cached PCI-E Capabilities Register */ |
399 | u16 pcie_flags_reg; /* cached PCI-E Capabilities Register */ |
Line 366... | Line 400... | ||
366 | 400 | ||
367 | // struct pci_driver *driver; /* which driver has allocated this device */ |
401 | // struct pci_driver *driver; /* which driver has allocated this device */ |
368 | uint64_t dma_mask; /* Mask of the bits of bus address this |
402 | u64 dma_mask; /* Mask of the bits of bus address this |
369 | device implements. Normally this is |
403 | device implements. Normally this is |
370 | 0xffffffff. You only need to change |
404 | 0xffffffff. You only need to change |
371 | this if your device has broken DMA |
405 | this if your device has broken DMA |
Line 546... | Line 580... | ||
546 | 580 | ||
547 | switch (err) { |
581 | switch (err) { |
548 | case PCIBIOS_FUNC_NOT_SUPPORTED: |
582 | case PCIBIOS_FUNC_NOT_SUPPORTED: |
549 | return -ENOENT; |
583 | return -ENOENT; |
550 | case PCIBIOS_BAD_VENDOR_ID: |
584 | case PCIBIOS_BAD_VENDOR_ID: |
551 | return -EINVAL; |
585 | return -ENOTTY; |
552 | case PCIBIOS_DEVICE_NOT_FOUND: |
586 | case PCIBIOS_DEVICE_NOT_FOUND: |
553 | return -ENODEV; |
587 | return -ENODEV; |
554 | case PCIBIOS_BAD_REGISTER_NUMBER: |
588 | case PCIBIOS_BAD_REGISTER_NUMBER: |
555 | return -EFAULT; |
589 | return -EFAULT; |
556 | case PCIBIOS_SET_FAILED: |
590 | case PCIBIOS_SET_FAILED: |
557 | return -EIO; |
591 | return -EIO; |
558 | case PCIBIOS_BUFFER_TOO_SMALL: |
592 | case PCIBIOS_BUFFER_TOO_SMALL: |
559 | return -ENOSPC; |
593 | return -ENOSPC; |
Line 560... | Line 594... | ||
560 | } |
594 | } |
561 | 595 | ||
Line 562... | Line 596... | ||
562 | return -ENOTTY; |
596 | return -ERANGE; |
Line 563... | Line 597... | ||
563 | } |
597 | } |
564 | 598 | ||
565 | /* Low-level architecture-dependent routines */ |
599 | /* Low-level architecture-dependent routines */ |
566 | 600 | ||
Line -... | Line 601... | ||
- | 601 | struct pci_ops { |
|
- | 602 | int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val); |
|
- | 603 | int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); |
|
- | 604 | }; |
|
- | 605 | ||
- | 606 | /* |
|
- | 607 | * ACPI needs to be able to access PCI config space before we've done a |
|
- | 608 | * PCI bus scan and created pci_bus structures. |
|
- | 609 | */ |
|
- | 610 | int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, |
|
- | 611 | int reg, int len, u32 *val); |
|
- | 612 | int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, |
|
- | 613 | int reg, int len, u32 val); |
|
Line 567... | Line 614... | ||
567 | struct pci_ops { |
614 | |
568 | int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val); |
615 | struct pci_bus_region { |
569 | int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); |
616 | dma_addr_t start; |
570 | }; |
617 | dma_addr_t end; |