hpci_postevent(D3hpci)
hpci_postevent --
report changes in hardware state for sockets and busses to hpci
Synopsis
#include <sys/types.h>
#include <sys/hpci.h>
#include <sys/ddi.h>
int hpci_postevent(int hpcid, hpci_socket_info_t *socket, int evtype);
Description
hpci_postevent( )
reports new changes in the hardware state
of sockets and busses
to the operating system.
Arguments
hpcid-
instance identifier of the HPCD
from which the event was posted.
socket-
pointer to the socket to be configured.
evtype-
type of event. Valid values are:
EVENT_STATE_CHANGE-
An asynchronous state change event
was detected by the HPCD driver.
EVENT_NEW_SOCKET-
The HPCD driver detected a new hot plug socket in the system.
EVENT_RESCAN-
Unused.
EVENT_DRVCMD_STATUS-
Unused.
Return values
hpci_postevent () returns 1 if successful, or -1 if an
invalid event was intercepted.
Usage
hpci_postevent( )
notifies the operating system about any changes to the hardware state
of the hotplug sockets that are controlled by the HPCD driver
because of asynchronous events that the HPCD driver encounters,
such as attaching a card to a socket.
The data structure tree information (controller, bus, socket, device,
and function) in the
hpci_hpcd_t(D4hpci)
structure must be in a consistent state when
hpci_postevent( )
is called because this call uses that information
to notify the operating system about
any changes to the hardware state.
Context and synchronization
Blockable or interrupt
context
Hardware applicability
All
Version applicability
hpci:
1
References
``Hotplug devices'' in HDK Technical Reference
``PCI'' in HDK Technical Reference
Examples
1 int
2 socket_state_change(int cmd,
3 hpci_socket_info_t *socket)
4 {
/* save current state */
5 socket->prev_state = socket->current_state;
6 switch(cmd)
7 {
8 case CARD_PRESENT:
/* update data structure tree */
/* set the bit in current state to reflect the presence of a card */
9 socket->current_state &= ~SOCKET_EMPTY;
/* inform HPCI about state change */
10 hpci_postevent(socket->hpcid, socket, EVENT_STATE_CHANGE);
11 break;
12 case CARD_NOT_PRESENT:
/* update data structure tree */
/* set the bit in current state to reflect the absence of the card */
13 socket->current_state |= SOCKET_EMPTY;
/* inform HPCI about state change */
14 hpci_postevent(socket->hpcid, socket, EVENT_STATE_CHANGE);
15 break;
16 case xxx: /* handle other cases here */
17 break;
18 default:
19 cmn_err(CE_WARN, "%s: socket_state_change: invalid request 0x%x for hpcid=%d\n",
20 modname, cmd, socket->hpcid);
21 return(EINVAL);
22 }
23 return(0);
24 }
Line 3-
pointer to the socket data structure
Line 5-
save current state
Line 8-
deal with card insertion
Line 9-
update data structure tree and
set the bit in socket->current_state to reflect the presence of a card
Line 10-
inform HPCI that a state change event occurred
Line 12-
deal with card removal
Line 13-
update data structure tree and
set the bit in socket->current_state to reflect the absence of the card
Line 14-
inform HPCI that a state change event occurred
Line 16-
handle other asynchronous events here
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005