Lines Matching defs:rhdl

70 	acpidev_resource_handle_t rhdl;
72 rhdl = kmem_zalloc(sizeof (*rhdl), KM_SLEEP);
73 rhdl->acpidev_consumer = consumer;
74 rhdl->acpidev_reg_max = ACPIDEV_RES_INIT_ITEMS;
75 rhdl->acpidev_regp = rhdl->acpidev_regs;
76 rhdl->acpidev_range_max = ACPIDEV_RES_INIT_ITEMS;
77 rhdl->acpidev_rangep = rhdl->acpidev_ranges;
78 rhdl->acpidev_bus_max = ACPIDEV_RES_INIT_ITEMS;
79 rhdl->acpidev_busp = rhdl->acpidev_buses;
81 return (rhdl);
85 acpidev_resource_handle_free(acpidev_resource_handle_t rhdl)
89 ASSERT(rhdl != NULL);
90 if (rhdl != NULL) {
91 if (rhdl->acpidev_regp != rhdl->acpidev_regs) {
93 rhdl->acpidev_reg_max;
94 kmem_free(rhdl->acpidev_regp, sz);
96 if (rhdl->acpidev_rangep != rhdl->acpidev_ranges) {
98 rhdl->acpidev_range_max;
99 kmem_free(rhdl->acpidev_rangep, sz);
101 if (rhdl->acpidev_busp != rhdl->acpidev_buses) {
103 rhdl->acpidev_bus_max;
104 kmem_free(rhdl->acpidev_busp, sz);
106 kmem_free(rhdl, sizeof (struct acpidev_resource_handle));
111 acpidev_resource_handle_grow(acpidev_resource_handle_t rhdl)
115 if (rhdl->acpidev_reg_count == rhdl->acpidev_reg_max) {
119 rhdl->acpidev_reg_max += ACPIDEV_RES_INCR_ITEMS;
120 sz = sizeof (*regp) * rhdl->acpidev_reg_max;
122 sz = sizeof (*regp) * rhdl->acpidev_reg_count;
123 bcopy(rhdl->acpidev_regp, regp, sz);
124 if (rhdl->acpidev_regp != rhdl->acpidev_regs) {
125 kmem_free(rhdl->acpidev_regp, sz);
127 rhdl->acpidev_regp = regp;
130 if (rhdl->acpidev_range_count == rhdl->acpidev_range_max) {
134 rhdl->acpidev_range_max += ACPIDEV_RES_INCR_ITEMS;
135 sz = sizeof (*rngp) * rhdl->acpidev_range_max;
137 sz = sizeof (*rngp) * rhdl->acpidev_range_count;
138 bcopy(rhdl->acpidev_rangep, rngp, sz);
139 if (rhdl->acpidev_rangep != rhdl->acpidev_ranges) {
140 kmem_free(rhdl->acpidev_rangep, sz);
142 rhdl->acpidev_rangep = rngp;
145 if (rhdl->acpidev_bus_count == rhdl->acpidev_bus_max) {
149 rhdl->acpidev_bus_max += ACPIDEV_RES_INCR_ITEMS;
150 sz = sizeof (*busp) * rhdl->acpidev_bus_max;
152 sz = sizeof (*busp) * rhdl->acpidev_bus_count;
153 bcopy(rhdl->acpidev_busp, busp, sz);
154 if (rhdl->acpidev_busp != rhdl->acpidev_buses) {
155 kmem_free(rhdl->acpidev_busp, sz);
157 rhdl->acpidev_busp = busp;
162 acpidev_resource_insert_reg(acpidev_resource_handle_t rhdl,
165 ASSERT(rhdl != NULL);
167 if (rhdl->acpidev_reg_count >= rhdl->acpidev_reg_max) {
168 acpidev_resource_handle_grow(rhdl);
170 ASSERT(rhdl->acpidev_reg_count < rhdl->acpidev_reg_max);
171 rhdl->acpidev_regp[rhdl->acpidev_reg_count] = *regp;
172 rhdl->acpidev_reg_count++;
178 acpidev_resource_get_regs(acpidev_resource_handle_t rhdl,
183 ASSERT(rhdl != NULL);
185 if (rhdl == NULL || cntp == NULL || (regp == NULL && *cntp != 0)) {
188 for (i = 0, j = 0; i < rhdl->acpidev_reg_count; i++) {
189 if ((rhdl->acpidev_regp[i].phys_hi & mask) == value) {
191 regp[j] = rhdl->acpidev_regp[i];
206 acpidev_resource_get_reg_count(acpidev_resource_handle_t rhdl,
211 ASSERT(rhdl != NULL);
212 for (i = 0, j = 0; i < rhdl->acpidev_reg_count; i++) {
213 if ((rhdl->acpidev_regp[i].phys_hi & mask) == value) {
222 acpidev_resource_insert_range(acpidev_resource_handle_t rhdl,
225 ASSERT(rhdl != NULL);
227 if (rhdl->acpidev_range_count >= rhdl->acpidev_range_max) {
228 acpidev_resource_handle_grow(rhdl);
230 ASSERT(rhdl->acpidev_range_count < rhdl->acpidev_range_max);
231 rhdl->acpidev_rangep[rhdl->acpidev_range_count] = *rangep;
232 rhdl->acpidev_range_count++;
238 acpidev_resource_get_ranges(acpidev_resource_handle_t rhdl,
243 ASSERT(rhdl != NULL);
245 if (rhdl == NULL || cntp == NULL || (rangep == NULL && *cntp != 0)) {
248 for (i = 0, j = 0; i < rhdl->acpidev_range_count; i++) {
249 if ((rhdl->acpidev_rangep[i].child_hi & mask) == value) {
251 rangep[j] = rhdl->acpidev_rangep[i];
266 acpidev_resource_get_range_count(acpidev_resource_handle_t rhdl,
271 ASSERT(rhdl != NULL);
272 for (i = 0, j = 0; i < rhdl->acpidev_range_count; i++) {
273 if ((rhdl->acpidev_rangep[i].child_hi & mask) == value) {
282 acpidev_resource_insert_bus(acpidev_resource_handle_t rhdl,
285 ASSERT(rhdl != NULL);
287 if (rhdl->acpidev_bus_count >= rhdl->acpidev_bus_max) {
288 acpidev_resource_handle_grow(rhdl);
290 ASSERT(rhdl->acpidev_bus_count < rhdl->acpidev_bus_max);
291 rhdl->acpidev_busp[rhdl->acpidev_bus_count] = *busp;
292 rhdl->acpidev_bus_count++;
298 acpidev_resource_get_buses(acpidev_resource_handle_t rhdl,
303 ASSERT(rhdl != NULL);
305 if (rhdl == NULL || cntp == NULL || (busp == NULL && *cntp != 0)) {
308 for (i = 0, j = 0; i < rhdl->acpidev_bus_count; i++) {
310 busp[j] = rhdl->acpidev_busp[i];
324 acpidev_resource_get_bus_count(acpidev_resource_handle_t rhdl)
326 ASSERT(rhdl != NULL);
327 return (rhdl->acpidev_bus_count);
331 acpidev_resource_insert_dma(acpidev_resource_handle_t rhdl, int dma)
333 ASSERT(rhdl != NULL);
334 if (rhdl->acpidev_dma_count >= ACPIDEV_RES_DMA_MAX) {
340 rhdl->acpidev_dmap[rhdl->acpidev_dma_count] = dma;
341 rhdl->acpidev_dma_count++;
347 acpidev_resource_get_dmas(acpidev_resource_handle_t rhdl,
352 ASSERT(rhdl != NULL);
354 if (rhdl == NULL || cntp == NULL || (dmap == NULL && *cntp != 0)) {
357 for (i = 0, j = 0; i < rhdl->acpidev_dma_count; i++) {
359 dmap[j] = rhdl->acpidev_dmap[i];
373 acpidev_resource_get_dma_count(acpidev_resource_handle_t rhdl)
375 ASSERT(rhdl != NULL);
376 return (rhdl->acpidev_dma_count);
380 acpidev_resource_insert_irq(acpidev_resource_handle_t rhdl, int irq)
382 ASSERT(rhdl != NULL);
383 if (rhdl->acpidev_irq_count >= ACPIDEV_RES_IRQ_MAX) {
389 rhdl->acpidev_irqp[rhdl->acpidev_irq_count] = irq;
390 rhdl->acpidev_irq_count++;
396 acpidev_resource_get_irqs(acpidev_resource_handle_t rhdl,
401 ASSERT(rhdl != NULL);
403 if (rhdl == NULL || cntp == NULL || (irqp == NULL && *cntp != 0)) {
406 for (i = 0, j = 0; i < rhdl->acpidev_irq_count; i++) {
408 irqp[j] = rhdl->acpidev_irqp[i];
422 acpidev_resource_get_irq_count(acpidev_resource_handle_t rhdl)
424 ASSERT(rhdl != NULL);
425 return (rhdl->acpidev_irq_count);
429 acpidev_resource_address64(acpidev_resource_handle_t rhdl,
435 ASSERT(addrp != NULL && rhdl != NULL);
472 rhdl->acpidev_consumer == B_TRUE) {
481 rc = acpidev_resource_insert_reg(rhdl, &reg);
488 rhdl->acpidev_consumer == B_FALSE) {
508 rc = acpidev_resource_insert_range(rhdl, &range);
543 rhdl->acpidev_consumer == B_TRUE) {
552 rc = acpidev_resource_insert_reg(rhdl, &reg);
559 rhdl->acpidev_consumer == B_FALSE) {
579 rc = acpidev_resource_insert_range(rhdl, &range);
590 rhdl->acpidev_consumer == B_FALSE) {
605 rc = acpidev_resource_insert_bus(rhdl, &bus);
627 acpidev_resource_handle_t rhdl;
630 rhdl = (acpidev_resource_handle_t)ctxp;
631 ASSERT(rhdl->acpidev_consumer == B_FALSE);
667 rc = acpidev_resource_insert_range(rhdl, &range);
689 } else if (ACPI_FAILURE(rc = acpidev_resource_address64(rhdl,
718 if (ACPI_FAILURE(rc = acpidev_resource_address64(rhdl,
751 acpidev_resource_handle_t rhdl;
754 rhdl = (acpidev_resource_handle_t)ctxp;
755 ASSERT(rhdl->acpidev_consumer == B_TRUE);
776 if (ACPI_SUCCESS(acpidev_resource_insert_irq(rhdl,
793 if (ACPI_SUCCESS(acpidev_resource_insert_irq(rhdl,
810 if (ACPI_SUCCESS(acpidev_resource_insert_dma(rhdl,
847 rc = acpidev_resource_insert_reg(rhdl, &reg);
886 rc = acpidev_resource_insert_reg(rhdl, &reg);
908 } else if (ACPI_FAILURE(rc = acpidev_resource_address64(rhdl,
937 if (ACPI_FAILURE(rc = acpidev_resource_address64(rhdl,
972 acpidev_resource_handle_t rhdl = NULL;
1002 rhdl = acpidev_resource_handle_alloc(consumer);
1005 acpidev_resource_walk_consumer, rhdl);
1008 acpidev_resource_walk_producer, rhdl);
1011 *rhdlp = rhdl;
1013 acpidev_resource_handle_free(rhdl);
1030 acpidev_resource_handle_t rhdl = NULL;
1042 consumer, &rhdl);
1054 if (rhdl->acpidev_reg_count > 0 &&
1056 "reg", (int *)rhdl->acpidev_regp,
1057 rhdl->acpidev_reg_count * sizeof (acpidev_regspec_t) /
1064 if (rhdl->acpidev_reg_count > 0 &&
1066 "assigned-addresses", (int *)rhdl->acpidev_regp,
1067 rhdl->acpidev_reg_count * sizeof (acpidev_regspec_t) /
1076 if (rhdl->acpidev_irq_count > 0 &&
1078 "interrupts", (int *)rhdl->acpidev_irqp,
1079 rhdl->acpidev_irq_count) != NDI_SUCCESS) {
1087 if (rhdl->acpidev_dma_count > 0 &&
1089 "dma-channels", (int *)rhdl->acpidev_dmap,
1090 rhdl->acpidev_dma_count) != NDI_SUCCESS) {
1101 if (rhdl->acpidev_range_count > 0 &&
1103 "ranges", (int *)rhdl->acpidev_rangep,
1104 rhdl->acpidev_range_count * sizeof (acpidev_ranges_t) /
1113 if (rhdl->acpidev_bus_count > 0 &&
1115 "bus-range", (int *)rhdl->acpidev_busp,
1116 rhdl->acpidev_bus_count * sizeof (acpidev_bus_range_t) /
1127 acpidev_resource_handle_free(rhdl);