Browse Prior Art Database

\Method to Enable Multiple Device Configuration Threads In a Multiprocessor Environment Disclosure Number: IPCOM000020987D
Original Publication Date: 2003-Dec-16
Included in the Prior Art Database: 2003-Dec-16
Document File: 5 page(s) / 75K

Publishing Venue



A means for device driver configuration code to incorporate; global resource configuration state information, defined access to that state, and a device instance count, in one variable. This allows multiple configuration threads to proceed at the same time, after the global resources have been allocated.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 56% of the total text.

Page 1 of 5

\Method to Enable Multiple Device Configuration Threads In a Multiprocessor Environment

At core of this invention is a variable with three defined states, ConfigCount. These states are IDLE, BUSY, and VALID. In the example below the global variable ConfigCount may assume the states; IDLE is Minus One(-1), BUSY is Zero(0), VALID is Greater-than Zero(>0). The novelty is introduced by the ordering and method of achieving state transitions through atomic operations.

Sample code:



/* ConfigCount maintains a count of configuration instances.

Page 2 of 5

int Command,

struct uio *ConfigData) {

int rslt = SUCCESS; /* return value */

int cmpwd; /* value for atomic compare/swap */

int pri; /* Save for interrupt priority */

switch (Command)



Page 3 of 5

case CFG_INIT: fetch_and_add(&ConfigActive, 1); /* increment active thread count */ cmpwd = 0; /* Confirm there are no CFG_TERM threads */ if (compare_and_swap(&UnconfigActive, &cmpwd, 0)) {

cmpwd = IDLE; /* to check for IDLE (first instance) */

if (compare_and_swap(&ConfigCount, &cmpwd, BUSY))

{ /* Allocate Global Control Structures */ lock_alloc(&ConfigLock,



     LOCK_ID); simple_lock_init(&ConfigLock); }

if (cmpwd == BUSY) /* _OLD_ value was -BUSY- */ rslt = EINPROGRESS; /* (un)config in progress */ else

{ rslt = AllocateDeviceResources(Device, ConfigData); if (rslt == SUCCESS)


pri = disable_lock(MYPRI,&ConfigLock);


unlock_enable(pri, &ConfigLock);

fetch_and_add(&ConfigCount, 1); /* clear BUSY or increment



     rslt = EBUSY; /* unconfig thread active */ fetch_and_add(&ConfigActive, (-1)); /* decrement active thread count */


Page 4 of 5

case CFG_TERM: fetch_and_add(&UnconfigActive, 1); /*...