Make error/bug messages have a more consistent presentation
PATCH 1/1 Make error/bug messages have a more consistent presentation
Signed-off-by Tom St Denis <[email protected]>
--- src/app/enum.c | 2 +- src/app/scan.c | 2 +- src/app/scan_log.c | 2 +- src/app/set_bit.c | 4 ++-- src/app/set_reg.c | 4 ++-- src/app/top.c | 2 +- src/lib/create_mmio_accel.c | 2 +- src/lib/discover.c | 8 ++++---- src/lib/find_reg.c | 4 ++-- src/lib/mmio.c | 8 ++++---- src/lib/read_sgpr.c | 2 +- src/lib/read_vram.c | 18 +++++++++--------- src/lib/transfer_soc15.c | 2 +- src/lib/update.c | 26 +++++++++++++------------- src/lib/wave_status.c | 8 ++++---- 15 files changed, 47 insertions(+), 47 deletions(-)
src/app/enum.c +1 -1
@@ -51,7 +51,7 @@ void umr_enumerate_devices(void)pci_system_init (); pci_iter =pci_id_match_iterator_create (NULL );if (!pci_iter) { -fprintf (stderr,"Cannot create PCI iterator" ); +fprintf (stderr,"[ERROR]: Cannot create PCI iterator" );return ; } do {
src/app/scan.c +1 -1
@@ -45,7 +45,7 @@ int umr_scan_asic(struct umr_asic *asic, char *asicname, char *ipname, char *reg r = asic->blocks[i]->grant (asic);if (r) {if (ipname[0 ]) { -fprintf (stderr,"[ERROR] Must specify at least one 'risky' option before scanning specific blocks.\n" ); +fprintf (stderr,"[ERROR]: Must specify at least one 'risky' option before scanning specific blocks.\n" );exit (EXIT_FAILURE ); }continue ;
src/app/scan_log.c +1 -1
@@ -45,7 +45,7 @@ int umr_create_mmio_accel(struct umr_asic *asic)for (j =0 ; j < asic->blocks[i]->no_regs; j++) {if (asic->blocks[i]->regs[j].type ==REG_MMIO ) {if (asic->blocks[i]->regs[j].addr >=LIST_SIZE ) { -fprintf (stderr,"[BUG] Register address width too large for scan_log\n" ); +fprintf (stderr,"[BUG]: Register address width too large for scan_log\n" );continue ; } asic->mmio_accel.reglist[asic->blocks[i]->regs[j].addr] = &asic->blocks[i]->regs[j];
src/app/set_bit.c +2 -2
@@ -64,7 +64,7 @@ int umr_set_register_bit(struct umr_asic *asic, char *regpath, char *regvalue) }if (asic->blocks[i]->grant) {if (asic->blocks[i]->grant (asic)) { -fprintf (stderr,"[ERROR] Must specify at least one 'risky' before writing to this block.\n" ); +fprintf (stderr,"[ERROR]: Must specify at least one 'risky' before writing to this block.\n" );return -1 ; } }
@@ -113,7 +113,7 @@ int umr_set_register_bit(struct umr_asic *asic, char *regpath, char *regvalue) } } } -fprintf (stderr,"Path <%s> not found on this ASIC\n" , regpath); +fprintf (stderr,"[ERROR]: Path <%s> not found on this ASIC\n" , regpath);return -1 ; }
src/app/set_reg.c +2 -2
@@ -61,7 +61,7 @@ int umr_set_register(struct umr_asic *asic, char *regpath, char *regvalue)if (asic->blocks[i]->grant) {if (asic->blocks[i]->grant (asic)) { -fprintf (stderr,"[ERROR] Must specify at least one 'risky' before writing to this block.\n" ); +fprintf (stderr,"[ERROR]: Must specify at least one 'risky' before writing to this block.\n" );return -1 ; } }
@@ -96,6 +96,6 @@ int umr_set_register(struct umr_asic *asic, char *regpath, char *regvalue) } } } -fprintf (stderr,"Path <%s> not found on this ASIC\n" , regpath); +fprintf (stderr,"[ERROR]: Path <%s> not found on this ASIC\n" , regpath);return -1 ; }
src/app/top.c +1 -1
@@ -965,7 +965,7 @@ void umr_top(struct umr_asic *asic)// start thread to grab sensor data if (pthread_create (&sensor_thread,NULL , gpu_sensor_thread, asic)) { -fprintf (stderr,"[ERROR] Cannot create gpu_sensor_thread\n" ); +fprintf (stderr,"[ERROR]: Cannot create gpu_sensor_thread\n" );return ; }
src/lib/create_mmio_accel.c +1 -1
@@ -43,7 +43,7 @@ int umr_create_mmio_accel(struct umr_asic *asic)for (j =0 ; j < asic->blocks[i]->no_regs; j++) {if (asic->blocks[i]->regs[j].type ==REG_MMIO ) {if (asic->blocks[i]->regs[j].addr >=LIST_SIZE ) { -fprintf (stderr,"[BUG] Register address width too large for scan_log\n" ); +fprintf (stderr,"[BUG]: Register address width too large for scan_log\n" );continue ; } asic->mmio_accel.reglist[asic->blocks[i]->regs[j].addr] = &asic->blocks[i]->regs[j];
src/lib/discover.c +4 -4
@@ -153,7 +153,7 @@ struct umr_asic *umr_discover_asic(struct umr_options *options)pci_system_init (); pci_iter =pci_id_match_iterator_create (NULL );if (!pci_iter) { -fprintf (stderr,"Cannot create PCI iterator" ); +fprintf (stderr,"[ERROR]: Cannot create PCI iterator" ); goto err_pci; } do {
@@ -161,7 +161,7 @@ struct umr_asic *umr_discover_asic(struct umr_options *options) }while (asic->pci.pdevice && !(asic->pci.pdevice->vendor_id ==0x1002 &&is_did_match (asic, asic->pci.pdevice->device_id)));if (!asic->pci.pdevice) { -fprintf (stderr,"Could not find ASIC with DID of %04lx\n" , (unsigned long )asic->did); +fprintf (stderr,"[ERROR]: Could not find ASIC with DID of %04lx\n" , (unsigned long )asic->did); goto err_pci; }pci_iterator_destroy (pci_iter);
@@ -194,14 +194,14 @@ struct umr_asic *umr_discover_asic(struct umr_options *options) }if (use_region ==6 ) { -fprintf (stderr,"Could not find PCI region (debugfs mode might still work)\n" ); +fprintf (stderr,"[ERROR]: Could not find PCI region (debugfs mode might still work)\n" ); goto err_pci; } asic->pci.region = use_region; pci_region_addr = asic->pci.pdevice->regions[use_region].base_addr;if (pci_device_map_range (asic->pci.pdevice, pci_region_addr, asic->pci.pdevice->regions[use_region].size,PCI_DEV_MAP_FLAG_WRITABLE , &pcimem_v)) { -fprintf (stderr,"Could not map PCI memory\n" ); +fprintf (stderr,"[ERROR]: Could not map PCI memory\n" ); goto err_pci; } asic->pci.mem = pcimem_v;
src/lib/find_reg.c +2 -2
@@ -32,7 +32,7 @@ uint32_t umr_find_reg(struct umr_asic *asic, char *regname)for (j =0 ; j < asic->blocks[i]->no_regs; j++)if (!strcmp (asic->blocks[i]->regs[j].regname, regname))return asic->blocks[i]->regs[j].addr; -fprintf (stderr,"BUG: reg [%s] not found on asic [%s]\n" , regname, asic->asicname); +fprintf (stderr,"[BUG]: reg [%s] not found on asic [%s]\n" , regname, asic->asicname);return 0xFFFFFFFF ; }
@@ -44,6 +44,6 @@ struct umr_reg *umr_find_reg_data(struct umr_asic *asic, char *regname)for (j =0 ; j < asic->blocks[i]->no_regs; j++)if (!strcmp (asic->blocks[i]->regs[j].regname, regname))return &asic->blocks[i]->regs[j]; -fprintf (stderr,"BUG: reg [%s] not found on asic [%s]\n" , regname, asic->asicname); +fprintf (stderr,"[BUG]: reg [%s] not found on asic [%s]\n" , regname, asic->asicname);return NULL ; }
src/lib/mmio.c +4 -4
@@ -28,7 +28,7 @@ uint32_t umr_read_reg(struct umr_asic *asic, uint64_t addr) {uint32_t value=0 ;if (addr ==0xFFFFFFFF ) -fprintf (stderr,"warning: reading from addr==0xFFFFFFFF is likely a bug\n" ); +fprintf (stderr,"[BUG]: reading from addr==0xFFFFFFFF is likely a bug\n" );if (asic->pci.mem && !(addr & ~0xFFFFFULL )) {// only use pci if enabled and not using high bits return asic->pci.mem[addr/4 ];
@@ -44,7 +44,7 @@ uint32_t umr_read_reg(struct umr_asic *asic, uint64_t addr)int umr_write_reg (struct umr_asic *asic,uint64_t addr,uint32_t value) {if (addr ==0xFFFFFFFF ) -fprintf (stderr,"warning: reading from addr==0xFFFFFFFF is likely a bug\n" ); +fprintf (stderr,"[BUG]: reading from addr==0xFFFFFFFF is likely a bug\n" );if (asic->pci.mem && !(addr & ~0xFFFFFULL )) { asic->pci.mem[addr/4 ] = value;
@@ -81,7 +81,7 @@ uint32_t umr_bitslice_reg(struct umr_asic *asic, struct umr_reg *reg, char *bitnreturn regvalue; } } -fprintf (stderr,"BUG: Bitfield [%s] not found in reg [%s] on asic [%s]\n" , bitname, reg->regname, asic->asicname); +fprintf (stderr,"[BUG]: Bitfield [%s] not found in reg [%s] on asic [%s]\n" , bitname, reg->regname, asic->asicname);return 0 ; }
@@ -95,7 +95,7 @@ uint32_t umr_bitslice_compose_value(struct umr_asic *asic, struct umr_reg *reg,return regvalue; } } -fprintf (stderr,"BUG: Bitfield [%s] not found in reg [%s] on asic [%s]\n" , bitname, reg->regname, asic->asicname); +fprintf (stderr,"[BUG]: Bitfield [%s] not found in reg [%s] on asic [%s]\n" , bitname, reg->regname, asic->asicname);return 0 ; }
src/lib/read_sgpr.c +1 -1
@@ -45,7 +45,7 @@ static void wave_read_regs_via_mmio(struct umr_asic *asic, uint32_t simd,while (num--) *(out++) =umr_read_reg (asic, ind_data->addr *4 ); }else { -fprintf (stderr,"[BUG] The required SQ_IND_{INDEX,DATA} registers are not found on the asic <%s>\n" , asic->asicname); +fprintf (stderr,"[BUG]: The required SQ_IND_{INDEX,DATA} registers are not found on the asic <%s>\n" , asic->asicname);return ; } }
src/lib/read_vram.c +9 -9
@@ -38,7 +38,7 @@ static void read_via_mmio(struct umr_asic *asic, uint64_t address, uint32_t sizeif (MM_INDEX ==0xFFFFFFFF ||MM_INDEX_HI ==0xFFFFFFFF ||MM_DATA ==0xFFFFFFFF ) { -fprintf (stderr,"[BUG] Cannot find MM access registers for this asic!\n" ); +fprintf (stderr,"[BUG]: Cannot find MM access registers for this asic!\n" );return ; }
@@ -192,13 +192,13 @@ static int umr_read_vram_vi(struct umr_asic *asic, uint32_t vmid, uint64_t addreDEBUG ("Computed address we will read from: %s:%llx (reading: %lu bytes)\n" , pte_fields.system ?"sys" :"vram" , (unsigned long long )start_addr, (unsigned long )chunk_size);if (pte_fields.system) {if (umr_read_sram (start_addr, chunk_size, pdst) <0 ) { -fprintf (stderr,"[ERROR] Cannot read system ram, perhaps CONFIG_STRICT_DEVMEM is set in your kernel config?\n" ); -fprintf (stderr,"[ERROR] Alternatively download and install /dev/fmem\n" ); +fprintf (stderr,"[ERROR]: Cannot read system ram, perhaps CONFIG_STRICT_DEVMEM is set in your kernel config?\n" ); +fprintf (stderr,"[ERROR]: Alternatively download and install /dev/fmem\n" );return -1 ; } }else {if (umr_read_vram (asic,0xFFFF , start_addr, chunk_size, pdst) <0 ) { -fprintf (stderr,"[ERROR] Cannot read from VRAM\n" ); +fprintf (stderr,"[ERROR]: Cannot read from VRAM\n" );return -1 ; } }
@@ -380,13 +380,13 @@ static int umr_read_vram_ai(struct umr_asic *asic, uint32_t vmid, uint64_t addre (unsigned long long)start_addr, (unsigned long)chunk_size);if (pte_fields.system) {if (umr_read_sram (start_addr, chunk_size, pdst) <0 ) { -fprintf (stderr,"[ERROR] Cannot read system ram, perhaps CONFIG_STRICT_DEVMEM is set in your kernel config?\n" ); -fprintf (stderr,"[ERROR] Alternatively download and install /dev/fmem\n" ); +fprintf (stderr,"[ERROR]: Cannot read system ram, perhaps CONFIG_STRICT_DEVMEM is set in your kernel config?\n" ); +fprintf (stderr,"[ERROR]: Alternatively download and install /dev/fmem\n" );return -1 ; } }else {if (umr_read_vram (asic,0xFFFF , start_addr, chunk_size, pdst) <0 ) { -fprintf (stderr,"[ERROR] Cannot read from VRAM\n" ); +fprintf (stderr,"[ERROR]: Cannot read from VRAM\n" );return -1 ; } }
@@ -405,7 +405,7 @@ int umr_read_vram(struct umr_asic *asic, uint32_t vmid, uint64_t address, uint32// only aligned destinations if (((intptr_t )dst) &3 ) { -fprintf (stderr,"[BUG] vram read destination is not 4-byte aligned\n" ); +fprintf (stderr,"[BUG]: vram read destination is not 4-byte aligned\n" );return -1 ; }
@@ -428,7 +428,7 @@ int umr_read_vram(struct umr_asic *asic, uint32_t vmid, uint64_t address, uint32case FAMILY_AI :return umr_read_vram_ai (asic, vmid, address, size, dst);default : -fprintf (stderr,"[BUG] Unsupported ASIC family type for umr_read_vram()\n" ); +fprintf (stderr,"[BUG]: Unsupported ASIC family type for umr_read_vram()\n" );return -1 ; }
src/lib/transfer_soc15.c +1 -1
@@ -33,7 +33,7 @@ int umr_transfer_soc15_to_reg(struct umr_options *options, struct umr_ip_offsetsif (!strcmp (ip[x].name, ipname))break ;if (!ip[x].name) { -fprintf (stderr,"[BUG] IP '%s' not found in offset table\n" , ipname); +fprintf (stderr,"[BUG]: IP '%s' not found in offset table\n" , ipname);return -1 ; }
src/lib/update.c +13 -13
@@ -50,7 +50,7 @@ static void consume_str(char **ptr, char *str) *ptr = p;if (!strlen (str)) -fprintf (stderr,"[ERROR] Premature end of file\n" ); +fprintf (stderr,"[ERROR]: Premature end of file\n" ); }static void parse_regpath (char **ptr,char *asic,char *ip,char *reg)
@@ -148,7 +148,7 @@ static int do_add_reg(char **ptr, struct umr_asic *as)find_reg (as, ip, reg, &i, &j);if (i <0 || j >=0 ) { -fprintf (stderr,"[ERROR] Invalid regpath %s.%s for add command\n" , ip, reg); +fprintf (stderr,"[ERROR]: Invalid regpath %s.%s for add command\n" , ip, reg);return -1 ; }
@@ -187,7 +187,7 @@ static int do_add_bit(char **ptr, struct umr_asic *as)find_bit (as, ip, reg, bit, &i, &j, &k);if (i <0 || j <0 || k >=0 ) { -fprintf (stderr,"[ERROR] Invalid regpath %s.%s.%s for add command\n" , ip, reg, bit); +fprintf (stderr,"[ERROR]: Invalid regpath %s.%s.%s for add command\n" , ip, reg, bit);return -1 ; }
@@ -226,7 +226,7 @@ static int do_add(char **ptr, struct umr_asic *asic) *ptr +=3 ;do_add_bit (ptr, asic); }else { -fprintf (stderr,"[ERROR] Invalid add command\n" ); +fprintf (stderr,"[ERROR]: Invalid add command\n" );return -1 ; }return 0 ;
@@ -250,7 +250,7 @@ static int do_edit_reg(char **ptr, struct umr_asic *as)find_reg (as, ip, reg, &i, &j);if (i <0 || j <0 ) { -fprintf (stderr,"[ERROR] Invalid regpath %s.%s for edit command\n" , ip, reg); +fprintf (stderr,"[ERROR]: Invalid regpath %s.%s for edit command\n" , ip, reg);return -1 ; }
@@ -280,7 +280,7 @@ static int do_edit_bit(char **ptr, struct umr_asic *as)find_bit (as, ip, reg, bit, &i, &j, &k);if (i <0 || j <0 || k <0 ) { -fprintf (stderr,"[ERROR] Invalid regpath %s.%s.%s for edit command\n" , ip, reg, bit); +fprintf (stderr,"[ERROR]: Invalid regpath %s.%s.%s for edit command\n" , ip, reg, bit);return -1 ; }
@@ -303,7 +303,7 @@ static int do_edit(char **ptr, struct umr_asic *asic) *ptr +=3 ;do_edit_bit (ptr, asic); }else { -fprintf (stderr,"[ERROR] Invalid edit command\n" ); +fprintf (stderr,"[ERROR]: Invalid edit command\n" );return -1 ; }return 0 ;
@@ -325,7 +325,7 @@ static int do_del_reg(char **ptr, struct umr_asic *as)find_reg (as, ip, reg, &i, &j);if (i <0 || j <0 ) { -fprintf (stderr,"[ERROR] Invalid regpath %s.%s for del command\n" , ip, reg); +fprintf (stderr,"[ERROR]: Invalid regpath %s.%s for del command\n" , ip, reg);return -1 ; }
@@ -352,7 +352,7 @@ static int do_del_bit(char **ptr, struct umr_asic *as)find_bit (as, ip, reg, bit, &i, &j, &k);if (i <0 || j <0 || k <0 ) { -fprintf (stderr,"[ERROR] Invalid regpath %s.%s.%s for del command\n" , ip, reg, bit); +fprintf (stderr,"[ERROR]: Invalid regpath %s.%s.%s for del command\n" , ip, reg, bit);return -1 ; }
@@ -375,7 +375,7 @@ static int do_del(char **ptr, struct umr_asic *asic) *ptr +=3 ;do_del_bit (ptr, asic); }else { -fprintf (stderr,"[ERROR] Invalid del command\n" ); +fprintf (stderr,"[ERROR]: Invalid del command\n" );return -1 ; }return 0 ;
@@ -390,7 +390,7 @@ int umr_update(struct umr_asic *asic, char *script) fd =open (script,O_RDWR );if (fd <0 ) { -fprintf (stderr,"[ERROR] Script <%s> not found\n" , script); +fprintf (stderr,"[ERROR]: Script <%s> not found\n" , script);return -1 ; } len =lseek (fd,0 ,SEEK_END ) +1 ;
@@ -398,7 +398,7 @@ int umr_update(struct umr_asic *asic, char *script)lseek (fd,0 ,SEEK_SET );if (!smem) {close (fd); -fprintf (stderr,"[ERROR] Out of memory...\n" ); +fprintf (stderr,"[ERROR]: Out of memory...\n" );return -1 ; }read (fd, smem, len);
@@ -420,7 +420,7 @@ int umr_update(struct umr_asic *asic, char *script) sdata +=3 ;do_del (&sdata, asic); }else if (*sdata) { -fprintf (stderr,"[ERROR] Unknown update command [%s]\n" , sdata); +fprintf (stderr,"[ERROR]: Unknown update command [%s]\n" , sdata); *sdata =0 ; } }
src/lib/wave_status.c +4 -4
@@ -38,7 +38,7 @@ static int umr_get_wave_sq_info_vi(struct umr_asic *asic, unsigned se, unsigned (((uint64_t )cu) <<44 );if (!index || !data) { -fprintf (stderr,"Cannot find SQ indirect registers on this asic!\n" ); +fprintf (stderr,"[BUG]: Cannot find SQ indirect registers on this asic!\n" );return -1 ; }
@@ -65,7 +65,7 @@ static uint32_t wave_read_ind(struct umr_asic *asic, uint32_t simd, uint32_t wavumr_write_reg (asic, ind_index->addr *4 , data);return umr_read_reg (asic, ind_data->addr *4 ); }else { -fprintf (stderr,"[BUG] The required SQ_IND_{INDEX,DATA} registers are not found on the asic <%s>\n" , asic->asicname); +fprintf (stderr,"[BUG]: The required SQ_IND_{INDEX,DATA} registers are not found on the asic <%s>\n" , asic->asicname);return -1 ; } }
@@ -120,7 +120,7 @@ static int umr_get_wave_status_vi(struct umr_asic *asic, unsigned se, unsigned s }if (buf[0 ] !=0 ) { -fprintf (stderr,"Was expecting type 0 wave data on a CZ/VI part!\n" ); +fprintf (stderr,"[ERROR]: Was expecting type 0 wave data on a CZ/VI part!\n" );return -1 ; }
@@ -222,7 +222,7 @@ static int umr_get_wave_status_ai(struct umr_asic *asic, unsigned se, unsigned s }if (buf[0 ] !=1 ) { -fprintf (stderr,"Was expecting type 1 wave data on a FAMILY_AI part!\n" ); +fprintf (stderr,"[ERROR]: Was expecting type 1 wave data on a FAMILY_AI part!\n" );return -1 ; }
Signature · 6 lines
2.12.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx