blob: ed9d0b222ef668b7ac66d8ad103da83f1cb0f670 [file] [log] [blame]
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +00001/*
2 * This file is part of the flashrom project.
3 *
4 * Copyright (C) 2000 Silicon Integrated System Corporation
5 * Copyright (C) 2000 Ronald G. Minnich <rminnich@gmail.com>
6 * Copyright (C) 2005-2009 coresystems GmbH
7 * Copyright (C) 2006-2009 Carl-Daniel Hailfinger
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#ifndef __PROGRAMMER_H__
25#define __PROGRAMMER_H__ 1
26
27enum programmer {
28#if CONFIG_INTERNAL == 1
29 PROGRAMMER_INTERNAL,
30#endif
31#if CONFIG_DUMMY == 1
32 PROGRAMMER_DUMMY,
33#endif
34#if CONFIG_NIC3COM == 1
35 PROGRAMMER_NIC3COM,
36#endif
37#if CONFIG_NICREALTEK == 1
38 PROGRAMMER_NICREALTEK,
39 PROGRAMMER_NICREALTEK2,
Idwer Vollering004f4b72010-09-03 18:21:21 +000040#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +000041#if CONFIG_NICNATSEMI == 1
42 PROGRAMMER_NICNATSEMI,
Idwer Vollering004f4b72010-09-03 18:21:21 +000043#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +000044#if CONFIG_GFXNVIDIA == 1
45 PROGRAMMER_GFXNVIDIA,
46#endif
47#if CONFIG_DRKAISER == 1
48 PROGRAMMER_DRKAISER,
49#endif
50#if CONFIG_SATASII == 1
51 PROGRAMMER_SATASII,
52#endif
53#if CONFIG_ATAHPT == 1
54 PROGRAMMER_ATAHPT,
55#endif
56#if CONFIG_INTERNAL == 1
57#if defined(__i386__) || defined(__x86_64__)
58 PROGRAMMER_IT87SPI,
59#endif
60#endif
61#if CONFIG_FT2232_SPI == 1
62 PROGRAMMER_FT2232_SPI,
63#endif
64#if CONFIG_SERPROG == 1
65 PROGRAMMER_SERPROG,
66#endif
67#if CONFIG_BUSPIRATE_SPI == 1
68 PROGRAMMER_BUSPIRATE_SPI,
69#endif
70#if CONFIG_DEDIPROG == 1
71 PROGRAMMER_DEDIPROG,
72#endif
73#if CONFIG_RAYER_SPI == 1
74 PROGRAMMER_RAYER_SPI,
75#endif
Idwer Vollering004f4b72010-09-03 18:21:21 +000076#if CONFIG_NICINTEL_SPI == 1
77 PROGRAMMER_NICINTEL_SPI,
78#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +000079 PROGRAMMER_INVALID /* This must always be the last entry. */
80};
81
82extern enum programmer programmer;
83
84struct programmer_entry {
85 const char *vendor;
86 const char *name;
87
88 int (*init) (void);
89 int (*shutdown) (void);
90
91 void * (*map_flash_region) (const char *descr, unsigned long phys_addr,
92 size_t len);
93 void (*unmap_flash_region) (void *virt_addr, size_t len);
94
95 void (*chip_writeb) (uint8_t val, chipaddr addr);
96 void (*chip_writew) (uint16_t val, chipaddr addr);
97 void (*chip_writel) (uint32_t val, chipaddr addr);
98 void (*chip_writen) (uint8_t *buf, chipaddr addr, size_t len);
99 uint8_t (*chip_readb) (const chipaddr addr);
100 uint16_t (*chip_readw) (const chipaddr addr);
101 uint32_t (*chip_readl) (const chipaddr addr);
102 void (*chip_readn) (uint8_t *buf, const chipaddr addr, size_t len);
103 void (*delay) (int usecs);
104};
105
106extern const struct programmer_entry programmer_table[];
107
108int programmer_init(char *param);
109int programmer_shutdown(void);
110
111enum bitbang_spi_master_type {
112 BITBANG_SPI_INVALID = 0, /* This must always be the first entry. */
113#if CONFIG_RAYER_SPI == 1
114 BITBANG_SPI_MASTER_RAYER,
115#endif
Idwer Vollering004f4b72010-09-03 18:21:21 +0000116#if CONFIG_NICINTEL_SPI == 1
117 BITBANG_SPI_MASTER_NICINTEL,
118#endif
Carl-Daniel Hailfinger2f436162010-07-28 15:08:35 +0000119#if CONFIG_INTERNAL == 1
120#if defined(__i386__) || defined(__x86_64__)
121 BITBANG_SPI_MASTER_MCP,
122#endif
123#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000124};
125
126struct bitbang_spi_master {
127 enum bitbang_spi_master_type type;
128
129 /* Note that CS# is active low, so val=0 means the chip is active. */
130 void (*set_cs) (int val);
131 void (*set_sck) (int val);
132 void (*set_mosi) (int val);
133 int (*get_miso) (void);
Carl-Daniel Hailfinger28228882010-09-15 00:17:37 +0000134 void (*request_bus) (void);
135 void (*release_bus) (void);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000136};
137
138#if CONFIG_INTERNAL == 1
139struct penable {
140 uint16_t vendor_id;
141 uint16_t device_id;
142 int status;
143 const char *vendor_name;
144 const char *device_name;
145 int (*doit) (struct pci_dev *dev, const char *name);
146};
147
148extern const struct penable chipset_enables[];
149
150struct board_pciid_enable {
151 /* Any device, but make it sensible, like the ISA bridge. */
152 uint16_t first_vendor;
153 uint16_t first_device;
154 uint16_t first_card_vendor;
155 uint16_t first_card_device;
156
157 /* Any device, but make it sensible, like
158 * the host bridge. May be NULL.
159 */
160 uint16_t second_vendor;
161 uint16_t second_device;
162 uint16_t second_card_vendor;
163 uint16_t second_card_device;
164
165 /* Pattern to match DMI entries */
166 const char *dmi_pattern;
167
168 /* The vendor / part name from the coreboot table. */
169 const char *lb_vendor;
170 const char *lb_part;
171
172 const char *vendor_name;
173 const char *board_name;
174
175 int max_rom_decode_parallel;
176 int status;
177 int (*enable) (void);
178};
179
180extern const struct board_pciid_enable board_pciid_enables[];
181
182struct board_info {
183 const char *vendor;
184 const char *name;
185 const int working;
186#ifdef CONFIG_PRINT_WIKI
187 const char *url;
188 const char *note;
189#endif
190};
191
192extern const struct board_info boards_known[];
193extern const struct board_info laptops_known[];
194#endif
195
196/* udelay.c */
197void myusec_delay(int usecs);
198void myusec_calibrate_delay(void);
199void internal_delay(int usecs);
200
201#if NEED_PCI == 1
202/* pcidev.c */
203extern uint32_t io_base_addr;
204extern struct pci_access *pacc;
205extern struct pci_dev *pcidev_dev;
206struct pcidev_status {
207 uint16_t vendor_id;
208 uint16_t device_id;
209 int status;
210 const char *vendor_name;
211 const char *device_name;
212};
213uint32_t pcidev_validate(struct pci_dev *dev, uint32_t bar, const struct pcidev_status *devs);
214uint32_t pcidev_init(uint16_t vendor_id, uint32_t bar, const struct pcidev_status *devs);
Carl-Daniel Hailfinger2bee8cf2010-11-10 15:25:18 +0000215/* rpci_write_* are reversible writes. The original PCI config space register
216 * contents will be restored on shutdown.
217 */
218int rpci_write_byte(struct pci_dev *dev, int reg, u8 data);
219int rpci_write_word(struct pci_dev *dev, int reg, u16 data);
220int rpci_write_long(struct pci_dev *dev, int reg, u32 data);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000221#endif
222
223/* print.c */
Idwer Vollering004f4b72010-09-03 18:21:21 +0000224#if CONFIG_NIC3COM+CONFIG_NICREALTEK+CONFIG_NICNATSEMI+CONFIG_GFXNVIDIA+CONFIG_DRKAISER+CONFIG_SATASII+CONFIG_ATAHPT+CONFIG_NICINTEL_SPI >= 1
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000225void print_supported_pcidevs(const struct pcidev_status *devs);
226#endif
227
228/* board_enable.c */
229void w836xx_ext_enter(uint16_t port);
230void w836xx_ext_leave(uint16_t port);
231int it8705f_write_enable(uint8_t port);
232uint8_t sio_read(uint16_t port, uint8_t reg);
233void sio_write(uint16_t port, uint8_t reg, uint8_t data);
234void sio_mask(uint16_t port, uint8_t reg, uint8_t data, uint8_t mask);
235int board_flash_enable(const char *vendor, const char *part);
236
237/* chipset_enable.c */
238int chipset_flash_enable(void);
239
240/* processor_enable.c */
241int processor_flash_enable(void);
242
243/* physmap.c */
244void *physmap(const char *descr, unsigned long phys_addr, size_t len);
245void *physmap_try_ro(const char *descr, unsigned long phys_addr, size_t len);
246void physunmap(void *virt_addr, size_t len);
247int setup_cpu_msr(int cpu);
248void cleanup_cpu_msr(void);
249
250/* cbtable.c */
251void lb_vendor_dev_from_string(char *boardstring);
252int coreboot_init(void);
253extern char *lb_part, *lb_vendor;
254extern int partvendor_from_cbtable;
255
256/* dmi.c */
257extern int has_dmi_support;
258void dmi_init(void);
259int dmi_match(const char *pattern);
260
261/* internal.c */
262#if NEED_PCI == 1
263struct superio {
264 uint16_t vendor;
265 uint16_t port;
266 uint16_t model;
267};
268extern struct superio superio;
269#define SUPERIO_VENDOR_NONE 0x0
270#define SUPERIO_VENDOR_ITE 0x1
271struct pci_dev *pci_dev_find_filter(struct pci_filter filter);
272struct pci_dev *pci_dev_find_vendorclass(uint16_t vendor, uint16_t class);
273struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device);
274struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
275 uint16_t card_vendor, uint16_t card_device);
276#endif
277void get_io_perms(void);
278void release_io_perms(void);
279#if CONFIG_INTERNAL == 1
280extern int is_laptop;
281extern int force_boardenable;
282extern int force_boardmismatch;
283void probe_superio(void);
284int internal_init(void);
285int internal_shutdown(void);
286void internal_chip_writeb(uint8_t val, chipaddr addr);
287void internal_chip_writew(uint16_t val, chipaddr addr);
288void internal_chip_writel(uint32_t val, chipaddr addr);
289uint8_t internal_chip_readb(const chipaddr addr);
290uint16_t internal_chip_readw(const chipaddr addr);
291uint32_t internal_chip_readl(const chipaddr addr);
292void internal_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
293#endif
294
295/* hwaccess.c */
296void mmio_writeb(uint8_t val, void *addr);
297void mmio_writew(uint16_t val, void *addr);
298void mmio_writel(uint32_t val, void *addr);
299uint8_t mmio_readb(void *addr);
300uint16_t mmio_readw(void *addr);
301uint32_t mmio_readl(void *addr);
302void mmio_le_writeb(uint8_t val, void *addr);
303void mmio_le_writew(uint16_t val, void *addr);
304void mmio_le_writel(uint32_t val, void *addr);
305uint8_t mmio_le_readb(void *addr);
306uint16_t mmio_le_readw(void *addr);
307uint32_t mmio_le_readl(void *addr);
308#define pci_mmio_writeb mmio_le_writeb
309#define pci_mmio_writew mmio_le_writew
310#define pci_mmio_writel mmio_le_writel
311#define pci_mmio_readb mmio_le_readb
312#define pci_mmio_readw mmio_le_readw
313#define pci_mmio_readl mmio_le_readl
314
315/* programmer.c */
316int noop_shutdown(void);
317void *fallback_map(const char *descr, unsigned long phys_addr, size_t len);
318void fallback_unmap(void *virt_addr, size_t len);
319uint8_t noop_chip_readb(const chipaddr addr);
320void noop_chip_writeb(uint8_t val, chipaddr addr);
321void fallback_chip_writew(uint16_t val, chipaddr addr);
322void fallback_chip_writel(uint32_t val, chipaddr addr);
323void fallback_chip_writen(uint8_t *buf, chipaddr addr, size_t len);
324uint16_t fallback_chip_readw(const chipaddr addr);
325uint32_t fallback_chip_readl(const chipaddr addr);
326void fallback_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
327
328/* dummyflasher.c */
329#if CONFIG_DUMMY == 1
330int dummy_init(void);
331int dummy_shutdown(void);
332void *dummy_map(const char *descr, unsigned long phys_addr, size_t len);
333void dummy_unmap(void *virt_addr, size_t len);
334void dummy_chip_writeb(uint8_t val, chipaddr addr);
335void dummy_chip_writew(uint16_t val, chipaddr addr);
336void dummy_chip_writel(uint32_t val, chipaddr addr);
337void dummy_chip_writen(uint8_t *buf, chipaddr addr, size_t len);
338uint8_t dummy_chip_readb(const chipaddr addr);
339uint16_t dummy_chip_readw(const chipaddr addr);
340uint32_t dummy_chip_readl(const chipaddr addr);
341void dummy_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
342int dummy_spi_send_command(unsigned int writecnt, unsigned int readcnt,
343 const unsigned char *writearr, unsigned char *readarr);
344int dummy_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
345int dummy_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
346#endif
347
348/* nic3com.c */
349#if CONFIG_NIC3COM == 1
350int nic3com_init(void);
351int nic3com_shutdown(void);
352void nic3com_chip_writeb(uint8_t val, chipaddr addr);
353uint8_t nic3com_chip_readb(const chipaddr addr);
354extern const struct pcidev_status nics_3com[];
355#endif
356
357/* gfxnvidia.c */
358#if CONFIG_GFXNVIDIA == 1
359int gfxnvidia_init(void);
360int gfxnvidia_shutdown(void);
361void gfxnvidia_chip_writeb(uint8_t val, chipaddr addr);
362uint8_t gfxnvidia_chip_readb(const chipaddr addr);
363extern const struct pcidev_status gfx_nvidia[];
364#endif
365
366/* drkaiser.c */
367#if CONFIG_DRKAISER == 1
368int drkaiser_init(void);
369int drkaiser_shutdown(void);
370void drkaiser_chip_writeb(uint8_t val, chipaddr addr);
371uint8_t drkaiser_chip_readb(const chipaddr addr);
372extern const struct pcidev_status drkaiser_pcidev[];
373#endif
374
375/* nicrealtek.c */
376#if CONFIG_NICREALTEK == 1
377int nicrealtek_init(void);
378int nicsmc1211_init(void);
379int nicrealtek_shutdown(void);
380void nicrealtek_chip_writeb(uint8_t val, chipaddr addr);
381uint8_t nicrealtek_chip_readb(const chipaddr addr);
382extern const struct pcidev_status nics_realtek[];
383extern const struct pcidev_status nics_realteksmc1211[];
384#endif
385
386/* nicnatsemi.c */
387#if CONFIG_NICNATSEMI == 1
388int nicnatsemi_init(void);
389int nicnatsemi_shutdown(void);
390void nicnatsemi_chip_writeb(uint8_t val, chipaddr addr);
391uint8_t nicnatsemi_chip_readb(const chipaddr addr);
392extern const struct pcidev_status nics_natsemi[];
393#endif
394
Idwer Vollering004f4b72010-09-03 18:21:21 +0000395/* nicintel_spi.c */
396#if CONFIG_NICINTEL_SPI == 1
397int nicintel_spi_init(void);
398int nicintel_spi_shutdown(void);
399int nicintel_spi_send_command(unsigned int writecnt, unsigned int readcnt,
400 const unsigned char *writearr, unsigned char *readarr);
401void nicintel_spi_chip_writeb(uint8_t val, chipaddr addr);
402extern const struct pcidev_status nics_intel_spi[];
403#endif
404
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000405/* satasii.c */
406#if CONFIG_SATASII == 1
407int satasii_init(void);
408int satasii_shutdown(void);
409void satasii_chip_writeb(uint8_t val, chipaddr addr);
410uint8_t satasii_chip_readb(const chipaddr addr);
411extern const struct pcidev_status satas_sii[];
412#endif
413
414/* atahpt.c */
415#if CONFIG_ATAHPT == 1
416int atahpt_init(void);
417int atahpt_shutdown(void);
418void atahpt_chip_writeb(uint8_t val, chipaddr addr);
419uint8_t atahpt_chip_readb(const chipaddr addr);
420extern const struct pcidev_status ata_hpt[];
421#endif
422
423/* ft2232_spi.c */
Jörg Fischer6529b9f2010-07-29 15:54:53 +0000424#if CONFIG_FT2232_SPI == 1
425struct usbdev_status {
Uwe Hermann48ec1b12010-08-08 17:01:18 +0000426 uint16_t vendor_id;
427 uint16_t device_id;
428 int status;
429 const char *vendor_name;
430 const char *device_name;
Jörg Fischer6529b9f2010-07-29 15:54:53 +0000431};
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000432int ft2232_spi_init(void);
433int ft2232_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
434int ft2232_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
435int ft2232_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
Jörg Fischer6529b9f2010-07-29 15:54:53 +0000436extern const struct usbdev_status devs_ft2232spi[];
437void print_supported_usbdevs(const struct usbdev_status *devs);
438#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000439
440/* rayer_spi.c */
441#if CONFIG_RAYER_SPI == 1
442int rayer_spi_init(void);
443#endif
444
Carl-Daniel Hailfinger2f436162010-07-28 15:08:35 +0000445/* mcp6x_spi.c */
446#if CONFIG_INTERNAL == 1
447#if defined(__i386__) || defined(__x86_64__)
448int mcp6x_spi_init(int want_spi);
449#endif
450#endif
451
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000452/* bitbang_spi.c */
453int bitbang_spi_init(const struct bitbang_spi_master *master, int halfperiod);
Carl-Daniel Hailfinger28228882010-09-15 00:17:37 +0000454int bitbang_spi_shutdown(const struct bitbang_spi_master *master);
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000455int bitbang_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
456int bitbang_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
457int bitbang_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
458
459/* buspirate_spi.c */
460struct buspirate_spispeeds {
461 const char *name;
462 const int speed;
463};
464int buspirate_spi_init(void);
465int buspirate_spi_shutdown(void);
466int buspirate_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
467int buspirate_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
468int buspirate_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
469
470/* dediprog.c */
471int dediprog_init(void);
472int dediprog_shutdown(void);
473int dediprog_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
474int dediprog_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
475
476/* flashrom.c */
477struct decode_sizes {
478 uint32_t parallel;
479 uint32_t lpc;
480 uint32_t fwh;
481 uint32_t spi;
482};
483extern struct decode_sizes max_rom_decode;
484extern int programmer_may_write;
485extern unsigned long flashbase;
486void check_chip_supported(struct flashchip *flash);
487int check_max_decode(enum chipbustype buses, uint32_t size);
488char *extract_programmer_param(char *param_name);
489
490/* layout.c */
491int show_id(uint8_t *bios, int size, int force);
492
493/* spi.c */
494enum spi_controller {
495 SPI_CONTROLLER_NONE,
496#if CONFIG_INTERNAL == 1
497#if defined(__i386__) || defined(__x86_64__)
498 SPI_CONTROLLER_ICH7,
499 SPI_CONTROLLER_ICH9,
500 SPI_CONTROLLER_IT87XX,
501 SPI_CONTROLLER_SB600,
502 SPI_CONTROLLER_VIA,
503 SPI_CONTROLLER_WBSIO,
Carl-Daniel Hailfinger2f436162010-07-28 15:08:35 +0000504 SPI_CONTROLLER_MCP6X_BITBANG,
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000505#endif
506#endif
507#if CONFIG_FT2232_SPI == 1
508 SPI_CONTROLLER_FT2232,
509#endif
510#if CONFIG_DUMMY == 1
511 SPI_CONTROLLER_DUMMY,
512#endif
513#if CONFIG_BUSPIRATE_SPI == 1
514 SPI_CONTROLLER_BUSPIRATE,
515#endif
516#if CONFIG_DEDIPROG == 1
517 SPI_CONTROLLER_DEDIPROG,
518#endif
519#if CONFIG_RAYER_SPI == 1
520 SPI_CONTROLLER_RAYER,
521#endif
Idwer Vollering004f4b72010-09-03 18:21:21 +0000522#if CONFIG_NICINTEL_SPI == 1
523 SPI_CONTROLLER_NICINTEL,
524#endif
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +0000525 SPI_CONTROLLER_INVALID /* This must always be the last entry. */
526};
527extern const int spi_programmer_count;
528struct spi_programmer {
529 int (*command)(unsigned int writecnt, unsigned int readcnt,
530 const unsigned char *writearr, unsigned char *readarr);
531 int (*multicommand)(struct spi_command *cmds);
532
533 /* Optimized functions for this programmer */
534 int (*read)(struct flashchip *flash, uint8_t *buf, int start, int len);
535 int (*write_256)(struct flashchip *flash, uint8_t *buf, int start, int len);
536};
537
538extern enum spi_controller spi_controller;
539extern const struct spi_programmer spi_programmer[];
540int default_spi_send_command(unsigned int writecnt, unsigned int readcnt,
541 const unsigned char *writearr, unsigned char *readarr);
542int default_spi_send_multicommand(struct spi_command *cmds);
543
544/* ichspi.c */
545#if CONFIG_INTERNAL == 1
546extern uint32_t ichspi_bbar;
547int ich_init_spi(struct pci_dev *dev, uint32_t base, void *rcrb,
548 int ich_generation);
549int via_init_spi(struct pci_dev *dev);
550int ich_spi_send_command(unsigned int writecnt, unsigned int readcnt,
551 const unsigned char *writearr, unsigned char *readarr);
552int ich_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
553int ich_spi_write_256(struct flashchip *flash, uint8_t * buf, int start, int len);
554int ich_spi_send_multicommand(struct spi_command *cmds);
555#endif
556
557/* it87spi.c */
558void enter_conf_mode_ite(uint16_t port);
559void exit_conf_mode_ite(uint16_t port);
560struct superio probe_superio_ite(void);
561int init_superio_ite(void);
562int it87spi_init(void);
563int it8716f_spi_send_command(unsigned int writecnt, unsigned int readcnt,
564 const unsigned char *writearr, unsigned char *readarr);
565int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, int len);
566int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
567
568/* sb600spi.c */
569#if CONFIG_INTERNAL == 1
570int sb600_probe_spi(struct pci_dev *dev);
571int sb600_spi_send_command(unsigned int writecnt, unsigned int readcnt,
572 const unsigned char *writearr, unsigned char *readarr);
573int sb600_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
574int sb600_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
575#endif
576
577/* wbsio_spi.c */
578#if CONFIG_INTERNAL == 1
579int wbsio_check_for_spi(void);
580int wbsio_spi_send_command(unsigned int writecnt, unsigned int readcnt,
581 const unsigned char *writearr, unsigned char *readarr);
582int wbsio_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
583#endif
584
585/* serprog.c */
586int serprog_init(void);
587int serprog_shutdown(void);
588void serprog_chip_writeb(uint8_t val, chipaddr addr);
589uint8_t serprog_chip_readb(const chipaddr addr);
590void serprog_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
591void serprog_delay(int delay);
592
593/* serial.c */
594#if _WIN32
595typedef HANDLE fdtype;
596#else
597typedef int fdtype;
598#endif
599
600void sp_flush_incoming(void);
601fdtype sp_openserport(char *dev, unsigned int baud);
602void __attribute__((noreturn)) sp_die(char *msg);
603extern fdtype sp_fd;
604int serialport_shutdown(void);
605int serialport_write(unsigned char *buf, unsigned int writecnt);
606int serialport_read(unsigned char *buf, unsigned int readcnt);
607
608#endif /* !__PROGRAMMER_H__ */