Changeset f6f22cdb in mainline for boot/arch/sparc32/src/ambapp.c


Ignore:
Timestamp:
2013-12-27T18:45:56Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
32e8cd1
Parents:
e47ed05
Message:

code revision
coding style changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/sparc32/src/ambapp.c

    re47ed05 rf6f22cdb  
    5050#include <errno.h>
    5151
    52 static void ambapp_scan_area(uintptr_t, int);
     52static void ambapp_scan_area(uintptr_t, unsigned int);
    5353
    5454void ambapp_scan()
    5555{
    5656        amba_fake = false;
    57 
     57       
    5858        /* Scan for AHB masters & slaves */
    5959        ambapp_scan_area(AMBAPP_AHBMASTER_AREA, 64);
    6060        ambapp_scan_area(AMBAPP_AHBSLAVE_AREA, 63);
    61 
     61       
    6262        /* Scan for APB slaves on APBMST */
    6363        amba_device_t *apbmst = ambapp_lookup_first(GAISLER, GAISLER_APBMST);
    6464        if (apbmst != NULL)
    6565                ambapp_scan_area(apbmst->bars[0].start, 16);
    66 
     66       
    6767        /* If we found nothing, fake device entries */
    6868        if (amba_devices_found == 0)
     
    7070}
    7171
    72 static void ambapp_scan_area(uintptr_t master_bar, int max_entries)
     72static void ambapp_scan_area(uintptr_t master_bar, unsigned int max_entries)
    7373{
    7474        ambapp_entry_t *entry = (ambapp_entry_t *) (master_bar | AMBAPP_CONF_AREA);
    75 
    76         for (int i = 0; i < max_entries; i++) {
     75       
     76        for (unsigned int i = 0; i < max_entries; i++) {
    7777                if (amba_devices_found == AMBAPP_MAX_DEVICES)
    7878                        return;
    79 
     79               
    8080                if (entry->vendor_id == 0xff)
    8181                        continue;
    82 
     82               
    8383                amba_device_t *device = &amba_devices[amba_devices_found];
    84                 device->vendor_id = (amba_vendor_id_t)entry->vendor_id;
    85         device->device_id = (amba_device_id_t)entry->device_id;
     84                device->vendor_id = (amba_vendor_id_t) entry->vendor_id;
     85                device->device_id = (amba_device_id_t) entry->device_id;
    8686                device->version = entry->version;
    8787                device->irq = entry->irq;
    88        
    89                 for (int bar = 0; bar < 4; bar++) {
     88               
     89                for (unsigned int bar = 0; bar < 4; bar++) {
    9090                        device->bars[bar].start = entry->bar[bar].addr << 20;
    9191                        device->bars[bar].size = entry->bar[bar].mask;
    92                         device->bars[bar].prefetchable = (bool)entry->bar[bar].prefetchable;
    93                         device->bars[bar].cacheable = (bool)entry->bar[bar].cacheable;
     92                        device->bars[bar].prefetchable = (bool) entry->bar[bar].prefetchable;
     93                        device->bars[bar].cacheable = (bool) entry->bar[bar].cacheable;
    9494                }
    95 
     95               
    9696                amba_devices_found++;
    9797        }
     
    107107        amba_devices[0].bars[0].start = 0x80000100;
    108108        amba_devices[0].bars[0].size = 0x100;
    109 
     109       
    110110        /* IRQMP */
    111111        amba_devices[1].vendor_id = GAISLER;
     
    115115        amba_devices[1].bars[0].start = 0x80000200;
    116116        amba_devices[1].bars[0].size = 0x100;
    117 
     117       
    118118        /* GPTIMER */
    119119        amba_devices[2].vendor_id = GAISLER;
     
    123123        amba_devices[2].bars[0].start = 0x80000300;
    124124        amba_devices[2].bars[0].size = 0x100;
    125 
     125       
    126126        amba_fake = true;
    127127        amba_devices_found = 3;
     
    136136{
    137137        printf("ABMA devices:\n");
    138 
    139         for (int i = 0; i < amba_devices_found; i++) {
     138       
     139        for (unsigned int i = 0; i < amba_devices_found; i++) {
    140140                amba_device_t *dev = &amba_devices[i];
    141                 printf("<%1x:%03x> at 0x%08x ", dev->vendor_id, dev->device_id, dev->bars[0].start);
     141               
     142                printf("<%1x:%03x> at 0x%08x ", dev->vendor_id, dev->device_id,
     143                    dev->bars[0].start);
     144               
    142145                if (dev->irq == -1)
    143146                        printf("\n");
     
    147150}
    148151
    149 amba_device_t *ambapp_lookup_first(amba_vendor_id_t vendor, amba_device_id_t device)
     152amba_device_t *ambapp_lookup_first(amba_vendor_id_t vendor,
     153    amba_device_id_t device)
    150154{
    151         for (int i = 0; i < amba_devices_found; i++) {
    152                 if (amba_devices[i].vendor_id == vendor &&
    153                     amba_devices[i].device_id == device)
     155        for (unsigned int i = 0; i < amba_devices_found; i++) {
     156                if ((amba_devices[i].vendor_id == vendor) &&
     157                    (amba_devices[i].device_id == device))
    154158                        return &amba_devices[i];
    155159        }
    156 
     160       
    157161        return NULL;
    158162}
Note: See TracChangeset for help on using the changeset viewer.