Changeset a35b458 in mainline for kernel/genarch/src/acpi


Ignore:
Timestamp:
2018-03-02T20:10:49Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

Location:
kernel/genarch/src/acpi
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/acpi/acpi.c

    r3061bc1 ra35b458  
    6969        uint8_t sum = 0;
    7070        uint32_t i;
    71        
     71
    7272        for (i = 0; i < 20; i++)
    7373                sum = (uint8_t) (sum + _rsdp[i]);
    74        
     74
    7575        if (sum)
    7676                return 0; /* bad checksum */
    77        
     77
    7878        if (rsdp->revision == 0)
    7979                return 1; /* ACPI 1.0 */
    80        
     80
    8181        for (; i < rsdp->length; i++)
    8282                sum = (uint8_t) (sum + _rsdp[i]);
    83        
     83
    8484        return !sum;
    8585}
     
    9090        uint8_t sum = 0;
    9191        unsigned int i;
    92        
     92
    9393        for (i = 0; i < hdr->length; i++)
    9494                sum = (uint8_t) (sum + sdt[i]);
    95        
     95
    9696        return !sum;
    9797}
     
    109109        vsdt = (struct acpi_sdt_header *) km_map((uintptr_t) psdt,
    110110            vhdr->length, PAGE_WRITE | PAGE_NOT_CACHEABLE);
    111        
     111
    112112        // TODO: do not leak vtmp
    113113
     
    121121        size_t cnt = (acpi_rsdt->header.length - sizeof(struct acpi_sdt_header))
    122122            / sizeof(uint32_t);
    123        
     123
    124124        for (i = 0; i < cnt; i++) {
    125125                for (j = 0; j < sizeof(signature_map)
     
    127127                        struct acpi_sdt_header *hdr =
    128128                            (struct acpi_sdt_header *) (sysarg_t) acpi_rsdt->entry[i];
    129                        
     129
    130130                        struct acpi_sdt_header *vhdr = map_sdt(hdr);
    131131                        if (CMP_SIGNATURE(vhdr->signature, signature_map[j].signature)) {
    132132                                if (!acpi_sdt_check((uint8_t *) vhdr))
    133133                                        break;
    134                                
     134
    135135                                *signature_map[j].sdt_ptr = vhdr;
    136136                                LOG("%p: ACPI %s", *signature_map[j].sdt_ptr,
     
    147147        size_t cnt = (acpi_xsdt->header.length - sizeof(struct acpi_sdt_header))
    148148            / sizeof(uint64_t);
    149        
     149
    150150        for (i = 0; i < cnt; i++) {
    151151                for (j = 0; j < sizeof(signature_map)
     
    153153                        struct acpi_sdt_header *hdr =
    154154                            (struct acpi_sdt_header *) ((uintptr_t) acpi_xsdt->entry[i]);
    155                        
     155
    156156                        struct acpi_sdt_header *vhdr = map_sdt(hdr);
    157157                        if (CMP_SIGNATURE(vhdr->signature, signature_map[j].signature)) {
    158158                                if (!acpi_sdt_check((uint8_t *) vhdr))
    159159                                        break;
    160                                
     160
    161161                                *signature_map[j].sdt_ptr = vhdr;
    162162                                LOG("%p: ACPI %s", *signature_map[j].sdt_ptr,
     
    174174        unsigned int length[2] = { 1024, 128 * 1024 };
    175175        uint64_t *sig = (uint64_t *) RSDP_SIGNATURE;
    176        
     176
    177177        /*
    178178         * Find Root System Description Pointer
     
    180180         * 2. search 128K starting at 0xe0000
    181181         */
    182        
     182
    183183        addr[0] = (uint8_t *) PA2KA(ebda);
    184184        for (i = (ebda ? 0 : 1); i < 2; i++) {
     
    191191                }
    192192        }
    193        
     193
    194194        return;
    195        
     195
    196196rsdp_found:
    197197        LOG("%p: ACPI Root System Description Pointer", acpi_rsdp);
    198        
     198
    199199        uintptr_t acpi_rsdt_p = (uintptr_t) acpi_rsdp->rsdt_address;
    200200        uintptr_t acpi_xsdt_p = 0;
     
    202202        if (acpi_rsdp->revision)
    203203                acpi_xsdt_p = (uintptr_t) acpi_rsdp->xsdt_address;
    204        
     204
    205205        if (acpi_rsdt_p)
    206206                acpi_rsdt = (struct acpi_rsdt *) map_sdt(
    207207                    (struct acpi_sdt_header *) acpi_rsdt_p);
    208        
     208
    209209        if (acpi_xsdt_p)
    210210                acpi_xsdt = (struct acpi_xsdt *) map_sdt(
    211211                    (struct acpi_sdt_header *) acpi_xsdt_p);
    212        
     212
    213213        if ((acpi_rsdt) && (!acpi_sdt_check((uint8_t *) acpi_rsdt))) {
    214214                log(LF_ARCH, LVL_ERROR, "RSDT: bad checksum");
    215215                return;
    216216        }
    217        
     217
    218218        if ((acpi_xsdt) && (!acpi_sdt_check((uint8_t *) acpi_xsdt))) {
    219219                log(LF_ARCH, LVL_ERROR, "XSDT: bad checksum");
    220220                return;
    221221        }
    222        
     222
    223223        if (acpi_xsdt)
    224224                configure_via_xsdt();
  • kernel/genarch/src/acpi/madt.c

    r3061bc1 ra35b458  
    8383{
    8484        assert(i < madt_l_apic_entry_cnt);
    85        
     85
    8686        return ((struct madt_l_apic *)
    8787            madt_entries_index[madt_l_apic_entry_index + i])->apic_id;
     
    9191{
    9292        assert(i < madt_l_apic_entry_cnt);
    93        
     93
    9494        /*
    9595         * FIXME: The current local APIC driver limits usable
     
    9999        if (i > 7)
    100100                return false;
    101        
     101
    102102        return ((struct madt_l_apic *)
    103103            madt_entries_index[madt_l_apic_entry_index + i])->flags & 0x1;
     
    107107{
    108108        assert(i < madt_l_apic_entry_cnt);
    109        
     109
    110110        return ((struct madt_l_apic *)
    111111            madt_entries_index[madt_l_apic_entry_index + i])->apic_id ==
     
    117117        if (irq >= sizeof(isa_irq_map) / sizeof(int))
    118118                return (int) irq;
    119        
     119
    120120        return isa_irq_map[irq];
    121121}
     
    135135        uint8_t typea = (*((struct madt_apic_header **) a))->type;
    136136        uint8_t typeb = (*((struct madt_apic_header **) b))->type;
    137        
     137
    138138        if (typea > typeb)
    139139                return 1;
    140        
     140
    141141        if (typea < typeb)
    142142                return -1;
    143        
     143
    144144        return 0;
    145145}
     
    149149        if (madt_l_apic_entry_cnt == 0)
    150150                madt_l_apic_entry_index = i;
    151        
     151
    152152        madt_l_apic_entry_cnt++;
    153        
     153
    154154        if (!(la->flags & 0x1)) {
    155155                /* Processor is unusable, skip it. */
    156156                return;
    157157        }
    158        
     158
    159159        apic_id_mask |= 1 << la->apic_id;
    160160}
     
    169169                /* Currently not supported */
    170170        }
    171        
     171
    172172        madt_io_apic_entry_cnt++;
    173173}
     
    177177{
    178178        assert(override->source < sizeof(isa_irq_map) / sizeof(int));
    179        
     179
    180180        isa_irq_map[override->source] = override->global_int;
    181181}
     
    186186            (((uint8_t *) acpi_madt) + acpi_madt->header.length);
    187187        struct madt_apic_header *hdr;
    188        
     188
    189189        l_apic = (uint32_t *) (sysarg_t) acpi_madt->l_apic_address;
    190        
     190
    191191        /* Count MADT entries */
    192192        unsigned int madt_entries_index_cnt = 0;
     
    194194            hdr = (struct madt_apic_header *) (((uint8_t *) hdr) + hdr->length))
    195195                madt_entries_index_cnt++;
    196        
     196
    197197        /* Create MADT APIC entries index array */
    198198        madt_entries_index = (struct madt_apic_header **)
     
    201201        if (!madt_entries_index)
    202202                panic("Memory allocation error.");
    203        
     203
    204204        size_t i = 0;
    205        
     205
    206206        for (hdr = acpi_madt->apic_header; hdr < end;
    207207            hdr = (struct madt_apic_header *) (((uint8_t *) hdr) + hdr->length)) {
     
    209209                i++;
    210210        }
    211        
     211
    212212        /* Sort MADT index structure */
    213213        if (!gsort(madt_entries_index, madt_entries_index_cnt,
    214214            sizeof(struct madt_apic_header *), madt_cmp, NULL))
    215215                panic("Sorting error.");
    216        
     216
    217217        /* Parse MADT entries */
    218218        for (i = 0; i < madt_entries_index_cnt; i++) {
    219219                hdr = madt_entries_index[i];
    220                
     220
    221221                switch (hdr->type) {
    222222                case MADT_L_APIC:
     
    245245                                    "MADT: Skipping reserved entry (type=%" PRIu8 ")",
    246246                                    hdr->type);
    247                                
     247
    248248                        if (hdr->type >= MADT_RESERVED_OEM_BEGIN)
    249249                                log(LF_ARCH, LVL_NOTE,
    250250                                    "MADT: Skipping OEM entry (type=%" PRIu8 ")",
    251251                                    hdr->type);
    252                        
     252
    253253                        break;
    254254                }
    255255        }
    256        
     256
    257257        if (madt_l_apic_entry_cnt > 0)
    258258                config.cpu_count = madt_l_apic_entry_cnt;
Note: See TracChangeset for help on using the changeset viewer.