opal_flash.c (bc60451a47c24f390fe807010e4eb9e16e6c37c1) opal_flash.c (93096fecb66a1dcc37c255b0625e9bd94d9c5c03)
1/*-
2 * Copyright (c) 2019 Justin Hibbits
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 225 unchanged lines hidden (view full) ---

234static int
235opalflash_write(struct opalflash_softc *sc, off_t off,
236 caddr_t data, off_t count)
237{
238 struct opal_msg msg;
239 int rv, size, token;
240
241 /* Ensure we write aligned to a full block size. */
1/*-
2 * Copyright (c) 2019 Justin Hibbits
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 225 unchanged lines hidden (view full) ---

234static int
235opalflash_write(struct opalflash_softc *sc, off_t off,
236 caddr_t data, off_t count)
237{
238 struct opal_msg msg;
239 int rv, size, token;
240
241 /* Ensure we write aligned to a full block size. */
242 if (off % sc->sc_disk->d_stripesize != 0 ||
243 count % sc->sc_disk->d_stripesize != 0)
242 if (off % sc->sc_disk->d_sectorsize != 0 ||
243 count % sc->sc_disk->d_sectorsize != 0)
244 return (EIO);
245
246 if (sc->sc_erase) {
247 /* Erase the full block first, then write in page chunks. */
248 rv = opalflash_erase(sc, off, count);
249 if (rv != 0)
250 return (rv);
251 }

--- 141 unchanged lines hidden ---
244 return (EIO);
245
246 if (sc->sc_erase) {
247 /* Erase the full block first, then write in page chunks. */
248 rv = opalflash_erase(sc, off, count);
249 if (rv != 0)
250 return (rv);
251 }

--- 141 unchanged lines hidden ---