Changeset 8a7ed82 in rtems


Ignore:
Timestamp:
Aug 1, 2011, 1:41:37 PM (9 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.11, 5, master
Children:
01f2692e
Parents:
864dd9ad
Message:

2011-08-01 Jennifer Averett <Jennifer.Averett@…>

PR 1802

  • Makefile.am, configure.ac, preinstall.am, clock/ckinit.c, start/start16.S, startup/bspstart.c, startup/ldsegs.S: Add SMP support for i386.
Location:
c/src/lib/libbsp/i386/pc386
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/pc386/ChangeLog

    r864dd9ad r8a7ed82  
     12011-08-01      Jennifer Averett <Jennifer.Averett@OARcorp.com>
     2
     3        PR 1802
     4        * Makefile.am, configure.ac, preinstall.am, clock/ckinit.c,
     5        start/start16.S, startup/bspstart.c, startup/ldsegs.S: Add SMP
     6        support for i386.
     7
    182011-07-20      Jennifer Averett <Jennifer.Averett@OARcorp.com>
    29
  • c/src/lib/libbsp/i386/pc386/Makefile.am

    r864dd9ad r8a7ed82  
    3131    ../../shared/include/irq-generic.h \
    3232    ../../shared/include/irq-info.h
     33
     34if HAS_SMP
     35include_bsp_HEADERS += ../../i386/shared/irq/apic.h
     36include_bsp_HEADERS += ../../i386/shared/smp/smp-imps.h
     37endif
    3338
    3439include_HEADERS += include/crt.h
     
    110115
    111116if HAS_SMP
    112 libbsp_a_SOURCES += ../../shared/smp/getcpuid.c ../../shared/smp/smp_stub.c \
    113     ../../shared/smp/bspsmp_wait_for.c
     117libbsp_a_SOURCES += ../../i386/shared/smp/getcpuid.c
     118libbsp_a_SOURCES += ../../i386/shared/smp/smp-imps.c
     119
     120project_lib_DATA += appstart.$(OBJEXT)
     121appcpustart.$(OBJEXT): start/start16.S
     122        $(CPPASCOMPILE) $(AM_CPPFLAGS) -DSMP_SECONDARY_CORE -o $@ -c $<
     123
     124appstart.$(OBJEXT): appcpustart.$(OBJEXT)
     125        $(LD) -N -T $(top_srcdir)/startup/linkcmds \
     126            -Ttext 0x70000 -e app_processor_start -nostdlib \
     127            -o appstart_tmp.exe $<
     128        $(OBJCOPY) -O binary appstart_tmp.exe appstart.bin
     129        $(OBJCOPY) -I binary -O elf32-i386 -B i386 appstart.bin $@
    114130endif
    115131
     
    145161    ../../../libcpu/@RTEMS_CPU@/page.rel \
    146162    ../../../libcpu/@RTEMS_CPU@/score.rel
     163
     164if HAS_SMP
     165libbsp_a_LIBADD += appstart.$(OBJEXT)
     166endif
     167
    147168# We only build the Network library if HAS_NETWORKING was defined
    148169# dec21140 is supported via libchip
  • c/src/lib/libbsp/i386/pc386/clock/ckinit.c

    r864dd9ad r8a7ed82  
    235235  pc386_clock_click_count = US_TO_TICK(pc386_microseconds_per_isr);
    236236
     237  BSP_irq_enable_at_i8259s( BSP_PERIODIC_TIMER - BSP_IRQ_VECTOR_BASE );
     238
    237239  #if 0
    238240    printk( "configured usecs per tick=%d \n",
     
    272274  rtems_vector_number vector
    273275);
     276
     277bool Clock_isr_enabled = false;
     278void Clock_isr_handler(
     279  rtems_irq_hdl_param param
     280)
     281{
     282  if ( Clock_isr_enabled )
     283    Clock_isr( 0 );
     284}
     285
    274286static rtems_irq_connect_data clockIrqData = {
    275287  BSP_PERIODIC_TIMER,
    276   (void *)Clock_isr,
     288  Clock_isr_handler,
    277289  0,
    278290  clockOn,
     
    280292  clockIsOn
    281293};
     294
     295void Clock_driver_install_handler(void)
     296{
     297  if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
     298    printk("Unable to install system clock ISR handler\n");
     299    rtems_fatal_error_occurred(1);
     300  }
     301}
    282302
    283303void Clock_driver_support_initialize_hardware(void)
     
    319339  );
    320340
    321   if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
    322     printk("Unable to initialize system clock\n");
    323     rtems_fatal_error_occurred(1);
    324   }
    325 
     341  Clock_isr_enabled = true;
    326342}
    327343
  • c/src/lib/libbsp/i386/pc386/configure.ac

    r864dd9ad r8a7ed82  
    8686 determining the CPU core number in an SMP configuration.])
    8787
     88## The PC386 BSP supports SMP configurations if this is enabled.
     89RTEMS_BSPOPTS_SET([BSP_HAS_SMP],[*],[1])
     90RTEMS_BSPOPTS_HELP([BSP_HAS_SMP],
     91[Always defined when on a pc386 to enable the pc386 support for
     92 determining the CPU core number in an SMP configuration.])
     93
    8894## if this is an i386, does gas have good code16 support?
    8995RTEMS_I386_GAS_CODE16
  • c/src/lib/libbsp/i386/pc386/preinstall.am

    r864dd9ad r8a7ed82  
    7474PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-info.h
    7575
     76if HAS_SMP
     77$(PROJECT_INCLUDE)/bsp/apic.h: ../../i386/shared/irq/apic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     78        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/apic.h
     79PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/apic.h
     80
     81$(PROJECT_INCLUDE)/bsp/smp-imps.h: ../../i386/shared/smp/smp-imps.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     82        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/smp-imps.h
     83PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/smp-imps.h
     84endif
    7685$(PROJECT_INCLUDE)/crt.h: include/crt.h $(PROJECT_INCLUDE)/$(dirstamp)
    7786        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/crt.h
     
    123132PREINSTALL_FILES += $(PROJECT_INCLUDE)/uart.h
    124133
     134if HAS_SMP
     135$(PROJECT_LIB)/appstart.$(OBJEXT): appstart.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
     136        $(INSTALL_DATA) $< $(PROJECT_LIB)/appstart.$(OBJEXT)
     137TMPINSTALL_FILES += $(PROJECT_LIB)/appstart.$(OBJEXT)
     138endif
    125139if HAS_NETWORKING
    126140$(PROJECT_INCLUDE)/wd80x3.h: include/wd80x3.h $(PROJECT_INCLUDE)/$(dirstamp)
  • c/src/lib/libbsp/i386/pc386/start/start16.S

    r864dd9ad r8a7ed82  
    3838+----------------------------------------------------------------------------*/
    3939
     40#if defined(SMP_SECONDARY_CORE)
     41.set PROT_CODE_SEG, 0x08        # offset of code segment descriptor into GDT
     42#else
    4043.set PROT_CODE_SEG, 0x0         # offset of code segment descriptor into GDT
     44#endif
     45
    4146.set PROT_DATA_SEG, 0x10        # offset of code segment descriptor into GDT
    4247.set CR0_PE,        1           # protected mode flag on CR0 register
     
    4550.set STACKOFF,      0x200-0x10  # offset to load into %esp, from start of image
    4651
    47  /* #define NEW_GAS */
     52/* #define NEW_GAS */
     53#ifdef NEW_GAS
     54  #define LJMPL ljmpl
     55#else
     56  #define LJMPL ljmp
     57#endif
     58
    4859/*----------------------------------------------------------------------------+
    4960| CODE section
     
    5162
    5263.text
    53 
     64#if defined(SMP_SECONDARY_CORE)
     65        .globl app_processor_start                # entry point
     66app_processor_start:
     67#else
    5468        .globl _start16         # entry point
    5569        .globl start16
    5670start16:
    5771_start16:
     72#endif
    5873
    5974.code16
    6075        cli                     # DISABLE INTERRUPTS!!!
    61 
    62         movw    %cs, %ax        #
    63         movw    %ax, %ds        # set the rest of real mode registers
    64         movw    %ax, %es        #
    65         movw    %ax, %ss        #
    66 
    67 #if (RTEMS_VIDEO_80x50 == 1)
    68 
     76#if defined(SMP_SECONDARY_CORE)
     77        jmp     1f
     78        .align 4
     79app_cpu_start:
     80        .long   0
     81app_cpu_stack:
     82        .long   0
     831:
     84#endif
     85        movw    %cs, %ax                   # Initialize the rest of
     86        movw    %ax, %ds                   #   segment registers
     87        movw    %ax, %es
     88        movw    %ax, %ss
     89
     90#if !defined(SMP_SECONDARY_CODE) && (RTEMS_VIDEO_80x50 == 1)
    6991        movl    $0x0040,%eax    # use 32 bit constant to ensure 16 MSB=0
    7092        mov     %ax,%es
     
    88110        movw    $0x0007, %cx
    89111        int     $0x10
    90 
    911121:
    92 #endif /* RTEMS_VIDEO_80x50 */
     113#endif /* !SMP_SECONDARY_CODE and RTEMS_VIDEO_80x50 */
    93114
    94115        /*---------------------------------------------------------------------+
     
    96117        +---------------------------------------------------------------------*/
    97118
     119#if defined(SMP_SECONDARY_CORE)
     120        lgdt    gdtptr - app_processor_start  # load Global Descriptor Table
     121#else
    98122        lgdt    gdtptr - start16        # load Global Descriptor Table
     123#endif /* SMP_SECONDARY_CORE */
     124
    99125        movl    %cr0, %eax
    100126        orl     $CR0_PE, %eax
    101127        movl    %eax, %cr0              # turn on protected mode
    102 
    103 #ifdef NEW_GAS
    104         ljmpl   $PROT_CODE_SEG, $1f     # flush prefetch queue, and reload %cs
    105 #else
    106         ljmp    $PROT_CODE_SEG, $1f     # flush prefetch queue, and reload %cs
     128#if defined(SMP_SECONDARY_CORE)
     129        LJMPL   $PROT_CODE_SEG, $2f     # flush prefetch queue, and reload %cs
     130#else
     131        LJMPL   $PROT_CODE_SEG, $2f     # flush prefetch queue, and reload %cs
    107132#endif
    108133.code32
    109 1:
     1342:
     135
    110136        /*---------------------------------------------------------------------+
    111137        | load the other segment registers
     
    115141        movw    %ax, %es
    116142        movw    %ax, %ss
     143#if defined(SMP_SECONDARY_CORE)
     144        movl    app_cpu_stack, %esp            # stack pointer
     145        movl    app_cpu_stack, %ebp            # base pointer
     146 #else
    117147        movl    $start16 + STACKOFF, %esp       # set up stack pointer
    118148        addl    $start16 + STACKOFF, %ebp       # set up stack pointer
     149#endif  /* SMP_SECONDARY_CORE */
    119150
    120151        /*---------------------------------------------------------------------+
     
    133164        call    pc386_delay
    134165
    135         movl    %cs:HDRSTART + HDROFF, %eax     #
    136         pushl   %eax                            # jump to start of 32 bit code
    137         ret                                     #
     166#if defined(SMP_SECONDARY_CORE)
     167        movl    app_cpu_start, %eax             # jump to app CPU start
     168#else
     169        movl    %cs:HDRSTART + HDROFF, %eax     # jump to start of 32 bit code
     170#endif  /* SMP_SECONDARY_CORE */
     171        pushl   %eax                           
     172        ret                                   
     173 
    138174
    139175/*----------------------------------------------------------------------------+
  • c/src/lib/libbsp/i386/pc386/startup/bspstart.c

    r864dd9ad r8a7ed82  
    3232
    3333#include <bsp.h>
     34#include <bsp/irq.h>
    3435#include <rtems/pci.h>
    3536#include <libcpu/cpuModel.h>
     
    4142extern void rtems_irq_mngt_init(void);
    4243extern void bsp_size_memory(void);
     44void Clock_driver_install_handler(void);
    4345
    4446/*-------------------------------------------------------------------------+
     
    8183  }
    8284
     85  Clock_driver_install_handler();
     86
    8387  bsp_ide_cmdline_init();
    8488
  • c/src/lib/libbsp/i386/pc386/startup/ldsegs.S

    r864dd9ad r8a7ed82  
    9797
    9898        lgdt SYM(gdtdesc)
    99         lidt SYM(idtdesc)
     99        lidt SYM(IDT_Descriptor)
    100100
    101101        /* Load CS, flush prefetched queue */
     
    212212
    213213        .p2align 4
    214 SYM(idtdesc):
     214        PUBLIC(IDT_Descriptor)
     215SYM(IDT_Descriptor):
    215216        .word  (256*8 - 1)
    216217        .long  SYM (Interrupt_descriptor_table)
Note: See TracChangeset for help on using the changeset viewer.