diff options
Diffstat (limited to 'sim/ppc/hw_htab.c')
-rw-r--r-- | sim/ppc/hw_htab.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/sim/ppc/hw_htab.c b/sim/ppc/hw_htab.c index e7b6371..ce09834 100644 --- a/sim/ppc/hw_htab.c +++ b/sim/ppc/hw_htab.c @@ -204,8 +204,8 @@ static void htab_decode_hash_table(device *me, - unsigned32 *htaborg, - unsigned32 *htabmask) + uint32_t *htaborg, + uint32_t *htabmask) { unsigned_word htab_ra; unsigned htab_nr_bytes; @@ -242,27 +242,27 @@ htab_decode_hash_table(device *me, static void htab_map_page(device *me, unsigned_word ra, - unsigned64 va, + uint64_t va, unsigned wimg, unsigned pp, - unsigned32 htaborg, - unsigned32 htabmask) + uint32_t htaborg, + uint32_t htabmask) { /* keep everything left shifted so that the numbering is easier */ - unsigned64 vpn = va << 12; - unsigned32 vsid = INSERTED32(EXTRACTED64(vpn, 0, 23), 0, 23); - unsigned32 vpage = INSERTED32(EXTRACTED64(vpn, 24, 39), 0, 15); - unsigned32 hash = INSERTED32(EXTRACTED32(vsid, 5, 23) + uint64_t vpn = va << 12; + uint32_t vsid = INSERTED32(EXTRACTED64(vpn, 0, 23), 0, 23); + uint32_t vpage = INSERTED32(EXTRACTED64(vpn, 24, 39), 0, 15); + uint32_t hash = INSERTED32(EXTRACTED32(vsid, 5, 23) ^ EXTRACTED32(vpage, 0, 15), 7, 31-6); int h; for (h = 0; h < 2; h++) { - unsigned32 pteg = (htaborg | (hash & htabmask)); + uint32_t pteg = (htaborg | (hash & htabmask)); int pti; for (pti = 0; pti < 8; pti++) { - unsigned32 pte = pteg + 8 * pti; - unsigned32 current_target_pte0; - unsigned32 current_pte0; + uint32_t pte = pteg + 8 * pti; + uint32_t current_target_pte0; + uint32_t current_pte0; if (device_dma_read_buffer(device_parent(me), ¤t_target_pte0, 0, /*space*/ @@ -273,9 +273,9 @@ htab_map_page(device *me, if (MASKED32(current_pte0, 0, 0)) { /* full pte, check it isn't already mapping the same virtual address */ - unsigned32 curr_vsid = INSERTED32(EXTRACTED32(current_pte0, 1, 24), 0, 23); - unsigned32 curr_api = INSERTED32(EXTRACTED32(current_pte0, 26, 31), 0, 5); - unsigned32 curr_h = EXTRACTED32(current_pte0, 25, 25); + uint32_t curr_vsid = INSERTED32(EXTRACTED32(current_pte0, 1, 24), 0, 23); + uint32_t curr_api = INSERTED32(EXTRACTED32(current_pte0, 26, 31), 0, 5); + uint32_t curr_h = EXTRACTED32(current_pte0, 25, 25); if (curr_h == h && curr_vsid == vsid && curr_api == MASKED32(vpage, 0, 5)) @@ -292,15 +292,15 @@ htab_map_page(device *me, } else { /* empty pte fill it */ - unsigned32 pte0 = (MASK32(0, 0) + uint32_t pte0 = (MASK32(0, 0) | INSERTED32(EXTRACTED32(vsid, 0, 23), 1, 24) | INSERTED32(h, 25, 25) | INSERTED32(EXTRACTED32(vpage, 0, 5), 26, 31)); - unsigned32 target_pte0 = H2T_4(pte0); - unsigned32 pte1 = (INSERTED32(EXTRACTED32(ra, 0, 19), 0, 19) + uint32_t target_pte0 = H2T_4(pte0); + uint32_t pte1 = (INSERTED32(EXTRACTED32(ra, 0, 19), 0, 19) | INSERTED32(wimg, 25, 28) | INSERTED32(pp, 30, 31)); - unsigned32 target_pte1 = H2T_4(pte1); + uint32_t target_pte1 = H2T_4(pte1); if (device_dma_write_buffer(device_parent(me), &target_pte0, 0, /*space*/ @@ -339,8 +339,8 @@ claim_memory(device *me, unsigned_word ra, unsigned_word size) { - unsigned32 args[3]; - unsigned32 results[1]; + uint32_t args[3]; + uint32_t results[1]; int status; args[0] = 0; /* alignment */ args[1] = size; @@ -355,15 +355,15 @@ static void htab_map_region(device *me, device_instance *memory, unsigned_word pte_ra, - unsigned64 pte_va, + uint64_t pte_va, unsigned nr_bytes, unsigned wimg, unsigned pp, - unsigned32 htaborg, - unsigned32 htabmask) + uint32_t htaborg, + uint32_t htabmask) { unsigned_word ra; - unsigned64 va; + uint64_t va; /* claim the memory */ if (memory != NULL) claim_memory(me, memory, pte_ra, nr_bytes); @@ -499,8 +499,8 @@ htab_map_binary(device *me, unsigned wimg, unsigned pp, const char *file_name, - unsigned32 htaborg, - unsigned32 htabmask) + uint32_t htaborg, + uint32_t htabmask) { htab_binary_sizes sizes; bfd *image; @@ -615,8 +615,8 @@ htab_init_data_callback(device *me) /* for the pte, do all the real work */ if (strcmp(device_name(me), "pte") == 0) { - unsigned32 htaborg; - unsigned32 htabmask; + uint32_t htaborg; + uint32_t htabmask; htab_decode_hash_table(me, &htaborg, &htabmask); @@ -626,7 +626,7 @@ htab_init_data_callback(device *me) unsigned pte_pp = device_find_integer_property(me, "pp"); const char *file_name = device_find_string_property(me, "file-name"); if (device_find_property(me, "real-address") != NULL) { - unsigned32 pte_ra = device_find_integer_property(me, "real-address"); + uint32_t pte_ra = device_find_integer_property(me, "real-address"); DTRACE(htab, ("pte - ra=0x%lx, wimg=%ld, pp=%ld, file-name=%s\n", (unsigned long)pte_ra, (unsigned long)pte_wimg, @@ -646,8 +646,8 @@ htab_init_data_callback(device *me) } else { /* handle a normal mapping definition */ - unsigned64 pte_va = 0; - unsigned32 pte_ra = device_find_integer_property(me, "real-address"); + uint64_t pte_va = 0; + uint32_t pte_ra = device_find_integer_property(me, "real-address"); unsigned pte_nr_bytes = device_find_integer_property(me, "nr-bytes"); unsigned pte_wimg = device_find_integer_property(me, "wimg"); unsigned pte_pp = device_find_integer_property(me, "pp"); |