[rtems commit] powerpc/ep1a: Remove if 0 sections

Joel Sherrill joel at rtems.org
Fri Oct 10 15:08:39 UTC 2014


Module:    rtems
Branch:    master
Commit:    e160e41361105109a12edd6dfe04058ddcefac84
Changeset: http://git.rtems.org/rtems/commit/?id=e160e41361105109a12edd6dfe04058ddcefac84

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Thu Oct  9 15:15:55 2014 -0500

powerpc/ep1a: Remove if 0 sections

There may be useful nuggets for debug and alternate configurations
in this code. There may be methods directly called by the application
which are beyond normal APIs. We have no way of knowing this based
on the comments in these files. There were no public prototypes
so the routines and code in question should have be unused private
methods.

These will always be in the source code control system as a deletion.
If some of the code is needed, justify it and provide a patch to restore
it along with a prototype in a public place if needed and a better name.

---

 c/src/lib/libbsp/powerpc/ep1a/console/m68360.h     |    4 -
 .../lib/libbsp/powerpc/ep1a/console/mc68360_scc.c  |   71 +-------
 c/src/lib/libbsp/powerpc/ep1a/console/polled_io.c  |  100 ----------
 c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.c    |  191 --------------------
 .../lib/libbsp/powerpc/ep1a/irq/openpic_xxx_irq.c  |   28 ---
 c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c   |   13 --
 6 files changed, 2 insertions(+), 405 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/ep1a/console/m68360.h b/c/src/lib/libbsp/powerpc/ep1a/console/m68360.h
index 7c99a4d..3645486 100644
--- a/c/src/lib/libbsp/powerpc/ep1a/console/m68360.h
+++ b/c/src/lib/libbsp/powerpc/ep1a/console/m68360.h
@@ -975,8 +975,4 @@ void *M360AllocateBufferDescriptors (M68360_t ptr, int count);
 void M360ExecuteRISC( volatile m360_t *m360, uint16_t command);
 int mc68360_scc_create_chip( PPMCQ1BoardData BoardData, uint8_t int_vector );
 
-#if 0
-extern volatile m360_t *m360;
-#endif
-
 #endif /* __MC68360_h */
diff --git a/c/src/lib/libbsp/powerpc/ep1a/console/mc68360_scc.c b/c/src/lib/libbsp/powerpc/ep1a/console/mc68360_scc.c
index 641c74f..ad9b570 100644
--- a/c/src/lib/libbsp/powerpc/ep1a/console/mc68360_scc.c
+++ b/c/src/lib/libbsp/powerpc/ep1a/console/mc68360_scc.c
@@ -25,9 +25,7 @@
 #include <rtems/bspIo.h>
 #include <string.h>
 
-#if 0
-#define DEBUG_360
-#endif
+/* #define DEBUG_360 */
 
 #if 1   /* XXX */
 int EP1A_READ_LENGTH_GREATER_THAN_1 = 0;
@@ -35,19 +33,6 @@ int EP1A_READ_LENGTH_GREATER_THAN_1 = 0;
 #define MC68360_LENGTH_SIZE 400
 int mc68360_length_array[ MC68360_LENGTH_SIZE ];
 int mc68360_length_count=0;
-
-#if 0
-/*
- * This is a debug method which is not currently used.
- */
-static void mc68360_Show_length_array(void)
-{
-  int i;
-  for (i=0; i<MC68360_LENGTH_SIZE; i++)
-    printf(" %d", mc68360_length_array[i] );
-  printf("\n\n");
-}
-#endif
 #endif
 
 
@@ -57,29 +42,6 @@ M68360_t    M68360_chips = NULL;
 #define mc68360_scc_Is_422( _minor ) \
   (Console_Port_Tbl[minor]->sDeviceName[7] == '4' )
 
