This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
pci tweaks
- From: Mark Salter <msalter at redhat dot com>
- To: ecos-patches at sources dot redhat dot com
- Date: Tue, 31 Aug 2004 16:23:15 -0400 (EDT)
- Subject: pci tweaks
Index: io/pci/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/pci/current/ChangeLog,v
retrieving revision 1.25
diff -u -p -5 -r1.25 ChangeLog
--- io/pci/current/ChangeLog 14 Jan 2004 15:39:43 -0000 1.25
+++ io/pci/current/ChangeLog 31 Aug 2004 20:16:34 -0000
@@ -1,5 +1,14 @@
+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
only implement the bottom 16 bits of an IO BAR. This is allowed by
the standard but is very rare and mostly present in older devices
Index: io/pci/current/doc/pci.sgml
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/pci/current/doc/pci.sgml,v
retrieving revision 1.2
diff -u -p -5 -r1.2 pci.sgml
--- io/pci/current/doc/pci.sgml 15 Sep 2002 22:11:28 -0000 1.2
+++ io/pci/current/doc/pci.sgml 31 Aug 2004 20:16:34 -0000
@@ -8,11 +8,11 @@
<!-- -->
<!-- =============================================================== -->
<!-- ####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 -->
<!-- http://www.opencontent.org/openpub/) -->
<!-- Distribution of the work or derivative of the work in any -->
@@ -622,9 +622,16 @@ is currently beyond the scope of the HAL
found by the bus scanning functions. This is sometimes necessary for
devices which need special handling. If this macro evaluates to <constant>true
</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>
</PART>
Index: io/pci/current/include/pci_hw.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/pci/current/include/pci_hw.h,v
retrieving revision 1.6
diff -u -p -5 -r1.6 pci_hw.h
--- io/pci/current/include/pci_hw.h 23 May 2002 23:06:18 -0000 1.6
+++ io/pci/current/include/pci_hw.h 31 Aug 2004 20:16:34 -0000
@@ -8,11 +8,11 @@
//
//=============================================================================
//####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
// Software Foundation; either version 2 or (at your option) any later version.
//
@@ -85,10 +85,18 @@
HAL_PCI_IGNORE_DEVICE((__bus), (__dev), (__fn))
#else
#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);
// Read functions
Index: io/pci/current/src/pci.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/pci/current/src/pci.c,v
retrieving revision 1.20
diff -u -p -5 -r1.20 pci.c
--- io/pci/current/src/pci.c 20 Jan 2004 15:27:45 -0000 1.20
+++ io/pci/current/src/pci.c 31 Aug 2004 20:16:34 -0000
@@ -6,11 +6,11 @@
//
//=============================================================================
//####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
// Software Foundation; either version 2 or (at your option) any later version.
//
@@ -129,10 +129,13 @@ cyg_pci_get_device_info ( cyg_pci_device
dev_info->base_address[i] = 0;
dev_info->base_size[i] = 0;
}
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]);
}
@@ -141,10 +144,13 @@ cyg_pci_get_device_info ( cyg_pci_device
bar_count = 0;
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);
cyg_pcihw_read_config_uint32(bus, devfn,
CYG_PCI_CFG_BAR_BASE + 4*i,
@@ -862,11 +868,19 @@ cyg_pci_translate_interrupt( cyg_pci_dev
CYG_ADDRWORD *vec )
{
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;
}
// Initialize devices on a given bus and all subordinate busses.
cyg_bool