#include <linux/pci.h>#include <linux/config.h>#include <asm/io.h>Include dependency graph for rt_pci.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
| union | bios32 |
Defines | |
| #define | PCI_COMMAND_IO 0x1 |
| #define | PCI_COMMAND_MEM 0x2 |
| #define | PCI_COMMAND_MASTER 0x4 |
| #define | PCI_LATENCY_TIMER 0x0d |
| #define | PCIBIOS_PCI_FUNCTION_ID 0xb1XX |
| #define | PCIBIOS_PCI_BIOS_PRESENT 0xb101 |
| #define | PCIBIOS_FIND_PCI_DEVICE 0xb102 |
| #define | PCIBIOS_FIND_PCI_CLASS_CODE 0xb103 |
| #define | PCIBIOS_GENERATE_SPECIAL_CYCLE 0xb106 |
| #define | PCIBIOS_READ_CONFIG_BYTE 0xb108 |
| #define | PCIBIOS_READ_CONFIG_WORD 0xb109 |
| #define | PCIBIOS_READ_CONFIG_DWORD 0xb10a |
| #define | PCIBIOS_WRITE_CONFIG_BYTE 0xb10b |
| #define | PCIBIOS_WRITE_CONFIG_WORD 0xb10c |
| #define | PCIBIOS_WRITE_CONFIG_DWORD 0xb10d |
| #define | PCIBIOS_SET_PCI_HW_INT 0xb10f |
| #define | PCI_VENDOR_ID 0x00 |
| #define | PCI_DEVICE_ID 0x02 |
| #define | PCI_COMMAND 0x04 |
| #define | PCI_REVISION 0x08 |
| #define | PCI_CLASS_CODE 0x0b |
| #define | PCI_SUBCLASS_CODE 0x0a |
| #define | PCI_HEADER_TYPE 0x0e |
| #define | PCI_BASE_ADDRESS_0 0x10 |
| #define | PCI_BASE_ADDRESS_1 0x14 |
| #define | PCI_BASE_ADDRESS_2 0x18 |
| #define | PCI_BASE_ADDRESS_3 0x1c |
| #define | PCI_BASE_ADDRESS_4 0x20 |
| #define | PCI_BASE_ADDRESS_5 0x24 |
| #define | PCI_INTERRUPT_LINE 0x3c |
| #define | PCI_INTERRUPT_PIN 0x3d |
| #define | PCI_BASE_ADDRESS_IO_MASK (~0x03) |
| #define | PCI_BASE_ADDRESS_SPACE_IO 0x01 |
| #define | PCI_ROM_ADDRESS 0x30 |
| #define | PCI_ROM_ADDRESS_ENABLE 0x01 |
| #define | PCI_FUNC(devfn) ((devfn) & 0x07) |
| #define | bus_number(pci_dev) ((((int)(pci_dev))>>8) & 0xff) |
| #define | devfn_number(pci_dev) (((int)(pci_dev)) & 0xff) |
| #define | BIOS32_SIGNATURE (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24)) |
| #define | PCI_SIGNATURE (('P' << 0) + ('C' << 8) + ('I' << 16) + (' ' << 24)) |
| #define | PCI_SERVICE (('$' << 0) + ('P' << 8) + ('C' << 16) + ('I' << 24)) |
| #define | KERN_CODE_SEG 0x10 |
| #define | rt_pci_read_config_byte(pdev, where, valp) rt_pcibios_read_config_byte(bus_number(pdev), devfn_number(pdev), where, valp) |
| #define | rt_pci_read_config_word(pdev, where, valp) rt_pcibios_read_config_word(bus_number(pdev), devfn_number(pdev), where, valp) |
| #define | rt_pci_read_config_dword(pdev, where, valp) rt_pcibios_read_config_dword(bus_number(pdev), devfn_number(pdev), where, valp) |
| #define | rt_pci_write_config_byte(pdev, where, val) rt_pcibios_write_config_byte(bus_number(pdev), devfn_number(pdev), where, val) |
| #define | rt_pci_write_config_word(pdev, where, val) rt_pcibios_write_config_word(bus_number(pdev), devfn_number(pdev), where, val) |
| #define | rt_pci_write_config_dword(pdev, where, val) rt_pcibios_write_config_dword(bus_number(pdev), devfn_number(pdev), where, val) |
| #define | rt_pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) |
| #define | rt_pci_resource_end(dev, bar) ((dev)->resource[(bar)].end) |
| #define | rt_pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags) |
| #define | rt_pci_resource_len(dev, bar) |
Functions | |
| int | rt_pcibios_read_config_byte (unsigned int bus, unsigned int device_fn, unsigned int where, unsigned char *value) |
| int | rt_rtpcibios_write_config_byte (unsigned int bus, unsigned int device_fn, unsigned int where, unsigned char value) |
| int | rt_pcibios_read_config_word (unsigned int bus, unsigned int device_fn, unsigned int where, unsigned short *value) |
| int | rt_pcibios_write_config_word (unsigned int bus, unsigned int device_fn, unsigned int where, unsigned short value) |
| int | rt_pcibios_read_config_dword (unsigned int bus, unsigned int device_fn, unsigned int where, unsigned int *value) |
| int | rt_pcibios_write_config_dword (unsigned int bus, unsigned int device_fn, unsigned int where, unsigned int value) |
| int | rt_pcibios_set_irq_routing (struct pci_dev *dev, int pin, int irq) |
| int | rt_pci_set_power_state (struct pci_dev *dev, int state) |
| int | rt_pci_find_capability (struct pci_dev *dev, int cap) |
| pci_dev * | rt_pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from) |
| int | rt_pci_enable_device (struct pci_dev *dev) |
| int | rt_pci_restore_state (struct pci_dev *dev, u32 *buffer) |
| int | rt_pci_enable_wake (struct pci_dev *dev, u32 state, int enable) |
| int | rt_pci_save_state (struct pci_dev *dev, u32 *buffer) |
|
|
Definition at line 113 of file rt_pci.h. Referenced by pcibios_init(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 88 of file rt_pci.h. Referenced by rt_pci_restore_state(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 95 of file rt_pci.h. Referenced by rt_pci_restore_state(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 119 of file rt_pci.h. Referenced by check_pcibios(). |
|
|
Definition at line 116 of file rt_pci.h. Referenced by check_pcibios(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 67 of file rt_pci.h. Referenced by check_pcibios(). |
|
|
|
|
|
Definition at line 71 of file rt_pci.h. Referenced by rt_pcibios_read_config_byte(). |
|
|
Definition at line 73 of file rt_pci.h. Referenced by rt_pcibios_read_config_dword(). |
|
|
Definition at line 72 of file rt_pci.h. Referenced by rt_pcibios_read_config_word(). |
|
|
Definition at line 77 of file rt_pci.h. Referenced by pcibios_set_irq_routing(). |
|
|
Definition at line 74 of file rt_pci.h. Referenced by rt_pcibios_write_config_byte(). |
|
|
Definition at line 76 of file rt_pci.h. Referenced by rt_pcibios_write_config_dword(). |
|
|
Definition at line 75 of file rt_pci.h. Referenced by rt_pcibios_write_config_word(). |
|
|
Definition at line 156 of file rt_pci.h. Referenced by rt_pci_find_capability(). |
|
|
|
|
|
Definition at line 158 of file rt_pci.h. Referenced by rt_pci_find_capability(), and rt_pci_set_power_state(). |
|
|
Definition at line 170 of file rt_pci.h. Referenced by start_up_rtl8139_device(). |
|
|
Definition at line 171 of file rt_pci.h. Referenced by start_up_rtl8139_device(). |
|
|
Value: ((rt_pci_resource_start((dev),(bar)) == 0 && \ rt_pci_resource_end((dev),(bar)) == \ rt_pci_resource_start((dev),(bar))) ? 0 : \ \ (rt_pci_resource_end((dev),(bar)) - \ rt_pci_resource_start((dev),(bar)) + 1)) Definition at line 172 of file rt_pci.h. Referenced by start_up_rtl8139_device(). |
|
|
Definition at line 169 of file rt_pci.h. Referenced by rtl_3COM905C_start_up_device(), and start_up_rtl8139_device(). |
|
|
Definition at line 162 of file rt_pci.h. Referenced by rt_pci_restore_state(). |
|
|
Definition at line 166 of file rt_pci.h. Referenced by rt_pci_restore_state(). |
|
|
Definition at line 164 of file rt_pci.h. Referenced by rt_pci_set_power_state(). |
|
|
Definition at line 679 of file rt_pci.c. Referenced by init_rtl8139_device(), and rtl_3COM905C_init_device().
00679 {
00680 return(pci_enable_device(dev));
00681 }
|
|
||||||||||||||||
|
Referenced by rtl_3COM905C_acpi_set_WOL(). |
|
||||||||||||
|
rt_pci_find_capability - query for devices' capabilities : PCI device to query : capability code Tell if a device supports a given PCI capability. Returns the address of the requested capability structure within the device's PCI configuration space or 0 in case the device does not support it. Possible values for : PCI_CAP_ID_PM Power Management PCI_CAP_ID_AGP Accelerated Graphics Port PCI_CAP_ID_VPD Vital Product Data PCI_CAP_ID_SLOTID Slot Identification PCI_CAP_ID_MSI Message Signalled Interrupts PCI_CAP_ID_CHSWP CompactPCI HotSwap Definition at line 636 of file rt_pci.c. References rt_pci_read_config_byte, rt_pci_read_config_word, and status. Referenced by rt_pci_set_power_state().
00637 {
00638 u16 status;
00639 u8 pos, id;
00640 int ttl = 48;
00641
00642 rt_pci_read_config_word(dev, PCI_STATUS, &status);
00643 if (!(status & PCI_STATUS_CAP_LIST))
00644 return 0;
00645 switch (dev->hdr_type) {
00646 case PCI_HEADER_TYPE_NORMAL:
00647 case PCI_HEADER_TYPE_BRIDGE:
00648 rt_pci_read_config_byte(dev, PCI_CAPABILITY_LIST, &pos);
00649 break;
00650 case PCI_HEADER_TYPE_CARDBUS:
00651 rt_pci_read_config_byte(dev, PCI_CB_CAPABILITY_LIST, &pos);
00652 break;
00653 default:
00654 return 0;
00655 }
00656 while (ttl-- && pos >= 0x40) {
00657 pos &= ~3;
00658 rt_pci_read_config_byte(dev, pos + PCI_CAP_LIST_ID, &id);
00659 if (id == 0xff)
00660 break;
00661 if (id == cap)
00662 return pos;
00663 rt_pci_read_config_byte(dev, pos + PCI_CAP_LIST_NEXT, &pos);
00664 }
00665 return 0;
00666 }
|
|
||||||||||||||||
|
Definition at line 672 of file rt_pci.c. Referenced by init_rtl8139_device(), and rtl_3COM905C_init_device().
00672 {
00673 return(pci_find_device(vendor, device, from));
00674 }
|
|
||||||||||||
|
rt_pci_restore_state - Restore the saved state of a PCI device : - PCI device that we're dealing with : - saved PCI config space Definition at line 691 of file rt_pci.c. References buffer, PCI_BASE_ADDRESS_0, PCI_INTERRUPT_LINE, rt_pci_write_config_byte, and rt_pci_write_config_dword. Referenced by vortex_up().
00692 {
00693 int i;
00694
00695 if (buffer) {
00696 for (i = 0; i < 16; i++)
00697 rt_pci_write_config_dword(dev,i * 4, buffer[i]);
00698 }
00699 /*
00700 * otherwise, write the context information we know from bootup.
00701 * This works around a problem where warm-booting from Windows
00702 * combined with a D3(hot)->D0 transition causes PCI config
00703 * header data to be forgotten.
00704 */
00705 else {
00706 for (i = 0; i < 6; i ++)
00707 rt_pci_write_config_dword(dev,
00708 PCI_BASE_ADDRESS_0 + (i * 4),
00709 dev->resource[i].start);
00710 rt_pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
00711 }
00712 return 0;
00713 }
|
|
||||||||||||
|
Referenced by rtl_3COM905C_start_up_device(), and vortex_down(). |
|
||||||||||||
|
Definition at line 552 of file rt_pci.c. References rt_pci_find_capability(), rt_pci_read_config_word, and rt_pci_write_config_word. Referenced by rtl_3COM905C_acpi_set_WOL(), vortex_remove_one(), and vortex_up().
00553 {
00554 int pm;
00555 u16 pmcsr;
00556
00557 /* bound the state we're entering */
00558 if (state > 3) state = 3;
00559
00560 /* Validate current state:
00561 * Can enter D0 from any state, but if we can only go deeper
00562 * to sleep if we're already in a low power state
00563 */
00564 if (state > 0 && dev->current_state > state)
00565 return -EINVAL;
00566 else if (dev->current_state == state)
00567 return 0; /* we're already there */
00568
00569 /* find PCI PM capability in list */
00570 pm = rt_pci_find_capability(dev, PCI_CAP_ID_PM);
00571
00572 /* abort if the device doesn't support PM capabilities */
00573 if (!pm) return -EIO;
00574
00575 /* check if this device supports the desired state */
00576 if (state == 1 || state == 2) {
00577 u16 pmc;
00578 rt_pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc);
00579 if (state == 1 && !(pmc & PCI_PM_CAP_D1)) return -EIO;
00580 else if (state == 2 && !(pmc & PCI_PM_CAP_D2)) return -EIO;
00581 }
00582
00583 /* If we're in D3, force entire word to 0.
00584 * This doesn't affect PME_Status, disables PME_En, and
00585 * sets PowerState to 0.
00586 */
00587 if (dev->current_state >= 3)
00588 pmcsr = 0;
00589 else {
00590 rt_pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
00591 pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
00592 pmcsr |= state;
00593 }
00594
00595 /* enter specified state */
00596 rt_pci_write_config_word(dev, pm + PCI_PM_CTRL, pmcsr);
00597
00598 /* Mandatory power management transition delays */
00599 /* see PCI PM 1.1 5.6.1 table 18 */
00600 if(state == 3 || dev->current_state == 3)
00601 {
00602 //set_current_state(TASK_UNINTERRUPTIBLE);
00603 //schedule_timeout(HZ/100);
00604 rtl_delay(200000);
00605 }
00606 else if(state == 2 || dev->current_state == 2)
00607 rtl_delay(200000);
00608 dev->current_state = state;
00609
00610 return 0;
00611 }
|
Here is the call graph for this function:
|
||||||||||||||||||||
|
Definition at line 257 of file rt_pci.c. References pci_indirect, and PCIBIOS_READ_CONFIG_BYTE.
00259 {
00260 unsigned long ret;
00261 unsigned long bx = (bus << 8) | device_fn;
00262 unsigned long flags;
00263
00264 save_flags(flags);
00265 __asm__(
00266 #ifdef ABSOLUTE_WITHOUT_ASTERISK
00267 "lcall (%%esi)\n\t"
00268 #else
00269 "lcall *(%%esi)\n\t"
00270 #endif
00271 "jc 1f\n\t"
00272 "xor %%ah, %%ah\n"
00273 "1:"
00274 : "=c" (*value),
00275 "=a" (ret)
00276 : "1" (PCIBIOS_READ_CONFIG_BYTE),
00277 "b" (bx),
00278 "D" ((long) where),
00279 "S" (&pci_indirect));
00280 restore_flags(flags);
00281 return (int) (ret & 0xff00) >> 8;
00282 }
|
|
||||||||||||||||||||
|
Definition at line 313 of file rt_pci.c. References pci_indirect, and PCIBIOS_READ_CONFIG_DWORD.
00315 {
00316 unsigned long ret;
00317 unsigned long bx = (bus << 8) | device_fn;
00318 unsigned long flags;
00319
00320 save_flags(flags);
00321 __asm__(
00322 #ifdef ABSOLUTE_WITHOUT_ASTERISK
00323 "lcall (%%esi)\n\t"
00324 #else
00325 "lcall *(%%esi)\n\t"
00326 #endif
00327 "jc 1f\n\t"
00328 "xor %%ah, %%ah\n"
00329 "1:"
00330 : "=c" (*value),
00331 "=a" (ret)
00332 : "1" (PCIBIOS_READ_CONFIG_DWORD),
00333 "b" (bx),
00334 "D" ((long) where),
00335 "S" (&pci_indirect));
00336 restore_flags(flags);
00337 return (int) (ret & 0xff00) >> 8;
00338 }
|
|
||||||||||||||||||||
|
Definition at line 285 of file rt_pci.c. References pci_indirect, and PCIBIOS_READ_CONFIG_WORD.
00287 {
00288 unsigned long ret;
00289 unsigned long bx = (bus << 8) | device_fn;
00290 unsigned long flags;
00291
00292 save_flags(flags);
00293 __asm__(
00294 #ifdef ABSOLUTE_WITHOUT_ASTERISK
00295 "lcall (%%esi)\n\t"
00296 #else
00297 "lcall *(%%esi)\n\t"
00298 #endif
00299 "jc 1f\n\t"
00300 "xor %%ah, %%ah\n"
00301 "1:"
00302 : "=c" (*value),
00303 "=a" (ret)
00304 : "1" (PCIBIOS_READ_CONFIG_WORD),
00305 "b" (bx),
00306 "D" ((long) where),
00307 "S" (&pci_indirect));
00308 restore_flags(flags);
00309 return (int) (ret & 0xff00) >> 8;
00310 }
|
|
||||||||||||||||
|
|
|
||||||||||||||||||||
|
Definition at line 400 of file rt_pci.c. References pci_indirect, and PCIBIOS_WRITE_CONFIG_DWORD.
00402 {
00403 unsigned long ret;
00404 unsigned long bx = (bus << 8) | device_fn;
00405 unsigned long flags;
00406
00407 save_flags(flags); cli();
00408 __asm__(
00409 #ifdef ABSOLUTE_WITHOUT_ASTERISK
00410 "lcall (%%esi)\n\t"
00411 #else
00412 "lcall *(%%esi)\n\t"
00413 #endif
00414 "jc 1f\n\t"
00415 "xor %%ah, %%ah\n"
00416 "1:"
00417 : "=a" (ret)
00418 : "0" (PCIBIOS_WRITE_CONFIG_DWORD),
00419 "c" (value),
00420 "b" (bx),
00421 "D" ((long) where),
00422 "S" (&pci_indirect));
00423 restore_flags(flags);
00424 return (int) (ret & 0xff00) >> 8;
00425 }
|
|
||||||||||||||||||||
|
Definition at line 372 of file rt_pci.c. References pci_indirect, and PCIBIOS_WRITE_CONFIG_WORD.
00374 {
00375 unsigned long ret;
00376 unsigned long bx = (bus << 8) | device_fn;
00377 unsigned long flags;
00378
00379 save_flags(flags); cli();
00380 __asm__(
00381 #ifdef ABSOLUTE_WITHOUT_ASTERISK
00382 "lcall (%%esi)\n\t"
00383 #else
00384 "lcall *(%%esi)\n\t"
00385 #endif
00386 "jc 1f\n\t"
00387 "xor %%ah, %%ah\n"
00388 "1:"
00389 : "=a" (ret)
00390 : "0" (PCIBIOS_WRITE_CONFIG_WORD),
00391 "c" (value),
00392 "b" (bx),
00393 "D" ((long) where),
00394 "S" (&pci_indirect));
00395 restore_flags(flags);
00396 return (int) (ret & 0xff00) >> 8;
00397 }
|
|
||||||||||||||||||||
|
|
1.3.4