Deleted Added
sdiff udiff text old ( 184205 ) new ( 184802 )
full compact
1/*-
2 * Copyright (c) 2005,2008 Joseph Koshy
3 * Copyright (c) 2007 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * Portions of this software were developed by A. Joseph Koshy under
7 * sponsorship from the FreeBSD Foundation and Google, Inc.
8 *

--- 15 unchanged lines hidden (view full) ---

24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_x86.c 184802 2008-11-09 17:37:54Z jkoshy $");
33
34#include <sys/param.h>
35#include <sys/bus.h>
36#include <sys/pmc.h>
37#include <sys/proc.h>
38#include <sys/systm.h>
39
40#include <machine/cpu.h>

--- 194 unchanged lines hidden (view full) ---

235 break;
236 pc = *(uintptr_t *) r;
237 fp = *(uintptr_t *) fp;
238 }
239
240 return (n);
241}
242
243/*
244 * Machine dependent initialization for x86 class platforms.
245 */
246
247struct pmc_mdep *
248pmc_md_initialize()
249{
250 int i;
251 struct pmc_mdep *md;
252
253 /* determine the CPU kind */
254 md = NULL;
255 if (strcmp(cpu_vendor, "AuthenticAMD") == 0)
256 md = pmc_amd_initialize();
257 else if (strcmp(cpu_vendor, "GenuineIntel") == 0)
258 md = pmc_intel_initialize();
259 else
260 KASSERT(0, ("[x86,%d] Unknown vendor", __LINE__));
261
262 /* disallow sampling if we do not have an LAPIC */
263 if (md != NULL && lapic == NULL)
264 for (i = 1; i < md->pmd_nclass; i++)
265 md->pmd_classdep[i].pcd_caps &= ~PMC_CAP_INTERRUPT;
266
267 return (md);
268}
269
270void
271pmc_md_finalize(struct pmc_mdep *md)
272{
273 if (strcmp(cpu_vendor, "AuthenticAMD") == 0)
274 pmc_amd_finalize(md);
275 else if (strcmp(cpu_vendor, "GenuineIntel") == 0)
276 pmc_intel_finalize(md);
277 else
278 KASSERT(0, ("[x86,%d] Unknown vendor", __LINE__));
279}