Now we arrive at the core of the matter. What does "512038 Exclusive" actually mean?
Key functions and structures:
Structures:
struct amd_smbus_adap
struct i2c_adapter adap;
struct mutex mutex; // serialize transactions
spinlock_t reg_lock; // protect registers
atomic_t in_progress; // token: 0 free, 1 busy
struct wait_queue_head wq; // waiters for adapter
unsigned long timeout_ms;
;
Transaction entry:
int amd_smbus_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
struct amd_smbus_adap *a = to_amd(adap);
if (!mutex_trylock(&a->mutex))
if (nonblocking_request) return -EAGAIN;
if (!wait_event_timeout(a->wq, mutex_trylock(&a->mutex), msecs_to_jiffies(a->timeout_ms)))
return -ETIMEDOUT;
/* got mutex */
if (atomic_cmpxchg(&a->in_progress, 0, 1) != 0)
mutex_unlock(&a->mutex);
return -EBUSY;
/* perform transfer with reg_lock around register accesses */
spin_lock_irqsave(&a->reg_lock, flags);
/* write regs, start transfer */
spin_unlock_irqrestore(&a->reg_lock, flags);
/* wait for completion (interrupt or polling) with timeout */
if (wait_for_completion_timeout(...))
/* success */
else
/* timeout: attempt controller reset and retry up to N times */
atomic_set(&a->in_progress, 0);
mutex_unlock(&a->mutex);
wake_up(&a->wq);
return ret;
Recovery:
Nonblocking and IRQ-safe paths:
API compatibility:
The most reliable way to install the SMBus driver is through the official AMD Chipset Drivers package. The standalone SMBus driver is rarely distributed separately by AMD; it is bundled with the chipset utility.
Drivers without proper exclusivity allow overlapping transactions causing data corruption or bus errors. The amd_smbus_512038 tag refers to a driver needing improved exclusive-access control to: amd smbus driver 512038 exclusive