Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F105771566
D19746.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D19746.diff
View Options
Index: head/sys/cam/cam_sim.h
===================================================================
--- head/sys/cam/cam_sim.h
+++ head/sys/cam/cam_sim.h
@@ -62,6 +62,15 @@
int max_dev_transactions,
int max_tagged_dev_transactions,
struct cam_devq *queue);
+struct cam_sim * cam_sim_alloc_dev(sim_action_func sim_action,
+ sim_poll_func sim_poll,
+ const char *sim_name,
+ void *softc,
+ device_t dev,
+ struct mtx *mtx,
+ int max_dev_transactions,
+ int max_tagged_dev_transactions,
+ struct cam_devq *queue);
void cam_sim_free(struct cam_sim *sim, int free_devq);
void cam_sim_hold(struct cam_sim *sim);
void cam_sim_release(struct cam_sim *sim);
@@ -109,6 +118,7 @@
struct callout callout;
struct cam_devq *devq; /* Device Queue to use for this SIM */
int refcount; /* References to the SIM. */
+ device_t sim_dev; /* For attached peripherals. */
};
#define CAM_SIM_LOCK(sim) mtx_lock((sim)->mtx)
Index: head/sys/cam/cam_sim.c
===================================================================
--- head/sys/cam/cam_sim.c
+++ head/sys/cam/cam_sim.c
@@ -37,6 +37,7 @@
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/bus.h>
#include <cam/cam.h>
#include <cam/cam_ccb.h>
@@ -82,6 +83,7 @@
sim->sim_name = sim_name;
sim->softc = softc;
sim->path_id = CAM_PATH_ANY;
+ sim->sim_dev = NULL; /* set only by cam_sim_alloc_dev */
sim->unit_number = unit;
sim->bus_id = 0; /* set in xpt_bus_register */
sim->max_tagged_dev_openings = max_tagged_dev_transactions;
@@ -97,6 +99,25 @@
sim->flags |= CAM_SIM_MPSAFE;
callout_init(&sim->callout, 1);
}
+ return (sim);
+}
+
+struct cam_sim *
+cam_sim_alloc_dev(sim_action_func sim_action, sim_poll_func sim_poll,
+ const char *sim_name, void *softc, device_t dev,
+ struct mtx *mtx, int max_dev_transactions,
+ int max_tagged_dev_transactions, struct cam_devq *queue)
+{
+ struct cam_sim *sim;
+
+ KASSERT(dev != NULL, ("%s: dev is null for sim_name %s softc %p\n",
+ __func__, sim_name, softc));
+
+ sim = cam_sim_alloc(sim_action, sim_poll, sim_name, softc,
+ device_get_unit(dev), mtx, max_dev_transactions,
+ max_tagged_dev_transactions, queue);
+ if (sim != NULL)
+ sim->sim_dev = dev;
return (sim);
}
Index: head/sys/dev/sdhci/sdhci.c
===================================================================
--- head/sys/dev/sdhci/sdhci.c
+++ head/sys/dev/sdhci/sdhci.c
@@ -2513,8 +2513,8 @@
goto fail;
mtx_init(&slot->sim_mtx, "sdhcisim", NULL, MTX_DEF);
- slot->sim = cam_sim_alloc(sdhci_cam_action, sdhci_cam_poll,
- "sdhci_slot", slot, device_get_unit(slot->bus),
+ slot->sim = cam_sim_alloc_dev(sdhci_cam_action, sdhci_cam_poll,
+ "sdhci_slot", slot, slot->bus,
&slot->sim_mtx, 1, 1, slot->devq);
if (slot->sim == NULL) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 11:40 AM (18 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15540941
Default Alt Text
D19746.diff (2 KB)
Attached To
Mode
D19746: Introduce sim_dev and cam_sim_alloc_dev().
Attached
Detach File
Event Timeline
Log In to Comment