Ignore:
Timestamp:
Jul 4, 2017, 12:05:39 PM (5 years ago)
Author:
max@…
Message:

update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/drivers/soclib_xcu.c

    r137 r138  
    11/*
    2  * soclib_xcu.c - soclib XCU driver API implementation.
     2 * soclib_xcu.c - x86 XCU driver API implementation.
    33 *
    4  * Authors  Alain Greiner    (2016)
    5  *
    6  * Copyright (c) UPMC Sorbonne Universites
     4 * Copyright (c) 2017 Maxime Villard
    75 *
    86 * This file is part of ALMOS-MKH.
    97 *
    10  * ALMOS-MKH.is free software; you can redistribute it and/or modify it
     8 * ALMOS-MKH is free software; you can redistribute it and/or modify it
    119 * under the terms of the GNU General Public License as published by
    1210 * the Free Software Foundation; version 2.0 of the License.
    1311 *
    14  * ALMOS-MKH.is distributed in the hope that it will be useful, but
     12 * ALMOS-MKH is distributed in the hope that it will be useful, but
    1513 * WITHOUT ANY WARRANTY; without even the implied warranty of
    1614 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     
    1816 *
    1917 * You should have received a copy of the GNU General Public License
    20  * along with ALMOS-kernel; if not, write to the Free Software Foundation,
     18 * along with ALMOS-MKH.; if not, write to the Free Software Foundation,
    2119 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    2220 */
     
    2826
    2927#include <hal_apic.h>
     28#include <hal_segmentation.h>
    3029#include <hal_internal.h>
    3130
    3231extern size_t ioapic_pins;
    33 
    34 uint64_t apic_fake_status __in_kdata = 0;
    3532
    3633/*
     
    4037uint32_t wti_baseidx __in_kdata = 0;
    4138uint32_t pti_baseidx __in_kdata = 0;
     39
     40static uint32_t get_pin(uint32_t idx, uint32_t type)
     41{
     42        switch (type) {
     43                case HWI_TYPE:
     44                        return hwi_baseidx + idx;
     45                case WTI_TYPE:
     46                        return wti_baseidx + idx;
     47                case PTI_TYPE:
     48                        return pti_baseidx + idx;
     49                default:
     50                        x86_panic("get_pin: wrong type");
     51                        return 0;
     52        }
     53}
    4254
    4355void soclib_xcu_init(chdev_t *icu, lid_t lid)
     
    5668    lid_t lid)
    5769{
     70        uint8_t dest = (uint8_t)lid; /* XXX */
    5871        uint32_t pin;
     72        uint8_t vec;
     73
     74        pin = get_pin(idx, type);
    5975
    6076        switch (type) {
    6177                case HWI_TYPE:
    62                         pin = hwi_baseidx + idx;
     78                        vec = VECTOR_APIC_XCU_HWI;
    6379                case WTI_TYPE:
    64                         pin = wti_baseidx + idx;
     80                        vec = VECTOR_APIC_XCU_WTI;
    6581                case PTI_TYPE:
    66                         pin = pti_baseidx + idx;
     82                        vec = VECTOR_APIC_XCU_PTI;
    6783                default:
    6884                        x86_panic("enabling wrong irq");
    6985        }
     86
     87        hal_ioapic_set_entry(pin, vec, dest);
    7088
    7189        x86_panic((char *)__func__);
     
    7593    lid_t lid)
    7694{
     95        uint32_t pin = get_pin(idx, type);
     96
     97        hal_ioapic_disable_entry(pin);
     98
    7799        x86_panic((char *)__func__);
    78100}
    79101
    80 void soclib_xcu_get_masks( chdev_t   * icu,
    81                            lid_t       lid,
    82                            uint32_t  * hwi_mask,
    83                            uint32_t  * wti_mask,
    84                            uint32_t  * pti_mask )
     102void soclib_xcu_get_masks(chdev_t *icu, lid_t lid, uint32_t *hwi_mask,
     103    uint32_t *wti_mask, uint32_t *pti_mask)
    85104{
    86105        x86_panic((char *)__func__);
     
    101120}
    102121
    103 
    104 
    105 
    106 
    107122void soclib_xcu_get_status(chdev_t *icu, lid_t lid, uint32_t *hwi_status,
    108123    uint32_t *wti_status, uint32_t *pti_status)
     
    114129        x86_panic((char *)__func__);
    115130}
    116 
    117 
    118 
    119 
    120 
    121131
    122132void soclib_xcu_send_ipi( xptr_t  icu_xp,
Note: See TracChangeset for help on using the changeset viewer.