2 * Copyright (c) 2000-2010 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
31 #if defined(__x86_64__)
32 void pmap_pcid_initialize(pmap_t
);
33 void pmap_pcid_initialize_kernel(pmap_t
);
34 pcid_t
pmap_pcid_allocate_pcid(int);
35 void pmap_pcid_deallocate_pcid(int, pmap_t
);
36 void pmap_destroy_pcid_sync_action(void *);
37 void pmap_destroy_pcid_sync(pmap_t
);
38 void pmap_pcid_lazy_flush(pmap_t
);
39 void pmap_pcid_activate(pmap_t
, int, boolean_t
, boolean_t
);
40 pcid_t
pcid_for_pmap_cpu_tuple(pmap_t
, thread_t
, int);
42 #define PMAP_INVALID ((pmap_t)0xDEAD7347)
43 #define PMAP_PCID_INVALID_PCID (0xDEAD)
44 #define PMAP_PCID_MAX_REFCOUNT (0xF0)
45 #define PMAP_PCID_MIN_PCID (1)
47 extern uint32_t pmap_pcid_ncpus
;
50 pmap_pcid_invalidate_all_cpus(pmap_t tpmap
)
54 pmap_assert((sizeof(tpmap
->pmap_pcid_coherency_vector
) >= real_ncpus
) && (!(sizeof(tpmap
->pmap_pcid_coherency_vector
) & 7)));
56 for (i
= 0; i
< real_ncpus
; i
+= 8) {
57 *(uint64_t *)(uintptr_t)&tpmap
->pmap_pcid_coherency_vector
[i
] = (~0ULL);
62 pmap_pcid_validate_current(void)
64 int ccpu
= cpu_number();
65 volatile uint8_t *cptr
= cpu_datap(ccpu
)->cpu_pmap_pcid_coherentp
;
67 pmap_assert(cptr
== &(current_thread()->map
->pmap
->pmap_pcid_coherency_vector
[ccpu
]));
75 pmap_pcid_invalidate_cpu(pmap_t tpmap
, int ccpu
)
77 tpmap
->pmap_pcid_coherency_vector
[ccpu
] = 0xFF;
81 pmap_pcid_validate_cpu(pmap_t tpmap
, int ccpu
)
83 tpmap
->pmap_pcid_coherency_vector
[ccpu
] = 0;