1/** 2 * \file 3 * \brief Essential capability definitions. 4 */ 5 6/* 7 * Copyright (c) 2007-2012, 2016, ETH Zurich. 8 * Copyright (c) 2015, 2016 Hewlett Packard Enterprise Development LP. 9 * All rights reserved. 10 * 11 * This file is distributed under the terms in the attached LICENSE file. 12 * If you do not find this file, copies can be found by writing to: 13 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 14 */ 15 16#ifndef BARRELFISH_CAPABILITIES_H 17#define BARRELFISH_CAPABILITIES_H 18 19/* FIXME: OBJBITS and OBJSIZE defines must match sizes in Hamlet's capabilities/caps.hl */ 20 21// Size of CNode entry 22#define OBJBITS_CTE 6 23 24/// Number of entries in L2 CNode in bits 25#define L2_CNODE_BITS 8 26/// Number of entries in L2 CNode 27#define L2_CNODE_SLOTS (1UL << L2_CNODE_BITS) 28 29#ifndef __ASSEMBLER__ 30 31#include <assert.h> 32#include <stdbool.h> 33#include <barrelfish_kpi/types.h> 34 35#include <sys/cdefs.h> 36 37__BEGIN_DECLS 38 39#define CAPRIGHTS_READ (1 << 0) 40#define CAPRIGHTS_WRITE (1 << 1) 41#define CAPRIGHTS_EXECUTE (1 << 2) 42#define CAPRIGHTS_GRANT (1 << 3) 43#define CAPRIGHTS_IDENTIFY (1 << 4) 44#define CAPRIGHTS_NUM 5 45 46#define CAPRIGHTS_ALLRIGHTS ((1 << CAPRIGHTS_NUM) - 1) 47#define CAPRIGHTS_READ_WRITE (CAPRIGHTS_READ | CAPRIGHTS_WRITE) 48#define CAPRIGHTS_NORIGHTS 0 49 50typedef uint8_t CapRights; 51#define PRIuCAPRIGHTS PRIu8 52#define PRIxCAPRIGHTS PRIx8 53 54struct dcb; 55 56// capbits needs CapRights and dcb; 57#include <barrelfish_kpi/capbits.h> 58 59STATIC_ASSERT((L2_CNODE_SLOTS * (1UL << OBJBITS_CTE)) == OBJSIZE_L2CNODE, 60 "l2 cnode size doesn't match cte size"); 61 62static inline bool type_is_vnode(enum objtype type) 63{ 64 STATIC_ASSERT(68 == ObjType_Num, "Check VNode definitions"); 65 66 return (type == ObjType_VNode_VTd_root_table || 67 type == ObjType_VNode_VTd_ctxt_table || 68 type == ObjType_VNode_x86_64_pml5 || 69 type == ObjType_VNode_x86_64_pml4 || 70 type == ObjType_VNode_x86_64_pdpt || 71 type == ObjType_VNode_x86_64_pdir || 72 type == ObjType_VNode_x86_64_ptable || 73 type == ObjType_VNode_x86_64_ept_pml4 || 74 type == ObjType_VNode_x86_64_ept_pdpt || 75 type == ObjType_VNode_x86_64_ept_pdir || 76 type == ObjType_VNode_x86_64_ept_ptable || 77 type == ObjType_VNode_x86_32_pdpt || 78 type == ObjType_VNode_x86_32_pdir || 79 type == ObjType_VNode_x86_32_ptable || 80 type == ObjType_VNode_AARCH64_l3 || 81 type == ObjType_VNode_AARCH64_l2 || 82 type == ObjType_VNode_AARCH64_l1 || 83 type == ObjType_VNode_AARCH64_l0 || 84 type == ObjType_VNode_ARM_l2 || 85 type == ObjType_VNode_ARM_l1 86 ); 87} 88 89static inline bool type_is_vroot(enum objtype type) 90{ 91 STATIC_ASSERT(68 == ObjType_Num, "Check VNode definitions"); 92 93 return (type == ObjType_VNode_x86_64_pml4 || 94 type == ObjType_VNode_x86_64_ept_pml4 || 95#ifdef CONFIG_PAE 96 type == ObjType_VNode_x86_32_pdpt || 97#else 98 type == ObjType_VNode_x86_32_pdir || 99#endif 100 type == ObjType_VNode_AARCH64_l0 || 101 type == ObjType_VNode_ARM_l1 102 ); 103} 104/** 105 * Return size of vnode in bits. This is the size of a page table page. 106 * 107 * @param type Object type. 108 * 109 * @return Number of bits a VNode object occupies. 110 */ 111static inline uint8_t vnode_objbits(enum objtype type) 112{ 113 // This function should be emitted by hamlet or somesuch. 114 STATIC_ASSERT(68 == ObjType_Num, "Check VNode definitions"); 115 116 if (type == ObjType_VNode_VTd_root_table || 117 type == ObjType_VNode_VTd_ctxt_table || 118 type == ObjType_VNode_x86_64_pml5 || 119 type == ObjType_VNode_x86_64_pml4 || 120 type == ObjType_VNode_x86_64_pdpt || 121 type == ObjType_VNode_x86_64_pdir || 122 type == ObjType_VNode_x86_64_ptable || 123 type == ObjType_VNode_x86_64_ept_pml4 || 124 type == ObjType_VNode_x86_64_ept_pdpt || 125 type == ObjType_VNode_x86_64_ept_pdir || 126 type == ObjType_VNode_x86_64_ept_ptable || 127 type == ObjType_VNode_x86_32_pdpt || 128 type == ObjType_VNode_x86_32_pdir || 129 type == ObjType_VNode_x86_32_ptable) 130 { 131 return 12; 132 } 133 else if (type == ObjType_VNode_AARCH64_l0 || 134 type == ObjType_VNode_AARCH64_l1 || 135 type == ObjType_VNode_AARCH64_l2 || 136 type == ObjType_VNode_AARCH64_l3) 137 { 138 return 12; 139 } 140 else if (type == ObjType_VNode_ARM_l1) 141 { 142 return 14; 143 } 144 else if (type == ObjType_VNode_ARM_l2) 145 { 146 return 10; 147 } 148 149 assert(0 && !"Page table size unknown."); 150 return 0; 151} 152 153static inline bool type_is_ept(enum objtype type) 154{ 155 STATIC_ASSERT(68 == ObjType_Num, "Check VNode definitions"); 156 157 return (type == ObjType_VNode_x86_64_ept_pml4 || 158 type == ObjType_VNode_x86_64_ept_pdpt || 159 type == ObjType_VNode_x86_64_ept_pdir || 160 type == ObjType_VNode_x86_64_ept_ptable); 161} 162 163/** 164 * Return size of vnode in bytes. This is the size of a page table page. 165 * 166 * @param type Object type. 167 * 168 * @return Size of a VNode in bytes. 169 * 170 * XXX: this should probably just do 1UL << vnode_objbits(type) for vnode 171 * objtypes -SG, 2016-07-06. 172 */ 173static inline size_t vnode_objsize(enum objtype type) 174{ 175 // This function should be emitted by hamlet or somesuch. 176 STATIC_ASSERT(68 == ObjType_Num, "Check VNode definitions"); 177 178 if (type == ObjType_VNode_VTd_root_table || 179 type == ObjType_VNode_VTd_ctxt_table || 180 type == ObjType_VNode_x86_64_pml5 || 181 type == ObjType_VNode_x86_64_pml4 || 182 type == ObjType_VNode_x86_64_pdpt || 183 type == ObjType_VNode_x86_64_pdir || 184 type == ObjType_VNode_x86_64_ptable || 185 type == ObjType_VNode_x86_64_ept_pml4 || 186 type == ObjType_VNode_x86_64_ept_pdpt || 187 type == ObjType_VNode_x86_64_ept_pdir || 188 type == ObjType_VNode_x86_64_ept_ptable || 189 type == ObjType_VNode_x86_32_pdpt || 190 type == ObjType_VNode_x86_32_pdir || 191 type == ObjType_VNode_x86_32_ptable) 192 { 193 // XXX: cannot use BASE_PAGE_SIZE here because asmoffsets does not 194 // include the right files 195 return 4096; // BASE_PAGE_SIZE 196 } 197 else if (type == ObjType_VNode_AARCH64_l0 || 198 type == ObjType_VNode_AARCH64_l1 || 199 type == ObjType_VNode_AARCH64_l2 || 200 type == ObjType_VNode_AARCH64_l3) 201 { 202 return 4096; 203 } 204 else if (type == ObjType_VNode_ARM_l1) 205 { 206 // ARMv7 L1 page table is 16kB. 207 return 16384; 208 } 209 else if (type == ObjType_VNode_ARM_l2) 210 { 211 return 1024; 212 } 213 214 assert(0 && !"Page table size unknown."); 215 return 0; 216} 217 218/** 219 * Return number of page table entries for vnode in bits. 220 * @param type Object type. 221 * @return Number of page table entries in bits 222 */ 223static inline size_t vnode_entry_bits(enum objtype type) { 224 // This function should be emitted by hamlet or somesuch. 225 STATIC_ASSERT(68 == ObjType_Num, "Check VNode definitions"); 226 227 if (type == ObjType_VNode_VTd_root_table || 228 type == ObjType_VNode_VTd_ctxt_table || 229 type == ObjType_VNode_x86_64_pml5 || 230 type == ObjType_VNode_x86_64_pml4 || 231 type == ObjType_VNode_x86_64_pdpt || 232 type == ObjType_VNode_x86_64_pdir || 233 type == ObjType_VNode_x86_64_ptable || 234 type == ObjType_VNode_x86_64_ept_pml4 || 235 type == ObjType_VNode_x86_64_ept_pdpt || 236 type == ObjType_VNode_x86_64_ept_pdir || 237 type == ObjType_VNode_x86_64_ept_ptable) 238 { 239 return 9; // log2(X86_64_PTABLE_SIZE) 240 } 241#ifdef CONFIG_PAE 242 if (type == ObjType_VNode_x86_32_pdpt) 243 { 244 return 2; // log2(X86_32_PDPTE_SIZE) 245 } 246 else if (type == ObjType_VNode_x86_32_pdir || 247 type == ObjType_VNode_x86_32_ptable) 248 { 249 return 9; // log2(X86_32_PTABLE_SIZE) == log2(X86_32_PDIR_SIZE) 250 } 251#else 252 if (type == ObjType_VNode_x86_32_pdir || 253 type == ObjType_VNode_x86_32_ptable) 254 { 255 return 10; // log2(X86_32_PTABLE_SIZE) == log2(X86_32_PDIR_SIZE) 256 } 257#endif 258 259 if (type == ObjType_VNode_AARCH64_l0 || 260 type == ObjType_VNode_AARCH64_l1 || 261 type == ObjType_VNode_AARCH64_l2 || 262 type == ObjType_VNode_AARCH64_l3) 263 { 264 return 9; // log2(ARM_MAX_ENTRIES) 265 } 266 267 if (type == ObjType_VNode_ARM_l2) 268 { 269 return 9; // log2(ARM_L2_MAX_ENTRIES) 270 } 271 else if (type == ObjType_VNode_ARM_l1) 272 { 273 return 12; // log2(ARM_L1_MAX_ENTRIES) 274 } 275 276 assert(!"unknown page table type"); 277 return 0; 278} 279 280/** 281 * Return number of slots for cnode in bits. 282 * @param type Object type. 283 * @return Number of page table entries in bits 284 */ 285static inline size_t cnode_get_slots(struct capability *cnode) { 286 STATIC_ASSERT(68 == ObjType_Num, "Check CNode definitions"); 287 288 switch (cnode->type) { 289 case ObjType_L1CNode: 290 return cnode->u.l1cnode.allocated_bytes / (1UL << OBJBITS_CTE); 291 case ObjType_L2CNode: 292 return L2_CNODE_SLOTS; 293 default: 294 assert(!"not a cnode"); 295 return 0; 296 } 297} 298 299static inline enum objtype get_mapping_type(enum objtype captype) 300{ 301 STATIC_ASSERT(68 == ObjType_Num, "Knowledge of all mapping types"); 302 303 switch (captype) { 304 case ObjType_Frame: 305 return ObjType_Frame_Mapping; 306 case ObjType_EndPointUMP: 307 return ObjType_EndPointUMP_Mapping; 308 case ObjType_DevFrame: 309 return ObjType_DevFrame_Mapping; 310 case ObjType_VNode_VTd_root_table: 311 return ObjType_VNode_VTd_root_table_Mapping; 312 case ObjType_VNode_VTd_ctxt_table: 313 return ObjType_VNode_VTd_ctxt_table_Mapping; 314 case ObjType_VNode_x86_64_pml5: 315 return ObjType_VNode_x86_64_pml5_Mapping; 316 case ObjType_VNode_x86_64_pml4: 317 return ObjType_VNode_x86_64_pml4_Mapping; 318 case ObjType_VNode_x86_64_pdpt: 319 return ObjType_VNode_x86_64_pdpt_Mapping; 320 case ObjType_VNode_x86_64_pdir: 321 return ObjType_VNode_x86_64_pdir_Mapping; 322 case ObjType_VNode_x86_64_ptable: 323 return ObjType_VNode_x86_64_ptable_Mapping; 324 case ObjType_VNode_x86_64_ept_pml4: 325 return ObjType_VNode_x86_64_ept_pml4_Mapping; 326 case ObjType_VNode_x86_64_ept_pdpt: 327 return ObjType_VNode_x86_64_ept_pdpt_Mapping; 328 case ObjType_VNode_x86_64_ept_pdir: 329 return ObjType_VNode_x86_64_ept_pdir_Mapping; 330 case ObjType_VNode_x86_64_ept_ptable: 331 return ObjType_VNode_x86_64_ept_ptable_Mapping; 332 case ObjType_VNode_x86_32_pdpt: 333 return ObjType_VNode_x86_32_pdpt_Mapping; 334 case ObjType_VNode_x86_32_pdir: 335 return ObjType_VNode_x86_32_pdir_Mapping; 336 case ObjType_VNode_x86_32_ptable: 337 return ObjType_VNode_x86_32_ptable_Mapping; 338 case ObjType_VNode_ARM_l1: 339 return ObjType_VNode_ARM_l1_Mapping; 340 case ObjType_VNode_ARM_l2: 341 return ObjType_VNode_ARM_l2_Mapping; 342 case ObjType_VNode_AARCH64_l0: 343 return ObjType_VNode_AARCH64_l0_Mapping; 344 case ObjType_VNode_AARCH64_l1: 345 return ObjType_VNode_AARCH64_l1_Mapping; 346 case ObjType_VNode_AARCH64_l2: 347 return ObjType_VNode_AARCH64_l2_Mapping; 348 case ObjType_VNode_AARCH64_l3: 349 return ObjType_VNode_AARCH64_l3_Mapping; 350 /* all other types are not mappable */ 351 default: 352 return ObjType_Null; 353 } 354} 355 356static inline bool type_is_mapping(enum objtype type) 357{ 358 STATIC_ASSERT(68 == ObjType_Num, "Knowledge of all mapping types"); 359 360 switch (type) { 361 case ObjType_Frame_Mapping: 362 case ObjType_EndPointUMP_Mapping: 363 case ObjType_DevFrame_Mapping: 364 case ObjType_VNode_VTd_root_table_Mapping: 365 case ObjType_VNode_VTd_ctxt_table_Mapping: 366 case ObjType_VNode_x86_64_pml5_Mapping: 367 case ObjType_VNode_x86_64_pml4_Mapping: 368 case ObjType_VNode_x86_64_pdpt_Mapping: 369 case ObjType_VNode_x86_64_pdir_Mapping: 370 case ObjType_VNode_x86_64_ptable_Mapping: 371 case ObjType_VNode_x86_64_ept_pml4_Mapping: 372 case ObjType_VNode_x86_64_ept_pdpt_Mapping: 373 case ObjType_VNode_x86_64_ept_pdir_Mapping: 374 case ObjType_VNode_x86_64_ept_ptable_Mapping: 375 case ObjType_VNode_x86_32_pdpt_Mapping: 376 case ObjType_VNode_x86_32_pdir_Mapping: 377 case ObjType_VNode_x86_32_ptable_Mapping: 378 case ObjType_VNode_ARM_l1_Mapping: 379 case ObjType_VNode_ARM_l2_Mapping: 380 case ObjType_VNode_AARCH64_l0_Mapping: 381 case ObjType_VNode_AARCH64_l1_Mapping: 382 case ObjType_VNode_AARCH64_l2_Mapping: 383 case ObjType_VNode_AARCH64_l3_Mapping: 384 return true; 385 386 /* all other types are not mapping types */ 387 default: 388 return false; 389 } 390} 391 392static inline bool type_is_mappable(enum objtype type) 393{ 394 STATIC_ASSERT(68 == ObjType_Num, "Knowledge of all mappable types"); 395 396 switch (type) { 397 case ObjType_Frame: 398 case ObjType_EndPointUMP: 399 case ObjType_DevFrame: 400 case ObjType_VNode_VTd_root_table: 401 case ObjType_VNode_VTd_ctxt_table: 402 case ObjType_VNode_x86_64_pml5: 403 case ObjType_VNode_x86_64_pml4: 404 case ObjType_VNode_x86_64_pdpt: 405 case ObjType_VNode_x86_64_pdir: 406 case ObjType_VNode_x86_64_ptable: 407 case ObjType_VNode_x86_32_pdpt: 408 case ObjType_VNode_x86_32_pdir: 409 case ObjType_VNode_x86_32_ptable: 410 case ObjType_VNode_ARM_l1: 411 case ObjType_VNode_ARM_l2: 412 case ObjType_VNode_AARCH64_l0: 413 case ObjType_VNode_AARCH64_l1: 414 case ObjType_VNode_AARCH64_l2: 415 case ObjType_VNode_AARCH64_l3: 416 return true; 417 418 /* all other types are not mappable */ 419 default: 420 return false; 421 } 422} 423 424/* XXX: this should be generated by hamlet. */ 425static inline pasid_t get_pasid(struct capability *cap) 426{ 427 STATIC_ASSERT(68 == ObjType_Num, "Knowledge of all types that have a pasid"); 428 429 if (!type_is_mappable(cap->type)) { 430 return -1; 431 } 432 433 // XXX: this assumes that everything that's mappable is derived from the 434 // abstract capability type Memory. 435 return cap->u.frame.pasid; 436} 437 438/** 439 * CNode capability commands. 440 */ 441enum cnode_cmd { 442 CNodeCmd_Copy, ///< Copy capability 443 CNodeCmd_Mint, ///< Mint capability 444 CNodeCmd_Retype, ///< Retype capability 445 CNodeCmd_Delete, ///< Delete capability 446 CNodeCmd_Revoke, ///< Revoke capability 447 CNodeCmd_Create, ///< Create capability 448 CNodeCmd_GetState, ///< Get distcap state for capability 449 CNodeCmd_GetSize, ///< Get Size of CNode, only applicable for L1 Cnode 450 CNodeCmd_Resize, ///< Resize CNode, only applicable for L1 Cnode 451 CNodeCmd_CapIdentify ///< Identify capability 452}; 453 454enum vnode_cmd { 455 VNodeCmd_Map, 456 VNodeCmd_Unmap, 457 VNodeCmd_ModifyFlags, 458 VNodeCmd_CleanDirtyBits, ///< Cleans all dirty bit in the table 459 VNodeCmd_CopyRemap, ///< Copy and remap page table for copy-on-write 460 VNodeCmd_Inherit, ///< Clone page table 461}; 462 463/** 464 * Mapping commands 465 */ 466enum mapping_cmd { 467 MappingCmd_Modify, 468 MappingCmd_Destroy, 469}; 470 471/** 472 * Kernel capabilities commands. 473 * Monitor's invocations of capability operations 474 * which the kernel will not subject to cross core checks 475 */ 476enum kernel_cmd { 477 KernelCmd_Spawn_core, ///< Spawn a new kernel 478 KernelCmd_Identify_cap, ///< Return the meta data of a capability 479 KernelCmd_Identify_domains_cap, ///< Return the meta data of another domain's capability 480 KernelCmd_Remote_relations, ///< Set capability as being remote 481 KernelCmd_Cap_has_relations, ///< Return presence of local relations 482 KernelCmd_Create_cap, ///< Create a new capability 483 KernelCmd_Copy_existing, 484 KernelCmd_Get_core_id, ///< Returns the id of the core the domain is on 485 KernelCmd_Get_arch_id, ///< Returns arch id of caller's core 486 KernelCmd_Nullify_cap, ///< Set the capability to NULL allowed it to be reused 487 KernelCmd_Setup_trace, ///< Set up trace buffer 488 KernelCmd_Register, ///< Register monitor notify endpoint 489 KernelCmd_Domain_Id, ///< Set domain ID of dispatcher 490 KernelCmd_Get_cap_owner, 491 KernelCmd_Set_cap_owner, 492 KernelCmd_Lock_cap, 493 KernelCmd_Unlock_cap, 494 KernelCmd_Delete_last, 495 KernelCmd_Delete_foreigns, 496 KernelCmd_Revoke_mark_target, 497 KernelCmd_Revoke_mark_relations, 498 KernelCmd_Delete_step, 499 KernelCmd_Clear_step, 500 KernelCmd_Retype, 501 KernelCmd_Has_descendants, 502 KernelCmd_Is_retypeable, 503 KernelCmd_Sync_timer, 504 KernelCmd_IPI_Register, 505 KernelCmd_IPI_Delete, 506 KernelCmd_GetGlobalPhys, 507 KernelCmd_Add_kcb, ///< add extra kcb to be scheduled 508 KernelCmd_Remove_kcb, ///< remove kcb from scheduling ring 509 KernelCmd_Suspend_kcb_sched, ///< suspend/resume kcb scheduler 510 KernelCmd_Get_platform, ///< Get architecture platform 511 KernelCmd_ReclaimRAM, ///< Retrieve stored ram caps from KCB 512 KernelCmd_Count 513}; 514 515/** 516 * Specific commands for dispatcher capabilities. 517 */ 518enum dispatcher_cmd { 519 DispatcherCmd_Setup, ///< Set dispatcher parameters 520 DispatcherCmd_Properties, ///< Set dispatcher properties 521 DispatcherCmd_PerfMon, ///< Performance monitoring 522 DispatcherCmd_SetupGuest, ///< Set up the DCB of a guest domain 523 DispatcherCmd_DumpPTables, ///< Dump hw page tables of dispatcher 524 DispatcherCmd_DumpCapabilities, ///< Dump capabilities of dispatcher 525 DispatcherCmd_Vmread, ///< Execute vmread on the current and active VMCS 526 DispatcherCmd_Vmwrite, ///< Execute vmwrite on the current and active VMCS 527 DispatcherCmd_Vmptrld, ///< Make VMCS clear and inactive 528 DispatcherCmd_Vmclear, ///< Make VMCS current and active 529}; 530 531/** 532 * Kernel control block commands. 533 */ 534enum kcb_cmd { 535 KCBCmd_Identify, ///< Return base address of KCB frame 536 KCBCmd_Clone, ///< Duplicate core_data 537}; 538 539/** 540 * RAM capability commands 541 */ 542enum ram_cmd { 543 RAMCmd_Noop, ///< Noop invocation for benchmark 544}; 545 546/** 547 * IRQ Table capability commands. 548 */ 549enum irqtable_cmd { 550 IRQTableCmd_Alloc, ///< Allocate new vector (XXX: HACK: this is x86 specific) 551 IRQTableCmd_AllocDestCap, ///< Allocate new dest capability (XXX: HACK: this is x86 specific) 552 IRQTableCmd_Set, ///< Set endpoint for IRQ# notifications 553 IRQTableCmd_Delete ///< Remove notification endpoint for IRQ# 554}; 555 556/** 557 * IRQ Vector commands. 558 */ 559 560enum irqdest_cmd { 561 IRQDestCmd_Connect, ///< Connect this capability to a messaging channel 562 IRQDestCmd_GetVector, ///< Return the local interrupt vector 563 IRQDestCmd_GetCpu ///< Return the local interrupt vector 564}; 565 566/** 567 * IRQ Vector commands. 568 */ 569 570enum irqsrc_cmd { 571 IRQSrcCmd_GetVecStart, ///< Return vector range start 572 IRQSrcCmd_GetVecEnd ///< Return vector range high 573}; 574 575 576/** 577 * IO capability commands. 578 */ 579enum io_cmd { 580 IOCmd_Outb, ///< Output byte to port 581 IOCmd_Outw, ///< Output word to port 582 IOCmd_Outd, ///< Output double word to port 583 IOCmd_Inb, ///< Input byte from port 584 IOCmd_Inw, ///< Input word from port 585 IOCmd_Ind ///< Input double word from port 586}; 587 588/** 589 * DeviceID Manager Commands 590 */ 591 592enum devidman_cmd { 593 DeviceIDManager_CreateID, ///< Create a new DeviceID 594}; 595 596 597/** 598 * Notify capability commands. 599 */ 600enum notify_cmd { 601 NotifyCmd_Send 602}; 603 604 605/** 606 * Performance monitoring commands. 607 * Seems to be already included in the Dispatcher capability. 608 */ 609enum perfmon_cmd { 610 PerfmonCmd_Activate, ///< Activate performance counters 611 PerfmonCmd_Deactivate, ///< Deactivate performance counters 612 PerfmonCmd_Write ///< Read current performance counter values 613}; 614 615 616/** 617 * ID capability commands. 618 */ 619enum id_cmd { 620 IDCmd_Identify ///< Return system-wide unique ID 621}; 622 623/** 624 * IPI capability commands 625 */ 626 627enum ipi_cmd { 628 IPICmd_Send_Start, ///< Send Startup IPI to a destination core 629 IPICmd_Send_Init, ///< Send Init IPI to a destination core 630}; 631 632/** 633 * Maximum command ordinal. 634 */ 635#define CAP_MAX_CMD KernelCmd_Count 636 637/** 638 * \brief Values returned from frame identify invocation 639 */ 640struct frame_identity { 641 genpaddr_t base; ///< Physical base address of frame 642 gensize_t bytes; ///< Size of frame, in bytes 643 pasid_t pasid; ///< the address space id 644}; 645 646/** 647 * \brief Values returned from the VNode identify invocation 648 */ 649struct vnode_identity { 650 genpaddr_t base; ///< Physical base address of the VNode 651 uint8_t type; ///< Type of VNode 652}; 653 654/** 655 * @brief values for the type field in the device_identity struct below 656 */ 657typedef enum { 658 DEVICE_ID_TYPE_UNKNOWN = 0, 659 DEVICE_ID_TYPE_PCI = 1, 660 DEVICE_ID_TYPE_USB = 2, 661 DEVICE_ID_TYPE_MAX = 3, 662} device_id_type_t; 663 664/** 665 * \brief Values returned from the DeviceID identify invocation 666 */ 667struct device_identity { 668 uint16_t segment; 669 uint8_t bus; 670 uint8_t device; 671 uint8_t function; 672 uint8_t type; 673 uint16_t flags; 674}; 675 676 677struct endpoint_identity { 678 genpaddr_t base; ///< Physical Address of the Endpoint 679 gensize_t length; ///< Length of the Endpoint 680 uint16_t iftype; ///< interface type 681 uint16_t eptype; ///< type of the endpoint 682}; 683 684__END_DECLS 685 686#endif // __ASSEMBLER__ 687 688#endif // BARRELFISH_CAPABILITIES_H 689