-
Notifications
You must be signed in to change notification settings - Fork 0
/
Updated-legacy-code-in-i386-pc386.patch
952 lines (873 loc) · 26.9 KB
/
Updated-legacy-code-in-i386-pc386.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
From 2bdcf4fd511941dab9ef0db0790363dedfaf622f Mon Sep 17 00:00:00 2001
From: Vipul Nayyar <[email protected]>
Date: Fri, 26 Jul 2013 20:23:39 +0530
Subject: [PATCH] Updated legacy code in i386 pc386
---
c/src/lib/libbsp/i386/pc386/3c509/3c509.c | 113 +++++-------------------
c/src/lib/libbsp/i386/pc386/clock/ckinit.c | 71 +++++++--------
c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c | 58 +++++-------
c/src/lib/libbsp/i386/pc386/console/vgacons.c | 35 +++-----
c/src/lib/libbsp/i386/pc386/include/bsp.h | 10 ++-
c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c | 44 ++++-----
c/src/lib/libbsp/i386/shared/comm/tty_drv.c | 93 +++++++------------
c/src/lib/libbsp/i386/shared/smp/smp-imps.c | 30 +++----
8 files changed, 166 insertions(+), 288 deletions(-)
diff --git a/c/src/lib/libbsp/i386/pc386/3c509/3c509.c b/c/src/lib/libbsp/i386/pc386/3c509/3c509.c
index ec309ba..41c1de1 100644
--- a/c/src/lib/libbsp/i386/pc386/3c509/3c509.c
+++ b/c/src/lib/libbsp/i386/pc386/3c509/3c509.c
@@ -60,6 +60,7 @@
#include <errno.h>
#include <rtems/error.h>
#include <rtems/rtems_bsdnet.h>
+#include <assert.h>
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -163,11 +164,11 @@ struct ep_softc
struct ep_board *epb;
int unit;
- rtems_irq_connect_data irqInfo;
- rtems_id rxDaemonTid;
- rtems_id txDaemonTid;
+ rtems_id rxDaemonTid;
+ rtems_id txDaemonTid;
+ rtems_vector_number name;
- int acceptBroadcast;
+ int acceptBroadcast;
short tx_underrun;
short rx_no_first;
@@ -355,7 +356,7 @@ static __inline unsigned short inw( unsigned short io_addr )
* RETURNS: nothing.
*
**********************************************************************************/
-void __inline outb( unsigned short io_addr, uint8_t out_data )
+static __inline void outb( unsigned short io_addr, uint8_t out_data )
{
outport_byte( io_addr, out_data );
}
@@ -403,46 +404,6 @@ static int get_eeprom_data( int id_port, int offset )
/**********************************************************************************
*
- * DESCRIPTION: Waits until the EEPROM of the card is ready to be accessed.
- *
- * RETURNS: 0 - not ready; 1 - ok
- *
- **********************************************************************************/
-static int eeprom_rdy( struct ep_softc *sc )
-{
- int i;
-
- for (i = 0; is_eeprom_busy(BASE) && i < MAX_EEPROMBUSY; i++)
- continue;
- if (i >= MAX_EEPROMBUSY)
- {
- printf("ep%d: eeprom failed to come ready.\n", sc->unit);
- return (0);
- }
- return (1);
-}
-
-/**********************************************************************************
- *
- * DESCRIPTION:
- * get_e: gets a 16 bits word from the EEPROM.
- * We must have set the window before call this routine.
- *
- * RETURNS: data from EEPROM
- *
- **********************************************************************************/
-u_short get_e( struct ep_softc *sc, int offset )
-{
- if( !eeprom_rdy(sc) )
- return (0xffff);
- outw(BASE + EP_W0_EEPROM_COMMAND, EEPROM_CMD_RD | offset );
- if( !eeprom_rdy(sc) )
- return( 0xffff );
- return( inw( BASE + EP_W0_EEPROM_DATA ) );
-}
-
-/**********************************************************************************
- *
* DESCRIPTION:
* Driver interrupt handler. This routine is called by the RTEMS kernel when this
* interrupt is raised.
@@ -450,9 +411,9 @@ u_short get_e( struct ep_softc *sc, int offset )
* RETURNS: nothing.
*
**********************************************************************************/
-static rtems_isr ap_interrupt_handler( rtems_vector_number v )
+static rtems_isr ap_interrupt_handler(void *arg)
{
- struct ep_softc *sc = (struct ep_softc *)&ep_softc[ 0 ];
+ struct ep_softc *sc = (struct ep_softc *)arg;
/* de-activate any pending interrrupt, and sent and event to interrupt task
* to process all events required by this interrupt.
@@ -464,30 +425,6 @@ static rtems_isr ap_interrupt_handler( rtems_vector_number v )
/**********************************************************************************
*
* DESCRIPTION:
- *
- * RETURNS:
- *
- **********************************************************************************/
-static void nopOn(const rtems_irq_connect_data* notUsed)
-{
- /* does nothing */
-}
-
-/**********************************************************************************
- *
- * DESCRIPTION:
- *
- * RETURNS:
- *
- **********************************************************************************/
-static int _3c509_IsOn(const rtems_irq_connect_data* irq)
-{
- return BSP_irq_enabled_at_i8259s (irq->name);
-}
-
-/**********************************************************************************
- *
- * DESCRIPTION:
* Initializes the ethernet hardware.
*
* RETURNS: nothing.
@@ -495,24 +432,22 @@ static int _3c509_IsOn(const rtems_irq_connect_data* irq)
**********************************************************************************/
static void _3c509_initialize_hardware (struct ep_softc *sc)
{
- rtems_status_code st;
+ rtems_status_code status;
epinit( sc );
/*
* Set up interrupts
*/
- sc->irqInfo.hdl = ( rtems_irq_hdl )ap_interrupt_handler;
- sc->irqInfo.on = nopOn;
- sc->irqInfo.off = nopOn;
- sc->irqInfo.isOn = _3c509_IsOn;
-
- printf ("3c509: IRQ with Kernel: %d\n", sc->irqInfo.name );
- st = BSP_install_rtems_irq_handler( &sc->irqInfo );
- if( !st )
- {
- rtems_panic ("Can't attach WD interrupt handler for irq %d\n", sc->irqInfo.name );
- }
+ printf ("3c509: IRQ with Kernel: %d\n", (int)sc->name );
+ status = rtems_interrupt_handler_install(
+ sc->name,
+ "3c509",
+ RTEMS_INTERRUPT_UNIQUE,
+ ap_interrupt_handler,
+ sc
+ );
+ assert(status == RTEMS_SUCCESSFUL);
}
/**********************************************************************************
@@ -746,8 +681,8 @@ int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *config )
*/
overrun = 0;
resend = 0;
- ep_unit = 0;
- ep_boards = 0;
+ ep_unit = 0;
+ ep_boards = 0;
/*
* Find a free driver
@@ -782,9 +717,9 @@ int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *config )
mtu = ETHERMTU;
if (config->irno)
- sc->irqInfo.name = config->irno;
+ sc->name = config->irno;
else
- sc->irqInfo.name = 10;
+ sc->name = 10;
if (config->port)
sc->ep_io_addr = config->port;
@@ -1046,13 +981,13 @@ static int ep_isa_attach( struct isa_device *is )
irq = is->id_irq;
/* update the interrupt line number to registered with kernel */
- sc->irqInfo.name = irq;
+ sc->name = irq;
GO_WINDOW( 0 );
SET_IRQ( BASE, irq );
printf( "3C509: I/O=0x%x, IRQ=%d, CONNECTOR=%s, ",
- sc->ep_io_addr, sc->irqInfo.name,ep_conn_type[ sc->ep_connector ] );
+ sc->ep_io_addr, (int)sc->name,ep_conn_type[ sc->ep_connector ] );
ep_attach( sc );
return 1;
diff --git a/c/src/lib/libbsp/i386/pc386/clock/ckinit.c b/c/src/lib/libbsp/i386/pc386/clock/ckinit.c
index 37b0408..76024e8 100644
--- a/c/src/lib/libbsp/i386/pc386/clock/ckinit.c
+++ b/c/src/lib/libbsp/i386/pc386/clock/ckinit.c
@@ -27,6 +27,7 @@
#include <bsp/irq.h>
#include <bspopts.h>
#include <libcpu/cpuModel.h>
+#include <assert.h>
#define CLOCK_VECTOR 0
@@ -36,15 +37,12 @@ uint32_t pc386_clock_click_count;
/* forward declaration */
void Clock_isr(void *param);
-void Clock_driver_support_at_tick_tsc(void);
-void Clock_driver_support_at_tick_empty(void);
-uint32_t bsp_clock_nanoseconds_since_last_tick_tsc(void);
-uint32_t bsp_clock_nanoseconds_since_last_tick_i8254(void);
-void Clock_isr_handler(rtems_irq_hdl_param param);
-int clockIsOn(const rtems_irq_connect_data* unused);
-void clockOff(const rtems_irq_connect_data* unused);
-void Clock_driver_install_handler(void);
-void Clock_driver_support_initialize_hardware(void);
+static void Clock_driver_support_at_tick_empty(void);
+static void clockOff(void);
+static void Clock_driver_support_at_tick_tsc(void);
+static uint32_t bsp_clock_nanoseconds_since_last_tick_tsc(void);
+static uint32_t bsp_clock_nanoseconds_since_last_tick_i8254(void);
+static void Clock_isr_handler(void *param);
/*
* Roughly the number of cycles per tick and per nanosecond. Note that these
@@ -83,7 +81,7 @@ uint32_t (*Clock_driver_nanoseconds_since_last_tick)(void) = NULL;
/*
* What do we do at each clock tick?
*/
-void Clock_driver_support_at_tick_tsc(void)
+static void Clock_driver_support_at_tick_tsc(void)
{
#ifdef CLOCK_DRIVER_ISRS_PER_TICK
/*
@@ -99,7 +97,7 @@ void Clock_driver_support_at_tick_tsc(void)
#endif
}
-void Clock_driver_support_at_tick_empty(void)
+static void Clock_driver_support_at_tick_empty(void)
{
}
@@ -113,7 +111,7 @@ extern volatile uint32_t Clock_driver_isrs;
/*
* Get nanoseconds using Pentium-compatible TSC register
*/
-uint32_t bsp_clock_nanoseconds_since_last_tick_tsc(void)
+static uint32_t bsp_clock_nanoseconds_since_last_tick_tsc(void)
{
uint64_t diff_nsec;
@@ -140,7 +138,7 @@ uint32_t bsp_clock_nanoseconds_since_last_tick_tsc(void)
/*
* Get nanoseconds using 8254 timer chip
*/
-uint32_t bsp_clock_nanoseconds_since_last_tick_i8254(void)
+static uint32_t bsp_clock_nanoseconds_since_last_tick_i8254(void)
{
uint32_t usecs, clicks, isrs;
uint32_t usecs1, usecs2;
@@ -232,9 +230,7 @@ static void calibrate_tsc(void)
pc586_tsc_per_tick /= rtems_clock_get_ticks_per_second();
}
-static void clockOn(
- const rtems_irq_connect_data* unused
-)
+static void clockOn(void)
{
pc386_isrs_per_tick = 1;
pc386_microseconds_per_isr = rtems_configuration_get_microseconds_per_tick();
@@ -267,7 +263,7 @@ static void clockOn(
calibrate_tsc();
}
-void clockOff(const rtems_irq_connect_data* unused)
+static void clockOff(void)
{
/* reset timer mode to standard (BIOS) value */
outport_byte(TIMER_MODE, TIMER_SEL0 | TIMER_16BIT | TIMER_RATEGEN);
@@ -275,35 +271,27 @@ void clockOff(const rtems_irq_connect_data* unused)
outport_byte(TIMER_CNTR0, 0);
} /* Clock_exit */
-int clockIsOn(const rtems_irq_connect_data* unused)
-{
- return ((i8259s_cache & 0x1) == 0);
-}
bool Clock_isr_enabled = false;
-void Clock_isr_handler(
- rtems_irq_hdl_param param
-)
+static void Clock_isr_handler(void *param)
{
if ( Clock_isr_enabled )
Clock_isr( param );
}
-static rtems_irq_connect_data clockIrqData = {
- BSP_PERIODIC_TIMER,
- Clock_isr_handler,
- 0,
- clockOn,
- clockOff,
- clockIsOn
-};
-
void Clock_driver_install_handler(void)
{
- if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
- printk("Unable to install system clock ISR handler\n");
- rtems_fatal_error_occurred(1);
- }
+ rtems_status_code status;
+
+ status = rtems_interrupt_handler_install(
+ BSP_PERIODIC_TIMER,
+ "ckinit",
+ RTEMS_INTERRUPT_UNIQUE,
+ Clock_isr_handler,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
+ clockOn();
}
void Clock_driver_support_initialize_hardware(void)
@@ -349,7 +337,14 @@ void Clock_driver_support_initialize_hardware(void)
#define Clock_driver_support_shutdown_hardware() \
do { \
- BSP_remove_rtems_irq_handler (&clockIrqData); \
+ rtems_status_code status; \
+ clockOff(); \
+ status = rtems_interrupt_handler_remove( \
+ BSP_PERIODIC_TIMER, \
+ Clock_isr_handler, \
+ NULL \
+ ); \
+ assert(status == RTEMS_SUCCESSFUL); \
} while (0)
#include "../../../shared/clockdrv_shell.h"
diff --git a/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c b/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c
index d0af6b9..9112552 100644
--- a/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c
+++ b/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c
@@ -17,6 +17,7 @@
#include <string.h>
#include <errno.h>
#include <sys/types.h>
+#include <assert.h>
#include <bsp.h>
#include <bsp/irq.h>
@@ -29,6 +30,7 @@
#define INITIALIZE_MOUSE
/* Some configuration switches are present in the include file... */
#include "ps2_mouse.h"
+#include "ps2_drv.h"
static void kbd_write_command_w(int data);
#if 0
@@ -36,6 +38,7 @@ static void kbd_write_output_w(int data);
#endif
static unsigned char handle_kbd_event(void);
+static void ps2_set_driver_handler(int port, mouse_parser_enqueue_handler handler);
/* used only by send_data - set by keyboard_interrupt */
static volatile unsigned char reply_expected = 0;
@@ -56,14 +59,14 @@ static unsigned char mouse_reply_expected = 0;
#define AUX_INTS_ON (KBD_MODE_KCC | KBD_MODE_SYS | KBD_MODE_MOUSE_INT | KBD_MODE_KBD_INT)
#define MAX_RETRIES 60 /* some aux operations take long time*/
-static void ps2_mouse_interrupt(rtems_irq_hdl_param);
+static void ps2_mouse_interrupt(void *);
static mouse_parser_enqueue_handler driver_input_handler_ps2 = NULL;
/*
* This routine sets the handler to handle the characters received
* from the serial port.
*/
-void ps2_set_driver_handler(
+static void ps2_set_driver_handler(
int port,
mouse_parser_enqueue_handler handler
)
@@ -78,30 +81,6 @@ static void mdelay( unsigned long t )
static void* termios_ttyp_paux = NULL;
-static void
-isr_on(const rtems_irq_connect_data *unused)
-{
- return;
-}
-
-static void
-isr_off(const rtems_irq_connect_data *unused)
-{
- return;
-}
-
-static int isr_is_on(const rtems_irq_connect_data *irq)
-{
- return BSP_irq_enabled_at_i8259s( irq->name );
-}
-
-static rtems_irq_connect_data ps2_isr_data = { AUX_IRQ,
- ps2_mouse_interrupt,
- 0,
- isr_on,
- isr_off,
- isr_is_on };
-
/*
* Wait for keyboard controller input buffer to drain.
*
@@ -223,7 +202,7 @@ static unsigned char handle_kbd_event(void)
return status;
}
-static void ps2_mouse_interrupt(rtems_irq_hdl_param ignored)
+static void ps2_mouse_interrupt(void * unused)
{
handle_kbd_event();
}
@@ -323,11 +302,17 @@ static int queue_empty(void)
static int release_aux(void)
{
+ rtems_status_code status;
if (--aux_count)
return 0;
kbd_write_cmd(AUX_INTS_OFF); /* Disable controller ints */
kbd_write_command_w(KBD_CCMD_MOUSE_DISABLE);
- BSP_remove_rtems_irq_handler( &ps2_isr_data );
+ status = rtems_interrupt_handler_remove(
+ AUX_IRQ,
+ ps2_mouse_interrupt,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
return 0;
}
@@ -338,18 +323,21 @@ static int release_aux(void)
static int open_aux(void)
{
- int status;
+ rtems_status_code status;
if (aux_count++) {
return 0;
}
queue->head = queue->tail = 0; /* Flush input queue */
- status = BSP_install_rtems_irq_handler( &ps2_isr_data );
- if( !status ) {
- printk("Error installing ps2-mouse interrupt handler!\n" );
- rtems_fatal_error_occurred( status );
- }
+ status = rtems_interrupt_handler_install(
+ AUX_IRQ,
+ "ps2_mouse",
+ RTEMS_INTERRUPT_UNIQUE,
+ ps2_mouse_interrupt,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
kbd_write_command_w(KBD_CCMD_MOUSE_ENABLE); /* Enable the auxiliary port on
controller. */
@@ -429,7 +417,7 @@ static int psaux_init( void )
/*
* paux device driver INITIALIZE entry point.
*/
-rtems_device_driver paux_initialize(
+rtems_device_driver paux_initialize(
rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg)
diff --git a/c/src/lib/libbsp/i386/pc386/console/vgacons.c b/c/src/lib/libbsp/i386/pc386/console/vgacons.c
index d1143da..91d88ee 100644
--- a/c/src/lib/libbsp/i386/pc386/console/vgacons.c
+++ b/c/src/lib/libbsp/i386/pc386/console/vgacons.c
@@ -1,5 +1,5 @@
/*
- * This file contains the termios TTY driver for the i386
+ * This file contains the termios TTY driver for the i386
* vga.
*
* COPYRIGHT (c) 1989-2011.
@@ -20,23 +20,11 @@
#include <bsp/irq.h>
#include <bsp.h>
#include <crt.h>
+#include <assert.h>
+#include "keyboard.h"
#define VGACONS_STATIC static
-static int isr_is_on(const rtems_irq_connect_data *irq)
-{
- return BSP_irq_enabled_at_i8259s(irq->name);
-}
-
-static rtems_irq_connect_data keyboard_isr_data = {
- BSP_KEYBOARD,
- keyboard_interrupt,
- 0,
- NULL,
- NULL,
- isr_is_on
-};
-
/*
* vgacons_init
*
@@ -44,7 +32,7 @@ static rtems_irq_connect_data keyboard_isr_data = {
*/
VGACONS_STATIC void vgacons_init(int minor)
{
- /*
+ /*
* Note: We do not initialize the KBD interface here since
* it was initialized regardless of whether the
* vga is available or not. Therefore it is initialized
@@ -160,7 +148,7 @@ bool vgacons_probe(
int minor
)
{
- int status;
+ rtems_status_code status;
static bool firstTime = true;
if ((*(unsigned char*) NB_MAX_ROW_ADDR == 0) &&
@@ -175,11 +163,14 @@ bool vgacons_probe(
* can be COM1 and you can still use the mouse/VGA for graphics.
*/
if ( firstTime ) {
- status = BSP_install_rtems_irq_handler(&keyboard_isr_data);
- if (!status) {
- printk("Error installing keyboard interrupt handler!\n");
- rtems_fatal_error_occurred(status);
- }
+ status = rtems_interrupt_handler_install(
+ BSP_KEYBOARD,
+ "vgacons",
+ RTEMS_INTERRUPT_UNIQUE,
+ keyboard_interrupt,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
}
firstTime = false;
diff --git a/c/src/lib/libbsp/i386/pc386/include/bsp.h b/c/src/lib/libbsp/i386/pc386/include/bsp.h
index 5e6dcc6..625d4ce 100644
--- a/c/src/lib/libbsp/i386/pc386/include/bsp.h
+++ b/c/src/lib/libbsp/i386/pc386/include/bsp.h
@@ -80,6 +80,10 @@ extern int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int);
#define BSP_DEC21140_NETWORK_DRIVER_NAME "dc1"
#define BSP_DEC21140_NETWORK_DRIVER_ATTACH rtems_dec21140_driver_attach
+extern int rtems_3c509_driver_attach(struct rtems_bsdnet_ifconfig *config);
+#define BSP_3C509_NETWORK_DRIVER_NAME "3c1"
+#define BSP_3C509_NETWORK_DRIVER_ATTACH rtems_3c509_driver_attach
+
#ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
#define RTEMS_BSP_NETWORK_DRIVER_NAME BSP_DEC21140_NETWORK_DRIVER_NAME
#endif
@@ -134,7 +138,7 @@ extern int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int);
/*-------------------------------------------------------------------------+
| Console Defines
-| WARNING: These Values MUST match the order in
+| WARNING: These Values MUST match the order in
| Console_Configuration_Ports
+--------------------------------------------------------------------------*/
#define BSP_CONSOLE_VGA 0
@@ -182,6 +186,10 @@ char _IBMPC_inch_sleep (void); /* from 'inch.c' */
void Wait_X_ms(unsigned int timeToWait); /* from 'timer.c' */
+void Clock_driver_install_handler(void); /* from 'ckinit.c' */
+void Clock_driver_support_initialize_hardware(void); /* from 'ckinit.c' */
+size_t read_aux(char * buffer, size_t count); /* from 'ps2_mouse.c' */
+
/* Definitions for BSPConsolePort */
#define BSP_CONSOLE_PORT_CONSOLE (-1)
#define BSP_CONSOLE_PORT_COM1 (BSP_UART_COM1)
diff --git a/c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c b/c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c
index d26464c..64b7fda 100644
--- a/c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c
+++ b/c/src/lib/libbsp/i386/pc386/wd8003/wd8003.c
@@ -18,6 +18,7 @@
#include <errno.h>
#include <rtems/error.h>
#include <rtems/rtems_bsdnet.h>
+#include <assert.h>
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -73,7 +74,6 @@
*/
struct wd_softc {
struct arpcom arpcom;
- rtems_irq_connect_data irqInfo;
struct mbuf **rxMbuf;
struct mbuf **txMbuf;
int acceptBroadcast;
@@ -84,6 +84,7 @@ struct wd_softc {
int txBdActiveCount;
rtems_id rxDaemonTid;
rtems_id txDaemonTid;
+ rtems_vector_number name;
unsigned int port;
unsigned char *base;
@@ -127,7 +128,7 @@ static struct wd_softc wd_softc[NWDDRIVER];
* WD interrupt handler
*/
static void
-wd8003Enet_interrupt_handler (void *unused)
+wd8003Enet_interrupt_handler (void * unused)
{
unsigned int tport;
unsigned char status, status2;
@@ -169,19 +170,6 @@ wd8003Enet_interrupt_handler (void *unused)
}
-static void nopOn(const rtems_irq_connect_data* notUsed)
-{
- /*
- * code should be moved from wd8003Enet_initialize_hardware
- * to this location
- */
-}
-
-static int wdIsOn(const rtems_irq_connect_data* irq)
-{
- return BSP_irq_enabled_at_i8259s (irq->name);
-}
-
/*
* Initialize the ethernet hardware
*/
@@ -191,7 +179,7 @@ wd8003Enet_initialize_hardware (struct wd_softc *sc)
int i1, ultra;
char cc1, cc2;
unsigned char temp;
- rtems_status_code st;
+ rtems_status_code status;
unsigned int tport;
unsigned char *hwaddr;
@@ -257,15 +245,15 @@ wd8003Enet_initialize_hardware (struct wd_softc *sc)
/*
* Set up interrupts
*/
- sc->irqInfo.hdl = wd8003Enet_interrupt_handler;
- sc->irqInfo.on = nopOn;
- sc->irqInfo.off = nopOn;
- sc->irqInfo.isOn = wdIsOn;
-
- st = BSP_install_rtems_irq_handler (&sc->irqInfo);
- if (!st)
- rtems_panic ("Can't attach WD interrupt handler for irq %d\n",
- sc->irqInfo.name);
+
+ status = rtems_interrupt_handler_install(
+ sc->name,
+ "wd8003",
+ RTEMS_INTERRUPT_UNIQUE,
+ wd8003Enet_interrupt_handler,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
}
static void
@@ -397,7 +385,7 @@ sendpacket (struct ifnet *ifp, struct mbuf *m)
/*
* Driver transmit daemon
*/
-void
+static void
wd_txDaemon (void *arg)
{
struct wd_softc *sc = (struct wd_softc *)arg;
@@ -607,9 +595,9 @@ rtems_wd_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
mtu = ETHERMTU;
if (config->irno)
- sc->irqInfo.name = config->irno;
+ sc->name = config->irno;
else
- sc->irqInfo.name = 5;
+ sc->name = 5;
if (config->port)
sc->port = config->port;
diff --git a/c/src/lib/libbsp/i386/shared/comm/tty_drv.c b/c/src/lib/libbsp/i386/shared/comm/tty_drv.c
index aafb02a..16a40df 100644
--- a/c/src/lib/libbsp/i386/shared/comm/tty_drv.c
+++ b/c/src/lib/libbsp/i386/shared/comm/tty_drv.c
@@ -27,63 +27,19 @@
#include <termios.h>
#include <uart.h>
#include <libcpu/cpuModel.h>
+#include "tty_drv.h"
int BSP_poll_read(int);
/* Internal routines */
static int tty1_conSetAttr( int minor, const struct termios *t);
static int tty2_conSetAttr( int minor, const struct termios *t);
-static void isr_on(const rtems_irq_connect_data *);
-static void isr_off(const rtems_irq_connect_data *);
-static int isr_is_on(const rtems_irq_connect_data *);
extern BSP_polling_getchar_function_type BSP_poll_char;
extern int BSPConsolePort;
extern void rtems_set_waiting_id_comx( int port, rtems_id id, rtems_event_set event );
/*
- * Interrupt structure for tty1
- */
-static rtems_irq_connect_data tty1_isr_data =
-{
- BSP_UART_COM1_IRQ,
- BSP_uart_termios_isr_com1,
- 0,
- isr_on,
- isr_off,
- isr_is_on};
-
-/*
- * Interrupt structure for tty2
- */
-static rtems_irq_connect_data tty2_isr_data =
-{
- BSP_UART_COM2_IRQ,
- BSP_uart_termios_isr_com2,
- 0,
- isr_on,
- isr_off,
- isr_is_on};
-
-static void
-isr_on(const rtems_irq_connect_data *unused)
-{
- return;
-}
-
-static void
-isr_off(const rtems_irq_connect_data *unused)
-{
- return;
-}
-
-static int
-isr_is_on(const rtems_irq_connect_data *irq)
-{
- return BSP_irq_enabled_at_i8259s(irq->name);
-}
-
-/*
* TTYS1 - device driver INITIALIZE entry point.
*/
rtems_device_driver
@@ -111,12 +67,14 @@ tty1_initialize(rtems_device_major_number major,
*/
/* 9600-8-N-1, without hardware flow control */
BSP_uart_init( BSP_UART_COM1, 9600, CHR_8_BITS, 0, 0, 0 );
- status = BSP_install_rtems_irq_handler( &tty1_isr_data );
- if( !status )
- {
- printk("Error installing ttyS1 interrupt handler!\n");
- rtems_fatal_error_occurred(status);
- }
+ status = rtems_interrupt_handler_install(
+ BSP_UART_COM1_IRQ,
+ "tty_drv",
+ RTEMS_INTERRUPT_UNIQUE,
+ BSP_uart_termios_isr_com1,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
/*
* Register the device
*/
@@ -132,7 +90,14 @@ tty1_initialize(rtems_device_major_number major,
static int tty1_last_close(int major, int minor, void *arg)
{
- BSP_remove_rtems_irq_handler( &tty1_isr_data );
+ rtems_status_code status;
+
+ status = rtems_interrupt_handler_remove(
+ BSP_UART_COM1_IRQ,
+ BSP_uart_termios_isr_com1,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
return 0;
}
@@ -339,12 +304,15 @@ tty2_initialize(rtems_device_major_number major,
*/
/* 9600-8-N-1, without hardware flow control */
BSP_uart_init( BSP_UART_COM2, 9600, CHR_8_BITS, 0, 0, 0);
- status = BSP_install_rtems_irq_handler( &tty2_isr_data );
- if( !status )
- {
- printk("Error installing serial console interrupt handler!\n");
- rtems_fatal_error_occurred(status);
- }
+ status = rtems_interrupt_handler_install(
+ BSP_UART_COM2_IRQ,
+ "tty_drv",
+ RTEMS_INTERRUPT_UNIQUE,
+ BSP_uart_termios_isr_com2,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
+
/*
* Register the device
*/
@@ -360,7 +328,14 @@ tty2_initialize(rtems_device_major_number major,
static int tty2_last_close(int major, int minor, void *arg)
{
- BSP_remove_rtems_irq_handler( &tty2_isr_data );
+ rtems_status_code status;
+
+ status = rtems_interrupt_handler_remove(
+ BSP_UART_COM2_IRQ,
+ BSP_uart_termios_isr_com2,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
return 0;
}
diff --git a/c/src/lib/libbsp/i386/shared/smp/smp-imps.c b/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
index 806cfb9..57ec5db 100644
--- a/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
+++ b/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
@@ -79,6 +79,7 @@
#include <rtems/bspsmp.h>
#include <rtems/bspIo.h>
#include <libcpu/cpu.h>
+#include <assert.h>
extern void _pc386_delay(void);
@@ -120,14 +121,14 @@ static void UDELAY(int x)
while ( _i-- )
_pc386_delay();
}
-
+
#define READ_MSR_LO(_x) \
(unsigned int)(read_msr(_x) & 0xffffffff)
static inline unsigned long long read_msr(unsigned int msr)
{
unsigned long long value;
-
+
asm volatile("rdmsr" : "=A" (value) : "c" (msr));
return value;
}
@@ -385,7 +386,7 @@ imps_read_config_table(unsigned start, int count)
case IMPS_BCT_PROCESSOR:
if ( imps_num_cpus < rtems_configuration_get_maximum_processors() ) {
add_processor((imps_processor *)start);
- } else
+ } else
imps_num_cpus++;
start += 12; /* 20 total */
break;
@@ -751,22 +752,19 @@ rtems_isr ap_ipi_isr(
#include <rtems/irq.h>
-static rtems_irq_connect_data apIPIIrqData = {
- 16,
- (void *)ap_ipi_isr,
- 0,
- NULL, /* On */
- NULL, /* Off */
- NULL, /* IsOn */
-};
-
extern void bsp_reset(void);
void ipi_install_irq(void)
{
- if (!BSP_install_rtems_irq_handler (&apIPIIrqData)) {
- printk("Unable to initialize IPI\n");
- bsp_reset();
- }
+ rtems_status_code status;
+
+ status = rtems_interrupt_handler_install(
+ 16,
+ "smp-imps",
+ RTEMS_INTERRUPT_UNIQUE,
+ ap_ipi_isr,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
}
#ifdef __SSE__
--
1.7.11.7