MCPcopy Create free account
hub / github.com/F-Stack/f-stack / isa_alloc_resource

Function isa_alloc_resource

freebsd/x86/isa/isa.c:88–132  ·  view source on GitHub ↗

* This implementation simply passes the request up to the parent * bus, which in our case is the special i386 nexus, substituting any * configured values if the caller defaulted. We can get away with * this because there is no special mapping for ISA resources on an Intel * platform. When porting this code to another architecture, it may be * necessary to interpose a mapping layer here. */

Source from the content-addressed store, hash-verified

86 * necessary to interpose a mapping layer here.
87 */
88struct resource *
89isa_alloc_resource(device_t bus, device_t child, int type, int *rid,
90 rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
91{
92 /*
93 * Consider adding a resource definition.
94 */
95 int passthrough = (device_get_parent(child) != bus);
96 int isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
97 struct isa_device* idev = DEVTOISA(child);
98 struct resource_list *rl = &idev->id_resources;
99 struct resource_list_entry *rle;
100
101 if (!passthrough && !isdefault) {
102 rle = resource_list_find(rl, type, *rid);
103 if (!rle) {
104 if (*rid < 0)
105 return 0;
106 switch (type) {
107 case SYS_RES_IRQ:
108 if (*rid >= ISA_NIRQ)
109 return 0;
110 break;
111 case SYS_RES_DRQ:
112 if (*rid >= ISA_NDRQ)
113 return 0;
114 break;
115 case SYS_RES_MEMORY:
116 if (*rid >= ISA_NMEM)
117 return 0;
118 break;
119 case SYS_RES_IOPORT:
120 if (*rid >= ISA_NPORT)
121 return 0;
122 break;
123 default:
124 return 0;
125 }
126 resource_list_add(rl, type, *rid, start, end, count);
127 }
128 }
129
130 return resource_list_alloc(rl, bus, child, type, rid,
131 start, end, count, flags);
132}
133
134int
135isa_release_resource(device_t bus, device_t child, int type, int rid,

Callers

nothing calls this directly

Calls 4

device_get_parentFunction · 0.85
resource_list_findFunction · 0.85
resource_list_addFunction · 0.85
resource_list_allocFunction · 0.85

Tested by

no test coverage detected