Mercurial > ecos
changeset 1739:5ee8bd19b4f5
PCI tweaks
| author | msalter |
|---|---|
| date | Tue, 31 Aug 2004 20:22:14 +0000 |
| parents | 9091309eb665 |
| children | 0031b615f51c |
| files | packages/io/pci/current/ChangeLog packages/io/pci/current/doc/pci.sgml packages/io/pci/current/include/pci_hw.h packages/io/pci/current/src/pci.c |
| diffstat | 4 files changed, 42 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/io/pci/current/ChangeLog +++ b/packages/io/pci/current/ChangeLog @@ -1,3 +1,12 @@ +2004-08-31 Mark Salter <msalter@redhat.com> + + * src/pci.c (cyg_pci_translate_interrupt): Write vector number into + INT_LINE register. + (cyg_pci_get_device_info): Add mechanism for HALs to specify certain + BARs to be ignored. + * include/pci_hw.h (CYG_PCI_IGNORE_BAR): New macro. + * doc/pci.sgml: Add info on HAL_PCI_IGNORE_BAR. + 2004-01-14 Nick Garnett <nickg@calivar.com> * src/pci.c (cyg_pci_get_device_info): Added fix for devices that
--- a/packages/io/pci/current/doc/pci.sgml +++ b/packages/io/pci/current/doc/pci.sgml @@ -10,7 +10,7 @@ <!-- ####COPYRIGHTBEGIN#### --> <!-- --> <!-- =============================================================== --> -<!-- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. --> +<!-- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 Red Hat, Inc. --> <!-- This material may be distributed only subject to the terms --> <!-- and conditions set forth in the Open Publication License, v1.0 --> <!-- or later (the latest version is presently available at --> @@ -624,6 +624,13 @@ devices which need special handling. If </constant>, the given device will not be found by <function>cyg_pci_find_next </function> or other bus scanning functions. </PARA> +<PROGRAMLISTING>HAL_PCI_IGNORE_BAR( dev_info, bar_num )</PROGRAMLISTING +<PARA>This macro, if defined, may be used to limit which BARs are discovered +and configured. This is sometimes necessary for platforms with limited PCI +windows. If this macro evaluates to <constant>true</constant>, the given BAR +will not be discovered by <function>cyg_pci_get_device_info</function> and +therefore not configured by <function>cyg_pci_configure_device</function>. +</PARA> </SECT2> </SECT1> </CHAPTER>
--- a/packages/io/pci/current/include/pci_hw.h +++ b/packages/io/pci/current/include/pci_hw.h @@ -10,7 +10,7 @@ //####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Red Hat, Inc. // // eCos is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -87,6 +87,14 @@ #define CYG_PCI_IGNORE_DEVICE(__bus, __dev, __fn) 0 #endif +// Ignore certain BARs at discretion of HAL +#ifdef HAL_PCI_IGNORE_BAR +#define CYG_PCI_IGNORE_BAR(__dinfo, __bar) \ + HAL_PCI_IGNORE_BAR((__dinfo), (__bar)) +#else +#define CYG_PCI_IGNORE_BAR(__dinfo, __bar) 0 +#endif + // Init externC void cyg_pcihw_init(void);
--- a/packages/io/pci/current/src/pci.c +++ b/packages/io/pci/current/src/pci.c @@ -8,7 +8,7 @@ //####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Red Hat, Inc. // // eCos is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -131,6 +131,9 @@ cyg_pci_get_device_info ( cyg_pci_device } for (i = 0; i < dev_info->num_bars; i++) { + if (CYG_PCI_IGNORE_BAR(dev_info, i)) + continue; + cyg_pcihw_read_config_uint32(bus, devfn, CYG_PCI_CFG_BAR_BASE + 4*i, &dev_info->base_address[i]); @@ -143,6 +146,9 @@ cyg_pci_get_device_info ( cyg_pci_device for (i = 0; i < dev_info->num_bars; i++){ cyg_uint32 size; + if (CYG_PCI_IGNORE_BAR(dev_info, i)) + continue; + cyg_pcihw_write_config_uint32(bus, devfn, CYG_PCI_CFG_BAR_BASE + 4*i, 0xffffffff); @@ -864,7 +870,15 @@ cyg_pci_translate_interrupt( cyg_pci_dev cyg_uint8 bus = CYG_PCI_DEV_GET_BUS(dev_info->devid); cyg_uint8 devfn = CYG_PCI_DEV_GET_DEVFN(dev_info->devid); - return cyg_pcihw_translate_interrupt(bus, devfn, vec); + if (cyg_pcihw_translate_interrupt(bus, devfn, vec)) { + // Fill in interrupt line info. This only really works for + // platforms where assigned PCI irq numbers are less than 255. + cyg_pcihw_write_config_uint8(bus, devfn, + CYG_PCI_CFG_INT_LINE, + *vec & 0xff); + return true; + } + return false; }
