1 #ifndef _IPXE_INTERFACE_H 2 #define _IPXE_INTERFACE_H 32 #define INTF_OP( op_type, object_type, op_func ) { \ 34 .func = ( ( ( ( typeof ( op_func ) * ) NULL ) == \ 35 ( ( op_type ## _TYPE ( object_type ) * ) NULL ) ) \ 36 ? op_func : op_func ), \ 47 #define UNUSED_INTF_OP( op_type, object_type, op_func ) { \ 49 .func = ( ( ( ( typeof ( op_func ) * ) NULL ) == \ 50 ( ( op_type ## _TYPE ( object_type ) * ) NULL ) ) \ 66 #define intf_offset( object_type, intf ) \ 67 ( ( ( ( typeof ( ( ( object_type * ) NULL )->intf ) * ) NULL ) \ 68 == ( ( struct interface * ) NULL ) ) \ 69 ? offsetof ( object_type, intf ) \ 70 : offsetof ( object_type, intf ) ) 80 #define INTF_DESC( object_type, intf, operations ) { \ 81 .offset = intf_offset ( object_type, intf ), \ 83 .num_op = ( sizeof ( operations ) / \ 84 sizeof ( operations[0] ) ), \ 85 .passthru_offset = 0, \ 97 #define INTF_DESC_PASSTHRU( object_type, intf, operations, passthru ) { \ 98 .offset = offsetof ( object_type, intf ), \ 100 .num_op = ( sizeof ( operations ) / \ 101 sizeof ( operations[0] ) ), \ 102 .passthru_offset = ( intf_offset ( object_type, passthru ) - \ 103 intf_offset ( object_type, intf ) ), \ 115 #define INTF_DESC_PURE( operations ) { \ 118 .num_op = ( sizeof ( operations ) / \ 119 sizeof ( operations[0] ) ), \ 120 .passthru_offset = 0, \ 176 #define intf_close_TYPE( object_type ) \ 177 typeof ( void ( object_type, int rc ) ) 190 #define intf_poke_TYPE( object_type ) \ 191 typeof ( void ( object_type ) ) 217 #define INTF_INIT( descriptor ) { \ 218 .dest = &null_intf, \ 220 .desc = &(descriptor), \ 222 .desc = &(descriptor), \ 257 #define intf_get_dest_op_no_passthru( intf, type, dest ) \ 258 ( ( type ## _TYPE ( void * ) * ) \ 259 intf_get_dest_op_no_passthru_untyped ( intf, type, dest ) ) 269 #define intf_get_dest_op( intf, type, dest ) \ 270 ( ( type ## _TYPE ( void * ) * ) \ 271 intf_get_dest_op_untyped ( intf, type, dest ) ) 281 #define INTF_COL( intf ) intf_object ( intf_origin ( intf ) ) 284 #define INTF_FMT "%p+%zx" 292 #define INTF_DBG( intf ) \ 293 intf_object ( intf_origin ( intf ) ), \ 294 intf_origin ( intf )->desc->offset 297 #define INTF_INTF_FMT INTF_FMT "->" INTF_FMT 306 #define INTF_INTF_DBG( intf, dest ) INTF_DBG ( intf ), INTF_DBG ( dest ) An object interface operation.
void intf_put(struct interface *intf)
Decrement reference count on an object interface.
struct arbelprm_rc_send_wqe rc
void intf_nullify(struct interface *intf)
Ignore all further operations on an object interface.
uint32_t type
Operating system type.
uint64_t desc
Microcode descriptor list physical address.
size_t offset
Offset of interface within containing object.
void intf_plug(struct interface *intf, struct interface *dest)
Plug an object interface into a new destination object interface.
void intf_close(struct interface *intf, int rc)
Close an object interface.
void intf_restart(struct interface *intf, int rc)
Shut down and restart an object interface.
static void(*) struct refcnt refcnt)
void * intf_object(struct interface *intf)
Get pointer to object containing object interface.
void * func
Implementing method.
struct interface * intf
Original interface.
unsigned int num_op
Number of interface operations.
union interface::@624 original
Original interface properties.
struct interface * dest
Destination object interface.
void intfs_vshutdown(va_list intfs, int rc)
Shut down multiple object interfaces.
struct interface_operation * op
Object interface operations.
static struct interface * intf_origin(struct interface *intf)
Get original interface.
void * intf_get_dest_op_no_passthru_untyped(struct interface *intf, void *type, struct interface **dest)
Get object interface destination and operation method (without pass-through)
ssize_t passthru_offset
Offset to pass-through interface, if present.
void intfs_restart(int rc,...) __attribute__((sentinel))
Shut down and restart multiple object interfaces.
void intfs_shutdown(int rc,...) __attribute__((sentinel))
Shut down multiple object interfaces.
struct interface null_intf
The null interface.
void * type
Operation type.
A 16-bit general register.
void intf_insert(struct interface *intf, struct interface *upper, struct interface *lower)
Insert a filter interface.
struct interface_descriptor null_intf_desc
Null interface descriptor.
void intfs_vrestart(va_list intfs, int rc)
Shut down and restart multiple object interfaces.
An object interface descriptor.
void intf_poke(struct interface *intf, void(type)(struct interface *intf))
Poke an object interface.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct interface * intf_get(struct interface *intf)
Increment reference count on an object interface.
void intf_unplug(struct interface *intf)
Unplug an object interface.
__builtin_va_list va_list
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
void * intf_get_dest_op_untyped(struct interface *intf, void *type, struct interface **dest)
Get object interface destination and operation method.
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
struct interface_descriptor * desc
Interface descriptor.
struct refcnt * refcnt
Reference counter.
void * __attribute__((pure)) intf_object(struct interface *intf)
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
#define NULL
NULL pointer (VOID *)
static void intf_temp_init(struct interface *intf, struct interface *original)
Initialise a temporary outbound-only object interface.
static void intf_reinit(struct interface *intf)
Reinitialise an object interface.