FreeBSD kernel CAM code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/endian.h>
#include <sys/systm.h>
#include <sys/types.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/time.h>
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <sys/interrupt.h>
#include <sys/sbuf.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/sysctl.h>
#include <sys/condvar.h>
#include <cam/cam.h>
#include <cam/cam_ccb.h>
#include <cam/cam_queue.h>
#include <cam/cam_periph.h>
#include <cam/cam_sim.h>
#include <cam/cam_xpt.h>
#include <cam/cam_xpt_sim.h>
#include <cam/cam_xpt_periph.h>
#include <cam/cam_xpt_internal.h>
#include <cam/cam_debug.h>
#include <cam/mmc/mmc.h>
#include <cam/mmc/mmc_bus.h>
#include <machine/stdarg.h>
#include <machine/_inttypes.h>
#include "opt_cam.h"
Go to the source code of this file.
Data Structures | |
struct | mmcprobe_softc |
Macros | |
#define | PROBE_SET_ACTION(softc, newaction) |
#define | MMC_XPT_XPORT(x, X) |
#define | PROBE_FLAG_ACMD_SENT 0x1 /* CMD55 is sent, card expects ACMD */ |
#define | PROBE_FLAG_HOST_CAN_DO_18V 0x2 /* Host can do 1.8V signaling */ |
#define | CARD_ID_FREQUENCY 400000 /* Spec requires 400kHz max during ID phase. */ |
Functions | |
__FBSDID ("$FreeBSD$") | |
FEATURE (mmccam, "CAM-based MMC/SD/SDIO stack") | |
static struct cam_ed * | mmc_alloc_device (struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id) |
static void | mmc_dev_async (u_int32_t async_code, struct cam_eb *bus, struct cam_et *target, struct cam_ed *device, void *async_arg) |
static void | mmc_action (union ccb *start_ccb) |
static void | mmc_dev_advinfo (union ccb *start_ccb) |
static void | mmc_announce_periph (struct cam_periph *periph) |
static void | mmc_scan_lun (struct cam_periph *periph, struct cam_path *path, cam_flags flags, union ccb *ccb) |
static cam_status | mmcprobe_register (struct cam_periph *periph, void *arg) |
static void | mmcprobe_start (struct cam_periph *periph, union ccb *start_ccb) |
static void | mmcprobe_cleanup (struct cam_periph *periph) |
static void | mmcprobe_done (struct cam_periph *periph, union ccb *done_ccb) |
static void | mmc_proto_announce (struct cam_ed *device) |
static void | mmc_proto_denounce (struct cam_ed *device) |
static void | mmc_proto_debug_out (union ccb *ccb) |
MMC_XPT_XPORT (mmc, MMCSD) | |
CAM_XPT_PROTO (mmc_proto) | |
void | mmccam_start_discovery (struct cam_sim *sim) |
static void | mmc_print_ident (struct mmc_params *ident_data, struct sbuf *sb) |
PERIPHDRIVER_DECLARE (mmcprobe, probe_driver) | |
static int | mmc_highest_voltage (uint32_t ocr) |
static void | init_standard_ccb (union ccb *ccb, uint32_t cmd) |
void | mmc_path_inq (struct ccb_pathinq *cpi, const char *hba, const struct cam_sim *sim, size_t maxio) |
Variables | |
static char * | probe_action_text [] |
static struct xpt_xport_ops | mmc_xport_ops |
static struct xpt_proto_ops | mmc_proto_ops |
static struct xpt_proto | mmc_proto |
static periph_init_t | probe_periph_init |
static struct periph_driver | probe_driver |
#define CARD_ID_FREQUENCY 400000 /* Spec requires 400kHz max during ID phase. */ |
#define MMC_XPT_XPORT | ( | x, | |
X | |||
) |
#define PROBE_FLAG_ACMD_SENT 0x1 /* CMD55 is sent, card expects ACMD */ |
#define PROBE_FLAG_HOST_CAN_DO_18V 0x2 /* Host can do 1.8V signaling */ |
#define PROBE_SET_ACTION | ( | softc, | |
newaction | |||
) |
enum probe_action |
__FBSDID | ( | "$FreeBSD$" | ) |
CAM_XPT_PROTO | ( | mmc_proto | ) |
FEATURE | ( | mmccam | , |
"CAM-based MMC/SD/SDIO stack" | |||
) |
|
inlinestatic |
Definition at line 586 of file mmc_xpt.c.
References CAM_DIR_OUT, ccb_hdr::cbfcnp, ccb::ccb_h, ccb_hdr::flags, ccb_hdr::func_code, mmcprobe_done(), ccb_hdr::retry_count, and ccb_hdr::timeout.
Referenced by mmcprobe_start().
|
static |
Definition at line 301 of file mmc_xpt.c.
References CAM_DEBUG, CAM_DEBUG_INFO, CAM_DEBUG_TRACE, ccb::ccb_h, ccb::crcn, ccb_rescan::flags, ccb_hdr::func_code, mmc_dev_advinfo(), mmc_scan_lun(), ccb_hdr::path, cam_path::periph, xpt_action_default(), xpt_action_name(), XPT_DEV_ADVINFO, XPT_SCAN_BUS, XPT_SCAN_LUN, and XPT_SCAN_TGT.
|
static |
Definition at line 190 of file mmc_xpt.c.
References cam_ed::inq_data, cam_ed::inq_flags, cam_ed::lun_id, cam_ed::maxtags, cam_ed::mintags, cam_ed::queue_flags, cam_ed::quirk, cam_ed::serial_num, cam_ed::serial_num_len, cam_ed::target, and xpt_alloc_device().
|
static |
Definition at line 380 of file mmc_xpt.c.
References CAM_DEBUG, CAM_DEBUG_INFO, CAM_DEBUG_TRACE, cam_periph_assert, CAM_PRIORITY_NORMAL, CAM_REQ_CMP, CAM_STATUS_MASK, cts, CTS_TYPE_CURRENT_SETTINGS, ccb_trans_settings_mmc::ios, cam_periph::path, cam_path::periph, xpt_action(), XPT_GET_TRAN_SETTINGS, xpt_path_inq(), and xpt_setup_ccb().
|
static |
Definition at line 332 of file mmc_xpt.c.
References ccb_dev_advinfo::buf, ccb_dev_advinfo::bufsiz, ccb_dev_advinfo::buftype, CAM_DEBUG, CAM_DEBUG_TRACE, CAM_REQ_CMP, CAM_REQ_INVALID, ccb::ccb_h, ccb::cdai, CDAI_FLAG_STORE, CDAI_TYPE_MMC_PARAMS, CDAI_TYPE_PHYS_PATH, CDAI_TYPE_SCSI_DEVID, CDAI_TYPE_SERIAL_NUM, cam_path::device, cam_ed::device_id, cam_ed::device_id_len, ccb_dev_advinfo::flags, cam_ed::mmc_ident_data, ccb_hdr::path, ccb_dev_advinfo::provsiz, cam_ed::serial_num, cam_ed::serial_num_len, ccb_hdr::status, and xpt_path_assert.
Referenced by mmc_action().
|
static |
Definition at line 210 of file mmc_xpt.c.
References AC_LOST_DEVICE, CAM_DEV_UNCONFIGURED, CAM_LUN_WILDCARD, CAM_TARGET_WILDCARD, cam_ed::flags, cam_ed::lun_id, cam_ed::target, cam_et::target_id, and xpt_release_device().
|
static |
Definition at line 574 of file mmc_xpt.c.
Referenced by mmcprobe_start().
void mmc_path_inq | ( | struct ccb_pathinq * | cpi, |
const char * | hba, | ||
const struct cam_sim * | sim, | ||
size_t | maxio | ||
) |
Definition at line 1216 of file mmc_xpt.c.
References ccb_pathinq::base_transfer_speed, ccb_pathinq::bus_id, CAM_REQ_CMP, cam_sim_bus(), cam_sim_name(), cam_sim_unit(), ccb_pathinq::ccb_h, DEV_IDLEN, ccb_pathinq::dev_name, ccb_pathinq::hba_eng_cnt, HBA_IDLEN, ccb_pathinq::hba_inquiry, ccb_pathinq::hba_misc, ccb_pathinq::hba_vid, ccb_pathinq::initiator_id, ccb_pathinq::max_lun, ccb_pathinq::max_target, ccb_pathinq::maxio, PIM_NOBUSRESET, PIM_SEQSCAN, PROTO_MMCSD, ccb_pathinq::protocol, ccb_pathinq::protocol_version, SCSI_REV_0, SIM_IDLEN, ccb_pathinq::sim_vid, ccb_hdr::status, ccb_pathinq::target_sprt, ccb_pathinq::transport, ccb_pathinq::transport_version, ccb_pathinq::unit_number, ccb_pathinq::version_num, and XPORT_MMCSD.
Referenced by mmc_cam_sim_default_action().
|
static |
Definition at line 429 of file mmc_xpt.c.
References CARD_FEATURE_18V, CARD_FEATURE_MEMORY, CARD_FEATURE_MMC, CARD_FEATURE_SD20, CARD_FEATURE_SDHC, CARD_FEATURE_SDIO, mmc_params::card_features, mmc_params::card_ocr, mmc_params::card_rca, mmc_params::io_ocr, and mmc_params::sdio_func_count.
Referenced by mmc_proto_announce().
|
static |
Definition at line 476 of file mmc_xpt.c.
References cam_ed::mmc_ident_data, and mmc_print_ident().
Referenced by mmc_proto_denounce().
|
static |
Definition at line 495 of file mmc_xpt.c.
References CAM_DEBUG, CAM_DEBUG_CDB, ccb::ccb_h, ccb_hdr::func_code, ccb_hdr::path, and XPT_MMC_IO.
|
static |
Definition at line 488 of file mmc_xpt.c.
References mmc_proto_announce().
|
static |
Definition at line 230 of file mmc_xpt.c.
References CAM_DEBUG, CAM_DEBUG_INFO, CAM_DEBUG_TRACE, CAM_LUN_WILDCARD, cam_periph_alloc(), CAM_PERIPH_BIO, cam_periph_find(), CAM_PERIPH_INVALID, CAM_REQ_CMP, CAM_REQ_CMP_ERR, ccb_pathinq::ccb_h, ccb::ccb_h, cam_periph::flags, mmcprobe_cleanup(), mmcprobe_register(), mmcprobe_start(), cam_periph::path, ccb_hdr::status, xpt_done(), xpt_path_inq(), xpt_path_lock, xpt_path_lun_id(), xpt_path_owned, xpt_path_unlock, and xpt_print().
Referenced by mmc_action().
MMC_XPT_XPORT | ( | mmc | , |
MMCSD | |||
) |
void mmccam_start_discovery | ( | struct cam_sim * | sim | ) |
Definition at line 403 of file mmc_xpt.c.
References CAM_REQ_CMP, cam_sim_name(), cam_sim_path(), ccb, ccb::ccb_h, ccb_hdr::path, xpt_alloc_ccb(), xpt_create_path(), xpt_free_ccb(), xpt_path_sim_device(), and xpt_rescan().
Referenced by mmc_cam_sim_discover().
|
static |
Definition at line 812 of file mmc_xpt.c.
References cam_periph::softc.
Referenced by mmc_scan_lun().
|
static |
Definition at line 818 of file mmc_xpt.c.
References AC_FOUND_DEVICE, AC_LOST_DEVICE, mmcprobe_softc::action, CAM_DEBUG, CAM_DEBUG_PROBE, CAM_DEV_UNCONFIGURED, CAM_DIR_NONE, cam_periph_invalidate(), cam_periph_release_locked(), cam_release_devq(), mmc_params::card_cid, mmc_params::card_csd, CARD_FEATURE_18V, CARD_FEATURE_MEMORY, CARD_FEATURE_MMC, CARD_FEATURE_SD20, CARD_FEATURE_SDHC, CARD_FEATURE_SDIO, mmc_params::card_features, mmc_params::card_ocr, mmc_params::card_rca, ccb_hdr::cbfcnp, ccb::ccb_h, ccb_mmcio::cmd, ccb::cts, cts, cam_path::device, ccb_hdr::flags, cam_ed::flags, mmcprobe_softc::flags, ccb_hdr::func_code, ccb_trans_settings_mmc::host_ocr, mmcprobe_softc::host_ocr, mmc_params::io_ocr, ccb_trans_settings_mmc::ios, ccb_trans_settings_mmc::ios_valid, ccb_trans_settings::mmc, cam_ed::mmc_ident_data, MMC_PROPOSED_RCA, MMC_VCCQ, ccb::mmcio, ccb_hdr::path, cam_periph::path, ccb_hdr::pinfo, cam_pinfo::priority, PROBE_DONE, PROBE_FLAG_ACMD_SENT, PROBE_FLAG_HOST_CAN_DO_18V, PROBE_GET_CID, PROBE_GET_CSD, PROBE_GET_HOST_OCR, PROBE_GO_IDLE_STATE, PROBE_IDENTIFY, PROBE_INVALID, PROBE_MMC_INIT, PROBE_MMC_SET_RELATIVE_ADDR, PROBE_POWER_OFF, PROBE_RESET, PROBE_RESET_BUS, PROBE_SDIO_INIT, PROBE_SDIO_RESET, PROBE_SELECT_CARD, PROBE_SEND_APP_OP_COND, PROBE_SEND_IF_COND, PROBE_SEND_RELATIVE_ADDR, PROBE_SET_ACTION, PROBE_SET_CS, PROBE_SET_ID_FREQ, PROTO_MMCSD, ccb_trans_settings::proto_specific, cam_ed::protocol, ccb_hdr::retry_count, mmc_params::sdio_func_count, cam_periph::softc, ccb_hdr::timeout, xpt_acquire_device(), xpt_action(), xpt_async(), XPT_GDEV_TYPE, xpt_release_ccb(), xpt_schedule(), and XPT_SET_TRAN_SETTINGS.
Referenced by init_standard_ccb(), and mmcprobe_start().
|
static |
Definition at line 523 of file mmc_xpt.c.
References mmcprobe_softc::acmd41_count, mmcprobe_softc::action, CAM_DEBUG, CAM_DEBUG_PROBE, CAM_DEBUG_TRACE, CAM_DEV_UNCONFIGURED, cam_periph_acquire(), CAM_PRIORITY_XPT, CAM_REQ_CMP, CAM_REQ_CMP_ERR, cam_path::device, cam_ed::flags, mmcprobe_softc::flags, cam_ed::mmc_ident_data, cam_periph::path, mmcprobe_softc::periph, PROBE_IDENTIFY, PROBE_INVALID, PROBE_RESET, PROBE_SET_ACTION, mmcprobe_softc::restart, cam_periph::softc, and xpt_schedule().
Referenced by mmc_scan_lun().
|
static |
Definition at line 596 of file mmc_xpt.c.
References mmcprobe_softc::acmd41_count, mmcprobe_softc::action, CAM_DEBUG, CAM_DEBUG_PROBE, CAM_DEV_QFREEZE, CAM_DEV_UNCONFIGURED, CAM_DIR_NONE, cam_fill_mmcio(), CARD_ID_FREQUENCY, mmc_params::card_rca, ccb::ccb_h, ccb_mmcio::cmd, ccb::cpi, ccb::cts, cts, cam_path::device, ccb_hdr::flags, cam_ed::flags, mmcprobe_softc::flags, ccb_trans_settings_mmc::host_caps, mmcprobe_softc::host_ocr, init_standard_ccb(), ccb_trans_settings_mmc::ios, ccb_trans_settings_mmc::ios_valid, ccb_trans_settings::mmc, MMC_BM, MMC_BT, MMC_BW, MMC_CAP_SIGNALING_180, MMC_CLK, MMC_CS, mmc_highest_voltage(), cam_ed::mmc_ident_data, MMC_PM, MMC_PROPOSED_RCA, MMC_VDD, ccb::mmcio, mmcprobe_done(), ccb_hdr::path, cam_periph::path, PROBE_DONE, PROBE_FLAG_ACMD_SENT, PROBE_FLAG_HOST_CAN_DO_18V, PROBE_GET_CID, PROBE_GET_CSD, PROBE_GET_HOST_OCR, PROBE_GO_IDLE_STATE, PROBE_IDENTIFY, PROBE_INVALID, PROBE_MMC_INIT, PROBE_MMC_SET_RELATIVE_ADDR, PROBE_POWER_OFF, PROBE_RESET, PROBE_RESET_BUS, PROBE_SDIO_INIT, PROBE_SDIO_RESET, PROBE_SELECT_CARD, PROBE_SEND_APP_OP_COND, PROBE_SEND_IF_COND, PROBE_SEND_RELATIVE_ADDR, PROBE_SET_CS, PROBE_SET_ID_FREQ, ccb_trans_settings::proto_specific, mmcprobe_softc::restart, cam_periph::softc, ccb_mmcio::stop, xpt_action(), XPT_MMC_GET_TRAN_SETTINGS, XPT_MMC_IO, XPT_MMC_SET_TRAN_SETTINGS, xpt_path_inq(), and XPT_SET_TRAN_SETTINGS.
Referenced by mmc_scan_lun().
PERIPHDRIVER_DECLARE | ( | mmcprobe | , |
probe_driver | |||
) |
|
static |
|
static |
|
static |
|
static |
|
static |