···3939 unsigned int flag;4040};41414242-4242+/* The default host entry. This must succeed. */4343int hpsb_default_host_entry(struct hpsb_host *host)4444{4545 struct csr1212_keyval *root;···170170 NULL,171171};172172173173-173173+/* Initialize all config roms */174174int hpsb_init_config_roms(void)175175{176176 int i, error = 0;···191191 return error;192192}193193194194+/* Cleanup all config roms */194195void hpsb_cleanup_config_roms(void)195196{196197 int i;···202201 }203202}204203204204+/* Add extra config roms to specified host */205205int hpsb_add_extra_config_roms(struct hpsb_host *host)206206{207207 int i, error = 0;···221219 return error;222220}223221222222+/* Remove extra config roms from specified host */224223void hpsb_remove_extra_config_roms(struct hpsb_host *host)225224{226225 int i;
-10
drivers/ieee1394/config_roms.h
···44#include "ieee1394_types.h"55#include "hosts.h"6677-/* The default host entry. This must succeed. */87int hpsb_default_host_entry(struct hpsb_host *host);99-1010-/* Initialize all config roms */118int hpsb_init_config_roms(void);1212-1313-/* Cleanup all config roms */149void hpsb_cleanup_config_roms(void);1515-1616-/* Add extra config roms to specified host */1710int hpsb_add_extra_config_roms(struct hpsb_host *host);1818-1919-/* Remove extra config roms from specified host */2011void hpsb_remove_extra_config_roms(struct hpsb_host *host);2121-22122313/* List of flags to check if a host contains a certain extra config rom2414 * entry. Available in the host->config_roms member. */
+24
drivers/ieee1394/dma.c
···62626363/* dma_region */64646565+/**6666+ * dma_region_init - clear out all fields but do not allocate anything6767+ */6568void dma_region_init(struct dma_region *dma)6669{6770 dma->kvirt = NULL;···7471 dma->sglist = NULL;7572}76737474+/**7575+ * dma_region_alloc - allocate the buffer and map it to the IOMMU7676+ */7777int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes,7878 struct pci_dev *dev, int direction)7979{···134128 return -ENOMEM;135129}136130131131+/**132132+ * dma_region_free - unmap and free the buffer133133+ */137134void dma_region_free(struct dma_region *dma)138135{139136 if (dma->n_dma_pages) {···176167 return i;177168}178169170170+/**171171+ * dma_region_offset_to_bus - get bus address of an offset within a DMA region172172+ *173173+ * Returns the DMA bus address of the byte with the given @offset relative to174174+ * the beginning of the @dma.175175+ */179176dma_addr_t dma_region_offset_to_bus(struct dma_region * dma,180177 unsigned long offset)181178{···192177 return sg_dma_address(sg) + rem;193178}194179180180+/**181181+ * dma_region_sync_for_cpu - sync the CPU's view of the buffer182182+ */195183void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset,196184 unsigned long len)197185{···211193 dma->direction);212194}213195196196+/**197197+ * dma_region_sync_for_device - sync the IO bus' view of the buffer198198+ */214199void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset,215200 unsigned long len)216201{···265244 .nopage = dma_region_pagefault,266245};267246247247+/**248248+ * dma_region_mmap - map the buffer into a user space process249249+ */268250int dma_region_mmap(struct dma_region *dma, struct file *file,269251 struct vm_area_struct *vma)270252{
+6-18
drivers/ieee1394/dma.h
···6666 int direction;6767};68686969-/* clear out all fields but do not allocate anything */7069void dma_region_init(struct dma_region *dma);7171-7272-/* allocate the buffer and map it to the IOMMU */7370int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes,7471 struct pci_dev *dev, int direction);7575-7676-/* unmap and free the buffer */7772void dma_region_free(struct dma_region *dma);7878-7979-/* sync the CPU's view of the buffer */8073void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset,8174 unsigned long len);8282-8383-/* sync the IO bus' view of the buffer */8475void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset,8576 unsigned long len);8686-8787-/* map the buffer into a user space process */8877int dma_region_mmap(struct dma_region *dma, struct file *file,8978 struct vm_area_struct *vma);9090-9191-/* macro to index into a DMA region (or dma_prog_region) */9292-#define dma_region_i(_dma, _type, _index) \9393- ( ((_type*) ((_dma)->kvirt)) + (_index) )9494-9595-/* return the DMA bus address of the byte with the given offset9696- * relative to the beginning of the dma_region */9779dma_addr_t dma_region_offset_to_bus(struct dma_region *dma,9880 unsigned long offset);8181+8282+/**8383+ * dma_region_i - macro to index into a DMA region (or dma_prog_region)8484+ */8585+#define dma_region_i(_dma, _type, _index) \8686+ ( ((_type*) ((_dma)->kvirt)) + (_index) )998710088#endif /* IEEE1394_DMA_H */
+86-3
drivers/ieee1394/highlevel.c
···7070 return NULL;7171}72727373-/* Returns a per host/driver data structure that was previously stored by7474- * hpsb_create_hostinfo. */7373+/**7474+ * hpsb_get_hostinfo - retrieve a hostinfo pointer bound to this driver/host7575+ *7676+ * Returns a per @host and @hl driver data structure that was previously stored7777+ * by hpsb_create_hostinfo.7878+ */7579void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host)7680{7781 struct hl_host_info *hi = hl_get_hostinfo(hl, host);···8379 return hi ? hi->data : NULL;8480}85818686-/* If size is zero, then the return here is only valid for error checking */8282+/**8383+ * hpsb_create_hostinfo - allocate a hostinfo pointer bound to this driver/host8484+ *8585+ * Allocate a hostinfo pointer backed by memory with @data_size and bind it to8686+ * to this @hl driver and @host. If @data_size is zero, then the return here is8787+ * only valid for error checking.8888+ */8789void *hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,8890 size_t data_size)8991{···123113 return data;124114}125115116116+/**117117+ * hpsb_set_hostinfo - set the hostinfo pointer to something useful118118+ *119119+ * Usually follows a call to hpsb_create_hostinfo, where the size is 0.120120+ */126121int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,127122 void *data)128123{···147132 return -EINVAL;148133}149134135135+/**136136+ * hpsb_destroy_hostinfo - free and remove a hostinfo pointer137137+ *138138+ * Free and remove the hostinfo pointer bound to this @hl driver and @host.139139+ */150140void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host)151141{152142 struct hl_host_info *hi;···167147 return;168148}169149150150+/**151151+ * hpsb_set_hostinfo_key - set an alternate lookup key for an hostinfo152152+ *153153+ * Sets an alternate lookup key for the hostinfo bound to this @hl driver and154154+ * @host.155155+ */170156void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host,171157 unsigned long key)172158{···184158 return;185159}186160161161+/**162162+ * hpsb_get_hostinfo_bykey - retrieve a hostinfo pointer by its alternate key163163+ */187164void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key)188165{189166 struct hl_host_info *hi;···218189 return 0;219190}220191192192+/**193193+ * hpsb_register_highlevel - register highlevel driver194194+ *195195+ * The name pointer in @hl has to stay valid at all times because the string is196196+ * not copied.197197+ */221198void hpsb_register_highlevel(struct hpsb_highlevel *hl)222199{223200 unsigned long flags;···293258 return 0;294259}295260261261+/**262262+ * hpsb_unregister_highlevel - unregister highlevel driver263263+ */296264void hpsb_unregister_highlevel(struct hpsb_highlevel *hl)297265{298266 unsigned long flags;···311273 nodemgr_for_each_host(hl, highlevel_for_each_host_unreg);312274}313275276276+/**277277+ * hpsb_allocate_and_register_addrspace - alloc' and reg' a host address space278278+ *279279+ * @start and @end are 48 bit pointers and have to be quadlet aligned.280280+ * @end points to the first address behind the handled addresses. This281281+ * function can be called multiple times for a single hpsb_highlevel @hl to282282+ * implement sparse register sets. The requested region must not overlap any283283+ * previously allocated region, otherwise registering will fail.284284+ *285285+ * It returns true for successful allocation. Address spaces can be286286+ * unregistered with hpsb_unregister_addrspace. All remaining address spaces287287+ * are automatically deallocated together with the hpsb_highlevel @hl.288288+ */314289u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,315290 struct hpsb_host *host,316291 struct hpsb_address_ops *ops,···399348 return retval;400349}401350351351+/**352352+ * hpsb_register_addrspace - register a host address space353353+ *354354+ * @start and @end are 48 bit pointers and have to be quadlet aligned.355355+ * @end points to the first address behind the handled addresses. This356356+ * function can be called multiple times for a single hpsb_highlevel @hl to357357+ * implement sparse register sets. The requested region must not overlap any358358+ * previously allocated region, otherwise registering will fail.359359+ *360360+ * It returns true for successful allocation. Address spaces can be361361+ * unregistered with hpsb_unregister_addrspace. All remaining address spaces362362+ * are automatically deallocated together with the hpsb_highlevel @hl.363363+ */402364int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,403365 struct hpsb_address_ops *ops, u64 start, u64 end)404366{···483419 return retval;484420}485421422422+/**423423+ * hpsb_listen_channel - enable receving a certain isochronous channel424424+ *425425+ * Reception is handled through the @hl's iso_receive op.426426+ */486427int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,487428 unsigned int channel)488429{···500431 return 0;501432}502433434434+/**435435+ * hpsb_unlisten_channel - disable receving a certain isochronous channel436436+ */503437void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,504438 unsigned int channel)505439{···600528 read_unlock_irqrestore(&hl_irqs_lock, flags);601529}602530531531+/*532532+ * highlevel_read, highlevel_write, highlevel_lock, highlevel_lock64:533533+ *534534+ * These functions are called to handle transactions. They are called when a535535+ * packet arrives. The flags argument contains the second word of the first536536+ * header quadlet of the incoming packet (containing transaction label, retry537537+ * code, transaction code and priority). These functions either return a538538+ * response code or a negative number. In the first case a response will be539539+ * generated. In the latter case, no response will be sent and the driver which540540+ * handled the request will send the response itself.541541+ */603542int highlevel_read(struct hpsb_host *host, int nodeid, void *data, u64 addr,604543 unsigned int length, u16 flags)605544{
+1-45
drivers/ieee1394/highlevel.h
···9999void highlevel_add_host(struct hpsb_host *host);100100void highlevel_remove_host(struct hpsb_host *host);101101void highlevel_host_reset(struct hpsb_host *host);102102-103103-/*104104- * These functions are called to handle transactions. They are called when a105105- * packet arrives. The flags argument contains the second word of the first106106- * header quadlet of the incoming packet (containing transaction label, retry107107- * code, transaction code and priority). These functions either return a108108- * response code or a negative number. In the first case a response will be109109- * generated. In the latter case, no response will be sent and the driver which110110- * handled the request will send the response itself.111111- */112102int highlevel_read(struct hpsb_host *host, int nodeid, void *data, u64 addr,113103 unsigned int length, u16 flags);114104int highlevel_write(struct hpsb_host *host, int nodeid, int destid, void *data,···109119int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store,110120 u64 addr, octlet_t data, octlet_t arg, int ext_tcode,111121 u16 flags);112112-113122void highlevel_iso_receive(struct hpsb_host *host, void *data, size_t length);114123void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,115124 void *data, size_t length);116125117117-/*118118- * Register highlevel driver. The name pointer has to stay valid at all times119119- * because the string is not copied.120120- */121126void hpsb_register_highlevel(struct hpsb_highlevel *hl);122127void hpsb_unregister_highlevel(struct hpsb_highlevel *hl);123128124124-/*125125- * Register handlers for host address spaces. Start and end are 48 bit pointers126126- * and have to be quadlet aligned. Argument "end" points to the first address127127- * behind the handled addresses. This function can be called multiple times for128128- * a single hpsb_highlevel to implement sparse register sets. The requested129129- * region must not overlap any previously allocated region, otherwise130130- * registering will fail.131131- *132132- * It returns true for successful allocation. Address spaces can be133133- * unregistered with hpsb_unregister_addrspace. All remaining address spaces134134- * are automatically deallocated together with the hpsb_highlevel.135135- */136129u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,137130 struct hpsb_host *host,138131 struct hpsb_address_ops *ops,···125152 struct hpsb_address_ops *ops, u64 start, u64 end);126153int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,127154 u64 start);128128-129129-/*130130- * Enable or disable receving a certain isochronous channel through the131131- * iso_receive op.132132- */133155int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,134134- unsigned int channel);156156+ unsigned int channel);135157void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,136158 unsigned int channel);137159138138-/* Retrieve a hostinfo pointer bound to this driver/host */139160void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host);140140-141141-/* Allocate a hostinfo pointer of data_size bound to this driver/host */142161void *hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,143162 size_t data_size);144144-145145-/* Free and remove the hostinfo pointer bound to this driver/host */146163void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host);147147-148148-/* Set an alternate lookup key for the hostinfo bound to this driver/host */149164void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host,150165 unsigned long key);151151-152152-/* Retrieve a hostinfo pointer bound to this driver using its alternate key */153166void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key);154154-155155-/* Set the hostinfo pointer to something useful. Usually follows a call to156156- * hpsb_create_hostinfo, where the size is 0. */157167int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,158168 void *data);159169
+8
drivers/ieee1394/hosts.c
···218218 device_unregister(&host->device);219219}220220221221+/**222222+ * hpsb_update_config_rom_image - updates configuration ROM image of a host223223+ *224224+ * Updates the configuration ROM image of a host. rom_version must be the225225+ * current version, otherwise it will fail with return value -1. If this226226+ * host does not support config-rom-update, it will return -%EINVAL.227227+ * Return value 0 indicates success.228228+ */221229int hpsb_update_config_rom_image(struct hpsb_host *host)222230{223231 unsigned long reset_delay;
-6
drivers/ieee1394/hosts.h
···202202int hpsb_add_host(struct hpsb_host *host);203203void hpsb_resume_host(struct hpsb_host *host);204204void hpsb_remove_host(struct hpsb_host *host);205205-206206-/* Updates the configuration rom image of a host. rom_version must be the207207- * current version, otherwise it will fail with return value -1. If this208208- * host does not support config-rom-update, it will return -EINVAL.209209- * Return value 0 indicates success.210210- */211205int hpsb_update_config_rom_image(struct hpsb_host *host);212206213207#endif /* _IEEE1394_HOSTS_H */
+69-8
drivers/ieee1394/ieee1394_core.c
···969697979898/**9999- * hpsb_set_packet_complete_task - set the task that runs when a packet100100- * completes. You cannot call this more than once on a single packet101101- * before it is sent.102102- *9999+ * hpsb_set_packet_complete_task - set task that runs when a packet completes103100 * @packet: the packet whose completion we want the task added to104101 * @routine: function to call105102 * @data: data (if any) to pass to the above function103103+ *104104+ * Set the task that runs when a packet completes. You cannot call this more105105+ * than once on a single packet before it is sent.106106 */107107void hpsb_set_packet_complete_task(struct hpsb_packet *packet,108108 void (*routine)(void *), void *data)···179179}180180181181182182+/**183183+ * hpsb_reset_bus - initiate bus reset on the given host184184+ * @host: host controller whose bus to reset185185+ * @type: one of enum reset_types186186+ *187187+ * Returns 1 if bus reset already in progress, 0 otherwise.188188+ */182189int hpsb_reset_bus(struct hpsb_host *host, int type)183190{184191 if (!host->in_bus_reset) {···236229 return 0;237230}238231232232+/**233233+ * hpsb_bus_reset - notify a bus reset to the core234234+ *235235+ * For host driver module usage. Safe to use in interrupt context, although236236+ * quite complex; so you may want to run it in the bottom rather than top half.237237+ *238238+ * Returns 1 if bus reset already in progress, 0 otherwise.239239+ */239240int hpsb_bus_reset(struct hpsb_host *host)240241{241242 if (host->in_bus_reset) {···420405}421406422407408408+/**409409+ * hpsb_selfid_received - hand over received selfid packet to the core410410+ *411411+ * For host driver module usage. Safe to use in interrupt context.412412+ *413413+ * The host driver should have done a successful complement check (second414414+ * quadlet is complement of first) beforehand.415415+ */423416void hpsb_selfid_received(struct hpsb_host *host, quadlet_t sid)424417{425418 if (host->in_bus_reset) {···439416 }440417}441418419419+/**420420+ * hpsb_selfid_complete - notify completion of SelfID stage to the core421421+ *422422+ * For host driver module usage. Safe to use in interrupt context, although423423+ * quite complex; so you may want to run it in the bottom rather than top half.424424+ *425425+ * Notify completion of SelfID stage to the core and report new physical ID426426+ * and whether host is root now.427427+ */442428void hpsb_selfid_complete(struct hpsb_host *host, int phyid, int isroot)443429{444430 if (!host->in_bus_reset)···494462 highlevel_host_reset(host);495463}496464497497-465465+/**466466+ * hpsb_packet_sent - notify core of sending a packet467467+ *468468+ * For host driver module usage. Safe to call from within a transmit packet469469+ * routine.470470+ *471471+ * Notify core of sending a packet. Ackcode is the ack code returned for async472472+ * transmits or ACKX_SEND_ERROR if the transmission failed completely; ACKX_NONE473473+ * for other cases (internal errors that don't justify a panic).474474+ */498475void hpsb_packet_sent(struct hpsb_host *host, struct hpsb_packet *packet,499476 int ackcode)500477{···545504 * @rootid: root whose force_root bit should get set (-1 = don't set force_root)546505 * @gapcnt: gap count value to set (-1 = don't set gap count)547506 *548548- * This function sends a PHY config packet on the bus through the specified host.507507+ * This function sends a PHY config packet on the bus through the specified508508+ * host.549509 *550550- * Return value: 0 for success or error number otherwise.510510+ * Return value: 0 for success or negative error number otherwise.551511 */552512int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt)553513{···663621 complete((struct completion *) data);664622}665623624624+/**625625+ * hpsb_send_packet_and_wait - enqueue packet, block until transaction completes626626+ * @packet: packet to send627627+ *628628+ * Return value: 0 on success, negative errno on failure.629629+ */666630int hpsb_send_packet_and_wait(struct hpsb_packet *packet)667631{668632 struct completion done;···983935}984936#undef PREP_REPLY_PACKET985937986986-938938+/**939939+ * hpsb_packet_received - hand over received packet to the core940940+ *941941+ * For host driver module usage.942942+ *943943+ * The contents of data are expected to be the full packet but with the CRCs944944+ * left out (data block follows header immediately), with the header (i.e. the945945+ * first four quadlets) in machine byte order and the data block in big endian.946946+ * *@data can be safely overwritten after this call.947947+ *948948+ * If the packet is a write request, @write_acked is to be set to true if it was949949+ * ack_complete'd already, false otherwise. This argument is ignored for any950950+ * other packet type.951951+ */987952void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size,988953 int write_acked)989954{
+7-66
drivers/ieee1394/ieee1394_core.h
···8080 quadlet_t embedded_header[5];8181};82828383-/* Set a task for when a packet completes */8483void hpsb_set_packet_complete_task(struct hpsb_packet *packet,8584 void (*routine)(void *), void *data);8686-8785static inline struct hpsb_packet *driver_packet(struct list_head *l)8886{8987 return list_entry(l, struct hpsb_packet, driver_list);9088}9191-9289void abort_timedouts(unsigned long __opaque);9393-9490struct hpsb_packet *hpsb_alloc_packet(size_t data_size);9591void hpsb_free_packet(struct hpsb_packet *packet);96929797-/*9898- * Generation counter for the complete 1394 subsystem. Generation gets9999- * incremented on every change in the subsystem (e.g. bus reset).9393+/**9494+ * get_hpsb_generation - generation counter for the complete 1394 subsystem10095 *101101- * Use the functions, not the variable.9696+ * Generation gets incremented on every change in the subsystem (notably on bus9797+ * resets). Use the functions, not the variable.10298 */10399static inline unsigned int get_hpsb_generation(struct hpsb_host *host)104100{105101 return atomic_read(&host->generation);106102}107103108108-/*109109- * Send a PHY configuration packet, return 0 on success, negative110110- * errno on failure.111111- */112104int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt);113113-114114-/*115115- * Queue packet for transmitting, return 0 on success, negative errno116116- * on failure.117117- */118105int hpsb_send_packet(struct hpsb_packet *packet);119119-120120-/*121121- * Queue packet for transmitting, and block until the transaction122122- * completes. Return 0 on success, negative errno on failure.123123- */124106int hpsb_send_packet_and_wait(struct hpsb_packet *packet);125125-126126-/* Initiate bus reset on the given host. Returns 1 if bus reset already in127127- * progress, 0 otherwise. */128107int hpsb_reset_bus(struct hpsb_host *host, int type);129129-130108int hpsb_read_cycle_timer(struct hpsb_host *host, u32 *cycle_timer,131109 u64 *local_time);132110133133-/*134134- * The following functions are exported for host driver module usage. All of135135- * them are safe to use in interrupt contexts, although some are quite136136- * complicated so you may want to run them in bottom halves instead of calling137137- * them directly.138138- */139139-140140-/* Notify a bus reset to the core. Returns 1 if bus reset already in progress,141141- * 0 otherwise. */142111int hpsb_bus_reset(struct hpsb_host *host);143143-144144-/*145145- * Hand over received selfid packet to the core. Complement check (second146146- * quadlet is complement of first) is expected to be done and successful.147147- */148112void hpsb_selfid_received(struct hpsb_host *host, quadlet_t sid);149149-150150-/*151151- * Notify completion of SelfID stage to the core and report new physical ID152152- * and whether host is root now.153153- */154113void hpsb_selfid_complete(struct hpsb_host *host, int phyid, int isroot);155155-156156-/*157157- * Notify core of sending a packet. Ackcode is the ack code returned for async158158- * transmits or ACKX_SEND_ERROR if the transmission failed completely; ACKX_NONE159159- * for other cases (internal errors that don't justify a panic). Safe to call160160- * from within a transmit packet routine.161161- */162114void hpsb_packet_sent(struct hpsb_host *host, struct hpsb_packet *packet,163115 int ackcode);164164-165165-/*166166- * Hand over received packet to the core. The contents of data are expected to167167- * be the full packet but with the CRCs left out (data block follows header168168- * immediately), with the header (i.e. the first four quadlets) in machine byte169169- * order and the data block in big endian. *data can be safely overwritten170170- * after this call.171171- *172172- * If the packet is a write request, write_acked is to be set to true if it was173173- * ack_complete'd already, false otherwise. This arg is ignored for any other174174- * packet type.175175- */176116void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size,177117 int write_acked);178178-179118180119/*181120 * CHARACTER DEVICE DISPATCHING···156217#define IEEE1394_EXPERIMENTAL_DEV MKDEV(IEEE1394_MAJOR, \157218 IEEE1394_MINOR_BLOCK_EXPERIMENTAL * 16)158219159159-/* return the index (within a minor number block) of a file */220220+/**221221+ * ieee1394_file_to_instance - get the index within a minor number block222222+ */160223static inline unsigned char ieee1394_file_to_instance(struct file *file)161224{162225 return file->f_path.dentry->d_inode->i_cindex;
+29
drivers/ieee1394/ieee1394_transactions.c
···212212 wake_up_interruptible(&tlabel_wq);213213}214214215215+/**216216+ * hpsb_packet_success - Make sense of the ack and reply codes217217+ *218218+ * Make sense of the ack and reply codes and return more convenient error codes:219219+ * 0 = success. -%EBUSY = node is busy, try again. -%EAGAIN = error which can220220+ * probably resolved by retry. -%EREMOTEIO = node suffers from an internal221221+ * error. -%EACCES = this transaction is not allowed on requested address.222222+ * -%EINVAL = invalid address at node.223223+ */215224int hpsb_packet_success(struct hpsb_packet *packet)216225{217226 switch (packet->ack_code) {···502493 * avoid in kernel buffers for user space callers503494 */504495496496+/**497497+ * hpsb_read - generic read function498498+ *499499+ * Recognizes the local node ID and act accordingly. Automatically uses a500500+ * quadlet read request if @length == 4 and and a block read request otherwise.501501+ * It does not yet support lengths that are not a multiple of 4.502502+ *503503+ * You must explicitly specifiy the @generation for which the node ID is valid,504504+ * to avoid sending packets to the wrong nodes when we race with a bus reset.505505+ */505506int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,506507 u64 addr, quadlet_t * buffer, size_t length)507508{···551532 return retval;552533}553534535535+/**536536+ * hpsb_write - generic write function537537+ *538538+ * Recognizes the local node ID and act accordingly. Automatically uses a539539+ * quadlet write request if @length == 4 and and a block write request540540+ * otherwise. It does not yet support lengths that are not a multiple of 4.541541+ *542542+ * You must explicitly specifiy the @generation for which the node ID is valid,543543+ * to avoid sending packets to the wrong nodes when we race with a bus reset.544544+ */554545int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,555546 u64 addr, quadlet_t * buffer, size_t length)556547{
-20
drivers/ieee1394/ieee1394_transactions.h
···2727struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer,2828 int length, int channel, int tag,2929 int sync);3030-3131-/*3232- * hpsb_packet_success - Make sense of the ack and reply codes and3333- * return more convenient error codes:3434- * 0 success3535- * -EBUSY node is busy, try again3636- * -EAGAIN error which can probably resolved by retry3737- * -EREMOTEIO node suffers from an internal error3838- * -EACCES this transaction is not allowed on requested address3939- * -EINVAL invalid address at node4040- */4130int hpsb_packet_success(struct hpsb_packet *packet);4242-4343-/*4444- * The generic read and write functions. All recognize the local node ID4545- * and act accordingly. Read and write automatically use quadlet commands if4646- * length == 4 and and block commands otherwise (however, they do not yet4747- * support lengths that are not a multiple of 4). You must explicitly specifiy4848- * the generation for which the node ID is valid, to avoid sending packets to4949- * the wrong nodes when we race with a bus reset.5050- */5131int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,5232 u64 addr, quadlet_t *buffer, size_t length);5333int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
+82-2
drivers/ieee1394/iso.c
···1515#include "hosts.h"1616#include "iso.h"17171818+/**1919+ * hpsb_iso_stop - stop DMA2020+ */1821void hpsb_iso_stop(struct hpsb_iso *iso)1922{2023 if (!(iso->flags & HPSB_ISO_DRIVER_STARTED))···2825 iso->flags &= ~HPSB_ISO_DRIVER_STARTED;2926}30272828+/**2929+ * hpsb_iso_shutdown - deallocate buffer and DMA context3030+ */3131void hpsb_iso_shutdown(struct hpsb_iso *iso)3232{3333 if (iso->flags & HPSB_ISO_DRIVER_INIT) {···136130 return NULL;137131}138132133133+/**134134+ * hpsb_iso_n_ready - returns number of packets ready to send or receive135135+ */139136int hpsb_iso_n_ready(struct hpsb_iso *iso)140137{141138 unsigned long flags;···151142 return val;152143}153144145145+/**146146+ * hpsb_iso_xmit_init - allocate the buffer and DMA context147147+ */154148struct hpsb_iso *hpsb_iso_xmit_init(struct hpsb_host *host,155149 unsigned int data_buf_size,156150 unsigned int buf_packets,···184172 return NULL;185173}186174175175+/**176176+ * hpsb_iso_recv_init - allocate the buffer and DMA context177177+ *178178+ * Note, if channel = -1, multi-channel receive is enabled.179179+ */187180struct hpsb_iso *hpsb_iso_recv_init(struct hpsb_host *host,188181 unsigned int data_buf_size,189182 unsigned int buf_packets,···216199 return NULL;217200}218201202202+/**203203+ * hpsb_iso_recv_listen_channel204204+ *205205+ * multi-channel only206206+ */219207int hpsb_iso_recv_listen_channel(struct hpsb_iso *iso, unsigned char channel)220208{221209 if (iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64)···228206 return iso->host->driver->isoctl(iso, RECV_LISTEN_CHANNEL, channel);229207}230208209209+/**210210+ * hpsb_iso_recv_unlisten_channel211211+ *212212+ * multi-channel only213213+ */231214int hpsb_iso_recv_unlisten_channel(struct hpsb_iso *iso, unsigned char channel)232215{233216 if (iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64)···240213 return iso->host->driver->isoctl(iso, RECV_UNLISTEN_CHANNEL, channel);241214}242215216216+/**217217+ * hpsb_iso_recv_set_channel_mask218218+ *219219+ * multi-channel only220220+ */243221int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask)244222{245223 if (iso->type != HPSB_ISO_RECV || iso->channel != -1)···253221 (unsigned long)&mask);254222}255223224224+/**225225+ * hpsb_iso_recv_flush - check for arrival of new packets226226+ *227227+ * check for arrival of new packets immediately (even if irq_interval228228+ * has not yet been reached)229229+ */256230int hpsb_iso_recv_flush(struct hpsb_iso *iso)257231{258232 if (iso->type != HPSB_ISO_RECV)···276238 return retval;277239}278240241241+/**242242+ * hpsb_iso_xmit_start - start DMA243243+ */279244int hpsb_iso_xmit_start(struct hpsb_iso *iso, int cycle, int prebuffer)280245{281246 if (iso->type != HPSB_ISO_XMIT)···311270 return 0;312271}313272273273+/**274274+ * hpsb_iso_recv_start - start DMA275275+ */314276int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync)315277{316278 int retval = 0;···350306}351307352308/* check to make sure the user has not supplied bogus values of offset/len353353- that would cause the kernel to access memory outside the buffer */354354-309309+ * that would cause the kernel to access memory outside the buffer */355310static int hpsb_iso_check_offset_len(struct hpsb_iso *iso,356311 unsigned int offset, unsigned short len,357312 unsigned int *out_offset,···374331 return 0;375332}376333334334+/**335335+ * hpsb_iso_xmit_queue_packet - queue a packet for transmission.336336+ *337337+ * @offset is relative to the beginning of the DMA buffer, where the packet's338338+ * data payload should already have been placed.339339+ */377340int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len,378341 u8 tag, u8 sy)379342{···429380 return rv;430381}431382383383+/**384384+ * hpsb_iso_xmit_sync - wait until all queued packets have been transmitted385385+ */432386int hpsb_iso_xmit_sync(struct hpsb_iso *iso)433387{434388 if (iso->type != HPSB_ISO_XMIT)···442390 iso->buf_packets);443391}444392393393+/**394394+ * hpsb_iso_packet_sent395395+ *396396+ * Available to low-level drivers.397397+ *398398+ * Call after a packet has been transmitted to the bus (interrupt context is399399+ * OK). @cycle is the _exact_ cycle the packet was sent on. @error should be400400+ * non-zero if some sort of error occurred when sending the packet.401401+ */445402void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error)446403{447404 unsigned long flags;···474413 spin_unlock_irqrestore(&iso->lock, flags);475414}476415416416+/**417417+ * hpsb_iso_packet_received418418+ *419419+ * Available to low-level drivers.420420+ *421421+ * Call after a packet has been received (interrupt context is OK).422422+ */477423void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len,478424 u16 total_len, u16 cycle, u8 channel, u8 tag,479425 u8 sy)···510442 spin_unlock_irqrestore(&iso->lock, flags);511443}512444445445+/**446446+ * hpsb_iso_recv_release_packets - release packets, reuse buffer447447+ *448448+ * @n_packets have been read out of the buffer, re-use the buffer space449449+ */513450int hpsb_iso_recv_release_packets(struct hpsb_iso *iso, unsigned int n_packets)514451{515452 unsigned long flags;···550477 return rv;551478}552479480480+/**481481+ * hpsb_iso_wake482482+ *483483+ * Available to low-level drivers.484484+ *485485+ * Call to wake waiting processes after buffer space has opened up.486486+ */553487void hpsb_iso_wake(struct hpsb_iso *iso)554488{555489 wake_up_interruptible(&iso->waitq);
+2-33
drivers/ieee1394/iso.h
···150150151151/* functions available to high-level drivers (e.g. raw1394) */152152153153-/* allocate the buffer and DMA context */154154-155153struct hpsb_iso* hpsb_iso_xmit_init(struct hpsb_host *host,156154 unsigned int data_buf_size,157155 unsigned int buf_packets,···157159 int speed,158160 int irq_interval,159161 void (*callback)(struct hpsb_iso*));160160-161161-/* note: if channel = -1, multi-channel receive is enabled */162162struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host,163163 unsigned int data_buf_size,164164 unsigned int buf_packets,···164168 int dma_mode,165169 int irq_interval,166170 void (*callback)(struct hpsb_iso*));167167-168168-/* multi-channel only */169171int hpsb_iso_recv_listen_channel(struct hpsb_iso *iso, unsigned char channel);170172int hpsb_iso_recv_unlisten_channel(struct hpsb_iso *iso, unsigned char channel);171173int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask);172172-173173-/* start/stop DMA */174174int hpsb_iso_xmit_start(struct hpsb_iso *iso, int start_on_cycle,175175 int prebuffer);176176int hpsb_iso_recv_start(struct hpsb_iso *iso, int start_on_cycle,177177 int tag_mask, int sync);178178void hpsb_iso_stop(struct hpsb_iso *iso);179179-180180-/* deallocate buffer and DMA context */181179void hpsb_iso_shutdown(struct hpsb_iso *iso);182182-183183-/* queue a packet for transmission.184184- * 'offset' is relative to the beginning of the DMA buffer, where the packet's185185- * data payload should already have been placed. */186180int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len,187181 u8 tag, u8 sy);188188-189189-/* wait until all queued packets have been transmitted to the bus */190182int hpsb_iso_xmit_sync(struct hpsb_iso *iso);191191-192192-/* N packets have been read out of the buffer, re-use the buffer space */193193-int hpsb_iso_recv_release_packets(struct hpsb_iso *recv,194194- unsigned int n_packets);195195-196196-/* check for arrival of new packets immediately (even if irq_interval197197- * has not yet been reached) */183183+int hpsb_iso_recv_release_packets(struct hpsb_iso *recv,184184+ unsigned int n_packets);198185int hpsb_iso_recv_flush(struct hpsb_iso *iso);199199-200200-/* returns # of packets ready to send or receive */201186int hpsb_iso_n_ready(struct hpsb_iso *iso);202187203188/* the following are callbacks available to low-level drivers */204189205205-/* call after a packet has been transmitted to the bus (interrupt context is OK)206206- * 'cycle' is the _exact_ cycle the packet was sent on207207- * 'error' should be non-zero if some sort of error occurred when sending the208208- * packet */209190void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error);210210-211211-/* call after a packet has been received (interrupt context OK) */212191void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len,213192 u16 total_len, u16 cycle, u8 channel, u8 tag,214193 u8 sy);215215-216216-/* call to wake waiting processes after buffer space has opened up. */217194void hpsb_iso_wake(struct hpsb_iso *iso);218195219196#endif /* IEEE1394_ISO_H */
+26-6
drivers/ieee1394/nodemgr.c
···17381738 return 0;17391739}1740174017411741-int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *))17411741+/**17421742+ * nodemgr_for_each_host - call a function for each IEEE 1394 host17431743+ * @data: an address to supply to the callback17441744+ * @cb: function to call for each host17451745+ *17461746+ * Iterate the hosts, calling a given function with supplied data for each host.17471747+ * If the callback fails on a host, i.e. if it returns a non-zero value, the17481748+ * iteration is stopped.17491749+ *17501750+ * Return value: 0 on success, non-zero on failure (same as returned by last run17511751+ * of the callback).17521752+ */17531753+int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *))17421754{17431755 struct class_device *cdev;17441756 struct hpsb_host *host;···17601748 list_for_each_entry(cdev, &hpsb_host_class.children, node) {17611749 host = container_of(cdev, struct hpsb_host, class_dev);1762175017631763- if ((error = cb(host, __data)))17511751+ if ((error = cb(host, data)))17641752 break;17651753 }17661754 up(&hpsb_host_class.sem);···17831771 * ID's.17841772 */1785177317861786-void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *pkt)17741774+/**17751775+ * hpsb_node_fill_packet - fill some destination information into a packet17761776+ * @ne: destination node17771777+ * @packet: packet to fill in17781778+ *17791779+ * This will fill in the given, pre-initialised hpsb_packet with the current17801780+ * information from the node entry (host, node ID, bus generation number).17811781+ */17821782+void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *packet)17871783{17881788- pkt->host = ne->host;17891789- pkt->generation = ne->generation;17841784+ packet->host = ne->host;17851785+ packet->generation = ne->generation;17901786 barrier();17911791- pkt->node_id = ne->nodeid;17871787+ packet->node_id = ne->nodeid;17921788}1793178917941790int hpsb_node_write(struct node_entry *ne, u64 addr,
+2-18
drivers/ieee1394/nodemgr.h
···153153{154154 return ne->generation == get_hpsb_generation(ne->host);155155}156156-157157-/*158158- * This will fill in the given, pre-initialised hpsb_packet with the current159159- * information from the node entry (host, node ID, generation number). It will160160- * return false if the node owning the GUID is not accessible (and not modify161161- * the hpsb_packet) and return true otherwise.162162- *163163- * Note that packet sending may still fail in hpsb_send_packet if a bus reset164164- * happens while you are trying to set up the packet (due to obsolete generation165165- * number). It will at least reliably fail so that you don't accidentally and166166- * unknowingly send your packet to the wrong node.167167- */168168-void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *pkt);169169-156156+void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *packet);170157int hpsb_node_write(struct node_entry *ne, u64 addr,171158 quadlet_t *buffer, size_t length);172172-173173-/* Iterate the hosts, calling a given function with supplied data for each174174- * host. */175175-int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *));159159+int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *));176160177161int init_ieee1394_nodemgr(void);178162void cleanup_ieee1394_nodemgr(void);
+1
drivers/ieee1394/ohci1394.c
···36583658/* essentially the only purpose of this code is to allow another36593659 module to hook into ohci's interrupt handler */3660366036613661+/* returns zero if successful, one if DMA context is locked up */36613662int ohci1394_stop_context(struct ti_ohci *ohci, int reg, char *msg)36623663{36633664 int i=0;
+1-3
drivers/ieee1394/ohci1394.h
···461461 struct ohci1394_iso_tasklet *tasklet);462462void ohci1394_unregister_iso_tasklet(struct ti_ohci *ohci,463463 struct ohci1394_iso_tasklet *tasklet);464464-465465-/* returns zero if successful, one if DMA context is locked up */466466-int ohci1394_stop_context (struct ti_ohci *ohci, int reg, char *msg);464464+int ohci1394_stop_context(struct ti_ohci *ohci, int reg, char *msg);467465struct ti_ohci *ohci1394_get_struct(int card_num);468466469467#endif