Changeset 135


Ignore:
Timestamp:
Jul 3, 2017, 5:21:06 PM (7 years ago)
Author:
max@…
Message:

start moving the APIC into the XCU driver

Location:
trunk/hal/x86_64
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/core/hal_apic.c

    r117 r135  
    114114/* -------------------------------------------------------------------------- */
    115115
     116size_t ioapic_pins __in_kdata = 0;
    116117paddr_t ioapic_pa __in_kdata = 0;
    117118vaddr_t ioapic_va __in_kdata = 0;
     
    133134#define IOREDTBL        0x10
    134135
    135 #define IOENTRY_DISABLE 0x10000
    136 
    137136void hal_ioapic_write(uint8_t reg, uint32_t val)
    138137{
     
    155154static void hal_ioapic_init()
    156155{
    157         size_t i, pins;
    158156        uint32_t ver;
     157        size_t i;
    159158
    160159        ioapic_va = hal_gpt_bootstrap_valloc(1); // XXX: should be shared
     
    163162
    164163        ver = hal_ioapic_read(IOAPICVER);
    165         pins = ((ver >> 16) & 0xFF) + 1;
     164        ioapic_pins = ((ver >> 16) & 0xFF) + 1;
    166165
    167166        /* Explicitly disable (mask) each vector */
    168         for (i = 0; i < pins; i++) {
     167        for (i = 0; i < ioapic_pins; i++) {
    169168                hal_ioapic_set_entry(i, IOENTRY_DISABLE);
    170169        }
     170
     171        x86_printf("IOAPICPINS: #%z\n", ioapic_pins);
    171172
    172173        /* Now, enable the keyboard */
     
    205206        /* Initialize the LAPIC timer to the maximum value */
    206207        hal_lapic_write(LAPIC_ICR_TIMER, 0xFFFFFFFF);
     208
     209        /* Initialize the PIT */
     210        hal_pit_init();
    207211
    208212        pittick = hal_pit_timer_read() + 1;
     
    239243 *  - APIC internal error (ERR)
    240244 *  - Extended (Implementation dependent)
     245 * Only the Spurious and APIC Timer interrupts are enabled.
    241246 */
    242247static void hal_lapic_init()
  • trunk/hal/x86_64/core/hal_apic.h

    r89 r135  
    2121
    2222#ifndef x86_ASM
     23void hal_ioapic_set_entry(uint8_t index, uint64_t data);
     24
    2325uint32_t hal_lapic_gid();
    2426void hal_apic_init();
    2527#endif
     28
     29/*
     30 *******************************************************************************
     31 * IOAPIC
     32 *******************************************************************************
     33 */
     34
     35#define IOENTRY_DISABLE 0x10000
     36
     37
     38/*
     39 *******************************************************************************
     40 * LAPIC
     41 *******************************************************************************
     42 */
    2643
    2744#define LAPIC_SPURIOUS_VECTOR   LAPICVEC_MIN
  • trunk/hal/x86_64/core/hal_init.c

    r119 r135  
    8080}
    8181
     82/* -------------------------------------------------------------------------- */
     83
     84static void init_bootinfo_icu(boot_device_t *dev)
     85{
     86        memset(dev, 0, sizeof(boot_device_t));
     87
     88        dev->base = NULL; /* XXX */
     89        dev->type = (DEV_FUNC_ICU << 16) | IMPL_ICU_XCU;
     90        dev->channels = 1;
     91        dev->param0 = 0;
     92        dev->param1 = 0;
     93        dev->param2 = 0;
     94        dev->param3 = 0;
     95
     96#ifdef NOTYET
     97    uint32_t    irqs;                 /*! number of input IRQs                              */
     98    boot_irq_t  irq[32];              /*! array of input IRQS (PIC and ICU only)            */
     99#endif
     100}
     101
    82102static size_t init_bootinfo_pages_nr()
    83103{
     
    190210        info->rsvd_nr = init_bootinfo_rsvd(&info->rsvd);
    191211
    192         /* dev_ XXX */
     212        init_bootinfo_icu(&info->dev_icu);
     213        /* TODO: dev_mmc */
     214        /* TODO: dev_dma */
     215
    193216        offset = hal_gpt_bootstrap_uniformize();
    194217        info->pages_offset = offset / PAGE_SIZE;
  • trunk/hal/x86_64/drivers/soclib_xcu.c

    r129 r135  
    2727#include <chdev.h>
    2828
     29#include <hal_apic.h>
    2930#include <hal_internal.h>
    3031
    31 void soclib_xcu_init( chdev_t * icu,
    32                       lid_t     lid )
     32extern size_t ioapic_pins;
     33
     34void soclib_xcu_init(chdev_t *icu, lid_t lid)
    3335{
     36        size_t i;
     37
     38        /* disable all IRQs */
     39        for (i = 0; i < ioapic_pins; i++) {
     40                hal_ioapic_set_entry(i, IOENTRY_DISABLE);
     41        }
     42
    3443        x86_panic((char *)__func__);
    3544}
Note: See TracChangeset for help on using the changeset viewer.