36 #include <sys/machsystm.h> /* lddphys() */
37 #include <sys/iommutsb.h>
38 #include "px_obj.h"
39
40 int
41 px_mmu_attach(px_t *px_p)
42 {
43 dev_info_t *dip = px_p->px_dip;
44 px_mmu_t *mmu_p;
45 uint32_t tsb_i = 0;
46 char map_name[32];
47 px_dvma_range_prop_t *dvma_prop;
48 int dvma_prop_len;
49 uint32_t cache_size, tsb_entries;
50
51 /*
52 * Allocate mmu state structure and link it to the
53 * px state structure.
54 */
55 mmu_p = kmem_zalloc(sizeof (px_mmu_t), KM_SLEEP);
56 if (mmu_p == NULL)
57 return (DDI_FAILURE);
58
59 px_p->px_mmu_p = mmu_p;
60 mmu_p->mmu_px_p = px_p;
61 mmu_p->mmu_inst = ddi_get_instance(dip);
62
63 /*
64 * Check for "virtual-dma" property that specifies
65 * the DVMA range.
66 */
67 if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS,
68 "virtual-dma", (caddr_t)&dvma_prop, &dvma_prop_len) !=
69 DDI_PROP_SUCCESS) {
70
71 DBG(DBG_ATTACH, dip, "Getting virtual-dma failed\n");
72
73 kmem_free(mmu_p, sizeof (px_mmu_t));
74 px_p->px_mmu_p = NULL;
75
76 return (DDI_FAILURE);
77 }
|
36 #include <sys/machsystm.h> /* lddphys() */
37 #include <sys/iommutsb.h>
38 #include "px_obj.h"
39
40 int
41 px_mmu_attach(px_t *px_p)
42 {
43 dev_info_t *dip = px_p->px_dip;
44 px_mmu_t *mmu_p;
45 uint32_t tsb_i = 0;
46 char map_name[32];
47 px_dvma_range_prop_t *dvma_prop;
48 int dvma_prop_len;
49 uint32_t cache_size, tsb_entries;
50
51 /*
52 * Allocate mmu state structure and link it to the
53 * px state structure.
54 */
55 mmu_p = kmem_zalloc(sizeof (px_mmu_t), KM_SLEEP);
56
57 px_p->px_mmu_p = mmu_p;
58 mmu_p->mmu_px_p = px_p;
59 mmu_p->mmu_inst = ddi_get_instance(dip);
60
61 /*
62 * Check for "virtual-dma" property that specifies
63 * the DVMA range.
64 */
65 if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS,
66 "virtual-dma", (caddr_t)&dvma_prop, &dvma_prop_len) !=
67 DDI_PROP_SUCCESS) {
68
69 DBG(DBG_ATTACH, dip, "Getting virtual-dma failed\n");
70
71 kmem_free(mmu_p, sizeof (px_mmu_t));
72 px_p->px_mmu_p = NULL;
73
74 return (DDI_FAILURE);
75 }
|