disk.c (296182) | disk.c (298230) |
---|---|
1/*- 2 * Copyright (c) 2008 Semihalf, Rafal Jaworowski 3 * Copyright (c) 2009 Semihalf, Piotr Ziecik 4 * Copyright (c) 2012 Andrey V. Elsukov <ae@FreeBSD.org> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 18 unchanged lines hidden (view full) --- 27 * 28 */ 29 30/* 31 * Block storage I/O routines for U-Boot 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2008 Semihalf, Rafal Jaworowski 3 * Copyright (c) 2009 Semihalf, Piotr Ziecik 4 * Copyright (c) 2012 Andrey V. Elsukov <ae@FreeBSD.org> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 18 unchanged lines hidden (view full) --- 27 * 28 */ 29 30/* 31 * Block storage I/O routines for U-Boot 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/boot/uboot/lib/disk.c 296182 2016-02-29 07:27:49Z sgalabov $"); | 35__FBSDID("$FreeBSD: head/sys/boot/uboot/lib/disk.c 298230 2016-04-18 23:09:22Z allanjude $"); |
36 37#include <sys/param.h> 38#include <sys/disk.h> 39#include <machine/stdarg.h> 40#include <stand.h> 41 42#include "api_public.h" 43#include "bootstrap.h" --- 24 unchanged lines hidden (view full) --- 68#define SI(dev) (stor_info[(dev)->d_unit]) 69 70static int stor_info_no = 0; 71static int stor_opendev(struct disk_devdesc *); 72static int stor_readdev(struct disk_devdesc *, daddr_t, size_t, char *); 73 74/* devsw I/F */ 75static int stor_init(void); | 36 37#include <sys/param.h> 38#include <sys/disk.h> 39#include <machine/stdarg.h> 40#include <stand.h> 41 42#include "api_public.h" 43#include "bootstrap.h" --- 24 unchanged lines hidden (view full) --- 68#define SI(dev) (stor_info[(dev)->d_unit]) 69 70static int stor_info_no = 0; 71static int stor_opendev(struct disk_devdesc *); 72static int stor_readdev(struct disk_devdesc *, daddr_t, size_t, char *); 73 74/* devsw I/F */ 75static int stor_init(void); |
76static int stor_strategy(void *, int, daddr_t, size_t, char *, size_t *); | 76static int stor_strategy(void *, int, daddr_t, size_t, size_t, char *, 77 size_t *); |
77static int stor_open(struct open_file *, ...); 78static int stor_close(struct open_file *); 79static int stor_ioctl(struct open_file *f, u_long cmd, void *data); 80static void stor_print(int); 81static void stor_cleanup(void); 82 83struct devsw uboot_storage = { 84 "disk", --- 53 unchanged lines hidden (view full) --- 138 139 for (i = 0; i < stor_info_no; i++) 140 if (stor_info[i].opened > 0) 141 ub_dev_close(stor_info[i].handle); 142 disk_cleanup(&uboot_storage); 143} 144 145static int | 78static int stor_open(struct open_file *, ...); 79static int stor_close(struct open_file *); 80static int stor_ioctl(struct open_file *f, u_long cmd, void *data); 81static void stor_print(int); 82static void stor_cleanup(void); 83 84struct devsw uboot_storage = { 85 "disk", --- 53 unchanged lines hidden (view full) --- 139 140 for (i = 0; i < stor_info_no; i++) 141 if (stor_info[i].opened > 0) 142 ub_dev_close(stor_info[i].handle); 143 disk_cleanup(&uboot_storage); 144} 145 146static int |
146stor_strategy(void *devdata, int rw, daddr_t blk, size_t size, char *buf, 147 size_t *rsize) | 147stor_strategy(void *devdata, int rw, daddr_t blk, size_t offset, size_t size, 148 char *buf, size_t *rsize) |
148{ 149 struct disk_devdesc *dev = (struct disk_devdesc *)devdata; 150 daddr_t bcount; 151 int err; 152 153 if (rw != F_READ) { 154 stor_printf("write attempt, operation not supported!\n"); 155 return (EROFS); --- 149 unchanged lines hidden --- | 149{ 150 struct disk_devdesc *dev = (struct disk_devdesc *)devdata; 151 daddr_t bcount; 152 int err; 153 154 if (rw != F_READ) { 155 stor_printf("write attempt, operation not supported!\n"); 156 return (EROFS); --- 149 unchanged lines hidden --- |