Lines Matching defs:range
135 /* need to insert our range */
183 * 2. If cannot allocate out of PFMem range, allocate from Mem ranges. PFmemFromMem
309 * assign a -1 and then update once the range
351 * range actually appears...
380 * This function adds a range into a sorted list of ranges per bus for a particular
381 * range type, it then calls another routine to update the range numbers on the
384 * Input: type of the resource, range to add, current bus
385 * Output: 0 or -1, bus and range ptrs
387 static int add_bus_range (int type, struct range_node *range, struct bus_node *bus_cur)
411 if (range->start < range_cur->start)
418 /* our range will go at the beginning of the list */
421 bus_cur->rangeMem = range;
424 bus_cur->rangePFMem = range;
427 bus_cur->rangeIO = range;
430 range->next = range_cur;
431 range->rangeno = 1;
434 /* our range will go at the end of the list */
435 range->next = NULL;
436 range_prev->next = range;
437 range->rangeno = range_prev->rangeno + 1;
440 /* the range is in the middle */
441 range_prev->next = range;
442 range->next = range_cur;
443 range->rangeno = range_cur->rangeno;
458 * the range numbers that they correspond to. It was called from add_bus_range fnc
497 /* found the range */
506 static void fix_me (struct resource_node *res, struct bus_node *bus_cur, struct range_node *range)
523 while (range) {
524 if ((res->start >= range->start) && (res->end <= range->end)) {
525 res->rangeno = range->rangeno;
540 range = range->next;
552 * This routine reassigns the range numbers to the resources that had a -1
555 * know the range, we assign -1, and this routine is called after a new range
556 * is assigned to see the resources with unknown range belong to the added range
563 struct range_node *range;
570 range = bus_cur->rangeIO;
571 fix_me (res, bus_cur, range);
575 range = bus_cur->rangeMem;
576 fix_me (res, bus_cur, range);
580 range = bus_cur->rangePFMem;
581 fix_me (res, bus_cur, range);
663 debug ("The range is %d\n", res->rangeno);
702 /* in the same range */
710 /* the last resource in this range */
716 /* at the beginning or middle of the range */
738 /* this is the case where it is 1st occurrence of the range */
939 struct range_node * range = NULL;
943 range = bus_cur->rangeIO;
946 range = bus_cur->rangeMem;
949 range = bus_cur->rangePFMem;
955 while (range) {
956 if (res->rangeno == range->rangeno)
958 range = range->next;
960 return range;
975 struct range_node *range = NULL;
1031 range = find_range (bus_cur, res_cur);
1034 if (!range) {
1035 err ("no range for the device exists... bailing out...\n");
1039 /* found our range */
1042 if ((res_cur->start != range->start) && ((len_tmp = res_cur->start - 1 - range->start) >= res->len)) {
1047 if ((range->start % tmp_divide) == 0) {
1051 start_cur = range->start;
1054 tmp_start = range->start;
1081 /* last device on the range */
1082 if ((range->end != res_cur->end) && ((len_tmp = range->end - (res_cur->end + 1)) >= res->len)) {
1096 while ((len_tmp = range->end - tmp_start) >= res->len) {
1104 if (tmp_start >= range->end)
1120 /* 1st device on this range */
1121 if ((res_cur->start != range->start) &&
1122 ((len_tmp = res_cur->start - 1 - range->start) >= res->len)) {
1124 if ((range->start % tmp_divide) == 0) {
1128 start_cur = range->start;
1131 tmp_start = range->start;
1156 /* in the same range */
1203 /* need to find appropriate range */
1206 range = bus_cur->rangeIO;
1209 range = bus_cur->rangeMem;
1212 range = bus_cur->rangePFMem;
1215 while (range) {
1216 if ((len_tmp = range->end - range->start) >= res->len) {
1218 if ((range->start % tmp_divide) == 0) {
1222 start_cur = range->start;
1225 tmp_start = range->start;
1228 while ((len_tmp = range->end - tmp_start) >= res->len) {
1236 if (tmp_start >= range->end)
1249 range = range->next;
1252 if ((!range) && (len_cur == 0)) {
1254 err ("no appropriate range.. bailing out...\n");
1270 range = bus_cur->rangeIO;
1273 range = bus_cur->rangeMem;
1276 range = bus_cur->rangePFMem;
1279 while (range) {
1280 if ((len_tmp = range->end - range->start) >= res->len) {
1282 if ((range->start % tmp_divide) == 0) {
1286 start_cur = range->start;
1289 tmp_start = range->start;
1292 while ((len_tmp = range->end - tmp_start) >= res->len) {
1300 if (tmp_start >= range->end)
1313 range = range->next;
1316 if ((!range) && (len_cur == 0)) {
1318 err ("no appropriate range.. bailing out...\n");
1335 err ("no appropriate range.. bailing out...\n");
1669 * pfmem out of memory buckets of the bus. If so, it will change the range numbers
1776 struct range_node *range;
1795 range = bus_cur->rangeIO;
1797 debug_pci ("rangeno is %d\n", range->rangeno);
1798 debug_pci ("[%x - %x]\n", range->start, range->end);
1799 range = range->next;
1805 range = bus_cur->rangeMem;
1807 debug_pci ("rangeno is %d\n", range->rangeno);
1808 debug_pci ("[%x - %x]\n", range->start, range->end);
1809 range = range->next;
1816 range = bus_cur->rangePFMem;
1818 debug_pci ("rangeno is %d\n", range->rangeno);
1819 debug_pci ("[%x - %x]\n", range->start, range->end);
1820 range = range->next;
1830 debug_pci ("The range # is %d\n", res->rangeno);
1845 debug_pci ("The range # is %d\n", res->rangeno);
1860 debug_pci ("The range # is %d\n", res->rangeno);
1876 debug_pci ("The range # is %d\n", res->rangeno);
1886 static int range_exists_already (struct range_node * range, struct bus_node * bus_cur, u8 type)
1900 err ("wrong type passed to find out if range already exists\n");
1905 if ((range_cur->start == range->start) && (range_cur->end == range->end))
1914 * range info for the secondary bus, and will also input this info into
1937 struct range_node *range;
1992 range = kzalloc(sizeof(struct range_node), GFP_KERNEL);
1993 if (!range) {
1997 range->start = start_address;
1998 range->end = end_address + 0xfff;
2001 if (!range_exists_already (range, bus_sec, IO)) {
2002 add_bus_range (IO, range, bus_sec);
2005 kfree (range);
2006 range = NULL;
2010 range->rangeno = 1;
2011 bus_sec->rangeIO = range;
2019 kfree (range);
2041 range = kzalloc(sizeof(struct range_node), GFP_KERNEL);
2042 if (!range) {
2046 range->start = start_address;
2047 range->end = end_address + 0xfffff;
2050 if (!range_exists_already (range, bus_sec, MEM)) {
2051 add_bus_range (MEM, range, bus_sec);
2054 kfree (range);
2055 range = NULL;
2059 range->rangeno = 1;
2060 bus_sec->rangeMem = range;
2069 kfree (range);
2095 range = kzalloc(sizeof(struct range_node), GFP_KERNEL);
2096 if (!range) {
2100 range->start = start_address;
2101 range->end = end_address + 0xfffff;
2104 if (!range_exists_already (range, bus_sec, PFMEM)) {
2105 add_bus_range (PFMEM, range, bus_sec);
2108 kfree (range);
2109 range = NULL;
2113 range->rangeno = 1;
2114 bus_sec->rangePFMem = range;
2122 kfree (range);