Changeset f6f22cdb in mainline for boot/arch/sparc32/src/ambapp.c
- Timestamp:
- 2013-12-27T18:45:56Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 32e8cd1
- Parents:
- e47ed05
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/sparc32/src/ambapp.c
re47ed05 rf6f22cdb 50 50 #include <errno.h> 51 51 52 static void ambapp_scan_area(uintptr_t, int);52 static void ambapp_scan_area(uintptr_t, unsigned int); 53 53 54 54 void ambapp_scan() 55 55 { 56 56 amba_fake = false; 57 57 58 58 /* Scan for AHB masters & slaves */ 59 59 ambapp_scan_area(AMBAPP_AHBMASTER_AREA, 64); 60 60 ambapp_scan_area(AMBAPP_AHBSLAVE_AREA, 63); 61 61 62 62 /* Scan for APB slaves on APBMST */ 63 63 amba_device_t *apbmst = ambapp_lookup_first(GAISLER, GAISLER_APBMST); 64 64 if (apbmst != NULL) 65 65 ambapp_scan_area(apbmst->bars[0].start, 16); 66 66 67 67 /* If we found nothing, fake device entries */ 68 68 if (amba_devices_found == 0) … … 70 70 } 71 71 72 static void ambapp_scan_area(uintptr_t master_bar, int max_entries)72 static void ambapp_scan_area(uintptr_t master_bar, unsigned int max_entries) 73 73 { 74 74 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++) { 77 77 if (amba_devices_found == AMBAPP_MAX_DEVICES) 78 78 return; 79 79 80 80 if (entry->vendor_id == 0xff) 81 81 continue; 82 82 83 83 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; 86 86 device->version = entry->version; 87 87 device->irq = entry->irq; 88 89 for ( int bar = 0; bar < 4; bar++) {88 89 for (unsigned int bar = 0; bar < 4; bar++) { 90 90 device->bars[bar].start = entry->bar[bar].addr << 20; 91 91 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; 94 94 } 95 95 96 96 amba_devices_found++; 97 97 } … … 107 107 amba_devices[0].bars[0].start = 0x80000100; 108 108 amba_devices[0].bars[0].size = 0x100; 109 109 110 110 /* IRQMP */ 111 111 amba_devices[1].vendor_id = GAISLER; … … 115 115 amba_devices[1].bars[0].start = 0x80000200; 116 116 amba_devices[1].bars[0].size = 0x100; 117 117 118 118 /* GPTIMER */ 119 119 amba_devices[2].vendor_id = GAISLER; … … 123 123 amba_devices[2].bars[0].start = 0x80000300; 124 124 amba_devices[2].bars[0].size = 0x100; 125 125 126 126 amba_fake = true; 127 127 amba_devices_found = 3; … … 136 136 { 137 137 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++) { 140 140 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 142 145 if (dev->irq == -1) 143 146 printf("\n"); … … 147 150 } 148 151 149 amba_device_t *ambapp_lookup_first(amba_vendor_id_t vendor, amba_device_id_t device) 152 amba_device_t *ambapp_lookup_first(amba_vendor_id_t vendor, 153 amba_device_id_t device) 150 154 { 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)) 154 158 return &amba_devices[i]; 155 159 } 156 160 157 161 return NULL; 158 162 }
Note:
See TracChangeset
for help on using the changeset viewer.