openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

cmext.h (3109B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  */
      7 
      8 #ifndef _SOC_CMEXT_H
      9 #define _SOC_CMEXT_H
     10 
     11 #include <soc/devids.h>
     12 #include <soc/cmtypes.h>
     13 
     14 extern int soc_cm_init(void);
     15 extern int soc_cm_deinit(void);
     16 /*
     17  * DRIVER/DEVICE INITIALIZATION
     18  * ----------------------------------------
     19  * 
     20  * Step One: Device/Revision Ids
     21  * -------------------------------
     22  * Each Broadcom device can be identified by 2 values -- its
     23  * Device ID and its Revision ID. The combination of these two values
     24  * specify a particular Broadcom device. 
     25  *
     26  * Before the BCM driver is assigned the task of driving 
     27  * a Broadcom device, you must ascertain the Device ID and the 
     28  * Revision ID for the device to be driven (for a PCI device, these
     29  * are in the PCI Configuration Space). 
     30  *
     31  *
     32  * After the Device ID and Revision ID are discovered (typically at
     33  * system initialization time), you should query the SOC driver to 
     34  * discover whether it supports the discovered device using the following 
     35  * function:
     36  */
     37 
     38 /*
     39  * Syntax:     int soc_cm_device_supported(uint16 device_id,
     40  *					   uint8 revision_id)
     41  *
     42  * Purpose:    Determine whether this driver supports a particular device. 
     43  * 
     44  * Parameters:
     45  *             device_id    -- The 16-bit device id for the device. 
     46  *             revision_id  -- The 8-bit revision id for the device. 
     47  * 
     48  * Returns:
     49  *             0 if the device is supported. 
     50  *             < 0 if the device is not supported. 
     51  */
     52 
     53 extern int soc_cm_device_supported(uint16 dev_id, uint8 rev_id);
     54 
     55 /*
     56  * Step Two: Device Creation
     57  * -----------------------------------------
     58  * When you have a device that the SOC driver supports, 
     59  * You must create a driver device for it. 
     60  * You create a driver device by calling cm_device_create() with
     61  * the device and revision ids. 
     62  *
     63  * cm_device_create() will return a handle that should be used
     64  * when referring to the device in the future. 
     65 
     66  * cm_device_create_id() might be used if application want to 
     67  * force a speicifc handle when referring to the device in the future.
     68  * Passing -1 as a "dev" parameter will force api to allocate a new handle.
     69  */
     70 
     71 extern int soc_cm_device_create(uint16 dev_id, uint16 rev_id, void *cookie);
     72 extern int soc_cm_device_create_id(uint16 dev_id, uint16 rev_id, 
     73                                    void *cookie, int dev);
     74 
     75 
     76 /*
     77  * Step Three: Device Initialization
     78  * -----------------------------------------
     79  * After you have initialized a device, 
     80  * you must provide several accessor functions that will be
     81  * used by the SOC driver to communicate with the device at 
     82  * the lowest level -- the SOC driver will access the device
     83  * through these routines, and these routines only. 
     84  *
     85  * You provide these access vectors to the driver
     86  * by filling in the 'cm_device_t' structure. See <cmtypes.h>
     87  */
     88 
     89 extern int soc_cm_device_init(int dev, soc_cm_device_vectors_t *vectors);
     90 
     91 extern int soc_cm_device_destroy(int dev);
     92 
     93 #endif	/* !_SOC_CMEXT_H */