Changeset 1433ecda in mainline for kernel/genarch


Ignore:
Timestamp:
2018-04-04T15:42:37Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2c4e1cc
Parents:
47b2d7e3
Message:

Fix cstyle: make ccheck-fix and commit only files where all the changes are good.

Location:
kernel/genarch
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/include/genarch/acpi/acpi.h

    r47b2d7e3 r1433ecda  
    4949        uint32_t ext_checksum;
    5050        uint8_t reserved[3];
    51 } __attribute__ ((packed));
     51} __attribute__((packed));
    5252
    5353/* System Description Table Header */
     
    6262        uint32_t creator_id;
    6363        uint32_t creator_revision;
    64 } __attribute__ ((packed));
     64} __attribute__((packed));
    6565
    6666struct acpi_signature_map {
     
    7474        struct acpi_sdt_header header;
    7575        uint32_t entry[];
    76 } __attribute__ ((packed));
     76} __attribute__((packed));
    7777
    7878/* Extended System Description Table */
     
    8080        struct acpi_sdt_header header;
    8181        uint64_t entry[];
    82 } __attribute__ ((packed));
     82} __attribute__((packed));
    8383
    8484extern struct acpi_rsdp *acpi_rsdp;
  • kernel/genarch/include/genarch/acpi/madt.h

    r47b2d7e3 r1433ecda  
    5656        uint8_t type;
    5757        uint8_t length;
    58 } __attribute__ ((packed));
     58} __attribute__((packed));
    5959
    6060/* Multiple APIC Description Table */
     
    6464        uint32_t flags;
    6565        struct madt_apic_header apic_header[];
    66 } __attribute__ ((packed));
     66} __attribute__((packed));
    6767
    6868struct madt_l_apic {
     
    7171        uint8_t apic_id;
    7272        uint32_t flags;
    73 } __attribute__ ((packed));
     73} __attribute__((packed));
    7474
    7575struct madt_io_apic {
     
    7979        uint32_t io_apic_address;
    8080        uint32_t global_intr_base;
    81 } __attribute__ ((packed));
     81} __attribute__((packed));
    8282
    8383struct madt_intr_src_ovrd {
     
    8787        uint32_t global_int;
    8888        uint16_t flags;
    89 } __attribute__ ((packed));
     89} __attribute__((packed));
    9090
    9191struct madt_nmi_src {
     
    9393        uint16_t flags;
    9494        uint32_t global_intr;
    95 } __attribute__ ((packed));
     95} __attribute__((packed));
    9696
    9797struct madt_l_apic_nmi {
     
    100100        uint16_t flags;
    101101        uint8_t l_apic_lint;
    102 } __attribute__ ((packed));
     102} __attribute__((packed));
    103103
    104104struct madt_l_apic_addr_ovrd {
     
    106106        uint16_t reserved;
    107107        uint64_t l_apic_address;
    108 } __attribute__ ((packed));
     108} __attribute__((packed));
    109109
    110110struct madt_io_sapic {
     
    114114        uint32_t global_intr_base;
    115115        uint64_t io_apic_address;
    116 } __attribute__ ((packed));
     116} __attribute__((packed));
    117117
    118118struct madt_l_sapic {
     
    125125        uint32_t acpi_processor_uid_value;
    126126        uint8_t acpi_processor_uid_str[1];
    127 } __attribute__ ((packed));
     127} __attribute__((packed));
    128128
    129129struct madt_platform_intr_src {
     
    136136        uint32_t global_intr;
    137137        uint32_t platform_intr_src_flags;
    138 } __attribute__ ((packed));
     138} __attribute__((packed));
    139139
    140140extern struct acpi_madt *acpi_madt;
  • kernel/genarch/include/genarch/drivers/am335x/cm_per.h

    r47b2d7e3 r1433ecda  
    7777
    7878        /* Wait for completion */
    79         while ((*tmr_reg & 0x03) != 0x02);
     79        while ((*tmr_reg & 0x03) != 0x02)
     80                ;
    8081}
    8182
  • kernel/genarch/include/genarch/drivers/amdm37x/gpt.h

    r47b2d7e3 r1433ecda  
    203203
    204204static inline void amdm37x_gpt_timer_ticks_init(
    205     amdm37x_gpt_t* timer, uintptr_t ioregs, size_t iosize, unsigned hz)
     205    amdm37x_gpt_t *timer, uintptr_t ioregs, size_t iosize, unsigned hz)
    206206{
    207207        /* Set 32768 Hz clock as source */
    208208        // TODO find a nicer way to setup 32kHz clock source for timer1
    209209        // reg 0x48004C40 is CM_CLKSEL_WKUP see page 485 of the manual
    210         ioport32_t *clksel = (void*) km_map(0x48004C40, 4, PAGE_NOT_CACHEABLE);
     210        ioport32_t *clksel = (void *) km_map(0x48004C40, 4, PAGE_NOT_CACHEABLE);
    211211        *clksel &= ~1;
    212212        km_unmap((uintptr_t)clksel, 4);
     
    214214        assert(timer);
    215215        /* Map control register */
    216         timer->regs = (void*) km_map(ioregs, iosize, PAGE_NOT_CACHEABLE);
     216        timer->regs = (void *) km_map(ioregs, iosize, PAGE_NOT_CACHEABLE);
    217217
    218218        /* Reset the timer */
    219219        timer->regs->tiocp_cfg |= AMDM37x_GPT_TIOCP_CFG_SOFTRESET_FLAG;
    220220
    221         while (!(timer->regs->tistat & AMDM37x_GPT_TISTAT_RESET_DONE_FLAG));
     221        while (!(timer->regs->tistat & AMDM37x_GPT_TISTAT_RESET_DONE_FLAG))
     222                ;
    222223
    223224        /* Set autoreload */
    224225        timer->regs->tclr |= AMDM37x_GPT_TCLR_AR_FLAG;
    225226
    226         timer->special_available = (
    227             (ioregs == AMDM37x_GPT1_BASE_ADDRESS) ||
     227        timer->special_available = ((ioregs == AMDM37x_GPT1_BASE_ADDRESS) ||
    228228            (ioregs == AMDM37x_GPT2_BASE_ADDRESS) ||
    229229            (ioregs == AMDM37x_GPT10_BASE_ADDRESS));
     
    246246}
    247247
    248 static inline void amdm37x_gpt_timer_ticks_start(amdm37x_gpt_t* timer)
     248static inline void amdm37x_gpt_timer_ticks_start(amdm37x_gpt_t *timer)
    249249{
    250250        assert(timer);
     
    256256}
    257257
    258 static inline bool amdm37x_gpt_irq_ack(amdm37x_gpt_t* timer)
     258static inline bool amdm37x_gpt_irq_ack(amdm37x_gpt_t *timer)
    259259{
    260260        assert(timer);
  • kernel/genarch/include/genarch/drivers/bcm2835/irc.h

    r47b2d7e3 r1433ecda  
    5959#define IRQ_PEND_SHORT_S        10
    6060
    61 unsigned shortcut_inums[] = {7, 9, 10, 18, 19, 53, 54, 55, 56, 57, 62};
     61unsigned shortcut_inums[] = { 7, 9, 10, 18, 19, 53, 54, 55, 56, 57, 62 };
    6262
    6363typedef struct {
     
    108108
    109109        asm volatile (
    110                 "clz r0, %[x]\n"
    111                 "rsb %[ret], r0, #32\n"
    112                 : [ret] "=r" (ret)
    113                 : [x] "r" (x)
    114                 : "r0" );
     110            "clz r0, %[x]\n"
     111            "rsb %[ret], r0, #32\n"
     112            : [ret] "=r" (ret)
     113            : [x] "r" (x)
     114            : "r0"
     115        );
    115116
    116117        return ret;
  • kernel/genarch/include/genarch/drivers/bcm2835/timer.h

    r47b2d7e3 r1433ecda  
    6565
    6666
    67 static inline void bcm2835_timer_start(bcm2835_timer_t* timer)
     67static inline void bcm2835_timer_start(bcm2835_timer_t *timer)
    6868{
    6969        assert(timer);
     
    7474}
    7575
    76 static inline void bcm2835_timer_irq_ack(bcm2835_timer_t* timer)
     76static inline void bcm2835_timer_irq_ack(bcm2835_timer_t *timer)
    7777{
    7878        assert(timer);
  • kernel/genarch/include/genarch/drivers/dsrln/dsrlnin.h

    r47b2d7e3 r1433ecda  
    4444typedef struct {
    4545        ioport8_t data;
    46 } __attribute__ ((packed)) dsrlnin_t;
     46} __attribute__((packed)) dsrlnin_t;
    4747
    4848typedef struct {
  • kernel/genarch/include/genarch/drivers/i8042/i8042.h

    r47b2d7e3 r1433ecda  
    4444        uint8_t pad[3];
    4545        ioport8_t status;
    46 } __attribute__ ((packed)) i8042_t;
     46} __attribute__((packed)) i8042_t;
    4747
    4848typedef struct {
  • kernel/genarch/include/genarch/multiboot/multiboot2.h

    r47b2d7e3 r1433ecda  
    9191        uint32_t entry_size;
    9292        uint32_t entry_version;
    93 } __attribute__ ((packed)) multiboot2_memmap_t;
     93} __attribute__((packed)) multiboot2_memmap_t;
    9494
    9595/** Multiboot2 memmap entry structure */
  • kernel/genarch/include/genarch/ofw/ebus.h

    r47b2d7e3 r1433ecda  
    3939        uint32_t addr;
    4040        uint32_t size;
    41 } __attribute__ ((packed)) ofw_ebus_reg_t;
     41} __attribute__((packed)) ofw_ebus_reg_t;
    4242
    4343typedef struct {
     
    4949        uint64_t parent_base;
    5050        uint32_t size;
    51 } __attribute__ ((packed)) ofw_ebus_range_t;
     51} __attribute__((packed)) ofw_ebus_range_t;
    5252
    5353typedef struct {
     
    5757        uint32_t controller_handle;
    5858        uint32_t controller_ino;
    59 } __attribute__ ((packed)) ofw_ebus_intr_map_t;
     59} __attribute__((packed)) ofw_ebus_intr_map_t;
    6060
    6161typedef struct {
     
    6363        uint32_t addr_mask;
    6464        uint32_t intr_mask;
    65 } __attribute__ ((packed)) ofw_ebus_intr_mask_t;
     65} __attribute__((packed)) ofw_ebus_intr_mask_t;
    6666
    6767extern bool ofw_ebus_apply_ranges(ofw_tree_node_t *, ofw_ebus_reg_t *,
  • kernel/genarch/include/genarch/ofw/pci.h

    r47b2d7e3 r1433ecda  
    4242        uint64_t addr;
    4343        uint64_t size;
    44 } __attribute__ ((packed)) ofw_pci_reg_t;
     44} __attribute__((packed)) ofw_pci_reg_t;
    4545
    4646typedef struct {
     
    5151        uint64_t parent_base;
    5252        uint64_t size;
    53 } __attribute__ ((packed)) ofw_pci_range_t;
     53} __attribute__((packed)) ofw_pci_range_t;
    5454
    5555extern bool ofw_pci_apply_ranges(ofw_tree_node_t *, ofw_pci_reg_t *,
  • kernel/genarch/include/genarch/ofw/sbus.h

    r47b2d7e3 r1433ecda  
    3838        uint64_t addr;
    3939        uint32_t size;
    40 } __attribute__ ((packed)) ofw_sbus_reg_t;
     40} __attribute__((packed)) ofw_sbus_reg_t;
    4141
    4242typedef struct {
     
    4444        uint64_t parent_base;
    4545        uint32_t size;
    46 } __attribute__ ((packed)) ofw_sbus_range_t;
     46} __attribute__((packed)) ofw_sbus_range_t;
    4747
    4848extern bool ofw_sbus_apply_ranges(ofw_tree_node_t *, ofw_sbus_reg_t *,
  • kernel/genarch/include/genarch/ofw/upa.h

    r47b2d7e3 r1433ecda  
    3838        uint64_t addr;
    3939        uint64_t size;
    40 } __attribute__ ((packed)) ofw_upa_reg_t;
     40} __attribute__((packed)) ofw_upa_reg_t;
    4141
    4242extern bool ofw_upa_apply_ranges(ofw_tree_node_t *, ofw_upa_reg_t *,
  • kernel/genarch/src/drivers/bcm2835/mbox.c

    r47b2d7e3 r1433ecda  
    4040static void mbox_write(bcm2835_mbox_t *mbox, uint8_t chan, uint32_t value)
    4141{
    42         while (mbox->status & MBOX_STATUS_FULL) ;
     42        while (mbox->status & MBOX_STATUS_FULL)
     43                ;
    4344        mbox->write = MBOX_COMPOSE(chan, value);
    4445}
     
    4950
    5051        do {
    51                 while (mbox->status & MBOX_STATUS_EMPTY) ;
     52                while (mbox->status & MBOX_STATUS_EMPTY)
     53                        ;
    5254                msg = mbox->read;
    5355        } while (MBOX_MSG_CHAN(msg) != chan);
     
    6971
    7072        mbox_write((bcm2835_mbox_t *)BCM2835_MBOX0_ADDR,
    71                    MBOX_CHAN_PROP_A2V, KA2VCA((uint32_t)req));
     73            MBOX_CHAN_PROP_A2V, KA2VCA((uint32_t)req));
    7274        mbox_read((bcm2835_mbox_t *)BCM2835_MBOX0_ADDR,
    73                   MBOX_CHAN_PROP_A2V);
     75            MBOX_CHAN_PROP_A2V);
    7476
    7577        if (req->buf_hdr.code == MBOX_PROP_CODE_RESP_OK) {
     
    8890        bcm2835_mbox_t *fb_mbox;
    8991        bool ret = false;
    90         MBOX_BUFF_ALLOC(fb_desc, bcm2835_fb_desc_t);
     92        MBOX_BUFF_ALLOC(fb_desc, bcm2835_fb_desc_t);
    9193
    9294        fb_mbox = (void *) km_map(BCM2835_MBOX0_ADDR, sizeof(bcm2835_mbox_t),
    93                                   PAGE_NOT_CACHEABLE);
     95            PAGE_NOT_CACHEABLE);
    9496
    9597        fb_desc->width = 640;
     
    119121
    120122        printf("BCM2835 framebuffer at 0x%08x (%dx%d)\n", prop->addr,
    121                prop->x, prop->y);
     123            prop->x, prop->y);
    122124        ret = true;
    123125out:
  • kernel/genarch/src/drivers/omap/uart.c

    r47b2d7e3 r1433ecda  
    4343{
    4444        /* Wait for buffer */
    45         while (uart->regs->ssr & OMAP_UART_SSR_TX_FIFO_FULL_FLAG);
     45        while (uart->regs->ssr & OMAP_UART_SSR_TX_FIFO_FULL_FLAG)
     46                ;
    4647        /* Write to the outgoing fifo */
    4748        uart->regs->thr = b;
     
    9394        /* Soft reset the port */
    9495        uart->regs->sysc = OMAP_UART_SYSC_SOFTRESET_FLAG;
    95         while (!(uart->regs->syss & OMAP_UART_SYSS_RESETDONE_FLAG));
     96        while (!(uart->regs->syss & OMAP_UART_SYSS_RESETDONE_FLAG))
     97                ;
    9698
    9799        /* Disable the UART module */
  • kernel/genarch/src/drivers/pl011/pl011.c

    r47b2d7e3 r1433ecda  
    5050        /* Wait for space becoming available in Tx FIFO. */
    5151        // TODO make pio_read accept consts pointers and remove the cast
    52         while ((pio_read_32((ioport32_t*)&uart->regs->flag) & PL011_UART_FLAG_TXFF_FLAG) != 0)
     52        while ((pio_read_32((ioport32_t *)&uart->regs->flag) & PL011_UART_FLAG_TXFF_FLAG) != 0)
    5353                ;
    5454
     
    8686
    8787        // TODO make pio_read accept const pointers and remove the cast
    88         while ((pio_read_32((ioport32_t*)&uart->regs->flag) & PL011_UART_FLAG_RXFE_FLAG) == 0) {
     88        while ((pio_read_32((ioport32_t *)&uart->regs->flag) & PL011_UART_FLAG_RXFE_FLAG) == 0) {
    8989                /* We ignore all error flags here */
    9090                const uint8_t data = pio_read_32(&uart->regs->data);
     
    9999{
    100100        assert(uart);
    101         uart->regs = (void*)km_map(addr, sizeof(pl011_uart_regs_t),
    102                                    PAGE_NOT_CACHEABLE);
     101        uart->regs = (void *)km_map(addr, sizeof(pl011_uart_regs_t),
     102            PAGE_NOT_CACHEABLE);
    103103        assert(uart->regs);
    104104
    105105        /* Disable UART */
    106         uart->regs->control &= ~ PL011_UART_CONTROL_UARTEN_FLAG;
     106        uart->regs->control &= ~PL011_UART_CONTROL_UARTEN_FLAG;
    107107
    108108        /* Enable hw flow control */
    109109        uart->regs->control |=
    110                 PL011_UART_CONTROL_RTSE_FLAG |
    111                 PL011_UART_CONTROL_CTSE_FLAG;
     110            PL011_UART_CONTROL_RTSE_FLAG |
     111            PL011_UART_CONTROL_CTSE_FLAG;
    112112
    113113        /* Mask all interrupts */
     
    117117        /* Enable UART, TX and RX */
    118118        uart->regs->control |=
    119                 PL011_UART_CONTROL_UARTEN_FLAG |
    120                 PL011_UART_CONTROL_TXE_FLAG |
    121                 PL011_UART_CONTROL_RXE_FLAG;
     119            PL011_UART_CONTROL_UARTEN_FLAG |
     120            PL011_UART_CONTROL_TXE_FLAG |
     121            PL011_UART_CONTROL_RXE_FLAG;
    122122
    123123        outdev_initialize("pl011_uart_dev", &uart->outdev, &pl011_uart_ops);
     
    143143        /* Enable receive interrupts */
    144144        uart->regs->interrupt_mask |=
    145                 PL011_UART_INTERRUPT_RX_FLAG |
    146                 PL011_UART_INTERRUPT_RT_FLAG;
     145            PL011_UART_INTERRUPT_RX_FLAG |
     146            PL011_UART_INTERRUPT_RT_FLAG;
    147147}
    148148
  • kernel/genarch/src/mm/page_ht.c

    r47b2d7e3 r1433ecda  
    222222}
    223223
    224 static pte_t *
    225 ht_mapping_find_internal(as_t *as, uintptr_t page, bool nolock)
     224static pte_t *ht_mapping_find_internal(as_t *as, uintptr_t page, bool nolock)
    226225{
    227226        uintptr_t key[2] = {
  • kernel/genarch/src/softint/multiplication.c

    r47b2d7e3 r1433ecda  
    5454 * @result
    5555 */
    56 static unsigned long long mul(unsigned int a, unsigned int b) {
     56static unsigned long long mul(unsigned int a, unsigned int b)
     57{
    5758        unsigned int a1, a2, b1, b2;
    5859        unsigned long long t1, t2, t3;
     
    6465
    6566        t1 = a1 * b1;
    66         t2 = a1*b2;
    67         t2 += a2*b1;
    68         t3 = a2*b2;
     67        t2 = a1 * b2;
     68        t2 += a2 * b1;
     69        t3 = a2 * b2;
    6970
    7071        t3 = (((t1 << 16) + t2) << 16) + t3;
     
    7980{
    8081        long long result;
    81         unsigned long long t1,t2;
     82        unsigned long long t1, t2;
    8283        unsigned long long a1, a2, b1, b2;
    8384        char neg = 0;
     
    101102        if (SOFTINT_CHECK_OF && (a1 != 0) && (b1 != 0)) {
    102103                // error, overflow
    103                 return (neg?MIN_INT64:MAX_INT64);
     104                return (neg ? MIN_INT64 : MAX_INT64);
    104105        }
    105106
    106107        // (if OF checked) a1 or b1 is zero => result fits in 64 bits, no need to another overflow check
    107         t1 = mul(a1,b2) + mul(b1,a2);
     108        t1 = mul(a1, b2) + mul(b1, a2);
    108109
    109110        if (SOFTINT_CHECK_OF && t1 > MAX_UINT32) {
    110111                // error, overflow
    111                 return (neg?MIN_INT64:MAX_INT64);
     112                return (neg ? MIN_INT64 : MAX_INT64);
    112113        }
    113114
    114115        t1 = t1 << 32;
    115         t2 = mul(a2,b2);
     116        t2 = mul(a2, b2);
    116117        t2 += t1;
    117118
     
    120121        if (SOFTINT_CHECK_OF && ((t2 < t1) || (t2 & (1ull << 63)))) {
    121122                // error, overflow
    122                 return (neg?MIN_INT64:MAX_INT64);
     123                return (neg ? MIN_INT64 : MAX_INT64);
    123124        }
    124125
Note: See TracChangeset for help on using the changeset viewer.