-#if 0
-/*
- * This method is included for completeness but not currently used.
- */
-static uint8_t scc_read8(
-  const char       *name,
-  volatile uint8_t *address
-)
-{
-  uint8_t value;
-
-#ifdef DEBUG_360
-  printk( "RD8 %s 0x%08x ", name, address );
-#endif
-  value = *address;
-#ifdef DEBUG_360
-  printk( "0x%02x\n", value );
-#endif
-
-  return value;
-}
-#endif
-
 static void scc_write8(
   const char       *name,
   volatile uint8_t *address,
@@ -152,21 +114,6 @@ static void scc_write32(
   *address = value;
 }
 
-#if 0
-/*
- * This is a debug method which is not currently used.
- */
-static void mc68360_sccShow_Regs(int minor)
-{
-  M68360_serial_ports_t  ptr;
-  ptr   = Console_Port_Tbl[minor]->pDeviceParams;
-
-  printk( "scce 0x%08x", &ptr->pSCCR->scce );
-  printk( " 0x%04x\n", ptr->pSCCR->scce );
-
-}
-#endif
-
 #define TX_BUFFER_ADDRESS( _ptr ) \
   ((char *)ptr->txBuf - (char *)ptr->chip->board_data->baseaddr)
 #define RX_BUFFER_ADDRESS( _ptr ) \
@@ -194,21 +141,7 @@ static void mc68360_sccShow_Regs(int minor)
 static int
 mc68360_sccBRGC(int baud, int m360_clock_rate)
 {
-   int data;
-#if 0
-   int divisor;
-   int div16;
-
-   div16 = 0;
-   divisor = ((m360_clock_rate / 16) + (baud / 2)) / baud;
-   if (divisor > 4096)
-   {
-      div16   = 1;
-      divisor = (divisor + 8) / 16;
-   }
-   return(M360_BRG_EN | M360_BRG_EXTC_BRGCLK |
-          ((divisor - 1) << 1) | div16);
-#endif
+  int data;
 
   /*
    * configure baud rate generator for 16x bit rate, where.....
diff --git a/c/src/lib/libbsp/powerpc/ep1a/console/polled_io.c b/c/src/lib/libbsp/powerpc/ep1a/console/polled_io.c
index 69ee438..e0ae919 100644
--- a/c/src/lib/libbsp/powerpc/ep1a/console/polled_io.c
+++ b/c/src/lib/libbsp/powerpc/ep1a/console/polled_io.c
@@ -409,106 +409,6 @@ static board_memory_map mem_map = {
 
 board_memory_map *ptr_mem_map = &mem_map;
 
-#if 0
-struct _console_global_data {
-	console_log *log;
-	int vacuum_sent;
-	int lines;
-	int cols;
-	int orig_x;
-	int orig_y;
-	u_char shfts, ctls, alts, caps;
-} console_global_data = {NULL, 0, 25, 80, 0, 24, 0, 0, 0, 0};
-
-typedef struct console_io {
-	void 	(*putc)	(const u_char);
-	int 	(*getc)	(void);
-	int 	(*tstc)	(void);
-}console_io;
-
-extern console_io* curIo;
-
-void debug_putc(const u_char c)
-{
-  curIo->putc(c);
-}
-
-/* const char arg to be compatible with BSP_output_char decl. */
-void
-debug_putc_onlcr(const char c)
-{
-	if ('\n'==c)
-		debug_putc('\r');
-	debug_putc(c);
-}
-
-int debug_getc(void)
-{
-  return curIo->getc();
-}
-
-int debug_tstc(void)
-{
-  return curIo->tstc();
-}
-
-#define vidmem ((__io_ptr)(ptr_mem_map->isa_mem_base+0xb8000))
-
-void vacuum_putc(u_char c) {
-	console_global_data.vacuum_sent++;
-}
-
-int vacuum_getc(void) {
-	return -1;
-}
-
-int vacuum_tstc(void) {
-	return 0;
-}
-
-/*
- * COM1 NS16550 support
- */
-
-#define rbr 0
-#define ier 1
-#define fcr 2
-#define lcr 3
-#define mcr 4
-#define lsr 5
-#define msr 6
-#define scr 7
-#define thr rbr
-#define iir fcr
-#define dll rbr
-#define dlm ier
-
-#define LSR_DR   0x01  /* Data ready */
-#define LSR_OE   0x02  /* Overrun */
-#define LSR_PE   0x04  /* Parity error */
-#define LSR_FE   0x08  /* Framing error */
-#define LSR_BI   0x10  /* Break */
-#define LSR_THRE 0x20  /* Xmit holding register empty */
-#define LSR_TEMT 0x40  /* Xmitter empty */
-#define LSR_ERR  0x80  /* Error */
-
-
-#ifdef STATIC_LOG_ALLOC
-static int global_index = 0;
-
-static void *__palloc(int s)
-{
-  if (global_index ==( STATIC_LOG_DATA_PAGE_NB - 1) ) return (void*) 0;
-  return  (void*) &(log_page_pool [PAGE_SIZE * global_index++]);
-}
-
-static void pfree(void* p)
-{
-  --global_index;
-}
-#endif
-
-
 void log_putc(const u_char c) {
 	console_log *l;
 	for(l=console_global_data.log; l; l=l->next) {
diff --git a/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.c b/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.c
index 584bcaf..f92cfad 100644
--- a/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.c
+++ b/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.c
@@ -52,36 +52,6 @@ static unsigned char rsPMCQ1Initialized = FALSE;
 
 /* forward declarations */
 
-#if 0
-/* local Qspan II serial eeprom table */
-static unsigned char rsPMCQ1eeprom[] =
-    {
-    0x00,	/* Byte 0 - PCI_SID */
-    0x00,	/* Byte 1 - PCI_SID */
-    0x00,	/* Byte 2 - PCI_SID */
-    0x00,	/* Byte 3 - PCI_SID */
-    0x00,	/* Byte 4 - PBROM_CTL */
-    0x00,	/* Byte 5 - PBROM_CTL */
-    0x00,	/* Byte 6 - PBROM_CTL */
-    0x2C,	/* Byte 7 - PBTI0_CTL */
-    0xB0,	/* Byte 8 - PBTI1_CTL */
-    0x00,	/* Byte 9 - QBSI0_AT */
-    0x00,	/* Byte 10 - QBSI0_AT */
-    0x02,	/* Byte 11 - QBSI0_AT */
-    0x00,	/* Byte 12 - PCI_ID */
-    0x07,	/* Byte 13 - PCI_ID */
-    0x11,	/* Byte 14 - PCI_ID */
-    0xB5,	/* Byte 15 - PCI_ID */
-    0x06,	/* Byte 16 - PCI_CLASS */
-    0x80,	/* Byte 17 - PCI_CLASS */
-    0x00,	/* Byte 18 - PCI_CLASS */
-    0x00,	/* Byte 19 - PCI_MISC1 */
-    0x00,	/* Byte 20 - PCI_MISC1 */
-    0xC0,	/* Byte 21 - PCI_PMC */
-    0x00	/* Byte 22 - PCI_BST */
-};
-#endif
-
 static void MsDelay(void)
 {
   printk(".");
@@ -99,13 +69,6 @@ static void write32( int addr, int data ) {
   out_be32((unsigned int *)addr, data );
 }
 
-#if 0
-static int read32( int addr){
-  return in_be32((unsigned int *)addr);
-}
-#endif
-
-
 static void rsPMCQ1_scc_nullFunc(void) {}
 
 /*******************************************************************************
@@ -212,41 +175,6 @@ unsigned int rsPMCQ1MaIntConnect (
   return (status);
 }
 
-#if 0
-/* This method is apparently unused. --joel 9 Oct 2014 */
-/*******************************************************************************
-*
-* rsPMCQ1MaIntDisconnect - disconnect a MiniAce interrupt routine
-*
-* This routine is called to disconnect a MiniAce interrupt handler
-* from a PMCQ1. It also masks the interrupt source on the PMCQ1.
-*
-* RETURNS: OK if PMCQ1 found, ERROR if not.
-*/
-static unsigned int rsPMCQ1MaIntDisconnect(
-    unsigned long	busNo,	/* Pci Bus number of PMCQ1 */
-    unsigned long	slotNo,	/* Pci Slot number of PMCQ1 */
-    unsigned long	funcNo	/* Pci Function number of PMCQ1 */
-)
-{
-  PPMCQ1BoardData boardData;
-  unsigned int status = RTEMS_IO_ERROR;
-
-  for (boardData = pmcq1BoardData; boardData; boardData = boardData->pNext) {
-    if ((boardData->busNo == busNo) && (boardData->slotNo == slotNo) &&
-        (boardData->funcNo == funcNo))
-    {
-      boardData->maInt = NULL;
-      *(unsigned long *)(boardData->baseaddr + PMCQ1_INT_MASK) |= PMCQ1_INT_MASK_MA;
-      status = RTEMS_SUCCESSFUL;
-      break;
-    }
-  }
-
-  return (status);
-}
-#endif
-
 /*******************************************************************************
 *
 * rsPMCQ1QuiccIntConnect - connect a Quicc interrupt routine
@@ -281,44 +209,6 @@ unsigned int rsPMCQ1QuiccIntConnect(
   return (status);
 }
 
-#if 0
-/* This method is apparently unused. --joel 9 Oct 2014 */
-/*******************************************************************************
-*
-* rsPMCQ1QuiccIntDisconnect - disconnect a Quicc interrupt routine
-*
-* This routine is called to disconnect a Quicc interrupt handler
-* from a PMCQ1. It also masks the interrupt source on the PMCQ1.
-*
-* RETURNS: OK if PMCQ1 found, ERROR if not.
-*/
-static unsigned int rsPMCQ1QuiccIntDisconnect(
-    unsigned long	busNo,	/* Pci Bus number of PMCQ1 */
-    unsigned long	slotNo,	/* Pci Slot number of PMCQ1 */
-    unsigned long	funcNo	/* Pci Function number of PMCQ1 */
-)
-{
-  PPMCQ1BoardData boardData;
-  unsigned int status = RTEMS_IO_ERROR;
-
-  for (boardData = pmcq1BoardData; boardData; boardData = boardData->pNext)
-  {
-    if ((boardData->busNo == busNo) && (boardData->slotNo == slotNo) &&
-        (boardData->funcNo == funcNo))
-    {
-      boardData->quiccInt = NULL;
-      *(unsigned long *)(boardData->baseaddr + PMCQ1_INT_MASK) |= PMCQ1_INT_MASK_QUICC;
-      status = RTEMS_SUCCESSFUL;
-      break;
-    }
-  }
-
-  return (status);
-}
-#endif
-/* This method is apparently unused. --joel 9 Oct 2014 */
-
-
 /*******************************************************************************
 *
 * rsPMCQ1Init - initialize the PMCQ1's
@@ -491,87 +381,6 @@ unsigned int rsPMCQ1Init(void)
   return((i > 0) ? RTEMS_SUCCESSFUL : RTEMS_IO_ERROR);
 }
 
-#if 0
-/* This method is apparently unused. --joel 9 Oct 2014 */
-/*******************************************************************************
-*
-* rsPMCQ1Commission - initialize the serial EEPROM on the QSPAN
-*
-* This routine is called to initialize the EEPROM attached to the QSPAN
-* on the PMCQ1 module. It will load standard settings into any QSPAN's
-* found with apparently uninitialised EEPROM's or PMCQ1's (to allow
-* EEPROM modifications to be performed).
-*/
-static unsigned int rsPMCQ1Commission(
-  unsigned long busNo,
-  unsigned long slotNo
-)
-{
-  unsigned int status = RTEMS_IO_ERROR;
-  uint32_t     bridgeaddr = 0;
-  unsigned long val;
-  int i;
-  uint32_t venId1;
-  uint32_t venId2;
-
-  pci_read_config_dword(busNo, slotNo, 0, PCI_VENDOR_ID, &venId1);
-  pci_read_config_dword(busNo, slotNo, 0, PCI_VENDOR_ID, &venId2);
-  if ((venId1 == 0x086210e3) ||
-      (venId2 == PCI_ID(PCI_VEN_ID_RADSTONE, PCI_DEV_ID_PMCQ1)))
-  {
-    pci_read_config_dword(busNo, slotNo, 0, PCI_BASE_ADDRESS_0, &bridgeaddr);
-    status = RTEMS_SUCCESSFUL;
-
-    /*
-     * The On board PMCQ1 on an EP1A has a subVendor ID of 0.
-     * A real PMCQ1 also has the sub vendor ID set up.
-     */
-    if ((busNo == 0) && (slotNo == 1)) {
-      *(unsigned long *)rsPMCQ1eeprom = 0;
-    } else {
-      *(unsigned long *)rsPMCQ1eeprom = PCI_ID(PCI_VEN_ID_RADSTONE, PCI_DEV_ID_PMCQ1);
-    }
-
-    for (i = 0; i < 23; i++) {
-      /* Wait until interface not active */
-      while(read32(bridgeaddr + 0x804) & 0x80000000) {
-        rtems_bsp_delay(1);
-      }
-
-      /* Write value */
-      write32(bridgeaddr + 0x804, (rsPMCQ1eeprom[i] << 8) | i);
-
-      /* delay for > 31 usec to allow active bit to become set */
-      rtems_bsp_delay(100);
-
-      /* Wait until interface not active */
-      while(read32(bridgeaddr + 0x804) & 0x80000000) {
-        rtems_bsp_delay(1);
-      }
-
-      /* Re-read value */
-      write32(bridgeaddr + 0x804, 0x40000000 | i);
-
-      /* delay for > 31 usec to allow active bit to become set */
-      rtems_bsp_delay(100);
-
-      /* Wait until interface not active */
-      while((val = read32(bridgeaddr + 0x804)) & 0x80000000) {
-        rtems_bsp_delay(1);
-      }
-
-      if (((val >> 8) & 0xff) != rsPMCQ1eeprom[i]) {
-        printk("Error writing byte %d expected 0x%02x got 0x%02x\n",
-               i, rsPMCQ1eeprom[i], (unsigned char)(val >> 8));
-        status = RTEMS_IO_ERROR;
-        break;
-      }
-    }
-  }
-  return(status);
-}
-#endif
-
 uint32_t PMCQ1_Read_EPLD( uint32_t base, uint32_t reg )
 {
   uint32_t data;
diff --git a/c/src/lib/libbsp/powerpc/ep1a/irq/openpic_xxx_irq.c b/c/src/lib/libbsp/powerpc/ep1a/irq/openpic_xxx_irq.c
index 728ffd4..67af151 100644
--- a/c/src/lib/libbsp/powerpc/ep1a/irq/openpic_xxx_irq.c
+++ b/c/src/lib/libbsp/powerpc/ep1a/irq/openpic_xxx_irq.c
@@ -150,34 +150,6 @@ int BSP_setup_the_pic(rtems_irq_global_settings* config)
     rtems_hdl_tbl 		= config->irqHdlTbl;
 
     /*
-     * set up internal tables used by rtems interrupt prologue
-     */
-#if 0
-#ifdef BSP_PCI_ISA_BRIDGE_IRQ
-    /*
-     * start with ISA IRQ
-     */
-    compute_i8259_masks_from_prio (config);
-
-    for (i=BSP_ISA_IRQ_LOWEST_OFFSET; i < BSP_ISA_IRQ_LOWEST_OFFSET + BSP_ISA_IRQ_NUMBER; i++) {
-      if (rtems_hdl_tbl[i].hdl != default_rtems_entry.hdl) {
-         BSP_irq_enable_at_i8259s (i);
-      }
-      else {
-         BSP_irq_disable_at_i8259s (i);
-      }
-    }
-
-	if ( BSP_ISA_IRQ_NUMBER > 0 ) {
-    	/*
-		 * must enable slave pic anyway
-		 */
-		BSP_irq_enable_at_i8259s (2);
-	}
-#endif
-#endif
-
-    /*
      * continue with PCI IRQ
      */
     for (i=BSP_PCI_IRQ_LOWEST_OFFSET; i < BSP_PCI_IRQ_LOWEST_OFFSET + BSP_PCI_IRQ_NUMBER ; i++) {
diff --git a/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c b/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c
index ac34a81..deb2572 100644
--- a/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c
@@ -61,19 +61,6 @@ static void BSP_Increment_Light(void)
   *GENERAL_REGISTER1 = data;
 }
 
-#if 0
-static void BSP_Fatal_Fault_Light(void)
-{
-  uint8_t data;
-
-  data = *GENERAL_REGISTER1;
-  data &= 0xf0;
-  data |= 0x7;
-  while(1)
-    *GENERAL_REGISTER1 = data;
-}
-#endif
-
 /*
  * Vital Board data Start using DATA RESIDUAL
  */



More information about the vc mailing list