[patch] BFD support for OpenRISC
Johan Rydberg
johan.rydberg@netinsight.se
Sun Jan 7 10:32:00 GMT 2001
Hi!
Attached is a patch that add support for OpenRISC to libbfd. I also
attached the new files that has to be added. Changelog entries are
included in the patch. Modified files are:
M bfd/ChangeLog
M bfd/Makefile.am
M bfd/Makefile.in
M bfd/archures.c
M bfd/bfd-in2.h
M bfd/config.bfd
M bfd/configure
M bfd/configure.in
M bfd/elf.c
M bfd/libbfd.h
M bfd/reloc.c
M bfd/targets.c
M include/elf/ChangeLog
M include/elf/common.h
Comments? Ok to commit?
regards,
Johan
Index: buffer.c
===================================================================
RCS file: /home/cvs_rep/neti_source/ns/hw_elsa/src/buffer.c,v
retrieving revision 1.16
diff -u -r1.16 buffer.c
--- buffer.c 2000/12/20 15:08:27 1.16
+++ buffer.c 2001/01/02 14:02:26
@@ -19,6 +19,9 @@
#define STAT_MAXBUFF 256
#define STAT_MINBUFF 64
+void dump_free_buffers (void);
+#define DEBUG 0
+
/* The array of buffers; */
struct pkt_buf *pkt_buffers = 0;
@@ -97,6 +100,7 @@
if (pb == 0)
{
printf ("buffer_insert: out of buffers for FIFO %d\n", fifo);
+ dump_free_buffers();
break;
}
pb->pb_active = 1;
@@ -145,14 +149,13 @@
DPRINT ("Buffers: Have allocated %d buffers\n", cnt);
}
-void dump_free_buffers (void);
void
dump_free_buffers ()
{
register pkt_buf_t pb;
- int i;
-
+ int i,j;
+ j=0;
printf ("Free buffers:\n");
for (i = 0; i < NBUFFERS; i++)
@@ -160,26 +163,44 @@
pb = &pkt_buffers[i];
if (pb->pb_free)
+ {
printf ("%d ", i);
+ j++;
+ if ( j > 9 )
+ {
+ printf("\n");
+ j=0;
+ }
+ }
}
printf ("\n");
+ j=0;
printf ("Used buffers:\n");
for (i = 0; i < NBUFFERS; i++)
{
pb = &pkt_buffers[i];
+ printf ("%d(", i);
if (pb->pb_active)
{
- printf ("%d(F) ", i);
+ printf("A");
}
- else if (pb->pb_queue)
+ if (pb->pb_queue)
{
- printf ("%d(%c) ", i, pb->pb_what == BUF_QUEUE_GLINK ? 'G' : 'D');
+ printf ("%c", pb->pb_what == BUF_QUEUE_GLINK ? 'G' : pb->pb_what == BUF_QUEUE_DTM ? 'D' : 'U');
}
- else if (pb->pb_free == 0)
+ if (pb->pb_free == 0)
{
- printf ("%d(X) ", i);
+ printf ("X");
}
+ printf(")\t");
+ j++;
+ if ( j > 4 )
+ {
+ printf("\n");
+ j=0;
+ }
+
}
printf ("\n");
}
@@ -195,9 +216,6 @@
{
printf ("I'm almost out of buffers, less than %d left\n",
LOW_WATERMARK);
- dump_free_buffers ();
- for (;;)
- ;
}
/* Read status register */
Index: channel.c
===================================================================
RCS file: /home/cvs_rep/neti_source/ns/hw_elsa/src/channel.c,v
retrieving revision 1.23
diff -u -r1.23 channel.c
--- channel.c 2000/12/20 15:08:27 1.23
+++ channel.c 2000/12/28 13:00:19
@@ -280,6 +280,7 @@
return DTM_EO_ERROR;
}
pb->pb_what = BUF_QUEUE_DTM;
+ pb->pb_active = 1;
pb->pb_channel = lci;
buff = pb->pb_number;
@@ -301,7 +302,10 @@
(void *) (lci),
0);
if (eo != DTM_EO_OK) /* should never happen */
+ {
+ buffer_free(pb);
return eo;
+ }
/* Update the meta data info. */
if (updatech)
@@ -401,7 +405,10 @@
dtx_ch_writeback (ent, (lci));
/* we can now released all queued buffers. */
- dtx_free_all_buffers (lci, bk.buff);
+ if (bk.empty == 0){
+ buffer_drop(bk.buff);
+ dtx_free_all_buffers (lci, bk.buff);
+ }
}
/* We're done and everything went really well. */
@@ -497,9 +504,13 @@
re->open = 0;
/* We can now release buffer */
+ if ( br.curr_slot != br.last_slot )
+ {
+ printf(" should release buffer %d in drx_close\n",br.buff);
#if 0
- buffer_drop (br.buff);
+ buffer_drop (br.buff);
#endif
+ }
}
/* We're done and everything went really well. */
@@ -564,6 +575,8 @@
int i = NCHANNELS, lci;
int buff;
dtm_eo eo;
+ pkt_buf_t pb;
+
/* Let us find a free channel in the channel table. If we can't do
that we're bailing out. The channel identifier is offset+1 from
@@ -598,7 +611,10 @@
(void *) lci,
0);
if (eo != DTM_EO_OK)
+ {
+ buffer_drop (buff);
return eo;
+ }
/* Ok. Now that we're sure that we're not messing things up we can
write the slots. */
@@ -607,8 +623,15 @@
(void *) lci,
0);
if (eo != DTM_EO_OK) /* should never happen */
+ {
+ buffer_drop (buff);
return eo;
+ }
+ pb = b2pb (buff);
+ pb->pb_what = BUF_QUEUE_DTM;
+ pb->pb_channel = BUF_QUEUE_DTM;
+ pb->pb_active = 1;
/* Update the meta data info. */
{
struct md_next_info md, *p;
@@ -652,13 +675,13 @@
pkt_buf_t pb;
pb = b2pb (buff);
-
+#if 0
if (pb->pb_what != BUF_QUEUE_DTM)
{
printf ("BOGUS EVENT: %d:%d?\n", lci, pb->pb_channel);
return;
}
-
+#endif
ch = dtx_ch (lci);
ch->length--;
}
@@ -675,10 +698,13 @@
if (lci < 1 || lci > NCHANNELS)
return;
+ printf("entering dtx_free_all_buffers\n");
while (1)
{
+ int j=0;
off = BN2MD (buff, MD_NEXT_INFO_OFF);
value.word = htoml (europa_bar0_read_4 (off));
+ printf("dtx_free raw data %08x\n",value.word);
if (value.md.valid == 0)
break;
@@ -691,6 +717,9 @@
#endif
buff = value.md.buff;
+ if (j >= MAXLENGTH )
+ break;
+ j++;
}
}
Index: config.h
===================================================================
RCS file: /home/cvs_rep/neti_source/ns/hw_elsa/src/config.h,v
retrieving revision 1.6
diff -u -r1.6 config.h
--- config.h 2000/10/21 11:46:06 1.6
+++ config.h 2000/12/20 07:43:17
@@ -12,7 +12,7 @@
#define NCHANNELS 127
/* If we should do any form of sanity checking */
-#define SANITY 1
+#define SANITY 0
/* If we should write debug information */
#if HW_VISH_DEBUG
@@ -22,7 +22,7 @@
#endif /* HW_VISH_DEBUG */
/* If we run polled or use DMA */
-#define POLLED 1
+#define POLLED 1
/* If we should use the RE */
#define USERE 1
Index: dbc.c
===================================================================
RCS file: /home/cvs_rep/neti_source/ns/hw_elsa/src/dbc.c,v
retrieving revision 1.31
diff -u -r1.31 dbc.c
--- dbc.c 2000/12/22 13:41:18 1.31
+++ dbc.c 2000/12/28 09:53:28
@@ -233,7 +233,7 @@
for (n = 0; n < 3; n++)
for (i = 0; i < 8; i++)
- re_bank_1->device_info[n].port[i].queue_length = 200;
+ re_bank_1->device_info[n].port[i].queue_length = 20;
/* XXX ... version here */
memset (bank3, 0, sizeof bank3);
@@ -242,7 +242,7 @@
memset (bank7, 0, sizeof bank7);
for (i = 0; i < 128; i++)
- re_bank_7->tx [i].queue_length = 200;
+ re_bank_7->tx [i].queue_length = 20;
memset (bank8, 0, sizeof bank8);
memset (bank9, 0, sizeof bank9);
@@ -478,6 +478,7 @@
this so that we can parse it a bit easier. */
convert_vector_to_slotlist (&slotlist, msg->data);
+ printf(" dtx_open called lci %d new %d\n",msg->lci, msg->newch);
/* We ignore all errors. */
(void) dtx_open (msg->lci, slotlist, msg->newch);
return DTM_EO_OK;
@@ -494,6 +495,7 @@
this so that we can parse it a bit easier. */
convert_vector_to_slotlist (&slotlist, msg->data);
+ printf(" dtx_close called lci %d new %d\n",msg->lci, msg->newch);
/* We ignore all errors. */
(void) dtx_close (msg->lci, slotlist, msg->newch);
return DTM_EO_OK;
@@ -512,8 +514,11 @@
/* We ignore all errors. */
/* XXX: While message not correct */
- /* (void) drx_open (msg->lci, slotlist, msg->newch, msg->hw_prio, msg->hw_dle); */
- (void) drx_open (msg->lci, slotlist, msg->newch, 0, 0);
+
+ printf("drx_open called with lci %d newch %d prio %d dle %d\n",msg->lci, msg->newch, msg->hw_prio, msg->hw_dle);
+ printf("raw data %08x %08x\n",*buff,*(buff+4));
+ (void) drx_open (msg->lci, slotlist, msg->newch, msg->hw_prio, msg->hw_dle);
+ /*(void) drx_open (msg->lci, slotlist, msg->newch, 0, 0); */
return DTM_EO_OK;
}
@@ -527,6 +532,8 @@
/* Here we convert the slotlist vector into a normal slotlist. We do
this so that we can parse it a bit easier. */
convert_vector_to_slotlist (&slotlist, msg->data);
+
+ printf(" drx_close called lci %d new %d\n",msg->lci, msg->newch);
/* We ignore all errors. */
(void) drx_close (msg->lci, slotlist, msg->newch);
Index: europa.c
===================================================================
RCS file: /home/cvs_rep/neti_source/ns/hw_elsa/src/europa.c,v
retrieving revision 1.19
diff -u -r1.19 europa.c
--- europa.c 2000/12/20 15:03:49 1.19
+++ europa.c 2000/12/27 10:44:49
@@ -1,3 +1,5 @@
+#define WORK_AROUND
+
#ifndef __sim__
#include <cyg/kernel/kapi.h>
#endif
@@ -86,8 +88,12 @@
/* Initiate Errorslot */
europa_bar0_write_4 (0x3ffc00, 0xffff0000);
europa_bar0_write_4 (0x3ffc04, 0x000085bc);
+ europa_write_4(europa_bar2_base + EUROPA_R2_RX_CTRL + EUROPA_DRX_DRC0, 2);
gl_enqueue_startup();
+#ifdef WORK_AROUND
+ europa_bar2_write_4(EUROPA_R2_TX_CTRL + EUROPA_DTX_DTC0,3);
+#endif
}
int
@@ -373,6 +379,10 @@
europa_buffer_init ();
europa_event_init ();
+
+ /* adding buffers into the fifo starting with a level of 250 */
+ buffer_insert (EUROPA_R1_GTX_FREE_FIFO, 250);
+ buffer_insert (EUROPA_R1_DRX_FREE_FIFO, 250);
- buffer_check_levels ();
+ /* buffer_check_levels (); */
} /* europa_hw_init() */
Index: event.c
===================================================================
RCS file: /home/cvs_rep/neti_source/ns/hw_elsa/src/event.c,v
retrieving revision 1.46
diff -u -r1.46 event.c
--- event.c 2000/12/20 15:03:49 1.46
+++ event.c 2001/01/02 13:57:45
@@ -254,7 +254,7 @@
{
struct event_grx_buff_free *e = (struct event_grx_buff_free *) &event;
-#if DEBUG
+#if 0
printf ("GRX freeing buffer: %d, stat=%d, dmach=%d, empty=%d\n",
e->buff, e->status, e->dmach, e->empty);
#endif
@@ -272,17 +272,17 @@
{
struct event_dtx_buff_free *e = (struct event_dtx_buff_free *) &event;
-#if DEBUG
+#if 0
printf ("DTX buffer free: %d\n", e->buff);
#endif
- /* We are done with this buffer. */
- dtx_tx_done (e->buff, e->lci);
PROFENTRY (7);
/* Just free the buffer. */
buffer_free (b2pb (e->buff));
PROFENTRY (8);
+ /* We are done with this buffer. */
+ dtx_tx_done (e->buff, e->lci);
}
@@ -516,6 +516,7 @@
through the event buffer again and process all packets.
We check the buffer FIFO:s. */
+int max_events=0;
int
europa_event_roll ()
{
@@ -553,7 +554,13 @@
PROFENTRY (2);
read_events = europa_fifo_poll (eb->eb_size - eb->eb_tail);
PROFEXIT (2);
+ if ( read_events > max_events )
+ {
+ printf(" max events %d\n",read_events);
+ max_events = read_events;
+ }
+ if (read_events > 200 ) printf("read_events = %d\n",read_events);
cnt_total_events += read_events; /* bqt */
#else
@@ -643,8 +650,13 @@
break;
case EVENT_GTX_BUFFERS_CONSUMED:
+ buffer_insert (EUROPA_R1_GTX_FREE_FIFO, 64);
+ cnt_buf_cons++; /* bqt */
+ break;
+
case EVENT_DRX_BUFERRS_CONSUMED:
- buffer_check_levels ();
+ /*buffer_check_levels (); */
+ buffer_insert (EUROPA_R1_DRX_FREE_FIFO, 64);
cnt_buf_cons++; /* bqt */
break;
@@ -687,7 +699,7 @@
}
}
-#if 1
+#if 0
/* Check FIFO levels. */
buffer_check_levels ();
#endif
@@ -832,7 +844,7 @@
active_event_buffer = active_intr_buffer = event_buffer_grab ();
if (active_event_buffer == 0)
{
- printf ("Couldn't grab an event buffer!\n");
+ printf ("Couldnt grab an event buffer! \n");
return;
}
Index: slotlists.c
===================================================================
RCS file: /home/cvs_rep/neti_source/ns/hw_elsa/src/slotlists.c,v
retrieving revision 1.2
diff -u -r1.2 slotlists.c
--- slotlists.c 2000/10/19 07:27:53 1.2
+++ slotlists.c 2000/12/27 10:47:48
@@ -98,7 +98,6 @@
start = (int) *(ptr++);
count = (int) *(ptr++);
- printf ("Slot: %d, Length: %d\n", start, count);
if (count == 0)
break;
More information about the Binutils
mailing list