equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
69 typedef int lgrp_rsrc_t; |
69 typedef int lgrp_rsrc_t; |
70 typedef enum lgrp_view { |
70 typedef enum lgrp_view { |
71 LGRP_VIEW_CALLER, /* what's available to the caller */ |
71 LGRP_VIEW_CALLER, /* what's available to the caller */ |
72 LGRP_VIEW_OS /* what's available to operating system */ |
72 LGRP_VIEW_OS /* what's available to operating system */ |
73 } lgrp_view_t; |
73 } lgrp_view_t; |
|
74 |
|
75 typedef uint_t (*getisax_func_t)(uint32_t* array, uint_t n); |
74 |
76 |
75 typedef lgrp_id_t (*lgrp_home_func_t)(idtype_t idtype, id_t id); |
77 typedef lgrp_id_t (*lgrp_home_func_t)(idtype_t idtype, id_t id); |
76 typedef lgrp_cookie_t (*lgrp_init_func_t)(lgrp_view_t view); |
78 typedef lgrp_cookie_t (*lgrp_init_func_t)(lgrp_view_t view); |
77 typedef int (*lgrp_fini_func_t)(lgrp_cookie_t cookie); |
79 typedef int (*lgrp_fini_func_t)(lgrp_cookie_t cookie); |
78 typedef lgrp_id_t (*lgrp_root_func_t)(lgrp_cookie_t cookie); |
80 typedef lgrp_id_t (*lgrp_root_func_t)(lgrp_cookie_t cookie); |
85 typedef int (*lgrp_cookie_stale_func_t)(lgrp_cookie_t cookie); |
87 typedef int (*lgrp_cookie_stale_func_t)(lgrp_cookie_t cookie); |
86 typedef int (*meminfo_func_t)(const uint64_t inaddr[], int addr_count, |
88 typedef int (*meminfo_func_t)(const uint64_t inaddr[], int addr_count, |
87 const uint_t info_req[], int info_count, |
89 const uint_t info_req[], int info_count, |
88 uint64_t outdata[], uint_t validity[]); |
90 uint64_t outdata[], uint_t validity[]); |
89 |
91 |
|
92 static getisax_func_t _getisax; |
|
93 |
90 static lgrp_home_func_t _lgrp_home; |
94 static lgrp_home_func_t _lgrp_home; |
91 static lgrp_init_func_t _lgrp_init; |
95 static lgrp_init_func_t _lgrp_init; |
92 static lgrp_fini_func_t _lgrp_fini; |
96 static lgrp_fini_func_t _lgrp_fini; |
93 static lgrp_root_func_t _lgrp_root; |
97 static lgrp_root_func_t _lgrp_root; |
94 static lgrp_children_func_t _lgrp_children; |
98 static lgrp_children_func_t _lgrp_children; |
280 static int lgrp_nlgrps(lgrp_cookie_t cookie) { return _lgrp_nlgrps != NULL ? _lgrp_nlgrps(cookie) : -1; } |
284 static int lgrp_nlgrps(lgrp_cookie_t cookie) { return _lgrp_nlgrps != NULL ? _lgrp_nlgrps(cookie) : -1; } |
281 static int lgrp_cookie_stale(lgrp_cookie_t cookie) { |
285 static int lgrp_cookie_stale(lgrp_cookie_t cookie) { |
282 return _lgrp_cookie_stale != NULL ? _lgrp_cookie_stale(cookie) : -1; |
286 return _lgrp_cookie_stale != NULL ? _lgrp_cookie_stale(cookie) : -1; |
283 } |
287 } |
284 static lgrp_cookie_t lgrp_cookie() { return _lgrp_cookie; } |
288 static lgrp_cookie_t lgrp_cookie() { return _lgrp_cookie; } |
|
289 |
|
290 static bool supports_getisax() { return _getisax != NULL; } |
|
291 static uint_t getisax(uint32_t* array, uint_t n); |
285 |
292 |
286 static void set_meminfo(meminfo_func_t func) { _meminfo = func; } |
293 static void set_meminfo(meminfo_func_t func) { _meminfo = func; } |
287 static int meminfo (const uint64_t inaddr[], int addr_count, |
294 static int meminfo (const uint64_t inaddr[], int addr_count, |
288 const uint_t info_req[], int info_count, |
295 const uint_t info_req[], int info_count, |
289 uint64_t outdata[], uint_t validity[]) { |
296 uint64_t outdata[], uint_t validity[]) { |