Changeset View
Changeset View
Standalone View
Standalone View
head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
Show First 20 Lines • Show All 391 Lines • ▼ Show 20 Lines | bcm2835_mbox_err(device_t dev, bus_addr_t msg_phys, uint32_t resp_phys, | ||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
bcm2835_mbox_property(void *msg, size_t msg_size) | bcm2835_mbox_property(void *msg, size_t msg_size) | ||||
{ | { | ||||
struct bcm_mbox_softc *sc; | struct bcm_mbox_softc *sc; | ||||
struct msg_set_power_state *buf; | |||||
bus_dma_tag_t msg_tag; | bus_dma_tag_t msg_tag; | ||||
bus_dmamap_t msg_map; | bus_dmamap_t msg_map; | ||||
bus_addr_t msg_phys; | bus_addr_t msg_phys; | ||||
char *buf; | |||||
uint32_t reg; | uint32_t reg; | ||||
device_t mbox; | device_t mbox; | ||||
int err; | int err; | ||||
/* get mbox device */ | /* get mbox device */ | ||||
mbox = devclass_get_device(devclass_find("mbox"), 0); | mbox = devclass_get_device(devclass_find("mbox"), 0); | ||||
if (mbox == NULL) | if (mbox == NULL) | ||||
return (ENXIO); | return (ENXIO); | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | bcm2835_mbox_set_power_state(uint32_t device_id, boolean_t on) | ||||
msg.end_tag = 0; | msg.end_tag = 0; | ||||
err = bcm2835_mbox_property(&msg, sizeof(msg)); | err = bcm2835_mbox_property(&msg, sizeof(msg)); | ||||
return (err); | return (err); | ||||
} | } | ||||
int | int | ||||
bcm2835_mbox_notify_xhci_reset(uint32_t pci_dev_addr) | |||||
{ | |||||
struct msg_notify_xhci_reset msg; | |||||
int err; | |||||
memset(&msg, 0, sizeof(msg)); | |||||
msg.hdr.buf_size = sizeof(msg); | |||||
msg.hdr.code = BCM2835_MBOX_CODE_REQ; | |||||
msg.tag_hdr.tag = BCM2835_MBOX_TAG_NOTIFY_XHCI_RESET; | |||||
msg.tag_hdr.val_buf_size = sizeof(msg.body); | |||||
msg.tag_hdr.val_len = sizeof(msg.body.req); | |||||
msg.body.req.pci_device_addr = pci_dev_addr; | |||||
msg.end_tag = 0; | |||||
err = bcm2835_mbox_property(&msg, sizeof(msg)); | |||||
return (err); | |||||
} | |||||
int | |||||
bcm2835_mbox_get_clock_rate(uint32_t clock_id, uint32_t *hz) | bcm2835_mbox_get_clock_rate(uint32_t clock_id, uint32_t *hz) | ||||
{ | { | ||||
struct msg_get_clock_rate msg; | struct msg_get_clock_rate msg; | ||||
int err; | int err; | ||||
memset(&msg, 0, sizeof(msg)); | memset(&msg, 0, sizeof(msg)); | ||||
msg.hdr.buf_size = sizeof(msg); | msg.hdr.buf_size = sizeof(msg); | ||||
msg.hdr.code = BCM2835_MBOX_CODE_REQ; | msg.hdr.code = BCM2835_MBOX_CODE_REQ; | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | if (err == 0) { | ||||
fb->yoffset = msg.offset.body.resp.y; | fb->yoffset = msg.offset.body.resp.y; | ||||
fb->pitch = msg.pitch.body.resp.pitch; | fb->pitch = msg.pitch.body.resp.pitch; | ||||
fb->base = VCBUS_TO_ARMC(msg.buffer.body.resp.fb_address); | fb->base = VCBUS_TO_ARMC(msg.buffer.body.resp.fb_address); | ||||
fb->size = msg.buffer.body.resp.fb_size; | fb->size = msg.buffer.body.resp.fb_size; | ||||
} | } | ||||
return (err); | return (err); | ||||
} | } | ||||