changeset 1260:c5a75fb0568a

* include/plf_io.h: Fixed implementation of HAL_PCI_TRANSLATE_INTERRUPT * include/plf_intr.h: Applied assembly safe fix
author nickg
date Wed, 01 Oct 2003 18:06:40 +0000
parents 13ba50dd5a8e
children e1738e65692a
files packages/hal/mips/atlas/current/ChangeLog packages/hal/mips/atlas/current/include/plf_intr.h packages/hal/mips/atlas/current/include/plf_io.h
diffstat 3 files changed, 43 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/packages/hal/mips/atlas/current/ChangeLog
+++ b/packages/hal/mips/atlas/current/ChangeLog
@@ -1,3 +1,9 @@
+2003-09-28  Michael Anburaj <michaelanburaj@hotmail.com>
+
+	* include/plf_io.h: Fixed implementation of
+         HAL_PCI_TRANSLATE_INTERRUPT
+	* include/plf_intr.h: Applied assembly safe fix
+
 2003-07-18  Nick Garnett  <nickg@balti.calivar.com>
 
 	* cdl/hal_mips_atlas.cdl:
--- a/packages/hal/mips/atlas/current/include/plf_intr.h
+++ b/packages/hal/mips/atlas/current/include/plf_intr.h
@@ -45,7 +45,7 @@
 //
 // Author(s):    nickg
 // Contributors: nickg, jskov,
-//               gthomas, jlarmour, dmoseley
+//               gthomas, jlarmour, dmoseley, michael anburaj <michaelanburaj@hotmail.com>
 // Date:         2000-06-06
 // Purpose:      Define Interrupt support
 // Description:  The macros defined here provide the HAL APIs for handling
@@ -62,8 +62,7 @@
 
 #include <pkgconf/hal.h>
 
-#include <cyg/infra/cyg_type.h>
-#include <cyg/hal/plf_io.h>
+// First an assembly safe part
 
 //--------------------------------------------------------------------------
 // Interrupt vectors.
@@ -112,6 +111,12 @@
 
 #endif
 
+
+//--------------------------------------------------------------------------
+#ifndef __ASSEMBLER__
+
+#include <cyg/infra/cyg_type.h>
+
 //--------------------------------------------------------------------------
 // Interrupt controller access.
 
@@ -233,6 +238,8 @@ extern void hal_atlas_reset( void );
 
 #endif // CYGHWR_HAL_RESET_DEFINED
 
+#endif // __ASSEMBLER__
+
 //--------------------------------------------------------------------------
 #endif // ifndef CYGONCE_HAL_PLF_INTR_H
 // End of plf_intr.h
--- a/packages/hal/mips/atlas/current/include/plf_io.h
+++ b/packages/hal/mips/atlas/current/include/plf_io.h
@@ -44,7 +44,7 @@
 //#####DESCRIPTIONBEGIN####
 //
 // Author(s):    dmoseley
-// Contributors: dmoseley
+// Contributors: dmoseley, michael anburaj <michaelanburaj@hotmail.com>
 // Date:         2000-06-06
 // Purpose:      Atlas platform IO support
 // Description: 
@@ -56,6 +56,8 @@
 
 #include <pkgconf/hal.h>
 #include <cyg/hal/hal_misc.h>
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/plf_intr.h>
 
 #ifdef __ASSEMBLER__
 #define HAL_REG(x)              x
@@ -453,7 +455,30 @@ externC void cyg_hal_plf_pci_init(void);
 // INTC# or INTD#) to the associated CPU interrupt (i.e., HAL vector).
 #define HAL_PCI_TRANSLATE_INTERRUPT( __bus, __devfn, __vec, __valid)          \
     CYG_MACRO_START                                                           \
-    __valid = false;                                                          \
+    cyg_uint8 __req;                                                          \
+    HAL_PCI_CFG_READ_UINT8(__bus, __devfn, CYG_PCI_CFG_INT_PIN, __req);       \
+    if (0 != __req) {                                                         \
+        CYG_ADDRWORD __translation[4] = {                                     \
+            CYGNUM_HAL_INTERRUPT_INTA,                                        \
+            CYGNUM_HAL_INTERRUPT_INTB,                                        \
+            CYGNUM_HAL_INTERRUPT_INTC,                                        \
+            CYGNUM_HAL_INTERRUPT_INTD};                                       \
+                                                                              \
+        /* The PCI #INT lines for different device numbers are wired like this: */     \
+        /*                                                             */     \
+        /* Int. Ctrl.     PCI_A     PCI_B    PCI_C   PCI_D             */     \
+        /* Device no.                                                  */     \
+        /* 0, 4, ..28     INTC#     INTD#    INTA#   INTB#             */     \
+        /* 1, 5, ..29     INTD#     INTA#    INTB#   INTC#             */     \
+        /* 2, 6, ..30     INTA#     INTB#    INTC#   INTD#             */     \
+        /* 3, 7, ..31     INTB#     INTC#    INTD#   INTA#             */     \
+                                                                              \
+        __vec = __translation[(((__req+1)+CYG_PCI_DEV_GET_DEV(__devfn))&3)];  \
+        __valid = true;                                                       \
+    } else {                                                                  \
+        /* Device will not generate interrupt requests. */                    \
+        __valid = false;                                                      \
+    }                                                                         \
     CYG_MACRO_END