intel/disasm: Take a devinfo in gen_disasm_create
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 13 Dec 2017 07:26:51 +0000 (23:26 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 14 Dec 2017 21:27:06 +0000 (13:27 -0800)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/tools/aubinator.c
src/intel/tools/aubinator_error_decode.c
src/intel/tools/disasm.c
src/intel/tools/gen_disasm.h

index 45b9566ecec906efd5710896b7fef8d8ec10d647..4ae70ad4fbcfa2290bf810415430612770b15a60 100644 (file)
@@ -846,7 +846,7 @@ handle_trace_header(uint32_t *p)
       spec = gen_spec_load(&devinfo);
    else
       spec = gen_spec_load_from_path(&devinfo, xml_path);
-   disasm = gen_disasm_create(pci_id);
+   disasm = gen_disasm_create(&devinfo);
 
    if (spec == NULL || disasm == NULL)
       exit(EXIT_FAILURE);
index ecc01b55e7f8166665c613c970b4ebe6cd2d8522..47acda49024517a83959d137bb1d7360bb3f129b 100644 (file)
@@ -603,7 +603,7 @@ read_data_file(FILE *file)
                exit(EXIT_FAILURE);
             }
 
-            disasm = gen_disasm_create(reg);
+            disasm = gen_disasm_create(&devinfo);
 
             printf("Detected GEN%i chipset\n", devinfo.gen);
 
index 50915795224d3253b01da5f68a61a716032b0215..1de20f576d4d36d3a6cd8354b9c5a489d20b7b47 100644 (file)
@@ -108,7 +108,7 @@ gen_disasm_disassemble(struct gen_disasm *disasm, void *assembly,
 }
 
 struct gen_disasm *
-gen_disasm_create(int pciid)
+gen_disasm_create(const struct gen_device_info *devinfo)
 {
    struct gen_disasm *gd;
 
@@ -116,10 +116,7 @@ gen_disasm_create(int pciid)
    if (gd == NULL)
       return NULL;
 
-   if (!gen_get_device_info(pciid, &gd->devinfo)) {
-      free(gd);
-      return NULL;
-   }
+   gd->devinfo = *devinfo;
 
    brw_init_compaction_tables(&gd->devinfo);
 
index d2764bb90b7f6ff18d01e21888e6dedb69f6c1e5..52601cb28642b0f92ebb1f36474c82c2170c0654 100644 (file)
 #ifndef GEN_DISASM_H
 #define GEN_DISASM_H
 
+#include "intel/common/gen_device_info.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 struct gen_disasm;
 
-struct gen_disasm *gen_disasm_create(int pciid);
+struct gen_disasm *gen_disasm_create(const struct gen_device_info *devinfo);
 void gen_disasm_disassemble(struct gen_disasm *disasm,
                             void *assembly, int start, FILE *out);